Qeasy Cloud
Get Started

Pushing MES Return Orders into U8 Sales Outbound (Red-Word): A Deep Dive into One Strategy

· 吕修远· Integration Solutions· 8 views· 4 min read

What This Strategy Solves (Scenario and Value)

In a manufacturer's supply chain, MES is the "source of truth" on the shop floor, while the ERP (U8 here) is the "ledger" for finance and inventory. When a return happens on the floor, the operator logs a return order in MES, and finance needs to immediately see a red-word sales outbound voucher in U8 so that inventory and receivables can be reversed in sync. It looks like a single strategy, but return scenarios are trickier than outbound: the document direction is reversed (red-word), quantities are negative, and the auto-audit switch must be handled carefully. A small mistake and inventory no longer reconciles. In real projects, we use the Qeasy Data Integration Platform to carry this strategy, stably converting MES return orders into U8 red-word sales outbound vouchers.

Data Flow and Field Mapping (Source → Middle Layer → Target)

The pipeline is one-way: MES return order → Qeasy middle layer → U8 sales outbound voucher (red-word).

The source side pulls return records from MES's common/search API, paginated by bomNo/id (100 per page), with queryKey identifying the return type. The target side calls U8's XSCKDAdd (sales outbound add) and forces red-word direction via bIsRedVouch=true.

Key field mapping table:

Business meaningMES source fieldMiddle-layer variableU8 target fieldNote
Document datecreateTime{{createTime}}dDateFormatted to second
Return numberconfrimNo{{confrimNo}}cCodeOutbound number, must be unique
Red/blue flagBusiness type/qty signDerivedbIsRedVouchHard-coded true
Add type—ConstantAddTypeValue 1 (new)
Auto audit—ConstantAutoAuditDefault true, switchable

Worth noting: in return scenarios the quantity is already negative, and bIsRedVouch must be explicitly set to true—both are required. This is one of the easiest places to trip up.

How to Configure in Qeasy

The source is a query-type WebAPI and the target is an execute-type WebAPI—this strategy is a textbook case in Qeasy.

  1. Source connector: register the MES platform, bind the request parameter template (pageNum / pageSize / wsId / queryKey), enable pagination and incremental cursor (use id as cursor key).
  2. Target connector: register the U8 platform, point the API to XSCKDAdd, hard-code bIsRedVouch=true, AddType=1, and convert the timestamp in dDate with DATE_FORMAT('{{createTime}}', '%Y-%m-%d %H:%i:%s').
  3. Code mapping: material codes, customer codes, warehouse codes, and units of measure are centrally managed in Qeasy's "Code Mapping" module. This is a common pattern among Qeasy customers—a single source of truth for all master data mappings, making audit and traceability straightforward.
  4. Header/body phased writing: a return order usually has a header (number, customer, date) and multiple body rows (material, qty, batch). We recommend landing the header in the staging table first, then expanding the body line by line keyed on the document number, and writing each line to U8. If one line fails, you can retry that single line without rolling back the whole document.
  5. Idempotency and retry: ERP systems like U8 reject duplicate submissions. Configure a dedup key (typically cCode + line number) and auto-retry 2–3 times on failure to avoid lost documents from network jitter.

Implementation Steps (Phased Scheduling)

  1. First full load trigger: on go-live day, manually trigger a full load in Qeasy to backfill historical returns (align the cut-off time with finance first, to avoid double reversals).
  2. Incremental start point: after the full load, Qeasy automatically records the cursor position (idCheck=true is enabled) and proceeds incrementally from there.
  3. Scheduling frequency: source side uses */9 7-22 * * * (every 9 minutes, covering 7am–10pm working hours); target side uses 2-59/9 7-22 * * * (staggered by 2 minutes, so the target does not compete for resources with the source during stress tests).
  4. Reconciliation mechanism: at 22:30 every day, run a reconciliation comparing MES and U8 return numbers. Any discrepancies enter a "pending review" queue for ops to follow up manually.

Pitfalls and Lessons Learned

  1. Judging red-word documents by negative quantity alone will fail you. If the source system still fills the return quantity as positive and uses a business type to distinguish red/blue, you must explicitly pass bIsRedVouch=true—do not rely on the quantity sign. The safe approach is to add a validation rule in the mapping: a red-word document's quantity must be ≤ 0.
  2. Think carefully about the AutoAudit switch. Turning it on by default is convenient, but finance usually wants "see the document first, then manual review". We recommend leaving it off during initial rollout and turning it on after two weeks of stable runs.
  3. Document number conflicts. MES return numbers and U8 outbound numbers follow different conventions, so passing confrimNo directly as cCode can collide. A safer approach is to add a prefix in Qeasy (e.g. TH-), or let U8 auto-generate the number and write the external reference back via an "external number" field.
  4. Cursor failure causes dropped records. If MES's id cursor is sorted as a string, newly inserted ids may not be strictly increasing—causing "cursor skipping → dropped records". The safe approach is to double-key the check with updateTime; if the timestamp goes backward, automatically pause and raise an alert.
  5. Missing batch/serial number fields. Returns in manufacturing often involve batch traceability. If U8 requires batch input and the mapping forgets to include it, U8 will reject the whole document. We recommend running a "field completeness check" in Qeasy before the first full load.

Applicable and Non-applicable Scenarios

Applicable: manufacturers where MES already logs returns and need real-time red-word sales outbound in U8 (or similar ERP) for inventory reversal and financial accounting. Not applicable: enterprises whose returns must go through an approval workflow before landing in ERP (this strategy is a direct push with no approval node); nor complex cross-ledger or cross-organization returns (these should be split into multiple strategies).

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-mes-web-u8-0201-mes-u8-5e7fad6a

Comments