From aeb971fe12b73d83d31a83b00f0a6e2876b24a00 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期四, 09 四月 2026 21:21:51 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/RuiShengZhiNeng/GaoPuLiTiKu

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs |   94 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 93 insertions(+), 1 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs"
index 00c4e53..83f6a96 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs"
@@ -38,6 +38,7 @@
                 //    if (LocationInfo.LocationStatus != LocationStatusEnum.Free.ObjToInt()) throw new Exception($"缁堢偣璐т綅銆恵taskDTO.toLocationCode}銆戣揣浣嶇姸鎬佷笉涓虹┖璐т綅");
                 //}
                 #endregion
+                var rGVLocationInfo = _rGVLocationInfoService.GetInFreeLocationInfo(taskDTO.toAreaCode.ObjToInt()) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱鍖恒�恵taskDTO.toAreaCode}銆戝彲鐢ㄧ┖璐т綅锛�");
                 Dt_StationManger stationManger = _stationMangerService.GetInStationInfo(taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐逛綅缃�恵taskDTO.fromLocationCode}銆戠珯鍙颁俊鎭紒");
                 Dt_Task dt_Task = new()
                 {
@@ -52,6 +53,7 @@
                     CurrentAddress = taskDTO.fromLocationCode,
                     NextAddress = stationManger.RGVStationCode,
                     TargetAddress = "",
+                    Dispatchertime=DateTime.Now,
                     Creater = "WMS",
                 };
                 BaseDal.AddData(dt_Task);
@@ -83,7 +85,7 @@
             try
             {
                 var stationManger = _stationMangerService.GetOutStationInfo(taskDTO.toLocationCode);
-                if (stationManger==null)
+                if (stationManger == null)
                 {
                     return content.Error($"{taskDTO.toLocationCode}涓嶆槸鍑哄簱绔欏彴");
                 }
@@ -103,6 +105,7 @@
                     CurrentAddress = taskDTO.fromLocationCode,
                     NextAddress = taskDTO.toLocationCode,
                     TargetAddress = taskDTO.toLocationCode,
+                    Dispatchertime = DateTime.Now,
                     Creater = "WMS",
                 };
                 rGVLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt();
@@ -133,7 +136,96 @@
                 };
                 return content.Error(ex.Message);
             }
+           
         }
         #endregion
+        /// <summary>
+        /// 绉诲簱浠诲姟
+        /// </summary>
+        /// <param name="taskDTO"></param>
+        /// <param name="taskType"></param>
+        /// <returns></returns>
+        public WebResponseContent CreateRGVNewMoveTask(TaskDTO taskDTO, int taskType)
+        {
+            WebResponseContent content = new WebResponseContent();
+            FOURBOTnewMovePodTask fOURBOTnewMovePodTask = new();
+            try
+            {
+                if (string.IsNullOrEmpty(taskDTO.fromLocationCode)) throw new Exception($"璧风偣搴撲綅涓嶈兘涓虹┖锛�");
+                if (string.IsNullOrEmpty(taskDTO.toLocationCode)) throw new Exception($"缁堢偣搴撲綅涓嶈兘涓虹┖锛�");
+                Dt_RGVLocationInfo rGVLocationInfo = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐瑰簱浣嶃�恵taskDTO.fromLocationCode}銆戯紒");
+                if (rGVLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鍙嚭搴擄紒");
+                if (rGVLocationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戠粦瀹氭枡绠卞彿銆恵rGVLocationInfo.PalletCode}銆戜笌浠诲姟鏂欑鍙枫�恵taskDTO.containerCode}銆戜笉鍖归厤锛�");
+                Dt_RGVLocationInfo rGVLocationInfo1 = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱浣嶃�恵taskDTO.toLocationCode}銆戯紒");
+                if (rGVLocationInfo1.LocationStatus != LocationStatusEnum.Free.ObjToInt()) throw new Exception($"缁堢偣搴撲綅銆恵taskDTO.toLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉涓虹┖闂诧紒");
+                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("鏈壘鍒板洓鍚戣溅浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+                Dt_Task dt_Task = new()
+                {
+                    TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+                    WMSTaskNum = taskDTO.taskCode,
+                    Grade = taskDTO.taskPriority,
+                    PalletCode = taskDTO.containerCode,
+                    Roadway = rGVLocationInfo.RoadwayNo,
+                    TaskState = TaskStatusEnum.New.ObjToInt(),
+                    TaskType = taskType,
+                    SourceAddress = taskDTO.fromLocationCode,
+                    CurrentAddress = taskDTO.fromLocationCode,
+                    NextAddress = taskDTO.toLocationCode,
+                    TargetAddress = taskDTO.toLocationCode,
+                    Creater = "WMS",
+                };
+                rGVLocationInfo.LocationStatus = LocationStatusEnum.MoveLock.ObjToInt();
+                rGVLocationInfo1.LocationStatus = LocationStatusEnum.MoveLock.ObjToInt();
+                #region 涓嬪彂鍥涘悜杞︿换鍔�
+                fOURBOTnewMovePodTask = new FOURBOTnewMovePodTask
+                {
+                    priority = dt_Task.Grade,
+                    podID = dt_Task.PalletCode,
+                    desStorageID = dt_Task.TargetAddress,
+                    desExt = new { unload = 1 }, // 鏄惁鏀句笅瀹瑰櫒,0鍚�1鏄�
+                    desType = 2
+                };
+                fOURBOTnewMovePodTask.taskExt = new
+                {
+                    autoToRest = 1
+                };
+                string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
+                var fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+                content.OK(data: fOURBOTReturn);
+                if (fOURBOTReturn.returnCode != 0) throw new Exception($"涓嬪彂鎴愬搧绉诲簱浠诲姟閿欒锛歿fOURBOTReturn.returnMsg}");
+                var data = fOURBOTReturn.data.ToString();
+                var fOURBO = data.DeserializeObject<FOURBOTnewMovePodTaskResponseData>();
+                dt_Task.RGVTaskId = fOURBO.taskID;
+                dt_Task.TaskState = TaskStatusEnum.RGV_MoveTaskSend.ObjToInt();
+                #endregion
+                try
+                {
+                    Db.Ado.BeginTran();
+                    BaseDal.AddData(dt_Task);
+                    _rGVLocationInfoService.Repository.UpdateData(rGVLocationInfo);
+                    _rGVLocationInfoService.Repository.UpdateData(rGVLocationInfo1);
+                    Db.Ado.CommitTran();
+                }
+                catch (Exception ex)
+                {
+                    Db.Ado.RollbackTran();
+                    throw new Exception(ex.Message);
+                }
+                return content.OK(data: new
+                {
+                    taskCode = taskDTO.taskCode,
+                    Message = "鎴愬姛锛�"
+                });
+            }
+            catch (Exception ex)
+            {
+                content.Data = new
+                {
+                    taskCode = taskDTO.taskCode,
+                    Message = $"澶辫触锛亄ex.Message}"
+                };
+                return content.Error(ex.Message);
+            }
+        }
     }
 }

--
Gitblit v1.9.3