更新输送线目标地址和日志记录逻辑
修正多个文件中关于输送线目标地址的设置,
将旧的 `ConveyorLineDBName.ConveyorLineTargetAddress`
替换为新的 `ConveyorLineDBName.WriteConveyorLineTargetAddress`。
优化错误序列号状态判断,新增对状态为 `4` 的过滤。
完善任务号为 `0` 时托盘号不一致的判断,提升代码可读性。
加强 HTTP 请求参数转换逻辑,清理无效代码段。
调整日志记录逻辑,确保异常捕获时信息准确,并修复拼写错误。
扩展 `Dt_TaskService` 类中整盘电芯状态的失败处理,
增加错误状态处理和调试信息输出。
| | |
| | | { |
| | | if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress) |
| | | { |
| | | //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】输送线入库完成,下一目标地址【等待分配货位,并写入1000】"); |
| | | |
| | |
| | | // 打印成功信息,表示托盘已到达指定输送线并完成出库,下一目标地址已确定 |
| | | ConsoleHelper.WriteSuccessLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】输送线出库完成,下一目标地址【{NGAddress}】"); |
| | | // 设置输送线的目标地址为NG地址 |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, NGAddress, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, NGAddress, childDeviceCode); |
| | | // 完成输送线发送 |
| | | ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | // 更新任务状态到下一个状态 |
| | |
| | | |
| | | if (result1.Success) |
| | | { |
| | | var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1).ToList(); |
| | | ConsoleHelper.WriteWarningLine("1"); |
| | | var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); |
| | | if (serialNosError.Count > 0) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, 100, stationManager.stationChildCode); |
| | | ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); |
| | | return; |
| | | } |
| | | |
| | | if (result1.SerialNos.Count <= 0) |
| | | { |
| | | |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, stationManager.stationLocation, stationManager.stationChildCode); |
| | | ConsoleHelper.WriteWarningLine("2"); |
| | | ConsoleHelper.WriteWarningLine(stationManager.stationLocation); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, stationManager.stationLocation, stationManager.stationChildCode); |
| | | |
| | | ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); |
| | | } |
| | | else |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, 1000, stationManager.stationChildCode); |
| | | ConsoleHelper.WriteWarningLine("1000"); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTaskNum, 5, stationManager.stationChildCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, 1000, stationManager.stationChildCode); |
| | | |
| | | ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); |
| | | } |
| | |
| | | { |
| | | if (task.SourceAddress == "1059-4") |
| | | { |
| | | //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{task.TaskNum}】,托盘条码:【{task.PalletCode}】已到达【{childDeviceCode}】请求扫码入库(实盘),下一目标地址【{1000}】"); |
| | | ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | |
| | | var taskNum = commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.TaskNum); |
| | | var taskBarCode = commonStackerCrane.GetValue<StackerCraneDBName, string>(StackerCraneDBName.Barcode); |
| | | ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】堆垛机任务号:【{taskNum}】,堆垛机托盘号:【{taskBarCode}】,任务任务号:【{task.TaskNum}】任务托盘号:【{task.PalletCode}】", ConsoleColor.DarkBlue); |
| | | if (taskNum == 0 && taskBarCode != task.PalletCode) |
| | | if (taskNum == 0 /*&& taskBarCode != task.PalletCode*/) |
| | | { |
| | | ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】任务号为【{0}】,托盘号不一致可以下发任务", ConsoleColor.DarkBlue); |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | |
| | | // 将参数转换为FormUrlEncodedContent |
| | | string content = JsonConvert.SerializeObject(parameters); |
| | | |
| | | //client.Timeout = TimeSpan.from; |
| | | |
| | | var request = new HttpRequestMessage(HttpMethod.Post, url); |
| | | |
| | | request.Content = new StringContent(content, Encoding.UTF8, "application/json"); |
| | |
| | | catch (Exception err) |
| | | { |
| | | Console.WriteLine(err.Message.ToString()); |
| | | LogFactory.GetLog("静置/陈化出库(整托盘)").Error(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("静置/陈化出库(整托盘)").Error(true, err.StackTrace); |
| | | LogFactory.GetLog("静置陈化出库(整托盘)").Error(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("静置陈化出库(整托盘)").Error(true, err.StackTrace); |
| | | content.Error(err.Message); |
| | | } |
| | | return content; |
| | |
| | | var agingOutputDto = MapToAgingOutputDto(stock); |
| | | content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto); |
| | | |
| | | var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString()); |
| | | task.Remark = result.Success ? null : "NG"; |
| | | |
| | | if (!result.Success && result.MessageCode == "E10001") |
| | | if (content.Status) |
| | | { |
| | | await HandleOutBoundError(stock, task); |
| | | var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString()); |
| | | task.Remark = result.Success ? null : "NG"; |
| | | |
| | | if (!result.Success && result.MessageCode == "E10001") |
| | | { |
| | | await HandleOutBoundError(stock, task); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task.Remark = "NG"; |
| | | } |
| | | } |
| | | } |
| | |
| | | // 创建并获取整盘电芯状态 |
| | | TrayCellsStatusDto trayCells = CreateTrayCellsStatusDto(area, input.PalletCode); |
| | | content = await GetTrayCellStatusAsync(trayCells); |
| | | if (!content.Status) return content; |
| | | if (!content.Status) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"获取电芯状态失败:{content.Message}"); |
| | | return content; |
| | | } |
| | | |
| | | var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString()); |
| | | |
| | | if (!result.Success) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"获取电芯状态失败:{result.MOMMessage}"); |
| | | if (result.SerialNos.Count <= 0) |
| | | { |
| | | // 空托盘入库逻辑 |