发运组 发运组代码唯一校验

tags/yfai-mes-ext-v1.0
LML丶 1 year ago
parent 3d328898fe
commit a439883fdf

@ -1,6 +1,7 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
import cn.estsh.i3plus.ext.mes.api.base.IMesLoadingVehiclesOrderService;
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
@ -9,6 +10,9 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesLoadingVehiclesOrder;
import cn.estsh.i3plus.pojo.mes.bean.MesLoadingVehiclesOrderDetail;
import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup;
import cn.estsh.i3plus.pojo.mes.bean.MesShippingOrderManagement;
import cn.estsh.i3plus.pojo.mes.repository.MesPartShippingGroupRepository;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
@ -30,11 +34,62 @@ public class MesLoadingVehiclesOrderService extends BaseMesService<MesLoadingVeh
@Autowired
private MesLoadingVehiclesOrderDetailService detailService;
@Autowired
private MesPartShippingGroupRepository partShippingGroupRepository;
@Override
public MesLoadingVehiclesOrder insert(MesLoadingVehiclesOrder bean) {
//插入前构造并校验数据
onInsertBean(bean);
MesShippingOrderManagement shippingOrderManagement = bean.getShippingOrderNoList().get(0);
DdlPackBean partShipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(shippingOrderManagement.getShippingGroupNo(), "shippingGroupNo", partShipGroupPackBean);
MesPartShippingGroup partShippingGroup = partShippingGroupRepository.getByProperty(partShipGroupPackBean);
if (StringUtils.isEmpty(partShippingGroup)) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】零件发运组数据为空请检查数据", shippingOrderManagement.getShippingGroupNo())
.build();
}
if (StringUtils.isEmpty(partShippingGroup.getIsLoading())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】零件发运组是否有装车不能为空请检查数据", shippingOrderManagement.getShippingGroupNo())
.build();
}
if (partShippingGroup.getIsLoading() == MesCommonConstant.FALSE_INTEGER) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】零件发运组是否有装车配置为否则不需要生成装车单请检查数据", shippingOrderManagement.getShippingGroupNo())
.build();
}
if (StringUtils.isEmpty(partShippingGroup.getIsFirstInstall())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】零件发运组是否先装车不能为空请检查数据", shippingOrderManagement.getShippingGroupNo())
.build();
}
if (StringUtils.isEmpty(partShippingGroup.getIsEnableMemory())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】零件发运组是否启用记忆不能为空请检查数据", shippingOrderManagement.getShippingGroupNo())
.build();
}
// bean.setIsLoading(partShippingGroup.getIsLoading());
bean.setIsFirstInstall(partShippingGroup.getIsFirstInstall());
bean.setIsEnableMemory(partShippingGroup.getIsEnableMemory());
List<MesLoadingVehiclesOrderDetail> detailList = new ArrayList<>();
MesLoadingVehiclesOrder finalBean = bean;
bean.getShippingOrderNoList().forEach(k -> {

@ -7,9 +7,11 @@ 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.i3plus.pojo.mes.bean.MesPartShippingGroupDetail;
import cn.estsh.i3plus.pojo.mes.bean.MesShippingOrderManagement;
import cn.estsh.i3plus.pojo.mes.bean.MesShippingOrderManagementDetail;
import cn.estsh.i3plus.pojo.mes.repository.MesPartShippingGroupRepository;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
@ -33,6 +35,9 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
@Autowired
private MesPartShippingGroupDetailService shippingGroupDetailService;
@Autowired
private MesPartShippingGroupRepository partShippingGroupRepository;
protected void setPackQueryBean(MesShippingOrderManagement bean, DdlPackBean packBean) {
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupNo(), "shippingGroupNo", packBean);
@ -49,6 +54,44 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
//插入前构造并校验数据
onInsertBean(bean);
DdlPackBean partShipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupNo(), "shippingGroupNo", partShipGroupPackBean);
MesPartShippingGroup partShippingGroup = partShippingGroupRepository.getByProperty(partShipGroupPackBean);
if (StringUtils.isEmpty(partShippingGroup)) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】零件发运组数据为空请检查数据", bean.getShippingGroupNo())
.build();
}
if (StringUtils.isEmpty(partShippingGroup.getIsLoading())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】零件发运组是否有装车不能为空请检查数据", bean.getShippingGroupNo())
.build();
}
if (StringUtils.isEmpty(partShippingGroup.getIsFirstInstall())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】零件发运组是否先装车不能为空请检查数据", bean.getShippingGroupNo())
.build();
}
if (StringUtils.isEmpty(partShippingGroup.getIsEnableMemory())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】零件发运组是否启用记忆不能为空请检查数据", bean.getShippingGroupNo())
.build();
}
bean.setIsLoading(partShippingGroup.getIsLoading());
bean.setIsFirstInstall(partShippingGroup.getIsFirstInstall());
bean.setIsEnableMemory(partShippingGroup.getIsEnableMemory());
//查询物料发运组明细数据
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupNo(), "shippingGroupNo", shipGroupPackBean);
@ -57,7 +100,7 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("【%s】发运组明细数据为空,请检查数据", bean.getShippingGroupNo())
.setErrorDetail("【%s】零件发运组明细数据为空,请检查数据", bean.getShippingGroupNo())
.build();
}

@ -6,13 +6,13 @@ public class MesCommonConstant {
//yanfeng
public static final String MES_YANFEN = "/mes/ext";
public static final String TRUE_STRING = "2";
public static final String TRUE_STRING = "1";
public static final String FALSE_STRING = "1";
public static final String FALSE_STRING = "2";
public static final Integer TRUE_INTEGER = 2;
public static final Integer TRUE_INTEGER = 1;
public static final Integer FALSE_INTEGER = 1;
public static final Integer FALSE_INTEGER = 2;
}

Loading…
Cancel
Save