Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23f3f9763f | ||
|
|
fc04ba165b | ||
|
|
f614a099a0 | ||
|
|
91ded5ac61 | ||
|
|
b83624f0c3 |
@@ -33,11 +33,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Driver", "Driver", "{30F461
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.TestProject", "Cowain.TestProject\Cowain.TestProject.csproj", "{2EE939AE-6843-3006-BC7A-6542BBAABB23}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.TestProject", "Cowain.TestProject\Cowain.TestProject.csproj", "{2EE939AE-6843-3006-BC7A-6542BBAABB23}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Baking", "Baking", "{0A0182D3-52CC-40AA-9A5D-FCE6A20F170B}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.AvaloniaPreview", "Plugins\Plugin.AvaloniaPreview\Plugin.AvaloniaPreview.csproj", "{951663D7-99B7-5109-93F5-5072D8F25897}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.AvaloniaPreview", "Plugins\Plugin.AvaloniaPreview\Plugin.AvaloniaPreview.csproj", "{951663D7-99B7-5109-93F5-5072D8F25897}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.Cowain.Baking", "Plugins\Baking\Plugin.Cowain.Baking\Plugin.Cowain.Baking.csproj", "{D0C1B285-1FDA-4C71-92BE-CF9BD28931CB}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.Cowain.Wcs", "Plugins\Wcs\Plugin.Cowain.Wcs\Plugin.Cowain.Wcs.csproj", "{BEAD32CC-A67F-09CB-7A11-28495EB31A53}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Wcs", "Wcs", "{83F1AB6C-033C-4713-A604-12D860002E17}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -85,10 +85,10 @@ Global
|
|||||||
{951663D7-99B7-5109-93F5-5072D8F25897}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{951663D7-99B7-5109-93F5-5072D8F25897}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{951663D7-99B7-5109-93F5-5072D8F25897}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{951663D7-99B7-5109-93F5-5072D8F25897}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{951663D7-99B7-5109-93F5-5072D8F25897}.Release|Any CPU.Build.0 = Release|Any CPU
|
{951663D7-99B7-5109-93F5-5072D8F25897}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{D0C1B285-1FDA-4C71-92BE-CF9BD28931CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{BEAD32CC-A67F-09CB-7A11-28495EB31A53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D0C1B285-1FDA-4C71-92BE-CF9BD28931CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{BEAD32CC-A67F-09CB-7A11-28495EB31A53}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D0C1B285-1FDA-4C71-92BE-CF9BD28931CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{BEAD32CC-A67F-09CB-7A11-28495EB31A53}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D0C1B285-1FDA-4C71-92BE-CF9BD28931CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
{BEAD32CC-A67F-09CB-7A11-28495EB31A53}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -98,9 +98,9 @@ Global
|
|||||||
{6C22C8CF-C50F-295E-7691-1C8933521476} = {30F46168-468C-44E9-9EEF-6796FC7CE213}
|
{6C22C8CF-C50F-295E-7691-1C8933521476} = {30F46168-468C-44E9-9EEF-6796FC7CE213}
|
||||||
{58615919-38A2-B9AA-8B03-E232DEADCFC8} = {30F46168-468C-44E9-9EEF-6796FC7CE213}
|
{58615919-38A2-B9AA-8B03-E232DEADCFC8} = {30F46168-468C-44E9-9EEF-6796FC7CE213}
|
||||||
{30F46168-468C-44E9-9EEF-6796FC7CE213} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
|
{30F46168-468C-44E9-9EEF-6796FC7CE213} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
|
||||||
{0A0182D3-52CC-40AA-9A5D-FCE6A20F170B} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
|
|
||||||
{951663D7-99B7-5109-93F5-5072D8F25897} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
|
{951663D7-99B7-5109-93F5-5072D8F25897} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
|
||||||
{D0C1B285-1FDA-4C71-92BE-CF9BD28931CB} = {0A0182D3-52CC-40AA-9A5D-FCE6A20F170B}
|
{BEAD32CC-A67F-09CB-7A11-28495EB31A53} = {83F1AB6C-033C-4713-A604-12D860002E17}
|
||||||
|
{83F1AB6C-033C-4713-A604-12D860002E17} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {83CB65B8-011F-4ED7-BCD3-A6CFA935EF7E}
|
SolutionGuid = {83CB65B8-011F-4ED7-BCD3-A6CFA935EF7E}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AvaloniaResource Include="Assets\**" />
|
<AvaloniaResource Include="Assets\**" />
|
||||||
<Folder Include="Configs\DB\" />
|
<Folder Include="Configs\DB\" />
|
||||||
<Folder Include="Migrations\" />
|
|
||||||
<Folder Include="Plugins\" />
|
<Folder Include="Plugins\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,464 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,621 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,717 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,284 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,714 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,714 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,716 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,690 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,692 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,699 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,702 +0,0 @@
|
|||||||
// <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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace Cowain.TestProject.Migrations
|
namespace Cowain.TestProject.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(DBContextGenerator))]
|
[DbContext(typeof(DBContextGenerator))]
|
||||||
[Migration("20260128080126_baking_mode_station_wh")]
|
[Migration("20260302014714_init")]
|
||||||
partial class baking_mode_station_wh
|
partial class init
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -73,7 +73,7 @@ namespace Cowain.TestProject.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
CreateTime = new DateTime(2026, 1, 28, 16, 1, 26, 47, DateTimeKind.Local).AddTicks(4627),
|
CreateTime = new DateTime(2026, 3, 2, 9, 47, 14, 393, DateTimeKind.Local).AddTicks(8647),
|
||||||
IsValid = true,
|
IsValid = true,
|
||||||
Name = "admin",
|
Name = "admin",
|
||||||
Password = "F44DDAC49CE7A95D",
|
Password = "F44DDAC49CE7A95D",
|
||||||
@@ -114,7 +114,7 @@ namespace Cowain.TestProject.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
CreateTime = new DateTime(2026, 1, 28, 16, 1, 26, 52, DateTimeKind.Local).AddTicks(3720),
|
CreateTime = new DateTime(2026, 3, 2, 9, 47, 14, 401, DateTimeKind.Local).AddTicks(47),
|
||||||
IsValid = true,
|
IsValid = true,
|
||||||
RoleName = "管理员",
|
RoleName = "管理员",
|
||||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||||
@@ -70,6 +70,63 @@ namespace Cowain.TestProject.Migrations
|
|||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
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: "varchar(200)", maxLength: 200, 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: "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),
|
||||||
|
Row = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Col = table.Column<int>(type: "int", nullable: false),
|
||||||
|
IsWaterBattery = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||||
|
WaterValue = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Status = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
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(
|
migrationBuilder.CreateTable(
|
||||||
name: "device",
|
name: "device",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -96,6 +153,99 @@ namespace Cowain.TestProject.Migrations
|
|||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.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.CreateTable(
|
||||||
|
name: "pallet_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),
|
||||||
|
Code = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
PalletStatus = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
StationId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
BakingCount = 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),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||||
|
WaterValue = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_pallet_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)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Code = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
BindingId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
PalletStatus = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
StationId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
BakingCount = 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),
|
||||||
|
WaterValue = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
HistoryTime = table.Column<DateTime>(type: "datetime(6)", maxLength: 200, nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_pallet_info_history", 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"),
|
||||||
|
StationCode = 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),
|
||||||
|
Height = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Width = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Enable = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_station_info", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "tag_address",
|
name: "tag_address",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -244,12 +394,12 @@ namespace Cowain.TestProject.Migrations
|
|||||||
migrationBuilder.InsertData(
|
migrationBuilder.InsertData(
|
||||||
table: "user",
|
table: "user",
|
||||||
columns: new[] { "Id", "CreateTime", "IsValid", "Name", "Password", "Phone", "RoleId", "Sex", "UpdateTime", "UserNumber" },
|
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" });
|
values: new object[] { 1, new DateTime(2026, 3, 2, 9, 47, 14, 393, DateTimeKind.Local).AddTicks(8647), true, "admin", "F44DDAC49CE7A95D", "17625760609", 1, "Male", new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "CWA4483" });
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
migrationBuilder.InsertData(
|
||||||
table: "user_role",
|
table: "user_role",
|
||||||
columns: new[] { "Id", "CreateTime", "IsValid", "RoleName", "UpdateTime" },
|
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) });
|
values: new object[] { 1, new DateTime(2026, 3, 2, 9, 47, 14, 401, DateTimeKind.Local).AddTicks(47), true, "管理员", new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) });
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
migrationBuilder.InsertData(
|
||||||
table: "user_role_menu",
|
table: "user_role_menu",
|
||||||
@@ -275,9 +425,30 @@ namespace Cowain.TestProject.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "alarm_level");
|
name: "alarm_level");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "baking_info");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "baking_variable");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "battery_info");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "device");
|
name: "device");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "pallet_binding");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "pallet_info");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "pallet_info_history");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "station_info");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "tag_address");
|
name: "tag_address");
|
||||||
|
|
||||||
@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace Cowain.TestProject.Migrations
|
namespace Cowain.TestProject.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(DBContextGenerator))]
|
[DbContext(typeof(DBContextGenerator))]
|
||||||
[Migration("20260128071034_baking_mode_station")]
|
[Migration("20260302103947_wcs")]
|
||||||
partial class baking_mode_station
|
partial class wcs
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -73,7 +73,7 @@ namespace Cowain.TestProject.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
CreateTime = new DateTime(2026, 1, 28, 15, 10, 33, 689, DateTimeKind.Local).AddTicks(249),
|
CreateTime = new DateTime(2026, 3, 2, 18, 39, 47, 481, DateTimeKind.Local).AddTicks(5662),
|
||||||
IsValid = true,
|
IsValid = true,
|
||||||
Name = "admin",
|
Name = "admin",
|
||||||
Password = "F44DDAC49CE7A95D",
|
Password = "F44DDAC49CE7A95D",
|
||||||
@@ -114,7 +114,7 @@ namespace Cowain.TestProject.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
CreateTime = new DateTime(2026, 1, 28, 15, 10, 33, 696, DateTimeKind.Local).AddTicks(8625),
|
CreateTime = new DateTime(2026, 3, 2, 18, 39, 47, 486, DateTimeKind.Local).AddTicks(6948),
|
||||||
IsValid = true,
|
IsValid = true,
|
||||||
RoleName = "管理员",
|
RoleName = "管理员",
|
||||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||||
@@ -398,6 +398,9 @@ namespace Cowain.TestProject.Migrations
|
|||||||
b.Property<bool>("Enable")
|
b.Property<bool>("Enable")
|
||||||
.HasColumnType("tinyint(1)");
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<int>("Height")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("LayOutX")
|
b.Property<int>("LayOutX")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@@ -414,6 +417,9 @@ namespace Cowain.TestProject.Migrations
|
|||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
.HasColumnType("varchar(200)");
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<int>("Width")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("station_info");
|
b.ToTable("station_info");
|
||||||
@@ -704,6 +710,342 @@ namespace Cowain.TestProject.Migrations
|
|||||||
|
|
||||||
b.ToTable("var_action");
|
b.ToTable("var_action");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.ProcessDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<bool>("Enable")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<string>("FlowData")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Json")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("process");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.ProcessFlowDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Action")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("FromStatus1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("FromStatus2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<int>("Priority")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ProcessId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ToStatus1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("ToStatus2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("process_flow");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.RgvDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Json")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("LayOutX")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("LayOutY")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ProcessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("StationCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<string>("StationName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("rgv");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.StationDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<bool>("Enable")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<int>("LayOutX")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("LayOutY")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("NextStationId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<float>("PositionX")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<float>("PositionY")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<float>("PositionZ")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<string>("ProcessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("StationCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<string>("StationName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<int>("StationPos")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("station");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.TaskDataDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Action")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int>("ExecuteAction")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("FinishedTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("FromStatus1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("FromStatus2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsFinished")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<int>("Priority")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ProcessId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ProcessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ToStatus1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("ToStatus2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("task_data");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.WcsParamDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Param")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("wcs_param");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Name = "FindTaskOnStartUp",
|
||||||
|
Param = "True"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Name = "FindTaskEnable",
|
||||||
|
Param = "True"
|
||||||
|
});
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
248
Cowain.TestProject/Migrations/20260302103947_wcs.cs
Normal file
248
Cowain.TestProject/Migrations/20260302103947_wcs.cs
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
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 wcs : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "process",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
FlowData = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.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),
|
||||||
|
Json = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_process", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "process_flow",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
ProcessId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Priority = table.Column<int>(type: "int", nullable: false),
|
||||||
|
FromStationId1 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ToStationId1 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
FromStatus1 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ToStatus1 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
FromStationId2 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ToStationId2 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
FromStatus2 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ToStatus2 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Action = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_process_flow", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "rgv",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
StationName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
StationCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ProcessName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
FromStationId1 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ToStationId1 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
FromStationId2 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ToStationId2 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
QrCode1 = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
QrCode2 = 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),
|
||||||
|
Json = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_rgv", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "station",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
StationName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
StationCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
QrCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ProcessName = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
PositionX = table.Column<float>(type: "float", nullable: false),
|
||||||
|
PositionY = table.Column<float>(type: "float", nullable: false),
|
||||||
|
PositionZ = table.Column<float>(type: "float", nullable: false),
|
||||||
|
LayOutX = table.Column<int>(type: "int", nullable: false),
|
||||||
|
LayOutY = table.Column<int>(type: "int", nullable: false),
|
||||||
|
StationPos = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Status = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Enable = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||||
|
NextStationId = table.Column<int>(type: "int", 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_station", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "task_data",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
ProcessName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ProcessId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Priority = table.Column<int>(type: "int", nullable: false),
|
||||||
|
QrCode1 = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
QrCode2 = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
FromStationId1 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ToStationId1 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
FromStatus1 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ToStatus1 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
FromStationId2 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ToStationId2 = table.Column<int>(type: "int", nullable: false),
|
||||||
|
FromStatus2 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ToStatus2 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ExecuteAction = table.Column<int>(type: "int", nullable: false),
|
||||||
|
IsFinished = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||||
|
Action = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
FinishedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_task_data", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "wcs_param",
|
||||||
|
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"),
|
||||||
|
Param = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_wcs_param", x => x.Id);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "user",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 1,
|
||||||
|
column: "CreateTime",
|
||||||
|
value: new DateTime(2026, 3, 2, 18, 39, 47, 481, DateTimeKind.Local).AddTicks(5662));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "user_role",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 1,
|
||||||
|
column: "CreateTime",
|
||||||
|
value: new DateTime(2026, 3, 2, 18, 39, 47, 486, DateTimeKind.Local).AddTicks(6948));
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "wcs_param",
|
||||||
|
columns: new[] { "Id", "Name", "Param" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ 1, "FindTaskOnStartUp", "True" },
|
||||||
|
{ 2, "FindTaskEnable", "True" }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "process");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "process_flow");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "rgv");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "station");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "task_data");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "wcs_param");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "user",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 1,
|
||||||
|
column: "CreateTime",
|
||||||
|
value: new DateTime(2026, 3, 2, 9, 47, 14, 393, DateTimeKind.Local).AddTicks(8647));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "user_role",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 1,
|
||||||
|
column: "CreateTime",
|
||||||
|
value: new DateTime(2026, 3, 2, 9, 47, 14, 401, DateTimeKind.Local).AddTicks(47));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,7 +70,7 @@ namespace Cowain.TestProject.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
CreateTime = new DateTime(2026, 1, 28, 16, 1, 26, 47, DateTimeKind.Local).AddTicks(4627),
|
CreateTime = new DateTime(2026, 3, 2, 18, 39, 47, 481, DateTimeKind.Local).AddTicks(5662),
|
||||||
IsValid = true,
|
IsValid = true,
|
||||||
Name = "admin",
|
Name = "admin",
|
||||||
Password = "F44DDAC49CE7A95D",
|
Password = "F44DDAC49CE7A95D",
|
||||||
@@ -111,7 +111,7 @@ namespace Cowain.TestProject.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
CreateTime = new DateTime(2026, 1, 28, 16, 1, 26, 52, DateTimeKind.Local).AddTicks(3720),
|
CreateTime = new DateTime(2026, 3, 2, 18, 39, 47, 486, DateTimeKind.Local).AddTicks(6948),
|
||||||
IsValid = true,
|
IsValid = true,
|
||||||
RoleName = "管理员",
|
RoleName = "管理员",
|
||||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||||
@@ -707,6 +707,342 @@ namespace Cowain.TestProject.Migrations
|
|||||||
|
|
||||||
b.ToTable("var_action");
|
b.ToTable("var_action");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.ProcessDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<bool>("Enable")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<string>("FlowData")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Json")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("process");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.ProcessFlowDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Action")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("FromStatus1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("FromStatus2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<int>("Priority")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ProcessId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ToStatus1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("ToStatus2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("process_flow");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.RgvDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Json")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<int>("LayOutX")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("LayOutY")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ProcessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("StationCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<string>("StationName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("rgv");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.StationDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<bool>("Enable")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<int>("LayOutX")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("LayOutY")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("NextStationId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<float>("PositionX")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<float>("PositionY")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<float>("PositionZ")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.Property<string>("ProcessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("StationCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<string>("StationName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<int>("StationPos")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("station");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.TaskDataDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Action")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int>("ExecuteAction")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("FinishedTime")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("FromStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("FromStatus1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("FromStatus2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsFinished")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<int>("Priority")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ProcessId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ProcessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnType("varchar(100)");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("QrCode2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId1")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ToStationId2")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ToStatus1")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.Property<string>("ToStatus2")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("varchar(50)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("task_data");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Plugin.Cowain.Wcs.Models.Dto.WcsParamDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Param")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("wcs_param");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Name = "FindTaskOnStartUp",
|
||||||
|
Param = "True"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Name = "FindTaskEnable",
|
||||||
|
Param = "True"
|
||||||
|
});
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Cowain.Base.Models.Menu;
|
|||||||
using Cowain.Base.ViewModels;
|
using Cowain.Base.ViewModels;
|
||||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Semi.Avalonia;
|
using Semi.Avalonia;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -19,6 +20,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -92,12 +94,17 @@ namespace Cowain.TestProject.ViewModels
|
|||||||
/// 菜单数据
|
/// 菜单数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly List<MenuItem> _menuItems;
|
private readonly List<MenuItem> _menuItems;
|
||||||
|
private ILogger<LoginWindowViewModel> _logger;
|
||||||
private IAccountService _accountService;
|
private IAccountService _accountService;
|
||||||
private IConfiguration _configuration;
|
private IConfiguration _configuration;
|
||||||
|
private string userFileName = "userdata.json";
|
||||||
|
|
||||||
public LoginWindowViewModel(MenuConfigurationContext menuContext, ILocalizer localizer, IViewNavigator viewNavigator, IAccountService accountService, IConfiguration configuration)
|
public LoginWindowViewModel(MenuConfigurationContext menuContext, ILocalizer localizer, ILogger<LoginWindowViewModel> logger, IViewNavigator viewNavigator, IAccountService accountService, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_l = localizer;
|
_l = localizer;
|
||||||
|
_logger = logger;
|
||||||
|
string pdtName = GetProductName();
|
||||||
|
userFileName= $"{pdtName}_userdata.json";
|
||||||
_menuItems = menuContext.Menus;
|
_menuItems = menuContext.Menus;
|
||||||
_viewNavigator = viewNavigator;
|
_viewNavigator = viewNavigator;
|
||||||
_accountService = accountService;
|
_accountService = accountService;
|
||||||
@@ -201,7 +208,7 @@ namespace Cowain.TestProject.ViewModels
|
|||||||
}
|
}
|
||||||
private void ReadUserData()
|
private void ReadUserData()
|
||||||
{
|
{
|
||||||
var path = PathHelper.GetLocalFilePath("userdata.json");
|
var path = PathHelper.GetLocalFilePath(userFileName);
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
var json = File.ReadAllText(path);
|
var json = File.ReadAllText(path);
|
||||||
@@ -252,12 +259,12 @@ namespace Cowain.TestProject.ViewModels
|
|||||||
{
|
{
|
||||||
var userData = new UserData { UserName = UserName, Password = DESHelper.Encrypt(Password, "ZSL12345"), IsRemember = RememberUserName };
|
var userData = new UserData { UserName = UserName, Password = DESHelper.Encrypt(Password, "ZSL12345"), IsRemember = RememberUserName };
|
||||||
var json = JsonSerializer.Serialize(userData);
|
var json = JsonSerializer.Serialize(userData);
|
||||||
var path = PathHelper.GetLocalFilePath("userdata.json");
|
var path = PathHelper.GetLocalFilePath(userFileName);
|
||||||
await File.WriteAllTextAsync(path, json);
|
await File.WriteAllTextAsync(path, json);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var path = PathHelper.GetLocalFilePath("userdata.json");
|
var path = PathHelper.GetLocalFilePath(userFileName);
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
File.Delete(path);
|
File.Delete(path);
|
||||||
@@ -285,5 +292,29 @@ namespace Cowain.TestProject.ViewModels
|
|||||||
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
|
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取项目文件中<Product>属性的值
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Product属性字符串,如"Cowain WCS"</returns>
|
||||||
|
public string GetProductName()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 获取当前程序集(如果是其他项目,替换为对应程序集)
|
||||||
|
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||||
|
// 获取AssemblyProduct特性
|
||||||
|
var productAttribute = assembly.GetCustomAttribute<AssemblyProductAttribute>();
|
||||||
|
|
||||||
|
// 返回值(为空时返回默认值)
|
||||||
|
return productAttribute?.Product ?? "未知产品名称";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 异常处理(根据你的日志框架调整)
|
||||||
|
_logger.LogError(ex, "读取Product属性失败");
|
||||||
|
return "未知产品名称";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ namespace Cowain.TestProject.ViewModels
|
|||||||
CultureInfo cultureInfo = menuItem?.CommandParameter is string parameter
|
CultureInfo cultureInfo = menuItem?.CommandParameter is string parameter
|
||||||
? new CultureInfo(parameter)
|
? new CultureInfo(parameter)
|
||||||
: Thread.CurrentThread.CurrentCulture;
|
: Thread.CurrentThread.CurrentCulture;
|
||||||
//待1.24号更新后再使用
|
|
||||||
Semi.Avalonia.SemiTheme.OverrideLocaleResources(app, cultureInfo);
|
Semi.Avalonia.SemiTheme.OverrideLocaleResources(app, cultureInfo);
|
||||||
Ursa.Themes.Semi.SemiTheme.OverrideLocaleResources(app, cultureInfo);
|
Ursa.Themes.Semi.SemiTheme.OverrideLocaleResources(app, cultureInfo);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"WcsFindTaskOnStartUp":"True",
|
"WcsFindTaskOnStartUp":"True",
|
||||||
"Database": { "db": "MySql" },
|
"Database": { "db": "MySql" },
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"MySqlConn": "Server=127.0.0.1;Database=db_6055006;Port=3307;charset=utf8;uid=root;pwd=123456;persistsecurityinfo=True;",
|
"MySqlConn": "Server=127.0.0.1;Database=wcs_6040003;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;",
|
"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;",
|
"PostGresConn": "Server=127.0.0.1;Port=5432;User Id=postgres;Password=123456;Database=testProjectDb;",
|
||||||
"SqlLiteConn": "Data Source=Configs/DB/localDb.sqlite"
|
"SqlLiteConn": "Data Source=Configs/DB/localDb.sqlite"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<!-- Version.props -->
|
<!-- Version.props -->
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.0.6</Version>
|
<Version>1.0.1</Version>
|
||||||
<AssemblyVersion>1.0.6</AssemblyVersion>
|
<AssemblyVersion>1.0.1</AssemblyVersion>
|
||||||
<FileVersion>1.0.6</FileVersion>
|
<FileVersion>1.0.1</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -31,9 +31,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Baking\Plugin.Cowain.Baking\Plugin.Cowain.Baking.csproj" />
|
|
||||||
<ProjectReference Include="..\Driver\Cowain.Driver\Plugin.Cowain.Driver.csproj" />
|
<ProjectReference Include="..\Driver\Cowain.Driver\Plugin.Cowain.Driver.csproj" />
|
||||||
<ProjectReference Include="..\Driver\Driver.DeviceOpcUa\Plugin.Driver.DeviceOpcUa.csproj" />
|
<ProjectReference Include="..\Driver\Driver.DeviceOpcUa\Plugin.Driver.DeviceOpcUa.csproj" />
|
||||||
<ProjectReference Include="..\Driver\Driver.DeviceSiemens\Plugin.Driver.DeviceSiemens.csproj" />
|
<ProjectReference Include="..\Driver\Driver.DeviceSiemens\Plugin.Driver.DeviceSiemens.csproj" />
|
||||||
|
<ProjectReference Include="..\Wcs\Plugin.Cowain.Wcs\Plugin.Cowain.Wcs.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
56
Plugins/Wcs/Plugin.Cowain.Wcs/Actions/HeartAction.cs
Normal file
56
Plugins/Wcs/Plugin.Cowain.Wcs/Actions/HeartAction.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using Cowain.Base.Models;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Plugin.Cowain.Driver.Abstractions;
|
||||||
|
using Plugin.Cowain.Driver.Attributes;
|
||||||
|
using Plugin.Cowain.Driver.Models;
|
||||||
|
using Plugin.Cowain.Driver.Models.Enum;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Actions;
|
||||||
|
|
||||||
|
[Action("Heart", "心跳反馈")]
|
||||||
|
public class HeartAction : IVariableAction
|
||||||
|
{
|
||||||
|
private class ParamData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PLC名称
|
||||||
|
/// </summary>
|
||||||
|
public string PlcName { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 反馈命令地址
|
||||||
|
/// </summary>
|
||||||
|
public string RetAddress { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly IDeviceMonitor _deviceMonitor;
|
||||||
|
public HeartAction(IDeviceMonitor deviceMonitor)
|
||||||
|
{
|
||||||
|
_deviceMonitor = deviceMonitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> ExecuteAsync(VariableAction variableAction, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var _param = JsonConvert.DeserializeObject<ParamData>(variableAction.Param);
|
||||||
|
if (_param == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("参数解析失败");
|
||||||
|
}
|
||||||
|
var driver = _deviceMonitor.GetDriver(_param.PlcName);
|
||||||
|
if (!driver.IsSuccess)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"未找到名称为 {_param.PlcName} 的Driver");
|
||||||
|
}
|
||||||
|
var plc = driver.Data;
|
||||||
|
// 解析变量值为 short 类型
|
||||||
|
if (!short.TryParse(variableAction.Variable.Value, out short shortValue))
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"无法将变量值 '{variableAction.Variable.Value}' 转换为 short 类型");
|
||||||
|
}
|
||||||
|
var writeRet = await plc.WriteAsync<short>(_param.RetAddress, DataTypeEnum.Int16, shortValue);
|
||||||
|
if (!writeRet.IsSuccess) return ResultModel.Error($"写变量失败:{_param.PlcName}->{_param.RetAddress}");
|
||||||
|
|
||||||
|
return ResultModel.Success();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
59
Plugins/Wcs/Plugin.Cowain.Wcs/Actions/RgvFinishedAction.cs
Normal file
59
Plugins/Wcs/Plugin.Cowain.Wcs/Actions/RgvFinishedAction.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using Cowain.Base.Models;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Plugin.Cowain.Driver.Abstractions;
|
||||||
|
using Plugin.Cowain.Driver.Attributes;
|
||||||
|
using Plugin.Cowain.Driver.Models;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Actions;
|
||||||
|
|
||||||
|
public class RgvFinishedParamData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PLC名称
|
||||||
|
/// </summary>
|
||||||
|
public string PlcName { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 命令地址
|
||||||
|
/// </summary>
|
||||||
|
public string CmdAddress { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 反馈命令地址
|
||||||
|
/// </summary>
|
||||||
|
public string RetCmdAddress { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Action("RgvFinished", "RGV动作完成时间")]
|
||||||
|
public class RgvFinishedAction : IVariableAction
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
private readonly IDeviceMonitor _deviceMonitor;
|
||||||
|
private IServiceScopeFactory _scopeFactory;
|
||||||
|
private readonly ILogger<RgvFinishedAction> _logger;
|
||||||
|
public RgvFinishedAction(IDeviceMonitor deviceMonitor, IServiceScopeFactory scopeFactory, ILogger<RgvFinishedAction> logger)
|
||||||
|
{
|
||||||
|
_deviceMonitor = deviceMonitor;
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<ResultModel> ExecuteAsync(VariableAction variableAction, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"执行调度完成事件:{variableAction.Variable.Name}-{variableAction.Variable.Address},参数:{variableAction.Param},旧值:{variableAction.Variable.OldValue},新值:{variableAction.Variable.Value}");
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var taskService = scope.ServiceProvider.GetRequiredService<IRgvTaskService>();
|
||||||
|
return await taskService.ExecuteAsync(variableAction.Param, RgvUpdateSourceEnum.PLC);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
175
Plugins/Wcs/Plugin.Cowain.Wcs/Actions/StationAction.cs
Normal file
175
Plugins/Wcs/Plugin.Cowain.Wcs/Actions/StationAction.cs
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
using Cowain.Base.Models;
|
||||||
|
using HslCommunication;
|
||||||
|
using HslCommunication.Core;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Plugin.Cowain.Driver;
|
||||||
|
using Plugin.Cowain.Driver.Abstractions;
|
||||||
|
using Plugin.Cowain.Driver.Attributes;
|
||||||
|
using Plugin.Cowain.Driver.Models;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using Plugin.Cowain.Wcs.Services;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Actions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工站需要上下料请求
|
||||||
|
/// </summary>
|
||||||
|
[Action("Station", "工站请求命令")]
|
||||||
|
public class StationAction : IVariableAction
|
||||||
|
{
|
||||||
|
|
||||||
|
private class ParamData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PLC名称
|
||||||
|
/// </summary>
|
||||||
|
public string StationCode { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// PLC名称
|
||||||
|
/// </summary>
|
||||||
|
public string PlcName { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 命令地址
|
||||||
|
/// </summary>
|
||||||
|
public string CmdAddress { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 反馈命令地址
|
||||||
|
/// </summary>
|
||||||
|
public string RetCmdAddress { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly IDeviceMonitor _deviceMonitor;
|
||||||
|
private IServiceScopeFactory _scopeFactory;
|
||||||
|
private readonly ILogger<StationAction> _logger;
|
||||||
|
public StationAction(IDeviceMonitor deviceMonitor, IServiceScopeFactory scopeFactory, ILogger<StationAction> logger)
|
||||||
|
{
|
||||||
|
_deviceMonitor = deviceMonitor;
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<ResultModel> ExecuteAsync(VariableAction variableAction, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"执行测试事件:{variableAction.Variable.Name}-{variableAction.Variable.Address},参数:{variableAction.Param},旧值:{variableAction.Variable.OldValue},新值:{variableAction.Variable.Value}");
|
||||||
|
|
||||||
|
var _param = JsonSerializer.Deserialize<ParamData>(variableAction.Param);
|
||||||
|
if (_param == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("参数解析失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
var driver = _deviceMonitor.GetDriver(_param.PlcName);
|
||||||
|
if (!driver.IsSuccess)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"未找到名称为 {_param.PlcName} 的Driver");
|
||||||
|
}
|
||||||
|
var plc = driver.Data.GetReadWrite();
|
||||||
|
if (plc == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"GetReadWrite为空,PLC={_param.PlcName}");
|
||||||
|
}
|
||||||
|
var read = await ReadAsync(plc, _param.CmdAddress);
|
||||||
|
if (!read.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogError($"从PLC读取工站数据失败:{_param.PlcName}->{_param.CmdAddress},{read.ErrorMessage}");
|
||||||
|
return ResultModel.Error($"读命令失败:{_param.PlcName}->{_param.CmdAddress},{read.ErrorMessage}");
|
||||||
|
}
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var stationService = scope.ServiceProvider.GetRequiredService<IStationService>();
|
||||||
|
var stations = await stationService.GetAllAsync();
|
||||||
|
var station = stations.FirstOrDefault(x => x.StationCode == _param.StationCode);
|
||||||
|
if (station == null)
|
||||||
|
{
|
||||||
|
_logger.LogError($"工站不存在,请检查:{_param.StationCode}");
|
||||||
|
return ResultModel.Error($"工站不存在,请检查:{_param.StationCode}");
|
||||||
|
}
|
||||||
|
station.UpdateSource = StationUpdateSourceEnum.PLC;
|
||||||
|
if (read.Data.Command == (short)StationStateEnum.RequestPick)
|
||||||
|
{
|
||||||
|
station.Status = StationStateEnum.RequestPick.ToString();
|
||||||
|
station.QrCode = read.Data.QrCode;
|
||||||
|
}
|
||||||
|
else if (read.Data.Command == (short)StationStateEnum.RequestPlace)
|
||||||
|
{
|
||||||
|
station.Status = StationStateEnum.RequestPlace.ToString();
|
||||||
|
}
|
||||||
|
else if (read.Data.Command == (short)StationStateEnum.NgPick)
|
||||||
|
{
|
||||||
|
station.Status = StationStateEnum.NgPick.ToString();
|
||||||
|
station.QrCode = read.Data.QrCode;
|
||||||
|
}
|
||||||
|
else if (read.Data.Command == 1)
|
||||||
|
{
|
||||||
|
//清除工站信息
|
||||||
|
station.QrCode = "";
|
||||||
|
station.ProcessName = "";
|
||||||
|
station.Status = StationStateEnum.UnKnown.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError($"命令不正确,请检查:{_param.StationCode},{read.Data.Command}");
|
||||||
|
return ResultModel.Error($"命令不正确,请检查:{_param.StationCode},{read.Data.Command}");
|
||||||
|
}
|
||||||
|
station.ProcessName = read.Data.ProcessName;
|
||||||
|
//这里没有判断产品名称是否正确,如果不正确需要返回PLC NG,待完善
|
||||||
|
_logger.LogInformation($"工站更新开始:{_param.StationCode},{read.Data.Command}");
|
||||||
|
var stationTaskHandler = scope.ServiceProvider.GetRequiredService<IEnumerable<IHostedService>>();
|
||||||
|
var stationQueueHostedService = stationTaskHandler.OfType<StationQueueHostedService>().FirstOrDefault();
|
||||||
|
var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
|
station.UpdatedAction = result => tcs.TrySetResult(result);
|
||||||
|
stationQueueHostedService?.Enqueue(station);
|
||||||
|
var ret = await tcs.Task;
|
||||||
|
_logger.LogInformation($"工站更新结束:{_param.StationCode},{read.Data.Command}");
|
||||||
|
|
||||||
|
//使用批量写入,保证PLC数据一致性,避免出现部分数据未写成功的情况,要么都没写成功
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
//工站更新OK
|
||||||
|
var writeResult = await plc.WriteValuesAysnc(_param.RetCmdAddress, new short[] { read.Data.Command, (short)1, read.Data.Count });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//工站更新NG
|
||||||
|
var writeResult = await plc.WriteValuesAysnc(_param.RetCmdAddress, new short[] { read.Data.Command, (short)2, read.Data.Count });
|
||||||
|
|
||||||
|
}
|
||||||
|
return ResultModel.Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task<ResultModel<StationRequestData>> ReadAsync(IReadWriteDevice driver, string address)
|
||||||
|
{
|
||||||
|
var readResult = await driver.ReadAsync(address, 70);
|
||||||
|
if (!readResult.IsSuccess)
|
||||||
|
{
|
||||||
|
ResultModel<StationRequestData>.Error(readResult.Message);
|
||||||
|
}
|
||||||
|
StationRequestData requestData = new StationRequestData
|
||||||
|
{
|
||||||
|
Command = driver.ByteTransform.TransInt16(readResult.Content, 0),
|
||||||
|
Count = driver.ByteTransform.TransInt16(readResult.Content, 2),
|
||||||
|
ProcessName = readResult.Content.RemoveBegin(4).GetS7String(),
|
||||||
|
NgStationName = readResult.Content.RemoveBegin(26).GetS7String(),
|
||||||
|
QrCode = readResult.Content.RemoveBegin(48).GetS7String()
|
||||||
|
};
|
||||||
|
return ResultModel<StationRequestData>.Success(requestData);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class StationRequestData
|
||||||
|
{
|
||||||
|
public string QrCode { get; set; } = string.Empty;
|
||||||
|
public string ProcessName { get; set; } = string.Empty;
|
||||||
|
public string NgStationName { get; set; } = string.Empty;
|
||||||
|
public short Command { get; set; }
|
||||||
|
public short Count { get; set; }
|
||||||
|
}
|
||||||
BIN
Plugins/Wcs/Plugin.Cowain.Wcs/Configs/Images/rgv.png
Normal file
BIN
Plugins/Wcs/Plugin.Cowain.Wcs/Configs/Images/rgv.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
BIN
Plugins/Wcs/Plugin.Cowain.Wcs/Configs/Images/堆垛机.png
Normal file
BIN
Plugins/Wcs/Plugin.Cowain.Wcs/Configs/Images/堆垛机.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
63
Plugins/Wcs/Plugin.Cowain.Wcs/Configs/menus.json
Normal file
63
Plugins/Wcs/Plugin.Cowain.Wcs/Configs/menus.json
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"Key": "Wcs",
|
||||||
|
"Icon": "M672 56.256L807.744 192l-45.248 45.248L704 178.688V320h224v64H704v256h141.376l-58.56-58.496 45.248-45.248 135.808 135.744L832 807.744l-45.248-45.248 58.496-58.496H704v256h-64v-256H384v256H320v-256H64v-64h256V384H224a160 160 0 1 1 159.68-170.496L384 224V320h256V178.688l-58.496 58.56L536.256 192 672 56.256z m-32 327.68H384v256h256V384zM576 448v128H448V448h128zM224 128a96 96 0 0 0-9.216 191.552L224 320H320V224a96 96 0 0 0-77.76-94.272l-8.96-1.28L224 128z",
|
||||||
|
"LocaleKey": "Menu.Toolbar.Wcs",
|
||||||
|
"Group": "Toolbar",
|
||||||
|
"CommandType": "Active",
|
||||||
|
"Items": [
|
||||||
|
{
|
||||||
|
"Key": "WcsRealStation",
|
||||||
|
"Icon": "M853.32992 102.4H170.67008C133.13024 102.4 102.4 133.13024 102.4 170.67008v409.6h819.2v-409.6C921.6 133.13024 890.86976 102.4 853.32992 102.4zM775.0656 365.4656L662.6304 477.87008l-36.22912-36.1984 74.8032-74.74176H238.92992v-51.2h462.27456l-74.73152-74.73152L662.59968 204.8 775.0656 317.20448a34.11968 34.11968 0 0 1 0 48.26112zM102.4 648.52992V716.8c0 37.5296 30.73024 68.27008 68.27008 68.27008H409.6c0 37.66272-30.59712 68.1984-68.27008 68.1984v0.06144H307.2V921.6h409.6v-68.27008h-34.12992A68.29056 68.29056 0 0 1 614.4 785.07008h238.92992C890.86976 785.07008 921.6 754.3296 921.6 716.8v-68.27008H102.4z",
|
||||||
|
"LocaleKey": "Menu.Sidebar.WcsRealStation",
|
||||||
|
"CommandType": "Navigate",
|
||||||
|
"CommandParameter": "WcsRealStation",
|
||||||
|
"PageActions": [ "add", "edit","save","delete" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Key": "StationManagement",
|
||||||
|
"Icon": "M501.76 292.408889c-77.368889 0-139.946667 62.577778-139.946667 138.808889s62.577778 138.808889 139.946667 138.808889c77.368889 0 139.946667-62.577778 139.946667-138.808889s-63.715556-138.808889-139.946667-138.808889z m0 221.866667c-45.511111 0-83.057778-36.408889-83.057778-81.92s37.546667-81.92 83.057778-81.92 83.057778 36.408889 83.057778 81.92-37.546667 81.92-83.057778 81.92z M500.622222 56.888889C293.546667 56.888889 125.155556 226.417778 125.155556 435.768889c0 100.124444 38.684444 195.697778 109.226666 267.377778l238.933334 242.346666c6.826667 6.826667 15.928889 10.24 25.031111 10.24h2.275555c9.102222 0 18.204444-3.413333 25.031111-10.24l241.208889-243.484444c69.404444-71.68 108.088889-166.115556 108.088889-266.24C876.088889 226.417778 707.697778 56.888889 500.622222 56.888889z m226.417778 605.297778c-1.137778 1.137778-76.231111 77.368889-226.417778 228.693333l-225.28-227.555556c-60.302222-61.44-93.297778-142.222222-93.297778-227.555555C182.044444 258.275556 325.404444 113.777778 500.622222 113.777778s318.577778 144.497778 318.577778 321.991111c0 85.333333-32.995556 166.115556-92.16 226.417778z",
|
||||||
|
"LocaleKey": "Menu.Sidebar.StationManagement",
|
||||||
|
"CommandType": "Navigate",
|
||||||
|
"CommandParameter": "StationManagement",
|
||||||
|
"PageActions": [ "add", "edit","save","delete" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Key": "RgvManagement",
|
||||||
|
"Icon": "M333.533867 856.4736A105.0112 105.0112 0 1 1 438.613333 751.479467a105.1136 105.1136 0 0 1-105.079466 104.994133z m0-175.786667A70.877867 70.877867 0 1 0 404.48 751.479467a70.946133 70.946133 0 0 0-70.946133-70.877867zM723.950933 856.4736a105.0112 105.0112 0 1 1 104.994134-104.994133 105.1136 105.1136 0 0 1-104.994134 104.994133z m0-175.786667a70.877867 70.877867 0 1 0 70.8608 70.877867 70.9632 70.9632 0 0 0-70.8608-70.9632z M427.741867 741.444267h214.6816v40.448H427.741867z M897.928533 781.892267H798.208v-40.448h90.453333V276.224h-74.308266l-12.680534 66.56c-2.4064 12.629333-11.025067 21.4528-20.957866 21.4528h-523.946667c-9.9328 0-18.5344-8.823467-20.9408-21.4528l-12.680533-66.56H148.241067v465.220267h108.3904v40.448H138.990933c-11.946667 0-21.589333-12.6976-21.589333-28.3136V264.072533c0-15.598933 9.6768-28.3136 21.589333-28.3136H230.4c9.9328 0 18.551467 8.823467 20.957867 21.4528l12.680533 66.56h509.457067l12.680533-66.56c2.4064-12.629333 11.025067-21.4528 20.9408-21.4528h90.811733c11.946667 0 21.6064 12.714667 21.6064 28.3136v489.506134c0 15.616-9.693867 28.3136-21.6064 28.3136z",
|
||||||
|
"LocaleKey": "Menu.Sidebar.RgvManagement",
|
||||||
|
"CommandType": "Navigate",
|
||||||
|
"CommandParameter": "RgvManagement",
|
||||||
|
"PageActions": [ "add", "edit","save","delete" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Key": "ProcessManagement",
|
||||||
|
"Icon": "M822.72 686.976a133.312 133.312 0 0 1 9.536 266.368l-9.6 0.32h-177.728a133.312 133.312 0 0 1-9.472-266.368l9.472-0.32h177.792z m-66.688-533.312a200 200 0 0 1 5.952 400H267.2a111.104 111.104 0 1 0-4.864 222.144l4.864 0.128h22.144v-107.328l196.224 196.224H267.2a200 200 0 0 1-5.952-400h494.784a111.104 111.104 0 0 0 4.864-222.208H600.512V153.6h155.52z m66.688 622.912h-177.792a43.712 43.712 0 0 0-6.4 87.04l6.4 0.448h177.792a43.712 43.712 0 0 0 6.4-87.04l-6.4-0.448zM378.24 64.832a133.312 133.312 0 0 1 9.472 266.304l-9.472 0.32H200.512a133.312 133.312 0 0 1-9.472-266.304l9.472-0.32h177.792z m0 89.6H200.512a43.712 43.712 0 0 0-6.4 87.04l6.4 0.384h177.792a43.712 43.712 0 0 0 6.4-86.976l-6.4-0.448z",
|
||||||
|
"LocaleKey": "Menu.Sidebar.ProcessManagement",
|
||||||
|
"CommandType": "Navigate",
|
||||||
|
"CommandParameter": "ProcessManagement",
|
||||||
|
"PageActions": [ "add", "edit","save", "delete" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Key": "FlowManagement",
|
||||||
|
"Icon": "M330.3 843.4h363.5V659.5H330.3v58.4h-73.8V542.6h76v59.2h359.2v-57.7h141.2V240.5H693.7v-59.9H330.3v183.9h363.5v-59.9h74.9v175.3h-77.1v-57.7H332.4v56.3H192.3v303.6h138v61.3z m299.3-543.1H394.4v-55.6h235.2v55.6zM394.4 723.7h235.2v55.6H394.4v-55.6z",
|
||||||
|
"LocaleKey": "Menu.Sidebar.FlowManagement",
|
||||||
|
"CommandType": "Navigate",
|
||||||
|
"CommandParameter": "FlowManagement",
|
||||||
|
"PageActions": [ "add", "edit", "save", "import", "export", "delete" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Key": "WcsTaskList",
|
||||||
|
"Icon": "M224 800.256L223.712 224H320v31.68c0 35.456 28.64 64.32 63.872 64.32h256.256A64.16 64.16 0 0 0 704 255.68V224l96-0.256L800.256 800 224 800.256zM640 192.32L640.128 256 384 255.68V192.32L383.872 192 640 192.32zM799.84 160H695.04c-11.072-19.04-31.424-32-54.912-32h-256.256c-23.488 0-43.808 12.928-54.912 32H223.712A63.776 63.776 0 0 0 160 223.744v576.512C160 835.392 188.608 864 223.744 864h576.512A63.84 63.84 0 0 0 864 800.256V223.744A64 64 0 0 0 799.84 160z M619.072 429.088l-151.744 165.888-62.112-69.6a32 32 0 1 0-47.744 42.624l85.696 96a32 32 0 0 0 23.68 10.688h0.192c8.96 0 17.536-3.776 23.616-10.4l175.648-192a32 32 0 0 0-47.232-43.2",
|
||||||
|
"LocaleKey": "Menu.Sidebar.WcsTaskList",
|
||||||
|
"CommandType": "Navigate",
|
||||||
|
"CommandParameter": "WcsTaskList",
|
||||||
|
"PageActions": [ "add", "edit", "save", "import", "export", "delete" ]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
88
Plugins/Wcs/Plugin.Cowain.Wcs/Controls/CustomGridPanel.cs
Normal file
88
Plugins/Wcs/Plugin.Cowain.Wcs/Controls/CustomGridPanel.cs
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Controls;
|
||||||
|
|
||||||
|
public class CustomGridPanel : Panel
|
||||||
|
{
|
||||||
|
// 定义Row附加属性
|
||||||
|
public static readonly AttachedProperty<int> RowProperty =
|
||||||
|
AvaloniaProperty.RegisterAttached<CustomGridPanel, Control, int>(
|
||||||
|
"Row", 0);
|
||||||
|
|
||||||
|
// 定义Column附加属性
|
||||||
|
public static readonly AttachedProperty<int> ColumnProperty =
|
||||||
|
AvaloniaProperty.RegisterAttached<CustomGridPanel, Control, int>(
|
||||||
|
"Column", 0);
|
||||||
|
|
||||||
|
// 定义CellSize附加属性
|
||||||
|
public static readonly AttachedProperty<Size> CellSizeProperty =
|
||||||
|
AvaloniaProperty.RegisterAttached<CustomGridPanel, Control, Size>(
|
||||||
|
"CellSize", new Size(100, 100));
|
||||||
|
|
||||||
|
// 属性访问器
|
||||||
|
public static int GetRow(Control element) => element.GetValue(RowProperty);
|
||||||
|
public static void SetRow(Control element, int value) => element.SetValue(RowProperty, value);
|
||||||
|
|
||||||
|
public static int GetColumn(Control element) => element.GetValue(ColumnProperty);
|
||||||
|
public static void SetColumn(Control element, int value) => element.SetValue(ColumnProperty, value);
|
||||||
|
|
||||||
|
public static Size GetCellSize(Control element) => element.GetValue(CellSizeProperty);
|
||||||
|
public static void SetCellSize(Control element, Size value) => element.SetValue(CellSizeProperty, value);
|
||||||
|
|
||||||
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("=== Measuring CustomGridPanel ===");
|
||||||
|
|
||||||
|
int maxRow = 0;
|
||||||
|
int maxColumn = 0;
|
||||||
|
|
||||||
|
foreach (var child in Children)
|
||||||
|
{
|
||||||
|
int row = GetRow(child);
|
||||||
|
int column = GetColumn(child);
|
||||||
|
|
||||||
|
Debug.WriteLine($"Child: {child.GetType().Name}, Row: {row}, Column: {column}");
|
||||||
|
|
||||||
|
maxRow = Math.Max(maxRow, row);
|
||||||
|
maxColumn = Math.Max(maxColumn, column);
|
||||||
|
|
||||||
|
child.Measure(availableSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
var cellSize = GetCellSize(this);
|
||||||
|
var result = new Size((maxColumn + 1) * cellSize.Width, (maxRow + 1) * cellSize.Height);
|
||||||
|
|
||||||
|
Debug.WriteLine($"Measured size: {result.Width} x {result.Height}");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Size ArrangeOverride(Size finalSize)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("=== Arranging CustomGridPanel ===");
|
||||||
|
|
||||||
|
var cellSize = GetCellSize(this);
|
||||||
|
|
||||||
|
foreach (var child in Children)
|
||||||
|
{
|
||||||
|
int row = GetRow(child);
|
||||||
|
int column = GetColumn(child);
|
||||||
|
|
||||||
|
Debug.WriteLine($"Arranging child at Row: {row}, Column: {column}");
|
||||||
|
|
||||||
|
Rect rect = new Rect(
|
||||||
|
column * cellSize.Width,
|
||||||
|
row * cellSize.Height,
|
||||||
|
cellSize.Width,
|
||||||
|
cellSize.Height);
|
||||||
|
|
||||||
|
child.Arrange(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
return finalSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
using Avalonia.Animation.Easings;
|
||||||
|
using Avalonia.Animation;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Xaml.Interactivity;
|
||||||
|
using Irihi.Avalonia.Shared.Helpers;
|
||||||
|
using Avalonia.Controls.Presenters;
|
||||||
|
using Avalonia.Data;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using Avalonia.Styling;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Controls;
|
||||||
|
|
||||||
|
public class GridColumnAnimationBehavior : Behavior<Grid>
|
||||||
|
{
|
||||||
|
private IDisposable? _columnSubscription;
|
||||||
|
|
||||||
|
public static readonly StyledProperty<int> GridColumnProperty =
|
||||||
|
AvaloniaProperty.Register<GridColumnAnimationBehavior, int>(
|
||||||
|
nameof(GridColumn),
|
||||||
|
defaultBindingMode: BindingMode.TwoWay);
|
||||||
|
|
||||||
|
public int GridColumn
|
||||||
|
{
|
||||||
|
get => GetValue(GridColumnProperty);
|
||||||
|
set => SetValue(GridColumnProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAttached()
|
||||||
|
{
|
||||||
|
base.OnAttached();
|
||||||
|
|
||||||
|
if (AssociatedObject is not null)
|
||||||
|
{
|
||||||
|
// 开始监听布局更新或直接触发初始动画
|
||||||
|
AssociatedObject.AttachedToVisualTree += HandleAttached;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDetaching()
|
||||||
|
{
|
||||||
|
if (AssociatedObject is not null)
|
||||||
|
{
|
||||||
|
AssociatedObject.AttachedToVisualTree -= HandleAttached;
|
||||||
|
}
|
||||||
|
|
||||||
|
_columnSubscription?.Dispose();
|
||||||
|
base.OnDetaching();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleAttached(object? sender, VisualTreeAttachmentEventArgs e)
|
||||||
|
{
|
||||||
|
if (AssociatedObject is Grid grid && grid.Parent is ContentPresenter contentPresenter)
|
||||||
|
{
|
||||||
|
// 使用绑定监听Grid.Column变化
|
||||||
|
_columnSubscription = contentPresenter.GetObservable(Grid.ColumnProperty)
|
||||||
|
.Subscribe(column =>
|
||||||
|
{
|
||||||
|
if (column != GridColumn)
|
||||||
|
{
|
||||||
|
AnimateColumnChange(grid, column, GridColumn);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AnimateColumnChange(Grid grid, int fromColumn, int toColumn)
|
||||||
|
{
|
||||||
|
var contentPresenter = grid.Parent as ContentPresenter;
|
||||||
|
if (contentPresenter == null) return;
|
||||||
|
|
||||||
|
// 创建水平移动动画
|
||||||
|
var transform = new TranslateTransform();
|
||||||
|
contentPresenter.RenderTransform = transform;
|
||||||
|
|
||||||
|
var _animation = new Animation
|
||||||
|
{
|
||||||
|
Duration = TimeSpan.FromSeconds(0.3),
|
||||||
|
Easing = new CubicEaseInOut(),
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new KeyFrame
|
||||||
|
{
|
||||||
|
Cue = new Cue(0d),
|
||||||
|
Setters =
|
||||||
|
{
|
||||||
|
new Setter
|
||||||
|
{
|
||||||
|
Property = TranslateTransform.XProperty,
|
||||||
|
Value = fromColumn * -grid.ColumnDefinitions[fromColumn].ActualWidth
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new KeyFrame
|
||||||
|
{
|
||||||
|
Cue = new Cue(1d),
|
||||||
|
Setters =
|
||||||
|
{
|
||||||
|
new Setter
|
||||||
|
{
|
||||||
|
Property = TranslateTransform.XProperty,
|
||||||
|
Value = toColumn * -grid.ColumnDefinitions[toColumn].ActualWidth
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_animation.RunAsync(contentPresenter);
|
||||||
|
}
|
||||||
|
}
|
||||||
117
Plugins/Wcs/Plugin.Cowain.Wcs/Controls/RgvArrowDecorator.cs
Normal file
117
Plugins/Wcs/Plugin.Cowain.Wcs/Controls/RgvArrowDecorator.cs
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using Avalonia.VisualTree;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Controls;
|
||||||
|
|
||||||
|
public class RgvArrowDecorator : Decorator
|
||||||
|
{
|
||||||
|
public static readonly StyledProperty<Point> ArrowEndCanvasPointProperty =
|
||||||
|
AvaloniaProperty.Register<RgvArrowDecorator, Point>(nameof(ArrowEndCanvasPoint));
|
||||||
|
|
||||||
|
public Point ArrowEndCanvasPoint
|
||||||
|
{
|
||||||
|
get => GetValue(ArrowEndCanvasPointProperty);
|
||||||
|
set => SetValue(ArrowEndCanvasPointProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<IBrush> ArrowBrushProperty =
|
||||||
|
AvaloniaProperty.Register<RgvArrowDecorator, IBrush>(nameof(ArrowBrush), Brushes.Red);
|
||||||
|
|
||||||
|
public IBrush ArrowBrush
|
||||||
|
{
|
||||||
|
get => GetValue(ArrowBrushProperty);
|
||||||
|
set => SetValue(ArrowBrushProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<bool> ArrowDirectionProperty =
|
||||||
|
AvaloniaProperty.Register<RgvArrowDecorator, bool>(nameof(ArrowDirection), false);
|
||||||
|
|
||||||
|
public bool ArrowDirection
|
||||||
|
{
|
||||||
|
get => GetValue(ArrowDirectionProperty);
|
||||||
|
set => SetValue(ArrowDirectionProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RgvArrowDecorator()
|
||||||
|
{
|
||||||
|
this.LayoutUpdated += (s, e) => this.InvalidateVisual();
|
||||||
|
ArrowEndCanvasPointProperty.Changed.AddClassHandler<RgvArrowDecorator>((b, e) => b.InvalidateVisual());
|
||||||
|
ArrowBrushProperty.Changed.AddClassHandler<RgvArrowDecorator>((b, e) => b.InvalidateVisual());
|
||||||
|
ArrowDirectionProperty.Changed.AddClassHandler<RgvArrowDecorator>((b, e) => b.InvalidateVisual());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void Render(DrawingContext context)
|
||||||
|
{
|
||||||
|
base.Render(context);
|
||||||
|
|
||||||
|
var start = new Point(Bounds.Width / 2, Bounds.Height / 2);
|
||||||
|
var endCanvas = ArrowEndCanvasPoint;
|
||||||
|
|
||||||
|
var canvas = this.FindAncestorOfType<Canvas>();
|
||||||
|
if (canvas == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var transform = this.TransformToVisual(canvas);
|
||||||
|
Point myLeftTop = default;
|
||||||
|
if (transform != null)
|
||||||
|
{
|
||||||
|
if (transform is Matrix matrix)
|
||||||
|
myLeftTop = matrix.Transform(new Point(0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为本地坐标
|
||||||
|
var end = new Point(endCanvas.X - myLeftTop.X, endCanvas.Y - myLeftTop.Y);
|
||||||
|
|
||||||
|
// 计算三段折线
|
||||||
|
double offset = 15; // 垂直偏移
|
||||||
|
bool isAbove = end.Y < start.Y;
|
||||||
|
|
||||||
|
// 第一拐点:起点垂直偏移
|
||||||
|
var first = new Point(start.X, start.Y + (isAbove ? -offset : offset));
|
||||||
|
// 第二拐点:目标X,起点Y偏移
|
||||||
|
var second = new Point(end.X, end.Y + (isAbove ? offset : -offset));
|
||||||
|
// 终点:目标点
|
||||||
|
var last = new Point(end.X, end.Y);
|
||||||
|
|
||||||
|
// 画三段折线
|
||||||
|
var pen = new Pen(ArrowBrush, 2);
|
||||||
|
context.DrawLine(pen, start, first);
|
||||||
|
context.DrawLine(pen, first, second);
|
||||||
|
context.DrawLine(pen, second, last);
|
||||||
|
|
||||||
|
// 画箭头头部
|
||||||
|
if (ArrowDirection)
|
||||||
|
{
|
||||||
|
DrawArrowHead(context, end, second, ArrowBrush);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawArrowHead(context, second, end, ArrowBrush);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawArrowHead(DrawingContext context, Point from, Point to, IBrush brush)
|
||||||
|
{
|
||||||
|
// 箭头头部为V型
|
||||||
|
double arrowSize = 10;
|
||||||
|
double angle = Math.Atan2(to.Y - from.Y, to.X - from.X);
|
||||||
|
double leftAngle = angle + Math.PI / 6;
|
||||||
|
double rightAngle = angle - Math.PI / 6;
|
||||||
|
|
||||||
|
var left = new Point(
|
||||||
|
to.X - arrowSize * Math.Cos(leftAngle),
|
||||||
|
to.Y - arrowSize * Math.Sin(leftAngle));
|
||||||
|
var right = new Point(
|
||||||
|
to.X - arrowSize * Math.Cos(rightAngle),
|
||||||
|
to.Y - arrowSize * Math.Sin(rightAngle));
|
||||||
|
|
||||||
|
var pen = new Pen(brush, 2);
|
||||||
|
context.DrawLine(pen, to, left);
|
||||||
|
context.DrawLine(pen, to, right);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Converters;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List和string转换器
|
||||||
|
/// </summary>
|
||||||
|
public class ActionStringConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public ActionStringConverter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? Convert(object? value, Type targetType, object? prefix, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is ObservableCollection<ProcessActionViewModel> lists)
|
||||||
|
{
|
||||||
|
return JsonSerializer.Serialize(lists.Select(x => x.Action).ToList());
|
||||||
|
//return string.Join(',', menuActions);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? ConvertBack(object? value, Type targetType, object? prefix, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is string jsonString)
|
||||||
|
{
|
||||||
|
return JsonSerializer.Deserialize<List<string>>(jsonString);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Converters;
|
||||||
|
|
||||||
|
public class CellPosToCanvansPosConverter : IValueConverter
|
||||||
|
{
|
||||||
|
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is int cellPosition)
|
||||||
|
{
|
||||||
|
double cellSize = 0;
|
||||||
|
if (parameter is double d)
|
||||||
|
{
|
||||||
|
cellSize = d;
|
||||||
|
}
|
||||||
|
else if (parameter is int i)
|
||||||
|
{
|
||||||
|
cellSize = i;
|
||||||
|
}
|
||||||
|
else if (parameter != null && double.TryParse(parameter.ToString(), out double parsed))
|
||||||
|
{
|
||||||
|
cellSize = parsed;
|
||||||
|
}
|
||||||
|
if (cellSize > 0)
|
||||||
|
{
|
||||||
|
return (double)cellPosition * cellSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Converters;
|
||||||
|
|
||||||
|
|
||||||
|
public class LayoutColumnDefinitionsConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public LayoutColumnDefinitionsConverter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? Convert(object? value, Type targetType, object? prefix, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is not IEnumerable elements)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
int maxRow = elements.OfType<LayoutViewModel>()
|
||||||
|
.Select(e => e.LayOutX)
|
||||||
|
.DefaultIfEmpty(0)
|
||||||
|
.Max();
|
||||||
|
|
||||||
|
return maxRow + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? ConvertBack(object? value, Type targetType, object? prefix, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("ConvertBack is not supported.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Converters;
|
||||||
|
|
||||||
|
|
||||||
|
public class LayoutRowDefinitionsConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public LayoutRowDefinitionsConverter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? Convert(object? value, Type targetType, object? prefix, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is not IEnumerable elements)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
int maxRow = elements.OfType<LayoutViewModel>()
|
||||||
|
.Select(e => e.LayOutY)
|
||||||
|
.DefaultIfEmpty(0)
|
||||||
|
.Max();
|
||||||
|
|
||||||
|
return maxRow + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? ConvertBack(object? value, Type targetType, object? prefix, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("ConvertBack is not supported.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Converters;
|
||||||
|
|
||||||
|
public class RgvArrowVisibleConverter : IValueConverter
|
||||||
|
{
|
||||||
|
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is int stationId)
|
||||||
|
{
|
||||||
|
return stationId > 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Converters;
|
||||||
|
|
||||||
|
public class StationStatusBrushConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
StationStateEnum state = StationStateEnum.UnKnown;
|
||||||
|
if (value is string str && Enum.TryParse<StationStateEnum>(str, out var parsed))
|
||||||
|
{
|
||||||
|
state = parsed;
|
||||||
|
}
|
||||||
|
else if (value is int i)
|
||||||
|
{
|
||||||
|
state = (StationStateEnum)i;
|
||||||
|
}
|
||||||
|
else if (value is StationStateEnum e)
|
||||||
|
{
|
||||||
|
state = e;
|
||||||
|
}
|
||||||
|
// 根据状态返回不同Brush
|
||||||
|
return state switch
|
||||||
|
{
|
||||||
|
StationStateEnum.RequestPick => Brushes.Orange,
|
||||||
|
StationStateEnum.Picking => Brushes.Yellow,
|
||||||
|
StationStateEnum.PickFinished => Brushes.LightGreen,
|
||||||
|
StationStateEnum.RequestPlace => Brushes.OrangeRed,
|
||||||
|
StationStateEnum.Placing => Brushes.Yellow,
|
||||||
|
StationStateEnum.PlaceFinished => Brushes.LightGreen,
|
||||||
|
StationStateEnum.UnKnown or _ => Brushes.Gray,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Cowain.Base.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.IServices;
|
||||||
|
|
||||||
|
public interface IFindFlowTaskService : IBaseService
|
||||||
|
{
|
||||||
|
public Task FindTaskAsync(TaskDataDto? taskData = null);
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using Cowain.Base.IServices;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.IServices;
|
||||||
|
|
||||||
|
public interface IProcessFlowService : IBaseService
|
||||||
|
{
|
||||||
|
Task<List<ProcessFlowViewModel>> GetAllAsync();
|
||||||
|
Task<(List<ProcessFlowViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize);
|
||||||
|
Task<(List<ProcessFlowViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize, int? processId);
|
||||||
|
Task<ResultModel> AddAsync(int processId, List<ProcessFlowViewModel> flows);
|
||||||
|
Task<ResultModel> UpdateAsync(int processId, List<ProcessFlowViewModel> flows);
|
||||||
|
Task<ResultModel> DeleteAsync(int processId);
|
||||||
|
|
||||||
|
}
|
||||||
19
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IProcessService.cs
Normal file
19
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IProcessService.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using Cowain.Base.IServices;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Plugin.Cowain.Wcs.Models;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.IServices;
|
||||||
|
|
||||||
|
public interface IProcessService : IBaseService
|
||||||
|
{
|
||||||
|
Task<List<ProcessViewModel>> GetAllAsync();
|
||||||
|
Task<(List<ProcessViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize);
|
||||||
|
Task<ResultModel> AddAsync(ProcessViewModel process);
|
||||||
|
Task<ResultModel> UpdateAsync(ProcessViewModel? process);
|
||||||
|
Task<ResultModel> DeleteAsync(int id);
|
||||||
|
|
||||||
|
Task<ResultModel> EnableAsync(int id);
|
||||||
|
Task<ResultModel> DisableAsync(int id);
|
||||||
|
Task<ResultModel<RgvJsonModel>> GetJsonData(int id);
|
||||||
|
}
|
||||||
14
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IRgvService.cs
Normal file
14
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IRgvService.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using Cowain.Base.IServices;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.IServices;
|
||||||
|
|
||||||
|
public interface IRgvService : IBaseService
|
||||||
|
{
|
||||||
|
Task<ResultModel> AddRgvAsync(RgvViewModel? rgv);
|
||||||
|
Task<ResultModel> DeleteAsync(int id);
|
||||||
|
Task<ResultModel> UpdateAsync(RgvViewModel? rgv);
|
||||||
|
Task<List<RgvViewModel>> GetAllAsync();
|
||||||
|
Task<(List<RgvViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize);
|
||||||
|
}
|
||||||
18
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IRgvTaskService.cs
Normal file
18
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IRgvTaskService.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using Cowain.Base.IServices;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Plugin.Cowain.Wcs.Models;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.IServices;
|
||||||
|
|
||||||
|
public interface IRgvTaskService : IBaseService
|
||||||
|
{
|
||||||
|
List<RgvActionViewModel>? ActionToList(string action);
|
||||||
|
RgvCommandEnum GetStepAction(List<RgvActionViewModel> actions, int step);
|
||||||
|
Task<ResultModel> FinishTaskAsync(int id);
|
||||||
|
Task<List<TaskViewModel>> GetAllAsync();
|
||||||
|
Task<(List<TaskViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize);
|
||||||
|
Task<ResultModel<RgvCommandModel>> GetRgvCommandAsync(RgvUpdateInfoModel? infoModel);
|
||||||
|
Task<ResultModel> ExecuteAsync(string? actionParam, RgvUpdateSourceEnum source, int? execute = 0);
|
||||||
|
}
|
||||||
17
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IStationService.cs
Normal file
17
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IStationService.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using Cowain.Base.IServices;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.IServices;
|
||||||
|
|
||||||
|
public interface IStationService : IBaseService
|
||||||
|
{
|
||||||
|
Task<List<StationViewModel>> GetAllAsync();
|
||||||
|
Task<(List<StationViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize);
|
||||||
|
Task<ResultModel> AddAsync(StationViewModel station);
|
||||||
|
Task<ResultModel> UpdateAsync(StationViewModel station);
|
||||||
|
Task<ResultModel> DeleteAsync(int id);
|
||||||
|
|
||||||
|
Task<ResultModel> EnableAsync(int id);
|
||||||
|
Task<ResultModel> DisableAsync(int id);
|
||||||
|
}
|
||||||
14
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IWcsParamService.cs
Normal file
14
Plugins/Wcs/Plugin.Cowain.Wcs/IServices/IWcsParamService.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using Cowain.Base.IServices;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.IServices;
|
||||||
|
|
||||||
|
public interface IWcsParamService : IBaseService
|
||||||
|
{
|
||||||
|
Task<ResultModel> AddAsync(WcsParamViewModel? viewModel);
|
||||||
|
Task<ResultModel> DeleteAsync(int id);
|
||||||
|
Task<ResultModel<WcsParamViewModel>> GetParamAsync(string? name);
|
||||||
|
Task<ResultModel> UpdateAsync(WcsParamViewModel? viewModel);
|
||||||
|
|
||||||
|
}
|
||||||
47
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/ProcessDto.cs
Normal file
47
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/ProcessDto.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
|
||||||
|
|
||||||
|
[Table("process")]
|
||||||
|
public class ProcessDto : BaseModel
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工艺名称
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(100)]
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工艺流程图存储
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public string FlowData { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public bool Enable { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后一次更新时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime UpdateTime { get; set; } = DateTime.MinValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PLC参数
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public string Json { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
64
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/ProcessFlowDto.cs
Normal file
64
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/ProcessFlowDto.cs
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
using Cowain.Base.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
|
||||||
|
|
||||||
|
[Table("process_flow")]
|
||||||
|
public class ProcessFlowDto : BaseModel
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工艺id
|
||||||
|
/// </summary>
|
||||||
|
public int ProcessId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 优先级
|
||||||
|
/// </summary>
|
||||||
|
public int Priority { get; set; }
|
||||||
|
public int FromStationId1 { get; set; }
|
||||||
|
|
||||||
|
public int ToStationId1 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string FromStatus1 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string ToStatus1 { get; set; } = string.Empty;
|
||||||
|
public int FromStationId2 { get; set; }
|
||||||
|
|
||||||
|
public int ToStationId2 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string FromStatus2 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string ToStatus2 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动作
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string Action { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
61
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/RgvDto.cs
Normal file
61
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/RgvDto.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using Cowain.Base.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
|
||||||
|
[Table("rgv")]
|
||||||
|
public class RgvDto : BaseModel
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 设备名称
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(100)]
|
||||||
|
public string StationName { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 设备代号 RGV-01
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(100)]
|
||||||
|
public string StationCode { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工艺名称
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(100)]
|
||||||
|
public string ProcessName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int FromStationId1 { get; set; }
|
||||||
|
public int ToStationId1 { get; set; }
|
||||||
|
public int FromStationId2 { get; set; }
|
||||||
|
public int ToStationId2 { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 序列号
|
||||||
|
/// </summary>
|
||||||
|
[MaxLength(200)]
|
||||||
|
public string QrCode1 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 序列号
|
||||||
|
/// </summary>
|
||||||
|
[MaxLength(200)]
|
||||||
|
public string QrCode2 { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 动画位置X
|
||||||
|
/// </summary>
|
||||||
|
public int LayOutX { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动画位置X
|
||||||
|
/// </summary>
|
||||||
|
public int LayOutY { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 参数,需要从PLC读取当前位置,状态等信息
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public string Json { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
99
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/StationDto.cs
Normal file
99
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/StationDto.cs
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
using Cowain.Base.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
|
||||||
|
[Table("station")]
|
||||||
|
public class StationDto : BaseModel
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 设备名称
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(100)]
|
||||||
|
public string StationName { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 设备代号,比如OP100-01
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(100)]
|
||||||
|
public string StationCode { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 序列号
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(200)]
|
||||||
|
public string QrCode { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 工艺名称
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public string ProcessName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 实际位置X
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public float PositionX { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 实际位置Y
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public float PositionY { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 实际位置Z
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public float PositionZ { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 布局位置X
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int LayOutX { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 布局位置Y
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int LayOutY { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工站自定义位置号,发送给PLC用
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int StationPos { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string Status { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
public bool Enable { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 下一站Id,手动指定,如果为0,则表示需要根据工艺流程自动计算下一站
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int NextStationId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后一次更新时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime UpdateTime { get; set; } = DateTime.MinValue;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
98
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/TaskDataDto.cs
Normal file
98
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/TaskDataDto.cs
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
using Cowain.Base.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
|
||||||
|
[Table("task_data")]
|
||||||
|
public class TaskDataDto : BaseModel
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工艺名称
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(100)]
|
||||||
|
public string ProcessName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int ProcessId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 优先级
|
||||||
|
/// </summary>
|
||||||
|
public int Priority { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 序列号
|
||||||
|
/// </summary>
|
||||||
|
[MaxLength(200)]
|
||||||
|
public string QrCode1 { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 序列号
|
||||||
|
/// </summary>
|
||||||
|
[MaxLength(200)]
|
||||||
|
public string QrCode2 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
public int FromStationId1 { get; set; }
|
||||||
|
public int ToStationId1 { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string FromStatus1 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string ToStatus1 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int FromStationId2 { get; set; }
|
||||||
|
public int ToStationId2 { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string FromStatus2 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string ToStatus2 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 正在执行的动作
|
||||||
|
/// </summary>
|
||||||
|
public int ExecuteAction { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务完成
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFinished { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动作保存
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[MaxLength(50)]
|
||||||
|
public string Action { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务完成时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime FinishedTime { get; set; } = DateTime.MinValue;
|
||||||
|
|
||||||
|
}
|
||||||
49
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/WcsParamDto.cs
Normal file
49
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Dto/WcsParamDto.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using Cowain.Base.DBContext;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Cowain.Base.Models.Admins;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
|
||||||
|
[Table("wcs_param")]
|
||||||
|
public class WcsParamDto : BaseModel
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 参数名称
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 参数内容
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public string Param { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UserSeed : IDataSeeding
|
||||||
|
{
|
||||||
|
public void DataSeeding(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<WcsParamDto>().HasData(
|
||||||
|
new WcsParamDto
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Name = "FindTaskOnStartUp",
|
||||||
|
Param = "True"
|
||||||
|
},
|
||||||
|
new WcsParamDto
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Name = "FindTaskEnable",
|
||||||
|
Param = "True"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
12
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Enum/RgvCommandEnum.cs
Normal file
12
Plugins/Wcs/Plugin.Cowain.Wcs/Models/Enum/RgvCommandEnum.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
|
||||||
|
public enum RgvCommandEnum
|
||||||
|
{
|
||||||
|
UnKnown = 0,
|
||||||
|
MoveFrom = 10,
|
||||||
|
MoveTo = 11,
|
||||||
|
Pick = 20,
|
||||||
|
Place = 30
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
|
||||||
|
public enum RgvUpdateSourceEnum
|
||||||
|
{
|
||||||
|
PLC,
|
||||||
|
First,
|
||||||
|
User
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
|
||||||
|
public enum StationStateEnum
|
||||||
|
{
|
||||||
|
UnKnown = 0,
|
||||||
|
RequestPick = 10, //请求取料
|
||||||
|
Picking = 11, //取料中
|
||||||
|
PickFinished = 12, //取料完成
|
||||||
|
RequestPlace = 20, //请求放料
|
||||||
|
Placing = 21, //放料中
|
||||||
|
PlaceFinished = 22, //放料完成
|
||||||
|
NgPick = 30, //NG取料
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
|
||||||
|
public enum StationUpdateSourceEnum
|
||||||
|
{
|
||||||
|
PLC,
|
||||||
|
Task,
|
||||||
|
User
|
||||||
|
}
|
||||||
20
Plugins/Wcs/Plugin.Cowain.Wcs/Models/RgvCommandModel.cs
Normal file
20
Plugins/Wcs/Plugin.Cowain.Wcs/Models/RgvCommandModel.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models;
|
||||||
|
|
||||||
|
|
||||||
|
public class RgvCommandModel
|
||||||
|
{
|
||||||
|
public RgvCommandEnum Command { get; set; }
|
||||||
|
|
||||||
|
public int TaskId { get; set; } = 0;
|
||||||
|
public string QrCode1 { get; set; } = string.Empty;
|
||||||
|
public string QrCode2 { get; set; } = string.Empty;
|
||||||
|
public int FromPos1 { get; set; } = 0;
|
||||||
|
public int FromPos2 { get; set; } = 0;
|
||||||
|
|
||||||
|
public int TargetPos1 { get; set; } = 0;
|
||||||
|
public int TargetPos2 { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
14
Plugins/Wcs/Plugin.Cowain.Wcs/Models/RgvJsonModel.cs
Normal file
14
Plugins/Wcs/Plugin.Cowain.Wcs/Models/RgvJsonModel.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models;
|
||||||
|
|
||||||
|
public class RgvJsonModel
|
||||||
|
{
|
||||||
|
public string? PlcName { get; set; }
|
||||||
|
public string? Address { get; set; }
|
||||||
|
public string? RgvName { get; set; }
|
||||||
|
}
|
||||||
17
Plugins/Wcs/Plugin.Cowain.Wcs/Models/RgvUpdateInfoModel.cs
Normal file
17
Plugins/Wcs/Plugin.Cowain.Wcs/Models/RgvUpdateInfoModel.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Models;
|
||||||
|
|
||||||
|
public class RgvUpdateInfoModel
|
||||||
|
{
|
||||||
|
public RgvUpdateSourceEnum Source { get; set; } = RgvUpdateSourceEnum.PLC;
|
||||||
|
|
||||||
|
public int ExecuteAction { get; set; }
|
||||||
|
|
||||||
|
public int TaskId { get; set; }
|
||||||
|
|
||||||
|
public int RetCmd { get; set; }
|
||||||
|
|
||||||
|
public int RetResult { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
101
Plugins/Wcs/Plugin.Cowain.Wcs/Plugin.Cowain.Wcs.csproj
Normal file
101
Plugins/Wcs/Plugin.Cowain.Wcs/Plugin.Cowain.Wcs.csproj
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<!--<Import Project="../../../Directory.Version.props" />-->
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<LangVersion>12.0</LangVersion>
|
||||||
|
<!-- 确保 NuGet 包的 DLL 被复制 -->
|
||||||
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="Configs\Images\rgv.png" />
|
||||||
|
<None Remove="Configs\Images\堆垛机.png" />
|
||||||
|
<None Remove="i18n\en-US.json" />
|
||||||
|
<None Remove="i18n\zh-CN.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<AvaloniaResource Include="Configs\Images\rgv.png" />
|
||||||
|
<AvaloniaResource Include="Configs\Images\堆垛机.png" />
|
||||||
|
<AvaloniaResource Include="i18n\en-US.json" />
|
||||||
|
<AvaloniaResource Include="i18n\zh-CN.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Avalonia" />
|
||||||
|
<PackageReference Include="Avalonia.Controls.ItemsRepeater" />
|
||||||
|
<PackageReference Include="HslCommunication" />
|
||||||
|
<PackageReference Include="Ke.Bee.Localization" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" />
|
||||||
|
<PackageReference Include="NodifyAvalonia" />
|
||||||
|
<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="Xaml.Behaviors.Avalonia" />
|
||||||
|
<PackageReference Include="Xaml.Behaviors.Interactivity" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Target Name="CopyFilesToDestination" AfterTargets="AfterBuild" Condition="true">
|
||||||
|
<!-- 确定相对路径到目标目录 -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- 这里使用 MSBuild 的内置属性来构造正确的路径 -->
|
||||||
|
<TargetDirectory>../../../Cowain.TestProject/Plugins/Wcs</TargetDirectory>
|
||||||
|
</PropertyGroup>
|
||||||
|
<!-- 确保目标目录存在 -->
|
||||||
|
<MakeDir Directories="$(TargetDirectory)" Condition="!Exists('$(TargetDirectory)')" />
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Source1 Include="i18n/*.*" />
|
||||||
|
<Source2 Include="Configs/*.*" />
|
||||||
|
<FilesToCopy Include="$(OutputPath)**/Plugin.Cowain.Wcs.dll" />
|
||||||
|
<FilesToCopy Include="$(OutputPath)**/Plugin.Cowain.Wcs.pdb" />
|
||||||
|
<FilesToCopy Include="$(OutputPath)**/Plugin.Cowain.Wcs.deps.json" />
|
||||||
|
<FilesToCopy Include="$(OutputPath)**/HslCommunication.dll" />
|
||||||
|
<FilesToCopy Include="$(OutputPath)**/Newtonsoft.Json.dll" />
|
||||||
|
<FilesToCopy Include="$(OutputPath)**/System.IO.Ports.dll" />
|
||||||
|
|
||||||
|
</ItemGroup>
|
||||||
|
<!-- 复制文件到目标目录 -->
|
||||||
|
<Copy SourceFiles="@(FilesToCopy)" DestinationFolder="$(TargetDirectory)/%(RecursiveDir)" />
|
||||||
|
<Copy SourceFiles="@(Source1)" DestinationFolder="$(TargetDirectory)/i18n/" />
|
||||||
|
<Copy SourceFiles="@(Source2)" DestinationFolder="$(TargetDirectory)/Configs/" />
|
||||||
|
<!-- 输出TargetDirectory -->
|
||||||
|
<Message Text="TargetDirectory: $(TargetDirectory)" Importance="high" />
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\Cowain.Base\Cowain.Base.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Driver\Cowain.Driver\Plugin.Cowain.Driver.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Views\FlowManagementView.axaml.cs">
|
||||||
|
<DependentUpon>FlowManagementView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Views\ProcessEditDialog.axaml.cs">
|
||||||
|
<DependentUpon>ProcessEditDialog.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Views\ProcessManagementView.axaml.cs">
|
||||||
|
<DependentUpon>ProcessManagementView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Views\RgvManagementView.axaml.cs">
|
||||||
|
<DependentUpon>RgvManagementView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Views\WcsRealStationView.axaml.cs">
|
||||||
|
<DependentUpon>WcsRealStationView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Views\WcsTaskListView.axaml.cs">
|
||||||
|
<DependentUpon>WcsTaskListView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Views\StationManagementView.axaml.cs">
|
||||||
|
<DependentUpon>StationManagementView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</Project>
|
||||||
316
Plugins/Wcs/Plugin.Cowain.Wcs/Services/FindFlowTaskService.cs
Normal file
316
Plugins/Wcs/Plugin.Cowain.Wcs/Services/FindFlowTaskService.cs
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
using Cowain.Base.DBContext;
|
||||||
|
using Cowain.Base.Services;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Plugin.Cowain.Driver.Abstractions;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Services;
|
||||||
|
|
||||||
|
public class FindFlowTaskService : BaseService, IFindFlowTaskService
|
||||||
|
{
|
||||||
|
private class ProcessFlowInfo
|
||||||
|
{
|
||||||
|
public ProcessFlowInfo(ProcessDto process, ProcessFlowDto flow)
|
||||||
|
{
|
||||||
|
Process = process;
|
||||||
|
Flow = flow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProcessDto Process { get; set; }
|
||||||
|
public ProcessFlowDto Flow { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SemaphoreSlim semaphore = new SemaphoreSlim(1);
|
||||||
|
private IDeviceMonitor _deviceMonitor;
|
||||||
|
private IProcessService _processService;
|
||||||
|
private IServiceScopeFactory _scopeFactory;
|
||||||
|
private readonly ILogger<FindFlowTaskService> _logger;
|
||||||
|
|
||||||
|
public FindFlowTaskService(IDbContextFactory<SqlDbContext> dbContextFactory, IServiceScopeFactory scopeFactory, IDeviceMonitor deviceMonitor, IProcessService processService, ILogger<FindFlowTaskService> logger) : base(dbContextFactory)
|
||||||
|
{
|
||||||
|
_deviceMonitor = deviceMonitor;
|
||||||
|
_processService = processService;
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据工站列表和流程工艺列表,构建所有可执行的候选任务
|
||||||
|
/// </summary>
|
||||||
|
private List<TaskDataDto> BuildCandidateTasks(List<StationDto> stations, List<ProcessFlowInfo> processAndFlows)
|
||||||
|
{
|
||||||
|
var candidateTasks = new List<TaskDataDto>();
|
||||||
|
foreach (var item in processAndFlows)
|
||||||
|
{
|
||||||
|
var flow = item.Flow;
|
||||||
|
var process = item.Process;
|
||||||
|
|
||||||
|
// 第一段工站匹配
|
||||||
|
var fromStation1 = stations.FirstOrDefault(s =>
|
||||||
|
s.ProcessName == process.Name &&
|
||||||
|
s.Id == flow.FromStationId1 &&
|
||||||
|
s.Status == flow.FromStatus1);
|
||||||
|
|
||||||
|
var toStation1 = stations.FirstOrDefault(s =>
|
||||||
|
s.ProcessName == process.Name &&
|
||||||
|
s.Id == flow.ToStationId1 &&
|
||||||
|
s.Status == flow.ToStatus1);
|
||||||
|
|
||||||
|
if (fromStation1 == null || toStation1 == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// 第二段工站匹配(如有)
|
||||||
|
bool secondMatched = true;
|
||||||
|
if (!(flow.FromStationId2 == 0 && flow.ToStationId2 == 0))
|
||||||
|
{
|
||||||
|
var fromStation2 = stations.FirstOrDefault(s =>
|
||||||
|
s.ProcessName == process.Name &&
|
||||||
|
s.Id == flow.FromStationId2 &&
|
||||||
|
s.Status == flow.FromStatus2);
|
||||||
|
|
||||||
|
var toStation2 = stations.FirstOrDefault(s =>
|
||||||
|
s.ProcessName == process.Name &&
|
||||||
|
s.Id == flow.ToStationId2 &&
|
||||||
|
s.Status == flow.ToStatus2);
|
||||||
|
|
||||||
|
if (fromStation2 == null || toStation2 == null)
|
||||||
|
secondMatched = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (secondMatched)
|
||||||
|
{
|
||||||
|
candidateTasks.Add(new TaskDataDto
|
||||||
|
{
|
||||||
|
ProcessId = process.Id,
|
||||||
|
ProcessName = process.Name,
|
||||||
|
Priority = flow.Priority,
|
||||||
|
FromStationId1 = flow.FromStationId1,
|
||||||
|
ToStationId1 = flow.ToStationId1,
|
||||||
|
FromStatus1 = flow.FromStatus1,
|
||||||
|
ToStatus1 = flow.ToStatus1,
|
||||||
|
FromStationId2 = flow.FromStationId2,
|
||||||
|
ToStationId2 = flow.ToStationId2,
|
||||||
|
FromStatus2 = flow.FromStatus2,
|
||||||
|
ToStatus2 = flow.ToStatus2,
|
||||||
|
ExecuteAction = 0,
|
||||||
|
IsFinished = false,
|
||||||
|
Action = flow.Action,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return candidateTasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 延时查询任务(非阻塞方式)
|
||||||
|
/// </summary>
|
||||||
|
private async Task DelayedQueryAsync(TaskDataDto originalTask)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await Task.Delay(10000).ConfigureAwait(false);
|
||||||
|
_logger.LogInformation($"延时10秒后重新查询任务,原任务:{JsonConvert.SerializeObject(originalTask)}");
|
||||||
|
|
||||||
|
// 使用新的作用域创建独立的DbContext
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var tempService = scope.ServiceProvider.GetRequiredService<IFindFlowTaskService>();
|
||||||
|
await tempService.FindTaskAsync(originalTask);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "延时查询任务失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存任务并执行
|
||||||
|
/// </summary>
|
||||||
|
private async Task SaveAndExecuteTask(TaskDataDto task)
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var taskSet = dbContext.GetDbSet<TaskDataDto>();
|
||||||
|
await taskSet.AddAsync(task);
|
||||||
|
var saveCount = await dbContext.SaveChangesAsync();
|
||||||
|
if (saveCount > 0)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"找到并添加任务:{JsonConvert.SerializeObject(task)}");
|
||||||
|
var getJson = await _processService.GetJsonData(task.ProcessId);
|
||||||
|
if (getJson.IsSuccess)
|
||||||
|
{
|
||||||
|
var taskJsonParam = _deviceMonitor.GetActionParam(getJson.Data!.PlcName!, getJson.Data!.Address!);
|
||||||
|
if (taskJsonParam.IsSuccess)
|
||||||
|
{
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var taskService = scope.ServiceProvider.GetRequiredService<IRgvTaskService>();
|
||||||
|
var execute = await taskService.ExecuteAsync(taskJsonParam.Data, RgvUpdateSourceEnum.First);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError(getJson.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError("任务添加失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task FindTaskAsync(TaskDataDto? taskData = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await semaphore.WaitAsync();
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var taskSet = dbContext.GetDbSet<TaskDataDto>();
|
||||||
|
var unfinishedTask = await taskSet.AsNoTracking().FirstOrDefaultAsync(t => !t.IsFinished);
|
||||||
|
if (unfinishedTask != null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"已有未完成的任务,任务ID:{unfinishedTask.Id},任务内容:{JsonConvert.SerializeObject(unfinishedTask)}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var rgvSet = dbContext.GetDbSet<RgvDto>();
|
||||||
|
var processSet = dbContext.GetDbSet<ProcessDto>();
|
||||||
|
var flowSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||||
|
var stationSet = dbContext.GetDbSet<StationDto>();
|
||||||
|
|
||||||
|
// 只查可用工站
|
||||||
|
var enabledStations = await stationSet.AsNoTracking().Where(s => s.Enable && s.NextStationId <= 0).ToListAsync();
|
||||||
|
|
||||||
|
// 组合所有流程和工艺
|
||||||
|
var query = from flow in flowSet
|
||||||
|
join process in processSet on flow.ProcessId equals process.Id
|
||||||
|
select new ProcessFlowInfo(process, flow);
|
||||||
|
var processAndFlows = await query.ToListAsync();
|
||||||
|
|
||||||
|
// 查找候选任务
|
||||||
|
var candidateTasks = BuildCandidateTasks(enabledStations, processAndFlows);
|
||||||
|
// 取优先级最高的
|
||||||
|
//var findTask = candidateTasks
|
||||||
|
// .OrderByDescending(x => x.Priority)
|
||||||
|
// .FirstOrDefault();
|
||||||
|
// 取优先级最高的,如果有多条则按距离(RGV->From1 + From1->To1)最小选取
|
||||||
|
TaskDataDto? findTask = null;
|
||||||
|
if (candidateTasks != null && candidateTasks.Count > 0)
|
||||||
|
{
|
||||||
|
var maxPriority = candidateTasks.Max(x => x.Priority);
|
||||||
|
var topCandidates = candidateTasks.Where(x => x.Priority == maxPriority).ToList();
|
||||||
|
if (topCandidates.Count == 1)
|
||||||
|
{
|
||||||
|
//只有一条最高优先级任务,直接选取
|
||||||
|
findTask = topCandidates[0];
|
||||||
|
_logger.LogInformation($"最优任务只有一条,任务内容:{JsonConvert.SerializeObject(findTask)}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//优先级最高的任务大于1个,尝试获取当前RGV位置
|
||||||
|
var rgv = await rgvSet.AsNoTracking().FirstOrDefaultAsync();
|
||||||
|
if (rgv == null)
|
||||||
|
{
|
||||||
|
// 无RGV位置时,退回到取第一条
|
||||||
|
findTask = topCandidates[0];
|
||||||
|
_logger.LogInformation($"rgv位置获取失败,使用默认最优任务,任务内容:{JsonConvert.SerializeObject(findTask)}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double bestDistance = double.MaxValue;
|
||||||
|
foreach (var cand in topCandidates)
|
||||||
|
{
|
||||||
|
//遍历优先级最高的任务,计算距离
|
||||||
|
var fromStation = enabledStations.FirstOrDefault(s => s.Id == cand.FromStationId1);
|
||||||
|
var toStation = enabledStations.FirstOrDefault(s => s.Id == cand.ToStationId1);
|
||||||
|
if (fromStation == null || toStation == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// 计算:|RGV.X - From.X| + |From.X - To.X|
|
||||||
|
var distance = Math.Abs((double)rgv.LayOutX - (double)fromStation.LayOutX)
|
||||||
|
+ Math.Abs((double)fromStation.LayOutX - (double)toStation.LayOutX);
|
||||||
|
if (distance < bestDistance)
|
||||||
|
{
|
||||||
|
bestDistance = distance;
|
||||||
|
findTask = cand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果遍历未找到合法候选(异常情况),退回到第一条
|
||||||
|
if (findTask == null)
|
||||||
|
{
|
||||||
|
findTask = topCandidates[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"最优任务找到,距离:{bestDistance},任务内容:{JsonConvert.SerializeObject(findTask)}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果taskData不为空,说明是通过延时查询触发的
|
||||||
|
if (taskData != null)
|
||||||
|
{
|
||||||
|
if (findTask == null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"延时查询后,没有找到新任务,保存原任务");
|
||||||
|
await SaveAndExecuteTask(taskData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"通过延时查询触发的查询,原任务:{JsonConvert.SerializeObject(taskData)}");
|
||||||
|
// 如果查询到第二段还是0且第一段相同,保存这个task
|
||||||
|
if (findTask.FromStationId2 == 0 && findTask.ToStationId2 == 0)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"延时查询后,还是只有单段任务,保存原任务");
|
||||||
|
await SaveAndExecuteTask(taskData);
|
||||||
|
}
|
||||||
|
// 如果查询到第二段不是0的任务,保存新任务
|
||||||
|
else if (findTask.FromStationId2 != 0 || findTask.ToStationId2 != 0)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"延时查询后,找到更好的两段任务,保存新任务");
|
||||||
|
await SaveAndExecuteTask(findTask);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"延时查询后,没有找到更好的任务,不保存");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (findTask == null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"没有需要执行的任务");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 首次查询
|
||||||
|
if (findTask.FromStationId2 == 0 && findTask.ToStationId2 == 0)
|
||||||
|
{
|
||||||
|
// 任务的第二段是0,启动非阻塞的延时查询
|
||||||
|
_logger.LogInformation($"当前任务第二段为0,需要重新查询,原任务:{JsonConvert.SerializeObject(findTask)}");
|
||||||
|
|
||||||
|
// 使用Task.Run启动非阻塞的延时查询,不等待其完成
|
||||||
|
_ = Task.Run(async () => await DelayedQueryAsync(findTask));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 直接保存任务
|
||||||
|
await SaveAndExecuteTask(findTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "查找任务失败");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
semaphore.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
261
Plugins/Wcs/Plugin.Cowain.Wcs/Services/ProcessFlowService.cs
Normal file
261
Plugins/Wcs/Plugin.Cowain.Wcs/Services/ProcessFlowService.cs
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
using Cowain.Base.DBContext;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Cowain.Base.Services;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Services;
|
||||||
|
|
||||||
|
public class ProcessFlowService : BaseService, IProcessFlowService
|
||||||
|
{
|
||||||
|
public ProcessFlowService(IDbContextFactory<SqlDbContext> dbContextFactory) : base(dbContextFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public async Task<ResultModel> AddAsync(int processId, List<ProcessFlowViewModel> flows)
|
||||||
|
{
|
||||||
|
if (flows == null || flows.Count == 0)
|
||||||
|
return ResultModel.Error("流程数据不能为空");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||||
|
var entities = new List<ProcessFlowDto>();
|
||||||
|
foreach (var f in flows)
|
||||||
|
{
|
||||||
|
entities.Add(new ProcessFlowDto
|
||||||
|
{
|
||||||
|
ProcessId = processId,
|
||||||
|
Priority = f.Priority,
|
||||||
|
FromStationId1 = f.FromStationId1,
|
||||||
|
ToStationId1 = f.ToStationId1,
|
||||||
|
FromStatus1 = f.FromStatus1,
|
||||||
|
ToStatus1 = f.ToStatus1,
|
||||||
|
FromStationId2 = f.FromStationId2,
|
||||||
|
ToStationId2 = f.ToStationId2,
|
||||||
|
FromStatus2 = f.FromStatus2,
|
||||||
|
ToStatus2 = f.ToStatus2,
|
||||||
|
Action = f.Action
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
await DbSet.AddRangeAsync(entities);
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("流程数据添加成功") : ResultModel.Error("流程数据添加失败");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"添加流程失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> UpdateAsync(int processId, List<ProcessFlowViewModel> flows)
|
||||||
|
{
|
||||||
|
if (flows == null || flows.Count == 0)
|
||||||
|
return ResultModel.Error("流程数据不能为空");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var dbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||||
|
foreach (var f in flows)
|
||||||
|
{
|
||||||
|
// 只根据Id和ProcessId查找
|
||||||
|
var entity = await dbSet.FirstOrDefaultAsync(x => x.Id == f.Id && x.ProcessId == processId);
|
||||||
|
|
||||||
|
if (entity != null)
|
||||||
|
{
|
||||||
|
// 更新已有
|
||||||
|
entity.Priority = f.Priority;
|
||||||
|
entity.FromStationId1 = f.FromStationId1;
|
||||||
|
entity.ToStationId1 = f.ToStationId1;
|
||||||
|
entity.FromStatus1 = f.FromStatus1;
|
||||||
|
entity.ToStatus1 = f.ToStatus1;
|
||||||
|
entity.FromStationId2 = f.FromStationId2;
|
||||||
|
entity.ToStationId2 = f.ToStationId2;
|
||||||
|
entity.FromStatus2 = f.FromStatus2;
|
||||||
|
entity.ToStatus2 = f.ToStatus2;
|
||||||
|
entity.Action = f.Action;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 新增
|
||||||
|
var newEntity = new ProcessFlowDto
|
||||||
|
{
|
||||||
|
ProcessId = processId,
|
||||||
|
Priority = f.Priority,
|
||||||
|
FromStationId1 = f.FromStationId1,
|
||||||
|
ToStationId1 = f.ToStationId1,
|
||||||
|
FromStatus1 = f.FromStatus1,
|
||||||
|
ToStatus1 = f.ToStatus1,
|
||||||
|
FromStationId2 = f.FromStationId2,
|
||||||
|
ToStationId2 = f.ToStationId2,
|
||||||
|
FromStatus2 = f.FromStatus2,
|
||||||
|
ToStatus2 = f.ToStatus2,
|
||||||
|
Action = f.Action
|
||||||
|
};
|
||||||
|
await dbSet.AddAsync(newEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
return count >= 0 ? ResultModel.Success("流程更新成功") : ResultModel.Error("流程更新失败");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"更新流程失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> DeleteAsync(int processId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var dbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||||
|
var entitie = await dbSet.Where(x => x.Id == processId).FirstOrDefaultAsync();
|
||||||
|
if (entitie == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Success("未找到要删除的流程数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
dbSet.Remove(entitie);
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("流程数据删除成功") : ResultModel.Error("流程数据删除失败");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"删除流程失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> DeleteByIdAsync(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var dbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||||
|
var existingModel = await dbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("process no exists");
|
||||||
|
}
|
||||||
|
|
||||||
|
dbSet.Remove(existingModel);
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("流程数据删除成功") : ResultModel.Error("流程数据删除失败");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"删除流程失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<ProcessFlowViewModel>> GetAllAsync()
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||||
|
var data = await DbSet.ToListAsync();
|
||||||
|
var result = new List<ProcessFlowViewModel>();
|
||||||
|
foreach (var x in data)
|
||||||
|
{
|
||||||
|
// 1号流程
|
||||||
|
if (x.FromStationId1 != 0 || x.ToStationId1 != 0 || !string.IsNullOrEmpty(x.FromStatus1) || !string.IsNullOrEmpty(x.ToStatus1))
|
||||||
|
{
|
||||||
|
result.Add(new ProcessFlowViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
ProcessId = x.ProcessId,
|
||||||
|
Priority = x.Priority,
|
||||||
|
FromStationId1 = x.FromStationId1,
|
||||||
|
ToStationId1 = x.ToStationId1,
|
||||||
|
FromStatus1 = x.FromStatus1,
|
||||||
|
ToStatus1 = x.ToStatus1,
|
||||||
|
FromStationId2 = x.FromStationId2,
|
||||||
|
ToStationId2 = x.ToStationId2,
|
||||||
|
FromStatus2 = x.FromStatus2,
|
||||||
|
ToStatus2 = x.ToStatus2,
|
||||||
|
Action = x.Action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<(List<ProcessFlowViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||||
|
var data = await DbSet.ToListAsync();
|
||||||
|
var result = new List<ProcessFlowViewModel>();
|
||||||
|
foreach (var x in data)
|
||||||
|
{
|
||||||
|
if (x.FromStationId1 != 0 || x.ToStationId1 != 0 || !string.IsNullOrEmpty(x.FromStatus1) || !string.IsNullOrEmpty(x.ToStatus1))
|
||||||
|
{
|
||||||
|
result.Add(new ProcessFlowViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
ProcessId = x.ProcessId,
|
||||||
|
Priority = x.Priority,
|
||||||
|
FromStationId1 = x.FromStationId1,
|
||||||
|
ToStationId1 = x.ToStationId1,
|
||||||
|
FromStatus1 = x.FromStatus1,
|
||||||
|
ToStatus1 = x.ToStatus1,
|
||||||
|
FromStationId2 = x.FromStationId2,
|
||||||
|
ToStationId2 = x.ToStationId2,
|
||||||
|
FromStatus2 = x.FromStatus2,
|
||||||
|
ToStatus2 = x.ToStatus2,
|
||||||
|
Action = x.Action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
var paged = result.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||||
|
return (paged, result.Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<(List<ProcessFlowViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize, int? processId)
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||||
|
IQueryable<ProcessFlowDto> query;
|
||||||
|
if (processId.HasValue && await DbSet.AnyAsync(x => x.ProcessId == processId))
|
||||||
|
{
|
||||||
|
query = DbSet.Where(x => x.ProcessId == processId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
query = DbSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await query.OrderBy(x => x.Id).ToListAsync();
|
||||||
|
var result = new List<ProcessFlowViewModel>();
|
||||||
|
foreach (var x in data)
|
||||||
|
{
|
||||||
|
if (x.FromStationId1 != 0 || x.ToStationId1 != 0 || !string.IsNullOrEmpty(x.FromStatus1) || !string.IsNullOrEmpty(x.ToStatus1))
|
||||||
|
{
|
||||||
|
result.Add(new ProcessFlowViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
ProcessId = x.ProcessId,
|
||||||
|
Priority = x.Priority,
|
||||||
|
FromStationId1 = x.FromStationId1,
|
||||||
|
ToStationId1 = x.ToStationId1,
|
||||||
|
FromStatus1 = x.FromStatus1,
|
||||||
|
ToStatus1 = x.ToStatus1,
|
||||||
|
FromStationId2 = x.FromStationId2,
|
||||||
|
ToStationId2 = x.ToStationId2,
|
||||||
|
FromStatus2 = x.FromStatus2,
|
||||||
|
ToStatus2 = x.ToStatus2,
|
||||||
|
Action = x.Action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var paged = result.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||||
|
return (paged, result.Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
226
Plugins/Wcs/Plugin.Cowain.Wcs/Services/ProcessService.cs
Normal file
226
Plugins/Wcs/Plugin.Cowain.Wcs/Services/ProcessService.cs
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
using Cowain.Base.DBContext;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Cowain.Base.Services;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Services;
|
||||||
|
|
||||||
|
public class ProcessService : BaseService, IProcessService
|
||||||
|
{
|
||||||
|
public ProcessService(IDbContextFactory<SqlDbContext> dbContextFactory) : base(dbContextFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> AddAsync(ProcessViewModel process)
|
||||||
|
{
|
||||||
|
if (process == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("process不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(process.Name))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("流程名称不能为空");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||||
|
|
||||||
|
// 检查名称是否已存在
|
||||||
|
var exists = await DbSet.AnyAsync(x => x.Name == process.Name);
|
||||||
|
if (exists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("已存在同名流程");
|
||||||
|
}
|
||||||
|
|
||||||
|
var entity = new ProcessDto
|
||||||
|
{
|
||||||
|
Name = process.Name,
|
||||||
|
Enable = true,
|
||||||
|
FlowData = process.FlowData,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
UpdateTime = DateTime.Now
|
||||||
|
};
|
||||||
|
await DbSet.AddAsync(entity);
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("流程添加成功") : ResultModel.Error("流程添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> DeleteAsync(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id cannot be null");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var processDbSet = dbContext.GetDbSet<ProcessDto>();
|
||||||
|
var flowDbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||||
|
var existingModel = await processDbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("device no exists");
|
||||||
|
}
|
||||||
|
using var transaction = await dbContext.Database.BeginTransactionAsync();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 删除流程相关的流程流数据
|
||||||
|
var relatedFlows = await flowDbSet.Where(f => f.ProcessId == id).ToListAsync();
|
||||||
|
if (relatedFlows.Count > 0)
|
||||||
|
{
|
||||||
|
flowDbSet.RemoveRange(relatedFlows);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除流程
|
||||||
|
processDbSet.Remove(existingModel);
|
||||||
|
|
||||||
|
int count = await dbContext.SaveChangesAsync();
|
||||||
|
await transaction.CommitAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("process delete successfully") : ResultModel.Error("process delete error");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await transaction.RollbackAsync();
|
||||||
|
return ResultModel.Error($"process delete error: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> DisableAsync(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id cannot be null");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("device no exists");
|
||||||
|
}
|
||||||
|
existingModel.Enable = false;
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
return ResultModel.Success("device disable successfully");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> EnableAsync(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id cannot be null");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("device no exists");
|
||||||
|
}
|
||||||
|
existingModel.Enable = true;
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
return ResultModel.Success("device enabled successfully");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel<RgvJsonModel>> GetJsonData(int id)
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||||
|
var data = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
return ResultModel<RgvJsonModel>.Error("process no exists");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(data.Json))
|
||||||
|
{
|
||||||
|
return ResultModel<RgvJsonModel>.Error("json cannot be null");
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RgvJsonModel? d = JsonConvert.DeserializeObject<RgvJsonModel>(data.Json);
|
||||||
|
if (d == null)
|
||||||
|
{
|
||||||
|
return ResultModel<RgvJsonModel>.Error("json DeserializeObject is null");
|
||||||
|
}
|
||||||
|
return ResultModel<RgvJsonModel>.Success(d);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
return ResultModel<RgvJsonModel>.Error($"json DeserializeObject error :{ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<List<ProcessViewModel>> GetAllAsync()
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||||
|
var data = await DbSet.ToListAsync();
|
||||||
|
return new List<ProcessViewModel>(data.Select(x => new ProcessViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Name = x.Name,
|
||||||
|
FlowData = x.FlowData,
|
||||||
|
CreateTime = x.CreateTime,
|
||||||
|
UpdateTime = x.UpdateTime,
|
||||||
|
Json = x.Json,
|
||||||
|
Enable = x.Enable,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<(List<ProcessViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||||
|
var data = await DbSet.ToListAsync();
|
||||||
|
var list = data.Skip((pageIndex - 1) * pageSize).Take(pageSize);
|
||||||
|
return (new List<ProcessViewModel>(list.Select(x => new ProcessViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Name = x.Name,
|
||||||
|
FlowData = x.FlowData,
|
||||||
|
CreateTime = x.CreateTime,
|
||||||
|
UpdateTime = x.UpdateTime,
|
||||||
|
Json = x.Json,
|
||||||
|
Enable = x.Enable,
|
||||||
|
})), data.Count());
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> UpdateAsync(ProcessViewModel? process)
|
||||||
|
{
|
||||||
|
if (process == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("参数不能为空");
|
||||||
|
}
|
||||||
|
if (process.Id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("流程ID不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(process.Name))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("流程名称不能为空");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == process.Id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("流程不存在");
|
||||||
|
}
|
||||||
|
// 检查是否有同名流程(排除自己)
|
||||||
|
var exists = await DbSet.AnyAsync(x => x.Name == process.Name && x.Id != process.Id);
|
||||||
|
if (exists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("已存在同名流程");
|
||||||
|
}
|
||||||
|
existingModel.Name = process.Name;
|
||||||
|
existingModel.FlowData = process.FlowData;
|
||||||
|
existingModel.Enable = process.Enable;
|
||||||
|
existingModel.UpdateTime = DateTime.Now;
|
||||||
|
existingModel.Json = process.Json;
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("流程更新成功") : ResultModel.Error("流程更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
197
Plugins/Wcs/Plugin.Cowain.Wcs/Services/RgvService.cs
Normal file
197
Plugins/Wcs/Plugin.Cowain.Wcs/Services/RgvService.cs
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
using Cowain.Base.DBContext;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Cowain.Base.Services;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Services;
|
||||||
|
|
||||||
|
public class RgvService : BaseService, IRgvService
|
||||||
|
{
|
||||||
|
public RgvService(IDbContextFactory<SqlDbContext> dbContextFactory) : base(dbContextFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<ResultModel> AddRgvAsync(RgvViewModel? rgv)
|
||||||
|
{
|
||||||
|
if (rgv == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("Rgv不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(rgv.StationName))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("Rgv名称不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(rgv.StationCode))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("Rgv编码不能为空");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var dbSet = dbContext.GetDbSet<RgvDto>();
|
||||||
|
// 检查Name是否重复
|
||||||
|
var nameExists = await dbSet.AnyAsync(x => x.StationName == rgv.StationName);
|
||||||
|
if (nameExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("Rgv名称已存在");
|
||||||
|
}
|
||||||
|
// 检查Code是否重复
|
||||||
|
var codeExists = await dbSet.AnyAsync(x => x.StationCode == rgv.StationCode);
|
||||||
|
if (codeExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("Rgv编码已存在");
|
||||||
|
}
|
||||||
|
var entity = new RgvDto
|
||||||
|
{
|
||||||
|
StationName = rgv.StationName,
|
||||||
|
StationCode = rgv.StationCode,
|
||||||
|
Json = rgv.Json,
|
||||||
|
LayOutX = rgv.LayOutX,
|
||||||
|
LayOutY = rgv.LayOutY,
|
||||||
|
FromStationId1 = rgv.FromStationId1,
|
||||||
|
ToStationId1 = rgv.ToStationId1,
|
||||||
|
FromStationId2 = rgv.FromStationId2,
|
||||||
|
ToStationId2 = rgv.ToStationId2,
|
||||||
|
QrCode1 = rgv.QrCode1,
|
||||||
|
QrCode2 = rgv.QrCode2,
|
||||||
|
ProcessName = rgv.ProcessName,
|
||||||
|
};
|
||||||
|
await dbSet.AddAsync(entity);
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
return ResultModel.Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> DeleteAsync(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不能小于0");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<RgvDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不存在");
|
||||||
|
}
|
||||||
|
DbSet.Remove(existingModel);
|
||||||
|
int count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("rgv删除成功") : ResultModel.Error("rgv删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> UpdateAsync(RgvViewModel? rgv)
|
||||||
|
{
|
||||||
|
if (rgv == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("rgv不能为空");
|
||||||
|
}
|
||||||
|
if (rgv.Id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("ID不能小于0");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(rgv.StationName))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("名称不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(rgv.StationCode))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("编码不能为空");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<RgvDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == rgv.Id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有同名工站(排除自己)
|
||||||
|
var nameExists = await DbSet.AnyAsync(x => x.StationName == rgv.StationName && x.Id != rgv.Id);
|
||||||
|
if (nameExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("名称已存在");
|
||||||
|
}
|
||||||
|
// 检查是否有同编码工站(排除自己)
|
||||||
|
var codeExists = await DbSet.AnyAsync(x => x.StationCode == rgv.StationCode && x.Id != rgv.Id);
|
||||||
|
if (codeExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("编码已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新字段
|
||||||
|
existingModel.StationName = rgv.StationName;
|
||||||
|
existingModel.StationCode = rgv.StationCode;
|
||||||
|
existingModel.Json = rgv.Json;
|
||||||
|
existingModel.LayOutX = rgv.LayOutX;
|
||||||
|
existingModel.LayOutY = rgv.LayOutY;
|
||||||
|
existingModel.FromStationId1 = rgv.FromStationId1;
|
||||||
|
existingModel.ToStationId1 = rgv.ToStationId1;
|
||||||
|
existingModel.FromStationId2 = rgv.FromStationId2;
|
||||||
|
existingModel.ToStationId2 = rgv.ToStationId2;
|
||||||
|
existingModel.QrCode1 = rgv.QrCode1;
|
||||||
|
existingModel.QrCode2 = rgv.QrCode2;
|
||||||
|
existingModel.ProcessName = rgv.ProcessName;
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("rgv更新成功") : ResultModel.Error("rgv更新失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<RgvViewModel>> GetAllAsync()
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<RgvDto>();
|
||||||
|
var data = await DbSet.ToListAsync();
|
||||||
|
return new List<RgvViewModel>(data.Select(x => new RgvViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
StationCode = x.StationCode,
|
||||||
|
Json = x.Json,
|
||||||
|
StationName = x.StationName,
|
||||||
|
LayOutX = x.LayOutX,
|
||||||
|
LayOutY = x.LayOutY,
|
||||||
|
FromStationId1 = x.FromStationId1,
|
||||||
|
ToStationId1 = x.ToStationId1,
|
||||||
|
FromStationId2 = x.FromStationId2,
|
||||||
|
ToStationId2 = x.ToStationId2,
|
||||||
|
QrCode1 = x.QrCode1,
|
||||||
|
QrCode2 = x.QrCode2,
|
||||||
|
ProcessName = x.ProcessName,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<(List<RgvViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var dbSet = dbContext.GetDbSet<RgvDto>();
|
||||||
|
var query = dbSet.AsQueryable();
|
||||||
|
|
||||||
|
int totals = await query.CountAsync();
|
||||||
|
var data = await query
|
||||||
|
.OrderBy(x => x.Id)
|
||||||
|
.Skip((pageIndex - 1) * pageSize)
|
||||||
|
.Take(pageSize)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var list = data.Select(x => new RgvViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
StationCode = x.StationCode,
|
||||||
|
Json = x.Json,
|
||||||
|
StationName = x.StationName,
|
||||||
|
LayOutX = x.LayOutX,
|
||||||
|
LayOutY = x.LayOutY,
|
||||||
|
FromStationId1 = x.FromStationId1,
|
||||||
|
ToStationId1 = x.ToStationId1,
|
||||||
|
FromStationId2 = x.FromStationId2,
|
||||||
|
ToStationId2 = x.ToStationId2,
|
||||||
|
QrCode1 = x.QrCode1,
|
||||||
|
QrCode2 = x.QrCode2,
|
||||||
|
ProcessName = x.ProcessName,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
return (list, totals);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
636
Plugins/Wcs/Plugin.Cowain.Wcs/Services/RgvTaskService.cs
Normal file
636
Plugins/Wcs/Plugin.Cowain.Wcs/Services/RgvTaskService.cs
Normal file
@@ -0,0 +1,636 @@
|
|||||||
|
using Cowain.Base.DBContext;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Cowain.Base.Services;
|
||||||
|
using HslCommunication.Core;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Plugin.Cowain.Driver.Abstractions;
|
||||||
|
using Plugin.Cowain.Wcs.Actions;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Services;
|
||||||
|
|
||||||
|
|
||||||
|
public class RgvToWcsData
|
||||||
|
{
|
||||||
|
public short Command { get; set; }
|
||||||
|
public short Count { get; set; }
|
||||||
|
public short Result { get; set; }
|
||||||
|
public int TaskId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WcsToRgvData
|
||||||
|
{
|
||||||
|
public short Command { get; set; }
|
||||||
|
public short Count { get; set; }
|
||||||
|
public int TaskId { get; set; }
|
||||||
|
public short FromStation1 { get; set; }
|
||||||
|
public short FromStation2 { get; set; }
|
||||||
|
public short ToStation1 { get; set; }
|
||||||
|
public short ToStation2 { get; set; }
|
||||||
|
public string QrCode1 { get; set; } = string.Empty;
|
||||||
|
public string QrCode2 { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class RgvTaskService : BaseService, IRgvTaskService
|
||||||
|
{
|
||||||
|
private IServiceScopeFactory _scopeFactory;
|
||||||
|
private IDeviceMonitor _deviceMonitor;
|
||||||
|
private readonly ILogger<RgvTaskService> _logger;
|
||||||
|
|
||||||
|
public RgvTaskService(IDbContextFactory<SqlDbContext> dbContextFactory, IDeviceMonitor deviceMonitor, IServiceScopeFactory scopeFactory, ILogger<RgvTaskService> logger) : base(dbContextFactory)
|
||||||
|
{
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
_deviceMonitor = deviceMonitor;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RgvActionViewModel>? ActionToList(string action)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var actions = JsonConvert.DeserializeObject<List<string>>(action) ?? [];
|
||||||
|
var rgvActionViewModels = actions
|
||||||
|
.Select((name, i) => new RgvActionViewModel { Id = i + 1, Name = name })
|
||||||
|
.ToList();
|
||||||
|
rgvActionViewModels.Insert(0, new RgvActionViewModel { Id = 0, Name = RgvCommandEnum.UnKnown.ToString() });
|
||||||
|
return rgvActionViewModels;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "反序列化失败");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RgvCommandEnum GetStepAction(List<RgvActionViewModel> actions, int step)
|
||||||
|
{
|
||||||
|
var name = actions.FirstOrDefault(x => x.Id == step)?.Name;
|
||||||
|
return Enum.TryParse(name, out RgvCommandEnum cmd) ? cmd : RgvCommandEnum.UnKnown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> FinishTaskAsync(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不能小于0");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<TaskDataDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("Taskid不存在");
|
||||||
|
}
|
||||||
|
existingModel.IsFinished = true;
|
||||||
|
int count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("Task直接更新为结束") : ResultModel.Error("Task直接更新为结束失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<TaskViewModel>> GetAllAsync()
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<TaskDataDto>();
|
||||||
|
var data = await DbSet.ToListAsync();
|
||||||
|
return new List<TaskViewModel>(data.Select(x => new TaskViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
ProcessId = x.ProcessId,
|
||||||
|
ProcessName = x.ProcessName,
|
||||||
|
Priority = x.Priority,
|
||||||
|
FromStationId1 = x.FromStationId1,
|
||||||
|
ToStationId1 = x.ToStationId1,
|
||||||
|
FromStatus1 = x.FromStatus1,
|
||||||
|
ToStatus1 = x.ToStatus1,
|
||||||
|
FromStationId2 = x.FromStationId2,
|
||||||
|
ToStationId2 = x.ToStationId2,
|
||||||
|
FromStatus2 = x.FromStatus2,
|
||||||
|
ToStatus2 = x.ToStatus2,
|
||||||
|
CreatTime = x.CreateTime,
|
||||||
|
IsFinished = x.IsFinished,
|
||||||
|
ExecuteAction = x.ExecuteAction,
|
||||||
|
FinishedTime = x.FinishedTime,
|
||||||
|
QrCode1 = x.QrCode1,
|
||||||
|
QrCode2 = x.QrCode2,
|
||||||
|
Action = x.Action
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<(List<TaskViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<TaskDataDto>();
|
||||||
|
// 按照CreateTime倒序排列,最新的任务排第一个
|
||||||
|
var data = await DbSet.OrderByDescending(x => x.Id).ToListAsync();
|
||||||
|
var list = data.Skip((pageIndex - 1) * pageSize).Take(pageSize);
|
||||||
|
var ret = new List<TaskViewModel>(list.Select(x => new TaskViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
ProcessId = x.ProcessId,
|
||||||
|
ProcessName = x.ProcessName,
|
||||||
|
Priority = x.Priority,
|
||||||
|
FromStationId1 = x.FromStationId1,
|
||||||
|
ToStationId1 = x.ToStationId1,
|
||||||
|
FromStatus1 = x.FromStatus1,
|
||||||
|
ToStatus1 = x.ToStatus1,
|
||||||
|
FromStationId2 = x.FromStationId2,
|
||||||
|
ToStationId2 = x.ToStationId2,
|
||||||
|
FromStatus2 = x.FromStatus2,
|
||||||
|
ToStatus2 = x.ToStatus2,
|
||||||
|
CreatTime = x.CreateTime,
|
||||||
|
IsFinished = x.IsFinished,
|
||||||
|
ExecuteAction = x.ExecuteAction,
|
||||||
|
FinishedTime = x.FinishedTime,
|
||||||
|
QrCode1 = x.QrCode1,
|
||||||
|
QrCode2 = x.QrCode2,
|
||||||
|
Action = x.Action
|
||||||
|
//Actions = new(ActionToList(x.Action) ?? new List<RgvActionViewModel>())
|
||||||
|
}));
|
||||||
|
|
||||||
|
return (ret, data.Count());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel<RgvCommandModel>> GetRgvCommandAsync(RgvUpdateInfoModel? infoModel)
|
||||||
|
{
|
||||||
|
RgvCommandModel? rgvCommand = null;
|
||||||
|
if (infoModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel<RgvCommandModel>.Error("RgvUpdateInfoModel不能为空");
|
||||||
|
}
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var dBContext = scope.ServiceProvider.GetRequiredService<SqlDbContext>();
|
||||||
|
var taskSet = dBContext.GetDbSet<TaskDataDto>();
|
||||||
|
var unfinishedTask = await taskSet.AsNoTracking().FirstOrDefaultAsync(t => !t.IsFinished);
|
||||||
|
|
||||||
|
if (unfinishedTask == null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"没有找到在执行的任务,不需要处理");
|
||||||
|
return ResultModel<RgvCommandModel>.Error("没有找到在执行的任务,不需要处理");
|
||||||
|
}
|
||||||
|
var actionResult = ActionToList(unfinishedTask.Action); //转换动作列表
|
||||||
|
if (actionResult == null)
|
||||||
|
{
|
||||||
|
_logger.LogError($"工艺未配置Action,请修改,taskId={unfinishedTask.Id}");
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"工艺未配置Action,请修改,taskId={unfinishedTask.Id}");
|
||||||
|
}
|
||||||
|
var actions = actionResult;
|
||||||
|
int step = 0;
|
||||||
|
if (infoModel.Source == RgvUpdateSourceEnum.PLC)
|
||||||
|
{
|
||||||
|
if (infoModel.RetResult == 2)
|
||||||
|
{
|
||||||
|
_logger.LogError($"PLC反馈结果是NG,任务id={unfinishedTask.Id}");
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"PLC反馈结果是NG,任务id={unfinishedTask.Id}");
|
||||||
|
}
|
||||||
|
else if (infoModel.TaskId != unfinishedTask.Id)
|
||||||
|
{
|
||||||
|
_logger.LogError($"PLC反馈结果任务号不匹配,plc任务号={infoModel.TaskId},执行任务id={unfinishedTask.Id}");
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"PLC反馈结果任务号不匹配,plc任务号={infoModel.TaskId},执行任务id={unfinishedTask.Id}");
|
||||||
|
}
|
||||||
|
step = unfinishedTask.ExecuteAction;
|
||||||
|
}
|
||||||
|
else if (infoModel.Source == RgvUpdateSourceEnum.First)
|
||||||
|
{
|
||||||
|
step = 0;
|
||||||
|
}
|
||||||
|
else if (infoModel.Source == RgvUpdateSourceEnum.User)
|
||||||
|
{
|
||||||
|
//手动下发的任务
|
||||||
|
if (infoModel.ExecuteAction > 0)
|
||||||
|
{
|
||||||
|
step = infoModel.ExecuteAction - 1;
|
||||||
|
_logger.LogInformation($"手动下发任务,执行任务id={unfinishedTask.Id}:{GetStepAction(actions, step).ToString()}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError($"手动选择的动作不能为0");
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"手动选择的动作不能为0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var stationService = scope.ServiceProvider.GetRequiredService<IStationService>();
|
||||||
|
var stationTaskHandler = scope.ServiceProvider.GetRequiredService<IEnumerable<IHostedService>>();
|
||||||
|
var stationQueueHostedService = stationTaskHandler.OfType<StationQueueHostedService>().FirstOrDefault();
|
||||||
|
|
||||||
|
var stations = await stationService.GetAllAsync();
|
||||||
|
var fromStation1 = stations.FirstOrDefault(x => x.Id == unfinishedTask.FromStationId1);
|
||||||
|
if (fromStation1 == null)
|
||||||
|
{
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"From1工站不存在,工站Id={unfinishedTask.FromStationId1}");
|
||||||
|
}
|
||||||
|
var toStation1 = stations.FirstOrDefault(x => x.Id == unfinishedTask.ToStationId1);
|
||||||
|
if (toStation1 == null)
|
||||||
|
{
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"To1工站不存在,工站Id={unfinishedTask.ToStationId1}");
|
||||||
|
}
|
||||||
|
var fromStation2 = stations.FirstOrDefault(x => x.Id == unfinishedTask.FromStationId2);
|
||||||
|
if (unfinishedTask.FromStationId2 > 0 && fromStation2 == null)
|
||||||
|
{
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"From2工站不存在,工站Id={unfinishedTask.FromStationId2}");
|
||||||
|
}
|
||||||
|
var toStation2 = stations.FirstOrDefault(x => x.Id == unfinishedTask.ToStationId2);
|
||||||
|
if (unfinishedTask.ToStationId2 > 0 && toStation2 == null)
|
||||||
|
{
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"To2站不存在,工站Id={unfinishedTask.ToStationId2}");
|
||||||
|
}
|
||||||
|
|
||||||
|
//数据库存储的是上一步
|
||||||
|
var stepCommand = GetStepAction(actions, step); //获取上一步动作
|
||||||
|
var nextCommand = GetStepAction(actions, step + 1); //获取下一步动作
|
||||||
|
|
||||||
|
if (infoModel.Source == RgvUpdateSourceEnum.PLC)
|
||||||
|
{
|
||||||
|
if (infoModel.RetCmd != (int)stepCommand)
|
||||||
|
{
|
||||||
|
_logger.LogError($"PLC反馈动作不正确,PLC动作{infoModel.RetCmd},实际动作{(int)stepCommand}");
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"PLC反馈动作不正确,PLC动作{infoModel.RetCmd},实际动作{(int)stepCommand}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stepCommand == RgvCommandEnum.UnKnown && nextCommand == RgvCommandEnum.UnKnown)
|
||||||
|
{
|
||||||
|
_logger.LogError($"获取RGV命令失败,配置有误");
|
||||||
|
return ResultModel<RgvCommandModel>.Error("获取RGV命令失败,配置有误");
|
||||||
|
}
|
||||||
|
|
||||||
|
rgvCommand = new RgvCommandModel
|
||||||
|
{
|
||||||
|
Command = nextCommand,
|
||||||
|
TaskId = unfinishedTask.Id,
|
||||||
|
FromPos1 = fromStation1.StationPos,
|
||||||
|
FromPos2 = fromStation2?.StationPos ?? 0,
|
||||||
|
TargetPos1 = toStation1.StationPos,
|
||||||
|
TargetPos2 = toStation2?.StationPos ?? 0,
|
||||||
|
QrCode1 = unfinishedTask.QrCode1,
|
||||||
|
QrCode2 = unfinishedTask.QrCode2
|
||||||
|
};
|
||||||
|
|
||||||
|
var processService = scope.ServiceProvider.GetRequiredService<IProcessService>();
|
||||||
|
var getJson = await processService.GetJsonData(unfinishedTask.ProcessId);
|
||||||
|
string? rgvName = string.Empty;
|
||||||
|
if (getJson != null)
|
||||||
|
{
|
||||||
|
rgvName = getJson.Data!.RgvName;
|
||||||
|
}
|
||||||
|
//更新RGV
|
||||||
|
|
||||||
|
if (stepCommand == RgvCommandEnum.MoveFrom)
|
||||||
|
{
|
||||||
|
//更新rgv的目标位置
|
||||||
|
var rgvService = scope.ServiceProvider.GetRequiredService<IRgvService>();
|
||||||
|
var rgvs = await rgvService.GetAllAsync();
|
||||||
|
if (rgvs != null)
|
||||||
|
{
|
||||||
|
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||||
|
if (rgv != null)
|
||||||
|
{
|
||||||
|
rgv.LayOutX = fromStation1.LayOutX;
|
||||||
|
await rgvService.UpdateAsync(rgv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (stepCommand == RgvCommandEnum.MoveTo)
|
||||||
|
{
|
||||||
|
//更新rgv的目标位置
|
||||||
|
var rgvService = scope.ServiceProvider.GetRequiredService<IRgvService>();
|
||||||
|
var rgvs = await rgvService.GetAllAsync();
|
||||||
|
if (rgvs != null)
|
||||||
|
{
|
||||||
|
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||||
|
if (rgv != null)
|
||||||
|
{
|
||||||
|
rgv.LayOutX = toStation1.LayOutX;
|
||||||
|
await rgvService.UpdateAsync(rgv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新工站状态
|
||||||
|
if (stepCommand == RgvCommandEnum.UnKnown && nextCommand != RgvCommandEnum.UnKnown)
|
||||||
|
{
|
||||||
|
//【1】上一步未知,任务刚开始
|
||||||
|
fromStation1.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
fromStation1.Status = StationStateEnum.Picking.ToString();
|
||||||
|
toStation1.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
toStation1.Status = StationStateEnum.Placing.ToString();
|
||||||
|
stationQueueHostedService?.Enqueue(fromStation1);
|
||||||
|
stationQueueHostedService?.Enqueue(toStation1);
|
||||||
|
if (fromStation2 != null)
|
||||||
|
{
|
||||||
|
fromStation2.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
fromStation2.Status = StationStateEnum.Picking.ToString();
|
||||||
|
stationQueueHostedService?.Enqueue(fromStation2);
|
||||||
|
}
|
||||||
|
if (toStation2 != null)
|
||||||
|
{
|
||||||
|
toStation2.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
toStation2.Status = StationStateEnum.Placing.ToString();
|
||||||
|
stationQueueHostedService?.Enqueue(toStation2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//任务刚开始,更新Rgv
|
||||||
|
var rgvService = scope.ServiceProvider.GetRequiredService<IRgvService>();
|
||||||
|
var rgvs = await rgvService.GetAllAsync();
|
||||||
|
if (rgvs != null)
|
||||||
|
{
|
||||||
|
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||||
|
if (rgv != null)
|
||||||
|
{
|
||||||
|
rgv.FromStationId1 = fromStation1.Id;
|
||||||
|
rgv.ToStationId1 = toStation1.Id;
|
||||||
|
rgv.FromStationId2 = fromStation2?.Id ?? 0;
|
||||||
|
rgv.ToStationId2 = toStation2?.Id ?? 0;
|
||||||
|
rgv.ProcessName = unfinishedTask.ProcessName;
|
||||||
|
await rgvService.UpdateAsync(rgv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (nextCommand == RgvCommandEnum.Place)
|
||||||
|
{
|
||||||
|
//【2】下一步要放料,将源QR复制到目标QR
|
||||||
|
toStation1.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
toStation1.QrCode = fromStation1.QrCode;
|
||||||
|
stationQueueHostedService?.Enqueue(toStation1);
|
||||||
|
if (fromStation2 != null && toStation2 != null)
|
||||||
|
{
|
||||||
|
toStation2.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
toStation2.QrCode = fromStation2.QrCode;
|
||||||
|
stationQueueHostedService?.Enqueue(toStation2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (stepCommand == RgvCommandEnum.Pick && nextCommand != RgvCommandEnum.Pick)
|
||||||
|
{
|
||||||
|
//【3】取料完成
|
||||||
|
fromStation1.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
fromStation1.Status = StationStateEnum.PickFinished.ToString();
|
||||||
|
stationQueueHostedService?.Enqueue(fromStation1);
|
||||||
|
|
||||||
|
if (fromStation2 != null)
|
||||||
|
{
|
||||||
|
fromStation2.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
fromStation2.Status = StationStateEnum.PickFinished.ToString();
|
||||||
|
stationQueueHostedService?.Enqueue(fromStation2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (stepCommand == RgvCommandEnum.Place && nextCommand != RgvCommandEnum.Place)
|
||||||
|
{
|
||||||
|
//【4】放料完成,任务结束
|
||||||
|
toStation1.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
toStation1.Status = StationStateEnum.PlaceFinished.ToString();
|
||||||
|
stationQueueHostedService?.Enqueue(toStation1);
|
||||||
|
if (toStation2 != null)
|
||||||
|
{
|
||||||
|
toStation2.UpdateSource = StationUpdateSourceEnum.Task;
|
||||||
|
toStation2.Status = StationStateEnum.PlaceFinished.ToString();
|
||||||
|
stationQueueHostedService?.Enqueue(toStation2);
|
||||||
|
}
|
||||||
|
|
||||||
|
var rgvService = scope.ServiceProvider.GetRequiredService<IRgvService>();
|
||||||
|
var rgvs = await rgvService.GetAllAsync();
|
||||||
|
if (rgvs != null)
|
||||||
|
{
|
||||||
|
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||||
|
if (rgv != null)
|
||||||
|
{
|
||||||
|
rgv.FromStationId1 = 0;
|
||||||
|
rgv.ToStationId1 = 0;
|
||||||
|
rgv.FromStationId2 = 0;
|
||||||
|
rgv.ToStationId2 = 0;
|
||||||
|
rgv.ProcessName = "";
|
||||||
|
await rgvService.UpdateAsync(rgv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int save = 0;
|
||||||
|
if (stepCommand == RgvCommandEnum.Place && nextCommand == RgvCommandEnum.UnKnown)
|
||||||
|
{
|
||||||
|
//任务结束
|
||||||
|
unfinishedTask.IsFinished = true;
|
||||||
|
unfinishedTask.FinishedTime = DateTime.Now;
|
||||||
|
// 手动将实体状态标记为Modified
|
||||||
|
dBContext.Entry(unfinishedTask).State = EntityState.Modified;
|
||||||
|
save = await dBContext.SaveChangesAsync();
|
||||||
|
if (save > 0)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"任务完成,任务id={unfinishedTask.Id}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rgvCommand.TaskId = unfinishedTask.Id;
|
||||||
|
unfinishedTask.ExecuteAction = step + 1;
|
||||||
|
// 手动将实体状态标记为Modified
|
||||||
|
dBContext.Entry(unfinishedTask).State = EntityState.Modified;
|
||||||
|
save = await dBContext.SaveChangesAsync();
|
||||||
|
if (save > 0)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"任务继续,任务id={unfinishedTask.Id},动作={JsonConvert.SerializeObject(rgvCommand)}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (save > 0)
|
||||||
|
{
|
||||||
|
return ResultModel<RgvCommandModel>.Success(rgvCommand);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"任务更新异常,任务id={unfinishedTask.Id}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"任务异常,任务id={unfinishedTask.Id}");
|
||||||
|
return ResultModel<RgvCommandModel>.Error($"任务异常,任务id={unfinishedTask.Id}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<ResultModel> ExecuteAsync(string? actionParam, RgvUpdateSourceEnum source, int? execute = 0)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(actionParam))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("参数不能为空");
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var _param = JsonConvert.DeserializeObject<RgvFinishedParamData>(actionParam);
|
||||||
|
if (_param == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("参数解析失败");
|
||||||
|
}
|
||||||
|
var driver = _deviceMonitor.GetDriver(_param.PlcName);
|
||||||
|
if (!driver.IsSuccess)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"未找到名称为 {_param.PlcName} 的Driver");
|
||||||
|
}
|
||||||
|
var plc = driver.Data.GetReadWrite();
|
||||||
|
if (plc == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"GetReadWrite为空,PLC={_param.PlcName}");
|
||||||
|
}
|
||||||
|
//读数据
|
||||||
|
var read = await ReadAsync(plc, _param.RetCmdAddress);
|
||||||
|
|
||||||
|
RgvUpdateInfoModel updateInfo = new RgvUpdateInfoModel
|
||||||
|
{
|
||||||
|
Source = source,
|
||||||
|
TaskId = read.IsSuccess ? read.Data.TaskId : 0,
|
||||||
|
RetResult = read.IsSuccess ? read.Data.Result : 0,
|
||||||
|
RetCmd = read.IsSuccess ? read.Data.Command : 0,
|
||||||
|
ExecuteAction = execute == null ? 0 : execute.Value,
|
||||||
|
};
|
||||||
|
var rgvCommand = await GetRgvCommandAsync(updateInfo);
|
||||||
|
if (!read.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogError($"从PLC读取调度数据失败:{_param.PlcName}->{_param.RetCmdAddress},{read.ErrorMessage}");
|
||||||
|
return ResultModel.Error($"读命令失败:{_param.PlcName}->{_param.RetCmdAddress},{read.ErrorMessage}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var readToRgvData = await ReadToRgvDataAsync(plc, _param.CmdAddress);
|
||||||
|
if (!readToRgvData.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogError($"从PLC读取命令失败:{_param.PlcName}->{_param.CmdAddress},{read.ErrorMessage}");
|
||||||
|
return ResultModel.Error($"从PLC读取命令失败:{_param.PlcName}->{_param.CmdAddress},{read.ErrorMessage}");
|
||||||
|
}
|
||||||
|
short count = readToRgvData.Data.Count; //计数
|
||||||
|
if (source == RgvUpdateSourceEnum.First && count != 1)
|
||||||
|
{
|
||||||
|
//新任务,且计数不为1,重置计数,这个情况出现在任务生成后被手动结束了
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
count = count + 1 <= 100 ? (short)(count + 1) : (short)1; //最大100
|
||||||
|
if (rgvCommand.IsSuccess)
|
||||||
|
{
|
||||||
|
if (rgvCommand.Data!.Command != RgvCommandEnum.UnKnown)
|
||||||
|
{
|
||||||
|
WcsToRgvData wcsToRgv = new WcsToRgvData
|
||||||
|
{
|
||||||
|
Command = (short)rgvCommand.Data!.Command,
|
||||||
|
Count = count,
|
||||||
|
FromStation1 = (short)rgvCommand.Data!.FromPos1,
|
||||||
|
FromStation2 = (short)rgvCommand.Data!.FromPos2,
|
||||||
|
ToStation1 = (short)rgvCommand.Data!.TargetPos1,
|
||||||
|
ToStation2 = (short)rgvCommand.Data!.TargetPos2,
|
||||||
|
TaskId = rgvCommand.Data!.TaskId,
|
||||||
|
QrCode1 = rgvCommand.Data!.QrCode1,
|
||||||
|
QrCode2 = rgvCommand.Data!.QrCode2
|
||||||
|
};
|
||||||
|
var write = await WriteAsync(plc, _param.CmdAddress, wcsToRgv);
|
||||||
|
if (!write.IsSuccess) return ResultModel.Error($"写变量失败:{_param.PlcName}->{_param.CmdAddress}");
|
||||||
|
_logger.LogInformation($"调度任务下发成功:TaskId={wcsToRgv.TaskId}->{JsonConvert.SerializeObject(wcsToRgv)}");
|
||||||
|
return ResultModel.Success();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return ResultModel.Error($"没有需要执行的动作:TaskId={updateInfo.TaskId}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return ResultModel.Error($"参数解析失败:{ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[LogAndSwallow]
|
||||||
|
private async Task<ResultModel<RgvToWcsData>> ReadAsync(IReadWriteDevice driver, string address)
|
||||||
|
{
|
||||||
|
var readResult = await driver.ReadAsync(address, 10);
|
||||||
|
if (!readResult.IsSuccess)
|
||||||
|
{
|
||||||
|
return ResultModel<RgvToWcsData>.Error(readResult.Message);
|
||||||
|
}
|
||||||
|
RgvToWcsData requestData = new RgvToWcsData
|
||||||
|
{
|
||||||
|
Command = driver.ByteTransform.TransInt16(readResult.Content, 0),
|
||||||
|
Count = driver.ByteTransform.TransInt16(readResult.Content, 2),
|
||||||
|
Result = driver.ByteTransform.TransInt16(readResult.Content, 4),
|
||||||
|
TaskId = driver.ByteTransform.TransInt32(readResult.Content, 6)
|
||||||
|
};
|
||||||
|
return ResultModel<RgvToWcsData>.Success(requestData);
|
||||||
|
}
|
||||||
|
|
||||||
|
[LogAndSwallow]
|
||||||
|
private async Task<ResultModel<WcsToRgvData>> ReadToRgvDataAsync(IReadWriteDevice driver, string address)
|
||||||
|
{
|
||||||
|
var readResult = await driver.ReadAsync(address, 60);
|
||||||
|
if (!readResult.IsSuccess)
|
||||||
|
{
|
||||||
|
return ResultModel<WcsToRgvData>.Error(readResult.Message);
|
||||||
|
}
|
||||||
|
WcsToRgvData requestData = new WcsToRgvData
|
||||||
|
{
|
||||||
|
Command = driver.ByteTransform.TransInt16(readResult.Content, 0),
|
||||||
|
Count = driver.ByteTransform.TransInt16(readResult.Content, 14),
|
||||||
|
TaskId = driver.ByteTransform.TransInt32(readResult.Content, 6)
|
||||||
|
};
|
||||||
|
return ResultModel<WcsToRgvData>.Success(requestData);
|
||||||
|
}
|
||||||
|
|
||||||
|
[LogAndSwallow]
|
||||||
|
private async Task<ResultModel> WriteAsync(IReadWriteDevice driver, string address, WcsToRgvData toRgvData, int retryCount = 5)
|
||||||
|
{
|
||||||
|
// 准备数据
|
||||||
|
byte[] data = new byte[60];
|
||||||
|
driver.ByteTransform.TransByte(toRgvData.Command).CopyTo(data, 0);
|
||||||
|
driver.ByteTransform.TransByte(toRgvData.TaskId).CopyTo(data, 2);
|
||||||
|
driver.ByteTransform.TransByte(toRgvData.FromStation1).CopyTo(data, 6);
|
||||||
|
driver.ByteTransform.TransByte(toRgvData.FromStation2).CopyTo(data, 8);
|
||||||
|
driver.ByteTransform.TransByte(toRgvData.ToStation1).CopyTo(data, 10);
|
||||||
|
driver.ByteTransform.TransByte(toRgvData.ToStation2).CopyTo(data, 12);
|
||||||
|
driver.ByteTransform.TransByte(toRgvData.Count).CopyTo(data, 14);
|
||||||
|
data[16] = 20;//字符串最大长度
|
||||||
|
data[17] = (byte)toRgvData.QrCode1.Length;//字符串实际长度
|
||||||
|
Encoding.ASCII.GetBytes(toRgvData.QrCode1).CopyTo(data, 18);
|
||||||
|
data[38] = 20;//字符串最大长度
|
||||||
|
data[39] = (byte)toRgvData.QrCode2.Length;//字符串实际长度
|
||||||
|
Encoding.ASCII.GetBytes(toRgvData.QrCode2).CopyTo(data, 40);
|
||||||
|
|
||||||
|
int baseDelay = 100; // 基础延迟100ms
|
||||||
|
var random = new Random();
|
||||||
|
for (int retry = 0; retry < retryCount; retry++)
|
||||||
|
{
|
||||||
|
var write = await driver.WriteAsync(address, data);
|
||||||
|
if (write.IsSuccess)
|
||||||
|
{
|
||||||
|
if (retry > 1)
|
||||||
|
{
|
||||||
|
//第一次就成功,不需要记录日志
|
||||||
|
_logger.LogInformation($"写PLC数据调度任务成功:{address}->{JsonConvert.SerializeObject(toRgvData)},第{retry + 1}次尝试");
|
||||||
|
}
|
||||||
|
return ResultModel.Success();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError($"写PLC数据调度任务失败:{address}->{JsonConvert.SerializeObject(toRgvData)},第{retry + 1}次尝试");
|
||||||
|
}
|
||||||
|
// 如果不是最后一次尝试,则等待后重试
|
||||||
|
if (retry < retryCount - 1)
|
||||||
|
{
|
||||||
|
// 计算指数退避+抖动
|
||||||
|
int jitter = random.Next(0, 100); // 0~100ms
|
||||||
|
int delay = baseDelay * (int)Math.Pow(2, retry) + jitter;
|
||||||
|
await Task.Delay(delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_logger.LogError($"写PLC数据调度任务失败:{address}->{JsonConvert.SerializeObject(toRgvData)},总共{retryCount}次尝试");
|
||||||
|
return ResultModel.Error("写PLC数据失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Threading.Channels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Services;
|
||||||
|
|
||||||
|
public class StationQueueHostedService : BackgroundHostedService
|
||||||
|
{
|
||||||
|
public Action<StationViewModel>? FindTaskAction { get; set; }
|
||||||
|
private Channel<StationViewModel> _channel = Channel.CreateUnbounded<StationViewModel>();
|
||||||
|
|
||||||
|
private IServiceScopeFactory _scopeFactory;
|
||||||
|
|
||||||
|
// 工站级别的锁,避免不同工站之间相互阻塞
|
||||||
|
private static readonly ConcurrentDictionary<int, SemaphoreSlim> _stationLocks = new();
|
||||||
|
|
||||||
|
private readonly ILogger<StationQueueHostedService> _logger;
|
||||||
|
|
||||||
|
public StationQueueHostedService(IServiceScopeFactory scopeFactory, ILogger<StationQueueHostedService> logger)
|
||||||
|
{
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取工站级别的锁
|
||||||
|
/// </summary>
|
||||||
|
private SemaphoreSlim GetStationLock(int stationId)
|
||||||
|
{
|
||||||
|
return _stationLocks.GetOrAdd(stationId, _ => new SemaphoreSlim(1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("StationQueueHostedService Stop");
|
||||||
|
|
||||||
|
// 清理所有锁
|
||||||
|
foreach (var kvp in _stationLocks)
|
||||||
|
{
|
||||||
|
kvp.Value.Dispose();
|
||||||
|
}
|
||||||
|
_stationLocks.Clear();
|
||||||
|
|
||||||
|
_channel.Writer.Complete();
|
||||||
|
await base.StopAsync(cancellationToken);
|
||||||
|
_logger.LogInformation("StationQueueHostedService Stoped");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Enqueue(StationViewModel item)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
item.EnqueueTime = DateTime.Now;
|
||||||
|
_logger.LogDebug($"入队列开始:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
_ = _channel.Writer.WriteAsync(item).AsTask().ContinueWith(task =>
|
||||||
|
{
|
||||||
|
if (task.IsFaulted)
|
||||||
|
{
|
||||||
|
_logger.LogError($"入队列错误:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
}
|
||||||
|
else if (task.IsCompletedSuccessfully)
|
||||||
|
{
|
||||||
|
_logger.LogDebug($"入队列成功:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"入队列异常:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetUpdateFunc(StationViewModel item, bool result)
|
||||||
|
{
|
||||||
|
if (item?.UpdatedAction != null)
|
||||||
|
{
|
||||||
|
item.UpdatedAction(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FindTaskFunc(StationViewModel item)
|
||||||
|
{
|
||||||
|
if (this.FindTaskAction != null)
|
||||||
|
{
|
||||||
|
FindTaskAction(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
await foreach (var item in _channel.Reader.ReadAllAsync(stoppingToken))
|
||||||
|
{
|
||||||
|
// 获取工站级别的锁
|
||||||
|
var stationLock = GetStationLock(item.Id);
|
||||||
|
await stationLock.WaitAsync(stoppingToken);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"消费队列开始:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
item.UpdateTime = DateTime.Now;
|
||||||
|
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var stationService = scope.ServiceProvider.GetRequiredService<IStationService>();
|
||||||
|
bool isValid = false;
|
||||||
|
var stations = await stationService.GetAllAsync();
|
||||||
|
var station = stations.FirstOrDefault(x => x.Id == item.Id);
|
||||||
|
if (station == null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"更新工站失败,Id不存在:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item.UpdateSource == StationUpdateSourceEnum.User)
|
||||||
|
{
|
||||||
|
// 用户手动更新
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
else if (item.UpdateSource == StationUpdateSourceEnum.PLC)
|
||||||
|
{
|
||||||
|
if (station?.Status != StationStateEnum.Picking.ToString() && station?.Status != StationStateEnum.Placing.ToString())
|
||||||
|
{
|
||||||
|
//工站不能是搬运中,搬运中PLC不可更新状态
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"更新工站失败,工站是搬运中,不可更新:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)},stationData={JsonConvert.SerializeObject(station)}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (item.UpdateSource == StationUpdateSourceEnum.Task)
|
||||||
|
{
|
||||||
|
if (station?.Status == StationStateEnum.UnKnown.ToString() ||
|
||||||
|
station?.Status == StationStateEnum.Picking.ToString() ||
|
||||||
|
station?.Status == StationStateEnum.Placing.ToString() ||
|
||||||
|
item.Status == StationStateEnum.Picking.ToString() ||
|
||||||
|
item.Status == StationStateEnum.Placing.ToString())
|
||||||
|
{
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"消费队列取消,不需要消费:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var updateStation = await stationService.UpdateAsync(item);
|
||||||
|
if (updateStation.IsSuccess)
|
||||||
|
{
|
||||||
|
SetUpdateFunc(item, true);
|
||||||
|
_logger.LogInformation($"消费队列成功:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
if (item.Status == StationStateEnum.RequestPick.ToString() || item.Status == StationStateEnum.RequestPlace.ToString() || item.Status == StationStateEnum.PlaceFinished.ToString() || item.Status == StationStateEnum.NgPick.ToString())
|
||||||
|
{
|
||||||
|
//20250909更改,放完成时,需要查找任务
|
||||||
|
FindTaskFunc(item);
|
||||||
|
//出现可取料或者可放料时更新任务
|
||||||
|
//var findTaskService = scope.ServiceProvider.GetRequiredService<IFindFlowTaskService>();
|
||||||
|
//await findTaskService.FindTaskAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetUpdateFunc(item, false);
|
||||||
|
_logger.LogError($"消费队列错误:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
SetUpdateFunc(item, false);
|
||||||
|
_logger.LogError(ex, $"消费队列异常:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// 计算消费用时(ms)
|
||||||
|
item.ConsumeUseTime = (DateTime.Now - item.EnqueueTime).TotalMilliseconds;
|
||||||
|
_logger.LogInformation($"消费队列用时:StationId={item.Id},Source={item.UpdateSource},JsonData={JsonConvert.SerializeObject(item)}");
|
||||||
|
stationLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
250
Plugins/Wcs/Plugin.Cowain.Wcs/Services/StationService.cs
Normal file
250
Plugins/Wcs/Plugin.Cowain.Wcs/Services/StationService.cs
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
using Cowain.Base.DBContext;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Cowain.Base.Services;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Services;
|
||||||
|
|
||||||
|
public class StationService : BaseService, IStationService
|
||||||
|
{
|
||||||
|
public StationService(IDbContextFactory<SqlDbContext> dbContextFactory) : base(dbContextFactory)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> AddAsync(StationViewModel station)
|
||||||
|
{
|
||||||
|
if (station == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("station不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(station.StationName))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站名称不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(station.StationCode))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站编码不能为空");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var dbSet = dbContext.GetDbSet<StationDto>();
|
||||||
|
// 检查StationName是否重复
|
||||||
|
var nameExists = await dbSet.AnyAsync(x => x.StationName == station.StationName);
|
||||||
|
if (nameExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站名称已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查StationCode是否重复
|
||||||
|
var codeExists = await dbSet.AnyAsync(x => x.StationCode == station.StationCode);
|
||||||
|
if (codeExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站编码已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
var entity = new StationDto
|
||||||
|
{
|
||||||
|
QrCode = station.QrCode,
|
||||||
|
ProcessName = station.ProcessName,
|
||||||
|
StationName = station.StationName,
|
||||||
|
StationCode = station.StationCode,
|
||||||
|
PositionX = station.PositionX,
|
||||||
|
PositionY = station.PositionY,
|
||||||
|
PositionZ = station.PositionZ,
|
||||||
|
LayOutX = station.LayOutX,
|
||||||
|
LayOutY = station.LayOutY,
|
||||||
|
StationPos = station.StationPos,
|
||||||
|
Status = station.Status,
|
||||||
|
Enable = true,
|
||||||
|
};
|
||||||
|
await dbSet.AddAsync(entity);
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("工站添加成功") : ResultModel.Error("工站添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> DeleteAsync(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不能小于0");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<StationDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站id不存在");
|
||||||
|
}
|
||||||
|
DbSet.Remove(existingModel);
|
||||||
|
int count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("工站删除成功") : ResultModel.Error("工站删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> DisableAsync(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不能小于0");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<StationDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站id不存在");
|
||||||
|
}
|
||||||
|
existingModel.Enable = false;
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
return ResultModel.Success("工站禁用成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> EnableAsync(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不能小于0");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<StationDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站id不存在");
|
||||||
|
}
|
||||||
|
existingModel.Enable = true;
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
return ResultModel.Success("工站启用成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<StationViewModel>> GetAllAsync()
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<StationDto>();
|
||||||
|
var data = await DbSet.ToListAsync();
|
||||||
|
return new List<StationViewModel>(data.Select(x => new StationViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
QrCode = x.QrCode,
|
||||||
|
ProcessName = x.ProcessName,
|
||||||
|
StationName = x.StationName,
|
||||||
|
StationCode = x.StationCode,
|
||||||
|
PositionX = x.PositionX,
|
||||||
|
PositionY = x.PositionY,
|
||||||
|
PositionZ = x.PositionZ,
|
||||||
|
LayOutX = x.LayOutX,
|
||||||
|
LayOutY = x.LayOutY,
|
||||||
|
Status = x.Status,
|
||||||
|
StationPos = x.StationPos,
|
||||||
|
NextStationId = x.NextStationId,
|
||||||
|
Enable = x.Enable,
|
||||||
|
CreateTime = x.CreateTime,
|
||||||
|
UpdateTime = x.UpdateTime
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<(List<StationViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var dbSet = dbContext.GetDbSet<StationDto>();
|
||||||
|
var query = dbSet.AsQueryable();
|
||||||
|
|
||||||
|
int totals = await query.CountAsync();
|
||||||
|
var data = await query
|
||||||
|
.OrderBy(x => x.Id)
|
||||||
|
.Skip((pageIndex - 1) * pageSize)
|
||||||
|
.Take(pageSize)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var list = data.Select(x => new StationViewModel
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
QrCode = x.QrCode,
|
||||||
|
ProcessName = x.ProcessName,
|
||||||
|
StationName = x.StationName,
|
||||||
|
StationCode = x.StationCode,
|
||||||
|
PositionX = x.PositionX,
|
||||||
|
PositionY = x.PositionY,
|
||||||
|
PositionZ = x.PositionZ,
|
||||||
|
LayOutX = x.LayOutX,
|
||||||
|
LayOutY = x.LayOutY,
|
||||||
|
StationPos = x.StationPos,
|
||||||
|
Status = x.Status,
|
||||||
|
NextStationId = x.NextStationId,
|
||||||
|
Enable = x.Enable,
|
||||||
|
CreateTime = x.CreateTime,
|
||||||
|
UpdateTime = x.UpdateTime
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
return (list, totals);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> UpdateAsync(StationViewModel satation)
|
||||||
|
{
|
||||||
|
if (satation == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("satation不能为空");
|
||||||
|
}
|
||||||
|
if (satation.Id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站ID不能小于0");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(satation.StationName))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站名称不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(satation.StationCode))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站编码不能为空");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<StationDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == satation.Id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站id不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有同名工站(排除自己)
|
||||||
|
var nameExists = await DbSet.AnyAsync(x => x.StationName == satation.StationName && x.Id != satation.Id);
|
||||||
|
if (nameExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站名称已存在");
|
||||||
|
}
|
||||||
|
// 检查是否有同编码工站(排除自己)
|
||||||
|
var codeExists = await DbSet.AnyAsync(x => x.StationCode == satation.StationCode && x.Id != satation.Id);
|
||||||
|
if (codeExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站编码已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有同位置工站(排除自己)
|
||||||
|
var posExists = await DbSet.AnyAsync(x => x.StationPos == satation.StationPos && x.Id != satation.Id);
|
||||||
|
if (posExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("工站位置已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新字段
|
||||||
|
existingModel.ProcessName = satation.ProcessName;
|
||||||
|
existingModel.QrCode = satation.QrCode;
|
||||||
|
existingModel.StationName = satation.StationName;
|
||||||
|
existingModel.StationCode = satation.StationCode;
|
||||||
|
existingModel.PositionX = satation.PositionX;
|
||||||
|
existingModel.PositionY = satation.PositionY;
|
||||||
|
existingModel.PositionZ = satation.PositionZ;
|
||||||
|
existingModel.LayOutX = satation.LayOutX;
|
||||||
|
existingModel.LayOutY = satation.LayOutY;
|
||||||
|
existingModel.Status = satation.Status;
|
||||||
|
existingModel.StationPos = satation.StationPos;
|
||||||
|
existingModel.NextStationId = satation.NextStationId;
|
||||||
|
existingModel.Enable = satation.Enable;
|
||||||
|
existingModel.UpdateTime = DateTime.Now;
|
||||||
|
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
return count > 0 ? ResultModel.Success("工站更新成功") : ResultModel.Error("工站更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
306
Plugins/Wcs/Plugin.Cowain.Wcs/Services/WcsParamService.cs
Normal file
306
Plugins/Wcs/Plugin.Cowain.Wcs/Services/WcsParamService.cs
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
using Cowain.Base.DBContext;
|
||||||
|
using Cowain.Base.Models;
|
||||||
|
using Cowain.Base.Services;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Dto;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Services;
|
||||||
|
|
||||||
|
public class WcsParamService : BaseService, IWcsParamService
|
||||||
|
{
|
||||||
|
private readonly IMemoryCache _memoryCache;
|
||||||
|
private readonly ILogger<WcsParamService> _logger;
|
||||||
|
|
||||||
|
// 参数级别的锁,避免不同参数之间的锁竞争
|
||||||
|
private static readonly ConcurrentDictionary<string, SemaphoreSlim> _paramLocks = new();
|
||||||
|
|
||||||
|
// 缓存键前缀
|
||||||
|
private const string CACHE_KEY_PREFIX = "WcsParam_";
|
||||||
|
|
||||||
|
// 缓存过期时间(5分钟)
|
||||||
|
private static readonly TimeSpan CACHE_EXPIRATION = TimeSpan.FromMinutes(5);
|
||||||
|
|
||||||
|
public WcsParamService(IDbContextFactory<SqlDbContext> dbContextFactory, ILogger<WcsParamService> logger, IMemoryCache memoryCache) : base(dbContextFactory)
|
||||||
|
{
|
||||||
|
_memoryCache = memoryCache;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取参数级别的锁
|
||||||
|
/// </summary>
|
||||||
|
private SemaphoreSlim GetParamLock(string paramName)
|
||||||
|
{
|
||||||
|
return _paramLocks.GetOrAdd(paramName, _ => new SemaphoreSlim(1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取缓存键
|
||||||
|
/// </summary>
|
||||||
|
private string GetCacheKey(string paramName)
|
||||||
|
{
|
||||||
|
return $"{CACHE_KEY_PREFIX}{paramName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清除指定参数的缓存
|
||||||
|
/// </summary>
|
||||||
|
private void ClearParamCache(string paramName)
|
||||||
|
{
|
||||||
|
string cacheKey = GetCacheKey(paramName);
|
||||||
|
_memoryCache.Remove(cacheKey);
|
||||||
|
_logger.LogInformation($"已清除参数 {paramName} 的缓存");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> AddAsync(WcsParamViewModel? viewModel)
|
||||||
|
{
|
||||||
|
if (viewModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("viewModel不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(viewModel.Name))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("viewModel.Name不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(viewModel.Param))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("viewModel.Param不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
var paramLock = GetParamLock(viewModel.Name);
|
||||||
|
await paramLock.WaitAsync();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var dbSet = dbContext.GetDbSet<WcsParamDto>();
|
||||||
|
// 检查Name是否重复
|
||||||
|
var nameExists = await dbSet.AnyAsync(x => x.Name == viewModel.Name);
|
||||||
|
if (nameExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("名称已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
var entity = new WcsParamDto
|
||||||
|
{
|
||||||
|
Name = viewModel.Name,
|
||||||
|
Param = viewModel.Param
|
||||||
|
};
|
||||||
|
await dbSet.AddAsync(entity);
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
// 清除相关缓存
|
||||||
|
ClearParamCache(viewModel.Name);
|
||||||
|
return ResultModel.Success("参数添加成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ResultModel.Error("参数添加失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
paramLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> DeleteAsync(int id)
|
||||||
|
{
|
||||||
|
if (id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不能小于0");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<WcsParamDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
string paramName = existingModel.Name;
|
||||||
|
var paramLock = GetParamLock(paramName);
|
||||||
|
await paramLock.WaitAsync();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DbSet.Remove(existingModel);
|
||||||
|
int count = await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
// 清除相关缓存
|
||||||
|
ClearParamCache(paramName);
|
||||||
|
return ResultModel.Success("参数删除成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ResultModel.Error("参数删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
paramLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel<WcsParamViewModel>> GetParamAsync(string? name)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
|
{
|
||||||
|
return ResultModel<WcsParamViewModel>.Error("参数名称不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
string cacheKey = GetCacheKey(name);
|
||||||
|
|
||||||
|
// 第一次尝试从缓存获取
|
||||||
|
if (_memoryCache.TryGetValue(cacheKey, out WcsParamViewModel? cachedValue))
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"从缓存获取参数 {name}: {cachedValue?.Param}");
|
||||||
|
return ResultModel<WcsParamViewModel>.Success(cachedValue!);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 缓存不存在,使用锁保护数据库查询和缓存更新
|
||||||
|
var paramLock = GetParamLock(name);
|
||||||
|
await paramLock.WaitAsync();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 双重检查,防止在等待锁期间其他线程已经更新了缓存
|
||||||
|
if (_memoryCache.TryGetValue(cacheKey, out cachedValue))
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"双重检查:从缓存获取参数 {name}: {cachedValue?.Param}");
|
||||||
|
return ResultModel<WcsParamViewModel>.Success(cachedValue!);
|
||||||
|
}
|
||||||
|
// 从数据库获取
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<WcsParamDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Name == name);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel<WcsParamViewModel>.Error("名称不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = new WcsParamViewModel
|
||||||
|
{
|
||||||
|
Id = existingModel.Id,
|
||||||
|
Name = existingModel.Name,
|
||||||
|
Param = existingModel.Param
|
||||||
|
};
|
||||||
|
|
||||||
|
// 将结果存入缓存
|
||||||
|
var cacheOptions = new MemoryCacheEntryOptions
|
||||||
|
{
|
||||||
|
AbsoluteExpirationRelativeToNow = CACHE_EXPIRATION,
|
||||||
|
SlidingExpiration = CACHE_EXPIRATION
|
||||||
|
};
|
||||||
|
_memoryCache.Set(cacheKey, result, cacheOptions);
|
||||||
|
|
||||||
|
_logger.LogInformation($"从数据库获取参数 {name}: {result.Param},已缓存");
|
||||||
|
return ResultModel<WcsParamViewModel>.Success(result);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
paramLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ResultModel> UpdateAsync(WcsParamViewModel? viewModel)
|
||||||
|
{
|
||||||
|
if (viewModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("viewModel不能为空");
|
||||||
|
}
|
||||||
|
if (viewModel.Id <= 0)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("ID不能小于0");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(viewModel.Name))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("名称不能为空");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(viewModel.Param))
|
||||||
|
{
|
||||||
|
return ResultModel.Error("参数不能为空");
|
||||||
|
}
|
||||||
|
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||||
|
var DbSet = dbContext.GetDbSet<WcsParamDto>();
|
||||||
|
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == viewModel.Id);
|
||||||
|
if (existingModel == null)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("id不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有同名(排除自己)
|
||||||
|
var nameExists = await DbSet.AnyAsync(x => x.Name == viewModel.Name && x.Id != viewModel.Id);
|
||||||
|
if (nameExists)
|
||||||
|
{
|
||||||
|
return ResultModel.Error("名称已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记录旧名称,用于清除缓存
|
||||||
|
string oldName = existingModel.Name;
|
||||||
|
string newName = viewModel.Name;
|
||||||
|
|
||||||
|
// 获取两个参数的锁(如果名称不同)
|
||||||
|
var oldParamLock = GetParamLock(oldName);
|
||||||
|
var newParamLock = oldName == newName ? oldParamLock : GetParamLock(newName);
|
||||||
|
|
||||||
|
// 如果名称不同,需要同时获取两个锁,避免死锁
|
||||||
|
if (oldName != newName)
|
||||||
|
{
|
||||||
|
// 按字典序获取锁,避免死锁
|
||||||
|
var locks = new[] { oldParamLock, newParamLock }.OrderBy(l => l.GetHashCode()).ToArray();
|
||||||
|
await locks[0].WaitAsync();
|
||||||
|
await locks[1].WaitAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await oldParamLock.WaitAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 更新字段
|
||||||
|
existingModel.Name = viewModel.Name;
|
||||||
|
existingModel.Param = viewModel.Param;
|
||||||
|
var count = await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
// 清除相关缓存(包括旧名称和新名称)
|
||||||
|
ClearParamCache(oldName);
|
||||||
|
if (oldName != newName)
|
||||||
|
{
|
||||||
|
ClearParamCache(newName);
|
||||||
|
}
|
||||||
|
return ResultModel.Success("参数更新成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ResultModel.Error("参数更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// 释放锁
|
||||||
|
if (oldName != newName)
|
||||||
|
{
|
||||||
|
var locks = new[] { oldParamLock, newParamLock }.OrderBy(l => l.GetHashCode()).ToArray();
|
||||||
|
locks[1].Release();
|
||||||
|
locks[0].Release();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oldParamLock.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.Services;
|
||||||
|
|
||||||
|
public class WcsStartUpHostedService : IHostedService
|
||||||
|
{
|
||||||
|
private IServiceScopeFactory _scopeFactory;
|
||||||
|
private readonly ILogger<WcsStartUpHostedService> _logger;
|
||||||
|
public WcsStartUpHostedService(IServiceScopeFactory scopeFactory, ILogger<WcsStartUpHostedService> logger)
|
||||||
|
{
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task StartAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("WcsStartUpHostedService Start");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await FindTaskAsync();
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var taskHandlers = scope.ServiceProvider.GetRequiredService<IEnumerable<IHostedService>>();
|
||||||
|
var stationQueueHostedService = taskHandlers.OfType<StationQueueHostedService>().FirstOrDefault();
|
||||||
|
if (stationQueueHostedService == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
stationQueueHostedService.FindTaskAction = async (StationViewModel item) =>
|
||||||
|
{
|
||||||
|
await FindTaskAsync();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "WcsStartUpHostedService Start Error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("WcsStartUpHostedService Started");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task FindTaskAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var wcsParamService = scope.ServiceProvider.GetRequiredService<IWcsParamService>();
|
||||||
|
|
||||||
|
// 使用WcsParamService的缓存功能获取参数
|
||||||
|
var findTaskEnableResult = await wcsParamService.GetParamAsync("FindTaskEnable");
|
||||||
|
|
||||||
|
if (findTaskEnableResult.IsSuccess)
|
||||||
|
{
|
||||||
|
if (bool.TryParse(findTaskEnableResult.Data!.Param, out bool findTaskEnable) && findTaskEnable)
|
||||||
|
{
|
||||||
|
var findFlowTaskService = scope.ServiceProvider.GetRequiredService<IFindFlowTaskService>();
|
||||||
|
await findFlowTaskService.FindTaskAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogInformation("任务查找功能已禁用");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"获取FindTaskEnable参数失败: {findTaskEnableResult.ErrorMessage}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "FindTaskAsync 执行失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("StationQueueHostedService Stop");
|
||||||
|
_logger.LogInformation("StationQueueHostedService Stoped");
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Plugins/Wcs/Plugin.Cowain.Wcs/UPGRADING.md
Normal file
3
Plugins/Wcs/Plugin.Cowain.Wcs/UPGRADING.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
## 首次发布 1.0.0
|
||||||
|
* 第一版
|
||||||
@@ -0,0 +1,261 @@
|
|||||||
|
using Avalonia.Controls.Notifications;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Cowain.Base.ViewModels;
|
||||||
|
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Ursa.Controls;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class FlowManagementViewModel : PageViewModelBase
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<ProcessFlowViewModel>? _flowList;
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<StationViewModel>? _stations;
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<ProcessViewModel>? _process;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _totals;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageSize;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageIndex;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ProcessViewModel? _selectedProcess;
|
||||||
|
|
||||||
|
private readonly ILocalizer _l;
|
||||||
|
private IProcessFlowService _flowService;
|
||||||
|
private IStationService _stationService;
|
||||||
|
private IProcessService _processService;
|
||||||
|
private List<string> actions = new List<string>() { RgvCommandEnum.MoveFrom.ToString(), RgvCommandEnum.Pick.ToString(), RgvCommandEnum.MoveTo.ToString(), RgvCommandEnum.Place.ToString() };
|
||||||
|
public FlowManagementViewModel(ILocalizer localizer, IProcessService processService, IProcessFlowService processFlowService, IStationService stationService)
|
||||||
|
{
|
||||||
|
PageSize = 20;
|
||||||
|
_flowService = processFlowService;
|
||||||
|
_processService = processService;
|
||||||
|
_stationService = stationService;
|
||||||
|
_l = localizer;
|
||||||
|
FlowList = new ObservableCollection<ProcessFlowViewModel>();
|
||||||
|
// 异步调用刷新
|
||||||
|
RefreshCommand.ExecuteAsync(1);
|
||||||
|
}
|
||||||
|
public static List<string> StationStateList =>
|
||||||
|
Enum.GetNames(typeof(StationStateEnum)).ToList(); // 直接获取枚举名称字符串列表
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task RefreshAsync(int pageIndex)
|
||||||
|
{
|
||||||
|
if (Stations == null)
|
||||||
|
{
|
||||||
|
var stationList = await _stationService.GetAllAsync();
|
||||||
|
Stations = new ObservableCollection<StationViewModel>(stationList);
|
||||||
|
StationViewModel nullStation = new StationViewModel { Id = 0, StationName = "Null", StationCode = "Null" };
|
||||||
|
Stations.Insert(0, nullStation);
|
||||||
|
}
|
||||||
|
if (Process == null)
|
||||||
|
{
|
||||||
|
var processList = await _processService.GetAllAsync();
|
||||||
|
Process = new ObservableCollection<ProcessViewModel>(processList);
|
||||||
|
}
|
||||||
|
var (data, count) = await _flowService.GetAllAsync(pageIndex, PageSize, SelectedProcess?.Id);
|
||||||
|
Totals = count;
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
FlowList?.Clear();
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
FlowList?.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void Add()
|
||||||
|
{
|
||||||
|
if (SelectedProcess == null || SelectedProcess.Id == 0)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["FlowManagement.Edit.SelectedProcessIsNull"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FlowList?.Add(new ProcessFlowViewModel
|
||||||
|
{
|
||||||
|
ProcessId = SelectedProcess.Id,
|
||||||
|
FromStatus1 = StationStateEnum.UnKnown.ToString(),
|
||||||
|
ToStatus1 = StationStateEnum.UnKnown.ToString(),
|
||||||
|
FromStatus2 = StationStateEnum.UnKnown.ToString(),
|
||||||
|
ToStatus2 = StationStateEnum.UnKnown.ToString(),
|
||||||
|
Action = JsonConvert.SerializeObject(actions)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task DeleteAsync(ProcessFlowViewModel? flow)
|
||||||
|
{
|
||||||
|
if (flow == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["DeleteDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var deleteDevice = await _flowService.DeleteAsync(flow.Id);
|
||||||
|
if (deleteDevice.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["FlowManagement.Delete.Success"]);
|
||||||
|
FlowList?.Remove(flow);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["FlowManagement.Delete.Error"] + ":" + deleteDevice.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task SaveAsync(ProcessFlowViewModel? flow)
|
||||||
|
{
|
||||||
|
if (flow == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (SelectedProcess == null || SelectedProcess.Id == 0)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["FlowManagement.Edit.SelectedProcessIsNull"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["SaveDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (flow.Id == 0)
|
||||||
|
{
|
||||||
|
var add = await _flowService.AddAsync(SelectedProcess.Id, new List<ProcessFlowViewModel> { flow });
|
||||||
|
await RefreshAsync(1);
|
||||||
|
if (add.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["FlowManagement.Add.Success"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["FlowManagement.Add.Error"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var update = await _flowService.UpdateAsync(SelectedProcess.Id, new List<ProcessFlowViewModel> { flow });
|
||||||
|
await RefreshAsync(1);
|
||||||
|
if (update.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["FlowManagement.Update.Success"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["FlowManagement.Update.Error"] + ":" + update.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task ExportAsync()
|
||||||
|
{
|
||||||
|
|
||||||
|
var saveDialog = await FileDialogHelper.SaveFileDialogAsync(GetFileTypes());
|
||||||
|
|
||||||
|
if (!saveDialog.IsSuccess)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var flows = await _flowService.GetAllAsync();
|
||||||
|
if (flows == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await ExcelHelper<ProcessFlowViewModel>.ExportExcelAsync(flows.ToList(), saveDialog.Data!.Path.LocalPath);
|
||||||
|
if (result.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["FlowManagement.Export.Success"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["FlowManagement.Export.Error"] + ":" + result.ErrorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task ImportAsync()
|
||||||
|
{
|
||||||
|
var openDialog = await FileDialogHelper.OpenFileDialogAsync(GetFileTypes());
|
||||||
|
if (!openDialog.IsSuccess) return;
|
||||||
|
var result = ExcelHelper<ProcessFlowViewModel>.ImportExcel(openDialog.Data!.Path.LocalPath);
|
||||||
|
if (!result.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["TagManagement.Import.Error"] + ":" + result.ErrorMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 使用Dispatcher确保UI线程更新
|
||||||
|
Dispatcher.UIThread.Post(() =>
|
||||||
|
{
|
||||||
|
FlowList = new ObservableCollection<ProcessFlowViewModel>(result.Data!);
|
||||||
|
OnPropertyChanged(nameof(FlowList));
|
||||||
|
|
||||||
|
});
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["FlowManagement.Import.Success"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task SaveAllAsync()
|
||||||
|
{
|
||||||
|
if (FlowList == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (SelectedProcess == null || SelectedProcess.Id == 0)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["FlowManagement.Edit.SelectedProcessIsNull"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["SaveDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var update = await _flowService.UpdateAsync(SelectedProcess.Id, FlowList.ToList());
|
||||||
|
await RefreshAsync(1);
|
||||||
|
if (update.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["FlowManagement.Update.Success"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["FlowManagement.Update.Error"] + ":" + update.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<FilePickerFileType>? GetFileTypes()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
[
|
||||||
|
new FilePickerFileType("Excel"){ Patterns=["*.xlsx"]}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
23
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/LayoutViewModel.cs
Normal file
23
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/LayoutViewModel.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using Avalonia.Media;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class LayoutViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _id;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _layOutX;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _layOutY;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _stationName = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _stationCode = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class ProcessActionViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _action = RgvCommandEnum.UnKnown.ToString();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Irihi.Avalonia.Shared.Contracts;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using Plugin.Cowain.Wcs.ViewModels.ProcessGraph;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class ProcessEditDialogViewModel : ObservableObject, IDialogContext
|
||||||
|
{
|
||||||
|
private class FlowDataDto
|
||||||
|
{
|
||||||
|
public List<StationNodeViewModel> Nodes { get; set; } = new();
|
||||||
|
public List<ConnectionViewModel> Connections { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public NodifyObservableCollection<StationNodeViewModel> Nodes { get; } = new NodifyObservableCollection<StationNodeViewModel>();
|
||||||
|
public NodifyObservableCollection<ConnectionViewModel> Connections { get; } = new();
|
||||||
|
|
||||||
|
public PendingConnectionViewModel PendingConnection { get; }
|
||||||
|
|
||||||
|
public event EventHandler<object?>? RequestClose;
|
||||||
|
[ObservableProperty]
|
||||||
|
private StationNodeViewModel? _selectedNode;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<StationNodeViewModel> _selectedNodes = new ObservableCollection<StationNodeViewModel>();
|
||||||
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ConnectionViewModel? _selectedConnection;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<ConnectionViewModel> _selectedConnections = new ObservableCollection<ConnectionViewModel>();
|
||||||
|
|
||||||
|
public List<StationViewModel>? Stations { get; }
|
||||||
|
|
||||||
|
private ProcessViewModel? _process;
|
||||||
|
public ICommand DeleteSelectionCommand { get; }
|
||||||
|
public static List<string> ActionList =>
|
||||||
|
Enum.GetNames(typeof(RgvCommandEnum)).ToList(); // 直接获取枚举名称字符串列表
|
||||||
|
|
||||||
|
public static List<string> StationStateList =>
|
||||||
|
Enum.GetNames(typeof(StationStateEnum)).ToList(); // 直接获取枚举名称字符串列表
|
||||||
|
private List<string> actions = new List<string>() { RgvCommandEnum.MoveFrom.ToString(), RgvCommandEnum.Pick.ToString(), RgvCommandEnum.MoveTo.ToString(), RgvCommandEnum.Place.ToString() };
|
||||||
|
|
||||||
|
|
||||||
|
private IProcessFlowService _processFlowService;
|
||||||
|
public ProcessEditDialogViewModel(List<StationViewModel>? stations, ProcessViewModel? process, IProcessFlowService processFlowService)
|
||||||
|
{
|
||||||
|
Stations = stations;
|
||||||
|
_process = process;
|
||||||
|
_processFlowService = processFlowService;
|
||||||
|
PendingConnection = new PendingConnectionViewModel(this);
|
||||||
|
DeleteSelectionCommand = new RelayCommand(DeleteSelection, () => SelectedNodes.Count > 0 || SelectedConnections.Count > 0);
|
||||||
|
GlobalData.Instance.AddOrUpdate("Stations", Stations);
|
||||||
|
Nodes.WhenRemoved(x => DisconnectStation(x))
|
||||||
|
.WhenCleared(x =>
|
||||||
|
{
|
||||||
|
Connections.Clear();
|
||||||
|
});
|
||||||
|
DispatcherTimer.RunOnce((async () =>
|
||||||
|
{
|
||||||
|
await InitFlowDataAsync();
|
||||||
|
}), TimeSpan.FromSeconds(0), DispatcherPriority.Default);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除工站同时,删除与之相关的连接
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
public void DisconnectStation(StationNodeViewModel state)
|
||||||
|
{
|
||||||
|
var transitions = Connections.Where(t => t.Source.NodeId == state.Id || t.Target.NodeId == state.Id).ToList();
|
||||||
|
transitions.ForEach(t => Connections.Remove(t));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Connect(ConnectorViewModel source, ConnectorViewModel target)
|
||||||
|
{
|
||||||
|
var conn = new ConnectionViewModel(source, target);
|
||||||
|
Connections.Add(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task InitFlowDataAsync()
|
||||||
|
{
|
||||||
|
if (_process == null || string.IsNullOrWhiteSpace(_process.FlowData))
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var flow = JsonConvert.DeserializeObject<FlowDataDto>(_process.FlowData);
|
||||||
|
if (flow != null)
|
||||||
|
{
|
||||||
|
Nodes.Clear();
|
||||||
|
foreach (var node in flow.Nodes)
|
||||||
|
{
|
||||||
|
Nodes.Add(node);
|
||||||
|
}
|
||||||
|
var flows = await _processFlowService.GetAllAsync();
|
||||||
|
var existingFlows = flows.Where(f => f.ProcessId == _process.Id);
|
||||||
|
Connections.Clear();
|
||||||
|
foreach (var conn in flow.Connections)
|
||||||
|
{
|
||||||
|
// 根据 Source 和 Target 的 StationId 找到 Nodes 中对应的 ConnectorViewModel
|
||||||
|
var sourceNode = Nodes.FirstOrDefault(n => n.Id == conn.Source.NodeId);
|
||||||
|
var targetNode = Nodes.FirstOrDefault(n => n.Id == conn.Target.NodeId);
|
||||||
|
|
||||||
|
if (sourceNode != null && targetNode != null)
|
||||||
|
{
|
||||||
|
// 这里假设连接都是 Output -> Input
|
||||||
|
var newConn = new ConnectionViewModel(sourceNode.Output, targetNode.Input);
|
||||||
|
newConn.ProcessFlow = conn.ProcessFlow;
|
||||||
|
|
||||||
|
var existFlow = existingFlows.FirstOrDefault(f =>
|
||||||
|
f.FromStationId1 == newConn.ProcessFlow.FromStationId1 &&
|
||||||
|
f.ToStationId1 == newConn.ProcessFlow.ToStationId1 &&
|
||||||
|
f.FromStationId2 == newConn.ProcessFlow.FromStationId2 &&
|
||||||
|
f.ToStationId2 == newConn.ProcessFlow.ToStationId2);
|
||||||
|
|
||||||
|
if (existFlow != null)
|
||||||
|
{
|
||||||
|
// 更新已有流程
|
||||||
|
newConn.ProcessFlow.Id = existFlow.Id;
|
||||||
|
newConn.ProcessFlow.FromStatus1 = existFlow.FromStatus1;
|
||||||
|
newConn.ProcessFlow.ToStatus1 = existFlow.ToStatus1;
|
||||||
|
newConn.ProcessFlow.FromStatus2 = existFlow.FromStatus2;
|
||||||
|
newConn.ProcessFlow.ToStatus2 = existFlow.ToStatus2;
|
||||||
|
newConn.ProcessFlow.Priority = existFlow.Priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections.Add(newConn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 可根据需要添加日志或通知
|
||||||
|
Debug.WriteLine($"InitFlowData 反序列化失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void DeleteSelection()
|
||||||
|
{
|
||||||
|
foreach (var connection in SelectedConnections.ToList())
|
||||||
|
{
|
||||||
|
connection.Source.IsConnected = false;
|
||||||
|
connection.Target.IsConnected = false;
|
||||||
|
Connections.Remove(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
var selected = SelectedNodes.ToList();
|
||||||
|
|
||||||
|
for (int i = 0; i < selected.Count; i++)
|
||||||
|
{
|
||||||
|
Nodes.Remove(selected[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void AddStation(Point point)
|
||||||
|
{
|
||||||
|
Nodes.Add(new StationNodeViewModel { Location = point });
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
RequestClose?.Invoke(this, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void Ok()
|
||||||
|
{
|
||||||
|
if (_process != null)
|
||||||
|
{
|
||||||
|
foreach (var conn in Connections)
|
||||||
|
{
|
||||||
|
// 设置工艺流转的起止工站ID
|
||||||
|
if (conn.ProcessFlow != null)
|
||||||
|
{
|
||||||
|
conn.ProcessFlow.FromStationId1 = conn.Source.NodeId == Guid.Empty ? 0 : Nodes.FirstOrDefault(n => n.Id == conn.Source.NodeId)?.Station1Id ?? 0;
|
||||||
|
conn.ProcessFlow.ToStationId1 = conn.Target.NodeId == Guid.Empty ? 0 : Nodes.FirstOrDefault(n => n.Id == conn.Target.NodeId)?.Station1Id ?? 0;
|
||||||
|
conn.ProcessFlow.FromStationId2 = conn.Source.NodeId == Guid.Empty ? 0 : Nodes.FirstOrDefault(n => n.Id == conn.Source.NodeId)?.Station2Id ?? 0;
|
||||||
|
conn.ProcessFlow.ToStationId2 = conn.Target.NodeId == Guid.Empty ? 0 : Nodes.FirstOrDefault(n => n.Id == conn.Target.NodeId)?.Station2Id ?? 0;
|
||||||
|
if (conn.ProcessFlow.FromStationId2 == 0)
|
||||||
|
{
|
||||||
|
conn.ProcessFlow.FromStatus2 = StationStateEnum.UnKnown.ToString();
|
||||||
|
}
|
||||||
|
if (conn.ProcessFlow.ToStationId2 == 0)
|
||||||
|
{
|
||||||
|
conn.ProcessFlow.ToStatus2 = StationStateEnum.UnKnown.ToString();
|
||||||
|
}
|
||||||
|
conn.ProcessFlow.Action = JsonConvert.SerializeObject(actions);
|
||||||
|
conn.ProcessFlow.ProcessId = _process.Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var flow = new FlowDataDto
|
||||||
|
{
|
||||||
|
Nodes = Nodes.ToList(),
|
||||||
|
Connections = Connections.ToList()
|
||||||
|
};
|
||||||
|
_process.FlowData = JsonConvert.SerializeObject(flow);
|
||||||
|
|
||||||
|
}
|
||||||
|
RequestClose?.Invoke(this, true);
|
||||||
|
}
|
||||||
|
[RelayCommand]
|
||||||
|
private void Cancel()
|
||||||
|
{
|
||||||
|
RequestClose?.Invoke(this, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class ProcessFlowViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _id;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _processId;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _priority;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _fromStationId1;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _toStationId1;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _fromStatus1 = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _toStatus1 = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _fromStationId2;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _toStationId2;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _fromStatus2 = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _toStatus2 = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _action = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels.ProcessGraph;
|
||||||
|
|
||||||
|
public partial class ConnectionViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _isSelected;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ProcessFlowViewModel _processFlow = new ProcessFlowViewModel
|
||||||
|
{
|
||||||
|
Priority = 100,
|
||||||
|
FromStatus1 = StationStateEnum.RequestPick.ToString(),
|
||||||
|
FromStatus2 = StationStateEnum.RequestPick.ToString(),
|
||||||
|
ToStatus1 = StationStateEnum.RequestPlace.ToString(),
|
||||||
|
ToStatus2 = StationStateEnum.RequestPlace.ToString(),
|
||||||
|
};
|
||||||
|
|
||||||
|
public ConnectorViewModel Source { get; set; }
|
||||||
|
public ConnectorViewModel Target { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public ConnectionViewModel(ConnectorViewModel source, ConnectorViewModel target)
|
||||||
|
{
|
||||||
|
Source = source;
|
||||||
|
Target = target;
|
||||||
|
Source.IsConnected = true;
|
||||||
|
Target.IsConnected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels.ProcessGraph;
|
||||||
|
|
||||||
|
public partial class ConnectorViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private string? _title;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Point _anchor;
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _isConnected;
|
||||||
|
|
||||||
|
public Guid NodeId { set; get; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels.ProcessGraph;
|
||||||
|
|
||||||
|
public class PendingConnectionViewModel
|
||||||
|
{
|
||||||
|
private readonly ProcessEditDialogViewModel _editor;
|
||||||
|
private ConnectorViewModel? _source;
|
||||||
|
|
||||||
|
public PendingConnectionViewModel(ProcessEditDialogViewModel editor)
|
||||||
|
{
|
||||||
|
_editor = editor;
|
||||||
|
StartCommand = new RelayCommand<ConnectorViewModel>(source => _source = source);
|
||||||
|
FinishCommand = new RelayCommand<ConnectorViewModel>(target =>
|
||||||
|
{
|
||||||
|
if (target != null && _source != null)
|
||||||
|
_editor.Connect(_source, target);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand StartCommand { get; }
|
||||||
|
public ICommand FinishCommand { get; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels.ProcessGraph;
|
||||||
|
|
||||||
|
public partial class StationNodeViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _station1Id;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string? _station1Name = "未选择";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string? _station1Code = "";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int? _station2Id;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string? _station2Name = "未选择";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string? _station2Code = "";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Point _location;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public ConnectorViewModel Input { get; } = new ConnectorViewModel { Title = "Input" };
|
||||||
|
|
||||||
|
public ConnectorViewModel Output { get; } = new ConnectorViewModel { Title = "Output" };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public StationNodeViewModel()
|
||||||
|
{
|
||||||
|
Input.NodeId = Id;
|
||||||
|
Output.NodeId = Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
partial void OnStation1IdChanged(int value)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (GlobalData.Instance["Stations"] is List<StationViewModel> stations)
|
||||||
|
{
|
||||||
|
var station = stations.FirstOrDefault(x => x.Id == value);
|
||||||
|
if (station != null)
|
||||||
|
{
|
||||||
|
Station1Name = station.StationName;
|
||||||
|
Station1Code = station.StationCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnStation2IdChanged(int? value)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (GlobalData.Instance["Stations"] is List<StationViewModel> stations)
|
||||||
|
{
|
||||||
|
var station = stations.FirstOrDefault(x => x.Id == value);
|
||||||
|
if (station != null)
|
||||||
|
{
|
||||||
|
Station2Name = station.StationName;
|
||||||
|
Station2Code = station.StationCode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Station2Name = "未选择";
|
||||||
|
Station2Code = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Controls.Notifications;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Cowain.Base.ViewModels;
|
||||||
|
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Views;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Ursa.Controls;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels
|
||||||
|
{
|
||||||
|
public partial class ProcessManagementViewModel : PageViewModelBase
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<ProcessViewModel>? _processList;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _totals;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageSize;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageIndex;
|
||||||
|
|
||||||
|
private readonly ILocalizer _l;
|
||||||
|
private IProcessService _processService;
|
||||||
|
private IStationService _stationService;
|
||||||
|
private IProcessFlowService _processFlowService;
|
||||||
|
private readonly ILogger<ProcessManagementViewModel> _logger;
|
||||||
|
public ProcessManagementViewModel(ILocalizer localizer, IProcessService processService, IStationService stationService, IProcessFlowService processFlowService, ILogger<ProcessManagementViewModel> logger)
|
||||||
|
{
|
||||||
|
PageSize = 20;
|
||||||
|
_l = localizer;
|
||||||
|
_processService = processService;
|
||||||
|
_stationService = stationService;
|
||||||
|
_processFlowService = processFlowService;
|
||||||
|
_logger = logger;
|
||||||
|
ProcessList = new ObservableCollection<ProcessViewModel>();
|
||||||
|
// 异步调用刷新
|
||||||
|
RefreshCommand.ExecuteAsync(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task RefreshAsync(int pageIndex)
|
||||||
|
{
|
||||||
|
var (data, count) = await _processService.GetAllAsync(pageIndex, PageSize);
|
||||||
|
Totals = count;
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
ProcessList?.Clear();
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
ProcessList?.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void Add()
|
||||||
|
{
|
||||||
|
|
||||||
|
ProcessList?.Add(new ProcessViewModel { Name = "请命名", Enable = true });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task EditAsync(ProcessViewModel? process)
|
||||||
|
{
|
||||||
|
if (process == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var options = new DialogOptions()
|
||||||
|
{
|
||||||
|
Title = _l["ProcessManagement.Dialog.Title"],
|
||||||
|
ShowInTaskBar = true,
|
||||||
|
IsCloseButtonVisible = true,
|
||||||
|
StartupLocation = WindowStartupLocation.CenterScreen,
|
||||||
|
Button = DialogButton.OKCancel,
|
||||||
|
CanDragMove = true,
|
||||||
|
CanResize = true,
|
||||||
|
};
|
||||||
|
var stations = await _stationService.GetAllAsync();
|
||||||
|
ProcessEditDialogViewModel deviceModel = new ProcessEditDialogViewModel(stations, process, _processFlowService);
|
||||||
|
var deviceEditDialog = await Dialog.ShowCustomModal<ProcessEditDialog, ProcessEditDialogViewModel, bool>(deviceModel, options: options);
|
||||||
|
if (deviceEditDialog)
|
||||||
|
{
|
||||||
|
var add = await _processService.UpdateAsync(process);
|
||||||
|
if (add.IsSuccess)
|
||||||
|
{
|
||||||
|
// 获取当前流程
|
||||||
|
var flows = await _processFlowService.GetAllAsync();
|
||||||
|
var existingFlows = flows.Where(f => f.ProcessId == process.Id);
|
||||||
|
var newFlows = deviceModel.Connections.Select(x => x.ProcessFlow).ToList();
|
||||||
|
|
||||||
|
var flowsToUpdate = new List<ProcessFlowViewModel>();
|
||||||
|
var flowsToAdd = new List<ProcessFlowViewModel>();
|
||||||
|
|
||||||
|
foreach (var newFlow in newFlows)
|
||||||
|
{
|
||||||
|
var existFlow = existingFlows.FirstOrDefault(f =>
|
||||||
|
f.FromStationId1 == newFlow.FromStationId1 &&
|
||||||
|
f.ToStationId1 == newFlow.ToStationId1 &&
|
||||||
|
f.FromStationId2 == newFlow.FromStationId2 &&
|
||||||
|
f.ToStationId2 == newFlow.ToStationId2);
|
||||||
|
|
||||||
|
if (existFlow != null)
|
||||||
|
{
|
||||||
|
// 更新已有流程
|
||||||
|
newFlow.Id = existFlow.Id;
|
||||||
|
flowsToUpdate.Add(newFlow);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 新增流程
|
||||||
|
flowsToAdd.Add(newFlow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先更新已存在的流程
|
||||||
|
if (flowsToUpdate.Count > 0)
|
||||||
|
{
|
||||||
|
var updateResult = await _processFlowService.UpdateAsync(process.Id, flowsToUpdate);
|
||||||
|
if (!updateResult.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Edit.Error"] + ":" + updateResult.ErrorMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 再新增不存在的流程
|
||||||
|
if (flowsToAdd.Count > 0)
|
||||||
|
{
|
||||||
|
var addResult = await _processFlowService.AddAsync(process.Id, flowsToAdd);
|
||||||
|
if (!addResult.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Edit.Error"] + ":" + addResult.ErrorMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["ProcessManagement.Edit.Success"]);
|
||||||
|
_logger.LogInformation($"修改工艺流程成功:工艺->{process.Name}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError($"修改工艺流程失败:工艺->{process.Name},错误信息->{add.ErrorMessage}");
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Edit.Error"] + ":" + add.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task DeleteAsync(ProcessViewModel? process)
|
||||||
|
{
|
||||||
|
if (process == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["DeleteDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deleteDevice = await _processService.DeleteAsync(process.Id);
|
||||||
|
if (deleteDevice.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"删除工艺:{process.Name}");
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["ProcessManagement.Delete.Success"]);
|
||||||
|
ProcessList?.Remove(process);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Delete.Error"] + ":" + deleteDevice.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Delete.Error"] + ":" + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task SaveAsync(ProcessViewModel? process)
|
||||||
|
{
|
||||||
|
if (process == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["SaveDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (process.Id == 0)
|
||||||
|
{
|
||||||
|
var add = await _processService.AddAsync(process);
|
||||||
|
if (add.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"新增工艺:{process.Name}");
|
||||||
|
await RefreshAsync(1);
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["ProcessManagement.Add.Success"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Add.Error"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
var update = await _processService.UpdateAsync(process);
|
||||||
|
if (update.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"更改工艺:{process.Name}");
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["ProcessManagement.Update.Success"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Update.Error"] + ":" + update.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/ProcessViewModel.cs
Normal file
22
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/ProcessViewModel.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class ProcessViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _id;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _name = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _flowData = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _json = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _enable;
|
||||||
|
[ObservableProperty]
|
||||||
|
private DateTime _createTime;
|
||||||
|
[ObservableProperty]
|
||||||
|
private DateTime _updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class RgvActionViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _id;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _name = string.Empty;
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
using Avalonia.Controls.Notifications;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Cowain.Base.ViewModels;
|
||||||
|
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Ursa.Controls;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class RgvManagementViewModel : PageViewModelBase
|
||||||
|
{
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<RgvViewModel>? _rgvList;
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<StationViewModel>? _stations;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _totals;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageSize;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageIndex;
|
||||||
|
|
||||||
|
|
||||||
|
private readonly ILocalizer _l;
|
||||||
|
private IStationService _stationService;
|
||||||
|
private readonly IRgvService _rgvService;
|
||||||
|
private readonly IServiceScopeFactory _scopeFactory;
|
||||||
|
public RgvManagementViewModel(ILocalizer localizer, IRgvService rgvService, IStationService stationService, IServiceScopeFactory scopeFactory)
|
||||||
|
{
|
||||||
|
_l = localizer;
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
_rgvService = rgvService;
|
||||||
|
_stationService = stationService;
|
||||||
|
PageSize = 10;
|
||||||
|
PageIndex = 1;
|
||||||
|
RgvList = new ObservableCollection<RgvViewModel>();
|
||||||
|
// 异步调用刷新
|
||||||
|
RefreshCommand.ExecuteAsync(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task RefreshAsync(int pageIndex)
|
||||||
|
{
|
||||||
|
if (Stations == null)
|
||||||
|
{
|
||||||
|
var stationList = await _stationService.GetAllAsync();
|
||||||
|
Stations = new ObservableCollection<StationViewModel>(stationList);
|
||||||
|
StationViewModel nullStation = new StationViewModel { Id = 0, StationName = "Null", StationCode = "Null" };
|
||||||
|
Stations.Insert(0, nullStation);
|
||||||
|
}
|
||||||
|
|
||||||
|
var (data, count) = await _rgvService.GetAllAsync(pageIndex, PageSize);
|
||||||
|
Totals = count;
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
RgvList?.Clear();
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
RgvList?.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void Add()
|
||||||
|
{
|
||||||
|
RgvList?.Add(new RgvViewModel { StationName = "请命名", StationCode = "请命名" });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task DeleteAsync(RgvViewModel? rgv)
|
||||||
|
{
|
||||||
|
if (rgv == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["DeleteDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var delete = await _rgvService.DeleteAsync(rgv.Id);
|
||||||
|
if (delete.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["RgvManagement.Delete.Success"]);
|
||||||
|
RgvList?.Remove(rgv);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["RgvManagement.Delete.Error"] + ":" + delete.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task SaveAsync(RgvViewModel? rgv)
|
||||||
|
{
|
||||||
|
if (rgv == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["SaveDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (rgv.Id == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
var addResult = await _rgvService.AddRgvAsync(rgv);
|
||||||
|
if (addResult.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["RgvManagement.Add.Success"]);
|
||||||
|
// 新增成功后刷新列表
|
||||||
|
await RefreshAsync(PageIndex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["RgvManagement.Add.Error"] + ":" + addResult.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var update = await _rgvService.UpdateAsync(rgv);
|
||||||
|
if (update.IsSuccess)
|
||||||
|
{
|
||||||
|
await RefreshAsync(PageIndex);
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["RgvManagement.Save.Success"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["RgvManagement.Save.Error"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
56
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/RgvViewModel.cs
Normal file
56
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/RgvViewModel.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class RgvViewModel : LayoutViewModel
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _processName = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private float _positionX;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private float _positionY;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private float _positionZ;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _fromStationId1;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _toStationId1;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Point? _fromStationPoint1;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Point? _toStationPoint1;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _fromStationId2;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _toStationId2;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Point? _fromStationPoint2;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private Point? _toStationPoint2;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _qrCode1 = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _qrCode2 = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _json = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _status = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
using Avalonia.Controls.Notifications;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Cowain.Base.ViewModels;
|
||||||
|
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using Plugin.Cowain.Wcs.Services;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Ursa.Controls;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class StationManagementViewModel : PageViewModelBase
|
||||||
|
{
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<StationViewModel>? _stationList;
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<ProcessViewModel>? _process;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _totals;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageSize;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageIndex;
|
||||||
|
|
||||||
|
public static List<string> StationStateList =>
|
||||||
|
Enum.GetNames(typeof(StationStateEnum)).ToList(); // 直接获取枚举名称字符串列表
|
||||||
|
|
||||||
|
private readonly ILocalizer _l;
|
||||||
|
|
||||||
|
private readonly IProcessService _processService;
|
||||||
|
private IServiceScopeFactory _scopeFactory;
|
||||||
|
private StationQueueHostedService? _stationQueueHostedService;
|
||||||
|
public StationManagementViewModel(ILocalizer localizer, IProcessService processService, IServiceScopeFactory scopeFactory, IEnumerable<IHostedService> taskHandlers)
|
||||||
|
{
|
||||||
|
_l = localizer;
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
_processService = processService;
|
||||||
|
_stationQueueHostedService = taskHandlers.OfType<StationQueueHostedService>().FirstOrDefault();
|
||||||
|
PageSize = 100;
|
||||||
|
PageIndex = 1;
|
||||||
|
StationList = new ObservableCollection<StationViewModel>();
|
||||||
|
// 异步调用刷新
|
||||||
|
RefreshCommand.ExecuteAsync(PageIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task RefreshAsync(int pageIndex)
|
||||||
|
{
|
||||||
|
if (Process == null)
|
||||||
|
{
|
||||||
|
var processList = await _processService.GetAllAsync();
|
||||||
|
Process = new ObservableCollection<ProcessViewModel>(processList);
|
||||||
|
}
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var stationService = scope.ServiceProvider.GetRequiredService<IStationService>();
|
||||||
|
var (data, count) = await stationService.GetAllAsync(pageIndex, PageSize);
|
||||||
|
Totals = count;
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
StationList?.Clear();
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
StationList?.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void Add()
|
||||||
|
{
|
||||||
|
StationList?.Add(new StationViewModel { StationName = "请命名", StationCode = "请命名", Status = StationStateEnum.UnKnown.ToString(), Enable = true });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task DeleteAsync(StationViewModel? station)
|
||||||
|
{
|
||||||
|
if (station == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["DeleteDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var stationService = scope.ServiceProvider.GetRequiredService<IStationService>();
|
||||||
|
var deleteDevice = await stationService.DeleteAsync(station.Id);
|
||||||
|
if (deleteDevice.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["StationManagement.Delete.Success"]);
|
||||||
|
StationList?.Remove(station);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["StationManagement.Delete.Error"] + ":" + deleteDevice.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task SaveAsync(StationViewModel? station)
|
||||||
|
{
|
||||||
|
if (station == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["SaveDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (station.Id == 0)
|
||||||
|
{
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var stationService = scope.ServiceProvider.GetRequiredService<IStationService>();
|
||||||
|
var addResult = await stationService.AddAsync(station);
|
||||||
|
if (addResult.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["StationManagement.Add.Success"]);
|
||||||
|
// 新增成功后刷新列表
|
||||||
|
await RefreshAsync(PageIndex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["StationManagement.Add.Error"] + ":" + addResult.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
|
station.UpdateSource = StationUpdateSourceEnum.User;
|
||||||
|
station.UpdatedAction = result => tcs.TrySetResult(result);
|
||||||
|
|
||||||
|
//// 替换原有的 station.UpdatedAction 赋值部分,确保通知在UI线程执行
|
||||||
|
//station.UpdatedAction = (result) =>
|
||||||
|
// {
|
||||||
|
// // Avalonia 应用需在UI线程操作UI相关内容
|
||||||
|
// Avalonia.Threading.Dispatcher.UIThread.Post(async () =>
|
||||||
|
// {
|
||||||
|
// if (result)
|
||||||
|
// {
|
||||||
|
// await RefreshAsync(PageIndex);
|
||||||
|
// NotificationHelper.ShowNormal(NotificationType.Success, _l["StationManagement.Save.Success"]);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// NotificationHelper.ShowNormal(NotificationType.Error, _l["StationManagement.Save.Error"]);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
_stationQueueHostedService?.Enqueue(station);
|
||||||
|
var ret = await tcs.Task;
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
await RefreshAsync(PageIndex);
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["StationManagement.Save.Success"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["StationManagement.Save.Error"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
58
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/StationViewModel.cs
Normal file
58
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/StationViewModel.cs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class StationViewModel : LayoutViewModel
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _processName = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _qrCode = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private float _positionX;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private float _positionY;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private float _positionZ;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _stationPos;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _status = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _nextStationId;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _enable;
|
||||||
|
[ObservableProperty]
|
||||||
|
private DateTime _createTime;
|
||||||
|
[ObservableProperty]
|
||||||
|
private DateTime _updateTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入队列时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime EnqueueTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 消费用时
|
||||||
|
/// </summary>
|
||||||
|
public double ConsumeUseTime { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public StationUpdateSourceEnum UpdateSource { get; set; } = StationUpdateSourceEnum.User;
|
||||||
|
[JsonIgnore]
|
||||||
|
public Action<bool>? UpdatedAction { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
65
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/TaskViewModel.cs
Normal file
65
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/TaskViewModel.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class TaskViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _id;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _processName = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _processId;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _priority;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _fromStationId1;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _toStationId1;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _fromStatus1 = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _toStatus1 = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _fromStationId2;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _toStationId2;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _fromStatus2 = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _toStatus2 = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _action = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _qrCode1 = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _qrCode2 = string.Empty;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _executeAction;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private RgvActionViewModel? _selectedAction;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<RgvActionViewModel>? _actions;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _isFinished;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private DateTime _creatTime;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private DateTime? _finishedTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class WcsParamViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _id;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _name = string.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _param = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
using Avalonia.Threading;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Cowain.Base.ViewModels;
|
||||||
|
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
|
||||||
|
public partial class WcsRealStationViewModel : PageViewModelBase
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private double _cellWidthSize = 130;
|
||||||
|
[ObservableProperty]
|
||||||
|
private double _cellHeightSize = 60;
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<StationViewModel>? _stations;
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<TaskViewModel> _taskList = new();
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<LayoutViewModel>? _layoutList;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _height = 400;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _width = 1000;
|
||||||
|
|
||||||
|
|
||||||
|
private readonly ILocalizer _l;
|
||||||
|
private IServiceScopeFactory _scopeFactory;
|
||||||
|
private bool _isProcessing;
|
||||||
|
|
||||||
|
public WcsRealStationViewModel(ILocalizer localizer, IServiceScopeFactory scopeFactory)
|
||||||
|
{
|
||||||
|
_l = localizer;
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
RefreshCommand.ExecuteAsync(1);
|
||||||
|
DispatcherTimer.Run(new Func<bool>(() =>
|
||||||
|
{
|
||||||
|
RefreshCommand.ExecuteAsync(1);
|
||||||
|
return true;
|
||||||
|
}), TimeSpan.FromSeconds(1), DispatcherPriority.Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task RefreshAsync(int pageIndex)
|
||||||
|
{
|
||||||
|
if (_isProcessing)
|
||||||
|
return;
|
||||||
|
_isProcessing = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var stationService = scope.ServiceProvider.GetRequiredService<IStationService>();
|
||||||
|
if (Stations == null)
|
||||||
|
{
|
||||||
|
var stationList = await stationService.GetAllAsync();
|
||||||
|
Stations = new ObservableCollection<StationViewModel>(stationList);
|
||||||
|
}
|
||||||
|
var taskService = scope.ServiceProvider.GetRequiredService<IRgvTaskService>();
|
||||||
|
var taskList = await taskService.GetAllAsync();
|
||||||
|
TaskList.Clear();
|
||||||
|
foreach (var item in taskList.OrderByDescending(x => x.Id).Take(1))
|
||||||
|
{
|
||||||
|
item.Actions = new(taskService.ActionToList(item.Action) ?? new List<RgvActionViewModel>());
|
||||||
|
item.SelectedAction = item.Actions.FirstOrDefault(x => x.Id == item.ExecuteAction);
|
||||||
|
TaskList?.Add(item);
|
||||||
|
}
|
||||||
|
var rgvService = scope.ServiceProvider.GetRequiredService<IRgvService>();
|
||||||
|
var rgvs = await rgvService.GetAllAsync();
|
||||||
|
var stations = await stationService.GetAllAsync();
|
||||||
|
|
||||||
|
if (LayoutList == null)
|
||||||
|
{
|
||||||
|
LayoutList = new ObservableCollection<LayoutViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 处理站点(StationViewModel)
|
||||||
|
foreach (var station in stations)
|
||||||
|
{
|
||||||
|
var exist = LayoutList.OfType<StationViewModel>().FirstOrDefault(x => x.Id == station.Id);
|
||||||
|
if (exist != null)
|
||||||
|
{
|
||||||
|
exist.LayOutX = station.LayOutX;
|
||||||
|
exist.LayOutY = station.LayOutY;
|
||||||
|
exist.StationName = station.StationName;
|
||||||
|
exist.StationCode = station.StationCode;
|
||||||
|
exist.Status = station.Status;
|
||||||
|
exist.QrCode = station.QrCode;
|
||||||
|
exist.ProcessName = station.ProcessName;
|
||||||
|
// 可同步更多属性
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LayoutList.Add(station);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 移除已不存在的站点
|
||||||
|
for (int i = LayoutList.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (LayoutList[i] is StationViewModel svm && !stations.Any(x => x.Id == svm.Id))
|
||||||
|
{
|
||||||
|
LayoutList.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 处理RGV(RgvViewModel)
|
||||||
|
foreach (var rgv in rgvs)
|
||||||
|
{
|
||||||
|
// 计算FromStationPoint
|
||||||
|
var fromStation = stations.FirstOrDefault(s => s.Id == rgv.FromStationId1);
|
||||||
|
if (fromStation != null)
|
||||||
|
{
|
||||||
|
double x = fromStation.LayOutX * CellWidthSize + CellWidthSize / 2;
|
||||||
|
double y = fromStation.LayOutY * CellHeightSize + CellHeightSize / 2;
|
||||||
|
rgv.FromStationPoint1 = new Avalonia.Point(x, y);
|
||||||
|
}
|
||||||
|
// 计算ToStationPoint
|
||||||
|
var toStation = stations.FirstOrDefault(s => s.Id == rgv.ToStationId1);
|
||||||
|
if (toStation != null)
|
||||||
|
{
|
||||||
|
double x = toStation.LayOutX * CellWidthSize + CellWidthSize / 2;
|
||||||
|
double y = toStation.LayOutY * CellHeightSize + CellHeightSize / 2;
|
||||||
|
rgv.ToStationPoint1 = new Avalonia.Point(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算FromStationPoint
|
||||||
|
var fromStation2 = stations.FirstOrDefault(s => s.Id == rgv.FromStationId2);
|
||||||
|
if (fromStation2 != null)
|
||||||
|
{
|
||||||
|
double x = fromStation2.LayOutX * CellWidthSize + CellWidthSize / 2;
|
||||||
|
double y = fromStation2.LayOutY * CellHeightSize + CellHeightSize / 2;
|
||||||
|
rgv.FromStationPoint2 = new Avalonia.Point(x, y);
|
||||||
|
}
|
||||||
|
// 计算ToStationPoint
|
||||||
|
var toStation2 = stations.FirstOrDefault(s => s.Id == rgv.ToStationId2);
|
||||||
|
if (toStation2 != null)
|
||||||
|
{
|
||||||
|
double x = toStation2.LayOutX * CellWidthSize + CellWidthSize / 2;
|
||||||
|
double y = toStation2.LayOutY * CellHeightSize + CellHeightSize / 2;
|
||||||
|
rgv.ToStationPoint2 = new Avalonia.Point(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var exist = LayoutList.OfType<RgvViewModel>().FirstOrDefault(x => x.Id == rgv.Id);
|
||||||
|
if (exist != null)
|
||||||
|
{
|
||||||
|
exist.LayOutX = rgv.LayOutX;
|
||||||
|
exist.LayOutY = rgv.LayOutY;
|
||||||
|
exist.StationName = rgv.StationName;
|
||||||
|
exist.StationCode = rgv.StationCode;
|
||||||
|
exist.FromStationId1 = rgv.FromStationId1;
|
||||||
|
exist.ToStationId1 = rgv.ToStationId1;
|
||||||
|
exist.FromStationId2 = rgv.FromStationId2;
|
||||||
|
exist.ToStationId2 = rgv.ToStationId2;
|
||||||
|
exist.FromStationPoint1 = rgv.FromStationPoint1;
|
||||||
|
exist.ToStationPoint1 = rgv.ToStationPoint1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LayoutList.Add(rgv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 移除已不存在的RGV
|
||||||
|
for (int i = LayoutList.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (LayoutList[i] is RgvViewModel rgvVm && !rgvs.Any(x => x.Id == rgvVm.Id))
|
||||||
|
{
|
||||||
|
LayoutList.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double maxRow = LayoutList
|
||||||
|
.Select(e => e.LayOutX)
|
||||||
|
.DefaultIfEmpty(0)
|
||||||
|
.Max();
|
||||||
|
Width = (int)(maxRow + 1) * (int)CellWidthSize;
|
||||||
|
|
||||||
|
double maxCol = LayoutList
|
||||||
|
.Select(e => e.LayOutY)
|
||||||
|
.DefaultIfEmpty(0)
|
||||||
|
.Max();
|
||||||
|
Height = (int)(maxCol + 1) * (int)CellHeightSize;
|
||||||
|
|
||||||
|
// 示例:随机移动 RGV1
|
||||||
|
//var rgv1 = LayoutList.OfType<Rgv6180ViewModel>().FirstOrDefault(x => x.Id == 1);
|
||||||
|
//if (rgv1 != null)
|
||||||
|
//{
|
||||||
|
// rgv1.LayOutX = new Random().Next(0, 7);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_isProcessing = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
218
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/WcsTaskListViewModel.cs
Normal file
218
Plugins/Wcs/Plugin.Cowain.Wcs/ViewModels/WcsTaskListViewModel.cs
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
using Avalonia.Controls.Notifications;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Cowain.Base.Helpers;
|
||||||
|
using Cowain.Base.ViewModels;
|
||||||
|
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Plugin.Cowain.Driver.Abstractions;
|
||||||
|
using Plugin.Cowain.Wcs.IServices;
|
||||||
|
using Plugin.Cowain.Wcs.Models.Enum;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Ursa.Controls;
|
||||||
|
|
||||||
|
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||||
|
|
||||||
|
public partial class WcsTaskListViewModel : PageViewModelBase
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<TaskViewModel>? _taskList;
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<StationViewModel>? _stations;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private WcsParamViewModel? _findTaskOnStartUp;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private WcsParamViewModel? _findTaskEnable;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _totals;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageSize;
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _pageIndex;
|
||||||
|
|
||||||
|
private readonly ILocalizer _l;
|
||||||
|
private IServiceScopeFactory _scopeFactory;
|
||||||
|
private IStationService _stationService;
|
||||||
|
private IDeviceMonitor _deviceMonitor;
|
||||||
|
private IProcessService _processService;
|
||||||
|
private IWcsParamService _wcsParamService;
|
||||||
|
public WcsTaskListViewModel(ILocalizer localizer, IServiceScopeFactory scopeFactory, IStationService stationService, IDeviceMonitor deviceMonitor, IProcessService processService, IWcsParamService wcsParamService)
|
||||||
|
{
|
||||||
|
_l = localizer;
|
||||||
|
_scopeFactory = scopeFactory;
|
||||||
|
_stationService = stationService;
|
||||||
|
_deviceMonitor = deviceMonitor;
|
||||||
|
_processService = processService;
|
||||||
|
_wcsParamService = wcsParamService;
|
||||||
|
|
||||||
|
PageSize = 10;
|
||||||
|
PageIndex = 1;
|
||||||
|
TaskList = new();
|
||||||
|
RefreshCommand.ExecuteAsync(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task ToggleFindTaskAsync()
|
||||||
|
{
|
||||||
|
var findOnStartUp = await _wcsParamService.UpdateAsync(FindTaskOnStartUp);
|
||||||
|
if (findOnStartUp.IsSuccess)
|
||||||
|
{
|
||||||
|
if (FindTaskOnStartUp?.Param == "True")
|
||||||
|
{
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var tempService = scope.ServiceProvider.GetRequiredService<IFindFlowTaskService>();
|
||||||
|
await tempService.FindTaskAsync();
|
||||||
|
}
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["WcsTaskList.FindTaskToggled.Success"] + ":" + FindTaskOnStartUp!.Param);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["WcsTaskList.FindTaskToggled.Error"] + ":" + findOnStartUp.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task ToggleTaskEnableAsync()
|
||||||
|
{
|
||||||
|
var findTaskEnable = await _wcsParamService.UpdateAsync(FindTaskEnable);
|
||||||
|
if (findTaskEnable.IsSuccess)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["WcsTaskList.FindTaskEnable.Success"] + ":" + FindTaskEnable!.Param);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["WcsTaskList.FindTaskEnable.Error"] + ":" + findTaskEnable.ErrorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task RefreshAsync(int pageIndex)
|
||||||
|
{
|
||||||
|
if (Stations == null)
|
||||||
|
{
|
||||||
|
var stationList = await _stationService.GetAllAsync();
|
||||||
|
Stations = new ObservableCollection<StationViewModel>(stationList);
|
||||||
|
}
|
||||||
|
if (FindTaskOnStartUp == null)
|
||||||
|
{
|
||||||
|
var findOnStartUp = await _wcsParamService.GetParamAsync("FindTaskOnStartUp");
|
||||||
|
if (findOnStartUp.IsSuccess)
|
||||||
|
{
|
||||||
|
FindTaskOnStartUp = findOnStartUp.Data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindTaskEnable == null)
|
||||||
|
{
|
||||||
|
var findOnEnable = await _wcsParamService.GetParamAsync("FindTaskEnable");
|
||||||
|
if (findOnEnable.IsSuccess)
|
||||||
|
{
|
||||||
|
FindTaskEnable = findOnEnable.Data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var taskService = scope.ServiceProvider.GetRequiredService<IRgvTaskService>();
|
||||||
|
var (data, count) = await taskService.GetAllAsync(pageIndex, PageSize);
|
||||||
|
Totals = count;
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
TaskList?.Clear();
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
item.Actions = new(taskService.ActionToList(item.Action) ?? new List<RgvActionViewModel>());
|
||||||
|
item.SelectedAction = item.Actions.FirstOrDefault(x => x.Id == item.ExecuteAction);
|
||||||
|
TaskList?.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanEdit(TaskViewModel? viewModel) => viewModel is not null && !viewModel.IsFinished;
|
||||||
|
|
||||||
|
[RelayCommand(CanExecute = nameof(CanEdit))]
|
||||||
|
private async Task RetryAsync(TaskViewModel? viewModel)
|
||||||
|
{
|
||||||
|
if (viewModel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (viewModel.SelectedAction == null)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["WcsTaskList.Retry.Error.SelectedActionNull"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string action = $"RgvCommand.{viewModel.SelectedAction?.Name}";
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["TaskRetryDialog"], $"{_l["TaskRetryAction"]}{viewModel.SelectedAction?.Id}-{_l[action]}", button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var getJson = await _processService.GetJsonData(viewModel.ProcessId);
|
||||||
|
if (getJson.IsSuccess)
|
||||||
|
{
|
||||||
|
var taskJsonParam = _deviceMonitor.GetActionParam(getJson.Data.PlcName, getJson.Data.Address);
|
||||||
|
if (taskJsonParam.IsSuccess)
|
||||||
|
{
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var taskService = scope.ServiceProvider.GetRequiredService<IRgvTaskService>();
|
||||||
|
var execute = await taskService.ExecuteAsync(taskJsonParam.Data, RgvUpdateSourceEnum.User, viewModel.SelectedAction?.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand(CanExecute = nameof(CanEdit))]
|
||||||
|
private async Task FinishAsync(TaskViewModel? viewModel)
|
||||||
|
{
|
||||||
|
if (viewModel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var result = await MessageBox.ShowOverlayAsync(_l["TaskFinishDialog"], _l["Message.Info.Title"], button: MessageBoxButton.YesNo);
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
using var scope = _scopeFactory.CreateScope();
|
||||||
|
var taskService = scope.ServiceProvider.GetRequiredService<IRgvTaskService>();
|
||||||
|
var finishTask = await taskService.FinishTaskAsync(viewModel.Id);
|
||||||
|
if (finishTask.IsSuccess)
|
||||||
|
{
|
||||||
|
var processService = scope.ServiceProvider.GetRequiredService<IProcessService>();
|
||||||
|
var getJson = await processService.GetJsonData(viewModel.ProcessId);
|
||||||
|
string? rgvName = string.Empty;
|
||||||
|
if (getJson != null)
|
||||||
|
{
|
||||||
|
rgvName = getJson.Data!.RgvName;
|
||||||
|
}
|
||||||
|
var rgvService = scope.ServiceProvider.GetRequiredService<IRgvService>();
|
||||||
|
var rgvs = await rgvService.GetAllAsync();
|
||||||
|
if (rgvs != null)
|
||||||
|
{
|
||||||
|
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||||
|
if (rgv != null)
|
||||||
|
{
|
||||||
|
rgv.FromStationId1 = 0;
|
||||||
|
rgv.ToStationId1 = 0;
|
||||||
|
rgv.FromStationId2 = 0;
|
||||||
|
rgv.ToStationId2 = 0;
|
||||||
|
await rgvService.UpdateAsync(rgv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await RefreshCommand.ExecuteAsync(1);
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Success, _l["WcsTaskList.Finish.Success"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowNormal(NotificationType.Error, _l["WcsTaskList.Finish.Error"] + ":" + finishTask.ErrorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
391
Plugins/Wcs/Plugin.Cowain.Wcs/Views/FlowManagementView.axaml
Normal file
391
Plugins/Wcs/Plugin.Cowain.Wcs/Views/FlowManagementView.axaml
Normal file
@@ -0,0 +1,391 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="Plugin.Cowain.Wcs.Views.FlowManagementView"
|
||||||
|
xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:conv="using:Cowain.Base.Converters"
|
||||||
|
xmlns:convWcs="using:Plugin.Cowain.Wcs.Converters"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:extensions="using:Cowain.Base.Extensions"
|
||||||
|
xmlns:helper="using:Cowain.Base.Helpers"
|
||||||
|
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:Plugin.Cowain.Wcs.ViewModels"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<conv:I18nLocalizeConverter x:Key="i18nConverter" />
|
||||||
|
<convWcs:ActionStringConverter x:Key="listStringConverter" />
|
||||||
|
<conv:MultiIdToPropertyConverter x:Key="IdToPropertyConverter" />
|
||||||
|
<conv:MultiI18nLocalizeConverter x:Key="MultiI18nLocalizeConverter" />
|
||||||
|
<helper:BindingProxy x:Key="Proxy" DataContext="{Binding}" />
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid RowDefinitions="Auto * Auto">
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="0"
|
||||||
|
Margin="10,8"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Spacing="10">
|
||||||
|
<ComboBox
|
||||||
|
Width="160"
|
||||||
|
Classes="ClearButton"
|
||||||
|
ItemsSource="{Binding Process}"
|
||||||
|
SelectedValue="{Binding SelectedProcess, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="vm:ProcessViewModel">
|
||||||
|
<StackPanel
|
||||||
|
Margin="2"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Spacing="10">
|
||||||
|
<TextBlock>
|
||||||
|
<Run Text="{Binding Name}" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
<u:IconButton
|
||||||
|
Command="{Binding RefreshCommand}"
|
||||||
|
CommandParameter="{Binding #page.CurrentPage}"
|
||||||
|
Theme="{DynamicResource BorderlessIconButton}"
|
||||||
|
ToolTip.Tip="{i18n:Localize StationManagement.Tooltip.Refresh}">
|
||||||
|
<u:IconButton.Icon>
|
||||||
|
<PathIcon
|
||||||
|
Width="16"
|
||||||
|
Height="16"
|
||||||
|
Data="{StaticResource SemiIconRedoStroked}" />
|
||||||
|
</u:IconButton.Icon>
|
||||||
|
</u:IconButton>
|
||||||
|
<u:IconButton
|
||||||
|
Command="{Binding AddCommand}"
|
||||||
|
IsEnabled="{extensions:MenuEnable ProcessManagement6180View,
|
||||||
|
add}"
|
||||||
|
Theme="{DynamicResource BorderlessIconButton}"
|
||||||
|
ToolTip.Tip="{i18n:Localize FlowManagement.Tooltip.Add}">
|
||||||
|
<u:IconButton.Icon>
|
||||||
|
<PathIcon
|
||||||
|
Width="16"
|
||||||
|
Height="16"
|
||||||
|
Data="{StaticResource SemiIconPlusStroked}" />
|
||||||
|
</u:IconButton.Icon>
|
||||||
|
</u:IconButton>
|
||||||
|
<u:IconButton
|
||||||
|
Command="{Binding SaveAllCommand}"
|
||||||
|
IsEnabled="{extensions:MenuEnable TagManagementView,
|
||||||
|
save}"
|
||||||
|
Theme="{DynamicResource BorderlessIconButton}"
|
||||||
|
ToolTip.Tip="{i18n:Localize TagManagement.Tooltip.Save}">
|
||||||
|
<u:IconButton.Icon>
|
||||||
|
<PathIcon
|
||||||
|
Width="16"
|
||||||
|
Height="16"
|
||||||
|
Data="{StaticResource SemiIconSave}" />
|
||||||
|
</u:IconButton.Icon>
|
||||||
|
</u:IconButton>
|
||||||
|
<u:IconButton
|
||||||
|
Command="{Binding ImportCommand}"
|
||||||
|
IsEnabled="{extensions:MenuEnable TagManagementView,
|
||||||
|
import}"
|
||||||
|
Theme="{DynamicResource BorderlessIconButton}"
|
||||||
|
ToolTip.Tip="{i18n:Localize TagManagement.Tooltip.Import}">
|
||||||
|
<u:IconButton.Icon>
|
||||||
|
<PathIcon
|
||||||
|
Width="16"
|
||||||
|
Height="16"
|
||||||
|
Data="{StaticResource SemiIconImport}" />
|
||||||
|
</u:IconButton.Icon>
|
||||||
|
</u:IconButton>
|
||||||
|
<u:IconButton
|
||||||
|
Command="{Binding ExportCommand}"
|
||||||
|
Theme="{DynamicResource BorderlessIconButton}"
|
||||||
|
ToolTip.Tip="{i18n:Localize TagManagement.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 FlowList}"
|
||||||
|
RowHeight="30">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn
|
||||||
|
Width="70"
|
||||||
|
x:DataType="vm:ProcessFlowViewModel"
|
||||||
|
Binding="{Binding Id}"
|
||||||
|
Header="{i18n:Localize FlowManagement.DataGrid.Id}" />
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Width="100" Header="{i18n:Localize FlowManagement.DataGrid.Edit}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||||
|
<u:IconButton
|
||||||
|
x:CompileBindings="False"
|
||||||
|
Command="{Binding $parent[DataGrid].DataContext.SaveCommand}"
|
||||||
|
CommandParameter="{Binding}"
|
||||||
|
IsEnabled="{extensions:MenuEnable FlowManagement6180View,
|
||||||
|
save}"
|
||||||
|
Theme="{DynamicResource BorderlessIconButton}"
|
||||||
|
ToolTip.Tip="{i18n:Localize FlowManagement.Tooltip.Save}">
|
||||||
|
<u:IconButton.Icon>
|
||||||
|
<PathIcon
|
||||||
|
Width="16"
|
||||||
|
Height="16"
|
||||||
|
Data="{StaticResource SemiIconSave}" />
|
||||||
|
</u:IconButton.Icon>
|
||||||
|
</u:IconButton>
|
||||||
|
|
||||||
|
<u:IconButton
|
||||||
|
x:CompileBindings="False"
|
||||||
|
Command="{Binding $parent[DataGrid].DataContext.DeleteCommand}"
|
||||||
|
CommandParameter="{Binding}"
|
||||||
|
IsEnabled="{extensions:MenuEnable FlowManagement6180View,
|
||||||
|
delete}"
|
||||||
|
Theme="{DynamicResource BorderlessIconButton}"
|
||||||
|
ToolTip.Tip="{i18n:Localize FlowManagement.Tooltip.Delete}">
|
||||||
|
<u:IconButton.Icon>
|
||||||
|
<PathIcon
|
||||||
|
Width="16"
|
||||||
|
Height="16"
|
||||||
|
Data="{StaticResource SemiIconDeleteStroked}" />
|
||||||
|
</u:IconButton.Icon>
|
||||||
|
</u:IconButton>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn
|
||||||
|
Width="80"
|
||||||
|
x:DataType="vm:ProcessFlowViewModel"
|
||||||
|
Header="{i18n:Localize FlowManagement.DataGrid.Priority}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<NumericUpDown Increment="1" Value="{Binding Priority}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Width="140" Header="{i18n:Localize FlowManagement.DataGrid.FromStation1}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Classes="Large"
|
||||||
|
ItemsSource="{Binding DataContext.Stations, Source={StaticResource Proxy}}"
|
||||||
|
SelectedValue="{Binding FromStationId1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectedValueBinding="{Binding Id}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="vm:StationViewModel">
|
||||||
|
<StackPanel
|
||||||
|
Margin="10,8"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Spacing="10">
|
||||||
|
<TextBlock>
|
||||||
|
<Run Text="{Binding StationName}" />
|
||||||
|
<Run>:</Run>
|
||||||
|
<Run Foreground="Red" Text="{Binding StationCode}" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Width="140" Header="{i18n:Localize FlowManagement.DataGrid.ToStation1}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Classes="Large"
|
||||||
|
ItemsSource="{Binding DataContext.Stations, Source={StaticResource Proxy}}"
|
||||||
|
SelectedValue="{Binding ToStationId1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectedValueBinding="{Binding Id}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="vm:StationViewModel">
|
||||||
|
<StackPanel
|
||||||
|
Margin="10,8"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Spacing="10">
|
||||||
|
<TextBlock>
|
||||||
|
<Run Text="{Binding StationName}" />
|
||||||
|
<Run>:</Run>
|
||||||
|
<Run Foreground="Red" Text="{Binding StationCode}" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Width="140" Header="{i18n:Localize FlowManagement.DataGrid.FromStationStatus1}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Classes="Large"
|
||||||
|
ItemsSource="{x:Static vm:FlowManagementViewModel.StationStateList}"
|
||||||
|
SelectedValue="{Binding FromStatus1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectedValueBinding="{Binding .}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="140" Header="{i18n:Localize FlowManagement.DataGrid.ToStationStatus1}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Classes="Large"
|
||||||
|
ItemsSource="{x:Static vm:FlowManagementViewModel.StationStateList}"
|
||||||
|
SelectedValue="{Binding ToStatus1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectedValueBinding="{Binding .}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Width="140" Header="{i18n:Localize FlowManagement.DataGrid.FromStation2}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Classes="Large"
|
||||||
|
ItemsSource="{Binding DataContext.Stations, Source={StaticResource Proxy}}"
|
||||||
|
SelectedValue="{Binding FromStationId2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectedValueBinding="{Binding Id}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="vm:StationViewModel">
|
||||||
|
<StackPanel
|
||||||
|
Margin="10,8"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Spacing="10">
|
||||||
|
<TextBlock>
|
||||||
|
<Run Text="{Binding StationName}" />
|
||||||
|
<Run>:</Run>
|
||||||
|
<Run Foreground="Red" Text="{Binding StationCode}" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Width="140" Header="{i18n:Localize FlowManagement.DataGrid.ToStation2}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Classes="Large"
|
||||||
|
ItemsSource="{Binding DataContext.Stations, Source={StaticResource Proxy}}"
|
||||||
|
SelectedValue="{Binding ToStationId2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectedValueBinding="{Binding Id}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="vm:StationViewModel">
|
||||||
|
<StackPanel
|
||||||
|
Margin="10,8"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Spacing="10">
|
||||||
|
<TextBlock>
|
||||||
|
<Run Text="{Binding StationName}" />
|
||||||
|
<Run>:</Run>
|
||||||
|
<Run Foreground="Red" Text="{Binding StationCode}" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
<DataGridTemplateColumn Width="140" Header="{i18n:Localize FlowManagement.DataGrid.FromStationStatus2}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Classes="Large"
|
||||||
|
ItemsSource="{x:Static vm:FlowManagementViewModel.StationStateList}"
|
||||||
|
SelectedValue="{Binding FromStatus2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectedValueBinding="{Binding .}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="140" Header="{i18n:Localize FlowManagement.DataGrid.ToStationStatus2}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Classes="Large"
|
||||||
|
ItemsSource="{x:Static vm:FlowManagementViewModel.StationStateList}"
|
||||||
|
SelectedValue="{Binding ToStatus2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectedValueBinding="{Binding .}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
|
||||||
|
<DataGridTextColumn
|
||||||
|
Width="400"
|
||||||
|
x:DataType="vm:ProcessFlowViewModel"
|
||||||
|
Binding="{Binding Action}"
|
||||||
|
Header="{i18n:Localize FlowManagement.DataGrid.Actions}" />
|
||||||
|
|
||||||
|
|
||||||
|
</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>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user