| | |
| | | using Autofac.Core; |
| | | using HslCommunication; |
| | | using Mapster; |
| | | using Newtonsoft.Json; |
| | | using Mapster; |
| | | using Quartz; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.HttpContextUser; |
| | | using WIDESEAWCS_DTO.MOM; |
| | | using WIDESEAWCS_IProcessRepository; |
| | | using WIDESEAWCS_ITaskInfo_HtyRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | |
| | | #region 调用事件总线通知前端 |
| | | |
| | | var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); |
| | | if (tokenInfos == null || !tokenInfos.Any()) |
| | | if (tokenInfos != null && tokenInfos.Any()) |
| | | { |
| | | //throw new Exception(commonStackerCrane.DeviceName + "缓存中未找到Token缓存"); |
| | | return Task.CompletedTask; |
| | | } |
| | | var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList(); |
| | | var userIds = tokenInfos?.Select(x => x.UserId).ToList(); |
| | | var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList(); |
| | | var userIds = tokenInfos?.Select(x => x.UserId).ToList(); |
| | | |
| | | object obj = new |
| | | { |
| | | commonStackerCrane.StackerCraneStatusDes, |
| | | commonStackerCrane.StackerCraneAutoStatusDes, |
| | | commonStackerCrane.StackerCraneWorkStatusDes, |
| | | commonStackerCrane.DeviceCode, |
| | | commonStackerCrane.DeviceName, |
| | | commonStackerCrane.CurrentTaskNum, |
| | | commonStackerCrane.LastTaskNum, |
| | | }; |
| | | _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { commonStackerCrane.DeviceName, data = obj }); |
| | | object obj = new |
| | | { |
| | | commonStackerCrane.StackerCraneStatusDes, |
| | | commonStackerCrane.StackerCraneAutoStatusDes, |
| | | commonStackerCrane.StackerCraneWorkStatusDes, |
| | | commonStackerCrane.DeviceCode, |
| | | commonStackerCrane.DeviceName, |
| | | commonStackerCrane.CurrentTaskNum, |
| | | commonStackerCrane.LastTaskNum, |
| | | }; |
| | | _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { commonStackerCrane.DeviceName, data = obj }); |
| | | } |
| | | |
| | | #endregion 调用事件总线通知前端 |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.TargetAddress}】对应的通讯对象,无法判断出库站台是否被占用"); |
| | | } |
| | | } |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.TargetAddress}】信息,无法校验站台"); |
| | | //_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.TargetAddress}】信息,无法校验站台"); |
| | | } |
| | | } |
| | | else |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 查找其他出库任务的辅助方法(排除指定任务ID的任务) |
| | | /// </summary> |
| | |
| | | { |
| | | return candidateTask; |
| | | } |
| | | ConsoleHelper.WriteErrorLine($"任务号:【{occupiedStation.TaskNum}】出库地址:【{occupiedStation.NextAddress}】不允许放货"); |
| | | ConsoleHelper.WriteErrorLine($"任务号:【{candidateTask.TaskNum}】出库地址:【{candidateTask.NextAddress}】不允许放货"); |
| | | } |
| | | |
| | | return null; |
| | |
| | | stackerCraneTaskCommand.StartCommand = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//判断是否是入库任务 |
| | | { |
| | | if (task.Roadway.Contains("JZ")) |
| | | if (task.SourceAddress == "1359-4" && task.Roadway.Contains("JZ")) |
| | | { |
| | | string[] souredCodes = task.CurrentAddress.Split("-"); |
| | | if (souredCodes.Length == 3) |
| | |
| | | } |
| | | else |
| | | { |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | if (routers.Count > 0) |
| | | if (task.TargetAddress == "002-021-001" && task.Roadway.Contains("JZ") && task.TaskType == (int)TaskOutboundTypeEnum.OutTray) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(routers.FirstOrDefault().SrmRow); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(routers.FirstOrDefault().SrmColumn); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(routers.FirstOrDefault().SrmLayer); |
| | | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //数据配置错误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】"); |
| | | return null; |
| | | } |
| | | string[] endCodes = task.NextAddress.Split("-"); |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(endCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(endCodes[2]); |
| | | string[] sourceCodes = task.SourceAddress.Split("-"); |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法获取对应的堆垛机放货站台信息"); |
| | | return null; |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | if (routers.Count > 0) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(routers.FirstOrDefault().SrmRow); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(routers.FirstOrDefault().SrmColumn); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(routers.FirstOrDefault().SrmLayer); |
| | | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //数据配置错误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】"); |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法获取对应的堆垛机放货站台信息"); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | return stackerCraneTaskCommand; |
| | | } |
| | | |
| | | } |
| | | } |