Sp_Check_sMad (procedure)
材料调拨单据保存之前数据校验
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sTableName |
varchar(100) |
| 2 | IN | sGuid |
varchar(100) |
| 3 | IN | sFormGuid |
varchar(100) |
| 4 | IN | sLoginId |
varchar(100) |
| 5 | IN | sBrId |
varchar(100) |
| 6 | IN | sSuId |
varchar(100) |
| 7 | IN | iFlag |
int |
| 8 | OUT | sCode |
int |
| 9 | OUT | sReturn |
varchar(4000) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpCheck_sMad'._
Narrative
Business context: 物料管理 → 仓储管理 → 材料调拨单据 (sMad = material-adjust, on mitmaterialsadjustmaster/slave) — post-save red-stroke (红冲) guard and after-save hook trigger. Same red-stroke pattern as Sp_Check_sCut but on the material-adjustment table family.
What it does: Reads sMinusSrcId from mitmaterialsadjustmaster for sId=sGuid. If non-empty, joins the original document's mitmaterialsadjustslave against the sum of all red-stroke counter-slaves (SUM(dAuxiliaryQty) GROUP BY sMinusSrcSlaveId); if any source line's dAuxiliaryQty + counter-qty <> 0, aborts with sCcprkHaveRedData ("已存在红冲数据,不允许重复提交"). On success, calls Sp_afterSave_sMad(sGuid, sBrId, sSuId, sCode, sReturn) to run the after-save back-fill (cost/qty distribution).
Invocation: Status: appears unbound at module level. The 材料调拨单据 module (192116810113315227212629260) has sSaveProName='' and only sProcName=Sp_Calc_sMad. No other routine references Sp_Check_sMad; xly-src ships only script/标版/30100101/Sp_Check_sMad.sql as the install body. Either bound by a customer override script not in the live gdsmodule, or expected to be invoked from Sp_Calc_sMad at audit time — verify with the maintainer.