package com.fjhx.mes.controller.production;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.common.constant.SourceConstant;
import com.fjhx.mes.entity.production.dto.ProductionReportingDto;
import com.fjhx.mes.entity.production.dto.ProductionReportingSelectDto;
import com.fjhx.mes.entity.production.po.ProductionReportingDetail;
import com.fjhx.mes.entity.production.vo.ProductionReportingVo;
import com.fjhx.mes.service.production.ProductionReportingService;
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-03-30
 */
@DS(SourceConstant.MES)
@RestController
@RequestMapping("/productionReporting")
public class ProductionReportingController {

    @Autowired
    private ProductionReportingService productionReportingService;

    /**
     * 生产报工分页
     */
    @PostMapping("/page")
    public Page<ProductionReportingVo> page(@RequestBody ProductionReportingSelectDto dto) {
        return productionReportingService.getPage(dto);
    }

    /**
     * 生产报工明细
     */
    @PostMapping("/detail")
    public ProductionReportingVo detail(@RequestBody BaseSelectDto dto) {
        return productionReportingService.detail(dto.getId());
    }

    /**
     * 生产报工新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ProductionReportingDto productionReportingDto) {
        productionReportingService.add(productionReportingDto);
    }

    /**
     * 生产报工编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ProductionReportingDto productionReportingDto) {
        productionReportingService.edit(productionReportingDto);
    }

    /**
     * 生产报工删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        productionReportingService.delete(dto.getId());
    }

}
