# `Sp_bd_MachinePlanTemplate_new` (procedure)

> @author:zhucx
							@date:20210621 封存
							@describe: 看板管理-单机设备看板(1屏) 对应commonAuto/QCZH1 下 左边计划,中间顶部 信息


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 看板管理 / 单机设备看板(1屏) (front-end template `commonAuto/QCZH1`). The "左边计划, 中间顶部信息" tile — the left-side production plan list plus the centre-top current-status header for one PLC machine. Revised version of the unnumbered family base `Sp_bd_MachinePlanTemplate`. Author tagged `封存` 2021-06-21.

**What it does:** Resolves machine + team + work-order + current shift window. Pulls the work-order header (`sWorkOrderNo`, `sCurrProductName`), the day's `dDayPlanQty`/月度 `dMonthPlanQty` targets, the actual `dReprotQty` reported on `mftproductionplanslave`, plus the current PLC status (`sStatus`, `iTime`, `iTotal`). Returns rows in `p_bd_MachinePlanTemplate` as the kanban left-panel + top-banner JSON.

**Invocation:** Installed by `xly-src/script/标版/30100101/Sp_bd_MachinePlanTemplate.sql` (which installs the family-base unnumbered name; this `_new` variant is DB-only). No form-master sSqlStr, no `gdsmodule` hook, no other-routine caller, no Java caller. Status: appears orphaned. Marked `封存` (sealed) 2021-06-21; reachable only by a tenant-baked external dashboard endpoint that invokes the proc by name.

Hardcoded defaults `dDayPlanQty=8000`/`dMonthPlanQty=240000` — re-mapping needed for tenants with different target quantities.
