From 2e9a47c28245366c5b458a1772873032b552b150 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 25 Nov 2024 15:37:46 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9A=82=E6=94=B6=E9=87=87=E8=B4=AD=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=8C=89?= =?UTF-8?q?=E7=85=A7=E6=96=B0=E7=89=88prd=E8=B0=83=E6=95=B4=EF=BC=9A?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E4=B8=8D=E5=9C=A8=E5=88=86=E7=BB=84?= =?UTF-8?q?=EF=BC=8C=E6=94=BE=E5=9C=A8from=E8=A1=A8=E5=8D=95=E4=B8=8A?= =?UTF-8?q?=EF=BC=8C=E6=9A=82=E6=94=B6=E5=90=88=E6=A0=BC=E6=95=B0=E5=92=8C?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E5=88=B0=E8=B4=A7=E6=95=B0=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?4=E4=B8=AA=E6=A0=A1=E9=AA=8C=E6=9D=A1=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4=E6=96=B9=E6=B3=95=EF=BC=9B?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=8D=95=E7=94=9F=E6=88=90=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=8D=95=E4=B8=BB=E8=A1=A8=E5=92=8C=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=85=A5=E5=BA=93=E5=8D=95=E5=AD=90=E8=A1=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98=E6=9A=82=E6=94=B6-?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95(=E9=87=87=E8=B4=AD=E5=85=A5?= =?UTF-8?q?=E5=BA=93)=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E9=87=87=E7=94=A8=E6=96=B0=E6=B5=81=E7=A8=8B=EF=BC=9A=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E4=BF=9D=E5=AD=98=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=8D?= =?UTF-8?q?=E5=9C=A8=E7=94=9F=E6=88=90=E5=93=81=E8=B4=A8=E5=8D=95=EF=BC=9B?= =?UTF-8?q?=E5=AF=B9=E5=AE=9E=E9=99=85=E5=88=B0=E8=B4=A7=E6=95=B0=E5=92=8C?= =?UTF-8?q?=E6=9A=82=E6=94=B6=E5=90=88=E6=A0=BC=E6=95=B0=E9=83=BD=E8=A6=81?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=A0=A1=E9=AA=8C=EF=BC=9B=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=EF=BC=8C=E5=AE=9E=E9=99=85=E5=88=B0=E8=B4=A7=E6=95=B0=E5=92=8C?= =?UTF-8?q?=E6=9A=82=E6=94=B6=E5=90=88=E6=A0=BC=E6=95=B0=E9=83=BD=E8=A6=81?= =?UTF-8?q?=E5=B0=8F=E4=BA=8E=E7=AD=89=E4=BA=8E=E9=80=9A=E7=9F=A5=E5=88=B0?= =?UTF-8?q?=E8=B4=A7=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PurchaseOrderServiceImpl.java | 24 +- .../WarehouseStorageOrderController.java | 9 +- .../WarehouseStorageOrderServiceImpl.java | 76 +++-- .../storageOrder/temporaryPurchase.html | 281 +++++++++++------- 4 files changed, 247 insertions(+), 143 deletions(-) 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 81640729..f4ead77e 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 @@ -1192,6 +1192,10 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService private void buildPurchaseStorage(PurchaseOrder purchaseOrder, List filterPurchaseOrderChildList, String warehouseStorageCode) { PurchaseStorage purchaseStorage = new PurchaseStorage(); + String supplierCode = purchaseOrder.getSupplierCode(); + + SysSupplier sysSupplier = sysSupplierService.selectSysSupplierByCode(supplierCode); + PurchaseOrderChild purchaseOrderChild = filterPurchaseOrderChildList.get(0); purchaseStorage.setWarehouseStorageStatus("0"); purchaseStorage.setWarehouseStorageType("5"); @@ -1202,8 +1206,11 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService purchaseStorage.setArrivedTime(purchaseOrder.getArrivedTime()); purchaseStorage.setRelatedOrderCode(purchaseOrder.getPurchaseOrderCode()); - purchaseStorage.setSupplierCode(purchaseOrder.getSupplierCode()); + purchaseStorage.setSupplierCode(supplierCode); purchaseStorage.setSupplierName(purchaseOrder.getSupplierName()); + purchaseStorage.setSupplierAddress(sysSupplier.getReceiveAddress()); + purchaseStorage.setContactNumber(sysSupplier.getReceivePersonPhone()); + purchaseStorage.setCustomerContact(sysSupplier.getReceivePerson()); purchaseStorage.setWarehouseStorageCode(warehouseStorageCode); int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum(); @@ -1224,6 +1231,11 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService //采购入库生成仓库入库主表数据 private void buildWarehouseStorage(PurchaseOrder purchaseOrder, String warehouseStorageCode, List filterPurchaseOrderChildList) { + + String supplierCode = purchaseOrder.getSupplierCode(); + + SysSupplier sysSupplier = sysSupplierService.selectSysSupplierByCode(supplierCode); + PurchaseOrderChild purchaseOrderChild = filterPurchaseOrderChildList.get(0); WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder(); warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode); @@ -1233,6 +1245,14 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService warehouseStorageOrder.setWarehouseQualityStatus("0"); warehouseStorageOrder.setWarehouseOrderType("0"); warehouseStorageOrder.setArrivedTime(purchaseOrder.getArrivedTime()); + + warehouseStorageOrder.setSupplierCode(supplierCode); + warehouseStorageOrder.setSupplierName(purchaseOrder.getSupplierName()); + warehouseStorageOrder.setSupplierAddress(sysSupplier.getReceiveAddress()); + warehouseStorageOrder.setContactNumber(sysSupplier.getReceivePersonPhone()); + warehouseStorageOrder.setCustomerContact(sysSupplier.getReceivePerson()); + + int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum(); int allNotifyHasArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyHasArrivedNum).sum(); if (allNotifyHasArrivedNum == 0){ @@ -1290,6 +1310,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService }else { warehouseStorageOrderDetail.setNotifyHasArrivedNum(notifyHasArrivedNum + notifyArriveNum); } + warehouseStorageOrderDetail.setNotifyArriveNum(notifyArriveNum); warehouseStorageOrderDetailChildren.add(warehouseStorageOrderDetail); } int result = warehouseStorageOrderDetailMapper.insertBatchWarehouseStorageOrderDetail(warehouseStorageOrderDetailChildren); @@ -1338,6 +1359,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService }else { purchaseStorageChild.setNotifyHasArrivedNum(notifyHasArrivedNum + notifyArriveNum); } + purchaseStorageChild.setNotifyArriveNum(notifyArriveNum); purchaseStorageChildren.add(purchaseStorageChild); } int result = purchaseStorageChildMapper.insertBatchPurchaseStorageChild(purchaseStorageChildren); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java index 4a4191ba..ded0a48e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java @@ -234,11 +234,10 @@ public class WarehouseStorageOrderController extends BaseController */ @ResponseBody @RequestMapping("/temporaryPurchaseDetailList") - public Map> temporaryPurchaseDetail(String warehouseStorageCode){ - List allDetails = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode); - List filterAllDetails = allDetails.stream().filter(wso -> "1".equals(wso.getMaterialDeptType())).collect(Collectors.toList()); - Map> groupedDetails = filterAllDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getSupplierCode)); - return groupedDetails; + public TableDataInfo temporaryPurchaseDetail(String warehouseStorageCode){ + startPage(); + List list = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode); + return getDataTable(list); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java index 082b5f83..4cafa3ed 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java @@ -362,13 +362,14 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS @Override public int temporaryPurchaseSave(WarehouseStorageOrder warehouseStorageOrder) { + //流程说明:入库部门(采购):1、采购发起【采购入库单】:2、仓库暂收【入库单】;3、采购入库【入库单】 String loginName = ShiroUtils.getLoginName(); warehouseStorageOrder.setUpdateBy(loginName); warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); //改变状态为已暂收 - warehouseStorageOrder.setWarehouseStorageStatus("1"); + warehouseStorageOrder.setWarehouseStorageStatus("2"); //设置品质状态,为待品质 - warehouseStorageOrder.setWarehouseQualityStatus("0"); + //warehouseStorageOrder.setWarehouseQualityStatus("0"); warehouseStorageOrder.setWarehouseEmployee(loginName); List warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); @@ -385,19 +386,15 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS actualArriveNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getActualArriveNum).sum(); int temporaryQualifiedNum = 0; - //检查填写的品质合格数是否有空值 + //检查填写的暂收合格数是否有空值 boolean hasTemporaryQualifiedNumNull = warehouseStorageOrderDetailList.stream() .anyMatch(item -> item.getTemporaryQualifiedNum() == null); if (hasTemporaryQualifiedNumNull) { - throw new BusinessException("存在品质合格数为空,请检查!"); + throw new BusinessException("存在暂收合格数为空,请检查!"); } //入库单主表的暂收合格数为子表的合计 temporaryQualifiedNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getTemporaryQualifiedNum).sum(); - if (actualArriveNum < temporaryQualifiedNum) { - throw new BusinessException("暂收合格数不能大于实际到货数"); - } - //插入实际到货数 warehouseStorageOrder.setActualArrivedNum(actualArriveNum); //插入暂收合格数 @@ -425,13 +422,15 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS } - try { - qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList()); - } catch (Exception e) { - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - log.error("生成品质单时发生错误", e); - throw new BusinessException("生成品质单时发生错误"); - } + //新流程,采购入库不走品质 +// +// try { +// qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList()); +// } catch (Exception e) { +// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); +// log.error("生成品质单时发生错误", e); +// throw new BusinessException("生成品质单时发生错误"); +// } return updateResult; } @@ -1145,23 +1144,42 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS return 0; } for (WarehouseStorageOrderDetail detail : details) { - detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); - Integer actualArriveNum = detail.getActualArriveNum(); - Integer temporaryQualifiedNum = detail.getTemporaryQualifiedNum(); - //添加实际已到货数 + detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + Integer actualArriveNum = detail.getActualArriveNum(); + Integer notifyArriveNum = detail.getNotifyArriveNum(); + Integer temporaryQualifiedNum = detail.getTemporaryQualifiedNum(); + Integer actualHasArrivedNum = detail.getActualHasArrivedNum(); + Integer temporaryHasQualifiedNum = detail.getTemporaryHasQualifiedNum(); + if (notifyArriveNum < temporaryQualifiedNum){ + throw new BusinessException("暂收合格数要小于等于通知到货数"); + } + if (notifyArriveNum < actualArriveNum){ + throw new BusinessException("实际到货数要小于等于通知到货数"); + } + + if (actualHasArrivedNum == null || actualHasArrivedNum == 0){ detail.setActualHasArrivedNum(actualArriveNum); - //添加暂收已合格数 + }else { + detail.setActualHasArrivedNum(actualHasArrivedNum + actualArriveNum); + } + if (temporaryHasQualifiedNum == null || temporaryHasQualifiedNum == 0){ detail.setTemporaryHasQualifiedNum(temporaryQualifiedNum); - if (actualArriveNum < temporaryQualifiedNum){ - throw new BusinessException("暂收合格数要小于等于实际到货数"); - } - if(detail.getWarehouseStorageType()!=null&&detail.getWarehouseStorageType().equals("4")){ - updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetail(detail); - }else { - updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail); - } + }else { + detail.setTemporaryHasQualifiedNum(temporaryHasQualifiedNum + temporaryQualifiedNum); + } + + //添加实际已到货数 + detail.setActualArriveNum(actualArriveNum); + //添加暂收已合格数 + detail.setTemporaryQualifiedNum(temporaryQualifiedNum); + + if(detail.getWarehouseStorageType() != null && detail.getWarehouseStorageType().equals("4")){ + updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetail(detail); + }else { + updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail); + } } - return updateResultDetails; + return updateResultDetails; } diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html index 623a9a91..1aa977f5 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html @@ -3,6 +3,7 @@ +