# `GetPriorProcessPlan` (function) > 得到上道工序生产情况 - **Type:** FUNCTION - **Returns:** `text` - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `uGuid` | `varchar(100)` | | 2 | IN | `uProcessGuid` | `varchar(100)` | | 3 | IN | `uPrductGuid` | `varchar(100)` | | 4 | IN | `sBrId` | `varchar(100)` | | 5 | IN | `sSuId` | `varchar(100)` | | 6 | IN | `sControlId` | `varchar(100)` | | 7 | IN | `sWorkOrderProcessTbId` | `varchar(100)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTION `GetPriorProcessPlan`'`._ ## Narrative **Business context:** 得到上道工序生产情况 — for a current APS gantt row, builds the "prior process production status" text the planner sees on the schedule board. Shape: `-(qty)/` or `-未生产/无计划` if the upstream step has neither been reported nor scheduled. Walks back through 蓝纸确认 → 文件制作 → upstream `sType<3` steps in priority order so the planner always sees the most relevant blocker first. **What it does:** reads the current `MftWorkOrderProcess` row (`iOrder`, `sType`, `sCombinePartsName`). When `sType='1'` (印刷/main process), looks for prior steps with `eleprocess.sProcessPhase = '蓝纸确认'` in the same control group, joins to the matching `mftproductionplanslave` row (`sWorkOrderProcessTbId` match), formats `processName-<报工时间(qty)>/<计划时间>`. If nothing useful is found, falls back to `文件制作`, then to any non-control prior step, then (when `sCombinePartsName` is set) widens to combined parts via `mftworkordercontrolcombine`. Each fallback uses the same `(@rownum/@rank/@sPsId)` ranking trick to pick the latest row per control group. **Invocation:** referenced by `Sp_Manufacture_GetAPSState` — embedded in the APS state-column builder alongside `GetPriorPlate` and `GetPriorProcess`. Same module path: `工作中心 → 生产管理 → 排产` (APS gantt). Also referenced in xly-src `script/标版/30100101/schedule/Sp_Manufacture_GetAPSstate.sql`.