package com.dk.mdm.controller.ivt.inbound;


import com.dk.common.model.pojo.PageList;
import com.dk.common.response.ResponseResultVO;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.pojo.ivt.Inbound;
import com.dk.mdm.model.query.ivt.InboundQuery;
import com.dk.mdm.model.response.ivt.InboundResponse;
import com.dk.mdm.model.vo.ivt.InboundVO;
import com.dk.mdm.service.ivt.inbound.InboundPurchaseService;
import com.dk.mdm.service.ivt.inbound.InboundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


@Api(tags = "入库单API接口")
@RestController
@RequestMapping("/ivt/inbound")
public class InboundController{

    public BaseService<Inbound> getService() {
        return inboundService;
    }

    @Autowired
    private InboundService inboundService;


    @Autowired
    private InboundPurchaseService inheritedPurchaseService;

    /**
     * @desc   : 条件查询
     * @author : 王英杰
     * @date   : 2024/3/8 10:58
     */
    @ApiOperation(
            value = "分页、关联、条件查询",
            notes = "分页、关联、条件查询"
    )
    @PostMapping({"list_by"})
    public ResponseResultVO<PageList<InboundResponse>> selectByCond(@RequestBody InboundQuery inboundQuery) {
        return inboundService.selectByCond(inboundQuery);
    }

    /**
     * @desc : 查看来源单据,总单加明细  采购入库用
     * @author : 王英杰
     * @date : 2024/3/6 10:36
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO selectById(@PathVariable String id) {
        return inboundService.selectById(id);
    }


    /**
     * @desc : 查看来源单据,总单加明细  采购退货用
     * @author : 于继渤
     * @date : 2024/3/6 10:36
     */
    @ApiOperation(value = "条件查询", notes = "条件查询")
    @PostMapping({"select_inbound_and_item"})
    public ResponseResultVO<PageList<InboundResponse>> selectInboundAndItem(@RequestBody InboundQuery inboundQuery) {
        return inboundService.selectInboundAndItem(inboundQuery);
    }
    /**
     * @desc : 新建入库单
     * @author : 王英杰
     * @date : 2024/3/6 10:36
     */
    @ApiOperation(value = "新建出库单", notes = "新建出库单")
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody InboundVO inboundVO) {
        return inboundService.insert(inboundVO);
    }




}
