From 1924bdeca6414b6fec314c37260b44f20865d593 Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期四, 22 一月 2026 20:49:05 +0800
Subject: [PATCH] 代码同步,接口更新

---
 项目代码/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/bindWorkOrder.cs |   42 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 7 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/bindWorkOrder.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/bindWorkOrder.cs"
index 4ea73ba..02c8b11 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/bindWorkOrder.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/bindWorkOrder.cs"
@@ -1,10 +1,13 @@
 锘縰sing AngleSharp.Common;
+using Newtonsoft.Json;
+using OfficeOpenXml.ConditionalFormatting;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Common;
+using WIDESEA_Common.MES;
 using WIDESEA_Common.MES.Request;
 using WIDESEA_Core;
 using WIDESEA_Core.Const;
@@ -21,9 +24,10 @@
     {
         public WebResponseContent bindWorkOrder(string stationNo, string rfid)
         {
-            WebResponseContent content = new WebResponseContent();  
+            WebResponseContent content = new WebResponseContent();
             try
             {
+
                 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;
@@ -35,24 +39,48 @@
 
                 var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == stationNo);
 
+                var carBodyInfo = _carBodyRepository.QueryFirst(x => x.PVI == rfid);
+
+                if (carBodyInfo == null) throw new Exception($"鏈壘鍒癙VI{rfid}鐨勮溅韬暟鎹�");
+
                 BindWorkOrder passPoint = new BindWorkOrder()
                 {
                     unionKey = Guid.NewGuid().ToString(),
-                    stationCode = stationInfo.stationChildCode,
+                    stationCode = "",
                     messageTime = DateTime.Now.ToString(),
-                    plantCode = "1022",
+                    plantCode = "1052",
                     pvi = rfid,
-                    workOrderNo = "",
-                    workOrderType = "",
+                    workOrderNo = carBodyInfo.workOrderNo,
+                    workOrderType = carBodyInfo.workOrderType,
                     workshopCode = ""
                 };
 
-                var MESrespon = HttpHelper.Post(wmsIpAddress, passPoint.ToJson());
+                var MESrespon = HttpHelper.PostAsync(wmsIpAddress, passPoint.ToJson(), contentType, headers).Result;
 
-                return content;
+                Console.WriteLine(MESrespon);
+                WebResponseContent webResponse = JsonConvert.DeserializeObject<WebResponseContent>(MESrespon.ToString());
+                if (webResponse.Code != 200)
+                {
+                    throw new Exception($"{webResponse.msg}");
+                }
+
+                BindWorkOrderRespon characterRespon = JsonConvert.DeserializeObject<BindWorkOrderRespon>(webResponse.Data.ToJson());
+                var paintingOrderInfo = _paintingOrderInfoRepository.QueryFirst(x => x.workOrderNo == characterRespon.workOrderNo);
+
+                if (paintingOrderInfo == null) throw new Exception($"缁戝畾澶辫触:鏈壘鍒版秱瑁呭伐鍗曚俊鎭瘂characterRespon.workOrderNo}");
+
+                paintingOrderInfo.pvi = characterRespon.pvi;
+                _paintingOrderInfoRepository.UpdateData(paintingOrderInfo);
+
+
+                LogFactory.GetLog("BDC璇锋眰缁戝畾宸ュ崟淇℃伅").Info(true, $"\r\r--------------------------------------");
+                LogFactory.GetLog("BDC璇锋眰缁戝畾宸ュ崟淇℃伅").Info(true, $"宸ヤ綅鍙�:{stationNo},RFID:{rfid}");
+
+                return content.OK();
             }
             catch (Exception ex)
             {
+                LogFactory.GetLog("BDC璇锋眰缁戝畾宸ュ崟淇℃伅").Info(true, $"缁戝畾澶辫触锛歿ex.Message}");
                 return content.Error(ex.Message);
             }
         }

--
Gitblit v1.9.3