|
|
@ -2,9 +2,13 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPartService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPartService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.unit.exception.MesException;
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.unit.exception.MesException;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
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.base.tool.DdlPreparedPack;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
@ -28,4 +32,39 @@ public class MesPartService extends BaseMesService<MesPart> implements IMesPartS
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return mesPart;
|
|
|
|
return mesPart;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void onInsertBean(MesPart item) {
|
|
|
|
|
|
|
|
// 数据校验
|
|
|
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartNo(), "物料号不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean roadPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getPartNo(), "partNo", roadPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(roadPackBean);
|
|
|
|
|
|
|
|
if (flg) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("物料号【%s】已经存在,请检查数据", item.getPartNo())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void onUpdateBean(MesPart item) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 数据校验
|
|
|
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartNo(), "物料号不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean roadPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getPartNo(), "partNo", roadPackBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getNumNOEqualPack(item.getId(), "id", roadPackBean);
|
|
|
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(roadPackBean);
|
|
|
|
|
|
|
|
if (flg) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("物料号【%s】已经存在,请检查数据", item.getPartNo())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|