# `Sp_Manufacture_PurPurchaseChecking` (procedure) > 工单到采购计划 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sId_s` | `varchar(4000)` | | 2 | IN | `sStyle_s` | `varchar(4000)` | | 3 | IN | `sWorkId_s` | `varchar(4000)` | | 4 | IN | `sLoginId` | `varchar(100)` | | 5 | IN | `sWorkOrderNo_s` | `varchar(255)` | | 6 | IN | `sCustomerName_s` | `varchar(255)` | | 7 | IN | `sProductName_s` | `varchar(255)` | | 8 | IN | `iPurchase_s` | `int` | | 9 | IN | `bViewAll_s` | `int` | | 10 | IN | `bSlaveAll_s` | `int` | | 11 | OUT | `sCode` | `int` | | 12 | OUT | `sReturn` | `varchar(5000)` | | 13 | IN | `sBrId` | `varchar(255)` | | 14 | IN | `sSuId` | `varchar(255)` | | 15 | IN | `bFilter` | `varchar(5000)` | | 16 | IN | `sUnTaskFormId` | `varchar(100)` | | 17 | IN | `pageNum` | `int` | | 18 | IN | `pageSize` | `int` | | 19 | OUT | `totalCount` | `int` | | 20 | IN | `countCloumn` | `varchar(5000)` | | 21 | OUT | `countMapJson` | `longtext` | | 22 | IN | `sFilterOrderBy` | `varchar(5000)` | | 23 | IN | `sGroupby_select_sql` | `varchar(5000)` | | 24 | IN | `sGroupby_group_sql` | `varchar(5000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Manufacture_PurPurchaseChecking`'`._ ## Narrative **Business context:** 生产管理 / 采购管理 — `工单到采购计划` (work-order to purchase-plan) pivot. For a selected set of work-orders / styles / customers, returns the consolidated materials list that the purchaser needs to procure: per (sMaterialsId, sCustomerId) accumulating product qty / money / min/max stock so the buyer can decide whether to issue a purchase plan. **What it does:** Builds scratch `Tmp1` keyed by `(sMaterialsId, sMaterialsNo, sMaterialsName, sMaterialsStyle, sCustomerId, …)` from `Viw_PurPurchaseChecking` filtered by the comma-list inputs (`sId_s`, `sStyle_s`, `sWorkId_s`, `sWorkOrderNo_s`, `sCustomerName_s`, `sProductName_s`, `iPurchase_s`, `bViewAll_s`, `bSlaveAll_s`). A second pass `update Tmp1 t1` enriches each row, then `UPDATE tmp AS TMP_Viw_PurPurchaseChecking_BFla …` applies the `bFilter` overlay. Final paging via `Sp_Outstanding_Query`. COMMENT is `工单到采购计划`. **Invocation:** No form-master binding, no `gdsmodule` hook, no other-routine caller. xly-src only ships the install script `script/标版/30100101/Sp_Manufacture_PurPurchaseChecking.sql`. Status: appears orphaned in the metadata channels — sibling `Sp_Manufacture_SalSalesChecking` (same `工单到采购计划` comment) is also unbound, suggesting both have been retired in favour of view-driven flows. Candidate for maintainer audit.