From 97073e9e6d03114221436ee0aa1e143d6e2c4a09 Mon Sep 17 00:00:00 2001 From: wankeda <Administrator@DESKTOP-HAU3ST3> Date: 星期一, 04 八月 2025 13:07:39 +0800 Subject: [PATCH] 出入库代码逻辑优化 --- WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs b/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs index e5f0771..e22363d 100644 --- a/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs +++ b/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs @@ -74,6 +74,24 @@ //ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)); //return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => b).OrderBy(a => a.CreateDate).Includes(a => a.Details).ToList(); } + + public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, List<string> locationCodes) + { + //List<Dt_StockInfo> stockInfos = null; + if (!string.IsNullOrEmpty(lotNo)) + { + return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode && v.BatchNo == lotNo)).ToList(); + } + else + { + return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList(); + } + + //return stockInfos; + //ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>().Where(x => locationCodes.Contains(x.LocationCode)); + //ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)); + //return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => b).OrderBy(a => a.CreateDate).Includes(a => a.Details).ToList(); + } /// <summary> /// 鏍规嵁璐т綅缂栧彿鑾峰彇缁勭洏搴撳瓨淇℃伅 /// </summary> @@ -94,7 +112,7 @@ } public List<Dt_StockInfo> GetStockInfosByPalletCode(List<string> palletCodes) { - return Db.Queryable<Dt_StockInfo>().Where(x => palletCodes.Contains(x.BatchNo)).Includes(x => x.Details).ToList(); + return Db.Queryable<Dt_StockInfo>().Where(x => palletCodes.Contains(x.PalletCode)).Includes(x => x.Details).ToList(); } public List<Dt_StockInfo> GetStockInfosExclude(string materielCode, List<string> palletCodes) { -- Gitblit v1.9.3