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

import com.prolog.cs.biz.outbound.model.SYZJPrintAgain;
import com.prolog.cs.biz.outbound.model.dto.OmsDoBillDDTO;
import com.prolog.cs.biz.outbound.model.entity.OmsDoBillDDO;
import com.prolog.cs.biz.outbound.service.IOmsDoBillDService;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.pojo.Page;
import com.prolog.framework.log.aop.annotation.UserLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;

@Api(tags = "出库单行")
@RestController
@RequestMapping("/outboundOrderLine")
public class OmsDoBillDController {

    @Autowired
    private IOmsDoBillDService iOmsDoBillDService;

    @UserLog
    @ApiOperation(value = "查询出库单行")
    @PostMapping("/queryDoBillDList")
    public RestMessage<Page<OmsDoBillDDO>> queryDoBillDList(@RequestBody OmsDoBillDDO omsDoBillDDO) {
        return RestMessage.success("操作成功", iOmsDoBillDService.queryDoBillDList(omsDoBillDDO));
    }

    @UserLog
    @ApiOperation(value = "保存出库单行")
    @PostMapping("/saveDoBillD")
    public RestMessage<Boolean> saveDoBillD(@RequestBody OmsDoBillDDTO omsDoBillDDTO) {
        Boolean result = iOmsDoBillDService.saveDoBillD(omsDoBillDDTO);
        return RestMessage.doSuccess(result);
    }

    @UserLog
    @ApiOperation(value = "首营资料补打")
    @PostMapping("/PrintAgainSY")
    public RestMessage<Object> PrintAgainSY(@RequestBody List<SYZJPrintAgain> list) {
        iOmsDoBillDService.PrintAgainSY(list);
        return RestMessage.success("补打成功", null);
    }

    @UserLog
    @ApiOperation(value = "质检报告补打")
    @PostMapping("/PrintAgainZJ")
    public RestMessage<Object> PrintAgainZJ(@RequestBody List<SYZJPrintAgain> list) {
        iOmsDoBillDService.PrintAgainZJ(list);
        return RestMessage.success("补打成功", null);
    }
}
