# `Sp_Manufacture_sSodPurchareMaterials` (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_sSodPurchareMaterials`'`._ ## Narrative **Business context:** 销售管理 / 物料采购流程 — sister of `Sp_Manufacture_sWodPurchareMaterials`, but driven from the sales-order side (header: 根据销售订单采购物料 — "purchase materials from sales orders"). Takes selected 销售订单 rows, rolls up their material demand, nets against on-hand and on-order, and returns the gridded purchase-suggestion lines via the standard `Sp_Outstanding_Query` paging contract. **What it does:** Builds the staging table `Tmp` with the sales-order material breakdown (`Insert INTO Tmp` / `Insert into TmpMaterials`), iterates `delete from TmpMaterials`/`Update Tmp` for net-out logic, then `INSERT INTO sWodMaterialsStoreList` and `Update sWodMaterialsStoreList` for the output staging that the report grid renders. Final paged select runs through `CALL Sp_Outstanding_Query` with `bFilter / sFilterOrderBy / sGroupby_*` splicing. **Invocation:** No form-master binding, no gdsmodule hook, no other-routine reference, and no Java caller — install script ships at `script/标版/30100101/schedule/Sp_Manufacture_sSodPurchareMaterials.sql`. Status: appears orphaned — present in the install tree but not wired to a form. Likely the legacy sales-order counterpart to the work-order-driven `Sp_Manufacture_sWodPurchareMaterials` that is the active version. Candidate for maintainer audit.