|
|
|
@ -214,28 +214,29 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerTypeCode"},
|
|
|
|
|
new Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn.getContainerTypeCode()});
|
|
|
|
|
if (containerType == null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器类型代码【%s】信息不存在,请检查容器类型主数据", containerSn.getContainerTypeCode());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器类型代码[%s]信息不存在,请检查容器类型主数据", containerSn.getContainerTypeCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.setBindIsChoosePart(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
|
if (Objects.equals(containerType.getBindIsChoosePart(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue())) {
|
|
|
|
|
List<MesContainerPartsModel> partsModelList = getContainerParts(model.getOrganizeCode(), containerType.getContainerTypeCode(), containerSn.getContainerSn());
|
|
|
|
|
if (CollectionUtils.isEmpty(partsModelList)) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】或容器类型代码【%s】未维护与容器关系,请检查数据", containerSn.getContainerSn(), containerType.getContainerTypeCode());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]或容器类型代码[%s]未维护与容器关系,请检查数据", containerSn.getContainerSn(), containerType.getContainerTypeCode());
|
|
|
|
|
}
|
|
|
|
|
if (partsModelList.size() > 1 && isEmptyBindSn(model.getOrganizeCode(), model.getContainerSn())) {
|
|
|
|
|
model.setContainerParts(partsModelList);
|
|
|
|
|
model.setBindIsChoosePart(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
autoOpenContainerSn(model.getOrganizeCode(), containerSn.getContainerSn(), false, model.getUserName());
|
|
|
|
|
|
|
|
|
|
MesContainerPackage containerPackage = containerPackageRDao.getByProperty(
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
|
|
|
|
|
new Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn.getContainerSn()});
|
|
|
|
|
if (containerPackage != null) {
|
|
|
|
|
List<MesContainerPackageDetail> packageDetails = containerPackageDetailRDao.findByProperty(
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
|
|
|
|
|
new Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn.getContainerSn()});
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "pid", "snStatus"},
|
|
|
|
|
new Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerPackage.getId(), MesExtEnumUtil.CONTAINER_BARCODE_STATUS.STATUS_10.getValue()});
|
|
|
|
|
model.setPackageDetails(packageDetails);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -283,7 +284,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), barcode});
|
|
|
|
|
if (containerPackage == null || !Objects.equals(containerPackage.getPackageStatus(),MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_20.getValue())) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】未关箱,不能进行上料操作!", barcode);
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未关箱,不能进行上料操作!", barcode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MesContainerPackageDetail> bottomPackageDetails = new ArrayList<>();
|
|
|
|
@ -350,6 +351,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
}
|
|
|
|
|
// 容器置为拆箱状态。
|
|
|
|
|
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_30.getValue());
|
|
|
|
|
containerPackageRDao.update(containerPackage);
|
|
|
|
|
}
|
|
|
|
|
// 全部扣减完成
|
|
|
|
|
if (!deductionDetails.isEmpty() && deductionDetails.size() == bottomPackageDetails.size()) {
|
|
|
|
@ -377,10 +379,10 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerTypeCode"},
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn.getContainerTypeCode()});
|
|
|
|
|
if (containerType == null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器类型代码【%s】信息不存在,请检查容器类型主数据", containerSn.getContainerTypeCode());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器类型代码[%s]信息不存在,请检查容器类型主数据", containerSn.getContainerTypeCode());
|
|
|
|
|
}
|
|
|
|
|
if (containerType.getMixType() == null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器类型代码【%s】未配置混包类型,请检查容器类型主数据", containerSn.getContainerTypeCode());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器类型代码[%s]未配置混包类型,请检查容器类型主数据", containerSn.getContainerTypeCode());
|
|
|
|
|
}
|
|
|
|
|
MesContainerPackage containerPackage = autoOpenContainerSn(organizeCode, containerSn.getContainerSn(), bStep, model.getUserName());
|
|
|
|
|
|
|
|
|
@ -390,16 +392,16 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
packageDetails = new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
if (Objects.equals(containerPackage.getPackageStatus(), MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_20.getValue())) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】已关箱,不能再进行上料", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]已关箱,不能再进行上料", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
packageDetails = containerPackageDetailRDao.findByProperty(
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "pid"},
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerPackage.getId()});
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "pid", "snStatus"},
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerPackage.getId(), MesExtEnumUtil.CONTAINER_BARCODE_STATUS.STATUS_10.getValue()});
|
|
|
|
|
}
|
|
|
|
|
MesContainerPackageDetail barcodePackageDetail = containerPackageDetailRDao.getByProperty(new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "barCode"},
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), model.getBarCode()});
|
|
|
|
|
if (barcodePackageDetail != null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("条码【%s】已被容器【%s】绑定,请检查数据!", model.getBarCode(), barcodePackageDetail.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("条码[%s]已被容器[%s]绑定,请检查数据!", model.getBarCode(), barcodePackageDetail.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
List<MesContainerPackageDetail> oldPackageDetails = new ArrayList<>();
|
|
|
|
|
getBottomPackageDetails(organizeCode, containerPackage, oldPackageDetails);
|
|
|
|
@ -409,12 +411,12 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
MesContainerSn childContainerSn = containerSnService.getContainerSn(organizeCode, model.getBarCode());
|
|
|
|
|
if (childContainerSn != null) {
|
|
|
|
|
if (!Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), containerType.getIsAllowRecursion())) {
|
|
|
|
|
MesPcnException.throwBusiException("容器条码【%s】不能绑定容器,请重新扫描!", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwBusiException("容器条码[%s]不能绑定容器,请重新扫描!", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
bottomPackageDetails = checkContainerBarcode(organizeCode, model.getBarCode(), oldPackageDetails);
|
|
|
|
|
} else {
|
|
|
|
|
if (Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), containerType.getIsAllowRecursion())) {
|
|
|
|
|
MesPcnException.throwBusiException("容器条码【%s】不能扫描原料条码,请重新扫描!", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwBusiException("容器条码[%s]不能扫描原料条码,请重新扫描!", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
bottomPackageDetails = new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
@ -485,11 +487,11 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn);
|
|
|
|
|
if (containerPackage == null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
List<MesContainerPackageDetail> packageDetails = getContainerPackageDetail(model, containerSn);
|
|
|
|
|
if (CollectionUtils.isEmpty(packageDetails)) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】不包含上料明细数据,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]不包含上料明细数据,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode());
|
|
|
|
@ -515,7 +517,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn);
|
|
|
|
|
if (containerPackage == null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
List<Long> deleteDetailIds = new ArrayList<>();
|
|
|
|
|
for (MesContainerPackageDetail detail : model.getPackageDetails()) {
|
|
|
|
@ -540,10 +542,10 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn);
|
|
|
|
|
if (containerPackage == null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
if (Objects.equals(containerPackage.getPackageStatus(), MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_20.getValue())) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】已关箱,请务重复操作!", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]已关箱,请务重复操作!", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
List<MesContainerPackageDetail> packageDetails = containerPackageDetailRDao.findByProperty(
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "pid"},
|
|
|
|
@ -567,15 +569,15 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn);
|
|
|
|
|
if (containerPackage == null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
if (!Objects.equals(containerPackage.getPackageStatus(), MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_20.getValue())) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】未关箱,不能执行开箱操作!", containerSn.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未关箱,不能执行开箱操作!", containerSn.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
MesContainerPackageDetail packageDetail = containerPackageDetailRDao.getByProperty(new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "barCode"},
|
|
|
|
|
new Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn.getContainerSn()});
|
|
|
|
|
if (packageDetail != null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】已被容器【%s】绑定,请先解绑再执行开箱操作!", containerSn.getContainerSn(), packageDetail.getContainerSn());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]已被容器[%s]绑定,请先解绑再执行开箱操作!", containerSn.getContainerSn(), packageDetail.getContainerSn());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_10.getValue());
|
|
|
|
@ -602,10 +604,10 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (model == null) {
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码【%s】或容器类型代码【%s】未维护与零件关系,请检查数据", containerSn.getContainerSn(), containerSn.getContainerTypeCode());
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]或容器类型代码[%s]未维护与零件关系,请检查数据", containerSn.getContainerSn(), containerSn.getContainerTypeCode());
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isEmpty(selectPartNo) && !Objects.equals(selectPartNo, model.getPartNo())) {
|
|
|
|
|
MesPcnException.throwMesBusiException("条码【%s】的零件号【%s】与选择的零件不匹配,请检查数据", barCode, model.getPartNo());
|
|
|
|
|
MesPcnException.throwMesBusiException("条码[%s]的零件号【%s】与选择的零件不匹配,请检查数据", barCode, model.getPartNo());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return model;
|
|
|
|
|