# `Sp_MftPlan_MachineProcessLodading` (procedure)

> 工序LOADing


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sAttribute` | `varchar(100)` |
| 2 | IN | `sLoginId` | `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)` |
| 14 | OUT | `sColumnNameConfig` | `longtext` |

## Body

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

## Narrative

**Business context:** 生产管理 → 生产运营报表 → 整厂实际负荷分析 — paged 工序LOADing report. For a 设备属性 (`sAttribute`), returns one row per machine grouping with daily/weekly load columns spanning the previous week through the end of "now + 2 months", so a planner can see where每 process step is over-/under-loaded across the planning horizon.

**What it does:** Computes `tStartDate` = the Monday of the previous week and `tEndDate` = last day of the month two months out. Builds temp table `Sp_MftPlan_MachineProcessLodading` (sId, sAttribute, sMachineQty, dBzcn=平均产能/小时/台, dZcn=总产能, plus a wide row to be filled in). Loops `p_iDayHanle` through every day in the window, dynamically `ALTER`s the temp table to add per-day load columns and `UPDATE`s them from `mftproductionplan*` joined to `elemachine`/`eleprocess`. Accumulates `sColumnNameConfig` (via the standard `Fun_get_show_config_*` helper) so the grid renders the date columns. Returns the temp table plus the JSON column-config.

**Invocation:** Bound as the data-source of the 整厂实际负荷分析 form (`sParentId 1921168137117916509801164270`) via `gdsconfigformmaster.sSqlStr` — under 生产运营报表 inside 生产管理. xly-src ships `script/标版/30100101/schedule/Sp_MftPlan_MachineProcessLodading.sql` (install). No customer overrides found.
