From ec78ebdad429c6438f8965941aa912865c71a949 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期三, 15 一月 2025 17:34:16 +0800
Subject: [PATCH] 修改板材退库交互

---
 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9a9ae583-4231-47b4-b5bf-94e21e462e94.vsidx |    0 
 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ec7cf4a8-d49d-49ce-bf3c-1956e1538ec8.vsidx |    0 
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs                                     |    6 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs                                       |   30 +++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs                                                      |    6 
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs                                   |   43 ++++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs                          |   39 +++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs                                    |   88 ++++++++
 /dev/null                                                                                                    |    0 
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs                                   |    4 
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs                                          |   27 ++
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                                         |   82 ++++++++
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/RGVJob_BC.cs                                                 |  108 ++--------
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs                           |  121 +++++++++++
 14 files changed, 448 insertions(+), 106 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/18a53365-4699-4a05-a22d-52202ffc28c5.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/18a53365-4699-4a05-a22d-52202ffc28c5.vsidx"
deleted file mode 100644
index 3810953..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/18a53365-4699-4a05-a22d-52202ffc28c5.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/76b34398-56f7-412e-a330-a8b8def683e9.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/76b34398-56f7-412e-a330-a8b8def683e9.vsidx"
deleted file mode 100644
index fd9af63..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/76b34398-56f7-412e-a330-a8b8def683e9.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9a9ae583-4231-47b4-b5bf-94e21e462e94.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9a9ae583-4231-47b4-b5bf-94e21e462e94.vsidx"
new file mode 100644
index 0000000..407f834
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/9a9ae583-4231-47b4-b5bf-94e21e462e94.vsidx"
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c470cd75-662b-44ab-b67b-80ff3d784fdc.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c470cd75-662b-44ab-b67b-80ff3d784fdc.vsidx"
deleted file mode 100644
index 0505f0c..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c470cd75-662b-44ab-b67b-80ff3d784fdc.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock"
deleted file mode 100644
index e69de29..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock"
+++ /dev/null
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
index 08daff0..b501222 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
@@ -84,6 +84,16 @@
         WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, string roadway);
 
         /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="sourceAddress"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="heightType"></param>
+        /// <param name="roadways"></param>
+        /// <returns></returns>
+        WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, int heightType, List<string> roadways);
+
+        /// <summary>
         /// 鍚慦MS鐢宠鍒嗛厤璐т綅
         /// </summary>
         /// <param name="taskNum">浠诲姟鍙�</param>
@@ -191,6 +201,11 @@
         /// <returns></returns>
         AgvResponseContent AgvUpdateTask(AgvUpdateDTO agvUpdateModel);
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="taskNum"></param>
+        /// <returns></returns>
         WebResponseContent SendSecureReplyToAgv(int taskNum);
 
         /// <summary>
@@ -217,6 +232,15 @@
         /// 
         /// </summary>
         /// <param name="roadwayNos"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="heightType"></param>
+        /// <returns></returns>
+        WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, string palletCode, int heightType);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="roadwayNos"></param>
         /// <param name="taskNum"></param>
         /// <param name="heightType"></param>
         /// <returns></returns>
@@ -229,6 +253,12 @@
         /// <returns></returns>
         WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos);
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="agvPodModel"></param>
+        /// <param name="PodBerthAndMat"></param>
+        /// <returns></returns>
         WebResponseContent AgvPodBerthAndMat(AgvPodBerthAndMatDTO agvPodModel, APIEnum PodBerthAndMat = APIEnum.Agv_CSJPodBerthAndMat);
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index fe70f82..ebdb88a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -326,6 +326,12 @@
             return content;
         }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="palletCode"></param>
+        /// <param name="sourceAddress"></param>
+        /// <returns></returns>
         public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress)
         {
             WebResponseContent content = new WebResponseContent();
@@ -355,6 +361,13 @@
             return content;
         }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="palletCode"></param>
+        /// <param name="sourceAddress"></param>
+        /// <param name="roadway"></param>
+        /// <returns></returns>
         public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, string roadway)
         {
             WebResponseContent content = new WebResponseContent();
@@ -366,6 +379,43 @@
                     return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
                 }
                 string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={roadway}&palletCode={palletCode}");
+                WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
+                if (responseContent != null && responseContent.Status && responseContent.Data != null)
+                {
+                    WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString());
+                    if (taskDTO != null)
+                    {
+                        content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
+                    }
+                }
+
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="sourceAddress"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="heightType"></param>
+        /// <param name="roadways"></param>
+        /// <returns></returns>
+        public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress,  int heightType, List<string> roadways)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string address = AppSettings.Get("WMSApiAddress");
+                if (string.IsNullOrEmpty(address))
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
+                }
+                string responseStr = HttpHelper.Post($"{address}/api/Task/DeviceRequestInboundTaskByRoadways?stationCode={sourceAddress}&palletCode={palletCode}&heightType={heightType}", roadways.Serialize());
                 WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
                 if (responseContent != null && responseContent.Status && responseContent.Data != null)
                 {
@@ -416,6 +466,38 @@
         }
 
         /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="roadwayNos"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="heightType"></param>
+        /// <returns></returns>
+        public WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, string palletCode, int heightType)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string address = AppSettings.Get("WMSApiAddress");
+                if (string.IsNullOrEmpty(address))
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
+                }
+                string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadwayByHeightAndCode?palletCode={palletCode}&heightType={heightType}", roadwayNos.Serialize());
+                WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
+                if (responseContent != null && responseContent.Status && responseContent.Data != null)
+                {
+                    return responseContent;
+                }
+
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
+        }
+
+        /// <summary>
         /// 鍒嗛厤宸烽亾
         /// </summary>
         /// <param name="roadwayNos"></param>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs"
index 33ebd26..d314d45 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs"
@@ -36,9 +36,10 @@
         private readonly IStationMangerRepository _stationMangerRepository;
         private readonly IRouterRepository _routerRepository;
         private readonly IRouterService _routerService;
+        private readonly IRouterExtension _routerExtension;
         private readonly List<Dt_WarehouseDevice> warehouseDevices;
 
-        public RGVJob_BC(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService)
+        public RGVJob_BC(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension)
         {
             _cacheService = cacheService;
             _taskService = taskService;
@@ -47,6 +48,7 @@
             _stationMangerRepository = stationMangerRepository;
             _routerRepository = routerRepository;
             _routerService = routerService;
+            _routerExtension = routerExtension;
 
             string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice));
             if (!string.IsNullOrEmpty(warehouseDevicesStr))
@@ -99,7 +101,26 @@
 
                         if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt())
                         {
-                            if (conveyorLineSignalRead.STB && /*conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && */!conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//鍏ュ簱
+                            //if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//鍏ュ簱
+                            //{
+                            //    List<string> stations = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()).Select(x => x.NextPosi).ToList();
+                            //    WebResponseContent responseContent = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode,  conveyorLineInfoRead.Spare2, stations);
+                            //    if (responseContent.Status)
+                            //    {
+                            //        Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.Barcode && x.CurrentAddress == item.StationCode && x.DeviceCode == device.DeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt());
+                            //        if (task != null)
+                            //        {
+                            //            device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
+                            //            device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode);
+                            //            device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
+                            //            device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode);
+                            //            device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
+                            //            _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
+                            //        }
+                            //    }
+                            //}
+
+                            if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//鍏ュ簱
                             {
                                 WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.Barcode, item.StationCode);
                                 if (content.Status)
@@ -115,89 +136,6 @@
                                         _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
                                     }
                                 }
-
-                                #region
-                                //Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.PalletCode == conveyorLineInfoRead.Barcode && string.IsNullOrEmpty(x.DeviceCode) && string.IsNullOrEmpty(x.NextAddress) && string.IsNullOrEmpty(x.TargetAddress));
-                                //if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
-                                //{
-                                //    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
-                                //    if (stationManger == null)
-                                //    {
-                                //        WriteError(item.StationName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
-                                //        continue;
-                                //    }
-                                //    List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && (task.Roadway == x.ChildPosiDeviceCode || task.Roadway == x.ChildPosi));
-                                //    Dt_Router? router = routers.FirstOrDefault();
-                                //    if (router == null)
-                                //    {
-                                //        WriteError(device.DeviceName, $"鏈壘鍒颁换鍔$被鍨媨task.TaskType}瀵瑰簲鐨勮矾鐢变俊鎭�");
-                                //    }
-                                //    else
-                                //    {
-                                //        if (routers.Count == 1)
-                                //        {
-                                //            task.Dispatchertime = DateTime.Now;
-                                //            _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: router.ChildPosi, targetAddress: router.NextPosi, nextAddress: router.StartPosi, currentAddress: item.StationCode);
-
-                                //            device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode);
-                                //            device.SetValue(W_ConveyorLineDB.EndPos, router.StartPosi, item.StationCode);
-                                //            device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
-                                //            device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
-                                //            device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
-                                //        }
-                                //        else
-                                //        {
-                                //            List<string> canInboundStations = new List<string>();
-                                //            List<string> stations = routers.Select(x => x.NextPosi).ToList();
-                                //            foreach (string station in stations)
-                                //            {
-                                //                Dt_StationManger stationManger1 = _stationMangerRepository.QueryFirst(x => x.StationCode == station);
-                                //                if (stationManger1 != null)
-                                //                {
-                                //                    IDevice? device1 = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger1.StationDeviceCode);
-                                //                    if (device1 != null)
-                                //                    {
-                                //                        OtherDevice otherDevice = (OtherDevice)device1;
-                                //                        //short workType = otherDevice.GetValue<R_ConveyorLineWorkType, short>(R_ConveyorLineWorkType.ConveyorLineWorkType, item.StationCode);
-                                //                        //if (workType == ConveyorWorkTypeEnum.Undefined.ObjToInt() || workType == ConveyorWorkTypeEnum.Inbound.ObjToInt())
-                                //                        {
-                                //                            canInboundStations.Add(stationManger1.Remark);
-                                //                        }
-                                //                    }
-                                //                }
-                                //            }
-
-                                //            WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(task.TaskNum, canInboundStations);
-                                //            if (responseContent.Status)
-                                //            {
-                                //                List<Dt_Router> dt_Routers = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType);
-
-                                //                Dt_Router? routerTemp = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType).FirstOrDefault();
-                                //                if (routerTemp != null)
-                                //                {
-                                //                    task.Dispatchertime = DateTime.Now;
-                                //                    task.Roadway = responseContent.Data.ToString() ?? task.Roadway;
-                                //                    _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: routerTemp.ChildPosiDeviceCode, targetAddress: routerTemp.NextPosi, nextAddress: routerTemp.NextPosi, currentAddress: item.StationCode);
-
-                                //                    device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode);
-                                //                    device.SetValue(W_ConveyorLineDB.EndPos, routerTemp.NextPosi, item.StationCode);
-                                //                    device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode);
-                                //                    device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode);
-                                //                    device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
-                                //                }
-                                //                else
-                                //                {
-                                //                    WriteError(device.DeviceName, $"鏈壘鍒颁换鍔$被鍨媨task.TaskType},璧风偣{item.StationCode},缁堢偣{responseContent.Data.ToString()}鐨勮矾鐢变俊鎭�");
-                                //                }
-                                //            }
-                                //            else
-                                //            {
-                                //                WriteError(device.DeviceName, responseContent.Message);
-                                //            }
-                                //        }
-                                //    }
-                                //}
-                                #endregion
                             }
                             else if (conveyorLineSignalRead.STB /*&& conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm*/ && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)//鍑哄簱
                             {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/a03bb6c9-6a9c-4e1f-9c40-304cdb5e9f4d.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/a03bb6c9-6a9c-4e1f-9c40-304cdb5e9f4d.vsidx"
deleted file mode 100644
index 904814a..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/a03bb6c9-6a9c-4e1f-9c40-304cdb5e9f4d.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/e3866d26-515d-474f-abfb-51e4ed23e1b5.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/e3866d26-515d-474f-abfb-51e4ed23e1b5.vsidx"
deleted file mode 100644
index 2314a3d..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/e3866d26-515d-474f-abfb-51e4ed23e1b5.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ec7cf4a8-d49d-49ce-bf3c-1956e1538ec8.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ec7cf4a8-d49d-49ce-bf3c-1956e1538ec8.vsidx"
new file mode 100644
index 0000000..b2a496b
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ec7cf4a8-d49d-49ce-bf3c-1956e1538ec8.vsidx"
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fda87ddb-3aec-4e38-98c3-9b80d5e108a6.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fda87ddb-3aec-4e38-98c3-9b80d5e108a6.vsidx"
deleted file mode 100644
index 85a4f21..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fda87ddb-3aec-4e38-98c3-9b80d5e108a6.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock"
deleted file mode 100644
index e69de29..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock"
+++ /dev/null
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs"
index edec038..9c00a39 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs"
@@ -17,19 +17,62 @@
     {
         IInboundOrderRepository Repository { get; }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
         WebResponseContent GetInboundOrders(SaveModel saveModel);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="inboundOrderId"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="serNum"></param>
+        /// <returns></returns>
         WebResponseContent MaterielGroup(int inboundOrderId, string palletCode, string serNum);
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="inboundOrderId"></param>
+        /// <param name="warehouseId"></param>
+        /// <param name="serNums"></param>
+        /// <returns></returns>
         WebResponseContent InPinKu(string inboundOrderId,int warehouseId, List<string> serNums);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="palletCode"></param>
+        /// <param name="Initiallife"></param>
+        /// <param name="warehouseId"></param>
+        /// <param name="serNums"></param>
+        /// <returns></returns>
         WebResponseContent MaterielGroup(string palletCode, int Initiallife, int warehouseId, List<string> serNums);
 
         //WebResponseContent FeedbackInboundOrder(int id);
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
         WebResponseContent MaterielGroup(SaveModel saveModel);
         /// <summary>
         /// 鍏ュ簱瀹屾垚涓婃姤
         /// </summary>
         /// <returns></returns>
         WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo,Dt_InboundOrder inboundOrder, List<ERPInboundDetailModel> detailModels);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="warehouse"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="materielInfo"></param>
+        /// <returns></returns>
+        int GetPalletType(Dt_Warehouse warehouse, string palletCode);
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
index a1aab3b..67606c7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
@@ -94,7 +94,17 @@
         /// <param name="stationCode"></param>
         /// <param name="palletCode"></param>
         /// <returns></returns>
-        WebResponseContent DeviceRequestInboundTask(string stationCode, string palletCode);
+        WebResponseContent DeviceRequestInboundTaskSimple(string stationCode, string palletCode);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="stationCode"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="roadwayNos"></param>
+        /// <param name="heightType"></param>
+        /// <returns></returns>
+        WebResponseContent DeviceRequestInboundTaskByRoadways(string stationCode, string palletCode, List<string> roadwayNos, int heightType);
 
         /// <summary>
         /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅
@@ -147,7 +157,7 @@
         /// </summary>
         /// <param name="keys"></param>
         /// <returns></returns>
-        WebResponseContent GenerateOutboundTask(int[] keys);
+        WebResponseContent GenerateOutboundTasks(int[] keys);
 
         /// <summary>
         /// 鍑哄簱浠诲姟瀹屾垚
@@ -221,7 +231,16 @@
         /// <param name="taskNum"></param>
         /// <param name="heightType"></param>
         /// <returns></returns>
-        WebResponseContent AssignRoadway(List<string> roadwayNos, int taskNum, int heightType = 0);
+        WebResponseContent AssignRoadwayByHeight(List<string> roadwayNos, int taskNum, int heightType = 0);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="roadwayNos"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="heightType"></param>
+        /// <returns></returns>
+        WebResponseContent AssignRoadwayByHeightAndCode(List<string> roadwayNos, string palletCode, int heightType = 0);
 
         /// <summary>
         /// 鍒嗛厤宸烽亾
@@ -236,7 +255,7 @@
         /// </summary>
         /// <param name="roadwayNos"></param>
         /// <returns></returns>
-        WebResponseContent AssignRoadway(List<string> roadwayNos);
+        WebResponseContent SingleAssignRoadway(List<string> roadwayNos);
 
         /// <summary>
         /// 
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
index 8a57f20..3a03b44 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
@@ -530,7 +530,7 @@
                         PalletCode = palletCode,
                         StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(),
                         WarehouseId = inboundOrder.WarehouseId,
-                        PalletType = GetPalletType(warehouse, palletCode, materielInfo),
+                        PalletType = GetPalletType(warehouse, palletCode),
                         Details = new List<Dt_StockInfoDetail>()
                     };
                 }
@@ -674,7 +674,7 @@
                         PalletCode = palletCode,
                         StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt(),
                         WarehouseId = warehouse.WarehouseId,
-                        PalletType = GetPalletType(warehouse, palletCode, materielInfo),
+                        PalletType = GetPalletType(warehouse, palletCode),
                         Details = new List<Dt_StockInfoDetail>()
                     };
                 }
@@ -892,7 +892,7 @@
         //    }
         //}
 
-        public int GetPalletType(Dt_Warehouse warehouse, string palletCode, Dt_MaterielInfo materielInfo)
+        public int GetPalletType(Dt_Warehouse warehouse, string palletCode)
         {
             if (warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
             {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs"
index 34f74bb..aca5552 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/AssignInboundTaskLocation_BC.cs"
@@ -24,7 +24,7 @@
         /// <param name="taskNum">浠诲姟鍙�</param>
         /// <param name="roadwayNos">宸烽亾鍙�</param>
         /// <returns></returns>
-        public WebResponseContent AssignRoadway(List<string> roadwayNos, int taskNum, int heightType = 0)
+        public WebResponseContent AssignRoadwayByHeight(List<string> roadwayNos, int taskNum, int heightType = 0)
         {
             try
             {
@@ -70,6 +70,123 @@
         }
 
         /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="roadwayNos"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="heightType"></param>
+        /// <returns></returns>
+        public WebResponseContent AssignRoadwayByHeightAndCode(List<string> roadwayNos, string palletCode, int heightType = 0)
+        {
+            try
+            {
+                if (heightType == 0 || heightType > 3)
+                {
+                    return WebResponseContent.Instance.Error($"楂樺害閿欒");
+                }
+                if (roadwayNos == null || roadwayNos.Count == 0)
+                {
+                    return WebResponseContent.Instance.Error($"宸烽亾涓嶈兘涓虹┖");
+                }
+                Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.RoadwayNo == roadwayNos[0]);
+                if (locationInfo == null)
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒板贩閬撳搴旇揣浣�");
+                }
+                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == locationInfo.WarehouseId);
+                if (warehouse == null)
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒板贩閬撳搴斾粨搴撲俊鎭�");
+                }
+
+                int palletType = _inboundOrderService.GetPalletType(warehouse, palletCode);
+                if (palletType == -1)
+                {
+                    return WebResponseContent.Instance.Error($"鎵樼洏鍙疯В鏋愭墭鐩樼被鍨嬮敊璇�");
+                }
+
+                string roadwayNo = "";
+                if (heightType == 1)
+                {
+                    List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == palletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer <= 3).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList();
+                    roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? "";
+                }
+                else if (heightType == 2)
+                {
+                    List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == palletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 4).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList();
+                    roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? "";
+                }
+                else if (heightType == 3)
+                {
+                    List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == palletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 5).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList();
+                    roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? "";
+                }
+
+                return !string.IsNullOrEmpty(roadwayNo) ? WebResponseContent.Instance.OK(data: roadwayNo) : WebResponseContent.Instance.Error("鏈壘鍒板彲鍒嗛厤宸烽亾");
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
+
+        public string AssignRoadwayNo(List<string> roadwayNos, string palletCode, int heightType = 0)
+        {
+            try
+            {
+                if (heightType == 0 || heightType > 3)
+                {
+                    throw new Exception($"楂樺害閿欒");
+                }
+                if (roadwayNos == null || roadwayNos.Count == 0)
+                {
+                    throw new Exception($"宸烽亾涓嶈兘涓虹┖");
+                }
+                Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.RoadwayNo == roadwayNos[0]);
+                if (locationInfo == null)
+                {
+                    throw new Exception($"鏈壘鍒板贩閬撳搴旇揣浣�");
+                }
+                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == locationInfo.WarehouseId);
+                if (warehouse == null)
+                {
+                    throw new Exception($"鏈壘鍒板贩閬撳搴斾粨搴撲俊鎭�");
+                }
+
+                int palletType = _inboundOrderService.GetPalletType(warehouse, palletCode);
+                if (palletType == -1)
+                {
+                    throw new Exception($"鎵樼洏鍙疯В鏋愭墭鐩樼被鍨嬮敊璇�");
+                }
+
+                string roadwayNo = "";
+                if (heightType == 1)
+                {
+                    List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == palletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer <= 3).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList();
+                    roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? "";
+                }
+                else if (heightType == 2)
+                {
+                    List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == palletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 4).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList();
+                    roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? "";
+                }
+                else if (heightType == 3)
+                {
+                    List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == palletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 5).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList();
+                    roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? "";
+                }
+
+                return !string.IsNullOrEmpty(roadwayNo) ? ( roadwayNo) : throw new Exception("鏈壘鍒板彲鍒嗛厤宸烽亾");
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                throw new Exception(ex.Message);
+            }
+        }
+
+        /// <summary>
         /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅
         /// </summary>
         /// <param name="taskNum">浠诲姟鍙�</param>
@@ -108,7 +225,7 @@
         /// </summary>
         /// <param name="roadwayNos">宸烽亾鍙�</param>
         /// <returns></returns>
-        public WebResponseContent AssignRoadway(List<string> roadwayNos)
+        public WebResponseContent SingleAssignRoadway(List<string> roadwayNos)
         {
             try
             {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index 3dfe8a2..cd411f7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -334,7 +334,7 @@
         /// <param name="stationCode"></param>
         /// <param name="palletCode"></param>
         /// <returns></returns>
-        public WebResponseContent DeviceRequestInboundTask(string stationCode, string palletCode)
+        public WebResponseContent DeviceRequestInboundTaskSimple(string stationCode, string palletCode)
         {
             try
             {
@@ -412,6 +412,92 @@
         }
 
         /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="stationCode"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="staions"></param>
+        /// <param name="heightType"></param>
+        /// <returns></returns>
+        public WebResponseContent DeviceRequestInboundTaskByRoadways(string stationCode, string palletCode, List<string> staions, int heightType)
+        {
+            try
+            {
+                Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode);
+                if (task != null)
+                {
+                    PushTasksToWCS(new List<Dt_Task> { task });
+                    return WebResponseContent.Instance.OK($"璇ユ墭鐩樺凡鐢熸垚浠诲姟", _mapper.Map<WMSTaskDTO>(task));
+                }
+
+                if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null)
+                {
+                    return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�");
+                }
+
+                string roadwayNo = AssignRoadwayNo(staions, palletCode, heightType);
+
+                Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode);
+                if (stockInfo == null)
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�");
+                }
+                if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES閫�搴�.ObjToInt())
+                {
+                    return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱");
+                }
+                if (!string.IsNullOrEmpty(stockInfo.LocationCode))
+                {
+                    return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅");
+                }
+
+                Dt_Task newTask = new Dt_Task()
+                {
+                    CurrentAddress = stationCode,
+                    Grade = 0,
+                    NextAddress = "",
+                    PalletCode = palletCode,
+                    Roadway = roadwayNo,
+                    SourceAddress = stationCode,
+                    TargetAddress = roadwayNo,
+                    TaskType = TaskTypeEnum.Inbound.ObjToInt(),
+                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
+                    WarehouseId = stockInfo.WarehouseId,
+                    PalletType = stockInfo.PalletType
+                };
+
+                if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt())
+                {
+                    stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt();
+                }
+                else if (stockInfo.StockStatus == StockStatusEmun.MES閫�搴�.ObjToInt())
+                {
+                    newTask.TaskType = TaskTypeEnum.MesMatReturn.ObjToInt();
+                }
+                else
+                {
+                    stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
+                }
+
+                _unitOfWorkManage.BeginTran();
+                int taskId = BaseDal.AddData(newTask);
+                newTask.TaskId = taskId;
+                _stockRepository.StockInfoRepository.UpdateData(stockInfo);
+                _unitOfWorkManage.CommitTran();
+                WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask);
+
+                PushTasksToWCS(new List<Dt_Task> { newTask });
+                //if (newTask.WarehouseId == 5) PutFinish(stationCode);
+                return WebResponseContent.Instance.OK(data: wMSTaskDTO);
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
+
+        /// <summary>
         /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅
         /// </summary>
         /// <param name="taskNum">浠诲姟鍙�</param>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index 47f3fd2..6ec106d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -461,7 +461,7 @@
         /// </summary>
         /// <param name="keys">鍑哄簱鍗曟槑缁嗕富閿�</param>
         /// <returns></returns>
-        public WebResponseContent GenerateOutboundTask(int[] keys)
+        public WebResponseContent GenerateOutboundTasks(int[] keys)
         {
             try
             {
@@ -515,7 +515,7 @@
             {
                 List<int> keys = _outboundService.OutboundOrderDetailService.Repository.QueryData(x => x.Id, x => x.OrderId == outboundId);
 
-                return GenerateOutboundTask(keys.ToArray());
+                return GenerateOutboundTasks(keys.ToArray());
             }
             catch (Exception ex)
             {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
index 12659d5..ed76f00 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
@@ -89,7 +89,21 @@
         [HttpPost, HttpGet, Route("DeviceRequestInboundTaskSimple"), AllowAnonymous]
         public WebResponseContent DeviceRequestInboundTaskSimple(string stationCode, string palletCode)
         {
-            return Service.DeviceRequestInboundTask(stationCode, palletCode);
+            return Service.DeviceRequestInboundTaskSimple(stationCode, palletCode);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="stationCode"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="roadwayNos"></param>
+        /// <param name="heightType"></param>
+        /// <returns></returns>
+        [HttpPost, HttpGet, Route("DeviceRequestInboundTaskByRoadways"), AllowAnonymous]
+        public WebResponseContent DeviceRequestInboundTaskByRoadways(string stationCode, string palletCode, int heightType, [FromBody] List<string> roadwayNos)
+        {
+            return Service.DeviceRequestInboundTaskByRoadways(stationCode, palletCode, roadwayNos, heightType);
         }
 
         /// <summary>
@@ -158,9 +172,9 @@
         /// <param name="keys"></param>
         /// <returns></returns>
         [HttpPost, HttpGet, Route("GenerateOutboundTasks"), AllowAnonymous]
-        public WebResponseContent GenerateOutboundTask([FromBody] int[] keys)
+        public WebResponseContent GenerateOutboundTasks([FromBody] int[] keys)
         {
-            return Service.GenerateOutboundTask(keys);
+            return Service.GenerateOutboundTasks(keys);
         }
 
         /// <summary>
@@ -229,7 +243,20 @@
         [HttpPost, Route("AssignRoadwayByHeight"), AllowAnonymous]
         public WebResponseContent AssignRoadwayByHeight([FromBody] List<string> roadwayNos, int taskNum, int heightType = 0)
         {
-            return Service.AssignRoadway(roadwayNos, taskNum, heightType);
+            return Service.AssignRoadwayByHeight(roadwayNos, taskNum, heightType);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="roadwayNos"></param>
+        /// <param name="palletCode"></param>
+        /// <param name="heightType"></param>
+        /// <returns></returns>
+        [HttpPost, Route("AssignRoadwayByHeightAndCode"), AllowAnonymous]
+        public WebResponseContent AssignRoadwayByHeightAndCode([FromBody] List<string> roadwayNos, string palletCode, int heightType = 0)
+        {
+            return Service.AssignRoadwayByHeightAndCode(roadwayNos, palletCode, heightType);
         }
 
         /// <summary>
@@ -250,9 +277,9 @@
         /// <param name="roadwayNos"></param>
         /// <returns></returns>
         [HttpPost, Route("SingleAssignRoadway"), AllowAnonymous]
-        public WebResponseContent AssignRoadway([FromBody] List<string> roadwayNos)
+        public WebResponseContent SingleAssignRoadway([FromBody] List<string> roadwayNos)
         {
-            return Service.AssignRoadway(roadwayNos);
+            return Service.SingleAssignRoadway(roadwayNos);
         }
 
         /// <summary>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
index c8b83e9..87d1375 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
@@ -103,13 +103,13 @@
 app.UseAllServicesMiddle(builder.Services);
 
 app.UseSession();
-//if (app.Environment.IsDevelopment())
+if (app.Environment.IsProduction())
 {
     //todo
     app.UseSwaggerAuthorized();
-    app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html") ?? throw new Exception("WIDESEA_WMSServer.index.html文件"));
+   
 }//判断是否需要打开swagger
-
+app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html") ?? throw new Exception("WIDESEA_WMSServer.index.html文件"));
 app.UseIpLimitMiddle();
 app.UseApiLogMiddleware();
 //todo

--
Gitblit v1.9.3