# `Sp_plc_viw_plcmachinedataall2` (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 | `bFilter` | `longtext` |
| 5 | IN | `pageNum` | `int` |
| 6 | IN | `pageSize` | `int` |
| 7 | OUT | `totalCount` | `int` |
| 8 | IN | `countCloumn` | `longtext` |
| 9 | OUT | `countMapJson` | `longtext` |
| 10 | IN | `sFilterOrderBy` | `longtext` |
| 11 | IN | `sGroupby_select_sql` | `longtext` |
| 12 | IN | `sGroupby_group_sql` | `longtext` |

## Body

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

## Narrative

**Business context:** 设备 / PLC 报工 — sibling of `Sp_plc_viw_plcmachinedataall1`; same paged report over `viw_plcmachinedataall`, but writes into a differently-named temp table (`TMP_viw_plcmachinedataall_SEcX`) and ships a slimmer column set (no `dMaterialStartQty/EndQty1`, no `dTransfermQty/AdjustQty`). Likely a parallel evolution of the same machine-run/idle history grid.

**What it does:** Same as the `…1` variant — runs `bFilter` through `Fun_bFilter_toWhere(bFilter,'A')`, leaves early when filter is empty, populates `TMP_viw_plcmachinedataall_SEcX` from `viw_plcmachinedataall A` with the `iTag` "waitingWork > 6h stuck" computation, defaults `sFilterOrderBy = sMachineId, iIncrement DESC`, and applies `LIMIT pageNum*pageSize`. The narrower column set drops the multi-stage material accounting fields.

**Invocation:** Status: appears orphaned. No `gdsconfigformmaster.sSqlStr/sConfigSqlStr` binding, no `gdsmodule` hook, no other-routine caller, no xly-src reference. Either the slimmer variant supplanted `…1` (or vice-versa) and its form-master was later rewired — verify with `gdsconfigformmaster` history. Candidate for maintainer audit.
