From f2b85c65234e0dcdd3fcce4dafbe16933b7f1b48 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期日, 30 十一月 2025 04:22:51 +0800
Subject: [PATCH] 出入库流程代码更新
---
项目代码/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
index 0b7f032..e0e1303 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
@@ -1,4 +1,6 @@
锘縰sing Autofac.Core;
+using Newtonsoft.Json.Serialization;
+using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -15,19 +17,24 @@
{
public partial class TaskService
{
+ // 鍒涘缓涓�涓娇鐢ㄥ皬椹煎嘲鍛藉悕娉曠殑搴忓垪鍖栬缃�
+ JsonSerializerSettings settings = new JsonSerializerSettings
+ {
+ ContractResolver = new CamelCasePropertyNamesContractResolver()
+ };
public WebResponseContent AgvSendTask(AgvTaskSendDTO taskModel, APIEnum SendTask = APIEnum.AgvSendTask)
{
WebResponseContent content = new WebResponseContent();
try
{
- string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == SendTask.ToString())?.ApiAddress;
- if (string.IsNullOrEmpty(apiAddress))
- return WebResponseContent.Instance.Error($"鏈壘鍒板彂閫丄GV浠诲姟鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�");
- string response = HttpHelper.Post(apiAddress, taskModel.Serialize());
- AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>();
- if (agvContent.Code == "0")
+ string? apiAddress = _apiInfoRepository.QueryFirst(x => x.ApiCode == SendTask.ToString())?.ApiAddress;
+ if (string.IsNullOrEmpty(apiAddress)) throw new Exception($"鏈壘鍒板彂閫丄GV浠诲姟鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�");
+ string request = JsonConvert.SerializeObject(taskModel, settings);
+ string response = HttpHelper.Post(apiAddress, request);
+ AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>() ?? throw new Exception("AGV浠诲姟鍙戦�佹湭杩斿洖缁撴灉");
+ if (agvContent.Success)
{
- content.OK(data: agvContent.Data);
+ content.OK();
}
else
{
--
Gitblit v1.9.3