新增MES模块,包含供应商、客户、车辆和地磅数据记录管理功能,支持免密接口和数据同步。更新相关控制器、实体、服务和数据库配置,优化权限管理和数据字典支持,确保系统的灵活性和可扩展性。

This commit is contained in:
geht
2026-04-30 15:28:20 +08:00
parent 142a0bdaba
commit b03cbeff9b
121 changed files with 10540 additions and 424 deletions

View File

@@ -12,6 +12,7 @@ using System.Windows.Threading;
using YY.Admin.Core;
using YY.Admin.Core.Const;
using YY.Admin.Core.Model;
using YY.Admin.Core.Services;
using YY.Admin.Core.Session;
using YY.Admin.Core.Util;
using YY.Admin.Event;
@@ -20,6 +21,7 @@ using YY.Admin.Services.Service.Auth;
using YY.Admin.Services.Service.Jeecg;
using YY.Admin.Services.Service.Menu;
using YY.Admin.ViewModels.Control;
using YY.Admin.Helper;
namespace YY.Admin.ViewModels
{
@@ -220,8 +222,9 @@ namespace YY.Admin.ViewModels
_refreshTabToken = _eventAggregator.GetEvent<TabRefreshEvent>().Subscribe(OnRefreshTab);
_loginOutToken = _eventAggregator.GetEvent<SysUserEvents.LoginOutEvent>().Subscribe(Destroy);
// Jeecg 用户增量同步:定时 + 可选 WebSocket工控机断网续传
_jeecgUserSyncCoordinator.Start();
// 首次按默认连接;后续按本地保存状态恢复
var settings = ServerSettingsStore.Load();
IsServerConnectionEnabled = !settings.DisconnectConnection;
// 主窗口底部连接状态圆点
_ = StartBackendConnectivityLoopAsync(_backendConnectivityCts.Token);
@@ -251,6 +254,30 @@ namespace YY.Admin.ViewModels
public Brush BackendConnectionStatusBrush => IsBackendConnected ? Brushes.LimeGreen : Brushes.Red;
private bool _isServerConnectionEnabled = true;
/// <summary>
/// 是否启用服务器连接(默认启用)
/// </summary>
public bool IsServerConnectionEnabled
{
get => _isServerConnectionEnabled;
set
{
if (SetProperty(ref _isServerConnectionEnabled, value))
{
if (!value)
{
IsBackendConnected = false;
_jeecgUserSyncCoordinator.Stop();
}
else
{
_jeecgUserSyncCoordinator.Start();
}
}
}
}
public DelegateCommand LogoutCommand { get; }
private void InitNavItems()
@@ -355,7 +382,8 @@ namespace YY.Admin.ViewModels
}
else
{
_logger.Error($"导航失败: {viewName}");
var exMsg = result.Exception?.Message;
_logger.Error($"导航失败: {viewName}, Region={regionName}, Exception={exMsg}");
tcs.SetResult(false);
}
}, parameters);
@@ -586,6 +614,26 @@ namespace YY.Admin.ViewModels
while (!cancellationToken.IsCancellationRequested)
{
bool connected = false;
if (!IsServerConnectionEnabled)
{
try
{
await Application.Current.Dispatcher.InvokeAsync(() => { IsBackendConnected = false; });
}
catch
{
}
try
{
await Task.Delay(TimeSpan.FromSeconds(ConnectivityCheckIntervalSeconds), cancellationToken);
}
catch (OperationCanceledException)
{
break;
}
continue;
}
try
{
// 每轮都重新读取配置,保存服务器设置后可即时生效
@@ -631,7 +679,24 @@ namespace YY.Admin.ViewModels
private void OpenServerSettings()
{
_dialogService.ShowDialog("ServerSettingsDialog", r => { });
_dialogService.ShowDialog("ServerSettingsDialog", r =>
{
if (r.Result == ButtonResult.OK)
{
var settings = ServerSettingsStore.Load();
IsServerConnectionEnabled = !settings.DisconnectConnection;
if (settings.DisconnectConnection)
{
var signalService = _container.Resolve<ISignalRService>();
_ = signalService.DisconnectAsync();
}
else
{
var signalService = _container.Resolve<ISignalRService>();
_ = signalService.ConnectUnifiedDeviceChannelAsync(CancellationToken.None);
}
}
});
}
/// <summary>