From 4bdc37291d784008cea7fb9d105077b65a12beb9 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期二, 24 三月 2026 09:31:52 +0800
Subject: [PATCH] job优化
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs | 78 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 76 insertions(+), 2 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
index c7a6a39..f61e389 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
@@ -13,6 +13,7 @@
using WIDESEAWCS_DTO;
using WIDESEAWCS_DTO.AGV.HIKROBOT;
using System.Diagnostics.CodeAnalysis;
+using System.Reflection.PortableExecutable;
namespace WIDESEAWCS_TaskInfoService
{
@@ -175,8 +176,19 @@
#region 瀹炰綋绫昏浆鎹�
hIKROBOTTaskSubmit = HIKROBOTTask(task);
if (hIKROBOTTaskSubmit == null) throw new Exception("娴峰悍AGV浠诲姟瀹炰綋杞崲澶辫触");
+ var json = hIKROBOTTaskSubmit.Serialize();
#endregion
- string response = HttpHelper.Post(apiInfo.ApiAddress, hIKROBOTTaskSubmit.Serialize());
+ // 鍒涘缓Headers瀛楀吀
+ var headers = new Dictionary<string, string>
+ {
+ { "X-lr-request-id", DateTimeOffset.Now.ToUnixTimeSeconds().ToString()+task.TaskNum }
+ // 濡傛灉闇�瑕佸叾浠朒eader锛屽彲浠ョ户缁坊鍔�
+ // { "Content-Type", "application/json" }
+ };
+
+ // 浼犻�扝eaders鍙傛暟
+ string response = HttpHelper.Post(apiInfo.ApiAddress, hIKROBOTTaskSubmit.Serialize(), headers: headers);
+ //string response = HttpHelper.Post(apiInfo.ApiAddress, hIKROBOTTaskSubmit.Serialize());
hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
if (hIKROBOTReturn.code == "SUCCESS")
{
@@ -209,7 +221,7 @@
HIKROBOTTaskSubmit hIKROBOTTaskSubmit = new HIKROBOTTaskSubmit();
try
{
- var tasktype = (TaskTypeEnum)Enum.GetValues(typeof(TaskTypeEnum)).GetValue(task.TaskType);
+ var tasktype = (TaskTypeEnum)Enum.GetValues(typeof(TaskTypeEnum)).GetValue(task.TaskType - 1);
hIKROBOTTaskSubmit.initPriority = task.Grade;
hIKROBOTTaskSubmit.robotTaskCode = task.WMSTaskNum;
@@ -233,6 +245,8 @@
case TaskTypeEnum.RK3F:
case TaskTypeEnum.CK3F:
case TaskTypeEnum.F02:
+ case TaskTypeEnum.F03:
+ case TaskTypeEnum.F04:
{
TargetRouteDto target = new TargetRouteDto()
{
@@ -311,5 +325,65 @@
}
return hIKROBOTTaskSubmit;
}
+
+
+ /// <summary>
+ /// 娴峰悍AGV浠诲姟缁х画鎵ц
+ /// </summary>
+ /// <param name="TaskCode">浠诲姟鍙�</param>
+ /// <returns></returns>
+ public WebResponseContent Hikvisiontaskscontinue(string TaskCode, string Address = null)
+ {
+ WebResponseContent content = new WebResponseContent();
+ HIKROBOTReturn hIKROBOTReturn = null;
+ HIKROBOTTaskContinue hIKROBOTTaskContinue = null;
+ try
+ {
+ // 1. 鍙傛暟楠岃瘉
+ if (string.IsNullOrWhiteSpace(TaskCode))
+ {
+ throw new Exception("浠诲姟缂栫爜涓嶈兘涓虹┖");
+ }
+ Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(HIKROBOTTaskContinue)) ?? throw new Exception("鏈壘鍒版捣搴稟GV缁х画鎵ц鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+ hIKROBOTTaskContinue = new HIKROBOTTaskContinue()
+ {
+ triggerCode = TaskCode,
+ triggerType = "TASK",//鍥哄畾鍊�
+ targetRoute = string.IsNullOrEmpty(Address) ? null :
+ new TargetRouteDto()
+ {
+ code = Address,
+ type = "SITE",
+ }
+ };
+ var headers = new Dictionary<string, string>
+ {
+ { "X-lr-request-id", DateTimeOffset.Now.ToUnixTimeSeconds().ToString()+TaskCode }
+ };
+ string response = HttpHelper.Post(apiInfo.ApiAddress, hIKROBOTTaskContinue.Serialize(), headers: headers);
+ hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
+
+ if (hIKROBOTReturn.code == "SUCCESS")
+ {
+ var data = hIKROBOTReturn.data.ToString().DeserializeObject<HIKROBOTReturnData>();
+ content.OK(data: data);
+ }
+ else
+ {
+ throw new Exception(hIKROBOTReturn.message);
+ }
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ finally
+ {
+ _trackloginfoService.AddTrackLog(hIKROBOTTaskContinue, content, "娴峰悍AGV缁х画鎵ц浠诲姟", "", hIKROBOTReturn.message);
+
+ }
+ return content;
+ }
+
}
}
--
Gitblit v1.9.3