Sp_Calc_sPck.md 1.73 KB

Sp_Calc_sPck (procedure)

成品库存盘点

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN iFlag int
2 IN iTmpCheck int
3 IN sFormGuid varchar(100)
4 IN sGuid varchar(100)
5 IN sLoginId varchar(100)
6 OUT sReturn varchar(4000)
7 IN sBrId varchar(100)
8 IN sSuId varchar(100)
9 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpCalc_sPck'._

Narrative

Business context: 成品库存 → 成品库单据 → 成品盘点 — audit handler for the finished-goods stocktaking doc on PitProductCheckMaster/PitProductCheckSlave. The 成品盘点 records the on-hand vs. system-recorded gap per stock line; on approval it freezes the count and (in the canonical body) posts the variance against the electronic stock ledger so the next cost run sees corrected quantities.

What it does: Standard validate-and-flip — guards sGuid/bInvalid/bCheck, then UPDATE pitproductcheckmaster + Update PitProductCheckSlave to set bCheck=1, sStatus=1, sCheckPerson, tCheckDate=NOW(). Joins PitProductCheckSlave back to the stock-ledger side to apply the variance row by row. iFlag=0 reverses the flags.

Invocation: Bound to gdsmodule.sProcName on 成品盘点 (sId 192116810113315264733417750) — 成品库存 → 成品库单据. Dispatched by BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on the audit/un-audit button. Install scripts at script/标版/30100101/Sp_Calc_sPck.sql and script/标版/optimize/Sp_Calc_sPck.sql.