| | |
| | | using Newtonsoft.Json; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Common.MES; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_StorageBasicRepository; |
| | | |
| | | namespace WIDESEA_StoragIntegrationServices |
| | | { |
| | | public partial class MESService |
| | | { |
| | | public WebResponseContent PassPoint(string stationCode, string rfid) |
| | | /// <summary> |
| | | /// 车身è¿ç¹ |
| | | /// </summary> |
| | | /// <param name="stationCode"></param> |
| | | /// <param name="rfidPrint">æ«äºç»´ç ä¿¡æ¯</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="InvalidOperationException"></exception> |
| | | public WebResponseContent PassPoint(RequestTaskDto json) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | { |
| | | throw new InvalidOperationException("WMS IP æªé
ç½®"); |
| | | } |
| | | var wmsIpAddress = wmsBase + ipAddress; |
| | | var wmsIpAddress = wmsBase + ipAddress; |
| | | |
| | | var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == stationCode); |
| | | var carBodyInfo = _carBodyRepository.QueryFirst(x => x.RFID == json.PVI); |
| | | if (carBodyInfo == null) throw new Exception($"æªæ¾å°PVI{json.PVI}çè½¦èº«æ°æ®"); |
| | | |
| | | //å°ç½è½¦èº«æ´æ°æå½©è½¦èº« |
| | | //carBodyInfo.CarType = 2; |
| | | //_carBodyRepository.UpdateData(carBodyInfo); |
| | | |
| | | var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position); |
| | | if (stationInfo == null) throw new Exception($"请æ±è½¦èº«è¿ç¹å¤±è´¥:ç¹ä½{json.Position}æªæ¾å°"); |
| | | |
| | | PassPointInfo passPoint = new PassPointInfo() |
| | | { |
| | | union_key = Guid.NewGuid().ToString(), |
| | | line_code = stationInfo.stationChildCode, |
| | | message_time = DateTime.Now, |
| | | line_code = stationInfo.stationEquipMES, |
| | | message_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | plant_code = "1052", |
| | | pvi = rfid, |
| | | station_code = stationInfo.stationChildCode, |
| | | pvi = json.PVI, |
| | | station_code = stationInfo.stationEquipMES, |
| | | vin = "", |
| | | pass_time = DateTime.Now |
| | | pass_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") |
| | | }; |
| | | |
| | | var MESrespon = HttpHelper.Post(wmsIpAddress, passPoint.ToJson()); |
| | | var MESrespon = HttpHelper.PostAsync(wmsIpAddress, passPoint.ToJson(), contentType, headers).Result; |
| | | |
| | | WebResponseContent responseContent = JsonConvert.DeserializeObject<WebResponseContent>(MESrespon); |
| | | if (!responseContent.Status) |
| | | MesResponse responseContent = JsonConvert.DeserializeObject<MesResponse>(MESrespon.ToString()); |
| | | if (responseContent.code != 200) |
| | | { |
| | | throw new Exception($"车身è¿ç¹å¼å¸¸ï¼{responseContent.Message}"); |
| | | //if (!responseContent.message.Contains("é夿¥å·¥")) |
| | | throw new Exception($"车身è¿ç¹å¼å¸¸ï¼{responseContent.message}"); |
| | | } |
| | | |
| | | LogFactory.GetLog("车身è¿ç¹").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("车身è¿ç¹").Info(true, $"å·¥ä½å·:{stationCode},RFID:{rfid}"); |
| | | LogFactory.GetLog("车身è¿ç¹").Info(true, $"å·¥ä½å·:{json.Position},RFID:{json.PVI},ååºä¿¡æ¯:{responseContent.ToJson}"); |
| | | |
| | | return content; |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog("车身è¿ç¹").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("车身è¿ç¹").Info(true, $"å·¥ä½å·:{json.Position},RFID:{json.PVI},å¼å¸¸ä¿¡æ¯:{ex.Message}"); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |