# `Sp_Bd_bi21` (procedure)

> @author:zhucx
							@date:20220111 
							@describe: 模烫现场


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iFlag` | `int` |
| 2 | IN | `iTmpCheck` | `int` |
| 3 | IN | `sFormGuid` | `varchar(100)` |
| 4 | IN | `sGuid` | `varchar(100)` |
| 5 | IN | `sLoginId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(4000)` |
| 7 | IN | `sBrId` | `varchar(100)` |
| 8 | IN | `sSuId` | `varchar(100)` |
| 9 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 模烫现场 workshop dashboard (kanban) — board procedure for the 模烫 (die-cut + hot-stamping) shop-floor view in the `Sp_Bd_bi<n>` workshop-board family. Companion to `Sp_Bd_bi17` (the 模烫 workshop board); `_21` is the on-floor (`现场`) extension with班组 + 工单批次 details.

**What it does:** Seeds `p_Bd_PlcNo_No(iPlcNo,iNo)` with four 模烫 machine PLC numbers (`8,9,10,11` — same as `Sp_Bd_bi17`), cursor-iterates per machine, reads current 工单号 / 班组 / 设备状态 / 当前色号 from `viw_plc_machine`, joins `mftworkordermaster`+`mftworkorderprocess`+`Mft_WorkOrder_Parts`+`eleteam` for the active 工单 details, computes 实际/标准/偏差 调机时间 + 完成版数 + 完成模数 from `plc_machinedata`, aggregates into `p_Bd_workshop`/`p_Bd_workshop5` and emits a `{"data":[...]}` JSON.

**Invocation:** Installed by `xly-src/script/标版/30100101/kanban/Sp_Bd_bi21-模烫现场.sql`. No form-master sSqlStr, no `gdsmodule` hook, no other-routine caller, no Java caller. Status: appears reachable only via an external dashboard HTTP endpoint that invokes the proc by name. Per wiki scope, kanban dashboard procs sit outside the routine call-graph wiring tracked in this catalog.
