# `Sp_productionPlan_BtnEventAutoOrder1` (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_productionPlan_BtnEventAutoOrder1`'`._

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 生产排程 — 机台计划 auto-ordering button, sort strategy **客户-色序-工单** (customer → colour-sequence → work-order). Variant 1 of the BtnEventAutoOrder family.

**What it does:** Same skeleton as `Sp_productionPlan_BtnEventAutoOrder`: per `sMachineId`, stages into `p_CalcTable` / `p_CalcBasicTable` (delete-insert-update), computes a new `iOrder` ordered 客户 → 色序 → 工单, then `UPDATE mftproductionplanslave a JOIN p_CalcTable t ON a.sId=t.sId SET a.iOrder=t.iOrder`. Aborts with 请选择数据 when nothing selected. Differs from variant 0 only in how the staging query keys colour-sequence ahead of work-order.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — 自动排序 toolbar option on 生产排程. xly-src ships `script/标版/30100101/schedule/Sp_productionPlan_BtnEventAutoOrder1.sql` (install script only).
