Sp_elematerials_AfterUpdateCard (procedure)
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sGuid |
varchar(2000) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpelematerials_AfterUpdateCard'._
Narrative
Business context: Recomputes the 见坑/纸板 (corrugated-board) material's guide price and composition name. Used in tandem with Sp_elematerials_AfterUpdate — runs only when the saved material has multiple elematerialscomb layers (i.e. it's a corrugated-board composite). Encodes the printing-industry loss rates for 2-layer (with A-flute special case), 3-layer, 4-layer (with P/B底纸 carving), and 5-layer constructions.
What it does: Numbers elematerialscomb rows via @i:=@i+1 into iOrder. With p_iCount=2, checks for A-flute (loss 1.07) else picks loss by 第一层底纸 code P=1.03, B=1.05, else 1.05; p_iCount=4 repeats the P/B logic; otherwise loss=1.05. Reads dWorkMoney from row #2 for 2-layer, else fixed 0.3 (3-layer) or 0.4 (5-layer). Cursors elematerialscomb ordered by iOrder: odd rows (face papers) compute iWeight*dPrice/1.55/1e6 and append +<sName> to p_sMaterialsName1; even rows (flutes) multiply by dHoleRate and append the flute code to p_sMaterialsName2. Final guide price = Σ × loss + dWorkMoney, scaled by 1.25 when iAssort<>1 (likely tax-inclusive flag). Writes both dGuidePrice and (if no ( already in sMaterialsName) the composition string back to elematerials.
Invocation: Called directly by Sp_elematerials_AfterUpdate as its final step. Also referenced by intra-DB test/diagnostic procs sp_cursor_CardEdit, sp_cursor_CardEdit1, sp_cursor_test. No form-master/gdsmodule binding of its own and no xly-src reference — it lives entirely as a helper to the orphaned Sp_elematerials_AfterUpdate. Candidate for the same audit as its parent.