package com.yh.saas.plugin.yiliangyiyun.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.yh.saas.plugin.yiliangyiyun.entity.ContractManagementInfo;
import com.yh.saas.plugin.yiliangyiyun.entity.PurchaseOrder;
import com.yh.saas.plugin.yiliangyiyun.entity.PurchaseReceiptReport;
import com.yh.saas.plugin.yiliangyiyun.service.IPurchaseReceiptReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 采购入库报表 前端控制器
 * </p>
 *
 * @author Gongdc
 * @since 2021-07-31
 */
@RestController
@RequestMapping("/purchaseReceiptReport")
public class PurchaseReceiptReportController {

    @Autowired
    private IPurchaseReceiptReportService purchaseReceiptReportService;
    /**
     * 采购入库统计列表
     * @param purchaseReceiptReport
     * @return
     */
    @GetMapping("/selectPurchaseOrder")
    public Page<PurchaseReceiptReport> selectPurchaseOrder(PurchaseReceiptReport purchaseReceiptReport){
        return purchaseReceiptReportService.selectPurchaseOrder(purchaseReceiptReport);
    }
    /**
     * 编辑采购入库统计
     * @param purchaseReceiptReport
     * @return
     */
    @PostMapping("/api/editProcurementReceiptReport")
    public String editProcurementReceiptReport(@RequestBody PurchaseReceiptReport purchaseReceiptReport){
        return purchaseReceiptReportService.editProcurementReceiptReport(purchaseReceiptReport);
    }

    /**
     * 补货结转
     * @param purchaseReceiptReport
     * @return
     */
    @PostMapping("/api/replenishment")
    public String replenishment(@RequestBody PurchaseReceiptReport purchaseReceiptReport){
        return purchaseReceiptReportService.replenishment(purchaseReceiptReport);
    }

    /**
     * 出纳付款
     * @param purchaseReceiptReport
     * @return
     */
    @PostMapping("/api/payMoney")
    public String payMoney(@RequestBody PurchaseReceiptReport purchaseReceiptReport){
        return purchaseReceiptReportService.payMoney(purchaseReceiptReport);
    }
    /**
     * 开发票
     * @param purchaseReceiptReport
     * @return
     */
    @PostMapping("/api/openInvoice")
    public String openInvoice(@RequestBody PurchaseReceiptReport purchaseReceiptReport) {
        return purchaseReceiptReportService.openInvoice(purchaseReceiptReport);
    }
    /**
     * 批量开发票
     * @param purchaseReceiptReport
     * @return
     */
    @PostMapping("/api/openInvoiceList")
    public String openInvoiceList(@RequestBody PurchaseReceiptReport purchaseReceiptReport) {
        return purchaseReceiptReportService.openInvoiceList(purchaseReceiptReport);
    }
    /**
     * 审核采购入库报表
     * @param purchaseReceiptReport
     * @return
     */
    @PostMapping("/api/examinePurchaseOrder")
    public String examinePurchaseOrder(@RequestBody PurchaseReceiptReport purchaseReceiptReport){
        return purchaseReceiptReportService.examinePurchaseOrder(purchaseReceiptReport);
    }
    /**
     * 合同编号下拉列表
     * @param compId
     * @return
     */
    @GetMapping("/selectContractNoList")
    public List<ContractManagementInfo> selectContractNoList(String compId) {
        return purchaseReceiptReportService.selectContractNoList(compId);
    }
    /**
     * 查采购订单表
     * @param purchaseReceiptReport
     */
    @GetMapping("/selectOrder")
    public PurchaseOrder selectOrder(PurchaseReceiptReport purchaseReceiptReport){
        return purchaseReceiptReportService.selectOrder(purchaseReceiptReport);
    }
    /**
     * 根据客户名查合同编号
     * @param customerName,contractNo
     * @return
     */
    @GetMapping("/selectContractNo")
    public List<PurchaseReceiptReport> selectContractNo(String customerName,String contractNo) {
        return purchaseReceiptReportService.selectContractNo(customerName,contractNo);
    }
    /**
     * 查看
     */
    @GetMapping("/getInfo")
    public PurchaseReceiptReport getInfo(@RequestParam String id) {
        return purchaseReceiptReportService.getInfo(id);
    }

}

