| | |
| | | using Mapster; |
| | | using Newtonsoft.Json; |
| | | using Masuit.Tools; |
| | | using Quartz; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Text; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.AppendLine(); |
| | | builder.AppendLine($"【{commonStackerCrane.DeviceName}】堆垛机状态:【{commonStackerCrane.StackerCraneStatusDes}】,时间:【{DateTime.Now}】"); |
| | | builder.AppendLine($"【{commonStackerCrane.DeviceName}】手自动状态:【{commonStackerCrane.StackerCraneAutoStatusDes}】,时间:【{DateTime.Now}】"); |
| | | builder.AppendLine($"【{commonStackerCrane.DeviceName}】作业状态:【{commonStackerCrane.StackerCraneWorkStatusDes}】,时间:【{DateTime.Now}】"); |
| | | builder.AppendLine($"【{commonStackerCrane.DeviceName}】下发任务成功,【{JsonConvert.SerializeObject(stackerCraneTaskCommand, Formatting.Indented)}】"); |
| | | builder.AppendLine($"时间:【{DateTime.Now}】"); |
| | | builder.AppendLine(); |
| | | ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue); |
| | | //StringBuilder builder = new StringBuilder(); |
| | | //builder.AppendLine(); |
| | | //builder.AppendLine($"【{commonStackerCrane.DeviceName}】堆垛机状态:【{commonStackerCrane.StackerCraneStatusDes}】,时间:【{DateTime.Now}】"); |
| | | //builder.AppendLine($"【{commonStackerCrane.DeviceName}】手自动状态:【{commonStackerCrane.StackerCraneAutoStatusDes}】,时间:【{DateTime.Now}】"); |
| | | //builder.AppendLine($"【{commonStackerCrane.DeviceName}】作业状态:【{commonStackerCrane.StackerCraneWorkStatusDes}】,时间:【{DateTime.Now}】"); |
| | | //builder.AppendLine($"【{commonStackerCrane.DeviceName}】下发任务成功,【{JsonConvert.SerializeObject(stackerCraneTaskCommand, Formatting.Indented)}】"); |
| | | //builder.AppendLine($"时间:【{DateTime.Now}】"); |
| | | //builder.AppendLine(); |
| | | //ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue); |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | |
| | | } |
| | | |
| | | var content = _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | if (commonStackerCrane.DeviceCode.Contains("CH") && task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | if ((commonStackerCrane.DeviceCode.Contains("CH") || commonStackerCrane.DeviceCode.Contains("JZ")) && task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum); |
| | | Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | |
| | | /// <returns></returns> |
| | | private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | Dt_Task task; |
| | | Dt_Task task = null; |
| | | if (commonStackerCrane.LastTaskType == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); |
| | |
| | | return task; |
| | | } |
| | | |
| | | #region 静置出库判断是否能执行任务 |
| | | |
| | | if (!task.IsNullOrEmpty() && task.Roadway.Contains("JZ") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | // 查询是否存在静置入库任务 |
| | | var inJZTask = _taskRepository.QueryData(x => x.Roadway == task.Roadway && |
| | | (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || |
| | | x.TaskState == (int)TaskInStatusEnum.SC_InExecuting || |
| | | x.TaskState == (int)TaskInStatusEnum.Line_InFinish)); |
| | | |
| | | ConsoleHelper.WriteErrorLine($"当前静置线体存在入库任务{inJZTask.Count()}条,{(inJZTask.Count() > 0 ? "可入库" : "不可入库")}"); |
| | | if (!inJZTask.IsNullOrEmpty()) |
| | | return null; |
| | | } |
| | | |
| | | #endregion 静置出库判断是否能执行任务 |
| | | } |
| | | else if (task == null) |
| | | { |
| | |
| | | IDevice? device = null; |
| | | if (task.Roadway.Contains("GW")) |
| | | { |
| | | device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1015"); |
| | | device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1004"); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device; |
| | |
| | | } |
| | | else |
| | | { |
| | | if ((task.NextAddress == ("002-021-001") || task.NextAddress == ("001-021-001")) && task.Roadway.Contains("JZ")) |
| | | if ((task.NextAddress == ("002-071-001") || task.NextAddress == ("001-071-001")) && task.Roadway.Contains("CH")) |
| | | { |
| | | return task; |
| | | } |
| | |
| | | { |
| | | var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue; |
| | | var valueList = value.Split(',').ToList(); |
| | | if ((valueList.Contains(task.SourceAddress)) && task.Roadway.Contains("CH")||task.Roadway.Contains("JZ")) |
| | | if ((valueList.Contains(task.SourceAddress)) && (task.Roadway.Contains("CH") || task.Roadway.Contains("JZ"))) |
| | | { |
| | | string[] souredCodes = task.CurrentAddress.Split("-"); |
| | | if (souredCodes.Length == 3) |
| | |
| | | } |
| | | else |
| | | { |
| | | if ((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ")) |
| | | if ((task.TargetAddress == "002-061-001" || task.TargetAddress == "001-061-001") && task.Roadway.Contains("JZ")) |
| | | { |
| | | string[] endCodes = task.NextAddress.Split("-"); |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]); |