init_plc_config.md 1.47 KB

init_plc_config (procedure)

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sNodeData longtext
2 IN sIp varchar(100)
3 IN iSemens int
4 IN iDbName int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDUREinitplc_config'._

Narrative

Business context: PLC 集成 / 设备数据采集 — DBA seeding tool that bulk-populates plc_machineaddrmap_import (the PLC address-map import-staging table) with the per-tag config for 12 sibling machines that share the same Siemens DB layout but differ in sMachineNo and iPlcsStatusAdd offset.

What it does: TRUNCATEs plc_machineaddrmap_import, then loops sMachineNo = 1..12. Each iteration parses the JSON sNodeData via JSON_TABLE to extract C_name/name/data_type/length/offset/plc_no_start, and inserts one row per JSON tag with iPlcsStatusAdd = (sMachineNo-1) * (sDataType='Real' ? sMachineNo : 2) + offset — i.e. each machine gets its tag block stamped at a stride-shifted PLC address.

Invocation: Status: appears orphaned. No form-master, gdsmodule hook, routine caller, or xly-src reference. DBA-driven; the hardcoded brand/subsidiary literal '1111111111' and the magic 12-machine loop bound confirm this is a one-shot import helper for a specific deployment rather than a tenant-aware production path.