| | |
| | | using System.Collections.Generic; |
| | | using System.IdentityModel.Tokens.Jwt; |
| | | using System.Linq; |
| | | using System.Runtime; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common; |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_StoragIntegrationServices |
| | |
| | | /// <param name="rfidPrint">RFID</param> |
| | | /// <param name="stationNo">ç«å°è¯·æ±ç¹ä½</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent getCharacteristic(string stationNo, string rfidPrint) |
| | | public WebResponseContent getCharacteristic(RequestTaskDto json) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var carBodyInfo = _carBodyRepository.QueryFirst(x => x.RFID == json.PVI); |
| | | |
| | | //if (carBodyInfo == null) throw new Exception($"æªæ¾å°PVI{rfid}çè½¦èº«æ°æ®"); |
| | | |
| | | CarCharacteristicInfo characterInfo = new CarCharacteristicInfo() |
| | | { |
| | | plantCode = "1052", |
| | | rfidPrint = rfidPrint, |
| | | vin = "", |
| | | pvi = carBodyInfo.PVI, |
| | | //vin = "", |
| | | messageTime = DateTime.Now.ToString(), |
| | | unionKey = Guid.NewGuid().ToString(), |
| | | }; |
| | |
| | | } |
| | | var wmsIpAddress = wmsBase + ipAddress; |
| | | |
| | | var MESrespon = HttpHelper.Post(wmsIpAddress, characterInfo.ToJson()); |
| | | var MESrespon = HttpHelper.PostAsync(wmsIpAddress, characterInfo.ToJson(), contentType, headers).Result; |
| | | |
| | | GetCarCharacteristicInfo characterRespon = JsonConvert.DeserializeObject<GetCarCharacteristicInfo>(MESrespon); |
| | | if (!characterRespon.success) |
| | | GetCarCharacteristicInfo characterRespon = JsonConvert.DeserializeObject<GetCarCharacteristicInfo>(MESrespon.ToString()); |
| | | if (characterRespon.code != 200) |
| | | { |
| | | throw new Exception($"{characterRespon}"); |
| | | throw new Exception($"{characterRespon.msg}"); |
| | | } |
| | | |
| | | LogFactory.GetLog("BDC请æ±è½¦è¾ç¹å¾ä¿¡æ¯").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("BDC请æ±è½¦è¾ç¹å¾ä¿¡æ¯").Info(true, $"å·¥ä½å·:{stationNo},RFID:{rfidPrint}"); |
| | | if (string.IsNullOrEmpty(characterRespon.data)) throw new Exception("è¯·æ±æå,使 VINä¿¡æ¯"); |
| | | |
| | | return content; |
| | | carBodyInfo.VIN = characterRespon.data.ToString().Substring(35, 17); |
| | | _carBodyRepository.UpdateData(carBodyInfo); |
| | | |
| | | LogFactory.GetLog("BDC请æ±è½¦è¾ç¹å¾ä¿¡æ¯").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("BDC请æ±è½¦è¾ç¹å¾ä¿¡æ¯").Info(true, $"å·¥ä½å·:{json.Position},RFID:{json.PVI},ååºä¿¡æ¯:{characterRespon.ToJson()}"); |
| | | |
| | | return content.OK(data: characterRespon.data); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogFactory.GetLog("BDC请æ±è½¦è¾ç¹å¾ä¿¡æ¯").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("BDC请æ±è½¦è¾ç¹å¾ä¿¡æ¯").Info(true, $"å·¥ä½å·:{json.Position},RFID:{json.PVI},é误信æ¯ï¼{ex.Message}"); |
| | | return content.Error($"BDC请æ±è½¦è¾ç¹å¾ä¿¡æ¯ï¼:{ex.Message}"); |
| | | } |
| | | } |