From bce2cc310d462ffbe56ee3d9f3d9368abf481aad Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期四, 06 十一月 2025 16:02:35 +0800
Subject: [PATCH] 最新

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs                              |    6 +
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs                              |    5 +
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs            |  113 ++++++++++++++++++++++
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs  |   68 +++++++++----
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs                 |    7 
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs                         |    5 +
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs |   25 ++++-
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs                |   31 ++++-
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs                                    |    5 +
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                                |    7 +
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs          |   15 +++
 项目资料/接口清单/托盘库接口清单V1.6.xlsx                                                                          |    0 
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_Model/Models/TaskInfo/Dt_Task.cs               |   10 +
 13 files changed, 259 insertions(+), 38 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs"
index 4918c95..9caaee4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs"
@@ -102,5 +102,10 @@
         public string MESbusinessId { get; set; }
         public string MESsubPalletCode { get; set; }
 
+        /// <summary>
+        /// 鍑哄叆搴撳彛
+        /// </summary>
+        public string OutboundPlatform { get; set; }
+
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
index 81cb776..d646b92 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
@@ -244,5 +244,11 @@
         /// </summary>
         /// <returns></returns>
         Dt_Task GetOutTaskInfo(string PLCaddress);
+
+        /// <summary>
+        /// 2妤煎嚭搴撳彛鐢宠鍙栨秷
+        /// </summary>
+        /// <returns></returns>
+        Dt_Task GetOutTaskInfo2(string PalletCode);
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
index b05bff1..001f137 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
@@ -192,5 +192,10 @@
         [ExporterHeader(DisplayName = "鎵樼洏缂栧彿瀛愭墭")]
         [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鎵樼洏缂栧彿瀛愭墭")]
         public string MESsubPalletCode { get; set; }
+
+        /// <summary>
+        /// 鍑哄叆搴撳彛
+        /// </summary>
+        public string OutboundPlatform { get; set; }
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 5df3716..3f511c4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -511,7 +511,7 @@
                     task.ModifyDate = DateTime.Now;
                     BaseDal.UpdateData(task);
                     content = HttpHelperh.Get<WebResponseContent>($"{urlTaskCompleted}?TaskNum={task.TaskNum}");
-                    Console.WriteLine("浠诲姟瀹屾垚");
+                    Console.WriteLine("浠诲姟瀹屾垚锛寃ms鍙嶉淇℃伅锛�"+content.Message);
                     //BaseDal.DeleteData(task);
                     // _task_HtyService.AddTaskHty(task); 闇�瑕佹坊鍔犵Щ鍏ュ巻鍙�
                     //_taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱瀹屾垚");
@@ -718,5 +718,10 @@
         {
             return BaseDal.QueryFirst(x => x.TargetAddress== PLCaddress && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish, TaskOrderBy);
         }
+
+        public Dt_Task GetOutTaskInfo2(string PalletCode)
+        {
+            return BaseDal.QueryFirst(x => x.PalletCode == PalletCode && x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting, TaskOrderBy);
+        }
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
index ea1a40c..2821efd 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
@@ -2,6 +2,7 @@
 using Quartz;
 using SqlSugar;
 using System.Threading.Tasks;
+using WIDESEA_Comm.Http;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.Helper;
 using WIDESEAWCS_Common.TaskEnum;
@@ -83,11 +84,19 @@
                                 // 鍑哄簱
                                 if (conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && !ACK)//鍑哄簱
                                 {
-                                    if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//閲囪喘鍏ュ簱
+                                    if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))
                                     {
-                                        device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
-                                        device.SetValue(W_ConveyorLineDB.EndPos, 2011, item.StationCode);
-                                        device.SetValue(W_ConveyorLineDB.TaskNo, 1111, item.StationCode);
+
+                                        Dt_Task dt_Ta = _taskService.GetOutTaskInfo2(conveyorLineInfoRead.Barcode);
+                                        if (dt_Ta != null)
+                                        {
+                                            device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode);
+                                            device.SetValue(W_ConveyorLineDB.EndPos, dt_Ta.OutboundPlatform, item.StationCode);
+                                            device.SetValue(W_ConveyorLineDB.TaskNo, dt_Ta.TaskNum, item.StationCode);
+
+                                            //鍒犻櫎浠诲姟
+                                            _taskRepository.DeleteData(dt_Ta);
+                                        }
                                     }
                                 }
                                 else if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && ACK)
@@ -153,13 +162,19 @@
                                     if (dt_Ta != null)
                                     {
                                         Dt_Router dt_Router = _routerRepository.QueryFirst(x => x.StartPosi == dt_Ta.TargetAddress);
-                                        //鍫嗗灈鏈轰换鍔″畬鎴愪笅涓�鍦板潃鏀规垚杈撻�佺嚎涓嬩竴鍦板潃锛岃澶囩紪鍙锋敼鎴愯緭閫佺嚎
-                                        _taskService.UpdateTaskStatusToNext(dt_Ta.TaskNum);
+                                        
                                         device.SetValue(W_ConveyorLineDB.TaskNo, dt_Ta.TaskNum, item.StationCode);
                                         device.SetValue(W_ConveyorLineDB.EndPos, dt_Router.NextPosi, item.StationCode);
                                         device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode);
-                                        //鍒犻櫎浠诲姟
-                                        _taskRepository.DeleteData(dt_Ta);
+                                        //鍫嗗灈鏈轰换鍔″畬鎴愪笅涓�鍦板潃鏀规垚杈撻�佺嚎涓嬩竴鍦板潃锛岃澶囩紪鍙锋敼鎴愯緭閫佺嚎
+                                        _taskService.UpdateTaskStatusToNext(dt_Ta.TaskNum);
+
+                                        if (dt_Ta.TargetAddress !="2021" && dt_Ta.TargetAddress != "2020")
+                                        {
+                                            //鍒犻櫎浠诲姟
+                                            _taskRepository.DeleteData(dt_Ta);
+                                        }
+                                        
                                     }
 
                                 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs"
index 6ee32ef..cc5eca5 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs"
@@ -243,6 +243,119 @@
                 return null;
             }
         }
+
+
+        /// <summary>
+        /// 搴撲綅鍒嗛厤,鏃犲贩閬撳彿杩涜鍒嗛厤鍙�
+        /// </summary>
+        /// <returns></returns>
+        public Dt_LocationInfo? GetLocationInfo()
+        {
+            lock (_locker)
+            {
+                List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 20).ToList();//鏌ヨ娣诲姞闈欐�佸彉閲忚秴杩�5鍒嗛挓鐨勮揣浣�
+                int count = removeItems.Count;
+                for (int i = 0; i < count; i++)
+                {
+                    locationCaches.Remove(removeItems[i]);//绉婚櫎鏌ヨ娣诲姞闈欐�佸彉閲忚秴杩�5鍒嗛挓鐨勮揣浣�
+                }
+
+                List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList();
+
+                List<Dt_LocationInfo> locationInfos = BaseDal.QueryData();//鏌ヨ宸烽亾鎵�鏈夎揣浣嶄俊鎭�
+                List<Dt_LocationInfo> emptyLocations = locationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && !lockLocations.Contains(x.LocationCode)).OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenByDescending(x => x.Depth).ThenBy(x => x.Row).ToList();//鏌ヨ绌鸿揣浣嶄俊鎭苟鎺掗櫎5鍒嗛挓鍐呭垎閰嶇殑璐т綅,鏍规嵁灞傘�佸垪銆佹繁搴︺�佽鎺掑簭
+
+
+                for (int i = 0; i < emptyLocations.Count; i++)
+                {
+                    if (emptyLocations[i].Depth == 1)//鍒ゆ柇鏄惁1娣辫揣浣�
+                    {
+                        Dt_LocationInfo? sencondDepthLocation = locationInfos.FirstOrDefault(x => Math.Abs(x.Row - emptyLocations[i].Row) == 1 && x.Layer == emptyLocations[i].Layer && x.Column == emptyLocations[i].Column);//鏌ヨ2娣辫揣浣嶅搴旂殑1娣辫揣浣嶆槸鍚︿负绌�,闃叉鍑虹幇鍒嗛厤1娣辫揣浣嶈��2娣辫揣浣嶄负绌虹殑鎯呭喌
+                        if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt())
+                        {
+                            locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = sencondDepthLocation.LocationCode });
+                            return sencondDepthLocation;//1娣辫揣浣嶅強2娣辫揣浣嶉兘涓虹┖鐨勬儏鍐典笅,浼樺厛鍒嗛厤2娣辫揣浣�
+                        }
+                        else
+                        {
+                            locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode });
+                            return emptyLocations[i];
+                        }
+                    }
+                    else
+                    {
+                        Dt_LocationInfo? sencondDepthLocation = locationInfos.FirstOrDefault(x => Math.Abs(x.Row - emptyLocations[i].Row) == 1 && x.Layer == emptyLocations[i].Layer && x.Column == emptyLocations[i].Column);//鏌ヨ2娣辫揣浣嶅搴旂殑1娣辫揣浣嶆槸鍚︿负绌�
+                        if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt())
+                        {
+                            locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode });
+                            return emptyLocations[i];
+                        }
+                    }
+                }
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇宸烽亾鍐呯Щ搴�,鑾峰彇璐т綅
+        /// </summary>
+        /// <param name="roadway"></param>
+        /// <returns></returns>
+        public Dt_LocationInfo? GetLocation(string roadway)
+        {
+            lock (_locker)
+            {
+                List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 20).ToList();//鏌ヨ娣诲姞闈欐�佸彉閲忚秴杩�20鍒嗛挓鐨勮揣浣�
+                int count = removeItems.Count;
+                for (int i = 0; i < count; i++)
+                {
+                    locationCaches.Remove(removeItems[i]);//绉婚櫎鏌ヨ娣诲姞闈欐�佸彉閲忚秴杩�5鍒嗛挓鐨勮揣浣�
+                }
+
+                List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList();
+
+                List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => x.RoadwayNo == roadway  && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && !lockLocations.Contains(x.LocationCode));//鏌ヨ宸烽亾鎵�鏈夎揣浣嶄俊鎭�
+
+
+                List<Dt_LocationInfo> emptyLocations = locationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && !lockLocations.Contains(x.LocationCode)).OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenByDescending(x => x.Depth).ThenBy(x => x.Row).ToList();//鏌ヨ绌鸿揣浣嶄俊鎭苟鎺掗櫎20鍒嗛挓鍐呭垎閰嶇殑璐т綅,鏍规嵁灞傘�佸垪銆佹繁搴︺�佽鎺掑簭
+
+
+                for (int i = 0; i < emptyLocations.Count; i++)
+                {
+                    if (emptyLocations[i].Depth == 1)//鍒ゆ柇鏄惁1娣辫揣浣�
+                    {
+                        Dt_LocationInfo? sencondDepthLocation = locationInfos.FirstOrDefault(x => Math.Abs(x.Row - emptyLocations[i].Row) == 1 && x.Layer == emptyLocations[i].Layer && x.Column == emptyLocations[i].Column);//鏌ヨ2娣辫揣浣嶅搴旂殑1娣辫揣浣嶆槸鍚︿负绌�,闃叉鍑虹幇鍒嗛厤1娣辫揣浣嶈��2娣辫揣浣嶄负绌虹殑鎯呭喌
+                        if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt())
+                        {
+                            locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = sencondDepthLocation.LocationCode });
+                            return sencondDepthLocation;//1娣辫揣浣嶅強2娣辫揣浣嶉兘涓虹┖鐨勬儏鍐典笅,浼樺厛鍒嗛厤2娣辫揣浣�
+                        }
+                        else
+                        {
+                            if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus != LocationStatusEnum.Lock.ObjToInt())   //鍒ゆ柇浜屾繁鏃犱换鍔�
+                            {
+                                locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode });
+                                return emptyLocations[i];
+                            }
+                        }
+                    }
+                    else
+                    {
+                        Dt_LocationInfo? sencondDepthLocation = locationInfos.FirstOrDefault(x => Math.Abs(x.Row - emptyLocations[i].Row) == 1 && x.Layer == emptyLocations[i].Layer && x.Column == emptyLocations[i].Column);//鏌ヨ2娣辫揣浣嶅搴旂殑1娣辫揣浣嶆槸鍚︿负绌�
+
+                        if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt())
+                        {
+                            locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode });
+                            return emptyLocations[i];
+                        }
+                    }
+                }
+                return null;
+            }
+        }
+
+
+
         /// <summary>
         /// 鑾峰彇鍙敤璐т綅
         /// </summary>
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs"
index a1ba0a3..8ba4171 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs"
@@ -104,5 +104,10 @@
         public string MESbusinessId { get; set; }
         public string MESsubPalletCode { get; set; }
 
+        /// <summary>
+        /// 鍑哄叆搴撳彛
+        /// </summary>
+        public string OutboundPlatform { get; set; }
+
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs"
index 3763b4f..79a65fb 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs"
@@ -62,5 +62,20 @@
         /// <param name="heightType"></param>
         /// <returns></returns>
         Dt_LocationInfo? AssignLocation(string roadwayNo,int warehouseId, string beRelocationCode = "");
+
+        /// <summary>
+        /// 搴撲綅鍒嗛厤,鏃犲贩閬撳彿杩涜鍒嗛厤鍙�
+        /// </summary>
+        /// <returns></returns>
+        Dt_LocationInfo? GetLocationInfo();
+
+        /// <summary>
+        /// 鍒ゆ柇宸烽亾鍐呯Щ搴�,鑾峰彇璐т綅
+        /// </summary>
+        /// <param name="roadway"></param>
+        /// <returns></returns>
+        Dt_LocationInfo? GetLocation(string roadway);
+
+
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_Model/Models/TaskInfo/Dt_Task.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_Model/Models/TaskInfo/Dt_Task.cs"
index 695d0af..d43bb4b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_Model/Models/TaskInfo/Dt_Task.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_Model/Models/TaskInfo/Dt_Task.cs"
@@ -168,7 +168,7 @@
         [ExporterHeader(DisplayName = "MES涓氬姟娴乮d")]
         [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "MES涓氬姟娴乮d")]
         public string MESbusinessId { get; set; }
-
+        
         /// <summary>
         /// 鎵樼洏缂栧彿瀛愭墭
         /// </summary>
@@ -176,5 +176,13 @@
         [ExporterHeader(DisplayName = "鎵樼洏缂栧彿瀛愭墭")]
         [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鎵樼洏缂栧彿瀛愭墭")]
         public string MESsubPalletCode { get; set; }
+
+        /// <summary>
+        /// 鍑哄簱鍙�
+        /// </summary>
+        [ImporterHeader(Name = "鍑哄簱鍙�")]
+        [ExporterHeader(DisplayName = "鍑哄簱鍙�")]
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鍑哄簱鍙�")]
+        public string OutboundPlatform { get; set; }
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
index e82f7d9..267c874 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
@@ -145,18 +145,17 @@
                 if (inboundTask.palletInfoList.Count > 0)
                 {
                     List<Dt_Task> taskData = BaseDal.QueryData();
+                    List<Dt_StockInfo> Stockdata = _stockRepository.QueryData();
 
-                    Dt_StationManger dt_Station = _stationMangerService.QueryPlatform(inboundTask.NodeCode);
-                    if (dt_Station == null) return MESresponse($"鏈壘鍒扮珯鍙颁俊鎭�,绔欏彴缂栧彿锛歿inboundTask.NodeCode}", false);
+                    /*Dt_StationManger dt_Station = _stationMangerService.QueryPlatform(inboundTask.NodeCode);
+                    if (dt_Station == null) return MESresponse($"鏈壘鍒扮珯鍙颁俊鎭�,绔欏彴缂栧彿锛歿inboundTask.NodeCode}", false);*/
 
                     foreach (PalletInfo palletInfo in inboundTask.palletInfoList)
                     {
                         Dt_LocationInfo location = null;
                         if (palletInfo.locationCode == null || palletInfo.locationCode == "")
                         {
-                            Dt_Warehouse warehouse = _warehouseRepository.QueryFirst(x => x.WarehouseCode == dt_Station.StackerCraneCode);
-
-                            location = _basicService.LocationInfoService.AssignLocation(dt_Station.StackerCraneCode, warehouse.WarehouseId, "");//鑾峰彇鍒版柊搴撲綅
+                            location = _basicService.LocationInfoService.GetLocationInfo();//鑾峰彇鍒版柊搴撲綅
                         }
                         else
                         {
@@ -165,18 +164,45 @@
                         if (location == null) return MESresponse($"鏈壘鍒拌揣浣嶄俊鎭�,鏉$爜锛歿palletInfo.palletCode}", false);
                         if (location.LocationStatus != (int)LocationStatusEnum.Free) return MESresponse($"鎵樼洏鏉$爜锛歿palletInfo.palletCode}锛屾煡鎵惧埌鐨勮揣浣嶏細{location.LocationCode},涓嶄负绌鸿揣浣嶏紒", false);
 
-
-                        //鍒涘缓缁勭洏淇℃伅
-                        var dt_Stock = new Dt_StockInfo
+                        Dt_StockInfo dt_ = Stockdata.Where(x => x.PalletCode == palletInfo.palletCode).FirstOrDefault();
+                        if (dt_ == null)
                         {
-                            PalletCode = palletInfo.palletCode,
-                            PalletType = 1,
-                            LocationCode = location.LocationCode,
-                            StockStatus = (int)StockStatusEmun.缁勭洏鏆傚瓨,
-                            Creater = "WMS",
-                            CreateDate = DateTime.Now,
-                            MESsubPalletCode = palletInfo.palletCode,
-                        };
+                            //鍒涘缓缁勭洏淇℃伅
+                            var dt_Stock = new Dt_StockInfo
+                            {
+                                PalletCode = palletInfo.palletCode,
+                                PalletType = 1,
+                                LocationCode = location.LocationCode,
+                                StockStatus = (int)StockStatusEmun.缁勭洏鏆傚瓨,
+                                Creater = "WMS",
+                                CreateDate = DateTime.Now,
+                                MESsubPalletCode = palletInfo.palletCode,
+                            };
+                            Adddtstockt.Add(dt_Stock);
+                        }
+                        else
+                        {
+                            if(dt_.StockStatus == (int)StockStatusEmun.宸插叆搴�)
+                            {
+                                return MESresponse($"璇ュ簱瀛樻潯鐮佸凡鍏ュ簱锛屼笉鍙噸澶嶅叆搴�,鏉$爜锛歿palletInfo.palletCode}", false);
+                            }
+                        }
+
+                        string TaregtAddres = "";
+                        if (inboundTask.NodeCode !="2011" && inboundTask.NodeCode != "2009")
+                        {
+                            int nextTaregt = int.Parse(inboundTask.NodeCode);
+                            //纭鐩爣绔欏彴锛堝浐瀹氾級
+                             TaregtAddres = (nextTaregt + 1).ToString();
+                        }
+                        else
+                        {
+                            TaregtAddres = location.RoadwayNo == "SC01" ? "2021" : "2020";
+                        }
+                        
+
+
+
                         location.LocationStatus = (int)LocationStatusEnum.InStockLock;
 
                         //鐢熸垚绉诲姩浠诲姟
@@ -187,9 +213,9 @@
                             Roadway = location.RoadwayNo,
                             TaskType = TaskInboundTypeEnum.Inbound.ObjToInt(),
                             TaskStatus = TaskInStatusEnum.Line_InExecuting.ObjToInt(),
-                            SourceAddress = dt_Station.StationCode,
+                            SourceAddress = TaregtAddres,
                             TargetAddress = location.LocationCode,
-                            CurrentAddress = dt_Station.StationCode,
+                            CurrentAddress = TaregtAddres,
                             NextAddress = location.LocationCode,
                             Grade = 1,
                             Creater = "MES",
@@ -197,9 +223,10 @@
                             CreateDate = DateTime.Now,
                             MEStaskId = inboundTask.TaskId,
                             MESbusinessId = inboundTask.BusinessId,
-                            MESsubPalletCode = palletInfo.subPalletCode
+                            MESsubPalletCode = palletInfo.subPalletCode,
+                            OutboundPlatform = inboundTask.NodeCode
                         };
-                        Adddtstockt.Add(dt_Stock);
+                       
                         Adddt_Locations.Add(location);
                         AddtaskList.Add(dt_Task);
                     }
@@ -243,5 +270,6 @@
                 throw;
             }
         }
+
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
index fb978c5..3dd21d8 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
@@ -67,6 +67,20 @@
                         dt_StockInfo.StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾;
                         locationInfo.LocationStatus = (int)LocationStatusEnum.InStockLock;
 
+
+
+                        string TaregtAddres = "";
+                        if (outbound.NodeCode != "2011" && outbound.NodeCode != "2009")
+                        {
+                            int nextTaregt = int.Parse(outbound.NodeCode);
+                            //纭鐩爣绔欏彴锛堝浐瀹氾級
+                            TaregtAddres = (nextTaregt - 1).ToString();
+                        }
+                        else
+                        {
+                            TaregtAddres = locationInfo.RoadwayNo == "SC01" ? "2021" : "2020";
+                        }
+
                         //鐢熸垚绉诲姩浠诲姟
                         Dt_Task dt_Task = new()
                         {
@@ -83,9 +97,10 @@
                             Creater = "MES",
                             Depth = locationInfo.Depth,
                             CreateDate = DateTime.Now,
-                            MEStaskId= outbound.TaskId,
-                            MESbusinessId= outbound.BusinessId,
-                            MESsubPalletCode= dt_StockInfo.MESsubPalletCode
+                            MEStaskId = outbound.TaskId,
+                            MESbusinessId = outbound.BusinessId,
+                            MESsubPalletCode = dt_StockInfo.MESsubPalletCode,
+                            OutboundPlatform = outbound.NodeCode
                         };
                         Adddtstockt.Add(dt_StockInfo);
                         Addlocations.Add(locationInfo);
@@ -96,9 +111,9 @@
                         _unitOfWorkManage.BeginTran();
 
 
-                        _stockRepository.DeleteData(Adddtstockt);
+                        _stockRepository.UpdateData(Adddtstockt);
                         _locationInfoRepository.UpdateData(Addlocations);
-                        BaseDal.DeleteData(Addtaskdt);
+                        BaseDal.AddData(Addtaskdt);
 
                         var respon = PushTasksToWCS(Addtaskdt,"");
                         if (respon.Status)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 428f449..4d6a0ab 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -171,7 +171,7 @@
                     if (_Task != null) return content.Error($"璐т綅缂栧彿:{Locatask}鐨勬祬璐т綅搴撳凡鏈変换鍔★紝涓嶅彲杩涜绉诲簱");
 
                     //杩涜鑾峰彇鏂扮殑搴撲綅
-                    Dt_LocationInfo? Nextlocation = _basicService.LocationInfoService.AssignLocation(DeepLocation.RoadwayNo, 0, "");//鑾峰彇鍒版柊搴撲綅
+                    Dt_LocationInfo? Nextlocation = _basicService.LocationInfoService.GetLocation(DeepLocation.RoadwayNo);//鑾峰彇鍒版柊搴撲綅
                     if (Nextlocation == null)
                     {
                         return content.Error($"璐т綅鍒嗛厤澶辫触,鏈壘鍒板彲鍒嗛厤璐т綅");
@@ -364,11 +364,12 @@
                 task.TaskStatus = TaskOutStatusEnum.OutFinish.ObjToInt();
 
                 _unitOfWorkManage.BeginTran();
+
                 _stockRepository.DeleteData(stockInfo);
                 _locationInfoRepository.UpdateData(locationInfo);   //淇敼鎴愮┖璐т綅
 
                 BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
-                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
+                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt(), "1", task.TaskNum);
                 /*WebResponseContent content = TaskCompletionFeedback(task);
                 if (!content.Status)
                 {
@@ -382,7 +383,7 @@
             catch (Exception ex)
             {
                 _unitOfWorkManage.RollbackTran();
-                return webResponse.Error($"绉诲簱浠诲姟瀹屾垚澶辫触锛屼换鍔d锛歿task.TaskNum},閿欒鍘熷洜锛歿ex.Message}");
+                return webResponse.Error($"鍑哄簱浠诲姟瀹屾垚澶辫触锛屼换鍔d锛歿task.TaskNum},閿欒鍘熷洜锛歿ex.Message}");
                 throw;
             }
             
diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\270\205\345\215\225/\346\211\230\347\233\230\345\272\223\346\216\245\345\217\243\346\270\205\345\215\225V1.6.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\270\205\345\215\225/\346\211\230\347\233\230\345\272\223\346\216\245\345\217\243\346\270\205\345\215\225V1.6.xlsx"
index ce16be1..394c194 100644
--- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\270\205\345\215\225/\346\211\230\347\233\230\345\272\223\346\216\245\345\217\243\346\270\205\345\215\225V1.6.xlsx"
+++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\270\205\345\215\225/\346\211\230\347\233\230\345\272\223\346\216\245\345\217\243\346\270\205\345\215\225V1.6.xlsx"
Binary files differ

--
Gitblit v1.9.3