|
|
|
@ -1033,29 +1033,24 @@ public class ReportLabelListServiceImpl extends ServiceImpl<ReportLabelListMappe |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据外箱标签解析对应内箱标签 |
|
|
|
* 查外箱下面有没有内箱。ParentReportID 等于外箱编号即表示挂了内箱,返回该行的 ReportID。 |
|
|
|
* 例如 ParentReportID=A068 时,A068 的内箱是 A067。不看标签类型,也不按地址回退。 |
|
|
|
* 没有这样的行就返回 null,调用方只打外箱。 |
|
|
|
*/ |
|
|
|
private String resolveInnerLabelByCustomer(PrintLabelRequest printRequest, String outerLabelNo) { |
|
|
|
String customerId = StringUtils.trimToNull(printRequest.getCustomerId()); |
|
|
|
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(outerLabelNo)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
String addressNo = StringUtils.trimToNull(printRequest.getAddressNo()); |
|
|
|
try { |
|
|
|
CustomerLabelSettingData query = new CustomerLabelSettingData(); |
|
|
|
query.setSearchFlag("Y"); |
|
|
|
query.setCustomerId(customerId.trim()); |
|
|
|
// 不在SQL层限定addressNo,保留“地址精确匹配 -> 客户通用地址回退”的业务顺序 |
|
|
|
List<CustomerLabelSettingData> customerLabelList = baseService.getCustomerLabelSettingList(query); |
|
|
|
if (customerLabelList == null || customerLabelList.isEmpty()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
CustomerLabelSettingData exactInnerLabel = null; |
|
|
|
CustomerLabelSettingData exactAnyLabel = null; |
|
|
|
CustomerLabelSettingData fallbackInnerLabel = null; |
|
|
|
CustomerLabelSettingData fallbackAnyLabel = null; |
|
|
|
|
|
|
|
for (CustomerLabelSettingData item : customerLabelList) { |
|
|
|
if (item == null || StringUtils.isBlank(item.getLabelNo())) { |
|
|
|
continue; |
|
|
|
@ -1064,51 +1059,16 @@ public class ReportLabelListServiceImpl extends ServiceImpl<ReportLabelListMappe |
|
|
|
&& !StringUtils.equalsIgnoreCase(printRequest.getSite(), item.getSite())) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 子标签且上级就是当前外箱,才是这张外箱的内箱 |
|
|
|
if (!"Y".equalsIgnoreCase(StringUtils.trimToEmpty(item.getSubLabelFlag()))) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (!StringUtils.equalsIgnoreCase(StringUtils.trimToEmpty(item.getParentLabelNo()), outerLabelNo)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
boolean isInnerLabelType = "内箱标签".equals(StringUtils.trimToEmpty(item.getLabelType())); |
|
|
|
String itemAddressNo = StringUtils.trimToNull(item.getAddressNo()); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(addressNo)) { |
|
|
|
if (StringUtils.equalsIgnoreCase(addressNo, itemAddressNo)) { |
|
|
|
if (isInnerLabelType) { |
|
|
|
exactInnerLabel = item; |
|
|
|
break; |
|
|
|
} |
|
|
|
if (exactAnyLabel == null) { |
|
|
|
exactAnyLabel = item; |
|
|
|
} |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(itemAddressNo)) { |
|
|
|
if (isInnerLabelType && fallbackInnerLabel == null) { |
|
|
|
fallbackInnerLabel = item; |
|
|
|
} |
|
|
|
if (fallbackAnyLabel == null) { |
|
|
|
fallbackAnyLabel = item; |
|
|
|
} |
|
|
|
} |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
if (isInnerLabelType) { |
|
|
|
exactInnerLabel = item; |
|
|
|
break; |
|
|
|
} |
|
|
|
if (exactAnyLabel == null) { |
|
|
|
exactAnyLabel = item; |
|
|
|
} |
|
|
|
return item.getLabelNo(); |
|
|
|
} |
|
|
|
|
|
|
|
CustomerLabelSettingData targetLabel = exactInnerLabel != null ? exactInnerLabel |
|
|
|
: (exactAnyLabel != null ? exactAnyLabel |
|
|
|
: (fallbackInnerLabel != null ? fallbackInnerLabel : fallbackAnyLabel)); |
|
|
|
return targetLabel != null ? targetLabel.getLabelNo() : null; |
|
|
|
return null; |
|
|
|
} catch (Exception e) { |
|
|
|
log.warn("根据外箱标签解析内箱标签失败,customerId={}, outerLabelNo={}, error={}", |
|
|
|
customerId, outerLabelNo, e.getMessage()); |
|
|
|
|