//package cn.estsh.i3plus.ext.mes.apiservice.controller.base;
//
//import cn.estsh.i3plus.ext.mes.api.base.IOqcProjectService;
//import cn.estsh.i3plus.ext.mes.pojo.bean.MesOqcProject;
//import cn.estsh.i3plus.ext.mes.pojo.model.OqcProjectModel;
//import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
//import cn.estsh.i3plus.platform.common.util.CommonConstWords;
//import cn.estsh.i3plus.pojo.base.common.Pager;
//import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
//import cn.estsh.impp.framework.boot.auth.AuthUtil;
//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.*;
//
///**
// * @author yumingxing
// * @version 1.0
// * @date 2021/2/5 15:55
// **/
//@RestController
//@Api(tags = "出货检验项目")
//@RequestMapping(CommonConstWords.BASE_URL_MES)
//public class OqcProjectController {
//
//    @Autowired
//    private IOqcProjectService oqcProjectService;
//
//    @GetMapping(value = "/oqc-project/query")
//    @ApiOperation(value = "分页查询出货检验项目")
//    public ResultBean queryOqcProjectPager(MesOqcProject oqcProject, Pager pager) {
//        try {
//            oqcProject.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
//            return ResultBean.success("查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
//                    .setListPager(oqcProjectService.queryOqcProjectPager(oqcProject, pager));
//        } catch (ImppBusiException busExcep) {
//            return ResultBean.fail(busExcep);
//        } catch (Exception e) {
//            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
//        }
//    }
//
//    @PostMapping(value = "/oqc-project/insert")
//    @ApiOperation(value = "新增出货检验项目")
//    public ResultBean insertOqcProject(@RequestBody OqcProjectModel model) {
//        try {
//            ValidatorBean.beginValid(model)
//                    .notNull(MesExtConstWords.OQC_TYPE, model.getOqcType())
//                    .notNull(MesExtConstWords.OQC_PROJECT, model.getOqcProject())
//                    .notNull(MesExtConstWords.SEQ, model.getSeq());
//            model.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
//            model.setUserInfo(AuthUtil.getSessionUser().getUserName());
//            oqcProjectService.insertOqcProject(model);
//            return ResultBean.success("新增成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
//        } catch (ImppBusiException busExcep) {
//            return ResultBean.fail(busExcep);
//        } catch (Exception e) {
//            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
//        }
//    }
//
//    @PostMapping(value = "/oqc-project/update")
//    @ApiOperation(value = "修改出货检验项目")
//    public ResultBean updateOqcProject(@RequestBody OqcProjectModel model) {
//        try {
//            ValidatorBean.beginValid(model)
//                    .notNull(MesExtConstWords.ID, model.getId())
//                    .notNull(MesExtConstWords.OQC_PROJECT, model.getOqcProject())
//                    .notNull(MesExtConstWords.SEQ, model.getSeq());
//            oqcProjectService.updateOqcProject(model);
//            return ResultBean.success("修改成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
//        } catch (ImppBusiException busExcep) {
//            return ResultBean.fail(busExcep);
//        } catch (Exception e) {
//            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
//        }
//    }
//
//    @PostMapping(value = "/oqc-project/status-update")
//    @ApiOperation(value = "根据ID启用或禁用出货检验项目")
//    public ResultBean updateOqcProjectValidById(@RequestBody OqcProjectModel model) {
//        try {
//            ValidatorBean.beginValid(model)
//                    .notNull(MesExtConstWords.STATUS, model.getStatus());
//            oqcProjectService.updateOqcProjectValidById(model, AuthUtil.getSessionUser().getUserName());
//            return ResultBean.success("修改成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
//        } catch (ImppBusiException busExcep) {
//            return ResultBean.fail(busExcep);
//        } catch (Exception e) {
//            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
//        }
//    }
//
//}
