# `Sp_commonList_BtnEventBillReturn` (procedure)

> 工序发外未清：返回重排


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `varchar(10000)` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(1000)` |
| 6 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 生产管理 → 排程/工序发外 → 工序发外未清单据 — "返回重排" (return-to-reschedule) button on the unfinished outsourced-process list. Drops the outside-process flag on selected `mftworkorderprocess` rows so the affected manufacturing slave can be re-routed through 排产 instead of staying with the external supplier.

**What it does:** Parses the standard `sProInParam` JSON envelope, then for each selected slave-id resets `mftworkorderprocess.bOutside=0` and `dOutsideQty=dOutsideProcessQty`, clears `mftproductionplanslave.bBillOutside=0`, un-hides the matching plan-slave rows (`bHide=0` for the well-known `sProcessId='1691254111216986535514800'`), and calls `Sp_Manufacture_InsertMftPlanProcess(p_sId, 1, ...)` to rebuild the plan-process entries.

**Invocation:** Status: appears orphaned. No `gdsmodule` hook, `gdsconfigformmaster` reference, or other-routine caller found; xly-src ships an install script under `script/标版/30100101/schedule/` and an upgrade patch dated 2022-01-21 ("发外后撤单, 确认计划后, 主计划中显示已下达, 但是排程中不显示") — likely intended as a `sp_btn_action*` dispatcher target via the `Sp_commonList_BtnEvent*` naming family but not currently wired. Candidate for maintainer audit.
