From d0712fcf60aa1ef5ddfb8d18b583a742893a7aea Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <1247017146@qq.com>
Date: 星期二, 03 六月 2025 11:04:52 +0800
Subject: [PATCH] 代码提交

---
 CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   84 +++++++++++++++++++++++++++--------------
 1 files changed, 55 insertions(+), 29 deletions(-)

diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index 58f94ff..5ed18a6 100644
--- a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -3,6 +3,7 @@
 using SixLabors.Fonts.Tables.AdvancedTypographic;
 using SqlSugar;
 using System.Text.RegularExpressions;
+using System.Threading.Tasks;
 using WIDESEA_Cache;
 using WIDESEA_Core;
 using WIDESEA_Core.Const;
@@ -352,7 +353,7 @@
         WebResponseContent content = new WebResponseContent();
         try
         {
-            if (task.TaskType == (int)TaskInboundTypeEnum.InNG || task.TaskType == (int)TaskInboundTypeEnum.InQuality)
+            if (task.TaskType == (int)TaskInboundTypeEnum.InNG)
             {
                 task.TaskState = (int)TaskInStatusEnum.SC_InFinish;
                 // 鍒涘缓鍘嗗彶浠诲姟瀹炰緥妯″瀷
@@ -419,6 +420,9 @@
             Console.WriteLine(err.Message.ToString());
             LogFactory.GetLog("浠诲姟瀹屾垚").Error(true, err);
             content.Error(err.Message);
+            task.ErrorMessage = err.Message;
+            task.TaskState = (int)TaskInStatusEnum.SC_InExecuting;
+            await BaseDal.Update(task);
         }
         return content;
     }
@@ -1082,11 +1086,11 @@
                 .ToList().Select(x => x.DeviceCode).ToList();
 
             var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
-                .Where(x => x.ProductionLine == station.productLine)
+                .WhereIF(!station.Roadway.Contains("JZSC"), x => x.ProductionLine == station.productLine)
                 .Where(x => x.AreaCode == areaCode && x.IsFull == false)
-                .Includes(x=>x.StockInfoDetails)
+                .Includes(x => x.StockInfoDetails)
                 .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "绌烘墭鐩�"))
-                .Includes(x=>x.LocationInfo)
+                .Includes(x => x.LocationInfo)
                 .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) // 杩囨护鏉′欢
                 .OrderBy(x => x.CreateDate) // 鎺掑簭
@@ -1111,7 +1115,7 @@
     {
         return new Dt_Task
         {
-            Grade = tag == 104 ? (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") ? 1 : 2) : (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") ? 2 : 1),
+            Grade = tag == 104 ? (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC")|| stockInfo.LocationInfo.RoadwayNo.Contains("JZSC") ? 1 : 2) : (stockInfo.LocationInfo.RoadwayNo.Contains("CWSC") || stockInfo.LocationInfo.RoadwayNo.Contains("JZSC") ? 2 : 1),
             Roadway = stockInfo.LocationInfo.RoadwayNo,
             TargetAddress = position,
             Dispatchertime = DateTime.Now,
@@ -1646,6 +1650,28 @@
 
     #endregion
 
+    #region 鏌ヨ闈欑疆绌洪棽搴撲綅
+    public WebResponseContent QueryLocationFreeJZ(string RoadwayNo)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            var result = _locationRepository.QueryData(x => x.EnalbeStatus != (int)EnableEnum.Disable && x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo.Contains("JZSC"));
+            LogFactory.GetLog($"闈欑疆{RoadwayNo}鏌ヨ绌洪棽搴撲綅").Info(true, $"{JsonConvert.SerializeObject(result)}");
+            if (result.Count > 5)
+            {
+                return content.OK();
+            }
+            return content.Error("搴撲綅宸叉弧");
+        }
+        catch (Exception ex)
+        {
+            return content.Error(ex.Message);
+        }
+    }
+
+    #endregion
+
     #region 澶у睆鎺ュ彛
 
     /// <summary>
@@ -2007,32 +2033,32 @@
             }
 
             #region 鏇存柊搴撳瓨淇℃伅锛堟殏鏃朵笉闇�瑕侊級
-            //if (stock.IsFull)
-            //{
-            //    // 鏌ヨ绗﹀悎鏉′欢鐨勫簱瀛樹俊鎭�
-            //    var stocks = _stockInfoRepository.QueryData(x => x.AreaCode == stock.AreaCode && x.ProductionLine == stock.ProductionLine && x.SpecialParameterDuration != stock.SpecialParameterDuration);
+            if (stock.IsFull)
+            {
+                // 鏌ヨ绗﹀悎鏉′欢鐨勫簱瀛樹俊鎭�
+                var stocks = _stockInfoRepository.QueryData(x => x.AreaCode == stock.AreaCode && x.ProductionLine == stock.ProductionLine && x.SpecialParameterDuration != stock.SpecialParameterDuration);
 
-            //    // 鏌ヨ浠诲姟淇℃伅
-            //    var tasks = BaseDal.QueryData(x => x.PalletCode != stock.PalletCode && x.ProductionLine == stock.ProductionLine).Select(x => x.PalletCode).ToList();
+                // 鏌ヨ浠诲姟淇℃伅
+                var tasks = BaseDal.QueryData(x => x.PalletCode != stock.PalletCode && x.ProductionLine == stock.ProductionLine).Select(x => x.PalletCode).ToList();
 
-            //    if (stocks != null && stocks.Count > 0)
-            //    {
-            //        // 杩囨护鍑洪渶瑕佹洿鏂扮殑搴撳瓨淇℃伅
-            //        var stocksToUpdate = stocks.Where(item => !tasks.Contains(item.PalletCode)).ToList();
-            //        foreach (var item in stocksToUpdate)
-            //        {
-            //            // 鏇存柊搴撳瓨淇℃伅鐨勭壒瀹氬弬鏁�
-            //            item.SpecialParameterDuration = stock.SpecialParameterDuration;
-            //            item.ParameterInfos = stock.ParameterInfos;
-            //            item.OutboundTime = Convert.ToDateTime(item.LinedProcessFeedbackTime == null ? item.CreateDate : item.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(stock.SpecialParameterDuration));
-            //        }
-            //        if (stocksToUpdate.Count > 0)
-            //        {
-            //            // 寮傛鏇存柊搴撳瓨淇℃伅
-            //            var isUpdates = await _stockInfoRepository.UpdateDataAsync(stocksToUpdate);
-            //        }
-            //    }
-            //}
+                if (stocks != null && stocks.Count > 0)
+                {
+                    // 杩囨护鍑洪渶瑕佹洿鏂扮殑搴撳瓨淇℃伅
+                    var stocksToUpdate = stocks.Where(item => !tasks.Contains(item.PalletCode)).ToList();
+                    foreach (var item in stocksToUpdate)
+                    {
+                        // 鏇存柊搴撳瓨淇℃伅鐨勭壒瀹氬弬鏁�
+                        item.SpecialParameterDuration = stock.SpecialParameterDuration;
+                        item.ParameterInfos = stock.ParameterInfos;
+                        item.OutboundTime = Convert.ToDateTime(item.LinedProcessFeedbackTime == null ? item.CreateDate : item.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(stock.SpecialParameterDuration));
+                    }
+                    if (stocksToUpdate.Count > 0)
+                    {
+                        // 寮傛鏇存柊搴撳瓨淇℃伅
+                        var isUpdates = await _stockInfoRepository.UpdateDataAsync(stocksToUpdate);
+                    }
+                }
+            }
             #endregion
 
             // 娣诲姞鍘嗗彶浠诲姟

--
Gitblit v1.9.3