From e2655143a06ee42eec06a97b045f33a09fbb3a3f Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期二, 24 十二月 2024 17:40:18 +0800
Subject: [PATCH] 合并更改

---
 /dev/null                                                                                             |   33 ----------------
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs       |   38 +++++++++----------
 .gitignore                                                                                            |    2 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs              |   12 +++--
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                       |    8 +---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs       |    3 -
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs |   14 ++++--
 7 files changed, 39 insertions(+), 71 deletions(-)

diff --git a/.gitignore b/.gitignore
index ad9ce37..acd2870 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1589,3 +1589,5 @@
 /Code Management/.vs/slnx.sqlite
 /Code Management/.vs/Code Management/v17/.wsuo
 /Code Management/.vs/Code Management/v17/workspaceFileList.bin
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
+/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3
diff --git a/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3 b/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3
deleted file mode 100644
index c22568e..0000000
--- a/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3
+++ /dev/null
Binary files differ
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
deleted file mode 100644
index 860d38a..0000000
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
-  "urls": "http://*:9291", //web鏈嶅姟绔彛锛屽鏋滅敤IIS閮ㄧ讲锛屾妸杩欎釜鍘绘帀
-  "Logging": {
-    "LogLevel": {
-      "Default": "Information",
-      "Microsoft.AspNetCore": "Warning"
-    }
-  },
-  "dics": "deviceType,devicePlcType,jobAssembly,jobClassName,deviceStatus,taskType,taskState,inOutType",
-  "AllowedHosts": "*",
-  "ConnectionStringsEncryption": false,
-  "MainDB": "DB_WIDESEA", //褰撳墠椤圭洰鐨勪富搴擄紝鎵�瀵瑰簲鐨勮繛鎺ュ瓧绗︿覆鐨凟nabled蹇呴』涓簍rue
-  //杩炴帴瀛楃涓�
-  //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
-  //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=True",
-  //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-  "ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-  "ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=True",
-  //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-  "ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-  //璺ㄥ煙
-  "Cors": {
-    "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О
-    "EnableAllIPs": true, //褰撲负true鏃讹紝寮�鏀炬墍鏈塈P鍧囧彲璁块棶銆�
-    // 鏀寔澶氫釜鍩熷悕绔彛锛屾敞鎰忕鍙e彿鍚庝笉瑕佸甫/鏂滄潌锛氭瘮濡俵ocalhost:8000/锛屾槸閿欑殑
-    // 娉ㄦ剰锛宧ttp://127.0.0.1:1818 鍜� http://localhost:1818 鏄笉涓�鏍风殑
-    "IPs": "http://127.0.0.1:8080,http://localhost:8080"
-  },
-  "ApiName": "WIDESEA",
-  "ExpMinutes": 120,
-  "QuartzJobAutoStart": true,
-  "LogDeubgEnable": true
-}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index d630db8..d5c8429 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -505,12 +505,8 @@
                     }
                     if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
                     {
-                        Dt_Task? tasks = UpdatePosition(task.TaskNum, task.CurrentAddress);
-                        if (tasks != null)
-                        {
-                            task.CurrentAddress = tasks.CurrentAddress;
-                            task.NextAddress = tasks.NextAddress;
-                        }
+                        content = StackCraneTaskCompleted(task.TaskNum);
+                        return content;
                     }
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index a2d0d4f..beee08f 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -22,6 +22,7 @@
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.DeviceBase;
 using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Repository;
 using WIDESEAWCS_QuartzJob.Service;
 using WIDESEAWCS_SignalR;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
@@ -32,7 +33,7 @@
     [DisallowConcurrentExecution]
     public partial class CommonConveyorLineJob : JobBase, IJob
     {
-        public readonly ITaskService _taskService;
+        private readonly ITaskService _taskService;
         private readonly ITaskRepository _taskRepository;
         private readonly ITaskExecuteDetailService _taskExecuteDetailService;
         private readonly IRouterService _routerService;
@@ -43,12 +44,13 @@
         private readonly IDt_StationManagerRepository _stationManagerRepository;
         private readonly ICacheService _cacheService;
         private readonly INoticeService _noticeService;
+        private readonly IDeviceInfoRepository _deviceInfoRepository;
 
         private static List<string>? userTokenIds;
         private static List<int>? userIds;
 
 
-        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService)
+        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService, IDeviceInfoRepository deviceInfoRepository)
         {
             _taskService = taskService;
             _taskExecuteDetailService = taskExecuteDetailService;
@@ -61,13 +63,12 @@
             _stationManagerRepository = stationManagerRepository;
             _cacheService = cacheService;
             _noticeService = noticeService;
+            _deviceInfoRepository = deviceInfoRepository;
         }
 
         public async Task Execute(IJobExecutionContext context)
         {
             string jobName = context.JobDetail.Key.Name;
-            //if (MemoryLockManager.TryAcquireLock(jobName))
-            //{
             try
             {
                 // 浠嶫obDataMap涓幏鍙栦紶閫掔殑鍙傛暟
@@ -76,9 +77,11 @@
                 {
                     // 鏌ヨ鎵�鏈夊瓙璁惧鐨勪綅缃�
                     List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
+
                     // 骞惰澶勭悊姣忎釜瀛愯澶�
                     var tasks = childDeviceCodes.Select(childDeviceCode => ProcessDeviceAsync(conveyorLine, childDeviceCode)).ToList();
                     await Task.WhenAll(tasks);
+
 
                     // 鑾峰彇鎵�鏈夌珯鐐圭鐞嗗櫒
                     List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode);
@@ -143,15 +146,6 @@
                 // 杈撳嚭寮傚父淇℃伅
                 Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
             }
-            //    finally
-            //    {
-            //        MemoryLockManager.ReleaseLock(jobName);
-            //    }
-            // }
-            // else
-            // {
-            //     ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]銆恵jobName}銆戜换鍔″凡琚攣瀹氾紝鏃犳硶澶勭悊");
-            // }
             return;
         }
 
@@ -165,7 +159,6 @@
                 ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand");
                 if (command != null && commandWrite != null)
                 {
-
                     #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
 
                     // 鑾峰彇缂撳瓨涓殑鐢ㄦ埛淇℃伅
@@ -255,7 +248,10 @@
                             }
                         }
                     }
-
+                    //if (conveyorLine.DeviceCode == "1001")
+                    //{
+                    //    ConsoleHelper.WriteSuccessLine("ProcessDeviceAsync鏂规硶缁撴潫鏃堕棿锛�" + DateTime.Now.ToString("G") + $"鐐逛綅锛歿childDeviceCode}");
+                    //}
                 }
             }
             catch (Exception ex)
@@ -655,7 +651,7 @@
                 else
                     taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
                 // 璋冪敤妫�鏌ュ苟鍒涘缓浠诲姟鐨勬柟娉�
-                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
+                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform);
             }
             catch (Exception)
             {
@@ -666,7 +662,7 @@
         /// <summary>
         /// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔�
         /// </summary>
-        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
+        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, Platform platform)
         {
             // 鏌ヨ鏁版嵁搴撲腑宸叉湁鐨勪换鍔�
             var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
@@ -691,8 +687,11 @@
                 }
                 var wmsIpAddress = wmsBase + requestTrayOutTask;
 
+                var device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && x.DeviceRemark == platform.Id.ToString());
+                var deviceCode = device.Select(x => x.DeviceCode).ToList();
+
                 // 鍙戦�丠TTP POST璇锋眰鑾峰彇浠诲姟鏁版嵁
-                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString());
+                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = platform.Stacker, AreaCdoes = deviceCode, platform.ProductionLine }.ToJsonString());
                 // 瑙f瀽杩斿洖鐨凧SON鏁版嵁
                 WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
 
@@ -758,7 +757,6 @@
 
             if (result1.Success)
             {
-
                 var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1).ToList();
                 if (serialNosError.Count > 0)
                 {
@@ -793,7 +791,7 @@
             }
             else
             {
-
+                ConsoleHelper.WriteErrorLine(result1.MOMMessage);
             }
         }
 
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
index 63f98fd..2c879f9 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -41,6 +41,7 @@
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Repository;
 using WIDESEAWCS_QuartzJob.Service;
 using WIDESEAWCS_SignalR;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
@@ -62,8 +63,9 @@
         private readonly IDt_StationManagerRepository _stationManagerRepository;
         private readonly ICacheService _cacheService;
         private readonly INoticeService _noticeService;
+        private readonly IDeviceInfoRepository _deviceInfoRepository;
 
-        public CommonConveyorLine_GWJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService)
+        public CommonConveyorLine_GWJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService, IDeviceInfoRepository deviceInfoRepository)
         {
             _taskService = taskService;
             _taskExecuteDetailService = taskExecuteDetailService;
@@ -75,6 +77,7 @@
             _stationManagerRepository = stationManagerRepository;
             _cacheService = cacheService;
             _noticeService = noticeService;
+            _deviceInfoRepository = deviceInfoRepository;
         }
 
         public Task Execute(IJobExecutionContext context)
@@ -434,7 +437,7 @@
                     taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray;
                 else
                     taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
-                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
+                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform);
             }
             catch (Exception)
             {
@@ -444,7 +447,7 @@
         /// <summary>
         /// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔�
         /// </summary>
-        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
+        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, Platform platform)
         {
             var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
             if (tasks.Count < index)
@@ -463,10 +466,11 @@
                 }
                 var wmsIpAddress = wmsBase + requestTrayOutTask;
 
-
+                var device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && x.DeviceRemark == platform.Id.ToString());
+                var deviceCode = device.Select(x => x.DeviceCode).ToList();
                 List<string> strings = platform.Location.Split(',').ToList();
 
-                var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = roadWay, AreaCdoes = strings, platform.ProductionLine }.ToJsonString());
+                var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = platform.Stacker, AreaCdoes = strings, platform.ProductionLine }.ToJsonString());
                 //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
 
                 WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index c9b8c07..4213039 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -81,7 +81,6 @@
                                     bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                     if (sendFlag)
                                     {
-                                        commonStackerCrane.SetValue(StackerCraneDBName.StartCommand, 1);
                                         commonStackerCrane.LastTaskType = task.TaskType;
                                         _taskService.UpdateTaskStatusToNext(task.TaskNum);
                                     }
@@ -358,7 +357,7 @@
             stackerCraneTaskCommand.TaskNum = task.TaskNum;
             stackerCraneTaskCommand.WorkType = 1;
             stackerCraneTaskCommand.TrayType = 0;
-            //stackerCraneTaskCommand.StartCommand = 1;
+            stackerCraneTaskCommand.StartCommand = 1;
             if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//鍒ゆ柇鏄惁鏄叆搴撲换鍔�
             {
                 if (task.SourceAddress == "1359-4" && task.Roadway.Contains("JZ"))
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 48cd4a9..b19f3b0 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,6 @@
 锘縰sing Mapster;
 using Masuit.Tools;
+using SixLabors.Fonts.Tables.AdvancedTypographic;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using WIDESEA_Core.Const;
@@ -1028,7 +1029,7 @@
         {
             // 鏍规嵁鎵樼洏绫诲瀷鏌ヨ搴撳瓨淇℃伅
             DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound
-                ? areaCodes == null ? await QueryStockInfoForRealTrayAsync(areaCode, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine)
+                ? areaCode != "CWSC1" ? await QueryStockInfoForRealTrayAsync(areaCode, areaCodes, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine)
                 : await QueryStockInfoForEmptyTrayAsync(areaCode);
 
             if (stockInfo == null)
@@ -1076,7 +1077,7 @@
     /// <summary>
     /// 鏌ヨ瀹炵洏搴撳瓨淇℃伅
     /// </summary>
-    private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, string productionLine)
+    private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> devices, string productionLine)
     {
         var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode);
 
@@ -1086,6 +1087,7 @@
             .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
             .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
             .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
+            .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo))
             .OrderBy(x => x.OutboundTime) // 鎺掑簭
             .FirstAsync(); // 鑾峰彇绗竴涓厓绱�
 
@@ -1096,7 +1098,7 @@
     }
 
     /// <summary>
-    /// 鏌ヨ瀹炵洏搴撳瓨淇℃伅
+    /// 鏌ヨ甯告俯瀹炵洏搴撳瓨淇℃伅
     /// </summary>
     private async Task<DtStockInfo> QueryStockInfoForRealTrayCWAsync(List<string> areaCodes, string productionLine)
     {
@@ -1145,7 +1147,7 @@
     {
         return new Dt_Task
         {
-            Grade = 1,
+            Grade = tag == 104 ? 2 : 1,
             Roadway = stockInfo.LocationInfo.RoadwayNo,
             TargetAddress = position,
             Dispatchertime = DateTime.Now,
@@ -1172,7 +1174,7 @@
         return new WMSTaskDTO
         {
             TaskNum = task.TaskNum.Value,
-            Grade = 1,
+            Grade = task.Grade.Value,
             PalletCode = task.PalletCode,
             RoadWay = task.Roadway,
             SourceAddress = task.SourceAddress,

--
Gitblit v1.9.3