From e7c4b8fbb9d4132b971ee0747656f6d360aa44f8 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 25 Nov 2024 19:29:18 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=AD=90=E8=A1=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=80=9A=E8=BF=87=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8F=B7=E5=92=8C=E7=89=A9=E6=96=99=E5=8F=B7=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=AD=90=E8=A1=A8=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20=E4=BF=AE=E6=94=B9=E6=9A=82=E6=94=B6-=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E5=85=A5=E5=BA=93=E5=92=8C=E6=9A=82=E6=94=B6=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=85=A5=E5=BA=93=E4=B8=A4=E4=B8=AA=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=8A=A0=E4=B8=8A=E5=AF=B9=E9=87=87=E8=B4=AD=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=AD=90=E8=A1=A8=E6=9A=82=E6=94=B6=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/PurchaseOrderChildMapper.java | 9 +++++ .../WarehouseStorageOrderServiceImpl.java | 39 ++++++++++++++++++- .../purchase/PurchaseOrderChildMapper.xml | 8 ++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java index ff217e66..d2c593be 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java @@ -48,6 +48,15 @@ public interface PurchaseOrderChildMapper List selectPurchaseOrderChildByOrderCode(String purchaseOrderCode); + /** + * 通过采购订单号和物料号查询采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 采购订单子表集合 + */ + PurchaseOrderChild selectPurchaseOrderChildByCodeAndNo(PurchaseOrderChild purchaseOrderChild); + + /** * 新增采购订单子表 * 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 447eed69..bbffbf5b 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 @@ -13,6 +13,7 @@ import com.ruoyi.erp.domain.ErpDevelopModifyorder; import com.ruoyi.erp.domain.ErpMaterial; import com.ruoyi.erp.mapper.ErpDevelopModifyorderMapper; import com.ruoyi.erp.mapper.ErpMaterialMapper; +import com.ruoyi.purchase.domain.PurchaseOrder; import com.ruoyi.purchase.domain.PurchaseOrderChild; import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper; import com.ruoyi.quality.domain.QualityOrder; @@ -407,6 +408,14 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS if (updateDetailResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()) { throw new BusinessException("更新入库单明细记录失败"); } + + //更新采购订单子表 + int updatePurchaseOrderChildResult = updateTemporaryPurchaseOrderChild(warehouseStorageOrder); + if (updatePurchaseOrderChildResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()){ + throw new BusinessException("更新采购订单子表记录失败"); + } + + int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); if (updateResult <= 0) { throw new BusinessException("更新入库单主记录失败"); @@ -435,6 +444,26 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS return updateResult; } + //更新采购订单子表 + private int updateTemporaryPurchaseOrderChild(WarehouseStorageOrder warehouseStorageOrder) { + int result = 0; + String purchaseOrderCode = warehouseStorageOrder.getRelatedOrderCode(); + List warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); + if (CollectionUtils.isEmpty(warehouseStorageOrderDetailList)){ + return 0; + } + + for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) { + PurchaseOrderChild purchaseOrderChild = new PurchaseOrderChild(); + purchaseOrderChild.setPurchaseOrderCode(purchaseOrderCode); + purchaseOrderChild.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); + purchaseOrderChild = purchaseOrderChildMapper.selectPurchaseOrderChildByCodeAndNo(purchaseOrderChild); + purchaseOrderChild.setTemporaryNum(warehouseStorageOrderDetail.getTemporaryQualifiedNum()); + result += purchaseOrderChildMapper.updatePurchaseOrderChild(purchaseOrderChild); + } + return result; + } + /** * 修改保存暂收-委外单(委外入库) * */ @@ -1056,6 +1085,14 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS if (updateDetailResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()) { throw new BusinessException("更新入库单明细记录失败"); } + + //更新采购订单子表 + int updatePurchaseOrderChildResult = updateTemporaryPurchaseOrderChild(warehouseStorageOrder); + if (updatePurchaseOrderChildResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()){ + throw new BusinessException("更新采购订单子表记录失败"); + } + + int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); if (updateResult <= 0) { throw new BusinessException("更新入库单主记录失败"); @@ -1134,7 +1171,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS private int updateTemporaryPurchaseDetails(WarehouseStorageOrder warehouseStorageOrder) { int updateResultDetails = 0; List details = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); - if (org.springframework.util.CollectionUtils.isEmpty(details)){ + if (CollectionUtils.isEmpty(details)){ return 0; } for (WarehouseStorageOrderDetail detail : details) { diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml index 0cd9fad5..dbad73a9 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml @@ -63,6 +63,14 @@ where purchase_order_code = #{purchaseOrderCode} + + + + insert into purchase_order_child