Sp_Check_sOpkg.md 2.2 KB

Sp_Check_sOpkg (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_sOpkg'._

Narrative

Business context: KPI流程操作菜单 → 发外加工流程 → 发外对账 — post-save validator on opsoutsidecheckingmaster. Prevents mixed 烟包/非烟包 reconciliation, blocks duplicate-source 发外确认 selections, then spreads the master-level 折扣 (discount) money across slaves proportionally and re-applies the price/tax recompute used elsewhere in the 发外 family.

What it does: Reads NetMoney/NetPrice precision from SysSystemSettings. Aborts if opsoutsidecheckingslave joined to elecustomer/siscustomerproperty mixes 烟包 with non-烟包 customers (sYbNybCantReconciled), and aborts if any non-红冲 slave references the same (sSrcNo, sSrcSlaveId) twice (sFwqrDataDuplicate). Then seeds dMaterialsOldPrice from dMaterialsPrice, computes the slave total, and apportions the master dLossAllMoney across slaves as sLossType='折扣' per (qty × oldPrice / total). Finishes with the standard cursor-driven money/tax recompute over opsoutsidecheckingslave joined to elematerials/sistax.

Invocation: Bound to gdsmodule.sSaveProName (post-save) on 发外对账 (192116810113315235850403280, under KPI流程操作菜单 → 发外加工流程). Dispatched by BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName") after the save batch commits. xly-src ships script/标版/30100101/Sp_Check_sOpkg.sql as the install body. The procedure summary text (发外发票单据保存之前数据校验) misnames the form — actual binding is 发外对账, not 发外发票.