# `Sp_Manufacture_ProductionArrange2` (procedure)

> @author:        qmj
			    @date:20210714  封存
				@describe :     生产计划看板
                                1.创建临时表，工单部件为单位创建若干条数据，并筛选分页条数
                                2.生产工单状态，按印前、印刷、印后、成品顺序拼接工序完工状态
                                3.稽查部件材料状态


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sCustomerName` | `varchar(255)` |
| 2 | IN | `tStartDate` | `datetime` |
| 3 | IN | `tEndDate` | `datetime` |
| 4 | IN | `sWorkOrderNos` | `varchar(255)` |
| 5 | IN | `sLoginId` | `varchar(4000)` |
| 6 | IN | `sBrId` | `varchar(100)` |
| 7 | IN | `sSuId` | `varchar(100)` |
| 8 | IN | `bFilter` | `varchar(5000)` |
| 9 | IN | `pageNum` | `int` |
| 10 | IN | `pageSize` | `int` |
| 11 | OUT | `totalCount` | `int` |
| 12 | IN | `countCloumn` | `varchar(5000)` |
| 13 | OUT | `countMapJson` | `longtext` |
| 14 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 15 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 16 | 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_ProductionArrange2`'`._

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 生产计划看板 / 大屏看板 / 生产计划甘特图 — page-tree variant of `Sp_Manufacture_ProductionArrange`. Header (`@author qmj @date 20210714 封存 @describe 生产计划看板`) describes building 工单+部件 rows, concatenating per-stage status (印前/印刷/印后/成品), and auditing 部件 material status. Marked 封存 (sealed) since 2021-07 — may have a successor in production.

**What it does:** Builds temp `p_TempTable`, `p_MftWorkOrderProcess`, `p_MftWorkOrder_Materials`. For each open `MftWorkOrderSlave` joined with `mftworkorderprocess` / `mftworkordermaterials` / `mftproductionreportslave` / `sgdsemigoodsmatchbillslave` / `sgdsemigoodsmatchbillprocess`, computes per-stage completion (印前→印刷→印后→成品 concatenated state string) and material-status flags. Calls `Sp_Do_ProcedurePageTree` to apply the page-tree grouping (parent 工单 → 部件 children) and emits rows through the standard `bFilter` / `pageNum` / `pageSize` / `countMapJson` / `sGroupby_*` block.

**Invocation:** Bound as data-source of 生产看板 / 大屏看板 / 生产计划甘特图 forms via `gdsconfigformmaster.sSqlStr` — `gfm.sId` `15905732950005954209191860345000`, `101251240115016033608492850`, `101251240115016076722376990`, `101251240115016111296520860`, and the `101251240115016087744...` 大屏看板 series. Loaded when the user opens any of those screens. Install scripts: `xly-src/script/标版/30100101/schedule/Sp_Manufacture_ProductionArrange2.sql` and customer-specific `xly-src/script/客户/无锡中江/Sp_Manufacture_ProductionArrange2.sql`.
