Sp_Check_sCut.md 1.8 KB

Sp_Check_sCut (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_sCut'._

Narrative

Business context: 物料管理 → 物料转换单据 (mitmaterialscutmaster/slave) — post-save red-stroke (红冲) guard. Blocks a duplicate red-stroke save: if the document is a red-stroke (sMinusSrcId set) and the upstream source's slaves no longer net to zero after this attempt, the save is refused.

What it does: Reads sMinusSrcId from mitmaterialscutmaster for sId=sGuid. If non-empty, joins the original document's mitmaterialscutslave against the sum of all already-issued red-stroke slaves (SUM(dAuxiliaryQty) GROUP BY sMinusSrcSlaveId); if any source line's dAuxiliaryQty + counter-qty <> 0, aborts with sCode=-1 and the localised sCcprkHaveRedData ("已存在红冲数据,不允许重复提交") message from Fun_Sis_GetConstNew. No work on non-red-stroke documents.

Invocation: Bound to gdsmodule.sSaveProName on 物料转换单据 (101251168116315839165634020) under 物料管理 → 仓储管理. Dispatched by BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName") after the save batch commits. xly-src ships script/标版/30100101/Sp_Check_sCut.sql as the install body.