From b6a82cb656a6cd045d772274ae927c8ca2c22b06 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 27 二月 2026 14:26:03 +0800
Subject: [PATCH] 优化四向车入库任务

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs |  136 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 135 insertions(+), 1 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs"
index f057da7..81a498f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs"
@@ -50,8 +50,33 @@
                 var outtasks = tasks.Where(x => x.TaskType == (int)TaskTypeEnum.CPOutbound).ToList();
                 foreach (var item in outtasks)
                 {
-                    ///鍒ゆ柇鏄惁闇�瑕佺Щ搴�
+                    ///鍒ゆ柇鏄惁闇�瑕佺Щ搴�,鍑哄簱绔欏彴鏄惁绌洪棽
+                    if (IsNoMoveTask(item) && StationIsFree(item.TargetAddress))
+                    {
+                        #region 涓嬪彂鍑哄簱浠诲姟
+                        fOURBOTnewMovePodTask.priority = item.Grade;
+                        fOURBOTnewMovePodTask.podID = item.PalletCode;
+                        fOURBOTnewMovePodTask.destination = item.NextAddress;
+                        fOURBOTnewMovePodTask.desExt = new
+                        {
+                            unload = 1//鏄惁鏀句笅瀹瑰櫒,0鍚�1鏄�
+                        };
+                        fOURBOTnewMovePodTask.desType = 2;
+                        string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
+                        FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+                        if (fOURBOTReturn.returnCode == 0)
+                        {
+                            item.RGVTaskId = fOURBOTReturn.data.taskID;
+                            item.TaskState = (int)TaskStatusEnum.Execut;
+                        }
+                        #endregion
+                    }
+                    else
+                    {
+                        item.TaskState = (int)TaskStatusEnum.RGV_WaitMoveToExecute;
+                    }
                 }
+                _taskService.UpdateData(outtasks);
                 #endregion
             }
             catch (Exception ex)
@@ -60,6 +85,8 @@
             }
         }
         #endregion
+
+        #region 涓嬪彂澶栧舰妫�娴嬫垚鍔熶换鍔�
         /// <summary>
         /// 涓嬪彂澶栧舰妫�娴嬫垚鍔熶换鍔�
         /// </summary>
@@ -71,6 +98,7 @@
             {
                 Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("鏈壘鍒板洓鍚戣溅浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
                 List<Dt_RGVLocationInfo> rGVLocationInfos = new List<Dt_RGVLocationInfo>();
+                List<Dt_StationManger> stationMangers = new List<Dt_StationManger>();
                 foreach (var item in tasks)
                 {
                     #region 鑾峰彇璐т綅
@@ -100,12 +128,18 @@
                             item.TaskState = (int)TaskStatusEnum.Puting;
                             rGVLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt();
                             rGVLocationInfos.Add(rGVLocationInfo);
+                            #region 閲婃斁鍏ュ簱绔欏彴
+                            Dt_StationManger stationManger = _stationMangerService.GetInStationInfo(item.SourceAddress);
+                            stationManger.IsOccupied = LocationStatusEnum.Free.ObjToInt();
+                            stationMangers.Add(stationManger);
+                            #endregion
                         }
                     }
                 }
                 _taskService.Db.Ado.BeginTran();
                 _taskService.UpdateData(tasks);
                 _rGVLocationInfoService.UpdateData(rGVLocationInfos);
+                _stationMangerService.UpdateData(stationMangers);
                 _taskService.Db.Ado.CommitTran();
             }
             catch (Exception ex)
@@ -113,5 +147,105 @@
                 WriteError(nameof(TaskJob), ex.Message, ex);
             }
         }
+        #endregion
+
+        #region 涓嬪彂澶栧舰妫�娴嬪け璐ヤ换鍔�
+        public void SendCheckShapeingNGTask(List<Dt_Task> tasks)
+        {
+            FOURBOTnewMovePodTask fOURBOTnewMovePodTask = new();
+            try
+            {
+                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("鏈壘鍒板洓鍚戣溅浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+                foreach (var item in tasks)
+                {
+                    Dt_StationManger stationManger = _stationMangerService.GetInStationInfo(item.SourceAddress);
+                    item.CurrentAddress = item.NextAddress;
+                    item.NextAddress = stationManger.RGVStationCode;
+                    fOURBOTnewMovePodTask.priority = item.Grade;
+                    fOURBOTnewMovePodTask.podID = item.PalletCode;
+                    fOURBOTnewMovePodTask.destination = item.NextAddress;
+                    fOURBOTnewMovePodTask.desExt = new
+                    {
+                        unload = 1//鏄惁鏀句笅瀹瑰櫒,0鍚�1鏄�
+                    };
+                    fOURBOTnewMovePodTask.desType = 2;
+                    string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
+                    FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+                    if (fOURBOTReturn.returnCode == 0)
+                    {
+                        item.RGVTaskId = fOURBOTReturn.data.taskID;
+                        item.TaskState = (int)TaskStatusEnum.Puting;
+                    }
+                }
+                _taskService.UpdateData(tasks);
+            }
+            catch (Exception ex)
+            {
+                WriteError(nameof(TaskJob), ex.Message, ex);
+            }
+        }
+        #endregion
+
+        #region 鍒ゆ柇鏄惁闇�瑕佺Щ搴�
+        public static bool IsNoMoveTask(Dt_Task task)
+        {
+            var isNoMove = true;
+            try
+            {
+
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+            return isNoMove;
+        }
+        #endregion
+
+        #region 鍒ゆ柇鍑哄簱鍙f槸鍚︾┖闂�
+        public bool StationIsFree(string StationCode)
+        {
+            Dt_StationManger stationManger = _stationMangerService.GetOutStationInfo(StationCode);
+            return stationManger.IsOccupied == LocationStatusEnum.Free.ObjToInt();
+        }
+        #endregion
+
+        #region 绉诲簱鍚庝笅鍙戝嚭搴撲换鍔�
+        public void SendMoveToExecuteTask(List<Dt_Task> tasks)
+        {
+            try
+            {
+                FOURBOTnewMovePodTask fOURBOTnewMovePodTask = new();
+                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("鏈壘鍒板洓鍚戣溅浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+                foreach (var item in tasks)
+                {
+                    if (_taskService.Repository.QueryData(x => x.Roadway == item.Roadway && x.TaskType == (int)TaskTypeEnum.CPMoveInventory).Any()) continue;
+                    if (!StationIsFree(item.TargetAddress)) continue;
+                    #region 涓嬪彂鍑哄簱浠诲姟
+                    fOURBOTnewMovePodTask.priority = item.Grade;
+                    fOURBOTnewMovePodTask.podID = item.PalletCode;
+                    fOURBOTnewMovePodTask.destination = item.NextAddress;
+                    fOURBOTnewMovePodTask.desExt = new
+                    {
+                        unload = 0//鏄惁鏀句笅瀹瑰櫒,0鍚�1鏄�
+                    };
+                    fOURBOTnewMovePodTask.desType = 2;
+                    string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
+                    FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+                    if (fOURBOTReturn.returnCode == 0)
+                    {
+                        item.RGVTaskId = fOURBOTReturn.data.taskID;
+                        item.TaskState = (int)TaskStatusEnum.Execut;
+                    }
+                    #endregion
+                }
+                _taskService.UpdateData(tasks);
+            }
+            catch (Exception ex)
+            {
+                WriteError(nameof(TaskJob), ex.Message, ex);
+            }
+        }
+        #endregion
     }
 }

--
Gitblit v1.9.3