# `Sp_Manufacture_InsertMftPlanProcess` (procedure) > @author:钱豹 @date:20210711 封存 @describe: 发外工序,返回重排过程中调用:插入计划(工单审核,重新投入规划调用),主要功能: 1、根据工序中设定的 拆单方式 按贴,按付... 插入到机台计划表中 2、根据工单工序从表ID汇总数量 反写工单工序的已排程数 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `p_sWorkOrderProcessGuid` | `varchar(255)` | | 2 | IN | `bCheck` | `int` | | 3 | IN | `sLoginId` | `varchar(100)` | | 4 | IN | `sBrId` | `varchar(100)` | | 5 | IN | `sSuId` | `varchar(100)` | | 6 | OUT | `sCode` | `int` | | 7 | OUT | `sReturn` | `varchar(500)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Manufacture_InsertMftPlanProcess`'`._ ## Narrative **Business context:** 生产管理 → 生产计划管理 — per-process variant of `Sp_Manufacture_InsertMftPlan`. Used by the outside-process (发外工序) return / re-plan flow: when a 发外 process comes back and needs re-scheduling, this re-explodes a single work-order process row (not the whole work-order) into `mftProductionPlanSlave`. Per the COMMENT, owned by 钱豹, 封存 20210711. **What it does:** For the single `p_sWorkOrderProcessGuid`, `CALL Sp_GetMachineByApsRule` to pick the machine per ApsRule, splits the qty per the process's 拆单方式 (按贴/按付/...), inserts the resulting plan-slaves and `UPDATE mftProductionPlanSlave` to refresh the work-order process row's 已排程数 (writes the aggregate back to `mftworkorderprocessslave`). **Invocation:** Chained from `Sp_commonList_BtnEventBillReturn` (the 撤单/return-to-process button on the common bill grid) and `Sp_productionMainPlan_Process_BtnEventUnOutProcessing` (the 取消发外 button on the 主计划 process grid). Both dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()`. Install: xly-src `script/标版/30100101/schedule/Sp_Manufacture_InsertMftPlanProcess.sql`.