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.InboundOtherService;
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;
import java.util.Map;


@Api(tags = "其他入库单API接口")
@RestController
@RequestMapping("/ivt/inbound_other")
public class InboundOtherController {

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

    @Autowired
    private InboundOtherService inboundOtherService;

    @Autowired
    private InboundService inboundService;



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

    /**
     * @desc : 查看来源单据,总单加明细  采购入库用
     * @author : 姜永辉
     * @date : 2024/3/6 10:36
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO selectById(@PathVariable String id) {
        return inboundService.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>> selectOtherInboundItemInfoById(@PathVariable String id) {
        return inboundOtherService.selectOtherInboundItemInfoById(id);
    }


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


    /**
     * @desc   : 其他入库办理
     * @date   : 2024/3/7 15:34
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "其他入库办理",
            notes = "其他入库办理"
    )
    @PostMapping({"inbound_handle"})
    public ResponseResultVO<?> otherHandleInbound(@Valid @RequestBody InboundVO inboundVO) {
        return inboundOtherService.otherHandleInbound(inboundVO);
    }



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

    /**
     * @desc   : 其他入库编辑
     * @date   : 2024/3/26 9:51
     * @author : 寇珊珊
     */
    @ApiOperation(
            value = "其他入库编辑",
            notes = "其他入库编辑"
    )
    @PostMapping({"inbound_update"})
    public ResponseResultVO<?> otherInboundUpdate(@Valid @RequestBody InboundVO inboundVO) {
        return inboundOtherService.otherInboundUpdate(inboundVO);
    }

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



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



    /**
     * @desc   : 条件查询 --- web端入库办理用
     * @date   : 2024/3/7 14:09
     * @author : 寇珊珊
     */
    @ApiOperation(value = "条件查询", notes = "条件查询")
    @PostMapping({"select_inbound"})
    public ResponseResultVO<PageList<InboundResponse>> selectInbound(@Valid @RequestBody InboundQuery inboundQuery) {
        return inboundOtherService.selectInbound(inboundQuery);
    }

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

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

}
