From 3fb6a51a60230f42be4db54cc4371a7106b322a4 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期五, 06 二月 2026 18:23:24 +0800
Subject: [PATCH] Merge branch 'htq20251215' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu into htq20251215

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockDetailByMaterielService.cs |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockDetailByMaterielService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockDetailByMaterielService.cs"
index 7ca9282..385eed4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockDetailByMaterielService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockDetailByMaterielService.cs"
@@ -18,11 +18,13 @@
     {
         private readonly IUnitOfWorkManage _unitOfWorkManage;
         private readonly SqlSugarClient _dbBase;
+        private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
 
-        public StockDetailByMaterielService(IUnitOfWorkManage unitOfWorkManage)
+        public StockDetailByMaterielService(IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _dbBase = unitOfWorkManage.GetDbClient();
+            _stockInfoDetailRepository = stockInfoDetailRepository;
         }
 
 
@@ -146,7 +148,12 @@
                     }
                 }
 
-                
+                decimal totalStockQuantity = 0;
+                if (groupedData.Count > 0)
+                {
+                    totalStockQuantity = groupedData.Values.Sum(x => x.StockQuantity);
+                }
+
                 materielnfoStatistics = groupedData.Values.ToList();
                 int startIndex = (options.Page - 1) * options.Rows;
                 int endIndex = Math.Min(startIndex + options.Rows, materielnfoStatistics.Count);
@@ -160,12 +167,25 @@
                 }
 
                 int count = groupedData.Count;
-                return new PageGridData<StockDetailByMateriel>(count, materielnfoStatistics);
+                return new PageGridData<StockDetailByMateriel>(count, materielnfoStatistics)
+                {
+                    TotalStockQuantity = totalStockQuantity 
+                };
             }
             catch (Exception ex)
             {
                 return new PageGridData<StockDetailByMateriel>();
             }
         }
+
+        public WebResponseContent CalculateStock(string warehouseCode,string materielCode)
+        {
+           var calculateStock =_stockInfoDetailRepository.QueryData(x => x.WarehouseCode == warehouseCode && x.MaterielCode == materielCode).Sum(x => x.StockQuantity);
+           if(calculateStock == 0)
+            {
+                return WebResponseContent.Instance.Error("鏈壘鍒板簱瀛�");
+            }
+            return WebResponseContent.Instance.OK(data: calculateStock);
+        }
     }
 }

--
Gitblit v1.9.3