From 9ad0f71549e3fbaea1acad38a216fd2c3a658149 Mon Sep 17 00:00:00 2001
From: Tiandele <tiandele@hnkhzn.com>
Date: 星期五, 20 三月 2026 14:54:43 +0800
Subject: [PATCH] 新增库存锁定、库存解锁

---
 项目代码/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs     |   45 +++++++++++
 项目代码/WMS/WMSClient/src/api/buttons.js                                            |   60 ++++++++++----
 项目代码/WMS/WMSClient/src/extension/widesea_wms/stock/VV_StockInfo.js               |   52 +++++++++++++
 项目代码/WMS/WMSServer/WIDESEA_IStorageBasicService/Stock/IVV_StockInfoService.cs    |    3 
 项目代码/WMS/WMSServer/WIDESEA_WMSServer/Controllers/Stock/VV_StockInfoController.cs |   21 +++++
 5 files changed, 161 insertions(+), 20 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/api/buttons.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/api/buttons.js"
index e3fb002..b50dc23 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/api/buttons.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/api/buttons.js"
@@ -103,7 +103,7 @@
     onClick: function () {
       this.printClick()
     }
-  },{
+  }, {
     name: '浠诲姟瀹屾垚',
     // icon: 'el-icon-printer',
     type: 'primary',
@@ -111,9 +111,9 @@
     // color: '#529b2e',
     value: 'TaskHandComplete',
     onClick: function () {
-      
+
     }
-  },{
+  }, {
     name: '鐩存帴鍑哄簱',
     // icon: 'el-icon-printer',
     type: 'primary',
@@ -121,26 +121,26 @@
     // color: '#529b2e',
     value: 'OutBound',
     onClick: function () {
-      
+
     }
-  },{
+  }, {
     name: '鍒濆鍖栧簱浣�',
     type: 'primary',
     // color: '#529b2e',
     value: 'initializeLocation',
     onClick: function () {
-      
+
     }
-    
-  },{
+
+  }, {
     name: '琛ュ綍鏁版嵁',
     type: 'primary',
     // color: '#529b2e',
     value: 'SupplementationData',
     onClick: function () {
-      
+
     }
-  },{
+  }, {
     name: '鎸囧畾鍑哄簱',
     // icon: 'el-icon-printer',
     type: 'primary',
@@ -148,10 +148,10 @@
     // color: '#529b2e',
     value: 'ManualOutBound',
     onClick: function () {
-      
+
     }
   }
-  ,{
+  , {
     name: '鍚敤',
     // icon: 'el-icon-printer',
     type: 'primary',
@@ -159,9 +159,9 @@
     // color: '#529b2e',
     value: 'EnableLocation',
     onClick: function () {
-      
+
     }
-  },{
+  }, {
     name: '绂佺敤',
     // icon: 'el-icon-printer',
     type: 'primary',
@@ -169,7 +169,7 @@
     // color: '#529b2e',
     value: 'DisableLocation',
     onClick: function () {
-      
+
     }
   },
   {
@@ -180,7 +180,7 @@
     // color: '#529b2e',
     value: 'Boxing',
     onClick: function () {
-      
+
     }
   }
   ,
@@ -192,9 +192,9 @@
     // color: '#529b2e',
     value: 'RequestIn',
     onClick: function () {
-      
+
     }
-  },{
+  }, {
     name: '纭浠诲姟',
     // icon: 'el-icon-printer',
     type: 'primary',
@@ -202,7 +202,29 @@
     // color: '#529b2e',
     value: 'confirmTask',
     onClick: function () {
-      
+
+    }
+  }
+  , {
+    name: '搴撳瓨閿佸畾',
+    // icon: 'el-icon-printer',
+    type: 'primary',
+    // plain: true,
+    // color: '#529b2e',
+    value: 'stockLock',
+    onClick: function () {
+
+    }
+  }
+  , {
+    name: '搴撳瓨瑙i攣',
+    // icon: 'el-icon-printer',
+    type: 'primary',
+    // plain: true,
+    // color: '#529b2e',
+    value: 'stockUnLock',
+    onClick: function () {
+
     }
   }
 ]
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/extension/widesea_wms/stock/VV_StockInfo.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/extension/widesea_wms/stock/VV_StockInfo.js"
index 4a47084..cc46243 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/extension/widesea_wms/stock/VV_StockInfo.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/extension/widesea_wms/stock/VV_StockInfo.js"
@@ -91,6 +91,58 @@
         }
       };
 
+
+
+
+      // 搴撳瓨閿佸畾
+      var stockLock = this.buttons.find(x => x.value == "stockLock");
+      if (stockLock != null) {
+        stockLock.onClick = () => {
+          let rows = this.$refs.table.getSelected();
+          if (rows.length == 0) {
+            return this.$error("璇烽�夋嫨鏁版嵁!");
+          }
+          let ids = rows.map(x => {
+            return x.id;
+          })
+          this.http.post(`/api/VV_StockInfo/stockLock`, ids, "搴撳瓨閿佸畾涓�...").then((result) => {
+            if (result.status) {
+              this.$Message.success(result.message);
+              this.refresh();
+            } else {
+              this.$Message.error(result.message);
+              this.refresh();
+            }
+          })
+
+        }
+      };
+
+      // 搴撳瓨瑙i攣
+      var stockUnLock = this.buttons.find(x => x.value == "stockUnLock");
+      if (stockUnLock != null) {
+        stockUnLock.onClick = () => {
+          let rows = this.$refs.table.getSelected();
+          if (rows.length == 0) {
+            return this.$error("璇烽�夋嫨鏁版嵁!");
+          }
+          let ids = rows.map(x => {
+            return x.id;
+          })
+          this.http.post(`/api/VV_StockInfo/stockUnLock`, ids, "搴撳瓨瑙i攣涓�...").then((result) => {
+            if (result.status) {
+              this.$Message.success(result.message);
+              this.refresh();
+            } else {
+              this.$Message.error(result.message);
+              this.refresh();
+            }
+          })
+
+        }
+      };
+
+
       // this.columns.forEach((column) => {
       //   if (column.field == 'materielName') {
       //     column.formatter = (row) => {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicService/Stock/IVV_StockInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicService/Stock/IVV_StockInfoService.cs"
index 8a18632..c117742 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicService/Stock/IVV_StockInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicService/Stock/IVV_StockInfoService.cs"
@@ -2,4 +2,7 @@
 
 public interface IVV_StockInfoService : IService<VV_StockInfo>
 {
+    WebResponseContent stockLock(object[] keys);
+
+    WebResponseContent stockUnLock(object[] keys);
 }
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs"
index 27ef51c..2396fab 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs"
@@ -11,8 +11,51 @@
 
 public class VV_StockInfoService : ServiceBase<VV_StockInfo, IVV_StockInfoRepository>, IVV_StockInfoService
 {
-    public VV_StockInfoService(IVV_StockInfoRepository BaseDal) : base(BaseDal)
+	private readonly IDt_PalletStockInfoRepository _repository;
+    public VV_StockInfoService(IVV_StockInfoRepository BaseDal, IDt_PalletStockInfoRepository repository) : base(BaseDal)
     {
+        _repository = repository;
     }
 
+    public WebResponseContent stockLock(object[] keys)
+    {
+		WebResponseContent content = new WebResponseContent();
+		try
+		{
+			foreach (var item in keys)
+			{
+				var stock = _repository.QueryFirst(x => x.Id == Convert.ToInt32(item));
+				stock.StockStatus= 1;
+                _repository.UpdateData(stock);
+
+            }
+			return content.OK("閿佸畾鎴愬姛!");
+		}
+		catch (Exception e)
+		{
+			return content.Error(e.Message);
+		}
+
+    }
+
+    public WebResponseContent stockUnLock(object[] keys)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            foreach (var item in keys)
+            {
+                var stock = _repository.QueryFirst(x => x.Id == Convert.ToInt32(item));
+                stock.StockStatus = 0;
+                _repository.UpdateData(stock);
+
+            }
+            return content.OK("瑙i攣鎴愬姛!");
+        }
+        catch (Exception e)
+        {
+            return content.Error(e.Message);
+        }
+
+    }
 }
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_WMSServer/Controllers/Stock/VV_StockInfoController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_WMSServer/Controllers/Stock/VV_StockInfoController.cs"
index 655eee8..3d8b7e9 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_WMSServer/Controllers/Stock/VV_StockInfoController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_WMSServer/Controllers/Stock/VV_StockInfoController.cs"
@@ -11,4 +11,25 @@
     {
 
     }
+    /// <summary>
+    /// 搴撳瓨閿佸畾
+    /// </summary>
+    /// <param name="keys"></param>
+    /// <returns></returns>
+    [HttpPost,HttpGet,Route("stockLock"),AllowAnonymous]
+    public WebResponseContent stockLock([FromBody]object[] keys)
+    {
+        return Service.stockLock(keys);
+    }
+    /// <summary>
+    /// 搴撳瓨瑙i攣
+    /// </summary>
+    /// <param name="keys"></param>
+    /// <returns></returns>
+    [HttpPost, HttpGet, Route("stockUnLock"), AllowAnonymous]
+    public WebResponseContent stockUnLock([FromBody] object[] keys)
+    {
+        return Service.stockUnLock(keys);
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.9.3