# `Sp_plc_machineaddrmap_machine_Event` (procedure)

> @author:zhucx 
		     @date: 
				 @describe:生产工单明细-功能定位-注明急单


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `longtext` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(1000)` |
| 6 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 设备 / PLC 地址映射 — per-machine variant of `Sp_plc_machineaddrmap_import_Event`. Where the import variant keys by `iSemens` (a 西门子 controller covering up to 14 PLC slots), this one keys by individual `elemachine.sId` + `iPlcNo`, so the operator can re-import the address map for selected machines without touching the rest of the same controller.

**What it does:** Parses `$.params[0].value[*].{iPlcNo,sId}` from `sProInParam` into temp table `plc_machineaddrmap_import_tmp` (two columns this time). Guards `iPlcNo > 0` — if no qualifying row, returns the `sMachineaddrmapPlcNoNeedUpZero` localised error ("请选择iPlcNo大于0数据"). Then `DELETE FROM plc_currentmachinevalue WHERE sParentId IN (selected machine sIds)` and `INSERT INTO plc_currentmachinevalue` from `plc_machineaddrmap_import A JOIN plc_machineaddrmap_import_tmp T ON T.iPlcNo = A.sMachineNo`, mirroring the column set used by the import variant but joining on the selected machines rather than the whole controller.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — `plc_machineaddrmap` grid's 设备映射 toolbar button names this proc. No `gdsmodule.sProcName` binding, no form-master sSqlStr reference, no xly-src install script located.
