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/PassPoint.cs |   47 ++++++++++++++++++++++++++++++++++-------------
 1 files changed, 34 insertions(+), 13 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/PassPoint.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/PassPoint.cs"
index 5e820ad..f116670 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/PassPoint.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/PassPoint.cs"
@@ -1,14 +1,24 @@
 锘縰sing Newtonsoft.Json;
 using WIDESEA_Common;
+using WIDESEA_Common.MES;
 using WIDESEA_Core;
 using WIDESEA_Core.Const;
 using WIDESEA_Core.Helper;
+using WIDESEA_DTO;
+using WIDESEA_StorageBasicRepository;
 
 namespace WIDESEA_StoragIntegrationServices
 {
     public partial class MESService
     {
-        public WebResponseContent PassPoint(string stationCode, string rfid)
+        /// <summary>
+        /// 杞﹁韩杩囩偣
+        /// </summary>
+        /// <param name="stationCode"></param>
+        /// <param name="rfidPrint">鎵簩缁寸爜淇℃伅</param>
+        /// <returns></returns>
+        /// <exception cref="InvalidOperationException"></exception>
+        public WebResponseContent PassPoint(RequestTaskDto json)
         {
             WebResponseContent content = new WebResponseContent();
             try
@@ -22,35 +32,46 @@
                 }
                 var wmsIpAddress = wmsBase + ipAddress;
 
-                var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == stationCode);
+                var carBodyInfo = _carBodyRepository.QueryFirst(x => x.RFID == json.PVI);
+                if (carBodyInfo == null) throw new Exception($"鏈壘鍒癙VI{json.PVI}鐨勮溅韬暟鎹�");
+
+                //灏嗙櫧杞﹁韩鏇存柊鎴愬僵杞﹁韩
+                //carBodyInfo.CarType = 2;
+                //_carBodyRepository.UpdateData(carBodyInfo);
+
+                var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position);
+                if (stationInfo == null) throw new Exception($"璇锋眰杞﹁韩杩囩偣澶辫触:鐐逛綅{json.Position}鏈壘鍒�");
 
                 PassPointInfo passPoint = new PassPointInfo()
                 {
                     union_key = Guid.NewGuid().ToString(),
-                    line_code = stationInfo.stationChildCode,
-                    message_time = DateTime.Now,
+                    line_code = stationInfo.stationEquipMES, 
+                    message_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                     plant_code = "1052",
-                    pvi = rfid,
-                    station_code = stationInfo.stationChildCode,
+                    pvi = json.PVI,
+                    station_code = stationInfo.stationEquipMES,
                     vin = "",
-                    pass_time = DateTime.Now
+                    pass_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                 };
 
-                var MESrespon = HttpHelper.Post(wmsIpAddress, passPoint.ToJson());
+                var MESrespon = HttpHelper.PostAsync(wmsIpAddress, passPoint.ToJson(), contentType, headers).Result;
 
-                WebResponseContent responseContent = JsonConvert.DeserializeObject<WebResponseContent>(MESrespon);
-                if (!responseContent.Status)
+                MesResponse responseContent = JsonConvert.DeserializeObject<MesResponse>(MESrespon.ToString());
+                if (responseContent.code != 200)
                 {
-                    throw new Exception($"杞﹁韩杩囩偣寮傚父锛歿responseContent.Message}");
+                    //if (!responseContent.message.Contains("閲嶅鎶ュ伐"))
+                    throw new Exception($"杞﹁韩杩囩偣寮傚父锛歿responseContent.message}");
                 }
 
                 LogFactory.GetLog("杞﹁韩杩囩偣").Info(true, $"\r\r--------------------------------------");
-                LogFactory.GetLog("杞﹁韩杩囩偣").Info(true, $"宸ヤ綅鍙�:{stationCode},RFID:{rfid}");
+                LogFactory.GetLog("杞﹁韩杩囩偣").Info(true, $"宸ヤ綅鍙�:{json.Position},RFID:{json.PVI},鍝嶅簲淇℃伅:{responseContent.ToJson}");
 
-                return content;
+                return content.OK();
             }
             catch (Exception ex)
             {
+                LogFactory.GetLog("杞﹁韩杩囩偣").Info(true, $"\r\r--------------------------------------");
+                LogFactory.GetLog("杞﹁韩杩囩偣").Info(true, $"宸ヤ綅鍙�:{json.Position},RFID:{json.PVI},寮傚父淇℃伅:{ex.Message}");
                 return content.Error(ex.Message);
             }
         }

--
Gitblit v1.9.3