# `GetNextMachine` (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 | `sControlId` | `varchar(100)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTION `GetNextMachine`'`._ ## Narrative **Business context:** 得到后道工序的机台 — for a given work-order process (`uGuid`, `uProcessGuid`, optionally `sControlId`), returns the space-separated list of distinct machine names assigned to the **next** process in the same control-group. Used by 产量上报 / OEE 报工 / 巡检 reports to show operators which downstream machine the current process feeds into. **What it does:** in `MftWorkOrderProcess`, looks up the current process's `iOrder` and `sType`; finds the next process (next-higher `iOrder` under the same `sParentId` + `sControlId`). Then in `MftProductionPlanSlave` it `group_concat`s the distinct `elemachine.sMachineName` rows matching that next process (or, when `sType='0'`, the whole control group's `stype='1'` plan slaves). Two branches: with-control-id and without-control-id (treats the work order as one flat sequence). **Invocation:** referenced by `Sp_Manufacture_PlanReport`, `Sp_Manufacture_ProcessReport`, `Sp_Manufacture_ProductionReport`, `Sp_Manufacture_Report`, `Sp_OEE_PlanByProcess`, `Sp_OEE_ProductionReport`, `Sp_OEE_ProductionReportAll`. Also referenced in xly-src scripts for `Sp_Mobile_PatrolInspection`, `Sp_PC_PatrolInspection`, `Sp_Mobile_Inspection`. Companion of `GetPriorProcess` (prior-direction lookup) and `GetPriorPlate` (prior-plate lookup).