|
|
|
@ -1,11 +1,14 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPartShippingGroupService;
|
|
|
|
|
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.MesPartShippingGroup;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.poi.ss.formula.functions.T;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -14,8 +17,52 @@ public class MesPartShippingGroupService extends BaseMesService<MesPartShippingG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void setPackQueryBean(MesPartShippingGroup bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getShippingGroupNo(),"shippingGroupNo",packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getShippingGroupName(),"shippingGroupName",packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getShippingGroupNo(), "shippingGroupNo", packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getShippingGroupName(), "shippingGroupName", packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public MesPartShippingGroup insert(MesPartShippingGroup bean) {
|
|
|
|
|
//插入前构造并校验数据
|
|
|
|
|
onInsertBean(bean);
|
|
|
|
|
|
|
|
|
|
bean = baseRDao.insert(bean);
|
|
|
|
|
return bean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onInsertBean(MesPartShippingGroup item) {
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShippingGroupNo(), "发运组代码不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getShippingGroupNo(), "shippingGroupNo", seriesPackBean);
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(seriesPackBean);
|
|
|
|
|
if (flg) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】发运组代码已经存在,请检查数据", item.getShippingGroupNo(), item.getCustomerCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onUpdateBean(MesPartShippingGroup item) {
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShippingGroupNo(), "发运组代码不能为空");
|
|
|
|
|
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getShippingGroupNo(), "shippingGroupNo", 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】发运组代码已经存在,请检查数据", item.getShippingGroupNo(), item.getCustomerCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|