6040-003分支:更新WCS库代码
This commit is contained in:
@@ -33,11 +33,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Driver", "Driver", "{30F461
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.TestProject", "Cowain.TestProject\Cowain.TestProject.csproj", "{2EE939AE-6843-3006-BC7A-6542BBAABB23}"
|
||||
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}"
|
||||
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
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -85,10 +83,10 @@ Global
|
||||
{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.Build.0 = Release|Any CPU
|
||||
{D0C1B285-1FDA-4C71-92BE-CF9BD28931CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D0C1B285-1FDA-4C71-92BE-CF9BD28931CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D0C1B285-1FDA-4C71-92BE-CF9BD28931CB}.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}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BEAD32CC-A67F-09CB-7A11-28495EB31A53}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BEAD32CC-A67F-09CB-7A11-28495EB31A53}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BEAD32CC-A67F-09CB-7A11-28495EB31A53}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -98,9 +96,8 @@ Global
|
||||
{6C22C8CF-C50F-295E-7691-1C8933521476} = {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}
|
||||
{0A0182D3-52CC-40AA-9A5D-FCE6A20F170B} = {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} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {83CB65B8-011F-4ED7-BCD3-A6CFA935EF7E}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
<Folder Include="Configs\DB\" />
|
||||
<Folder Include="Migrations\" />
|
||||
<Folder Include="Plugins\" />
|
||||
</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,710 +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("20260128071034_baking_mode_station")]
|
||||
partial class baking_mode_station
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Sex")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("UserNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 28, 15, 10, 33, 689, DateTimeKind.Local).AddTicks(249),
|
||||
IsValid = true,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
Phone = "17625760609",
|
||||
RoleId = 1,
|
||||
Sex = "Male",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
UserNumber = "CWA4483"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsValid")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CreateTime = new DateTime(2026, 1, 28, 15, 10, 33, 696, DateTimeKind.Local).AddTicks(8625),
|
||||
IsValid = true,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Cowain.Base.Models.Admins.UserRoleMenuDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("MenuActions")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MenuKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("user_role_menu");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
MenuActions = "[]",
|
||||
MenuKey = "Home",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserRoleSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 3,
|
||||
MenuActions = "[ \"edit\", \"delete\"]",
|
||||
MenuKey = "RoleMenuSetting",
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4,
|
||||
MenuActions = "[ \"add\", \"edit\", \"delete\"]",
|
||||
MenuKey = "UserManagement",
|
||||
RoleId = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DataValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BakingVariableDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("baking_variable");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.BatteryInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("Col")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsWaterBattery")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Row")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ScanTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("battery_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletBindingDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("PalletId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_binding");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.PalletInfoHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BakingCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("BakingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("BakingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("BindingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<DateTime>("HistoryTime")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingEndTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("LoadingStartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PalletStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<int>("StationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("UnLoadingTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("WaterValue")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("pallet_info_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Baking.Models.Dto.StationInfoDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("LayOutX")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LayOutY")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("StationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("station_info");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmGroupDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_group");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Name = "系统"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmHistoryDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Group")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("Status")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTime?>("StopTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_history");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.AlarmLevelDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("alarm_level");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Color = "Red",
|
||||
Name = "报警"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Color = "Yellow",
|
||||
Name = "警告"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.DeviceDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DeviceName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("DeviceType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<string>("DriverName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<bool>("Enable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("device");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.TagAddressDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<bool>("AlarmEnable")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("AlarmGroup")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AlarmLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AlarmMsg")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("AlarmValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ArrayCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DataType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Json")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("OperMode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("tag_address");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[0]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag1",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag1",
|
||||
OperMode = "Read"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Address = "ns=4;s=L1RSTemp_Output1[1]",
|
||||
AlarmEnable = false,
|
||||
AlarmGroup = 0,
|
||||
AlarmLevel = 0,
|
||||
AlarmMsg = "",
|
||||
AlarmValue = "",
|
||||
ArrayCount = 1,
|
||||
DataType = "Int16",
|
||||
Desc = "Tag2",
|
||||
DeviceId = 1,
|
||||
Json = "",
|
||||
Name = "Tag2",
|
||||
OperMode = "Read"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Plugin.Cowain.Driver.Models.Dto.VarActionDto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("ActionValue")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Condition")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("Desc")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)");
|
||||
|
||||
b.Property<int>("DeviceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Param")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("varchar(1000)");
|
||||
|
||||
b.Property<int>("TagId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("var_action");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
[DbContext(typeof(DBContextGenerator))]
|
||||
[Migration("20260128080126_baking_mode_station_wh")]
|
||||
partial class baking_mode_station_wh
|
||||
[Migration("20260302014714_init")]
|
||||
partial class init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -73,7 +73,7 @@ namespace Cowain.TestProject.Migrations
|
||||
new
|
||||
{
|
||||
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,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
@@ -114,7 +114,7 @@ namespace Cowain.TestProject.Migrations
|
||||
new
|
||||
{
|
||||
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,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
@@ -70,6 +70,63 @@ namespace Cowain.TestProject.Migrations
|
||||
})
|
||||
.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(
|
||||
name: "device",
|
||||
columns: table => new
|
||||
@@ -96,6 +153,99 @@ namespace Cowain.TestProject.Migrations
|
||||
})
|
||||
.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(
|
||||
name: "tag_address",
|
||||
columns: table => new
|
||||
@@ -244,12 +394,12 @@ namespace Cowain.TestProject.Migrations
|
||||
migrationBuilder.InsertData(
|
||||
table: "user",
|
||||
columns: new[] { "Id", "CreateTime", "IsValid", "Name", "Password", "Phone", "RoleId", "Sex", "UpdateTime", "UserNumber" },
|
||||
values: new object[] { 1, new DateTime(2026, 1, 22, 14, 52, 24, 945, DateTimeKind.Local).AddTicks(547), true, "admin", "F44DDAC49CE7A95D", "17625760609", 1, "Male", new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "CWA4483" });
|
||||
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(
|
||||
table: "user_role",
|
||||
columns: new[] { "Id", "CreateTime", "IsValid", "RoleName", "UpdateTime" },
|
||||
values: new object[] { 1, new DateTime(2026, 1, 22, 14, 52, 24, 949, DateTimeKind.Local).AddTicks(9102), true, "管理员", new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) });
|
||||
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(
|
||||
table: "user_role_menu",
|
||||
@@ -275,9 +425,30 @@ namespace Cowain.TestProject.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "alarm_level");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "baking_info");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "baking_variable");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "battery_info");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
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(
|
||||
name: "tag_address");
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Cowain.TestProject.Migrations
|
||||
new
|
||||
{
|
||||
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,
|
||||
Name = "admin",
|
||||
Password = "F44DDAC49CE7A95D",
|
||||
@@ -111,7 +111,7 @@ namespace Cowain.TestProject.Migrations
|
||||
new
|
||||
{
|
||||
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,
|
||||
RoleName = "管理员",
|
||||
UpdateTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"WcsFindTaskOnStartUp":"True",
|
||||
"Database": { "db": "MySql" },
|
||||
"ConnectionStrings": {
|
||||
"MySqlConn": "Server=127.0.0.1;Database=db_6055006;Port=3307;charset=utf8;uid=root;pwd=123456;persistsecurityinfo=True;",
|
||||
"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;",
|
||||
"PostGresConn": "Server=127.0.0.1;Port=5432;User Id=postgres;Password=123456;Database=testProjectDb;",
|
||||
"SqlLiteConn": "Data Source=Configs/DB/localDb.sqlite"
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Baking\Plugin.Cowain.Baking\Plugin.Cowain.Baking.csproj" />
|
||||
<ProjectReference Include="..\Driver\Cowain.Driver\Plugin.Cowain.Driver.csproj" />
|
||||
<ProjectReference Include="..\Driver\Driver.DeviceOpcUa\Plugin.Driver.DeviceOpcUa.csproj" />
|
||||
<ProjectReference Include="..\Driver\Driver.DeviceSiemens\Plugin.Driver.DeviceSiemens.csproj" />
|
||||
<ProjectReference Include="..\Wcs\Plugin.Cowain.Wcs\Plugin.Cowain.Wcs.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
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 RgvFinished6180ParamData
|
||||
{
|
||||
/// <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("RgvFinished6180", "RGV动作完成6180")]
|
||||
public class RgvFinished6180Action : IVariableAction
|
||||
{
|
||||
|
||||
|
||||
private readonly IDeviceMonitor _deviceMonitor;
|
||||
private IServiceScopeFactory _scopeFactory;
|
||||
private readonly ILogger<RgvFinished6180Action> _logger;
|
||||
public RgvFinished6180Action(IDeviceMonitor deviceMonitor, IServiceScopeFactory scopeFactory, ILogger<RgvFinished6180Action> 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<IRgvTask6180Service>();
|
||||
return await taskService.ExecuteAsync(variableAction.Param, RgvUpdateSourceEnum.PLC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
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>
|
||||
/// 20250812简化,批量写
|
||||
/// </summary>
|
||||
[Action("Station6180", "上下料请求6180")]
|
||||
public class Station6180Action : 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<Station6180Action> _logger;
|
||||
public Station6180Action(IDeviceMonitor deviceMonitor, IServiceScopeFactory scopeFactory, ILogger<Station6180Action> 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; }
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.Models;
|
||||
using Cowain.Base.Models;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Plugin.Cowain.Driver.Abstractions;
|
||||
@@ -20,34 +19,15 @@ public class RgvFinishedParamData
|
||||
/// 命令地址
|
||||
/// </summary>
|
||||
public string CmdAddress { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 计数地址
|
||||
/// </summary>
|
||||
public string CountAddress { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 目标工站
|
||||
/// </summary>
|
||||
public string TargetPosAddress { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 任务号地址
|
||||
/// </summary>
|
||||
public string TaskAddress { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 反馈命令地址
|
||||
/// </summary>
|
||||
public string RetCmdAddress { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 反馈结果地址
|
||||
/// </summary>
|
||||
public string RetResultAddress { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 反馈任务号地址
|
||||
/// </summary>
|
||||
public string RetTaskAddress { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
[Action("RgvFinished", "RGV动作完成")]
|
||||
[Action("RgvFinished", "RGV动作完成时间")]
|
||||
public class RgvFinishedAction : IVariableAction
|
||||
{
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.Models;
|
||||
using Cowain.Base.Models;
|
||||
using HslCommunication;
|
||||
using HslCommunication.Core;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -9,8 +8,6 @@ using Plugin.Cowain.Driver;
|
||||
using Plugin.Cowain.Driver.Abstractions;
|
||||
using Plugin.Cowain.Driver.Attributes;
|
||||
using Plugin.Cowain.Driver.Models;
|
||||
using Plugin.Cowain.Driver.Models.Enum;
|
||||
using Plugin.Cowain.Driver.ViewModels;
|
||||
using Plugin.Cowain.Wcs.IServices;
|
||||
using Plugin.Cowain.Wcs.Models.Enum;
|
||||
using Plugin.Cowain.Wcs.Services;
|
||||
@@ -18,10 +15,13 @@ using System.Text.Json;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Actions;
|
||||
|
||||
|
||||
[Action("Station", "上下料请求")]
|
||||
/// <summary>
|
||||
/// 工站需要上下料请求
|
||||
/// </summary>
|
||||
[Action("Station", "工站请求命令")]
|
||||
public class StationAction : IVariableAction
|
||||
{
|
||||
|
||||
private class ParamData
|
||||
{
|
||||
/// <summary>
|
||||
@@ -36,6 +36,7 @@ public class StationAction : IVariableAction
|
||||
/// 命令地址
|
||||
/// </summary>
|
||||
public string CmdAddress { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 反馈命令地址
|
||||
/// </summary>
|
||||
@@ -80,7 +81,6 @@ public class StationAction : IVariableAction
|
||||
_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();
|
||||
@@ -143,6 +143,7 @@ public class StationAction : IVariableAction
|
||||
return ResultModel.Success();
|
||||
}
|
||||
|
||||
|
||||
private async Task<ResultModel<StationRequestData>> ReadAsync(IReadWriteDevice driver, string address)
|
||||
{
|
||||
var readResult = await driver.ReadAsync(address, 70);
|
||||
@@ -160,4 +161,15 @@ public class StationAction : IVariableAction
|
||||
};
|
||||
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; }
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using Avalonia.Data.Converters;
|
||||
using Plugin.Cowain.Wcs.ViewModels;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Converters;
|
||||
|
||||
public class CellPositionToPixelConverter : IValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int cellPosition)
|
||||
{
|
||||
return (double)cellPosition * WcsRealStationViewModel.CellSize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using Avalonia.Data.Converters;
|
||||
using Plugin.Cowain.Wcs.ViewModels;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Converters;
|
||||
|
||||
public class ColumnToPositionConverter : IValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int column)
|
||||
{
|
||||
return column * WcsRealStationViewModel.CellSize + 5; // +5是为了留出边距
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using Avalonia.Data.Converters;
|
||||
using Plugin.Cowain.Wcs.ViewModels;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Converters;
|
||||
|
||||
public class RowToPositionConverter : IValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int row)
|
||||
{
|
||||
return row * WcsRealStationViewModel.CellSize + 5; // +5是为了留出边距
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
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 IFindFlowTask6180Service : IBaseService
|
||||
{
|
||||
public Task FindTaskAsync(TaskData6180Dto? taskData = null);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using Cowain.Base.IServices;
|
||||
using Cowain.Base.Models;
|
||||
using Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.IServices;
|
||||
|
||||
public interface IProcessFlow6180Service : IBaseService
|
||||
{
|
||||
Task<List<ProcessFlow6180ViewModel>> GetAllAsync();
|
||||
Task<(List<ProcessFlow6180ViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize);
|
||||
Task<(List<ProcessFlow6180ViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize, int? processId);
|
||||
Task<ResultModel> AddAsync(int processId, List<ProcessFlow6180ViewModel> flows);
|
||||
Task<ResultModel> UpdateAsync(int processId, List<ProcessFlow6180ViewModel> flows);
|
||||
Task<ResultModel> DeleteAsync(int processId);
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Cowain.Base.IServices;
|
||||
using Cowain.Base.Models;
|
||||
using Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.IServices;
|
||||
|
||||
public interface IRgv6180Service : IBaseService
|
||||
{
|
||||
Task<ResultModel> AddRgvAsync(Rgv6180ViewModel? rgv);
|
||||
Task<ResultModel> DeleteAsync(int id);
|
||||
Task<ResultModel> UpdateAsync(Rgv6180ViewModel? rgv);
|
||||
Task<List<Rgv6180ViewModel>> GetAllAsync();
|
||||
Task<(List<Rgv6180ViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
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 IRgvTask6180Service : IBaseService
|
||||
{
|
||||
List<RgvActionViewModel>? ActionToList(string action);
|
||||
RgvCommand6180Enum GetStepAction(List<RgvActionViewModel> actions, int step);
|
||||
Task<ResultModel> FinishTaskAsync(int id);
|
||||
Task<List<Task6180ViewModel>> GetAllAsync();
|
||||
Task<(List<Task6180ViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize);
|
||||
Task<ResultModel<RgvCommand6180Model>> GetRgvCommandAsync(RgvUpdateInfoModel? infoModel);
|
||||
Task<ResultModel> ExecuteAsync(string? actionParam, RgvUpdateSourceEnum source, int? execute = 0);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Cowain.Base.IServices;
|
||||
using Plugin.Cowain.Wcs.Models.Dto;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,5 +10,5 @@ namespace Plugin.Cowain.Wcs.IServices;
|
||||
|
||||
public interface IFindFlowTaskService : IBaseService
|
||||
{
|
||||
public Task FindTaskAsync();
|
||||
public Task FindTaskAsync(TaskDataDto? taskData = null);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public interface IProcessFlowService : IBaseService
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
using Cowain.Base.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||
|
||||
|
||||
[Table("processflow6180dto")]
|
||||
public class ProcessFlow6180Dto : 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;
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
using Cowain.Base.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||
|
||||
[Table("rgv6180dto")]
|
||||
public class Rgv6180Dto : 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;
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
using Cowain.Base.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||
|
||||
[Table("taskdata6180dto")]
|
||||
public class TaskData6180Dto : 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;
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||
|
||||
|
||||
[Table("processdto")]
|
||||
[Table("process")]
|
||||
public class ProcessDto : BaseModel
|
||||
{
|
||||
[Key]
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
|
||||
|
||||
using Cowain.Base.Models;
|
||||
using Cowain.Base.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||
|
||||
[Table("processflowdto")]
|
||||
|
||||
[Table("process_flow")]
|
||||
public class ProcessFlowDto : BaseModel
|
||||
{
|
||||
[Key]
|
||||
@@ -15,35 +14,45 @@ public class ProcessFlowDto : BaseModel
|
||||
/// <summary>
|
||||
/// 工艺id
|
||||
/// </summary>
|
||||
[Required]
|
||||
public int ProcessId { get; set; }
|
||||
/// <summary>
|
||||
/// 优先级
|
||||
/// </summary>
|
||||
[Required]
|
||||
public int Priority { get; set; }
|
||||
[Required]
|
||||
public int FromStationId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ToStationId { get; set; }
|
||||
|
||||
public int FromStationId1 { get; set; }
|
||||
|
||||
public int ToStationId1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string FromStatus { get; set; } = string.Empty;
|
||||
public string FromStatus1 { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string ToStatus { get; set; } = string.Empty;
|
||||
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>
|
||||
/// 动作
|
||||
@@ -51,4 +60,5 @@ public class ProcessFlowDto : BaseModel
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string Action { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||
|
||||
[Table("rgvdto")]
|
||||
[Table("rgv")]
|
||||
public class RgvDto : BaseModel
|
||||
{
|
||||
[Key]
|
||||
@@ -14,13 +14,13 @@ public class RgvDto : BaseModel
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string StationName { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 设备代号 RGV-01
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public string StationCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 工艺名称
|
||||
@@ -29,11 +29,21 @@ public class RgvDto : BaseModel
|
||||
[MaxLength(100)]
|
||||
public string ProcessName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public int FromStationId { get; set; }
|
||||
[Required]
|
||||
public int ToStationId { get; set; }
|
||||
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>
|
||||
@@ -48,6 +58,4 @@ public class RgvDto : BaseModel
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Json { get; set; } = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||
|
||||
[Table("stationdto")]
|
||||
[Table("station")]
|
||||
public class StationDto : BaseModel
|
||||
{
|
||||
[Key]
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||
|
||||
[Table("taskdatadto")]
|
||||
[Table("task_data")]
|
||||
public class TaskDataDto : BaseModel
|
||||
{
|
||||
[Key]
|
||||
@@ -17,49 +17,60 @@ public class TaskDataDto : BaseModel
|
||||
[MaxLength(100)]
|
||||
public string ProcessName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public int ProcessId { get; set; }
|
||||
[Required]
|
||||
public int FromStationId { get; set; }
|
||||
[Required]
|
||||
public int ToStationId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 优先级
|
||||
/// </summary>
|
||||
[Required]
|
||||
public int Priority { get; set; }
|
||||
/// <summary>
|
||||
/// 序列号
|
||||
/// </summary>
|
||||
[MaxLength(200)]
|
||||
public string QrCode { get; set; } = string.Empty;
|
||||
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 FromStatus { get; set; } = string.Empty;
|
||||
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 ToStatus { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 动作保存
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string Action { get; set; } = string.Empty;
|
||||
|
||||
public string ToStatus2 { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 正在执行的动作
|
||||
/// </summary>
|
||||
[Required]
|
||||
public int ExecuteAction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -67,6 +78,13 @@ public class TaskDataDto : BaseModel
|
||||
/// </summary>
|
||||
public bool IsFinished { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 动作保存
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string Action { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models.Dto;
|
||||
|
||||
[Table("wcsparamdto")]
|
||||
[Table("wcs_param")]
|
||||
public class WcsParamDto : BaseModel
|
||||
{
|
||||
[Key]
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models.Enum;
|
||||
|
||||
public enum RgvCommand6180Enum
|
||||
{
|
||||
UnKnown = 0,
|
||||
MoveFrom = 10,
|
||||
MoveTo = 11,
|
||||
Pick = 20,
|
||||
Place = 30
|
||||
}
|
||||
@@ -5,9 +5,8 @@ namespace Plugin.Cowain.Wcs.Models.Enum;
|
||||
public enum RgvCommandEnum
|
||||
{
|
||||
UnKnown = 0,
|
||||
Move = 10,
|
||||
PickIn = 20,
|
||||
PickOut = 21,
|
||||
PlaceIn = 30,
|
||||
PlaceOut = 31
|
||||
MoveFrom = 10,
|
||||
MoveTo = 11,
|
||||
Pick = 20,
|
||||
Place = 30
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using Plugin.Cowain.Wcs.Models.Enum;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models;
|
||||
|
||||
|
||||
public class RgvCommand6180Model
|
||||
{
|
||||
public RgvCommand6180Enum 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;
|
||||
|
||||
|
||||
}
|
||||
@@ -2,10 +2,19 @@
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models;
|
||||
|
||||
|
||||
public class RgvCommandModel
|
||||
{
|
||||
public RgvCommandEnum Command { get; set; }
|
||||
public int TargetPos { get; set; }
|
||||
public int TaskId { get; set; }
|
||||
public string QrCode { get; set; } = string.Empty;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using Plugin.Cowain.Wcs.Models.Dto;
|
||||
using Plugin.Cowain.Wcs.Models.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Plugin.Cowain.Wcs.Models.Enum;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Models;
|
||||
|
||||
|
||||
@@ -72,39 +72,27 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\6180\FlowManagement6180View.axaml.cs">
|
||||
<DependentUpon>FlowManagement6180View.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\6180\ProcessManagement6180View.axaml.cs">
|
||||
<DependentUpon>ProcessManagement6180View.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\6180\RgvManagement6180View.axaml.cs">
|
||||
<DependentUpon>RgvManagement6180View.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\6180\WcsRealStation6180View.axaml.cs">
|
||||
<DependentUpon>WcsRealStation6180View.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\6180\WcsTaskList6180View.axaml.cs">
|
||||
<DependentUpon>WcsTaskList6180View.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<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\StationManagementView.axaml.cs">
|
||||
<DependentUpon>StationManagementView.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>
|
||||
|
||||
|
||||
|
||||
@@ -1,316 +0,0 @@
|
||||
using Cowain.Base.DBContext;
|
||||
using Cowain.Base.Helpers;
|
||||
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;
|
||||
using System.Threading;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Services;
|
||||
|
||||
public class FindFlowTask6180Service : BaseService, IFindFlowTask6180Service
|
||||
{
|
||||
private class ProcessFlowInfo
|
||||
{
|
||||
public ProcessFlowInfo(ProcessDto process, ProcessFlow6180Dto flow)
|
||||
{
|
||||
Process = process;
|
||||
Flow = flow;
|
||||
}
|
||||
|
||||
public ProcessDto Process { get; set; }
|
||||
public ProcessFlow6180Dto Flow { get; set; }
|
||||
}
|
||||
|
||||
private static SemaphoreSlim semaphore = new SemaphoreSlim(1);
|
||||
private IDeviceMonitor _deviceMonitor;
|
||||
private IProcessService _processService;
|
||||
private IServiceScopeFactory _scopeFactory;
|
||||
private readonly ILogger<FindFlowTask6180Service> _logger;
|
||||
|
||||
public FindFlowTask6180Service(SqlDbContext dbContext, IServiceScopeFactory scopeFactory, IDeviceMonitor deviceMonitor, IProcessService processService, ILogger<FindFlowTask6180Service> logger) : base(dbContext)
|
||||
{
|
||||
_deviceMonitor = deviceMonitor;
|
||||
_processService = processService;
|
||||
_scopeFactory = scopeFactory;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工站列表和流程工艺列表,构建所有可执行的候选任务
|
||||
/// </summary>
|
||||
private List<TaskData6180Dto> BuildCandidateTasks(List<StationDto> stations, List<ProcessFlowInfo> processAndFlows)
|
||||
{
|
||||
var candidateTasks = new List<TaskData6180Dto>();
|
||||
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 TaskData6180Dto
|
||||
{
|
||||
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(TaskData6180Dto 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<IFindFlowTask6180Service>();
|
||||
await tempService.FindTaskAsync(originalTask);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "延时查询任务失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存任务并执行
|
||||
/// </summary>
|
||||
private async Task SaveAndExecuteTask(TaskData6180Dto task)
|
||||
{
|
||||
var taskSet = _dBContext.GetDbSet<TaskData6180Dto>();
|
||||
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<IRgvTask6180Service>();
|
||||
var execute = await taskService.ExecuteAsync(taskJsonParam.Data, RgvUpdateSourceEnum.First);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogError(getJson.ErrorMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogError("任务添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task FindTaskAsync(TaskData6180Dto? taskData = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await semaphore.WaitAsync();
|
||||
var taskSet = _dBContext.GetDbSet<TaskData6180Dto>();
|
||||
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<Rgv6180Dto>();
|
||||
var processSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
var flowSet = _dBContext.GetDbSet<ProcessFlow6180Dto>();
|
||||
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)最小选取
|
||||
TaskData6180Dto? 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,257 +0,0 @@
|
||||
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.Dto;
|
||||
using Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Services;
|
||||
|
||||
public class ProcessFlow6180Service : BaseService, IProcessFlow6180Service
|
||||
{
|
||||
public ProcessFlow6180Service(SqlDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
public async Task<ResultModel> AddAsync(int processId, List<ProcessFlow6180ViewModel> flows)
|
||||
{
|
||||
if (flows == null || flows.Count == 0)
|
||||
return ResultModel.Error("流程数据不能为空");
|
||||
|
||||
try
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessFlow6180Dto>();
|
||||
var entities = new List<ProcessFlow6180Dto>();
|
||||
foreach (var f in flows)
|
||||
{
|
||||
entities.Add(new ProcessFlow6180Dto
|
||||
{
|
||||
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<ProcessFlow6180ViewModel> flows)
|
||||
{
|
||||
if (flows == null || flows.Count == 0)
|
||||
return ResultModel.Error("流程数据不能为空");
|
||||
|
||||
try
|
||||
{
|
||||
var dbSet = _dBContext.GetDbSet<ProcessFlow6180Dto>();
|
||||
|
||||
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 ProcessFlow6180Dto
|
||||
{
|
||||
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
|
||||
{
|
||||
var dbSet = _dBContext.GetDbSet<ProcessFlow6180Dto>();
|
||||
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
|
||||
{
|
||||
var dbSet = _dBContext.GetDbSet<ProcessFlow6180Dto>();
|
||||
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<ProcessFlow6180ViewModel>> GetAllAsync()
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessFlow6180Dto>();
|
||||
var data = await DbSet.ToListAsync();
|
||||
var result = new List<ProcessFlow6180ViewModel>();
|
||||
foreach (var x in data)
|
||||
{
|
||||
// 1号流程
|
||||
if (x.FromStationId1 != 0 || x.ToStationId1 != 0 || !string.IsNullOrEmpty(x.FromStatus1) || !string.IsNullOrEmpty(x.ToStatus1))
|
||||
{
|
||||
result.Add(new ProcessFlow6180ViewModel
|
||||
{
|
||||
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<ProcessFlow6180ViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessFlow6180Dto>();
|
||||
var data = await DbSet.ToListAsync();
|
||||
var result = new List<ProcessFlow6180ViewModel>();
|
||||
foreach (var x in data)
|
||||
{
|
||||
if (x.FromStationId1 != 0 || x.ToStationId1 != 0 || !string.IsNullOrEmpty(x.FromStatus1) || !string.IsNullOrEmpty(x.ToStatus1))
|
||||
{
|
||||
result.Add(new ProcessFlow6180ViewModel
|
||||
{
|
||||
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<ProcessFlow6180ViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize, int? processId)
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessFlow6180Dto>();
|
||||
IQueryable<ProcessFlow6180Dto> 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<ProcessFlow6180ViewModel>();
|
||||
foreach (var x in data)
|
||||
{
|
||||
if (x.FromStationId1 != 0 || x.ToStationId1 != 0 || !string.IsNullOrEmpty(x.FromStatus1) || !string.IsNullOrEmpty(x.ToStatus1))
|
||||
{
|
||||
result.Add(new ProcessFlow6180ViewModel
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,193 +0,0 @@
|
||||
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 Rgv6180Service : BaseService, IRgv6180Service
|
||||
{
|
||||
public Rgv6180Service(SqlDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public async Task<ResultModel> AddRgvAsync(Rgv6180ViewModel? 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编码不能为空");
|
||||
}
|
||||
var dbSet = _dBContext.GetDbSet<Rgv6180Dto>();
|
||||
// 检查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 Rgv6180Dto
|
||||
{
|
||||
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");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<Rgv6180Dto>();
|
||||
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(Rgv6180ViewModel? 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("编码不能为空");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<Rgv6180Dto>();
|
||||
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<Rgv6180ViewModel>> GetAllAsync()
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<Rgv6180Dto>();
|
||||
var data = await DbSet.ToListAsync();
|
||||
return new List<Rgv6180ViewModel>(data.Select(x => new Rgv6180ViewModel
|
||||
{
|
||||
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<Rgv6180ViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||
{
|
||||
|
||||
var dbSet = _dBContext.GetDbSet<Rgv6180Dto>();
|
||||
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 Rgv6180ViewModel
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,633 +0,0 @@
|
||||
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 WcsToRgv6180Data
|
||||
{
|
||||
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 RgvTask6180Service : BaseService, IRgvTask6180Service
|
||||
{
|
||||
private IServiceScopeFactory _scopeFactory;
|
||||
private IDeviceMonitor _deviceMonitor;
|
||||
private readonly ILogger<RgvTask6180Service> _logger;
|
||||
|
||||
public RgvTask6180Service(SqlDbContext dbContext, IDeviceMonitor deviceMonitor, IServiceScopeFactory scopeFactory, ILogger<RgvTask6180Service> logger) : base(dbContext)
|
||||
{
|
||||
_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 = RgvCommand6180Enum.UnKnown.ToString() });
|
||||
return rgvActionViewModels;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "反序列化失败");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public RgvCommand6180Enum GetStepAction(List<RgvActionViewModel> actions, int step)
|
||||
{
|
||||
var name = actions.FirstOrDefault(x => x.Id == step)?.Name;
|
||||
return Enum.TryParse(name, out RgvCommand6180Enum cmd) ? cmd : RgvCommand6180Enum.UnKnown;
|
||||
}
|
||||
|
||||
public async Task<ResultModel> FinishTaskAsync(int id)
|
||||
{
|
||||
if (id <= 0)
|
||||
{
|
||||
return ResultModel.Error("id不能小于0");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<TaskData6180Dto>();
|
||||
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<Task6180ViewModel>> GetAllAsync()
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<TaskData6180Dto>();
|
||||
var data = await DbSet.ToListAsync();
|
||||
return new List<Task6180ViewModel>(data.Select(x => new Task6180ViewModel
|
||||
{
|
||||
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<Task6180ViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<TaskData6180Dto>();
|
||||
// 按照CreateTime倒序排列,最新的任务排第一个
|
||||
var data = await DbSet.OrderByDescending(x => x.Id).ToListAsync();
|
||||
var list = data.Skip((pageIndex - 1) * pageSize).Take(pageSize);
|
||||
var ret = new List<Task6180ViewModel>(list.Select(x => new Task6180ViewModel
|
||||
{
|
||||
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<RgvCommand6180Model>> GetRgvCommandAsync(RgvUpdateInfoModel? infoModel)
|
||||
{
|
||||
RgvCommand6180Model? rgvCommand = null;
|
||||
if (infoModel == null)
|
||||
{
|
||||
return ResultModel<RgvCommand6180Model>.Error("RgvUpdateInfoModel不能为空");
|
||||
}
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
var dBContext = scope.ServiceProvider.GetRequiredService<SqlDbContext>();
|
||||
var taskSet = dBContext.GetDbSet<TaskData6180Dto>();
|
||||
var unfinishedTask = await taskSet.AsNoTracking().FirstOrDefaultAsync(t => !t.IsFinished);
|
||||
|
||||
if (unfinishedTask == null)
|
||||
{
|
||||
_logger.LogInformation($"没有找到在执行的任务,不需要处理");
|
||||
return ResultModel<RgvCommand6180Model>.Error("没有找到在执行的任务,不需要处理");
|
||||
}
|
||||
var actionResult = ActionToList(unfinishedTask.Action); //转换动作列表
|
||||
if (actionResult == null)
|
||||
{
|
||||
_logger.LogError($"工艺未配置Action,请修改,taskId={unfinishedTask.Id}");
|
||||
return ResultModel<RgvCommand6180Model>.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<RgvCommand6180Model>.Error($"PLC反馈结果是NG,任务id={unfinishedTask.Id}");
|
||||
}
|
||||
else if (infoModel.TaskId != unfinishedTask.Id)
|
||||
{
|
||||
_logger.LogError($"PLC反馈结果任务号不匹配,plc任务号={infoModel.TaskId},执行任务id={unfinishedTask.Id}");
|
||||
return ResultModel<RgvCommand6180Model>.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<RgvCommand6180Model>.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<RgvCommand6180Model>.Error($"From1工站不存在,工站Id={unfinishedTask.FromStationId1}");
|
||||
}
|
||||
var toStation1 = stations.FirstOrDefault(x => x.Id == unfinishedTask.ToStationId1);
|
||||
if (toStation1 == null)
|
||||
{
|
||||
return ResultModel<RgvCommand6180Model>.Error($"To1工站不存在,工站Id={unfinishedTask.ToStationId1}");
|
||||
}
|
||||
var fromStation2 = stations.FirstOrDefault(x => x.Id == unfinishedTask.FromStationId2);
|
||||
if (unfinishedTask.FromStationId2 > 0 && fromStation2 == null)
|
||||
{
|
||||
return ResultModel<RgvCommand6180Model>.Error($"From2工站不存在,工站Id={unfinishedTask.FromStationId2}");
|
||||
}
|
||||
var toStation2 = stations.FirstOrDefault(x => x.Id == unfinishedTask.ToStationId2);
|
||||
if (unfinishedTask.ToStationId2 > 0 && toStation2 == null)
|
||||
{
|
||||
return ResultModel<RgvCommand6180Model>.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<RgvCommand6180Model>.Error($"PLC反馈动作不正确,PLC动作{infoModel.RetCmd},实际动作{(int)stepCommand}");
|
||||
}
|
||||
}
|
||||
|
||||
if (stepCommand == RgvCommand6180Enum.UnKnown && nextCommand == RgvCommand6180Enum.UnKnown)
|
||||
{
|
||||
_logger.LogError($"获取RGV命令失败,配置有误");
|
||||
return ResultModel<RgvCommand6180Model>.Error("获取RGV命令失败,配置有误");
|
||||
}
|
||||
|
||||
rgvCommand = new RgvCommand6180Model
|
||||
{
|
||||
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 == RgvCommand6180Enum.MoveFrom)
|
||||
{
|
||||
//更新rgv的目标位置
|
||||
var rgvService = scope.ServiceProvider.GetRequiredService<IRgv6180Service>();
|
||||
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 == RgvCommand6180Enum.MoveTo)
|
||||
{
|
||||
//更新rgv的目标位置
|
||||
var rgvService = scope.ServiceProvider.GetRequiredService<IRgv6180Service>();
|
||||
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 == RgvCommand6180Enum.UnKnown && nextCommand != RgvCommand6180Enum.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<IRgv6180Service>();
|
||||
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 == RgvCommand6180Enum.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 == RgvCommand6180Enum.Pick && nextCommand != RgvCommand6180Enum.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 == RgvCommand6180Enum.Place && nextCommand != RgvCommand6180Enum.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<IRgv6180Service>();
|
||||
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 == RgvCommand6180Enum.Place && nextCommand == RgvCommand6180Enum.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<RgvCommand6180Model>.Success(rgvCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ResultModel<RgvCommand6180Model>.Error($"任务更新异常,任务id={unfinishedTask.Id}");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, $"任务异常,任务id={unfinishedTask.Id}");
|
||||
return ResultModel<RgvCommand6180Model>.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<RgvFinished6180ParamData>(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 != RgvCommand6180Enum.UnKnown)
|
||||
{
|
||||
WcsToRgv6180Data wcsToRgv = new WcsToRgv6180Data
|
||||
{
|
||||
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<WcsToRgv6180Data>> ReadToRgvDataAsync(IReadWriteDevice driver, string address)
|
||||
{
|
||||
var readResult = await driver.ReadAsync(address, 60);
|
||||
if (!readResult.IsSuccess)
|
||||
{
|
||||
return ResultModel<WcsToRgv6180Data>.Error(readResult.Message);
|
||||
}
|
||||
WcsToRgv6180Data requestData = new WcsToRgv6180Data
|
||||
{
|
||||
Command = driver.ByteTransform.TransInt16(readResult.Content, 0),
|
||||
Count = driver.ByteTransform.TransInt16(readResult.Content, 14),
|
||||
TaskId = driver.ByteTransform.TransInt32(readResult.Content, 6)
|
||||
};
|
||||
return ResultModel<WcsToRgv6180Data>.Success(requestData);
|
||||
}
|
||||
|
||||
[LogAndSwallow]
|
||||
private async Task<ResultModel> WriteAsync(IReadWriteDevice driver, string address, WcsToRgv6180Data 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数据失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
using Cowain.Base.DBContext;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
@@ -15,70 +13,133 @@ 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 IMemoryCache _memoryCache;
|
||||
private readonly ILogger<FindFlowTaskService> _logger;
|
||||
public FindFlowTaskService(SqlDbContext dbContext, IServiceScopeFactory scopeFactory, IMemoryCache memoryCache, IDeviceMonitor deviceMonitor, IProcessService processService, ILogger<FindFlowTaskService> logger) : base(dbContext)
|
||||
|
||||
public FindFlowTaskService(IDbContextFactory<SqlDbContext> dbContextFactory, IServiceScopeFactory scopeFactory, IDeviceMonitor deviceMonitor, IProcessService processService, ILogger<FindFlowTaskService> logger) : base(dbContextFactory)
|
||||
{
|
||||
_memoryCache = memoryCache;
|
||||
_deviceMonitor = deviceMonitor;
|
||||
_processService = processService;
|
||||
_scopeFactory = scopeFactory;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task FindTaskAsync()
|
||||
/// <summary>
|
||||
/// 根据工站列表和流程工艺列表,构建所有可执行的候选任务
|
||||
/// </summary>
|
||||
private List<TaskDataDto> BuildCandidateTasks(List<StationDto> stations, List<ProcessFlowInfo> processAndFlows)
|
||||
{
|
||||
|
||||
var taskSet = _dBContext.GetDbSet<TaskDataDto>();
|
||||
var unfinishedTask = await taskSet.AsNoTracking().FirstOrDefaultAsync(t => !t.IsFinished);
|
||||
if (unfinishedTask != null)
|
||||
var candidateTasks = new List<TaskDataDto>();
|
||||
foreach (var item in processAndFlows)
|
||||
{
|
||||
_logger.LogInformation($"已有未完成的任务,任务ID:{unfinishedTask.Id},任务内容:{JsonConvert.SerializeObject(unfinishedTask)}");
|
||||
return;
|
||||
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;
|
||||
}
|
||||
|
||||
var processSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
var flowSet = _dBContext.GetDbSet<ProcessFlowDto>();
|
||||
var fromStationSet = _dBContext.GetDbSet<StationDto>();
|
||||
var toStationSet = _dBContext.GetDbSet<StationDto>();
|
||||
|
||||
var query = from fromStation in fromStationSet
|
||||
join process in processSet on fromStation.ProcessName equals process.Name
|
||||
join flow in flowSet on new { processId = process.Id, fromStation = fromStation.Id, fromStatus = fromStation.Status } equals new { processId = flow.ProcessId, fromStation = flow.FromStationId, fromStatus = flow.FromStatus }
|
||||
join toStation in toStationSet on new { process = process.Name, toStation = flow.ToStationId, toStatus = flow.ToStatus } equals new { process = toStation.ProcessName, toStation = toStation.Id, toStatus = toStation.Status }
|
||||
where fromStation.NextStationId <= 0 && fromStation.Enable && toStation.Enable
|
||||
orderby flow.Priority descending
|
||||
select new TaskDataDto
|
||||
{
|
||||
ProcessId = process.Id,
|
||||
ProcessName = process.Name,
|
||||
Priority = flow.Priority,
|
||||
ExecuteAction = 0,
|
||||
FromStationId = flow.FromStationId,
|
||||
ToStationId = flow.ToStationId,
|
||||
FromStatus = flow.FromStatus,
|
||||
ToStatus = flow.ToStatus,
|
||||
QrCode = fromStation.QrCode,
|
||||
IsFinished = false,
|
||||
Action = flow.Action,
|
||||
};
|
||||
string sql = query.ToQueryString();
|
||||
var findTask = await query.AsNoTracking().FirstOrDefaultAsync();
|
||||
if (findTask == null)
|
||||
/// <summary>
|
||||
/// 延时查询任务(非阻塞方式)
|
||||
/// </summary>
|
||||
private async Task DelayedQueryAsync(TaskDataDto originalTask)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation($"没有需要执行的任务");
|
||||
return;
|
||||
}
|
||||
await Task.Delay(10000).ConfigureAwait(false);
|
||||
_logger.LogInformation($"延时10秒后重新查询任务,原任务:{JsonConvert.SerializeObject(originalTask)}");
|
||||
|
||||
await taskSet.AddAsync(findTask);
|
||||
var saveCount = await _dBContext.SaveChangesAsync();
|
||||
// 使用新的作用域创建独立的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(findTask)}");
|
||||
var getJson = await _processService.GetJsonData(findTask.ProcessId);
|
||||
_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!);
|
||||
@@ -93,7 +154,6 @@ public class FindFlowTaskService : BaseService, IFindFlowTaskService
|
||||
{
|
||||
_logger.LogError(getJson.ErrorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -101,5 +161,156 @@ public class FindFlowTaskService : BaseService, IFindFlowTaskService
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,40 +5,44 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Plugin.Cowain.Wcs.IServices;
|
||||
using Plugin.Cowain.Wcs.Models.Dto;
|
||||
using Plugin.Cowain.Wcs.ViewModels;
|
||||
using System.Collections.ObjectModel;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Services;
|
||||
|
||||
public class ProcessFlowService : BaseService, IProcessFlowService
|
||||
{
|
||||
public ProcessFlowService(SqlDbContext dbContext) : base(dbContext)
|
||||
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
|
||||
{
|
||||
// 假设有DbContext和ProcessFlow实体
|
||||
var DbSet = _dBContext.GetDbSet<ProcessFlowDto>();
|
||||
|
||||
var entities = flows.Select(f => new ProcessFlowDto
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||
var entities = new List<ProcessFlowDto>();
|
||||
foreach (var f in flows)
|
||||
{
|
||||
ProcessId = processId,
|
||||
Priority = f.Priority,
|
||||
FromStationId = f.FromStationId,
|
||||
ToStationId = f.ToStationId,
|
||||
FromStatus = f.FromStatus,
|
||||
ToStatus = f.ToStatus,
|
||||
Action = JsonConvert.SerializeObject(f.Actions.Select(x => x.Action).ToList())
|
||||
}).ToList();
|
||||
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();
|
||||
var count = await dbContext.SaveChangesAsync();
|
||||
return count > 0 ? ResultModel.Success("流程数据添加成功") : ResultModel.Error("流程数据添加失败");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -47,19 +51,100 @@ public class ProcessFlowService : BaseService, IProcessFlowService
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
var dbSet = _dBContext.GetDbSet<ProcessFlowDto>();
|
||||
var entities = await dbSet.Where(x => x.ProcessId == processId).ToListAsync();
|
||||
if (entities.Count == 0)
|
||||
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.RemoveRange(entities);
|
||||
var count = await _dBContext.SaveChangesAsync();
|
||||
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)
|
||||
@@ -70,45 +155,74 @@ public class ProcessFlowService : BaseService, IProcessFlowService
|
||||
|
||||
public async Task<List<ProcessFlowViewModel>> GetAllAsync()
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessFlowDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||
var data = await DbSet.ToListAsync();
|
||||
return new List<ProcessFlowViewModel>(data.Select(x => new ProcessFlowViewModel
|
||||
var result = new List<ProcessFlowViewModel>();
|
||||
foreach (var x in data)
|
||||
{
|
||||
Id = x.Id,
|
||||
ProcessId = x.ProcessId,
|
||||
Priority = x.Priority,
|
||||
FromStationId = x.FromStationId,
|
||||
ToStationId = x.ToStationId,
|
||||
FromStatus = x.FromStatus,
|
||||
ToStatus = x.ToStatus,
|
||||
Action = x.Action
|
||||
}));
|
||||
// 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)
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessFlowDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||
var data = await DbSet.ToListAsync();
|
||||
var list = data.Skip((pageIndex - 1) * pageSize).Take(pageSize);
|
||||
return (new List<ProcessFlowViewModel>(list.Select(x => new ProcessFlowViewModel
|
||||
var result = new List<ProcessFlowViewModel>();
|
||||
foreach (var x in data)
|
||||
{
|
||||
Id = x.Id,
|
||||
ProcessId = x.ProcessId,
|
||||
Priority = x.Priority,
|
||||
FromStationId = x.FromStationId,
|
||||
ToStationId = x.ToStationId,
|
||||
FromStatus = x.FromStatus,
|
||||
ToStatus = x.ToStatus,
|
||||
Action = x.Action
|
||||
})), data.Count());
|
||||
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)
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessFlowDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<ProcessFlowDto>();
|
||||
IQueryable<ProcessFlowDto> query;
|
||||
|
||||
if (await DbSet.AnyAsync(x => x.ProcessId == processId))
|
||||
if (processId.HasValue && await DbSet.AnyAsync(x => x.ProcessId == processId))
|
||||
{
|
||||
query = DbSet.Where(x => x.ProcessId == processId);
|
||||
}
|
||||
@@ -117,23 +231,31 @@ public class ProcessFlowService : BaseService, IProcessFlowService
|
||||
query = DbSet;
|
||||
}
|
||||
|
||||
var totals = await query.CountAsync();
|
||||
var data = await query
|
||||
.OrderBy(x => x.Priority)
|
||||
.Skip((pageIndex - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToListAsync();
|
||||
var list = data.Select(x => new ProcessFlowViewModel
|
||||
var data = await query.OrderBy(x => x.Id).ToListAsync();
|
||||
var result = new List<ProcessFlowViewModel>();
|
||||
foreach (var x in data)
|
||||
{
|
||||
Id = x.Id,
|
||||
ProcessId = x.ProcessId,
|
||||
Priority = x.Priority,
|
||||
FromStationId = x.FromStationId,
|
||||
ToStationId = x.ToStationId,
|
||||
FromStatus = x.FromStatus,
|
||||
ToStatus = x.ToStatus,
|
||||
Action = x.Action
|
||||
}).ToList();
|
||||
return (list, totals);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Plugin.Cowain.Wcs.Services;
|
||||
|
||||
public class ProcessService : BaseService, IProcessService
|
||||
{
|
||||
public ProcessService(SqlDbContext dbContext) : base(dbContext)
|
||||
public ProcessService(IDbContextFactory<SqlDbContext> dbContextFactory) : base(dbContextFactory)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ public class ProcessService : BaseService, IProcessService
|
||||
{
|
||||
return ResultModel.Error("流程名称不能为空");
|
||||
}
|
||||
|
||||
var DbSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||
|
||||
// 检查名称是否已存在
|
||||
var exists = await DbSet.AnyAsync(x => x.Name == process.Name);
|
||||
@@ -45,7 +45,7 @@ public class ProcessService : BaseService, IProcessService
|
||||
UpdateTime = DateTime.Now
|
||||
};
|
||||
await DbSet.AddAsync(entity);
|
||||
var count = await _dBContext.SaveChangesAsync();
|
||||
var count = await dbContext.SaveChangesAsync();
|
||||
return count > 0 ? ResultModel.Success("流程添加成功") : ResultModel.Error("流程添加失败");
|
||||
}
|
||||
|
||||
@@ -55,14 +55,15 @@ public class ProcessService : BaseService, IProcessService
|
||||
{
|
||||
return ResultModel.Error("id cannot be null");
|
||||
}
|
||||
var processDbSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
var flowDbSet = _dBContext.GetDbSet<ProcessFlow6180Dto>();
|
||||
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();
|
||||
using var transaction = await dbContext.Database.BeginTransactionAsync();
|
||||
try
|
||||
{
|
||||
// 删除流程相关的流程流数据
|
||||
@@ -75,7 +76,7 @@ public class ProcessService : BaseService, IProcessService
|
||||
// 删除流程
|
||||
processDbSet.Remove(existingModel);
|
||||
|
||||
int count = await _dBContext.SaveChangesAsync();
|
||||
int count = await dbContext.SaveChangesAsync();
|
||||
await transaction.CommitAsync();
|
||||
return count > 0 ? ResultModel.Success("process delete successfully") : ResultModel.Error("process delete error");
|
||||
}
|
||||
@@ -92,14 +93,15 @@ public class ProcessService : BaseService, IProcessService
|
||||
{
|
||||
return ResultModel.Error("id cannot be null");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
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();
|
||||
await dbContext.SaveChangesAsync();
|
||||
return ResultModel.Success("device disable successfully");
|
||||
}
|
||||
|
||||
@@ -109,20 +111,22 @@ public class ProcessService : BaseService, IProcessService
|
||||
{
|
||||
return ResultModel.Error("id cannot be null");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
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();
|
||||
await dbContext.SaveChangesAsync();
|
||||
return ResultModel.Success("device enabled successfully");
|
||||
}
|
||||
|
||||
public async Task<ResultModel<RgvJsonModel>> GetJsonData(int id)
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||
var data = await DbSet.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (data == null)
|
||||
{
|
||||
@@ -151,7 +155,8 @@ public class ProcessService : BaseService, IProcessService
|
||||
|
||||
public async Task<List<ProcessViewModel>> GetAllAsync()
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<ProcessDto>();
|
||||
var data = await DbSet.ToListAsync();
|
||||
return new List<ProcessViewModel>(data.Select(x => new ProcessViewModel
|
||||
{
|
||||
@@ -167,7 +172,8 @@ public class ProcessService : BaseService, IProcessService
|
||||
|
||||
public async Task<(List<ProcessViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
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
|
||||
@@ -196,28 +202,25 @@ public class ProcessService : BaseService, IProcessService
|
||||
{
|
||||
return ResultModel.Error("流程名称不能为空");
|
||||
}
|
||||
|
||||
var DbSet = _dBContext.GetDbSet<ProcessDto>();
|
||||
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();
|
||||
var count = await dbContext.SaveChangesAsync();
|
||||
return count > 0 ? ResultModel.Success("流程更新成功") : ResultModel.Error("流程更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Plugin.Cowain.Wcs.Services;
|
||||
|
||||
public class RgvService : BaseService, IRgvService
|
||||
{
|
||||
public RgvService(SqlDbContext dbContext) : base(dbContext)
|
||||
public RgvService(IDbContextFactory<SqlDbContext> dbContextFactory) : base(dbContextFactory)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,32 +29,37 @@ public class RgvService : BaseService, IRgvService
|
||||
{
|
||||
return ResultModel.Error("Rgv编码不能为空");
|
||||
}
|
||||
var dbSet = _dBContext.GetDbSet<RgvDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var dbSet = dbContext.GetDbSet<RgvDto>();
|
||||
// 检查Name是否重复
|
||||
var nameExists = await dbSet.AnyAsync(x => x.Name == rgv.StationName);
|
||||
var nameExists = await dbSet.AnyAsync(x => x.StationName == rgv.StationName);
|
||||
if (nameExists)
|
||||
{
|
||||
return ResultModel.Error("Rgv名称已存在");
|
||||
}
|
||||
// 检查Code是否重复
|
||||
var codeExists = await dbSet.AnyAsync(x => x.Code == rgv.StationCode);
|
||||
var codeExists = await dbSet.AnyAsync(x => x.StationCode == rgv.StationCode);
|
||||
if (codeExists)
|
||||
{
|
||||
return ResultModel.Error("Rgv编码已存在");
|
||||
}
|
||||
var entity = new RgvDto
|
||||
{
|
||||
Name = rgv.StationName,
|
||||
Code = rgv.StationCode,
|
||||
StationName = rgv.StationName,
|
||||
StationCode = rgv.StationCode,
|
||||
Json = rgv.Json,
|
||||
LayOutX = rgv.LayOutX,
|
||||
LayOutY = rgv.LayOutY,
|
||||
FromStationId = rgv.FromStationId,
|
||||
ToStationId = rgv.ToStationId,
|
||||
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();
|
||||
await dbContext.SaveChangesAsync();
|
||||
return ResultModel.Success();
|
||||
}
|
||||
|
||||
@@ -64,14 +69,15 @@ public class RgvService : BaseService, IRgvService
|
||||
{
|
||||
return ResultModel.Error("id不能小于0");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<RgvDto>();
|
||||
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();
|
||||
int count = await dbContext.SaveChangesAsync();
|
||||
return count > 0 ? ResultModel.Success("rgv删除成功") : ResultModel.Error("rgv删除失败");
|
||||
}
|
||||
|
||||
@@ -85,7 +91,7 @@ public class RgvService : BaseService, IRgvService
|
||||
{
|
||||
return ResultModel.Error("ID不能小于0");
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(rgv.StationCode))
|
||||
if (string.IsNullOrWhiteSpace(rgv.StationName))
|
||||
{
|
||||
return ResultModel.Error("名称不能为空");
|
||||
}
|
||||
@@ -93,7 +99,8 @@ public class RgvService : BaseService, IRgvService
|
||||
{
|
||||
return ResultModel.Error("编码不能为空");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<RgvDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<RgvDto>();
|
||||
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == rgv.Id);
|
||||
if (existingModel == null)
|
||||
{
|
||||
@@ -101,53 +108,62 @@ public class RgvService : BaseService, IRgvService
|
||||
}
|
||||
|
||||
// 检查是否有同名工站(排除自己)
|
||||
var nameExists = await DbSet.AnyAsync(x => x.Name == rgv.StationName && x.Id != rgv.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.Code == rgv.StationCode && x.Id != rgv.Id);
|
||||
var codeExists = await DbSet.AnyAsync(x => x.StationCode == rgv.StationCode && x.Id != rgv.Id);
|
||||
if (codeExists)
|
||||
{
|
||||
return ResultModel.Error("编码已存在");
|
||||
}
|
||||
|
||||
// 更新字段
|
||||
existingModel.Name = rgv.StationName;
|
||||
existingModel.Code = rgv.StationCode;
|
||||
existingModel.StationName = rgv.StationName;
|
||||
existingModel.StationCode = rgv.StationCode;
|
||||
existingModel.Json = rgv.Json;
|
||||
existingModel.LayOutX = rgv.LayOutX;
|
||||
existingModel.LayOutY = rgv.LayOutY;
|
||||
existingModel.FromStationId = rgv.FromStationId;
|
||||
existingModel.ToStationId = rgv.ToStationId;
|
||||
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();
|
||||
var count = await dbContext.SaveChangesAsync();
|
||||
return count > 0 ? ResultModel.Success("rgv更新成功") : ResultModel.Error("rgv更新失败");
|
||||
}
|
||||
|
||||
public async Task<List<RgvViewModel>> GetAllAsync()
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<RgvDto>();
|
||||
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.Code,
|
||||
StationCode = x.StationCode,
|
||||
Json = x.Json,
|
||||
StationName = x.Name,
|
||||
StationName = x.StationName,
|
||||
LayOutX = x.LayOutX,
|
||||
LayOutY = x.LayOutY,
|
||||
FromStationId = x.FromStationId,
|
||||
ToStationId = x.ToStationId,
|
||||
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)
|
||||
{
|
||||
|
||||
var dbSet = _dBContext.GetDbSet<RgvDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var dbSet = dbContext.GetDbSet<RgvDto>();
|
||||
var query = dbSet.AsQueryable();
|
||||
|
||||
int totals = await query.CountAsync();
|
||||
@@ -160,13 +176,17 @@ public class RgvService : BaseService, IRgvService
|
||||
var list = data.Select(x => new RgvViewModel
|
||||
{
|
||||
Id = x.Id,
|
||||
StationCode = x.Code,
|
||||
StationCode = x.StationCode,
|
||||
Json = x.Json,
|
||||
StationName = x.Name,
|
||||
StationName = x.StationName,
|
||||
LayOutX = x.LayOutX,
|
||||
LayOutY = x.LayOutY,
|
||||
FromStationId = x.FromStationId,
|
||||
ToStationId = x.ToStationId,
|
||||
FromStationId1 = x.FromStationId1,
|
||||
ToStationId1 = x.ToStationId1,
|
||||
FromStationId2 = x.FromStationId2,
|
||||
ToStationId2 = x.ToStationId2,
|
||||
QrCode1 = x.QrCode1,
|
||||
QrCode2 = x.QrCode2,
|
||||
ProcessName = x.ProcessName,
|
||||
}).ToList();
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Cowain.Base.DBContext;
|
||||
using Cowain.Base.Helpers;
|
||||
using Cowain.Base.Models;
|
||||
using Cowain.Base.Services;
|
||||
using HslCommunication.Core;
|
||||
@@ -9,8 +8,6 @@ using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Plugin.Cowain.Driver.Abstractions;
|
||||
using Plugin.Cowain.Driver.Models.Enum;
|
||||
using Plugin.Cowain.Driver.ViewModels;
|
||||
using Plugin.Cowain.Wcs.Actions;
|
||||
using Plugin.Cowain.Wcs.IServices;
|
||||
using Plugin.Cowain.Wcs.Models;
|
||||
@@ -22,21 +19,35 @@ 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 ToStation { get; set; }
|
||||
public string QrCode { get; set; } = string.Empty;
|
||||
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(SqlDbContext dbContext, IDeviceMonitor deviceMonitor, IServiceScopeFactory scopeFactory, ILogger<RgvTaskService> logger) : base(dbContext)
|
||||
|
||||
public RgvTaskService(IDbContextFactory<SqlDbContext> dbContextFactory, IDeviceMonitor deviceMonitor, IServiceScopeFactory scopeFactory, ILogger<RgvTaskService> logger) : base(dbContextFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
_deviceMonitor = deviceMonitor;
|
||||
@@ -73,20 +84,22 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
{
|
||||
return ResultModel.Error("id不能小于0");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<TaskDataDto>();
|
||||
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();
|
||||
int count = await dbContext.SaveChangesAsync();
|
||||
return count > 0 ? ResultModel.Success("Task直接更新为结束") : ResultModel.Error("Task直接更新为结束失败");
|
||||
}
|
||||
|
||||
public async Task<List<TaskViewModel>> GetAllAsync()
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<TaskDataDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<TaskDataDto>();
|
||||
var data = await DbSet.ToListAsync();
|
||||
return new List<TaskViewModel>(data.Select(x => new TaskViewModel
|
||||
{
|
||||
@@ -94,25 +107,30 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
ProcessId = x.ProcessId,
|
||||
ProcessName = x.ProcessName,
|
||||
Priority = x.Priority,
|
||||
FromStationId = x.FromStationId,
|
||||
ToStationId = x.ToStationId,
|
||||
FromStatus = x.FromStatus,
|
||||
ToStatus = x.ToStatus,
|
||||
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,
|
||||
QrCode = x.QrCode,
|
||||
//Actions = new(ActionToList(x.Action) ?? new List<RgvActionViewModel>()),
|
||||
QrCode1 = x.QrCode1,
|
||||
QrCode2 = x.QrCode2,
|
||||
Action = x.Action
|
||||
}));
|
||||
}
|
||||
|
||||
public async Task<(List<TaskViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<TaskDataDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<TaskDataDto>();
|
||||
// 按照CreateTime倒序排列,最新的任务排第一个
|
||||
var data = await DbSet.OrderByDescending(x => x.CreateTime).ToListAsync();
|
||||
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
|
||||
{
|
||||
@@ -120,16 +138,21 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
ProcessId = x.ProcessId,
|
||||
ProcessName = x.ProcessName,
|
||||
Priority = x.Priority,
|
||||
FromStationId = x.FromStationId,
|
||||
ToStationId = x.ToStationId,
|
||||
FromStatus = x.FromStatus,
|
||||
ToStatus = x.ToStatus,
|
||||
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,
|
||||
QrCode = x.QrCode,
|
||||
Action = x.Action,
|
||||
QrCode1 = x.QrCode1,
|
||||
QrCode2 = x.QrCode2,
|
||||
Action = x.Action
|
||||
//Actions = new(ActionToList(x.Action) ?? new List<RgvActionViewModel>())
|
||||
}));
|
||||
|
||||
@@ -154,17 +177,24 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
_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.LogInformation($"PLC反馈结果是NG,任务id={unfinishedTask.Id}");
|
||||
_logger.LogError($"PLC反馈结果是NG,任务id={unfinishedTask.Id}");
|
||||
return ResultModel<RgvCommandModel>.Error($"PLC反馈结果是NG,任务id={unfinishedTask.Id}");
|
||||
}
|
||||
else if (infoModel.TaskId != unfinishedTask.Id)
|
||||
{
|
||||
_logger.LogInformation($"PLC反馈结果任务号不匹配,plc任务号={infoModel.TaskId},执行任务id={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;
|
||||
@@ -179,37 +209,41 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
if (infoModel.ExecuteAction > 0)
|
||||
{
|
||||
step = infoModel.ExecuteAction - 1;
|
||||
_logger.LogInformation($"手动下发任务,执行任务id={unfinishedTask.Id}:{GetStepAction(actions, step).ToString()}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"手动选择的动作不能为0");
|
||||
_logger.LogError($"手动选择的动作不能为0");
|
||||
return ResultModel<RgvCommandModel>.Error($"手动选择的动作不能为0");
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var actionResult = ActionToList(unfinishedTask.Action); //转换动作列表
|
||||
if (actionResult == null)
|
||||
{
|
||||
_logger.LogInformation($"工艺未配置Action,请修改,taskId={unfinishedTask.Id}");
|
||||
return ResultModel<RgvCommandModel>.Error($"工艺未配置Action,请修改,taskId={unfinishedTask.Id}");
|
||||
}
|
||||
var actions = actionResult;
|
||||
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 fromStation = stations.FirstOrDefault(x => x.Id == unfinishedTask.FromStationId);
|
||||
if (fromStation == null)
|
||||
var fromStation1 = stations.FirstOrDefault(x => x.Id == unfinishedTask.FromStationId1);
|
||||
if (fromStation1 == null)
|
||||
{
|
||||
return ResultModel<RgvCommandModel>.Error($"From工站不存在,工站Id={unfinishedTask.FromStationId}");
|
||||
return ResultModel<RgvCommandModel>.Error($"From1工站不存在,工站Id={unfinishedTask.FromStationId1}");
|
||||
}
|
||||
var toStation = stations.FirstOrDefault(x => x.Id == unfinishedTask.ToStationId);
|
||||
if (toStation == null)
|
||||
var toStation1 = stations.FirstOrDefault(x => x.Id == unfinishedTask.ToStationId1);
|
||||
if (toStation1 == null)
|
||||
{
|
||||
return ResultModel<RgvCommandModel>.Error($"To工站不存在,工站Id={unfinishedTask.ToStationId}");
|
||||
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}");
|
||||
}
|
||||
|
||||
//数据库存储的是上一步
|
||||
@@ -220,54 +254,29 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
{
|
||||
if (infoModel.RetCmd != (int)stepCommand)
|
||||
{
|
||||
_logger.LogInformation($"PLC反馈动作不正确,PLC动作{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.LogInformation($"获取RGV命令失败,配置有误");
|
||||
_logger.LogError($"获取RGV命令失败,配置有误");
|
||||
return ResultModel<RgvCommandModel>.Error("获取RGV命令失败,配置有误");
|
||||
}
|
||||
if (nextCommand == RgvCommandEnum.Move)
|
||||
{
|
||||
//下一步是移动
|
||||
var moveNextCommand = GetStepAction(actions, step + 2); //获取下一步动作
|
||||
if (moveNextCommand == RgvCommandEnum.UnKnown)
|
||||
{
|
||||
rgvCommand = new RgvCommandModel { Command = nextCommand, TargetPos = toStation.StationPos };
|
||||
}
|
||||
else if (moveNextCommand == RgvCommandEnum.PickIn || moveNextCommand == RgvCommandEnum.PickOut)
|
||||
{
|
||||
rgvCommand = new RgvCommandModel { Command = nextCommand, TargetPos = fromStation.StationPos };
|
||||
}
|
||||
else if (moveNextCommand == RgvCommandEnum.PlaceIn || moveNextCommand == RgvCommandEnum.PlaceOut)
|
||||
{
|
||||
rgvCommand = new RgvCommandModel { Command = nextCommand, TargetPos = toStation.StationPos };
|
||||
}
|
||||
}
|
||||
else if (nextCommand == RgvCommandEnum.PickIn || nextCommand == RgvCommandEnum.PickOut)
|
||||
{
|
||||
rgvCommand = new RgvCommandModel { Command = nextCommand, TargetPos = fromStation.StationPos };
|
||||
}
|
||||
else if (nextCommand == RgvCommandEnum.PlaceIn || nextCommand == RgvCommandEnum.PlaceOut)
|
||||
{
|
||||
rgvCommand = new RgvCommandModel { Command = nextCommand, TargetPos = toStation.StationPos };
|
||||
}
|
||||
else if (nextCommand == RgvCommandEnum.UnKnown)
|
||||
{
|
||||
//没有下一步动作,说明任务结束
|
||||
rgvCommand = new RgvCommandModel { Command = RgvCommandEnum.UnKnown };
|
||||
}
|
||||
|
||||
if (rgvCommand == null)
|
||||
rgvCommand = new RgvCommandModel
|
||||
{
|
||||
_logger.LogInformation($"获取RGV命令失败,配置有误");
|
||||
return ResultModel<RgvCommandModel>.Error("获取RGV命令失败,配置有误");
|
||||
}
|
||||
rgvCommand.QrCode = unfinishedTask.QrCode;
|
||||
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;
|
||||
@@ -276,50 +285,61 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
rgvName = getJson.Data!.RgvName;
|
||||
}
|
||||
//更新RGV
|
||||
if (stepCommand == RgvCommandEnum.Move)
|
||||
|
||||
if (stepCommand == RgvCommandEnum.MoveFrom)
|
||||
{
|
||||
if (nextCommand == RgvCommandEnum.PickIn || nextCommand == RgvCommandEnum.PickOut)
|
||||
//更新rgv的目标位置
|
||||
var rgvService = scope.ServiceProvider.GetRequiredService<IRgvService>();
|
||||
var rgvs = await rgvService.GetAllAsync();
|
||||
if (rgvs != null)
|
||||
{
|
||||
//更新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)
|
||||
{
|
||||
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||
if (rgv != null)
|
||||
{
|
||||
rgv.LayOutX = fromStation.LayOutX;
|
||||
await rgvService.UpdateAsync(rgv);
|
||||
}
|
||||
rgv.LayOutX = fromStation1.LayOutX;
|
||||
await rgvService.UpdateAsync(rgv);
|
||||
}
|
||||
}
|
||||
else if (nextCommand == RgvCommandEnum.PlaceIn || nextCommand == RgvCommandEnum.PlaceOut)
|
||||
}
|
||||
else if (stepCommand == RgvCommandEnum.MoveTo)
|
||||
{
|
||||
//更新rgv的目标位置
|
||||
var rgvService = scope.ServiceProvider.GetRequiredService<IRgvService>();
|
||||
var rgvs = await rgvService.GetAllAsync();
|
||||
if (rgvs != null)
|
||||
{
|
||||
//更新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)
|
||||
{
|
||||
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||
if (rgv != null)
|
||||
{
|
||||
rgv.LayOutX = toStation.LayOutX;
|
||||
await rgvService.UpdateAsync(rgv);
|
||||
}
|
||||
rgv.LayOutX = toStation1.LayOutX;
|
||||
await rgvService.UpdateAsync(rgv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//更新工站状态
|
||||
if (stepCommand == RgvCommandEnum.UnKnown && nextCommand == RgvCommandEnum.Move)
|
||||
if (stepCommand == RgvCommandEnum.UnKnown && nextCommand != RgvCommandEnum.UnKnown)
|
||||
{
|
||||
//【1】上一步未知,下一步是移动,任务刚开始
|
||||
fromStation.UpdateSource = StationUpdateSourceEnum.Task;
|
||||
fromStation.Status = StationStateEnum.Picking.ToString();
|
||||
toStation.UpdateSource = StationUpdateSourceEnum.Task;
|
||||
toStation.Status = StationStateEnum.Placing.ToString();
|
||||
stationQueueHostedService?.Enqueue(fromStation);
|
||||
stationQueueHostedService?.Enqueue(toStation);
|
||||
//【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();
|
||||
@@ -328,29 +348,56 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||
if (rgv != null)
|
||||
{
|
||||
rgv.FromStationId = fromStation.Id;
|
||||
rgv.ToStationId = toStation.Id;
|
||||
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 ((stepCommand == RgvCommandEnum.PickIn || stepCommand == RgvCommandEnum.PickOut) && nextCommand != RgvCommandEnum.PickIn && nextCommand != RgvCommandEnum.PickOut)
|
||||
else if (nextCommand == RgvCommandEnum.Place)
|
||||
{
|
||||
//【2】下一步要放料,将源QR复制到目标QR
|
||||
toStation.UpdateSource = StationUpdateSourceEnum.Task;
|
||||
toStation.QrCode = fromStation.QrCode;
|
||||
fromStation.Status = StationStateEnum.PickFinished.ToString();
|
||||
stationQueueHostedService?.Enqueue(fromStation);
|
||||
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.PlaceIn || stepCommand == RgvCommandEnum.PlaceOut) && nextCommand == RgvCommandEnum.UnKnown)
|
||||
else if (stepCommand == RgvCommandEnum.Pick && nextCommand != RgvCommandEnum.Pick)
|
||||
{
|
||||
//【3】上一步是放料动作,下一步无动作,说明任务结束
|
||||
toStation.UpdateSource = StationUpdateSourceEnum.Task;
|
||||
toStation.Status = StationStateEnum.PlaceFinished.ToString();
|
||||
stationQueueHostedService?.Enqueue(toStation);
|
||||
//【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)
|
||||
@@ -358,17 +405,19 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||
if (rgv != null)
|
||||
{
|
||||
rgv.FromStationId = 0;
|
||||
rgv.ToStationId = 0;
|
||||
rgv.FromStationId1 = 0;
|
||||
rgv.ToStationId1 = 0;
|
||||
rgv.FromStationId2 = 0;
|
||||
rgv.ToStationId2 = 0;
|
||||
rgv.ProcessName = "";
|
||||
await rgvService.UpdateAsync(rgv);
|
||||
}
|
||||
}
|
||||
}
|
||||
int save = 0;
|
||||
if (rgvCommand.Command == RgvCommandEnum.UnKnown)
|
||||
if (stepCommand == RgvCommandEnum.Place && nextCommand == RgvCommandEnum.UnKnown)
|
||||
{
|
||||
//没有目标动作,说明任务结束
|
||||
//任务结束
|
||||
unfinishedTask.IsFinished = true;
|
||||
unfinishedTask.FinishedTime = DateTime.Now;
|
||||
// 手动将实体状态标记为Modified
|
||||
@@ -436,21 +485,22 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
}
|
||||
//读数据
|
||||
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}");
|
||||
}
|
||||
|
||||
RgvUpdateInfoModel updateInfo = new RgvUpdateInfoModel
|
||||
{
|
||||
Source = source,
|
||||
TaskId = read.Data.TaskId,
|
||||
RetResult = read.Data.Result,
|
||||
RetCmd = read.Data.Command,
|
||||
ExecuteAction = execute == null ? 0 : execute.Value,
|
||||
};
|
||||
var rgvCommand = await GetRgvCommandAsync(updateInfo);
|
||||
var readToRgvData = await ReadToRgvDataAsync(plc, _param.CmdAddress);
|
||||
if (!readToRgvData.IsSuccess)
|
||||
{
|
||||
@@ -464,7 +514,6 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
count = 0;
|
||||
}
|
||||
count = count + 1 <= 100 ? (short)(count + 1) : (short)1; //最大100
|
||||
|
||||
if (rgvCommand.IsSuccess)
|
||||
{
|
||||
if (rgvCommand.Data!.Command != RgvCommandEnum.UnKnown)
|
||||
@@ -473,14 +522,19 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
{
|
||||
Command = (short)rgvCommand.Data!.Command,
|
||||
Count = count,
|
||||
ToStation = (short)rgvCommand.Data!.TargetPos,
|
||||
FromStation1 = (short)rgvCommand.Data!.FromPos1,
|
||||
FromStation2 = (short)rgvCommand.Data!.FromPos2,
|
||||
ToStation1 = (short)rgvCommand.Data!.TargetPos1,
|
||||
ToStation2 = (short)rgvCommand.Data!.TargetPos2,
|
||||
TaskId = rgvCommand.Data!.TaskId,
|
||||
QrCode = rgvCommand.Data!.QrCode,
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -500,7 +554,7 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
var readResult = await driver.ReadAsync(address, 10);
|
||||
if (!readResult.IsSuccess)
|
||||
{
|
||||
ResultModel<RgvToWcsData>.Error(readResult.Message);
|
||||
return ResultModel<RgvToWcsData>.Error(readResult.Message);
|
||||
}
|
||||
RgvToWcsData requestData = new RgvToWcsData
|
||||
{
|
||||
@@ -515,10 +569,10 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
[LogAndSwallow]
|
||||
private async Task<ResultModel<WcsToRgvData>> ReadToRgvDataAsync(IReadWriteDevice driver, string address)
|
||||
{
|
||||
var readResult = await driver.ReadAsync(address, 40);
|
||||
var readResult = await driver.ReadAsync(address, 60);
|
||||
if (!readResult.IsSuccess)
|
||||
{
|
||||
ResultModel<WcsToRgvData>.Error(readResult.Message);
|
||||
return ResultModel<WcsToRgvData>.Error(readResult.Message);
|
||||
}
|
||||
WcsToRgvData requestData = new WcsToRgvData
|
||||
{
|
||||
@@ -533,14 +587,20 @@ public class RgvTaskService : BaseService, IRgvTaskService
|
||||
private async Task<ResultModel> WriteAsync(IReadWriteDevice driver, string address, WcsToRgvData toRgvData, int retryCount = 5)
|
||||
{
|
||||
// 准备数据
|
||||
byte[] data = new byte[40];
|
||||
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.ToStation).CopyTo(data, 10);
|
||||
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.QrCode.Length;//字符串实际长度
|
||||
Encoding.ASCII.GetBytes(toRgvData.QrCode).CopyTo(data, 18);
|
||||
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();
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Plugin.Cowain.Wcs.Services;
|
||||
|
||||
public class StationService : BaseService, IStationService
|
||||
{
|
||||
public StationService(SqlDbContext dbContext) : base(dbContext)
|
||||
public StationService(IDbContextFactory<SqlDbContext> dbContextFactory) : base(dbContextFactory)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -30,9 +30,8 @@ public class StationService : BaseService, IStationService
|
||||
{
|
||||
return ResultModel.Error("工站编码不能为空");
|
||||
}
|
||||
|
||||
var dbSet = _dBContext.GetDbSet<StationDto>();
|
||||
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var dbSet = dbContext.GetDbSet<StationDto>();
|
||||
// 检查StationName是否重复
|
||||
var nameExists = await dbSet.AnyAsync(x => x.StationName == station.StationName);
|
||||
if (nameExists)
|
||||
@@ -63,7 +62,7 @@ public class StationService : BaseService, IStationService
|
||||
Enable = true,
|
||||
};
|
||||
await dbSet.AddAsync(entity);
|
||||
var count = await _dBContext.SaveChangesAsync();
|
||||
var count = await dbContext.SaveChangesAsync();
|
||||
return count > 0 ? ResultModel.Success("工站添加成功") : ResultModel.Error("工站添加失败");
|
||||
}
|
||||
|
||||
@@ -73,14 +72,15 @@ public class StationService : BaseService, IStationService
|
||||
{
|
||||
return ResultModel.Error("id不能小于0");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<StationDto>();
|
||||
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();
|
||||
int count = await dbContext.SaveChangesAsync();
|
||||
return count > 0 ? ResultModel.Success("工站删除成功") : ResultModel.Error("工站删除失败");
|
||||
}
|
||||
|
||||
@@ -90,14 +90,15 @@ public class StationService : BaseService, IStationService
|
||||
{
|
||||
return ResultModel.Error("id不能小于0");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<StationDto>();
|
||||
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();
|
||||
await dbContext.SaveChangesAsync();
|
||||
return ResultModel.Success("工站禁用成功");
|
||||
}
|
||||
|
||||
@@ -107,20 +108,22 @@ public class StationService : BaseService, IStationService
|
||||
{
|
||||
return ResultModel.Error("id不能小于0");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<StationDto>();
|
||||
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();
|
||||
await dbContext.SaveChangesAsync();
|
||||
return ResultModel.Success("工站启用成功");
|
||||
}
|
||||
|
||||
public async Task<List<StationViewModel>> GetAllAsync()
|
||||
{
|
||||
var DbSet = _dBContext.GetDbSet<StationDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<StationDto>();
|
||||
var data = await DbSet.ToListAsync();
|
||||
return new List<StationViewModel>(data.Select(x => new StationViewModel
|
||||
{
|
||||
@@ -145,8 +148,8 @@ public class StationService : BaseService, IStationService
|
||||
|
||||
public async Task<(List<StationViewModel>, int totals)> GetAllAsync(int pageIndex, int pageSize)
|
||||
{
|
||||
|
||||
var dbSet = _dBContext.GetDbSet<StationDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var dbSet = dbContext.GetDbSet<StationDto>();
|
||||
var query = dbSet.AsQueryable();
|
||||
|
||||
int totals = await query.CountAsync();
|
||||
@@ -197,7 +200,8 @@ public class StationService : BaseService, IStationService
|
||||
{
|
||||
return ResultModel.Error("工站编码不能为空");
|
||||
}
|
||||
var DbSet = _dBContext.GetDbSet<StationDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<StationDto>();
|
||||
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == satation.Id);
|
||||
if (existingModel == null)
|
||||
{
|
||||
@@ -240,7 +244,7 @@ public class StationService : BaseService, IStationService
|
||||
existingModel.Enable = satation.Enable;
|
||||
existingModel.UpdateTime = DateTime.Now;
|
||||
|
||||
var count = await _dBContext.SaveChangesAsync();
|
||||
var count = await dbContext.SaveChangesAsync();
|
||||
return count > 0 ? ResultModel.Success("工站更新成功") : ResultModel.Error("工站更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,17 +15,17 @@ 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(SqlDbContext dbContext, ILogger<WcsParamService> logger, IMemoryCache memoryCache) : base(dbContext)
|
||||
|
||||
public WcsParamService(IDbContextFactory<SqlDbContext> dbContextFactory, ILogger<WcsParamService> logger, IMemoryCache memoryCache) : base(dbContextFactory)
|
||||
{
|
||||
_memoryCache = memoryCache;
|
||||
_logger = logger;
|
||||
@@ -74,25 +74,26 @@ public class WcsParamService : BaseService, IWcsParamService
|
||||
|
||||
var paramLock = GetParamLock(viewModel.Name);
|
||||
await paramLock.WaitAsync();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var dbSet = _dBContext.GetDbSet<WcsParamDto>();
|
||||
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();
|
||||
|
||||
var count = await dbContext.SaveChangesAsync();
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
// 清除相关缓存
|
||||
@@ -116,23 +117,23 @@ public class WcsParamService : BaseService, IWcsParamService
|
||||
{
|
||||
return ResultModel.Error("id不能小于0");
|
||||
}
|
||||
|
||||
var DbSet = _dBContext.GetDbSet<WcsParamDto>();
|
||||
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();
|
||||
|
||||
int count = await dbContext.SaveChangesAsync();
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
// 清除相关缓存
|
||||
@@ -158,7 +159,7 @@ public class WcsParamService : BaseService, IWcsParamService
|
||||
}
|
||||
|
||||
string cacheKey = GetCacheKey(name);
|
||||
|
||||
|
||||
// 第一次尝试从缓存获取
|
||||
if (_memoryCache.TryGetValue(cacheKey, out WcsParamViewModel? cachedValue))
|
||||
{
|
||||
@@ -169,7 +170,7 @@ public class WcsParamService : BaseService, IWcsParamService
|
||||
// 缓存不存在,使用锁保护数据库查询和缓存更新
|
||||
var paramLock = GetParamLock(name);
|
||||
await paramLock.WaitAsync();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// 双重检查,防止在等待锁期间其他线程已经更新了缓存
|
||||
@@ -178,20 +179,20 @@ public class WcsParamService : BaseService, IWcsParamService
|
||||
_logger.LogInformation($"双重检查:从缓存获取参数 {name}: {cachedValue?.Param}");
|
||||
return ResultModel<WcsParamViewModel>.Success(cachedValue!);
|
||||
}
|
||||
|
||||
// 从数据库获取
|
||||
var DbSet = _dBContext.GetDbSet<WcsParamDto>();
|
||||
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 result = new WcsParamViewModel
|
||||
{
|
||||
Id = existingModel.Id,
|
||||
Name = existingModel.Name,
|
||||
Param = existingModel.Param
|
||||
};
|
||||
|
||||
// 将结果存入缓存
|
||||
@@ -201,7 +202,7 @@ public class WcsParamService : BaseService, IWcsParamService
|
||||
SlidingExpiration = CACHE_EXPIRATION
|
||||
};
|
||||
_memoryCache.Set(cacheKey, result, cacheOptions);
|
||||
|
||||
|
||||
_logger.LogInformation($"从数据库获取参数 {name}: {result.Param},已缓存");
|
||||
return ResultModel<WcsParamViewModel>.Success(result);
|
||||
}
|
||||
@@ -229,8 +230,8 @@ public class WcsParamService : BaseService, IWcsParamService
|
||||
{
|
||||
return ResultModel.Error("参数不能为空");
|
||||
}
|
||||
|
||||
var DbSet = _dBContext.GetDbSet<WcsParamDto>();
|
||||
using var dbContext = _dbContextFactory.CreateDbContext();
|
||||
var DbSet = dbContext.GetDbSet<WcsParamDto>();
|
||||
var existingModel = await DbSet.FirstOrDefaultAsync(x => x.Id == viewModel.Id);
|
||||
if (existingModel == null)
|
||||
{
|
||||
@@ -247,11 +248,11 @@ public class WcsParamService : BaseService, IWcsParamService
|
||||
// 记录旧名称,用于清除缓存
|
||||
string oldName = existingModel.Name;
|
||||
string newName = viewModel.Name;
|
||||
|
||||
|
||||
// 获取两个参数的锁(如果名称不同)
|
||||
var oldParamLock = GetParamLock(oldName);
|
||||
var newParamLock = oldName == newName ? oldParamLock : GetParamLock(newName);
|
||||
|
||||
|
||||
// 如果名称不同,需要同时获取两个锁,避免死锁
|
||||
if (oldName != newName)
|
||||
{
|
||||
@@ -264,14 +265,14 @@ public class WcsParamService : BaseService, IWcsParamService
|
||||
{
|
||||
await oldParamLock.WaitAsync();
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// 更新字段
|
||||
existingModel.Name = viewModel.Name;
|
||||
existingModel.Param = viewModel.Param;
|
||||
var count = await _dBContext.SaveChangesAsync();
|
||||
|
||||
var count = await dbContext.SaveChangesAsync();
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
// 清除相关缓存(包括旧名称和新名称)
|
||||
|
||||
@@ -59,7 +59,7 @@ public class WcsStartUpHostedService : IHostedService
|
||||
{
|
||||
if (bool.TryParse(findTaskEnableResult.Data!.Param, out bool findTaskEnable) && findTaskEnable)
|
||||
{
|
||||
var findFlowTaskService = scope.ServiceProvider.GetRequiredService<IFindFlowTask6180Service>();
|
||||
var findFlowTaskService = scope.ServiceProvider.GetRequiredService<IFindFlowTaskService>();
|
||||
await findFlowTaskService.FindTaskAsync();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
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.Driver.ViewModels;
|
||||
using Plugin.Cowain.Wcs.IServices;
|
||||
using Plugin.Cowain.Wcs.Models.Enum;
|
||||
using SixLabors.Fonts.Tables.AdvancedTypographic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Ursa.Controls;
|
||||
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
public partial class FlowManagement6180ViewModel : PageViewModelBase
|
||||
{
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<ProcessFlow6180ViewModel>? _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 IProcessFlow6180Service _flowService;
|
||||
private IStationService _stationService;
|
||||
private IProcessService _processService;
|
||||
private List<string> actions = new List<string>() { RgvCommand6180Enum.MoveFrom.ToString(), RgvCommand6180Enum.Pick.ToString(), RgvCommand6180Enum.MoveTo.ToString(), RgvCommand6180Enum.Place.ToString() };
|
||||
public FlowManagement6180ViewModel(ILocalizer localizer, IProcessService processService, IProcessFlow6180Service processFlowService, IStationService stationService)
|
||||
{
|
||||
PageSize = 20;
|
||||
_flowService = processFlowService;
|
||||
_processService = processService;
|
||||
_stationService = stationService;
|
||||
_l = localizer;
|
||||
FlowList = new ObservableCollection<ProcessFlow6180ViewModel>();
|
||||
// 异步调用刷新
|
||||
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 ProcessFlow6180ViewModel
|
||||
{
|
||||
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(ProcessFlow6180ViewModel? 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(ProcessFlow6180ViewModel? 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<ProcessFlow6180ViewModel> { 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<ProcessFlow6180ViewModel> { 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<ProcessFlow6180ViewModel>.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<ProcessFlow6180ViewModel>.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<ProcessFlow6180ViewModel>(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"]}
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,234 +0,0 @@
|
||||
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.Services;
|
||||
using Plugin.Cowain.Wcs.ViewModels.ProcessGraph;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
public partial class ProcessEdit6180DialogViewModel : ObservableObject, IDialogContext
|
||||
{
|
||||
private class FlowDataDto
|
||||
{
|
||||
public List<StationNode6180ViewModel> Nodes { get; set; } = new();
|
||||
public List<Connection6180ViewModel> Connections { get; set; } = new();
|
||||
}
|
||||
|
||||
|
||||
public NodifyObservableCollection<StationNode6180ViewModel> Nodes { get; } = new NodifyObservableCollection<StationNode6180ViewModel>();
|
||||
public NodifyObservableCollection<Connection6180ViewModel> Connections { get; } = new();
|
||||
|
||||
public PendingConnection6180ViewModel PendingConnection { get; }
|
||||
|
||||
public event EventHandler<object?>? RequestClose;
|
||||
[ObservableProperty]
|
||||
private StationNode6180ViewModel? _selectedNode;
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<StationNode6180ViewModel> _selectedNodes = new ObservableCollection<StationNode6180ViewModel>();
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
private Connection6180ViewModel? _selectedConnection;
|
||||
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Connection6180ViewModel> _selectedConnections = new ObservableCollection<Connection6180ViewModel>();
|
||||
|
||||
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>() { RgvCommand6180Enum.MoveFrom.ToString(), RgvCommand6180Enum.Pick.ToString(), RgvCommand6180Enum.MoveTo.ToString(), RgvCommand6180Enum.Place.ToString() };
|
||||
|
||||
|
||||
private IProcessFlow6180Service _processFlowService;
|
||||
public ProcessEdit6180DialogViewModel(List<StationViewModel>? stations, ProcessViewModel? process, IProcessFlow6180Service processFlowService)
|
||||
{
|
||||
Stations = stations;
|
||||
_process = process;
|
||||
_processFlowService = processFlowService;
|
||||
PendingConnection = new PendingConnection6180ViewModel(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(StationNode6180ViewModel 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 Connection6180ViewModel(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 Connection6180ViewModel(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 StationNode6180ViewModel { 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
public partial class ProcessFlow6180ViewModel : 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;
|
||||
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
using AspectInjector.Broker;
|
||||
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 Newtonsoft.Json;
|
||||
using Plugin.Cowain.Wcs.IServices;
|
||||
using Plugin.Cowain.Wcs.Services;
|
||||
using Plugin.Cowain.Wcs.Views;
|
||||
using System.Collections.ObjectModel;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels
|
||||
{
|
||||
public partial class ProcessManagement6180ViewModel : 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 IProcessFlow6180Service _processFlowService;
|
||||
private readonly ILogger<ProcessManagement6180ViewModel> _logger;
|
||||
public ProcessManagement6180ViewModel(ILocalizer localizer, IProcessService processService, IStationService stationService, IProcessFlow6180Service processFlowService, ILogger<ProcessManagement6180ViewModel> 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();
|
||||
ProcessEdit6180DialogViewModel deviceModel = new ProcessEdit6180DialogViewModel(stations, process, _processFlowService);
|
||||
var deviceEditDialog = await Dialog.ShowCustomModal<ProcessEdit6180Dialog, ProcessEdit6180DialogViewModel, 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<ProcessFlow6180ViewModel>();
|
||||
var flowsToAdd = new List<ProcessFlow6180ViewModel>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using Avalonia;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
public partial class Rgv6180ViewModel : 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;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
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 Plugin.Cowain.Wcs.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
public partial class RgvManagement6180ViewModel : PageViewModelBase
|
||||
{
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Rgv6180ViewModel>? _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 IRgv6180Service _rgvService;
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
public RgvManagement6180ViewModel(ILocalizer localizer, IRgv6180Service rgvService, IStationService stationService, IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_l = localizer;
|
||||
_scopeFactory = scopeFactory;
|
||||
_rgvService = rgvService;
|
||||
_stationService = stationService;
|
||||
PageSize = 10;
|
||||
PageIndex = 1;
|
||||
RgvList = new ObservableCollection<Rgv6180ViewModel>();
|
||||
// 异步调用刷新
|
||||
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 Rgv6180ViewModel { StationName = "请命名", StationCode = "请命名" });
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task DeleteAsync(Rgv6180ViewModel? 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(Rgv6180ViewModel? 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"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
public partial class Task6180ViewModel : 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;
|
||||
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
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 WcsRealStation6180ViewModel : PageViewModelBase
|
||||
{
|
||||
[ObservableProperty]
|
||||
private double _cellWidthSize = 130;
|
||||
[ObservableProperty]
|
||||
private double _cellHeightSize = 60;
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<StationViewModel>? _stations;
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Task6180ViewModel> _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 WcsRealStation6180ViewModel(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<IRgvTask6180Service>();
|
||||
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<IRgv6180Service>();
|
||||
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<Rgv6180ViewModel>().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 Rgv6180ViewModel 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
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 WcsTaskList6180ViewModel : PageViewModelBase
|
||||
{
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Task6180ViewModel>? _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 WcsTaskList6180ViewModel(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<IFindFlowTask6180Service>();
|
||||
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<IRgvTask6180Service>();
|
||||
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(Task6180ViewModel? viewModel) => viewModel is not null && !viewModel.IsFinished;
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanEdit))]
|
||||
private async Task RetryAsync(Task6180ViewModel? 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<IRgvTask6180Service>();
|
||||
var execute = await taskService.ExecuteAsync(taskJsonParam.Data, RgvUpdateSourceEnum.User, viewModel.SelectedAction?.Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanEdit))]
|
||||
private async Task FinishAsync(Task6180ViewModel? 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<IRgvTask6180Service>();
|
||||
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<IRgv6180Service>();
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
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 Avalonia.Collections;
|
||||
using Plugin.Cowain.Wcs.Services;
|
||||
using Ursa.Controls;
|
||||
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
@@ -33,6 +37,7 @@ public partial class FlowManagementViewModel : PageViewModelBase
|
||||
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;
|
||||
@@ -56,6 +61,8 @@ public partial class FlowManagementViewModel : PageViewModelBase
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -72,7 +79,182 @@ public partial class FlowManagementViewModel : PageViewModelBase
|
||||
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"]}
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
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;
|
||||
@@ -21,7 +24,7 @@ public partial class ProcessEditDialogViewModel : ObservableObject, IDialogConte
|
||||
|
||||
|
||||
public NodifyObservableCollection<StationNodeViewModel> Nodes { get; } = new NodifyObservableCollection<StationNodeViewModel>();
|
||||
public NodifyObservableCollection<ConnectionViewModel> Connections { get; } = new NodifyObservableCollection<ConnectionViewModel>();
|
||||
public NodifyObservableCollection<ConnectionViewModel> Connections { get; } = new();
|
||||
|
||||
public PendingConnectionViewModel PendingConnection { get; }
|
||||
|
||||
@@ -50,22 +53,28 @@ public partial class ProcessEditDialogViewModel : ObservableObject, IDialogConte
|
||||
|
||||
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() };
|
||||
|
||||
|
||||
public ProcessEditDialogViewModel(List<StationViewModel>? stations, ProcessViewModel? process)
|
||||
private IProcessFlowService _processFlowService;
|
||||
public ProcessEditDialogViewModel(List<StationViewModel>? stations, ProcessViewModel? process, IProcessFlowService processFlowService)
|
||||
{
|
||||
Stations = stations;
|
||||
_process = process;
|
||||
InitFlowData();
|
||||
_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>
|
||||
@@ -81,12 +90,10 @@ public partial class ProcessEditDialogViewModel : ObservableObject, IDialogConte
|
||||
public void Connect(ConnectorViewModel source, ConnectorViewModel target)
|
||||
{
|
||||
var conn = new ConnectionViewModel(source, target);
|
||||
|
||||
|
||||
|
||||
Connections.Add(conn);
|
||||
}
|
||||
private void InitFlowData()
|
||||
|
||||
private async Task InitFlowDataAsync()
|
||||
{
|
||||
if (_process == null || string.IsNullOrWhiteSpace(_process.FlowData))
|
||||
return;
|
||||
@@ -101,7 +108,8 @@ public partial class ProcessEditDialogViewModel : ObservableObject, IDialogConte
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -114,10 +122,30 @@ public partial class ProcessEditDialogViewModel : ObservableObject, IDialogConte
|
||||
// 这里假设连接都是 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)
|
||||
{
|
||||
@@ -146,9 +174,9 @@ public partial class ProcessEditDialogViewModel : ObservableObject, IDialogConte
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void AddStation()
|
||||
private void AddStation(Point point)
|
||||
{
|
||||
Nodes.Add(new StationNodeViewModel());
|
||||
Nodes.Add(new StationNodeViewModel { Location = point });
|
||||
}
|
||||
|
||||
public void Close()
|
||||
@@ -156,30 +184,6 @@ public partial class ProcessEditDialogViewModel : ObservableObject, IDialogConte
|
||||
RequestClose?.Invoke(this, false);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void AddAction()
|
||||
{
|
||||
if (SelectedConnection == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SelectedConnection.ProcessFlow.Actions.Add(new ProcessActionViewModel());
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void DeleteAction(int selectIndex)
|
||||
{
|
||||
if (SelectedConnection == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (selectIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SelectedConnection.ProcessFlow.Actions.RemoveAt(selectIndex);
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private void Ok()
|
||||
@@ -191,8 +195,19 @@ public partial class ProcessEditDialogViewModel : ObservableObject, IDialogConte
|
||||
// 设置工艺流转的起止工站ID
|
||||
if (conn.ProcessFlow != null)
|
||||
{
|
||||
conn.ProcessFlow.FromStationId = conn.Source.NodeId == Guid.Empty ? 0 : Nodes.FirstOrDefault(n => n.Id == conn.Source.NodeId)?.StationId ?? 0;
|
||||
conn.ProcessFlow.ToStationId = conn.Target.NodeId == Guid.Empty ? 0 : Nodes.FirstOrDefault(n => n.Id == conn.Target.NodeId)?.StationId ?? 0;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
@@ -13,16 +12,24 @@ public partial class ProcessFlowViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private int _priority;
|
||||
[ObservableProperty]
|
||||
private int _fromStationId;
|
||||
private int _fromStationId1;
|
||||
[ObservableProperty]
|
||||
private int _toStationId;
|
||||
private int _toStationId1;
|
||||
[ObservableProperty]
|
||||
private string _fromStatus = string.Empty;
|
||||
private string _fromStatus1 = string.Empty;
|
||||
[ObservableProperty]
|
||||
private string _toStatus = string.Empty;
|
||||
private string _toStatus1 = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<ProcessActionViewModel> _actions = new();
|
||||
private int _fromStationId2;
|
||||
[ObservableProperty]
|
||||
private string _action= string.Empty;
|
||||
private int _toStationId2;
|
||||
[ObservableProperty]
|
||||
private string _fromStatus2 = string.Empty;
|
||||
[ObservableProperty]
|
||||
private string _toStatus2 = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _action = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
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 Connection6180ViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool _isSelected;
|
||||
|
||||
[ObservableProperty]
|
||||
private ProcessFlow6180ViewModel _processFlow = new ProcessFlow6180ViewModel
|
||||
{
|
||||
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 Connection6180ViewModel(ConnectorViewModel source, ConnectorViewModel target)
|
||||
{
|
||||
Source = source;
|
||||
Target = target;
|
||||
Source.IsConnected = true;
|
||||
Target.IsConnected = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Plugin.Cowain.Wcs.Models.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -13,7 +14,14 @@ public partial class ConnectionViewModel : ObservableObject
|
||||
private bool _isSelected;
|
||||
|
||||
[ObservableProperty]
|
||||
private ProcessFlowViewModel _processFlow = new ProcessFlowViewModel();
|
||||
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; }
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels.ProcessGraph;
|
||||
|
||||
public class PendingConnection6180ViewModel
|
||||
{
|
||||
private readonly ProcessEdit6180DialogViewModel _editor;
|
||||
private ConnectorViewModel? _source;
|
||||
|
||||
public PendingConnection6180ViewModel(ProcessEdit6180DialogViewModel 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; }
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using Avalonia;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Cowain.Base.Helpers;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels.ProcessGraph;
|
||||
|
||||
public partial class StationNode6180ViewModel : 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 StationNode6180ViewModel()
|
||||
{
|
||||
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 = "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,13 +9,22 @@ public partial class StationNodeViewModel : ObservableObject
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[ObservableProperty]
|
||||
private int _stationId;
|
||||
private int _station1Id;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _stationName = "no station";
|
||||
private string? _station1Name = "未选择";
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _stationCode = "no station";
|
||||
private string? _station1Code = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private int? _station2Id;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _station2Name = "未选择";
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _station2Code = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private Point _location;
|
||||
@@ -35,7 +44,7 @@ public partial class StationNodeViewModel : ObservableObject
|
||||
}
|
||||
|
||||
|
||||
partial void OnStationIdChanged(int value)
|
||||
partial void OnStation1IdChanged(int value)
|
||||
{
|
||||
|
||||
|
||||
@@ -44,12 +53,34 @@ public partial class StationNodeViewModel : ObservableObject
|
||||
var station = stations.FirstOrDefault(x => x.Id == value);
|
||||
if (station != null)
|
||||
{
|
||||
StationName = station.StationName;
|
||||
StationCode = station.StationCode;
|
||||
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 = "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,11 +5,10 @@ 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.Services;
|
||||
using Plugin.Cowain.Wcs.Views;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels
|
||||
@@ -29,14 +28,15 @@ namespace Plugin.Cowain.Wcs.ViewModels
|
||||
private IProcessService _processService;
|
||||
private IStationService _stationService;
|
||||
private IProcessFlowService _processFlowService;
|
||||
|
||||
public ProcessManagementViewModel(ILocalizer localizer, IProcessService processService, IStationService stationService, 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);
|
||||
@@ -84,34 +84,72 @@ namespace Plugin.Cowain.Wcs.ViewModels
|
||||
CanResize = true,
|
||||
};
|
||||
var stations = await _stationService.GetAllAsync();
|
||||
ProcessEditDialogViewModel deviceModel = new ProcessEditDialogViewModel(stations, process);
|
||||
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 delete = await _processFlowService.DeleteAsync(process.Id);
|
||||
if (!delete.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)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Edit.Error"] + ":" + add.ErrorMessage);
|
||||
return;
|
||||
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);
|
||||
}
|
||||
}
|
||||
var addFlow = await _processFlowService.AddAsync(process.Id, deviceModel.Connections.Select(x => x.ProcessFlow).ToList());
|
||||
if (!addFlow.IsSuccess)
|
||||
|
||||
// 先更新已存在的流程
|
||||
if (flowsToUpdate.Count > 0)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Edit.Error"] + ":" + add.ErrorMessage);
|
||||
return;
|
||||
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;
|
||||
}
|
||||
}
|
||||
await RefreshAsync(1);
|
||||
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]
|
||||
@@ -126,15 +164,23 @@ namespace Plugin.Cowain.Wcs.ViewModels
|
||||
{
|
||||
return;
|
||||
}
|
||||
var deleteDevice = await _processService.DeleteAsync(process.Id);
|
||||
if (deleteDevice.IsSuccess)
|
||||
try
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["ProcessManagement.Delete.Success"]);
|
||||
ProcessList?.Remove(process);
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Delete.Error"] + ":" + deleteDevice.ErrorMessage);
|
||||
NotificationHelper.ShowNormal(NotificationType.Error, _l["ProcessManagement.Delete.Error"] + ":" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +202,7 @@ namespace Plugin.Cowain.Wcs.ViewModels
|
||||
var add = await _processService.AddAsync(process);
|
||||
if (add.IsSuccess)
|
||||
{
|
||||
_logger.LogInformation($"新增工艺:{process.Name}");
|
||||
await RefreshAsync(1);
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["ProcessManagement.Add.Success"]);
|
||||
}
|
||||
@@ -170,6 +217,7 @@ namespace Plugin.Cowain.Wcs.ViewModels
|
||||
var update = await _processService.UpdateAsync(process);
|
||||
if (update.IsSuccess)
|
||||
{
|
||||
_logger.LogInformation($"更改工艺:{process.Name}");
|
||||
NotificationHelper.ShowNormal(NotificationType.Success, _l["ProcessManagement.Update.Success"]);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -6,7 +6,6 @@ using Cowain.Base.ViewModels;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Plugin.Cowain.Wcs.IServices;
|
||||
using Plugin.Cowain.Wcs.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
using Ursa.Controls;
|
||||
|
||||
|
||||
@@ -7,10 +7,7 @@ public partial class RgvViewModel : LayoutViewModel
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string _processName = string.Empty;
|
||||
[ObservableProperty]
|
||||
private int _fromStationId;
|
||||
[ObservableProperty]
|
||||
private int _toStationId;
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
private float _positionX;
|
||||
@@ -22,10 +19,32 @@ public partial class RgvViewModel : LayoutViewModel
|
||||
private float _positionZ;
|
||||
|
||||
[ObservableProperty]
|
||||
private Point? _fromStationPoint;
|
||||
private int _fromStationId1;
|
||||
[ObservableProperty]
|
||||
private int _toStationId1;
|
||||
|
||||
[ObservableProperty]
|
||||
private Point? _toStationPoint;
|
||||
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;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
@@ -19,18 +18,32 @@ public partial class TaskViewModel : ObservableObject
|
||||
private int _priority;
|
||||
|
||||
[ObservableProperty]
|
||||
private int _fromStationId;
|
||||
private int _fromStationId1;
|
||||
[ObservableProperty]
|
||||
private int _toStationId;
|
||||
private int _toStationId1;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _fromStatus = string.Empty;
|
||||
private string _fromStatus1 = string.Empty;
|
||||
[ObservableProperty]
|
||||
private string _toStatus = string.Empty;
|
||||
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 _qrCode = string.Empty;
|
||||
private string _qrCode1 = string.Empty;
|
||||
[ObservableProperty]
|
||||
private string _qrCode2 = string.Empty;
|
||||
[ObservableProperty]
|
||||
private int _executeAction;
|
||||
|
||||
|
||||
@@ -6,14 +6,16 @@ using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Plugin.Cowain.Wcs.IServices;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.ViewModels;
|
||||
|
||||
|
||||
public partial class WcsRealStationViewModel : PageViewModelBase
|
||||
{
|
||||
public const double CellSize = 110;
|
||||
[ObservableProperty]
|
||||
private double _cellWidthSize = 130;
|
||||
[ObservableProperty]
|
||||
private double _cellHeightSize = 60;
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<StationViewModel>? _stations;
|
||||
[ObservableProperty]
|
||||
@@ -26,23 +28,25 @@ public partial class WcsRealStationViewModel : PageViewModelBase
|
||||
private int _width = 1000;
|
||||
|
||||
|
||||
private readonly DispatcherTimer _timer = new() { Interval = new TimeSpan(0, 0, 0, 2, 0) };
|
||||
private readonly ILocalizer _l;
|
||||
private IServiceScopeFactory _scopeFactory;
|
||||
private bool _isProcessing;
|
||||
|
||||
public WcsRealStationViewModel(ILocalizer localizer, IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_l = localizer;
|
||||
_scopeFactory = scopeFactory;
|
||||
RefreshCommand.ExecuteAsync(1);
|
||||
//暂时使用定时器,后面改成工站状态改变时刷新
|
||||
_timer.Tick += async delegate { await RefreshAsync(); };
|
||||
_timer.Start();
|
||||
DispatcherTimer.Run(new Func<bool>(() =>
|
||||
{
|
||||
RefreshCommand.ExecuteAsync(1);
|
||||
return true;
|
||||
}), TimeSpan.FromSeconds(1), DispatcherPriority.Default);
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private async Task RefreshAsync()
|
||||
private async Task RefreshAsync(int pageIndex)
|
||||
{
|
||||
if (_isProcessing)
|
||||
return;
|
||||
@@ -60,7 +64,7 @@ public partial class WcsRealStationViewModel : PageViewModelBase
|
||||
var taskService = scope.ServiceProvider.GetRequiredService<IRgvTaskService>();
|
||||
var taskList = await taskService.GetAllAsync();
|
||||
TaskList.Clear();
|
||||
foreach (var item in taskList.OrderByDescending(x => x.Id).Take(3))
|
||||
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);
|
||||
@@ -87,6 +91,7 @@ public partial class WcsRealStationViewModel : PageViewModelBase
|
||||
exist.StationCode = station.StationCode;
|
||||
exist.Status = station.Status;
|
||||
exist.QrCode = station.QrCode;
|
||||
exist.ProcessName = station.ProcessName;
|
||||
// 可同步更多属性
|
||||
}
|
||||
else
|
||||
@@ -107,29 +112,40 @@ public partial class WcsRealStationViewModel : PageViewModelBase
|
||||
foreach (var rgv in rgvs)
|
||||
{
|
||||
// 计算FromStationPoint
|
||||
var fromStation = stations.FirstOrDefault(s => s.Id == rgv.FromStationId);
|
||||
var fromStation = stations.FirstOrDefault(s => s.Id == rgv.FromStationId1);
|
||||
if (fromStation != null)
|
||||
{
|
||||
double x = fromStation.LayOutX * CellSize + CellSize / 2;
|
||||
double y = fromStation.LayOutY * CellSize + CellSize / 2;
|
||||
rgv.FromStationPoint = new Avalonia.Point(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
rgv.FromStationPoint = 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.ToStationId);
|
||||
var toStation = stations.FirstOrDefault(s => s.Id == rgv.ToStationId1);
|
||||
if (toStation != null)
|
||||
{
|
||||
double x = toStation.LayOutX * CellSize + CellSize / 2;
|
||||
double y = toStation.LayOutY * CellSize + CellSize / 2;
|
||||
rgv.ToStationPoint = new Avalonia.Point(x, y);
|
||||
double x = toStation.LayOutX * CellWidthSize + CellWidthSize / 2;
|
||||
double y = toStation.LayOutY * CellHeightSize + CellHeightSize / 2;
|
||||
rgv.ToStationPoint1 = new Avalonia.Point(x, y);
|
||||
}
|
||||
else
|
||||
|
||||
// 计算FromStationPoint
|
||||
var fromStation2 = stations.FirstOrDefault(s => s.Id == rgv.FromStationId2);
|
||||
if (fromStation2 != null)
|
||||
{
|
||||
rgv.ToStationPoint = 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)
|
||||
@@ -137,11 +153,13 @@ public partial class WcsRealStationViewModel : PageViewModelBase
|
||||
exist.LayOutX = rgv.LayOutX;
|
||||
exist.LayOutY = rgv.LayOutY;
|
||||
exist.StationName = rgv.StationName;
|
||||
exist.FromStationId = rgv.FromStationId;
|
||||
exist.StationCode = rgv.StationCode;
|
||||
exist.ToStationId = rgv.ToStationId;
|
||||
exist.FromStationPoint = rgv.FromStationPoint;
|
||||
exist.ToStationPoint = rgv.ToStationPoint;
|
||||
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
|
||||
{
|
||||
@@ -160,19 +178,19 @@ public partial class WcsRealStationViewModel : PageViewModelBase
|
||||
.Select(e => e.LayOutX)
|
||||
.DefaultIfEmpty(0)
|
||||
.Max();
|
||||
Width = (int)(maxRow + 1) * (int)CellSize;
|
||||
Width = (int)(maxRow + 1) * (int)CellWidthSize;
|
||||
|
||||
double maxCol = LayoutList
|
||||
.Select(e => e.LayOutY)
|
||||
.DefaultIfEmpty(0)
|
||||
.Max();
|
||||
Height = (int)(maxCol + 1) * (int)CellSize;
|
||||
Height = (int)(maxCol + 1) * (int)CellHeightSize;
|
||||
|
||||
// 示例:随机移动 RGV1
|
||||
//var rgv1 = LayoutList.OfType<RgvViewModel>().FirstOrDefault(x => x.Id == 1);
|
||||
//var rgv1 = LayoutList.OfType<Rgv6180ViewModel>().FirstOrDefault(x => x.Id == 1);
|
||||
//if (rgv1 != null)
|
||||
//{
|
||||
// rgv1.LayOutX = new Random().Next(0, 10);
|
||||
// rgv1.LayOutX = new Random().Next(0, 7);
|
||||
//}
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -6,10 +6,8 @@ using Cowain.Base.ViewModels;
|
||||
using Ke.Bee.Localization.Localizer.Abstractions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Plugin.Cowain.Driver.Abstractions;
|
||||
using Plugin.Cowain.Driver.Actions;
|
||||
using Plugin.Cowain.Wcs.IServices;
|
||||
using Plugin.Cowain.Wcs.Models.Enum;
|
||||
using Plugin.Cowain.Wcs.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
using Ursa.Controls;
|
||||
|
||||
@@ -25,6 +23,9 @@ public partial class WcsTaskListViewModel : PageViewModelBase
|
||||
[ObservableProperty]
|
||||
private WcsParamViewModel? _findTaskOnStartUp;
|
||||
|
||||
[ObservableProperty]
|
||||
private WcsParamViewModel? _findTaskEnable;
|
||||
|
||||
[ObservableProperty]
|
||||
private int _totals;
|
||||
[ObservableProperty]
|
||||
@@ -59,6 +60,12 @@ public partial class WcsTaskListViewModel : PageViewModelBase
|
||||
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
|
||||
@@ -67,6 +74,21 @@ public partial class WcsTaskListViewModel : PageViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
[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)
|
||||
{
|
||||
@@ -83,6 +105,15 @@ public partial class WcsTaskListViewModel : PageViewModelBase
|
||||
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);
|
||||
@@ -96,6 +127,7 @@ public partial class WcsTaskListViewModel : PageViewModelBase
|
||||
item.SelectedAction = item.Actions.FirstOrDefault(x => x.Id == item.ExecuteAction);
|
||||
TaskList?.Add(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -166,8 +198,10 @@ public partial class WcsTaskListViewModel : PageViewModelBase
|
||||
var rgv = rgvs.FirstOrDefault(x => x.StationName == rgvName);
|
||||
if (rgv != null)
|
||||
{
|
||||
rgv.FromStationId = 0;
|
||||
rgv.ToStationId = 0;
|
||||
rgv.FromStationId1 = 0;
|
||||
rgv.ToStationId1 = 0;
|
||||
rgv.FromStationId2 = 0;
|
||||
rgv.ToStationId2 = 0;
|
||||
await rgvService.UpdateAsync(rgv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,391 +0,0 @@
|
||||
<UserControl
|
||||
x:Class="Plugin.Cowain.Wcs.Views.FlowManagement6180View"
|
||||
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:FlowManagement6180ViewModel.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:FlowManagement6180ViewModel.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:FlowManagement6180ViewModel.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:FlowManagement6180ViewModel.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>
|
||||
@@ -1,13 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Views;
|
||||
|
||||
public partial class FlowManagement6180View : UserControl
|
||||
{
|
||||
public FlowManagement6180View()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -1,355 +0,0 @@
|
||||
<UserControl
|
||||
x:Class="Plugin.Cowain.Wcs.Views.ProcessEdit6180Dialog"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="using:Cowain.Base.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:extensions="using:Cowain.Base.Extensions"
|
||||
xmlns:helper="using:Cowain.Base.Helpers"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:local="using:Plugin.Cowain.Wcs.ViewModels.ProcessGraph"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:nodify="https://miroiu.github.io/nodify"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Plugin.Cowain.Wcs.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.KeyBindings>
|
||||
<KeyBinding Command="{Binding DisconnectConnectorCommand}" Gesture="Delete" />
|
||||
</UserControl.KeyBindings>
|
||||
|
||||
<UserControl.Resources>
|
||||
<helper:BindingProxy x:Key="EditorProxy" DataContext="{Binding}" />
|
||||
<helper:BindingProxy x:Key="StationsProxy" DataContext="{Binding Stations}" />
|
||||
<conv:I18nLocalizeConverter x:Key="i18nConverter" />
|
||||
<conv:ListStringConverter x:Key="listStringConverter" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid
|
||||
MinWidth="800"
|
||||
MinHeight="600"
|
||||
Margin="8,40,8,8"
|
||||
RowDefinitions="* Auto">
|
||||
<nodify:NodifyEditor
|
||||
x:Name="Editor"
|
||||
Connections="{Binding Connections}"
|
||||
ItemsSource="{Binding Nodes}"
|
||||
PendingConnection="{Binding PendingConnection}"
|
||||
SelectedConnection="{Binding SelectedConnection}"
|
||||
SelectedConnections="{Binding SelectedConnections}"
|
||||
SelectedItem="{Binding SelectedNode}"
|
||||
SelectedItems="{Binding SelectedNodes}">
|
||||
|
||||
<nodify:NodifyEditor.KeyBindings>
|
||||
<KeyBinding Command="{Binding DeleteSelectionCommand}" Gesture="Delete" />
|
||||
|
||||
</nodify:NodifyEditor.KeyBindings>
|
||||
|
||||
<nodify:NodifyEditor.DataTemplates>
|
||||
<DataTemplate DataType="{x:Type local:StationNode6180ViewModel}">
|
||||
<nodify:Node Header="{Binding}">
|
||||
<nodify:Node.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Spacing="10">
|
||||
<TextBlock>
|
||||
<Run>1:</Run>
|
||||
<Run Text="{Binding Station1Name}" />
|
||||
<Run>:</Run>
|
||||
<Run Foreground="Red" Text="{Binding Station1Code}" />
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<Run>2:</Run>
|
||||
<Run Text="{Binding Station2Name}" />
|
||||
<Run>:</Run>
|
||||
<Run Foreground="Red" Text="{Binding Station2Code}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
</DataTemplate>
|
||||
</nodify:Node.HeaderTemplate>
|
||||
|
||||
|
||||
<nodify:Node.Template>
|
||||
<!-- 自定义 Node 控件模板 -->
|
||||
<ControlTemplate TargetType="{x:Type nodify:Node}">
|
||||
<Border
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="3">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border
|
||||
Name="PART_Header"
|
||||
Grid.ColumnSpan="3"
|
||||
Background="{TemplateBinding HeaderBrush}"
|
||||
Theme="{TemplateBinding HeaderContainerStyle}">
|
||||
<ContentPresenter Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" />
|
||||
</Border>
|
||||
|
||||
<!-- Body -->
|
||||
<Border Grid.Row="1" Theme="{TemplateBinding ContentContainerStyle}">
|
||||
<Grid>
|
||||
<!-- 左侧输入节点 -->
|
||||
<nodify:NodeInput
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Anchor="{Binding Anchor, Mode=OneWayToSource}"
|
||||
DataContext="{Binding Input}"
|
||||
IsConnected="{Binding IsConnected}" />
|
||||
<!-- 右侧输出节点 -->
|
||||
<nodify:NodeOutput
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Anchor="{Binding Anchor, Mode=OneWayToSource}"
|
||||
DataContext="{Binding Output}"
|
||||
IsConnected="{Binding IsConnected}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</nodify:Node.Template>
|
||||
</nodify:Node>
|
||||
</DataTemplate>
|
||||
</nodify:NodifyEditor.DataTemplates>
|
||||
|
||||
<nodify:NodifyEditor.ConnectionTemplate>
|
||||
<DataTemplate DataType="{x:Type local:Connection6180ViewModel}">
|
||||
<nodify:LineConnection
|
||||
nodify:BaseConnection.IsSelectable="True"
|
||||
Fill="Transparent"
|
||||
Source="{Binding Source.Anchor}"
|
||||
Spacing="30"
|
||||
StrokeThickness="3"
|
||||
Target="{Binding Target.Anchor}">
|
||||
<nodify:LineConnection.Stroke>
|
||||
<SolidColorBrush Opacity="0.7" Color="Blue" />
|
||||
</nodify:LineConnection.Stroke>
|
||||
<nodify:LineConnection.Theme>
|
||||
<ControlTheme TargetType="{x:Type nodify:LineConnection}">
|
||||
<Setter Property="OutlineBrush" Value="Transparent" />
|
||||
<Style Selector="^:pointerover">
|
||||
<Setter Property="OutlineBrush">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Opacity="0.15" Color="White" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style Selector="^[(nodify|BaseConnection.IsSelected)=True]">
|
||||
<Setter Property="OutlineBrush">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Opacity="0.25" Color="DodgerBlue" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</nodify:LineConnection.Theme>
|
||||
|
||||
</nodify:LineConnection>
|
||||
</DataTemplate>
|
||||
</nodify:NodifyEditor.ConnectionTemplate>
|
||||
|
||||
<nodify:NodifyEditor.PendingConnectionTemplate>
|
||||
<DataTemplate DataType="{x:Type local:PendingConnection6180ViewModel}">
|
||||
<nodify:PendingConnection
|
||||
AllowOnlyConnectors="True"
|
||||
CompletedCommand="{Binding FinishCommand}"
|
||||
StartedCommand="{Binding StartCommand}" />
|
||||
</DataTemplate>
|
||||
</nodify:NodifyEditor.PendingConnectionTemplate>
|
||||
|
||||
<nodify:NodifyEditor.ItemContainerTheme>
|
||||
<ControlTheme BasedOn="{StaticResource {x:Type nodify:ItemContainer}}" TargetType="{x:Type nodify:ItemContainer}">
|
||||
<Setter Property="BorderThickness" Value="2" />
|
||||
<Setter Property="SelectedBorderThickness" Value="4" />
|
||||
|
||||
<Setter Property="Location" Value="{Binding Location}" />
|
||||
|
||||
</ControlTheme>
|
||||
</nodify:NodifyEditor.ItemContainerTheme>
|
||||
|
||||
|
||||
<nodify:NodifyEditor.ContextMenu>
|
||||
<ContextMenu DataContext="{Binding DataContext, Source={StaticResource EditorProxy}}">
|
||||
<MenuItem
|
||||
Command="{Binding AddStationCommand}"
|
||||
CommandParameter="{Binding #Editor.MouseLocation}"
|
||||
Header="{i18n:Localize ProcessEditDialog.AddStation}"
|
||||
Tag="{StaticResource AddStateIcon}" />
|
||||
</ContextMenu>
|
||||
</nodify:NodifyEditor.ContextMenu>
|
||||
|
||||
|
||||
</nodify:NodifyEditor>
|
||||
<ScrollViewer
|
||||
Width="300"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
<Border
|
||||
Classes="Hover"
|
||||
IsVisible="{Binding SelectedNode, Converter={conv:BooleanToVisibilityConverter}}"
|
||||
Theme="{StaticResource CardBorder}">
|
||||
<StackPanel Margin="10" Spacing="10">
|
||||
<StackPanel Margin="0,0,0,14">
|
||||
<TextBlock FontWeight="Bold" Text="{i18n:Localize ProcessEditDialog.SelectedStation}" />
|
||||
</StackPanel>
|
||||
|
||||
<ComboBox
|
||||
Classes="Large"
|
||||
ItemsSource="{Binding Stations}"
|
||||
SelectedValue="{Binding SelectedNode.Station1Id, 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>
|
||||
|
||||
<ComboBox
|
||||
Classes="ClearButton"
|
||||
ItemsSource="{Binding Stations}"
|
||||
SelectedValue="{Binding SelectedNode.Station2Id, 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>
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Border>
|
||||
<Border
|
||||
Classes="Hover"
|
||||
IsVisible="{Binding SelectedConnection, Converter={conv:BooleanToVisibilityConverter}}"
|
||||
Theme="{StaticResource CardBorder}">
|
||||
<StackPanel Margin="10" Spacing="8">
|
||||
<StackPanel Margin="0,0,0,14">
|
||||
<TextBlock FontWeight="Bold" Text="{i18n:Localize ProcessEditDialog.ProcessEdit}" />
|
||||
</StackPanel>
|
||||
<u:FormItem Label="{i18n:Localize ProcessEditDialog.Priority}">
|
||||
<NumericUpDown
|
||||
Increment="10"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Value="{Binding SelectedConnection.ProcessFlow.Priority}" />
|
||||
</u:FormItem>
|
||||
<u:FormItem Label="{i18n:Localize FlowManagement.DataGrid.FromStationStatus1}">
|
||||
<ComboBox
|
||||
Classes="Large"
|
||||
ItemsSource="{x:Static vm:ProcessEdit6180DialogViewModel.StationStateList}"
|
||||
SelectedValue="{Binding SelectedConnection.ProcessFlow.FromStatus1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValueBinding="{Binding .}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
</u:FormItem>
|
||||
|
||||
<u:FormItem Label="{i18n:Localize FlowManagement.DataGrid.ToStationStatus1}">
|
||||
<ComboBox
|
||||
Classes="Large"
|
||||
ItemsSource="{x:Static vm:ProcessEditDialogViewModel.StationStateList}"
|
||||
SelectedValue="{Binding SelectedConnection.ProcessFlow.ToStatus1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValueBinding="{Binding .}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</u:FormItem>
|
||||
|
||||
<u:FormItem Label="{i18n:Localize FlowManagement.DataGrid.FromStationStatus2}">
|
||||
<ComboBox
|
||||
Classes="Large"
|
||||
ItemsSource="{x:Static vm:ProcessEdit6180DialogViewModel.StationStateList}"
|
||||
SelectedValue="{Binding SelectedConnection.ProcessFlow.FromStatus2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValueBinding="{Binding .}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
</u:FormItem>
|
||||
|
||||
<u:FormItem Label="{i18n:Localize FlowManagement.DataGrid.ToStationStatus2}">
|
||||
<ComboBox
|
||||
Classes="Large"
|
||||
ItemsSource="{x:Static vm:ProcessEditDialogViewModel.StationStateList}"
|
||||
SelectedValue="{Binding SelectedConnection.ProcessFlow.ToStatus2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValueBinding="{Binding .}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding, Converter={StaticResource i18nConverter}, ConverterParameter='StationState'}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</u:FormItem>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="8"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal"
|
||||
Spacing="12">
|
||||
<Button
|
||||
Command="{Binding OkCommand}"
|
||||
Content="{i18n:Localize OK}"
|
||||
Theme="{DynamicResource SolidButton}" />
|
||||
<Button
|
||||
Command="{Binding CancelCommand}"
|
||||
Content="{i18n:Localize Cancel}"
|
||||
Theme="{DynamicResource SolidButton}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -1,12 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Views
|
||||
{
|
||||
public partial class ProcessEdit6180Dialog : UserControl
|
||||
{
|
||||
public ProcessEdit6180Dialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
<UserControl
|
||||
x:Class="Plugin.Cowain.Wcs.Views.ProcessManagement6180View"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="using:Cowain.Base.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:extensions="using:Cowain.Base.Extensions"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:semi="https://irihi.tech/semi"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Plugin.Cowain.Wcs.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<conv:I18nLocalizeConverter x:Key="i18nConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid RowDefinitions="Auto * Auto">
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Margin="10,8"
|
||||
Orientation="Horizontal"
|
||||
Spacing="10">
|
||||
<u:IconButton
|
||||
Command="{Binding AddCommand}"
|
||||
IsEnabled="{extensions:MenuEnable ProcessManagement6180View,
|
||||
add}"
|
||||
Theme="{DynamicResource BorderlessIconButton}"
|
||||
ToolTip.Tip="{i18n:Localize ProcessManagement.Tooltip.Add}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconPlusStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding #page.CurrentPage}"
|
||||
Theme="{DynamicResource BorderlessIconButton}"
|
||||
ToolTip.Tip="{i18n:Localize ProcessManagement.Tooltip.Refresh}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconRedoStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
CanUserReorderColumns="True"
|
||||
CanUserResizeColumns="True"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="2"
|
||||
HeadersVisibility="All"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding ProcessList}"
|
||||
RowHeight="30">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="60"
|
||||
x:DataType="vm:ProcessViewModel"
|
||||
Binding="{Binding Id}"
|
||||
Header="{i18n:Localize ProcessManagement.DataGrid.Id}"
|
||||
IsReadOnly="True" />
|
||||
|
||||
<DataGridTemplateColumn Width="140" Header="{i18n:Localize ProcessManagement.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 ProcessManagement6180View,
|
||||
save}"
|
||||
Theme="{DynamicResource BorderlessIconButton}"
|
||||
ToolTip.Tip="{i18n:Localize ProcessManagement.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.EditCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
IsEnabled="{extensions:MenuEnable ProcessManagement6180View,
|
||||
edit}"
|
||||
Theme="{DynamicResource BorderlessIconButton}"
|
||||
ToolTip.Tip="{i18n:Localize ProcessManagement.Tooltip.Edit}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconEdit2Stroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
x:CompileBindings="False"
|
||||
Command="{Binding $parent[DataGrid].DataContext.DeleteCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
IsEnabled="{extensions:MenuEnable ProcessManagement6180View,
|
||||
delete}"
|
||||
Theme="{DynamicResource BorderlessIconButton}"
|
||||
ToolTip.Tip="{i18n:Localize ProcessManagement.Tooltip.Delete}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconDeleteStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="140"
|
||||
x:DataType="vm:ProcessViewModel"
|
||||
Binding="{Binding Name}"
|
||||
Header="{i18n:Localize ProcessManagement.DataGrid.Name}" />
|
||||
<DataGridTextColumn
|
||||
Width="140"
|
||||
x:DataType="vm:ProcessViewModel"
|
||||
Binding="{Binding Json}"
|
||||
Header="{i18n:Localize ProcessManagement.DataGrid.Json}" />
|
||||
<DataGridTextColumn
|
||||
Width="180"
|
||||
x:DataType="vm:ProcessViewModel"
|
||||
Binding="{Binding CreateTime}"
|
||||
Header="{i18n:Localize ProcessManagement.DataGrid.CreateTime}"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
x:DataType="vm:ProcessViewModel"
|
||||
Binding="{Binding UpdateTime}"
|
||||
Header="{i18n:Localize ProcessManagement.DataGrid.UpdateTime}"
|
||||
IsReadOnly="True" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
|
||||
<u:Pagination
|
||||
Name="page"
|
||||
Grid.Row="2"
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding $self.CurrentPage}"
|
||||
CurrentPage="{Binding PageIndex, Mode=TwoWay}"
|
||||
PageSize="{Binding PageSize, Mode=TwoWay}"
|
||||
PageSizeOptions="10, 20, 50, 100"
|
||||
ShowPageSizeSelector="True"
|
||||
ShowQuickJump="True"
|
||||
TotalCount="{Binding Totals}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,13 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Views;
|
||||
|
||||
public partial class ProcessManagement6180View : UserControl
|
||||
{
|
||||
public ProcessManagement6180View()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -1,286 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:semi="https://irihi.tech/semi"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Plugin.Cowain.Wcs.ViewModels"
|
||||
xmlns:helper="using:Cowain.Base.Helpers"
|
||||
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
|
||||
xmlns:conv="using:Cowain.Base.Converters"
|
||||
xmlns:extensions="using:Cowain.Base.Extensions"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Plugin.Cowain.Wcs.Views.RgvManagement6180View">
|
||||
<UserControl.Resources>
|
||||
<conv:I18nLocalizeConverter x:Key="i18nConverter" />
|
||||
<helper:BindingProxy x:Key="Proxy"
|
||||
DataContext="{Binding}" />
|
||||
</UserControl.Resources>
|
||||
<Grid RowDefinitions="Auto * Auto">
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="10" Margin="10 8">
|
||||
<u:IconButton
|
||||
ToolTip.Tip="{i18n:Localize RgvManagement.Tooltip.Add}"
|
||||
IsEnabled="{extensions:MenuEnable RgvManagement6180View,add}"
|
||||
Command="{Binding AddCommand}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconPlusStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
<u:IconButton
|
||||
ToolTip.Tip="{i18n:Localize RgvManagement.Tooltip.Refresh}"
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding #page.CurrentPage}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon
|
||||
Width="16"
|
||||
Height="16"
|
||||
Data="{StaticResource SemiIconRedoStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
<DataGrid Grid.Row="1" FrozenColumnCount="2"
|
||||
CanUserReorderColumns="True"
|
||||
CanUserResizeColumns="True"
|
||||
CanUserSortColumns="False"
|
||||
HeadersVisibility="All"
|
||||
RowHeight="30"
|
||||
ItemsSource="{Binding RgvList}"
|
||||
HorizontalScrollBarVisibility="Auto">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="60"
|
||||
x:DataType="vm:RgvViewModel"
|
||||
Binding="{Binding Id}"
|
||||
IsReadOnly="True"
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.Id}" />
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.Edit}"
|
||||
Width="100">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<u:IconButton
|
||||
ToolTip.Tip="{i18n:Localize RgvManagement.Tooltip.Save}"
|
||||
x:CompileBindings="False"
|
||||
IsEnabled="{extensions:MenuEnable RgvManagement6180View,save}"
|
||||
Command="{Binding $parent[DataGrid].DataContext.SaveCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon Width="16" Height="16" Data="{StaticResource SemiIconSave}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
|
||||
<u:IconButton
|
||||
ToolTip.Tip="{i18n:Localize RgvManagement.Tooltip.Delete}"
|
||||
x:CompileBindings="False"
|
||||
IsEnabled="{extensions:MenuEnable RgvManagement6180View,delete}"
|
||||
Command="{Binding $parent[DataGrid].DataContext.DeleteCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Theme="{DynamicResource BorderlessIconButton}">
|
||||
<u:IconButton.Icon>
|
||||
<PathIcon Width="16" Height="16" Data="{StaticResource SemiIconDeleteStroked}" />
|
||||
</u:IconButton.Icon>
|
||||
</u:IconButton>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTextColumn Width="140"
|
||||
x:DataType="vm:RgvViewModel"
|
||||
Binding="{Binding StationName}"
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.Name}" />
|
||||
<DataGridTextColumn Width="140"
|
||||
x:DataType="vm:RgvViewModel"
|
||||
Binding="{Binding StationCode}"
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.Code}" />
|
||||
<DataGridTextColumn Width="140"
|
||||
x:DataType="vm:RgvViewModel"
|
||||
Binding="{Binding ProcessName}"
|
||||
IsReadOnly="True"
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.ProcessName}" />
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.FromStation1}"
|
||||
Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox Classes="Large" VerticalAlignment="Center"
|
||||
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 Orientation="Horizontal" Spacing="10" Margin="10 8">
|
||||
<TextBlock >
|
||||
<Run Text="{Binding StationName}" />
|
||||
<Run> : </Run>
|
||||
<Run Text="{Binding StationCode}"
|
||||
Foreground="Red" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.ToStation1}"
|
||||
Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox Classes="Large" VerticalAlignment="Center"
|
||||
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 Orientation="Horizontal" Spacing="10" Margin="10 8">
|
||||
<TextBlock >
|
||||
<Run Text="{Binding StationName}" />
|
||||
<Run> : </Run>
|
||||
<Run Text="{Binding StationCode}"
|
||||
Foreground="Red" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.FromStation2}"
|
||||
Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox Classes="Large" VerticalAlignment="Center"
|
||||
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 Orientation="Horizontal" Spacing="10" Margin="10 8">
|
||||
<TextBlock >
|
||||
<Run Text="{Binding StationName}" />
|
||||
<Run> : </Run>
|
||||
<Run Text="{Binding StationCode}"
|
||||
Foreground="Red" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.ToStation2}"
|
||||
Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox Classes="Large" VerticalAlignment="Center"
|
||||
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 Orientation="Horizontal" Spacing="10" Margin="10 8">
|
||||
<TextBlock >
|
||||
<Run Text="{Binding StationName}" />
|
||||
<Run> : </Run>
|
||||
<Run Text="{Binding StationCode}"
|
||||
Foreground="Red" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.PositionX}"
|
||||
Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<NumericUpDown Increment="10" Value="{Binding PositionX}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.PositionY}"
|
||||
Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<NumericUpDown Increment="10" Value="{Binding PositionY}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.PositionZ}"
|
||||
Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<NumericUpDown Increment="10" Value="{Binding PositionZ}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.LayOutX}"
|
||||
Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<NumericUpDown Increment="1" Value="{Binding LayOutX}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.LayOutY}"
|
||||
Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<NumericUpDown Increment="1" Value="{Binding LayOutY}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTextColumn Width="180"
|
||||
x:DataType="vm:RgvViewModel"
|
||||
Binding="{Binding Json}"
|
||||
IsReadOnly="True"
|
||||
Header="{i18n:Localize RgvManagement.DataGrid.Json}" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<u:Pagination Grid.Row="2"
|
||||
Name="page"
|
||||
PageSizeOptions="10, 20, 50, 100"
|
||||
ShowQuickJump="True"
|
||||
ShowPageSizeSelector="True"
|
||||
PageSize="{Binding PageSize,Mode=TwoWay}"
|
||||
CurrentPage="{Binding PageIndex,Mode=TwoWay}"
|
||||
Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding $self.CurrentPage}"
|
||||
TotalCount="{Binding Totals}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,13 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Plugin.Cowain.Wcs.Views;
|
||||
|
||||
public partial class RgvManagement6180View : UserControl
|
||||
{
|
||||
public RgvManagement6180View()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user