From 43701568a4a90b3a7a471ac0b34222b1df3efd22 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期四, 02 四月 2026 15:12:03 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs |   66 +++++++++++++++++++++-----------
 1 files changed, 43 insertions(+), 23 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 1f4eef1..d75095a 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"
@@ -1,6 +1,7 @@
 锘縰sing Newtonsoft.Json;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -46,12 +47,12 @@
                         desStationCodes = task.SourceAddress,
                         desType = 5
                     };
-                    fOURBOTnewMovePodTask.requestID += i;
+                    fOURBOTnewMovePodTask.requestID += task.TaskId;
                     try
                     {
                         string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
                         FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
-                        content.Data = fOURBOTReturn;
+                        content.OK(data: fOURBOTReturn);
                         if (fOURBOTReturn.returnCode != 0) throw new Exception(fOURBOTReturn.returnUserMsg);
 
                         string dataJson = fOURBOTReturn.data.ToString();
@@ -70,7 +71,16 @@
                         task.ExceptionMessage = ex.Message;
                     }
                 }
-                _taskService.UpdateData(tasks);
+                var uptasks = tasks.Where(task => string.IsNullOrEmpty(task.ExceptionMessage)).ToList();
+                if (uptasks.Count() > 0) _taskService.UpdateData(uptasks);
+                var errortasks = tasks.Where(task => !string.IsNullOrEmpty(task.ExceptionMessage)).ToList();
+                if (errortasks.Count() > 0)
+                {
+                    foreach (var item in errortasks)
+                    {
+                        _taskService.ErrorTaskFeedback(item, true);
+                    }
+                }
                 content.OK();
             }
             catch (Exception ex)
@@ -113,7 +123,7 @@
                     fOURBOTnewMovePodTask.desNodeID = item.NextAddress;
                     string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
                     FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
-                    content.Data = fOURBOTReturn;
+                    content.OK(data: fOURBOTReturn);
                     if (fOURBOTReturn.returnCode == 0)
                     {
                         string dataJson = fOURBOTReturn.data.ToString();
@@ -136,7 +146,7 @@
             }
             finally
             {
-                _trackloginfoService.AddTrackLog(fOURBOTnewMovePodTask, content, "涓嬪彂鍥涘悜杞︽柊寤哄叆搴撲换鍔�", "", "");
+                _trackloginfoService.AddTrackLog(fOURBOTnewMovePodTask, content, "涓嬪彂鍥涘悜杞﹀褰㈡娴嬩换鍔�", "", "");
             }
         }
         #endregion
@@ -172,7 +182,7 @@
                 //content.candidatePodIDs = tasks.Select(x => x.PalletCode).ToList();
                 string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize());
                 FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
-                content.Data = fOURBOTReturn;
+                content.OK(data: fOURBOTReturn);
                 if (fOURBOTReturn.returnCode == 0)
                 {
                     //ReturnBlockPodResultDto getBlockPod = fOURBOTReturn.data as ReturnBlockPodResultDto ?? throw new Exception("鏈幏鍙栧埌闃荤鎵樼洏鍏崇郴鏁版嵁");
@@ -188,7 +198,12 @@
                         {
                             var task = tasks.First(x => x.PalletCode == item.outPod);
                             if (item.blockPods != null && item.blockPods.Count > 0)
+                                item.blockPods = item.blockPods.Except(PalletCodes).ToList();
+                            if (item.blockPods != null && item.blockPods.Count > 0)
                             {
+                                #region 鍒ゆ柇闃荤鎵樻槸鍚︿负鍑哄簱浠诲姟
+                                //var except = item.blockPods.Except(PalletCodes).ToList();
+                                #endregion
                                 var responseContent = AddMoveTask(item.blockPods, task);//娣诲姞绉诲簱浠诲姟
                                 if (!responseContent.Status) task.ExceptionMessage = responseContent.Message;
                                 else task.TaskState = (int)TaskStatusEnum.RGV_WaitMoveToExecute;
@@ -266,7 +281,7 @@
 
                             string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
                             var fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
-                            content.Data = fOURBOTReturn;
+                            content.OK(data: fOURBOTReturn);
                             if (fOURBOTReturn.returnCode == 0)
                             {
                                 var data = fOURBOTReturn.data.ToString();
@@ -278,12 +293,12 @@
                                 locationsToUpdate.Add(rGVLocationInfo);
 
                                 #region 閲婃斁鍏ュ簱绔欏彴
-                                var stationManger = _stationMangerService.GetInStationInfo(item.SourceAddress);
-                                if (stationManger != null)
-                                {
-                                    stationManger.IsOccupied = LocationStatusEnum.Free.ObjToInt();
-                                    stationsToUpdate.Add(stationManger);
-                                }
+                                //var stationManger = _stationMangerService.GetInStationInfo(item.SourceAddress);
+                                //if (stationManger != null)
+                                //{
+                                //    stationManger.IsOccupied = LocationStatusEnum.Free.ObjToInt();
+                                //    stationsToUpdate.Add(stationManger);
+                                //}
                                 content.OK();
                                 #endregion
                             }
@@ -386,8 +401,8 @@
                             _taskService.UpdateData(tasksToUpdate);
                         if (locationsToUpdate.Any())
                             _rGVLocationInfoService.UpdateData(locationsToUpdate);
-                        if (stationsToUpdate.Any())
-                            _stationMangerService.UpdateData(stationsToUpdate);
+                        //if (stationsToUpdate.Any())
+                        //    _stationMangerService.UpdateData(stationsToUpdate);
 
                         _unitOfWorkManage.CommitTran();
                     }
@@ -406,7 +421,7 @@
             }
             finally
             {
-                _trackloginfoService.AddTrackLog(fOURBOTnewMovePodTask, content, "涓嬪彂澶栧舰妫�娴嬩换鍔″け璐�", "", "");
+                _trackloginfoService.AddTrackLog(fOURBOTnewMovePodTask, content, "涓嬪彂澶栧舰妫�娴嬫垚鍔熶换鍔�", "", "");
             }
         }
         #endregion
@@ -445,6 +460,7 @@
                         //FOURBOTnewMovePodTaskResponseData fOURBO = fOURBOTReturn.data as FOURBOTnewMovePodTaskResponseData ?? throw new Exception("鏈幏鍙栧埌鍥涘悜杞﹁繑鍥炵殑浠诲姟ID");
                         string dataJson = fOURBOTReturn.data.ToString();
                         FOURBOTnewMovePodTaskResponseData? fOURBO = JsonConvert.DeserializeObject<FOURBOTnewMovePodTaskResponseData>(dataJson);
+                        content.OK(data: fOURBO);
                         if (fOURBO == null || fOURBO.taskID == 0)
                         {
                             throw new Exception($"鏈幏鍙栧埌鍥涘悜杞﹁繑鍥炵殑浠诲姟ID锛岃繑鍥炴暟鎹細{response}");
@@ -483,7 +499,7 @@
                 tasks.ForEach(x =>
                 {
                     x.TaskNum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
-                    x.WMSTaskNum = task.WMSTaskNum;
+                    //x.WMSTaskNum = task.WMSTaskNum;
                 });
                 rGVLocationInfos.ForEach(x =>
                 {
@@ -537,7 +553,7 @@
                 }
                 string response = HttpHelper.Post(apiInfo.ApiAddress, moveBlock.Serialize());
                 FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
-                content.Data = fOURBOTReturn;
+                content.OK(data: fOURBOTReturn);
                 if (fOURBOTReturn.returnCode == 0)
                 {
                     string dataJson = fOURBOTReturn.data.ToString();
@@ -607,8 +623,12 @@
                 {
                     i++;
                     var stationManger = _stationMangerService.GetOutStationInfo(item.TargetAddress);
+                    //if (stationManger.IsOccupied != LocationStatusEnum.Free.ObjToInt())
+                    //{
+                    //    item.ExceptionMessage = $"鍑哄簱绔欏彴銆恵stationManger.StationCode}銆戣鍗犵敤";
+                    //    continue;
+                    //}
                     item.NextAddress = stationManger.StationCode;
-                    if (stationManger.IsOccupied != LocationStatusEnum.Free.ObjToInt()) continue;
                     #region 涓嬪彂鍑哄簱浠诲姟
                     fOURBOTnewMovePodTask.priority = item.Grade;
                     fOURBOTnewMovePodTask.podID = item.PalletCode;
@@ -623,10 +643,10 @@
                         autoToRest = 1
                     };
                     fOURBOTnewMovePodTask.desType = 5;
-                    fOURBOTnewMovePodTask.requestID = DateTime.Now.ToString("yyyyMMddHHmmss") + i;
+                    fOURBOTnewMovePodTask.requestID = DateTime.Now.ToString("yyyyMMddHHmmss") + item.TaskId;
                     string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
                     FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
-                    content.Data = fOURBOTReturn;
+                    content.OK(data: fOURBOTReturn);
                     if (fOURBOTReturn.returnCode == 0)
                     {
                         string dataJson = fOURBOTReturn.data.ToString();
@@ -637,8 +657,8 @@
                         }
                         item.RGVTaskId = fOURBO.taskID;
                         item.TaskState = (int)TaskStatusEnum.Execut;
-                        stationManger.IsOccupied = LocationStatusEnum.Lock.ObjToInt();
-                        _stationMangerService.UpdateData(stationManger);
+                        //stationManger.IsOccupied = LocationStatusEnum.Lock.ObjToInt();
+                        //_stationMangerService.UpdateData(stationManger);
                     }
                     #endregion
                 }

--
Gitblit v1.9.3