# `sp_manufacture_productionplaninfotrace` (procedure)

> 点击机台获取排程数据(树形结构带不固定查询)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sFlag` | `varchar(225)` |
| 2 | IN | `sLoginId` | `varchar(100)` |
| 3 | IN | `iSearchType` | `int` |
| 4 | IN | `iBillOutside` | `int` |
| 5 | IN | `sDivRowGroupByDate` | `varchar(255)` |
| 6 | IN | `sState` | `varchar(10)` |
| 7 | IN | `sBrId` | `varchar(100)` |
| 8 | IN | `sSuId` | `varchar(100)` |
| 9 | IN | `bFilter` | `varchar(5000)` |
| 10 | IN | `pageNum` | `int` |
| 11 | IN | `pageSize` | `int` |
| 12 | OUT | `totalCount` | `int` |
| 13 | IN | `countCloumn` | `varchar(5000)` |
| 14 | OUT | `countMapJson` | `longtext` |
| 15 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 16 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 17 | IN | `sGroupby_group_sql` | `varchar(5000)` |

## Body

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

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 生产排程 — production-plan progress trace ("点击机台获取排程数据"). Joins each `mftproductionplanslave` row with its lock state and the matching `mftproductionreportslave` rows so the planner board can show per-machine plan vs. actual progress.

**What it does:** Builds three temp tables (`Table_MftProductionPlanSlave_Tmp`, `p_MftProductionPlanSlave_Tmp_OUT`, `MftProductionPlanSlave_Tmp_reportDiv`), seeds them from `mftproductionplanslavelock` and `mftproductionreportslave`, then iterates per-machine and per-`iSearchType`/`sDivRowGroupByDate` slice, refining `p_MftProductionPlanSlave_Tmp_OUT` with conditional `DELETE`/`UPDATE` passes. Final result is paged/grouped via the outstanding-query helper using `pageNum`/`pageSize`/`countCloumn`/`countMapJson`. Body is ~42K — see `mysql … SHOW CREATE PROCEDURE`.

**Invocation:** Shipped as `script/标版/30100101/schedule/Sp_Manufacture_ProductionPlanInfoTrace.sql`. No form-master binding, no `gdsmodule` hook, no other-routine caller found. Status: appears orphaned. The live 排程 boards bind to `Sp_Manufacture_ProductionPlanInfoTree*` instead; this trace variant looks like an unreferenced internal/experimental cut. Candidate for maintainer audit. Variant `sp_manufacture_productionplaninfotrace1` is a near-duplicate.
