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

import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftGroupCenterCfgService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.mes.bean.MesShiftGroupCenterCfg;
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 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: 产线与班组的对应关系
 * @Author: gsz
 * @Date: 2024/5/25 18:16
 * @Modify:
 */
@RestController
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesShiftGroupCenterCfg")
public class MesShiftGroupCenterCfgController {

    @Autowired
    private IMesShiftGroupCenterCfgService mesShiftGroupCenterCfgService;

    @GetMapping("/query-pager")
    @ApiOperation(value = "产线与班组的对应关系")
    public ResultBean queryMesShiftGroupCenterCfgByPager(MesShiftGroupCenterCfg mesShiftGroupCenterCfg, Pager pager) {
        try {
            ListPager<MesShiftGroupCenterCfg> partInspectionListPager = mesShiftGroupCenterCfgService.queryMesShiftGroupCenterCfgByPager(mesShiftGroupCenterCfg, pager);
            return ResultBean.success("查询成功").setListPager(partInspectionListPager);
        } catch (ImppBusiException imppException) {
            return ResultBean.fail(imppException);
        } catch (Exception e) {
            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
        }
    }

}
