From 6b74e1dcf5642c8f56975471e27780d695953989 Mon Sep 17 00:00:00 2001
From: 陈勇 <竞男@ASUNA>
Date: 星期日, 26 四月 2026 15:48:01 +0800
Subject: [PATCH] 同步代码

---
 项目代码/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/lock.cs |   49 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 43 insertions(+), 6 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/lock.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/lock.cs"
index b765954..485d86f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/lock.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/lock.cs"
@@ -12,30 +12,67 @@
 using WIDESEA_Core;
 using WIDESEA_Core.Const;
 using WIDESEA_Core.Helper;
+using WIDESEA_Model.Models;
 using WIDESEAWCS_BasicInfoService;
 using WIDESEAWCS_Model.Models;
 
 namespace WIDESEA_StoragIntegrationServices
 {
     /// <summary>
-    /// 杞﹁韩缁戝畾宸ュ崟(鐒婅鐩撮�氭秱瑁�)
+    /// 閿佽溅涓婃姤
     /// </summary>
     public partial class MESService
     {
-        public WebResponseContent Lock(object jsondata)
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="carBody">涓婃姤閿佽溅鐨勮溅韬俊鎭�</param>
+        /// <param name="operationType">涓婃姤绫诲瀷锛�1-寮傚父閿佽溅  2-寮傚父鎭㈠</param>
+        /// <returns></returns>
+        public WebResponseContent LockRequest(Dt_CarBodyInfo carBody, int operationType)
         {
             WebResponseContent content = new WebResponseContent();
             try
             {
-               
+                lockInfo lockInfo = new lockInfo()
+                {
+                    unionKey = Guid.NewGuid().ToString(),
+                    plantCode = "1052",
+                    sendStatus = operationType.ToString(),
+                    messageTime = DateTime.Now.ToString(),
+                    insertWorkOrder = "",
 
+                };
+
+                var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_MESIPAddress);
+                var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MESIPAddress)?.ConfigValue;
+                var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.LockRequest)?.ConfigValue;
+                if (wmsBase == null || ipAddress == null)
+                {
+                    throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                }
+                var wmsIpAddress = wmsBase + ipAddress;
+
+                var MESrespon = HttpHelper.PostAsync(wmsIpAddress, lockInfo.ToJson(), contentType, headers).Result;
+
+                Console.WriteLine(MESrespon);
+                WebResponseContent webResponse = JsonConvert.DeserializeObject<WebResponseContent>(MESrespon.ToString());
+                if (webResponse.Code != 200)
+                {
+                    throw new Exception($"{webResponse.msg}");
+                }
+
+                LockInfoRespon characterRespon = JsonConvert.DeserializeObject<LockInfoRespon>(webResponse.Data.ToJson());
+
+                _unitOfWorkManage.BeginTran();
                 LogFactory.GetLog("閿佽溅涓婃姤").Info(true, $"\r\r--------------------------------------");
-                LogFactory.GetLog("閿佽溅涓婃姤").Info(true, jsondata.ToJsonString());
-
-                return content;
+                LogFactory.GetLog("閿佽溅涓婃姤").Info(true, lockInfo.ToJsonString());
+                _unitOfWorkManage.CommitTran();
+                return content.OK();
             }
             catch (Exception ex)
             {
+                LogFactory.GetLog("閿佽溅涓婃姤").Info(true, "涓婃姤寮傚父" + carBody.ToJsonString());
                 return content.Error(ex.Message);
             }
         }

--
Gitblit v1.9.3