# `Sp_productionMainPlan_Process_BtnEventUnOutProcessing` (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_productionMainPlan_Process_BtnEventUnOutProcessing`'`._

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 生管主计划 — toolbar action 取消工序发外加工 on the work-order-process grid. Inverse of "工序发外": pulls an outsourced process step (`mftworkorderprocess.bOutside=1`) back in-house.

**What it does:** Walks `$.params[0].value[*].sId` from `sProInParam`. For each `mftworkorderprocess.sId`, reads `bOutside, bProductionReportComplete`; refuses with `sCode=-1` and message 已发外工序，不能操作！ when `bOutside=0` or 已完工工序，不能操作！ when production-reporting is closed. Otherwise sets `bOutside=0, dOutsideQty=dOutsideProcessQty`, then `CALL Sp_Manufacture_InsertMftPlanProcess(p_sId, 1, ...)` to regenerate machine-plan process rows in-house, and logs an entry to `syslog` with sOperationType=取消发外加工 and sFormId of 生管主计划.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — wired as a button-event action on 生管主计划 (`gdsmodule.sId=19211681019715708440774010`). xly-src ships `script/标版/30100101/schedule/Sp_productionMainPlan_Process_BtnEventUnOutProcessing.sql` (install script only; no Java caller).
