# `Sp_Calc_sPca` (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(5000)` | | 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 PROCEDURE `Sp_Calc_sPca`'`._ ## Narrative **Business context:** 材料库存 → 材料库单据 → 采购到货(送检)单据 — audit handler for the purchasing arrival-for-inspection doc on `PurPurchaseArriveMaster`. This is the goods-receipt that goes to QC inspection rather than directly into stock; on approval the master row is frozen and the inspection workflow can pick the lines up. **What it does:** Standard `Sp_Calc_*` validate-and-flip — guards `sGuid`/`bInvalid`/`bCheck`, then `Update PurPurchaseArriveMaster` to set `bCheck=1, sStatus=1, sCheckPerson, tCheckDate=NOW()`. `iFlag=0` reverses the flags. **Invocation:** Bound to `gdsmodule.sProcName` on `采购到货(送检)单据` (sId `101251240115016068096930620`) — 材料库存 → 材料库单据. Dispatched by `BusinessBaseServiceImpl.getPrcName(sFormGuid, …)` on the audit/un-audit button. Install script ships at `script/标版/30100101/Sp_Calc_sPca.sql`. Note: a sibling `Sp_Calc_sPca1` (orphaned) targets `PurPurchaseArriveshMaster` — the 送货 send-back variant.