Sp_Check_sWod (procedure)
生产工单单据保存之前数据校验
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sTableName |
varchar(100) |
| 2 | IN | sGuid |
longtext |
| 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_sWod'._
Narrative
Business context: 订单生产流程 → 轮转工单 / 生产工单 / 2/3 新增生产补单 — heavyweight post-save validator on mftworkordermaster/mftworkorderslave/mftworkordermaterials/mftworkorderprocess. Refuses saves that would leave the work order in an inconsistent state with already-issued purchase orders, material applications or production reports, then re-derives money fields across the slave rows the same way Sp_Check_sSod does for sales orders.
What it does: Refuses save with sMaterialQtyZero when any mftworkordermaterials.dMaterialsKQty=0; with sProcessScZero when any mftworkorderprocess.dProcessQty=0; with sMaterialPurDeleted when a purpurchaseorderdetail row still references a material the work order has since dropped (A.sSrcSlaveId not in (Select sId From mftworkordermaterials …)); with sMaterialLlsq when the reduced material qty drops below the already-applied viw_mitproductionapply qty (form 101251240115016056026128440 领料申请); with sMaterialPurCantChange when a row that has been purchased now disagrees with purpurchaseorderdetail.sMaterialsStyle/sMaterialsId. Then reads NetMoney/NetPrice, opens a cursor over the slave rows and runs the same per-row money recalc as Sp_Check_sSod — recomputing dProductMoney/dProductPrice/dNProductMoney/dNProductPrice/dProductNoTaxMoney/dProductTaxMoney from foreign currency × dCurrencyRate minus 打样/版/刀模 surcharges.
Invocation: Bound to gdsmodule.sSaveProName on three modules — 轮转工单 (sId 101251240115015840916341460), 生产工单 (sId 101251240115016002469445380), and 2/3 新增生产补单 (sId 101251240115016098136660960) — all under 订单生产流程 (KPI流程操作菜单). Dispatched by BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName") after the save batch commits. xly-src ships script/标版/30100101/Sp_Check_sWod.sql as the install body. sGuid is declared LONGTEXT (not the usual varchar(100)) because the dispatcher passes multi-row save batches concatenated.