|
|
|
@ -1,12 +1,14 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPartProdGroupDetailService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.utils.MesException;
|
|
|
|
|
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.MesPartProdGroup;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroupDetail;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartProduceType;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -29,6 +31,28 @@ public class MesPartProdGroupDetailService extends BaseMesService<MesPartProdGro
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onInsertBean(MesPartProdGroupDetail item) {
|
|
|
|
|
// 数据校验
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartProdGroupCode(), "零件生产组代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartNo(), "零件号不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getCustPartNo(), "客户零件号不能为空");
|
|
|
|
|
|
|
|
|
|
DdlPackBean custBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getPartProdGroupCode(), "partProdGroupCode", custBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getCustPartNo(), "custPartNo", custBean);
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(custBean);
|
|
|
|
|
if (flg) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】零件生产组代码下,客户零件号【%s】已存在,请检查数据", item.getPartProdGroupCode(), item.getCustPartNo())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void validateImport(List<MesPartProdGroupDetail> beanList) {
|
|
|
|
|
|
|
|
|
@ -36,17 +60,28 @@ public class MesPartProdGroupDetailService extends BaseMesService<MesPartProdGro
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartProdGroupCode(), "零件生产组代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getPartNo(), "零件号不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getWorkCellCode(), "工位代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getCustPartNo(), "客户零件号不能为空");
|
|
|
|
|
|
|
|
|
|
DdlPackBean custBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getPartProdGroupCode(), "partProdGroupCode", custBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getCustPartNo(), "custPartNo", custBean);
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(custBean);
|
|
|
|
|
if (flg) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】零件生产组代码下,客户零件号【%s】已存在,请检查数据", item.getPartProdGroupCode(),item.getCustPartNo())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getPartProdGroupCode(), "partProdGroupCode", packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(item.getPartNo(), "partNo", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCellCode(), "workCellCode", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getCustPartNo(), "custPartNo", packBean);
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(packBean);
|
|
|
|
|
if (flg) {
|
|
|
|
|
boolean flg2 = baseRDao.isExitByHql(packBean);
|
|
|
|
|
if (flg2) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|