diff --git a/src/main/java/com/xujie/sys/modules/ecss/entity/EcssDeclarationHeaderData.java b/src/main/java/com/xujie/sys/modules/ecss/entity/EcssDeclarationHeaderData.java index 2057ac36..3824a68b 100644 --- a/src/main/java/com/xujie/sys/modules/ecss/entity/EcssDeclarationHeaderData.java +++ b/src/main/java/com/xujie/sys/modules/ecss/entity/EcssDeclarationHeaderData.java @@ -71,5 +71,6 @@ public class EcssDeclarationHeaderData extends EcssDeclarationHeader{ private Boolean showWeight; private BigDecimal allWeight; private Boolean mexicoShippingMarkFlag; + private Boolean showOrderNoFlag; private String modelContentStr; } diff --git a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java index fdb82b04..e40f4adf 100644 --- a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java @@ -965,6 +965,15 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { || "02-Hardtag".equalsIgnoreCase(buNoTrim); } + private boolean isShowOrderNoBu(String buNo) { + if (StringUtils.isBlank(buNo)) { + return false; + } + String buNoTrim = buNo.trim(); + return "05-Alpha".equalsIgnoreCase(buNoTrim) + || "02-Hardtag".equalsIgnoreCase(buNoTrim); + } + private String buildDefaultVoyage(EcssCoDelNotifyHeaderData notifyHeader) { if (notifyHeader == null) { return ""; @@ -2010,6 +2019,36 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { return result.toString(); } + /** + * 出口货物委托书货物描述下方 PO 显示格式:中间 '/' 分隔,每4个换一行。 + */ + private String formatPoNoForHwDesc(Collection poNoCollection) { + if (poNoCollection == null || poNoCollection.isEmpty()) { + return ""; + } + List poNoList = poNoCollection.stream() + .filter(Objects::nonNull) + .map(String::trim) + .filter(StringUtils::isNotBlank) + .collect(Collectors.toList()); + if (poNoList.isEmpty()) { + return ""; + } + + StringBuilder result = new StringBuilder(); + for (int i = 0; i < poNoList.size(); i++) { + if (i > 0) { + if (i % 4 == 0) { + result.append("\n"); + } else { + result.append(" / "); + } + } + result.append(poNoList.get(i)); + } + return result.toString(); + } + private void extractedInvoice(EcssDeclarationHeaderData data, ExcelTemplateAdapter template, EcssCoDelNotifyHeaderData notifyHeader) { List notifyDetailList = data.getNotifyPartDetailList(); @@ -2911,7 +2950,13 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { } ttlAmount = ttlAmount.add((BigDecimal) map.get("ttl_amount")); } - template.addVar("poNo", formatPoNoForDisplay(poNoSet)); + boolean showOrderNoFlag = data != null && Boolean.TRUE.equals(data.getShowOrderNoFlag()); + String buNo = notifyHeader == null ? "" : notifyHeader.getBuNo(); + String poNoDisplayText = formatPoNoForDisplay(poNoSet); + if (isShowOrderNoBu(buNo)) { + poNoDisplayText = showOrderNoFlag ? formatPoNoForHwDesc(poNoSet) : ""; + } + template.addVar("hw_desc", sb + "\n" +poNoDisplayText); template.addVar("shipping_port", stringInput(notifyHeader.getCnative())); template.addVar("cmc_invoice", stringInput(notifyHeader.getCmcInvoice())); // 导出时默认,可编辑的栏目 diff --git a/src/main/resources/templates/ALPHA/declaration-all-template.xlsx b/src/main/resources/templates/ALPHA/declaration-all-template.xlsx index 3fb0baf6..b63ab2a3 100644 Binary files a/src/main/resources/templates/ALPHA/declaration-all-template.xlsx and b/src/main/resources/templates/ALPHA/declaration-all-template.xlsx differ diff --git a/src/main/resources/templates/ALPHA/export-goods-template.xlsx b/src/main/resources/templates/ALPHA/export-goods-template.xlsx index f8b9d1f9..beb2486f 100644 Binary files a/src/main/resources/templates/ALPHA/export-goods-template.xlsx and b/src/main/resources/templates/ALPHA/export-goods-template.xlsx differ diff --git a/src/main/resources/templates/YB/declaration-all-template.xlsx b/src/main/resources/templates/YB/declaration-all-template.xlsx index bbf827a3..4cae3eac 100644 Binary files a/src/main/resources/templates/YB/declaration-all-template.xlsx and b/src/main/resources/templates/YB/declaration-all-template.xlsx differ diff --git a/src/main/resources/templates/YB/export-goods-template.xlsx b/src/main/resources/templates/YB/export-goods-template.xlsx index f714e151..5887f7ee 100644 Binary files a/src/main/resources/templates/YB/export-goods-template.xlsx and b/src/main/resources/templates/YB/export-goods-template.xlsx differ