| | |
| | | using HslCommunication; |
| | | using Masuit.Tools.Systems; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System.Diagnostics.CodeAnalysis; |
| | |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.HttpContextUser; |
| | | using WIDESEAWCS_DTO.MOM; |
| | | using WIDESEAWCS_IProcessRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_SignalR; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Common; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | CommonStackerStationCrane commonStackerCrane = (CommonStackerStationCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | //EqptAlive(commonStackerCrane); |
| | | //Console.Out.WriteLine(commonStackerCrane.DeviceName); |
| | | if (!commonStackerCrane.IsEventSubscribed) |
| | | { |
| | | commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订阅任务完成事件 |
| | |
| | | |
| | | if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | Dt_Task? task = null; |
| | | if (StaticVariable.isLineRun) |
| | | { |
| | | StaticVariable.isStackerRun = false; |
| | | task = GetTask(commonStackerCrane); |
| | | } |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | { |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | WriteError("CommonStackerStationCraneJob", "test", ex); |
| | | //Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString()); |
| | | } |
| | | finally |
| | | { |
| | | StaticVariable.isStackerRun = true; |
| | | } |
| | | //WriteDebug("CommonStackerStationCraneJob", "test"); |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | |
| | | str = $"{commonStackerCrane.DeviceName}】WMS|WCS任务完成:【{content.Status}】,堆垛机完成信号写入:【{isWorkType}】,任务号:【{e.TaskNum}】时间【{DateTime.Now}】"; |
| | | WriteInfo(commonStackerCrane.DeviceName, str); |
| | | ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue); |
| | | |
| | | if (content.Status) |
| | | { |
| | | var task = content.Data as Dt_Task; |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.Roadway == task.Roadway && x.stationLocation == task.TargetAddress); |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine_After conveyorLine = (CommonConveyorLine_After)device; |
| | | var proAddress = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationManager.stationChildCode).Where(x => x.DeviceProParamName == ConveyorLineDBName_After.InteractiveSignal.ToString()).FirstOrDefault().DeviceProAddress; |
| | | string? address = proAddress; |
| | | if (!proAddress.Contains(".0")) |
| | | { |
| | | address = proAddress + ".0"; |
| | | } |
| | | conveyorLine.Communicator.Write(str, false); |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.NextAddress}】对应的通讯对象,无法清除出库站台顶升状态"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.Roadway == task.Roadway && x.stationLocation == task.TargetAddress); |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine_After conveyorLine = (CommonConveyorLine_After)device; |
| | | var proAddress = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationManager.stationChildCode).Where(x => x.DeviceProParamName == ConveyorLineDBName_After.InteractiveSignal.ToString()).FirstOrDefault().DeviceProAddress; |
| | | string? str = proAddress; |
| | | if (!proAddress.Contains(".0")) |
| | | { |
| | | str = proAddress + ".0"; |
| | | } |
| | | conveyorLine.Communicator.Write(str, true); |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.NextAddress}】对应的通讯对象,无法判断出库站台是否被占用"); |
| | | return null; |
| | | } |
| | | } |
| | | // 检查当前出库任务站台是否允许放货 |
| | | var occupiedStation = OutTaskStationIsOccupied(task); |
| | | if (occupiedStation == null) |