完善 MCS 桌面代理与开炼机动作同步,修复原料相关菜单权限,桌面端新增上辅机 MES 菜单。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using YY.Admin.Helper;
|
||||
using YY.Admin.Services.Service.EquipmentDb;
|
||||
|
||||
namespace YY.Admin.ViewModels.Dialogs
|
||||
{
|
||||
@@ -45,9 +46,6 @@ namespace YY.Admin.ViewModels.Dialogs
|
||||
}
|
||||
|
||||
private bool _disconnectConnection;
|
||||
/// <summary>
|
||||
/// 是否断开连接(true=断开,false=连接)
|
||||
/// </summary>
|
||||
public bool DisconnectConnection
|
||||
{
|
||||
get => _disconnectConnection;
|
||||
@@ -60,11 +58,50 @@ namespace YY.Admin.ViewModels.Dialogs
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 连接参数是否可编辑(勾选断开连接后禁用)。
|
||||
/// </summary>
|
||||
public bool IsConnectionFieldsEnabled => !DisconnectConnection;
|
||||
|
||||
private string _eqDeviceId = string.Empty;
|
||||
public string EqDeviceId
|
||||
{
|
||||
get => _eqDeviceId;
|
||||
set => SetProperty(ref _eqDeviceId, value);
|
||||
}
|
||||
|
||||
private string _eqServerHost = "127.0.0.1";
|
||||
public string EqServerHost
|
||||
{
|
||||
get => _eqServerHost;
|
||||
set => SetProperty(ref _eqServerHost, value);
|
||||
}
|
||||
|
||||
private int _eqServerPort = 1433;
|
||||
public int EqServerPort
|
||||
{
|
||||
get => _eqServerPort;
|
||||
set => SetProperty(ref _eqServerPort, value);
|
||||
}
|
||||
|
||||
private string _eqDbName = "MES_ShareDB";
|
||||
public string EqDbName
|
||||
{
|
||||
get => _eqDbName;
|
||||
set => SetProperty(ref _eqDbName, value);
|
||||
}
|
||||
|
||||
private string _eqUsername = "sa";
|
||||
public string EqUsername
|
||||
{
|
||||
get => _eqUsername;
|
||||
set => SetProperty(ref _eqUsername, value);
|
||||
}
|
||||
|
||||
private string _eqPassword = string.Empty;
|
||||
public string EqPassword
|
||||
{
|
||||
get => _eqPassword;
|
||||
set => SetProperty(ref _eqPassword, value);
|
||||
}
|
||||
|
||||
public DelegateCommand SaveCommand { get; }
|
||||
public DelegateCommand CancelCommand { get; }
|
||||
public DialogCloseListener RequestClose { get; private set; }
|
||||
@@ -91,6 +128,14 @@ namespace YY.Admin.ViewModels.Dialogs
|
||||
BasePath = string.IsNullOrWhiteSpace(settings.BasePath) ? "/jeecg-boot" : settings.BasePath;
|
||||
DisconnectConnection = settings.DisconnectConnection;
|
||||
ErrorMessage = string.Empty;
|
||||
|
||||
var eq = EquipmentDbSettingsStore.Load();
|
||||
EqDeviceId = string.IsNullOrWhiteSpace(eq.DeviceId) ? Environment.MachineName : eq.DeviceId;
|
||||
EqServerHost = eq.ServerHost;
|
||||
EqServerPort = eq.ServerPort;
|
||||
EqDbName = eq.DbName;
|
||||
EqUsername = eq.Username;
|
||||
EqPassword = eq.Password;
|
||||
}
|
||||
|
||||
private void Save()
|
||||
@@ -106,6 +151,11 @@ namespace YY.Admin.ViewModels.Dialogs
|
||||
ErrorMessage = "端口号必须在 1-65535 之间";
|
||||
return;
|
||||
}
|
||||
if (EqServerPort <= 0 || EqServerPort > 65535)
|
||||
{
|
||||
ErrorMessage = "设备库端口号必须在 1-65535 之间";
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -127,6 +177,19 @@ namespace YY.Admin.ViewModels.Dialogs
|
||||
WebSocketPath = DefaultWebSocketPath,
|
||||
DisconnectConnection = DisconnectConnection
|
||||
});
|
||||
|
||||
EquipmentDbSettingsStore.Save(new EquipmentDbSettingsStore.EquipmentDbSettings
|
||||
{
|
||||
Enabled = true,
|
||||
DeviceId = string.IsNullOrWhiteSpace(EqDeviceId) ? Environment.MachineName : EqDeviceId.Trim(),
|
||||
ServerHost = EqServerHost?.Trim() ?? "127.0.0.1",
|
||||
ServerPort = EqServerPort,
|
||||
DbName = EqDbName?.Trim() ?? "MES_ShareDB",
|
||||
Username = EqUsername?.Trim() ?? "sa",
|
||||
Password = EqPassword ?? string.Empty,
|
||||
ConnectTimeoutSeconds = 15
|
||||
});
|
||||
|
||||
RequestClose.Invoke(new DialogResult(ButtonResult.OK));
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user