# `Sp_Manufacture_GetPlanAPSstate` (procedure)

> 主计划：齐套稽查(材料准备、工艺流程)


- **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_GetPlanAPSstate`'`._

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 主计划 — kit-completeness audit (齐套稽查) for the master plan. Per the body's COMMENT ("主计划：齐套稽查(材料准备、工艺流程)"), it inspects every active master-plan row and refreshes the `sPartNameStatus` / `sMaterialsStatus` summary on `MftProductionPlan` based on whether the upstream parts and material checks are satisfied.

**What it does:** Resets `sPartNameStatus` and `sMaterialsStatus` to empty for all `MftProductionPlan` rows with `sState<>'6'` for the brand/subsidiary. Materialises a temporary `p_MftWorkOrderProcess` and `p_MftWorkOrder_Materials/_Group` from the work-order side, then `CALL Sp_MaterialCheck_BtnEventMaterialCheck` per master row to compute readiness, finally `UPDATE MftProductionPlan` with the resolved status strings.

**Invocation:** Status: appears orphaned — no form-master binding, no `gdsmodule` hook (no row has `sProcName='Sp_Manufacture_GetPlanAPSstate'`), no other routine references it, and the only xly-src hits are the install script `script/标版/30100101/schedule/Sp_Manufacture_GetPlanAPSstate.sql` and a 无锡中江 customer override. Likely scheduled externally (cron / 计划任务) or invoked via metadata not yet surveyed — candidate for maintainer audit.
