package com.prolog.eis.controller.dps;


import com.prolog.eis.dto.dps.DpsSendListDto;
import com.prolog.eis.dto.wcs.WcsCarDto;
import com.prolog.eis.dto.wcs.WcsCarryBackDto;
import com.prolog.eis.dto.wcs.WcsGirdDto;
import com.prolog.eis.service.logic.WcsTaskService;
import com.prolog.eis.utils.DpsResult;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.fx.inf.core.InterfaceType;
import com.prolog.fx.inf.core.annotation.InterfaceMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
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;

import javax.validation.Valid;

@RequiredArgsConstructor
@RestController
@Slf4j
@Validated
@Api(tags = "Dps接口服务")
@RequestMapping(value = "api/v1/dps")
public class DpsController {

    private final WcsTaskService wcsTaskService;

    @ApiOperation(value = "dps拍灯回告", notes = "dps拍灯回告")
    @PostMapping(value = "/exeuteTaskReported")
    @InterfaceMethod(key = "dps拍灯回告", name = "DPS->EIS拍灯回告", type = InterfaceType.Receive)
    public DpsResult exeuteTaskReported(@Valid @RequestBody DpsSendListDto dpsSendListDto) {
        try {
            wcsTaskService.exeuteTaskReported(dpsSendListDto);
            return DpsResult.newInstance(true, "0", "回告成功", null);
        }catch (Exception e) {
            log.error("dps拍灯拣选回告拍灯失败" + e.getMessage(), e);
            return DpsResult.newInstance(false, "-1", "回告异常："+e.getMessage());
        }
    }

}
