demand: tms-运输管理-漏组批次订单扫描过滤调规则有效期范围外的规则

committer: heyu
This commit is contained in:
aike 2025-09-01 13:30:53 +08:00
parent 4de32fdd85
commit d9612d0f86

View File

@ -5283,6 +5283,29 @@ public class EmisBaseService {
allNodes.addAll(path);
}
// 过滤出运单发货日期在规则有效期内的规则
if (waybill.getSendDate() != null) {
allNodes = allNodes.stream()
.filter(transPlanRule -> {
// 如果规则没有设置有效期,则默认有效
if (transPlanRule.getStartDate() == null && transPlanRule.getEndDate() == null) {
return true;
}
// 如果只设置了开始日期,检查发货日期是否在开始日期之后
if (transPlanRule.getStartDate() != null && transPlanRule.getEndDate() == null) {
return !waybill.getSendDate().before(transPlanRule.getStartDate());
}
// 如果只设置了结束日期,检查发货日期是否在结束日期之前
if (transPlanRule.getStartDate() == null && transPlanRule.getEndDate() != null) {
return !waybill.getSendDate().after(transPlanRule.getEndDate());
}
// 如果同时设置了开始和结束日期,检查发货日期是否在有效期内
return !waybill.getSendDate().before(transPlanRule.getStartDate()) &&
!waybill.getSendDate().after(transPlanRule.getEndDate());
})
.collect(Collectors.toList());
}
// 按ancestors长度分组去重
Map<Integer, List<EmisTransPlanRule>> levelMap = new HashMap<>();
for (EmisTransPlanRule node : allNodes) {