Sp_Calc_sCut.md 2 KB

Sp_Calc_sCut (procedure)

物料转换单

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN iFlag int
2 IN iTmpCheck int
3 IN sFormGuid varchar(100)
4 IN sGuid varchar(100)
5 IN sLoginId varchar(100)
6 OUT sReturn varchar(100)
7 IN sBrId varchar(100)
8 IN sSuId varchar(100)
9 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpCalc_sCut'._

Narrative

Business context: 材料库 → 材料库单据 → 物料转换单据 — material-cut / material-conversion check / uncheck on MitMaterialsCutMaster. A 物料转换 turns one stocked material (e.g. a large parent sheet/roll) into one or more child materials; auditing the doc posts the conversion into the materials-store ledger and refreshes the linked work-order BOM. Same proc is reused by 材料转换(入) (the inbound-side conversion view).

What it does: Validates sGuid. With iFlag=1: refuses if already checked; updates the MitMaterialsCutMaster audit flags, runs Update MftWorkOrderMaterials / Update MitMaterialsStore to apply the conversion against the affected work-order BOM and store rows, then INSERT INTO EleMaterialsStock / UPDATE EleMaterialsStock posts the stock movement, and CALL Sp_calc_materialsstoreLimit re-checks per-location stock limits. With iFlag=0: symmetric uncheck reverses each step.

Invocation: Bound to gdsmodule.sProcName on:

  • 物料转换单据 (sId 101251168116315839165634020) — 材料库 → 材料库单据
  • 材料转换(入) (sId 986502008721788802615003001) — 通用常量 → 常用设置 → 销售管理 (inbound conversion view; same audit serves both directions)

xly-src ships script/标版/30100101/Sp_Check_sCut.sql as a pre-audit validator that pairs with this proc.