From daea1a90c2fa1b5cc2f52e62be15bd95cc4155f6 Mon Sep 17 00:00:00 2001
From: Tiandele <tiandele@hnkhzn.com>
Date: 星期五, 20 三月 2026 17:16:04 +0800
Subject: [PATCH] 优化手动锁车逻辑

---
 项目代码/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/getCharacteristic.cs |   33 +++++++++++++++++++++++----------
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/getCharacteristic.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/getCharacteristic.cs"
index 3897cee..50457a1 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/getCharacteristic.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/getCharacteristic.cs"
@@ -4,6 +4,7 @@
 using System.Collections.Generic;
 using System.IdentityModel.Tokens.Jwt;
 using System.Linq;
+using System.Runtime;
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Common;
@@ -12,6 +13,7 @@
 using WIDESEA_Core;
 using WIDESEA_Core.Const;
 using WIDESEA_Core.Helper;
+using WIDESEA_DTO;
 using WIDESEA_Model.Models;
 
 namespace WIDESEA_StoragIntegrationServices
@@ -28,16 +30,20 @@
         /// <param name="rfidPrint">RFID</param>
         /// <param name="stationNo">绔欏彴璇锋眰鐐逛綅</param>
         /// <returns></returns>
-        public WebResponseContent getCharacteristic(string stationNo, string rfidPrint)
+        public WebResponseContent getCharacteristic(RequestTaskDto json)
         {
             WebResponseContent content = new WebResponseContent();
             try
             {
+                var carBodyInfo = _carBodyRepository.QueryFirst(x => x.RFID == json.PVI);
+
+                //if (carBodyInfo == null) throw new Exception($"鏈壘鍒癙VI{rfid}鐨勮溅韬暟鎹�");
+
                 CarCharacteristicInfo characterInfo = new CarCharacteristicInfo()
                 {
                     plantCode = "1052",
-                    rfidPrint = rfidPrint,
-                    vin = "",
+                    pvi = carBodyInfo.PVI,
+                    //vin = "",
                     messageTime = DateTime.Now.ToString(),
                     unionKey = Guid.NewGuid().ToString(),
                 };
@@ -51,21 +57,28 @@
                 }
                 var wmsIpAddress = wmsBase + ipAddress;
 
-                var MESrespon = HttpHelper.Post(wmsIpAddress, characterInfo.ToJson());
+                var MESrespon = HttpHelper.PostAsync(wmsIpAddress, characterInfo.ToJson(), contentType, headers).Result;
 
-                GetCarCharacteristicInfo characterRespon = JsonConvert.DeserializeObject<GetCarCharacteristicInfo>(MESrespon);
-                if (!characterRespon.success)
+                GetCarCharacteristicInfo characterRespon = JsonConvert.DeserializeObject<GetCarCharacteristicInfo>(MESrespon.ToString());
+                if (characterRespon.code != 200)
                 {
-                    throw new Exception($"{characterRespon}");
+                    throw new Exception($"{characterRespon.msg}");
                 }
 
-                LogFactory.GetLog("BDC璇锋眰杞﹁締鐗瑰緛淇℃伅").Info(true, $"\r\r--------------------------------------");
-                LogFactory.GetLog("BDC璇锋眰杞﹁締鐗瑰緛淇℃伅").Info(true, $"宸ヤ綅鍙�:{stationNo},RFID:{rfidPrint}");
+                if (string.IsNullOrEmpty(characterRespon.data)) throw new Exception("璇锋眰鎴愬姛,浣嗘棤VIN淇℃伅");
 
-                return content;
+                carBodyInfo.VIN = characterRespon.data.ToString().Substring(35, 17);
+                _carBodyRepository.UpdateData(carBodyInfo);
+
+                LogFactory.GetLog("BDC璇锋眰杞﹁締鐗瑰緛淇℃伅").Info(true, $"\r\r--------------------------------------");
+                LogFactory.GetLog("BDC璇锋眰杞﹁締鐗瑰緛淇℃伅").Info(true, $"宸ヤ綅鍙�:{json.Position},RFID:{json.PVI},鍝嶅簲淇℃伅:{characterRespon.ToJson()}");
+
+                return content.OK(data: characterRespon.data);
             }
             catch (Exception ex)
             {
+                LogFactory.GetLog("BDC璇锋眰杞﹁締鐗瑰緛淇℃伅").Info(true, $"\r\r--------------------------------------");
+                LogFactory.GetLog("BDC璇锋眰杞﹁締鐗瑰緛淇℃伅").Info(true, $"宸ヤ綅鍙�:{json.Position},RFID:{json.PVI},閿欒淇℃伅锛歿ex.Message}");
                 return content.Error($"BDC璇锋眰杞﹁締鐗瑰緛淇℃伅锛�:{ex.Message}");
             }
         }

--
Gitblit v1.9.3