wenxiangchao
3 天以前 b544d5cccd76735e034c8055918a50927b437474
Plugin.DeviceConfig/DeviceConfig.xaml.cs
@@ -221,6 +221,13 @@
                var chList = _model.GetChannelsByDevice(dev.DeviceId);
                Channels = new ObservableCollection<DeviceChannel>(chList);
                // V3.0 执行位置展示
                tbExecutionMode.Text = dev.ExecutionMode == ExecutionModeKind.Broker
                    ? "Broker 共享" : "Local 直连";
                tbAuthorityInfo.Text = dev.ExecutionMode == ExecutionModeKind.Broker
                    ? $"{dev.AuthorityId} · {dev.PhysicalSessionKey}"
                    : (string.IsNullOrWhiteSpace(dev.AuthorityId) ? V3AuthorityCatalog.LocalAuthorityId : dev.AuthorityId);
            }
            catch (Exception ex)
            {
@@ -326,6 +333,11 @@
                    DriverType = SelectedDevice.DriverType,
                    Transport = SelectedDevice.Transport,
                    Endpoint = SelectedDevice.Endpoint,
                    ExecutionMode = SelectedDevice.ExecutionMode,
                    AuthorityId = SelectedDevice.AuthorityId,
                    BrokerId = SelectedDevice.BrokerId,
                    OwnerProcessId = SelectedDevice.OwnerProcessId,
                    PhysicalSessionKey = SelectedDevice.PhysicalSessionKey,
                    EffectiveVersion = SelectedDevice.EffectiveVersion,
                    CreatedAt = SelectedDevice.CreatedAt,
                    UpdatedAt = SelectedDevice.UpdatedAt
@@ -408,6 +420,8 @@
            tbTransport.Text = string.Empty;
            tbEndpoint.Text = string.Empty;
            tbEffectiveVersion.Text = string.Empty;
            tbExecutionMode.Text = string.Empty;
            tbAuthorityInfo.Text = string.Empty;
            Channels = new ObservableCollection<DeviceChannel>();
        }
@@ -494,6 +508,21 @@
                    ToastHelper.Warning("没有可发布的草稿版本");
                    return;
                }
                // V3.0 §05 发布门禁:执行位置绑定校验不通过则阻止发布
                var gateErrors = _model.ValidatePublishGate();
                if (gateErrors.Count > 0)
                {
                    var detail = string.Join("\n", gateErrors.Take(8));
                    if (gateErrors.Count > 8)
                    {
                        detail += $"\n… 共 {gateErrors.Count} 项错误";
                    }
                    log.Warn($"发布门禁拦截: {string.Join("; ", gateErrors)}");
                    MsgBoxHelper.Error(Window.GetWindow(this), $"发布门禁校验未通过:\n{detail}");
                    return;
                }
                var hash = _model.ComputeConfigHash();
                draft.Hash = hash;
                draft.Status = VersionStatus.Published;