From 02a4fdd78cef9c7d2a26bfb9aa187179cf0baac3 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 25 二月 2026 17:44:26 +0800
Subject: [PATCH] 1

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |  238 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 152 insertions(+), 86 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 5f638a5..bce772b 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,5 +1,7 @@
-锘縰sing Mapster;
+锘縰sing AngleSharp.Io;
+using Mapster;
 using Masuit.Tools;
+using SixLabors.Fonts.Tables.AdvancedTypographic;
 using SqlSugar;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
@@ -9,6 +11,7 @@
 using WIDESEA_DTO.WMS;
 using WIDESEA_IServices;
 using WIDESEA_IStoragIntegrationServices;
+using WIDESEA_Model.Models;
 using WIDESEAWCS_BasicInfoRepository;
 using WIDESEAWCS_QuartzJob.Models;
 
@@ -85,30 +88,30 @@
         {
             if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
             {
-                if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
+                //if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
+                //{
+                if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB")
                 {
-                    if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB")
+                    var agingOutputDto = MapToAgingOutputDto(stock);
+                    content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
+
+                    if (content.Status)
                     {
-                        var agingOutputDto = MapToAgingOutputDto(stock);
-                        content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
+                        var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
 
-                        if (content.Status)
+                        if (!result.Success && result.MessageCode == "E10001")
                         {
-                            var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
-
-                            if (!result.Success && result.MessageCode == "E10001")
-                            {
-                                await HandleOutBoundError(stock, task);
-                            }
-                        }
-                        else
-                        {
-                            task.Remark = "NG";
-                            ConsoleHelper.WriteErrorLine("MOM閫氭姤鐐硅姱NG");
-                            return content.Error("MOM閫氭姤鐐硅姱NG");
+                            await HandleOutBoundError(stock, task);
                         }
                     }
+                    else
+                    {
+                        task.Remark = "NG";
+                        ConsoleHelper.WriteErrorLine("MOM閫氭姤鐐硅姱NG");
+                        return content.Error("MOM閫氭姤鐐硅姱NG");
+                    }
                 }
+                //}
             }
 
             if (task.Remark == "NG")
@@ -428,8 +431,8 @@
             Console.WriteLine(err.Message.ToString());
             LogFactory.GetLog("浠诲姟瀹屾垚").Error(true, err);
             content.Error(err.Message);
-            task.ErrorMessage= err.Message;
-            task.TaskState=(int)TaskInStatusEnum.SC_InExecuting;
+            task.ErrorMessage = err.Message;
+            task.TaskState = (int)TaskInStatusEnum.SC_InExecuting;
             await BaseDal.Update(task);
         }
         return content;
@@ -616,13 +619,13 @@
         }
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "楠岃瘉浠诲姟鏄惁瀛樺湪", JsonConvert.SerializeObject(task));
 
-        if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
-        {
-            return await CompleteInToOutTaskAsync(task);
-        }
+
         // 楠岃瘉搴撳瓨鏄惁瀛樺湪
         var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode);
-
+        if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
+        {
+            return await CompleteInToOutTaskAsync(task, stock);
+        }
         // 鏍规嵁浠诲姟绫诲瀷璋冪敤鐩稿簲鐨勫畬鎴愪换鍔℃柟娉�
         switch (task.TaskType)
         {
@@ -636,8 +639,7 @@
             case (int)TaskOutboundTypeEnum.OutTray:
             case (int)TaskOutboundTypeEnum.Outbound:
             case (int)TaskOutboundTypeEnum.OutNG:
-            case (int)TaskOutboundTypeEnum.OutQuality:
-            
+
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", "");
                 return await CompleteStackTaskAsync(task, stock);
 
@@ -648,7 +650,6 @@
 
             case (int)TaskRelocationTypeEnum.Relocation:
                 return await CompleteTransferTaskAsync(task, stock);
-
             default:
                 return content.Error("浠诲姟绫诲瀷涓嶅瓨鍦�");
         }
@@ -666,15 +667,24 @@
         {
             // 鏌ヨ浠诲姟
             var task = await QueryTaskByPalletCode(input.PalletCode);
-            if (task != null)
+            if (task != null && (task.TaskState == (int)TaskInStatusEnum.InNew || task.TaskState == (int)TaskOutStatusEnum.OutNew))
             {
                 return CreateAndReturnWMSTaskDTO(task);
+            }
+            if(task != null && (task.TaskState != (int)TaskInStatusEnum.InNew || task.TaskState != (int)TaskOutStatusEnum.OutNew))
+            {
+                return content.Error($"鎵樼洏{input.PalletCode}瀛樺湪浠诲姟");
             }
 
             // 鏌ヨ搴撳瓨淇℃伅锛堣繖閲屽悗缁瀹屽杽璐ㄦ鍥炲簱閫昏緫锛�
             var stock = await QueryStockInfo(input.PalletCode);
             if (stock != null)
             {
+                List<string> strings = new List<string>() { "GW", "CW", "FR" };
+                if (stock.AreaCode.Contains(strings))
+                {
+                    return content.Error($"鎵樼洏銆恵stock.PalletCode}銆戝瓨鍦ㄥ簱瀛樹笉鍏佽鍏ュ簱");
+                }
                 Dt_Task taskNew = new Dt_Task
                 {
                     Grade = 1,
@@ -765,6 +775,7 @@
                 //    return await HandleErrorCells(input, area, serialNosError);
                 //}
                 #endregion
+
                 var boxing = CreateBoxingInfo(result, input.PalletCode);
                 if (boxing == null) return content.Error("缁勭洏澶辫触");
 
@@ -777,6 +788,7 @@
             // 鏇磋缁嗙殑寮傚父澶勭悊锛屽彲浠ユ牴鎹紓甯哥被鍨嬭褰曚笉鍚岀殑閿欒鏃ュ織绛�
             content.Error(err.Message);
             Console.WriteLine(err.Message);
+            LogFactory.GetLog($"璇锋眰鍏ュ簱寮傚父").Info(true, $"寮傚父淇℃伅銆恵err.Message}銆戝紓甯歌銆恵err.StackTrace}銆�");
         }
 
         return content;
@@ -860,8 +872,8 @@
                 var configOne = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.CHInboundEmptyProductLineOne);
                 var configTwo = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.CHInboundEmptyProductLineTwo);
 
-                List<string>  productLineconfigOne = configOne.ConfigValue.Split(',').ToList();
-                List<string>  productLineconfigTwo = configTwo.ConfigValue.Split(',').ToList();
+                List<string> productLineconfigOne = configOne.ConfigValue.Split(',').ToList();
+                List<string> productLineconfigTwo = configTwo.ConfigValue.Split(',').ToList();
 
                 if (productLineconfigOne.Count == 0 && productLineconfigTwo.Count() == 0)
                 {
@@ -880,13 +892,13 @@
                 {
                     ConsoleHelper.WriteErrorLine($"鏈壘鍒皗result.ProductionLine}瀵瑰簲閰嶇疆宸烽亾");
                     return content.Error($"鏈壘鍒皗result.ProductionLine}瀵瑰簲閰嶇疆宸烽亾");
-                }   
+                }
             }
             else
             {
                 strings = stationManagers.Roadway.Split(',').ToList();
             }
-             
+
 
             return await CreateNewTask(input, result.ProductionLine, result.ProcessCode, strings, 1);
         }
@@ -906,7 +918,7 @@
     // 鑾峰彇缁勭洏淇℃伅
     private DtBoxingInfo CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode)
     {
-        var boxing=_boxingInfoRepository.QueryFirst(x=>x.PalletCode== palletCode);
+        var boxing = _boxingInfoRepository.QueryFirst(x => x.PalletCode == palletCode);
         if (boxing == null)
         {
             return new DtBoxingInfo
@@ -927,23 +939,26 @@
         }
         else
         {
-            _boxingInfoRepository.DeleteData(boxing);
+            _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxing.Id)
+                                            .Include(x => x.BoxingInfoDetails)
+                                            .ExecuteCommandAsync();
             return new DtBoxingInfo
             {
                 PalletCode = palletCode,
                 IsFull = true,
                 ProcessCode = result.ProcessCode,
                 ProductionLine = result.ProductionLine,
-                BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail
+                BoxingInfoDetails = result.SerialNos.Select(seriaINoObj => new DtBoxingInfoDetail
                 {
-                    SerialNumber = serialNoObj.SerialNo,
-                    OrderNo = serialNoObj.PositionNo.ToString(),
-                    Status = serialNoObj.SerialNoStatus,
+                    SerialNumber = seriaINoObj.SerialNo,
+                    OrderNo = seriaINoObj.PositionNo.ToString(),
+                    Status = seriaINoObj.SerialNoStatus,
                     MaterielCode = result.BindCode,
                     Remark = result.TrayBarcodePropertys.ToJsonString(),
                 }).ToList()
             };
         }
+
     }
 
     // 鑾峰彇宸ヨ壓鐢宠
@@ -977,11 +992,12 @@
         WebResponseContent content = new WebResponseContent();
         try
         {
+            // 璁板綍寮傚父淇℃伅骞舵姏鍑�
+            LogFactory.GetLog($"{position}璇锋眰{productionLine}浠诲姟").Info(true, $"{position}-{tag}-{areaCode}-{JsonConvert.SerializeObject(areaCodes)}-{productionLine}");
             // 鏍规嵁鎵樼洏绫诲瀷鏌ヨ搴撳瓨淇℃伅
             DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound
                 ? areaCode != "CWSC1" ? await QueryStockInfoForRealTrayAsync(areaCode, areaCodes, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine)
                 : await QueryStockInfoForEmptyTrayAsync(areaCode, position);
-
             if (stockInfo == null)
             {
                 return content.Error("搴撳瓨淇℃伅涓嶅瓨鍦�");
@@ -1014,6 +1030,8 @@
                 stockInfo.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable;
                 await _locationRepository.UpdateDataAsync(stockInfo.LocationInfo);
             }
+            if (position == "1670")
+                LogFactory.GetLog($"OCV{position}璇锋眰{productionLine}浠诲姟").Info(true, $"杩斿洖鍙傛暟{JsonConvert.SerializeObject(taskDTO)}");
 
             // 杩斿洖鎴愬姛鍝嶅簲
             return content.OK(data: taskDTO);
@@ -1052,16 +1070,28 @@
 
             var result = new DtStockInfo();
 
-            result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
+            var stockInfoList = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
                             .Includes(x => x.LocationInfo)
-                            .Includes(x => x.StockInfoDetails)
+                            //.Includes(x => x.StockInfoDetails)
                             .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull)
                             .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
                             .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo))
                             .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable)
-                            .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode)))
+                            //.WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode)))
                             .OrderBy(x => x.OutboundTime)
-                            .FirstAsync();
+                            .ToListAsync();
+            foreach (var stock in stockInfoList)
+            {
+                var hasMatchingDetail = await _stockInfoRepository.Db.Queryable<DtStockInfoDetail>()
+                    .Where(d => d.StockId == stock.Id && materielCodes.Contains(d.MaterielCode))
+                    .AnyAsync();
+
+                if (hasMatchingDetail)
+                {
+                    result = stock;
+                    break;
+                }
+            }
 
             if (result.IsNullOrEmpty())
                 ConsoleHelper.WriteErrorLine($"{area.AreaName}-{productionLine}鏌ヨ瀹炵洏搴撳瓨淇℃伅澶辫触:鏈壘鍒扮鍚堟潯浠剁殑鏁版嵁");
@@ -1109,21 +1139,43 @@
                 .Where(x => x.DeviceCode.Contains("CWSC"))
                 .ToList().Select(x => x.DeviceCode).ToList();
 
+            //var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
+            //    .Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
+            //    .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
+            //    .Includes(x => x.LocationInfo)
+            //    .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo))
+            //    .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && areaId.Contains(x.LocationInfo.AreaId) && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
+            //    .Includes(x => x.StockInfoDetails)
+            //    .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode)))
+            //    .OrderBy(x => x.OutboundTime) // 鎺掑簭
+            //    .FirstAsync(); // 鑾峰彇绗竴涓厓绱�
+
+            DtStockInfo stockInfo = null;
             var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
                 .Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
                 .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
                 .Includes(x => x.LocationInfo)
                 .WhereIF(!deviceCode.IsNullOrEmpty(), x => deviceCode.Contains(x.LocationInfo.RoadwayNo))
                 .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && areaId.Contains(x.LocationInfo.AreaId) && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
-                .Includes(x => x.StockInfoDetails)
-                .WhereIF(!materielCodes.IsNullOrEmpty(), x => x.StockInfoDetails.Any(y => materielCodes.Contains(y.MaterielCode)))
                 .OrderBy(x => x.OutboundTime) // 鎺掑簭
-                .FirstAsync(); // 鑾峰彇绗竴涓厓绱�
+                .ToListAsync();
 
-            if (result.IsNullOrEmpty())
+            foreach (var stock in result)
+            {
+                var hasMatchingDetail = await _stockInfoRepository.Db.Queryable<DtStockInfoDetail>()
+                    .Where(d => d.StockId == stock.Id && materielCodes.Contains(d.MaterielCode))
+                    .AnyAsync();
+
+                if (hasMatchingDetail)
+                {
+                    stockInfo = stock;
+                    break;
+                }
+            }
+            if (stockInfo.IsNullOrEmpty())
                 ConsoleHelper.WriteErrorLine($"{JsonConvert.SerializeObject(areaCodes)}-{productionLine}鏌ヨ甯告俯瀹炵洏搴撳瓨淇℃伅澶辫触:鏈壘鍒扮鍚堟潯浠剁殑鏁版嵁");
 
-            return result;
+            return stockInfo;
         }
         catch (Exception ex)
         {
@@ -1152,21 +1204,36 @@
                 .Where(x => stackers.Contains(x.DeviceCode))
                 .ToList().Select(x => x.DeviceCode).ToList();
 
+            DtStockInfo stockInfo = null;
+
             var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
                 .Where(x => x.ProductionLine == station.productLine)
                 .Where(x => x.AreaCode == areaCode && x.IsFull == false)
-                .Includes(x => x.StockInfoDetails)
-                .Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "绌烘墭鐩�"))
+                //.Includes(x => x.StockInfoDetails)
+                //.Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "绌烘墭鐩�"))
                 .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) // 鎺掑簭
-                .FirstAsync(); // 杞崲涓哄垪琛�
+                .ToListAsync();
+
+            foreach (var stock in result)
+            {
+                var hasMatchingDetail = await _stockInfoRepository.Db.Queryable<DtStockInfoDetail>()
+                    .Where(d => d.StockId == stock.Id && d.MaterielCode == "绌烘墭鐩�")
+                    .AnyAsync();
+
+                if (hasMatchingDetail)
+                {
+                    stockInfo = stock;
+                    break;
+                }
+            }
 
             if (result.IsNullOrEmpty())
                 ConsoleHelper.WriteErrorLine($"{area}-{station.productLine}鏌ヨ绌虹洏搴撳瓨淇℃伅澶辫触:鏈壘鍒扮鍚堟潯浠剁殑鏁版嵁");
 
-            return result;
+            return stockInfo;
         }
         catch (Exception ex)
         {
@@ -1308,15 +1375,15 @@
             if (stockInfo.AreaCode.Contains("CH"))
             {
                 // 鍒涘缓骞舵坊鍔犱换鍔″埌鏁版嵁搴�
-                if(stockInfo.LocationInfo.RoadwayNo=="CHSC1"|| stockInfo.LocationInfo.RoadwayNo == "CHSC2"|| stockInfo.LocationInfo.RoadwayNo == "CHSC3")
+                if (stockInfo.LocationInfo.RoadwayNo == "CHSC1" || stockInfo.LocationInfo.RoadwayNo == "CHSC2" || stockInfo.LocationInfo.RoadwayNo == "CHSC3")
                 {
                     task = CreateTask(stockInfo, "1020-1", taskType);
                 }
                 else
                 {
-                    task = CreateTask(stockInfo, "1049-1", taskType);
+                    task = CreateTask(stockInfo, "1049-8", taskType);
                 }
-                
+
             }
             else
             {
@@ -1740,7 +1807,7 @@
         // 鍒涘缓鍘嗗彶浠诲姟瀹炰緥妯″瀷
         try
         {
-            foreach (object item in key)
+            foreach (var item in key)
             {
                 Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(key));
                 if (task == null)
@@ -1748,9 +1815,6 @@
                     return content.Error("鏈壘鍒颁换鍔′俊鎭�!");
                 }
                 var taskHtyNG = CreateHistoricalTask(task, true);
-
-                // 鎵ц鏁版嵁搴撲簨鍔�
-
                 // 娣诲姞鍘嗗彶浠诲姟
                 var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0;
 
@@ -1890,7 +1954,6 @@
         {
             taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System";
         }
-        taskHty.TaskState = task.TaskType > 199 ? (int)TaskInStatusEnum.InFinish : (int)TaskOutStatusEnum.OutFinish;
         return taskHty;
     }
 
@@ -1947,32 +2010,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
 
             // 娣诲姞鍘嗗彶浠诲姟
@@ -2147,7 +2210,10 @@
             ToAddress = await GetRoadWayAsync(process);
         else
             ToAddress = process[0];
-
+        if (string.IsNullOrEmpty(ToAddress))
+        {
+            return content.Error("鏃犳硶鑾峰彇鐩爣鍦板潃");
+        }
         // 鍒涘缓鏂颁换鍔″疄渚�
         var task = new Dt_Task
         {

--
Gitblit v1.9.3