Commit 10c67bb62bfdf14751520e4d846a354c64dba2ef

Authored by yeqianyong
1 parent 54b56d06

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

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