YARN-FLOW.md — complete yarn flow (by order mode)
The yarn spine, drawn for the three order modes the system supports. Node
legend: [DOC] = document/event created · (act) = action by role ·
SYS: = derived by system · the barcode/QR on every bag is the physical
key throughout.
Front door — how yarn comes in (common to all modes)
[GATEPASS] trader→(our godown | endorsed to us for job-work) [DOC: gatepass + image]
planning enters GP (WhatsApp copy + stamped physical handed to carrier)
├─ transporter login: my-pickups → tap picked (partial/all)
└─ godown gate: scan transporter's INWARD code → partial/all →
SYS prints bag barcodes (party, construction, contract no,
count, ticket, wt) → guard tags boxes during unload
[DIRECT-DELIVERY INTIMATION] trader unloads at OUR premises or named SIZER godown
planning raises intimation (count/bags, destination, expected date) — precursor
├─ premises: arrival → normal inward (gate barcodes)
└─ sizer godown: sizer WhatsApp confirm (answer options + photo) →
planning uploads reply & acknowledges; post-delivery gatepass
counter-copy signed = delivery confirmation
Every lot/ bag is marked to a CONTRACT (JW contract | SO | internal production order) at inward; warp|weft is a soft label (fixed later at usage/sizing-outward); set-no is NOT assigned at yarn inward (see sizing).
Flow 1 — Trading SO (order-driven)
SO (mtrs | beams) ─► SYS requirement (kgs, costing engine)
│
▼
[yarn booking] count + TICKET (suggestion), bags × packaging prefill,
warp bags in sizing-set multiples; rate board prefill
│
▼
gatepass / direct-delivery intimation ─► yarn in (barcodes, contract-marked,
│ own; park-lot if no doc yet)
▼
stock (own) ─► SYS states ─► [allocation] / [verbal reservation]
│
├─ WARP: → [WARPING: cones→beams, krill size × parts] →
│ [SIZING TIPPAN: construction + yarn usage + weaver +
│ pick-up + beam count] → warp yarn + empty beams → sizer →
│ filled beams IN (parts; guard taps + GP photo, OCR prefill)
│ │ └─ bottoms/fresh cones → winder → re-wound cones INWARDED
│ └─ [beam card] ─► loom (Stage D)
│
└─ WEFT: direct issue to looms (cones, shift); sold / returned variants
│
▼
weaving (D) ─► checking/grading (E) ─► dispatch vs SO (F) ─► P&L per SO
Flow 2 — Trading stock & sell (production order)
Same physical spine; only the DEMAND and the SALE differ.
[production order] design + mtrs target (+ stock trigger, yarn-trend timing)
│ (this is the demand in requirement calc, allocation, beam plan)
▼
yarn spine exactly as Flow 1 (booking → gatepass/intimation → in → warp
│ sizing/winding → beams → looms; weft direct)
▼
FG stock by lot (checked in at E) ─► SYS lot cost (yarn consumed + conversion)
│
▼ (sell when market is conducive)
SO later ─► dispatch consumes FG stock ─► SYS COGS (FIFO / weighted-avg,
method TBD) ─► profit per SO +
avg cost of available stock
Flow 3 — Job work (party's material, conversion income)
No booking, no costing; contract is the anchor.
[job-work contract] (loom class, rate = jobRate ₹/pick × picks, mtrs|beams)
│
├─ YARN: party yarn via GATEPASS (trader endorses to us) —
│ weft received IN PARTS; beams variant:
│ A) party FILLED beams received (set-no at their beam inward)
│ B) empty beams OUT (ours) with party warp → sizing → filled in
│ (beam-out = intimation → guard taps; no strict chronology;
│ warp & weft can arrive together)
│
├─ WEFT: issued to weaving/weaver at calculated requirement ×1.05
│ └─ saved weft (efficiency) → [yarn-stock-transfer to weaver
│ account] → weaver sells later
│
├─ fabric: checking → dispatch (module = job-work)
│
└─ close: [hishob per contract] yarn given vs fabric delivered,
generated at last dispatch → pending→sent→accepted
Cross-mode rules
- One physical spine: inward (barcode) → stock (own|party, contract-marked) → warp/weft legs → weaving → checking → dispatch; the mode only changes who the demand is (SO / production order / contract) and which cost legs apply at closing (P&L per SO / lot-avg / conversion + hishob).
- Stock shows LOCATION: our godown / sizer / weaver / in-transit — own stock tracked across the whole value chain, not just premises.
- QR = mobile camera (no hardware scanners); every move = scan bag → tap count/mode.
- Park-lot: yarn without a document (own or party) — assign later.
- Weft usage basis = bag barcode + cones-moved numbers at issue/return.
(Drawn 2026-09-01; owner reviews for corrections, then this becomes the Stage B/C reference.)