From 1181f9f764b14abd6e9f598f89f8507b4bbfad0d Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 09 三月 2026 09:47:10 +0800
Subject: [PATCH] 设置登录默认值;添加数据传输对象;更新服务器作业

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs |   47 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs
index 4b08204..a5fe893 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs
@@ -10,6 +10,8 @@
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Logging;
 using Newtonsoft.Json;
+using WIDESEAWCS_Common;
+using WIDESEAWCS_Common.HttpEnum;
 using WIDESEAWCS_Core.Caches;
 
 namespace WIDESEA_Core
@@ -23,6 +25,20 @@
         {
             _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
             _cache = cache ?? throw new ArgumentNullException(nameof(cache));
+
+
+
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.CreateTaskInboundAsync)}", $"Task/CreateTaskInbound");
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.GetTasksLocation)}", $"Task/GetTasksLocation");
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.OutboundFinishTaskAsync)}", $"Task/OutboundFinishTask");
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.InboundFinishTaskAsync)}", $"Task/InboundFinishTask");
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.GetOutBoundTrayTaskAsync)}", $"Task/GetOutBoundTrayTask");
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.CreateTaskInboundTrayAsync)}", $"Task/CreateTaskInboundTray");
+
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.GroupPalletAsync)}", $"Stock/GroupPalletAsync");
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.ChangePalletAsync)}", $"Stock/ChangePalletAsync");
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.SplitPalletAsync)}", $"Stock/SplitPalletAsync");
+            _cache.TryAdd($"{RedisPrefix.Code}:{RedisName.API}:{nameof(ConfigKey.UpdateTaskByStatus)}", $"Task/UpdateTaskByStatus");
         }
 
         /// <summary>
@@ -35,26 +51,31 @@
         /// <returns></returns>
         public HttpResponseResult Post(string url, string content, string contentType = "application/json", HttpRequestConfig? config = null)
         {
-            url = _cache.Get(url);
-            HttpResponseResult httpResponseResult = ExecuteAsync(async (client) =>
+            HttpResponseResult httpResponseResult = Task.Run(async () =>
             {
-                var request = new HttpRequestMessage(HttpMethod.Post, url);
-                request.Content = new StringContent(content ?? string.Empty, Encoding.UTF8, contentType);
-                SetRequestHeaders(request, config?.Headers);
-                return await client.SendAsync(request);
-            }, config, $"POST {url}").Result;
+                return await ExecuteAsync(async (client) =>
+                {
+                    var request = new HttpRequestMessage(HttpMethod.Post, url);
+                    request.Content = new StringContent(content ?? string.Empty, Encoding.UTF8, contentType);
+                    SetRequestHeaders(request, config?.Headers);
+                    return await client.SendAsync(request);
+                }, config, $"POST {url}");
+            }).GetAwaiter().GetResult();
             httpResponseResult.ApiUrl = url;
             return httpResponseResult;
         }
 
         public HttpResponseResult Get(string url, HttpRequestConfig? config = null)
         {
-            HttpResponseResult httpResponseResult = ExecuteAsync(async (client) =>
+            HttpResponseResult httpResponseResult = Task.Run(async () =>
             {
-                var request = new HttpRequestMessage(HttpMethod.Get, url);
-                SetRequestHeaders(request, config?.Headers);
-                return await client.SendAsync(request);
-            }, config, $"GET {url}").Result;
+                return await ExecuteAsync(async (client) =>
+                {
+                    var request = new HttpRequestMessage(HttpMethod.Get, url);
+                    SetRequestHeaders(request, config?.Headers);
+                    return await client.SendAsync(request);
+                }, config, $"GET {url}");
+            }).GetAwaiter().GetResult();
 
             httpResponseResult.ApiUrl = url;
             return httpResponseResult;
@@ -72,6 +93,7 @@
         public HttpResponseResult<TResponse> Post<TResponse>(string url, string content, string contentType = "application/json", HttpRequestConfig? config = null)
         {
 
+            url = BaseAPI.WMSBaseUrl + _cache.Get($"{RedisPrefix.Code}:{RedisName.API}:{url}");
             HttpResponseResult httpResponseResult = Post(url, content, contentType, config);
 
             HttpResponseResult<TResponse> result = new HttpResponseResult<TResponse>
@@ -113,6 +135,7 @@
 
         public HttpResponseResult<TResponse> Get<TResponse>(string url, HttpRequestConfig? config = null)
         {
+            url = BaseAPI.WMSBaseUrl + _cache.Get(url);
             HttpResponseResult httpResponseResult = Get(url, config);
 
             HttpResponseResult<TResponse> result = new HttpResponseResult<TResponse>

--
Gitblit v1.9.3