| | |
| | | if (string.Equals(task.NextAddress, ConstraintMachineName, StringComparison.Ordinal)) |
| | | { |
| | | ConstraintMachine? constraint = devices.OfType<ConstraintMachine>().FirstOrDefault(d => d.DeviceName == ConstraintMachineName); |
| | | if (constraint == null) |
| | | { |
| | | // 处理 processing 为空的情况(可根据实际业务需求添加处理逻辑) |
| | | return; |
| | | } |
| | | if (constraint == null) return; |
| | | |
| | | ProcessDeviceRequest(conveyorLine, constraint, childDeviceCode, |
| | | () => constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestUpper), |
| | |
| | | else if (string.Equals(task.NextAddress, PinMachineName, StringComparison.Ordinal)) |
| | | { |
| | | PinMachine? pinMachine = devices.OfType<PinMachine>().FirstOrDefault(d => d.DeviceName == PinMachineName); |
| | | if (pinMachine == null) |
| | | { |
| | | // 处理 pinMachine 为空的情况(可根据实际业务需求添加处理逻辑) |
| | | return; |
| | | } |
| | | if (pinMachine == null) return; |
| | | |
| | | ProcessDeviceRequest(conveyorLine, pinMachine, childDeviceCode, |
| | | () => pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestUpper), |
| | |
| | | } |
| | | |
| | | Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | | //if (newTask != null) |
| | | //{ |
| | | // _taskService.UpdateTaskStatusToNext(task); |
| | | //} |
| | | if (newTask != null) |
| | | { |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | ConveyorLineTaskCommandNew taskCommand = _mapper.Map<ConveyorLineTaskCommandNew>(task); |
| | | taskCommand.WCS_ACK = command.WCS_ACK; |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | //ConveyorLineTaskCommandNew taskCommand = _mapper.Map<ConveyorLineTaskCommandNew>(task); |
| | | //taskCommand.WCS_ACK = command.WCS_ACK; |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.TaskNo, task.TaskNum, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.Barcode, task.PalletCode, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.Target, task.TargetAddress, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode); |
| | | |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | |
| | | } |
| | | |
| | | Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode); |
| | | WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); |
| | | Console.Out.WriteLine(content.Serialize()); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 入库拘束机请求处理 |
| | | /// </summary> |
| | | /// <param name="conveyorLine"></param> |
| | | /// <param name="command"></param> |
| | | /// <param name="constraint"></param> |
| | | /// <param name="childDeviceCode"></param> |
| | | public void InboundConstraintMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, ConstraintMachine? constraint, string childDeviceCode) |
| | | { |
| | | //入库拘束机请求处理逻辑 |
| | | bool materialReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestUpper); |
| | | bool outputReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.OutputRequestUpper); |
| | | |
| | | if (materialReq) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode); |
| | | } |
| | | else |
| | | { |
| | | constraint.SetValue(ConstraintMachineDBName.ConstraintTrayOutputReadyUpper, outputReq ? 1 : 0); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 入库插拔钉机请求处理 |
| | | /// </summary> |
| | | /// <param name="conveyorLine"></param> |
| | | /// <param name="command"></param> |
| | | /// <param name="pinMachine"></param> |
| | | /// <param name="childDeviceCode"></param> |
| | | public void InboundPinMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, PinMachine? pinMachine, string childDeviceCode) |
| | | { |
| | | //入库插拔钉机请求处理逻辑 |
| | | bool materialReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestUpper); |
| | | bool outputReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.OutputRequestUpper); |
| | | if (materialReq) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode); |
| | | } |
| | | else |
| | | { |
| | | pinMachine.SetValue(PinMachineDBName.PlugPinTrayOutputReadyUpper, outputReq ? 1 : 0); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 出库拘束机请求处理 |
| | | /// </summary> |
| | | /// <param name="conveyorLine"></param> |
| | | /// <param name="command"></param> |
| | | /// <param name="constraint"></param> |
| | | /// <param name="childDeviceCode"></param> |
| | | public void OutConstraintMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, ConstraintMachine? constraint, string childDeviceCode) |
| | | { |
| | | //出库拘束机请求处理逻辑 |
| | | |
| | | bool materialReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestLower); |
| | | bool outputReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.OutputRequestLower); |
| | | |
| | | if (materialReq) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode); |
| | | } |
| | | else |
| | | { |
| | | constraint.SetValue(ConstraintMachineDBName.ConstraintTrayOutputReadyLower, outputReq ? 1 : 0); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 出库插拔钉机请求处理 |
| | | /// </summary> |
| | | /// <param name="conveyorLine"></param> |
| | | /// <param name="command"></param> |
| | | /// <param name="pinMachine"></param> |
| | | /// <param name="childDeviceCode"></param> |
| | | public void OutPinMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, PinMachine? pinMachine, string childDeviceCode) |
| | | { |
| | | //出库插拔钉机请求处理逻辑 |
| | | bool materialReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestLower); |
| | | bool outputReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.OutputRequestLower); |
| | | if (materialReq) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode); |
| | | } |
| | | else |
| | | { |
| | | pinMachine.SetValue(PinMachineDBName.PlugPinTrayOutputReadyLower, outputReq ? 1 : 0); |
| | | } |
| | | } |
| | | |