diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java index 1a424d63..e71b9598 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java @@ -1206,18 +1206,19 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService //生成仓库入库单子表 buildWarehouseChild(purchaseOrder, warehouseStorageCode,filterPurchaseOrderChildList); - //更新采购订单子表 - updatePurchaseOrderChildData(purchaseOrder, filterPurchaseOrderChildList); - int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum(); int allNotifyHasArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyHasArrivedNum).sum(); - if (allNotifyHasArrivedNum == 0){ + if (purchaseOrder.getNotifyHasArrivedSum() == null || purchaseOrder.getNotifyHasArrivedSum() == 0 ){ purchaseOrder.setNotifyHasArrivedSum(allNotifyArrivedNum); }else { - purchaseOrder.setNotifyHasArrivedSum(allNotifyHasArrivedNum + allNotifyArrivedNum); + purchaseOrder.setNotifyHasArrivedSum(allNotifyArrivedNum + purchaseOrder.getNotifyHasArrivedSum()); } + + //更新采购订单子表 + updatePurchaseOrderChildData(purchaseOrder, filterPurchaseOrderChildList); + if (purchaseOrder.getNotifyHasArrivedSum().equals(purchaseOrder.getActualPurchaseSum())){ purchaseOrder.setWarehouseStorageStatus("4"); }if (purchaseOrder.getNotifyHasArrivedSum() < purchaseOrder.getActualPurchaseSum()){ @@ -1231,7 +1232,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService private void updatePurchaseOrderChildData(PurchaseOrder purchaseOrder, List filterPurchaseOrderChildList) { for (PurchaseOrderChild purchaseOrderChild : filterPurchaseOrderChildList) { - if (purchaseOrderChild.getNotifyHasArrivedNum() == 0 || purchaseOrderChild.getNotifyHasArrivedNum() == null){ + if (purchaseOrderChild.getNotifyHasArrivedNum() == null || purchaseOrderChild.getNotifyHasArrivedNum() == 0){ purchaseOrderChild.setNotifyHasArrivedNum(purchaseOrderChild.getNotifyArriveNum()); }else { purchaseOrderChild.setNotifyHasArrivedNum(purchaseOrderChild.getNotifyHasArrivedNum() + purchaseOrderChild.getNotifyArriveNum()); @@ -1289,6 +1290,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService warehouseStorageOrder.setWarehouseDeptType(purchaseOrderChild.getWarehouseDept()); warehouseStorageOrder.setWarehouseQualityStatus("0"); warehouseStorageOrder.setWarehouseOrderType("0"); + warehouseStorageOrder.setArrivedTime(purchaseOrder.getArrivedTime()); int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum(); int allNotifyHasArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyHasArrivedNum).sum(); if (allNotifyHasArrivedNum == 0){ @@ -1330,6 +1332,8 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService warehouseStorageOrderDetail.setMaterialType(purchaseOrderChild.getMaterialType()); warehouseStorageOrderDetail.setMaterialDeptType(purchaseOrderChild.getWarehouseDept()); warehouseStorageOrderDetail.setArrivedTime(purchaseOrderChild.getPlanDeliveryTime()); + warehouseStorageOrderDetail.setSupplierCode(purchaseOrder.getSupplierCode()); + warehouseStorageOrderDetail.setSupplierName(purchaseOrder.getSupplierName()); warehouseStorageOrderDetail.setCreateTime(new Date()); warehouseStorageOrderDetail.setCreateBy(ShiroUtils.getLoginName()); Integer notifyArriveNum = purchaseOrderChild.getNotifyArriveNum(); @@ -1377,6 +1381,8 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService purchaseStorageChild.setMaterialType(purchaseOrderChild.getMaterialType()); purchaseStorageChild.setMaterialDeptType(purchaseOrderChild.getWarehouseDept()); purchaseStorageChild.setArrivedTime(purchaseOrderChild.getPlanDeliveryTime()); + purchaseStorageChild.setSupplierCode(purchaseOrder.getSupplierCode()); + purchaseStorageChild.setSupplierName(purchaseOrder.getSupplierName()); purchaseStorageChild.setCreateTime(new Date()); purchaseStorageChild.setCreateBy(ShiroUtils.getLoginName()); Integer notifyArriveNum = purchaseOrderChild.getNotifyArriveNum();