From 5336bfc54525253a30f1f8238806d3a67f388e14 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 21 十一月 2025 15:12:03 +0800
Subject: [PATCH] 优化接口,增加字段等
---
项目代码/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
index 70ebbef..c9d6b61 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
@@ -2,7 +2,9 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Text;
+using System.Text.RegularExpressions;
using WIDESEA_DTO.Agv;
+using WIDESEA_External.Model;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Enums;
@@ -70,7 +72,7 @@
}
else//鍑哄簱鏀捐揣璇锋眰
{
- var content = PutRequest(task.NextAddress, task.PalletType);
+ var content = PutRequest(task.NextAddress, task);
if (!content.Status)
{
throw new Exception(content.Message);
@@ -89,7 +91,7 @@
}
else//鍏ュ簱鏀捐揣璇锋眰
{
- var content = PutRequest(task.NextAddress, task.TaskNum);
+ var content = PutRequest(task.NextAddress, task);
if (!content.Status)
{
throw new Exception(content.Message);
@@ -312,7 +314,7 @@
/// <param name="palletType"></param>
/// <returns></returns>
[HttpPost, HttpGet, Route("PutRequest"), AllowAnonymous]
- public WebResponseContent PutRequest(string code, int taskNum)
+ public WebResponseContent PutRequest(string code, Dt_Task task)
{
WebResponseContent content = new WebResponseContent();
try
@@ -330,14 +332,20 @@
{
SD_WorkCentreAgvArriveNoticeInfo=new List<AgvArriveNotice> { new AgvArriveNotice()
{
- DispatchPlanMaterialId=409,
- WorkCentreCode="66",
- LocationCode="3-ZD-ZJZZ",
- CallId="4534c242-27a7-4fb6-86f5-460b09db303d"
+ DispatchPlanMaterialId=task.DispatchPlanId,
+ WorkCentreCode=task.WorkCentreCode,
+ LocationCode=code,
+ CallId=Guid.NewGuid().ToString().Replace("-","")
} }
};
- WebResponseContent webResponse= _taskService.MESAvgArriveNotice(requestAGVArriveDTO);
- if (webResponse.Message.Contains("\"obj\": true"))
+ MESResponse response = _taskService.MESAvgArriveNotice(requestAGVArriveDTO).DeserializeObject<MESResponse>() ?? throw new Exception("鏈幏鍙栧埌杩斿洖淇℃伅");
+ if (!response.Result)
+ {
+ throw new Exception($"璋冪敤MES灏忚溅鍏佽鏀捐揣鎶ラ敊,MES杩斿洖淇℃伅"+ Regex.Replace(response.Msg, @"\\u([0-9a-fA-F]{4})", match => {
+ return ((char)Convert.ToInt32(match.Groups[1].Value, 16)).ToString();
+ }));
+ }
+ if (response.Obj)
{
return content.Error($"鍏佽鍙栨枡");
}
@@ -389,7 +397,7 @@
bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode);
if (!RequestPut)
{
- otherDevice.SetValue(CoveryorDB.C_InTaskNum, taskNum, stationManger.StationDeviceCode);
+ otherDevice.SetValue(CoveryorDB.C_InTaskNum, task.TaskNum, stationManger.StationDeviceCode);
otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode);
Thread.Sleep(1000);
}
--
Gitblit v1.9.3