# `sp_getoutsideprocess` (procedure)

> 发外工序获取


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sSlaveId` | `longtext` |
| 2 | IN | `sBrandsId` | `varchar(255)` |
| 3 | IN | `sSubsidiaryId` | `varchar(255)` |

## Body

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

## Narrative

**Business context:** 发外工序 (outsourced-process) fetcher — given a comma-joined list of `mftworkorderslave.sId`s, builds three temp tables (`sp_getoutsideprocess`, `sp_getoutsideprocess_parts`, `sp_getoutsideprocess_product`) holding the candidate 工单工序 rows from `viw_mftworkorderprocessextral` so a downstream 整单发外 / 工序发外 build step can pick them up.

**What it does:** Dynamic-SQL INSERTs into `sp_getoutsideprocess` from the view restricted to the input slave-ids, then derives per-part and per-product expansions: when `sType=3` and `sCombinePartsName` is empty, fans the row out across each `mftworkorderslave.sId` for that parent. Carries fields `sControlId`, `dProcessQty`, `sMouldId`, `iProcessType` for downstream cost/booking lookups.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines, xly-src grep across all extensions). Stray `-- select aa from bb;` debug-echo confirms scratchpad lineage. Companion `sp_getsalesoutsideprocess` is the sales-order-source variant and is also orphan. The live outsourcing flow uses `Sp_btn_OpsProduct*` / `Sp_btn_OpsProcess*` button procs instead.
