|
|
|
@ -1,10 +1,15 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesShiftGroupCenterCfgService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesShiftGroupCenterCfg;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -18,4 +23,44 @@ public class MesShiftGroupCenterCfgService extends BaseMesService<MesShiftGroupC
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onInsertBean(MesShiftGroupCenterCfg item) {
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShiftGroup(), "班组代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getWorkCenterCode(), "生产线代码不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getShiftGroup(), "shiftGroup", seriesPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCenterCode(), "workCenterCode", seriesPackBean);
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(seriesPackBean);
|
|
|
|
|
if (flg) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】班组代码【%s】生产线代码已经存在,请检查数据", item.getShiftGroup(), item.getWorkCenterCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onUpdateBean(MesShiftGroupCenterCfg item) {
|
|
|
|
|
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShiftGroup(), "班组代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getWorkCenterCode(), "生产线代码不能为空");
|
|
|
|
|
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getShiftGroup(), "shiftGroup", seriesPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCenterCode(), "workCenterCode", seriesPackBean);
|
|
|
|
|
DdlPreparedPack.getNumNOEqualPack(item.getId(), "id", seriesPackBean);
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(seriesPackBean);
|
|
|
|
|
if (flg) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】班组代码【%s】生产线代码已经存在,请检查数据", item.getShiftGroup(), item.getWorkCenterCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|