package com.fjhx.mes.controller.production;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.mes.entity.production.dto.ProduceOrderDetailSelectDto;
import com.fjhx.mes.entity.production.dto.ProductionOrderDetailDto;
import com.fjhx.mes.entity.production.dto.ProductionTaskDetailDto;
import com.fjhx.mes.entity.production.vo.ProductionOrderDetailVo;
import com.fjhx.mes.service.production.ProduceOrderDetailService;
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("/produceOrderDetail")
public class ProduceOrderDetailController {

    @Autowired
    private ProduceOrderDetailService produceOrderDetailService;

    /**
     * 生产任务分页
     */
    @PostMapping("/page")
    public Page<ProductionOrderDetailVo> page(@RequestBody ProduceOrderDetailSelectDto dto) {
        return produceOrderDetailService.getPage(dto);
    }

    /**
     * 生产任务详情
     */
    @PostMapping("/detail")
    public ProductionOrderDetailVo detail(@RequestBody ProductionTaskDetailDto dto) {
        return produceOrderDetailService.detail(dto);
    }

    /**
     * 批量生产任务详情
     */
    @PostMapping("/detailByIds")
    public List<ProductionOrderDetailVo> detailByIds(@RequestBody ProduceOrderDetailSelectDto dto) {
        return produceOrderDetailService.detailByIds(dto.getTaskIds());
    }

    /**
     * 修改备注
     */
    @PostMapping("/editRemark")
    public void editRemark(@RequestBody ProductionOrderDetailDto dto) {
        produceOrderDetailService.editRemark(dto);
    }

}
