优化异常处理和日志记录功能
在 `CommonConveyorLine_After.cs` 中,更新了异常消息以提供更具体的信息。在 `CommonStackerCraneJob.cs` 中,调整了设备类型以确保代码的正确性。此外,在 `CellStateService.cs` 中添加了日志记录功能,增强了调试和监控能力,同时改进了日志信息的结构化,提升了代码的可读性和可维护性。
| | |
| | | |
| | | if (devicePro == null) |
| | | { |
| | | throw new Exception("未找到协议信息"); |
| | | throw new Exception($"{deviceChildCode}未找到协议信息"); |
| | | } |
| | | else |
| | | { |
| | |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device; |
| | | CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device; |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(1815), stationinfo.stationChildCode); |
| | | Thread.Sleep(100); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode); |
| | |
| | | } |
| | | var wmsIpAddress = wmsBase + ipAddress; |
| | | |
| | | LogFactory.GetLog("整盘电芯属性获取").Info(true, $"请求数据:{JsonConvert.SerializeObject(inputJson)}"); |
| | | |
| | | var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result; |
| | | |
| | | var respone = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(result.ToString()); |
| | |
| | | MoMErrorMsg.DeleteMoMErrorMsg(0, input.TrayBarcode); |
| | | } |
| | | |
| | | |
| | | LogFactory.GetLog("整盘电芯属性获取").Info(true,$"返回参数:{result}" ); |
| | | LogFactory.GetLog("整盘电芯属性获取").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("整盘电芯属性获取").Info(true, result); |
| | | content.OK(data: result); |
| | | } |
| | | catch (Exception err) |