Sp_Check_sDgda.md 2.03 KB

Sp_Check_sDgda (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_sDgda'._

Narrative

Business context: 销售管理 → 材料送货单 (saldelivergoodsmaster, material side of 送货单) — post-save validator covering employee binding, 库存条码 mapping, and source-qty consistency against the upstream 送货通知 (saldelivernotifyslave). Heavier validator than Sp_Check_sDgd because it also runs barcode-warehouse propagation.

What it does: Reads sMinusSrcId/sMinusType/sWareHouseId/sInWareHouseId/sBillNo from SalDeliverGoodsmaster. Propagates sWareHouseId/sInWareHouseId to every saldelivergoodsslave and to the bound mitmaterialsstorebarcode rows, stamping sMasterBillNo. Joins sftlogininfo+eleemployee on sUserName=sLoginId; if no employee binding exists, aborts with sDgdNotEmployee ("当前操作人非员工,需要绑定员工关系,否则影响门卫放行"). Then calls Sp_Check_dOraQtyTs to verify slave dProductQty does not exceed the source saldelivernotifyslave.dProductQty, and runs further barcode-uniqueness checks on mitmaterialsstorebarcode.

Invocation: Called from the PDA wrapper Sp_Check_sDgda_phone and (per the 送货单 family convention) the same gdsmodule path used for the material 送货单 variant. xly-src has no SQL install script for this proc — it lives only in the live database. Pre-save peer is presumed to be the generic Sp_beforeSave_sDgd family.