Commit 10c67bb62bfdf14751520e4d846a354c64dba2ef

Authored by yeqianyong
1 parent 54b56d06

楚江ERP-录入实发数接口调整

@@ -394,7 +394,7 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde @@ -394,7 +394,7 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
394 @Override 394 @Override
395 @Transactional(rollbackFor = Exception.class) 395 @Transactional(rollbackFor = Exception.class)
396 public void updateStatus(List<String> ids, String status) { 396 public void updateStatus(List<String> ids, String status) {
397 - if (CollectionUtils.isNotEmpty(ids) || StringUtils.isBlank(status)) { 397 + if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(status)) {
398 return; 398 return;
399 } 399 }
400 LambdaUpdateWrapper<PurchaseOrderInfo> updateWrapper = Wrappers.lambdaUpdate(PurchaseOrderInfo.class); 400 LambdaUpdateWrapper<PurchaseOrderInfo> updateWrapper = Wrappers.lambdaUpdate(PurchaseOrderInfo.class);
@@ -270,14 +270,35 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr @@ -270,14 +270,35 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr
270 @Transactional(rollbackFor = Exception.class) 270 @Transactional(rollbackFor = Exception.class)
271 public void dataReplenishInput(ShipmentsOrderVo vo) { 271 public void dataReplenishInput(ShipmentsOrderVo vo) {
272 String shipmentsOrderId = vo.getId(); 272 String shipmentsOrderId = vo.getId();
  273 + ShipmentsOrderInfo orderInfo = getBaseMapper().selectById(shipmentsOrderId);
  274 + if (orderInfo == null) {
  275 + throw new DefaultClientException("发货单不存在!");
  276 + }
273 List<ShipmentsOrderDetailVo> detailList = vo.getDetailList(); 277 List<ShipmentsOrderDetailVo> detailList = vo.getDetailList();
274 if (CollectionUtils.isEmpty(detailList)) { 278 if (CollectionUtils.isEmpty(detailList)) {
275 return; 279 return;
276 } 280 }
277 - List<ShipmentsPlanDetail> dataList = new ArrayList<>(); 281 + List<String> detailIds = new ArrayList<>();
  282 + Map<String, ShipmentsOrderDetailVo> detailVoMap = new HashMap<>();
278 for (ShipmentsOrderDetailVo detailVo : detailList) { 283 for (ShipmentsOrderDetailVo detailVo : detailList) {
  284 + String id = detailVo.getId();
  285 + detailIds.add(id);
  286 + detailVoMap.put(id, detailVo);
  287 + }
  288 + List<ShipmentsPlanDetail> shipmentsOrderDetailList = shipmentsPlanDetailService.listByIds(detailIds);
  289 + if (CollectionUtils.isEmpty(shipmentsOrderDetailList)) {
  290 + throw new DefaultClientException("发货单明细不存在!");
  291 + }
  292 + List<String> partShipmentsOrderIds = new ArrayList<>();
  293 + List<String> shipmentsOrderIds = new ArrayList<>();
  294 + List<ShipmentsPlanDetail> dataList = new ArrayList<>();
  295 + for (ShipmentsPlanDetail info : shipmentsOrderDetailList) {
279 ShipmentsPlanDetail detail = new ShipmentsPlanDetail(); 296 ShipmentsPlanDetail detail = new ShipmentsPlanDetail();
280 - detail.setId(detailVo.getId()); 297 + detail.setId(info.getId());
  298 + ShipmentsOrderDetailVo detailVo = detailVoMap.get(info.getId());
  299 + if (detailVo == null) {
  300 + continue;
  301 + }
281 detail.setActualShipmentQuantity(detailVo.getActualShipmentQuantity()); 302 detail.setActualShipmentQuantity(detailVo.getActualShipmentQuantity());
282 detail.setNum(detailVo.getNum()); 303 detail.setNum(detailVo.getNum());
283 detail.setYieldBatchNo(detailVo.getYieldBatchNo()); 304 detail.setYieldBatchNo(detailVo.getYieldBatchNo());
@@ -285,9 +306,11 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr @@ -285,9 +306,11 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr
285 Double quantity = detailVo.getQuantity(); 306 Double quantity = detailVo.getQuantity();
286 Double actualShipmentQuantity = detailVo.getActualShipmentQuantity(); 307 Double actualShipmentQuantity = detailVo.getActualShipmentQuantity();
287 if (actualShipmentQuantity >= quantity) { 308 if (actualShipmentQuantity >= quantity) {
288 - purchaseOrderInfoService.updateStatus(detailVo.getOrderId(), "SHIPPED"); 309 + // 发货完成
  310 + shipmentsOrderIds.add(info.getOrderId());
289 } else { 311 } else {
290 - purchaseOrderInfoService.updateStatus(detailVo.getOrderId(), "TRANSIT"); 312 + // 部分发货
  313 + partShipmentsOrderIds.add(info.getOrderId());
291 } 314 }
292 dataList.add(detail); 315 dataList.add(detail);
293 } 316 }
@@ -295,6 +318,9 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr @@ -295,6 +318,9 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr
295 shipmentsPlanDetailService.updateBatchById(dataList); 318 shipmentsPlanDetailService.updateBatchById(dataList);
296 // 更新发货单状态 319 // 更新发货单状态
297 updateStatus(shipmentsOrderId, "SHIPMENTS"); 320 updateStatus(shipmentsOrderId, "SHIPMENTS");
  321 + // 更新订货单状态
  322 + purchaseOrderInfoService.updateStatus(shipmentsOrderIds, "SHIPPED");
  323 + purchaseOrderInfoService.updateStatus(partShipmentsOrderIds, "TRANSIT");
298 } 324 }
299 325
300 @Override 326 @Override
@@ -13,7 +13,6 @@ @@ -13,7 +13,6 @@
13 <result column="dept_id" property="deptId"/> 13 <result column="dept_id" property="deptId"/>
14 <result column="delivery_type" property="deliveryType"/> 14 <result column="delivery_type" property="deliveryType"/>
15 <result column="destination" property="destination"/> 15 <result column="destination" property="destination"/>
16 - <result column="actual_shipment_quantity" property="actualShipmentQuantity"/>  
17 <result column="status" property="status"/> 16 <result column="status" property="status"/>
18 <result column="create_by_id" property="createById"/> 17 <result column="create_by_id" property="createById"/>
19 <result column="update_by_id" property="updateById"/> 18 <result column="update_by_id" property="updateById"/>
@@ -33,7 +32,6 @@ @@ -33,7 +32,6 @@
33 tb.dept_id, 32 tb.dept_id,
34 tb.delivery_type, 33 tb.delivery_type,
35 tb.destination, 34 tb.destination,
36 - tb.actual_shipment_quantity,  
37 tb.status, 35 tb.status,
38 tb.create_by_id, 36 tb.create_by_id,
39 tb.update_by_id, 37 tb.update_by_id,