| | |
| | | /// </summary> |
| | | private void HandleNewTask(CommonConveyorLine_CW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode); |
| | | |
| | | if (stationManager == null) |
| | | try |
| | | { |
| | | // Handle the case where stationManager is not found, if necessary |
| | | Console.WriteLine($"未找到{childDeviceCode}站台"); |
| | | return; |
| | | } |
| | | |
| | | // 根据站类型执行相应的方法 |
| | | switch (stationManager.stationType) |
| | | { |
| | | case 8: |
| | | case 9: |
| | | case 11: |
| | | case 12: |
| | | var task = _taskService.QueryExecutingTaskByBarcode(command.ConveyorLineBarcode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode); |
| | | |
| | | if (stationManager == null) |
| | | { |
| | | // Handle the case where stationManager is not found, if necessary |
| | | Console.WriteLine($"未找到{childDeviceCode}站台"); |
| | | return; |
| | | } |
| | | |
| | | // 根据站类型执行相应的方法 |
| | | switch (stationManager.stationType) |
| | | { |
| | | case 8: |
| | | case 9: |
| | | case 11: |
| | | case 12: |
| | | var task = _taskService.QueryExecutingTaskByBarcode(command.ConveyorLineBarcode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode); |
| | | } |
| | | break; |
| | | case 1: |
| | | case 6: |
| | | case 10: |
| | | ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode); |
| | | } |
| | | break; |
| | | case 1: |
| | | case 6: |
| | | case 10: |
| | | ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode); |
| | | break; |
| | | //case 16: |
| | | // ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode); |
| | | // break; |
| | | break; |
| | | //case 16: |
| | | // ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode); |
| | | // break; |
| | | } |
| | | |
| | | } |
| | | |
| | | #region |
| | | //Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode); |
| | | |
| | | //if (stationManager.stationType == 8) |
| | | //{ |
| | | // var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | // if (task != null) |
| | | // { |
| | | // RequestInNextAddress(conveyorLine, command, childDeviceCode); |
| | | // } |
| | | //} |
| | | //else if (stationManager.stationType == 9) |
| | | //{ |
| | | // var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | // if (task != null) |
| | | // { |
| | | // ConveyorLineInFinish(conveyorLine, command, childDeviceCode); |
| | | // } |
| | | //} |
| | | //else if (stationManager.stationType == 1) |
| | | //{ |
| | | // if (stationManager.stationArea.Contains("GW")) |
| | | // { |
| | | // var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && x.TaskState == (int)TaskOutStatusEnum.OutFinish); |
| | | // if (taskGW != null) |
| | | // { |
| | | // command.ConveyorLineBarcode = taskGW.PalletCode; |
| | | // } |
| | | // } |
| | | // RequestWmsTask(conveyorLine, command, childDeviceCode); |
| | | //} |
| | | //else if (stationManager.stationType == 10) |
| | | //{ |
| | | // var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | // if (task != null) |
| | | // { |
| | | // RequestOutbound(conveyorLine, command, childDeviceCode); |
| | | // } |
| | | //} |
| | | //else if (stationManager.stationType == 11) |
| | | //{ |
| | | // var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | // if (task != null) |
| | | // { |
| | | // RequestOutNextAddress(conveyorLine, command, childDeviceCode); |
| | | // } |
| | | //} |
| | | //else if (stationManager.stationType == 12) |
| | | //{ |
| | | // var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | // if (task != null) |
| | | // { |
| | | // ConveyorLineOutFinish(conveyorLine, command, childDeviceCode); |
| | | // } |
| | | //} |
| | | #endregion |
| | | catch (Exception ex) |
| | | { |
| | | WriteInfo("HandleNewTask", $"【{ex.Message}】"); |
| | | } |
| | | } |
| | | |
| | | private void ExecuteStationAction(Dt_StationManager stationManager, CommonConveyorLine_CW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) |
| | |
| | | AbNormalStationBZTask(conveyorLine, command, childDeviceCode); |
| | | break; |
| | | case 1: |
| | | |
| | | //if (stationManager.stationArea.Contains("GW")) |
| | | //{ |
| | | //var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && (x.TaskState == (int)TaskOutStatusEnum.OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutPending)); |
| | | //if (taskGW != null) |
| | | //{ |
| | | // command.ConveyorLineBarcode = taskGW.PalletCode; |
| | | //} |
| | | //} |
| | | //如高温出库后任务标记NG异常则将任务更新为异常排出任务 --冠宇取消超时检测后 托盘超时不在出库至异常口 |
| | | //Dt_Task NGtask = _taskRepository.QueryFirst(x => x.Remark == "NG" && x.Roadway == stationManager.Roadway && x.Roadway.Contains("GW")); |
| | | //if (NGtask != null) |
| | | //{ |
| | | // CreateAbNormalOutbound(conveyorLine, command, childDeviceCode, NGtask); |
| | | // break; |
| | | //} |
| | | |
| | | RequestWmsTask(conveyorLine, command, childDeviceCode, stationManager); |
| | | break; |
| | | } |
| | |
| | | throw new InvalidOperationException("WMS IP 未配置"); |
| | | } |
| | | var wmsIpAddrss = wmsBase + requestTrayInTask; |
| | | |
| | | var result = HttpHelper.PostAsync(wmsIpAddrss, request.ToJsonString()).Result; |
| | | |
| | | if (result == null) |
| | | return new WMSTaskDTO(); |
| | | |
| | |
| | | try |
| | | { |
| | | if (command.ConveyorLineBarcode.IsNullOrEmpty()) return; |
| | | |
| | | var content = await _taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode); |
| | | |
| | | if (content.Status) |
| | | { |
| | | var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode); |
| | |
| | | } |
| | | |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |