using System.Net; using DS.Module.Core; using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Op.Dtos.TaskInteraction; using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Interface.TaskInteraction; using Microsoft.AspNetCore.Mvc; namespace DS.WMS.OpApi.Controllers { /// /// 海运出口任务API /// public class SeaExportTaskController : ApiController { readonly ISeaExportTaskService taskService; /// /// 构造函数 /// /// public SeaExportTaskController(ISeaExportTaskService service) { taskService = service; } /// /// 获取指定业务的关联任务 /// /// 业务ID /// 业务类型 /// [HttpGet, Route("GetList")] public async Task>> GetListAsync([FromQuery]long businessId, [FromQuery] BusinessType businessType) { return await taskService.GetTasks(businessId, businessType); } /// /// 创建关联任务 /// /// /// [HttpPost, Route("CreateTask")] public async Task CreateTaskAsync([FromBody] TaskCreationRequest request) { if (!ModelState.IsValid) return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); return await taskService.CreateTaskAsync(request); } /// /// 设置任务状态 /// /// /// [HttpPost, Route("SetTaskStatus")] public async Task> SetTaskStatusAsync([FromBody] TaskUpdateRequest request) { if (!ModelState.IsValid) return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); return await taskService.SetTaskStatusAsync(request); } /// /// 手动发起任务审核(用于二次审核) /// /// /// [HttpPost, Route("SubmitAudit")] public async Task SubmitAuditAsync(TaskRequest request) { return await taskService.SubmitAuditAsync(request); } /// /// 任务审核 /// /// /// [HttpPost, Route("Audit")] public async virtual Task AuditAsync([FromBody] AuditRequest request) { return await taskService.AuditAsync(request); } /// /// 审批完成回调更新(无需客户端手动调用) /// /// 回调信息 /// [HttpPost, Route("UpdateBusiness")] public async Task UpdateBusinessAsync([FromBody] FlowCallback callback) { await taskService.UpdateBusinessAsync(callback); return StatusCode((int)HttpStatusCode.NoContent); } /// /// 通知审批执行人变更(无需客户端手动调用) /// /// 回调信息 /// [HttpPost, Route("MarkerChanged")] public virtual async Task MarkerChangedAsync([FromBody] MarkerChangedCallback callback) { await taskService.MarkerChangedAsync(callback); return StatusCode((int)HttpStatusCode.NoContent); } } }