From 1b8daa902b075c7cedee7bbcc13b914b7a5b4ad4 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 03 十一月 2025 11:48:49 +0800
Subject: [PATCH] 优化盘点逻辑

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs              |   24 +++---
 新建文件夹/WMS/src/extension/stock/Dt_Inventory_Batch.js                                       |   17 ++++
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs                 |   27 +++---
 新建文件夹/WMS/src/views/stock/Dt_Inventory_Batch.vue                                          |  119 ++++++++++-------------------
 新建文件夹/WIDESEA_WMSServer/ClassLibrary2/Inventory_BatchServices.cs.cs                       |    5 +
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs    |    9 +-
 新建文件夹/WMS/src/views/stock/stockInfo.vue                                                   |    4 
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs |   11 +-
 8 files changed, 98 insertions(+), 118 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/Inventory_BatchServices.cs.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/Inventory_BatchServices.cs.cs"
index 5a10030..7f8f0d0 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/Inventory_BatchServices.cs.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/Inventory_BatchServices.cs.cs"
@@ -22,7 +22,10 @@
         }
 
         public IRepository<Dt_Inventory_Batch> Repository => BaseDal;
-
+        public override WebResponseContent UpdateData(SaveModel saveModel)
+        {
+            return base.UpdateData(saveModel);
+        }
         public WebResponseContent GetExpiredAndlow()
         {
             WebResponseContent content = new WebResponseContent();
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
index c910893..c4b01fb 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
@@ -524,14 +524,13 @@
                     {
                         //鎵惧簱瀛樻壒娆′俊鎭�
                         Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First();
-                        var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity);
-                        if (Qty != item.order_qty) throw new Exception($"鐩樼泩鍏ュ簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樼泩鏁伴噺鏈夎");
+                        if (inventory_Batch.SupplyQuantity != item.order_qty) throw new Exception($"鐩樼泩鍏ュ簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樼泩鏁伴噺鏈夎");
                         //鎵炬墍鏈夊簱瀛�
                         List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList();
                         foreach (var inventoryInfo in inventoryInfos)
                         {
                             #region 娣诲姞鐩樼泩鍏ュ簱浠诲姟
-                            if (inventoryInfo.StockQuantity != inventoryInfo.SupplyQuantity)
+                            if (inventoryInfo.SupplyQuantity != 0)
                             {
                                 Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty()
                                 {
@@ -548,7 +547,7 @@
                                     Creater = App.User.UserName,
                                     LocationCode = inventoryInfo.LocationCode,
                                     OrderNo = order.order_no,
-                                    StockQuantity = Math.Abs(inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity),
+                                    StockQuantity = inventoryInfo.SupplyQuantity,
                                     SupplyQuantity = 0,
                                     Remark = "鐩樼泩鍏ュ簱"
                                 };
@@ -556,13 +555,13 @@
                                 supplyTask_Hties.Add(supplyTask_Hty);
                             }
                             #endregion
-                            inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+                            inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                             inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                             inventoryInfo.SupplyQuantity = 0;
                             inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
                         }
                         infosUp.AddRange(inventoryInfos);
-                        inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+                        inventory_Batch.StockQuantity += inventory_Batch.SupplyQuantity;
                         inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity;
                         inventory_Batch.SupplyQuantity = 0;
                         batchesUp.Add(inventory_Batch);
@@ -614,16 +613,16 @@
                     {
                         //鎵惧簱瀛樻壒娆′俊鎭�
                         Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First();
-                        var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity);
+                        var Qty = Math.Abs(inventory_Batch.SupplyQuantity);
                         if (Qty != item.order_qty) throw new Exception($"鐩樼泩鍏ュ簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樼泩鏁伴噺鏈夎");
                         //鎵炬墍鏈夊簱瀛�
                         List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList();
                         //鑾峰彇绔嬪簱鐩樼偣宸紓鏁�
                         var inventoryLK = inventoryInfos.Where(x => x.WarehouseCode == WareCodeLK).First();
-                        var LkQty = Math.Abs(inventoryLK.StockQuantity - inventoryLK.SupplyQuantity);
+                        var LkQty = Math.Abs(inventoryLK.SupplyQuantity);
                         //鑾峰彇澶т欢搴撶洏鐐瑰樊寮傛暟
                         var inventoryDJ = inventoryInfos.Where(x => x.WarehouseCode == WareCodeDJ).ToList();
-                        var DJQty = Math.Abs(inventoryDJ.Sum(x => x.StockQuantity) - inventoryDJ.Sum(x => x.SupplyQuantity));
+                        var DJQty = Math.Abs(inventoryDJ.Sum(x => x.SupplyQuantity));
                         if (LkQty + DJQty != Qty) throw new Exception($"銆恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐗╂枡淇℃伅涓庣墿鏂欐壒娆′俊鎭洏鐩堟暟閲忎笉绗�");
                         if (LkQty == 0)//绔嬪簱鏃犲樊寮�
                         {
@@ -648,7 +647,7 @@
                                         Creater = App.User.UserName,
                                         LocationCode = inventoryInfo.LocationCode,
                                         OrderNo = order.order_no,
-                                        StockQuantity = Math.Abs(inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity),
+                                        StockQuantity = Math.Abs(inventoryInfo.SupplyQuantity),
                                         SupplyQuantity = 0,
                                         Remark = "鐩樼泩鍏ュ簱"
                                     };
@@ -656,14 +655,14 @@
                                     supplyTask_Hties.Add(supplyTask_Hty);
                                 }
                                 #endregion
-                                inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+                                inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                                 inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                                 inventoryInfo.SupplyQuantity = 0;
                                 inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
                             }
                             //_inventoryInfoService.UpdateData(inventoryInfos);
                             infosUp.AddRange(inventoryInfos);
-                            inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+                            inventory_Batch.StockQuantity += inventory_Batch.SupplyQuantity;
                             inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity;
                             inventory_Batch.SupplyQuantity = 0;
                             //_inventory_BatchServices.UpdateData(inventory_Batch);
@@ -721,7 +720,7 @@
                                         Creater = App.User.UserName,
                                         LocationCode = inventoryInfo.LocationCode,
                                         OrderNo = order.order_no,
-                                        StockQuantity = Math.Abs(inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity),
+                                        StockQuantity = Math.Abs(inventoryInfo.SupplyQuantity),
                                         SupplyQuantity = 0,
                                         Remark = "鐩樼泩鍏ュ簱"
                                     };
@@ -729,7 +728,7 @@
                                     supplyTask_Hties.Add(supplyTask_Hty);
                                 }
                                 #endregion
-                                inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+                                inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                                 inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                                 inventoryInfo.SupplyQuantity = 0;
                                 inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
index d5157af..396f697 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
@@ -522,7 +522,7 @@
                     {
                         //鎵惧簱瀛樻壒娆′俊鎭�
                         Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First();
-                        var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity);
+                        var Qty = Math.Abs(inventory_Batch.SupplyQuantity);
                         if (Qty != item.order_qty) throw new Exception($"鐩樹簭鍑哄簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樹簭鏁伴噺鏈夎");
                         //鎵炬墍鏈夊簱瀛�
                         List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList();
@@ -546,7 +546,7 @@
                                     Creater = App.User.UserName,
                                     LocationCode = inventoryInfo.LocationCode,
                                     OrderNo = order.order_no,
-                                    StockQuantity = Math.Abs(inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity),
+                                    StockQuantity = Math.Abs(inventoryInfo.SupplyQuantity),
                                     SupplyQuantity = 0,
                                     Remark = "鐩樹簭鍏ュ簱"
                                 };
@@ -554,12 +554,12 @@
                                 supplyTask_Hties.Add(supplyTask_Hty);
                             }
                             #endregion
-                            inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+                            inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                             inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                             inventoryInfo.SupplyQuantity = 0;
                             inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
                         }
-                        inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+                        inventory_Batch.StockQuantity += inventory_Batch.SupplyQuantity;
                         inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity;
                         inventory_Batch.SupplyQuantity = 0;
                         infosUp.AddRange(inventoryInfos);
@@ -611,16 +611,16 @@
                     {
                         //鎵惧簱瀛樻壒娆′俊鎭�
                         Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First();
-                        var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity);
+                        var Qty = Math.Abs(inventory_Batch.SupplyQuantity);
                         if (Qty != item.order_qty) throw new Exception($"鐩樹簭鍑哄簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樹簭鏁伴噺鏈夎");
                         //鎵炬墍鏈夊簱瀛�
                         List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList();
                         //鑾峰彇绔嬪簱鐩樼偣宸紓鏁�.銆傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘��
                         var inventoryLK = inventoryInfos.Where(x => x.WarehouseCode == WareCodeLK).First();
-                        var LkQty = Math.Abs(inventoryLK.StockQuantity - inventoryLK.SupplyQuantity);
+                        var LkQty = Math.Abs(inventoryLK.SupplyQuantity);
                         //鑾峰彇澶т欢搴撶洏鐐瑰樊寮傛暟
                         var inventoryDJ = inventoryInfos.Where(x => x.WarehouseCode == WareCodeDJ).ToList();
-                        var DJQty = Math.Abs(inventoryDJ.Sum(x => x.StockQuantity) - inventoryDJ.Sum(x => x.SupplyQuantity));
+                        var DJQty = Math.Abs(inventoryDJ.Sum(x => x.SupplyQuantity));
                         if (LkQty + DJQty != Qty) throw new Exception($"銆恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐗╂枡淇℃伅涓庣墿鏂欐壒娆′俊鎭洏鐩堟暟閲忎笉绗�");
                         if (LkQty == 0)//绔嬪簱鏃犲樊寮�
                         {
@@ -645,7 +645,7 @@
                                         Creater = App.User.UserName,
                                         LocationCode = inventoryInfo.LocationCode,
                                         OrderNo = order.order_no,
-                                        StockQuantity = Math.Abs(inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity),
+                                        StockQuantity = Math.Abs(inventoryInfo.SupplyQuantity),
                                         SupplyQuantity = 0,
                                         Remark = "鐩樹簭鍏ュ簱"
                                     };
@@ -653,13 +653,13 @@
                                     supplyTask_Hties.Add(supplyTask_Hty);
                                 }
                                 #endregion
-                                inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+                                inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                                 inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                                 inventoryInfo.SupplyQuantity = 0;
                                 inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
                             }
                             //_inventoryInfoService.UpdateData(inventoryInfos);
-                            inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+                            inventory_Batch.StockQuantity += inventory_Batch.SupplyQuantity;
                             inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity;
                             inventory_Batch.SupplyQuantity = 0;
                             //_inventory_BatchServices.UpdateData(inventory_Batch);
@@ -718,7 +718,7 @@
                                         Creater = App.User.UserName,
                                         LocationCode = inventoryInfo.LocationCode,
                                         OrderNo = order.order_no,
-                                        StockQuantity = Math.Abs(inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity),
+                                        StockQuantity = Math.Abs(inventoryInfo.SupplyQuantity),
                                         SupplyQuantity = 0,
                                         Remark = "鐩樹簭鍑哄簱"
                                     };
@@ -726,7 +726,7 @@
                                     supplyTask_Hties.Add(supplyTask_Hty);
                                 }
                                 #endregion
-                                inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+                                inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                                 inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                                 inventoryInfo.SupplyQuantity = 0;
                                 inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs"
index c0a4b66..299d649 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs"
@@ -45,16 +45,15 @@
                         if (orderDetail == null) throw new Exception($"鏈壘鍒扮洏鐐瑰崟銆恵cabinOrder.Order_no}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠墿鏂欐壒娆°�恵detail.batchNo}銆戠殑鏄庣粏淇℃伅");
                         decimal orderQty = detail.orderDetails?.Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0) ?? 0;
                         Dt_InventoryInfo inventoryInfo = inventoryInfos.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).First();
-                        var qty = inventoryInfo.SupplyQuantity - inventoryInfo.StockQuantity;
-                        if (orderQty != qty)
-                            throw new Exception($"鐩樼泩鍏ュ簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樼泩鏁伴噺銆恵qty}銆�");
-                        inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+                        if (orderQty != inventoryInfo.SupplyQuantity)
+                            throw new Exception($"鐩樼泩鍏ュ簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樼泩鏁伴噺銆恵inventoryInfo.SupplyQuantity}銆�");
+                        inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                         inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                         inventoryInfo.SupplyQuantity = 0;
                         inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
                         infosUp.Add(inventoryInfo);
                         Dt_Inventory_Batch inventory_Batch = inventory_Batches.First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
-                        inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+                        inventory_Batch.StockQuantity += inventory_Batch.SupplyQuantity;
                         inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity;
                         inventory_Batch.SupplyQuantity = 0;
                         batchesUp.Add(inventory_Batch);
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs"
index 3c120d4..84065f4 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs"
@@ -39,22 +39,21 @@
                             if (orderDetail == null) throw new Exception($"鏈壘鍒扮洏鐐瑰崟銆恵deliveryOrder.Out_no}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠墿鏂欐壒娆°�恵detail.batchNo}銆戠殑鏄庣粏淇℃伅");
                             decimal orderQty = detail.orderDetails?.Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0) ?? 0;
                             Dt_InventoryInfo inventoryInfo = inventoryInfos.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).First();
-                            var qty = inventoryInfo.SupplyQuantity - inventoryInfo.StockQuantity;
-                            if (orderQty != qty)
-                                throw new Exception($"鐩樹簭鍑哄簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樹簭鏁伴噺銆恵qty}銆�");
-                            inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+                            if (orderQty != Math.Abs(inventoryInfo.SupplyQuantity))
+                                throw new Exception($"鐩樹簭鍑哄簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樹簭鏁伴噺銆恵Math.Abs(inventoryInfo.SupplyQuantity)}銆�");
+                            inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                             inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                             inventoryInfo.SupplyQuantity = 0;
                             inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
                             infosUp.Add(inventoryInfo);
                             Dt_Inventory_Batch inventory_Batch = inventory_Batches.First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
-                            inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+                            inventory_Batch.StockQuantity += inventory_Batch.SupplyQuantity;
                             inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity;
                             inventory_Batch.SupplyQuantity = 0;
                             batchesUp.Add(inventory_Batch);
                             orderDetail.OotDetailStatus = "宸插畬鎴�";
                             cabinOrderDetailsUp.Add(orderDetail);
-                            #region 娣诲姞鐩樼泩鍏ュ簱浠诲姟
+                            #region 娣诲姞鐩樹簭鍑哄簱浠诲姟
                             Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty()
                             {
                                 WarehouseCode = inventoryInfo.WarehouseCode,
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/extension/stock/Dt_Inventory_Batch.js" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/extension/stock/Dt_Inventory_Batch.js"
index c33cb49..317cbac 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/extension/stock/Dt_Inventory_Batch.js"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/extension/stock/Dt_Inventory_Batch.js"
@@ -1,6 +1,8 @@
 
 //姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜
 
+import { el } from "element-plus/es/locales.mjs";
+
 let extension = {
   components: {
     //鏌ヨ鐣岄潰鎵╁睍缁勪欢
@@ -65,6 +67,11 @@
       //妗嗘灦鍒濆鍖栭厤缃悗
       //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔
       //this.detailOptions.columns.forEach(column=>{ });
+      this.buttons.forEach(x => {//name鏀逛负瑕侀殣钘忕殑鎸夐挳鍚嶅瓧
+        if (x.name == '缂� 杈�') {
+          x.name = '璋� 鎷�';
+        }
+      })
     },
     searchBefore(param) {
       //鐣岄潰鏌ヨ鍓�,鍙互缁檖aram.wheres娣诲姞鏌ヨ鍙傛暟
@@ -94,6 +101,16 @@
       //(3)this.editFormFields.瀛楁='xxx';
       //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊�
       //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions)
+      this.editFormFields.stockQuantity = 1;
+      this.editFormOptions.forEach((editForm) => {
+        editForm.forEach((x) => {
+          if (x.field == "stockQuantity") {
+            
+          } else {
+            x.readonly = true
+          }
+        })
+      })
     }
   }
 };
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/stock/Dt_Inventory_Batch.vue" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/stock/Dt_Inventory_Batch.vue"
index cef7d24..ed656f8 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/stock/Dt_Inventory_Batch.vue"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/stock/Dt_Inventory_Batch.vue"
@@ -1,7 +1,15 @@
 <template>
-  <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
-    :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
-    :table="table" :extend="extend">
+  <view-grid
+    ref="grid"
+    :columns="columns"
+    :detail="detail"
+    :editFormFields="editFormFields"
+    :editFormOptions="editFormOptions"
+    :searchFormFields="searchFormFields"
+    :searchFormOptions="searchFormOptions"
+    :table="table"
+    :extend="extend"
+  >
   </view-grid>
 </template>
 <script>
@@ -30,7 +38,7 @@
       productionDate: "",
       validityPeriod: "",
       remark: "",
-      AvailableQuantity: "",
+      availableQuantity: "",
     });
     const editFormOptions = ref([
       [
@@ -40,18 +48,14 @@
           field: "materielCode",
           type: "string",
         },
+      ],
+      [
         {
           title: "鐗╂枡鍚嶇О",
           required: true,
           field: "materielName",
           type: "string",
         },
-        {
-          title: "鐗╂枡瑙勬牸",
-          required: true,
-          field: "materielSpec",
-          type: "string",
-        }
       ],
       [
         {
@@ -60,67 +64,15 @@
           field: "batchNo",
           type: "string",
         },
+      ],
+      [
         {
-          title: "搴撳瓨鏁�",
+          title: "璋冩嫧鏁伴噺",
           required: true,
           field: "stockQuantity",
           type: "number",
         },
-        {
-          title: "寰呭嚭搴撴暟閲�",
-          required: true,
-          field: "outboundQuantity",
-          type: "number",
-        },
-          {
-          title: "鍙敤搴撳瓨鏁�",
-          required: true,
-          field: "availableQuantity",
-          type: "number",
-        }
       ],
-      [
-        {
-          title: "鐩樼偣鏁�",
-          required: true,
-          field: "supplyQuantity",
-          type: "number",
-        },
-        {
-          title: "ERP瀹為檯搴撳瓨鏁�",
-          required: true,
-          field: "erpStockQuantity",
-          type: "number",
-        },
-        // {
-        //   title: "搴撳瓨宸紓",
-        //   field: "status",
-        //   type: "select",
-        //   bind: { key: "stockDifference", data: [] }
-        // }
-      ],
-      [
-        // {
-        //   title: "鐢熶骇鏃ユ湡",
-        //   field: "productionDate",
-        //   type: "date",
-        //   span: 12
-        // },
-        {
-          title: "鏈夋晥鏈熻嚦",
-          field: "validityPeriod",
-          type: "date",
-          span: 12
-        }
-      ],
-      [
-        {
-          title: "澶囨敞",
-          field: "remark",
-          type: "string",
-          span: 24
-        }
-      ]
     ]);
     const searchFormFields = ref({
       materielCode: "",
@@ -129,9 +81,9 @@
     });
     const searchFormOptions = ref([
       [
-        { title: "鐗╂枡缂栧彿", field: "materielCode" ,type: "like" },
-        { title: "鐗╂枡鍚嶇О", field: "materielName" ,type: "like"},
-        { title: "鎵规鍙�", field: "batchNo" ,type: "like"},
+        { title: "鐗╂枡缂栧彿", field: "materielCode", type: "like" },
+        { title: "鐗╂枡鍚嶇О", field: "materielName", type: "like" },
+        { title: "鎵规鍙�", field: "batchNo", type: "like" },
       ],
     ]);
     const columns = ref([
@@ -189,17 +141,28 @@
       },
       {
         field: "supplyQuantity",
-        title: "鐩樼偣鏁�",
+        title: "鐩樼偣宸紓鏁�",
         type: "number",
         width: 100,
         align: "left",
-      },
-         {
-          title: "鍙敤搴撳瓨鏁�",
-          required: true,
-          field: "availableQuantity",
-          type: "number",
+        cellStyle: (row) => {
+          const value = row.supplyQuantity;
+          if (value > 0) {
+            return { color: "#00ff00" }; // 缁胯壊
+          } else if (value < 0) {
+            return { color: "#ff0000" }; // 绾㈣壊
+          }
+          // else {
+          //   return { color: '#000000' }; // 榛戣壊
+          // }
         },
+      },
+      {
+        title: "鍙敤搴撳瓨鏁�",
+        required: true,
+        field: "availableQuantity",
+        type: "number",
+      },
       {
         field: "erpStockQuantity",
         title: "ERP瀹為檯搴撳瓨鏁�",
@@ -249,7 +212,7 @@
         type: "string",
         width: 100,
         align: "left",
-        hidden: true
+        hidden: true,
       },
       {
         field: "modifyDate",
@@ -257,7 +220,7 @@
         type: "datetime",
         width: 160,
         align: "left",
-        hidden: true
+        hidden: true,
       },
       {
         field: "remark",
@@ -265,7 +228,7 @@
         type: "string",
         width: 100,
         align: "left",
-        hidden: true
+        hidden: true,
       },
     ]);
     const detail = ref({
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/stock/stockInfo.vue" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/stock/stockInfo.vue"
index 6f8f0ce..ddff682 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/stock/stockInfo.vue"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/stock/stockInfo.vue"
@@ -128,7 +128,7 @@
         },
         {
           field: "supplyQuantity",
-          title: "鐩樼偣鏁�",
+          title: "鐩樼偣宸紓鏁�",
           type: "number",
           span: 8
         },
@@ -327,7 +327,7 @@
         },
       {
         field: "supplyQuantity",
-        title: "鐩樼偣鏁�",
+        title: "鐩樼偣宸紓鏁�",
         type: "number",
         width: 100,
         align: "left",

--
Gitblit v1.9.3