@chenchaolong/plugin-trade-compliance-workbench 1.0.253 → 1.0.254
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/customs-packing-weight.d.ts +7 -8
- package/dist/lib/customs-packing-weight.d.ts.map +1 -1
- package/dist/lib/customs-packing-weight.js +4 -7
- package/dist/lib/customs-packing-weight.js.map +1 -1
- package/dist/lib/document-pricing.d.ts +1 -2
- package/dist/lib/document-pricing.d.ts.map +1 -1
- package/dist/lib/document-pricing.js +1 -4
- package/dist/lib/document-pricing.js.map +1 -1
- package/dist/lib/invoice/dynamic-render.d.ts +1 -0
- package/dist/lib/invoice/dynamic-render.d.ts.map +1 -1
- package/dist/lib/invoice/dynamic-render.js +36 -19
- package/dist/lib/invoice/dynamic-render.js.map +1 -1
- package/dist/lib/invoice/values.js +1 -1
- package/dist/lib/invoice/values.js.map +1 -1
- package/dist/lib/invoice-formatting.d.ts +1 -0
- package/dist/lib/invoice-formatting.d.ts.map +1 -1
- package/dist/lib/invoice-formatting.js +1 -1
- package/dist/lib/invoice-formatting.js.map +1 -1
- package/dist/lib/packing/packing-document-weights.d.ts +1 -2
- package/dist/lib/packing/packing-document-weights.d.ts.map +1 -1
- package/dist/lib/packing/packing-document-weights.js +8 -52
- package/dist/lib/packing/packing-document-weights.js.map +1 -1
- package/dist/lib/packing/packing-layout.js +2 -2
- package/dist/lib/packing/packing-layout.js.map +1 -1
- package/dist/lib/packing/packing-render.d.ts.map +1 -1
- package/dist/lib/packing/packing-render.js +13 -9
- package/dist/lib/packing/packing-render.js.map +1 -1
- package/dist/lib/packing/supplier-packing.service.js +4 -4
- package/dist/lib/packing/supplier-packing.service.js.map +1 -1
- package/dist/lib/remote-components/trade-compliance-workbench/app.css +1 -1
- package/dist/lib/remote-components/trade-compliance-workbench/app.js +4 -4
- package/dist/lib/remote-ui/app-source.js +1 -1
- package/dist/lib/remote-ui/app-source.js.map +1 -1
- package/dist/lib/remote-ui/pages/procurement-contracts.css +0 -5
- package/dist/lib/remote-ui/pages/procurement.d.ts.map +1 -1
- package/dist/lib/remote-ui/pages/procurement.js +9 -9
- package/dist/lib/remote-ui/pages/procurement.js.map +1 -1
- package/dist/lib/sales-file.service.d.ts +1 -1
- package/dist/lib/sales-file.service.d.ts.map +1 -1
- package/dist/lib/sales-file.service.js +19 -14
- package/dist/lib/sales-file.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ export declare const MAX_EDITED_WORKBOOK_BYTES: number;
|
|
|
13
13
|
export declare const MAX_EDITED_WORKBOOK_ZIP_ENTRIES = 2048;
|
|
14
14
|
export declare const MAX_EDITED_WORKBOOK_ZIP_UNCOMPRESSED_BYTES: number;
|
|
15
15
|
export declare const OLD_SALES_FILE_CLEANUP_DELAY_MS = 30000;
|
|
16
|
-
export declare const SALES_EXPORT_INTEGRITY_VERSION = "2026-11-18.
|
|
16
|
+
export declare const SALES_EXPORT_INTEGRITY_VERSION = "2026-11-18.export-display-precision";
|
|
17
17
|
export type PersistedSalesFileResult = GeneratedSalesFile & {
|
|
18
18
|
translationFailures: SalesFileTranslationFailure[];
|
|
19
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sales-file.service.d.ts","sourceRoot":"","sources":["../../src/lib/sales-file.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAA;AAK9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAA;AAe9F,OAAO,EAAE,UAAU,EAAc,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AAepE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAA4F,kBAAkB,EAAuH,MAAM,qBAAqB,CAAA;AACvQ,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAA;AACxE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1E,eAAe;IAuB7B,wDAAwD;YAC1C,sBAAsB;IAYpC,gCAAgC;IAChC,OAAO,CAAC,oBAAoB;CAQ7B;AAgDD,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,KAAK,CAAC;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC;IAAE,mBAAmB,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,yBAAyB,EAAE,CAE7L;AAmJD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8ExG;AAiXD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,UAM1J"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
-
import { applyDynamicInvoiceLayout } from './invoice/dynamic-render.js';
|
|
2
|
+
import { applyDynamicInvoiceLayout, DYNAMIC_INVOICE_LAYOUT_VERSION } from './invoice/dynamic-render.js';
|
|
3
3
|
import { mergeInvoiceLayouts } from './invoice/source-layout.js';
|
|
4
4
|
import { InvoiceLayoutAnalysisProvider } from './adapters/invoice-layout-analysis.provider.js';
|
|
5
5
|
import { invoicePaymentTerms } from './invoice-payment-terms.js';
|
|
6
|
-
import { balanceDocumentPricing,
|
|
6
|
+
import { balanceDocumentPricing, DOCUMENT_UNIT_PRICE_FORMAT } from './document-pricing.js';
|
|
7
7
|
import { compactExportLayout } from './compact-export-layout.js';
|
|
8
8
|
import { refreshPackingTotalsPagination } from './packing/packing-full-text.js';
|
|
9
9
|
import { PackingWeightAnalysisProvider } from './adapters/packing-weight-analysis.provider.js';
|
|
@@ -54,7 +54,7 @@ export const MAX_EDITED_WORKBOOK_BYTES = 20 * 1024 * 1024;
|
|
|
54
54
|
export const MAX_EDITED_WORKBOOK_ZIP_ENTRIES = 2048;
|
|
55
55
|
export const MAX_EDITED_WORKBOOK_ZIP_UNCOMPRESSED_BYTES = 100 * 1024 * 1024;
|
|
56
56
|
export const OLD_SALES_FILE_CLEANUP_DELAY_MS = 30_000;
|
|
57
|
-
export const SALES_EXPORT_INTEGRITY_VERSION = '2026-11-18.
|
|
57
|
+
export const SALES_EXPORT_INTEGRITY_VERSION = '2026-11-18.export-display-precision';
|
|
58
58
|
const PACKING_LAYOUT_VERSION = 'v22-boom-marker';
|
|
59
59
|
const COMPANY_LOGO_PLACEMENTS = {
|
|
60
60
|
PI: { tl: { col: 0, row: 0.02925 }, br: { col: 2, row: 0.999996875 } },
|
|
@@ -199,7 +199,8 @@ let SalesFileService = class SalesFileService {
|
|
|
199
199
|
});
|
|
200
200
|
if (fileType === 'CUSTOMS_DECLARATION')
|
|
201
201
|
fileWarnings.push({ code: 'CUSTOMS_ELEMENTS_REVIEW', message: '商品描述采用报关资料申报要素,数量及单位按第一、第二法定单位列示;黄色空缺字段请核对补全,本文件尚未提交海关。' });
|
|
202
|
-
const
|
|
202
|
+
const dynamicInvoice = (fileType === 'PI' || fileType === 'CI') && invoiceLayout;
|
|
203
|
+
const request = { currencyCode: documentPricing.currencyCode, ...(batchGenerationId ? { batchGenerationId } : {}), exportIntegrityVersion: SALES_EXPORT_INTEGRITY_VERSION, shipmentDocumentsVersion: 'v2', orderDataFingerprint: fileType === 'PI' ? commercialOrderDataFingerprint : orderDataFingerprint, templateVersion, fileNumber, remarks, bankType, ...(dynamicInvoice ? { dynamicInvoiceLayoutVersion: DYNAMIC_INVOICE_LAYOUT_VERSION } : {}), ...(needsPacking ? { packingMode: input.packingMode ?? 'DRAFT', packingIds: packing?.batchIds ?? [] } : {}), ...(fileType === 'PL' ? { packingLayoutVersion: PACKING_LAYOUT_VERSION } : {}), packingFingerprint: packing?.fingerprint ?? '', ordersKey };
|
|
203
204
|
const snapshot = { ...((fileType === 'PI' || fileType === 'CI') && invoiceLayout ? { invoiceLayout } : {}), ...(fileType === 'CUSTOMS_DECLARATION' ? { customsWeightSource: { type: 'SUPPLIER_PACKING', packingIds: packing?.batchIds ?? [], grossWeightKg: packing?.totals.grossKg ?? null, netWeightKg: customsWeights.totalNetWeightKg, method: 'PL_GROSS_80_PERCENT', ratio: 0.8, byLine: customsWeights.byLine } } : {}), customsScope: fileType === 'CUSTOMS_DECLARATION' ? materialData.customsScope : null, customsSourceCities, customsCoverage: fileCustomsCoverage, materials: fileType === 'CUSTOMS_DECLARATION' ? materialData.sources.map(source => source.documentType === 'CUSTOMS_INFO' ? { ...source, fields: source.fields.filter(field => field !== 'netWeightKg' || customsWeights.byLine[source.purchaseOrderLineId]?.source === 'REVIEWED_SHARED_ITEM_NET') } : source) : materialData.sources, materialsFingerprint, version: 'v1', generatedAt: generatedAt.toISOString(), fileType, request, orders, documentPricing: fileDocumentPricing, customer: { ...customer }, customerContract: { ...customerContract }, purchaseOrder: { ...purchaseOrder }, purchaseLines: filePurchaseLines.map(item => ({ ...item })), derived: fileDerived, shipment: { reference: shipmentReference, orders, packingIds: packing?.batchIds ?? [], status: 'PENDING_REVIEW' }, company: company ? { ...company } : null, bank: bank ? { ...bank } : null, clauses: clauses.map(item => ({ ...item })), translated: fileTranslated, packing: packing ? { ...packing, mode: input.packingMode ?? 'DRAFT', shipmentLines: fileDerived.lines.filter((line) => (packing.byPurchaseLine[line.purchaseOrderLineId]?.shippedQty ?? 0) > 0).map((line) => ({ purchaseOrderLineId: line.purchaseOrderLineId, quantity: String(packing.byPurchaseLine[line.purchaseOrderLineId].shippedQty) })) } : null, compliance: { profitCny: compliance.profitCny.toString(), complianceProfitRate: compliance.complianceProfitRate.toString() }, exchangeRate: exchangeRate ? { ...exchangeRate } : null, exchangeCost: exchangeCost?.toString() ?? null, rule: { ...rule } };
|
|
204
205
|
const logo = await this.readCompanyLogo(scope, fileType, company?.logoFileId);
|
|
205
206
|
const buffer = await this.fillWorkbook(fileType, { snapshot, customer, customerContract, purchaseOrder, purchaseLines: filePurchaseLines, derived: fileDerived, company, bank, clauses, translated: fileTranslated, packing, customsCoverage: fileCustomsCoverage, generationWarnings: fileWarnings }, logo);
|
|
@@ -780,10 +781,13 @@ function workbookDocumentPricing(data) {
|
|
|
780
781
|
const ids = data.derived.lines.map((line) => line.purchaseOrderLineId);
|
|
781
782
|
if (byId.size !== pricing.lines.length || new Set(ids).size !== ids.length || ids.length !== pricing.lines.length || ids.some(id => !byId.has(id)))
|
|
782
783
|
throw new DomainError(DomainErrorCodes.INVALID_INPUT, '商品与定价明细不一致,请重新生成整批文件');
|
|
783
|
-
return { ...pricing, lines: ids.map(id =>
|
|
784
|
+
return { ...pricing, lines: ids.map(id => {
|
|
785
|
+
const line = byId.get(id);
|
|
786
|
+
return { ...line, unitPrice: line.unroundedUnitPrice ?? line.unitPrice };
|
|
787
|
+
}) };
|
|
784
788
|
}
|
|
785
789
|
// Older rendering callers and saved snapshots are denominated in CNY.
|
|
786
|
-
return { currencyCode: 'CNY', orderAmount: data.derived.orderAmountCny, lines: data.derived.lines.map((line) => ({ purchaseOrderLineId: line.purchaseOrderLineId, purchaseOrderId: '', exchangeRateMonth: null, usdToCnyRate: null, unitPrice: line.salesUnitPriceCny, lineAmount: line.salesLineAmountCny })) };
|
|
790
|
+
return { currencyCode: 'CNY', orderAmount: data.derived.orderAmountCny, lines: data.derived.lines.map((line) => ({ purchaseOrderLineId: line.purchaseOrderLineId, purchaseOrderId: '', exchangeRateMonth: null, usdToCnyRate: null, unitPrice: line.salesUnitPriceCnyExact ?? line.salesUnitPriceCny, lineAmount: line.salesLineAmountCny })) };
|
|
787
791
|
}
|
|
788
792
|
function generationRequestMatches(item, expected) {
|
|
789
793
|
const request = item.generationSnapshot?.request;
|
|
@@ -798,6 +802,7 @@ function generationRequestMatches(item, expected) {
|
|
|
798
802
|
typeof request === 'object' &&
|
|
799
803
|
!Array.isArray(request) &&
|
|
800
804
|
request.exportIntegrityVersion === SALES_EXPORT_INTEGRITY_VERSION &&
|
|
805
|
+
(!item.generationSnapshot?.invoiceLayout || request.dynamicInvoiceLayoutVersion === DYNAMIC_INVOICE_LAYOUT_VERSION) &&
|
|
801
806
|
request.currencyCode === expected.currencyCode &&
|
|
802
807
|
request.fileNumber === expected.fileNumber &&
|
|
803
808
|
request.templateVersion === expected.templateVersion &&
|
|
@@ -862,7 +867,7 @@ function fillInvoiceSheet(sheet, type, data) {
|
|
|
862
867
|
const productLabel = englishProduct;
|
|
863
868
|
[index + 1, productLabel, translated.lines[index]?.description ?? '', Number(derived.lines[index].quantity), Number(pricing.lines[index].unitPrice), translated.lines[index]?.unit ?? '', Number(pricing.lines[index].usdToCnyRate ?? 1), Number(pricing.lines[index].lineAmount), derived.lines[index].hsCode ?? ''].forEach((value, offset) => sheet.getCell(row, offset < 7 ? offset + 1 : offset + 2).value = value);
|
|
864
869
|
safeMerge(sheet, `G${row}:H${row}`);
|
|
865
|
-
sheet.getCell(`E${row}`).numFmt =
|
|
870
|
+
sheet.getCell(`E${row}`).numFmt = DOCUMENT_UNIT_PRICE_FORMAT;
|
|
866
871
|
sheet.getCell(`I${row}`).numFmt = '0.00';
|
|
867
872
|
if (pricing.lines[index].exchangeRateMonth)
|
|
868
873
|
sheet.getCell(`G${row}`).note = `${pricing.lines[index].exchangeRateMonth}: 1 USD = ${pricing.lines[index].usdToCnyRate} CNY`;
|
|
@@ -1211,15 +1216,15 @@ function fillPackingPhysicalRows(sheet, rows, data) {
|
|
|
1211
1216
|
}
|
|
1212
1217
|
const itemSource = source.find(member => member.id === row.sourceLineId && packingPhysicalKey(member) === row.packageKey);
|
|
1213
1218
|
const weight = itemSource && row.purchaseOrderLineId ? documentWeights.byAllocation[packingWeightAllocationKey(itemSource, row.purchaseOrderLineId)] : undefined;
|
|
1214
|
-
const
|
|
1215
|
-
if (
|
|
1219
|
+
const exactWeight = weight ?? (!repeated && row.packageKey ? documentWeights.byGroup[row.packageKey] : !row.packageKey && row.purchaseOrderLineId ? documentWeights.byLine[row.purchaseOrderLineId] : undefined);
|
|
1220
|
+
if (exactWeight && typeof sheet.getCell(excelRow, 12).value === 'number') {
|
|
1216
1221
|
const allocation = itemSource?.allocations?.find(a => a.purchaseOrderLineId === row.purchaseOrderLineId);
|
|
1217
1222
|
const count = Number(allocation?.cartons) > 0 ? Number(allocation.cartons) : Number(row.metrics?.cartons);
|
|
1218
|
-
sheet.getCell(excelRow, 12).value =
|
|
1219
|
-
sheet.getCell(excelRow, 11).value =
|
|
1223
|
+
sheet.getCell(excelRow, 12).value = exactWeight.grossKg;
|
|
1224
|
+
sheet.getCell(excelRow, 11).value = exactWeight.netKg;
|
|
1220
1225
|
if (count > 0) {
|
|
1221
|
-
sheet.getCell(excelRow, 6).value = new Decimal(
|
|
1222
|
-
sheet.getCell(excelRow, 10).value = new Decimal(
|
|
1226
|
+
sheet.getCell(excelRow, 6).value = new Decimal(exactWeight.grossKg).div(count).toNumber();
|
|
1227
|
+
sheet.getCell(excelRow, 10).value = new Decimal(exactWeight.netKg).div(count).toNumber();
|
|
1223
1228
|
}
|
|
1224
1229
|
}
|
|
1225
1230
|
if (conflict || !completeScope) {
|
|
@@ -1523,7 +1528,7 @@ function fillCustomsSheet(sheet, data) {
|
|
|
1523
1528
|
for (const warning of data.generationWarnings ?? [])
|
|
1524
1529
|
if (String(warning.field ?? '').startsWith(`customs.${purchaseLines[index].id}.`))
|
|
1525
1530
|
markReview(sheet.getCell(String(warning.field).endsWith('.hsCode') ? `B${row}` : `C${row}`));
|
|
1526
|
-
const priceFormat =
|
|
1531
|
+
const priceFormat = DOCUMENT_UNIT_PRICE_FORMAT;
|
|
1527
1532
|
sheet.getCell(`F${priceRow}`).numFmt = priceFormat;
|
|
1528
1533
|
sheet.getCell(`G${priceRow}`).numFmt = '0.00';
|
|
1529
1534
|
}
|