# `Sp_Bd_bi20` (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_bi20`'`._

## Narrative

**Business context:** 喷码+分切现场 workshop dashboard (kanban) — board procedure for the 喷码 + 分切 (inkjet + slitting) shop-floor view in the `Sp_Bd_bi<n>` workshop-board family. Returns the per-machine current-shift status block consumed by the 看板/dashboard page; the on-floor `_现场` siblings (20=喷码, 21=模烫, 22=印刷, 23=糊盒, 24=品检) extend the workshop boards (16–19) with team/班组 + 工单批次 + 调机时间 line-by-line breakdowns.

**What it does:** Seeds `p_Bd_PlcNo_No` with four PLC numbers (`7,5,6,27`), cursor-iterates per machine, reads current 工单号 / 当前班组 / 当前设备状态 / 当前色号 from `viw_plc_machine`, joins `mftworkordermaster`+`mftworkorderprocess`+`Mft_WorkOrder_Parts`+`eleteam`+`mftproductionplanmaster`+`mftproductionplanslave` for the active 计划/工单, computes 实际/标准/偏差 调机时间 + 完成版数 + 完成模数 from `plc_machinedata`/`p_Bd_Speed`, aggregates into `p_Bd_workshop`/`p_Bd_workshop5` and emits a `{"data":[...]}` JSON.

**Invocation:** Installed by `xly-src/script/标版/30100101/kanban/Sp_Bd_bi20-喷码现场.sql`. No form-master sSqlStr, no `gdsmodule` hook, no other-routine caller (other than appearing as a comment string in the bi20 variant procs), 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.

Tenant note: `iPlcNo` literals (`7,5,6,27`) are tied to one deployment's machine numbering.
