# `Sp_OEE_ScanInsertToERP2013` (procedure)

> @author:zhucx 
					@date:20210817 封存 
					@describe:PLC服务器调用


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sBrId` | `varchar(100)` |
| 2 | IN | `sSuId` | `varchar(100)` |
| 3 | IN | `sPlcAddr` | `longtext` |
| 4 | IN | `sValues` | `longtext` |

## Body

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

## Narrative

**Business context:** OEE / PLC integration — variant of `Sp_OEE_ScanInsertToERP` retained alongside the sealed 2021 base; the header COMMENT carries the same `20210817 封存` marker. Receives PLC scan data (`sPlcAddr` / `sValues` blobs) from the Siemens-reader scheduler and writes machine counters / states back to ERP production tables.

**What it does:** Tokenises the pipe-delimited `sPlcAddr`/`sValues` payload into per-channel readings, looks up the matching `elemachine` and active work-order rows, and either invokes `Sp_OEE_ScanInsertToERP` (the predecessor) as a delegate or runs the equivalent insert/update path directly to update OEE counters on the ERP side.

**Invocation:** Called from xlyPlc when the deployment is pinned to the 2013-line variant — same call site as `Sp_OEE_ScanInsertToERP` (`PlcToErpServiceImpl`, configured by `splc` literal). No `gdsmodule` or form-master binding (PLC scheduler is the only caller).

Status caveat: header still says 封存 — surviving in DB because customers' PLC fleets reference it; verify which of the two procedures is actually dispatched by checking the deployed `xlyPlc` config.
