# `Sp_Manufacture_GetAPSState` (procedure) > @author: @date:20210521 封存 @describe: 排程工艺流程、材料准备情况 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `bFilter` | `longtext` | | 2 | IN | `sLoginId` | `varchar(100)` | | 3 | IN | `sBrId` | `varchar(100)` | | 4 | IN | `sSuId` | `varchar(100)` | | 5 | OUT | `sReturn` | `varchar(1000)` | | 6 | OUT | `sCode` | `int` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Manufacture_GetAPSState`'`._ ## Narrative **Business context:** 生产管理 → 生产计划管理 (APS 排程) — pre-pass that drives "排程工艺流程、材料准备情况" before the per-machine OEE pass: refreshes material-check flags on the work-order then delegates to `Sp_Manufacture_GetAPSStateOee` to compute the actual machine-level state, finally calls `planScriptTmp()` to materialise the planning temp table. **What it does:** Parses the `bFilter` JSON array into `sMachineId`/`sProcessId`. Sweeps `MftWorkOrderMaterials` joined against `purpurchaseorderslave`: rows where a purchase order already exists are auto-marked `bPlanMaterialCheck=1`, with `bPlanMaterialCheckResult` set from the inbound qty. Then `CALL Sp_Manufacture_GetAPSStateOee(bFilter, p_sMachineId, sLoginId, sBrId, sSuId, sReturn, sCode)`; on `sCode<0` sets `sCode=-1` and leaves. Always finishes with `CALL planScriptTmp()`. **Invocation:** Chained from `Sp_productionPlan_BtnEventAutoOrder10` (the 印刷计划 自动排序 button — generic-dispatch toolbar action). Not bound directly to any form-master or `gdsmodule` hook. Install: xly-src `script/标版/30100101/schedule/Sp_Manufacture_GetAPSstate.sql`.