From 4504285022b118d43360e2f5e74c3d631d30eb99 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Sat, 18 May 2024 11:02:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionStockArticleServiceImpl.java | 157 +++++++++++++++++- 1 file changed, 156 insertions(+), 1 deletion(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java index f31dc63a3..734916707 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java @@ -1376,6 +1376,8 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_code", orderCode) + .eq("warehouse_id", warehouseId) + .eq("conditions", 1) + .eq("is_deleted", 0); + List list = distributionParcelListService.list(queryWrapper); + Integer incomingNum = 0; + Integer handleNum = 0; + Integer outNum = 0; + Integer signNum = 0; + Integer reservationNum = 0; + Integer groundingNum = 0; + + Long firstEntryTime = 0L; + Long lastEntryTime = 0L; + Set waybillNoSet = new TreeSet<>(); + for (DistributionParcelListEntity parcelListEntity : list) { + incomingNum = incomingNum + 1; + Date warehouseEntryTimeEnd = parcelListEntity.getWarehouseEntryTimeEnd(); + if (Objects.isNull(warehouseEntryTimeEnd)) { + warehouseEntryTimeEnd = parcelListEntity.getCreateTime(); + } + long time = warehouseEntryTimeEnd.getTime(); + + if (firstEntryTime == 0L) { + firstEntryTime = time; + } else { + if (firstEntryTime > time) { + firstEntryTime = time; + } + } + + if (lastEntryTime == 0L) { + lastEntryTime = time; + } else { + if (lastEntryTime < time) { + lastEntryTime = time; + } + } + + Integer conditions = parcelListEntity.getConditions(); + if (conditions.equals(1)) { + String orderPackageStatus = parcelListEntity.getOrderPackageStatus(); + String orderPackageReservationStatus = parcelListEntity.getOrderPackageReservationStatus(); + String orderPackageGroundingStatus = parcelListEntity.getOrderPackageGroundingStatus(); + String waybillNumber = parcelListEntity.getWaybillNumber(); + if (StringUtils.isNotBlank(waybillNumber)) { + waybillNoSet.add(parcelListEntity.getWaybillNumber()); + } + + if ("20".equals(orderPackageGroundingStatus)) { + groundingNum = groundingNum + 1; + } + + if ("20".equals(orderPackageReservationStatus)) { + reservationNum = reservationNum + 1; + } + + if (!"60".equals(orderPackageStatus) && !"70".equals(orderPackageStatus)) { + handleNum = handleNum + 1; + } else if ("60".equals(orderPackageStatus)) { + outNum = outNum + 1; + } else if ("70".equals(orderPackageStatus)) { + signNum = signNum + 1; + } + } + } + + String orderWaybillNo = null; + for (String waybillNo : waybillNoSet) { + if (StringUtils.isBlank(orderWaybillNo)) { + orderWaybillNo = waybillNo; + } else { + orderWaybillNo = orderWaybillNo + "," + waybillNo; + } + } + + stockArticleEntity.setWaybillNumber(orderWaybillNo); + stockArticleEntity.setWarehouseEntryTime(new Date(firstEntryTime)); + stockArticleEntity.setWarehouseEntryTimeEnd(new Date(lastEntryTime)); + + if (incomingNum == 0) { + stockArticleEntity.setOrderReceiveStatus("10"); + stockArticleEntity.setCompleteSet(1); + stockArticleEntity.setOrderStatus("0"); + stockArticleEntity.setReservationStatus("10"); + stockArticleEntity.setGroundingStatus("10"); + } else if (0 < incomingNum && incomingNum < totalNumber) { + stockArticleEntity.setOrderReceiveStatus("20"); + stockArticleEntity.setCompleteSet(1); + if (signNum == 0) { + if (handleNum == 0) { + stockArticleEntity.setOrderStatus("20"); + } else if (0 < handleNum && handleNum < totalNumber) { + stockArticleEntity.setOrderStatus("20"); + } else { + stockArticleEntity.setOrderStatus("20"); + } + } else { + stockArticleEntity.setOrderStatus("70"); + } + + if (reservationNum == 0) { + stockArticleEntity.setReservationStatus("10"); + } else { + stockArticleEntity.setReservationStatus("20"); + } + + if (groundingNum == 0) { + stockArticleEntity.setGroundingStatus("10"); + } else { + stockArticleEntity.setGroundingStatus("20"); + } + } else { + stockArticleEntity.setOrderReceiveStatus("30"); + stockArticleEntity.setCompleteSet(2); + if (signNum == 0) { + if (handleNum == 0) { + stockArticleEntity.setOrderStatus("20"); + } else if (0 < handleNum && handleNum < totalNumber) { + stockArticleEntity.setOrderStatus("20"); + } else { + stockArticleEntity.setOrderStatus("20"); + } + } else { + if (signNum.equals(totalNumber)) { + stockArticleEntity.setOrderStatus("80"); + } else { + stockArticleEntity.setOrderStatus("70"); + } + } + + if (reservationNum == 0) { + stockArticleEntity.setReservationStatus("10"); + } else if (reservationNum > 0 && reservationNum < totalNumber) { + stockArticleEntity.setReservationStatus("20"); + } else { + stockArticleEntity.setReservationStatus("30"); + } + + if (groundingNum == 0) { + stockArticleEntity.setGroundingStatus("10"); + } else if (groundingNum > 0 && groundingNum < totalNumber) { + stockArticleEntity.setGroundingStatus("20"); + } else { + stockArticleEntity.setGroundingStatus("30"); + } + } + + stockArticleEntity.setIncomingNum(incomingNum); + stockArticleEntity.setHandQuantity(handleNum); + updateById(stockArticleEntity); } From 75afe31520b0e8b5c588ba2740e0e283555e6dd7 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Sat, 18 May 2024 11:04:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DistributionStockArticleServiceImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java index 734916707..efeee1670 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java @@ -1375,9 +1375,6 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl