Sp_Check_sSmia.md 1.97 KB

Sp_Check_sSmia (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_sSmia'._

Narrative

Business context: 半成品入库申请 (semi-goods inbound application) post-save validator on sgdsemigoodsinstoreapplymaster/sgdsemigoodsinstoreapplyslave. The proc's stored COMMENT ('生产工单单据保存之前数据校验') is a copy-paste from the sWod template — the real body operates on the inbound-apply tables and joins mftworkorderprocess to cap the apply qty by the work-order's per-process plan.

What it does: Iterates a cursor over the apply slave rows. For each row with non-empty sSrcSlaveId, joins mftworkorderprocess and sums the existing applied dProcessQty against the work-order's dProcessQty; over-quantity produces sSmiaQtyUpWorkOrderQty ("申请数量已超过工单数量") combined with the offending product name and either sProductInHalfGoods (single bill) or sProductInHalfGoodsNo (multiple bills) localizers. Aborts with sCode=-1 if sReturn non-empty, otherwise chains Sp_afterSave_sSmia.

Invocation: Status: appears orphaned. No gdsmodule.sSaveProName hook, no gdsconfigformmaster binding, no other-routine caller. Family siblings Sp_beforeSave_sSmia, Sp_afterSave_sSmia, Sp_Calc_sSmia all exist in the live DB. Candidate for maintainer audit on which deployments wire the 半成品入库申请 module to this validator.