Sp_Check_sPmd.md 2.65 KB

Sp_Check_sPmd (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_sPmd'._

Narrative

Business context: 生产管理 → 物料领用流程 → 生产领料 / 生产补料 / 生产退料 — post-save validator on MitProductionMaterialsMaster/Slave (sPmd = production-materials-dispatch). Enforces the over-issue limits a customer sets via the MaterialsStockLimit switch in SysSystemSettings: requested qty vs. plan qty, picked qty vs. requested qty, returned qty vs. previously-issued qty — branching on which form (领料 / 补料 / 退料 / 发外补料) raised the save.

What it does: Sets sCode=1, iFlag=0, clears sReturn. Reads NetMoney/NetPrice precisions. Branches on sFormGuid — for 生产领料 (192116810113315226492535760), 1/1 新增生产补料 (192116810113315222184074940), 发外补料, and two additional forms, opens cursors over MitProductionMaterialsSlave joined to upstream mftproductionmaterialsapply / mftworkordermaterialsslave / mitproductionmaterialswastebookmaster, computes the overrun, calls Sp_Sis_GetConst('MaterialsStockLimit', ...) to decide whether to abort, and on overrun raises sMwhMaterialInOrder, sMwhCkQtyUpOrderMaterial, sMwhCkJjQtyUpOrderMaterial, sMaterialCkQtyUp, sMaterialJjQtyUp, sMwhJjQtyUpLlsq, sMwhCkQtyUpLlsq, sMwhCkJjQtyLlsq, sMwhMaterialInClck, sMwhMaterialInLlrk, etc. For 生产退料 (192116810113315226622476570) the equivalent over-return check is applied. Finally calls Sp_afterSave_sPmd. The 红冲 (reverse-charge) branch is commented out.

Invocation: Bound to gdsmodule.sSaveProName on 生产领料单据 (192116810113315226492535760), 1/1 新增生产补料 (192116810113315222184074940), and 生产退料单据 (192116810113315226622476570) — all under 生产管理 → 物料领用流程 (KPI流程操作菜单). Dispatched by BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName") after the save batch commits. Pre-save peer is Sp_beforeSave_sPmd. xly-src ships script/标版/30100101/Sp_Check_sPmd.sql as the install body.