From 507c540eed466aaabfc543c8a514596445d3a7af Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期五, 10 四月 2026 14:44:34 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/RuiShengZhiNeng/GaoPuLiTiKu
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs | 56 ++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 42 insertions(+), 14 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
index 2191f2d..6f0807f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
@@ -8,6 +8,7 @@
using System.Reflection.Metadata;
using System.Text;
using System.Text.Json;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.LocationEnum;
@@ -176,7 +177,7 @@
BaseDal.UpdateData(task);
}
// //鍥涙ゼ鍑烘彁鍗囨満 鍏ュ簱 涔嬪墠鏄疉GV_ToExecute //瑕佸啓鎴愬彇璐у畬鎴愮姸鎬乀akeFinish
- else if ((task.TaskType == TaskTypeEnum.Q1TSJ4.ObjToInt() || task.TaskType == TaskTypeEnum.F03.ObjToInt()) && task.TaskState == (int)TaskStatusEnum.AGV_ToExecute)
+ else if ((task.TaskType == TaskTypeEnum.Q1TSJ4.ObjToInt() || task.TaskType == TaskTypeEnum.F03.ObjToInt()) && task.TaskState == (int)TaskStatusEnum.TakeFinish)
{
var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
if (device == null) task.ExceptionMessage = "鏈壘鍒版彁鍗囨満淇℃伅";
@@ -283,7 +284,7 @@
case "intolift": //杩涘叆鐢垫
{
//鍏ゼ鍒颁竴妤肩殑鍏ュ簱浠诲姟
- if (task.TaskType == (int)TaskTypeEnum.Q3RK || task.TaskType == (int)TaskTypeEnum.MOVE || task.TaskType == (int)TaskTypeEnum.F01)
+ if (task.TaskType == (int)TaskTypeEnum.Q3RK || task.TaskType == (int)TaskTypeEnum.MOVE || task.TaskType == (int)TaskTypeEnum.F01 || task.TaskType == (int)TaskTypeEnum.Q3CK)
{
task.TaskState = TaskStatusEnum.Hkintolift.ObjToInt();
BaseDal.UpdateData(task);
@@ -292,7 +293,7 @@
break;
case "leavelift": //绂诲紑鐢垫
{
- if (task.TaskType == (int)TaskTypeEnum.Q3RK || task.TaskType == (int)TaskTypeEnum.MOVE || task.TaskType == (int)TaskTypeEnum.F01)
+ if (task.TaskType == (int)TaskTypeEnum.Q3RK || task.TaskType == (int)TaskTypeEnum.MOVE || task.TaskType == (int)TaskTypeEnum.F01|| task.TaskType == (int)TaskTypeEnum.Q3CK)
{
task.TaskState = TaskStatusEnum.HKleavelift.ObjToInt();
BaseDal.UpdateData(task);
@@ -393,12 +394,18 @@
}
if (Rgv.content.status == 5)
{
- if (task.TaskState == (int)TaskStatusEnum.Execut)
+ task.ExceptionMessage = Rgv.content.errorReason;
+ var Error = _taskErrorMessageService.Repository.QueryFirst(x => x.ErrorCode == Rgv.content.errorCode && x.DeviceType == (int)deviceTypeEnum);
+ if (Error != null)
{
- task.TaskState = (int)TaskStatusEnum.New;
- task.Remark = "鍥涘悜杞﹀弽棣堝け璐�,閲嶆柊涓嬪彂";
- BaseDal.UpdateData(task);
+ task.ExceptionMessage = Error.ExceptionMessage;
+ MatchCollection matches = Regex.Matches(Rgv.content.errorReason, @"\(([^)]+)\)");
+ if (matches.Count > 0)
+ task.ExceptionMessage = ReplacePlaceholders(Rgv.content.errorReason, Error.ExceptionMessage);
+ ErrorTaskFeedback(task, true, Error.ErrorCode.ToString());
}
+ else
+ ErrorTaskFeedback(task, true);
}
}
}
@@ -414,6 +421,30 @@
_trackloginfoService.AddTrackLog(TaskDTO, content, $"{deviceName}浠诲姟鐘舵�佸弽棣�", "", "");
}
return content;
+ }
+ #endregion
+
+ #region 寮傚父淇℃伅杞崲
+ /// <summary>
+ /// 寮傚父淇℃伅()鍐呭杞崲
+ /// </summary>
+ /// <param name="source"></param>
+ /// <param name="targetTemplate"></param>
+ /// <returns></returns>
+ public string ReplacePlaceholders(string source, string targetTemplate)
+ {
+ // 鎻愬彇婧愬瓧绗︿覆涓殑鎵�鏈夋嫭鍙峰��
+ var values = Regex.Matches(source, @"\(([^)]+)\)")
+ .Cast<Match>()
+ .Select(m => m.Groups[1].Value)
+ .ToList();
+
+ // 鏇挎崲鐩爣妯℃澘涓殑鎵�鏈� (%v)
+ int idx = 0;
+ string result = Regex.Replace(targetTemplate, @"\(\%v\)", _ =>
+ idx < values.Count ? values[idx++] : "");
+
+ return result;
}
#endregion
@@ -692,7 +723,7 @@
}
#endregion
#region 澶辫触浠诲姟涓婃姤WMS骞跺垹闄や换鍔�
- public WebResponseContent ErrorTaskFeedback(Dt_Task dt_Task, bool Del)
+ public WebResponseContent ErrorTaskFeedback(Dt_Task dt_Task, bool Del = false, string ErrorCode = "")
{
WebResponseContent content = new WebResponseContent();
WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback();
@@ -708,7 +739,7 @@
boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress;
boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress;
boundCompleteFeedback.status = 3;
- boundCompleteFeedback.custStatus = "";
+ boundCompleteFeedback.custStatus = ErrorCode;
boundCompleteFeedback.memo = dt_Task.ExceptionMessage;
string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
agvContent = response.DeserializeObject<WMSReturn>();
@@ -729,15 +760,12 @@
finally
{
_trackloginfoService.AddTrackLog(boundCompleteFeedback, content, "鍑哄叆搴撲换鍔$姸鎬佸弽棣圵MS", "", "");
- if (agvContent != null && agvContent.code == 200 && Del) BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩鍒犻櫎);
+ if (agvContent != null && agvContent.code == 200 && Del)
+ BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩鍒犻櫎);
else BaseDal.UpdateData(dt_Task);
}
return content;
}
#endregion
-
-
-
-
}
}
--
Gitblit v1.9.3