From 1769107c38d40f7d209a48ab7752fe27a81b9709 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 14 四月 2026 17:48:18 +0800
Subject: [PATCH] fix:1.出库台账(删除出库记录查询结果有误)增加批号和供应商 2.出入库不合格管理加批号和供应商 3.发货以及发货记录(部分发货)

---
 src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
index 711fb1c..f4609eb 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
@@ -161,6 +161,15 @@
 
     @Override
     public Boolean addProductOrder(ProductOrder productOrder) {
+        // 妫�鏌ョ浉鍚屼骇鍝佸瀷鍙峰拰鎵瑰彿鏄惁宸插瓨鍦�
+        if (productOrder.getProductModelId() != null && productOrder.getBatchNo() != null) {
+            LambdaQueryWrapper<ProductOrder> queryWrapper = Wrappers.<ProductOrder>lambdaQuery()
+                    .eq(ProductOrder::getProductModelId, productOrder.getProductModelId())
+                    .eq(ProductOrder::getBatchNo, productOrder.getBatchNo());
+            if (this.count(queryWrapper) > 0) {
+                throw new RuntimeException("鐩稿悓浜у搧鍨嬪彿鍜屾壒鍙风殑鐢熶骇璁㈠崟宸插瓨鍦�");
+            }
+        }
         String string = generateNextOrderNo(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
         productOrder.setNpsNo(string);
         productOrder.setCompleteQuantity(BigDecimal.ZERO);
@@ -281,7 +290,7 @@
             List<DrawMaterialDto> materialDtoList = JSON.parseArray(productOrder.getDrawMaterials(), DrawMaterialDto.class);
             for (DrawMaterialDto drawMaterialDto : materialDtoList) {
                 stockUtils.addStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(), null, productOrderDto.getId(),
-                        drawMaterialDto.getBatchNo(), drawMaterialDto.getCustomer()
+                        drawMaterialDto.getBatchNo(), drawMaterialDto.getCustomer(),drawMaterialDto.getProductionDate()
                 );
             }
         }
@@ -292,6 +301,10 @@
                 if (drawMaterialDto.getProductModelId() == null) {
                     throw new RuntimeException("浜у搧鍨嬪彿ID涓嶈兘涓虹┖");
                 }
+                if (drawMaterialDto.getQualitity() == null  || drawMaterialDto.getQualitity().compareTo(BigDecimal.ZERO) == 0) {
+                    throw new RuntimeException("浜у搧" + drawMaterialDto.getProductName() + "鍨嬪彿" + drawMaterialDto.getModel()
+                     + "鎵瑰彿" + drawMaterialDto.getBatchNo() + "搴撳瓨涓嶈冻锛�");
+                }
                 stockUtils.substractStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(),
                         StockOutQualifiedRecordTypeEnum.DRAW_MATERIALS_STOCK_OUT.getCode(), productOrderDto.getId(),
                         drawMaterialDto.getBatchNo(),drawMaterialDto.getCustomer());

--
Gitblit v1.9.3