|
|
|
@ -3,10 +3,15 @@ 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.IMesShiftGroupService;
|
|
|
|
|
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.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesShiftGroup;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
@ -14,10 +19,46 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MesShiftGroupService extends BaseMesService<MesShiftGroup> implements IMesShiftGroupService {
|
|
|
|
|
|
|
|
|
|
protected void setPackQueryBean(MesPart bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getPartNo(), "partNo", packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getPartName(), "partName", packBean);
|
|
|
|
|
protected void setPackQueryBean(MesShiftGroup bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShiftGroup(), "shiftGroup", packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getShiftGroupName(), "shiftGroupName", packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onInsertBean(MesShiftGroup item) {
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShiftGroup(), "班组代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShiftGroupName(), "班组名称不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getShiftGroup(), "shiftGroup", 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.getShiftGroup())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onUpdateBean(MesShiftGroup item) {
|
|
|
|
|
// 数据校验
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShiftGroup(), "发运组代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShiftGroupName(), "班组名称不能为空");
|
|
|
|
|
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getShiftGroup(), "shiftGroup", 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.getShiftGroup())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|