# `Sp_productionplan_ControlProcess` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sLoginId` | `varchar(100)` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | IN | `p_sProductionPlanId` | `varchar(255)` |

## Body

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

## Narrative

**Business context:** 生产计划管理 → 生管主计划 — process-flow loader for a single 生产主计划 row. Builds the per-process status tree for an expanded plan (the "click +" load-on-demand grid in 生产主计划 detail) showing where each `eleprocess` step stands across material consumption, semi-goods matching, and production progress.

**What it does:** Reads `SysSystemSettings.CkxXd` to decide whether 工序直接下达 mode is active. Builds the `Productionplan_ControlProcess_Tmp` working table and `INSERT INTO` two passes: (1) joins `sgdsemigoodsmatchbillslave` with `mftproductionplan` on `sSrcId` for the chosen `p_sProductionPlanId` to load semi-goods rows with default status '未开工', (2) joins material-consumption rows with the same plan to add auxiliary-quantity entries. Subsequent updates (truncated in this preview) annotate the rows with the resolved `sProcessName`, machine, customer, and current `sProcessState`. Result-set is selected back to the caller.

**Invocation:** No xly-src caller found by grep on this exact spelling. The newer variant `Sp_productionplan_ControlProcessNew` is what `WorkOrderPlanServiceImpl.getControlProcessList(...)` actually invokes (via `call Sp_productionplan_ControlProcessNew(...)` string-concat); this proc is the older sibling kept for compatibility — Status: appears orphaned in production. Candidate for maintainer audit / removal.
