# `Sp_Manufacture_GetAPSStateOee` (procedure)

> @author:
			           
		@date:20210521 封存
				        
		@describe: 排程工艺流程、材料准备情况


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `bFilter` | `longtext` |
| 2 | IN | `sMachineId` | `varchar(100)` |
| 3 | IN | `sLoginId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(1000)` |
| 7 | OUT | `sCode` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Manufacture_GetAPSStateOee`'`._

## Narrative

**Business context:** 生产管理 → 生产计划管理 (APS 排程) — per-machine engine behind `Sp_Manufacture_GetAPSState`: walks each machine's planning queue, fills work-order process flow + material-readiness signals into `mftproductionplanslave`, and snapshots data into `plc_machinedata_tmp` for the PLC/board dashboard.

**What it does:** Recognises three filter shapes: `未排程传入工序` (resort by process), `未排程传入设备` (per-machine), or the JSON `bFilter` array of `sMachineId`/`sProcessId`. Builds the temporary `p_MftWorkOrderProcess` from `MftProductionPlanSlave`/`mftproductionmeans`, runs upstream-process and plate-readiness checks per row, then `UPDATE MftProductionPlanSlave` to set `sPriorProcess`/`sPriorPlate`/state flags, `INSERT INTO plc_processId` and `plc_machinedata_tmp` for downstream PLC consumption.

**Invocation:** Chained from `Sp_Manufacture_GetAPSState` (the standard pre-pass) and from `Sp_productionPlan_BtnEventAutoOrder10` (印刷计划 自动排序 button). Not bound directly to any form-master or `gdsmodule` hook. Install: xly-src `script/标版/30100101/schedule/Sp_Manufacture_GetAPSStateOee.sql`; customer variant under `script/客户/无锡中江/Sp_Manufacture_GetAPSStateOee.sql`.
