# `Sp_GetMachineByApsRule(排程直接下达)` (procedure)

> 自定义排程规则


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sWorkOrderGuid` | `varchar(5000)` |
| 2 | IN | `sWorkOrderProcessid` | `varchar(100)` |
| 3 | IN | `sProcessid` | `varchar(100)` |
| 4 | IN | `p_sMachineid` | `varchar(100)` |
| 5 | IN | `sBrId` | `varchar(100)` |
| 6 | IN | `sSuId` | `varchar(100)` |
| 7 | OUT | `sReturnMachineId` | `varchar(250)` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_GetMachineByApsRule(排程直接下达)`'`._

## Narrative

**Business context:** Early/simpler variant of the live `Sp_GetMachineByApsRule` (主计划：自定义排程规则) — APS rule-based machine picker for a work-order process. Returns the chosen 机台 (sReturnMachineId) but lacks the `sReturnInfo` reason-trace OUT param the live version carries.

**What it does:** Picks `eleprocessmachine` default-rebound when `p_sMachineid` is blank, else excludes the current machine; falls through to a `Machine_Tmp` rule-table search keyed by 印刷颜色/重量/长宽/工艺/材料/产品分类/客户备注 from `eleprocessmachineapsrule`.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines, xly-src grep across all extensions). Superseded by `Sp_GetMachineByApsRule` (109K body, called per-row by `BtnCalculationServiceImpl.doSetTimeCalcMachineHour()` over `mftproductionplanslave`). Chinese suffix `(排程直接下达)` suggests this was the "直接下达" path variant before the unified version subsumed it.
