wanshenmean
2 天以前 f319fd5d5e5e0332c4c7e209df64c351dfbe6887
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Status.cs
@@ -1,3 +1,4 @@
using Serilog.Core;
using System.Diagnostics.CodeAnalysis;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
@@ -5,6 +6,7 @@
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_Tasks;
namespace WIDESEAWCS_TaskInfoService;
@@ -92,6 +94,9 @@
    /// <returns></returns>
    public WebResponseContent UpdateTaskStatusToNext([NotNull] Dt_Task task)
    {
        WebResponseContent content = new WebResponseContent();
        try
        {
        int oldState = task.TaskStatus;
        var result = task.TaskType.GetTaskTypeGroup() switch
@@ -100,7 +105,7 @@
            TaskTypeGroup.InboundGroup => _inboundTaskFlowService.MoveToNextStatus(task),
            TaskTypeGroup.RelocationGroup => _relocationTaskFlowService.MoveToNextStatus(task),
            TaskTypeGroup.OtherGroup => _robotTaskFlowService.MoveToNextStatus(task),
            _ => WebResponseContent.Instance.Error($"任务类型错误,未找到该任务类型,任务号:【{task.TaskNum}】,任务类型:【{task.TaskType}】")
                _ => content.Error($"任务类型错误,未找到该任务类型,任务号:【{task.TaskNum}】,任务类型:【{task.TaskType}】")
        };
        if (!result.Status)
@@ -111,7 +116,7 @@
            && result.Data is List<WMSTaskDTO> wmsTasks
            && wmsTasks.Count > 0)
        {
            WebResponseContent content = ReceiveWMSTask(wmsTasks);
                content = ReceiveWMSTask(wmsTasks);
            if (!content.Status)
                return content;
        }
@@ -134,7 +139,13 @@
            : $"系统自动流程,任务状态从【{oldState}】转到【{task.TaskStatus}】";
        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, logMessage);
        return WebResponseContent.Instance.OK();
            return content.OK();
        }
        catch (Exception ex)
        {
            QuartzLogHelper.LogError(Logger.None, $"UpdateTaskStatusToNext 更新将任务状态修改为下一个状态失败,任务号:【{task.TaskNum}】,错误信息:【{ex.Message}】", "UpdateTaskStatusToNext");
            return content.Error(ex.Message);
        }
    }
    /// <summary>
@@ -171,7 +182,8 @@
        }
        catch (Exception ex)
        {
            Console.WriteLine($"UpdatePosition 更新任务位置失败,任务号:【{taskNum}】,错误信息:【{ex.Message}】");
            QuartzLogHelper.LogError(Logger.None, $"UpdatePosition 更新任务位置失败,任务号:【{taskNum}】,错误信息:【{ex.Message}】", "UpdatePosition");
            //Console.WriteLine($"UpdatePosition 更新任务位置失败,任务号:【{taskNum}】,错误信息:【{ex.Message}】");
        }
        return null;
    }
@@ -208,7 +220,7 @@
        }
        catch (Exception ex)
        {
            Console.WriteLine($"UpdatePosition 更新任务位置失败,任务号:【{taskNum}】,错误信息:【{ex.Message}】");
            QuartzLogHelper.LogError(Logger.None, $"UpdatePosition 更新任务位置失败,任务号:【{taskNum}】,错误信息:【{ex.Message}】", "UpdatePosition");
        }
        return null;
    }