package com.prolog.cs.biz.outbound.controller;

import com.prolog.cs.biz.outbound.model.dto.FreightEnterDto;
import com.prolog.cs.biz.outbound.model.vo.FreightEnterVo;
import com.prolog.cs.biz.outbound.service.FreightEnterService;
import com.prolog.framework.bz.common.print.PrintData;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.log.aop.annotation.UserLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.annotation.Resource;
import java.util.List;

/**
 * @author cheng.kong
 * @date 2022/8/3   17:01
 */
@Slf4j
@Api(tags = "运费录入")
@RestController
@RequestMapping("/freight")
public class FreightEnterController {

    @Resource
    private FreightEnterService freightEnterService;

    @ApiOperation(value = "查询", notes = "/queryFreightEnter/v1.0")
    @UserLog("查询")
    @PostMapping("/queryFreightEnter")
    public RestMessage<List<FreightEnterDto>> queryFreightEnter(@RequestBody FreightEnterVo vo) {
        List<FreightEnterDto> result = freightEnterService.queryFreightEnter(vo);
        return RestMessage.newInstance(true, "成功", result);
    }

    @ApiOperation(value = "保存", notes = "/saveFreightEnter/v1.0")
    @UserLog("保存")
    @PostMapping("/saveFreightEnter")
    public RestMessage<Boolean> saveFreightEnter(@RequestBody List<FreightEnterDto> vos) {
        Boolean result = freightEnterService.saveFreightEnter(vos);
        return RestMessage.newInstance(true, "成功", result);
    }

//    @UserLog
//    @ApiOperation(value = "物料标签补打")
//    @PostMapping("/labelPrint")
//    public RestMessage<PrintData> labelPrint(@RequestBody TaskPrintAgainVo printAgainVo) {
//        return RestMessage.newInstance(true, "查询成功", pickTaskService.labelPrint(printAgainVo));
//    }

}
