Browse Source

样式

master
han\hanst 1 week ago
parent
commit
13fdac7e57
  1. 21
      src/main/java/com/xujie/sys/common/utils/ExcelTemplateYB.java
  2. BIN
      src/main/resources/templates/ALPHA/declaration-all-template-pdf.xlsx
  3. BIN
      src/main/resources/templates/ALPHA/declaration-all-template.xlsx
  4. BIN
      src/main/resources/templates/ALPHA/declaration-packingList-template.xlsx
  5. BIN
      src/main/resources/templates/ALPHA/export-goods-template.xlsx
  6. BIN
      src/main/resources/templates/TX/declaration-all-template-pdf.xlsx
  7. BIN
      src/main/resources/templates/TX/declaration-all-template.xlsx
  8. BIN
      src/main/resources/templates/YB/declaration-all-template-invoice-pdf.xlsx
  9. BIN
      src/main/resources/templates/YB/declaration-all-template-invoice.xlsx
  10. BIN
      src/main/resources/templates/YB/declaration-all-template-pdf.xlsx
  11. BIN
      src/main/resources/templates/YB/declaration-all-template.xlsx
  12. BIN
      src/main/resources/templates/YB/declaration-packingList-template.xlsx
  13. BIN
      src/main/resources/templates/YB/export-goods-template.xlsx

21
src/main/java/com/xujie/sys/common/utils/ExcelTemplateYB.java

@ -52,7 +52,7 @@ public class ExcelTemplateYB {
// 发票价格列是否使用固定小数位单价5位总价2位
@Setter
private boolean fixedInvoicePriceScale = false;
// 报关单价格列是否固定两位小数净重/单价/总价
// 报关单价格列是否固定小数净重/总价2位单价5位
@Setter
private boolean fixedDeclarationPriceScale = false;
// 数字靠右 箱单
@ -316,6 +316,7 @@ public class ExcelTemplateYB {
Set<Integer> invoiceUnitPriceCols = new HashSet<>();
Set<Integer> invoiceTotalPriceCols = new HashSet<>();
Set<Integer> declarationFixedPriceCols = new HashSet<>();
Set<Integer> declarationUnitPriceCols = new HashSet<>();
Set<Integer> declarationQtyCols = new HashSet<>();
Set<Integer> declarationHsCodeDescCols = new HashSet<>();
//整体填值
@ -349,6 +350,8 @@ public class ExcelTemplateYB {
invoiceUnitPriceCols.add(j);
} else if (isInvoiceTotalPriceField(dtlField)) {
invoiceTotalPriceCols.add(j);
} else if (isDeclarationUnitPriceField(dtlField)) {
declarationUnitPriceCols.add(j);
} else if (isDeclarationFixedPriceField(dtlField)) {
declarationFixedPriceCols.add(j);
} else if (isDeclarationQtyField(dtlField)) {
@ -647,9 +650,10 @@ public class ExcelTemplateYB {
style.setWrapText(keepWrapText || declarationHsCodeDescColumn);
c7.setCellStyle(style);
boolean declarationFixedTwoScaleColumn = fixedDeclarationPriceScale && declarationFixedPriceCols.contains(i);
boolean declarationFixedFiveScaleColumn = fixedDeclarationPriceScale && declarationUnitPriceCols.contains(i);
boolean declarationQtyColumn = fixedDeclarationPriceScale && declarationQtyCols.contains(i);
boolean declarationNumberColumn = fixedDeclarationPriceScale
? (declarationFixedTwoScaleColumn || declarationQtyColumn)
? (declarationFixedTwoScaleColumn || declarationFixedFiveScaleColumn || declarationQtyColumn)
: (i == 6 || i == 11);
if (declarationNumberColumn) {
BigDecimal numericValue = null;
@ -659,7 +663,9 @@ public class ExcelTemplateYB {
numericValue = BigDecimal.valueOf(c7.getNumericCellValue());
}
if (numericValue != null) {
if (declarationFixedTwoScaleColumn) {
if (declarationFixedFiveScaleColumn) {
numericValue = numericValue.setScale(5, RoundingMode.HALF_UP);
} else if (declarationFixedTwoScaleColumn) {
numericValue = numericValue.setScale(2, RoundingMode.HALF_UP);
}
c7.setCellValue(numericValue.doubleValue());
@ -679,7 +685,9 @@ public class ExcelTemplateYB {
// 设置千分位格式根据单元格实际小数位动态决定格式
DataFormat dataFormat = workbook.createDataFormat();
String numFmt3;
if (declarationFixedTwoScaleColumn) {
if (declarationFixedFiveScaleColumn) {
numFmt3 = "#,##0.00000";
} else if (declarationFixedTwoScaleColumn) {
numFmt3 = "#,##0.00";
} else if (declarationQtyColumn) {
numFmt3 = "#,##0";
@ -937,10 +945,13 @@ public class ExcelTemplateYB {
private boolean isDeclarationFixedPriceField(String field) {
return "net_weight".equalsIgnoreCase(field)
|| "unit_price".equalsIgnoreCase(field)
|| "total_price".equalsIgnoreCase(field);
}
private boolean isDeclarationUnitPriceField(String field) {
return "unit_price".equalsIgnoreCase(field);
}
private boolean isDeclarationQtyField(String field) {
return "qty".equalsIgnoreCase(field);
}

BIN
src/main/resources/templates/ALPHA/declaration-all-template-pdf.xlsx

BIN
src/main/resources/templates/ALPHA/declaration-all-template.xlsx

BIN
src/main/resources/templates/ALPHA/declaration-packingList-template.xlsx

BIN
src/main/resources/templates/ALPHA/export-goods-template.xlsx

BIN
src/main/resources/templates/TX/declaration-all-template-pdf.xlsx

BIN
src/main/resources/templates/TX/declaration-all-template.xlsx

BIN
src/main/resources/templates/YB/declaration-all-template-invoice-pdf.xlsx

BIN
src/main/resources/templates/YB/declaration-all-template-invoice.xlsx

BIN
src/main/resources/templates/YB/declaration-all-template-pdf.xlsx

BIN
src/main/resources/templates/YB/declaration-all-template.xlsx

BIN
src/main/resources/templates/YB/declaration-packingList-template.xlsx

BIN
src/main/resources/templates/YB/export-goods-template.xlsx

Loading…
Cancel
Save