package com.wms_main.controller.wms;

import com.wms_main.model.dto.request.wcs.WcsTaskResultRequest;
import com.wms_main.model.dto.request.wcs.WcsVehicleInRequest;
import com.wms_main.model.dto.response.wcs.BaseWcsApiResponse;
import com.wms_main.model.dto.response.wcs.WcsVehicleInResponse;
import com.wms_main.service.controller.ITaskControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 任务控制类
 */
@RestController
@ResponseBody
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/wms/task")
public class TaskController {
    private final ITaskControllerService taskControllerService;

    @PostMapping("/wcsRequestVehicleIn")
    public WcsVehicleInResponse requireInTask(@RequestBody WcsVehicleInRequest request) {
        return taskControllerService.requireInTask(request);
    }

    /**
     * 接收wcs反馈任务状态
     * @param wcsTaskResultRequest 请求信息
     * @return 处理结果
     */
    @PostMapping("/sendTaskResult")
    public BaseWcsApiResponse sendTaskResult(@RequestBody WcsTaskResultRequest wcsTaskResultRequest) {
        return taskControllerService.sendTaskResult(wcsTaskResultRequest);
    }
}
