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


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.Outbound;
import com.dk.mdm.model.query.ivt.OutboundQuery;
import com.dk.mdm.model.response.ivt.InboundResponse;
import com.dk.mdm.model.response.ivt.OutboundResponse;
import com.dk.mdm.model.vo.ivt.OutboundVO;
import com.dk.mdm.service.ivt.outbound.OutboundSaleReturnService;
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;
import java.util.Map;


@Api(tags = "销售退货出库单API接口")
@RestController
@RequestMapping("/ivt/outbound_sale_return")
public class OutboundSaleReturnController {

    public BaseService<Outbound> getService() {
        return outboundSaleReturnService;
    }

    @Autowired
    private OutboundSaleReturnService outboundSaleReturnService;

    /**
     * @desc :  销售退货出库新建
     * @date : 2024/3/18 15:22
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "销售退货出库新建",
            notes = "销售退货出库新建"
    )
    @PostMapping({"outbound_insert"})
    public ResponseResultVO<?> saleReturnOutboundInsert(@Valid @RequestBody OutboundVO outboundVO) {
        return outboundSaleReturnService.saleReturnOutboundInsert(outboundVO);
    }

    /**
     * @desc : 销售退货出库办理
     * @date : 2024/3/18 15:22
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "销售退货出库办理",
            notes = "销售退货出库办理"
    )
    @PostMapping({"handle_outbound"})
    public ResponseResultVO<?> saleReturnHandleOutbound(@Valid @RequestBody OutboundVO outboundVO) {
        return outboundSaleReturnService.saleReturnHandleOutbound(outboundVO);
    }

    /**
     * @desc : 销售退货出库撤销
     * @date : 2024/3/18 15:22
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "销售退货出库撤销",
            notes = "销售退货出库撤销"
    )
    @PostMapping({"outbound_cancel"})
    public ResponseResultVO<?> saleReturnOutboundCancel(@Valid @RequestBody OutboundVO outboundVO) {
        return outboundSaleReturnService.saleReturnOutboundCancel(outboundVO);
    }

    /**
     * @desc   : 销售出库退货编辑
     * @date   : 2024/3/26 9:51
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "销售出库退货编辑",
            notes = "销售出库退货编辑"
    )
    @PostMapping({"outbound_update"})
    public ResponseResultVO<?> otherOutboundUpdate(@Valid @RequestBody OutboundVO outboundVO) {
        return outboundSaleReturnService.saleReturnOutboundUpdate(outboundVO);
    }

    /**
     * @desc   : 销售出库退货作废
     * @date   : 2024/3/26 9:51
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "销售出库退货作废",
            notes = "销售出库退货作废"
    )
    @PostMapping({"repeal/{id}"})
    public ResponseResultVO<?> otherOutboundRepeal(@PathVariable String id) {
        return outboundSaleReturnService.saleReturnOutboundRepeal(id);
    }

    /********************************************** 销售退货查询相关方法begin *************************************/
    /**
     * @desc : 一览页退货出库
     * @author : 付斌
     * @date : 2023/1/9 10:36
     */
    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
    @PostMapping({"list_by"})
    public ResponseResultVO<PageList<OutboundResponse>> selectByCond(@RequestBody OutboundQuery outboundQuery) {
        return outboundSaleReturnService.selectByCond(outboundQuery);
    }

    /**
     * @desc : 一览页销售退货明细（货物、附件）
     * @author : 付斌
     * @date : 2024-03-07 16:36
     */
    @PostMapping({"select_outbound_info_by_id/{id}"})
    public ResponseResultVO<Map<String, Object>> selectOutboundInfoById(@PathVariable String id) {
        return outboundSaleReturnService.selectOutboundInfoById(id);
    }
    /**
     * @desc : 获取销售退货信息（编辑用）
     * @author : 付斌
     * @date : 2024-03-03 9:28
     */
    @ApiOperation(value = "编辑出库单", notes = "编辑出库单")
    @PostMapping({"get_out_return_for_update/{id}"})
    public ResponseResultVO<?> getOutReturnForUpdate(@PathVariable String id) {
        return outboundSaleReturnService.getOutReturnForUpdate(id);
    }
    /********************************************** 销售退货查询相关方法end *************************************/

//    /**
//     * @desc : 条件查询
//     * @date : 2024/3/18 15:23
//     * @author : 寇珊珊
//     */
//    @ApiOperation(value = "条件查询", notes = "条件查询")
//    @PostMapping({"list_by"})
//    public ResponseResultVO<PageList<InboundResponse>> selectByCond(@RequestBody OutboundQuery outboundQuery) {
//        return outboundSaleReturnService.selectByCond(outboundQuery);
//    }
//
//    /**
//     * @desc : 明细信息条件查询
//     * @date : 2024/3/18 15:23
//     * @author : 寇珊珊
//     */
//    @ApiOperation(value = "明细信息条件查询", notes = "明细信息条件查询")
//    @PostMapping({"select_item_info_by_id/{id}"})
//    public ResponseResultVO<Map<String, Object>> selectOutBoundSaleReturnItemInfoById(@PathVariable String id) {
//        return outboundSaleReturnService.selectOutBoundSaleReturnItemInfoById(id);
//    }
//
//    /**
//     * @desc : 获取单据信息（编辑用）
//     * @date : 2024/3/18 15:22
//     * @author : 寇珊珊
//     */
//    @ApiOperation(value = "获取单据信息（编辑用）", notes = "获取单据信息（编辑用）")
//    @PostMapping({"select_by_update/{id}"})
//    public ResponseResultVO<?> selectByUpdate(@PathVariable String id) {
//        return outboundSaleReturnService.selectByUpdate(id);
//    }

}
