# `Sp_Bd_bi16` (procedure)

> @author:zhucx
							@date:20211224 
							@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_bi16`'`._

## Narrative

**Business context:** 喷码车间 workshop dashboard (kanban) — board procedure for the 喷码 (inkjet) workshop in the `Sp_Bd_bi<n>` workshop-board family (16=喷码, 17=模烫, 18=印刷, 19=糊盒, 20=喷码现场, 21=模烫现场, 22=印刷现场, 23=糊盒现场, 24=品检现场). Returns the per-machine current-shift status block consumed by the 看板/dashboard page.

**What it does:** Seeds a temp table `p_Bd_PlcNo_No(iPlcNo,iNo)` with five 喷码 machine PLC numbers (`26,7,5,6,27`) and iterates them with a cursor. For each machine, looks up current 工单 / 班组 / 设备状态 via `viw_plc_machine`, joins `mftworkordermaster`+`mftworkorderprocess` to compute 实际调机时间 / 标准调机时间 / 调机偏差 / 当前色号 / 完成版数 + 完成模数 from `plc_machinedata`, then aggregates into `p_Bd_workshop5(sName,sValue)` and emits a `{"data":[{"x":..., "y":...}], ...}` JSON for chart rendering.

**Invocation:** Installed by `xly-src/script/标版/30100101/kanban/Sp_Bd_bi16-喷码.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.

Tenant note: `iPlcNo` literals (`26,7,5,6,27`) are tied to one deployment's machine numbering — cloning to a new deployment requires re-mapping per `elemachine.iPlcNo`.
