|
|
@ -57,10 +57,10 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private SnowflakeIdMaker snowflakeIdMaker;
|
|
|
|
private SnowflakeIdMaker snowflakeIdMaker;
|
|
|
|
|
|
|
|
|
|
|
|
private MesContainerPackage getContainerPackage(MesContainerSnBindModel model, MesContainerSn containerSn) {
|
|
|
|
private MesContainerPackage getContainerPackage(MesContainerSnBindModel model, String containerSn) {
|
|
|
|
MesContainerPackage containerPackage = containerPackageRDao.getByProperty(
|
|
|
|
MesContainerPackage containerPackage = containerPackageRDao.getByProperty(
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
|
|
|
|
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 Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn});
|
|
|
|
return containerPackage;
|
|
|
|
return containerPackage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -71,12 +71,12 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
return packageDetails;
|
|
|
|
return packageDetails;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<MesContainerPartsModel> getContainerParts(String organizeCode, String containerTypeCode, String containerSn) {
|
|
|
|
private List<MesContainerPartsModel> getContainerParts(String organizeCode, MesContainerType containerType, String containerSn) {
|
|
|
|
List<MesContainerPartsModel> result = new ArrayList<>();
|
|
|
|
List<MesContainerPartsModel> result = new ArrayList<>();
|
|
|
|
Set<String> partNoSet = new HashSet<>();
|
|
|
|
Set<String> partNoSet = new HashSet<>();
|
|
|
|
List<MesContainerSnPart> snPartList = containerSnPartRDao.findByProperty(
|
|
|
|
List<MesContainerSnPart> snPartList = containerSnPartRDao.findByProperty(
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerTypeCode", "containerSn"},
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerTypeCode", "containerSn"},
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerTypeCode, containerSn});
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerType.getContainerTypeCode(), containerSn});
|
|
|
|
if (!CollectionUtils.isEmpty(snPartList)) {
|
|
|
|
if (!CollectionUtils.isEmpty(snPartList)) {
|
|
|
|
for (MesContainerSnPart snPart : snPartList) {
|
|
|
|
for (MesContainerSnPart snPart : snPartList) {
|
|
|
|
if (StringUtils.isEmpty(snPart.getPartNo())) {
|
|
|
|
if (StringUtils.isEmpty(snPart.getPartNo())) {
|
|
|
@ -85,6 +85,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
|
|
|
|
|
|
|
partNoSet.add(snPart.getPartNo());
|
|
|
|
partNoSet.add(snPart.getPartNo());
|
|
|
|
MesContainerPartsModel model = MesContainerPartsModel.builder()
|
|
|
|
MesContainerPartsModel model = MesContainerPartsModel.builder()
|
|
|
|
|
|
|
|
.containerType(containerType.getContainerType())
|
|
|
|
.partNo(snPart.getPartNo())
|
|
|
|
.partNo(snPart.getPartNo())
|
|
|
|
.partName(snPart.getPartName())
|
|
|
|
.partName(snPart.getPartName())
|
|
|
|
.matchType(snPart.getMatchType())
|
|
|
|
.matchType(snPart.getMatchType())
|
|
|
@ -97,7 +98,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
|
|
|
|
|
|
|
List<MesContainerTypePart> partList = containerTypePartRDao.findByProperty(
|
|
|
|
List<MesContainerTypePart> partList = containerTypePartRDao.findByProperty(
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerTypeCode"},
|
|
|
|
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(), containerTypeCode});
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerType.getContainerTypeCode()});
|
|
|
|
if (!CollectionUtils.isEmpty(partList)) {
|
|
|
|
if (!CollectionUtils.isEmpty(partList)) {
|
|
|
|
for (MesContainerTypePart partPart : partList) {
|
|
|
|
for (MesContainerTypePart partPart : partList) {
|
|
|
|
if (StringUtils.isEmpty(partPart.getPartNo())) {
|
|
|
|
if (StringUtils.isEmpty(partPart.getPartNo())) {
|
|
|
@ -108,6 +109,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MesContainerPartsModel model = MesContainerPartsModel.builder()
|
|
|
|
MesContainerPartsModel model = MesContainerPartsModel.builder()
|
|
|
|
|
|
|
|
.containerType(containerType.getContainerType())
|
|
|
|
.partNo(partPart.getPartNo())
|
|
|
|
.partNo(partPart.getPartNo())
|
|
|
|
.partName(partPart.getPartName())
|
|
|
|
.partName(partPart.getPartName())
|
|
|
|
.matchType(partPart.getMatchType())
|
|
|
|
.matchType(partPart.getMatchType())
|
|
|
@ -219,7 +221,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
|
|
|
|
|
|
|
|
model.setBindIsChoosePart(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
model.setBindIsChoosePart(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
if (Objects.equals(containerType.getBindIsChoosePart(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue())) {
|
|
|
|
if (Objects.equals(containerType.getBindIsChoosePart(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue())) {
|
|
|
|
List<MesContainerPartsModel> partsModelList = getContainerParts(model.getOrganizeCode(), containerType.getContainerTypeCode(), containerSn.getContainerSn());
|
|
|
|
List<MesContainerPartsModel> partsModelList = getContainerParts(model.getOrganizeCode(), containerType, containerSn.getContainerSn());
|
|
|
|
if (CollectionUtils.isEmpty(partsModelList)) {
|
|
|
|
if (CollectionUtils.isEmpty(partsModelList)) {
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]或容器类型代码[%s]未维护与容器关系,请检查数据", containerSn.getContainerSn(), containerType.getContainerTypeCode());
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]或容器类型代码[%s]未维护与容器关系,请检查数据", containerSn.getContainerSn(), containerType.getContainerTypeCode());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -346,8 +348,14 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerPackage.getId(), detail.getBarCode(), MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.UN_BINDING.getValue()})) {
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerPackage.getId(), detail.getBarCode(), MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.UN_BINDING.getValue()})) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(containerPackage, detail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.UN_BINDING, username);
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(detail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.UN_BINDING, username);
|
|
|
|
detailBindingRDao.insert(binding);
|
|
|
|
detailBindingRDao.insert(binding);
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(detail.getBarCode(), "containerSn", ddlPackBean);
|
|
|
|
|
|
|
|
containerSnStationRDao.updateByProperties(
|
|
|
|
|
|
|
|
new String[]{"modifyUser", "modifyDatetime", "isDeleted"},
|
|
|
|
|
|
|
|
new Object[]{username, TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()},
|
|
|
|
|
|
|
|
ddlPackBean);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 容器置为拆箱状态。
|
|
|
|
// 容器置为拆箱状态。
|
|
|
|
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_30.getValue());
|
|
|
|
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_30.getValue());
|
|
|
@ -425,16 +433,28 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
barcode = bottomPackageDetails.get(0).getBarCode();
|
|
|
|
barcode = bottomPackageDetails.get(0).getBarCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MesContainerPartsModel containerPart = checkProduceSn(model.getOrganizeCode(), containerSn, barcode, model.getPartNo());
|
|
|
|
MesContainerPartsModel containerPart = null;
|
|
|
|
containerPart.setContainerType(containerType.getContainerType());
|
|
|
|
Map<String, Object> matchResult = null;
|
|
|
|
containerPart.setContainerPackage(containerPackage);
|
|
|
|
List<MesContainerPartsModel> containerPartsModels = getContainerParts(model.getOrganizeCode(), containerType, containerSn.getContainerSn());
|
|
|
|
|
|
|
|
for (MesContainerPartsModel containerPartsModel : containerPartsModels) {
|
|
|
|
// 调用策略校验条码与容器是否可以绑定
|
|
|
|
// 调用策略校验条码与容器是否可以绑定
|
|
|
|
Map<String, Object> matchResult = ContainerBindManager.INSTANCE.matchNumberRule(model.getOrganizeCode(), barcode, containerPart);
|
|
|
|
matchResult = ContainerBindManager.INSTANCE.matchNumberRule(model.getOrganizeCode(), barcode, containerPartsModel);
|
|
|
|
assert matchResult != null;
|
|
|
|
assert matchResult != null;
|
|
|
|
if (Objects.equals(matchResult.get(MesPcnExtConstWords.RESULT), false)) {
|
|
|
|
if (Objects.equals(matchResult.get(MesPcnExtConstWords.RESULT), true)) {
|
|
|
|
MesPcnException.throwMesBusiException(matchResult.get(MesPcnExtConstWords.MESSAGE).toString());
|
|
|
|
containerPart = containerPartsModel;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (containerPart == null) {
|
|
|
|
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]或容器类型代码[%s]未维护与零件关系,请检查数据", containerSn.getContainerSn(), containerSn.getContainerTypeCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(model.getPartNo()) && !Objects.equals(model.getPartNo(), containerPart.getPartNo())) {
|
|
|
|
|
|
|
|
MesPcnException.throwMesBusiException("条码[%s]的零件号【%s】与选择的零件不匹配,请检查数据", model.getBarCode(), model.getPartNo());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
containerPart.setContainerType(containerType.getContainerType());
|
|
|
|
|
|
|
|
containerPart.setContainerPackage(containerPackage);
|
|
|
|
|
|
|
|
|
|
|
|
MesContainerPackageDetail packageDetail = createContainerPackageDetail(model, containerPackage, containerPart, matchResult);
|
|
|
|
MesContainerPackageDetail packageDetail = createContainerPackageDetail(model, containerPackage, containerPart, matchResult);
|
|
|
|
List<MesContainerPackageDetail> combPackageDetails = new ArrayList<>(oldPackageDetails);
|
|
|
|
List<MesContainerPackageDetail> combPackageDetails = new ArrayList<>(oldPackageDetails);
|
|
|
|
if (CollectionUtils.isEmpty(bottomPackageDetails)) {
|
|
|
|
if (CollectionUtils.isEmpty(bottomPackageDetails)) {
|
|
|
@ -446,12 +466,12 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MesAbstractContainerBindCheckQtyService checkQtyService = ContainerBindManager.INSTANCE.getCheckQtyService(MesExtEnumUtil.CONTAINER_TYPE_MIX_TYPE.getByValue(containerType.getMixType()));
|
|
|
|
MesAbstractContainerBindCheckQtyService checkQtyService = ContainerBindManager.INSTANCE.getCheckQtyService(MesExtEnumUtil.CONTAINER_TYPE_MIX_TYPE.getByValue(containerType.getMixType()));
|
|
|
|
Map<String, Object> checkQtyResult = checkQtyService.doCheck(model.getOrganizeCode(), containerPackage, combPackageDetails, getContainerParts(model.getOrganizeCode(), containerType.getContainerTypeCode(), containerSn.getContainerSn()));
|
|
|
|
Map<String, Object> checkQtyResult = checkQtyService.doCheck(model.getOrganizeCode(), containerPackage, combPackageDetails, containerPartsModels);
|
|
|
|
if (checkQtyResult != null && Objects.equals(checkQtyResult.get(MesPcnExtConstWords.RESULT), false)) {
|
|
|
|
if (checkQtyResult != null && Objects.equals(checkQtyResult.get(MesPcnExtConstWords.RESULT), false)) {
|
|
|
|
MesPcnException.throwMesBusiException(checkQtyResult.get(MesPcnExtConstWords.MESSAGE).toString());
|
|
|
|
MesPcnException.throwMesBusiException(checkQtyResult.get(MesPcnExtConstWords.MESSAGE).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(containerPackage, packageDetail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.BINDING, model.getUserName());
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(packageDetail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.BINDING, model.getUserName());
|
|
|
|
|
|
|
|
|
|
|
|
packageDetails.add(packageDetail);
|
|
|
|
packageDetails.add(packageDetail);
|
|
|
|
model.setContainerPackage(containerPackage);
|
|
|
|
model.setContainerPackage(containerPackage);
|
|
|
@ -485,7 +505,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
public MesContainerSnBindModel doClear(MesContainerSnBindModel model) {
|
|
|
|
public MesContainerSnBindModel doClear(MesContainerSnBindModel model) {
|
|
|
|
//校验容器条码
|
|
|
|
//校验容器条码
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn);
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn.getContainerSn());
|
|
|
|
if (containerPackage == null) {
|
|
|
|
if (containerPackage == null) {
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -504,9 +524,10 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
containerPackageRDao.update(containerPackage);
|
|
|
|
containerPackageRDao.update(containerPackage);
|
|
|
|
|
|
|
|
|
|
|
|
for (MesContainerPackageDetail packageDetail : packageDetails) {
|
|
|
|
for (MesContainerPackageDetail packageDetail : packageDetails) {
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(containerPackage, packageDetail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.UN_BINDING, model.getUserName());
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(packageDetail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.UN_BINDING, model.getUserName());
|
|
|
|
detailBindingRDao.insert(binding);
|
|
|
|
detailBindingRDao.insert(binding);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
deleteContainerSnStation(containerPackage, model.getUserName());
|
|
|
|
model.setPackageDetails(new ArrayList<>());
|
|
|
|
model.setPackageDetails(new ArrayList<>());
|
|
|
|
return model;
|
|
|
|
return model;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -515,16 +536,27 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
public MesContainerSnBindModel doDeleteDetails(MesContainerSnBindModel model) {
|
|
|
|
public MesContainerSnBindModel doDeleteDetails(MesContainerSnBindModel model) {
|
|
|
|
//校验容器条码
|
|
|
|
//校验容器条码
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn);
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn.getContainerSn());
|
|
|
|
if (containerPackage == null) {
|
|
|
|
if (containerPackage == null) {
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<Long> deleteDetailIds = new ArrayList<>();
|
|
|
|
List<Long> deleteDetailIds = new ArrayList<>();
|
|
|
|
for (MesContainerPackageDetail detail : model.getPackageDetails()) {
|
|
|
|
for (MesContainerPackageDetail detail : model.getPackageDetails()) {
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(containerPackage, detail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.UN_BINDING, model.getUserName());
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(detail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.UN_BINDING, model.getUserName());
|
|
|
|
detailBindingRDao.insert(binding);
|
|
|
|
detailBindingRDao.insert(binding);
|
|
|
|
|
|
|
|
|
|
|
|
deleteDetailIds.add(detail.getId());
|
|
|
|
deleteDetailIds.add(detail.getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(detail.getBarCode(), "containerSn", ddlPackBean);
|
|
|
|
|
|
|
|
containerSnStationRDao.updateByProperties(
|
|
|
|
|
|
|
|
new String[]{"modifyUser", "modifyDatetime", "isDeleted"},
|
|
|
|
|
|
|
|
new Object[]{model.getUserName(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()},
|
|
|
|
|
|
|
|
ddlPackBean);
|
|
|
|
|
|
|
|
MesContainerPackage detailPackage = getContainerPackage(model, detail.getBarCode());
|
|
|
|
|
|
|
|
if (detailPackage != null) {
|
|
|
|
|
|
|
|
deleteContainerSnStation(detailPackage, model.getUserName());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
containerPackageDetailRDao.deleteWeaklyByIds(deleteDetailIds.toArray(new Long[0]), model.getUserName());
|
|
|
|
containerPackageDetailRDao.deleteWeaklyByIds(deleteDetailIds.toArray(new Long[0]), model.getUserName());
|
|
|
|
|
|
|
|
|
|
|
@ -540,7 +572,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
public MesContainerSnBindModel doClosePackage(MesContainerSnBindModel model) {
|
|
|
|
public MesContainerSnBindModel doClosePackage(MesContainerSnBindModel model) {
|
|
|
|
//校验容器条码
|
|
|
|
//校验容器条码
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn);
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn.getContainerSn());
|
|
|
|
if (containerPackage == null) {
|
|
|
|
if (containerPackage == null) {
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -551,7 +583,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "pid"},
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "pid"},
|
|
|
|
new Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerPackage.getId()});
|
|
|
|
new Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerPackage.getId()});
|
|
|
|
for (MesContainerPackageDetail detail : packageDetails) {
|
|
|
|
for (MesContainerPackageDetail detail : packageDetails) {
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(containerPackage, detail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.CLOSE, model.getUserName());
|
|
|
|
MesContainerPackageDetailBinding binding = createContainerPackageDetailBinding(detail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS.CLOSE, model.getUserName());
|
|
|
|
detailBindingRDao.insert(binding);
|
|
|
|
detailBindingRDao.insert(binding);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -567,7 +599,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
public MesContainerSnBindModel doOpenPackage(MesContainerSnBindModel model) {
|
|
|
|
public MesContainerSnBindModel doOpenPackage(MesContainerSnBindModel model) {
|
|
|
|
//校验容器条码
|
|
|
|
//校验容器条码
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
MesContainerSn containerSn = containerSnService.checkContainerSn(model.getOrganizeCode(), model.getContainerSn());
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn);
|
|
|
|
MesContainerPackage containerPackage = getContainerPackage(model, containerSn.getContainerSn());
|
|
|
|
if (containerPackage == null) {
|
|
|
|
if (containerPackage == null) {
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
MesPcnException.throwMesBusiException("容器条码[%s]未生成容器条码上料主表,请检查数据", containerSn.getContainerSn());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -644,12 +676,12 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
return detail;
|
|
|
|
return detail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MesContainerPackageDetailBinding createContainerPackageDetailBinding(MesContainerPackage containerPackage, MesContainerPackageDetail packageDetail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS snBindingStatus, String userName) {
|
|
|
|
private MesContainerPackageDetailBinding createContainerPackageDetailBinding(MesContainerPackageDetail packageDetail, MesExtEnumUtil.CONTAINER_RAW_SN_BINDING_STATUS snBindingStatus, String userName) {
|
|
|
|
MesContainerPackageDetailBinding binding = new MesContainerPackageDetailBinding();
|
|
|
|
MesContainerPackageDetailBinding binding = new MesContainerPackageDetailBinding();
|
|
|
|
binding.setOrganizeCode(containerPackage.getOrganizeCode());
|
|
|
|
binding.setOrganizeCode(packageDetail.getOrganizeCode());
|
|
|
|
binding.setPid(containerPackage.getId());
|
|
|
|
binding.setPid(packageDetail.getPid());
|
|
|
|
binding.setSourceId(packageDetail.getId());
|
|
|
|
binding.setSourceId(packageDetail.getId());
|
|
|
|
binding.setContainerSn(containerPackage.getContainerSn());
|
|
|
|
binding.setContainerSn(packageDetail.getContainerSn());
|
|
|
|
binding.setBarCode(packageDetail.getBarCode());
|
|
|
|
binding.setBarCode(packageDetail.getBarCode());
|
|
|
|
binding.setQty(packageDetail.getQty());
|
|
|
|
binding.setQty(packageDetail.getQty());
|
|
|
|
binding.setSnStatus(snBindingStatus.getValue());
|
|
|
|
binding.setSnStatus(snBindingStatus.getValue());
|
|
|
@ -657,4 +689,18 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
|
|
|
|
ConvertBean.serviceModelInitialize(binding, userName);
|
|
|
|
ConvertBean.serviceModelInitialize(binding, userName);
|
|
|
|
return binding;
|
|
|
|
return binding;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void deleteContainerSnStation(MesContainerPackage containerPackage, String userName) {
|
|
|
|
|
|
|
|
final String organizeCode = containerPackage.getOrganizeCode();
|
|
|
|
|
|
|
|
List<MesContainerPackageDetail> bottomPackageDetailList = new ArrayList<>();
|
|
|
|
|
|
|
|
getBottomPackageDetails(organizeCode, containerPackage, bottomPackageDetailList);
|
|
|
|
|
|
|
|
final Set<String> containerSnSet = bottomPackageDetailList.stream().map(MesContainerPackageDetail::getContainerSn).collect(Collectors.toSet());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(new ArrayList<>(containerSnSet), "containerSn", ddlPackBean);
|
|
|
|
|
|
|
|
containerSnStationRDao.updateByProperties(
|
|
|
|
|
|
|
|
new String[]{"modifyUser", "modifyDatetime", "isDeleted"},
|
|
|
|
|
|
|
|
new Object[]{userName, TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()},
|
|
|
|
|
|
|
|
ddlPackBean);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|