From a3014a01e07619105d597d0c51cf195217b0806f Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 29 七月 2025 10:47:01 +0800
Subject: [PATCH] 1

---
 WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs b/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs
index 8acf8a4..714c82e 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs
@@ -75,6 +75,32 @@
             //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>
+        /// <param name="locationCodes"></param>
+        /// <returns></returns>
+        public List<Dt_StockInfo> LocationCodesGetStockInfos(List<string> locationCodes, StockStatusEmun statusEmun = StockStatusEmun.宸插叆搴�)
+        {
+            return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode) /*&& x.StockStatus == statusEmun.ObjToInt()*/).Includes(x => x.Details).ToList();
+        }
         public List<Dt_StockInfo> GetStockInfosByIds(List<int> ids)
         {
             return Db.Queryable<Dt_StockInfo>().Where(x => ids.Contains(x.Id)).Includes(x => x.Details).ToList();

--
Gitblit v1.9.3