diff --git a/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java b/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java index fbe5437..c7a33b3 100644 --- a/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java +++ b/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java @@ -168,10 +168,24 @@ public class BoxForNotificationServiceImpl implements BoxForNotificationService //---*批号的物料可以通吃 if(!"*".equals(stock.getBatchNo())) { - // 校验批次号:只要有一行partNo和batchNo都匹配即可 + // 校验批次号:outBatchNo可能是多个号码用";"拼接,如A001;B002;C003 + String rollBatchNo = stock.getBatchNo(); boolean batchNoMatch = checkPartNo.stream() .filter(detail -> detail.getPartNo() != null && detail.getPartNo().equals(stock.getPartNo())) - .anyMatch(detail -> detail.getOutBatchNo() != null && detail.getOutBatchNo().equals(stock.getBatchNo())); + .anyMatch(detail -> { + String outBatchNo = detail.getOutBatchNo(); + if (outBatchNo == null || outBatchNo.isEmpty()) { + return false; + } + // 按";"分割,检查是否包含rollBatchNo + String[] batchNos = outBatchNo.split(";"); + for (String batchNo : batchNos) { + if (batchNo != null && batchNo.trim().equals(rollBatchNo)) { + return true; + } + } + return false; + }); if (!batchNoMatch) { throw new RuntimeException("该卷的批次号与销售发货单中的批次号不匹配"); }