1
Huangxiaoqiang-03
2024-11-01 6e9f630e4e12738d98241b684e6227e02010b6c5
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components.Routing;
using HslCommunication;
using Microsoft.AspNetCore.Components.Routing;
using Quartz;
using SqlSugar.Extensions;
using System;
@@ -8,12 +9,14 @@
using System.Net;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.Enums;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_Tasks.StackerCraneJob;
@@ -93,7 +96,7 @@
            }
            catch (Exception ex)
            {
                Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString());
                //Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString());
            }
            return Task.CompletedTask;
        }
@@ -131,8 +134,8 @@
            }
            else
            {
                bool flag = speStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup;
                if (flag)
                bool flag = speStackerCrane.LastTaskType == TaskTypeEnum.Inbound.ObjToInt() || speStackerCrane.LastTaskType == TaskTypeEnum.PalletInbound.ObjToInt();
                if (flag==false)
                {
                    task = _taskService.QueryStackerCraneInTask(speStackerCrane.DeviceCode);
                    if (task == null)
@@ -145,19 +148,6 @@
                    task = _taskService.QueryStackerCraneOutTask(speStackerCrane.DeviceCode);
                }
            }
            if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
            {
                List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(speStackerCrane.DeviceCode, task.TargetAddress);
                foreach (var item in tasks)
                {
                    return task;
                }
                return task;
            }
            return task;
        }
@@ -192,13 +182,34 @@
            return null;
        }
        /// <summary>
        /// ä»»åŠ¡å®žä½“è½¬æ¢æˆå‘½ä»¤Model
        /// </summary>
        /// <param name="task">任务实体</param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
        public bool SendCommands(StackerCraneTaskCommand command,SpeStackerCrane speStackerCrane)
        {
            try
            {
                speStackerCrane.SetValue(StackerCraneDBName.TaskNum, command.TaskNum);
                speStackerCrane.SetValue(StackerCraneDBName.StartRow, command.StartRow);
                speStackerCrane.SetValue(StackerCraneDBName.StartColumn, command.StartColumn);
                speStackerCrane.SetValue(StackerCraneDBName.StartLayer, command.StartLayer);
                speStackerCrane.SetValue(StackerCraneDBName.EndRow, command.EndRow);
                speStackerCrane.SetValue(StackerCraneDBName.EndColumn, command.EndColumn);
                speStackerCrane.SetValue(StackerCraneDBName.EndLayer, command.EndLayer);
                speStackerCrane.SetValue(StackerCraneDBName.Barcode, command.Barcode);
                speStackerCrane.SetValue(StackerCraneDBName.WorkType, command.WorkType);
                speStackerCrane.SetValue(StackerCraneDBName.TrayType, command.TrayType);
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
            /// <summary>
            /// ä»»åŠ¡å®žä½“è½¬æ¢æˆå‘½ä»¤Model
            /// </summary>
            /// <param name="task">任务实体</param>
            /// <returns></returns>
            /// <exception cref="Exception"></exception>
            public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
        {
            StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand();
@@ -206,7 +217,7 @@
            stackerCraneTaskCommand.TaskNum = task.TaskNum;
            stackerCraneTaskCommand.WorkType = 1;
            stackerCraneTaskCommand.TrayType = 0;
            if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//判断是否是入库任务
            if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletInbound.ObjToInt())//判断是否是入库任务
            {
                if (task.SourceAddress != null && task.TargetAddress != null)
                {
@@ -243,7 +254,7 @@
                    return null;
                }
            }
            else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
            else if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletOutbound.ObjToInt())
            {
                if (task.SourceAddress != null && task.TargetAddress != null)
                {
@@ -280,7 +291,7 @@
                    return null;
                }
            }
            else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
            else if (task.TaskType == TaskTypeEnum.Relocation.ObjToInt())
            {
                if (task.SourceAddress != null && task.TargetAddress != null)
                {