# `Sp_productionPlan_BtnEventAutoOrder10` (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_BtnEventAutoOrder10`'`._

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 生产排程 — 机台计划 auto-ordering button, sort strategy **按印刷计划排单** (drive the order from the upstream printing plan). Variant 10 of the BtnEventAutoOrder family — instead of computing a sort key in-proc, it adopts the order already laid down by 印刷计划 and then schedules process times.

**What it does:** Per-machine staging through `table_mftproductionplanslave_tmp` / `_tmp_after` plus the process-aware `table_mftproductionplanslave_Porcess_tmp`, recomputes `iOrder` from the printing-plan reference, then `UPDATE mftproductionplanslave SET iOrder=<computed>`, and finally `CALL Sp_Manufacture_SetTime` to recalculate `tStart/tEnd` for each task based on machine capacity.

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