package com.fjhx.jxst.controller.sales;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.jxst.entity.sales.dto.SalesContractDto;
import com.fjhx.jxst.entity.sales.dto.SalesContractSelectDto;
import com.fjhx.jxst.entity.sales.vo.SalesContractDetailsVo;
import com.fjhx.jxst.entity.sales.vo.SalesContractVo;
import com.fjhx.jxst.service.sales.SalesContractService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * <p>
 * 销售合同 前端控制器
 * </p>
 *
 * @author
 * @since 2023-05-16
 */
@RestController
@RequestMapping("/salesContract")
public class SalesContractController {

    @Autowired
    private SalesContractService salesContractService;

    /**
     * 销售合同分页
     */
    @PostMapping("/page")
    public Page<SalesContractVo> page(@RequestBody SalesContractSelectDto dto) {
        return salesContractService.getPage(dto);
    }

    /**
     * 销售合同明细
     */
    @PostMapping("/detail")
    public SalesContractVo detail(@RequestBody BaseSelectDto dto) {
        return salesContractService.detail(dto.getId());
    }

    /**
     * 销售合同新增
     */
    @PostMapping("/add")
    public void add(@RequestBody SalesContractDto salesContractDto) {
        salesContractService.add(salesContractDto);
    }

    /**
     * 合同结清
     */
    @PostMapping("/settle")
    public void settle(@RequestBody SalesContractDto dto) {
        salesContractService.settle(dto);
    }

    /**
     * 销售出库分页
     *
     * @return
     */
    @PostMapping("/salesDeliveryList")
    List<SalesContractDetailsVo> salesDeliveryList(@RequestBody SalesContractDto dto){
        return salesContractService.salesDeliveryList(dto);
    }

    /**
     * 销售出库
     */
    @PostMapping("/salesDelivery")
    void salesDelivery(@RequestBody SalesContractDto dto){
        salesContractService.salesDelivery(dto);
    }

}
