| | |
| | | using HslCommunication; |
| | | using HslCommunication.Profinet.OpenProtocol; |
| | | using Mapster; |
| | | using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; |
| | | using Microsoft.CodeAnalysis; |
| | |
| | | var Traycontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode); |
| | | if (Traycontent.Status) |
| | | { |
| | | ConsoleHelper.WriteSuccessLine("请求回流静置"); |
| | | ConsoleHelper.WriteSuccessLine("二封空框请求回流"); |
| | | ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | } |
| | | } |
| | |
| | | ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | } |
| | | } |
| | | #region |
| | | |
| | | //if (Taskcontent.Status) |
| | | //{ |
| | | // var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode); |
| | | // if (task != null) |
| | | // { |
| | | // var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue; |
| | | // var valueList = value.Split(',').ToList(); |
| | | // if (valueList.Contains(task.SourceAddress)) |
| | | // { |
| | | // conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | |
| | | // var log = $"【{conveyorLine._deviceName}】任务号:【{task.TaskNum}】,托盘条码:【{task.PalletCode}】已到达【{childDeviceCode}】请求扫码入库(实盘),下一目标地址【{1000}】"; |
| | | // ConsoleHelper.WriteWarningLine(log); |
| | | |
| | | // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); |
| | | // WriteInfo(conveyorLine.DeviceName, log); |
| | | |
| | | // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | // } |
| | | // else if (task.TargetAddress == "1020-1") |
| | | // { |
| | | // var next = task.NextAddress; |
| | | // var taskCommand = MapTaskCommand(task, command); |
| | | // task.NextAddress = next; |
| | | |
| | | // var log = $"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】请求扫码入库(实盘),下一目标地址【{taskCommand.TargetAddress}】"; |
| | | // ConsoleHelper.WriteWarningLine(log); |
| | | |
| | | // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); |
| | | // WriteInfo(conveyorLine.DeviceName, log); |
| | | |
| | | // conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | |
| | | // var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | // _task_HtyRepository.AddData(taskHty); |
| | | // _taskService.DeleteData(task); |
| | | // } |
| | | // else |
| | | // { |
| | | // var next = task.NextAddress; |
| | | // var taskCommand = MapTaskCommand(task, command); |
| | | // task.NextAddress = next; |
| | | |
| | | // var log = $"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】请求扫码入库(实盘),下一目标地址【{taskCommand.TargetAddress}】"; |
| | | // ConsoleHelper.WriteWarningLine(log); |
| | | |
| | | // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); |
| | | // WriteInfo(conveyorLine.DeviceName, log); |
| | | |
| | | // conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | // _taskService.UpdateTaskStatusToNext(task); |
| | | // } |
| | | // } |
| | | //} |
| | | //else |
| | | // WriteInfo(conveyorLine.DeviceName, content.Message); |
| | | |
| | | #endregion |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="InvalidOperationException"></exception> |
| | | private async Task JZRequestInBound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue, Dt_StationManager stationManager) |
| | | { |
| | | try |
| | | { |
| | | StaticVariable.isLineRun = false; |
| | | |
| | | if (StaticVariable.isStackerRun) |
| | | { |
| | | ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | return; |
| | | } |
| | | |
| | | ResultTrayCellsStatus resultTrayCellsStatus = GetResultTrayCellsStatus(command, stationManager); |
| | | |
| | |
| | | if (Traycontent.Status) |
| | | { |
| | | ConsoleHelper.WriteSuccessLine("化成空框请求回流静置"); |
| | | if (StaticVariable.isStackerRun) |
| | | { |
| | | ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | |
| | | ConsoleHelper.WriteErrorLine($"{JsonConvert.SerializeObject(Taskcontent)}"); |
| | | if (Taskcontent.Status) |
| | | { |
| | | var task = _taskRepository.QueryFirst(x => x.Roadway.Contains("JZ") && ( x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish||x.TaskState==(int)TaskOutStatusEnum.OutNew)); |
| | | if (task != null && task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting && task.CurrentAddress == "1537") |
| | | if (StaticVariable.isStackerRun) |
| | | { |
| | | ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(stationManager.stationLocation); |
| | | ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | } |
| | | #region |
| | | //if (task != null && task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting && task.CurrentAddress == "1537") |
| | | //{ |
| | | // ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(stationManager.stationLocation); |
| | | |
| | | if (command1.InteractiveSignal != 2) |
| | | { |
| | | ConsoleHelper.WriteSuccessLine("化成实托请求入静置"); |
| | | ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | ConsoleHelper.WriteWarningLine("出库任务未完成"); |
| | | return; |
| | | } |
| | | } |
| | | else if (task != null && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting) |
| | | { |
| | | ConsoleHelper.WriteWarningLine("已存在静置出库任务"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | var Task = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode); |
| | | if (Task.Status) |
| | | { |
| | | ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | } |
| | | return; |
| | | } |
| | | // if (command1.InteractiveSignal != 2) |
| | | // { |
| | | // ConsoleHelper.WriteSuccessLine("化成实托请求入静置"); |
| | | // if (StaticVariable.isStackerRun == true) |
| | | // { |
| | | // ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | // } |
| | | // return; |
| | | // } |
| | | // else |
| | | // { |
| | | // ConsoleHelper.WriteWarningLine("出库任务未完成"); |
| | | // return; |
| | | // } |
| | | //} |
| | | //else if (task != null && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting) |
| | | //{ |
| | | // ConsoleHelper.WriteWarningLine("已存在静置出库任务"); |
| | | // return; |
| | | //} |
| | | //else |
| | | //{ |
| | | // var Task = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode); |
| | | // if (Task.Status) |
| | | // { |
| | | // if (StaticVariable.isStackerRun == true) |
| | | // { |
| | | // ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | // } |
| | | // } |
| | | // return; |
| | | //} |
| | | #endregion |
| | | } |
| | | else |
| | | { |
| | |
| | | var Taskcontent = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | if (Taskcontent.Status) |
| | | { |
| | | if (StaticVariable.isStackerRun) |
| | | { |
| | | ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | } |
| | | return; |
| | | } |
| | | else |
| | |
| | | ConsoleHelper.WriteErrorLine($"{JsonConvert.SerializeObject(Task)}"); |
| | | if (Task.Status) |
| | | { |
| | | if (StaticVariable.isStackerRun) |
| | | { |
| | | ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); |
| | | } |
| | | } |
| | | ConsoleHelper.WriteWarningLine("二封缓存位已满"); |
| | | return; |
| | |
| | | } |
| | | } |
| | | } |
| | | #region |
| | | //public void ExecuteConveyorLineTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, int ProtocalDetailValue ,string childDeviceCode) |
| | | //{ |
| | | // var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode); |
| | | // if (task != null) |
| | | // { |
| | | // var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue; |
| | | // var valueList = value.Split(',').ToList(); |
| | | // if (valueList.Contains(task.SourceAddress)) |
| | | // { |
| | | // conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | catch (Exception ex) |
| | | { |
| | | ConsoleHelper.WriteWarningLine($"{ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | StaticVariable.isLineRun = true; |
| | | } |
| | | } |
| | | |
| | | // var log = $"【{conveyorLine._deviceName}】任务号:【{task.TaskNum}】,托盘条码:【{task.PalletCode}】已到达【{childDeviceCode}】请求扫码入库(实盘),下一目标地址【{1000}】"; |
| | | // ConsoleHelper.WriteWarningLine(log); |
| | | |
| | | // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); |
| | | // WriteInfo(conveyorLine.DeviceName, log); |
| | | |
| | | // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | // } |
| | | // else if (task.TargetAddress == "1020-1") |
| | | // { |
| | | // var next = task.NextAddress; |
| | | // var taskCommand = MapTaskCommand(task, command); |
| | | // task.NextAddress = next; |
| | | |
| | | // var log = $"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】请求扫码入库(实盘),下一目标地址【{taskCommand.TargetAddress}】"; |
| | | // ConsoleHelper.WriteWarningLine(log); |
| | | |
| | | // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); |
| | | // WriteInfo(conveyorLine.DeviceName, log); |
| | | |
| | | // conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | |
| | | // var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | // _task_HtyRepository.AddData(taskHty); |
| | | // _taskService.DeleteData(task); |
| | | // } |
| | | // else |
| | | // { |
| | | // var next = task.NextAddress; |
| | | // var taskCommand = MapTaskCommand(task, command); |
| | | // task.NextAddress = next; |
| | | |
| | | // var log = $"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】请求扫码入库(实盘),下一目标地址【{taskCommand.TargetAddress}】"; |
| | | // ConsoleHelper.WriteWarningLine(log); |
| | | |
| | | // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); |
| | | // WriteInfo(conveyorLine.DeviceName, log); |
| | | |
| | | // conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | // _taskService.UpdateTaskStatusToNext(task); |
| | | // } |
| | | // } |
| | | //} |
| | | #endregion |
| | | /// <summary> |
| | | /// 执行输送线任务 |
| | | /// </summary> |
| | |
| | | (x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || |
| | | x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutNew)); |
| | | |
| | | if (outJZTask.IsNullOrEmpty()) |
| | | if (!outJZTask.Any()) |
| | | { |
| | | // 映射任务命令 |
| | | var taskCommand = MapTaskCommand(task, command); |