From f6a30a6e9d6f200f1a39d0dee3194b7ea5961e7b Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期三, 20 十一月 2024 10:15:52 +0800
Subject: [PATCH] 站台代码

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   41 +++++++++++++++++++++++++++++------------
 1 files changed, 29 insertions(+), 12 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..da13577 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;
@@ -435,6 +436,8 @@
         var respone = JsonConvert.DeserializeObject<ResponeAgingInputDto>(result.Data.ToString());
         stock.LinedProcessFeedbackTime = respone.LinedProcessFeedbackTime;
         stock.SpecialParameterDuration = respone.SpecialParameterDuration;
+        //2024骞�11鏈�16鏃ワ細鏂板瀛楁璁$畻搴斿嚭搴撴椂闂�
+        stock.OutboundTime = Convert.ToDateTime(respone.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(respone.SpecialParameterDuration));
 
         // 璁板綍鏃ュ織
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟瀹屾垚", $"璐т綅鍦板潃锛歿task.TargetAddress},淇敼鍚庤揣浣嶆暟鎹細{locationInf}");
@@ -804,12 +807,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 +825,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;
     }
 
@@ -1378,13 +1386,22 @@
     /// <param name="areaId">鍖哄煙涓婚敭</param>
     /// <param name="roadWay">宸烽亾</param>
     /// <returns></returns>
-    public async Task<DtLocationInfo> GetLocationDistributeAsync(string roadWay)
+    public async Task<DtLocationInfo> GetLocationDistributeAsync(string roadWay, bool IsFull = true)
     {
         #region 鑾峰彇璐т綅
 
         try
         {
-            var locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay);
+            List<DtLocationInfo> locations;
+            if (IsFull)
+            {
+                locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay);
+            }
+            else
+            {
+                locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay /*&& x.LocationType ==*/);
+            }
+
             if (locations == null)
             {
                 return null;

--
Gitblit v1.9.3