package com.fjhx.mes.controller.production;

import com.fjhx.mes.entity.production.dto.ProductionSchedulingDto;
import com.fjhx.mes.entity.production.dto.ProductionSchedulingSelectDto;
import com.fjhx.mes.entity.production.po.ProductionScheduling;
import com.fjhx.mes.entity.production.vo.ProductionSchedulingVo;
import com.fjhx.mes.service.production.ProductionSchedulingService;
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;
import java.util.Map;

/**
 * <p>
 * 生产排程 前端控制器
 * </p>
 *
 * @author
 * @since 2024-02-03
 */
@RestController
@RequestMapping("/productionScheduling")
public class ProductionSchedulingController {

    @Autowired
    private ProductionSchedulingService productionSchedulingService;

    /**
     * 生产排程列表
     */
    @PostMapping("/listMap")
    public Map<String, List<ProductionSchedulingVo>> listMap(@RequestBody ProductionSchedulingSelectDto dto) {
        return productionSchedulingService.listMap(dto);
    }

    /**
     * 生产排程新增
     */
    @PostMapping("/add")
    public void add(@RequestBody List<ProductionScheduling> dtoList) {
        productionSchedulingService.add(dtoList);
    }

    /**
     * 生产排程编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ProductionSchedulingDto productionSchedulingDto) {
        productionSchedulingService.edit(productionSchedulingDto);
    }

    /**
     * 生产排程删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        productionSchedulingService.delete(dto.getId());
    }

}
