package com.fjhx.mes.controller.production;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.mes.entity.production.vo.ProductionTaskDetailVo;
import com.fjhx.mes.entity.production.dto.ProductionTaskDetailSelectDto;
import com.fjhx.mes.entity.production.dto.ProductionTaskDetailDto;
import com.fjhx.mes.service.production.ProductionTaskDetailService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 生产任务明细 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-05-18
 */
@RestController
@RequestMapping("/productionTaskDetail")
public class ProductionTaskDetailController {

    @Autowired
    private ProductionTaskDetailService productionTaskDetailService;

    /**
     * 生产任务明细分页
     */
    @PostMapping("/page")
    public Page<ProductionTaskDetailVo> page(@RequestBody ProductionTaskDetailSelectDto dto) {
        return productionTaskDetailService.getPage(dto);
    }

    /**
     * 生产任务明细分页
     */
    @PostMapping("/circulationPage")
    public Page<ProductionTaskDetailVo> circulationPage(@RequestBody ProductionTaskDetailSelectDto dto) {
        return productionTaskDetailService.circulationPage(dto);
    }

    /**
     * 生产任务流转
     */
    @PostMapping("/circulation")
    public void circulation(@RequestBody ProductionTaskDetailDto productionTaskDetailDto) {
        productionTaskDetailService.circulation(productionTaskDetailDto);
    }

    /**
     * 生产任务流转完工入库
     */
    @PostMapping("/productStorage")
    public void productStorage(@RequestBody ProductionTaskDetailDto productionTaskDetailDto) {
        productionTaskDetailService.productStorage(productionTaskDetailDto.getId());
    }



    /**
     * 生产任务接收分页
     */
    @PostMapping("/receivePage")
    public Page<ProductionTaskDetailVo> receivePage(@RequestBody ProductionTaskDetailSelectDto dto) {
        return productionTaskDetailService.receivePage(dto);
    }

    /**
     * 生产任务接收
     */
    @PostMapping("/receive")
    public void receive(@RequestBody ProductionTaskDetailDto productionTaskDetailDto) {
        productionTaskDetailService.receive(productionTaskDetailDto);
    }

    /**
     * 生产任务拒绝接收
     */
    @PostMapping("/rejection")
    public void rejection(@RequestBody ProductionTaskDetailDto productionTaskDetailDto) {
        productionTaskDetailService.rejection(productionTaskDetailDto);
    }

    /**
     * 获取sn信息
     */
    @PostMapping("/snInfo")
    public ProductionTaskDetailVo snInfo(@RequestBody ProductionTaskDetailDto productionTaskDetailDto) {
        return productionTaskDetailService.snInfo(productionTaskDetailDto.getProductSn());
    }

}
