Sp_Calc_sMma.md 1.9 KB

Sp_Calc_sMma (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(4000)
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_sMma'._

Narrative

Business context: 材料库存 → 材料库单据 → 材料库存调整单据 — material-stock adjustment audit / un-audit on MitMaterialsStoreAdjustmentMaster. The 库存调整 is the manual escape hatch for fixing on-hand totals that no other transaction can correct (lost/found stock, post-stocktake patches). Auditing the doc commits the adjustment into MitMaterialsStore and refreshes the EleMaterialsStock snapshot.

What it does: Defaults the IN params, branches on iFlag. On iFlag=1 flips MitMaterialsStoreAdjustmentMaster.bCheck=1 and INSERT INTO EleMaterialsStock re-aggregating from MitMaterialsStore after the adjustment rows post. On iFlag=0 runs Delete From MitMaterialsStore for the doc's adjustment rows and UPDATE EleMaterialsStock to restore prior on-hand.

Invocation: Bound to gdsmodule.sProcName on 材料库存调整单据 (sId 192116810113315227379171200) under 材料库存 → 材料库单据. Dispatched by Java BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on the 审核/反审核 button. xly-src ships script/标版/30100101/Sp_Calc_sMma.sql and script/标版/optimize/Sp_Calc_sMma.sql. Note: the sibling Sp_Calc_sMmm covers the financial-adjust variant (MitMaterialsStoreAdjustmoneyMaster).