Showing
9 changed files
with
138 additions
and
6 deletions
| ... | ... | @@ -96,4 +96,18 @@ public class ShipmentsPlanDetailController extends DefaultBaseController { |
| 96 | 96 | shipmentsPlanDetailService.update(vo); |
| 97 | 97 | return InvokeResultBuilder.success(); |
| 98 | 98 | } |
| 99 | + | |
| 100 | + /** | |
| 101 | + * 获取可以发货的订货单规格数据 | |
| 102 | + */ | |
| 103 | + @ApiOperation("查询列表") | |
| 104 | + @GetMapping("/queryCanShipmentsData") | |
| 105 | + public InvokeResult<PageResult<ShipmentsPlanDetailBo>> queryCanShipmentsData(@Valid QueryShipmentsPlanDetailVo vo) { | |
| 106 | + PageResult<ShipmentsPlanDetail> pageResult = shipmentsPlanDetailService.queryCanShipmentsData(getPageIndex(vo), getPageSize(vo), vo); | |
| 107 | + List<ShipmentsPlanDetailBo> results = null; | |
| 108 | + if (!CollectionUtil.isEmpty(pageResult.getDatas())) { | |
| 109 | + results = pageResult.getDatas().stream().map(ShipmentsPlanDetailBo::new).collect(Collectors.toList()); | |
| 110 | + } | |
| 111 | + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); | |
| 112 | + } | |
| 99 | 113 | } | ... | ... |
| ... | ... | @@ -139,6 +139,11 @@ public class ShipmentsPlanDetail extends BaseEntity implements BaseDto { |
| 139 | 139 | private LocalTime shipmentsTime; |
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | + * 是否预发 | |
| 143 | + */ | |
| 144 | + private Boolean preShipments; | |
| 145 | + | |
| 146 | + /** | |
| 142 | 147 | * 是否可以发货 |
| 143 | 148 | */ |
| 144 | 149 | private Boolean canShipments; | ... | ... |
| 1 | 1 | package com.lframework.xingyun.sc.impl.shipments; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 3 | 4 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 4 | 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | 6 | import com.github.pagehelper.PageInfo; |
| 6 | 7 | import com.lframework.starter.web.core.components.security.SecurityUtil; |
| 7 | 8 | import com.lframework.xingyun.sc.entity.PurchaseOrderLine; |
| 9 | +import com.lframework.xingyun.sc.entity.ShipmentsPlan; | |
| 8 | 10 | import com.lframework.xingyun.sc.entity.ShipmentsPlanDetail; |
| 9 | 11 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 10 | 12 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| ... | ... | @@ -20,6 +22,7 @@ import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 20 | 22 | import com.lframework.xingyun.sc.mappers.ShipmentsPlanDetailMapper; |
| 21 | 23 | import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; |
| 22 | 24 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; |
| 25 | +import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService; | |
| 23 | 26 | import com.lframework.xingyun.sc.vo.shipments.plan.CreateShipmentsPlanDetailVo; |
| 24 | 27 | import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; |
| 25 | 28 | import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanDetailVo; |
| ... | ... | @@ -28,6 +31,7 @@ import org.springframework.stereotype.Service; |
| 28 | 31 | import org.springframework.transaction.annotation.Transactional; |
| 29 | 32 | |
| 30 | 33 | import javax.annotation.Resource; |
| 34 | +import java.time.LocalDate; | |
| 31 | 35 | import java.util.ArrayList; |
| 32 | 36 | import java.util.List; |
| 33 | 37 | import java.util.Map; |
| ... | ... | @@ -39,6 +43,9 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 39 | 43 | |
| 40 | 44 | @Resource |
| 41 | 45 | private PurchaseOrderLineService purchaseOrderLineService; |
| 46 | + @Resource | |
| 47 | + private ShipmentsPlanService shipmentsPlanService; | |
| 48 | + | |
| 42 | 49 | |
| 43 | 50 | @Override |
| 44 | 51 | public PageResult<ShipmentsPlanDetail> query(Integer pageIndex, Integer pageSize, QueryShipmentsPlanDetailVo vo) { |
| ... | ... | @@ -68,6 +75,10 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 68 | 75 | @Transactional(rollbackFor = Exception.class) |
| 69 | 76 | @Override |
| 70 | 77 | public void create(CreateShipmentsPlanDetailVo vo) { |
| 78 | + ShipmentsPlan plan = shipmentsPlanService.getById(vo.getPlanId()); | |
| 79 | + if (plan == null) { | |
| 80 | + throw new DefaultClientException("发货计划不存在!"); | |
| 81 | + } | |
| 71 | 82 | List<String> orderSpecIds = vo.getOrderSpecIds(); |
| 72 | 83 | if (CollectionUtils.isEmpty(orderSpecIds)) { |
| 73 | 84 | throw new DefaultClientException("订货单规格ID不能为空!"); |
| ... | ... | @@ -87,6 +98,10 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 87 | 98 | data.setOrderId(orderIdMap.get(specId)); |
| 88 | 99 | data.setOrderSpecId(specId); |
| 89 | 100 | data.setShipmentsDate(vo.getShipmentDate()); |
| 101 | + // 判断是否预发 | |
| 102 | + LocalDate afTomoPreShipDate = plan.getAfTomoPreShipDate(); | |
| 103 | + data.setPreShipments(afTomoPreShipDate.equals(vo.getShipmentDate())); | |
| 104 | + | |
| 90 | 105 | data.setCreateById(userId); |
| 91 | 106 | data.setUpdateById(userId); |
| 92 | 107 | data.setDelFlag(false); |
| ... | ... | @@ -116,4 +131,30 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 116 | 131 | OpLogUtil.setVariable("id", data.getId()); |
| 117 | 132 | OpLogUtil.setExtra(vo); |
| 118 | 133 | } |
| 134 | + | |
| 135 | + /** | |
| 136 | + * 获取可以发货的列表数据 | |
| 137 | + * | |
| 138 | + * @param pageIndex 分页页码 | |
| 139 | + * @param pageSize 分页大小 | |
| 140 | + * @param vo 查询条件 | |
| 141 | + * @return PageResult<ShipmentsPlanDetail> | |
| 142 | + */ | |
| 143 | + @Override | |
| 144 | + public PageResult<ShipmentsPlanDetail> queryCanShipmentsData(Integer pageIndex, Integer pageSize, QueryShipmentsPlanDetailVo vo) { | |
| 145 | + // 获取已经加入发货计划的订货单规格id | |
| 146 | + LambdaQueryWrapper<ShipmentsPlanDetail> queryWrapper = Wrappers.lambdaQuery(ShipmentsPlanDetail.class); | |
| 147 | + queryWrapper.eq(ShipmentsPlanDetail::getPreShipments, Boolean.FALSE) | |
| 148 | + .select(ShipmentsPlanDetail::getOrderSpecId); | |
| 149 | + List<ShipmentsPlanDetail> shipmentsPlanDetails = getBaseMapper().selectList(queryWrapper); | |
| 150 | + if (CollectionUtils.isNotEmpty(shipmentsPlanDetails)) { | |
| 151 | + List<String> orderSpecIds = shipmentsPlanDetails.stream().map(ShipmentsPlanDetail::getId).collect(Collectors.toList()); | |
| 152 | + vo.setOrderSpecIds(orderSpecIds); | |
| 153 | + } | |
| 154 | + // 开启分页 | |
| 155 | + PageHelperUtil.startPage(pageIndex, pageSize); | |
| 156 | + List<ShipmentsPlanDetail> dataList = getBaseMapper().queryCanShipmentsData(LocalDate.now(), vo); | |
| 157 | + | |
| 158 | + return PageResultUtil.convert(new PageInfo<>(dataList)); | |
| 159 | + } | |
| 119 | 160 | } | ... | ... |
| ... | ... | @@ -15,7 +15,6 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; |
| 15 | 15 | import com.lframework.starter.web.core.utils.PageHelperUtil; |
| 16 | 16 | import com.lframework.starter.common.utils.Assert; |
| 17 | 17 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 18 | -import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; | |
| 19 | 18 | import org.springframework.transaction.annotation.Transactional; |
| 20 | 19 | import com.lframework.xingyun.sc.mappers.ShipmentsPlanMapper; |
| 21 | 20 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService; |
| ... | ... | @@ -24,15 +23,12 @@ import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanVo; |
| 24 | 23 | import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanVo; |
| 25 | 24 | import org.springframework.stereotype.Service; |
| 26 | 25 | |
| 27 | -import javax.annotation.Resource; | |
| 28 | 26 | import java.util.List; |
| 29 | 27 | |
| 30 | 28 | @Service |
| 31 | 29 | public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMapper, ShipmentsPlan> implements ShipmentsPlanService { |
| 32 | 30 | |
| 33 | 31 | |
| 34 | - @Resource | |
| 35 | - private ShipmentsPlanDetailService shipmentsPlanDetailService;; | |
| 36 | 32 | |
| 37 | 33 | |
| 38 | 34 | @Override | ... | ... |
| ... | ... | @@ -5,6 +5,7 @@ import com.lframework.starter.web.core.mapper.BaseMapper; |
| 5 | 5 | import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; |
| 6 | 6 | import org.apache.ibatis.annotations.Param; |
| 7 | 7 | |
| 8 | +import java.time.LocalDate; | |
| 8 | 9 | import java.util.List; |
| 9 | 10 | |
| 10 | 11 | /** |
| ... | ... | @@ -29,4 +30,13 @@ public interface ShipmentsPlanDetailMapper extends BaseMapper<ShipmentsPlanDetai |
| 29 | 30 | * @param dataList 数据实体 |
| 30 | 31 | */ |
| 31 | 32 | void batchAdd(List<ShipmentsPlanDetail> dataList); |
| 33 | + | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 获取可以发货的列表数据 | |
| 37 | + * | |
| 38 | + * @param vo 查询条件 | |
| 39 | + * @return List<ShipmentsPlanDetail> | |
| 40 | + */ | |
| 41 | + List<ShipmentsPlanDetail> queryCanShipmentsData(@Param("shipmentsDate") LocalDate shipmentsDate, @Param("vo") QueryShipmentsPlanDetailVo vo); | |
| 32 | 42 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/shipments/ShipmentsPlanDetailService.java
| ... | ... | @@ -73,4 +73,13 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD |
| 73 | 73 | */ |
| 74 | 74 | void update(UpdateShipmentsPlanDetailVo vo); |
| 75 | 75 | |
| 76 | + /** | |
| 77 | + * 获取可以发货的列表数据 | |
| 78 | + * | |
| 79 | + * @param pageIndex 分页页码 | |
| 80 | + * @param pageSize 分页大小 | |
| 81 | + * @param vo 查询条件 | |
| 82 | + * @return PageResult<ShipmentsPlanDetail> | |
| 83 | + */ | |
| 84 | + PageResult<ShipmentsPlanDetail> queryCanShipmentsData(Integer pageIndex, Integer pageSize, QueryShipmentsPlanDetailVo vo); | |
| 76 | 85 | } | ... | ... |
| ... | ... | @@ -4,6 +4,8 @@ import javax.validation.constraints.NotBlank; |
| 4 | 4 | import com.lframework.starter.web.core.vo.BaseVo; |
| 5 | 5 | |
| 6 | 6 | import javax.validation.constraints.NotEmpty; |
| 7 | +import javax.validation.constraints.NotNull; | |
| 8 | + | |
| 7 | 9 | import io.swagger.annotations.ApiModelProperty; |
| 8 | 10 | import org.hibernate.validator.constraints.Length; |
| 9 | 11 | import java.io.Serializable; |
| ... | ... | @@ -28,13 +30,14 @@ public class CreateShipmentsPlanDetailVo implements BaseVo, Serializable { |
| 28 | 30 | /** |
| 29 | 31 | * 订货单规格ID集合 |
| 30 | 32 | */ |
| 31 | - @ApiModelProperty(value = "订货单ID", required = true) | |
| 32 | - @NotEmpty(message = "请输入订货单ID!") | |
| 33 | + @ApiModelProperty(value = "订货单规格ID", required = true) | |
| 34 | + @NotEmpty(message = "请输入订货单规格ID!") | |
| 33 | 35 | private List<String> orderSpecIds; |
| 34 | 36 | |
| 35 | 37 | /** |
| 36 | 38 | * 发货日期 |
| 37 | 39 | */ |
| 38 | 40 | @ApiModelProperty(value = "发货日期") |
| 41 | + @NotNull(message = "请输入发货日期!") | |
| 39 | 42 | private LocalDate shipmentDate; |
| 40 | 43 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/plan/QueryShipmentsPlanDetailVo.java
| ... | ... | @@ -7,6 +7,7 @@ import com.lframework.starter.web.core.vo.BaseVo; |
| 7 | 7 | import com.lframework.starter.web.core.components.validation.TypeMismatch; |
| 8 | 8 | import io.swagger.annotations.ApiModelProperty; |
| 9 | 9 | import java.io.Serializable; |
| 10 | +import java.util.List; | |
| 10 | 11 | |
| 11 | 12 | @Data |
| 12 | 13 | public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serializable { |
| ... | ... | @@ -25,4 +26,22 @@ public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serial |
| 25 | 26 | @ApiModelProperty("发货日期") |
| 26 | 27 | @TypeMismatch(message = "发货日期格式有误!") |
| 27 | 28 | private LocalDate shipmentsDate; |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 订货单规格ID集合 | |
| 32 | + */ | |
| 33 | + @ApiModelProperty("订货单规格ID集合") | |
| 34 | + private List<String> orderSpecIds; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 订货单编号 | |
| 38 | + */ | |
| 39 | + @ApiModelProperty("订货单编号") | |
| 40 | + private String orderNo; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 客户名称 | |
| 44 | + */ | |
| 45 | + @ApiModelProperty("客户名称") | |
| 46 | + private String customerName; | |
| 28 | 47 | } | ... | ... |
| ... | ... | @@ -86,6 +86,7 @@ |
| 86 | 86 | status, |
| 87 | 87 | shipments_date, |
| 88 | 88 | shipments_time, |
| 89 | + pre_shipments, | |
| 89 | 90 | can_shipments, |
| 90 | 91 | del_flag, |
| 91 | 92 | create_by_id, |
| ... | ... | @@ -103,6 +104,7 @@ |
| 103 | 104 | #{item.status}, |
| 104 | 105 | #{item.shipmentsDate}, |
| 105 | 106 | #{item.shipmentsTime}, |
| 107 | + #{item.preShipments}, | |
| 106 | 108 | #{item.canShipments}, |
| 107 | 109 | #{item.delFlag}, |
| 108 | 110 | #{item.createById}, |
| ... | ... | @@ -112,4 +114,37 @@ |
| 112 | 114 | ) |
| 113 | 115 | </foreach> |
| 114 | 116 | </insert> |
| 117 | + | |
| 118 | + <select id="queryCanShipmentsData" resultType="com.lframework.xingyun.sc.entity.ShipmentsPlanDetail"> | |
| 119 | + select | |
| 120 | + o.id as order_id, | |
| 121 | + o.order_no, | |
| 122 | + c.name AS customer_name, | |
| 123 | + ol.thickness, | |
| 124 | + ol.thickness_tol_pos, | |
| 125 | + ol.thickness_tol_neg, | |
| 126 | + ol.width, | |
| 127 | + ol.width_tol_pos, | |
| 128 | + ol.width_tol_neg, | |
| 129 | + ol.length, | |
| 130 | + ol.length_tol_pos, | |
| 131 | + ol.length_tol_neg, | |
| 132 | + ol.quantity | |
| 133 | + from tbl_purchase_order_line ol | |
| 134 | + inner join purchase_order_info o on ol.purchase_order_id = o.id | |
| 135 | + left join base_data_customer c on o.ordering_unit = c.id | |
| 136 | + where ol.delivery_date >= #{shipmentsDate} | |
| 137 | + <if test="vo.orderSpecIds != null and vo.orderSpecIds.size() > 0"> | |
| 138 | + and ol.id not in | |
| 139 | + <foreach collection="vo.orderSpecIds" open="(" separator="," close=")" item="item"> | |
| 140 | + #{item} | |
| 141 | + </foreach> | |
| 142 | + </if> | |
| 143 | + <if test="vo.orderNo != null and vo.orderNo != ''"> | |
| 144 | + AND o.order_no like concat('%', #{vo.orderNo}, '%') | |
| 145 | + </if> | |
| 146 | + <if test="vo.customerName != null and vo.customerName != ''"> | |
| 147 | + AND c.name like concat('%', #{vo.customerName}, '%') | |
| 148 | + </if> | |
| 149 | + </select> | |
| 115 | 150 | </mapper> | ... | ... |