package com.dk.mdm.controller.ivt;


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.model.vo.ivt.IntoReturnVO;
import com.dk.mdm.service.ivt.InboundReturnService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Api(tags = "采购退货API接口")
@RestController
@RequestMapping("/ivt/inbound_return")
public class inboundReturnController {

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

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

    /**
     * @desc : 查看来源单据,总单加明细  采购退货用
     * @author : 于继渤
     * @date : 2024/3/6 10:36
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO<?> selectById(@PathVariable String id) {
        return inboundReturnService.selectInboundReturnById(id);
    }



    /**
     * @desc : 新建采购退货
     * @author : 于继渤
     * @date : 2023/1/5 9:39
     */
    @ApiOperation(value = "新建", notes = "新建")
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody InboundVO inboundVO) {
        return inboundReturnService.insert(inboundVO);
    }


    /**
     * @desc : 作废
     * @date : 2022/6/28 16:58
     * @author : 于继渤
     */
    @ApiOperation(
            value = "作废",
            notes = "作废"
    )
    @PostMapping("cancel")
    public ResponseResultVO<String> cancel(@RequestBody InboundVO inboundVO) {
        return inboundReturnService.cancel(inboundVO);
    }


    /**
     * @desc : 编辑
     * @date : 2022/6/28 16:58
     * @author : 于继渤
     */
    @ApiOperation(
            value = "编辑",
            notes = "编辑"
    )
    @PostMapping("update")
    public ResponseResultVO<String> update(@RequestBody InboundVO inboundVO) {
        return inboundReturnService.update(inboundVO);
    }


    /**
     * @desc : 办理
     * @date : 2022/6/28 16:58
     * @author : 于继渤
     */
    @ApiOperation(
            value = "办理",
            notes = "办理"
    )
    @PostMapping("return_handle")
    public ResponseResultVO<String> returnHandle(@RequestBody InboundVO inboundVO) {
        return inboundReturnService.returnHandle(inboundVO);
    }
    /**
     * @desc : 采购退货入库撤销
     * @date : 2022/6/28 16:58
     * @author : 于继渤
     */
    @ApiOperation(
            value = "采购退货入库撤销",
            notes = "采购退货入库撤销"
    )
    @PostMapping({"inbound_return_cancel"})
    public ResponseResultVO<?> inboundReturnCancel(@RequestBody InboundVO inboundVO) {
        return inboundReturnService.inboundReturnCancel(inboundVO);
    }

}
