From c27bbcc497711df8b13d096f4917b5a8f16508c9 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期日, 28 九月 2025 10:28:59 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java |   66 ++++++++++++++++++++++++++-------
 1 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java b/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
index 713061e..29fc139 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
@@ -8,6 +8,7 @@
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.example.erp.common.Constants;
 import com.example.erp.dto.mm.FinishedOperateLogDTO;
+import com.example.erp.dto.mm.MaterialLogDTO;
 import com.example.erp.entity.mm.*;
 import com.example.erp.entity.pp.*;
 import com.example.erp.entity.sd.Delivery;
@@ -199,13 +200,15 @@
 
             MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class);
 
-
+            if(materialInventory.getProducer()==null){
+                materialInventory.setProducer("");
+            }
             //鏌ヨ鐗╂枡鏄惁瀛樺湪
             List<MaterialInventory> MaterialInventoryCount;
             if (materialInventory.getDateOfManufacture()!=null){
-                MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture());
+                MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture(),materialInventory.getProducer());
             }else{
-                MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(materialCode);
+                MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(materialCode,materialInventory.getProducer());
             }
 
             if(MaterialInventoryCount.size()==1){
@@ -601,12 +604,15 @@
                     totalArea= Double.parseDouble(decimalFormat.format(singlePieceArea * returningWarehouseDetail.getReturnQuantity()));
 
 
+                    if(returningWarehouseDetail.getProducer()==null){
+                        returningWarehouseDetail.setProducer("");
+                    }
                     //鏌ヨ鐗╂枡鏄惁瀛樺湪
                     List<MaterialInventory> MaterialInventoryCount;
                     if (returningWarehouseDetail.getDateOfManufacture()!=null){
-                        MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture());
+                        MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture(),returningWarehouseDetail.getProducer());
                     }else{
-                        MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(returningWarehouseDetail.getId());
+                        MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(returningWarehouseDetail.getId(),returningWarehouseDetail.getProducer());
                     }
 
 
@@ -624,9 +630,9 @@
                     //鑾峰彇搴撳瓨缂栧彿娣诲姞鍒拌繑搴撴槑缁嗚〃
                     List<MaterialInventory> MaterialInventoryId;
                     if (returningWarehouseDetail.getDateOfManufacture()!=null){
-                        MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountId(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture());
+                        MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountId(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture(),returningWarehouseDetail.getProducer());
                     }else{
-                        MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountNullId(returningWarehouseDetail.getId());
+                        MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountNullId(returningWarehouseDetail.getId(),returningWarehouseDetail.getProducer());
                     }
                     materialInventoryMapper.updateReturningWarehouseDetail(oddNumber, returningWarehouseDetailMaximum + 1,MaterialInventoryId.get(0).getId());
 
@@ -870,8 +876,15 @@
         return map;
     }
 
-    public List<MaterialLog> exportMaterialLogReport(List<LocalDate> dates, String type) {
-        return materialInventoryMapper.exportMaterialLogReport(dates,type);
+    public List<MaterialLogDTO> exportMaterialLogReport(List<LocalDate> dates, String type) {
+        if(type.equals("鐗╂枡鍑哄簱")){
+            return materialInventoryMapper.exportMaterialLogReport(dates,type);
+        }else if(type.equals("浼樺寲鍑哄簱")){
+            return materialInventoryMapper.exportMaterialLogOptimizeOutboundReport(dates,type);
+        }else{
+            return materialInventoryMapper.exportMaterialLogReports(dates,type);
+        }
+
     }
 
 
@@ -1040,20 +1053,25 @@
             if (!materialLoglist.isEmpty()){
                 for (MaterialLog materialLog : materialLoglist) {
 
+                    if(materialLog.getProducer()==null){
+                        materialLog.setProducer("");
+                    }
                     //鏌ヨ鐗╂枡鏄惁瀛樺湪
                     List<MaterialInventory> MaterialInventoryList;
                     if (materialLog.getOperationOrderNumber()!=null){
-                        MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCount(materialLog.getMaterialCode(), LocalDate.parse(materialLog.getOperationOrderNumber()));
+                        MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCount(materialLog.getMaterialCode(), LocalDate.parse(materialLog.getOperationOrderNumber()),materialLog.getProducer());
                     }else{
-                        MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCountNull(materialLog.getMaterialCode());
+                        MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCountNull(materialLog.getMaterialCode(),materialLog.getProducer());
                     }
 
                     if(MaterialInventoryList.size()==1){
                         if(MaterialInventoryList.get(0).getAvailableQuantity()>=materialLog.getQuantity()){
                             if (materialLog.getOperationOrderNumber()!=null){
-                                materialInventoryMapper.updateMaterialInventoryOut(materialLog.getMaterialCode(),materialLog.getQuantity(),materialLog.getOperationOrderNumber());
+                                materialInventoryMapper.updateMaterialInventoryOut(materialLog.getMaterialCode(),materialLog.getQuantity(),
+                                        materialLog.getOperationOrderNumber(),materialLog.getProducer());
                             }else{
-                                materialInventoryMapper.updateMaterialInventoryNullOut(materialLog.getMaterialCode(),materialLog.getQuantity());
+                                materialInventoryMapper.updateMaterialInventoryNullOut(materialLog.getMaterialCode(),materialLog.getQuantity(),
+                                        materialLog.getProducer());
                             }
                             materialInventoryMapper.deleteMaterialLogById(materialLog.getId());
                         }else{
@@ -1260,7 +1278,27 @@
             log.setFunction("updateMaterialInventory鐗╂枡搴撳瓨淇敼");
             MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class);
 
-            materialInventoryMapper.updateMaterialInventoryAll(materialInventoryId,materialInventory);
+            if(materialInventory.getProducer()==null){
+                materialInventory.setProducer("");
+            }
+            //鏌ヨ鐗╂枡鏄惁瀛樺湪
+            List<MaterialInventory> MaterialInventoryCount;
+            if (materialInventory.getDateOfManufacture()!=null){
+                MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount1(materialInventory.getMaterialCode(),materialInventory.getDateOfManufacture(),materialInventory.getProducer(),materialInventory.getId());
+            }else{
+                MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull1(materialInventory.getMaterialCode(),materialInventory.getProducer(),materialInventory.getId());
+            }
+
+            if(MaterialInventoryCount.size()==1){
+                materialInventoryMapper.updateMaterialInventoryOne(MaterialInventoryCount.get(0).getId(),materialInventory);
+                List<Long> id=new ArrayList<>();
+                id.add(materialInventoryId);
+                materialInventoryMapper.deleteMaterialInventory(id);
+            }else{
+                materialInventoryMapper.updateMaterialInventoryAll(materialInventoryId,materialInventory);
+            }
+
+
 
             logService.saveLog(log);
         } catch (Exception e) {

--
Gitblit v1.8.0