using Newtonsoft.Json; using WIDESEA_Common; using WIDESEA_Core; using WIDESEA_Core.Const; using WIDESEA_Core.Helper; namespace WIDESEA_StoragIntegrationServices { public partial class MESService { public WebResponseContent PassPoint(string stationCode, string rfid) { 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.AVIPASS)?.ConfigValue; if (wmsBase == null || ipAddress == null) { throw new InvalidOperationException("WMS IP 未配置"); } var wmsIpAddress = wmsBase + ipAddress; var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == stationCode); PassPointInfo passPoint = new PassPointInfo() { union_key = Guid.NewGuid().ToString(), line_code = stationInfo.stationChildCode, message_time = DateTime.Now, plant_code = "1052", pvi = rfid, station_code = stationInfo.stationChildCode, vin = "", pass_time = DateTime.Now }; var MESrespon = HttpHelper.Post(wmsIpAddress, passPoint.ToJson()); WebResponseContent responseContent = JsonConvert.DeserializeObject(MESrespon); if (!responseContent.Status) { throw new Exception($"车身过点异常:{responseContent.Message}"); } LogFactory.GetLog("车身过点").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("车身过点").Info(true, $"工位号:{stationCode},RFID:{rfid}"); return content; } catch (Exception ex) { return content.Error(ex.Message); } } } }