
package org.nl.acs.ext.wms.rest;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.ext.wms.liKuData.*;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.enums.InterfaceLogType;
import org.nl.common.logging.annotation.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ludj
 * @date 2021-07-21
 **/
@RestController
@RequiredArgsConstructor
@Api(tags = "立库接口")
@RequestMapping("/api/liku")
@Slf4j
public class AcsToLiKuController {
    private final AcsToLiKuService acsToLiKuService;

    @PostMapping("/inStore")
    @Log(value = "下发立库入库任务")
    @ApiOperation("下发立库物料入库任务")
    public ResponseEntity<Object> inStore(@RequestBody InStoreRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.inStore(requestParam), HttpStatus.OK);
    }

    @PostMapping("/outStore")
    @Log(value = "下发立库出库任务")
    @ApiOperation("下发立库出库任务")
    public ResponseEntity<Object> outStore(@RequestBody OutStoreRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.outStore(requestParam), HttpStatus.OK);
    }

    @PostMapping("/emptyVehicleOutStore")
    @Log(value = "下发立库空盘出库任务")
    @ApiOperation("下发立库空盘出库任务")
    public ResponseEntity<Object> emptyVehicleOutStore(@RequestBody EmptyVehicleOutStoreRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.emptyVehicleOutStore(requestParam), HttpStatus.OK);
    }

    @PostMapping("/moveStore")
    @Log(value = "下发立库移库任务")
    @ApiOperation("下发立库移库任务")
    public ResponseEntity<Object> moveStore(@RequestBody MoveStoreRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.moveStore(requestParam), HttpStatus.OK);
    }

    @PostMapping("/inStoreReset")
    @Log(value = "下发立库入库任务调整")
    @ApiOperation("下发立库入库任务调整")
    public ResponseEntity<Object> inStoreReset(@RequestBody InStoreResetRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.inStoreReset(requestParam), HttpStatus.OK);
    }

    @PostMapping("/moveStoreReset")
    @Log(value = "下发立库移库任务调整")
    @ApiOperation("下发立库移库任务调整")
    public ResponseEntity<Object> moveStoreReset(@RequestBody MoveStoreResetRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.moveStoreReset(requestParam), HttpStatus.OK);
    }

    @PostMapping("/roadWayIsLock")
    @Log(value = "下发立库巷道锁定或解锁")
    @ApiOperation("向立库下发巷道锁定或解锁")
    public ResponseEntity<Object> roadWayIsLock(@RequestBody RoadWayIsLockRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.roadWayIsLock(requestParam), HttpStatus.OK);
    }

    @PostMapping("/cancelTask")
    @Log(value = "取消立库任务")
    @ApiOperation("取消立库任务")
    public ResponseEntity<Object> cancelTask(@RequestBody CancelTaskRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.cancelTask(requestParam), HttpStatus.OK);
    }

    @PostMapping("/queryCarStatus")
    @Log(value = "查询四向车状态")
    @ApiOperation("查询四向车状态")
    public ResponseEntity<Object> queryCarStatus(@RequestBody DeviceStatusRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.queryCarDeviceStatus(requestParam), HttpStatus.OK);
    }

    @PostMapping("/queryTsjStatus")
    @Log(value = "查询提升机状态")
    @ApiOperation("查询提升机状态")
    public ResponseEntity<Object> queryTsjStatus(@RequestBody DeviceStatusRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.queryTsjDeviceStatus(requestParam), HttpStatus.OK);
    }

    @PostMapping("/querySsxStatus")
    @Log(value = "查询提升机状态")
    @ApiOperation("查询提升机状态")
    public ResponseEntity<Object> querySsxStatus(@RequestBody DeviceStatusRequest requestParam) {
        return new ResponseEntity<>(acsToLiKuService.queryTsjDeviceStatus(requestParam), HttpStatus.OK);
    }

}
