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,
|
//};
|
}
|
}
|
}
|