| | |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC); |
| | | if (device != null) |
| | | { |
| | | if (device.DeviceCode == "1024" || device.DeviceCode == "1023") |
| | | { |
| | | CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device; |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode); |
| | | Thread.Sleep(100); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode); |
| | | } |
| | | else |
| | | { |
| | | CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device; |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode); |
| | | Thread.Sleep(100); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode); |
| | | } |
| | | } |
| | | WriteInfo(commonStackerCrane.DeviceName, $"【手动出库记录】任务号【{e.TaskNum}】托盘号【{task.PalletCode}】"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | |
| | | _noticeService.Logs(userTokenIds, new { commonStackerCrane.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); |
| | | WriteInfo(commonStackerCrane.DeviceName, log); |
| | | |
| | | task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task.TaskId); |
| | | task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task); |
| | | |
| | | if (task == null) |
| | | { |
| | |
| | | device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode); |
| | | if (device != null) |
| | | { |
| | | if (device.DeviceCode == "1024" || device.DeviceCode == "1023") |
| | | { |
| | | CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device; |
| | | if (conveyorLine.IsOccupied(task.NextAddress))//出库站台未被占用 |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device; |
| | | if (conveyorLine.IsOccupied(task.NextAddress))//出库站台未被占用 |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | else |
| | |
| | | /// <param name="deviceCode">设备代码</param> |
| | | /// <param name="excludedTaskId">要排除的任务ID</param> |
| | | /// <returns></returns> |
| | | private Dt_Task? FindAnotherOutboundTask(string deviceCode, int excludedTaskId) |
| | | private Dt_Task? FindAnotherOutboundTask(string deviceCode, Dt_Task task) |
| | | { |
| | | // 先获取所有符合条件(排除指定任务ID)的出库任务列表 |
| | | var allOutboundTasks = _taskService.QueryAllOutboundTasks(deviceCode); |
| | | var availableTasks = allOutboundTasks?.Where(t => excludedTaskId != t.TaskId && t.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup).ToList(); |
| | | var availableTasks = allOutboundTasks?.Where(t => t.TargetAddress != task.TargetAddress && t.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup).ToList(); |
| | | |
| | | if (availableTasks == null || availableTasks.Count == 0) |
| | | { |