From 004717e950398ec7b3c03f32c5cea560b19c7e1f Mon Sep 17 00:00:00 2001 From: iioter <535915157@qq.com> Date: Tue, 6 Dec 2022 22:39:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=98=E9=87=8F=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221206143332_EndianType.Designer.cs | 865 ++++++++++++++++++ .../Migrations/20221206143332_EndianType.cs | 26 + .../Migrations/DataContextModelSnapshot.cs | 3 + IoTGateway.Model/DeviceVariable.cs | 5 +- .../DeviceVariableBatchVM.cs | 2 + .../DeviceVariableImportVM.cs | 2 + .../DeviceVariableVMs/DeviceVariableListVM.cs | 2 + .../Views/DeviceVariable/BatchEdit.cshtml | 17 +- .../Views/DeviceVariable/Create.cshtml | 1 + .../Views/DeviceVariable/Details.cshtml | 21 +- .../Views/DeviceVariable/Edit.cshtml | 1 + IoTGateway/iotgateway.db | Bin 311296 -> 311296 bytes .../DriverModbusMaster/ModbusMaster.cs | 2 +- Plugins/Plugin/DeviceThread.cs | 3 +- .../DriverAddressIoArgModel.cs | 4 +- Plugins/PluginInterface/EndianEnum.cs | 21 +- 16 files changed, 939 insertions(+), 36 deletions(-) create mode 100644 IoTGateway.DataAccess/Migrations/20221206143332_EndianType.Designer.cs create mode 100644 IoTGateway.DataAccess/Migrations/20221206143332_EndianType.cs diff --git a/IoTGateway.DataAccess/Migrations/20221206143332_EndianType.Designer.cs b/IoTGateway.DataAccess/Migrations/20221206143332_EndianType.Designer.cs new file mode 100644 index 0000000..c448a1d --- /dev/null +++ b/IoTGateway.DataAccess/Migrations/20221206143332_EndianType.Designer.cs @@ -0,0 +1,865 @@ +// +using System; +using IoTGateway.DataAccess; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace IoTGateway.DataAccess.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20221206143332_EndianType")] + partial class EndianType + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.10"); + + modelBuilder.Entity("IoTGateway.Model.Device", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("AutoStart") + .HasColumnType("INTEGER"); + + b.Property("CgUpload") + .HasColumnType("INTEGER"); + + b.Property("CmdPeriod") + .HasColumnType("INTEGER"); + + b.Property("CreateBy") + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("DeviceName") + .HasColumnType("TEXT"); + + b.Property("DeviceTypeEnum") + .HasColumnType("INTEGER"); + + b.Property("DriverId") + .HasColumnType("TEXT"); + + b.Property("EnforcePeriod") + .HasColumnType("INTEGER"); + + b.Property("Index") + .HasColumnType("INTEGER"); + + b.Property("ParentId") + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("DriverId"); + + b.HasIndex("ParentId"); + + b.ToTable("Devices"); + }); + + modelBuilder.Entity("IoTGateway.Model.DeviceConfig", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("DataSide") + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("DeviceConfigName") + .HasColumnType("TEXT"); + + b.Property("DeviceId") + .HasColumnType("TEXT"); + + b.Property("EnumInfo") + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceConfigs"); + }); + + modelBuilder.Entity("IoTGateway.Model.DeviceVariable", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("DataType") + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("DeviceAddress") + .HasColumnType("TEXT"); + + b.Property("DeviceId") + .HasColumnType("TEXT"); + + b.Property("EndianType") + .HasColumnType("INTEGER"); + + b.Property("Expressions") + .HasColumnType("TEXT"); + + b.Property("Index") + .HasColumnType("INTEGER"); + + b.Property("Method") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ProtectType") + .HasColumnType("INTEGER"); + + b.HasKey("ID"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceVariables"); + }); + + modelBuilder.Entity("IoTGateway.Model.Driver", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("AssembleName") + .HasColumnType("TEXT"); + + b.Property("AuthorizesNum") + .HasColumnType("INTEGER"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("DriverName") + .HasColumnType("TEXT"); + + b.Property("FileName") + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("Drivers"); + }); + + modelBuilder.Entity("IoTGateway.Model.RpcLog", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("DeviceId") + .HasColumnType("TEXT"); + + b.Property("EndTime") + .HasColumnType("TEXT"); + + b.Property("IsSuccess") + .HasColumnType("INTEGER"); + + b.Property("Method") + .HasColumnType("TEXT"); + + b.Property("Params") + .HasColumnType("TEXT"); + + b.Property("RpcSide") + .HasColumnType("INTEGER"); + + b.Property("StartTime") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("DeviceId"); + + b.ToTable("RpcLogs"); + }); + + modelBuilder.Entity("IoTGateway.Model.SystemConfig", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ClientId") + .HasColumnType("TEXT"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("GatewayName") + .HasColumnType("TEXT"); + + b.Property("IoTPlatformType") + .HasColumnType("INTEGER"); + + b.Property("MqttIp") + .HasColumnType("TEXT"); + + b.Property("MqttPort") + .HasColumnType("INTEGER"); + + b.Property("MqttUName") + .HasColumnType("TEXT"); + + b.Property("MqttUPwd") + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("SystemConfig"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.ActionLog", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ActionName") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("ActionTime") + .HasColumnType("TEXT"); + + b.Property("ActionUrl") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("Duration") + .HasColumnType("REAL"); + + b.Property("IP") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ITCode") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("LogType") + .HasColumnType("INTEGER"); + + b.Property("ModuleName") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b.Property("Remark") + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("ActionLogs"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.DataPrivilege", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("Domain") + .HasColumnType("TEXT"); + + b.Property("GroupCode") + .HasColumnType("TEXT"); + + b.Property("RelateId") + .HasColumnType("TEXT"); + + b.Property("TableName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.Property("UserCode") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("DataPrivileges"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FileAttachment", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ExtraInfo") + .HasColumnType("TEXT"); + + b.Property("FileData") + .HasColumnType("BLOB"); + + b.Property("FileExt") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("HandlerInfo") + .HasColumnType("TEXT"); + + b.Property("Length") + .HasColumnType("INTEGER"); + + b.Property("Path") + .HasColumnType("TEXT"); + + b.Property("SaveMode") + .HasColumnType("TEXT"); + + b.Property("UploadTime") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("FileAttachments"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkGroup", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("GroupCode") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("GroupRemark") + .HasColumnType("TEXT"); + + b.Property("TenantCode") + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("FrameworkGroups"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkMenu", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ActionName") + .HasColumnType("TEXT"); + + b.Property("ClassName") + .HasColumnType("TEXT"); + + b.Property("DisplayOrder") + .IsRequired() + .HasColumnType("INTEGER"); + + b.Property("Domain") + .HasColumnType("TEXT"); + + b.Property("FolderOnly") + .HasColumnType("INTEGER"); + + b.Property("Icon") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsInherit") + .HasColumnType("INTEGER"); + + b.Property("IsInside") + .IsRequired() + .HasColumnType("INTEGER"); + + b.Property("IsPublic") + .HasColumnType("INTEGER"); + + b.Property("MethodName") + .HasColumnType("TEXT"); + + b.Property("ModuleName") + .HasColumnType("TEXT"); + + b.Property("PageName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ParentId") + .HasColumnType("TEXT"); + + b.Property("ShowOnMenu") + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("ParentId"); + + b.ToTable("FrameworkMenus"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkRole", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("RoleCode") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RoleRemark") + .HasColumnType("TEXT"); + + b.Property("TenantCode") + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("FrameworkRoles"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUser", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Address") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("CellPhone") + .HasColumnType("TEXT"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Gender") + .HasColumnType("INTEGER"); + + b.Property("HomePhone") + .HasMaxLength(30) + .HasColumnType("TEXT"); + + b.Property("ITCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsValid") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("PhotoId") + .HasColumnType("TEXT"); + + b.Property("TenantCode") + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("PhotoId"); + + b.ToTable("FrameworkUsers"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUserGroup", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("GroupCode") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("FrameworkUserGroups"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUserRole", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("RoleCode") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("FrameworkUserRoles"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FunctionPrivilege", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Allowed") + .IsRequired() + .HasColumnType("INTEGER"); + + b.Property("CreateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("MenuItemId") + .HasColumnType("TEXT"); + + b.Property("RoleCode") + .HasColumnType("TEXT"); + + b.Property("UpdateBy") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdateTime") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("MenuItemId"); + + b.ToTable("FunctionPrivileges"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.PersistedGrant", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreationTime") + .HasColumnType("TEXT"); + + b.Property("Expiration") + .HasColumnType("TEXT"); + + b.Property("RefreshToken") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UserCode") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("PersistedGrants"); + }); + + modelBuilder.Entity("IoTGateway.Model.Device", b => + { + b.HasOne("IoTGateway.Model.Driver", "Driver") + .WithMany() + .HasForeignKey("DriverId"); + + b.HasOne("IoTGateway.Model.Device", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.Navigation("Driver"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("IoTGateway.Model.DeviceConfig", b => + { + b.HasOne("IoTGateway.Model.Device", "Device") + .WithMany("DeviceConfigs") + .HasForeignKey("DeviceId"); + + b.Navigation("Device"); + }); + + modelBuilder.Entity("IoTGateway.Model.DeviceVariable", b => + { + b.HasOne("IoTGateway.Model.Device", "Device") + .WithMany("DeviceVariables") + .HasForeignKey("DeviceId"); + + b.Navigation("Device"); + }); + + modelBuilder.Entity("IoTGateway.Model.RpcLog", b => + { + b.HasOne("IoTGateway.Model.Device", "Device") + .WithMany() + .HasForeignKey("DeviceId"); + + b.Navigation("Device"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkMenu", b => + { + b.HasOne("WalkingTec.Mvvm.Core.FrameworkMenu", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkUser", b => + { + b.HasOne("WalkingTec.Mvvm.Core.FileAttachment", "Photo") + .WithMany() + .HasForeignKey("PhotoId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Photo"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FunctionPrivilege", b => + { + b.HasOne("WalkingTec.Mvvm.Core.FrameworkMenu", "MenuItem") + .WithMany("Privileges") + .HasForeignKey("MenuItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("MenuItem"); + }); + + modelBuilder.Entity("IoTGateway.Model.Device", b => + { + b.Navigation("Children"); + + b.Navigation("DeviceConfigs"); + + b.Navigation("DeviceVariables"); + }); + + modelBuilder.Entity("WalkingTec.Mvvm.Core.FrameworkMenu", b => + { + b.Navigation("Children"); + + b.Navigation("Privileges"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IoTGateway.DataAccess/Migrations/20221206143332_EndianType.cs b/IoTGateway.DataAccess/Migrations/20221206143332_EndianType.cs new file mode 100644 index 0000000..02359ef --- /dev/null +++ b/IoTGateway.DataAccess/Migrations/20221206143332_EndianType.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IoTGateway.DataAccess.Migrations +{ + public partial class EndianType : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "EndianType", + table: "DeviceVariables", + type: "INTEGER", + nullable: false, + defaultValue: 0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "EndianType", + table: "DeviceVariables"); + } + } +} diff --git a/IoTGateway.DataAccess/Migrations/DataContextModelSnapshot.cs b/IoTGateway.DataAccess/Migrations/DataContextModelSnapshot.cs index a29e1d4..73de5c2 100644 --- a/IoTGateway.DataAccess/Migrations/DataContextModelSnapshot.cs +++ b/IoTGateway.DataAccess/Migrations/DataContextModelSnapshot.cs @@ -137,6 +137,9 @@ namespace IoTGateway.DataAccess.Migrations b.Property("DeviceId") .HasColumnType("TEXT"); + b.Property("EndianType") + .HasColumnType("INTEGER"); + b.Property("Expressions") .HasColumnType("TEXT"); diff --git a/IoTGateway.Model/DeviceVariable.cs b/IoTGateway.Model/DeviceVariable.cs index 4f8b449..770ba45 100644 --- a/IoTGateway.Model/DeviceVariable.cs +++ b/IoTGateway.Model/DeviceVariable.cs @@ -20,7 +20,10 @@ namespace IoTGateway.Model public string DeviceAddress { get; set; } [Display(Name = "类型")] - public PluginInterface.DataTypeEnum DataType { get; set; } + public DataTypeEnum DataType { get; set; } + + [Display(Name = "大小端")] + public EndianEnum EndianType { get; set; } [Display(Name = "表达式")] public string Expressions { get; set; } diff --git a/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableBatchVM.cs b/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableBatchVM.cs index 0d8d2aa..fa9bdfc 100644 --- a/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableBatchVM.cs +++ b/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableBatchVM.cs @@ -53,6 +53,8 @@ namespace IoTGateway.ViewModel.BasicData.DeviceVariableVMs public String DeviceAddress { get; set; } [Display(Name = "数据类型")] public DataTypeEnum? DataType { get; set; } + [Display(Name = "大小端")] + public EndianEnum? EndianType { get; set; } [Display(Name = "表达式")] public string Expression { get; set; } [Display(Name = "权限")] diff --git a/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableImportVM.cs b/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableImportVM.cs index 04fe596..dd94121 100644 --- a/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableImportVM.cs +++ b/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableImportVM.cs @@ -25,6 +25,8 @@ namespace IoTGateway.ViewModel.BasicData.DeviceVariableVMs public ExcelPropety DeviceAddress_Excel = ExcelPropety.CreateProperty(x => x.DeviceAddress); [Display(Name = "数据类型")] public ExcelPropety DataType_Excel = ExcelPropety.CreateProperty(x => x.DataType); + [Display(Name = "大小端")] + public ExcelPropety EndianType_Excel = ExcelPropety.CreateProperty(x => x.EndianType); [Display(Name = "表达式")] public ExcelPropety Expressions_Excel = ExcelPropety.CreateProperty(x => x.Expressions); [Display(Name = "权限")] diff --git a/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableListVM.cs b/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableListVM.cs index 8f8fa10..73420e3 100644 --- a/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableListVM.cs +++ b/IoTGateway.ViewModel/BasicData/DeviceVariableVMs/DeviceVariableListVM.cs @@ -66,6 +66,7 @@ namespace IoTGateway.ViewModel.BasicData.DeviceVariableVMs this.MakeGridHeader(x => x.Method).SetSort(true).SetWidth(160), this.MakeGridHeader(x => x.DeviceAddress).SetSort(true).SetWidth(80), this.MakeGridHeader(x => x.DataType).SetSort(true).SetWidth(80), + this.MakeGridHeader(x => x.EndianType).SetSort(true).SetWidth(120), this.MakeGridHeader(x => x.Value).SetWidth(80).SetFormat((a,b)=>{ return $"
{a.Value}
"; }), @@ -126,6 +127,7 @@ namespace IoTGateway.ViewModel.BasicData.DeviceVariableVMs Method = x.Method, DeviceAddress = x.DeviceAddress, DataType = x.DataType, + EndianType = x.EndianType, Expressions = x.Expressions, ProtectType = x.ProtectType, DeviceName_view = x.Device.DeviceName, diff --git a/IoTGateway/Areas/BasicData/Views/DeviceVariable/BatchEdit.cshtml b/IoTGateway/Areas/BasicData/Views/DeviceVariable/BatchEdit.cshtml index 6d1cc6d..d902dba 100644 --- a/IoTGateway/Areas/BasicData/Views/DeviceVariable/BatchEdit.cshtml +++ b/IoTGateway/Areas/BasicData/Views/DeviceVariable/BatchEdit.cshtml @@ -3,15 +3,16 @@
@Localizer["Sys.BatchEditConfirm"]
- - - - - - - + + + + + + + + - + diff --git a/IoTGateway/Areas/BasicData/Views/DeviceVariable/Create.cshtml b/IoTGateway/Areas/BasicData/Views/DeviceVariable/Create.cshtml index 528140f..3c606e5 100644 --- a/IoTGateway/Areas/BasicData/Views/DeviceVariable/Create.cshtml +++ b/IoTGateway/Areas/BasicData/Views/DeviceVariable/Create.cshtml @@ -10,6 +10,7 @@ + diff --git a/IoTGateway/Areas/BasicData/Views/DeviceVariable/Details.cshtml b/IoTGateway/Areas/BasicData/Views/DeviceVariable/Details.cshtml index 5d8a4ce..f71ed93 100644 --- a/IoTGateway/Areas/BasicData/Views/DeviceVariable/Details.cshtml +++ b/IoTGateway/Areas/BasicData/Views/DeviceVariable/Details.cshtml @@ -2,16 +2,17 @@ @inject IStringLocalizer Localizer; - - - - - - - - - - + + + + + + + + + + + diff --git a/IoTGateway/Areas/BasicData/Views/DeviceVariable/Edit.cshtml b/IoTGateway/Areas/BasicData/Views/DeviceVariable/Edit.cshtml index 82f3c63..a425d32 100644 --- a/IoTGateway/Areas/BasicData/Views/DeviceVariable/Edit.cshtml +++ b/IoTGateway/Areas/BasicData/Views/DeviceVariable/Edit.cshtml @@ -10,6 +10,7 @@ + diff --git a/IoTGateway/iotgateway.db b/IoTGateway/iotgateway.db index 6059c2e39f74c8457a8e1c0ba26fde0086a84989..4f4e88cc9fb7e13512d801d17f19761c9a03551d 100644 GIT binary patch delta 477 zcmZo@5N>D?o**r#&A`Cm1H|4y%mTz36LpLkwKpa#;g{m(Yh&Pl!heu|0e>BTEWaJU z1m9=AvwW-g+BPdHWbmmdaWmUX8W|WF85$Xw8JZXy8ym&D=A~pN=7m%iq?+j&=ouPp zUL_aB2sG&c1OF@jGyEI)C-avB&9dQ_;rq>ZkM97`q(yvkvds33I1S=%zNgoIPmgi? zJv}B3Mk75&t|IPp9D1xNEdN<%F;8X|WvXS+V~J*8!TN|rg^L&H2L|>D3=AzkTI}N5 z+Ke6k+Y=3#W;1dqC_x-I{h%R}*z{f}M(*kLwoKB~XW28QwbvRk0WtITS|gSYUP0E6 zEUX`Sh54KKq{xpt7b^0+M79T$5T1K8w zkc6zMGEkz=pQUJffg8(rW+t9#+cUjbbeTXwTQhx@4@(6fe-#rD?o**r##lXPe1H|4y%mT#f6LpLkwKgU!;g{gzTgAZtg#RG_0{%MwSbjTx z3BJ#KXZcobR#fQY+q_CHiV>*f9s~a?{xkd=_$Tw10~Oiu%kcf?ySG^|;1FN)J-zmO zdW_re=`m?As)aLh6>*>A&|^(u`Oh+oc`~yoQ!PU{OEmim)<-NVT)aTL8Q3RGR#edD zYEjl=7uVKiY_HvJVZbz-aeBQill1gi_DpH*wMI-p%)GtUh^2#9kgb4;znPztua{4X zcOtJ4&$R7g4lFUOlMNL9GIDM&aAWz-%*5BSJ=2Rtmx-l{ohx+uEFYE%o@zF(P)1(< zP(@RDj_LgIEGpBt`?2^=@AqZ-Dgtx`Cs?wI8KOwlRC0R1KT9EZ1rtO-)>L-7f-g%x TcQqqSKzaH0W1XojSW}* diff --git a/Plugins/Drivers/DriverModbusMaster/ModbusMaster.cs b/Plugins/Drivers/DriverModbusMaster/ModbusMaster.cs index f2e3a99..0eaf7e8 100644 --- a/Plugins/Drivers/DriverModbusMaster/ModbusMaster.cs +++ b/Plugins/Drivers/DriverModbusMaster/ModbusMaster.cs @@ -348,7 +348,7 @@ namespace DriverModbusMaster else if (funCode == 4) rawBuffers = _master.ReadInputRegisters(SlaveAddress, startAddress, count); - var retBuffers = ChangeBuffersOrder(rawBuffers, ioarg.Endian); + var retBuffers = ChangeBuffersOrder(rawBuffers, ioarg.EndianType); if (ioarg.ValueType == DataTypeEnum.AsciiString) retBuffers = rawBuffers; diff --git a/Plugins/Plugin/DeviceThread.cs b/Plugins/Plugin/DeviceThread.cs index 70496bb..b0d1526 100644 --- a/Plugins/Plugin/DeviceThread.cs +++ b/Plugins/Plugin/DeviceThread.cs @@ -87,7 +87,8 @@ namespace Plugin { ID = item.ID, Address = item.DeviceAddress, - ValueType = item.DataType + ValueType = item.DataType, + EndianType = item.EndianType }; var method = Methods.Where(x => x.Name == item.Method).FirstOrDefault(); if (method == null) diff --git a/Plugins/PluginInterface/DriverAddressIoArgModel.cs b/Plugins/PluginInterface/DriverAddressIoArgModel.cs index 21d4c02..8a5d00a 100644 --- a/Plugins/PluginInterface/DriverAddressIoArgModel.cs +++ b/Plugins/PluginInterface/DriverAddressIoArgModel.cs @@ -13,10 +13,10 @@ namespace PluginInterface public object Value { get; set; } public DataTypeEnum ValueType { get; set; } - public EndianEnum Endian { get; set; } + public EndianEnum EndianType { get; set; } public override string ToString() { - return $"变量ID:{ID},Address:{Address},Value:{Value},ValueType:{ValueType},Endian{Endian}"; + return $"变量ID:{ID},Address:{Address},Value:{Value},ValueType:{ValueType},Endian:{EndianType}"; } } } diff --git a/Plugins/PluginInterface/EndianEnum.cs b/Plugins/PluginInterface/EndianEnum.cs index cd33efc..c510e9e 100644 --- a/Plugins/PluginInterface/EndianEnum.cs +++ b/Plugins/PluginInterface/EndianEnum.cs @@ -1,19 +1,14 @@ using System.ComponentModel.DataAnnotations; using System.Xml.Linq; -namespace PluginInterface -{ +namespace PluginInterface +{ public enum EndianEnum { - [Display(Name = "无")] - None, - [Display(Name = "大端")] - BigEndian, - [Display(Name = "小端")] - LittleEndian, - [Display(Name = "大端交换")] - BigEndianSwap, - [Display(Name = "小端交换")] - LittleEndianSwap - } + [Display(Name = "无")] None = 0, + [Display(Name = "大端")] BigEndian, + [Display(Name = "小端")] LittleEndian, + [Display(Name = "大端交换")] BigEndianSwap, + [Display(Name = "小端交换")] LittleEndianSwap + } }