# Exchange Customer PO — the Planner moves allocated, not-yet-packed goods of one Customer P.O to one or more P.Os and confirms the EXC ticket directly; the exchanged part returns to Packing Planning, the rest stays in the source plan; target-P.O plans use the MOR of the source plan; a DRAFT ticket can be deleted, a CONFIRMED ticket can be cancelled while the target P.Os are not packed

> Fine Chemical (FC) · MES module · v0.5 · 14/10/2026 · Standard flow — for implementation, testing and development
>
> Generated from the diagram by `sync.js` — do not edit by hand. The diagram is authoritative: report any mismatch with the diagram page.
>
> Diagram page: /en/mes/exchange-customer-po

## How to read

- Every box on the diagram has a code `Bxx`, numbered in flow order (from the start event, following the arrows).
- "Goes to" lists every arrow leaving the box; text in square brackets is that arrow's condition label.
- "Optional branch" = a dashed arrow on the diagram: may be done or skipped.
- "Data" boxes in the Input lane are incoming data; in the Output lane they are results / end points of the flow.

## Process Flow (swimlane)

### Roles (lanes)

- Input
- Planner
- Output

### Steps

| Code | Role | Type | Content | Platform · Screen | Goes to |
| --- | --- | --- | --- | --- | --- |
| B01 | Input | Data | Packing Plan RELEASED, not fully packed (source P.O) |  | B05 |
| B02 | Input | Data | Target Customer P.O · balance (Sales Order) |  | B06 |
| B03 | Planner | Start | Start |  | B04 |
| B04 | Planner | Task | Create Exchange Customer PO | Web · Exchange Customer PO | B05 |
| B05 | Planner | Task | Pick source P.O · goods by size | Web · Exchange Customer PO | B06 |
| B06 | Planner | Task | Pick target P.Os · Reason | Web · Exchange Customer PO | B07 |
| B07 | Planner | Task | Enter exchange qty by size per target P.O | Web · Exchange Customer PO | B08 |
| B08 | Planner | Decision | Exchange qty valid? |  | B07 [No — fix]; B09 [Yes] |
| B09 | Planner | Decision | Confirm now? |  | B10 [Not yet]; B11 [Yes] |
| B10 | Planner | Task | Save draft of Exchange Customer PO | Web · Exchange Customer PO | B12; B11 [Confirm from DRAFT ticket] |
| B11 | Planner | Task | Confirm Exchange Customer PO | Web · Exchange Customer PO | B13 |
| B12 | Output | Data | EXC ticket DRAFT — can be reopened and edited |  | (end) |
| B13 | Planner | Task | Record EXC ticket · return Remaining | System (auto) · Exchange Customer PO | B14; B15 |
| B14 | Output | Data | Source P.O Remaining returned → Packing Planning |  | (end) |
| B15 | Planner | Task | Reduce source plan · create a plan per target P.O | System (auto) · Exchange Customer PO | B16; B17 |
| B16 | Output | Data | RELEASED plan for target P.O (source plan MOR) · source plan keeps Remaining → Result |  | (end) |
| B17 | Planner | End | End |  |  |
| B18 | Planner | Start | Delete / cancel a ticket |  | B19 |
| B19 | Planner | Decision | Ticket in which status? |  | B20 [DRAFT]; B21 [CONFIRMED] |
| B20 | Planner | Task | Delete draft ticket Exchange Customer PO | Web · Exchange Customer PO | B22 |
| B21 | Planner | Decision | Can cancel? |  | B23 [No]; B24 [Yes] |
| B22 | Output | Data | DRAFT ticket deleted — its number is not reused |  | (end) |
| B23 | Output | Data | Cancel blocked — reason shown on the ticket |  | (end) |
| B24 | Planner | Task | Cancel ticket Exchange Customer PO | Web · Exchange Customer PO | B25 |
| B25 | Planner | Task | Delete target-P.O plans · return qty to source plan | System (auto) · Exchange Customer PO | B26; B27 |
| B26 | Output | Data | Ticket CANCELLED · target-P.O plans deleted · source plan gets the qty back |  | (end) |
| B27 | Planner | End | End |  |  |

### Step details (hover content on the diagram)

#### B04 · Create Exchange Customer PO

- Planner · Web · Exchange Customer PO
- Comes from: B03
- Goes to: B05 · Pick source P.O · goods by size

> The Planner creates a ticket to move not-yet-packed goods of one Customer P.O to one or more other Customer P.Os.  
> When: goods fail the source P.O but pass another one, the delivery schedule changes, another customer has an urgent order, or the destination changes; applies to Logo and SPRAY goods, not to goods still at the Spray Out vendor.  
> Not covered: FG already packed and received into stock — its P.O is changed with the WMS exchange function.  
> Action: PACKING menu › Exchange Customer PO › "Create Exchange" button.  
> Result: a new ticket opens; the ticket number is assigned on save.  
> Open: button names and layout follow prototype v0.92; not confirmed by the customer.  
> Source: Q-20261002-02 (1) · Q-20261002-04 · Q-20261014-01 (2) · MOM 28/09 rows 12–13  

#### B05 · Pick source P.O · goods by size

- Planner · Web · Exchange Customer PO
- Comes from: B01, B04
- Goes to: B06 · Pick target P.Os · Reason

> The Planner picks the source P.O, then a Packing Plan of that P.O.  
> Action: "LOGO / SPRAY *" → "SOURCE CUSTOMER P.O *" → "PACKING PLAN NO. *"; when the P.O has only one plan the system selects it.  
> System: lists only RELEASED Packing Plans not fully packed; one P.O can have several plans; exchangeable by size "Available to exchange" = Plan Qty − recorded output (A + A- + C + Pending repair).  
> System: the P.O information block (Customer · Model · Base Color · Upper Color (SPRAY only) · AL / INT · Destination · ETD · Sales Order) shows "—" until the Source Customer P.O is chosen, then the system fills it.  
> Test:  
> - A 690-pair plan with 600 recorded → "Available to exchange" is 90  
> - P.O 260811-06 has only PKP-20260812-04 → after choosing the P.O, Packing Plan No. fills itself  
> Source: Q-20261007-03 (7) · Q-20261014-01 (1, 2) · Q-20261006-06 · prototype v0.92  

#### B06 · Pick target P.Os · Reason

- Planner · Web · Exchange Customer PO
- Comes from: B02, B05
- Goes to: B07 · Enter exchange qty by size per target P.O

> The Planner picks one or more target Customer P.Os and notes the reason if needed.  
> Action: Step 2 table, one row per target P.O, field "Target Customer P.O *"; "Add Target P.O" adds a row, the trash icon removes it; "REASON" is free text, optional, one for the whole ticket.  
> System: lists only P.Os with the same Model, Base Color, AL / INT as the source P.O (SPRAY also Upper Color) that still have balance; a P.O chosen on another row is not offered again; each row shows Customer · Model · Base Color · AL / INT · Destination · ETD · Sales Order · Exchange Qty.  
> Test:  
> - Source P.O Sandal Black · Black · INT → the target list has no P.O of another color or AL  
> - Row 1 takes 260811-14 → the P.O field of row 2 no longer offers 260811-14  
> Source: Q-20261014-01 (3) · Q-20261002-04 · Q-20261006-06 (2) · prototype v0.92  

#### B07 · Enter exchange qty by size per target P.O

- Planner · Web · Exchange Customer PO
- Comes from: B06, B08
- Goes to: B08 · Exchange qty valid?

> The Planner enters the pairs by size for each target P.O, or lets the system fill them.  
> Action: Step 3, each target P.O has a "Balance · P.O …" row and an "Exchange → P.O …" input row; the "Auto Fill (earliest ETD first)" button fills them instead.  
> System: Auto Fill gives each size to the target P.O with the earliest ETD first, up to that P.O Balance, and stops when "Available to exchange" runs out; equal ETDs follow row order; it overwrites what was entered.  
> System: "Total exchange" = Σ exchange of all target P.Os by size; "Remaining · stays with P.O <source>" = Available to exchange − Total exchange.  
> Test:  
> - Available W5 60; P.O A ETD 19/08 Balance 50, P.O B ETD 17/08 Balance 140 → Auto Fill: B 60, A 0, Remaining 0  
> - Enter A W5 20, B W5 30 → Total exchange 50, Remaining W5 10  
> Source: Q-20261014-01 (3, 4, 5) · prototype v0.92  

#### B08 · Exchange qty valid?

- Planner
- Comes from: B07
- Goes to [No — fix]: B07 · Enter exchange qty by size per target P.O
- Goes to [Yes]: B09 · Confirm now?

> The system checks the ticket before saving or confirming.  
> Yes: the source P.O and Packing Plan are chosen, at least one valid target P.O, no P.O chosen twice, every target P.O has a total > 0, each P.O quantity by size ≤ that P.O Balance, and Total exchange by size ≤ "Available to exchange".  
> No: an error shows and the ticket must be fixed — "Select the source Customer P.O and the Packing Plan No." · "Select at least one target Customer P.O with the same Model, Base Color and AL / INT." · "P.O <x>: enter the quantity to exchange by size, or remove the row." · "P.O <x> · <size>: exchange quantity exceeds the balance of the P.O (n)." · "<size>: total exchange quantity (n) exceeds the available quantity of <plan> (m)."  
> Test:  
> - Available W5 60, enter P.O A W5 50 and P.O B W5 30 → "M3/W5: total exchange quantity (80) exceeds the available quantity of PKP-20260812-04 (60)." shows  
> - A target P.O chosen with no quantity → "P.O 260811-05: enter the quantity to exchange by size, or remove the row." shows  
> Not checked: an empty REASON can still be saved / confirmed.  
> Open: the messages follow prototype v0.92; not confirmed by the customer.  
> Source: Q-20261014-01 (3) · Q-20261006-06 · prototype v0.92  

#### B09 · Confirm now?

- Planner
- Comes from: B08
- Goes to [Not yet]: B10 · Save draft of Exchange Customer PO
- Goes to [Yes]: B11 · Confirm Exchange Customer PO

> The Planner chooses to save a draft or confirm now.  
> Not yet: needs another review → save as draft, ticket DRAFT.  
> Yes: quantities are right → confirm, ticket CONFIRMED.  
> Source: Q-20261002-04 (3)  

#### B10 · Save draft of Exchange Customer PO

- Planner · Web · Exchange Customer PO
- Comes from: B09
- Goes to: B12 · EXC ticket DRAFT — can be reopened and edited
- Goes to [Confirm from DRAFT ticket]: B11 · Confirm Exchange Customer PO

> The Planner saves a draft ticket to continue later.  
> Action: "Save Draft" button.  
> Result: the ticket → DRAFT; nothing changes yet in Packing Planning, Packing Result or WMS; it can be reopened and edited.  
> Open: whether a DRAFT ticket can be cancelled / deleted, and whether it reserves the "Available to exchange" quantity — proposed, not confirmed.  
> Source: Q-20261002-04 (3)  

#### B11 · Confirm Exchange Customer PO

- Planner · Web · Exchange Customer PO
- Comes from: B10, B09
- Goes to: B13 · Record EXC ticket · return Remaining

> The Planner confirms the ticket directly; there is no approval step.  
> When: a new or DRAFT ticket that passed the check.  
> Action: "Confirm Exchange" button → popup "Exchange n pairs from <plan> to <k> P.Os?" (From plan · From P.O · To P.O · Reason · Exchange quantity · Remaining; size table per target P.O, Total exchange, Remaining) → "Confirm Exchange" button.  
> Result: the ticket → CONFIRMED.  
> Open: whether a CONFIRMED ticket can be cancelled or reversed.  
> Source: Q-20261002-04 (3) · Q-20261014-01 · prototype v0.92  

#### B13 · Record EXC ticket · return Remaining

- Planner · System (auto) · Exchange Customer PO
- Comes from: B11
- Goes to: B14 · Source P.O Remaining returned → Packing Planning
- Goes to: B15 · Reduce source plan · create a plan per target P.O

> The system records the ticket and returns the source P.O balance to Packing Planning.  
> System: ticket number "EXC-<YYYYMMDD>-NN", one ticket for all target P.Os; the source P.O Remaining (balance) by size in Packing Planning gets back exactly the Total exchange; each target P.O balance drops by the quantity it received.  
> Result: the Planner finds another source for the exchanged part of the source P.O and plans it again in Packing Planning.  
> Test:  
> - Exchange 30 pairs of W5 from P.O 260811-06 to 260811-04 → Packing Planning Step 3: W5 "Remaining" of 260811-06 rises by 30  
> Open: how the new screen numbers its tickets; "EXC-<YYYYMMDD>-NN" follows the old Exchange panel.  
> Source: Q-20261002-03 · Q-20261014-01 · MOM 28/09 row 14  

#### B15 · Reduce source plan · create a plan per target P.O

- Planner · System (auto) · Exchange Customer PO
- Comes from: B13
- Goes to: B16 · RELEASED plan for target P.O (source plan MOR) · source plan keeps Remaining → Result
- Goes to: B17 · End

> The system moves the exchanged part of the source plan into a new plan for each target P.O; the rest stays in the source plan.  
> System: one new RELEASED Packing Plan per target P.O, with source line "Exchange" and the EXC number; the source plan Plan Qty drops by the Total exchange by size; Spray Plan / Spray Result do not change.  
> System: the target-P.O plans get no new MOR — they carry the MOR number created for the source plan (the "MOR" column shows "MOR-PK-… · shared"; Packing Result shows "shared from <source plan> (Exchange EXC-…)").  
> Result: the new plans appear in Packing Result as "Waiting"; the Remaining (not exchanged) still belongs to the source P.O and the source plan keeps packing in Packing Result.  
> Test:  
> - Source plan 690 pairs, exchange 20 to P.O A and 80 to P.O B → two new RELEASED plans of 20 and 80 pairs; the source plan keeps 590 pairs "Waiting" in Packing Result  
> - Source plan has MOR-PK-2603 → both new plans show "MOR-PK-2603 · shared", no new MOR  
> Source: Q-20261014-01 (3, 5) · Q-20261014-02 (1) · Q-20261002-04 · prototype v0.93  

#### B19 · Ticket in which status?

- Planner
- Comes from: B18
- Goes to [DRAFT]: B20 · Delete draft ticket Exchange Customer PO
- Goes to [CONFIRMED]: B21 · Can cancel?

> The ticket status decides whether the Planner deletes or cancels it.  
> DRAFT: the ticket has not changed any quantity → delete it.  
> CONFIRMED: plans already exist for the target P.Os → it can only be cancelled under conditions, and the ticket stays as CANCELLED.  
> Source: Q-20261014-02 (2)  

#### B20 · Delete draft ticket Exchange Customer PO

- Planner · Web · Exchange Customer PO
- Comes from: B19
- Goes to: B22 · DRAFT ticket deleted — its number is not reused

> The Planner deletes a draft ticket that is no longer needed.  
> Action: open the DRAFT ticket › "Delete Draft" button → popup "Delete draft EXC-…?" → "Delete Draft" button.  
> Result: the ticket disappears from "Exchange List"; a deleted ticket number is not reused.  
> Test:  
> - Delete EXC-20260811-01 (DRAFT), then confirm a new ticket → the new ticket gets EXC-20260811-02  
> Source: Q-20261014-02 (2) · prototype v0.93  

#### B21 · Can cancel?

- Planner
- Comes from: B19
- Goes to [No]: B23 · Cancel blocked — reason shown on the ticket
- Goes to [Yes]: B24 · Cancel ticket Exchange Customer PO

> The system checks whether a CONFIRMED ticket can still be cancelled.  
> Yes: the source plan is still RELEASED; no target-P.O plan has Record Output in Packing Result; the source P.O balance by size ≥ the exchanged quantity (the returned part has not been planned again).  
> No: the "Cancel Exchange" button is greyed out and the ticket shows the reason — "Packing output is already recorded for <plan> (P.O <x>) in Packing Result — the exchange cannot be cancelled." · "<size>: the quantity returned to P.O <x> has already been planned again (n of m pairs still open) — revise that plan first." · "The source plan <plan> is no longer Released — the exchange cannot be cancelled."  
> Test:  
> - Target-P.O plan PKP-20260811-03 already has Record Output → "Cancel Exchange" is greyed out with "Packing output is already recorded for PKP-20260811-03 (P.O 260811-04) …"  
> Source: Q-20261014-02 (2) · prototype v0.93  

#### B24 · Cancel ticket Exchange Customer PO

- Planner · Web · Exchange Customer PO
- Comes from: B21
- Goes to: B25 · Delete target-P.O plans · return qty to source plan

> The Planner cancels a confirmed ticket when the exchange is no longer needed.  
> Action: open the CONFIRMED ticket › "Cancel Exchange" button → popup "Cancel exchange EXC-…?" (From plan · From P.O · To P.O · Plans removed · Quantity returned; size table per target P.O) → "Cancel Exchange" button.  
> Result: the ticket → CANCELLED, with time and user; it stays in "Exchange List" (filter "CANCELLED").  
> Source: Q-20261014-02 (2) · prototype v0.93  

#### B25 · Delete target-P.O plans · return qty to source plan

- Planner · System (auto) · Exchange Customer PO
- Comes from: B24
- Goes to: B26 · Ticket CANCELLED · target-P.O plans deleted · source plan gets the qty back
- Goes to: B27 · End

> The system puts the quantities back as they were before the exchange.  
> System: deletes the target-P.O Packing Plans created by the ticket; the source plan gets back the Total exchange by size; each target P.O balance goes back up and the returned Remaining of the source P.O in Packing Planning goes back down; the source plan MOR does not change.  
> Result: the target-P.O plans disappear from Packing Result; the source plan packs its full former quantity again.  
> Test:  
> - Cancel a 70-pair ticket (20 + 50) from PKP-20260812-04 → PKP-20260811-03 / -04 are deleted, PKP-20260812-04 is back to 690 pairs  
> Source: Q-20261014-02 (2) · prototype v0.93  

## Status lifecycle

#### Exchange Customer PO ticket

`DRAFT` → `CONFIRMED` → `CANCELLED`

Transitions:

- `DRAFT` -- Confirm Exchange --> `CONFIRMED`
- `DRAFT` -- Delete Draft --> `Deleted`
- `CONFIRMED` -- Cancel Exchange — no Record Output yet --> `CANCELLED`

## Input

| # | Input | Type | Used in step |
| --- | --- | --- | --- |
| I-1 | Packing Plan `RELEASED` of the source P.O, not fully packed — goods allocated, not yet packed; with the plan's packing material MOR | Document — Packing flow | Pick source P.O · goods by size |
| I-2 | Target Customer P.O by size — Model, Base Color, Upper Color, AL / INT, ETD, balance | Document — Sales Order | Pick target P.Os · Reason |

## Step ↔ screen

| Step | Role | Screen · UI buttons (per prototype v0.93) |
| --- | --- | --- |
| Create Exchange Customer PO ticket · Pick source P.O · goods by size · Pick target P.Os · Reason · Enter exchange qty by size per target P.O | Planner | Exchange Customer PO · `Create Exchange` · `SOURCE CUSTOMER P.O *` · `PACKING PLAN NO. *` · `Target Customer P.O *` · `Add Target P.O` · `REASON` · `Exchange → P.O …` · `Auto Fill (earliest ETD first)` |
| Save Exchange Customer PO draft · Confirm Exchange Customer PO | Planner | Exchange Customer PO · `Save Draft` · `Confirm Exchange` |
| Record EXC ticket · return Remaining · Reduce source plan · create a plan per target P.O | System (auto) | Exchange Customer PO |
| Delete draft Exchange Customer PO ticket · Cancel Exchange Customer PO ticket | Planner | Exchange Customer PO · DRAFT ticket `Delete Draft` · CONFIRMED ticket `Cancel Exchange` |
| Delete target-P.O plans · return qty to source plan | System (auto) | Exchange Customer PO |

## Output

| # | Output | Produced when |
| --- | --- | --- |
| O-1 | EXC ticket `DRAFT` — can be reopened and edited | Planner saves a draft |
| O-2 | Remaining (balance) of the source P.O returned → Packing Planning; the Planner re-plans the source P.O | Slip `CONFIRMED` |
| O-3 | One new Packing Plan `RELEASED` → Packing Result (Waiting), no new MOR — it carries the MOR number of the source plan; the source plan drops by the Total exchange, the Remaining not exchanged still belongs to the source P.O and keeps packing | Slip `CONFIRMED` |
| O-4 | Slip `DRAFT` deleted — the ticket number is not reused | Planner clicks Delete Draft |
| O-5 | Cancel blocked — the ticket shows the reason | A target-P.O plan has Record Output, or the Remaining returned to the source P.O has been planned again, or the source plan is no longer `RELEASED` |
| O-6 | Slip `CANCELLED` — target-P.O plans are removed from Packing Result, the source plan gets the quantity back, both balances return to their state before the exchange; the source plan MOR does not change | Planner clicks Cancel Exchange on a `CONFIRMED` ticket that can still be cancelled |

## Glossary

| Glossary | Meaning in this flow |
| --- | --- |
| `Source P.O · target P.O` | Customer P.O holding the goods · Customer P.O receiving them |
| `EXC` | Exchange Customer PO ticket, number EXC-<YYYYMMDD>-NN |
| `Reason` | Exchange reason, free text, optional, one field for the whole ticket |
| `Available to exchange` | Exchangeable quantity by size of the source Packing Plan = Plan Qty − recorded output (A + A- + C + Pending repair) |
| `Balance · P.O …` | Quantity the target P.O still needs by size (Remaining in Packing Planning) |
| `Total exchange` | Σ exchange of all target P.Os by size; each size ≤ Available to exchange |
| `Remaining · stays with P.O …` | Available to exchange − Total exchange: the part not exchanged, which stays in the source plan of the source P.O and is still packed in Packing Result |
| `Auto Fill (earliest ETD first)` | Each size goes first to the target P.O with the earliest ETD, up to that P.O Balance, until Available to exchange runs out; equal ETDs follow row order |
| `Remaining (balance) returned` | The exchanged quantity is added back to the source P.O Remaining in Packing Planning for re-planning |
| `AL / INT` | Market of the P.O — the target P.O must match the source P.O |
| `MOR` | Packing material Material Out Request, created when the source plan is released; target-P.O plans created by Exchange share that MOR (shown as "MOR-PK-… · shared") |
| `FG` | Finished goods packed and received into the FG warehouse — their P.O is not changed on this screen; use the WMS exchange function |
