Browse Source

Merge branch 'dev' into pre-production

master
pref_mail@163.com 8 months ago
parent
commit
b8800deeb4
  1. 155
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

155
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -1375,7 +1375,6 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
@Override
public void updateOrderInfo(String orderCode, Long warehouseId) {
DistributionStockArticleEntity stockArticleEntity = findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId);
if (Objects.isNull(stockArticleEntity)) {
log.warn("##############updateOrderInfo: 订单信息不存在 orderCode={} warehouseId={}", orderCode, warehouseId);
@ -1388,9 +1387,161 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
return;
}
Integer totalNumber = stockArticleEntity.getTotalNumber();
//查询入库件数
updateStockArticleByextracted(warehouseId, stockArticleEntity);
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_code", orderCode)
.eq("warehouse_id", warehouseId)
.eq("conditions", 1)
.eq("is_deleted", 0);
List<DistributionParcelListEntity> 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<String> 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);
}

Loading…
Cancel
Save