duyongjia
2024-12-23 430404d69be9b5d420ad12b9ac087508f1fa2aca
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -4,10 +4,14 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common.Http;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
@@ -35,12 +39,11 @@
            _taskRepository = taskRepository;
            _routerService = routerService;
        }
        public string url = AppSettings.Configuration["WMS"];
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
            {
                CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
                if (commonStackerCrane != null)
                {
@@ -69,15 +72,17 @@
                                    bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                    if (sendFlag)
                                    {
                                        if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
                                        if (task.TaskType == (int)TaskInboundTypeEnum.Inbound|| task.TaskType == (int)TaskInboundTypeEnum.InInventory)
                                        {
                                            _taskService.UpdateTaskStatus(task.TaskId, (int)TaskInStatusEnum.SC_InExecuting);
                                            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机入库执行中");
                                            var response = HttpHelpers.Post<WebResponseContent>(url.Replace("PDA", "Task") + "UpdateTaskStatus?taskNum=" + task.TaskNum, "", "更新任务状态");
                                        }
                                        else if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
                                        else if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound|| task.TaskType == (int)TaskOutboundTypeEnum.OutInventory)
                                        {
                                            _taskService.UpdateTaskStatus(task.TaskId, (int)TaskOutStatusEnum.SC_OutExecuting);
                                            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机出库执行中");
                                            var response = HttpHelpers.Post<WebResponseContent>(url.Replace("PDA", "Task") + "UpdateTaskStatus?taskNum=" + task.TaskNum, "", "更新任务状态");
                                        }
                                    }
                                }
@@ -120,7 +125,7 @@
        private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane)
        {
            Dt_Task task;
            task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode);
            task = _taskService.QueryStackerCraneTask("R01");
            return task;
        }
@@ -168,7 +173,15 @@
            stackerCraneTaskCommand.Barcode = task.PalletCode;
            stackerCraneTaskCommand.TaskNum = task.TaskNum;
            stackerCraneTaskCommand.WorkType = 1;
            stackerCraneTaskCommand.TrayType = 1;
            if(task.PalletCode.Substring(0,1)=="B")
            {
                stackerCraneTaskCommand.TrayType = 2;
            }
            else
            {
                stackerCraneTaskCommand.TrayType = 1;
            }
            //stackerCraneTaskCommand.TrayType = 1;
            string[] SourceCodes = task.SourceAddress.Split("-");
            if (SourceCodes.Length == 4)
            {