feat: 海运报价单询价栏写入贸易条款和运输分类
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+2
-1
@@ -797,7 +797,7 @@ public class InquiryQuoteTemplateServiceImpl extends ServiceImpl<InquiryQuoteTem
|
|||||||
out.put("destination", first(src, "目的地", "目的港", "destination", "pod"));
|
out.put("destination", first(src, "目的地", "目的港", "destination", "pod"));
|
||||||
out.put("commodity", first(src, "品名", "货物品名", "commodity"));
|
out.put("commodity", first(src, "品名", "货物品名", "commodity"));
|
||||||
out.put("vehicle_qty", first(src, "车型/数量", "车型"));
|
out.put("vehicle_qty", first(src, "车型/数量", "车型"));
|
||||||
// 海运七项:合同键是 quantity / fcl_or_lcl / container_type_qty,工单事实是中文键
|
// 海运询价栏:合同键是 quantity / fcl_or_lcl / container_type_qty / trade_terms,工单事实是中文键
|
||||||
out.put("quantity", first(src, "货量", "货物数量", "quantity"));
|
out.put("quantity", first(src, "货量", "货物数量", "quantity"));
|
||||||
out.put("fcl_or_lcl", first(src, "整柜或拼柜", "fcl_or_lcl"));
|
out.put("fcl_or_lcl", first(src, "整柜或拼柜", "fcl_or_lcl"));
|
||||||
out.put("container_type_qty", first(src, "箱型箱量", "container_type_qty"));
|
out.put("container_type_qty", first(src, "箱型箱量", "container_type_qty"));
|
||||||
@@ -806,6 +806,7 @@ public class InquiryQuoteTemplateServiceImpl extends ServiceImpl<InquiryQuoteTem
|
|||||||
out.put("volume_cbm", first(src, "体积", "volume_cbm"));
|
out.put("volume_cbm", first(src, "体积", "volume_cbm"));
|
||||||
out.put("quote_date", first(src, "报价日期", "quote_date", "询价日期"));
|
out.put("quote_date", first(src, "报价日期", "quote_date", "询价日期"));
|
||||||
out.put("trade_terms", first(src, "贸易条款", "trade_terms"));
|
out.put("trade_terms", first(src, "贸易条款", "trade_terms"));
|
||||||
|
out.put("运输分类", first(src, "运输分类"));
|
||||||
out.put("cargo_ready_date", first(src, "货好时间", "cargo_ready_date"));
|
out.put("cargo_ready_date", first(src, "货好时间", "cargo_ready_date"));
|
||||||
out.put("hs_code", first(src, "商品海关编码", "HS编码", "海关编码", "hs_code"));
|
out.put("hs_code", first(src, "商品海关编码", "HS编码", "海关编码", "hs_code"));
|
||||||
String oil = first(src, "是否含油", "has_oil");
|
String oil = first(src, "是否含油", "has_oil");
|
||||||
|
|||||||
+1
-1
@@ -2484,7 +2484,7 @@ public final class QuoteTemplateExcelSupport {
|
|||||||
}
|
}
|
||||||
String[] markers = {
|
String[] markers = {
|
||||||
"起运港", "目的港", "询价日期", "品名", "货物数量", "整柜或拼柜", "箱型箱量",
|
"起运港", "目的港", "询价日期", "品名", "货物数量", "整柜或拼柜", "箱型箱量",
|
||||||
"贸易条款", "货好时间", "商品海关编码", "是否含油", "提货地址", "送货地址", "报价有效期", "费用总计",
|
"贸易条款", "运输分类", "货好时间", "商品海关编码", "是否含油", "提货地址", "送货地址", "报价有效期", "费用总计",
|
||||||
"始发港", "目的地", "Inquiry Date", "Commodity", "Place of Receipt"
|
"始发港", "目的地", "Inquiry Date", "Commodity", "Place of Receipt"
|
||||||
};
|
};
|
||||||
for (String m : markers) {
|
for (String m : markers) {
|
||||||
|
|||||||
+43
@@ -291,6 +291,8 @@ public class QuoteTemplateFillTest {
|
|||||||
facts.put("货量", "15件");
|
facts.put("货量", "15件");
|
||||||
facts.put("整柜或拼柜", "整柜");
|
facts.put("整柜或拼柜", "整柜");
|
||||||
facts.put("箱型箱量", "20GP*1");
|
facts.put("箱型箱量", "20GP*1");
|
||||||
|
facts.put("贸易条款", "FOB");
|
||||||
|
facts.put("运输分类", "Port to Port");
|
||||||
facts.put("报价日期", "2026-09-15");
|
facts.put("报价日期", "2026-09-15");
|
||||||
Map<String, Object> quote = new HashMap<>();
|
Map<String, Object> quote = new HashMap<>();
|
||||||
quote.put("total", "2287.65");
|
quote.put("total", "2287.65");
|
||||||
@@ -306,9 +308,50 @@ public class QuoteTemplateFillTest {
|
|||||||
assertEquals("15件", out.getString("quantity"));
|
assertEquals("15件", out.getString("quantity"));
|
||||||
assertEquals("整柜", out.getString("fcl_or_lcl"));
|
assertEquals("整柜", out.getString("fcl_or_lcl"));
|
||||||
assertEquals("20GP*1", out.getString("container_type_qty"));
|
assertEquals("20GP*1", out.getString("container_type_qty"));
|
||||||
|
assertEquals("FOB", out.getString("trade_terms"));
|
||||||
|
assertEquals("Port to Port", out.getString("运输分类"));
|
||||||
assertEquals("2287.65", out.getString("total_amount"));
|
assertEquals("2287.65", out.getString("total_amount"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 海运询价栏:贸易条款、运输分类按标签右侧原文写入。
|
||||||
|
* 标签格子本身不能被港口/分类值盖掉。
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void seaInquiryWritesTradeTermsAndClassByLabel() throws Exception {
|
||||||
|
Path src = Files.createTempFile("quote-sea-class-src", ".xlsx");
|
||||||
|
Path out = Files.createTempFile("quote-sea-class-out", ".xlsx");
|
||||||
|
try (Workbook wb = new XSSFWorkbook()) {
|
||||||
|
Sheet sheet = wb.createSheet("海运询价单");
|
||||||
|
row(sheet, 8).createCell(0).setCellValue("贸易条款");
|
||||||
|
row(sheet, 9).createCell(0).setCellValue("运输分类");
|
||||||
|
try (java.io.OutputStream os = Files.newOutputStream(src)) {
|
||||||
|
wb.write(os);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, Object> ticket = new HashMap<>();
|
||||||
|
ticket.put("贸易条款", "FOB");
|
||||||
|
ticket.put("运输分类", "Port to Port");
|
||||||
|
ticket.put("起运港", "DONGGUAN");
|
||||||
|
JSONObject facts = org.jeecg.modules.inquiry.service.impl.InquiryQuoteTemplateServiceImpl
|
||||||
|
.buildFillFacts("WO202609200010", ticket, new HashMap<>(), "WuJiLin");
|
||||||
|
assertEquals("FOB", facts.getString("trade_terms"));
|
||||||
|
assertEquals("Port to Port", facts.getString("运输分类"));
|
||||||
|
JSONObject mapping = new JSONObject();
|
||||||
|
mapping.put("fields", new JSONObject());
|
||||||
|
QuoteTemplateExcelSupport.fillWorkbook(src, out, mapping, facts);
|
||||||
|
try (Workbook filled = new XSSFWorkbook(Files.newInputStream(out))) {
|
||||||
|
Sheet sheet = filled.getSheetAt(0);
|
||||||
|
assertEquals("贸易条款", read(sheet, 8, 0));
|
||||||
|
assertEquals("FOB", read(sheet, 8, 1));
|
||||||
|
assertEquals("运输分类", read(sheet, 9, 0));
|
||||||
|
assertEquals("Port to Port", read(sheet, 9, 1));
|
||||||
|
} finally {
|
||||||
|
Files.deleteIfExists(src);
|
||||||
|
Files.deleteIfExists(out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void buildFillFactsProjectsCollabFields() {
|
public void buildFillFactsProjectsCollabFields() {
|
||||||
Map<String, Object> facts = new HashMap<>();
|
Map<String, Object> facts = new HashMap<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user