using DS.Module.Core;
using DS.Module.Core.Attributes;
using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace DS.WMS.TaskApi.Controllers;
///
/// 任务台相关接口
///
public class TaskManageController : ApiController
{
private readonly ITaskManageService taskManageService;
public TaskManageController(ITaskManageService taskManageService)
{
this.taskManageService = taskManageService;
}
///
/// 创建任务
///
/// 任务详情
/// 返回回执
[HttpPost("CreateTaskJob")]
[ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous]
public async Task CreateTaskJob(TaskManageOrderMessageInfo info)
{
var result = await taskManageService.InitTaskJob(info);
return result;
}
///
/// 创建BC任务
///
/// 文件
/// BC变更内容后文件
/// BC任务详情JSON
/// 返回回执
[HttpPost("CreateBCTaskJob")]
[ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous]
public async Task CreateBCTaskJob(IFormFile file, IFormFile modifyFile, [FromForm] string jsonData)
{
TaskManageOrderMessageInfo? info = JsonConvert.DeserializeObject(jsonData);
if (info == null)
{
throw new ArgumentException(nameof(jsonData));
}
var result = await taskManageService.InitTaskJob(info, file, modifyFile);
return result;
}
// /TaskManage/CreateBCTaskJob
// /TaskManage/CreateDRAFTTaskJob
// /TaskManage/CreateAdvisoryTaskJob
// /TaskManage/CreateDRAFTTaskJob
}