Sp_Check_sPpr.md 2.23 KB

Sp_Check_sPpr (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_sPpr'._

Narrative

Business context: 生产管理 → 订单生产流程 → 产量上报 — post-save validator on mftproductionreportmaster/mftproductionreportslave. Enforces that the reported processed quantity does not exceed the underlying 生产计划 plan quantity or the 工序 process quantity (summed across all non-invalid production-report records for the same source slave).

What it does: Sets sCode=1, iFlag=0, clears sReturn. Reads NetMoney/NetPrice precisions (unused — template scaffolding). When sFormGuid is set, opens a cursor over mftproductionreportslave filtered by sParentId=sGuid, and for each row with a non-empty sSrcSlaveId runs two over-report checks: (1) plan: mftproductionplanslave.dProcessQty - SUM(mftproductionreportslave.dProcessQty) joined back through master and eleproduct — if negative, appends 产品名称在产量上报明细单据号<billno>中上报数已超过计划数量;. (2) process: same calculation against mftworkorderprocess.dProcessQty — if negative, appends 上报数已超过工序数量;. Sets sCode=-1 and exits if sReturn ended up non-empty. The trailing Sp_afterSave_sPpr call is commented out.

Invocation: Bound to gdsmodule.sSaveProName on 产量上报 (19211681019715476042694840) — 生产管理 → 订单生产流程 (KPI流程操作菜单). Dispatched by BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName") after the save batch commits. Pre-save peer is Sp_beforeSave_sPpr. xly-src ships script/标版/30100101/Sp_Check_sPpr.sql as the install body.