dengjunjie
2024-11-06 36230cd4dd0ebe5d21eede3eff6216908f7f7a8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_TaskInfoService;
 
namespace WIDESEAWCS_TaskInfoService
{
    public partial class TaskService
    {
        /// <summary>
        /// 更新AGV任务状态
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        public WebResponseContent AGVUpdateTaskState(AGVUpdateTaskDTO saveModel)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                if (saveModel == null) throw new Exception("更新任务信息为空");
                Dt_Task dt_Task = GetTaskInfo(Convert.ToInt32(saveModel.outID));
                if (dt_Task == null) throw new Exception($"未找到任务号为【{saveModel.outID}】的任务");
                dt_Task.TaskState = saveModel.status switch
                {
                    "02" => (int)TaskInStatusEnum.AGV_InExecuting,
                    "08" => (int)TaskInStatusEnum.AGV_InFinish,
                    _ => throw new Exception($"未定义任务状态【{saveModel.status}】"),
                };
                content = UpdateData(dt_Task);
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
            //return new AGVReturnInfo()
            //{
            //    code = content.Status ? "20000" : "90000",
            //    message = content.Message,
            //};
        }
    }
}