Tiandele
2026-03-20 daea1a90c2fa1b5cc2f52e62be15bd95cc4155f6
ÏîÄ¿´úÂë/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($"未找到PVI{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.PostAsync(wmsIpAddress, characterInfo.ToJson()).Result;
                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}");
            }
        }