From 8d54aef9335f78f76a8f1509341023bba773d357 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 20 四月 2026 09:42:45 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockDetailByMaterielService.cs | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 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..626c036 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);
@@ -161,11 +168,22 @@
int count = groupedData.Count;
return new PageGridData<StockDetailByMateriel>(count, materielnfoStatistics);
+
}
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