| | |
| | | { |
| | | if (!commonStackerCrane.StackerOnline) |
| | | { |
| | | BasicDto dto = new BasicDto |
| | | RequestEqptRunDto request = new RequestEqptRunDto() |
| | | { |
| | | EmployeeNo = "T00001", |
| | | EquipmentCode = commonStackerCrane.DeviceCode, |
| | | RequestTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"), |
| | | SessionId = Guid.NewGuid().ToString(), |
| | | Software = commonStackerCrane.DeviceName, |
| | | Password = "12345", |
| | | EquipmentModel = "1" |
| | | }; |
| | | var respone = await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptRun", dto.ToJsonString()); |
| | | var respone = await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptRun", request.ToJsonString()); |
| | | if (respone != null) |
| | | { |
| | | var result = JsonConvert.DeserializeObject<ResponseEqptRunDto>(respone); |
| | | if (result != null && result.Success) |
| | | { |
| | | var process = _processRepository.QueryData(x => x.EquipmentName == commonStackerCrane.DeviceName).FirstOrDefault(); |
| | | var process = _processRepository.QueryData(x => x.EquipmentName == commonStackerCrane.DeviceCode).FirstOrDefault(); |
| | | if (process == null) |
| | | { |
| | | ResponeRunDto runDto = JsonConvert.DeserializeObject<ResponeRunDto>(respone); |
| | | process = new Dt_EquipmentProcess() |
| | | { |
| | | EquipmentName = commonStackerCrane.DeviceCode, |
| | | EquipmentType = commonStackerCrane.DeviceName.Substring(commonStackerCrane.DeviceCode.IndexOf("堆垛机")), |
| | | EquipmentType = new string(commonStackerCrane.DeviceName.TakeWhile(c => !char.IsDigit(c)).ToArray()), |
| | | WipOrderNo = runDto.WipOrderNo, |
| | | ProductDesc = runDto.ProductDesc, |
| | | ProcessValue = JsonConvert.SerializeObject(result) |
| | |
| | | AlertDescription = commonStackerCrane.StackerCraneStatusDes, |
| | | AlertReset = "0" |
| | | }; |
| | | await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptAlive", requestAlert.ToJsonString()); |
| | | var S= await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptAlive", requestAlert.ToJsonString()); |
| | | WriteInfo("EqptAlive", S); |
| | | } |
| | | RequestEqptStatusDto requestEqptStatus = new RequestEqptStatusDto() |
| | | { |
| | | EmployeeNo = "T00001", |
| | | EquipmentCode = commonStackerCrane.DeviceCode, |
| | | EquipmentCode = "ECH001-B", |
| | | RequestTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"), |
| | | SessionId = Guid.NewGuid().ToString(), |
| | | Software = commonStackerCrane.DeviceName, |
| | | ChangeTime = DateTime.Now.ToString(), |
| | | ChangeTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"), |
| | | Description = commonStackerCrane.StackerCraneStatusDes, |
| | | LocationID = "NA", |
| | | ReasonCode = "123", |
| | | StatusCode = code |
| | | }; |
| | | var respone = await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptStatus", requestEqptStatus.ToJsonString()); |
| | | WriteInfo("EqptStatus", respone); |
| | | } |
| | | } |
| | | } |