# `Sp_Manufacture_ProductionPlanInfo_WorkCenter2` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sLoginId` | `varchar(100)` |
| 2 | IN | `sWorkCenterId` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | IN | `bFilter` | `varchar(5000)` |
| 6 | IN | `pageNum` | `int` |
| 7 | IN | `pageSize` | `int` |
| 8 | OUT | `totalCount` | `int` |
| 9 | IN | `countCloumn` | `varchar(5000)` |
| 10 | OUT | `countMapJson` | `longtext` |
| 11 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 12 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 13 | 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_ProductionPlanInfo_WorkCenter2`'`._

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 生产排程 — second variant of `Sp_Manufacture_ProductionPlanInfo_WorkCenter` (机台排程 顶部机台卡片 / 机台班组信息 data-source). Body is near-identical to `Sp_Manufacture_ProductionPlanInfo_OutSideWorkCenter`: bootstraps cards from `Viw_OpsOutsideProcess` joined with `eleprocess`/`sisworkcenter`, intended for tenants whose machine-strip needs to include 委外工序 alongside the in-house machines.

**What it does:** Builds temp `p_TmpWorkCenter` by `INSERT INTO p_TmpWorkCenter SELECT O.sId, '1', P.sWorkCenterId, '已下达', W.sName, 0, O.iOrder FROM Viw_OpsOutsideProcess O JOIN eleprocess P ON O.sProcessId=P.sId JOIN sisworkcenter W ON P.sWorkCenterId=W.sId WHERE O.bCopyLimit=0 AND O.bCheck=1 AND O.bInstoreComplete=0 AND O.bInvalid=0 AND Abs(O.dAuxiliaryQty)-Abs(O.dInStoreAuxiliaryQty)>0` and tenant match, grouped by `sWorkCenterId`. Emits each card with a synthetic `<type>_<machineId>_<tStartDate>` id and per-card `dHour`. Pages out via the standard paging block.

**Invocation:** Bound as data-source of 机台班组信息 form `gfm.sId=101251240115016197477619210` via `gdsconfigformmaster.sSqlStr` — the only live binding. No xly-src install script (DB-only). Status: looks like a per-form override for tenants needing outsourcing cards on the 机台班组信息 panel.
