Sp_CheckChild_sPdt (procedure)
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sGuid |
varchar(100) |
| 2 | IN | sBrId |
varchar(100) |
| 3 | IN | sSuId |
varchar(100) |
| 4 | OUT | sCode |
int |
| 5 | OUT | sReturn |
varchar(5000) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpCheckChild_sPdt'._
Narrative
Business context: 成品检验 audit-time child-product completeness check, called from Sp_Calc_sPdt. Composite products (multi-component 销售订单 lines) need every child component shipped before the parent can be audited: this helper looks up the child rows in salsalesorderslave (where sFatherSlaveId links a 子产品 to its parent line) and ensures each child's dOutProductRejQty already covers dProductQty * dCombineCoefficient. If any child is short, the audit aborts with sCode=-8 and a per-product breakdown.
What it does: Resolves the qlyproducttestmaster row by sGuid, joins mftworkorderslave (filtered to bMain=1) to discover all order-slave references on the QC bill, and builds a temp table summing IF(dArrProductQty>0, dArrProductQty, dProductQty) per sOrderSlaveId. Joins back to salsalesorderslave + eleproduct to find any child row whose dOutProductRejQty < B.dProductQty * A.dCombineCoefficient; concatenates "子产品:<name>出库不足,应出库 X 已出库 Y" lines into p_sMsg. Sets sCode=-8, sReturn=p_sMsg, and LEAVE TOP if any short row is found.
Invocation: Called by Sp_Calc_sPdt (成品检验审核) — the standard Sp_Calc_s<Code> audit dispatcher for 成品检验 — as part of its 审核 (iFlag=1) pre-flight, after the bill's own bCheck guard and before it commits the audit flags. No direct UI binding.