using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; 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; using WIDESEA_Core.Helper; using WIDESEA_Model.Models; namespace WIDESEA_StoragIntegrationServices { /// /// BDC向MES请求车辆特征信息 /// 接口描述: BDC在PBS01前一个工位通过(PVI+白车身后4位)向MES请求VIN+车辆特征信息写入tag /// public partial class MESService { /// /// BDC请求车辆特征信息 /// /// RFID /// 站台请求点位 /// public WebResponseContent getCharacteristic(string stationNo, string rfidPrint) { WebResponseContent content = new WebResponseContent(); try { CarCharacteristicInfo characterInfo = new CarCharacteristicInfo() { plantCode = "1052", rfidPrint = rfidPrint, vin = "", messageTime = DateTime.Now.ToString(), unionKey = Guid.NewGuid().ToString(), }; 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.getCharacteristic)?.ConfigValue; if (wmsBase == null || ipAddress == null) { throw new InvalidOperationException("WMS IP 未配置"); } var wmsIpAddress = wmsBase + ipAddress; var MESrespon = HttpHelper.PostAsync(wmsIpAddress, characterInfo.ToJson()).Result; GetCarCharacteristicInfo characterRespon = JsonConvert.DeserializeObject(MESrespon); if (!characterRespon.success) { throw new Exception($"{characterRespon}"); } LogFactory.GetLog("BDC请求车辆特征信息").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("BDC请求车辆特征信息").Info(true, $"工位号:{stationNo},RFID:{rfidPrint}"); return content; } catch (Exception ex) { return content.Error($"BDC请求车辆特征信息::{ex.Message}"); } } } }