| | |
| | | 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; |
| | | if (wmsBase == null || ipAddress == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP æªé
ç½®"); |
| | | } |
| | | var wmsIpAddress = wmsBase + ipAddress; |
| | | |
| | | var carBodyInfo = _carBodyRepository.QueryFirst(x => x.RFID == ""); |
| | | |
| | | if (carBodyInfo == null) throw new Exception($"æªæ¾å°PVIçè½¦èº«æ°æ®"); |
| | | |
| | | BindWorkOrder bindOrder = new BindWorkOrder() |
| | | { |
| | | unionKey = Guid.NewGuid().ToString(), |
| | | stationCode = "", |
| | | messageTime = DateTime.Now.ToString(), |
| | | plantCode = "1052", |
| | | pvi = carBodyInfo.PVI, |
| | | }; |
| | | |
| | | var MESrespon = HttpHelper.PostAsync(wmsIpAddress, bindOrder.ToJson(), contentType, headers).Result; |
| | | |
| | | 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()); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | LogFactory.GetLog("éè½¦ä¸æ¥").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("éè½¦ä¸æ¥").Info(true, jsondata.ToJsonString()); |
| | | |
| | | return content; |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |