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.StockPurchaseReceiptReport;
import com.yh.saas.plugin.yiliangyiyun.service.IStockPurchaseReceiptReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 现货采购入库报表 前端控制器
 * </p>
 *
 * @author Gdc
 * @since 2021-09-17
 */
@RestController
@RequestMapping("/stockPurchaseReceiptReport")
public class StockPurchaseReceiptReportController {

    @Autowired
    private IStockPurchaseReceiptReportService stockPurchaseReceiptReportService;
    /**
     * 采购入库统计列表
     * @param stockPurchaseReceiptReport
     * @return
     */
    @GetMapping("/selectPurchaseOrder")
    public Page<StockPurchaseReceiptReport> selectPurchaseOrder(StockPurchaseReceiptReport stockPurchaseReceiptReport){
        return stockPurchaseReceiptReportService.selectPurchaseOrder(stockPurchaseReceiptReport);
    }
    /**
     * 定金/备注
     *
     * @param contractManagementInfo
     * @return
     */
    @PostMapping("/api/disAndRemark")
    public  String disAndRemark(@RequestBody ContractManagementInfo contractManagementInfo){
        return stockPurchaseReceiptReportService.disAndRemark(contractManagementInfo);
    }
    /**
     * 修改结算重量
     *
     * @param stockPurchaseReceiptReport
     * @return
     */
    @PostMapping("/api/edit")
    public  String edit(@RequestBody StockPurchaseReceiptReport stockPurchaseReceiptReport){
        return stockPurchaseReceiptReportService.edit(stockPurchaseReceiptReport);
    }

    /**
     * 出纳付款
     * @param stockPurchaseReceiptReport
     * @return
     */
    @PostMapping("/api/payMoney")
    public String payMoney(@RequestBody StockPurchaseReceiptReport stockPurchaseReceiptReport){
        return stockPurchaseReceiptReportService.payMoney(stockPurchaseReceiptReport);
    }
    /**
     * 合同编号下拉列表
     * @param compId
     * @return
     */
    @GetMapping("/selectContractNoList")
    public List<ContractManagementInfo> selectContractNoList(String compId) {
        return stockPurchaseReceiptReportService.selectContractNoList(compId);
    }
    /**
     * 查看
     */
    @GetMapping("/getInfo")
    public StockPurchaseReceiptReport getInfo(@RequestParam String id) {
        return stockPurchaseReceiptReportService.getInfo(id);
    }
    /**
     * 导出
     *
     * @return
     * @throws Exception
     */
    @PostMapping("/export")
    public void export(@RequestBody StockPurchaseReceiptReport example, HttpServletResponse response) throws Exception {
        stockPurchaseReceiptReportService.export(example,response);
    }
}

