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