|
|
@ -10,9 +10,7 @@ import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesJisShippingRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartShippingGroupRepository;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
@ -43,7 +41,13 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
private MesPartShippingGroupRepository partShippingGroupRepository;
|
|
|
|
private MesPartShippingGroupRepository partShippingGroupRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesCustomerDockRepository customerDockRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private MesJisShippingRepository jisShippingRepository;
|
|
|
|
private MesJisShippingRepository jisShippingRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesProduceSnRepository produceSnRepository;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IMesConfigService configService;
|
|
|
|
private IMesConfigService configService;
|
|
|
|
|
|
|
|
|
|
|
@ -55,13 +59,16 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void setPackQueryBean(MesShippingOrderManagement bean, DdlPackBean packBean) {
|
|
|
|
protected void setPackQueryBean(MesShippingOrderManagement bean, DdlPackBean packBean) {
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupNo(), "shippingGroupNo", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingCode(), "shippingCode", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupCode(), "shippingGroupCode", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getCustCode(), "custCode", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getCustCode(), "custCode", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getCustOrganizeCode(), "custOrganizeCode", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getCustOrganizeCode(), "custOrganizeCode", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupNo(), "shippingGroupNo", packBean);
|
|
|
|
DdlPreparedPack.getNumEqualPack(bean.getStatus(), "status", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackArray(bean.getStatusArray(), "status", packBean);
|
|
|
|
if (!StringUtils.isEmpty(bean.getReleaseTimeStart()) || !StringUtils.isEmpty(bean.getReleaseTimeEnd())) {
|
|
|
|
if (!StringUtils.isEmpty(bean.getReleaseTimeStart()) || !StringUtils.isEmpty(bean.getReleaseTimeEnd())) {
|
|
|
|
DdlPreparedPack.timeBuilder(bean.getReleaseTimeStart(), bean.getReleaseTimeEnd(), "releaseTime", packBean, false);
|
|
|
|
DdlPreparedPack.timeBuilder(bean.getReleaseTimeStart(), bean.getReleaseTimeEnd(), "releaseTime", packBean, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -70,14 +77,14 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
onInsertBean(bean);
|
|
|
|
onInsertBean(bean);
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean partShipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPackBean partShipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupNo(), "shippingGroupNo", partShipGroupPackBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupCode(), "shippingGroupCode", partShipGroupPackBean);
|
|
|
|
MesPartShippingGroup partShippingGroup = partShippingGroupRepository.getByProperty(partShipGroupPackBean);
|
|
|
|
MesPartShippingGroup partShippingGroup = partShippingGroupRepository.getByProperty(partShipGroupPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup)) {
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup)) {
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorDetail("【%s】零件发运组数据为空,请检查数据", bean.getShippingGroupNo())
|
|
|
|
.setErrorDetail("【%s】零件发运组数据为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -85,37 +92,52 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorDetail("【%s】零件发运组是否有装车不能为空,请检查数据", bean.getShippingGroupNo())
|
|
|
|
.setErrorDetail("【%s】零件发运组是否有装车不能为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup.getIsFirstInstall()) || partShippingGroup.getIsFirstInstall() == 0) {
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup.getIsFirstInstall()) || partShippingGroup.getIsFirstInstall() == 0) {
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorDetail("【%s】零件发运组是否先装车不能为空,请检查数据", bean.getShippingGroupNo())
|
|
|
|
.setErrorDetail("【%s】零件发运组是否先装车不能为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup.getIsEnableMemory()) || partShippingGroup.getIsEnableMemory() == 0) {
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup.getIsEnableMemory()) || partShippingGroup.getIsEnableMemory() == 0) {
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorDetail("【%s】零件发运组是否启用记忆不能为空,请检查数据", bean.getShippingGroupNo())
|
|
|
|
.setErrorDetail("【%s】零件发运组是否启用记忆不能为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean custDockPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getCustCode(), "custCode", custDockPackBean);
|
|
|
|
|
|
|
|
MesCustomerDock customerDock = customerDockRepository.getByProperty(custDockPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(customerDock)) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】客户零件号未维护客户道口,请检查数据", bean.getCustCode())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bean.setCustDockCode(customerDock.getCustDockCode());
|
|
|
|
|
|
|
|
bean.setPartShippingId(partShippingGroup.getId());
|
|
|
|
|
|
|
|
bean.setShippingType(MesExtEnumUtil.SHIPPING_ORDER_TYPE.SORT_SHIPPING.getValue());
|
|
|
|
bean.setIsLoading(partShippingGroup.getIsLoading());
|
|
|
|
bean.setIsLoading(partShippingGroup.getIsLoading());
|
|
|
|
bean.setIsFirstInstall(partShippingGroup.getIsFirstInstall());
|
|
|
|
bean.setIsFirstInstall(partShippingGroup.getIsFirstInstall());
|
|
|
|
bean.setIsEnableMemory(partShippingGroup.getIsEnableMemory());
|
|
|
|
bean.setIsEnableMemory(partShippingGroup.getIsEnableMemory());
|
|
|
|
|
|
|
|
|
|
|
|
//查询物料发运组明细数据
|
|
|
|
//查询物料发运组明细数据
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupNo(), "shippingGroupNo", shipGroupPackBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupCode(), "shippingGroupCode", shipGroupPackBean);
|
|
|
|
List<MesPartShippingGroupDetail> groupDetailList = shippingGroupDetailService.findAll(shipGroupPackBean);
|
|
|
|
List<MesPartShippingGroupDetail> groupDetailList = shippingGroupDetailService.findAll(shipGroupPackBean);
|
|
|
|
if (CollectionUtils.isEmpty(groupDetailList)) {
|
|
|
|
if (CollectionUtils.isEmpty(groupDetailList)) {
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorDetail("【%s】零件发运组明细数据为空,请检查数据", bean.getShippingGroupNo())
|
|
|
|
.setErrorDetail("【%s】零件发运组明细数据为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -128,8 +150,10 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
BeanUtils.copyProperties(k, detail, "id");
|
|
|
|
BeanUtils.copyProperties(k, detail, "id");
|
|
|
|
MesPart part = partService.getPartByPartNo(k.getPartNo(), k.getOrganizeCode());
|
|
|
|
MesPart part = partService.getPartByPartNo(k.getPartNo(), k.getOrganizeCode());
|
|
|
|
detail.setPartName(part.getPartName());
|
|
|
|
detail.setPartName(part.getPartName());
|
|
|
|
|
|
|
|
detail.setUnit(part.getUnit());
|
|
|
|
detail.setCustPartNo(k.getCustPartNo());
|
|
|
|
detail.setCustPartNo(k.getCustPartNo());
|
|
|
|
detail.setPlanQty(1);
|
|
|
|
detail.setPlanQty(1);
|
|
|
|
|
|
|
|
detail.setShippingId(finalBean.getId());
|
|
|
|
// detail.setActualQty(1);
|
|
|
|
// detail.setActualQty(1);
|
|
|
|
detail.setShippingCode(finalBean.getShippingCode());
|
|
|
|
detail.setShippingCode(finalBean.getShippingCode());
|
|
|
|
detail.setOrganizeCode(k.getOrganizeCode());
|
|
|
|
detail.setOrganizeCode(k.getOrganizeCode());
|
|
|
@ -159,7 +183,61 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断是否修改发运组,如果不修改发运组,则不修改明细
|
|
|
|
//判断是否修改发运组,如果不修改发运组,则不修改明细
|
|
|
|
if (!bean.getShippingGroupNo().equals(originBean.getShippingGroupNo())) {
|
|
|
|
if (!bean.getShippingGroupCode().equals(originBean.getShippingGroupCode())) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean partShipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupCode(), "shippingGroupCode", 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.getShippingGroupCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup.getIsLoading()) || partShippingGroup.getIsLoading() == 0) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】零件发运组是否有装车不能为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup.getIsFirstInstall()) || partShippingGroup.getIsFirstInstall() == 0) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】零件发运组是否先装车不能为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup.getIsEnableMemory()) || partShippingGroup.getIsEnableMemory() == 0) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】零件发运组是否启用记忆不能为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean custDockPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getCustCode(), "custCode", custDockPackBean);
|
|
|
|
|
|
|
|
MesCustomerDock customerDock = customerDockRepository.getByProperty(custDockPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(customerDock)) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】客户零件号未维护客户道口,请检查数据", bean.getCustCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bean.setCustDockCode(customerDock.getCustDockCode());
|
|
|
|
|
|
|
|
bean.setPartShippingId(partShippingGroup.getId());
|
|
|
|
|
|
|
|
bean.setShippingType(MesExtEnumUtil.SHIPPING_ORDER_TYPE.SORT_SHIPPING.getValue());
|
|
|
|
|
|
|
|
bean.setIsLoading(partShippingGroup.getIsLoading());
|
|
|
|
|
|
|
|
bean.setIsFirstInstall(partShippingGroup.getIsFirstInstall());
|
|
|
|
|
|
|
|
bean.setIsEnableMemory(partShippingGroup.getIsEnableMemory());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean detailPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPackBean detailPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingCode(), "shippingCode", detailPackBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingCode(), "shippingCode", detailPackBean);
|
|
|
@ -170,24 +248,31 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//查询物料发运组数据
|
|
|
|
//查询物料发运组数据
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupNo(), "shippingGroupNo", shipGroupPackBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupCode(), "shippingGroupCode", shipGroupPackBean);
|
|
|
|
List<MesPartShippingGroupDetail> shippingGroupDetailList = shippingGroupDetailService.findAll(shipGroupPackBean);
|
|
|
|
List<MesPartShippingGroupDetail> shippingGroupDetailList = shippingGroupDetailService.findAll(shipGroupPackBean);
|
|
|
|
if (CollectionUtils.isEmpty(shippingGroupDetailList)) {
|
|
|
|
if (CollectionUtils.isEmpty(shippingGroupDetailList)) {
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
.setErrorDetail("【%s】发运组明细数据为空,请检查数据", bean.getShippingGroupNo())
|
|
|
|
.setErrorDetail("【%s】发运组明细数据为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//发运单明细
|
|
|
|
//发运单明细
|
|
|
|
List<MesShippingOrderManagementDetail> detailInsertList = new ArrayList<>();
|
|
|
|
List<MesShippingOrderManagementDetail> detailInsertList = new ArrayList<>();
|
|
|
|
shippingGroupDetailList.forEach(k -> {
|
|
|
|
shippingGroupDetailList.forEach(k -> {
|
|
|
|
MesShippingOrderManagementDetail detail = new MesShippingOrderManagementDetail();
|
|
|
|
MesShippingOrderManagementDetail detail = new MesShippingOrderManagementDetail();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(k, detail, "id");
|
|
|
|
|
|
|
|
MesPart part = partService.getPartByPartNo(k.getPartNo(), k.getOrganizeCode());
|
|
|
|
|
|
|
|
detail.setPartName(part.getPartName());
|
|
|
|
|
|
|
|
detail.setUnit(part.getUnit());
|
|
|
|
|
|
|
|
detail.setCustPartNo(k.getCustPartNo());
|
|
|
|
|
|
|
|
detail.setPlanQty(1);
|
|
|
|
|
|
|
|
detail.setShippingId(originBean.getId());
|
|
|
|
|
|
|
|
detail.setShippingCode(originBean.getShippingCode());
|
|
|
|
detail.setOrganizeCode(k.getOrganizeCode());
|
|
|
|
detail.setOrganizeCode(k.getOrganizeCode());
|
|
|
|
// ConvertBean.serviceModelInitialize(detail, "LML");
|
|
|
|
detail.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.CREATE.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName());
|
|
|
|
BeanUtils.copyProperties(k, detail, "id");
|
|
|
|
|
|
|
|
detailInsertList.add(detail);
|
|
|
|
detailInsertList.add(detail);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//软删原明细数据
|
|
|
|
//软删原明细数据
|
|
|
@ -196,8 +281,6 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
detailService.insertBatch(detailInsertList);
|
|
|
|
detailService.insertBatch(detailInsertList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onModifyBean();
|
|
|
|
|
|
|
|
// ConvertBean.serviceModelUpdate(bean, "LML");
|
|
|
|
|
|
|
|
ConvertBean.serviceModelUpdate(bean, AuthUtil.getSessionUser().getUserName());
|
|
|
|
ConvertBean.serviceModelUpdate(bean, AuthUtil.getSessionUser().getUserName());
|
|
|
|
baseRDao.update(bean);
|
|
|
|
baseRDao.update(bean);
|
|
|
|
return originBean;
|
|
|
|
return originBean;
|
|
|
@ -211,7 +294,7 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
MesShippingOrderManagement bean = baseRDao.getById(id);
|
|
|
|
MesShippingOrderManagement bean = baseRDao.getById(id);
|
|
|
|
if (StringUtils.isEmpty(bean)) continue;
|
|
|
|
if (StringUtils.isEmpty(bean)) continue;
|
|
|
|
DdlPackBean detailPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPackBean detailPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingCode(), "shippingGroupNo", detailPackBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingCode(), "shippingCode", detailPackBean);
|
|
|
|
List<MesShippingOrderManagementDetail> detailDeleteList = detailService.findAll(detailPackBean);
|
|
|
|
List<MesShippingOrderManagementDetail> detailDeleteList = detailService.findAll(detailPackBean);
|
|
|
|
detailDeleteList.forEach(k -> {
|
|
|
|
detailDeleteList.forEach(k -> {
|
|
|
|
k.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
|
|
|
k.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
|
|
@ -232,7 +315,7 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
ValidatorBean.checkNotNull(item.getSeq(), "顺序号不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getSeq(), "顺序号不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getCustCode(), "客户代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getCustCode(), "客户代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getCustCode(), "客户工厂代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getCustCode(), "客户工厂代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getShippingGroupNo(), "发运组代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getShippingGroupCode(), "发运组代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getStatus(), "状态不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getStatus(), "状态不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
@ -246,6 +329,17 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getSeq(), "seq", packBean);
|
|
|
|
|
|
|
|
boolean flg1 = baseRDao.isExitByHql(packBean);
|
|
|
|
|
|
|
|
if (flg1) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】顺序号已经存在,请检查数据", item.getSeq())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -256,8 +350,32 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
ValidatorBean.checkNotNull(item.getSeq(), "顺序号不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getSeq(), "顺序号不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getCustCode(), "客户代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getCustCode(), "客户代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getCustOrganizeCode(), "客户工厂代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getCustOrganizeCode(), "客户工厂代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getShippingGroupNo(), "发运组代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getShippingGroupCode(), "发运组代码不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getStatus(), "状态不能为空");
|
|
|
|
ValidatorBean.checkNotNull(item.getStatus(), "状态不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getShippingCode(), "shippingCode", shipGroupPackBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getNumNOEqualPack(item.getId(), "id", shipGroupPackBean);
|
|
|
|
|
|
|
|
boolean flg = baseRDao.isExitByHql(shipGroupPackBean);
|
|
|
|
|
|
|
|
if (flg) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】发运单已经存在,请检查数据", item.getShippingCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getSeq(), "seq", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getNumNOEqualPack(item.getId(), "id", packBean);
|
|
|
|
|
|
|
|
boolean flg1 = baseRDao.isExitByHql(packBean);
|
|
|
|
|
|
|
|
if (flg1) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】顺序号已经存在,请检查数据", item.getSeq())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -321,4 +439,42 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
jisShippingRepository.saveAll(jisShippingList);
|
|
|
|
jisShippingRepository.saveAll(jisShippingList);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void saveShippingClose(MesShippingOrderManagement bean) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesShippingOrderManagement originBean = baseRDao.getById(bean.getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean detailPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(originBean.getShippingCode(), "shippingCode", detailPackBean);
|
|
|
|
|
|
|
|
List<MesShippingOrderManagementDetail> detailDeleteList = detailService.findAll(detailPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
originBean.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.CLOSE.getValue());
|
|
|
|
|
|
|
|
ConvertBean.serviceModelUpdate(originBean, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
//修改当前发运单明细状态
|
|
|
|
|
|
|
|
detailDeleteList.forEach(k -> {
|
|
|
|
|
|
|
|
k.setActualQty(0);
|
|
|
|
|
|
|
|
k.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.CLOSE.getValue());
|
|
|
|
|
|
|
|
ConvertBean.serviceModelUpdate(k, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//若扫描过的条码 则恢复条码
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(k.getBarcode())) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(k.getBarcode(), "productSn", packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
|
|
|
|
|
|
|
|
MesProduceSn produceSn = produceSnRepository.getByProperty(packBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
produceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue());
|
|
|
|
|
|
|
|
ConvertBean.serviceModelUpdate(k, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
produceSnRepository.save(produceSn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
baseRDao.save(originBean);
|
|
|
|
|
|
|
|
detailService.updates(detailDeleteList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|