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 |   43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 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 008f2a5..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,6 +12,7 @@
 using WIDESEA_Core;
 using WIDESEA_Core.Const;
 using WIDESEA_Core.Helper;
+using WIDESEA_Model.Models;
 using WIDESEAWCS_BasicInfoService;
 using WIDESEAWCS_Model.Models;
 
@@ -22,34 +23,37 @@
     /// </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.bindWorkOrder)?.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 carBodyInfo = _carBodyRepository.QueryFirst(x => x.RFID == "");
-
-                if (carBodyInfo == null) throw new Exception($"鏈壘鍒癙VI鐨勮溅韬暟鎹�");
-
-                BindWorkOrder bindOrder = new BindWorkOrder()
-                {
-                    unionKey = Guid.NewGuid().ToString(),
-                    stationCode = "",
-                    messageTime = DateTime.Now.ToString(),
-                    plantCode = "1052",
-                    pvi = carBodyInfo.PVI,
-                };
-
-                var MESrespon = HttpHelper.PostAsync(wmsIpAddress, bindOrder.ToJson(), contentType, headers).Result;
+                var MESrespon = HttpHelper.PostAsync(wmsIpAddress, lockInfo.ToJson(), contentType, headers).Result;
 
                 Console.WriteLine(MESrespon);
                 WebResponseContent webResponse = JsonConvert.DeserializeObject<WebResponseContent>(MESrespon.ToString());
@@ -58,18 +62,17 @@
                     throw new Exception($"{webResponse.msg}");
                 }
 
-                BindWorkOrderRespon characterRespon = JsonConvert.DeserializeObject<BindWorkOrderRespon>(webResponse.Data.ToJson());
+                LockInfoRespon characterRespon = JsonConvert.DeserializeObject<LockInfoRespon>(webResponse.Data.ToJson());
 
                 _unitOfWorkManage.BeginTran();
-
                 LogFactory.GetLog("閿佽溅涓婃姤").Info(true, $"\r\r--------------------------------------");
-                LogFactory.GetLog("閿佽溅涓婃姤").Info(true, jsondata.ToJsonString());
-
+                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