package com.fjhx.mes.controller.production;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.mes.entity.production.dto.ProduceOrderSelectDto;
import com.fjhx.mes.entity.production.dto.ProductionOrderDto;
import com.fjhx.mes.entity.production.vo.ProductionOrderVo;
import com.fjhx.mes.service.production.ProduceOrderService;
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 2024-01-10
 */
@RestController
@RequestMapping("/produceOrder")
public class ProduceOrderController {

    @Autowired
    private ProduceOrderService produceOrderService;

    /**
     * 生产订单分页
     */
    @PostMapping("/page")
    public Page<ProductionOrderVo> page(@RequestBody ProduceOrderSelectDto dto) {
        return produceOrderService.getPage(dto);
    }

    /**
     * 创建生产订单
     */
    @PostMapping("/createOrder")
    public void createOrder(@RequestBody ProductionOrderDto produceOrderDto) {
        produceOrderService.createOrder(produceOrderDto);
    }

    /**
     * 获取排程列表
     *
     * @return
     */
    @PostMapping("/schedulingList")
    public List<ProductionOrderVo> getSchedulingList(@RequestBody ProduceOrderSelectDto produceOrderDto) {
        return produceOrderService.getSchedulingList(produceOrderDto);
    }

    /**
     * 投产
     */
    @PostMapping("/putProduction")
    public void putProduction(@RequestBody ProduceOrderSelectDto dto) {
        produceOrderService.putProduction(dto);
    }

    /**
     * 投产
     */
    @PostMapping("/editProduceTime")
    public void editProduceTime(@RequestBody ProduceOrderSelectDto dto) {
        produceOrderService.editProduceTime(dto);
    }
}
