Files
sap-erp/packing-calculation.txt
John 69b4e68baf
SAP-ERP Portal CI/CD / build (push) Failing after 5m20s
first commit
2026-09-23 17:31:02 +05:30

30 lines
1.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
The Qty Req. (Units) for each packing/component row is auto-calculated in recalcMaterials() (work-order.html:369-371) whenever Total Units, Std Qty/Unit, or Ovg% changes:
total = Std Qty/Unit × Total Units × (1 + Ovg% / 100)
if the item is a ROLL item (name contains "<number> MTR", e.g. "PRINTED FILM 50 MTR"):
Qty Req. (Units) = ceil(total / roll length) ← total metres needed ÷ metres per roll, rounded UP
else (a discrete-count item — caps, boxes, labels, etc.):
Qty Req. (Units) = round(total) ← rounded to nearest whole unit
Details on the inputs:
Std Qty/Unit (work-order.html:204) accepts a plain number or a fraction like 1/2 (parsed as n/d).
Roll length (work-order.html:207) is pulled straight out of the component's name — it regex-matches \d+ MTR (case-insensitive), so an item named e.g. LDPE FILM 100 MTR is treated as a 100-metre roll; if no MTR pattern is found, rl=0 and it falls to the plain rounding path.
If you manually type directly into the Qty Req. field, that row gets flagged _manual=true and the auto-calc skips it from then on — it only resumes auto-computing once you edit Std Qty/Unit, Ovg%, or UOM again.
This is the same for both the separate "Packing Materials" table and the simplified single "Components" table (singleTableMode, when no raw material was found) — they share the same _pack array and formula.
now Qty Req. (Units) = round(Std Qty/Unit × Total Units × (1 + Ovg%/100))
log1
prod1
prod2 - manager
store1
qa1
qa2 - manager
qc - manager
123456