From 7dbf72fde7069ecbe54ce7c2133eaa16424246b5 Mon Sep 17 00:00:00 2001
From: 陈勇 <chenyong@hnkhzn.com>
Date: 星期二, 19 十一月 2024 10:13:40 +0800
Subject: [PATCH] 实盘空托盘查找修改

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index 177bc6e..7143a2d 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1,6 +1,7 @@
 锘縰sing log4net.Core;
 using Mapster;
 using Masuit.Tools;
+using Masuit.Tools.Models;
 using WIDESEA_DTO.MOM;
 using WIDESEA_DTO.WMS;
 using WIDESEA_IStorageBasicRepository;
@@ -804,12 +805,15 @@
         //return _stockInfoRepository.QueryFirstNavAsync(x => x.AreaCode == areaCode && Convert.ToDateTime(x.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(x.SpecialParameterDuration)) < DateTime.Now
         //                        && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && roadways.Contains(x.LocationInfo.RoadwayNo) && x.StockInfoDetails.Any(x => x.Status == (int)StockStateEmun.宸插叆搴�) && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).Result;
 
-        var result = await _stockInfoRepository.QueryFirstNavAsync(x =>
+        var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>().Where(x =>
             x.AreaCode == areaCode &&
-            Convert.ToDateTime(x.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(x.SpecialParameterDuration)) < DateTime.Now &&
-            x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock &&
-            roadways.Contains(x.LocationInfo.RoadwayNo) &&
-            x.StockInfoDetails != null && x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.宸插叆搴�));
+            Convert.ToDateTime(x.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(x.SpecialParameterDuration)) < DateTime.Now)
+            .Includes(x => x.LocationInfo)
+            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && roadways.Contains(x.LocationInfo.RoadwayNo))
+            .Includes(x => x.StockInfoDetails)
+            .Where(x => x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.宸插叆搴�))
+            .OrderBy(x => x.CreateDate)
+            .FirstAsync();
         return result;
     }
 
@@ -819,11 +823,13 @@
     private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode, List<string> roadways)
     {
         //return _stockInfoRepository.QueryFirstNavAsync(x => x.StockInfoDetails.Any(x => x.MaterielCode == "绌烘墭鐩�") && roadways.Contains(x.LocationInfo.RoadwayNo) && x.StockInfoDetails.Any(x => x.Status == (int)StockStateEmun.宸插叆搴�) && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).Result;
-        var result = await _stockInfoRepository.QueryFirstNavAsync(x =>
-            x.StockInfoDetails != null && x.StockInfoDetails.Any(detail => detail.MaterielCode == "绌烘墭鐩�") &&
-            roadways.Contains(x.LocationInfo.RoadwayNo) &&
-            x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.宸插叆搴�) &&
-            x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock);
+        var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
+            .Includes(x => x.LocationInfo)
+            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && roadways.Contains(x.LocationInfo.RoadwayNo))
+            .Includes(x => x.StockInfoDetails)
+            .Where(x => x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.宸插叆搴� && detail.MaterielCode == "绌烘墭鐩�"))
+            .OrderBy(x => x.CreateDate)
+            .FirstAsync();
         return result;
     }
 

--
Gitblit v1.9.3