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.InboundPurchaseReturnService;
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_purchase_return")
public class InboundPurchaseReturnController {

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

    @Autowired
    private InboundPurchaseReturnService inboundPurchaseReturnService;




    /**
     * @desc   : 条件查询
     * @date   : 2024/3/7 14:09
     * @author : 寇珊珊
     */
    @ApiOperation(value = "条件查询", notes = "条件查询")
    @PostMapping({"select_inbound_and_item"})
    public ResponseResultVO<PageList<InboundResponse>> selectInboundAndItem(@RequestBody InboundQuery inboundQuery) {
        return inboundPurchaseReturnService.selectInboundAndItem(inboundQuery);
    }



    /**
     * @desc   : 采购退货入库新建
     * @date   : 2024/3/7 14:00
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "采购退货入库新建",
            notes = "采购退货入库新建"
    )
    @PostMapping({"inbound_insert"})
    public ResponseResultVO<?> purchaseReturnInboundInsert(@Valid @RequestBody InboundVO inboundVO) {
        return inboundPurchaseReturnService.purchaseReturnInboundInsert(inboundVO);
    }


    /**
     * @desc   : 采购退货入库办理
     * @date   : 2024/3/7 15:34
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "采购退货入库办理",
            notes = "采购退货入库办理"
    )
    @PostMapping({"inbound_handle"})
    public ResponseResultVO<?> saleReturnHandleInbound(@RequestBody InboundVO inboundVO) {
        return inboundPurchaseReturnService.saleReturnHandleInbound(inboundVO);
    }



    /**
     * @desc   : 采购退货入库撤销
     * @date   : 2024/3/7 17:06
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "采购退货入库撤销",
            notes = "采购退货入库撤销"
    )
    @PostMapping({"inbound_cancel"})
    public ResponseResultVO<?> saleReturnInboundCancel(@RequestBody InboundVO inboundVO) {
        return inboundPurchaseReturnService.saleReturnInboundCancel(inboundVO);
    }


    /**
     * @desc   : 采购退货入库编辑
     * @date   : 2024/3/26 9:51
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "采购退货入库编辑",
            notes = "采购退货入库编辑"
    )
    @PostMapping({"inbound_update"})
    public ResponseResultVO<?> purchaseInboundUpdate(@Valid @RequestBody InboundVO inboundVO) {
        return inboundPurchaseReturnService.purchaseReturnInboundUpdate(inboundVO);
    }

    /**
     * @desc   : 采购退货入库作废
     * @date   : 2024/3/26 9:51
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "采购退货入库作废",
            notes = "采购退货入库作废"
    )
    @PostMapping({"repeal/{id}"})
    public ResponseResultVO<?> purchaseInboundRepeal(@PathVariable String id) {
        return inboundPurchaseReturnService.purchaseReturnInboundRepeal(id);
    }


    /**
     * @desc   : 获取单据信息（编辑用）
     * @date   : 2024/3/14 16:37
     * @author : 寇珊珊
     */
    @ApiOperation(value = "获取单据信息（编辑用）", notes = "获取单据信息（编辑用）")
    @PostMapping({"select_by_update/{id}"})
    public ResponseResultVO<?> selectByUpdate(@PathVariable String id) {
        return inboundPurchaseReturnService.selectByUpdate(id);
    }
}
