首次提交:本地项目同步到Gitea
This commit is contained in:
33
Cowain.TestProject/App.axaml
Normal file
33
Cowain.TestProject/App.axaml
Normal file
@@ -0,0 +1,33 @@
|
||||
<Application
|
||||
x:Class="Cowain.TestProject.App"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Cowain.TestProject"
|
||||
xmlns:semi="https://irihi.tech/semi"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:u-semi="https://irihi.tech/ursa/themes/semi">
|
||||
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator />
|
||||
</Application.DataTemplates>
|
||||
|
||||
<Application.Styles>
|
||||
<!-- 样式主题 -->
|
||||
<semi:SemiTheme />
|
||||
<u-semi:SemiTheme />
|
||||
<semi:SemiPopupAnimations />
|
||||
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
|
||||
</Application.Styles>
|
||||
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<!-- 引入主题资源 -->
|
||||
<ResourceInclude Source="/Assets/_index.axaml" />
|
||||
<ResourceInclude Source="avares://Nodify/Theme.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
181
Cowain.TestProject/App.axaml.cs
Normal file
181
Cowain.TestProject/App.axaml.cs
Normal file
@@ -0,0 +1,181 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Data.Core.Plugins;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.TestProject.Services;
|
||||
using Cowain.TestProject.ViewModels;
|
||||
using Cowain.TestProject.Views;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Cowain.TestProject;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
private IHost? _host;
|
||||
private IClassicDesktopStyleApplicationLifetime? _desktopLifetime;
|
||||
private ILogger<App>? _logger;
|
||||
public override void Initialize()
|
||||
{
|
||||
//StartConfig.OnStart();
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override async void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (Design.IsDesignMode)
|
||||
{
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_host = CreateHostBuilder().Build();
|
||||
Serilog.Debugging.SelfLog.Enable(msg => File.AppendAllText("serilog-selflog.txt", msg + Environment.NewLine));
|
||||
ServiceLocator.Current = _host!.Services;
|
||||
_logger = _host.Services.GetRequiredService<ILogger<App>>();
|
||||
_logger.LogInformation("开始应用程序初始化");
|
||||
LogAndSwallowAttribute.OnExceptionAction = ex =>
|
||||
{
|
||||
_logger.LogError(ex, "[Fody]异常被捕获并记录");
|
||||
};
|
||||
AvaloniaExceptionMiddleware.Install(_logger);
|
||||
await _host.StartAsync();
|
||||
_host.Services.InitializePlugins();
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
_desktopLifetime = desktop;
|
||||
DisableAvaloniaDataAnnotationValidation();
|
||||
var loginWindow = CreateLoginWindow(_host.Services);
|
||||
desktop.MainWindow = loginWindow;
|
||||
loginWindow.Closed += async (sender, args) =>
|
||||
{
|
||||
if ((loginWindow.DataContext as LoginWindowViewModel)?.LoginSuccess == true)
|
||||
{
|
||||
ShowMainWindow(desktop, _host.Services);
|
||||
}
|
||||
else
|
||||
{
|
||||
await ShutdownApplicationAsync();
|
||||
}
|
||||
};
|
||||
loginWindow.Show();
|
||||
desktop.Exit += async (sender, args) =>
|
||||
{
|
||||
await ShutdownApplicationAsync();
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger?.LogError(ex, "应用程序初始化失败,即将退出");
|
||||
Log.CloseAndFlush();
|
||||
_desktopLifetime?.Shutdown(1);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_logger?.LogInformation("应用程序初始化完成");
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
private IHostBuilder CreateHostBuilder()
|
||||
{
|
||||
return Host.CreateDefaultBuilder()
|
||||
.ConfigureAppConfiguration((hostContext, config) =>
|
||||
{
|
||||
config.SetBasePath(AppContext.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||
})
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
services.AddServices(hostContext.Configuration, _logger);
|
||||
//services.AddHostedService<InitializeDatabaseHostedService>();
|
||||
//services.AddHostedService<TestHostedService>();
|
||||
|
||||
})
|
||||
.UseSerilog((context, services, configuration) =>
|
||||
{
|
||||
configuration.ReadFrom.Configuration(context.Configuration)
|
||||
.ReadFrom.Services(services)
|
||||
.MinimumLevel.Information()
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||
.ConfigureDatabaseSink(context.Configuration)
|
||||
.WriteTo.File(@"Logs\Log.txt",
|
||||
rollingInterval: RollingInterval.Day, // 按天的日志
|
||||
shared: true, // 设置为 true,避免多个日志文件
|
||||
retainedFileCountLimit: 180) // 保留最近31个文件
|
||||
;
|
||||
});
|
||||
}
|
||||
|
||||
private Window CreateLoginWindow(IServiceProvider services)
|
||||
{
|
||||
var vm = services.GetRequiredService<LoginWindowViewModel>();
|
||||
var loginWindow = new LoginWindow
|
||||
{
|
||||
DataContext = vm
|
||||
};
|
||||
|
||||
return loginWindow;
|
||||
}
|
||||
|
||||
private void ShowMainWindow(IClassicDesktopStyleApplicationLifetime desktop, IServiceProvider services)
|
||||
{
|
||||
var mainWindow = new MainWindow();
|
||||
mainWindow.DataContext = services.GetRequiredService<MainWindowViewModel>();
|
||||
mainWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
mainWindow.WindowState = WindowState.Normal;
|
||||
|
||||
desktop.MainWindow = mainWindow;
|
||||
mainWindow.Show();
|
||||
|
||||
_logger?.LogInformation("主窗口已显示,应用程序已启动");
|
||||
}
|
||||
|
||||
private async Task ShutdownApplicationAsync()
|
||||
{
|
||||
_logger?.LogInformation("开始关闭应用程序");
|
||||
try
|
||||
{
|
||||
if (_host != null)
|
||||
{
|
||||
await _host.StopAsync();
|
||||
_logger?.LogInformation("后台服务已停止");
|
||||
}
|
||||
_host?.Services.ShutDownPlugins();
|
||||
_logger?.LogInformation("插件已关闭");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger?.LogError(ex, "应用程序关闭过程中发生错误");
|
||||
}
|
||||
finally
|
||||
{
|
||||
_logger?.LogInformation("应用程序已完全关闭");
|
||||
Log.CloseAndFlush();
|
||||
_host?.Dispose();
|
||||
_host = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void DisableAvaloniaDataAnnotationValidation()
|
||||
{
|
||||
foreach (var plugin in BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray())
|
||||
{
|
||||
BindingPlugins.DataValidators.Remove(plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Cowain.TestProject/Assets/CowainLogo.ico
Normal file
BIN
Cowain.TestProject/Assets/CowainLogo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
BIN
Cowain.TestProject/Assets/CowainLogo.png
Normal file
BIN
Cowain.TestProject/Assets/CowainLogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
Cowain.TestProject/Assets/Fonts/HarmonyOS_Sans_SC_Regular.ttf
Normal file
BIN
Cowain.TestProject/Assets/Fonts/HarmonyOS_Sans_SC_Regular.ttf
Normal file
Binary file not shown.
242
Cowain.TestProject/Assets/Icons.axaml
Normal file
242
Cowain.TestProject/Assets/Icons.axaml
Normal file
@@ -0,0 +1,242 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
<DrawingBrush x:Key="AddKeyIcon">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Brush="#00FFFFFF"
|
||||
Geometry="F1M16,16L0,16 0,0 16,0z" />
|
||||
<GeometryDrawing Brush="#FFF6F6F6"
|
||||
Geometry="F1M16,8.4629C16,10.9239 13.997,12.9259 11.537,12.9259 11.118,12.9259 10.704,12.8669 10.3,12.7479L7.704,15.3439C7.595,15.4529 7.003,16.0019 6.147,16.0019 5.767,16.0019 5.2,15.8869 4.657,15.3439 3.538,14.2249 4.043,12.9079 4.657,12.2959L7.252,9.6989C7.133,9.2959 7.073,8.8819 7.073,8.4629 7.073,7.5529 7.35,6.7069 7.82,5.9999L6,5.9999 6,7.9999 2.019,7.9999 2.019,5.9999 0,5.9999 0,2.0179 2.019,2.0179 2.019,-9.99999999979906E-05 6,-9.99999999979906E-05 6,2.0179 8,2.0179 8,5.7719C8.816,4.7019 10.091,3.9999 11.537,3.9999 12.165,3.9999 13.132,4.2889 13.368,4.3999 13.605,4.5099 14.987,5.1659 15.601,6.6309 15.688,6.8399 16,7.8359 16,8.4629" />
|
||||
<GeometryDrawing Brush="#FF424242"
|
||||
Geometry="F1M14.9873,8.5049C14.9873,10.4339 13.4233,11.9969 11.4953,11.9969 10.9823,11.9969 10.4323,11.9349 9.9953,11.7359L7.1303,14.6149C7.1303,14.6149 6.2573,15.4879 5.3843,14.6149 4.5103,13.7419 5.3843,12.8689 5.3843,12.8689L8.3233,10.0179C8.1263,9.5779 8.0033,9.0169 8.0033,8.5049 8.0033,6.5769 9.5663,5.0139 11.4953,5.0139 12.0063,5.0139 12.5553,5.0849 12.9953,5.2829L10.6223,7.6329 12.3683,9.3789 14.7143,7.0179C14.9113,7.4549,14.9873,7.9939,14.9873,8.5049" />
|
||||
<GeometryDrawing Brush="#FF388A34"
|
||||
Geometry="F1M7,3.0176L5,3.0176 5,0.9996 3.019,0.9996 3.019,3.0176 1,3.0176 1,4.9996 3.019,4.9996 3.019,6.9996 5,6.9996 5,4.9996 7,4.9996z" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<DrawingBrush x:Key="PauseIcon">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Brush="#00f6f6f6"
|
||||
Geometry="M16,0V16H0V0Z" />
|
||||
<GeometryDrawing Brush="Transparent"
|
||||
Geometry="M13,2V13H3V2Z" />
|
||||
<GeometryDrawing Brush="#FF0081E4"
|
||||
Geometry="M4,3H7v9H4ZM9,3v9h3V3Z" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
|
||||
|
||||
<DrawingBrush x:Key="StopIcon">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Brush="#00FFFFFF"
|
||||
Geometry="F1M16,16L0,16 0,0 16,0z" />
|
||||
<GeometryDrawing Brush="#F38B76"
|
||||
Geometry="F1M13,13L3,13 3,3 13,3z" />
|
||||
<GeometryDrawing Brush="#F38B76"
|
||||
Geometry="F1M12,12L4,12 4,4 12,4z" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush x:Key="RunIcon">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Brush="#00FFFFFF"
|
||||
Geometry="F1M16,16L0,16 0,0 16,0z" />
|
||||
<GeometryDrawing Brush="#8DD28A"
|
||||
Geometry="F1M4,2L4,14 12,8z" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush x:Key="AddStateIcon">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Brush="#00FFFFFF"
|
||||
Geometry="F1M16,16L0,16 0,0 16,0z" />
|
||||
<GeometryDrawing Brush="#FFF6F6F6"
|
||||
Geometry="F1M1.9998,-0.000199999999999534L1.9998,1.9998 -0.000199999999999978,1.9998 -0.000199999999999978,5.9998 1.9998,5.9998 1.9998,13.4148 3.5858,14.9998 5.4148,14.9998 6.9998,13.4148 6.9998,12.0008 14.4148,12.0008 15.9998,10.4138 15.9998,6.5858 14.4148,4.9998 7.9998,4.9998 7.9998,1.9998 6.0008,1.9998 6.0008,-0.000199999999999534z" />
|
||||
<GeometryDrawing Brush="#FF424242"
|
||||
Geometry="F1M15,7L15,10 14,11 6,11 6,13 5,14 4,14 3,13 3,8 4,8 4,13 5,13 5,10 14,10 14,7 6,7 6,6 14,6z" />
|
||||
<GeometryDrawing Brush="#FFF0EFF1"
|
||||
Geometry="F1M14,7L14,10 5,10 5,13 4,13 4,8 6,8 6,7z" />
|
||||
<GeometryDrawing Brush="#FF388A34"
|
||||
Geometry="F1M3,5L1,5 1,3 3,3 3,1 5,1 5,3 7,3 7,5 5,5 5,7 3,7z" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush x:Key="RenameIcon">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Brush="#00FFFFFF"
|
||||
Geometry="F1M16,16L0,16 0,0 16,0z" />
|
||||
<GeometryDrawing Brush="#FFF6F6F6"
|
||||
Geometry="F1M0,0.999700000000001L0,14.0007 8,14.0007 8,13.0007 16,13.0007 16,4.0007 8,4.0007 8,0.999700000000001z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,13L3,13 3,11 1,11z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M3,11L5,11 5,4 3,4z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M7,11L5,11 5,13 7,13z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,4L3,4 3,2 1,2z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,6L2,6 2,5 1,5z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,8L2,8 2,7 1,7z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M6,6L7,6 7,5 6,5z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M5,4L7,4 7,2 5,2z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,10L2,10 2,9 1,9z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M8,6L9,6 9,5 8,5z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M14,10L15,10 15,9 14,9z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M14,8L15,8 15,7 14,7z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M14,12L15,12 15,10.999 14,10.999z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M14,6L15,6 15,5 14,5z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M12,12L13,12 13,10.999 12,10.999z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M12,6L13,6 13,5 12,5z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M10,12L11,12 11,10.999 10,10.999z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M10,6L11,6 11,5 10,5z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M8,12L9,12 9,10.999 8,10.999z" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush x:Key="DeleteIcon">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V511.992 H511.992 V0 H0 Z">
|
||||
<DrawingGroup.Transform>
|
||||
<TranslateTransform X="3.5762786865234375E-07"
|
||||
Y="3.5762786865234375E-07" />
|
||||
</DrawingGroup.Transform>
|
||||
<GeometryDrawing Brush="#FFE76E54"
|
||||
Geometry="F1 M511.992,511.992z M0,0z M415.402344,495.421875L255.996094,336.011719 96.589844,495.421875C74.492188,517.515625 38.667969,517.515625 16.570312,495.421875 -5.52343799999997,473.324219 -5.52343799999997,437.5 16.570312,415.402344L175.980469,255.996094 16.570312,96.589844C-5.52343799999997,74.492188 -5.52343799999997,38.667969 16.570312,16.570312 38.667969,-5.52343800000003 74.492188,-5.52343800000003 96.589844,16.570312L255.996094,175.980469 415.402344,16.570312C437.5,-5.52343800000003 473.324219,-5.52343800000003 495.421875,16.570312 517.515625,38.667969 517.515625,74.492188 495.421875,96.589844L336.011719,255.996094 495.421875,415.402344C517.515625,437.5 517.515625,473.324219 495.421875,495.421875 473.324219,517.515625 437.5,517.515625 415.402344,495.421875z M415.402344,495.421875" />
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush x:Key="DisconnectIcon">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Brush="#00FFFFFF"
|
||||
Geometry="F1M16,16L0,16 0,0 16,0z" />
|
||||
<GeometryDrawing Brush="#FFF6F6F6"
|
||||
Geometry="F1M7.0002,-0.000199999999999534L7.0002,0.6468 6.3532,-0.000199999999999534 5.5252,-0.000199999999999534 3.9702,1.5558 2.4142,-0.000199999999999534 1.5862,-0.000199999999999534 0.000200000000000422,1.5858 0.000200000000000422,2.5348 1.4952,4.0298 0.000200000000000422,5.5258 0.000200000000000422,6.4748 1.5252,7.9998 1.0002,7.9998 1.0002,15.9998 10.0002,15.9998 10.0002,13.9998 14.0002,13.9998 14.0002,7.9998 16.0002,7.9998 16.0002,-0.000199999999999534z M6.4442,4.0298L7.0002,3.4748 7.0002,4.5858z M3.9702,6.5048L5.4652,7.9998 2.4752,7.9998z M7.0002,7.4138L7.0002,7.9998 6.4142,7.9998z M10.0002,7.9998L11.0002,7.9998 11.0002,10.9998 10.0002,10.9998z" />
|
||||
<GeometryDrawing Brush="#FF424242"
|
||||
Geometry="F1M14,6L9,6 9,3 14,3z M8,14L3,14 3,11 8,11z M8,1L8,7 12,7 12,12 9,12 9,9 2,9 2,15 9,15 9,13 13,13 13,7 15,7 15,1z" />
|
||||
<GeometryDrawing Brush="#FFEFEFF0"
|
||||
Geometry="F1M9,6L14,6 14,3 9,3z M3,11L8,11 8,14 3,14z" />
|
||||
<GeometryDrawing Brush="#FFA1260D"
|
||||
Geometry="F1M3.9699,2.9698L1.9999,0.999799999999999 0.9399,2.0608 2.9089,4.0298 0.9399,5.9998 1.9999,7.0598 3.9699,5.0908 5.9389,7.0598 6.9999,5.9998 5.0299,4.0298 6.9999,2.0608 5.9389,0.999799999999999z" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<DrawingBrush x:Key="SelectAllIcon">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Brush="#00FFFFFF"
|
||||
Geometry="F1M16,16L0,16 0,0 16,0z" />
|
||||
<GeometryDrawing Brush="#FFF6F6F6"
|
||||
Geometry="F1M0,-0.000199999999999534L0,13.0008 6,13.0008 6,14.9998 7.649,14.9998 8.337,14.2448 9.115,15.9998 9.983,15.9998 12.269,14.9598 11.406,13.0008 15,13.0008 15,-0.000199999999999534z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M8.4141,7L9.4141,8 11.0001,8 11.0001,7z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,12L2,12 2,10.999 1,10.999z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,2L2,2 2,1 1,1z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,10L2,10 2,9 1,9z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,6L2,6 2,5 1,5z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,4L2,4 2,3 1,3z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M1,8L2,8 2,7 1,7z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M9,2L10,2 10,1 9,1z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M7,2L8,2 8,1 7,1z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M5,2L6,2 6,1 5,1z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M3,2L4,2 4,1 3,1z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M3,6L10,6 10,5 3,5z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M13,4L14.001,4 14.001,3 13,3z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M13,10L14.001,10 14.001,9 13,9z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M3,12L4,12 4,10.999 3,10.999z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M12.9996,10.9996L12.9996,11.5856 13.4146,12.0006 14.0006,12.0006 14.0006,10.9996z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M13,6L14.001,6 14.001,5 13,5z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M13,2L14.001,2 14.001,1 13,1z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M13,8L14.001,8 14.001,7 13,7z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M11,2L12,2 12,1 11,1z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M3,8L6.001,8 6.001,7 3,7z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M5,12L6,12 6,10.999 5,10.999z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M3,4L12,4 12,3 3,3z" />
|
||||
<GeometryDrawing Brush="#FF414141"
|
||||
Geometry="F1M10.9551,14.459L9.8691,11.994 12.3871,11.994 7.0001,6.996 7.0001,14.228 8.6291,12.438 9.7661,15z" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<PathGeometry x:Key="CloseGeometry"
|
||||
Figures="M9.15625 6.3125L6.3125 9.15625L22.15625 25L6.21875 40.96875L9.03125 43.78125L25 27.84375L40.9375 43.78125L43.78125 40.9375L27.84375 25L43.6875 9.15625L40.84375 6.3125L25 22.15625Z"/>
|
||||
|
||||
<PathGeometry x:Key="AddGeometry"
|
||||
Figures="M15 5L15 15L5 15L5 17L15 17L15 27L17 27L17 17L27 17L27 15L17 15L17 5Z"/>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
181
Cowain.TestProject/Assets/ShadowUrsaWindow.axaml
Normal file
181
Cowain.TestProject/Assets/ShadowUrsaWindow.axaml
Normal file
@@ -0,0 +1,181 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
<ControlTheme x:Key="{x:Type u:UrsaWindow}" TargetType="u:UrsaWindow">
|
||||
<Setter Property="Background" Value="{DynamicResource WindowDefaultBackground}" />
|
||||
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource WindowDefaultBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}" />
|
||||
<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}" />
|
||||
<Setter Property="ExtendClientAreaTitleBarHeightHint" Value="-1" />
|
||||
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
|
||||
<Setter Property="u:OverlayDialogHost.IsModalStatusScope" Value="True" />
|
||||
<Setter Property="IsMinimizeButtonVisible" Value="{OnPlatform {x:True}, macOS={x:False}}" />
|
||||
<Setter Property="IsRestoreButtonVisible" Value="{OnPlatform {x:True}, macOS={x:False}}" />
|
||||
<Setter Property="IsCloseButtonVisible" Value="{OnPlatform {x:True}, macOS={x:False}}" />
|
||||
<Setter Property="SystemDecorations">
|
||||
<OnPlatform>
|
||||
<On Options="Default">
|
||||
<SystemDecorations>Full</SystemDecorations>
|
||||
</On>
|
||||
<On Options="Linux">
|
||||
<SystemDecorations>None</SystemDecorations>
|
||||
</On>
|
||||
</OnPlatform>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:UrsaWindow">
|
||||
<Panel Name="PART_RootPanel" Margin="8">
|
||||
<Border
|
||||
Name="PART_TransparencyFallback"
|
||||
BoxShadow="0 0 8 0 #1A000000"
|
||||
IsHitTestVisible="False" />
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BackgroundSizing="InnerBorderEdge"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
IsHitTestVisible="False" />
|
||||
<Panel Margin="{TemplateBinding WindowDecorationMargin}" Background="Transparent" />
|
||||
<VisualLayerManager Padding="{TemplateBinding OffScreenMargin, Mode=OneWay}">
|
||||
<VisualLayerManager.ChromeOverlayLayer>
|
||||
<Panel Margin="{Binding $parent[u:UrsaWindow].OffScreenMargin}">
|
||||
<u:TitleBar
|
||||
Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}"
|
||||
Content="{Binding $parent[u:UrsaWindow].TitleBarContent}"
|
||||
IsTitleBarHitTestVisible="{Binding $parent[u:UrsaWindow].(u:TitleBar.IsTitleBarHitTestVisible)}"
|
||||
IsTitleVisible="{Binding $parent[u:UrsaWindow].IsTitleBarVisible}"
|
||||
LeftContent="{Binding $parent[u:UrsaWindow].LeftContent}"
|
||||
RightContent="{Binding $parent[u:UrsaWindow].RightContent}" />
|
||||
<VisualLayerManager>
|
||||
<Panel>
|
||||
<u:OverlayDialogHost
|
||||
Name="{x:Static u:UrsaWindow.PART_DialogHost}"
|
||||
IsModalStatusReporter="True"
|
||||
IsTopLevel="True" />
|
||||
<u:WindowResizer
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
IsVisible="{Binding $parent[u:UrsaWindow].IsManagedResizerVisible}" />
|
||||
</Panel>
|
||||
</VisualLayerManager>
|
||||
</Panel>
|
||||
</VisualLayerManager.ChromeOverlayLayer>
|
||||
<Panel>
|
||||
<ContentPresenter
|
||||
Name="PART_ContentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
|
||||
</Panel>
|
||||
</VisualLayerManager>
|
||||
</Panel>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^[WindowState=Maximized]">
|
||||
<Style Selector="^ /template/ Panel#PART_RootPanel">
|
||||
<Setter Property="Margin" Value="0" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^[WindowState=FullScreen]">
|
||||
<Style Selector="^ /template/ Panel#PART_RootPanel">
|
||||
<Setter Property="Margin" Value="0" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:TitleBar}" TargetType="u:TitleBar">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:TitleBar">
|
||||
<Panel Background="Transparent">
|
||||
<Panel>
|
||||
<u:WindowThumb Background="{TemplateBinding Background}" IsHitTestVisible="{TemplateBinding IsTitleBarHitTestVisible}" />
|
||||
<Grid HorizontalAlignment="Stretch" ColumnDefinitions="Auto, *, Auto, Auto">
|
||||
<ContentPresenter
|
||||
Grid.Column="0"
|
||||
Content="{TemplateBinding LeftContent}"
|
||||
IsVisible="{TemplateBinding IsTitleVisible}" />
|
||||
<ContentPresenter
|
||||
Grid.Column="1"
|
||||
Content="{TemplateBinding Content}"
|
||||
IsVisible="{TemplateBinding IsTitleVisible}" />
|
||||
<ContentPresenter
|
||||
Grid.Column="2"
|
||||
Content="{TemplateBinding RightContent}"
|
||||
IsVisible="{TemplateBinding IsTitleVisible}" />
|
||||
<u:CaptionButtons
|
||||
Name="{x:Static u:TitleBar.PART_CaptionButtons}"
|
||||
Grid.Column="3"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
DockPanel.Dock="Right"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
</Grid>
|
||||
</Panel>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:CaptionButtons}" TargetType="u:CaptionButtons">
|
||||
<Setter Property="Foreground" Value="{DynamicResource CaptionButtonForeground}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:CaptionButtons">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="PART_FullScreenButton" Theme="{StaticResource CaptionButton}">
|
||||
<PathIcon
|
||||
Name="PART_FullScreenButtonIcon"
|
||||
Data="{StaticResource WindowExpandGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}"
|
||||
Theme="{StaticResource InnerPathIcon}" />
|
||||
</Button>
|
||||
<Button Name="PART_MinimizeButton" Theme="{StaticResource CaptionButton}">
|
||||
<PathIcon
|
||||
Name="PART_MinimizeButtonIcon"
|
||||
Data="{StaticResource WindowMinimizeGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}"
|
||||
Theme="{StaticResource InnerPathIcon}" />
|
||||
</Button>
|
||||
<Button Name="PART_RestoreButton" Theme="{StaticResource CaptionButton}">
|
||||
<PathIcon
|
||||
Name="PART_RestoreButtonIcon"
|
||||
Data="{StaticResource WindowMaximizeGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}"
|
||||
Theme="{StaticResource InnerPathIcon}" />
|
||||
</Button>
|
||||
<Button Name="PART_CloseButton" Theme="{StaticResource CaptionButton}">
|
||||
<PathIcon
|
||||
Name="PART_CloseButtonIcon"
|
||||
Data="{StaticResource WindowCloseIconGlyph}"
|
||||
Foreground="{Binding $parent[Button].Foreground}"
|
||||
Theme="{StaticResource InnerPathIcon}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^ /template/ Button#PART_CloseButton:pointerover">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePointeroverBackground}" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ Button#PART_CloseButton:pressed">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Background" Value="{DynamicResource CaptionButtonClosePressedBackground}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:maximized /template/ PathIcon#PART_RestoreButtonIcon">
|
||||
<Setter Property="Data" Value="{StaticResource WindowRestoreGlyph}" />
|
||||
</Style>
|
||||
<Style Selector="^:fullscreen /template/ PathIcon#PART_FullScreenButtonIcon">
|
||||
<Setter Property="Data" Value="{StaticResource WindowCollapseGlyph}" />
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
112
Cowain.TestProject/Assets/Styles.axaml
Normal file
112
Cowain.TestProject/Assets/Styles.axaml
Normal file
@@ -0,0 +1,112 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<!-- Add Controls for Previewer Here -->
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
|
||||
<Style Selector="Border.Rounded-1">
|
||||
<Setter Property="CornerRadius" Value="5" />
|
||||
</Style>
|
||||
<Style Selector="Border.Rounded-2">
|
||||
<Setter Property="CornerRadius" Value="10" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.BtnPrimary">
|
||||
<Setter Property="Background" Value="{DynamicResource BtnPrimary}" />
|
||||
</Style>
|
||||
|
||||
<!--文本块-->
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimary}" />
|
||||
</Style>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<Style Selector="Button.ToolbarIconButton">
|
||||
<Setter Property="Margin" Value="10" />
|
||||
<Setter Property="Width" Value="60" />
|
||||
<Setter Property="CornerRadius" Value="10" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Style Selector="^:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{DynamicResource BtnDefaultHover}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{DynamicResource BtnDefaultActive}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="Button.ToolbarIconButton.Active">
|
||||
<Setter Property="Background" Value="{DynamicResource BtnDefaultActive}" />
|
||||
</Style>
|
||||
<Style Selector="Button.ToolbarIconButton PathIcon">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimary}" />
|
||||
<Setter Property="Margin" Value="4" />
|
||||
</Style>
|
||||
<Style Selector="Button.ToolbarIconButton TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<!--侧边栏搜索框-->
|
||||
<Style Selector="TextBox.Search">
|
||||
<Setter Property="Background" Value="{DynamicResource BgSearchInput}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BgSearchInput}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="CornerRadius" Value="10" />
|
||||
<Setter Property="Padding" Value="10" />
|
||||
<!--
|
||||
覆盖默认 TextBox 样式,原结构可参考以下网址
|
||||
https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml
|
||||
-->
|
||||
<Style Selector="^:pointerover">
|
||||
<Style Selector="^ /template/ Border#PART_BorderElement">
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Background" Value="{DynamicResource BgSearchInput}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:focus">
|
||||
<Style Selector="^ /template/ Border#PART_BorderElement">
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Background" Value="{DynamicResource BgSearchInput}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<!--侧边栏二级菜单样式-->
|
||||
<Style Selector="TextBlock.SidebarGroupName">
|
||||
<Setter Property="Width" Value="190" />
|
||||
<Setter Property="TextWrapping" Value="NoWrap" />
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="Padding" Value="10,0,0,10" />
|
||||
</Style>
|
||||
<Style Selector="Button.SidebarMenuItem">
|
||||
<Setter Property="CornerRadius" Value="10" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Style Selector="^:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{DynamicResource BgSidebarItemHover}" />
|
||||
</Style>
|
||||
<Style Selector="^:pressed /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{DynamicResource BgSidebarItemPressed}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="Button.SidebarMenuItem.Active">
|
||||
<Setter Property="Background" Value="{DynamicResource BgSidebarItemPressed}" />
|
||||
</Style>
|
||||
<Style Selector="Button.SidebarMenuItem PathIcon">
|
||||
<Setter Property="Margin" Value="0,0,6,0" />
|
||||
<Setter Property="Width" Value="18" />
|
||||
<Setter Property="Height" Value="18" />
|
||||
</Style>
|
||||
<Style Selector="Button.SidebarMenuItem TextBlock">
|
||||
<Setter Property="Width" Value="142" />
|
||||
<Setter Property="Padding" Value="5" />
|
||||
<Setter Property="TextWrapping" Value="NoWrap" />
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||
</Style>
|
||||
|
||||
</Styles>
|
||||
48
Cowain.TestProject/Assets/Themes.axaml
Normal file
48
Cowain.TestProject/Assets/Themes.axaml
Normal file
@@ -0,0 +1,48 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
|
||||
<!--默认主题-->
|
||||
<ResourceDictionary x:Key='Default'>
|
||||
<SolidColorBrush x:Key="BorderColor" Color="#dedfe1" />
|
||||
<!--背景-->
|
||||
<SolidColorBrush x:Key="BgToolbar" Color="#f5f5f6" />
|
||||
<SolidColorBrush x:Key="BgBody" Color="White" />
|
||||
<SolidColorBrush x:Key="BgSidebarItemHover" Color="#f5f5f6" />
|
||||
<SolidColorBrush x:Key="BgSidebarItemPressed" Color="#ebebed" />
|
||||
<SolidColorBrush x:Key="BgSearchInput" Color="#f6f6f7" />
|
||||
<!--文本-->
|
||||
<SolidColorBrush x:Key="TextPrimary" Color="#25262b" />
|
||||
<SolidColorBrush x:Key="TextSecondary" Color="" />
|
||||
<SolidColorBrush x:Key="TextSuccess" Color="#198754" />
|
||||
<SolidColorBrush x:Key="TextDanger" Color="#dc3545" />
|
||||
<!--按钮-->
|
||||
<SolidColorBrush x:Key="BtnDefault" Color="#f5f5f6" />
|
||||
<SolidColorBrush x:Key="BtnDefaultHover" Color="#ececee" />
|
||||
<SolidColorBrush x:Key="BtnDefaultActive" Color="#e3e3e5" />
|
||||
<SolidColorBrush x:Key="BtnPrimary" Color="#446dff" />
|
||||
</ResourceDictionary>
|
||||
|
||||
<!--暗色主题-->
|
||||
<ResourceDictionary x:Key='Dark'>
|
||||
<SolidColorBrush x:Key="BorderColor" Color="#3c3c3c" />
|
||||
<SolidColorBrush x:Key="BgToolbar" Color="#222226" />
|
||||
<SolidColorBrush x:Key="BgBody" Color="#111113" />
|
||||
<SolidColorBrush x:Key="BgSidebarItemHover" Color="#1f1f22" />
|
||||
<SolidColorBrush x:Key="BgSidebarItemPressed" Color="#2d2d30" />
|
||||
<SolidColorBrush x:Key="BgSearchInput" Color="#19191c" />
|
||||
<SolidColorBrush x:Key="TextPrimary" Color="White" />
|
||||
<SolidColorBrush x:Key="TextSecondary" Color="#606062" />
|
||||
<SolidColorBrush x:Key="TextSuccess" Color="#198754" />
|
||||
<SolidColorBrush x:Key="TextDanger" Color="#dc3545" />
|
||||
<SolidColorBrush x:Key="BtnDefault" Color="#222226" />
|
||||
<SolidColorBrush x:Key="BtnDefaultHover" Color="#2e2e32" />
|
||||
<SolidColorBrush x:Key="BtnDefaultActive" Color="#3a3a3f" />
|
||||
<SolidColorBrush x:Key="BtnPrimary" Color="#446dff" />
|
||||
</ResourceDictionary>
|
||||
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
31
Cowain.TestProject/Assets/ToggleSwitch.axaml
Normal file
31
Cowain.TestProject/Assets/ToggleSwitch.axaml
Normal file
@@ -0,0 +1,31 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ControlTheme x:Key="ThemeToggleSwitch"
|
||||
BasedOn="{StaticResource ButtonToggleSwitch}"
|
||||
TargetType="ToggleSwitch">
|
||||
<Setter Property="Padding" Value="8" />
|
||||
<Setter Property="OnContent" Value="{Binding $self.Content}" />
|
||||
<Setter Property="OnContentTemplate">
|
||||
<DataTemplate>
|
||||
<PathIcon Theme="{StaticResource InnerPathIcon}" Data="{Binding}" />
|
||||
</DataTemplate>
|
||||
</Setter>
|
||||
<Setter Property="OffContent" Value="{Binding $self.Content}" />
|
||||
<Setter Property="OffContentTemplate">
|
||||
<DataTemplate>
|
||||
<PathIcon Theme="{StaticResource InnerPathIcon}" Data="{Binding}" />
|
||||
</DataTemplate>
|
||||
</Setter>
|
||||
<Setter Property="ContentTemplate">
|
||||
<DataTemplate>
|
||||
<PathIcon Theme="{StaticResource InnerPathIcon}" Data="{Binding}" />
|
||||
</DataTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="SplitViewToggleSwitch"
|
||||
BasedOn="{StaticResource ThemeToggleSwitch}"
|
||||
TargetType="ToggleSwitch">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
<Setter Property="Content" Value="{StaticResource SemiIconSidebar}" />
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
7
Cowain.TestProject/Assets/_index.axaml
Normal file
7
Cowain.TestProject/Assets/_index.axaml
Normal file
@@ -0,0 +1,7 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="ToggleSwitch.axaml" />
|
||||
<ResourceInclude Source="Icons.axaml" />
|
||||
<ResourceInclude Source="ShadowUrsaWindow.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
BIN
Cowain.TestProject/Assets/avalonia-logo.ico
Normal file
BIN
Cowain.TestProject/Assets/avalonia-logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
127
Cowain.TestProject/Assets/i18n/en-US.json
Normal file
127
Cowain.TestProject/Assets/i18n/en-US.json
Normal file
@@ -0,0 +1,127 @@
|
||||
{
|
||||
"AppName": "CowainWCS",
|
||||
"LoginTitle": "Welcome to use",
|
||||
"SelectFolder": "Select Folder",
|
||||
"SelectFile": "Select File",
|
||||
"Yes": "Yes",
|
||||
"No": "No",
|
||||
"OK": "OK",
|
||||
"Cancel": "Cancel",
|
||||
"Add": "Add",
|
||||
"Delete": "Delete",
|
||||
"ExitTitle": "Exit",
|
||||
"CloseAppDialog": "Are you sure you want to exit?",
|
||||
"Message.Info.Title": "Message Tips",
|
||||
"DeleteDialog": "Are you sure you want to delete?",
|
||||
"SaveDialog": "Are you sure you want to save?",
|
||||
|
||||
"Login.UserName": "UserName",
|
||||
"Login.Password": "Password",
|
||||
"Login.RememberUserName": "RememberUserName",
|
||||
"Login.Login": "Login",
|
||||
|
||||
|
||||
"Menu.Toolbar.Home": "Home",
|
||||
"Menu.Toolbar.AdminManagement": "User",
|
||||
"Menu.Toolbar.RealTime": "Diagnostics",
|
||||
"Menu.Toolbar.BasicSettings": "Param",
|
||||
"Menu.Sidebar.Logs": "Logs",
|
||||
|
||||
"Menu.Settings": "Settings",
|
||||
"Menu.Settings.Language": "Language",
|
||||
"Menu.Settings.Theme": "Themes",
|
||||
"Menu.Settings.Theme.Default": "Default",
|
||||
"Menu.Settings.Theme.Dark": "Dark",
|
||||
"Menu.Settings.Theme.Desert": "Desert",
|
||||
"Menu.Settings.Theme.Dusk": "Dusk",
|
||||
"Menu.Settings.Theme.NightSky": "NightSky",
|
||||
"Menu.Settings.About": "About",
|
||||
|
||||
"Menu.Sidebar.AdminSetting": "AdminSetting",
|
||||
"Menu.Sidebar.UserRoleSetting": "UserRole",
|
||||
"Menu.Sidebar.RoleMenuSetting": "RoleMenu",
|
||||
"Menu.Sidebar.UserManagement": "UserManagement",
|
||||
|
||||
|
||||
|
||||
"View.SearchInput.Placeholder": "Search The Toolbox",
|
||||
|
||||
"Task.TaskListTitle": "Task List",
|
||||
"Task.DragDropText": "Drag and drop files from your local computer here to add them to the task list",
|
||||
"Task.TaskPendingStatusText": "The task list has {0} files pending processing",
|
||||
"Task.TaskRunningStatusText": "Processing file {0} out of {1}",
|
||||
"Task.TaskCompletedStatusText": "All files have been processed.",
|
||||
"Task.ExecuteButtonText": "Execute",
|
||||
"Task.ClearButtonText": "Clear",
|
||||
"Task.OutputDirectoryButtonText": "Output Directory",
|
||||
|
||||
"Errors.Invalid.ViewPage": "Invalid View Page",
|
||||
|
||||
"UserRole.DataGrid.RoleId": "Id",
|
||||
"UserRole.DataGrid.RoleName": "RoleName",
|
||||
"UserRole.DataGrid.IsValid": "IsValid",
|
||||
"UserRole.DataGrid.Edit": "Edit",
|
||||
"UserRole.Dialog.Title": "RoleSetting",
|
||||
"UserRole.Setting.Add.Success": "UserRole Add Sucess",
|
||||
"UserRole.Setting.Add.Error": "UserRole Add Err,UserRoleName already exists",
|
||||
"UserRole.Setting.Edit.Success": "UserRole Edit Sucess",
|
||||
"UserRole.Setting.Edit.Error": "UserRole Edit Err,UserRoleName already exists",
|
||||
"UserRole.Setting.Delete.Success": "UserRole Delete Success",
|
||||
|
||||
"RoleMenu.DataGrid.MenuName": "RoleName",
|
||||
"RoleMenu.DataGrid.MenuActions": "MenuActions",
|
||||
"RoleMenu.Dialog.MenuSelect": "MenuSelect",
|
||||
"RoleMenu.Setting.Edit.Success": "Role Menu Edit Success",
|
||||
"RoleMenu.Setting.Edit.Error": "Role Menu Edit Error",
|
||||
"RoleMenu.Dialog.MenuActions": "MenuActions Edit",
|
||||
"RoleMenu.Actions.Setting.Edit.Success": "MenuActions Edit Success",
|
||||
"RoleMenu.Actions.Setting.Edit.Error": "MenuActions Edit Error,Message:",
|
||||
"RoleMenu.Actions.Setting.Edit.SelectRoleNull": "SelectRole is Null",
|
||||
"RoleMenu.Actions.Setting.Edit.UserRoleMenuNull": "UserRoleMenu Action is Null",
|
||||
"RoleMenu.Actions.Setting.Delete.Success": "MenuActions Delete Success",
|
||||
"RoleMenu.Actions.Setting.Delete.Error": "MenuActions Delete Error,Message:",
|
||||
|
||||
"UserManagement.DataGrid.Id": "Id",
|
||||
"UserManagement.DataGrid.Name": "UserName",
|
||||
"UserManagement.DataGrid.UserNumber": "UserNumber",
|
||||
"UserManagement.DataGrid.RoleName": "RoleName",
|
||||
"UserManagement.DataGrid.Phone": "Phone",
|
||||
"UserManagement.DataGrid.Sex": "Sex",
|
||||
"UserManagement.DataGrid.IsValid": "IsValid",
|
||||
"UserManagement.DataGrid.Password": "Password",
|
||||
"UserManagement.DataGrid.Edit": "Edit",
|
||||
"UserManagement.Dialog.Title": "Edit User",
|
||||
"UserManagement.RoleName.Placeholder": "Pleace Select Role",
|
||||
|
||||
"UserManagement.AddUser.Success": "AddUser Successed",
|
||||
"UserManagement.EditUser.Success": "EditUser Successed",
|
||||
"UserManagement.DeleteUser.Success": "DeleteUser Successed",
|
||||
"UserManagement.AddUser.Error.UserRolesNull": "database userRoles is null",
|
||||
"UserManagement.AddUser.Error.SelectedRoleNull": "selected role is null",
|
||||
"UserEditDilog.Error.UserNameNull": "User Name is null!",
|
||||
"UserEditDilog.Error.UserNumberNull": "User Number is Null!",
|
||||
"UserEditDilog.Error.SexNull": "User Sex is Null!",
|
||||
"UserEditDilog.Error.SelectedRoleNull": "SelectedRole is Null",
|
||||
"UserManagement.EditUser.Error": "EditUser Error",
|
||||
|
||||
"Log.DataGrid.Id": "Id",
|
||||
"Log.DataGrid.Timestamp": "Timestamp",
|
||||
"Log.DataGrid.Message": "Message",
|
||||
"Log.DataGrid.Level": "Level",
|
||||
"Log.DataGrid.Exception": "Exception",
|
||||
"Log.Tooltip.Refresh": "Refresh",
|
||||
"Log.Tooltip.Export": "Export",
|
||||
"Log.Export.Success": "Log Export Success",
|
||||
"Log.Export.Error": "Log Export Error",
|
||||
|
||||
"SexMode.Male": "Male",
|
||||
"SexMode.Female": "Female",
|
||||
"SexMode.Other": "Other",
|
||||
"SexMode.Placeholder": "Pleace Select Sex",
|
||||
|
||||
"Errors.MinLength": "The length of the string should be at least:",
|
||||
|
||||
"LoginWindow.UserNameEmpty": "UserName is Empty",
|
||||
"LoginWindow.PasswordEmpty": "Password is Empty",
|
||||
"LoginWindow.LoginFailed": "LoginFailed,UserName or Password error"
|
||||
}
|
||||
126
Cowain.TestProject/Assets/i18n/zh-CN.json
Normal file
126
Cowain.TestProject/Assets/i18n/zh-CN.json
Normal file
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"AppName": "CowainWCS",
|
||||
"LoginTitle": "登录界面",
|
||||
"SelectFolder": "选择文件夹",
|
||||
"SelectFile": "选择文件",
|
||||
"Yes": "是",
|
||||
"No": "否",
|
||||
"OK": "确定",
|
||||
"Cancel": "取消",
|
||||
"Add": "添加",
|
||||
"Delete": "删除",
|
||||
"ExitTitle": "退出",
|
||||
"CloseAppDialog": "确定要关闭软件吗?",
|
||||
"Message.Info.Title": "操作提示",
|
||||
"DeleteDialog": "确定要删除吗?",
|
||||
"SaveDialog": "确定要保存吗?",
|
||||
|
||||
"Login.UserName": "用户名",
|
||||
"Login.Password": "密码",
|
||||
"Login.RememberUserName": "记住用户名",
|
||||
"Login.Login": "登录",
|
||||
|
||||
"Menu.Toolbar.Home": "首页",
|
||||
"Menu.Toolbar.AdminManagement": "用户",
|
||||
"Menu.Toolbar.RealTime": "诊断",
|
||||
"Menu.Toolbar.BasicSettings": "参数",
|
||||
"Menu.Sidebar.Logs": "软件日志",
|
||||
|
||||
"Menu.Settings": "设置",
|
||||
"Menu.Settings.Language": "语言",
|
||||
"Menu.Settings.Theme": "主题",
|
||||
"Menu.Settings.Theme.Default": "默认主题",
|
||||
"Menu.Settings.Theme.Dark": "暗色主题",
|
||||
"Menu.Settings.Theme.Desert": "Desert",
|
||||
"Menu.Settings.Theme.Dusk": "Dusk",
|
||||
"Menu.Settings.Theme.NightSky": "NightSky",
|
||||
"Menu.Settings.About": "关于",
|
||||
|
||||
"Menu.Sidebar.AdminSetting": "用户权限设置",
|
||||
"Menu.Sidebar.UserRoleSetting": "角色设置",
|
||||
"Menu.Sidebar.RoleMenuSetting": "权限设置",
|
||||
"Menu.Sidebar.UserManagement": "用户管理",
|
||||
|
||||
|
||||
"View.SearchInput.Placeholder": "在工具箱中搜索",
|
||||
|
||||
"Task.TaskListTitle": "任务列表",
|
||||
"Task.DragDropText": "从本地电脑拖放文件到此处加入任务列表",
|
||||
"Task.TaskPendingStatusText": "任务列表有 {0} 个文件待处理",
|
||||
"Task.TaskRunningStatusText": "正在处理第 {0}/{1} 个文件",
|
||||
"Task.TaskCompletedStatusText": "所有文件处理完毕",
|
||||
"Task.ExecuteButtonText": "执行任务",
|
||||
"Task.ClearButtonText": "清除任务",
|
||||
"Task.OutputDirectoryButtonText": "输出目录",
|
||||
|
||||
"Errors.Invalid.ViewPage": "无效的视图页面",
|
||||
|
||||
"UserRole.DataGrid.RoleId": "序号",
|
||||
"UserRole.DataGrid.RoleName": "角色名称",
|
||||
"UserRole.DataGrid.IsValid": "是否生效",
|
||||
"UserRole.DataGrid.Edit": "操作",
|
||||
"UserRole.Dialog.Title": "角色设置",
|
||||
"UserRole.Setting.Add.Success": "角色添加成功",
|
||||
"UserRole.Setting.Add.Error": "角色添加失败,角色名称不能重复",
|
||||
"UserRole.Setting.Edit.Success": "角色修改成功",
|
||||
"UserRole.Setting.Edit.Error": "角色修改失败,角色名称不能重复",
|
||||
"UserRole.Setting.Delete.Success": "角色删除成功",
|
||||
|
||||
"RoleMenu.DataGrid.MenuName": "菜单名称",
|
||||
"RoleMenu.DataGrid.MenuActions": "操作权限",
|
||||
"RoleMenu.Dialog.MenuSelect": "菜单选择",
|
||||
"RoleMenu.Setting.Edit.Success": "角色菜单修改成功",
|
||||
"RoleMenu.Setting.Edit.Error": "角色菜单修改失败",
|
||||
"RoleMenu.Dialog.MenuActions": "编辑菜单操作权限",
|
||||
"RoleMenu.Actions.Setting.Edit.Success": "权限菜单修改成功",
|
||||
"RoleMenu.Actions.Setting.Edit.Error": "权限菜单修改失败,错误信息:",
|
||||
"RoleMenu.Actions.Setting.Edit.SelectRoleNull": "请选中角色",
|
||||
"RoleMenu.Actions.Setting.Edit.UserRoleMenuNull": "当前页面无权限菜单",
|
||||
"RoleMenu.Actions.Setting.Delete.Success": "权限菜单删除成功",
|
||||
"RoleMenu.Actions.Setting.Delete.Error": "权限菜单删除失败,错误信息:",
|
||||
|
||||
"UserManagement.DataGrid.Id": "序号",
|
||||
"UserManagement.DataGrid.Name": "用户名称",
|
||||
"UserManagement.DataGrid.UserNumber": "工号",
|
||||
"UserManagement.DataGrid.RoleName": "角色名称",
|
||||
"UserManagement.DataGrid.Phone": "电话",
|
||||
"UserManagement.DataGrid.Sex": "性别",
|
||||
"UserManagement.DataGrid.IsValid": "有效",
|
||||
"UserManagement.DataGrid.Password": "密码",
|
||||
"UserManagement.DataGrid.Edit": "操作",
|
||||
"UserManagement.Dialog.Title": "编辑用户",
|
||||
"UserManagement.RoleName.Placeholder": "请选择角色",
|
||||
|
||||
"UserManagement.AddUser.Success": "添加用户成功",
|
||||
"UserManagement.EditUser.Success": "修改用户成功",
|
||||
"UserManagement.DeleteUser.Success": "删除用户成功",
|
||||
"UserManagement.AddUser.Error.UserRolesNull": "从数据库获取的用户角色为空",
|
||||
"UserManagement.AddUser.Error.SelectedRoleNull": "没有选择角色,请选择",
|
||||
"UserEditDilog.Error.UserNameNull": "用户名称不能为空!",
|
||||
"UserEditDilog.Error.UserNumberNull": "工号不能为空!",
|
||||
"UserEditDilog.Error.SexNull": "性别不能为空!",
|
||||
"UserEditDilog.Error.SelectedRoleNull": "角色不能为空",
|
||||
"UserManagement.EditUser.Error": "修改用户错误",
|
||||
|
||||
|
||||
"Log.DataGrid.Id": "序号",
|
||||
"Log.DataGrid.Timestamp": "时间",
|
||||
"Log.DataGrid.Message": "日志内容",
|
||||
"Log.DataGrid.Level": "等级",
|
||||
"Log.DataGrid.Exception": "异常",
|
||||
"Log.Tooltip.Refresh": "刷新",
|
||||
"Log.Tooltip.Export": "导出",
|
||||
"Log.Export.Success": "日志导出成功",
|
||||
"Log.Export.Error": "日志导出失败",
|
||||
|
||||
"SexMode.Male": "男",
|
||||
"SexMode.Female": "女",
|
||||
"SexMode.Other": "其他",
|
||||
"SexMode.Placeholder": "请选择性别",
|
||||
|
||||
"Errors.MinLength": "字符串长度不能小于:",
|
||||
|
||||
"LoginWindow.UserNameEmpty": "用户名不能为空",
|
||||
"LoginWindow.PasswordEmpty": "密码不能为空",
|
||||
"LoginWindow.LoginFailed": "登录失败,用户名或密码错误"
|
||||
}
|
||||
BIN
Cowain.TestProject/Configs/DB/localDb.sqlite
Normal file
BIN
Cowain.TestProject/Configs/DB/localDb.sqlite
Normal file
Binary file not shown.
141
Cowain.TestProject/Configs/menus.json
Normal file
141
Cowain.TestProject/Configs/menus.json
Normal file
@@ -0,0 +1,141 @@
|
||||
[
|
||||
{
|
||||
"Key": "Home",
|
||||
"Icon": "M21.6062 5.85517C23.0048 4.71494 24.9952 4.71494 26.3938 5.85517L39.5688 16.5966C40.4736 17.3342 41 18.4492 41 19.628V39.1134C41 41.2599 39.2875 43 37.175 43H32.075C29.9625 43 28.25 41.2599 28.25 39.1134V29.7492C28.25 29.0337 27.6792 28.4536 26.975 28.4536H21.025C20.3208 28.4536 19.75 29.0337 19.75 29.7492V39.1134C19.75 41.2599 18.0375 43 15.925 43H10.825C8.71251 43 7 41.2599 7 39.1134V19.628C7 18.4493 7.52645 17.3342 8.43124 16.5966L21.6062 5.85517ZM24.7979 7.87612C24.3317 7.49604 23.6683 7.49604 23.2021 7.87612L10.0271 18.6175C9.72548 18.8634 9.55 19.2351 9.55 19.628V39.1134C9.55 39.8289 10.1208 40.4089 10.825 40.4089H15.925C16.6292 40.4089 17.2 39.8289 17.2 39.1134V29.7492C17.2 27.6027 18.9125 25.8626 21.025 25.8626H26.975C29.0875 25.8626 30.8 27.6027 30.8 29.7492V39.1134C30.8 39.8289 31.3708 40.4089 32.075 40.4089H37.175C37.8792 40.4089 38.45 39.8289 38.45 39.1134V19.628C38.45 19.2351 38.2745 18.8634 37.9729 18.6175L24.7979 7.87612Z",
|
||||
"IsActive": true,
|
||||
"LocaleKey": "Menu.Toolbar.Home",
|
||||
"Group": "Toolbar",
|
||||
"CommandType": "Active"
|
||||
|
||||
},
|
||||
{
|
||||
"Key": "AdminManagement",
|
||||
"Icon": "M512 74.666667C270.933333 74.666667 74.666667 270.933333 74.666667 512S270.933333 949.333333 512 949.333333 949.333333 753.066667 949.333333 512 753.066667 74.666667 512 74.666667zM288 810.666667c0-123.733333 100.266667-224 224-224S736 686.933333 736 810.666667c-61.866667 46.933333-140.8 74.666667-224 74.666666s-162.133333-27.733333-224-74.666666z m128-384c0-53.333333 42.666667-96 96-96s96 42.666667 96 96-42.666667 96-96 96-96-42.666667-96-96z m377.6 328.533333c-19.2-96-85.333333-174.933333-174.933333-211.2 32-29.866667 51.2-70.4 51.2-117.333333 0-87.466667-72.533333-160-160-160s-160 72.533333-160 160c0 46.933333 19.2 87.466667 51.2 117.333333-89.6 36.266667-155.733333 115.2-174.933334 211.2-55.466667-66.133333-91.733333-149.333333-91.733333-243.2 0-204.8 168.533333-373.333333 373.333333-373.333333S885.333333 307.2 885.333333 512c0 93.866667-34.133333 177.066667-91.733333 243.2z",
|
||||
"LocaleKey": "Menu.Toolbar.AdminManagement",
|
||||
"Group": "Toolbar",
|
||||
"CommandType": "Active",
|
||||
"Items": [
|
||||
{
|
||||
"Key": "UserRoleSetting",
|
||||
"Icon": "M797.696 354.304c0-157.696-130.048-287.744-288.256-287.744S221.696 196.096 221.696 354.304c0 117.248 70.144 219.648 172.544 264.704-130.048 42.496-236.544 153.6-270.848 296.448-2.048 10.752 4.096 21.504 16.896 23.552h4.096c10.752 0 18.944-6.144 21.504-16.896 40.448-164.352 183.296-281.6 343.552-281.6 158.208 1.536 288.256-128.512 288.256-286.208z m-532.992 0c0-134.144 111.104-245.248 245.248-245.248s245.248 111.104 245.248 245.248-111.104 245.248-245.248 245.248c-136.704 0-245.248-111.104-245.248-245.248z M857.088 635.392c-79.872-45.568-181.76-17.92-227.328 61.952-8.192 13.824-13.824 29.184-17.408 44.544l-252.416 67.584-57.344 100.352 108.032 61.952 23.552-41.472 46.08 27.648 29.184-48.128 32.768 18.944 114.688-30.208c10.24 10.24 22.016 18.944 34.816 26.624 79.872 45.568 181.76 17.92 227.328-61.952 46.08-80.384 17.92-182.784-61.952-227.84z m5.632 146.944c-9.728 16.896-31.744 23.04-48.64 13.312s-23.04-31.744-13.312-48.64 31.744-23.04 48.64-13.312 23.04 31.744 13.312 48.64z m-150.528 106.496c-12.288-7.168-23.552-16.384-32.768-27.136L620.544 793.6l18.432 67.072-90.624 24.064-52.736-30.208-28.672 47.104-47.104-28.672-24.576 42.496-37.376-21.504 28.672-50.176 261.632-69.632 2.048-13.312c2.56-15.36 7.68-30.208 15.36-44.032 34.304-60.416 111.104-81.408 171.52-47.104 13.312 7.68 24.576 17.408 34.304 28.672-36.352-23.04-84.992-9.728-106.496 27.648-20.992 36.864-8.192 83.456 28.672 104.448 36.864 20.992 83.456 8.192 104.448-28.672 0-0.512 0.512-1.024 0.512-1.536-2.56 13.824-7.168 27.648-14.848 40.96-34.304 60.928-111.104 81.92-171.52 47.616z",
|
||||
"LocaleKey": "Menu.Sidebar.UserRoleSetting",
|
||||
"CommandType": "Navigate",
|
||||
"CommandParameter": "UserRoleSetting",
|
||||
"PageActions": [ "add", "edit", "delete" ]
|
||||
},
|
||||
{
|
||||
"Key": "RoleMenuSetting",
|
||||
"Icon": "M843.14375 762.425h-286.875a20.8125 20.8125 0 1 0 0 41.7375h286.875a20.8125 20.8125 0 1 0 0-41.7375z m0-329.9625h-286.875a20.8125 20.8125 0 1 0 0 41.7375h286.875a20.8125 20.8125 0 1 0 0-41.7375z m15.862499999999999-157.16250000000002H721.25C695.99375 153.79999999999995 590.0749999999999 62 461.15 62a267.35625 267.35625 0 0 0-267.41249999999997 267.41249999999997 266.79375000000005 266.79375000000005 0 0 0 155.25 241.9875 395.2125 395.2125 0 0 0-282.375 366.13125c-0.22499999999999998 1.18125-0.73125 2.3625-0.73125 3.5999999999999996a20.925 20.925 0 0 0 41.7375 0H108.12500000000006a353.08125 353.08125 0 0 1 329.5125-343.2375v261.05625c0 56.925 46.12499999999999 103.05 102.99375 103.05h318.375C915.875 962 962 915.875 962 858.9499999999999V378.3499999999999c0-56.925-46.12499999999999-103.05-102.99375-103.05zM437.6375 378.3499999999999v174.375c-113.45625-11.924999999999999-202.1625-106.76249999999999-202.1625-223.31250000000003A225.67499999999998 225.67499999999998 0 0 1 461.15 103.73749999999995c105.80625 0 193.6125 73.23750000000001 217.96875 171.5625H540.6312499999999c-56.86875 0-102.99375 46.12499999999999-102.99375 103.05z m482.62499999999994 480.59999999999997c0 33.91875-27.393749999999997 61.31250000000001-61.25625 61.31250000000001h-318.375a61.2 61.2 0 0 1-61.25625-61.31250000000001V378.3499999999999c0-33.91875 27.450000000000003-61.31250000000001 61.25625-61.31250000000001h318.375c33.8625 0 61.25625 27.393749999999997 61.25625 61.31250000000001v480.59999999999997z m-77.11875-259.53749999999997h-286.875a20.8125 20.8125 0 1 0 0 41.7375h286.875a20.8125 20.8125 0 1 0 0-41.7375z",
|
||||
"LocaleKey": "Menu.Sidebar.RoleMenuSetting",
|
||||
"CommandType": "Navigate",
|
||||
"CommandParameter": "RoleMenuSetting",
|
||||
"PageActions": [ "edit", "delete" ]
|
||||
},
|
||||
{
|
||||
"Key": "UserManagement",
|
||||
"Icon": "M423.535859 640.663936a282.456786 282.456786 0 1 1 199.706688-82.737112 280.586727 280.586727 0 0 1-199.706688 82.737112z m0-481.799851c-109.917896 0-199.330078 89.412182-199.330078 199.330079s89.412182 199.330078 199.330078 199.330078 199.278132-89.399196 199.278133-199.304105-89.373223-199.330078-199.278133-199.330079z M805.495353 1024H41.56338a41.55686 41.55686 0 0 1-41.556861-41.55686 423.52934 423.52934 0 1 1 847.045694 0 41.55686 41.55686 0 0 1-41.55686 41.55686z m-719.829755-83.113721h675.727536c-20.648565-168.084514-164.318423-298.689934-337.857275-298.689934s-317.221697 130.592434-337.870261 298.689934zM752.263612 583.185603a41.55686 41.55686 0 0 1-10.85673-81.672217 213.264613 213.264613 0 0 0 157.02-205.485688c0-117.411117-95.50286-212.913977-212.97891-212.913977a213.23864 213.23864 0 0 0-62.620994 9.337307 41.55686 41.55686 0 1 1-24.349723-79.373603 296.09263 296.09263 0 0 1 383.102307 283.015205c0 133.358562-89.801778 250.860585-218.381301 285.703416a41.55686 41.55686 0 0 1-10.934649 1.389557z M1089.030019 981.430191h-138.955752a41.55686 41.55686 0 0 1 0-83.113721h95.035345a361.362874 361.362874 0 0 0-294.910857-314.455568 41.565951 41.565951 0 0 1 14.739699-81.815069 445.190854 445.190854 0 0 1 365.648426 437.801525 41.55686 41.55686 0 0 1-41.556861 41.55686z",
|
||||
"LocaleKey": "Menu.Sidebar.UserManagement",
|
||||
"CommandType": "Navigate",
|
||||
"CommandParameter": "UserManagement",
|
||||
"PageActions": [ "add", "edit", "delete" ]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Key": "RealTime",
|
||||
"Icon": "M6.25,4 L17.75,4 C19.4830315,4 20.8992459,5.35645477 20.9948552,7.06557609 L21,7.25 L21,16.75 C21,18.4830315 19.6435452,19.8992459 17.9344239,19.9948552 L17.75,20 L6.25,20 C4.51696854,20 3.10075407,18.6435452 3.00514479,16.9344239 L3,16.75 L3,7.25 C3,5.51696854 4.35645477,4.10075407 6.06557609,4.00514479 L6.25,4 L17.75,4 L6.25,4 Z M17.75,5.5 L6.25,5.5 C5.3318266,5.5 4.57880766,6.20711027 4.5058012,7.10647279 L4.5,7.25 L4.5,16.75 C4.5,17.6681734 5.20711027,18.4211923 6.10647279,18.4941988 L6.25,18.5 L17.75,18.5 C18.6681734,18.5 19.4211923,17.7928897 19.4941988,16.8935272 L19.5,16.75 L19.5,7.25 C19.5,6.3318266 18.7928897,5.57880766 17.8935272,5.5058012 L17.75,5.5 Z M10.0527864,9.5854102 C10.1625594,9.3658642 10.4120593,9.26236922 10.639617,9.328815 L10.7236068,9.3618034 L15.1055728,11.5527864 C15.2023365,11.6011683 15.2807978,11.6796295 15.3291796,11.7763932 C15.4389526,11.9959392 15.3720486,12.2576361 15.1823574,12.3998148 L15.1055728,12.4472136 L10.7236068,14.6381966 C10.6541791,14.6729105 10.5776225,14.690983 10.5,14.690983 C10.2545401,14.690983 10.0503916,14.5141078 10.0080557,14.2808586 L10,14.190983 L10,9.80901699 C10,9.73139445 10.0180725,9.65483791 10.0527864,9.5854102 Z",
|
||||
"LocaleKey": "Menu.Toolbar.RealTime",
|
||||
"Group": "Toolbar",
|
||||
"CommandType": "Active",
|
||||
"Items": [
|
||||
{
|
||||
"Key": "Logs",
|
||||
"Icon": "M269.844659 81.4308h44.821057v166.626082h-44.821057zM677.140966 491.719232c52.335426 0 102.092273 19.937769 140.105639 56.13883 38.126482 36.31053 60.461599 85.284073 62.891788 137.900467 2.5056 54.276658-16.27424 106.280032-52.881549 146.431672-36.60731 40.15164-86.65972 63.643469-140.936379 66.150285-3.180653 0.147174-6.401444 0.221369-9.576016 0.221369-52.341508 0-102.102004-19.936552-140.114153-56.136398-38.126482-36.309314-60.461599-85.284073-62.891789-137.902899-2.5056-54.276658 16.27424-106.280032 52.88155-146.431672 36.60731-40.15164 86.65972-63.643469 140.936379-66.149069a208.122961 208.122961 0 0 1 9.576016-0.221369h0.008514m-0.00973-44.822274c-3.859355 0-7.746684 0.088791-11.642528 0.268805-136.951744 6.3236-242.847422 122.470346-236.525038 259.422091 6.143586 133.0559 115.942406 236.793842 247.779562 236.793842 3.859355 0 7.747901-0.088791 11.642529-0.268804 136.951744-6.322384 242.847422-122.470346 236.525037-259.422091-6.143586-133.057117-115.942406-236.798708-247.779562-236.793843z M490.264524 891.110734a272.361206 272.361206 0 0 1-32.682275-37.369937H180.453104c-20.912034 0-37.927007-17.013757-37.927007-37.92579v-590.263526c0-20.912034 17.013757-37.927007 37.927007-37.927007H732.799354c20.912034 0 37.925791 17.013757 37.925791 37.927007V441.15597a268.605238 268.605238 0 0 1 44.821057 21.463023V225.551481c0-45.70045-37.047614-82.746848-82.746848-82.746849H180.453104c-45.70045 0-82.746848 37.047614-82.746848 82.746849v590.263526c0 45.70045 37.047614 82.746848 82.746848 82.746848h317.980164a273.587248 273.587248 0 0 1-8.168744-7.451121z M770.725145 489.61623a225.243754 225.243754 0 0 1 44.821057 27.231985v-0.21407a225.182938 225.182938 0 0 0-44.821057-27.114003v0.096088zM812.590566 778.530212H646.820768V576.105667h44.821057v157.604704h120.948741zM209.55091 380.121489h498.255687v44.821057H209.55091zM600.682445 81.4308h44.821058v166.626082h-44.821058zM406.842623 712.17437H209.55091v44.821057h203.864657a272.351476 272.351476 0 0 1-6.572944-44.821057zM450.941192 546.147929H209.55091v44.821057h217.435038a268.707408 268.707408 0 0 1 23.955244-44.821057z",
|
||||
"LocaleKey": "Menu.Sidebar.Logs",
|
||||
"CommandType": "Navigate",
|
||||
"CommandParameter": "Logs",
|
||||
"PageActions": [ "add", "edit", "delete" ]
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
{
|
||||
"Key": "BasicSettings",
|
||||
"Icon": "M25,21.75 C25,23.5449254 23.5449254,25 21.75,25 L6.25,25 C4.45507456,25 3,23.5449254 3,21.75 L3,6.25 C3,4.45507456 4.45507456,3 6.25,3 L21.75,3 C23.5449254,3 25,4.45507456 25,6.25 L25,21.75 Z M23.5,21.75 L23.5,6.25 C23.5,5.28350169 22.7164983,4.5 21.75,4.5 L6.25,4.5 C5.28350169,4.5 4.5,5.28350169 4.5,6.25 L4.5,21.75 C4.5,22.7164983 5.28350169,23.5 6.25,23.5 L21.75,23.5 C22.7164983,23.5 23.5,22.7164983 23.5,21.75 Z M19.75,14 C19.75,14.3796958 19.4678461,14.693491 19.1017706,14.7431534 L19,14.75 L9,14.75 C8.58578644,14.75 8.25,14.4142136 8.25,14 C8.25,13.6203042 8.53215388,13.306509 8.89822944,13.2568466 L9,13.25 L19,13.25 C19.4142136,13.25 19.75,13.5857864 19.75,14 Z M19.75,19.25 C19.75,19.6296958 19.4678461,19.943491 19.1017706,19.9931534 L19,20 L9,20 C8.58578644,20 8.25,19.6642136 8.25,19.25 C8.25,18.8703042 8.53215388,18.556509 8.89822944,18.5068466 L9,18.5 L19,18.5 C19.4142136,18.5 19.75,18.8357864 19.75,19.25 Z M19.75,8.75 C19.75,9.12969577 19.4678461,9.44349096 19.1017706,9.49315338 L19,9.5 L9,9.5 C8.58578644,9.5 8.25,9.16421356 8.25,8.75 C8.25,8.37030423 8.53215388,8.05650904 8.89822944,8.00684662 L9,8 L19,8 C19.4142136,8 19.75,8.33578644 19.75,8.75 Z",
|
||||
"LocaleKey": "Menu.Toolbar.BasicSettings",
|
||||
"Group": "Toolbar",
|
||||
"CommandType": "Active"
|
||||
},
|
||||
|
||||
{
|
||||
"Key": "Setting",
|
||||
"Icon": "M14 9.50006C11.5147 9.50006 9.5 11.5148 9.5 14.0001C9.5 16.4853 11.5147 18.5001 14 18.5001C15.3488 18.5001 16.559 17.9066 17.3838 16.9666C18.0787 16.1746 18.5 15.1365 18.5 14.0001C18.5 13.5401 18.431 13.0963 18.3028 12.6784C17.7382 10.8381 16.0253 9.50006 14 9.50006ZM11 14.0001C11 12.3432 12.3431 11.0001 14 11.0001C15.6569 11.0001 17 12.3432 17 14.0001C17 15.6569 15.6569 17.0001 14 17.0001C12.3431 17.0001 11 15.6569 11 14.0001Z M21.7093 22.3948L19.9818 21.6364C19.4876 21.4197 18.9071 21.4515 18.44 21.7219C17.9729 21.9924 17.675 22.4693 17.6157 23.0066L17.408 24.8855C17.3651 25.273 17.084 25.5917 16.7055 25.682C14.9263 26.1061 13.0725 26.1061 11.2933 25.682C10.9148 25.5917 10.6336 25.273 10.5908 24.8855L10.3834 23.0093C10.3225 22.4731 10.0112 21.9976 9.54452 21.7281C9.07783 21.4586 8.51117 21.4269 8.01859 21.6424L6.29071 22.4009C5.93281 22.558 5.51493 22.4718 5.24806 22.1859C4.00474 20.8536 3.07924 19.2561 2.54122 17.5137C2.42533 17.1384 2.55922 16.7307 2.8749 16.4977L4.40219 15.3703C4.83721 15.0501 5.09414 14.5415 5.09414 14.0007C5.09414 13.4598 4.83721 12.9512 4.40162 12.6306L2.87529 11.5051C2.55914 11.272 2.42513 10.8638 2.54142 10.4882C3.08038 8.74734 4.00637 7.15163 5.24971 5.82114C5.51684 5.53528 5.93492 5.44941 6.29276 5.60691L8.01296 6.36404C8.50793 6.58168 9.07696 6.54881 9.54617 6.27415C10.0133 6.00264 10.3244 5.52527 10.3844 4.98794L10.5933 3.11017C10.637 2.71803 10.9245 2.39704 11.3089 2.31138C12.19 2.11504 13.0891 2.01071 14.0131 2.00006C14.9147 2.01047 15.8128 2.11485 16.6928 2.31149C17.077 2.39734 17.3643 2.71823 17.4079 3.11017L17.617 4.98937C17.7116 5.85221 18.4387 6.50572 19.3055 6.50663C19.5385 6.507 19.769 6.45838 19.9843 6.36294L21.7048 5.60568C22.0626 5.44818 22.4807 5.53405 22.7478 5.81991C23.9912 7.1504 24.9172 8.74611 25.4561 10.487C25.5723 10.8623 25.4386 11.2703 25.1228 11.5035L23.5978 12.6297C23.1628 12.95 22.9 13.4586 22.9 13.9994C22.9 14.5403 23.1628 15.0489 23.5988 15.3698L25.1251 16.4965C25.441 16.7296 25.5748 17.1376 25.4586 17.5131C24.9198 19.2536 23.9944 20.8492 22.7517 22.1799C22.4849 22.4657 22.0671 22.5518 21.7093 22.3948ZM16.263 22.1966C16.4982 21.4685 16.9889 20.8288 17.6884 20.4238C18.5702 19.9132 19.6536 19.8547 20.5841 20.2627L21.9281 20.8526C22.791 19.8538 23.4593 18.7013 23.8981 17.4552L22.7095 16.5778L22.7086 16.5771C21.898 15.98 21.4 15.0277 21.4 13.9994C21.4 12.9719 21.8974 12.0195 22.7073 11.4227L22.7085 11.4218L23.8957 10.545C23.4567 9.2988 22.7881 8.14636 21.9248 7.1477L20.5922 7.73425L20.5899 7.73527C20.1844 7.91463 19.7472 8.00722 19.3039 8.00663C17.6715 8.00453 16.3046 6.77431 16.1261 5.15465L16.1259 5.15291L15.9635 3.69304C15.3202 3.57328 14.6677 3.50872 14.013 3.50017C13.3389 3.50891 12.6821 3.57367 12.0377 3.69328L11.8751 5.15452C11.7625 6.16272 11.1793 7.05909 10.3019 7.56986C9.41937 8.0856 8.34453 8.14844 7.40869 7.73694L6.07273 7.14893C5.20949 8.14751 4.54092 9.29983 4.10196 10.5459L5.29181 11.4233C6.11115 12.0269 6.59414 12.9837 6.59414 14.0007C6.59414 15.0173 6.11142 15.9742 5.29237 16.5776L4.10161 17.4566C4.54002 18.7044 5.2085 19.8585 6.07205 20.8587L7.41742 20.2682C8.34745 19.8613 9.41573 19.9215 10.2947 20.4292C11.174 20.937 11.7593 21.832 11.8738 22.84L11.8744 22.8445L12.0362 24.3088C13.3326 24.5638 14.6662 24.5638 15.9626 24.3088L16.1247 22.8418C16.1491 22.6217 16.1955 22.4055 16.263 22.1966Z",
|
||||
"LocaleKey": "Menu.Settings",
|
||||
"Group": "Settings",
|
||||
"Items": [
|
||||
{
|
||||
"Key": "Languages",
|
||||
"LocaleKey": "Menu.Settings.Language",
|
||||
"Items": [
|
||||
{
|
||||
"Key": "en-US",
|
||||
"LocaleKey": "English",
|
||||
"CommandType": "SwitchLanguage",
|
||||
"CommandParameter": "en-US"
|
||||
},
|
||||
{
|
||||
"Key": "zh-CN",
|
||||
"LocaleKey": "简体中文",
|
||||
"CommandType": "SwitchLanguage",
|
||||
"CommandParameter": "zh-CN"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"Key": "Themes",
|
||||
"Icon": "M37.75,8 C38.9926407,8 40,9.00735931 40,10.25 L40,15.75 C40,16.9079464 39.1252778,17.8615904 38.0005597,17.9862059 L38,35.75 C38,38.0281746 36.207493,39.8876867 33.9559163,39.9950991 L33.75,40 L14.25,40 C11.9718254,40 10.1123133,38.207493 10.0049009,35.9559163 L10,35.75 L10.0004396,17.9863164 C8.87524032,17.8621552 8,16.9082892 8,15.75 L8,10.25 C8,9.00735931 9.00735931,8 10.25,8 L37.75,8 Z M35.5,18 L12.5,18 L12.5,35.75 C12.5,36.6681734 13.2071103,37.4211923 14.1064728,37.4941988 L14.25,37.5 L33.75,37.5 C34.6681734,37.5 35.4211923,36.7928897 35.4941988,35.8935272 L35.5,35.75 L35.5,18 Z M20.25,22.5 L26.75,22.5 C27.4403559,22.5 28,23.0596441 28,23.75 C28,24.3972087 27.5081253,24.9295339 26.8778052,24.9935464 L26.75,25 L20.25,25 C19.5596441,25 19,24.4403559 19,23.75 C19,23.1027913 19.4918747,22.5704661 20.1221948,22.5064536 L20.25,22.5 L26.75,22.5 L20.25,22.5 Z M37.5,10.5 L10.5,10.5 L10.5,15.5 L37.5,15.5 L37.5,10.5 Z",
|
||||
"LocaleKey": "Menu.Settings.Theme",
|
||||
"Items": [
|
||||
{
|
||||
"Key": "Theme.Default",
|
||||
"LocaleKey": "Menu.Settings.Theme.Default",
|
||||
"CommandType": "SwitchTheme",
|
||||
"CommandParameter": "Default"
|
||||
},
|
||||
{
|
||||
"Key": "Theme.Dark",
|
||||
"LocaleKey": "Menu.Settings.Theme.Dark",
|
||||
"CommandType": "SwitchTheme",
|
||||
"CommandParameter": "Dark"
|
||||
},
|
||||
{
|
||||
"Key": "Theme.Desert",
|
||||
"LocaleKey": "Menu.Settings.Theme.Desert",
|
||||
"CommandType": "SwitchTheme",
|
||||
"CommandParameter": "Desert"
|
||||
},
|
||||
{
|
||||
"Key": "Theme.Dusk",
|
||||
"LocaleKey": "Menu.Settings.Theme.Dusk",
|
||||
"CommandType": "SwitchTheme",
|
||||
"CommandParameter": "Dusk"
|
||||
},
|
||||
{
|
||||
"Key": "Theme.NightSky",
|
||||
"LocaleKey": "Menu.Settings.Theme.NightSky",
|
||||
"CommandType": "SwitchTheme",
|
||||
"CommandParameter": "NightSky"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"Key": "About",
|
||||
"Icon": "M37.75,8 C38.9926407,8 40,9.00735931 40,10.25 L40,15.75 C40,16.9079464 39.1252778,17.8615904 38.0005597,17.9862059 L38,35.75 C38,38.0281746 36.207493,39.8876867 33.9559163,39.9950991 L33.75,40 L14.25,40 C11.9718254,40 10.1123133,38.207493 10.0049009,35.9559163 L10,35.75 L10.0004396,17.9863164 C8.87524032,17.8621552 8,16.9082892 8,15.75 L8,10.25 C8,9.00735931 9.00735931,8 10.25,8 L37.75,8 Z M35.5,18 L12.5,18 L12.5,35.75 C12.5,36.6681734 13.2071103,37.4211923 14.1064728,37.4941988 L14.25,37.5 L33.75,37.5 C34.6681734,37.5 35.4211923,36.7928897 35.4941988,35.8935272 L35.5,35.75 L35.5,18 Z M20.25,22.5 L26.75,22.5 C27.4403559,22.5 28,23.0596441 28,23.75 C28,24.3972087 27.5081253,24.9295339 26.8778052,24.9935464 L26.75,25 L20.25,25 C19.5596441,25 19,24.4403559 19,23.75 C19,23.1027913 19.4918747,22.5704661 20.1221948,22.5064536 L20.25,22.5 L26.75,22.5 L20.25,22.5 Z M37.5,10.5 L10.5,10.5 L10.5,15.5 L37.5,15.5 L37.5,10.5 Z",
|
||||
"LocaleKey": "Menu.Settings.About",
|
||||
"CommandType": "Link",
|
||||
"CommandParameter": "https://www.kdocs.cn/l/ce5jHrpwH9Eg"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
138
Cowain.TestProject/Cowain.TestProject.csproj
Normal file
138
Cowain.TestProject/Cowain.TestProject.csproj
Normal file
@@ -0,0 +1,138 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\Directory.Version.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
<Company>Cowain Zhusenlin</Company>
|
||||
<Product>Cowain WCS</Product>
|
||||
<!-- 避免自动添加 git 修订号(.NET 8+ 需注意) -->
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
<Folder Include="Configs\DB\" />
|
||||
<Folder Include="Migrations\" />
|
||||
<Folder Include="Plugins\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fody">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MethodBoundaryAspect.Fody" />
|
||||
<PackageReference Include="Avalonia" />
|
||||
<PackageReference Include="Avalonia.Desktop" />
|
||||
<PackageReference Include="Avalonia.Controls.ItemsRepeater" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="NetSparkleUpdater.SparkleUpdater" />
|
||||
<PackageReference Include="NetSparkleUpdater.UI.Avalonia" />
|
||||
<PackageReference Include="NodifyAvalonia" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Include="Avalonia.Diagnostics">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" />
|
||||
<PackageReference Include="Semi.Avalonia" />
|
||||
<PackageReference Include="Semi.Avalonia.ColorPicker" />
|
||||
<PackageReference Include="Semi.Avalonia.DataGrid" />
|
||||
<PackageReference Include="Irihi.Ursa" />
|
||||
<PackageReference Include="Irihi.Ursa.Themes.Semi" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" />
|
||||
<PackageReference Include="Serilog" />
|
||||
<PackageReference Include="Serilog.Extensions.Hosting" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" />
|
||||
<PackageReference Include="Serilog.Sinks.File" />
|
||||
<PackageReference Include="Serilog.Sinks.MSSqlServer" />
|
||||
<PackageReference Include="Serilog.Sinks.MySQL" />
|
||||
<PackageReference Include="Serilog.Sinks.PostgreSQL" />
|
||||
<PackageReference Include="Serilog.Sinks.SQLite" />
|
||||
<PackageReference Include="Xaml.Behaviors.Avalonia" />
|
||||
<PackageReference Include="Xaml.Behaviors.Interactivity" />
|
||||
<!--<PackageReference Include="HslCommunication" />-->
|
||||
<!--<PackageReference Include="OpcUaHelper" />-->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Cowain.Base\Cowain.Base.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- 定义需要复制的文件 -->
|
||||
<ItemGroup>
|
||||
<None Include="Configs\**\*.*" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
<None Include="Plugins\**\*.*" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AvaloniaXaml Remove="Converters\**" />
|
||||
<Compile Remove="Converters\**" />
|
||||
<EmbeddedResource Remove="Converters\**" />
|
||||
<None Remove="Converters\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AvaloniaXaml Remove="Assets\ToggleSwitch.axaml" />
|
||||
<AvaloniaXaml Remove="Assets\_index.axaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\i18n\zh-CN.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Update="Assets\ToggleSwitch.axaml">
|
||||
<SubType>Designer</SubType>
|
||||
</AvaloniaResource>
|
||||
<AvaloniaResource Update="Assets\_index.axaml">
|
||||
<SubType>Designer</SubType>
|
||||
</AvaloniaResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\Admin\RoleMenuSettingView.axaml.cs">
|
||||
<DependentUpon>RoleMenuSettingView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\Admin\UserEditDialog.axaml.cs">
|
||||
<DependentUpon>UserEditDialog.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\Admin\UserRoleMenuDialog.axaml.cs">
|
||||
<DependentUpon>UserRoleMenuDialog.axaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Configs\menus.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- 自定义目标:在构建和发布时复制文件并保留目录结构 -->
|
||||
<Target Name="CopyResourcesOnBuildAndPublish" AfterTargets="Build;Publish">
|
||||
<ItemGroup>
|
||||
<ResourcesToCopy Include="\Configs\**\*.*" />
|
||||
<ResourcesToCopy Include="\Plugins\**\*.*" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(ResourcesToCopy)" DestinationFolder="$(OutputPath)\%(RecursiveDir)" SkipUnchangedFiles="true" />
|
||||
<Copy SourceFiles="@(ResourcesToCopy)" DestinationFolder="$(PublishDir)\%(RecursiveDir)" SkipUnchangedFiles="true" Condition="'$(PublishDir)' != ''" />
|
||||
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
169
Cowain.TestProject/DBContext/DBContextGenerator.cs
Normal file
169
Cowain.TestProject/DBContext/DBContextGenerator.cs
Normal file
@@ -0,0 +1,169 @@
|
||||
using Avalonia.Controls;
|
||||
using Cowain.Base.DBContext;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.Models;
|
||||
using Cowain.TestProject.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using static Azure.Core.HttpHeader;
|
||||
|
||||
namespace Cowain.TestProject.DBContext;
|
||||
|
||||
/// <summary>
|
||||
/// 数据库生成使用,代码中不要使用,不要注入到容器
|
||||
/// </summary>
|
||||
public class DBContextGenerator : DbContext
|
||||
{
|
||||
private readonly string? _dbType;
|
||||
private IConfiguration? _configuration;
|
||||
private List<Assembly>? _assemblies;
|
||||
public DBContextGenerator()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(AppContext.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.Build();
|
||||
_configuration = configuration;
|
||||
_dbType = configuration.GetSection("Database")["db"];
|
||||
_assemblies = [.. GetAssembliesFromPluginDirectory()];
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_dbType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!Enum.TryParse<DataBaseType>(_dbType.ToUpper(), out var cmdType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_configuration == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (cmdType)
|
||||
{
|
||||
case DataBaseType.SQLITE:
|
||||
var SqlLite_connection = _configuration.GetConnectionString("SqlLiteConn");
|
||||
options.UseSqlite(SqlLite_connection);
|
||||
break;
|
||||
case DataBaseType.SQLSERVER:
|
||||
var SqlServer_connection = _configuration.GetConnectionString("SqlServerConn");
|
||||
options.UseSqlServer(SqlServer_connection);
|
||||
break;
|
||||
case DataBaseType.MYSQL:
|
||||
var MySql_connection = _configuration.GetConnectionString("MySqlConn");
|
||||
options.UseMySql(MySql_connection, new MySqlServerVersion(new Version(8, 0, 26)));
|
||||
break;
|
||||
case DataBaseType.POSTGRES:
|
||||
var Postgres_connection = _configuration.GetConnectionString("PostGresConn");
|
||||
options.UseNpgsql(Postgres_connection);
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
||||
break;
|
||||
}
|
||||
options.ConfigureWarnings(warnings => warnings.Ignore(RelationalEventId.PendingModelChangesWarning));
|
||||
options.EnableSensitiveDataLogging();
|
||||
}
|
||||
|
||||
override protected void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
MapModelEntities(modelBuilder);
|
||||
DataSeeding(modelBuilder);
|
||||
base.OnModelCreating(modelBuilder);
|
||||
modelBuilder.Ignore<SerilogDto>();
|
||||
}
|
||||
/// <summary>
|
||||
/// Auto data seeding
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder">ModelBuilder</param>
|
||||
private void DataSeeding(ModelBuilder modelBuilder)
|
||||
{
|
||||
var baseModelType = typeof(IDataSeeding);
|
||||
var entityTypes = _assemblies?
|
||||
.SelectMany(assembly => assembly.GetTypes())
|
||||
.Where(t => t.IsClass && !t.IsAbstract && baseModelType.IsAssignableFrom(t));
|
||||
if (entityTypes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (var type in entityTypes)
|
||||
{
|
||||
var instance = Activator.CreateInstance(type) as IDataSeeding;
|
||||
instance?.DataSeeding(modelBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Auto Mapping Entity
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder">ModelBuilder</param>
|
||||
private void MapModelEntities(ModelBuilder modelBuilder)
|
||||
{
|
||||
var baseModelType = typeof(BaseModel);
|
||||
var entityTypes = _assemblies?
|
||||
.SelectMany(assembly => assembly.GetTypes())
|
||||
.Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(baseModelType));
|
||||
if (entityTypes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (var type in entityTypes)
|
||||
{
|
||||
modelBuilder.Model.AddEntityType(type);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all assemblies including those in the plugin directory
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable<Assembly></returns>
|
||||
private IEnumerable<Assembly> GetAssembliesFromPluginDirectory()
|
||||
{
|
||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
|
||||
var pluginPath = Path.Combine(AppContext.BaseDirectory, "Plugins");
|
||||
// 处理加载失败的情况
|
||||
if (Directory.Exists(pluginPath))
|
||||
{
|
||||
var pluginAssemblies = Directory.GetFiles(pluginPath, "Plugin.*.dll", SearchOption.AllDirectories)
|
||||
.Select(Assembly.LoadFrom);
|
||||
assemblies.AddRange(pluginAssemblies);
|
||||
}
|
||||
return assemblies;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create DbSet
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Entity</typeparam>
|
||||
/// <returns></returns>
|
||||
public virtual DbSet<T> GetDbSet<T>() where T : class
|
||||
{
|
||||
if (Model.FindEntityType(typeof(T)) != null)
|
||||
{
|
||||
return Set<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"type {typeof(T).Name} is not add into DbContext ");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// over write EnsureCreated
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EnsureCreated()
|
||||
{
|
||||
return Database.EnsureCreated();
|
||||
}
|
||||
}
|
||||
3
Cowain.TestProject/FodyWeavers.xml
Normal file
3
Cowain.TestProject/FodyWeavers.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<MethodBoundaryAspect />
|
||||
</Weavers>
|
||||
464
Cowain.TestProject/Migrations/20260122065225_init.Designer.cs
generated
Normal file
464
Cowain.TestProject/Migrations/20260122065225_init.Designer.cs
generated
Normal file
@@ -0,0 +1,464 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260122065225_init")]
|
||||
partial class init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 22, 14, 52, 24, 945, DateTimeKind.Local).AddTicks(547),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 22, 14, 52, 24, 949, DateTimeKind.Local).AddTicks(9102),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
297
Cowain.TestProject/Migrations/20260122065225_init.cs
Normal file
297
Cowain.TestProject/Migrations/20260122065225_init.cs
Normal file
@@ -0,0 +1,297 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "alarm_group",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_alarm_group", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "alarm_history",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
TagId = table.Column<int>(type: "int", nullable: false),
|
||||
Desc = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Group = table.Column<int>(type: "int", nullable: false),
|
||||
Level = table.Column<int>(type: "int", nullable: false),
|
||||
Status = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
StartTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
StopTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_alarm_history", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "alarm_level",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Color = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_alarm_level", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "device",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DeviceName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DriverName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DeviceType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Param = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Desc = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Enable = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_device", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tag_address",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DeviceId = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Address = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Desc = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DataType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ArrayCount = table.Column<int>(type: "int", nullable: false),
|
||||
OperMode = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AlarmEnable = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
AlarmValue = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AlarmGroup = table.Column<int>(type: "int", nullable: false),
|
||||
AlarmLevel = table.Column<int>(type: "int", nullable: false),
|
||||
AlarmMsg = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Json = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_tag_address", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "user",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
UserNumber = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Phone = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
RoleId = table.Column<int>(type: "int", nullable: false),
|
||||
Sex = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Password = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsValid = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_user", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "user_role",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
RoleName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
IsValid = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_user_role", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "user_role_menu",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
RoleId = table.Column<int>(type: "int", nullable: false),
|
||||
MenuKey = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
MenuActions = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_user_role_menu", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "var_action",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DeviceId = table.Column<int>(type: "int", nullable: false),
|
||||
TagId = table.Column<int>(type: "int", nullable: false),
|
||||
ActionName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Param = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Desc = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ActionValue = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Condition = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_var_action", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "alarm_group",
|
||||
columns: new[] { "Id", "Name" },
|
||||
values: new object[] { 1, "系统" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "alarm_level",
|
||||
columns: new[] { "Id", "Color", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "Red", "报警" },
|
||||
{ 2, "Yellow", "警告" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "tag_address",
|
||||
columns: new[] { "Id", "Address", "AlarmEnable", "AlarmGroup", "AlarmLevel", "AlarmMsg", "AlarmValue", "ArrayCount", "DataType", "Desc", "DeviceId", "Json", "Name", "OperMode" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "ns=4;s=L1RSTemp_Output1[0]", false, 0, 0, "", "", 1, "Int16", "Tag1", 1, "", "Tag1", "Read" },
|
||||
{ 2, "ns=4;s=L1RSTemp_Output1[1]", false, 0, 0, "", "", 1, "Int16", "Tag2", 1, "", "Tag2", "Read" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "user",
|
||||
columns: new[] { "Id", "CreateTime", "IsValid", "Name", "Password", "Phone", "RoleId", "Sex", "UpdateTime", "UserNumber" },
|
||||
values: new object[] { 1, new DateTime(2026, 1, 22, 14, 52, 24, 945, DateTimeKind.Local).AddTicks(547), true, "admin", "F44DDAC49CE7A95D", "17625760609", 1, "Male", new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "CWA4483" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "user_role",
|
||||
columns: new[] { "Id", "CreateTime", "IsValid", "RoleName", "UpdateTime" },
|
||||
values: new object[] { 1, new DateTime(2026, 1, 22, 14, 52, 24, 949, DateTimeKind.Local).AddTicks(9102), true, "管理员", new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "user_role_menu",
|
||||
columns: new[] { "Id", "MenuActions", "MenuKey", "RoleId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "[]", "Home", 1 },
|
||||
{ 2, "[ \"add\", \"edit\", \"delete\"]", "UserRoleSetting", 1 },
|
||||
{ 3, "[ \"edit\", \"delete\"]", "RoleMenuSetting", 1 },
|
||||
{ 4, "[ \"add\", \"edit\", \"delete\"]", "UserManagement", 1 }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "alarm_group");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "alarm_history");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "alarm_level");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "device");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tag_address");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "user");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "user_role");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "user_role_menu");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "var_action");
|
||||
}
|
||||
}
|
||||
}
|
||||
621
Cowain.TestProject/Migrations/20260124082311_baking_model.Designer.cs
generated
Normal file
621
Cowain.TestProject/Migrations/20260124082311_baking_model.Designer.cs
generated
Normal file
@@ -0,0 +1,621 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260124082311_baking_model")]
|
||||
partial class baking_model
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 24, 16, 23, 11, 270, DateTimeKind.Local).AddTicks(5712),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 24, 16, 23, 11, 280, DateTimeKind.Local).AddTicks(5323),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
|
||||
b.UseTptMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletStatusDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_status");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Desc = "新托盘",
|
||||
Name = "New"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Desc = "上料中",
|
||||
Name = "Loading"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.HasBaseType("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.HasOne("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", null)
|
||||
.WithOne()
|
||||
.HasForeignKey("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", "Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
170
Cowain.TestProject/Migrations/20260124082311_baking_model.cs
Normal file
170
Cowain.TestProject/Migrations/20260124082311_baking_model.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class baking_model : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "battery_info",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Code = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PalletId = table.Column<int>(type: "int", nullable: false),
|
||||
IsWaterBattery = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
ScanTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_battery_info", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "pallet_info",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Code = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PalletStatus = table.Column<int>(type: "int", nullable: false),
|
||||
StationId = table.Column<int>(type: "int", nullable: false),
|
||||
LoadingStartTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
LoadingEndTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
BakingStartTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
BakingEndTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
UnLoadingTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
WaterValue = table.Column<double>(type: "double", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_pallet_info", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "pallet_status",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Desc = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_pallet_status", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "station_info",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LayOutX = table.Column<int>(type: "int", nullable: false),
|
||||
LayOutY = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_station_info", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "pallet_info_history",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_pallet_info_history", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_pallet_info_history_pallet_info_Id",
|
||||
column: x => x.Id,
|
||||
principalTable: "pallet_info",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "pallet_status",
|
||||
columns: new[] { "Id", "Desc", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "新托盘", "New" },
|
||||
{ 2, "上料中", "Loading" }
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 24, 16, 23, 11, 270, DateTimeKind.Local).AddTicks(5712));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 24, 16, 23, 11, 280, DateTimeKind.Local).AddTicks(5323));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "battery_info");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "pallet_status");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "station_info");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "pallet_info");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 22, 14, 52, 24, 945, DateTimeKind.Local).AddTicks(547));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 22, 14, 52, 24, 949, DateTimeKind.Local).AddTicks(9102));
|
||||
}
|
||||
}
|
||||
}
|
||||
717
Cowain.TestProject/Migrations/20260126032551_baking_model_edit.Designer.cs
generated
Normal file
717
Cowain.TestProject/Migrations/20260126032551_baking_model_edit.Designer.cs
generated
Normal file
@@ -0,0 +1,717 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260126032551_baking_model_edit")]
|
||||
partial class baking_model_edit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 11, 25, 51, 148, DateTimeKind.Local).AddTicks(7643),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 11, 25, 51, 165, DateTimeKind.Local).AddTicks(2827),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletStatusDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_status");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Desc = "新托盘",
|
||||
Name = "New"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Desc = "上料中",
|
||||
Name = "Loading"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class baking_model_edit : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_pallet_info_history_pallet_info_Id",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreateTime",
|
||||
table: "pallet_info");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "pallet_info_history",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "BakingEndTime",
|
||||
table: "pallet_info_history",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "BakingStartTime",
|
||||
table: "pallet_info_history",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Code",
|
||||
table: "pallet_info_history",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: false,
|
||||
defaultValue: "")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "HistoryTime",
|
||||
table: "pallet_info_history",
|
||||
type: "datetime(6)",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "LoadingEndTime",
|
||||
table: "pallet_info_history",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "LoadingStartTime",
|
||||
table: "pallet_info_history",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info_history",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "StationId",
|
||||
table: "pallet_info_history",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UnLoadingTime",
|
||||
table: "pallet_info_history",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UpdateTime",
|
||||
table: "pallet_info_history",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info_history",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BindingId",
|
||||
table: "pallet_info",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "WaterValue",
|
||||
table: "battery_info",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "baking_info",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
BindingId = table.Column<int>(type: "int", nullable: false),
|
||||
TagId = table.Column<int>(type: "int", nullable: false),
|
||||
DataValue = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_baking_info", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "baking_variable",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
StationId = table.Column<int>(type: "int", nullable: false),
|
||||
TagId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_baking_variable", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "pallet_binding",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PalletId = table.Column<int>(type: "int", nullable: false),
|
||||
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_pallet_binding", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 11, 25, 51, 148, DateTimeKind.Local).AddTicks(7643));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 11, 25, 51, 165, DateTimeKind.Local).AddTicks(2827));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "baking_info");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "baking_variable");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "pallet_binding");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BakingEndTime",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BakingStartTime",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Code",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HistoryTime",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LoadingEndTime",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LoadingStartTime",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StationId",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UnLoadingTime",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdateTime",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BindingId",
|
||||
table: "pallet_info");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WaterValue",
|
||||
table: "battery_info");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "pallet_info_history",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "CreateTime",
|
||||
table: "pallet_info",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 24, 16, 23, 11, 270, DateTimeKind.Local).AddTicks(5712));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 24, 16, 23, 11, 280, DateTimeKind.Local).AddTicks(5323));
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_pallet_info_history_pallet_info_Id",
|
||||
table: "pallet_info_history",
|
||||
column: "Id",
|
||||
principalTable: "pallet_info",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
714
Cowain.TestProject/Migrations/20260126052708_pallet_edit.Designer.cs
generated
Normal file
714
Cowain.TestProject/Migrations/20260126052708_pallet_edit.Designer.cs
generated
Normal file
@@ -0,0 +1,714 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260126052708_pallet_edit")]
|
||||
partial class pallet_edit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 13, 27, 8, 455, DateTimeKind.Local).AddTicks(9319),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 13, 27, 8, 461, DateTimeKind.Local).AddTicks(1704),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletStatusDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_status");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Desc = "新托盘",
|
||||
Name = "New"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Desc = "上料中",
|
||||
Name = "Loading"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Cowain.TestProject/Migrations/20260126052708_pallet_edit.cs
Normal file
57
Cowain.TestProject/Migrations/20260126052708_pallet_edit.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class pallet_edit : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdateTime",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 27, 8, 455, DateTimeKind.Local).AddTicks(9319));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 27, 8, 461, DateTimeKind.Local).AddTicks(1704));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UpdateTime",
|
||||
table: "pallet_info_history",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 11, 25, 51, 148, DateTimeKind.Local).AddTicks(7643));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 11, 25, 51, 165, DateTimeKind.Local).AddTicks(2827));
|
||||
}
|
||||
}
|
||||
}
|
||||
714
Cowain.TestProject/Migrations/20260126052919_pallet_water_value.Designer.cs
generated
Normal file
714
Cowain.TestProject/Migrations/20260126052919_pallet_water_value.Designer.cs
generated
Normal file
@@ -0,0 +1,714 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260126052919_pallet_water_value")]
|
||||
partial class pallet_water_value
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 13, 29, 18, 736, DateTimeKind.Local).AddTicks(5446),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 13, 29, 18, 741, DateTimeKind.Local).AddTicks(3327),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletStatusDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_status");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Desc = "新托盘",
|
||||
Name = "New"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Desc = "上料中",
|
||||
Name = "Loading"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class pallet_water_value : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info_history",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(double),
|
||||
oldType: "double")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(double),
|
||||
oldType: "double")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 29, 18, 736, DateTimeKind.Local).AddTicks(5446));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 29, 18, 741, DateTimeKind.Local).AddTicks(3327));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<double>(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info_history",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<double>(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 27, 8, 455, DateTimeKind.Local).AddTicks(9319));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 27, 8, 461, DateTimeKind.Local).AddTicks(1704));
|
||||
}
|
||||
}
|
||||
}
|
||||
716
Cowain.TestProject/Migrations/20260126053117_pallet_water_value_maxlength.Designer.cs
generated
Normal file
716
Cowain.TestProject/Migrations/20260126053117_pallet_water_value_maxlength.Designer.cs
generated
Normal file
@@ -0,0 +1,716 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260126053117_pallet_water_value_maxlength")]
|
||||
partial class pallet_water_value_maxlength
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 13, 31, 17, 455, DateTimeKind.Local).AddTicks(4003),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 13, 31, 17, 460, DateTimeKind.Local).AddTicks(6222),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletStatusDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_status");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Desc = "新托盘",
|
||||
Name = "New"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Desc = "上料中",
|
||||
Name = "Loading"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class pallet_water_value_maxlength : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 31, 17, 455, DateTimeKind.Local).AddTicks(4003));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 31, 17, 460, DateTimeKind.Local).AddTicks(6222));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(200)",
|
||||
oldMaxLength: 200,
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 29, 18, 736, DateTimeKind.Local).AddTicks(5446));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 29, 18, 741, DateTimeKind.Local).AddTicks(3327));
|
||||
}
|
||||
}
|
||||
}
|
||||
690
Cowain.TestProject/Migrations/20260126122513_palletinfo.Designer.cs
generated
Normal file
690
Cowain.TestProject/Migrations/20260126122513_palletinfo.Designer.cs
generated
Normal file
@@ -0,0 +1,690 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260126122513_palletinfo")]
|
||||
partial class palletinfo
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 20, 25, 13, 22, DateTimeKind.Local).AddTicks(9183),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 20, 25, 13, 34, DateTimeKind.Local).AddTicks(6570),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
148
Cowain.TestProject/Migrations/20260126122513_palletinfo.cs
Normal file
148
Cowain.TestProject/Migrations/20260126122513_palletinfo.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class palletinfo : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "pallet_status");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info_history",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BakingCount",
|
||||
table: "pallet_info_history",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BindingId",
|
||||
table: "pallet_info_history",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BakingCount",
|
||||
table: "pallet_info",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 20, 25, 13, 22, DateTimeKind.Local).AddTicks(9183));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 20, 25, 13, 34, DateTimeKind.Local).AddTicks(6570));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BakingCount",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BindingId",
|
||||
table: "pallet_info_history");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BakingCount",
|
||||
table: "pallet_info");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info_history",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "pallet_status",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Desc = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_pallet_status", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "pallet_status",
|
||||
columns: new[] { "Id", "Desc", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "新托盘", "New" },
|
||||
{ 2, "上料中", "Loading" }
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 31, 17, 455, DateTimeKind.Local).AddTicks(4003));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 13, 31, 17, 460, DateTimeKind.Local).AddTicks(6222));
|
||||
}
|
||||
}
|
||||
}
|
||||
692
Cowain.TestProject/Migrations/20260126124929_palletinfo_length.Designer.cs
generated
Normal file
692
Cowain.TestProject/Migrations/20260126124929_palletinfo_length.Designer.cs
generated
Normal file
@@ -0,0 +1,692 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260126124929_palletinfo_length")]
|
||||
partial class palletinfo_length
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 20, 49, 28, 660, DateTimeKind.Local).AddTicks(505),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 26, 20, 49, 28, 665, DateTimeKind.Local).AddTicks(3692),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("WaterValue")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class palletinfo_length : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info_history",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 20, 49, 28, 660, DateTimeKind.Local).AddTicks(505));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 20, 49, 28, 665, DateTimeKind.Local).AddTicks(3692));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info_history",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(200)",
|
||||
oldMaxLength: 200)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PalletStatus",
|
||||
table: "pallet_info",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(200)",
|
||||
oldMaxLength: 200)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 20, 25, 13, 22, DateTimeKind.Local).AddTicks(9183));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 20, 25, 13, 34, DateTimeKind.Local).AddTicks(6570));
|
||||
}
|
||||
}
|
||||
}
|
||||
699
Cowain.TestProject/Migrations/20260127070650_baking_mode_edit.Designer.cs
generated
Normal file
699
Cowain.TestProject/Migrations/20260127070650_baking_mode_edit.Designer.cs
generated
Normal file
@@ -0,0 +1,699 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260127070650_baking_mode_edit")]
|
||||
partial class baking_mode_edit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 27, 15, 6, 49, 534, DateTimeKind.Local).AddTicks(5788),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 27, 15, 6, 49, 543, DateTimeKind.Local).AddTicks(1528),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("Col")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Row")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
133
Cowain.TestProject/Migrations/20260127070650_baking_mode_edit.cs
Normal file
133
Cowain.TestProject/Migrations/20260127070650_baking_mode_edit.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class baking_mode_edit : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info_history",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "WaterValue",
|
||||
table: "battery_info",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(double),
|
||||
oldType: "double")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Status",
|
||||
table: "battery_info",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Col",
|
||||
table: "battery_info",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Row",
|
||||
table: "battery_info",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 27, 15, 6, 49, 534, DateTimeKind.Local).AddTicks(5788));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 27, 15, 6, 49, 543, DateTimeKind.Local).AddTicks(1528));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Col",
|
||||
table: "battery_info");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Row",
|
||||
table: "battery_info");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "WaterValue",
|
||||
table: "pallet_info_history",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(200)",
|
||||
oldMaxLength: 200,
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<double>(
|
||||
name: "WaterValue",
|
||||
table: "battery_info",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Status",
|
||||
table: "battery_info",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 20, 49, 28, 660, DateTimeKind.Local).AddTicks(505));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 26, 20, 49, 28, 665, DateTimeKind.Local).AddTicks(3692));
|
||||
}
|
||||
}
|
||||
}
|
||||
702
Cowain.TestProject/Migrations/20260127070916_baking_mode_lenght.Designer.cs
generated
Normal file
702
Cowain.TestProject/Migrations/20260127070916_baking_mode_lenght.Designer.cs
generated
Normal file
@@ -0,0 +1,702 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260127070916_baking_mode_lenght")]
|
||||
partial class baking_mode_lenght
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 27, 15, 9, 15, 656, DateTimeKind.Local).AddTicks(622),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 27, 15, 9, 15, 660, DateTimeKind.Local).AddTicks(9473),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("Col")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Row")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class baking_mode_lenght : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "WaterValue",
|
||||
table: "battery_info",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Status",
|
||||
table: "battery_info",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "DataValue",
|
||||
table: "baking_info",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 27, 15, 9, 15, 656, DateTimeKind.Local).AddTicks(622));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 27, 15, 9, 15, 660, DateTimeKind.Local).AddTicks(9473));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "WaterValue",
|
||||
table: "battery_info",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(200)",
|
||||
oldMaxLength: 200,
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Status",
|
||||
table: "battery_info",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(200)",
|
||||
oldMaxLength: 200,
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "DataValue",
|
||||
table: "baking_info",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(200)",
|
||||
oldMaxLength: 200,
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 27, 15, 6, 49, 534, DateTimeKind.Local).AddTicks(5788));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 27, 15, 6, 49, 543, DateTimeKind.Local).AddTicks(1528));
|
||||
}
|
||||
}
|
||||
}
|
||||
710
Cowain.TestProject/Migrations/20260128071034_baking_mode_station.Designer.cs
generated
Normal file
710
Cowain.TestProject/Migrations/20260128071034_baking_mode_station.Designer.cs
generated
Normal file
@@ -0,0 +1,710 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260128071034_baking_mode_station")]
|
||||
partial class baking_mode_station
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 28, 15, 10, 33, 689, DateTimeKind.Local).AddTicks(249),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 28, 15, 10, 33, 696, DateTimeKind.Local).AddTicks(8625),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("Col")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Row")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("StationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class baking_mode_station : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Enable",
|
||||
table: "station_info",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "StationCode",
|
||||
table: "station_info",
|
||||
type: "varchar(200)",
|
||||
maxLength: 200,
|
||||
nullable: false,
|
||||
defaultValue: "")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 28, 15, 10, 33, 689, DateTimeKind.Local).AddTicks(249));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 28, 15, 10, 33, 696, DateTimeKind.Local).AddTicks(8625));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Enable",
|
||||
table: "station_info");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StationCode",
|
||||
table: "station_info");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 27, 15, 9, 15, 656, DateTimeKind.Local).AddTicks(622));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 27, 15, 9, 15, 660, DateTimeKind.Local).AddTicks(9473));
|
||||
}
|
||||
}
|
||||
}
|
||||
716
Cowain.TestProject/Migrations/20260128080126_baking_mode_station_wh.Designer.cs
generated
Normal file
716
Cowain.TestProject/Migrations/20260128080126_baking_mode_station_wh.Designer.cs
generated
Normal file
@@ -0,0 +1,716 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260128080126_baking_mode_station_wh")]
|
||||
partial class baking_mode_station_wh
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 28, 16, 1, 26, 47, DateTimeKind.Local).AddTicks(4627),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 28, 16, 1, 26, 52, DateTimeKind.Local).AddTicks(3720),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("Col")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Row")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("Height")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("StationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("Width")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class baking_mode_station_wh : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Height",
|
||||
table: "station_info",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Width",
|
||||
table: "station_info",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 28, 16, 1, 26, 47, DateTimeKind.Local).AddTicks(4627));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 28, 16, 1, 26, 52, DateTimeKind.Local).AddTicks(3720));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Height",
|
||||
table: "station_info");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Width",
|
||||
table: "station_info");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 28, 15, 10, 33, 689, DateTimeKind.Local).AddTicks(249));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "user_role",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "CreateTime",
|
||||
value: new DateTime(2026, 1, 28, 15, 10, 33, 696, DateTimeKind.Local).AddTicks(8625));
|
||||
}
|
||||
}
|
||||
}
|
||||
713
Cowain.TestProject/Migrations/DBContextGeneratorModelSnapshot.cs
Normal file
713
Cowain.TestProject/Migrations/DBContextGeneratorModelSnapshot.cs
Normal file
@@ -0,0 +1,713 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Cowain.TestProject.DBContext;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Cowain.TestProject.Migrations
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
partial class DBContextGeneratorModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 28, 16, 1, 26, 47, DateTimeKind.Local).AddTicks(4627),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 28, 16, 1, 26, 52, DateTimeKind.Local).AddTicks(3720),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("Col")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Row")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("Height")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("StationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("Width")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
6
Cowain.TestProject/Models/LoginSuccessMessage.cs
Normal file
6
Cowain.TestProject/Models/LoginSuccessMessage.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||
using Cowain.TestProject.ViewModels.Admin;
|
||||
|
||||
namespace Cowain.TestProject.Models;
|
||||
|
||||
public class LoginSuccessMessage(UserItemViewModel result) : ValueChangedMessage<UserItemViewModel>(result);
|
||||
46
Cowain.TestProject/Services/AvaloniaExceptionMiddleware.cs
Normal file
46
Cowain.TestProject/Services/AvaloniaExceptionMiddleware.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Threading;
|
||||
using Cowain.Base.Helpers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.TestProject.Services;
|
||||
|
||||
public static class AvaloniaExceptionMiddleware
|
||||
{
|
||||
private static ILogger<App>? _logger;
|
||||
public static void Install(ILogger<App>? logger)
|
||||
{
|
||||
_logger = logger;
|
||||
// 1) 托管级:任意线程抛到崩溃
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
||||
Handle("AppDomain", e.ExceptionObject as Exception);
|
||||
|
||||
// 2) Task级:async void / 未 await 的Task
|
||||
TaskScheduler.UnobservedTaskException += (_, e) =>
|
||||
{
|
||||
Handle("TaskScheduler", e.Exception);
|
||||
e.SetObserved(); // 标记已处理,防止进程自杀
|
||||
};
|
||||
|
||||
// 3) Dispatcher级:UI 线程中的未捕获
|
||||
if (Application.Current != null)
|
||||
Dispatcher.UIThread.UnhandledException += (_, e) => // 使用 Dispatcher.UIThread 代替 Application.Current.Dispatcher
|
||||
{
|
||||
Handle("Dispatcher", e.Exception);
|
||||
e.Handled = true; // true=不继续冒泡
|
||||
};
|
||||
}
|
||||
|
||||
private static void Handle(string source, Exception? ex)
|
||||
{
|
||||
if (ex == null) return;
|
||||
// TODO: 统一写日志、弹窗、上报……
|
||||
var msg = $"[{source}] {ex}";
|
||||
_logger?.LogError(ex, msg);
|
||||
// 这里可以调自定义弹窗
|
||||
// new ErrorWindow(ex).ShowDialog(Application.Current?.MainWindow);
|
||||
}
|
||||
}
|
||||
17
Cowain.TestProject/Services/HarmonyOSFontCollection.cs
Normal file
17
Cowain.TestProject/Services/HarmonyOSFontCollection.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Avalonia.Media.Fonts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.TestProject.Services;
|
||||
|
||||
public sealed class HarmonyOSFontCollection : EmbeddedFontCollection
|
||||
{
|
||||
public HarmonyOSFontCollection() : base(
|
||||
new Uri("fonts:HarmonyOS Sans", UriKind.Absolute),
|
||||
new Uri("avares://Cowain.TestProject/Assets/Fonts", UriKind.Absolute))
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.IServices;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Cowain.TestProject.Services
|
||||
{
|
||||
public class InitializeDatabaseHostedService : IHostedService
|
||||
{
|
||||
private readonly IAccountService _accountService;
|
||||
private readonly ILogger<InitializeDatabaseHostedService> _logger;
|
||||
public InitializeDatabaseHostedService(IAccountService accountService, ILogger<InitializeDatabaseHostedService> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_accountService = accountService;
|
||||
}
|
||||
|
||||
public async Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await _accountService.CheckHealthAsync();
|
||||
_logger.LogInformation("Database Initialized Start");
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation("Database Initialized Stop");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
75
Cowain.TestProject/Services/LoggerConfigurationExtensions.cs
Normal file
75
Cowain.TestProject/Services/LoggerConfigurationExtensions.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using Cowain.Base.Models;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MySqlConnector;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using Serilog.Sinks.MSSqlServer;
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace Cowain.TestProject.Services;
|
||||
|
||||
public static class LoggerConfigurationExtensions
|
||||
{
|
||||
public static LoggerConfiguration ConfigureDatabaseSink(
|
||||
this LoggerConfiguration loggerConfig,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
var databaseType = configuration.GetSection("Database")["db"];
|
||||
if (string.IsNullOrEmpty(databaseType) || !Enum.TryParse<DataBaseType>(databaseType.ToUpper(), out var dbType))
|
||||
{
|
||||
return loggerConfig;
|
||||
}
|
||||
|
||||
return dbType switch
|
||||
{
|
||||
DataBaseType.MYSQL => ConfigureMySqlSink(loggerConfig, configuration),
|
||||
DataBaseType.SQLSERVER => ConfigureSqlServerSink(loggerConfig, configuration),
|
||||
DataBaseType.POSTGRES => ConfigurePostgreSqlSink(loggerConfig, configuration),
|
||||
DataBaseType.SQLITE => ConfigureSqliteSink(loggerConfig, configuration),
|
||||
_ => loggerConfig
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private static LoggerConfiguration ConfigureMySqlSink(LoggerConfiguration loggerConfig, IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration.GetConnectionString("MySqlConn");
|
||||
return loggerConfig.WriteTo.MySQL(
|
||||
connectionString: connectionString,
|
||||
tableName: "Logs",
|
||||
restrictedToMinimumLevel: LogEventLevel.Information
|
||||
);
|
||||
}
|
||||
|
||||
private static LoggerConfiguration ConfigureSqlServerSink(LoggerConfiguration loggerConfig, IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration.GetConnectionString("SqlServerConn");
|
||||
return loggerConfig.WriteTo.MSSqlServer(
|
||||
connectionString: connectionString,
|
||||
sinkOptions: new MSSqlServerSinkOptions
|
||||
{
|
||||
TableName = "Logs",
|
||||
AutoCreateSqlTable = true
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private static LoggerConfiguration ConfigurePostgreSqlSink(LoggerConfiguration loggerConfig, IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration.GetConnectionString("PostGresConn");
|
||||
return loggerConfig.WriteTo.PostgreSQL(connectionString: connectionString, tableName: "Logs",
|
||||
restrictedToMinimumLevel: LogEventLevel.Information);
|
||||
}
|
||||
|
||||
private static LoggerConfiguration ConfigureSqliteSink(LoggerConfiguration loggerConfig, IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration.GetConnectionString("SqlLiteConn");
|
||||
return loggerConfig.WriteTo.SQLite(
|
||||
sqliteDbPath: connectionString?.Replace("Data Source=", "").Trim(),
|
||||
tableName: "Logs"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
425
Cowain.TestProject/Services/ServiceCollectionExtensions.cs
Normal file
425
Cowain.TestProject/Services/ServiceCollectionExtensions.cs
Normal file
@@ -0,0 +1,425 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Cowain.Base.Abstractions.Navigation;
|
||||
using Cowain.Base.Abstractions.Plugin;
|
||||
using Cowain.Base.Attributes;
|
||||
using Cowain.Base.DBContext;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.IServices;
|
||||
using Cowain.Base.Models;
|
||||
using Cowain.Base.Models.Menu;
|
||||
using Ke.Bee.Localization.Extensions;
|
||||
using Ke.Bee.Localization.Options;
|
||||
using Ke.Bee.Localization.Providers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
|
||||
namespace Cowain.TestProject.Services;
|
||||
|
||||
public static class ConfigureServices
|
||||
{
|
||||
private static List<Assembly>? _assemblies;
|
||||
private static IOptions<AppSettings>? appSettings;
|
||||
private static MenuConfigurationContext? menuConfigurationContext;
|
||||
private static readonly List<IPlugin> _plugins = new();
|
||||
private static ILogger<App>? _logger;
|
||||
/// <summary>
|
||||
/// 注册服务
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection AddServices(this IServiceCollection services, IConfiguration configuration, ILogger<App>? logger)
|
||||
{
|
||||
_logger = logger;
|
||||
// 注册全局配置
|
||||
services.AddSettings();
|
||||
_assemblies = GetAssemblies();
|
||||
GlobalData.Instance.AddOrUpdate("Assemblies", _assemblies);
|
||||
services.AddMemoryCache();
|
||||
//注入configuration
|
||||
services.AddSingleton(configuration);
|
||||
services.AddSingleton<IMessenger, WeakReferenceMessenger>();
|
||||
// 注册数据库
|
||||
services.AddDbContextService(configuration);
|
||||
// 注册视图模型
|
||||
services.AddViewModels();
|
||||
// 注册应用菜单
|
||||
services.AddMenus();
|
||||
// 注册视图导航器
|
||||
services.AddSingleton<IViewNavigator, DefaultViewNavigator>();
|
||||
// 注册TransientAttribute
|
||||
services.AddTransientAttributes();
|
||||
// 注册SingletonAttribute
|
||||
services.AddSingletonAttributes();
|
||||
// 注册所有数据库服务
|
||||
services.AddDbServices();
|
||||
// 注册所有实现IHostedService的类
|
||||
services.AddHostedServices();
|
||||
//注册插件服务
|
||||
services.AddPlugins();
|
||||
// 注册本地化
|
||||
services.AddLocalization();
|
||||
return services;
|
||||
}
|
||||
private static List<Assembly> GetAssemblies()
|
||||
{
|
||||
string? pluginPath = appSettings?.Value.PluginPath;
|
||||
|
||||
// 获取当前已加载的程序集(使用FullName作为唯一标识)
|
||||
var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.ToDictionary(a => a.GetName().FullName);
|
||||
|
||||
// 创建结果列表,初始化为已加载的程序集
|
||||
var assemblies = new List<Assembly>(loadedAssemblies.Values);
|
||||
|
||||
// 加载插件程序集
|
||||
if (Directory.Exists(pluginPath))
|
||||
{
|
||||
var pluginFiles = Directory.GetFiles(pluginPath, "Plugin.*.dll", SearchOption.AllDirectories);
|
||||
foreach (var file in pluginFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 获取程序集名称而不加载它
|
||||
var assemblyName = AssemblyName.GetAssemblyName(file);
|
||||
|
||||
// 检查是否已加载同名程序集
|
||||
if (!loadedAssemblies.ContainsKey(assemblyName.FullName))
|
||||
{
|
||||
// 加载程序集并添加到结果列表
|
||||
var assembly = Assembly.LoadFrom(file);
|
||||
assemblies.Add(assembly);
|
||||
loadedAssemblies[assemblyName.FullName] = assembly;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理加载错误(例如,非程序集文件、版本冲突等)
|
||||
_logger?.LogError(ex, $"Error loading assembly from {file}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return assemblies;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册所有viewmodel
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddViewModels(this IServiceCollection services)
|
||||
{
|
||||
if (_assemblies == null)
|
||||
{
|
||||
return services;
|
||||
}
|
||||
var viewModelTypes = _assemblies.SelectMany(a => a.GetTypes())
|
||||
.Where(t => t.Name.EndsWith("ViewModel") && t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(ObservableObject)));
|
||||
foreach (var viewModelType in viewModelTypes)
|
||||
{
|
||||
try
|
||||
{
|
||||
services.AddTransient(viewModelType);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger?.LogError(ex, "ViewModel注入错误");
|
||||
}
|
||||
|
||||
}
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册全局配置
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddSettings(this IServiceCollection services)
|
||||
{
|
||||
appSettings = Options.Create(new AppSettings
|
||||
{
|
||||
OutputPath = Path.Combine(AppContext.BaseDirectory, "Output"),
|
||||
PluginPath = Path.Combine(AppContext.BaseDirectory, "Plugins")
|
||||
});
|
||||
services.AddSingleton(appSettings);
|
||||
GlobalData.Instance.AddOrUpdate("AppSettings", appSettings.Value);
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册数据库
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddDbContextService(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
var database_config = configuration.GetSection("Database")["db"];
|
||||
if (string.IsNullOrEmpty(database_config))
|
||||
{
|
||||
_logger?.LogError("未配置数据库");
|
||||
return services;
|
||||
}
|
||||
if (!Enum.TryParse<DataBaseType>(database_config.ToUpper(), out var cmdType))
|
||||
{
|
||||
return services;
|
||||
}
|
||||
// 配置EF Core日志过滤(针对9.0.0版本)
|
||||
services.AddLogging(loggingBuilder =>
|
||||
{
|
||||
// 过滤EF Core的Info级别日志,只记录Warning及以上
|
||||
loggingBuilder.AddFilter(
|
||||
"Microsoft.EntityFrameworkCore",
|
||||
LogLevel.Warning // 最低日志级别设为Warning
|
||||
);
|
||||
|
||||
// 专门过滤数据库命令日志(SQL执行语句等)
|
||||
loggingBuilder.AddFilter(
|
||||
"Microsoft.EntityFrameworkCore.Database.Command",
|
||||
LogLevel.Warning
|
||||
);
|
||||
});
|
||||
|
||||
services.AddPooledDbContextFactory<SqlDbContext>(options =>
|
||||
{
|
||||
switch (cmdType)
|
||||
{
|
||||
case DataBaseType.SQLITE:
|
||||
var SqlLite_connection = configuration.GetConnectionString("SqlLiteConn");
|
||||
options.UseSqlite(SqlLite_connection);
|
||||
break;
|
||||
case DataBaseType.SQLSERVER:
|
||||
var SqlServer_connection = configuration.GetConnectionString("SqlServerConn");
|
||||
options.UseSqlServer(SqlServer_connection);
|
||||
break;
|
||||
case DataBaseType.MYSQL:
|
||||
var MySql_connection = configuration.GetConnectionString("MySqlConn");
|
||||
options.UseMySql(MySql_connection, new MySqlServerVersion(new Version(8, 0, 26)));
|
||||
break;
|
||||
case DataBaseType.POSTGRES:
|
||||
var Postgres_connection = configuration.GetConnectionString("PostGresConn");
|
||||
options.UseNpgsql(Postgres_connection);
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
||||
break;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
options.EnableSensitiveDataLogging();
|
||||
#endif
|
||||
}, 100);
|
||||
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册应用菜单
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddMenus(this IServiceCollection services)
|
||||
{
|
||||
// 从配置文件读取菜单注入到 DI 容器
|
||||
var menuItems = JsonSerializer.Deserialize<List<MenuItem>>(
|
||||
File.ReadAllBytes(Path.Combine(AppContext.BaseDirectory, "Configs", "menus.json"))
|
||||
);
|
||||
menuConfigurationContext = new MenuConfigurationContext(menuItems);
|
||||
services.AddSingleton(menuConfigurationContext);
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册插件服务
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddPlugins(this IServiceCollection services)
|
||||
{
|
||||
if (_assemblies == null)
|
||||
{
|
||||
return services;
|
||||
}
|
||||
var pluginTypes = _assemblies.SelectMany(a => a.GetTypes())
|
||||
.Where(t => typeof(PluginBase).IsAssignableFrom(t) && !t.IsAbstract);
|
||||
foreach (var type in pluginTypes)
|
||||
{
|
||||
if (Activator.CreateInstance(type) is IPlugin plugin)
|
||||
{
|
||||
plugin.RegisterServices(services, _assemblies);
|
||||
//只是注入插件,不需要配置菜单
|
||||
//plugin.ConfigureMenu(menuConfigurationContext);
|
||||
_plugins.Add(plugin);
|
||||
}
|
||||
}
|
||||
return services;
|
||||
}
|
||||
public static void InitializePlugins(this IServiceProvider serviceProvider)
|
||||
{
|
||||
foreach (var plugin in _plugins)
|
||||
{
|
||||
plugin.Initialize(serviceProvider);
|
||||
}
|
||||
}
|
||||
public static void ShutDownPlugins(this IServiceProvider serviceProvider)
|
||||
{
|
||||
foreach (var plugin in _plugins)
|
||||
{
|
||||
plugin.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册所有数据库服务
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddDbServices(this IServiceCollection services)
|
||||
{
|
||||
if (_assemblies == null)
|
||||
{
|
||||
return services;
|
||||
}
|
||||
var types = _assemblies.SelectMany(a => a.GetTypes())
|
||||
.Where(t => typeof(IBaseService).IsAssignableFrom(t) && t != typeof(IBaseService));
|
||||
var implementTypes = types.Where(x => x.IsClass).ToArray();
|
||||
var interfaceTypes = types.Where(x => x.IsInterface).ToArray();
|
||||
foreach (var implementType in implementTypes)
|
||||
{
|
||||
var interfaceType = interfaceTypes.FirstOrDefault(x => x.IsAssignableFrom(implementType));
|
||||
if (interfaceType != null)
|
||||
services.AddScoped(interfaceType, implementType);
|
||||
}
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册所有TransientAttribute
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddTransientAttributes(this IServiceCollection services)
|
||||
{
|
||||
if (_assemblies == null)
|
||||
{
|
||||
return services;
|
||||
}
|
||||
var transientTypes = _assemblies.SelectMany(a => a.GetTypes())
|
||||
.Where(t => t.GetCustomAttributes(typeof(TransientAttribute), true).Any() && t.IsClass && !t.IsAbstract);
|
||||
foreach (var transientType in transientTypes)
|
||||
{
|
||||
services.AddTransient(transientType);
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册所有SingletonAttribute
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddSingletonAttributes(this IServiceCollection services)
|
||||
{
|
||||
if (_assemblies == null)
|
||||
{
|
||||
return services;
|
||||
}
|
||||
var transientTypes = _assemblies.SelectMany(a => a.GetTypes())
|
||||
.Where(t => t.GetCustomAttributes(typeof(SingletonAttribute), true).Any() && t.IsClass && !t.IsAbstract);
|
||||
foreach (var transientType in transientTypes)
|
||||
{
|
||||
services.AddSingleton(transientType);
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册所有实现IHostedService的类
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddHostedServices(this IServiceCollection services)
|
||||
{
|
||||
if (_assemblies == null)
|
||||
{
|
||||
return services;
|
||||
}
|
||||
|
||||
var hostedServiceTypes = _assemblies.SelectMany(a => a.GetTypes())
|
||||
.Where(t => typeof(IHostedService).IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
|
||||
|
||||
// 获取 AddHostedService 方法的泛型定义
|
||||
var addHostedServiceMethod = typeof(ServiceCollectionHostedServiceExtensions)
|
||||
.GetMethods()
|
||||
.First(m => m.Name == "AddHostedService" && m.IsGenericMethod && m.GetParameters().Length == 1);
|
||||
|
||||
foreach (var hostedServiceType in hostedServiceTypes)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 构造泛型方法并调用
|
||||
var genericMethod = addHostedServiceMethod.MakeGenericMethod(hostedServiceType);
|
||||
genericMethod.Invoke(null, new object[] { services });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger?.LogError(ex, $"注册后台服务 {hostedServiceType.FullName} 失败");
|
||||
}
|
||||
}
|
||||
|
||||
return services;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册本地化
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection AddLocalization(this IServiceCollection services)
|
||||
{
|
||||
services.AddLocalization<AvaloniaJsonLocalizationProvider>(() =>
|
||||
{
|
||||
var options = new AvaloniaLocalizationOptions(
|
||||
// 支持的本地化语言文化
|
||||
[
|
||||
new("en-US"),
|
||||
new("zh-CN")
|
||||
],
|
||||
// defaultCulture, 用于设置当前文化(currentCulture)不在 cultures 列表中时的情况以及作为缺失的本地化条目的备用文化(fallback culture)
|
||||
new CultureInfo("en-US"),
|
||||
// currentCulture 在基础设施加载时设置,可以从应用程序设置或其他地方获取
|
||||
Thread.CurrentThread.CurrentCulture,
|
||||
// 包含本地化 JSON 文件的资源路径
|
||||
$"{typeof(App).Namespace}/Assets/i18n");
|
||||
return options;
|
||||
});
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
28
Cowain.TestProject/Services/TestHostedService.cs
Normal file
28
Cowain.TestProject/Services/TestHostedService.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Cowain.Base.Helpers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Cowain.TestProject.Services
|
||||
{
|
||||
public class TestHostedService : BackgroundHostedService
|
||||
{
|
||||
private readonly ILogger<TestHostedService> _logger;
|
||||
public TestHostedService(ILogger<TestHostedService> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[LogAndSwallow]
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
|
||||
_logger.LogInformation("Test StartAsync ");
|
||||
await Task.Delay(2000, stoppingToken);
|
||||
_logger.LogInformation("Test StartedAsync");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
8
Cowain.TestProject/UPGRADING.md
Normal file
8
Cowain.TestProject/UPGRADING.md
Normal file
@@ -0,0 +1,8 @@
|
||||
## 更新 1.0.1 to 1.0.2
|
||||
* 无更新,测试自动更新组件
|
||||
|
||||
## 更新 1.0.0 to 1.0.1
|
||||
* 增加自动更新组件功能
|
||||
|
||||
## 首次发布 1.0.0
|
||||
* 第一版
|
||||
58
Cowain.TestProject/ViewLocator.cs
Normal file
58
Cowain.TestProject/ViewLocator.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.ViewModels;
|
||||
using Cowain.TestProject.ViewModels;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Cowain.TestProject
|
||||
{
|
||||
/// <summary>
|
||||
/// 视图定位器,根据视图模型定位视图
|
||||
/// </summary>
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
|
||||
public Control? Build(object? param)
|
||||
{
|
||||
if (param is null)
|
||||
return null;
|
||||
var dataType = param.GetType();
|
||||
var name = dataType.FullName!.Replace("ViewModel", "View", StringComparison.Ordinal);
|
||||
//var type = Type.GetType(name);
|
||||
// 完全限定名
|
||||
var type = Type.GetType($"{name}, {GetAssemblyName(dataType)}");
|
||||
|
||||
if (type != null)
|
||||
{
|
||||
return (Control)Activator.CreateInstance(type)!;
|
||||
}
|
||||
return new TextBlock { Text = "Not Found: " + name };
|
||||
}
|
||||
|
||||
public bool Match(object? data)
|
||||
{
|
||||
return data is ViewModelBase || data is PageViewModelBase;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取程序集名称
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
private string GetAssemblyName(Type type)
|
||||
{
|
||||
// 类型的完整名称
|
||||
string? input = type.AssemblyQualifiedName;
|
||||
if (input is null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
// 正则表达式匹配两个逗号之间的内容
|
||||
var match = Regex.Match(input, ",(.*?),");
|
||||
return match.Success ? match.Groups[1].Value.Trim() : string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels.Admin;
|
||||
|
||||
public partial class RoleActionsDialogViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<RoleActionsItemViewModel>? _menuActions;
|
||||
}
|
||||
|
||||
public partial class RoleActionsItemViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string? _name;
|
||||
[ObservableProperty]
|
||||
private bool _isActive;
|
||||
}
|
||||
|
||||
|
||||
192
Cowain.TestProject/ViewModels/Admin/RoleMenuSettingViewModel.cs
Normal file
192
Cowain.TestProject/ViewModels/Admin/RoleMenuSettingViewModel.cs
Normal file
@@ -0,0 +1,192 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Notifications;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.IServices;
|
||||
using Cowain.Base.ViewModels;
|
||||
using Cowain.TestProject.Views.Admin;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels.Admin;
|
||||
|
||||
public partial class RoleMenuSettingViewModel : PageViewModelBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 工具栏按钮集合
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<MenuItemViewModel>? _toolbarMenus;
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<UserRoleViewModel>? _userRoles;
|
||||
[ObservableProperty]
|
||||
private UserRoleViewModel? _selectedRole;
|
||||
|
||||
|
||||
private readonly ILocalizer _l;
|
||||
private PageViewMenuHelper _pageViewMenuActions;
|
||||
|
||||
private IUserRoleMenuService _roleMenuService;
|
||||
public RoleMenuSettingViewModel(IUserRoleMenuService roleMenuService, ILocalizer localizer, PageViewMenuHelper viewMenuActions)
|
||||
{
|
||||
_roleMenuService = roleMenuService;
|
||||
_l = localizer;
|
||||
_pageViewMenuActions = viewMenuActions;
|
||||
UserRoles = new ObservableCollection<UserRoleViewModel>();
|
||||
var toolMenus = viewMenuActions.GetGroupMenus("Toolbar");
|
||||
ToolbarMenus = [.. toolMenus];
|
||||
// 异步调用刷新
|
||||
RefreshCommand.ExecuteAsync(null);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task RefreshAsync()
|
||||
{
|
||||
var ret = await _roleMenuService.GetAllAsync();
|
||||
if (ret.Any())
|
||||
{
|
||||
UserRoles?.Clear();
|
||||
foreach (var item in ret)
|
||||
{
|
||||
UserRoles?.Add(item);
|
||||
}
|
||||
if (UserRoles != null && UserRoles.Count() > 0)
|
||||
{
|
||||
SelectedRole = UserRoles[0];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private async Task EditUserRoleMenuAsync()
|
||||
{
|
||||
if (SelectedRole == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var options = new DialogOptions()
|
||||
{
|
||||
ShowInTaskBar = false,
|
||||
IsCloseButtonVisible = false,
|
||||
StartupLocation = WindowStartupLocation.CenterScreen,
|
||||
CanDragMove = true,
|
||||
CanResize = false,
|
||||
};
|
||||
|
||||
var ret = await Dialog.ShowCustomModal<UserRoleMenuDialog, UserRoleMenuDialogViewModel, bool>(new UserRoleMenuDialogViewModel(ToolbarMenus, UserRoles, SelectedRole, _pageViewMenuActions, false), options: options);
|
||||
if (ret)
|
||||
{
|
||||
var userRole = await _roleMenuService.EditUserRoleMenuAsync(SelectedRole);
|
||||
if (userRole.IsSuccess)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["RoleMenu.Setting.Edit.Success"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
await RefreshAsync();
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["RoleMenu.Setting.Edit.Error"] + ":" + userRole.ErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task EditMenuActionsAsync(UserRoleMenuViewModel? userRoleMenu)
|
||||
{
|
||||
if (SelectedRole == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["RoleMenu.Actions.Setting.Edit.SelectRoleNull"]);
|
||||
return;
|
||||
}
|
||||
if (userRoleMenu == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["RoleMenu.Actions.Setting.Edit.UserRoleMenuNull"]);
|
||||
return;
|
||||
}
|
||||
var options = new DialogOptions()
|
||||
{
|
||||
Title = _l["RoleMenu.Dialog.MenuActions"],
|
||||
ShowInTaskBar = false,
|
||||
IsCloseButtonVisible = false,
|
||||
StartupLocation = WindowStartupLocation.CenterScreen,
|
||||
Button = DialogButton.OKCancel,
|
||||
CanDragMove = true,
|
||||
CanResize = false,
|
||||
};
|
||||
var actionNames = _pageViewMenuActions.GetMenuActionsByKey(userRoleMenu.MenuKey);
|
||||
if (actionNames == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["RoleMenu.Actions.Setting.Edit.UserRoleMenuNull"]);
|
||||
return;
|
||||
}
|
||||
ObservableCollection<RoleActionsItemViewModel> _menuActions = new ObservableCollection<RoleActionsItemViewModel>();
|
||||
foreach (var actionName in actionNames)
|
||||
{
|
||||
_menuActions.Add(new RoleActionsItemViewModel { Name = actionName });
|
||||
}
|
||||
foreach (var action in _menuActions)
|
||||
{
|
||||
if (userRoleMenu.MenuActions != null && !string.IsNullOrEmpty(action.Name) && userRoleMenu.MenuActions.Contains(action.Name))
|
||||
{
|
||||
action.IsActive = true;
|
||||
}
|
||||
}
|
||||
RoleActionsDialogViewModel roleActionsDialogViewModel = new RoleActionsDialogViewModel { MenuActions = _menuActions };
|
||||
var ret = await Dialog.ShowModal<RoleActionsDialog, RoleActionsDialogViewModel>(roleActionsDialogViewModel, options: options);
|
||||
if (ret == DialogResult.OK)
|
||||
{
|
||||
//将_menuActions中isActive为true的Name添加到userRoleMenu.MenuActions中
|
||||
userRoleMenu.MenuActions = new ObservableCollection<string>(_menuActions.Where(x => x.IsActive && x.Name != null).Select(x => x.Name!));
|
||||
var edit = await _roleMenuService.EditMenuActionsAsync(userRoleMenu);
|
||||
if (edit.IsSuccess)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["RoleMenu.Actions.Setting.Edit.Success"] + "\r\n" + edit.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
await RefreshAsync();
|
||||
NotificationHelper.ShowNormal(NotificationType.Error, _l["RoleMenu.Actions.Setting.Edit.Error"] + ":" + edit.ErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task DeleteMenuActionsAsync(UserRoleMenuViewModel? userRoleMenu)
|
||||
{
|
||||
if (SelectedRole == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["RoleMenu.Actions.Setting.Edit.SelectRoleNull"]);
|
||||
return;
|
||||
}
|
||||
if (userRoleMenu == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["RoleMenu.Actions.Setting.Edit.UserRoleMenuNull"]);
|
||||
return;
|
||||
}
|
||||
var result = await MessageBox.ShowOverlayAsync(_l["DeleteDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||
if (result != MessageBoxResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var deleteUser = await _roleMenuService.DeleteMenuActionsAsync(userRoleMenu);
|
||||
if (deleteUser.IsSuccess)
|
||||
{
|
||||
// 从SelectedRole中移除删除的UserRoleMenuAction
|
||||
SelectedRole.Menus?.Remove(userRoleMenu);
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["RoleMenu.Actions.Setting.Delete.Success"] + "\r\n" + deleteUser.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Error, _l["RoleMenu.Actions.Setting.Delete.Error"] + ":" + deleteUser.ErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
using Avalonia.Controls.Notifications;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.Models;
|
||||
using Cowain.Base.ViewModels;
|
||||
using Irihi.Avalonia.Shared.Contracts;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels.Admin;
|
||||
public partial class UserEditDialogViewModel : ObservableValidator, IDialogContext
|
||||
{
|
||||
public event EventHandler<object?>? RequestClose;
|
||||
[ObservableProperty]
|
||||
private UserViewModel? _user;
|
||||
|
||||
[ObservableProperty]
|
||||
private UserRoleViewModel? _selectedRole;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _selectedSex;
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<UserRoleViewModel>? _userRoles;
|
||||
private readonly ILocalizer _l;
|
||||
public UserEditDialogViewModel(ObservableCollection<UserRoleViewModel>? userRoles)
|
||||
{
|
||||
_l = ServiceLocator.GetRequiredService<ILocalizer>();
|
||||
UserRoles = userRoles;
|
||||
}
|
||||
|
||||
public UserEditDialogViewModel(ObservableCollection<UserRoleViewModel>? userRoles, UserViewModel user) : this(userRoles)
|
||||
{
|
||||
User = user;
|
||||
SelectedSex = user.Sex;
|
||||
SelectedRole = UserRoles?.FirstOrDefault(x => x.RoleId == user.RoleId);
|
||||
}
|
||||
|
||||
public List<string> SexModes => Enum.GetValues(typeof(SexMode))
|
||||
.Cast<SexMode>()
|
||||
.Select(e => e.ToString())
|
||||
.ToList();
|
||||
|
||||
public void Close()
|
||||
{
|
||||
RequestClose?.Invoke(this, null);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void Ok()
|
||||
{
|
||||
if (User == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(User.Name))
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["UserEditDilog.Error.UserNameNull"]);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(User.UserNumber))
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["UserEditDilog.Error.UserNumberNull"]);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(SelectedSex))
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["UserEditDilog.Error.SexNull"]);
|
||||
return;
|
||||
}
|
||||
if (SelectedRole == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["UserEditDilog.Error.SelectedRoleNull"]);
|
||||
return;
|
||||
}
|
||||
User.Sex = SelectedSex;
|
||||
RequestClose?.Invoke(this, true);
|
||||
}
|
||||
[RelayCommand]
|
||||
private void Cancel()
|
||||
{
|
||||
RequestClose?.Invoke(this, false);
|
||||
}
|
||||
|
||||
}
|
||||
25
Cowain.TestProject/ViewModels/Admin/UserItemViewModel.cs
Normal file
25
Cowain.TestProject/ViewModels/Admin/UserItemViewModel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Avalonia.Media;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels.Admin
|
||||
{
|
||||
public partial class UserItemViewModel : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户名称
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string? _userName="NoUser";
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
public StreamGeometry? UserIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单是否选中
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _isActive;
|
||||
}
|
||||
}
|
||||
168
Cowain.TestProject/ViewModels/Admin/UserManagementViewModel.cs
Normal file
168
Cowain.TestProject/ViewModels/Admin/UserManagementViewModel.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Notifications;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.IServices;
|
||||
using Cowain.Base.ViewModels;
|
||||
using Cowain.TestProject.Views.Admin;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels.Admin
|
||||
{
|
||||
public partial class UserManagementViewModel : PageViewModelBase
|
||||
{
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<UserViewModel>? _users;
|
||||
|
||||
[ObservableProperty]
|
||||
private int _totals;
|
||||
[ObservableProperty]
|
||||
private int _pageSize;
|
||||
[ObservableProperty]
|
||||
private int _pageIndex;
|
||||
|
||||
private readonly ILocalizer _l;
|
||||
private IAccountService _accountService;
|
||||
private IUserRoleService _userRoleService;
|
||||
public UserManagementViewModel(ILocalizer localizer, IAccountService accountService, IUserRoleService userRoleService)
|
||||
{
|
||||
PageSize = 20;
|
||||
_l = localizer;
|
||||
_accountService = accountService;
|
||||
_userRoleService = userRoleService;
|
||||
Users = new ObservableCollection<UserViewModel>();
|
||||
// 异步调用刷新
|
||||
RefreshCommand.ExecuteAsync(1);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task RefreshAsync(int pageIndex)
|
||||
{
|
||||
var (data, count) = await _accountService.GetAllAsync(pageIndex, PageSize);
|
||||
Totals = count;
|
||||
if (count > 0)
|
||||
{
|
||||
Users?.Clear();
|
||||
foreach (var item in data)
|
||||
{
|
||||
Users?.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task AddUserAsync()
|
||||
{
|
||||
var options = new DialogOptions()
|
||||
{
|
||||
Title = _l["UserManagement.Dialog.Title"],
|
||||
ShowInTaskBar = false,
|
||||
IsCloseButtonVisible = false,
|
||||
StartupLocation = WindowStartupLocation.CenterScreen,
|
||||
Button = DialogButton.OKCancel,
|
||||
CanDragMove = true,
|
||||
CanResize = true,
|
||||
};
|
||||
var userRoles = await _userRoleService.GetAllAsync();
|
||||
if (userRoles == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["UserManagement.AddUser.Error.UserRolesNull"]);
|
||||
return;
|
||||
}
|
||||
UserEditDialogViewModel editDialogViewModel = new UserEditDialogViewModel(new ObservableCollection<UserRoleViewModel>(userRoles));
|
||||
editDialogViewModel.User = new UserViewModel { IsValid = true };
|
||||
var ret = await Dialog.ShowCustomModal<UserEditDialog, UserEditDialogViewModel, bool>(editDialogViewModel, options: options);
|
||||
if (ret)
|
||||
{
|
||||
if (editDialogViewModel.SelectedRole == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["UserManagement.AddUser.Error.SelectedRoleNull"]);
|
||||
return;
|
||||
}
|
||||
editDialogViewModel.User.RoleId = editDialogViewModel.SelectedRole.RoleId;
|
||||
editDialogViewModel.User.RoleName = editDialogViewModel.SelectedRole.RoleName;
|
||||
var addUser = await _accountService.AddUserAsync(editDialogViewModel.User);
|
||||
if (addUser.IsSuccess)
|
||||
{
|
||||
await RefreshAsync(1);
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["UserManagement.AddUser.Success"]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task EditUserAsync(UserViewModel? user)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var options = new DialogOptions()
|
||||
{
|
||||
Title = _l["UserManagement.Dialog.Title"],
|
||||
ShowInTaskBar = false,
|
||||
IsCloseButtonVisible = false,
|
||||
StartupLocation = WindowStartupLocation.CenterScreen,
|
||||
Button = DialogButton.OKCancel,
|
||||
CanDragMove = true,
|
||||
CanResize = true,
|
||||
};
|
||||
var userRoles = await _userRoleService.GetAllAsync();
|
||||
if (userRoles == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["UserManagement.AddUser.Error.UserRolesNull"]);
|
||||
return;
|
||||
}
|
||||
UserEditDialogViewModel editDialogViewModel = new UserEditDialogViewModel(new ObservableCollection<UserRoleViewModel>(userRoles), user);
|
||||
var ret = await Dialog.ShowCustomModal<UserEditDialog, UserEditDialogViewModel, bool>(editDialogViewModel, options: options);
|
||||
if (ret)
|
||||
{
|
||||
if (editDialogViewModel.SelectedRole == null)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Information, _l["UserManagement.AddUser.Error.SelectedRoleNull"]);
|
||||
return;
|
||||
}
|
||||
user.RoleId = editDialogViewModel.SelectedRole.RoleId;
|
||||
user.RoleName = editDialogViewModel.SelectedRole.RoleName;
|
||||
var editUser = await _accountService.EditUserAsync(user);
|
||||
if (editUser.IsSuccess)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["UserManagement.EditUser.Success"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Error, _l["UserManagement.EditUser.Error"] + editUser.ErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task DeleteUserAsync(UserViewModel? user)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var result = await MessageBox.ShowOverlayAsync(_l["DeleteDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||
if (result != MessageBoxResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var editUser = await _accountService.DelUserAsync(user);
|
||||
if (editUser.IsSuccess)
|
||||
{
|
||||
Users?.Remove(user);
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["UserManagement.DeleteUser.Success"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Cowain.Base.ViewModels;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels.Admin
|
||||
{
|
||||
public partial class UserRoleDialogViewModel : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置菜单集合
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private UserRoleViewModel? _userRole;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.ViewModels;
|
||||
using Irihi.Avalonia.Shared.Contracts;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels.Admin
|
||||
{
|
||||
public partial class UserRoleMenuDialogViewModel : ObservableObject, IDialogContext
|
||||
{
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<UserRoleViewModel>? _userRoles;
|
||||
|
||||
[ObservableProperty]
|
||||
private UserRoleViewModel? _selectedRole;
|
||||
|
||||
/// <summary>
|
||||
/// 工具栏按钮集合
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<MenuItemViewModel>? _toolbarMenus;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isEdit;
|
||||
|
||||
public event EventHandler<object?>? RequestClose;
|
||||
|
||||
private PageViewMenuHelper _pageViewMenuHelper;
|
||||
public UserRoleMenuDialogViewModel(ObservableCollection<MenuItemViewModel>? toolbarMenu, ObservableCollection<UserRoleViewModel>? userRoles, UserRoleViewModel? selectedRole, PageViewMenuHelper pageViewMenuHelper, bool isEdit = false)
|
||||
{
|
||||
_pageViewMenuHelper = pageViewMenuHelper;
|
||||
UserRoles = userRoles;
|
||||
ToolbarMenus = toolbarMenu;
|
||||
_pageViewMenuHelper.ClearMenuActives(ToolbarMenus);
|
||||
SelectedRole = selectedRole;
|
||||
IsEdit = isEdit;
|
||||
if (!IsEdit)
|
||||
{
|
||||
if (!IsEdit && SelectedRole?.Menus != null)
|
||||
{
|
||||
var menuKeys = SelectedRole.Menus.Select(x => x.MenuKey).Where(key => key != null).Cast<string>().ToList();
|
||||
_pageViewMenuHelper.SetMenuActiveByKeys(ToolbarMenus, menuKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Close()
|
||||
{
|
||||
RequestClose?.Invoke(this, null);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void Ok()
|
||||
{
|
||||
if (SelectedRole != null && ToolbarMenus != null)
|
||||
{
|
||||
SelectedRole.Menus = [.. _pageViewMenuHelper.GetActiveMenus(ToolbarMenus)!];
|
||||
}
|
||||
RequestClose?.Invoke(this, true);
|
||||
}
|
||||
[RelayCommand]
|
||||
private void Cancel()
|
||||
{
|
||||
RequestClose?.Invoke(this, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
142
Cowain.TestProject/ViewModels/Admin/UserRoleSettingViewModel.cs
Normal file
142
Cowain.TestProject/ViewModels/Admin/UserRoleSettingViewModel.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Notifications;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.IServices;
|
||||
using Cowain.Base.ViewModels;
|
||||
using Cowain.TestProject.Views.Admin;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels.Admin;
|
||||
|
||||
public partial class UserRoleSettingViewModel : PageViewModelBase
|
||||
{
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<UserRoleViewModel>? _userRoles;
|
||||
|
||||
private readonly IUserRoleService _userRoleService;
|
||||
private readonly ILocalizer _l;
|
||||
private PageViewMenuHelper _pageViewMenuActions;
|
||||
|
||||
[ObservableProperty]
|
||||
private int _totals;
|
||||
[ObservableProperty]
|
||||
private int _pageSize;
|
||||
[ObservableProperty]
|
||||
private int _pageIndex;
|
||||
public UserRoleSettingViewModel(IUserRoleService userRoleService, ILocalizer localizer, PageViewMenuHelper viewMenuActions)
|
||||
{
|
||||
PageSize = 20;
|
||||
_pageViewMenuActions = viewMenuActions;
|
||||
UserRoles = new ObservableCollection<UserRoleViewModel>();
|
||||
_userRoleService = userRoleService;
|
||||
_l = localizer;
|
||||
// 异步调用刷新
|
||||
RefreshCommand.ExecuteAsync(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private async Task AddUserRoleAsync()
|
||||
{
|
||||
var options = new DialogOptions()
|
||||
{
|
||||
Title = _l["UserRole.Dialog.Title"],
|
||||
ShowInTaskBar = false,
|
||||
IsCloseButtonVisible = false,
|
||||
StartupLocation = WindowStartupLocation.CenterScreen,
|
||||
Button = DialogButton.OKCancel,
|
||||
CanDragMove = true,
|
||||
CanResize = false,
|
||||
};
|
||||
UserRoleViewModel model = new UserRoleViewModel { IsValid = true };
|
||||
var ret = await Dialog.ShowModal<UserRoleDialog, UserRoleDialogViewModel>(new UserRoleDialogViewModel { UserRole = model }, options: options);
|
||||
if (ret == DialogResult.OK)
|
||||
{
|
||||
var userRole = await _userRoleService.AddUserRoleAsync(model);
|
||||
if (userRole.IsSuccess)
|
||||
{
|
||||
await RefreshAsync(1);
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["UserRole.Setting.Add.Success"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Error, _l["UserRole.Setting.Add.Error"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task EditUserRoleAsync(UserRoleViewModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var options = new DialogOptions()
|
||||
{
|
||||
Title = _l["UserRole.Dialog.Title"],
|
||||
ShowInTaskBar = false,
|
||||
IsCloseButtonVisible = false,
|
||||
StartupLocation = WindowStartupLocation.CenterScreen,
|
||||
Button = DialogButton.OKCancel,
|
||||
CanDragMove = true,
|
||||
CanResize = false,
|
||||
};
|
||||
|
||||
var ret = await Dialog.ShowModal<UserRoleDialog, UserRoleDialogViewModel>(new UserRoleDialogViewModel { UserRole = model }, options: options);
|
||||
if (ret == DialogResult.OK)
|
||||
{
|
||||
var userRole = await _userRoleService.EditUserRoleAsync(model);
|
||||
if (userRole.IsSuccess)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["UserRole.Setting.Edit.Success"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
await RefreshAsync(1);
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["UserRole.Setting.Edit.Error"] + ":" + userRole.ErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task DelUserRoleAsync(UserRoleViewModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var result = await MessageBox.ShowOverlayAsync(_l["DeleteDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||
if (result != MessageBoxResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var ret = await _userRoleService.DelUserRoleAsync(model);
|
||||
if (ret.IsSuccess)
|
||||
{
|
||||
UserRoles?.Remove(model);
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["UserRole.Setting.Delete.Success"]);
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task RefreshAsync(int pageIndex)
|
||||
{
|
||||
var (data, count) = await _userRoleService.GetAllAsync(pageIndex, PageSize);
|
||||
Totals = count;
|
||||
if (count > 0)
|
||||
{
|
||||
UserRoles?.Clear();
|
||||
foreach (var item in data)
|
||||
{
|
||||
UserRoles?.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
289
Cowain.TestProject/ViewModels/LoginWindowViewModel.cs
Normal file
289
Cowain.TestProject/ViewModels/LoginWindowViewModel.cs
Normal file
@@ -0,0 +1,289 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Styling;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Cowain.Base.Abstractions.Navigation;
|
||||
using Cowain.Base.Attributes;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.IServices;
|
||||
using Cowain.Base.Models.Menu;
|
||||
using Cowain.Base.ViewModels;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Semi.Avalonia;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MenuItem = Cowain.Base.Models.Menu.MenuItem;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels
|
||||
{
|
||||
public partial class LoginWindowViewModel : ViewModelBase
|
||||
{
|
||||
private class UserData
|
||||
{
|
||||
public string? UserName { get; set; }
|
||||
public string? Password { get; set; }
|
||||
public bool IsRemember { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 登录成功
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _loginSuccess;
|
||||
|
||||
/// <summary>
|
||||
/// 是否记住用户名
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _rememberUserName;
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
[NotifyDataErrorInfo]
|
||||
[NotifyCanExecuteChangedFor(nameof(LoginCommand))]
|
||||
[MinLength(2, "Errors.MinLength")]
|
||||
private string? _userName;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
[NotifyDataErrorInfo]
|
||||
[NotifyCanExecuteChangedFor(nameof(LoginCommand))]
|
||||
[MinLength(4, "Errors.MinLength")]
|
||||
private string? _password;
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string? _errorMessage;
|
||||
|
||||
/// <summary>
|
||||
/// 当前页面视图模型
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private PageViewModelBase? _currentPage;
|
||||
|
||||
/// <summary>
|
||||
/// 设置菜单集合
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Base.ViewModels.MenuItemViewModel>? _settingMenus;
|
||||
|
||||
private readonly ILocalizer _l;
|
||||
/// <summary>
|
||||
/// 视图导航器
|
||||
/// </summary>
|
||||
private readonly IViewNavigator _viewNavigator;
|
||||
/// <summary>
|
||||
/// 菜单数据
|
||||
/// </summary>
|
||||
private readonly List<MenuItem> _menuItems;
|
||||
private IAccountService _accountService;
|
||||
private IConfiguration _configuration;
|
||||
|
||||
public LoginWindowViewModel(MenuConfigurationContext menuContext, ILocalizer localizer, IViewNavigator viewNavigator, IAccountService accountService, IConfiguration configuration)
|
||||
{
|
||||
_l = localizer;
|
||||
_menuItems = menuContext.Menus;
|
||||
_viewNavigator = viewNavigator;
|
||||
_accountService = accountService;
|
||||
_configuration = configuration;
|
||||
LoadSettingMenus();
|
||||
ReadUserData();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MenuItem 到 MenuItemViewModel 的转换器
|
||||
/// </summary>
|
||||
private Func<MenuItem, MenuItemViewModel> MenuItemToViewModel => x => new MenuItemViewModel(_l[x.LocaleKey])
|
||||
{
|
||||
Key = x.Key,
|
||||
IsActive = x.IsActive == true,
|
||||
Icon = string.IsNullOrWhiteSpace(x.Icon) ? null : StreamGeometry.Parse(x.Icon),
|
||||
CommandParameter = x.CommandParameter,
|
||||
//PageActions = x.PageActions,
|
||||
Items = x.Items.Select(MenuItemToViewModel).ToList(),
|
||||
MenuClickCommand = GetRelayCommand(x.CommandType),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 根据命令类型返回中继命令
|
||||
/// </summary>
|
||||
/// <param name="commandType"></param>
|
||||
/// <returns></returns>
|
||||
private IRelayCommand? GetRelayCommand(string? commandType)
|
||||
{
|
||||
if (!Enum.TryParse<MenuClickCommandType>(commandType, out var cmdType))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return cmdType switch
|
||||
{
|
||||
// 主题切换返回的中继命令
|
||||
MenuClickCommandType.SwitchTheme => new RelayCommand<MenuItemViewModel>((MenuItemViewModel? menuItem) =>
|
||||
{
|
||||
var app = Application.Current;
|
||||
if (app is not null)
|
||||
{
|
||||
ThemeVariant? tv = menuItem?.CommandParameter switch
|
||||
{
|
||||
nameof(ThemeVariant.Default) => ThemeVariant.Default,
|
||||
nameof(ThemeVariant.Dark) => ThemeVariant.Dark,
|
||||
"Desert" => SemiTheme.Desert,
|
||||
"Dusk" => SemiTheme.Dusk,
|
||||
"NightSky" => SemiTheme.NightSky,
|
||||
_ => ThemeVariant.Default
|
||||
};
|
||||
app.RequestedThemeVariant = tv;
|
||||
// 重载视图
|
||||
_viewNavigator.ReloadCurrentPage();
|
||||
}
|
||||
}),
|
||||
|
||||
// 打开链接返回的中继命令
|
||||
MenuClickCommandType.Link => new RelayCommand<MenuItemViewModel>((MenuItemViewModel? menuItem) =>
|
||||
{
|
||||
var url = menuItem?.CommandParameter;
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = url,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}),
|
||||
|
||||
// 切换本地化语言
|
||||
MenuClickCommandType.SwitchLanguage => new RelayCommand<MenuItemViewModel>((MenuItemViewModel? menuItem) =>
|
||||
{
|
||||
_l.CurrentCulture = _l.AvailableCultures.FirstOrDefault(f => f.IetfLanguageTag == menuItem?.CommandParameter) ??
|
||||
Thread.CurrentThread.CurrentCulture;
|
||||
|
||||
// 重载视图,触发本地化更新
|
||||
_viewNavigator.ReloadCurrentPage();
|
||||
LoadSettingMenus();
|
||||
var app = Application.Current;
|
||||
if (app is null) return;
|
||||
CultureInfo cultureInfo = menuItem?.CommandParameter is string parameter
|
||||
? new CultureInfo(parameter)
|
||||
: Thread.CurrentThread.CurrentCulture;
|
||||
Semi.Avalonia.SemiTheme.OverrideLocaleResources(app, cultureInfo);
|
||||
Ursa.Themes.Semi.SemiTheme.OverrideLocaleResources(app, cultureInfo);
|
||||
}),
|
||||
|
||||
// 返回 null
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 载入设置栏菜单
|
||||
/// </summary>
|
||||
private void LoadSettingMenus()
|
||||
{
|
||||
var settingMenus = _menuItems.Where(x => x.Group == "Settings").Select(MenuItemToViewModel);
|
||||
SettingMenus = [.. settingMenus];
|
||||
}
|
||||
private void ReadUserData()
|
||||
{
|
||||
var path = PathHelper.GetLocalFilePath("userdata.json");
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var json = File.ReadAllText(path);
|
||||
var userData = JsonSerializer.Deserialize<UserData>(json);
|
||||
if (userData != null)
|
||||
{
|
||||
RememberUserName = userData.IsRemember;
|
||||
if (RememberUserName)
|
||||
{
|
||||
UserName = userData.UserName;
|
||||
if (!string.IsNullOrEmpty(userData.Password))
|
||||
{
|
||||
Password = DESHelper.Decrypt(userData.Password, "ZSL12345");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanLogin()
|
||||
{
|
||||
ValidateAllProperties();
|
||||
return !HasErrors;
|
||||
}
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanLogin))]
|
||||
private async Task LoginAsync(object obj)
|
||||
{
|
||||
if (string.IsNullOrEmpty(UserName))
|
||||
{
|
||||
ErrorMessage = _l["LoginWindow.UserNameEmpty"];
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(Password))
|
||||
{
|
||||
ErrorMessage = _l["LoginWindow.PasseordEmpty"];
|
||||
return;
|
||||
}
|
||||
var loginResult = await _accountService.LoginAsync(UserName, Password);
|
||||
if (loginResult.IsSuccess)
|
||||
{
|
||||
GlobalData.Instance.CurrentUser = loginResult.Data;
|
||||
//GlobalData.Instance.AddOrUpdate("UserName", UserName);
|
||||
GlobalData.Instance.AddOrUpdate("CurrentUser", loginResult.Data!.User);
|
||||
LoginSuccess = true;
|
||||
if (RememberUserName)
|
||||
{
|
||||
var userData = new UserData { UserName = UserName, Password = DESHelper.Encrypt(Password, "ZSL12345"), IsRemember = RememberUserName };
|
||||
var json = JsonSerializer.Serialize(userData);
|
||||
var path = PathHelper.GetLocalFilePath("userdata.json");
|
||||
await File.WriteAllTextAsync(path, json);
|
||||
}
|
||||
else
|
||||
{
|
||||
var path = PathHelper.GetLocalFilePath("userdata.json");
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
}
|
||||
// 关闭登录窗口,并且 DialogResult返回True;
|
||||
if (obj is Window window)
|
||||
{
|
||||
window.Close(true);
|
||||
}
|
||||
//WeakReferenceMessenger.Default.Send(new LoginSuccessMessage(new UserItemViewModel { UserName = "Admin", IsActive = true }));
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessage = _l["LoginWindow.LoginFailed"];
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ToggleTheme()
|
||||
{
|
||||
var app = Application.Current;
|
||||
if (app is null) return;
|
||||
var theme = app.ActualThemeVariant;
|
||||
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
88
Cowain.TestProject/ViewModels/LogsViewModel.cs
Normal file
88
Cowain.TestProject/ViewModels/LogsViewModel.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using Avalonia.Controls.Notifications;
|
||||
using Avalonia.Platform.Storage;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.IServices;
|
||||
using Cowain.Base.ViewModels;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels;
|
||||
|
||||
public partial class LogsViewModel : PageViewModelBase
|
||||
{
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<SerilogViewModel>? _logList;
|
||||
[ObservableProperty]
|
||||
private int _totals;
|
||||
[ObservableProperty]
|
||||
private int _pageSize;
|
||||
[ObservableProperty]
|
||||
private int _pageIndex;
|
||||
|
||||
private readonly ILocalizer _l;
|
||||
private readonly ILogService _logService;
|
||||
public LogsViewModel(ILocalizer localizer, ILogService logService)
|
||||
{
|
||||
PageSize = 20;
|
||||
_l = localizer;
|
||||
_logService = logService;
|
||||
LogList = new();
|
||||
RefreshCommand.Execute(PageIndex);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task RefreshAsync(int pageIndex)
|
||||
{
|
||||
var (data, count) = await _logService.GetAllAsync(pageIndex, PageSize);
|
||||
Totals = count;
|
||||
if (count > 0)
|
||||
{
|
||||
LogList?.Clear();
|
||||
foreach (var item in data)
|
||||
{
|
||||
LogList?.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task ExportAsync()
|
||||
{
|
||||
|
||||
var saveDialog = await FileDialogHelper.SaveFileDialogAsync(GetFileTypes());
|
||||
|
||||
if (!saveDialog.IsSuccess)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (LogList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var result = await ExcelHelper<SerilogViewModel>.ExportExcelAsync(LogList.ToList(), saveDialog.Data!.Path.LocalPath);
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["Log.Export.Success"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Error, _l["Log.Export.Error"] + ":" + result.ErrorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<FilePickerFileType>? GetFileTypes()
|
||||
{
|
||||
return
|
||||
[
|
||||
new FilePickerFileType("Excel"){ Patterns=["*.xlsx"]}
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
425
Cowain.TestProject/ViewModels/MainWindowViewModel.cs
Normal file
425
Cowain.TestProject/ViewModels/MainWindowViewModel.cs
Normal file
@@ -0,0 +1,425 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Cowain.Base.Abstractions.Navigation;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.Models.Menu;
|
||||
using Cowain.Base.ViewModels;
|
||||
using Cowain.TestProject.ViewModels.Admin;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Plugin.Cowain.Base.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels
|
||||
{
|
||||
public partial class MainWindowViewModel : ViewModelBase, IRecipient<AlarmChangedMessage>
|
||||
{
|
||||
private PageViewMenuHelper _pageViewMenuActions;
|
||||
[ObservableProperty]
|
||||
private MenuItemViewModel? _selectedMenuItem;
|
||||
/// <summary>
|
||||
/// 工具栏按钮集合
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<MenuItemViewModel>? _toolbarMenus;
|
||||
/// <summary>
|
||||
/// 设置菜单集合
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<MenuItemViewModel>? _settingMenus;
|
||||
|
||||
/// <summary>
|
||||
/// 存储筛选前的菜单数据
|
||||
/// </summary>
|
||||
private ObservableCollection<MenuItemViewModel>? _originalSettingMenus;
|
||||
/// <summary>
|
||||
/// 本地化资源
|
||||
/// </summary>
|
||||
private readonly ILocalizer _l;
|
||||
|
||||
private readonly ILogger<MainWindowViewModel> _logger;
|
||||
/// <summary>
|
||||
/// 菜单数据
|
||||
/// </summary>
|
||||
private readonly List<MenuItem> _menuItems;
|
||||
/// <summary>
|
||||
/// 防抖器
|
||||
/// </summary>
|
||||
private readonly Debounce _debounce;
|
||||
/// <summary>
|
||||
/// 视图导航器
|
||||
/// </summary>
|
||||
private readonly IViewNavigator _viewNavigator;
|
||||
/// <summary>
|
||||
/// 当前页面视图模型
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private PageViewModelBase? _currentPage;
|
||||
|
||||
/// <summary>
|
||||
/// 用户图标
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private UserItemViewModel? _userItem;
|
||||
|
||||
/// <summary>
|
||||
/// 报警信息
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string? _alarmMsg = string.Empty;
|
||||
|
||||
|
||||
private List<AlarmViewModel> _alarms = new();
|
||||
// 获取版本号的属性
|
||||
public string AppVersion => GetAssemblyVersion();
|
||||
|
||||
[RelayCommand]
|
||||
private void SerachKeyUp(string e)
|
||||
{
|
||||
OnSerachMenu(e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private void ToggleTheme()
|
||||
{
|
||||
var app = Application.Current;
|
||||
if (app is null) return;
|
||||
var theme = app.ActualThemeVariant;
|
||||
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MenuItem 到 MenuItemViewModel 的转换器
|
||||
/// </summary>
|
||||
private Func<MenuItem, MenuItemViewModel> MenuItemToViewModel => x => new MenuItemViewModel(_l[x.LocaleKey])
|
||||
{
|
||||
Key = x.Key,
|
||||
IsActive = x.IsActive == true,
|
||||
Icon = string.IsNullOrWhiteSpace(x.Icon) ? null : StreamGeometry.Parse(x.Icon),
|
||||
CommandParameter = x.CommandParameter,
|
||||
//PageActions = x.PageActions,
|
||||
Items = x.Items.Select(MenuItemToViewModel).ToList(),
|
||||
MenuClickCommand = GetRelayCommand(x.CommandType),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 根据命令类型返回中继命令
|
||||
/// </summary>
|
||||
/// <param name="commandType"></param>
|
||||
/// <returns></returns>
|
||||
private IRelayCommand? GetRelayCommand(string? commandType)
|
||||
{
|
||||
if (!Enum.TryParse<MenuClickCommandType>(commandType, out var cmdType))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return cmdType switch
|
||||
{
|
||||
// 导航到视图中继命令
|
||||
MenuClickCommandType.Navigate => new RelayCommand(() =>
|
||||
{
|
||||
if (SelectedMenuItem?.CommandParameter is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// 导航到视图
|
||||
_viewNavigator.NavigateTo(SelectedMenuItem.CommandParameter);
|
||||
}),
|
||||
// 主题切换返回的中继命令
|
||||
MenuClickCommandType.SwitchTheme => new RelayCommand<MenuItemViewModel>((MenuItemViewModel? menuItem) =>
|
||||
{
|
||||
var app = Application.Current;
|
||||
if (app is not null)
|
||||
{
|
||||
ThemeVariant? tv = menuItem?.CommandParameter switch
|
||||
{
|
||||
nameof(ThemeVariant.Default) => ThemeVariant.Default,
|
||||
nameof(ThemeVariant.Dark) => ThemeVariant.Dark,
|
||||
"Desert" => Semi.Avalonia.SemiTheme.Desert,
|
||||
"Dusk" => Semi.Avalonia.SemiTheme.Dusk,
|
||||
"NightSky" => Semi.Avalonia.SemiTheme.NightSky,
|
||||
_ => ThemeVariant.Default
|
||||
};
|
||||
app.RequestedThemeVariant = tv;
|
||||
// 重载视图
|
||||
_viewNavigator.ReloadCurrentPage();
|
||||
}
|
||||
}),
|
||||
|
||||
// 打开链接返回的中继命令
|
||||
MenuClickCommandType.Link => new RelayCommand<MenuItemViewModel>((MenuItemViewModel? menuItem) =>
|
||||
{
|
||||
var url = menuItem?.CommandParameter;
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = url,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}),
|
||||
|
||||
// 切换本地化语言
|
||||
MenuClickCommandType.SwitchLanguage => new RelayCommand<MenuItemViewModel>((MenuItemViewModel? menuItem) =>
|
||||
{
|
||||
_l.CurrentCulture = _l.AvailableCultures.FirstOrDefault(f => f.IetfLanguageTag == menuItem?.CommandParameter) ??
|
||||
Thread.CurrentThread.CurrentCulture;
|
||||
// 重载视图,触发本地化更新
|
||||
_viewNavigator.ClearCurrentPage();
|
||||
//这里重新加载菜单,菜单选中项会被破坏
|
||||
LoadToolbarMenus();
|
||||
SelectedMenuItem = null;
|
||||
//重新选中菜单
|
||||
var app = Application.Current;
|
||||
if (app is null) return;
|
||||
CultureInfo cultureInfo = menuItem?.CommandParameter is string parameter
|
||||
? new CultureInfo(parameter)
|
||||
: Thread.CurrentThread.CurrentCulture;
|
||||
//待1.24号更新后再使用
|
||||
Semi.Avalonia.SemiTheme.OverrideLocaleResources(app, cultureInfo);
|
||||
Ursa.Themes.Semi.SemiTheme.OverrideLocaleResources(app, cultureInfo);
|
||||
}),
|
||||
|
||||
// 返回 null
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
private readonly IMessenger _messenger;
|
||||
public MainWindowViewModel(MenuConfigurationContext menuContext, ILocalizer localizer, IViewNavigator viewNavigator, PageViewMenuHelper viewMenuActions, IMessenger messenger, ILogger<MainWindowViewModel> logger, IConfiguration configuration)
|
||||
{
|
||||
_l = localizer;
|
||||
_logger = logger;
|
||||
_messenger = messenger;
|
||||
_menuItems = menuContext.Menus;
|
||||
_userItem = new UserItemViewModel();
|
||||
_pageViewMenuActions = viewMenuActions;
|
||||
_debounce = new Debounce(500);
|
||||
_viewNavigator = viewNavigator;
|
||||
_viewNavigator.PropertyChanged += OnNavigatorPropertyChanged;
|
||||
LoadToolbarMenus();
|
||||
_messenger.RegisterAll(this);
|
||||
var homeMenu = ToolbarMenus?.Where(x => x.Key == "Home").FirstOrDefault();
|
||||
if (homeMenu != null && !string.IsNullOrEmpty(homeMenu.CommandParameter))
|
||||
{
|
||||
SelectedMenuItem = homeMenu;
|
||||
//自动导航到首页
|
||||
_viewNavigator.NavigateTo(homeMenu.CommandParameter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 反射获取程序集版本
|
||||
private string GetAssemblyVersion()
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var version = assembly.GetName().Version;
|
||||
|
||||
if (version == null)
|
||||
return "1.0.0";
|
||||
|
||||
// 只取前三个部分(主版本.次版本.生成号)
|
||||
return $"{version.Major}.{version.Minor}.{version.Build}";
|
||||
}
|
||||
private void OnNavigatorPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(_viewNavigator.CurrentPage))
|
||||
{
|
||||
CurrentPage = _viewNavigator.CurrentPage;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 载入工具栏菜单
|
||||
/// </summary>
|
||||
private void LoadToolbarMenus()
|
||||
{
|
||||
var toolbarMenus = _menuItems.Where(x => x.Group == "Toolbar").Select(MenuItemToViewModel);
|
||||
var userMenus = toolbarMenus.Where(x => IsUserMenu(x)).Select(x => GetUserMenuItem(x));
|
||||
_originalSettingMenus = [.. userMenus];
|
||||
ToolbarMenus = _originalSettingMenus;
|
||||
var settingMenus = _menuItems.Where(x => x.Group == "Settings").Select(MenuItemToViewModel);
|
||||
SettingMenus = [.. settingMenus];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断用户是否有此菜单权限
|
||||
/// </summary>
|
||||
private bool IsUserMenu(MenuItemViewModel menuItem)
|
||||
{
|
||||
if (GlobalData.Instance.CurrentUser?.Menus?.Any(menu => menu.MenuKey == menuItem.Key) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (menuItem.Items != null)
|
||||
{
|
||||
foreach (var subItem in menuItem.Items)
|
||||
{
|
||||
if (IsUserMenu(subItem))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private MenuItemViewModel GetUserMenuItem(MenuItemViewModel menuItem)
|
||||
{
|
||||
var filteredSubItems = menuItem.Items?
|
||||
.Where(x => IsUserMenu(x))
|
||||
.Select(x => GetUserMenuItem(x))
|
||||
.ToList();
|
||||
return new MenuItemViewModel(menuItem.Text)
|
||||
{
|
||||
Key = menuItem.Key,
|
||||
IsActive = menuItem.IsActive,
|
||||
Icon = menuItem.Icon,
|
||||
CommandParameter = menuItem.CommandParameter,
|
||||
Items = filteredSubItems,
|
||||
MenuClickCommand = menuItem.MenuClickCommand,
|
||||
};
|
||||
}
|
||||
|
||||
#region 菜单搜索
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 搜索查找菜单
|
||||
/// </summary>
|
||||
/// <param name="keywords"></param>
|
||||
public void OnSerachMenu(string? keywords)
|
||||
{
|
||||
// 防抖是指在一定时间范围内,只有最后一次操作才会被执行。如果在这段时间内再次触发操作,则重新计时。
|
||||
// KeyUp 事件会在每个按键弹起时执行,为了避免频繁触发事件。所以进行防抖处理
|
||||
_debounce.Trigger(() =>
|
||||
{
|
||||
// 筛选菜单。在国际化场景中,使用 InvariantCultureIgnoreCase,以确保跨文化的比较行为一致
|
||||
var filterdMenus = _originalSettingMenus?
|
||||
.Where(x => ContainsKeyword(x, keywords ?? string.Empty, StringComparison.InvariantCultureIgnoreCase))
|
||||
.Select(x => FilterMenuItem(x, keywords ?? string.Empty, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
if (filterdMenus != null && filterdMenus.Count > 0)
|
||||
{
|
||||
var menus = new ObservableCollection<MenuItemViewModel>(filterdMenus);
|
||||
ToolbarMenus = [.. menus];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private MenuItemViewModel FilterMenuItem(MenuItemViewModel menuItem, string keyword, StringComparison comparison)
|
||||
{
|
||||
var filteredSubItems = menuItem.Items?
|
||||
.Where(x => ContainsKeyword(x, keyword, comparison))
|
||||
.Select(x => FilterMenuItem(x, keyword, comparison))
|
||||
.ToList();
|
||||
|
||||
return new MenuItemViewModel(menuItem.Text)
|
||||
{
|
||||
Key = menuItem.Key,
|
||||
IsActive = menuItem.IsActive,
|
||||
Icon = menuItem.Icon,
|
||||
CommandParameter = menuItem.CommandParameter,
|
||||
Items = filteredSubItems,
|
||||
MenuClickCommand = menuItem.MenuClickCommand,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool ContainsKeyword(MenuItemViewModel menuItem, string keyword, StringComparison comparison)
|
||||
{
|
||||
if (menuItem.Text.Contains(keyword, comparison))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (menuItem.Items != null)
|
||||
{
|
||||
foreach (var subItem in menuItem.Items)
|
||||
{
|
||||
if (ContainsKeyword(subItem, keyword, comparison))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 报警滚动条消息接收
|
||||
/// </summary>
|
||||
public void Receive(AlarmChangedMessage message)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
// 标记:是否有实际的报警列表变更(新增/删除)
|
||||
bool hasAlarmChanged = false;
|
||||
var latestAlarms = message.Value ?? new List<AlarmViewModel>();
|
||||
var currentTagIds = _alarms.Select(a => a.TagId).ToHashSet();
|
||||
var latestTagIds = latestAlarms.Select(a => a.TagId).ToHashSet();
|
||||
var alarmsToAdd = latestAlarms.Where(alarm => !currentTagIds.Contains(alarm.TagId)).ToList();
|
||||
if (alarmsToAdd.Any()) // 有新增项,标记变更
|
||||
{
|
||||
hasAlarmChanged = true;
|
||||
foreach (var alarm in alarmsToAdd)
|
||||
{
|
||||
_alarms.Add(alarm);
|
||||
}
|
||||
}
|
||||
var tagIdsToRemove = currentTagIds.Where(tagId => !latestTagIds.Contains(tagId)).ToList();
|
||||
if (tagIdsToRemove.Any()) // 有删除项,标记变更
|
||||
{
|
||||
hasAlarmChanged = true;
|
||||
foreach (var tagId in tagIdsToRemove)
|
||||
{
|
||||
var alarmToRemove = _alarms.FirstOrDefault(a => a.TagId == tagId);
|
||||
if (alarmToRemove != null)
|
||||
{
|
||||
_alarms.Remove(alarmToRemove);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasAlarmChanged)
|
||||
{
|
||||
// 拼接所有报警的Desc(自定义分隔符,这里用换行符,适合UI显示;也可改用分号";")
|
||||
//AlarmMsg = string.Join(Environment.NewLine, _alarms.Select(a => a.Desc));
|
||||
//需要去重Desc,过滤空Desc
|
||||
AlarmMsg = string.Join(" ",
|
||||
_alarms.Where(a => !string.IsNullOrEmpty(a.Desc))
|
||||
.Select(a => a.Desc)
|
||||
.Distinct());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 销毁时取消注册,避免内存泄漏
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing) _messenger.UnregisterAll(this);
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
36
Cowain.TestProject/ViewModels/ViewModelBase.cs
Normal file
36
Cowain.TestProject/ViewModels/ViewModelBase.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
|
||||
namespace Cowain.TestProject.ViewModels
|
||||
{
|
||||
public class ViewModelBase : ObservableValidator, IDisposable
|
||||
{
|
||||
private bool _disposed;
|
||||
|
||||
// 公开的 Dispose 方法(IDisposable 接口要求)
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// 虚方法:允许子类重写,清理自身资源
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
// 基类自身的托管资源清理(如命令、定时器等)
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 析构函数(非托管资源兜底)
|
||||
~ViewModelBase()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Cowain.TestProject/Views/Admin/RoleActionsDialog.axaml
Normal file
31
Cowain.TestProject/Views/Admin/RoleActionsDialog.axaml
Normal file
@@ -0,0 +1,31 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels.Admin"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="450"
|
||||
Width="300" Height="450"
|
||||
x:DataType="vm:RoleActionsDialogViewModel"
|
||||
x:Class="Cowain.TestProject.Views.Admin.RoleActionsDialog">
|
||||
<u:Form Margin="20 20" HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
LabelPosition="Top">
|
||||
|
||||
<u:FormItem
|
||||
u:FormItem.Label="{i18n:Localize RoleMenu.DataGrid.MenuActions}">
|
||||
<TreeView Margin="0,10" x:CompileBindings="False"
|
||||
ItemsSource="{Binding MenuActions}">
|
||||
<TreeView.ItemTemplate>
|
||||
<TreeDataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<CheckBox IsChecked="{Binding IsActive}" />
|
||||
<TextBlock Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</TreeDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
</u:FormItem>
|
||||
</u:Form>
|
||||
</UserControl>
|
||||
13
Cowain.TestProject/Views/Admin/RoleActionsDialog.axaml.cs
Normal file
13
Cowain.TestProject/Views/Admin/RoleActionsDialog.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Cowain.TestProject.Views.Admin;
|
||||
|
||||
public partial class RoleActionsDialog : UserControl
|
||||
{
|
||||
public RoleActionsDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
175
Cowain.TestProject/Views/Admin/RoleMenuSettingView.axaml
Normal file
175
Cowain.TestProject/Views/Admin/RoleMenuSettingView.axaml
Normal file
@@ -0,0 +1,175 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels.Admin"
|
||||
xmlns:vmb="using:Cowain.Base.ViewModels"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:conv="using:Cowain.Base.Converters"
|
||||
xmlns:extensions="using:Cowain.Base.Extensions"
|
||||
xmlns:semi="https://irihi.tech/semi"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:DataType="vm:RoleMenuSettingViewModel"
|
||||
x:Class="Cowain.TestProject.Views.Admin.RoleMenuSettingView">
|
||||
<UserControl.Resources>
|
||||
<conv:MenuActionsConverter x:Key="menuActionsConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="10" Margin="10 8">
|
||||
<u:IconButton
|
||||
Command="{Binding RefreshCommand}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconRedoStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
IsEnabled="{extensions:MenuEnable RoleMenuSettingView,edit}"
|
||||
Command="{Binding EditUserRoleMenuCommand}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconEdit2Stroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1" ColumnDefinitions="Auto *">
|
||||
<ScrollViewer>
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock Text="{i18n:Localize UserRole.DataGrid.RoleName}" />
|
||||
<!--
|
||||
<ListBox ItemsSource="{Binding UserRoles}"
|
||||
SelectedItem="{Binding SelectedRole}"
|
||||
Width="150">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border
|
||||
Width="4"
|
||||
Height="20"
|
||||
Margin="2 0 14 0"
|
||||
IsVisible="{Binding $parent[ListBoxItem].IsSelected, Mode=OneWay}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{DynamicResource SemiBlue6}"
|
||||
CornerRadius="4" />
|
||||
<TextBlock
|
||||
Classes.Active="{Binding $parent[ListBoxItem].IsSelected, Mode=OneWay}"
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding RoleName}" >
|
||||
<TextBlock.Styles>
|
||||
<Style Selector="TextBlock.Active">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SemiOrange6}" />
|
||||
</Style>
|
||||
</TextBlock.Styles>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
-->
|
||||
<u:SelectionList Name="roleMenu" Width="150"
|
||||
ItemsSource="{Binding UserRoles}"
|
||||
SelectedItem="{Binding SelectedRole}">
|
||||
<u:SelectionList.Indicator>
|
||||
<Border Background="Transparent" CornerRadius="4">
|
||||
<Border
|
||||
Width="4"
|
||||
Margin="0,8"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{DynamicResource SemiBlue6}"
|
||||
CornerRadius="4" />
|
||||
</Border>
|
||||
</u:SelectionList.Indicator>
|
||||
<u:SelectionList.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Panel Height="30">
|
||||
<TextBlock
|
||||
Classes.Active="{Binding $parent[u:SelectionListItem].IsSelected, Mode=OneWay}"
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding RoleName}">
|
||||
<TextBlock.Styles>
|
||||
<Style Selector="TextBlock.Active">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SemiOrange6}" />
|
||||
</Style>
|
||||
</TextBlock.Styles>
|
||||
</TextBlock>
|
||||
</Panel>
|
||||
</DataTemplate>
|
||||
</u:SelectionList.ItemTemplate>
|
||||
</u:SelectionList>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<DataGrid Grid.Column="1" FrozenColumnCount="2"
|
||||
Margin="8"
|
||||
CanUserReorderColumns="True"
|
||||
CanUserResizeColumns="True"
|
||||
CanUserSortColumns="True"
|
||||
HeadersVisibility="All"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding SelectedRole.Menus}">
|
||||
<DataGrid.Columns>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vmb:UserRoleMenuViewModel"
|
||||
Binding="{Binding MenuName}"
|
||||
IsReadOnly="True"
|
||||
Header="{i18n:Localize RoleMenu.DataGrid.MenuName}" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vmb:UserRoleMenuViewModel"
|
||||
Binding="{Binding MenuActions,Converter={StaticResource menuActionsConverter}}"
|
||||
IsReadOnly="True"
|
||||
Header="{i18n:Localize RoleMenu.DataGrid.MenuActions}" />
|
||||
|
||||
<DataGridTemplateColumn Header="{i18n:Localize UserRole.DataGrid.Edit}" Width="100">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<u:IconButton
|
||||
x:CompileBindings="False"
|
||||
IsEnabled="{extensions:MenuEnable RoleMenuSettingView,edit}"
|
||||
Command="{Binding $parent[DataGrid].DataContext.EditMenuActionsCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconEdit2Stroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
x:CompileBindings="False"
|
||||
IsEnabled="{extensions:MenuEnable RoleMenuSettingView,delete}"
|
||||
Command="{Binding $parent[DataGrid].DataContext.DeleteMenuActionsCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconDeleteStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
Cowain.TestProject/Views/Admin/RoleMenuSettingView.axaml.cs
Normal file
13
Cowain.TestProject/Views/Admin/RoleMenuSettingView.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Cowain.TestProject.Views.Admin;
|
||||
|
||||
public partial class RoleMenuSettingView : UserControl
|
||||
{
|
||||
public RoleMenuSettingView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
95
Cowain.TestProject/Views/Admin/UserEditDialog.axaml
Normal file
95
Cowain.TestProject/Views/Admin/UserEditDialog.axaml
Normal file
@@ -0,0 +1,95 @@
|
||||
<UserControl
|
||||
x:Class="Cowain.TestProject.Views.Admin.UserEditDialog"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="using:Cowain.Base.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels.Admin"
|
||||
xmlns:vmb="using:Cowain.Base.ViewModels"
|
||||
d:DesignHeight="620"
|
||||
d:DesignWidth="400"
|
||||
x:DataType="vm:UserEditDialogViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<conv:I18nLocalizeConverter x:Key="i18nConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid
|
||||
MinWidth="400"
|
||||
Margin="8,40,8,8"
|
||||
RowDefinitions="* Auto">
|
||||
<u:Form
|
||||
Grid.Row="0"
|
||||
Margin="20,20"
|
||||
HorizontalAlignment="Stretch"
|
||||
LabelPosition="Top">
|
||||
<u:Form.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel HorizontalAlignment="Stretch" Spacing="10" />
|
||||
</ItemsPanelTemplate>
|
||||
</u:Form.ItemsPanel>
|
||||
<u:FormItem u:FormItem.Label="{i18n:Localize UserManagement.DataGrid.Name}">
|
||||
<TextBox u:FormItem.Label="Owner" Text="{Binding User.Name}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem u:FormItem.Label="{i18n:Localize UserManagement.DataGrid.UserNumber}">
|
||||
<TextBox u:FormItem.Label="Owner" Text="{Binding User.UserNumber}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem u:FormItem.Label="{i18n:Localize UserManagement.DataGrid.Phone}">
|
||||
<TextBox u:FormItem.Label="Owner" Text="{Binding User.Phone}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem u:FormItem.Label="{i18n:Localize UserManagement.DataGrid.Password}">
|
||||
<TextBox u:FormItem.Label="Owner" Text="{Binding User.Password}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem u:FormItem.Label="{i18n:Localize UserManagement.DataGrid.Sex}">
|
||||
<ComboBox
|
||||
Width="200"
|
||||
ItemsSource="{Binding SexModes}"
|
||||
PlaceholderText="{i18n:Localize SexMode.Placeholder}"
|
||||
SelectedValue="{Binding SelectedSex}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='SexMode'}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</u:FormItem>
|
||||
<u:FormItem u:FormItem.Label="{i18n:Localize UserManagement.DataGrid.RoleName}">
|
||||
<ComboBox
|
||||
Width="200"
|
||||
ItemsSource="{Binding UserRoles}"
|
||||
PlaceholderText="{i18n:Localize UserManagement.RoleName.Placeholder}"
|
||||
SelectedValue="{Binding SelectedRole}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding RoleName}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</u:FormItem>
|
||||
<u:FormItem u:FormItem.Label="{i18n:Localize UserManagement.DataGrid.IsValid}">
|
||||
<ToggleSwitch
|
||||
u:FormItem.Label="Owner"
|
||||
IsChecked="{Binding User.IsValid}"
|
||||
OffContent="{i18n:Localize No}"
|
||||
OnContent="{i18n:Localize Yes}" />
|
||||
</u:FormItem>
|
||||
</u:Form>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="8"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal"
|
||||
Spacing="12">
|
||||
<Button
|
||||
Command="{Binding OkCommand}"
|
||||
Content="{i18n:Localize OK}"
|
||||
Theme="{DynamicResource SolidButton}" />
|
||||
<Button
|
||||
Command="{Binding CancelCommand}"
|
||||
Content="{i18n:Localize Cancel}"
|
||||
Theme="{DynamicResource SolidButton}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
Cowain.TestProject/Views/Admin/UserEditDialog.axaml.cs
Normal file
13
Cowain.TestProject/Views/Admin/UserEditDialog.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Cowain.TestProject.Views.Admin;
|
||||
|
||||
public partial class UserEditDialog : UserControl
|
||||
{
|
||||
public UserEditDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
166
Cowain.TestProject/Views/Admin/UserManagementView.axaml
Normal file
166
Cowain.TestProject/Views/Admin/UserManagementView.axaml
Normal file
@@ -0,0 +1,166 @@
|
||||
<UserControl
|
||||
x:Class="Cowain.TestProject.Views.Admin.UserManagementView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="using:Cowain.Base.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:extensions="using:Cowain.Base.Extensions"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:semi="https://irihi.tech/semi"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels.Admin"
|
||||
xmlns:vmb="using:Cowain.Base.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:DataType="vm:UserManagementViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<conv:I18nLocalizeConverter x:Key="i18nConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid RowDefinitions="Auto * Auto">
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Margin="10,8"
|
||||
Orientation="Horizontal"
|
||||
Spacing="10">
|
||||
<u:IconButton
|
||||
Command="{Binding AddUserCommand}"
|
||||
IsEnabled="{extensions:MenuEnable UserManagementView,
|
||||
add}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconPlusStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding #page.CurrentPage}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconRedoStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconExternalOpenStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
Margin="8"
|
||||
CanUserReorderColumns="True"
|
||||
CanUserResizeColumns="True"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="2"
|
||||
HeadersVisibility="All"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding Users}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="60"
|
||||
x:DataType="vmb:UserViewModel"
|
||||
Binding="{Binding Id}"
|
||||
Header="{i18n:Localize UserManagement.DataGrid.Id}"
|
||||
IsReadOnly="True" />
|
||||
|
||||
<DataGridTemplateColumn Width="100" Header="{i18n:Localize UserManagement.DataGrid.Edit}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<u:IconButton
|
||||
x:CompileBindings="False"
|
||||
Command="{Binding $parent[DataGrid].DataContext.EditUserCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
IsEnabled="{extensions:MenuEnable UserManagementView,
|
||||
edit}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconEdit2Stroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
x:CompileBindings="False"
|
||||
Command="{Binding $parent[DataGrid].DataContext.DeleteUserCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
IsEnabled="{extensions:MenuEnable UserManagementView,
|
||||
delete}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconDeleteStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vmb:UserViewModel"
|
||||
Binding="{Binding Name}"
|
||||
Header="{i18n:Localize UserManagement.DataGrid.Name}"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vmb:UserViewModel"
|
||||
Binding="{Binding UserNumber}"
|
||||
Header="{i18n:Localize UserManagement.DataGrid.UserNumber}"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vmb:UserViewModel"
|
||||
Binding="{Binding Phone}"
|
||||
Header="{i18n:Localize UserManagement.DataGrid.Phone}"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vmb:UserViewModel"
|
||||
Binding="{Binding RoleName}"
|
||||
Header="{i18n:Localize UserManagement.DataGrid.RoleName}"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
x:DataType="vmb:UserViewModel"
|
||||
Binding="{Binding Sex, Mode=OneWay, Converter={StaticResource i18nConverter}, ConverterParameter='SexMode'}"
|
||||
Header="{i18n:Localize UserManagement.DataGrid.Sex}"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
x:DataType="vmb:UserViewModel"
|
||||
Binding="{Binding IsValid}"
|
||||
Header="{i18n:Localize UserManagement.DataGrid.IsValid}"
|
||||
IsReadOnly="True" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
<u:Pagination
|
||||
Name="page"
|
||||
Grid.Row="2"
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding $self.CurrentPage}"
|
||||
CurrentPage="{Binding PageIndex, Mode=TwoWay}"
|
||||
PageSize="{Binding PageSize, Mode=TwoWay}"
|
||||
PageSizeOptions="10, 20, 50, 100"
|
||||
ShowPageSizeSelector="True"
|
||||
ShowQuickJump="True"
|
||||
TotalCount="{Binding Totals}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
Cowain.TestProject/Views/Admin/UserManagementView.axaml.cs
Normal file
13
Cowain.TestProject/Views/Admin/UserManagementView.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Cowain.TestProject.Views.Admin;
|
||||
|
||||
public partial class UserManagementView : UserControl
|
||||
{
|
||||
public UserManagementView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
50
Cowain.TestProject/Views/Admin/UserRoleDialog.axaml
Normal file
50
Cowain.TestProject/Views/Admin/UserRoleDialog.axaml
Normal file
@@ -0,0 +1,50 @@
|
||||
<UserControl
|
||||
x:Class="Cowain.TestProject.Views.Admin.UserRoleDialog"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels.Admin"
|
||||
Width="350"
|
||||
Height="300"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="350"
|
||||
x:DataType="vm:UserRoleDialogViewModel"
|
||||
mc:Ignorable="d">
|
||||
<u:Form
|
||||
Margin="20,20"
|
||||
HorizontalAlignment="Stretch"
|
||||
LabelPosition="Top">
|
||||
<u:Form.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Grid RowDefinitions="Auto, *" />
|
||||
</ItemsPanelTemplate>
|
||||
</u:Form.ItemsPanel>
|
||||
<u:FormItem Label="{i18n:Localize UserRole.DataGrid.RoleName}">
|
||||
<TextBox u:FormItem.Label="Owner" Text="{Binding UserRole.RoleName}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem Grid.Row="1" Label="{i18n:Localize UserRole.DataGrid.IsValid}">
|
||||
<ToggleSwitch
|
||||
u:FormItem.Label="Owner"
|
||||
IsChecked="{Binding UserRole.IsValid}"
|
||||
OffContent="{i18n:Localize No}"
|
||||
OnContent="{i18n:Localize Yes}" />
|
||||
</u:FormItem>
|
||||
</u:Form>
|
||||
<!--
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal"
|
||||
HorizontalAlignment="Right" Spacing="12"
|
||||
Margin="8">
|
||||
<Button
|
||||
Command="{Binding OKCommand}"
|
||||
Content="{i18n:Localize OK}"
|
||||
Theme="{DynamicResource SolidButton}" />
|
||||
<Button
|
||||
Command="{Binding CancelCommand}"
|
||||
Content="{i18n:Localize Cancel}"
|
||||
Theme="{DynamicResource SolidButton}" />
|
||||
</StackPanel>
|
||||
-->
|
||||
</UserControl>
|
||||
13
Cowain.TestProject/Views/Admin/UserRoleDialog.axaml.cs
Normal file
13
Cowain.TestProject/Views/Admin/UserRoleDialog.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Cowain.TestProject.Views.Admin;
|
||||
|
||||
public partial class UserRoleDialog : UserControl
|
||||
{
|
||||
public UserRoleDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
60
Cowain.TestProject/Views/Admin/UserRoleMenuDialog.axaml
Normal file
60
Cowain.TestProject/Views/Admin/UserRoleMenuDialog.axaml
Normal file
@@ -0,0 +1,60 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels.Admin"
|
||||
xmlns:vmb="using:Cowain.Base.ViewModels"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
mc:Ignorable="d" d:DesignWidth="350" d:DesignHeight="600"
|
||||
Width="450" Height="600"
|
||||
x:DataType="vm:UserRoleMenuDialogViewModel"
|
||||
x:Class="Cowain.TestProject.Views.Admin.UserRoleMenuDialog">
|
||||
<Grid RowDefinitions="Auto * Auto" Margin="8">
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="10"
|
||||
FontSize="16"
|
||||
FontWeight="600"
|
||||
Text="{i18n:Localize UserRole.Dialog.Title}" />
|
||||
|
||||
<Grid Grid.Row="1" RowDefinitions="Auto,Auto,Auto,*">
|
||||
<TextBlock Grid.Row="0" Margin="10" Text="{i18n:Localize UserRole.DataGrid.RoleName}" />
|
||||
<ComboBox Grid.Row="1" Margin="10"
|
||||
x:DataType="vm:UserRoleMenuDialogViewModel"
|
||||
ItemsSource="{Binding UserRoles}"
|
||||
IsEnabled="{Binding IsEdit}"
|
||||
DisplayMemberBinding="{Binding RoleName}"
|
||||
Width="180"
|
||||
SelectedItem="{Binding SelectedRole}" />
|
||||
<TextBlock Grid.Row="2" Margin="10" Text="{i18n:Localize RoleMenu.Dialog.MenuSelect}" />
|
||||
<TreeView Grid.Row="3"
|
||||
Margin="10"
|
||||
ItemsSource="{Binding ToolbarMenus}">
|
||||
<TreeView.ItemTemplate>
|
||||
<TreeDataTemplate ItemsSource="{Binding Items}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<CheckBox IsChecked="{Binding IsActive}" />
|
||||
<TextBlock Text="{Binding Key}" />
|
||||
<TextBlock Text="->" />
|
||||
<TextBlock Text="{Binding Text}" />
|
||||
</StackPanel>
|
||||
</TreeDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal"
|
||||
HorizontalAlignment="Right" Spacing="12"
|
||||
Margin="8">
|
||||
<Button
|
||||
Command="{Binding OkCommand}"
|
||||
Content="{i18n:Localize OK}"
|
||||
Theme="{DynamicResource SolidButton}" />
|
||||
<Button
|
||||
Command="{Binding CancelCommand}"
|
||||
Content="{i18n:Localize Cancel}"
|
||||
Theme="{DynamicResource SolidButton}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
Cowain.TestProject/Views/Admin/UserRoleMenuDialog.axaml.cs
Normal file
13
Cowain.TestProject/Views/Admin/UserRoleMenuDialog.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Cowain.TestProject.Views.Admin;
|
||||
|
||||
public partial class UserRoleMenuDialog : UserControl
|
||||
{
|
||||
public UserRoleMenuDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
127
Cowain.TestProject/Views/Admin/UserRoleSettingView.axaml
Normal file
127
Cowain.TestProject/Views/Admin/UserRoleSettingView.axaml
Normal file
@@ -0,0 +1,127 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels.Admin"
|
||||
xmlns:vmb="using:Cowain.Base.ViewModels"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:extensions="using:Cowain.Base.Extensions"
|
||||
xmlns:semi="https://irihi.tech/semi"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:conv="using:Cowain.Base.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:DataType="vm:UserRoleSettingViewModel"
|
||||
x:Class="Cowain.TestProject.Views.Admin.UserRoleSettingView">
|
||||
<UserControl.Resources>
|
||||
</UserControl.Resources>
|
||||
<Grid RowDefinitions="Auto * Auto">
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="10" Margin="10 8">
|
||||
<u:IconButton
|
||||
IsEnabled="{extensions:MenuEnable UserRoleSettingView,add}"
|
||||
Command="{Binding AddUserRoleCommand}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconPlusStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding #page.CurrentPage}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconRedoStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconExternalOpenStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
<DataGrid Grid.Row="1" FrozenColumnCount="2"
|
||||
Margin="8"
|
||||
CanUserReorderColumns="True"
|
||||
CanUserResizeColumns="True"
|
||||
CanUserSortColumns="True"
|
||||
HeadersVisibility="All"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding UserRoles}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="80"
|
||||
x:DataType="vmb:UserRoleViewModel"
|
||||
Binding="{Binding RoleId}"
|
||||
IsReadOnly="True"
|
||||
Header="{i18n:Localize UserRole.DataGrid.RoleId}" />
|
||||
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vmb:UserRoleViewModel"
|
||||
Binding="{Binding RoleName}"
|
||||
IsReadOnly="True"
|
||||
Header="{i18n:Localize UserRole.DataGrid.RoleName}" />
|
||||
<DataGridTextColumn
|
||||
Width="6*"
|
||||
x:DataType="vmb:UserRoleViewModel"
|
||||
Binding="{Binding IsValid}"
|
||||
IsReadOnly="True"
|
||||
Header="{i18n:Localize UserRole.DataGrid.IsValid}" />
|
||||
<DataGridTemplateColumn Header="{i18n:Localize UserRole.DataGrid.Edit}" Width="2*">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<u:IconButton
|
||||
x:CompileBindings="False"
|
||||
IsEnabled="{extensions:MenuEnable UserRoleSettingView,edit}"
|
||||
Command="{Binding $parent[DataGrid].DataContext.EditUserRoleCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconEdit2Stroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton x:CompileBindings="False"
|
||||
IsEnabled="{extensions:MenuEnable UserRoleSettingView,delete}"
|
||||
Command="{Binding $parent[DataGrid].DataContext.DelUserRoleCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconDeleteStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
<u:Pagination Grid.Row="2"
|
||||
Name="page"
|
||||
PageSizeOptions="10, 20, 50, 100"
|
||||
ShowQuickJump="True"
|
||||
ShowPageSizeSelector="True"
|
||||
PageSize="{Binding PageSize,Mode=TwoWay}"
|
||||
CurrentPage="{Binding PageIndex,Mode=TwoWay}"
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding $self.CurrentPage}"
|
||||
TotalCount="{Binding Totals}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
17
Cowain.TestProject/Views/Admin/UserRoleSettingView.axaml.cs
Normal file
17
Cowain.TestProject/Views/Admin/UserRoleSettingView.axaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Notifications;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Cowain.Base.Helpers;
|
||||
|
||||
namespace Cowain.TestProject.Views.Admin;
|
||||
|
||||
public partial class UserRoleSettingView : UserControl
|
||||
{
|
||||
public UserRoleSettingView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
100
Cowain.TestProject/Views/LoginView.axaml
Normal file
100
Cowain.TestProject/Views/LoginView.axaml
Normal file
@@ -0,0 +1,100 @@
|
||||
<UserControl
|
||||
x:Class="Cowain.TestProject.Views.LoginView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:local="using:Cowain.TestProject.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:menu="using:Cowain.Base.ViewModels"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="600"
|
||||
x:DataType="vm:LoginWindowViewModel"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="Button">
|
||||
<Setter Property="Theme" Value="{DynamicResource BorderlessButton}" />
|
||||
<Setter Property="Padding" Value="8" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="PathIcon">
|
||||
<Setter Property="Theme" Value="{DynamicResource InnerPathIcon}" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
|
||||
<ToggleSwitch
|
||||
Command="{Binding ToggleThemeCommand}"
|
||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}"
|
||||
OffContent="{StaticResource SemiIconSun}"
|
||||
OnContent="{StaticResource SemiIconMoon}"
|
||||
Theme="{DynamicResource ThemeToggleSwitch}" />
|
||||
<!-- 设置菜单 -->
|
||||
<ItemsControl DockPanel.Dock="Bottom" ItemsSource="{Binding SettingMenus}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Classes="ToolbarIconButton">
|
||||
<PathIcon Data="{StaticResource SemiIconMenu}" />
|
||||
<Button.Flyout>
|
||||
<MenuFlyout ItemsSource="{Binding Items}" Placement="Top">
|
||||
<MenuFlyout.ItemContainerTheme>
|
||||
<ControlTheme
|
||||
x:DataType="menu:MenuItemViewModel"
|
||||
BasedOn="{StaticResource {x:Type MenuItem}}"
|
||||
TargetType="MenuItem">
|
||||
<Setter Property="Header" Value="{Binding Text}" />
|
||||
<Setter Property="ItemsSource" Value="{Binding Items}" />
|
||||
<Setter Property="Icon" Value="{Binding Icon}" />
|
||||
<Setter Property="Command" Value="{Binding MenuClickCommand}" />
|
||||
<Setter Property="CommandParameter" Value="{Binding}" />
|
||||
</ControlTheme>
|
||||
</MenuFlyout.ItemContainerTheme>
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="20">
|
||||
<Image
|
||||
Width="185"
|
||||
Height="50"
|
||||
RenderOptions.BitmapInterpolationMode="HighQuality"
|
||||
Source="/Assets/CowainLogo.png" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
Classes="H4"
|
||||
Text="{i18n:Localize AppName}" />
|
||||
<TextBox
|
||||
Width="300"
|
||||
Text="{Binding UserName}"
|
||||
Watermark="{i18n:Localize Login.UserName}" />
|
||||
<TextBox
|
||||
Width="300"
|
||||
Classes="revealPasswordButton"
|
||||
Text="{Binding Password}"
|
||||
Watermark="{i18n:Localize Login.Password}" />
|
||||
<CheckBox Content="{i18n:Localize Login.RememberUserName}" IsChecked="{Binding RememberUserName}" />
|
||||
<Button
|
||||
Width="300"
|
||||
Command="{Binding LoginCommand}"
|
||||
CommandParameter="{Binding $parent[Window]}"
|
||||
Content="{i18n:Localize Login.Login}" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
Foreground="Red"
|
||||
Text="{Binding ErrorMessage}" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
12
Cowain.TestProject/Views/LoginView.axaml.cs
Normal file
12
Cowain.TestProject/Views/LoginView.axaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Cowain.TestProject.Views
|
||||
{
|
||||
public partial class LoginView : UserControl
|
||||
{
|
||||
public LoginView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Cowain.TestProject/Views/LoginWindow.axaml
Normal file
21
Cowain.TestProject/Views/LoginWindow.axaml
Normal file
@@ -0,0 +1,21 @@
|
||||
<Window
|
||||
x:Class="Cowain.TestProject.Views.LoginWindow"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:menu="using:Cowain.Base.ViewModels"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:views="using:Cowain.TestProject.Views"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels"
|
||||
Title="{i18n:Localize LoginTitle}"
|
||||
Width="600"
|
||||
Height="450"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="600"
|
||||
Icon="/Assets/CowainLogo.ico"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<views:LoginView />
|
||||
</Window>
|
||||
11
Cowain.TestProject/Views/LoginWindow.axaml.cs
Normal file
11
Cowain.TestProject/Views/LoginWindow.axaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Cowain.TestProject.Views;
|
||||
|
||||
public partial class LoginWindow : Window
|
||||
{
|
||||
public LoginWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
105
Cowain.TestProject/Views/LogsView.axaml
Normal file
105
Cowain.TestProject/Views/LogsView.axaml
Normal file
@@ -0,0 +1,105 @@
|
||||
<UserControl
|
||||
x:Class="Cowain.TestProject.Views.LogsView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="using:Cowain.Base.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:semi="https://irihi.tech/semi"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:viewmodels="using:Cowain.TestProject.ViewModels"
|
||||
xmlns:vm="using:Cowain.Base.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:DataType="viewmodels:LogsViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<conv:I18nLocalizeConverter x:Key="i18nConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid RowDefinitions="Auto * Auto">
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Margin="10,8"
|
||||
Orientation="Horizontal"
|
||||
Spacing="10">
|
||||
<u:IconButton
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding #page.CurrentPage}"
|
||||
Theme="{DynamicResource BorderlessIconButton}"
|
||||
ToolTip.Tip="{i18n:Localize Log.Tooltip.Refresh}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconRedoStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Command="{Binding ExportCommand}"
|
||||
Theme="{DynamicResource BorderlessIconButton}"
|
||||
ToolTip.Tip="{i18n:Localize Log.Tooltip.Export}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconExternalOpenStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserReorderColumns="True"
|
||||
CanUserResizeColumns="True"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="2"
|
||||
HeadersVisibility="All"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding LogList}"
|
||||
RowHeight="30">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="70"
|
||||
x:DataType="vm:SerilogViewModel"
|
||||
Binding="{Binding Id}"
|
||||
Header="{i18n:Localize Log.DataGrid.Id}" />
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="250"
|
||||
x:DataType="vm:SerilogViewModel"
|
||||
Binding="{Binding Timestamp}"
|
||||
Header="{i18n:Localize Log.DataGrid.Timestamp}" />
|
||||
<DataGridTextColumn
|
||||
Width="150"
|
||||
x:DataType="vm:SerilogViewModel"
|
||||
Binding="{Binding Level}"
|
||||
Header="{i18n:Localize Log.DataGrid.Level}" />
|
||||
<DataGridTextColumn
|
||||
Width="500"
|
||||
x:DataType="vm:SerilogViewModel"
|
||||
Binding="{Binding Message}"
|
||||
Header="{i18n:Localize Log.DataGrid.Message}" />
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="160"
|
||||
x:DataType="vm:SerilogViewModel"
|
||||
Binding="{Binding Exception}"
|
||||
Header="{i18n:Localize Log.DataGrid.Exception}" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<u:Pagination
|
||||
Name="page"
|
||||
Grid.Row="2"
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding $self.CurrentPage}"
|
||||
CurrentPage="{Binding PageIndex, Mode=TwoWay}"
|
||||
PageSize="{Binding PageSize, Mode=TwoWay}"
|
||||
PageSizeOptions="10, 20, 50, 100"
|
||||
ShowPageSizeSelector="True"
|
||||
ShowQuickJump="True"
|
||||
TotalCount="{Binding Totals}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
12
Cowain.TestProject/Views/LogsView.axaml.cs
Normal file
12
Cowain.TestProject/Views/LogsView.axaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Cowain.TestProject.Views
|
||||
{
|
||||
public partial class LogsView : UserControl
|
||||
{
|
||||
public LogsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Cowain.TestProject/Views/MainContextView.axaml
Normal file
12
Cowain.TestProject/Views/MainContextView.axaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
x:Class="Cowain.TestProject.Views.MainContextView">
|
||||
<TransitioningContentControl
|
||||
Content="{Binding CurrentPage}" />
|
||||
|
||||
</UserControl>
|
||||
32
Cowain.TestProject/Views/MainContextView.axaml.cs
Normal file
32
Cowain.TestProject/Views/MainContextView.axaml.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Notifications;
|
||||
using Avalonia.LogicalTree;
|
||||
using Cowain.Base.Helpers;
|
||||
using WindowNotificationManager = Ursa.Controls.WindowNotificationManager;
|
||||
|
||||
namespace Cowain.TestProject.Views;
|
||||
|
||||
public partial class MainContextView : UserControl
|
||||
{
|
||||
public MainContextView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnAttachedToVisualTree(e);
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
FileDialogHelper.Provider = topLevel?.StorageProvider;
|
||||
NotificationHelper.NotificationManager = new WindowNotificationManager(topLevel) { MaxItems = 3 };
|
||||
NotificationHelper.NotificationManager.Position = NotificationPosition.BottomRight;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnDetachedFromLogicalTree(e);
|
||||
FileDialogHelper.Provider = null;
|
||||
NotificationHelper.NotificationManager?.Uninstall();
|
||||
}
|
||||
}
|
||||
144
Cowain.TestProject/Views/MainView.axaml
Normal file
144
Cowain.TestProject/Views/MainView.axaml
Normal file
@@ -0,0 +1,144 @@
|
||||
<UserControl
|
||||
x:Class="Cowain.TestProject.Views.MainView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:am="using:Avalonia.Media"
|
||||
xmlns:conv="using:Cowain.Base.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:extensions="using:Cowain.Base.Extensions"
|
||||
xmlns:i="using:Avalonia.Xaml.Interactivity"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:ia="using:Avalonia.Xaml.Interactions.Core"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:menu="using:Cowain.Base.ViewModels"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:view="using:Cowain.TestProject.Views"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels"
|
||||
MinWidth="1024"
|
||||
MinHeight="500"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<conv:FirstLetterConverter x:Key="FirstLetterConverter" />
|
||||
<conv:StringToBoolConverter x:Key="StringToBoolConverter" />
|
||||
</UserControl.Resources>
|
||||
|
||||
|
||||
|
||||
<Grid Classes.Blur="{Binding $parent[u:UrsaWindow].(u:OverlayDialogHost.IsInModalStatus)}" ColumnDefinitions="Auto *">
|
||||
|
||||
<Border
|
||||
Padding="0"
|
||||
HorizontalAlignment="Left"
|
||||
BorderThickness="0,0,1,0"
|
||||
Theme="{DynamicResource CardBorder}">
|
||||
<!-- 导航菜单 -->
|
||||
<u:NavMenu
|
||||
Name="menu"
|
||||
Margin="0,10,0,0"
|
||||
CommandBinding="{Binding MenuClickCommand}"
|
||||
ExpandWidth="200"
|
||||
HeaderBinding="{Binding Text}"
|
||||
IconBinding="{Binding Icon}"
|
||||
IsHorizontalCollapsed="{Binding #collapse.IsChecked, Mode=OneWay}"
|
||||
ItemsSource="{Binding ToolbarMenus}"
|
||||
SelectedItem="{Binding SelectedMenuItem}"
|
||||
SubMenuBinding="{Binding Items}">
|
||||
<u:NavMenu.IconTemplate>
|
||||
<DataTemplate DataType="{x:Type am:StreamGeometry}">
|
||||
<u:TwoTonePathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
ActiveForeground="{DynamicResource SemiBlue5}"
|
||||
ActiveStrokeBrush="{DynamicResource SemiBlue5}"
|
||||
Data="{Binding}"
|
||||
Foreground="{DynamicResource SemiGrey5}"
|
||||
IsActive="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=u:NavMenuItem}, Path=IsHighlighted, Mode=TwoWay}"
|
||||
StrokeBrush="{DynamicResource SemiGrey5}" />
|
||||
</DataTemplate>
|
||||
</u:NavMenu.IconTemplate>
|
||||
<u:NavMenu.Header>
|
||||
<StackPanel
|
||||
Margin="4,4,4,20"
|
||||
HorizontalAlignment="Center"
|
||||
Spacing="15">
|
||||
<Image
|
||||
Width="48"
|
||||
Height="47"
|
||||
u:NavMenu.CanToggle="True"
|
||||
Source="/Assets/CowainLogo.ico" />
|
||||
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Classes="H10"
|
||||
IsVisible="{Binding !#menu.IsHorizontalCollapsed}"
|
||||
Theme="{DynamicResource TitleTextBlock}">
|
||||
<Run Text="{i18n:Localize AppName}" />
|
||||
<Run Text=" V" />
|
||||
<Run Text="{Binding AppVersion}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</u:NavMenu.Header>
|
||||
<u:NavMenu.Footer>
|
||||
<!-- 搜索框 -->
|
||||
<StackPanel Margin="4" Orientation="Horizontal">
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Margin="12,8"
|
||||
u:NavMenu.CanToggle="True"
|
||||
Data="{StaticResource SemiIconSearchStroked}" />
|
||||
<TextBox
|
||||
x:Name="SerachTextBox"
|
||||
Grid.Column="1"
|
||||
Classes="clearButton"
|
||||
IsVisible="{Binding !#menu.IsHorizontalCollapsed}"
|
||||
Watermark="{i18n:Localize View.SearchInput.Placeholder}">
|
||||
<i:Interaction.Behaviors>
|
||||
<ia:EventTriggerBehavior EventName="TextChanged" SourceObject="SerachTextBox">
|
||||
<ia:InvokeCommandAction Command="{Binding SerachKeyUpCommand}" CommandParameter="{Binding #SerachTextBox.Text}" />
|
||||
</ia:EventTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
</u:NavMenu.Footer>
|
||||
</u:NavMenu>
|
||||
|
||||
</Border>
|
||||
|
||||
<Grid
|
||||
Grid.Column="1"
|
||||
Margin="12,36,12,12"
|
||||
RowDefinitions="Auto * Auto">
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Margin="4"
|
||||
Padding="12,4"
|
||||
Theme="{DynamicResource CardBorder}">
|
||||
<Panel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ToggleSwitch Name="collapse" Theme="{DynamicResource SplitViewToggleSwitch}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding SelectedMenuItem.Text}" />
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
</Border>
|
||||
<view:MainContextView Grid.Row="1" Margin="6,4" />
|
||||
<u:Marquee Grid.Row="2"
|
||||
Height="30" Margin="4,2"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Speed="60"
|
||||
IsVisible="{Binding AlarmMsg, Converter={x:Static conv:StringVisibilityConverter.IsNotNullOrEmpty} }"
|
||||
Background="{DynamicResource SemiBlue1}"
|
||||
Foreground="{DynamicResource SemiRed4}"
|
||||
Direction="Left"
|
||||
Content="{Binding AlarmMsg}"
|
||||
IsRunning="True">
|
||||
</u:Marquee>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
Cowain.TestProject/Views/MainView.axaml.cs
Normal file
13
Cowain.TestProject/Views/MainView.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Cowain.TestProject.Views;
|
||||
|
||||
public partial class MainView : UserControl
|
||||
{
|
||||
public MainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
88
Cowain.TestProject/Views/MainWindow.axaml
Normal file
88
Cowain.TestProject/Views/MainWindow.axaml
Normal file
@@ -0,0 +1,88 @@
|
||||
<u:UrsaWindow
|
||||
x:Class="Cowain.TestProject.Views.MainWindow"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:extensions="using:Cowain.Base.Extensions"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:menu="using:Cowain.Base.ViewModels"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:view="using:Cowain.TestProject.Views"
|
||||
xmlns:views="using:Cowain.TestProject.Views"
|
||||
xmlns:vm="using:Cowain.TestProject.ViewModels"
|
||||
Title="{i18n:Localize AppName}"
|
||||
Width="1024"
|
||||
Height="600"
|
||||
MinWidth="1024"
|
||||
MinHeight="500"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Icon="/Assets/CowainLogo.ico"
|
||||
IsFullScreenButtonVisible="{OnPlatform True,
|
||||
macOS=False}"
|
||||
IsManagedResizerVisible="{OnPlatform False,
|
||||
Linux=True}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
|
||||
<u:UrsaWindow.RightContent>
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<StackPanel.Styles>
|
||||
<Style Selector="Button">
|
||||
<Setter Property="Theme" Value="{DynamicResource BorderlessButton}" />
|
||||
<Setter Property="Padding" Value="8" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
</Style>
|
||||
<Style Selector="PathIcon">
|
||||
<Setter Property="Theme" Value="{DynamicResource InnerPathIcon}" />
|
||||
</Style>
|
||||
</StackPanel.Styles>
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Text="{extensions:GlobalDataExtensions CurrentUser, Name}" />
|
||||
|
||||
<ToggleSwitch
|
||||
Command="{Binding ToggleThemeCommand}"
|
||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}"
|
||||
OffContent="{StaticResource SemiIconSun}"
|
||||
OnContent="{StaticResource SemiIconMoon}"
|
||||
Theme="{DynamicResource ThemeToggleSwitch}" />
|
||||
|
||||
<!-- 设置菜单 -->
|
||||
<ItemsControl DockPanel.Dock="Bottom" ItemsSource="{Binding SettingMenus}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Classes="ToolbarIconButton">
|
||||
<PathIcon Data="{StaticResource SemiIconMenu}" />
|
||||
<Button.Flyout>
|
||||
<MenuFlyout ItemsSource="{Binding Items}" Placement="Top">
|
||||
<MenuFlyout.ItemContainerTheme>
|
||||
<ControlTheme
|
||||
x:DataType="menu:MenuItemViewModel"
|
||||
BasedOn="{StaticResource {x:Type MenuItem}}"
|
||||
TargetType="MenuItem">
|
||||
<Setter Property="Header" Value="{Binding Text}" />
|
||||
<Setter Property="ItemsSource" Value="{Binding Items}" />
|
||||
<Setter Property="Icon" Value="{Binding Icon}" />
|
||||
<Setter Property="Command" Value="{Binding MenuClickCommand}" />
|
||||
<Setter Property="CommandParameter" Value="{Binding}" />
|
||||
</ControlTheme>
|
||||
</MenuFlyout.ItemContainerTheme>
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</u:UrsaWindow.RightContent>
|
||||
|
||||
<views:MainView />
|
||||
|
||||
</u:UrsaWindow>
|
||||
21
Cowain.TestProject/Views/MainWindow.axaml.cs
Normal file
21
Cowain.TestProject/Views/MainWindow.axaml.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Cowain.Base.Helpers;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using System.Threading.Tasks;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Cowain.TestProject.Views;
|
||||
public partial class MainWindow : UrsaWindow
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override async Task<bool> CanClose()
|
||||
{
|
||||
ILocalizer _l = ServiceLocator.GetRequiredService<ILocalizer>();
|
||||
var result = await MessageBox.ShowOverlayAsync(_l["CloseAppDialog"], _l["ExitTitle"], button: MessageBoxButton.YesNo);
|
||||
return result == MessageBoxResult.Yes;
|
||||
}
|
||||
|
||||
}
|
||||
10
Cowain.TestProject/appsettings.json
Normal file
10
Cowain.TestProject/appsettings.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"WcsFindTaskOnStartUp":"True",
|
||||
"Database": { "db": "MySql" },
|
||||
"ConnectionStrings": {
|
||||
"MySqlConn": "Server=127.0.0.1;Database=db_6055006;Port=3307;charset=utf8;uid=root;pwd=123456;persistsecurityinfo=True;",
|
||||
"SqlServerConn": "Data Source= 127.0.0.1; Connect Timeout=600;User ID= sa;Password= 123456; Initial Catalog=testProjectDb;Encrypt=False;",
|
||||
"PostGresConn": "Server=127.0.0.1;Port=5432;User Id=postgres;Password=123456;Database=testProjectDb;",
|
||||
"SqlLiteConn": "Data Source=Configs/DB/localDb.sqlite"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user