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.InboundQuery;
import com.dk.mdm.model.query.ivt.OutboundQuery;
import com.dk.mdm.model.response.ivt.InboundResponse;
import com.dk.mdm.model.vo.ivt.InboundVO;
import com.dk.mdm.model.vo.ivt.OutboundVO;
import com.dk.mdm.service.ivt.inbound.InboundService;
import com.dk.mdm.service.ivt.outbound.OutboundOtherService;
import com.dk.mdm.service.ivt.outbound.OutboundService;
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_other")
public class OutboundOtherController {

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

    @Autowired
    private OutboundOtherService outboundOtherService;

    @Autowired
    private OutboundService outboundService;



    /**
     * @desc   : 条件查询
     * @date   : 2024/3/7 14:09
     * @author : 寇珊珊
     */
    @ApiOperation(value = "条件查询", notes = "条件查询")
    @PostMapping({"list_by"})
    public ResponseResultVO<PageList<InboundResponse>> selectByCond(@Valid @RequestBody OutboundQuery outboundQuery) {
        return outboundOtherService.selectByCond(outboundQuery);
    }

    /**
     * @desc : 查询出库明细（货物、附件）
     * @author : 付斌
     * @date : 2024/3/6 10:36
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO selectById(@PathVariable String id) {
        return outboundService.selectById(id);
    }

    /**
     * @desc   : 查询明细信息
     * @date   : 2024/3/9 15:45
     * @author : 寇珊珊
     */
    @ApiOperation(value = "明细信息条件查询", notes = "明细信息条件查询")
    @PostMapping({"select_item_info_by_id/{id}"})
    public ResponseResultVO<Map<String, Object>> selectOutboundOtherItemInfoById(@PathVariable String id) {
        return outboundOtherService.selectOutboundOtherItemInfoById(id);
    }


    /**
     * @desc   : 其他出库新建
     * @date   : 2024/3/7 14:00
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "其他出库新建",
            notes = "其他出库新建"
    )
    @PostMapping({"outbound_insert"})
    public ResponseResultVO<?> otherOutboundInsert(@Valid @RequestBody OutboundVO outboundVO) {
        return outboundOtherService.otherOutboundInsert(outboundVO);
    }


    /**
     * @desc   : 其他出库办理
     * @date   : 2024/3/7 15:34
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "其他出库办理",
            notes = "其他出库办理"
    )
    @PostMapping({"outbound_handle"})
    public ResponseResultVO<?> otherHandleOutbound(@Valid @RequestBody OutboundVO outboundVO) {
        return outboundOtherService.otherHandleOutbound(outboundVO);
    }



    /**
     * @desc   : 其它入库撤销
     * @date   : 2024/3/7 17:06
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "其它入库撤销",
            notes = "其它入库撤销"
    )
    @PostMapping({"outbound_cancel"})
    public ResponseResultVO<?> otherOutboundCancel(@Valid @RequestBody OutboundVO outboundVO){
        return outboundOtherService.otherOutboundCancel(outboundVO);
    }

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

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

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

    /**
     * @desc   : 条件查询 --- web端出库办理用
     * @date   : 2024/3/7 14:09
     * @author : 寇珊珊
     */
    @ApiOperation(value = "条件查询", notes = "条件查询")
    @PostMapping({"select_outbound"})
    public ResponseResultVO<PageList<InboundResponse>> selectOutbound(@Valid @RequestBody OutboundQuery outboundQuery) {
        return outboundOtherService.selectOutbound(outboundQuery);
    }

    /**
     * @desc   : 条件查询 --- web端出库办理用
     * @date   : 2024/3/7 14:09
     * @author : 寇珊珊
     */
    @ApiOperation(value = "明细信息条件查询web端出库办理用", notes = "明细信息条件查询web端出库办理用")
    @PostMapping({"select_outbound_item/{id}"})
    public ResponseResultVO<Map<String, Object>> selectOutboundItem(@PathVariable String id) {
        return outboundOtherService.selectOutboundItem(id);
    }

    /**
     * @desc   : 查询待出库数量（小程序（我的））
     * @date   : 2024/4/9 14:09
     * @author : 周兴
     */
    @ApiOperation(value = "查询待出库数量（小程序（我的））", notes = "查询待出库数量（小程序（我的））")
    @PostMapping({"select_wait_outbound_count"})
    public ResponseResultVO<?> selectWaitOutboundCount(@Valid @RequestBody OutboundQuery outboundQuery) {
        return outboundOtherService.selectWaitOutboundCount(outboundQuery);
    }

}
