|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesCustomerRoadService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesCustomerService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
@ -8,9 +7,12 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCustomer;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerRoad;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerCarModelRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerPartRepository;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -22,7 +24,11 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MesCustomerService extends BaseMesService<MesCustomer> implements IMesCustomerService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCustomerPartRepository mesCustomerPartRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCustomerCarModelRepository mesCustomerCarModelRDao;
|
|
|
|
|
|
|
|
|
|
protected void onInsertBean(MesCustomer item) {
|
|
|
|
|
// 数据校验
|
|
|
|
@ -63,4 +69,28 @@ public class MesCustomerService extends BaseMesService<MesCustomer> implements I
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getCustomerName(), "customerName", packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onDeleteId(Long id) {
|
|
|
|
|
MesCustomer mesCustomer = baseRDao.getById(id);
|
|
|
|
|
//校验客户物料是否存在
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesCustomer.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(mesCustomer.getCustomerCode(), "customerCode", packBean);
|
|
|
|
|
if(mesCustomerPartRDao.isExitByHql(packBean)){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("客户代码【%s】存在客户零件号信息,请先删除对应的客户零件号信息", mesCustomer.getCustomerCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
//校验客户车型配置
|
|
|
|
|
packBean = DdlPackBean.getDdlPackBean(mesCustomer.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(mesCustomer.getCustomerCode(), "customerCode", packBean);
|
|
|
|
|
if(mesCustomerCarModelRDao.isExitByHql(packBean)){
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("客户代码【%s】存在客户车型配置信息,请先删除对应的客户车型配置信息", mesCustomer.getCustomerCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|