|
|
|
@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesConfigService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPartService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesShippingOrderManagementService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
@ -71,7 +72,6 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
if (!StringUtils.isEmpty(bean.getReleaseTimeStart()) || !StringUtils.isEmpty(bean.getReleaseTimeEnd())) {
|
|
|
|
|
DdlPreparedPack.timeBuilder(bean.getReleaseTimeStart(), bean.getReleaseTimeEnd(), "releaseTime", packBean, false);
|
|
|
|
|
}
|
|
|
|
|
// DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -112,6 +112,25 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
.setErrorDetail("【%s】零件发运组是否启用记忆不能为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(partShippingGroup.getAutoSubmit()) || partShippingGroup.getAutoSubmit() == 0) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】零件发运组是否自动确认发运单不能为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询物料发运组明细数据
|
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupCode(), "shippingGroupCode", shipGroupPackBean);
|
|
|
|
|
List<MesPartShippingGroupDetail> groupDetailList = shippingGroupDetailService.findAll(shipGroupPackBean);
|
|
|
|
|
if (CollectionUtils.isEmpty(groupDetailList)) {
|
|
|
|
|
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);
|
|
|
|
@ -125,6 +144,13 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (partShippingGroup.getAutoSubmit() == MesCommonConstant.TRUE_INTEGER) {
|
|
|
|
|
bean.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.PUBLISHED.getValue());
|
|
|
|
|
bean.setPublishTime(TimeTool.getNowTime(true));
|
|
|
|
|
} else {
|
|
|
|
|
bean.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.CREATE.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bean.setCustDockCode(customerDock.getCustDockCode());
|
|
|
|
|
bean.setPartShippingGroupId(partShippingGroup.getId());
|
|
|
|
|
bean.setShippingType(MesExtEnumUtil.SHIPPING_ORDER_TYPE.SORT_SHIPPING.getValue());
|
|
|
|
@ -132,17 +158,6 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
bean.setIsFirstInstall(partShippingGroup.getIsFirstInstall());
|
|
|
|
|
bean.setIsEnableMemory(partShippingGroup.getIsEnableMemory());
|
|
|
|
|
|
|
|
|
|
//查询物料发运组明细数据
|
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupCode(), "shippingGroupCode", shipGroupPackBean);
|
|
|
|
|
List<MesPartShippingGroupDetail> groupDetailList = shippingGroupDetailService.findAll(shipGroupPackBean);
|
|
|
|
|
if (CollectionUtils.isEmpty(groupDetailList)) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】零件发运组明细数据为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bean = baseRDao.insert(bean);
|
|
|
|
|
|
|
|
|
@ -159,7 +174,6 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
detail.setCustPartNo(k.getCustPartNo());
|
|
|
|
|
detail.setPlanQty(1);
|
|
|
|
|
detail.setPid(finalBean.getId());
|
|
|
|
|
// detail.setActualQty(1);
|
|
|
|
|
detail.setShippingCode(finalBean.getShippingCode());
|
|
|
|
|
detail.setOrganizeCode(k.getOrganizeCode());
|
|
|
|
|
detail.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.CREATE.getValue());
|
|
|
|
@ -173,125 +187,6 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
return bean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public MesShippingOrderManagement update(MesShippingOrderManagement bean) {
|
|
|
|
|
//更新前构造并校验数据
|
|
|
|
|
onUpdateBean(bean);
|
|
|
|
|
MesShippingOrderManagement originBean = baseRDao.getById(bean.getId());
|
|
|
|
|
if (StringUtils.isEmpty(originBean)) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("请选择需要操作的资源。")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断是否修改发运组,如果不修改发运组,则不修改明细
|
|
|
|
|
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.setPartShippingGroupId(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());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingCode(), "shippingCode", detailPackBean);
|
|
|
|
|
List<MesShippingOrderManagementDetail> detailDeleteList = detailService.findAll(detailPackBean);
|
|
|
|
|
detailDeleteList.forEach(k -> {
|
|
|
|
|
k.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(k, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
});
|
|
|
|
|
//查询物料发运组数据
|
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupCode(), "shippingGroupCode", shipGroupPackBean);
|
|
|
|
|
List<MesPartShippingGroupDetail> shippingGroupDetailList = shippingGroupDetailService.findAll(shipGroupPackBean);
|
|
|
|
|
if (CollectionUtils.isEmpty(shippingGroupDetailList)) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】发运组明细数据为空,请检查数据", bean.getShippingGroupCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
//发运单明细
|
|
|
|
|
List<MesShippingOrderManagementDetail> detailInsertList = new ArrayList<>();
|
|
|
|
|
shippingGroupDetailList.forEach(k -> {
|
|
|
|
|
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.setPid(originBean.getId());
|
|
|
|
|
detail.setShippingCode(originBean.getShippingCode());
|
|
|
|
|
detail.setOrganizeCode(k.getOrganizeCode());
|
|
|
|
|
detail.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.CREATE.getValue());
|
|
|
|
|
|
|
|
|
|
ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
detailInsertList.add(detail);
|
|
|
|
|
});
|
|
|
|
|
//软删原明细数据
|
|
|
|
|
detailService.updates(detailDeleteList);
|
|
|
|
|
//新增新明细数据
|
|
|
|
|
detailService.insertBatch(detailInsertList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConvertBean.serviceModelUpdate(bean, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
baseRDao.update(bean);
|
|
|
|
|
return originBean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void deleteWeaklyByIds(Long[] ids, String userName) {
|
|
|
|
|
|
|
|
|
@ -321,7 +216,7 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
ValidatorBean.checkNotNull(item.getCustCode(), "客户代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getCustCode(), "客户工厂代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getShippingGroupCode(), "发运组代码不能为空");
|
|
|
|
|
ValidatorBean.checkNotNull(item.getStatus(), "状态不能为空");
|
|
|
|
|
// ValidatorBean.checkNotNull(item.getStatus(), "状态不能为空");
|
|
|
|
|
|
|
|
|
|
DdlPackBean shipGroupPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getShippingCode(), "shippingCode", shipGroupPackBean);
|
|
|
|
@ -481,5 +376,16 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
baseRDao.save(originBean);
|
|
|
|
|
detailService.updates(detailDeleteList);
|
|
|
|
|
|
|
|
|
|
} @Override
|
|
|
|
|
public void saveShippingRelease(MesShippingOrderManagement bean) {
|
|
|
|
|
|
|
|
|
|
MesShippingOrderManagement originBean = baseRDao.getById(bean.getId());
|
|
|
|
|
|
|
|
|
|
originBean.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.PUBLISHED.getValue());
|
|
|
|
|
originBean.setPublishTime(TimeTool.getNowTime(true));
|
|
|
|
|
ConvertBean.serviceModelUpdate(originBean, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
|
|
baseRDao.save(originBean);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|