Commit b29ae7df90b630d3b774aea2cb72c4d951f01d31
1 parent
caa13938
楚江ERP-1、订货单变更增加模糊搜索;2、增加可以补货的订货单数据;3、发货计划状态逻辑调整;4、新增发货明细bug修复;5、生成发货单列表数据逻辑调整;
Showing
9 changed files
with
89 additions
and
12 deletions
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| @@ -267,6 +267,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | @@ -267,6 +267,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | ||
| 267 | List<List<ShipmentsPlanDetail>> batchList = CommonUtil.partition(detailList, 8); | 267 | List<List<ShipmentsPlanDetail>> batchList = CommonUtil.partition(detailList, 8); |
| 268 | handleBatchData(batchList, planId); | 268 | handleBatchData(batchList, planId); |
| 269 | } | 269 | } |
| 270 | + // 更细发货计划状态 | ||
| 271 | + shipmentsPlanDetailService.completed(planId); | ||
| 270 | } | 272 | } |
| 271 | 273 | ||
| 272 | 274 |
| @@ -23,10 +23,7 @@ import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; | @@ -23,10 +23,7 @@ import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; | ||
| 23 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; | 23 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; |
| 24 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService; | 24 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService; |
| 25 | import com.lframework.xingyun.sc.utils.CommonUtil; | 25 | import com.lframework.xingyun.sc.utils.CommonUtil; |
| 26 | -import com.lframework.xingyun.sc.vo.shipments.plan.CreateShipmentsPlanDetailVo; | ||
| 27 | -import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; | ||
| 28 | -import com.lframework.xingyun.sc.vo.shipments.plan.ShipmentsPlanDetailSplitVo; | ||
| 29 | -import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanDetailVo; | 26 | +import com.lframework.xingyun.sc.vo.shipments.plan.*; |
| 30 | import org.apache.commons.collections4.CollectionUtils; | 27 | import org.apache.commons.collections4.CollectionUtils; |
| 31 | import org.apache.commons.lang3.StringUtils; | 28 | import org.apache.commons.lang3.StringUtils; |
| 32 | import org.springframework.stereotype.Service; | 29 | import org.springframework.stereotype.Service; |
| @@ -148,13 +145,14 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | @@ -148,13 +145,14 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | ||
| 148 | */ | 145 | */ |
| 149 | @Override | 146 | @Override |
| 150 | public PageResult<ShipmentsPlanDetail> queryCanShipmentsData(Integer pageIndex, Integer pageSize, QueryShipmentsPlanDetailVo vo) { | 147 | public PageResult<ShipmentsPlanDetail> queryCanShipmentsData(Integer pageIndex, Integer pageSize, QueryShipmentsPlanDetailVo vo) { |
| 151 | - // 获取已经加入发货计划的订货单规格id | ||
| 152 | - LambdaQueryWrapper<ShipmentsPlanDetail> queryWrapper = Wrappers.lambdaQuery(ShipmentsPlanDetail.class); | ||
| 153 | - queryWrapper.eq(ShipmentsPlanDetail::getPreShipments, Boolean.FALSE) | ||
| 154 | - .select(ShipmentsPlanDetail::getOrderSpecId); | ||
| 155 | - List<ShipmentsPlanDetail> shipmentsPlanDetails = getBaseMapper().selectList(queryWrapper); | ||
| 156 | - if (CollectionUtils.isNotEmpty(shipmentsPlanDetails)) { | ||
| 157 | - List<String> orderSpecIds = shipmentsPlanDetails.stream().map(ShipmentsPlanDetail::getOrderSpecId).collect(Collectors.toList()); | 148 | + // 获取发货计划数据 |
| 149 | + ShipmentsPlan plan = shipmentsPlanService.findById(vo.getPlanId()); | ||
| 150 | + if (plan == null) { | ||
| 151 | + throw new DefaultClientException("发货计划不存在!"); | ||
| 152 | + } | ||
| 153 | + // 获取已经存在的明细数据 | ||
| 154 | + List<String> orderSpecIds = getBaseMapper().getExistsOrderSpecIds(plan.getAfTomoPreShipDate()); | ||
| 155 | + if (CollectionUtils.isNotEmpty(orderSpecIds)) { | ||
| 158 | vo.setOrderSpecIds(orderSpecIds); | 156 | vo.setOrderSpecIds(orderSpecIds); |
| 159 | } | 157 | } |
| 160 | // 开启分页 | 158 | // 开启分页 |
| @@ -324,6 +322,26 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | @@ -324,6 +322,26 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | ||
| 324 | return getBaseMapper().listByPlanId(planId); | 322 | return getBaseMapper().listByPlanId(planId); |
| 325 | } | 323 | } |
| 326 | 324 | ||
| 325 | + @Override | ||
| 326 | + public void completed(String planId) { | ||
| 327 | + if (StringUtils.isBlank(planId)) { | ||
| 328 | + return; | ||
| 329 | + } | ||
| 330 | + LambdaQueryWrapper<ShipmentsPlanDetail> queryWrapper = Wrappers.lambdaQuery(ShipmentsPlanDetail.class); | ||
| 331 | + queryWrapper.eq(ShipmentsPlanDetail::getPlanId, planId) | ||
| 332 | + .and(wrapper -> wrapper.isNull(ShipmentsPlanDetail::getShipmentOrderId) | ||
| 333 | + .or() | ||
| 334 | + .eq(ShipmentsPlanDetail::getShipmentOrderId, "")); | ||
| 335 | + Integer count = getBaseMapper().selectCount(queryWrapper); | ||
| 336 | + if (count == 0) { | ||
| 337 | + // 已全部完成 | ||
| 338 | + UpdateShipmentsPlanVo planVo = new UpdateShipmentsPlanVo(); | ||
| 339 | + planVo.setId(planId); | ||
| 340 | + planVo.setStatus("COMPLETED"); | ||
| 341 | + shipmentsPlanService.update(planVo); | ||
| 342 | + } | ||
| 343 | + } | ||
| 344 | + | ||
| 327 | 345 | ||
| 328 | /** | 346 | /** |
| 329 | * 封装发货计划明细数据 | 347 | * 封装发货计划明细数据 |
| @@ -63,4 +63,13 @@ public interface ShipmentsPlanDetailMapper extends BaseMapper<ShipmentsPlanDetai | @@ -63,4 +63,13 @@ public interface ShipmentsPlanDetailMapper extends BaseMapper<ShipmentsPlanDetai | ||
| 63 | * @return ShipmentsPlanDetail | 63 | * @return ShipmentsPlanDetail |
| 64 | */ | 64 | */ |
| 65 | ShipmentsPlanDetail findById(@Param("id") String id); | 65 | ShipmentsPlanDetail findById(@Param("id") String id); |
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 获取已经存在的规格ID | ||
| 69 | + * 包含预发数据 | ||
| 70 | + * | ||
| 71 | + * @param shipmentsDate 发货日期 | ||
| 72 | + * @return List<String> | ||
| 73 | + */ | ||
| 74 | + List<String> getExistsOrderSpecIds(LocalDate shipmentsDate); | ||
| 66 | } | 75 | } |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/shipments/ShipmentsPlanDetailService.java
| @@ -105,4 +105,12 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD | @@ -105,4 +105,12 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD | ||
| 105 | * @return List<ShipmentsPlanDetail> | 105 | * @return List<ShipmentsPlanDetail> |
| 106 | */ | 106 | */ |
| 107 | List<ShipmentsPlanDetail> listByPlanId(String planId); | 107 | List<ShipmentsPlanDetail> listByPlanId(String planId); |
| 108 | + | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * 判断发货计划明细是否已全部完成 | ||
| 112 | + * | ||
| 113 | + * @param planId 计划ID | ||
| 114 | + */ | ||
| 115 | + void completed(String planId); | ||
| 108 | } | 116 | } |
| @@ -15,6 +15,7 @@ public class QueryPurchaseOrderInfoVo extends PageVo implements BaseVo, Serializ | @@ -15,6 +15,7 @@ public class QueryPurchaseOrderInfoVo extends PageVo implements BaseVo, Serializ | ||
| 15 | * 查询类型 | 15 | * 查询类型 |
| 16 | * REVOKE:撤销 | 16 | * REVOKE:撤销 |
| 17 | * CHANGE:变更 | 17 | * CHANGE:变更 |
| 18 | + * REPLENISHMENT:补货 | ||
| 18 | */ | 19 | */ |
| 19 | @ApiModelProperty("查询类型") | 20 | @ApiModelProperty("查询类型") |
| 20 | private String queryType; | 21 | private String queryType; |
| @@ -99,4 +100,11 @@ public class QueryPurchaseOrderInfoVo extends PageVo implements BaseVo, Serializ | @@ -99,4 +100,11 @@ public class QueryPurchaseOrderInfoVo extends PageVo implements BaseVo, Serializ | ||
| 99 | @ApiModelProperty("订货单位或订单编号") | 100 | @ApiModelProperty("订货单位或订单编号") |
| 100 | private String orderingUnitNameOrOrderNo; | 101 | private String orderingUnitNameOrOrderNo; |
| 101 | 102 | ||
| 103 | + /** | ||
| 104 | + * 搜索关键字 | ||
| 105 | + * 移动端使用 | ||
| 106 | + * 根据订货单位和订货单编号模糊搜索 | ||
| 107 | + */ | ||
| 108 | + @ApiModelProperty("搜索关键字") | ||
| 109 | + private String searchKey; | ||
| 102 | } | 110 | } |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/plan/QueryShipmentsPlanDetailVo.java
| @@ -45,4 +45,10 @@ public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serial | @@ -45,4 +45,10 @@ public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serial | ||
| 45 | */ | 45 | */ |
| 46 | @ApiModelProperty("客户名称") | 46 | @ApiModelProperty("客户名称") |
| 47 | private String customerName; | 47 | private String customerName; |
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 是否已完成 | ||
| 51 | + */ | ||
| 52 | + @ApiModelProperty("客户名称") | ||
| 53 | + private Boolean completed; | ||
| 48 | } | 54 | } |
| @@ -117,6 +117,12 @@ | @@ -117,6 +117,12 @@ | ||
| 117 | <if test="vo.workshopId != null and vo.workshopId != ''"> | 117 | <if test="vo.workshopId != null and vo.workshopId != ''"> |
| 118 | AND tb.workshop_id = #{vo.workshopId} | 118 | AND tb.workshop_id = #{vo.workshopId} |
| 119 | </if> | 119 | </if> |
| 120 | + <if test="vo.searchKey != null and vo.searchKey != ''"> | ||
| 121 | + AND ( | ||
| 122 | + cu.name LIKE CONCAT('%', #{vo.searchKey},'%') | ||
| 123 | + OR tb.order_no LIKE CONCAT('%', #{vo.searchKey},'%') | ||
| 124 | + ) | ||
| 125 | + </if> | ||
| 120 | </where> | 126 | </where> |
| 121 | ORDER BY tb.update_time DESC | 127 | ORDER BY tb.update_time DESC |
| 122 | </select> | 128 | </select> |
| @@ -192,10 +192,14 @@ | @@ -192,10 +192,14 @@ | ||
| 192 | </when> | 192 | </when> |
| 193 | <when test="vo.queryType == 'CHANGE'"> | 193 | <when test="vo.queryType == 'CHANGE'"> |
| 194 | AND tb.examine_status = 'PASS' | 194 | AND tb.examine_status = 'PASS' |
| 195 | - AND tb.status != 'SHIPPED' | 195 | + AND tb.status NOT IN ('SHIPPED', 'DELIVERED') |
| 196 | AND (tb.revoke_status != 'UNDOING' OR tb.revoke_status IS NULL) | 196 | AND (tb.revoke_status != 'UNDOING' OR tb.revoke_status IS NULL) |
| 197 | AND (tb.spec_change_status != 'IN_PROGRESS' OR tb.spec_change_status IS NULL) | 197 | AND (tb.spec_change_status != 'IN_PROGRESS' OR tb.spec_change_status IS NULL) |
| 198 | </when> | 198 | </when> |
| 199 | + <when test="vo.queryType == 'REPLENISHMENT'"> | ||
| 200 | + AND tb.examine_status = 'PASS' | ||
| 201 | + AND tb.status IN ('TRANSIT', 'SHIPPED', 'DELIVERED') | ||
| 202 | + </when> | ||
| 199 | <otherwise> | 203 | <otherwise> |
| 200 | AND 1 = 0 <!-- 确保查询不到任何数据 --> | 204 | AND 1 = 0 <!-- 确保查询不到任何数据 --> |
| 201 | </otherwise> | 205 | </otherwise> |
| @@ -86,6 +86,16 @@ | @@ -86,6 +86,16 @@ | ||
| 86 | <if test="vo.shipmentsDate != null"> | 86 | <if test="vo.shipmentsDate != null"> |
| 87 | AND tb.shipments_date = #{vo.shipmentsDate} | 87 | AND tb.shipments_date = #{vo.shipmentsDate} |
| 88 | </if> | 88 | </if> |
| 89 | + <if test="vo.completed != null"> | ||
| 90 | + <choose> | ||
| 91 | + <when test="vo.completed == true"> | ||
| 92 | + AND tb.shipment_order_id IS NOT NULL AND tb.shipment_order_id != '' | ||
| 93 | + </when> | ||
| 94 | + <otherwise> | ||
| 95 | + AND (tb.shipment_order_id IS NULL OR tb.shipment_order_id = '') | ||
| 96 | + </otherwise> | ||
| 97 | + </choose> | ||
| 98 | + </if> | ||
| 89 | </where> | 99 | </where> |
| 90 | ORDER BY tb.create_time desc | 100 | ORDER BY tb.create_time desc |
| 91 | </select> | 101 | </select> |
| @@ -238,4 +248,10 @@ | @@ -238,4 +248,10 @@ | ||
| 238 | </if> | 248 | </if> |
| 239 | </where> | 249 | </where> |
| 240 | </select> | 250 | </select> |
| 251 | + | ||
| 252 | + <select id="getExistsOrderSpecIds" resultType="java.lang.String"> | ||
| 253 | + select distinct tb.order_spec_id | ||
| 254 | + from shipments_plan_detail tb | ||
| 255 | + where tb.pre_shipments = false or (tb.pre_shipments = true and tb.shipments_date = #{shipmentsDate}) | ||
| 256 | + </select> | ||
| 241 | </mapper> | 257 | </mapper> |