From 9843b47612ee6ab23e3e36bf74b14c11354997af Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期日, 23 三月 2025 15:25:32 +0800
Subject: [PATCH] 1

---
 CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
index ba9ebfd..2eb9d42 100644
--- a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
+++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -20,6 +20,7 @@
     /// <returns>鍖呭惈浠诲姟淇℃伅鐨勫搷搴斿唴瀹�</returns>
     public async Task<WebResponseContent> RequestInTask(RequestTaskDto input)
     {
+        Console.WriteLine($"{JsonConvert.SerializeObject(input)}");
         // 鍒涘缓涓�涓猈ebResponseContent瀵硅薄
         WebResponseContent content = new WebResponseContent();
         try
@@ -978,17 +979,17 @@
             .ToList().Select(x => x.DeviceCode).ToList();
 
         var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
-                                .IncludesAllFirstLayer().Where(x => x.ProductionLine == productLine)
-                                .Where(x => x.AreaCode == areaCode && x.IsFull == false)
-                                .Where(x => x.StockInfoDetails != null && x.StockInfoDetails.Any(y => y.MaterielCode == "绌烘墭鐩�"))
-                                .WhereIF(!deviceCode.IsNullOrEmpty(), x => x.LocationInfo != null && deviceCode.Contains(x.LocationInfo.RoadwayNo))
-                                .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
+                                .Includes(x => x.LocationInfo)
+                                .Includes(x => x.StockInfoDetails)
+                                .Where(x => x.AreaCode == areaCode && x.IsFull == false && x.ProductionLine == productLine)
+                                .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo))
+                                .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
+                                .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "绌烘墭鐩�"))
                                 .OrderBy(x => x.CreateDate) // 鎺掑簭
                                 .FirstAsync();
 
         if (result.IsNullOrEmpty())
             ConsoleHelper.WriteColorLine($"甯告俯{productLine}绌烘墭鐩樺簱瀛樹笉瓒�", ConsoleColor.Red);
-
 
         return result;
     }
@@ -1018,16 +1019,16 @@
                 .Where(x => x.DeviceCode.Contains("CWSC")) // 杩囨护鏉′欢
                 .ToList().Select(x => x.DeviceCode).ToList();
 
-
             // 淇敼鍚庣殑鏌ヨ浠g爜
             var stockInfo = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
-                                .IncludesAllFirstLayer()
+                                .Includes(x => x.LocationInfo)
+                                .Includes(x => x.StockInfoDetails)
                                 .Where(x => x.ProductionLine == station.productLine)
                                 .Where(x => x.AreaCode == "CWSC3" && x.IsFull == true)
                                 // 澧炲姞瀵� LocationInfo 鐨勭┖鍊兼鏌�
-                                .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock)
+                                .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock)
                                 // 澧炲姞瀵� LocationInfo 鐨勭┖鍊兼鏌�
-                                .WhereIF(!deviceCode.IsNullOrEmpty(), x => x.LocationInfo != null && deviceCode.Contains(x.LocationInfo.RoadwayNo))
+                                .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo))
                                 .OrderBy(x => x.OutboundTime)
                                 .FirstAsync();
 
@@ -1065,7 +1066,6 @@
             BaseDal.AddData(task);
             stockInfo.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable;
             _locationRepository.UpdateData(stockInfo.LocationInfo);
-
 
             _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(stockInfo.LocationInfo, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum);
 

--
Gitblit v1.9.3