package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.base;

import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartProdGroupService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroup;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ResultBean;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description : 长度修改类型
 * @Reference :
 * @Author : junsheng.li
 * @CreateDate 2024/6/13 15:13
 * @Modify:
 **/
@RestController
@Api(tags = "零件生产组")
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mes-part-prod-group")
public class MesPartProdGroupController {

    @Autowired
    private IMesPartProdGroupService partProdGroupService;

    @GetMapping("/query")
    @ApiOperation(value = "查询零件生产组信息")
    public ResultBean queryMesCutLengthModifyType(MesPartProdGroup partProdGroup) {
        try {

            ValidatorBean.checkNotNull(partProdGroup.getOrganizeCode(), "工厂代码为空");

            return ResultBean.success("查询成功").setResultList(partProdGroupService.queryMesPartProdGroup(partProdGroup));
        } catch (ImppBusiException imppException) {
            return ResultBean.fail(imppException);
        } catch (Exception e) {
            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
        }
    }
}
