From c1aabd3aaa92b072591fc368d81ab2cc37a0aa14 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 27 三月 2026 17:33:25 +0800
Subject: [PATCH] 路由变更

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MesService.cs |   77 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MesService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MesService.cs
new file mode 100644
index 0000000..79bd0bd
--- /dev/null
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/MesService.cs
@@ -0,0 +1,77 @@
+using Newtonsoft.Json;
+using System.Collections.Generic;
+using WIDESEA_Core;
+using WIDESEA_Core.Helper;
+using WIDESEA_IBasicService;
+using WIDESEA_DTO.MES;
+
+namespace WIDESEA_BasicService
+{
+    /// <summary>
+    /// MES鏈嶅姟瀹炵幇 - 闄曡タ椤峰埢鑳芥簮绉戞妧MES绯荤粺瀵规帴
+    /// </summary>
+    public class MesService : IMesService
+    {
+        private readonly HttpClientHelper _httpClient;
+        private readonly string _baseUrl;
+        private readonly string _authorization;
+
+        private const string BindContainerPath = "/EquipmentService/api/v1/BindContainer";
+        private const string UnBindContainerPath = "/EquipmentService/api/v1/UnBindContainer";
+        private const string ContainerNgReportPath = "/EquipmentService/api/v1/ContainerNgReport";
+        private const string InboundInContainerPath = "/EquipmentService/api/v1/InboundInContainer";
+        private const string OutboundInContainerPath = "/EquipmentService/api/v1/OutboundInContainer";
+
+        public MesService(HttpClientHelper httpClient)
+        {
+            _httpClient = httpClient;
+            _baseUrl = AppSettings.Get("MES:BaseUrl").TrimEnd('/');
+            _authorization = AppSettings.Get("MES:Authorization");
+        }
+
+        private HttpRequestConfig BuildConfig()
+        {
+            return new HttpRequestConfig
+            {
+                Headers = new Dictionary<string, string>
+                {
+                    { "Authorization", _authorization }
+                },
+                TimeoutMs = 30000,
+                MaxRetryCount = 0,
+                EnableLogging = true
+            };
+        }
+
+        private HttpResponseResult<MesResponse> Post<T>(string url, T request)
+        {
+            string json = JsonConvert.SerializeObject(request);
+            return _httpClient.Post<MesResponse>(url, json, "application/json", BuildConfig());
+        }
+
+        public HttpResponseResult<MesResponse> BindContainer(BindContainerRequest request)
+        {
+            return Post(_baseUrl + BindContainerPath, request);
+        }
+
+        public HttpResponseResult<MesResponse> UnBindContainer(UnBindContainerRequest request)
+        {
+            return Post(_baseUrl + UnBindContainerPath, request);
+        }
+
+        public HttpResponseResult<MesResponse> ContainerNgReport(ContainerNgReportRequest request)
+        {
+            return Post(_baseUrl + ContainerNgReportPath, request);
+        }
+
+        public HttpResponseResult<MesResponse> InboundInContainer(InboundInContainerRequest request)
+        {
+            return Post(_baseUrl + InboundInContainerPath, request);
+        }
+
+        public HttpResponseResult<MesResponse> OutboundInContainer(OutboundInContainerRequest request)
+        {
+            return Post(_baseUrl + OutboundInContainerPath, request);
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3