Sales Outbound to Sales Invoice Sync: A Practical Guide for Jushuitan → Chanjet T+ with Payment-Term Mapping
What This Strategy Solves
Pushing e-commerce orders from Jushuitan into Chanjet T+ for financial posting looks like a simple document copy. But when customers settle by payment term (e.g., JD self-operated stores), different stores use different fund channels and the payment-term definitions diverge, breaking reconciliation. In a real project, a retail enterprise was running multiple self-operated stores in parallel; we used the Qeasy data integration platform to split Jushuitan sales outbound documents by payment term and route them into the corresponding T+ books, aligning document flow with cash flow.
Data Flow and Field Mapping
The overall flow is: Jushuitan (B side) → Qeasy middle layer → Chanjet T+ (A side).
| Business Meaning | Jushuitan (Source) | Qeasy Middle Layer | Chanjet T+ (Target) |
|---|---|---|---|
| Document No. | io_id (outbound id) | io_id | VoucherCode |
| Store Code | shop_id | shop_id + payment-term tag | DepartmentCode |
| Customer/Dealer | customer_id | Code mapping → CustomerCode | CustomerCode |
| SKU Code | sku_id | Code mapping → InventoryCode | InventoryCode |
| Outbound Qty | qty | qty | Quantity |
| Tax-Inclusive Price | price | price | TaxPrice |
| Tax Amount | tax | tax → derived | TaxAmount |
| Payment-Term Tag | (no explicit field) | Injected by shop_id routing | Written to header custom field |
Key point: the payment-term tag does not exist in the source; we inject it in the middle layer based on the store code. A common pattern on customer sites is to keep the "store → payment-term" relation as a single mapping table inside Qeasy, so adding a new store means updating one mapping entry, not the strategy.
How to Configure on Qeasy
Configuring this strategy on Qeasy typically takes four steps:
- Register data sources: connect to Jushuitan (open platform) and Chanjet T+ (T+ APIs); credentials live inside Qeasy connectors, never hard-coded in scripts.
- Fetch strategy: on the Jushuitan side, call
io_queryfor sales outbound documents and usemodified_start/modified_endfor incremental; for the first run usedate_type=2with a creation-time window for full backfill. - Middle-layer transformation: in the Qeasy transformer, do three things — SKU/customer code mapping, store-to-book routing, and header/body split. We prefer to handle headers (store, payment term, order time) and line items in two phases: write the header first, then push line items carrying the header id. This avoids lines being dropped when the header is not yet committed.
- Write strategy: call Chanjet T+'s sales invoice create API, route by book id; failed documents land in an error-handling queue for manual reissue or scheduled rerun.
Implementation Steps
When rolling this out at a customer site, we typically proceed in three phases:
- T0 Full backfill: run a one-shot full backfill of historical outbound documents; to avoid pressuring T+, batch by store — 200 documents per batch, start the next only after the previous completes.
- T1 Incremental start: take the cutover date as the boundary; set
modified_startto midnight of the cutover day and run incrementally on a schedule thereafter. - T2 Schedule frequency: in dense e-commerce scenarios the interval is typically 5–15 minutes; payment-term books can run at 30 minutes to 1 hour, with dedup by
io_idin a Qeasy staging table before each batch.
The safe pattern is dual-track — full for history, incremental for daily operations, with no interference between them.
Pitfalls and Lessons
- Payment term is not a field, it's a routing rule. A typical mistake is hunting for a "payment term" field in Jushuitan and discovering it has to be reverse-looked-up by store code. This is where things break — store codes are numeric strings in Jushuitan and a different set in T+; a central mapping table is mandatory.
- Don't push header and body in one shot. T+'s sales invoice create API depends heavily on the header; if the header fails, line items are simply dropped. The safer pattern: write the header, land it in the staging table with a success flag, then push line items carrying the header id — much better idempotency.
- Pick the right idempotency key. We use
io_id + line_noas the idempotency key to avoid duplicates on rerun; usingio_idalone causes T+ to reject the entire document on retry. - Tax rate and tax-inclusive price conversion. Jushuitan provides tax-inclusive prices; T+ sales invoices usually require tax-exclusive unit price + tax amount. The tax rate is taken from the document date, not the item master — cross-month documents need special attention.
- Layered error handling. Network jitter and T+ temporary unavailability are normal. We let Qeasy classify failed documents into two buckets: retryable (network/lock) auto-retried, and human-required (missing field, unmapped code) routed to a todo queue, to avoid false alarms of "total failure".
When to Use and When Not to Use
Use it for: multi-store, multi-payment-term e-commerce retail where documents must be split by payment term/book — the typical Jushuitan-front, T+-back combination. Do not use it for: simple single-store, single-book sync (a flat rule suffices, no routing layer needed); or scenarios demanding real-time, sub-second write-back — this strategy runs on a schedule, so minute-level latency is expected.