| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using System.Threading.Tasks; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseController; |
| | | using WIDESEAWCS_DTO.BasicInfo; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | |
| | | public class TaskController : ApiBaseController<ITaskService, Dt_Task> |
| | | { |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor) : base(service) |
| | | private readonly IOrderDetailsService _orderDetailsService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | |
| | | public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IOrderDetailsService orderDetailsService, ITaskRepository taskRepository) : base(service) |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | _orderDetailsService = orderDetailsService; |
| | | _taskRepository = taskRepository; |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("CreateTask"), AllowAnonymous] |
| | |
| | | { |
| | | return Service.PlaceBlockTest(orderRowId); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("GenerateTask"), AllowAnonymous] |
| | | public Dt_Task GenerateTask(string barcode) |
| | | { |
| | | OrderInfo orderInfo = _orderDetailsService.GetOrderInfoByBarcode(barcode); |
| | | |
| | | var (flag, task, message) = Service.GenerateTask(orderInfo); |
| | | if (flag && task != null) |
| | | return task; |
| | | else |
| | | return new Dt_Task(); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("TaskComplete"), AllowAnonymous] |
| | | public WebResponseContent TaskComplete(int taskNum) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºä»»å¡ä¿¡æ¯"); |
| | | } |
| | | return Service.TaskComplete(task); |
| | | } |
| | | } |
| | | } |