|
|
|
@ -1,10 +1,13 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPartTypeService;
|
|
|
|
|
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.MesPartShippingGroupDetail;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartType;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
@ -15,4 +18,42 @@ public class MesPartTypeService extends BaseMesService<MesPartType> implements I
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getPartTypeCode(), "partTypeCode", packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getPartTypeName(), "partTypeName", packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void onInsertBean(MesPartType item) {
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartTypeCode(), "零件类型代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartTypeName(), "零件类型名称不能为空");
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getPartTypeCode(), "partTypeCode", packBean);
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(packBean);
|
|
|
|
|
if (flg) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】零件类型代码已经存在,请检查数据", item.getPartTypeCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void onUpdateBean(MesPartType item) {
|
|
|
|
|
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartTypeCode(), "零件类型代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartTypeName(), "零件类型名称不能为空");
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getPartTypeCode(), "partTypeCode", packBean);
|
|
|
|
|
DdlPreparedPack.getNumNOEqualPack(item.getId(), "id", packBean);
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(packBean);
|
|
|
|
|
if (flg) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】零件类型代码已经存在,请检查数据", item.getPartTypeCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|