From 40ed23083b660473152994e55363f823a6adcac0 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <1247017146@qq.com>
Date: 星期一, 07 四月 2025 14:28:55 +0800
Subject: [PATCH] 11

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
index 2a3c296..e990f18 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -1,8 +1,6 @@
 锘縰sing Masuit.Tools;
 using SqlSugar;
 using WIDESEA_Common.CustomModels;
-
-//using WIDESEA_Common.CustomModels;
 using WIDESEA_Core.Const;
 using WIDESEA_DTO.MOM;
 using WIDESEA_DTO.WMS;
@@ -460,7 +458,7 @@
             else
             {
                 locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Distribute && x.RoadwayNo == requestTask.Roadways && x.EnalbeStatus == 1 && x.LocationType == 1);
-                if (locations == null)
+                if (locations.IsNullOrEmpty())
                 {
                     locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == requestTask.Roadways && x.EnalbeStatus == 1 && x.LocationType == 1);
                 }
@@ -1028,6 +1026,13 @@
                 .Where(x => x.DeviceCode.Contains("CWSC")) // 杩囨护鏉′欢
                 .ToList().Select(x => x.DeviceCode).ToList();
 
+            var outBoundMateriel = AppSettings.app<OutBoundMateriel>("OutBoundMateriel");
+            List<string>? materielCodes = outBoundMateriel.Count != 0
+                ? outBoundMateriel.Where(x => x.ProductionLine == station.productLine && x.ProcessCode == "CWSC3")
+                                  .Select(x => x.MaterielCode)
+                                  .ToList()
+                : null;
+
             // 浠庣紦瀛樹腑鑾峰彇搴撳瓨淇℃伅
             IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo);
             List<DtStockInfo> stockInfoList = stockInfos.Values.ToList();
@@ -1044,6 +1049,7 @@
                 .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock)
                 // 澧炲姞瀵� LocationInfo 鐨勭┖鍊兼鏌�
                 .WhereIF(!deviceCode.IsNullOrEmpty(), x => x.LocationInfo != null && deviceCode.Contains(x.LocationInfo.RoadwayNo))
+                .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode)))
                 .FirstOrDefault();
 
             if (stockInfo == null) throw new Exception($"搴撳唴{station.productLine}鏃犳弧瓒虫潯浠剁殑搴撳瓨鍙嚭搴�");

--
Gitblit v1.9.3