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


import com.baomidou.mybatisplus.plugins.Page;
import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePrice;
import com.yh.saas.plugin.yiliangyiyun.entity.QualityInspectionManagement;
import com.yh.saas.plugin.yiliangyiyun.service.IQualityInspectionManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 记录质检管理数据信息 前端控制器
 * </p>
 *
 * @author Gdc
 * @since 2021-09-06
 */
@RestController
@RequestMapping("/qualityInspectionManagement")
public class QualityInspectionManagementController {
    @Autowired
    private IQualityInspectionManagementService qualityInspectionManagementService;
    /**
     * 质检管理列表
     * @param qualityInspectionManagement
     * @return
     */
    @GetMapping("/selectQualityInspection")
    public Page<QualityInspectionManagement> selectQualityInspection(QualityInspectionManagement qualityInspectionManagement) {
        return qualityInspectionManagementService.selectQualityInspection(qualityInspectionManagement);
    }
    /**
     * 删除质检管理信息
     *  @param qualityInspectionManagement
     * @return
     */
    @PostMapping("/api/deleteQualityInspection")
    public void deleteQualityInspection(@RequestBody QualityInspectionManagement qualityInspectionManagement) {
        qualityInspectionManagementService.deleteQualityInspection(qualityInspectionManagement.getId());
    }
    /**
     * 查看质检管理信息
     *  @param id
     * @return
     */
    @GetMapping("/api/getQualityInspection")
    public QualityInspectionManagement getQualityInspection(@RequestParam String id) {
         return qualityInspectionManagementService.getQualityInspection(id);
    }
    /**
     * 添加质检管理信息
     *  @param qualityInspectionManagement
     * @return
     */
    @PostMapping("/api/addQualityInspection")
    public String addQualityInspection(@RequestBody QualityInspectionManagement qualityInspectionManagement) {
        return qualityInspectionManagementService.addQualityInspection(qualityInspectionManagement);
    }
    /**
     * 编辑质检管理信息
     *  @param qualityInspectionManagement
     * @return
     */
    @PostMapping("/api/editQualityInspection")
    public String editQualityInspection(@RequestBody QualityInspectionManagement qualityInspectionManagement) {
        return qualityInspectionManagementService.editQualityInspection(qualityInspectionManagement);
    }
    /**
     * 货名下拉列表
     *  @param warehouseId
     * @return
     */
    @GetMapping("/api/goodsName")
    public List<PurchasePrice> goodsName(@RequestParam String warehouseId) {
        return qualityInspectionManagementService.goodsName(warehouseId);
    }
    /**
     * 出库管理添加质检管理信息
     *  @param qualityInspectionManagement
     * @return
     */
    @PostMapping("/api/addQualityInspectionOut")
    public String addQualityInspectionOut(@RequestBody QualityInspectionManagement qualityInspectionManagement) {
        return qualityInspectionManagementService.addQualityInspectionOut(qualityInspectionManagement);
    }
    /**
     * 查客户待结算数量
     */
    @GetMapping("/api/settledCount")
    public Integer settledCount(QualityInspectionManagement qualityInspectionManagement){
        return qualityInspectionManagementService.settledCount(qualityInspectionManagement);
    }
    /**
     * 导入
     *  @param qualityInspectionManagement
     * @return
     */
    @PostMapping("/api/importQuality")
    public String importQuality(@RequestBody QualityInspectionManagement qualityInspectionManagement) {
        return qualityInspectionManagementService.importQuality(qualityInspectionManagement);
    }

}

