Files
lmxopcua/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Equipment.cs
T
Joseph Doherty 486628cf0a fix(config): #998 deploy gate rejects duplicate ZTag/SAPID, duplicate owned historian tagnames and dangling parent links; NULL-keyed unique indexes enforced; node/cluster edits carry a RowVersion
C-3 ZTag/SAPID uniqueness enforced from the draft (reservation ledger has no writer); UI/doc claim corrected.
C-5 HistorianTagnameDuplicate (owned tags, per cluster, case-insensitive; readOnly exempt).
C-8 UX_NodeAcl_PrincipalScope / UX_LdapGroupRoleMapping_Group_Cluster unfiltered (migration with duplicate pre-check) + friendly service/page checks.
C-9 RowVersion on ClusterNode/ServerCluster, edit pages use it; node delete removes its NodeDeploymentState rows.
C-10 DanglingReference rule; dead PathTooLong/EquipmentUuidImmutable rules + PriorEquipment/Enterprise/Site inputs deleted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-03 10:49:57 -05:00

71 lines
3.6 KiB
C#

namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
/// <summary>
/// UNS level-5 entity. Only for drivers in Equipment-kind namespaces.
/// </summary>
public sealed class Equipment
{
/// <summary>Gets or sets the row identifier for this equipment.</summary>
public Guid EquipmentRowId { get; set; }
/// <summary>
/// System-generated stable internal logical ID. Format: <c>'EQ-' + first 12 hex chars of EquipmentUuid</c>.
/// NEVER operator-supplied, NEVER in CSV imports, NEVER editable in Admin UI.
/// </summary>
public required string EquipmentId { get; set; }
/// <summary>UUIDv4, IMMUTABLE across all generations of the same EquipmentId. Downstream-consumer join key.</summary>
public Guid EquipmentUuid { get; set; }
// v3: equipment no longer binds a driver or device. It references existing raw tags via
// UnsTagReference and hosts VirtualTags + ScriptedAlarms. The old DriverInstanceId / DeviceId
// binding columns are retired.
/// <summary>Logical FK to <see cref="UnsLine.UnsLineId"/>.</summary>
public required string UnsLineId { get; set; }
/// <summary>UNS level 5 segment, matches <c>^[a-z0-9-]{1,32}$</c>.</summary>
public required string Name { get; set; }
// Operator-facing / external-system identifiers
/// <summary>Operator colloquial id (e.g. "machine_001"). Unique within cluster. Required.</summary>
public required string MachineCode { get; set; }
/// <summary>ERP equipment id. Unique fleet-wide, enforced by the deploy gate (<c>DraftValidator</c>, <c>BadDuplicateExternalIdentifier</c>; #998). Primary browse identifier in Admin UI.</summary>
public string? ZTag { get; set; }
/// <summary>SAP PM equipment id. Unique fleet-wide, enforced by the deploy gate (<c>DraftValidator</c>; #998).</summary>
public string? SAPID { get; set; }
// OPC UA Companion Spec OPC 40010 Machinery Identification fields.
// All nullable so equipment can be added before identity is fully captured.
/// <summary>Gets or sets the manufacturer name for this equipment.</summary>
public string? Manufacturer { get; set; }
/// <summary>Gets or sets the model number or designation for this equipment.</summary>
public string? Model { get; set; }
/// <summary>Gets or sets the serial number for this equipment.</summary>
public string? SerialNumber { get; set; }
/// <summary>Gets or sets the hardware revision level for this equipment.</summary>
public string? HardwareRevision { get; set; }
/// <summary>Gets or sets the software revision level for this equipment.</summary>
public string? SoftwareRevision { get; set; }
/// <summary>Gets or sets the year of construction for this equipment.</summary>
public short? YearOfConstruction { get; set; }
/// <summary>Gets or sets the asset location information for this equipment.</summary>
public string? AssetLocation { get; set; }
/// <summary>Gets or sets the manufacturer URI for this equipment.</summary>
public string? ManufacturerUri { get; set; }
/// <summary>Gets or sets the device manual URI for this equipment.</summary>
public string? DeviceManualUri { get; set; }
/// <summary>Nullable hook for future schemas-repo template ID.</summary>
public string? EquipmentClassRef { get; set; }
/// <summary>Gets or sets whether this equipment is enabled.</summary>
public bool Enabled { get; set; } = true;
/// <summary>Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.</summary>
public byte[] RowVersion { get; set; } = Array.Empty<byte>();
}