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.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请求焊装特征下发 /// 接口描述: 车身进入BDC时,BDC读取车身上的一维条码向MES请求焊装特征信息 /// public partial class MESService { /// /// BDC请求焊装特征信息 /// /// RFID /// VIN号 /// 站台请求点位 /// public WebResponseContent issuedCharacter(string rfidPrint, string vin, string stationNo) { WebResponseContent content = new WebResponseContent(); try { IssuedCharacterInfo characterInfo = new IssuedCharacterInfo() { plantCode = "1022", rfidPrint = rfidPrint, vin = vin, messageTime = DateTime.Now }; 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.IssuedCharacter)?.ConfigValue; if (wmsBase == null || ipAddress == null) { throw new InvalidOperationException("WMS IP 未配置"); } var wmsIpAddress = wmsBase + ipAddress; var MESrespon = HttpHelper.Post(wmsIpAddress, characterInfo.ToJson()); IssuedCharacterRespon characterRespon = JsonConvert.DeserializeObject(MESrespon); if (!characterRespon.success) { throw new Exception($"{characterRespon}"); } Dt_CarBody CarBody = new Dt_CarBody() { BodyStatus = "", CarType = 1, CreateDate = DateTime.Now, Creater = "system", Description = "", PalletCode = rfidPrint, PVI = characterRespon.rfidPrint }; _carBodyRepository.AddData(CarBody); return content; } catch (Exception ex) { return content.Error($"请求焊装特征信息异常::{ex.Message}"); } } } }