Qeasy Cloud
Get Started

MySQL to Fenxiangxiaoke Supply Chain Integration Overview: A Phased Approach with 19 Strategies

· 高金凤· Integration Solutions· 54 views· 5 min read

Scenario and Value

In a real engagement, we ran into a chronic data silo between a customer's CRM (Fenxiangxiaoke) and its self-built MySQL data warehouse. Master data such as customer accounts and product codes had to be exported manually, and reconciliation of sales orders, deliveries and returns could not complete until the next afternoon. The business kept asking why inventory numbers never matched. The root cause was not bad reporting—it was the absence of an automated closed loop. Master data was not landing on a schedule, transactional documents had no execution order, and there was no retry mechanism for failures.

This integration aims to land 19 Fenxiangxiaoke objects into MySQL's tp_fxk_* tables following a master-data-first pattern, so BI, reconciliation and reporting can read directly from MySQL instead of repeatedly hitting the CRM API. The scope covers master data (customers, products, departments, warehouses, product categories), transactional documents (sales contracts, sales orders, delivery-note products, order products, payments), the return chain (return-application details, returned-goods products), and pricing/rebate details.

Integration Architecture and Data Flow

The architecture is a classic three-layer "source → integration platform → target" pattern. The integration platform is Qeasy (轻易云数据集成平台), which handles extract-transform-load orchestration, scheduling, exception handling and unified alerting.

┌──────────────────────────────────────────────────────────────────────┐
│              Fenxiangxiaoke CRM/Supply-Chain (Source)                 │
└──────────────────────────────────────────────────────────────────────┘
                                  │
        ┌─────────────────────────┼─────────────────────────┐
        ▼                         ▼                         ▼
┌───────────────────┐   ┌───────────────────┐   ┌────────────────────┐
│ Phase 1: Preload  │   │ Phase 2: Master   │   │ Phase 3: Tx Docs   │
│ Strategies 1–5,7  │   │ Strategy 8        │   │ Strategies 9–19    │
│ Employees/Cust... │   │ Customer → MySQL  │   │ Contracts/Orders...│
└────────┬──────────┘   └─────────┬─────────┘   └─────────┬──────────┘
         │  Strategy 6 depends   │  Master first          │  Tx depends on master
         │  on Strategy 5        │                        │
         └────────────────────────┴───────────────────────┘
                                  ▼
┌──────────────────────────────────────────────────────────────────────┐
│                  MySQL Database (Target)                              │
│  tp_fxk_customer | tp_fxk_contracts | tp_fxk_delivery_goods         │
│  tp_fxk_products | tp_fxk_payment_records | tp_fxk_sales_goods      │
│  tp_fxk_returned_goods | tp_fxk_price_list | tp_fxk_rebate_*        │
└──────────────────────────────────────────────────────────────────────┘

The data flow runs in three phases:

  • Phase 1 (Preload): Strategies 1–5 and 7 pull employees, customers, product categories, inventory details, warehouse records and departments into the integration platform. These are mostly QUERY_ONLY and can run in parallel.
  • Phase 2 (Master data landing): Strategy 8 writes customer master data into tp_fxk_customer, becoming the foreign-key source for downstream transactional documents.
  • Phase 3 (Transactional documents): Strategies 9–19 handle sales contracts, delivery-note products, payments, products, order products, returned-goods products, return applications, price lists, rebates and sales orders.

There is only one reverse flow: Strategy 6 (new materials) goes from the integration platform to Fenxiangxiaoke, splitting materials by warehouse dimension into the CRM's inventory report object. It depends on Strategy 5 (warehouse records).

Interface List

Strategy IDData ObjectDirectionNotes
1EmployeesFenxiangxiaoke → PlatformPreload, no dependency
2CustomersFenxiangxiaoke → PlatformPreload, no dependency
3Product CategoriesFenxiangxiaoke → PlatformPreload, no dependency
4Inventory DetailsFenxiangxiaoke → PlatformPreload, no dependency
5Warehouse RecordsFenxiangxiaoke → PlatformPreload, prerequisite for Strategy 6
6New Materials (material × warehouse)Platform → FenxiangxiaokeDepends on Strategy 5; AfterSourceInvoke script produces Cartesian product
7DepartmentsFenxiangxiaoke → PlatformPreload, no dependency
8Customer MasterFenxiangxiaoke → MySQLtp_fxk_customer, FK source for tx documents
9Sales ContractsFenxiangxiaoke → MySQLtp_fxk_contracts, depends on Strategy 8
10Delivery-Note ProductsFenxiangxiaoke → MySQLtp_fxk_delivery_goods, depends on 8 and 19
11PaymentsFenxiangxiaoke → MySQLtp_fxk_payment_records, depends on Strategy 8
12ProductsFenxiangxiaoke → MySQLtp_fxk_products, no hard dependency
13Order ProductsFenxiangxiaoke → MySQLtp_fxk_sales_goods, depends on 8, 12, 19
14Returned-Goods ProductsFenxiangxiaoke → MySQLtp_fxk_returned_goods, depends on Strategy 15
15Return Application DetailsFenxiangxiaoke → MySQLtp_fxk_return_details, run before Strategy 14
16Price List DetailsFenxiangxiaoke → MySQLtp_fxk_price_list, depends on Strategy 12
17Rebate DetailsFenxiangxiaoke → MySQLtp_fxk_rebate_details, depends on Strategy 8
18Rebate Coupon DetailsFenxiangxiaoke → MySQLtp_fxk_rebate_coupons, depends on Strategy 8
19Sales OrdersFenxiangxiaoke → MySQLtp_fxk_sales_orders, depends on Strategy 8

Implementation Highlights

1. Phased scheduling, master data first Preload strategies (1–5, 7) can run in parallel. After master data lands (Strategy 8), transactional strategies (9–19) execute in dependency order. In Qeasy we wired the dependency graph directly into the scheduler so that customer and product masters always precede sales orders, deliveries and returns.

2. Incremental + full reconciliation Daily sync uses last_modified_time as an incremental filter with a fixed window (for example 30 minutes). A full reconciliation runs weekly or monthly to absorb missed or manually edited records. The incremental filter must carry a "watermark timestamp" or downstream reconciliation will never see historical changes.

3. Timestamp conversion and code mapping Source fields such as create_time and last_modified_time are Unix milliseconds. In MySQL we apply FROM_UNIXTIME(field/1000, '%Y-%m-%d %H:%i:%s') to produce datetime values. Customer codes (account_no) and product codes (field_product_code__c) are kept in a dedicated mapping table aligned with MySQL master data—this is what later reconciliation and BI queries hinge on.

4. Retry and dead-letter handling Network and API timeouts use exponential backoff (30s/60s/120s) for up to three attempts. Primary-key conflicts on the target use REPLACE INTO or ON DUPLICATE KEY UPDATE. A single record failure does not abort a batch; failed records are persisted to a sync_failed_records dead-letter table for manual replay or backfill.

5. Privacy and field minimization Sensitive fields on the customer side (legal entity names, contact persons) are masked or trimmed before being written into MySQL, instead of mirroring the CRM verbatim.

Best Practices and Lessons Learned

  1. Centralize code mapping. Once customer, product and warehouse codes are scattered across every strategy's script, future changes become a hunt across files. We use Qeasy's mapping module to maintain a single mapping table referenced by all strategies, which dramatically cuts maintenance overhead.
  2. Watch for reverse dependencies on detail tables. Strategy 14 (returned-goods products) depends on Strategy 15 (return-application details), and Strategy 15 in turn references Strategy 14's detail ID through field_return_application_detail_id__c—a cycle. The safe approach is to write return-application details (Strategy 15) first and returned-goods products (Strategy 14) second, and enforce that order in the scheduler.
  3. Split header and line into separate phases. Delivery-note headers, delivery-note products, sales-order headers and order products, when bundled into a single strategy, become large and tightly coupled—any later change risks breakage. On-site we split them: write the header first, then backfill line records using the header's internal ID as the foreign key.
  4. Dual-channel split for Qimen/non-Qimen flows. New materials (Strategy 6) must be written both to Fenxiangxiaoke's inventory report and back to MySQL's inventory ledger. In practice we run two independent strategies—one from platform to Fenxiangxiaoke, one from platform to MySQL—so they don't block each other.
  5. Set alert thresholds around business windows. Daily strategies trip a summary alert when failure rate exceeds 5%. During business hours (08:00–22:00) three consecutive failures on a strategy trigger an immediate alert. A data latency above 2 hours triggers a delay alert. The point is to catch problems inside the working day rather than discovering them the next morning.

When to Use Qeasy

If your data pipeline is the "CRM/supply-chain system → self-built database" pattern, with strategy counts in the double digits and non-trivial dependencies, Qeasy (轻易云数据集成平台) lets you orchestrate all 19 strategies from a single console. Master-data-first scheduling, dependency-aware execution, retry, and alerting are available out of the box, so you do not need to stitch together multiple ETL tools.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/sol-mysql-p2d57ef-8267

Comments