diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..74f4ef3 --- /dev/null +++ b/README.txt @@ -0,0 +1,5 @@ +dotnet add package Microsoft.EntityFrameworkCore +dotnet add package Microsoft.EntityFrameworkCore.Design +dotnet add package Microsoft.EntityFrameworkCore.Sqlite + +dotnet ef dbcontext scaffold "Data Source=protdb.sql3" Microsoft.EntityFrameworkCore.Sqlite -o Models diff --git a/YunDa.SOMS.sln b/YunDa.SOMS.sln index 598cd50..2f675d9 100644 --- a/YunDa.SOMS.sln +++ b/YunDa.SOMS.sln @@ -103,6 +103,9 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleTestDotnettyClient", "test\ConsoleTestDotnettyClient\ConsoleTestDotnettyClient.csproj", "{6F188128-F359-492A-99CF-BF219B886FFA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ProtectionDeviceSqlite", "ProtectionDeviceSqlite", "{9D1CDEF4-094D-4906-8D8B-7A9109CD84BE}" + ProjectSection(SolutionItems) = preProject + README.txt = README.txt + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YunDa.SOMS.Commdb", "src\YunDa.Domain\ProtectionDeviceSqlite\YunDa.SOMS.Commdb\YunDa.SOMS.Commdb.csproj", "{76D765C8-89D0-4BD8-AC00-117605809EFE}" EndProject @@ -114,7 +117,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yunda.SOMS.OperationsMainSi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCPU", "test\TestCPU\TestCPU.csproj", "{7D90211D-07EA-436E-8147-9D3296CEF400}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTest", "test\ConsoleTest\ConsoleTest.csproj", "{3BE9DBEE-1FE7-44C7-93DA-7F213D43C44E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleTest", "test\ConsoleTest\ConsoleTest.csproj", "{3BE9DBEE-1FE7-44C7-93DA-7F213D43C44E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YunDa.SOMS.ProDB", "src\YunDa.Domain\ProtectionDeviceSqlite\YunDa.SOMS.ProDB\YunDa.SOMS.ProDB\YunDa.SOMS.ProDB.csproj", "{1C7AC379-5A1C-4266-B469-83F529979EFE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -849,6 +854,24 @@ Global {3BE9DBEE-1FE7-44C7-93DA-7F213D43C44E}.Template|x64.Build.0 = Debug|Any CPU {3BE9DBEE-1FE7-44C7-93DA-7F213D43C44E}.Template|x86.ActiveCfg = Debug|Any CPU {3BE9DBEE-1FE7-44C7-93DA-7F213D43C44E}.Template|x86.Build.0 = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Debug|x64.ActiveCfg = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Debug|x64.Build.0 = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Debug|x86.ActiveCfg = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Debug|x86.Build.0 = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Release|Any CPU.Build.0 = Release|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Release|x64.ActiveCfg = Release|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Release|x64.Build.0 = Release|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Release|x86.ActiveCfg = Release|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Release|x86.Build.0 = Release|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Template|Any CPU.ActiveCfg = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Template|Any CPU.Build.0 = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Template|x64.ActiveCfg = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Template|x64.Build.0 = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Template|x86.ActiveCfg = Debug|Any CPU + {1C7AC379-5A1C-4266-B469-83F529979EFE}.Template|x86.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -901,9 +924,10 @@ Global {505F0B5A-4AEB-499C-8937-19FE950B0354} = {A49CD7CD-52BA-48F3-83D5-D6CA072F8849} {7D90211D-07EA-436E-8147-9D3296CEF400} = {F10AA149-2626-486E-85BB-9CD5365F3016} {3BE9DBEE-1FE7-44C7-93DA-7F213D43C44E} = {F10AA149-2626-486E-85BB-9CD5365F3016} + {1C7AC379-5A1C-4266-B469-83F529979EFE} = {9D1CDEF4-094D-4906-8D8B-7A9109CD84BE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - VisualSVNWorkingCopyRoot = . SolutionGuid = {B516B1E8-1CEC-4BCC-BA92-93CB32845E37} + VisualSVNWorkingCopyRoot = . EndGlobalSection EndGlobal diff --git a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/BoardCardInfoAppService.cs b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/BoardCardInfoAppService.cs index 4e8aa48..eb9be3c 100644 --- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/BoardCardInfoAppService.cs +++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/BoardCardInfoAppService.cs @@ -21,10 +21,12 @@ using YunDa.ISAS.DataTransferObject; using YunDa.ISAS.Entities.GeneralInformation; using YunDa.ISAS.Redis.Repositories; using YunDa.ISMS.BASE.Entities.Models; +using YunDa.SOMS.DataTransferObject.CommonDto; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.HistoryData; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.SearchCondition; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionSettingDto; +using YunDa.SOMS.DataTransferObject.MainStationMaintenanceInfo.OperationReport; using YunDa.SOMS.Entities.GeneralInformation; namespace YunDa.ISAS.Application.GeneralInformation @@ -45,7 +47,7 @@ namespace YunDa.ISAS.Application.GeneralInformation private readonly IRepository _imProtectDeviceRepository; private readonly IUnitOfWorkManager _unitOfWorkManager; - IRedisRepository _deviceBoardStatesRedis; + IRedisRepository _deviceBoardStatesRedis; string deviceIORedisKey = "deviceIO"; IRedisRepository _deviceIOsRedis; @@ -69,7 +71,7 @@ namespace YunDa.ISAS.Application.GeneralInformation IRepository boardCardInfoRepository, IRepository boardCardHistoryRepository, IRepository manufacturerInfoRepository, - IRedisRepository deviceBoardStatesRedis, + IRedisRepository deviceBoardStatesRedis, IRedisRepository deviceIOsRedis, IRepository protectionDeviceTypeRepository, ISessionAppService sessionAppService @@ -331,27 +333,7 @@ namespace YunDa.ISAS.Application.GeneralInformation RequestResult rst = new RequestResult(); return rst; } - List iopositions = new List - { - "运行", - "告警", - "跳闸", - "重合闸", - "重合闸就绪", - "备自投", - "备自投就绪", - "分位", - "合位", - "检修", - "重合闸动作", - - "IO插件1", - "IO插件2", - "IO插件3", - "IO插件4", - "电源插件(IO5)", - "液晶" - }; + string deviceBoardStatesRedisKey = "deviceBoardStates"; /// /// 获取板卡状态 @@ -380,39 +362,8 @@ namespace YunDa.ISAS.Application.GeneralInformation { var state = await _deviceBoardStatesRedis.HashSetGetAllAsync(deviceBoardStatesRedisKey, protectionDeviceInfo.DeviceAddress.ToString()); - if (state != null && state.Length == 8) - { - List datas = new(); - for (int i = 0; i < iopositions.Count; i++) - { - if (i == 0) - { - datas.Add(new DeviceRunState - { - Name =iopositions[0] , - State = state[0] - }); - } - else if(i<11) - { - datas.Add(new DeviceRunState - { - Name = iopositions[i], - State = -1 - }); - } - else - { - datas.Add(new DeviceRunState - { - Name = iopositions[i], - State = state[i-9] - }); - } - } - rst.ResultData = datas; - rst.Flag = true; - } + rst.ResultData = state.States.Select(t=>new DeviceRunState { Name = t.Name,State = t.Value}).ToList(); + rst.Flag = true; } } catch (Exception ex) diff --git a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/IBoardCardInfoAppService.cs b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/IBoardCardInfoAppService.cs index ce418c9..d7ee4b5 100644 --- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/IBoardCardInfoAppService.cs +++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/IBoardCardInfoAppService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading.Tasks; using YunDa.ISAS.Application.Core; using YunDa.ISAS.DataTransferObject; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto; @@ -16,5 +17,12 @@ namespace YunDa.ISAS.Application.GeneralInformation /// /// RequestResult> FindHistoryDataByEquipmentInfoId(Guid? equipmentInfoId); + /// + /// 查询板卡在线信息 + /// + /// + /// + /// + Task>> GetBoardStateInfo(Guid equipmentId, Guid deviceId); } } diff --git a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/IProtectionDeviceAppService.cs b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/IProtectionDeviceAppService.cs index fe0c918..a482b08 100644 --- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/IProtectionDeviceAppService.cs +++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/IProtectionDeviceAppService.cs @@ -6,6 +6,7 @@ using YunDa.ISAS.DataTransferObject.CommonDto; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.HistoryData; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.SearchCondition; +using YunDa.SOMS.DataTransferObject.MainStationMaintenanceInfo.OperationReport; namespace YunDa.ISAS.Application.GeneralInformation { @@ -30,5 +31,12 @@ namespace YunDa.ISAS.Application.GeneralInformation /// /// RequestResult> FindProtectionDeviceForSelect(Guid stationId); + /// + /// 获取装置事件类型 + /// + /// + /// + /// + RequestResult GetDeviceEventType(int deviceAddr, int eventCode); } } diff --git a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs index 4312dcf..d3bb13c 100644 --- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs +++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs @@ -893,7 +893,7 @@ namespace YunDa.ISAS.Application.GeneralInformation return rst; } /// - /// 获取装置时间类型 + /// 获取装置事件类型 /// /// /// @@ -928,7 +928,7 @@ namespace YunDa.ISAS.Application.GeneralInformation catch (Exception ex) { rst.Message = ex.Message; - Log4Helper.Error(this.GetType(), "线路管理服务", ex); + Log4Helper.Error(this.GetType(), "获取装置事件类型", ex); } return rst; } diff --git a/src/YunDa.Application/YunDa.ISAS.DataTransferObject/CommonDto/NameValueProperty.cs b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/CommonDto/NameValueProperty.cs new file mode 100644 index 0000000..b384090 --- /dev/null +++ b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/CommonDto/NameValueProperty.cs @@ -0,0 +1,60 @@ +using Abp.Application.Services.Dto; +using MessagePack; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace YunDa.SOMS.DataTransferObject.CommonDto +{ + [MessagePackObject(keyAsPropertyName: true)] + public class NameValueProperty : NameValueProperty + { + public NameValueProperty() + { + + } + + public NameValueProperty(string name, string value) + { + Name = name; + Value = value; + } + } + + [MessagePackObject(keyAsPropertyName: true)] + public class NameValueProperty + { + public string Name { get; set; } + + public T Value { get; set; } + + public NameValueProperty() + { + + } + public NameValueProperty(string name, T value) + { + Name = name; + Value = value; + } + } + [MessagePackObject(keyAsPropertyName: true)] + public class NameIntValueProperty + { + public string Name { get; set; } + + public int Value { get; set; } + + public NameIntValueProperty() + { + + } + public NameIntValueProperty(string name, int value) + { + Name = name; + Value = value; + } + } +} diff --git a/src/YunDa.Application/YunDa.ISAS.DataTransferObject/MainStationMaintenanceInfo/OperationReport/BCodeAndNTP.cs b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/MainStationMaintenanceInfo/OperationReport/BCodeAndNTP.cs index 447507a..c50ccac 100644 --- a/src/YunDa.Application/YunDa.ISAS.DataTransferObject/MainStationMaintenanceInfo/OperationReport/BCodeAndNTP.cs +++ b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/MainStationMaintenanceInfo/OperationReport/BCodeAndNTP.cs @@ -8,7 +8,17 @@ namespace YunDa.SOMS.DataTransferObject.MainStationMaintenanceInfo.OperationRepo { public class BCodeAndNTP { + /// + /// 设备Id + /// + public Guid EquipmentInfoId { get; set; } + /// + /// B码是否成功 + /// public bool BCode { get; set; } + /// + /// NTP是否成功 + /// public bool NTP { get; set; } } } diff --git a/src/YunDa.Application/YunDa.ISAS.DataTransferObject/MainStationMaintenanceInfo/OperationReport/DeviceBoardStates.cs b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/MainStationMaintenanceInfo/OperationReport/DeviceBoardStates.cs new file mode 100644 index 0000000..2be0522 --- /dev/null +++ b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/MainStationMaintenanceInfo/OperationReport/DeviceBoardStates.cs @@ -0,0 +1,21 @@ +using MessagePack; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Permissions; +using System.Text; +using System.Threading.Tasks; +using YunDa.SOMS.DataTransferObject.CommonDto; + +namespace YunDa.SOMS.DataTransferObject.MainStationMaintenanceInfo.OperationReport +{ + [MessagePackObject(keyAsPropertyName: true)] + public class DeviceBoardStates + { + public Guid EquipmentInfoId { get; set; } + public string EquipmentInfoName { get; set; } + public List States { get; set; } + [MessagePackFormatter(typeof(DateTimeAsUnixTimeFormatter))] + public DateTime Time { get; set; } + } +} diff --git a/src/YunDa.Application/YunDa.ISAS.DataTransferObject/YunDa.ISAS.DataTransferObject.xml b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/YunDa.ISAS.DataTransferObject.xml index a297e6d..2808e64 100644 --- a/src/YunDa.Application/YunDa.ISAS.DataTransferObject/YunDa.ISAS.DataTransferObject.xml +++ b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/YunDa.ISAS.DataTransferObject.xml @@ -15625,6 +15625,21 @@ 设备名称。 + + + 设备Id + + + + + B码是否成功 + + + + + NTP是否成功 + + 装置监视数据 diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbADbinfo.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbADbinfo.cs new file mode 100644 index 0000000..0ad9b6c --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbADbinfo.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbADbinfo +{ + public int? Id { get; set; } + + public int? RecordIndex { get; set; } + + public string? Crcprogram { get; set; } + + public int? VerInfo { get; set; } + + public int? Status { get; set; } + + public string? UpdateWhat { get; set; } + + public string? UpdateWho { get; set; } + + public string? DatetimeUpdateWhen { get; set; } + + public int? DeviceTypeCode { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbActionFlag.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbActionFlag.cs new file mode 100644 index 0000000..6e93964 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbActionFlag.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbActionFlag +{ + public int? DeviceTypeCode { get; set; } + + public int? ActionFlag { get; set; } + + public string? ActionDesc { get; set; } + + public string? Lcden { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbContactDi.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbContactDi.cs new file mode 100644 index 0000000..cd21a7b --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbContactDi.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbContactDi +{ + public int? DeviceTypeCode { get; set; } + + public int? Bit { get; set; } + + public string? Title { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbContactDo.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbContactDo.cs new file mode 100644 index 0000000..5c354b5 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbContactDo.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbContactDo +{ + public int? DeviceTypeCode { get; set; } + + public int? Bit { get; set; } + + public string? Title { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbCpufpga.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbCpufpga.cs new file mode 100644 index 0000000..729742a --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbCpufpga.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbCpufpga +{ + public int? Id { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? Ver { get; set; } + + public int? SendDelay { get; set; } + + public int? OutTimerSource { get; set; } + + public int? Ft3dataBaudRate { get; set; } + + public int? Ft3delayTime { get; set; } + + public int? Ft3volRatio { get; set; } + + public int? MultiplierCh1 { get; set; } + + public int? ZeroDriftCh1 { get; set; } + + public int? MultiplierCh2 { get; set; } + + public int? ZeroDriftCh2 { get; set; } + + public int? MultiplierCh3 { get; set; } + + public int? ZeroDriftCh3 { get; set; } + + public int? MultiplierCh4 { get; set; } + + public int? ZeroDriftCh4 { get; set; } + + public int? MultiplierCh5 { get; set; } + + public int? ZeroDriftCh5 { get; set; } + + public int? MultiplierCh6 { get; set; } + + public int? ZeroDriftCh6 { get; set; } + + public int? MultiplierCh7 { get; set; } + + public int? ZeroDriftCh7 { get; set; } + + public int? MultiplierCh8 { get; set; } + + public int? ZeroDriftCh8 { get; set; } + + public int? MultiplierCh9 { get; set; } + + public int? ZeroDriftCh9 { get; set; } + + public int? MultiplierCh10 { get; set; } + + public int? ZeroDriftCh10 { get; set; } + + public int? MultiplierCh11 { get; set; } + + public int? ZeroDriftCh11 { get; set; } + + public int? MultiplierCh12 { get; set; } + + public int? ZeroDriftCh12 { get; set; } + + public int? MultiplierCh13 { get; set; } + + public int? ZeroDriftCh13 { get; set; } + + public int? MultiplierCh14 { get; set; } + + public int? ZeroDriftCh14 { get; set; } + + public int? MultiplierCh15 { get; set; } + + public int? ZeroDriftCh15 { get; set; } + + public int? MultiplierCh16 { get; set; } + + public int? ZeroDriftCh16 { get; set; } + + public int? MappingCh1 { get; set; } + + public int? MappingCh2 { get; set; } + + public int? MappingCh3 { get; set; } + + public int? MappingCh4 { get; set; } + + public int? MappingCh5 { get; set; } + + public int? MappingCh6 { get; set; } + + public int? MappingCh7 { get; set; } + + public int? MappingCh8 { get; set; } + + public int? MappingCh9 { get; set; } + + public int? MappingCh10 { get; set; } + + public int? MappingCh11 { get; set; } + + public int? MappingCh12 { get; set; } + + public string? MappingCh13 { get; set; } + + public int? MappingCh14 { get; set; } + + public int? MappingCh15 { get; set; } + + public int? MappingCh16 { get; set; } + + public int? MappingCh17 { get; set; } + + public int? MappingCh18 { get; set; } + + public int? MappingCh19 { get; set; } + + public int? MappingCh20 { get; set; } + + public int? MappingCh21 { get; set; } + + public int? MappingCh22 { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDevCat.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDevCat.cs new file mode 100644 index 0000000..868e262 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDevCat.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDevCat +{ + public int? Id { get; set; } + + public int? DeviceCat { get; set; } + + public string? Desc { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDeviceType.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDeviceType.cs new file mode 100644 index 0000000..753a1df --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDeviceType.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDeviceType +{ + public int? DeviceTypeCode { get; set; } + + public string? DeviceName { get; set; } + + public int? DeviceCategory { get; set; } + + public int? In2 { get; set; } + + public int? Un2 { get; set; } + + public string? BoolDkjltable { get; set; } + + public string? BoolQlxltable { get; set; } + + public string? ShortName { get; set; } + + public string? Pname { get; set; } + + public string? Io1type { get; set; } + + public string? Io2type { get; set; } + + public string? Io3type { get; set; } + + public string? Io4type { get; set; } + + public int? RefDeviceEvent { get; set; } + + public string? BoolHaveTouTui { get; set; } + + public int? TouTuiChl { get; set; } + + public string? Lcden { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzDkjl.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzDkjl.cs new file mode 100644 index 0000000..f57c511 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzDkjl.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDzDkjl +{ + public int? Id { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public string? SqlGroup { get; set; } + + public string? Dzname { get; set; } + + public string? ValMin { get; set; } + + public string? ValMax { get; set; } + + public string? Uint2 { get; set; } + + public string? Uint1 { get; set; } + + public int? DztypeCode { get; set; } + + public int? EnumId { get; set; } + + public string? DefaultVal { get; set; } + + public double? Scale2 { get; set; } + + public double? Scale1 { get; set; } + + public int? RelCt2 { get; set; } + + public int? RelCt1 { get; set; } + + public int? RelPt2 { get; set; } + + public int? RelPt1 { get; set; } + + public int? Ptctindex { get; set; } + + public string? BoolVisable { get; set; } + + public string? BoolModify { get; set; } + + public string? Lcdname { get; set; } + + public string? Lcden { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzKzz.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzKzz.cs new file mode 100644 index 0000000..169b346 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzKzz.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDzKzz +{ + public int? DeviceTypeCode { get; set; } + + public int? SqlGroup { get; set; } + + public int? SqlIndex { get; set; } + + public string? YabanName { get; set; } + + public string? Lcden { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzSconf.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzSconf.cs new file mode 100644 index 0000000..02949e9 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzSconf.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDzSconf +{ + public double? Id { get; set; } + + public double? DeviceTypeCode { get; set; } + + public double? SqlIndex { get; set; } + + public string? SqlGroup { get; set; } + + public string? Dzname { get; set; } + + public string? ValMin { get; set; } + + public string? ValMax { get; set; } + + public string? Uint2 { get; set; } + + public string? Uint1 { get; set; } + + public double? DztypeCode { get; set; } + + public double? EnumId { get; set; } + + public decimal? DefaultVal { get; set; } + + public double? Scale2 { get; set; } + + public double? Scale1 { get; set; } + + public string? RelCt2 { get; set; } + + public string? RelCt1 { get; set; } + + public string? RelPt2 { get; set; } + + public string? RelPt1 { get; set; } + + public string? Ptctindex { get; set; } + + public string? BoolVisable { get; set; } + + public string? BoolModify { get; set; } + + public string? Lcdname { get; set; } + + public string? LcdnameBt { get; set; } + + public string? Lcden { get; set; } + + public string? Lcdenbt { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzSy.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzSy.cs new file mode 100644 index 0000000..67ef793 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzSy.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDzSy +{ + public int? Id { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public string? SqlGroup { get; set; } + + public string? Dzname { get; set; } + + public string? ValMin { get; set; } + + public string? ValMax { get; set; } + + public string? Uint2 { get; set; } + + public string? Uint1 { get; set; } + + public int? DztypeCode { get; set; } + + public int? EnumId { get; set; } + + public string? DefaultVal { get; set; } + + public double? Scale2 { get; set; } + + public double? Scale1 { get; set; } + + public int? RelCt2 { get; set; } + + public int? RelCt1 { get; set; } + + public int? RelPt2 { get; set; } + + public int? RelPt1 { get; set; } + + public int? Ptctindex { get; set; } + + public string? BoolVisable { get; set; } + + public string? BoolModify { get; set; } + + public string? Lcdname { get; set; } + + public string? LcdnameBt { get; set; } + + public string? Lcden { get; set; } + + public string? Lcdenbt { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzUser.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzUser.cs new file mode 100644 index 0000000..90268ca --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzUser.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDzUser +{ + public int? Id { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public string? SqlGroup { get; set; } + + public string? Dzname { get; set; } + + public string? ValMin { get; set; } + + public string? ValMax { get; set; } + + public string? Uint2 { get; set; } + + public string? Uint1 { get; set; } + + public int? DztypeCode { get; set; } + + public int? EnumId { get; set; } + + public string? DefaultVal { get; set; } + + public double? Scale2 { get; set; } + + public double? Scale1 { get; set; } + + public int? RelCt2 { get; set; } + + public int? RelCt1 { get; set; } + + public int? RelPt2 { get; set; } + + public int? RelPt1 { get; set; } + + public int? Ptctindex { get; set; } + + public string? BoolVisable { get; set; } + + public string? BoolModify { get; set; } + + public string? Lcdname { get; set; } + + public string? LcdnameBt { get; set; } + + public string? Lcden { get; set; } + + public string? Lcdenbt { get; set; } + + public int? Coeffi { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzYxset.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzYxset.cs new file mode 100644 index 0000000..0842948 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzYxset.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDzYxset +{ + public int? Id { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public string? SqlGroup { get; set; } + + public string? Dzname { get; set; } + + public double? ValMin { get; set; } + + public double? ValMax { get; set; } + + public string? Uint1 { get; set; } + + public string? Uint2 { get; set; } + + public int? DztypeCode { get; set; } + + public int? EnumId { get; set; } + + public string? DefaultVal { get; set; } + + public int? Scale1 { get; set; } + + public int? Scale2 { get; set; } + + public int? RelativePt { get; set; } + + public int? RelativeCt { get; set; } + + public string? BoolVisable { get; set; } + + public string? BoolModify { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzenum.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzenum.cs new file mode 100644 index 0000000..f06a280 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDzenum.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDzenum +{ + public int? DzenumId { get; set; } + + public string? DzenmuIddesc { get; set; } + + public int? DzenumValue { get; set; } + + public string? DzenumName { get; set; } + + public string? Lcden { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDztype.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDztype.cs new file mode 100644 index 0000000..c9d7ceb --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbDztype.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbDztype +{ + public int? DztypeCode { get; set; } + + public string? DztypeName { get; set; } + + public int? Dzlength { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbEventBh.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbEventBh.cs new file mode 100644 index 0000000..fd17f95 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbEventBh.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbEventBh +{ + public double? DeviceTypeCode { get; set; } + + public double? EventCode { get; set; } + + public string? Event { get; set; } + + public string? Lcdevent { get; set; } + + public int? DeviceCat { get; set; } + + public string? Lcden { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbEventZj.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbEventZj.cs new file mode 100644 index 0000000..b6cd719 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbEventZj.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbEventZj +{ + public int? DeciceTypeCode { get; set; } + + public int? SelfCheckCode { get; set; } + + public string? Description { get; set; } + + public string? Lcden { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbFpgatype.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbFpgatype.cs new file mode 100644 index 0000000..09d9e11 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbFpgatype.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbFpgatype +{ + public int? TypeId { get; set; } + + public string? TypeDesc { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGckg.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGckg.cs new file mode 100644 index 0000000..da45b65 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGckg.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbGckg +{ + public int? SqlIndex { get; set; } + + public string? Name { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGcmodel.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGcmodel.cs new file mode 100644 index 0000000..2e645fb --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGcmodel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbGcmodel +{ + public int? SqlIndex { get; set; } + + public string? ModelName { get; set; } + + public string? ModelValue { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGooseCd.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGooseCd.cs new file mode 100644 index 0000000..600f055 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGooseCd.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbGooseCd +{ + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public int? Channel { get; set; } + + public string? ChannelName { get; set; } + + public int? YxIndex { get; set; } + + public int? Board { get; set; } + + public int? Type { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGooseKc.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGooseKc.cs new file mode 100644 index 0000000..c0364da --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGooseKc.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbGooseKc +{ + public int? DeviceTypeCode { get; set; } + + public string? Kcduanzi { get; set; } + + public int? SqlIndex { get; set; } + + public string? Kcname { get; set; } + + public string? InVarName { get; set; } + + public string? Board { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGooseKr.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGooseKr.cs new file mode 100644 index 0000000..fd39d05 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbGooseKr.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbGooseKr +{ + public int? DeviceTypeCode { get; set; } + + public string? Krduanzi { get; set; } + + public int? SqlIndex { get; set; } + + public string? Krtype { get; set; } + + public string? Krname { get; set; } + + public string? InVarName { get; set; } + + public string? Bit { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKc.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKc.cs new file mode 100644 index 0000000..fd52da4 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKc.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbKc +{ + public int? DeviceTypeCode { get; set; } + + public string? Kcduanzi { get; set; } + + public int? SqlIndex { get; set; } + + public string? Kcname { get; set; } + + public string? Board { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKctest.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKctest.cs new file mode 100644 index 0000000..cf936e2 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKctest.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbKctest +{ + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public int? Channel { get; set; } + + public string? ChannelName { get; set; } + + public int? YxIndex { get; set; } + + public int? Board { get; set; } + + public int? Type { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKdadjust.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKdadjust.cs new file mode 100644 index 0000000..3d1c294 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKdadjust.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbKdadjust +{ + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public int? Channel { get; set; } + + public string? ChannelName { get; set; } + + public double? Value5A { get; set; } + + public int? Ycindex { get; set; } + + public int? Value1A { get; set; } + + public int? Value5V { get; set; } + + public int? Value10V { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKr.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKr.cs new file mode 100644 index 0000000..9ca9313 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKr.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbKr +{ + public int? DeviceTypeCode { get; set; } + + public string? Krduanzi { get; set; } + + public int? CommIndex { get; set; } + + public int? BoardIndex { get; set; } + + public string? Krname { get; set; } + + public int? DisplayIndex { get; set; } + + public string? Lcden { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKrtx.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKrtx.cs new file mode 100644 index 0000000..b0a2db1 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKrtx.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbKrtx +{ + public int? Id { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public string? SetStr { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKxzttd.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKxzttd.cs new file mode 100644 index 0000000..2c1d0fe --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbKxzttd.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbKxzttd +{ + public int? Id { get; set; } + + public int? TongDaoHao { get; set; } + + public string? TongDaoName { get; set; } + + public string? TimeAllow { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbLanguage.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbLanguage.cs new file mode 100644 index 0000000..6c43f3c --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbLanguage.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbLanguage +{ + public int? 编号 { get; set; } + + public int? SqlIndex { get; set; } + + public string? LanguageName1 { get; set; } + + public string? LanguageName2 { get; set; } + + public string? Code { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbLight.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbLight.cs new file mode 100644 index 0000000..7366340 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbLight.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbLight +{ + public int? 编号 { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public int? Type { get; set; } + + public string? Name { get; set; } + + public int? Color { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbTable.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbTable.cs new file mode 100644 index 0000000..77b63c3 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbTable.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbTable +{ + public int? 级别 { get; set; } + + public string? 描述 { get; set; } + + public string? 对应表 { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbUpdateLog.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbUpdateLog.cs new file mode 100644 index 0000000..50e4202 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbUpdateLog.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbUpdateLog +{ + public int? Id { get; set; } + + public string? Editor { get; set; } + + public string? DatetimeUpdDate { get; set; } + + public string? UpdDesc { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbUser.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbUser.cs new file mode 100644 index 0000000..8c51bcf --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbUser.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbUser +{ + public int? Id { get; set; } + + public string? UserName { get; set; } + + public string? SqlGroup { get; set; } + + public string? Password { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbWaveDefine.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbWaveDefine.cs new file mode 100644 index 0000000..81cd598 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbWaveDefine.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbWaveDefine +{ + public int? SqlIndex { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? ChannelId { get; set; } + + public string? ChannelName { get; set; } + + public string? Unit1 { get; set; } + + public string? Unit2 { get; set; } + + public string? ChannelNameB { get; set; } + + public string? ChannelType { get; set; } + + public string? Lcden { get; set; } + + public string? Lcdebbt { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbXieboDlzl.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbXieboDlzl.cs new file mode 100644 index 0000000..197122c --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbXieboDlzl.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbXieboDlzl +{ + public int? Id { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? Line { get; set; } + + public int? Col { get; set; } + + public string? XieBoName { get; set; } + + public string? XieBoFuhao { get; set; } + + public int? Type { get; set; } + + public string? Unit { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYabanTest.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYabanTest.cs new file mode 100644 index 0000000..3882258 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYabanTest.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbYabanTest +{ + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public int? Channel { get; set; } + + public string? ChannelName { get; set; } + + public int? YxIndex { get; set; } + + public int? Board { get; set; } + + public int? Type { get; set; } + + public string? Lcden { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYc.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYc.cs new file mode 100644 index 0000000..2f7a29f --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYc.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbYc +{ + public int? Id { get; set; } + + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public int? Jzchannel { get; set; } + + public string? Duanzi { get; set; } + + public string? InVarName { get; set; } + + public int? Jzvalue { get; set; } + + public int? Jzvalue1A { get; set; } + + public int? Jzvalue5A { get; set; } + + public string? Ycname { get; set; } + + public int? Coeff { get; set; } + + public string? Unit { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYctype.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYctype.cs new file mode 100644 index 0000000..3293ccf --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYctype.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbYctype +{ + public int? Yctype { get; set; } + + public string? Ycname { get; set; } + + public string? Yccategory { get; set; } + + public string? Uint1 { get; set; } + + public string? Uint2 { get; set; } + + public int? Coeff1 { get; set; } + + public int? Coeff2 { get; set; } + + public string? YcnameB { get; set; } + + public string? YccategoryB { get; set; } + + public int? DeviceCat { get; set; } + + public string? EnumStr { get; set; } + + public int? DeviceTypeCode { get; set; } + + public string? Lcden { get; set; } + + public string? Lcdenb { get; set; } + + public string? Type { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYcunit.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYcunit.cs new file mode 100644 index 0000000..6316adb --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYcunit.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbYcunit +{ + public int? SqlIndex { get; set; } + + public string? SiuintValue { get; set; } + + public string? Siuint { get; set; } + + public string? Name { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYk.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYk.cs new file mode 100644 index 0000000..7498dd9 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYk.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbYk +{ + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public int? Inf { get; set; } + + public string? CtrlType { get; set; } + + public string? ObjectName { get; set; } + + public string? Type { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYx.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYx.cs new file mode 100644 index 0000000..2e5e905 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbYx.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbYx +{ + public int? DeviceTypeCode { get; set; } + + public int? SqlIndex { get; set; } + + public int? Inf { get; set; } + + public string? ObjectName { get; set; } + + public string? CloseText { get; set; } + + public string? OpenText { get; set; } + + public int? Type { get; set; } + + public string? BoolVisable { get; set; } + + public string? BoolIsBsinfo { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbZtlj.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbZtlj.cs new file mode 100644 index 0000000..3d34ed3 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbZtlj.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbZtlj +{ + public int? 编号 { get; set; } + + public int? SqlIndex { get; set; } + + public string? Kgid { get; set; } + + public string? Kgconfig { get; set; } + + public string? Kgname { get; set; } + + public int? Kgpos { get; set; } + + public int? Kgtype { get; set; } + + public string? Desc { get; set; } + + public int? PosOnly { get; set; } + + public int? TypeOnly { get; set; } + + public int? DeviceTypeCode { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbZyb.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbZyb.cs new file mode 100644 index 0000000..da03c7f --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbZyb.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbZyb +{ + public int? DeviceTypeCode { get; set; } + + public double? SqlIndex { get; set; } + + public string? ChannelName { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbZyl.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbZyl.cs new file mode 100644 index 0000000..8338bc3 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Models/TbZyl.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace YunDa.SOMS.ProDB.Models; + +public partial class TbZyl +{ + public double? DeviceTypeCode { get; set; } + + public double? SqlIndex { get; set; } + + public double? LiansuoChannel { get; set; } + + public string? LiansuoDesc { get; set; } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Program.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Program.cs new file mode 100644 index 0000000..bc65a61 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/Program.cs @@ -0,0 +1,10 @@ +namespace YunDa.SOMS.ProDB +{ + internal class Program + { + static void Main(string[] args) + { + //Console.WriteLine("Hello, World!"); + } + } +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/ProtdbContext.cs b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/ProtdbContext.cs new file mode 100644 index 0000000..f52b0e5 --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/ProtdbContext.cs @@ -0,0 +1,709 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using YunDa.SOMS.ProDB.Models; + +namespace YunDa.SOMS.ProDB; + +public partial class ProtdbContext : DbContext +{ + private readonly string _databasePath; + + public ProtdbContext(string databasePath) + { + _databasePath = databasePath; + } + + public ProtdbContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet TbADbinfos { get; set; } + + public virtual DbSet TbActionFlags { get; set; } + + public virtual DbSet TbContactDis { get; set; } + + public virtual DbSet TbContactDos { get; set; } + + public virtual DbSet TbCpufpgas { get; set; } + + public virtual DbSet TbDevCats { get; set; } + + public virtual DbSet TbDeviceTypes { get; set; } + + public virtual DbSet TbDzDkjls { get; set; } + + public virtual DbSet TbDzKzzs { get; set; } + + public virtual DbSet TbDzSconfs { get; set; } + + public virtual DbSet TbDzSys { get; set; } + + public virtual DbSet TbDzUsers { get; set; } + + public virtual DbSet TbDzYxsets { get; set; } + + public virtual DbSet TbDzenums { get; set; } + + public virtual DbSet TbDztypes { get; set; } + + public virtual DbSet TbEventBhs { get; set; } + + public virtual DbSet TbEventZjs { get; set; } + + public virtual DbSet TbFpgatypes { get; set; } + + public virtual DbSet TbGckgs { get; set; } + + public virtual DbSet TbGcmodels { get; set; } + + public virtual DbSet TbGooseCds { get; set; } + + public virtual DbSet TbGooseKcs { get; set; } + + public virtual DbSet TbGooseKrs { get; set; } + + public virtual DbSet TbKcs { get; set; } + + public virtual DbSet TbKctests { get; set; } + + public virtual DbSet TbKdadjusts { get; set; } + + public virtual DbSet TbKrs { get; set; } + + public virtual DbSet TbKrtxes { get; set; } + + public virtual DbSet TbKxzttds { get; set; } + + public virtual DbSet TbLanguages { get; set; } + + public virtual DbSet TbLights { get; set; } + + public virtual DbSet TbTables { get; set; } + + public virtual DbSet TbUpdateLogs { get; set; } + + public virtual DbSet TbUsers { get; set; } + + public virtual DbSet TbWaveDefines { get; set; } + + public virtual DbSet TbXieboDlzls { get; set; } + + public virtual DbSet TbYabanTests { get; set; } + + public virtual DbSet TbYcs { get; set; } + + public virtual DbSet TbYctypes { get; set; } + + public virtual DbSet TbYcunits { get; set; } + + public virtual DbSet TbYks { get; set; } + + public virtual DbSet TbYxes { get; set; } + + public virtual DbSet TbZtljs { get; set; } + + public virtual DbSet TbZybs { get; set; } + + public virtual DbSet TbZyls { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseSqlite($"Data Source={_databasePath}"); + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_A_DBinfo"); + + entity.Property(e => e.Crcprogram).HasColumnName("CRCProgram"); + entity.Property(e => e.DatetimeUpdateWhen).HasColumnName("datetime_UpdateWhen"); + entity.Property(e => e.Id).HasColumnName("ID"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_ActionFlag"); + + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_Contact_DI"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_Contact_DO"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_CPUFPGA"); + + entity.Property(e => e.Ft3dataBaudRate).HasColumnName("FT3DataBaudRate"); + entity.Property(e => e.Ft3delayTime).HasColumnName("FT3DelayTime"); + entity.Property(e => e.Ft3volRatio).HasColumnName("FT3VolRatio"); + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.MappingCh1).HasColumnName("MappingCH1"); + entity.Property(e => e.MappingCh10).HasColumnName("MappingCH10"); + entity.Property(e => e.MappingCh11).HasColumnName("MappingCH11"); + entity.Property(e => e.MappingCh12).HasColumnName("MappingCH12"); + entity.Property(e => e.MappingCh13).HasColumnName("MappingCH13"); + entity.Property(e => e.MappingCh14).HasColumnName("MappingCH14"); + entity.Property(e => e.MappingCh15).HasColumnName("MappingCH15"); + entity.Property(e => e.MappingCh16).HasColumnName("MappingCH16"); + entity.Property(e => e.MappingCh17).HasColumnName("MappingCH17"); + entity.Property(e => e.MappingCh18).HasColumnName("MappingCH18"); + entity.Property(e => e.MappingCh19).HasColumnName("MappingCH19"); + entity.Property(e => e.MappingCh2).HasColumnName("MappingCH2"); + entity.Property(e => e.MappingCh20).HasColumnName("MappingCH20"); + entity.Property(e => e.MappingCh21).HasColumnName("MappingCH21"); + entity.Property(e => e.MappingCh22).HasColumnName("MappingCH22"); + entity.Property(e => e.MappingCh3).HasColumnName("MappingCH3"); + entity.Property(e => e.MappingCh4).HasColumnName("MappingCH4"); + entity.Property(e => e.MappingCh5).HasColumnName("MappingCH5"); + entity.Property(e => e.MappingCh6).HasColumnName("MappingCH6"); + entity.Property(e => e.MappingCh7).HasColumnName("MappingCH7"); + entity.Property(e => e.MappingCh8).HasColumnName("MappingCH8"); + entity.Property(e => e.MappingCh9).HasColumnName("MappingCH9"); + entity.Property(e => e.MultiplierCh1).HasColumnName("MultiplierCH1"); + entity.Property(e => e.MultiplierCh10).HasColumnName("MultiplierCH10"); + entity.Property(e => e.MultiplierCh11).HasColumnName("MultiplierCH11"); + entity.Property(e => e.MultiplierCh12).HasColumnName("MultiplierCH12"); + entity.Property(e => e.MultiplierCh13).HasColumnName("MultiplierCH13"); + entity.Property(e => e.MultiplierCh14).HasColumnName("MultiplierCH14"); + entity.Property(e => e.MultiplierCh15).HasColumnName("MultiplierCH15"); + entity.Property(e => e.MultiplierCh16).HasColumnName("MultiplierCH16"); + entity.Property(e => e.MultiplierCh2).HasColumnName("MultiplierCH2"); + entity.Property(e => e.MultiplierCh3).HasColumnName("MultiplierCH3"); + entity.Property(e => e.MultiplierCh4).HasColumnName("MultiplierCH4"); + entity.Property(e => e.MultiplierCh5).HasColumnName("MultiplierCH5"); + entity.Property(e => e.MultiplierCh6).HasColumnName("MultiplierCH6"); + entity.Property(e => e.MultiplierCh7).HasColumnName("MultiplierCH7"); + entity.Property(e => e.MultiplierCh8).HasColumnName("MultiplierCH8"); + entity.Property(e => e.MultiplierCh9).HasColumnName("MultiplierCH9"); + entity.Property(e => e.ZeroDriftCh1).HasColumnName("ZeroDriftCH1"); + entity.Property(e => e.ZeroDriftCh10).HasColumnName("ZeroDriftCH10"); + entity.Property(e => e.ZeroDriftCh11).HasColumnName("ZeroDriftCH11"); + entity.Property(e => e.ZeroDriftCh12).HasColumnName("ZeroDriftCH12"); + entity.Property(e => e.ZeroDriftCh13).HasColumnName("ZeroDriftCH13"); + entity.Property(e => e.ZeroDriftCh14).HasColumnName("ZeroDriftCH14"); + entity.Property(e => e.ZeroDriftCh15).HasColumnName("ZeroDriftCH15"); + entity.Property(e => e.ZeroDriftCh16).HasColumnName("ZeroDriftCH16"); + entity.Property(e => e.ZeroDriftCh2).HasColumnName("ZeroDriftCH2"); + entity.Property(e => e.ZeroDriftCh3).HasColumnName("ZeroDriftCH3"); + entity.Property(e => e.ZeroDriftCh4).HasColumnName("ZeroDriftCH4"); + entity.Property(e => e.ZeroDriftCh5).HasColumnName("ZeroDriftCH5"); + entity.Property(e => e.ZeroDriftCh6).HasColumnName("ZeroDriftCH6"); + entity.Property(e => e.ZeroDriftCh7).HasColumnName("ZeroDriftCH7"); + entity.Property(e => e.ZeroDriftCh8).HasColumnName("ZeroDriftCH8"); + entity.Property(e => e.ZeroDriftCh9).HasColumnName("ZeroDriftCH9"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DevCat"); + + entity.Property(e => e.Id).HasColumnName("ID"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DeviceType"); + + entity.Property(e => e.BoolDkjltable).HasColumnName("bool_DKJLTable"); + entity.Property(e => e.BoolHaveTouTui).HasColumnName("bool_HaveTouTui"); + entity.Property(e => e.BoolQlxltable).HasColumnName("bool_QLXLTable"); + entity.Property(e => e.Io1type).HasColumnName("IO1Type"); + entity.Property(e => e.Io2type).HasColumnName("IO2Type"); + entity.Property(e => e.Io3type).HasColumnName("IO3Type"); + entity.Property(e => e.Io4type).HasColumnName("IO4Type"); + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.Pname).HasColumnName("PName"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DZ_Dkjl"); + + entity.Property(e => e.BoolModify).HasColumnName("bool_Modify"); + entity.Property(e => e.BoolVisable).HasColumnName("bool_Visable"); + entity.Property(e => e.Dzname).HasColumnName("DZName"); + entity.Property(e => e.DztypeCode).HasColumnName("DZTypeCode"); + entity.Property(e => e.EnumId).HasColumnName("EnumID"); + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.Lcdname).HasColumnName("LCDName"); + entity.Property(e => e.Ptctindex).HasColumnName("PTCTIndex"); + entity.Property(e => e.RelCt1).HasColumnName("RelCT1"); + entity.Property(e => e.RelCt2).HasColumnName("RelCT2"); + entity.Property(e => e.RelPt1).HasColumnName("RelPT1"); + entity.Property(e => e.RelPt2).HasColumnName("RelPT2"); + entity.Property(e => e.SqlGroup).HasColumnName("sql_Group"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DZ_Kzz"); + + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.SqlGroup).HasColumnName("sql_Group"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DZ_SConf"); + + entity.Property(e => e.BoolModify).HasColumnName("bool_Modify"); + entity.Property(e => e.BoolVisable).HasColumnName("bool_Visable"); + entity.Property(e => e.Dzname).HasColumnName("DZName"); + entity.Property(e => e.DztypeCode).HasColumnName("DZTypeCode"); + entity.Property(e => e.EnumId).HasColumnName("EnumID"); + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.Lcdenbt).HasColumnName("LCDENBT"); + entity.Property(e => e.Lcdname).HasColumnName("LCDName"); + entity.Property(e => e.LcdnameBt).HasColumnName("LCDNameBT"); + entity.Property(e => e.Ptctindex).HasColumnName("PTCTIndex"); + entity.Property(e => e.RelCt1).HasColumnName("RelCT1"); + entity.Property(e => e.RelCt2).HasColumnName("RelCT2"); + entity.Property(e => e.RelPt1).HasColumnName("RelPT1"); + entity.Property(e => e.RelPt2).HasColumnName("RelPT2"); + entity.Property(e => e.SqlGroup).HasColumnName("sql_Group"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DZ_Sys"); + + entity.Property(e => e.BoolModify).HasColumnName("bool_Modify"); + entity.Property(e => e.BoolVisable).HasColumnName("bool_Visable"); + entity.Property(e => e.Dzname).HasColumnName("DZName"); + entity.Property(e => e.DztypeCode).HasColumnName("DZTypeCode"); + entity.Property(e => e.EnumId).HasColumnName("EnumID"); + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.Lcdenbt).HasColumnName("LCDENBT"); + entity.Property(e => e.Lcdname).HasColumnName("LCDName"); + entity.Property(e => e.LcdnameBt).HasColumnName("LCDNameBT"); + entity.Property(e => e.Ptctindex).HasColumnName("PTCTIndex"); + entity.Property(e => e.RelCt1).HasColumnName("RelCT1"); + entity.Property(e => e.RelCt2).HasColumnName("RelCT2"); + entity.Property(e => e.RelPt1).HasColumnName("RelPT1"); + entity.Property(e => e.RelPt2).HasColumnName("RelPT2"); + entity.Property(e => e.SqlGroup).HasColumnName("sql_Group"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DZ_User"); + + entity.Property(e => e.BoolModify).HasColumnName("bool_Modify"); + entity.Property(e => e.BoolVisable).HasColumnName("bool_Visable"); + entity.Property(e => e.Dzname).HasColumnName("DZName"); + entity.Property(e => e.DztypeCode).HasColumnName("DZTypeCode"); + entity.Property(e => e.EnumId).HasColumnName("EnumID"); + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.Lcdenbt).HasColumnName("LCDENBT"); + entity.Property(e => e.Lcdname).HasColumnName("LCDName"); + entity.Property(e => e.LcdnameBt).HasColumnName("LCDNameBT"); + entity.Property(e => e.Ptctindex).HasColumnName("PTCTIndex"); + entity.Property(e => e.RelCt1).HasColumnName("RelCT1"); + entity.Property(e => e.RelCt2).HasColumnName("RelCT2"); + entity.Property(e => e.RelPt1).HasColumnName("RelPT1"); + entity.Property(e => e.RelPt2).HasColumnName("RelPT2"); + entity.Property(e => e.SqlGroup).HasColumnName("sql_Group"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DZ_YXSet"); + + entity.Property(e => e.BoolModify).HasColumnName("bool_Modify"); + entity.Property(e => e.BoolVisable).HasColumnName("bool_Visable"); + entity.Property(e => e.Dzname).HasColumnName("DZName"); + entity.Property(e => e.DztypeCode).HasColumnName("DZTypeCode"); + entity.Property(e => e.EnumId).HasColumnName("EnumID"); + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.RelativeCt).HasColumnName("RelativeCT"); + entity.Property(e => e.RelativePt).HasColumnName("RelativePT"); + entity.Property(e => e.SqlGroup).HasColumnName("sql_Group"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DZEnum"); + + entity.Property(e => e.DzenmuIddesc).HasColumnName("DZEnmuIDDesc"); + entity.Property(e => e.DzenumId).HasColumnName("DZEnumID"); + entity.Property(e => e.DzenumName).HasColumnName("DZEnumName"); + entity.Property(e => e.DzenumValue).HasColumnName("DZEnumValue"); + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_DZType"); + + entity.Property(e => e.Dzlength).HasColumnName("DZlength"); + entity.Property(e => e.DztypeCode).HasColumnName("DZTypeCode"); + entity.Property(e => e.DztypeName).HasColumnName("DZTypeName"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_Event_BH"); + + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.Lcdevent).HasColumnName("LCDEvent"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_Event_ZJ"); + + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_FPGAType"); + + entity.Property(e => e.TypeId).HasColumnName("TypeID"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_GCKG"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_GCModel"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_GOOSE_CD"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_GOOSE_KC"); + + entity.Property(e => e.Kcduanzi).HasColumnName("KCDuanzi"); + entity.Property(e => e.Kcname).HasColumnName("KCname"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_GOOSE_KR"); + + entity.Property(e => e.Krduanzi).HasColumnName("KRDuanzi"); + entity.Property(e => e.Krname).HasColumnName("KRName"); + entity.Property(e => e.Krtype).HasColumnName("KRType"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_KC"); + + entity.Property(e => e.Kcduanzi).HasColumnName("KCDuanzi"); + entity.Property(e => e.Kcname).HasColumnName("KCname"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_KCTest"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_KDAdjust"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + entity.Property(e => e.Ycindex).HasColumnName("YCIndex"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_KR"); + + entity.Property(e => e.Krduanzi).HasColumnName("KRDuanzi"); + entity.Property(e => e.Krname).HasColumnName("KRName"); + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_KRTX"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_KXZTTD"); + + entity.Property(e => e.Id).HasColumnName("ID"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_Language"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_Lights"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_tables"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_UpdateLog"); + + entity.Property(e => e.DatetimeUpdDate).HasColumnName("datetime_UpdDate"); + entity.Property(e => e.Id).HasColumnName("ID"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_User"); + + entity.Property(e => e.Id).HasColumnName("id"); + entity.Property(e => e.Password).HasColumnName("password"); + entity.Property(e => e.SqlGroup).HasColumnName("sql_group"); + entity.Property(e => e.UserName).HasColumnName("userName"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_WaveDefine"); + + entity.Property(e => e.ChannelId).HasColumnName("ChannelID"); + entity.Property(e => e.Lcdebbt).HasColumnName("LCDEBBT"); + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_xiebo_DLZL"); + + entity.Property(e => e.Id).HasColumnName("ID"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_YabanTest"); + + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_YC"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Jzchannel).HasColumnName("JZChannel"); + entity.Property(e => e.Jzvalue).HasColumnName("JZValue"); + entity.Property(e => e.Jzvalue1A).HasColumnName("JZValue1A"); + entity.Property(e => e.Jzvalue5A).HasColumnName("JZValue5A"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + entity.Property(e => e.Ycname).HasColumnName("YCName"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_YCType"); + + entity.Property(e => e.Lcden).HasColumnName("LCDEN"); + entity.Property(e => e.Lcdenb).HasColumnName("LCDENB"); + entity.Property(e => e.Yccategory).HasColumnName("YCCategory"); + entity.Property(e => e.YccategoryB).HasColumnName("YCCategoryB"); + entity.Property(e => e.Ycname).HasColumnName("YCName"); + entity.Property(e => e.YcnameB).HasColumnName("YCNameB"); + entity.Property(e => e.Yctype).HasColumnName("YCType"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_YCUnit"); + + entity.Property(e => e.Siuint).HasColumnName("SIUint"); + entity.Property(e => e.SiuintValue).HasColumnName("SIUintValue"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_YK"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_YX"); + + entity.Property(e => e.BoolIsBsinfo).HasColumnName("bool_isBSInfo"); + entity.Property(e => e.BoolVisable).HasColumnName("bool_Visable"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_ZTLJ"); + + entity.Property(e => e.Kgconfig).HasColumnName("KGConfig"); + entity.Property(e => e.Kgid).HasColumnName("KGID"); + entity.Property(e => e.Kgname).HasColumnName("KGName"); + entity.Property(e => e.Kgpos).HasColumnName("KGPos"); + entity.Property(e => e.Kgtype).HasColumnName("KGType"); + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_ZYBS"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("tb_ZYLS"); + + entity.Property(e => e.SqlIndex).HasColumnName("sql_Index"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB.csproj b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB.csproj new file mode 100644 index 0000000..133475d --- /dev/null +++ b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB.csproj @@ -0,0 +1,19 @@ + + + + Exe + net8.0 + enable + enable + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + diff --git a/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/protdb.sql3 b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/protdb.sql3 new file mode 100644 index 0000000..2d61670 Binary files /dev/null and b/src/YunDa.Domain/ProtectionDeviceSqlite/YunDa.SOMS.ProDB/YunDa.SOMS.ProDB/protdb.sql3 differ diff --git a/src/YunDa.Domain/YunDa.ISAS.Redis.Entities/YunDa.SOMS.Redis.Entities.csproj b/src/YunDa.Domain/YunDa.ISAS.Redis.Entities/YunDa.SOMS.Redis.Entities.csproj index 095c864..9828f43 100644 --- a/src/YunDa.Domain/YunDa.ISAS.Redis.Entities/YunDa.SOMS.Redis.Entities.csproj +++ b/src/YunDa.Domain/YunDa.ISAS.Redis.Entities/YunDa.SOMS.Redis.Entities.csproj @@ -13,6 +13,7 @@ + diff --git a/src/YunDa.Domain/YunDa.ISAS.Redis/ISASRedisModule.cs b/src/YunDa.Domain/YunDa.ISAS.Redis/ISASRedisModule.cs index f38cd55..4d41e8b 100644 --- a/src/YunDa.Domain/YunDa.ISAS.Redis/ISASRedisModule.cs +++ b/src/YunDa.Domain/YunDa.ISAS.Redis/ISASRedisModule.cs @@ -18,6 +18,7 @@ using YunDa.ISAS.Redis.Entities.PatternRecongnition; using YunDa.ISAS.Redis.Entities.SortDefines; using YunDa.ISAS.Redis.Factory; using YunDa.ISAS.Redis.Repositories; +using YunDa.SOMS.DataTransferObject.CommonDto; using YunDa.SOMS.DataTransferObject.EquipmentLiveData; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionSettingDto; @@ -62,6 +63,7 @@ namespace YunDa.ISAS.Redis IocManager.Register, string>, RedisRepository, string>>(); IocManager.Register, string>, RedisRepository, string>>(); IocManager.Register, string>, RedisRepository, string>>(); + IocManager.Register, string>, RedisRepository, string>>(); IocManager.Register, RedisRepository>(); IocManager.Register, RedisRepository>(); @@ -98,8 +100,11 @@ namespace YunDa.ISAS.Redis IocManager.Register, RedisRepository>(); IocManager.Register, RedisRepository>(); IocManager.Register, RedisRepository>(); + IocManager.Register, string>, RedisRepository, string>>(); + IocManager.Register, string>, RedisRepository, string>>(); + IocManager.Register, RedisRepository>(); - + } } } diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/App.xaml.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/App.xaml.cs index d77f808..f372e1f 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/App.xaml.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/App.xaml.cs @@ -67,26 +67,18 @@ namespace Yunda.ISAS.DataMonitoringServer protected override void OnStartup(StartupEventArgs e) { - try - { - SplashScreen ss = new SplashScreen(@"./Images/splash_screen.png"); - ss.Show(true); - _bootstrapper.Initialize(); + SplashScreen ss = new SplashScreen(@"./Images/splash_screen.png"); + ss.Show(true); + _bootstrapper.Initialize(); - _bootstrapper.IocManager.Resolve(); - _bootstrapper.IocManager.Resolve(); - _dataWindow = _bootstrapper.IocManager.Resolve(); - //_webApiServer = _bootstrapper.IocManager.Resolve(); - //_webApiServer = _bootstrapper.IocManager.Resolve(); - _dataWindow.Show(); - ss.Close(new TimeSpan(0, 0, 0, 0)); - RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; - base.OnStartup(e); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } + _bootstrapper.IocManager.Resolve(); + _bootstrapper.IocManager.Resolve(); + _dataWindow = _bootstrapper.IocManager.Resolve(); + _dataWindow.Show(); + ss.Close(new TimeSpan(0, 0, 0, 0)); + RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; + base.OnStartup(e); + } protected override void OnExit(ExitEventArgs e) diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataAnalysis/DataCollection/DataSendTask.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataAnalysis/DataCollection/DataSendTask.cs index 5e6423a..8e10e62 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataAnalysis/DataCollection/DataSendTask.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataAnalysis/DataCollection/DataSendTask.cs @@ -114,11 +114,11 @@ namespace Yunda.ISAS.DataMonitoringServer.DataAnalysis.DataCollection while (true) { await SendDeviceSlefCheckInfo(); - await Task.Delay(3000); + await Task.Delay(1000); await SendSecondaryCircuitDiagnosticsInfo(); - await Task.Delay(3000); + await Task.Delay(1000); await SendEquipmentInfoRemainingLifeAssessmentInfo(); - await Task.Delay(3000); + await Task.Delay(1000); } }); @@ -375,7 +375,6 @@ namespace Yunda.ISAS.DataMonitoringServer.DataAnalysis.DataCollection } else { - Console.WriteLine("装置温度值超出范围, 设置为默认值 60°C"); data.SurfaceTemperature = 60; // 设置为默认温度 60°C } } @@ -392,7 +391,6 @@ namespace Yunda.ISAS.DataMonitoringServer.DataAnalysis.DataCollection { Random random = new Random(); data.CPU5V1 = (float)(random.NextDouble() * (5.02 - 4.98) + 4.98); - Console.WriteLine($"CPU5V电压1值超出范围, 设置为随机值: {data.CPU5V1}"); } } // 校验 5V 电压2 @@ -408,7 +406,6 @@ namespace Yunda.ISAS.DataMonitoringServer.DataAnalysis.DataCollection { Random random = new Random(); data.CPU5V2 = (float)(random.NextDouble() * (5.02 - 4.98) + 4.98); - Console.WriteLine($"CPU5V电压2值超出范围, 设置为随机值: {data.CPU5V2}"); } } // 校验 5V 电压3 @@ -426,7 +423,6 @@ namespace Yunda.ISAS.DataMonitoringServer.DataAnalysis.DataCollection // 设置为随机电压值(假设随机值在 4.78 到 4.82 之间) Random random = new Random(); data.CPU5V3 = (float)(random.NextDouble() * (5.02 - 4.98) + 5.02); - Console.WriteLine($"CPU5V电压3值超出范围, 设置为随机值: {data.CPU5V3}"); } } diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataAnalysis/MonitoringDataService.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataAnalysis/MonitoringDataService.cs index e4360eb..a3c5f2c 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataAnalysis/MonitoringDataService.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataAnalysis/MonitoringDataService.cs @@ -110,7 +110,9 @@ namespace Yunda.ISAS.DataMonitoringServer.DataAnalysis if (settingModel.DataSourceCategoryName =="综自") { MonitoringEventBus.LogHandler("启动装置定值接口", "装置定值"); + PortProcessManager.KillProcessByPort(7110); PortProcessManager.KillProcessByPort(2403); + await _protectionDeviceDataCenter.InitProtectionDeviceComms(); await InitSecondaryCircuitLogicExpressionDic(); _protectionDeviceDataCenter.InitDevices(); @@ -128,10 +130,12 @@ namespace Yunda.ISAS.DataMonitoringServer.DataAnalysis public void DataServiceStop() { _dataCollectionTask.CollectionStop(); //数据采集停止 - _dotNettyTcpServer.StopSeverAsync(); + _dotNettyTcpServer.StopServerAsync(); if (_settingModel.DataSourceCategoryName == "综自") { _protectionDeviceDataCenter.StopAllProcesses(); + PortProcessManager.KillProcessByPort(7110); + PortProcessManager.KillProcessByPort(2403); } } diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataCenter/RedisRepository.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataCenter/RedisRepository.cs index 68effe9..1bdb174 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataCenter/RedisRepository.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/DataCenter/RedisRepository.cs @@ -8,6 +8,7 @@ using YunDa.ISAS.Redis.Entities.CameraAuthCategory; using YunDa.ISAS.Redis.Entities.DataMonitorCategory; using YunDa.ISAS.Redis.Entities.LinkageCategory; using YunDa.ISAS.Redis.Repositories; +using YunDa.SOMS.DataTransferObject.CommonDto; using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto; using YunDa.SOMS.DataTransferObject.MainStationMaintenanceInfo.OperationReport; @@ -20,6 +21,8 @@ namespace Yunda.ISAS.DataMonitoringServer.DataCenter public IRedisRepository AlarmListRedis { get; } public IRedisRepository EnvironmentTempValueRedis { get; } public IRedisRepository EquipmentDataModelDicRedis { get; } + public IRedisRepository, string> _deviceBoardStatesRedis; + private readonly WPF.ViewModel.Content _settingModel; //public string TelemeteringModelInflectionInflectionListRediskey = "telemeteringModelInflectionList"; public string TelemeteringInflectionInflectionZZChannelRediskey = "telemeteringInflection_ZZ_Channel"; diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/FTPHandle/FtpFile.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/FTPHandle/FtpFile.cs index 6aa6a31..9cf93bc 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/FTPHandle/FtpFile.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/FTPHandle/FtpFile.cs @@ -73,7 +73,7 @@ namespace Yunda.SOMS.DataMonitoringServer.FTPHandle // 尝试下载文件到本地 if (client.DownloadFile(localFilePath, remoteFilePath) == FtpStatus.Success) { - MonitoringEventBus.LogHandler($"Successfully downloaded {fileName} from FTP.", "FTP信息"); + //MonitoringEventBus.LogHandler($"Successfully downloaded {fileName} from FTP.", "FTP信息"); // 下载成功,删除失败时间户记录 if (failedDownloadTimestamps.ContainsKey(key)) { @@ -137,7 +137,7 @@ namespace Yunda.SOMS.DataMonitoringServer.FTPHandle // 检查是否在上次失败之后的1小时内 if (failedDownloadTimestamps.ContainsKey(key) && DateTime.Now - failedDownloadTimestamps[key] < TimeSpan.FromHours(1)) { - MonitoringEventBus.LogHandler($"Download attempt skipped for {fileName} from {ftpHost} due to recent failure.", "FTP信息"); + //MonitoringEventBus.LogHandler($"Download attempt skipped for {fileName} from {ftpHost} due to recent failure.", "FTP信息"); return null; } @@ -153,7 +153,7 @@ namespace Yunda.SOMS.DataMonitoringServer.FTPHandle { if (client.DownloadStream(memoryStream, remoteFilePath)) { - MonitoringEventBus.LogHandler($"Successfully downloaded {fileName} from FTP.", "FTP信息"); + //MonitoringEventBus.LogHandler($"Successfully downloaded {fileName} from FTP.", "FTP信息"); // 下载成功,删除失败时间记录 if (failedDownloadTimestamps.ContainsKey(key)) { @@ -166,7 +166,7 @@ namespace Yunda.SOMS.DataMonitoringServer.FTPHandle // 下载失败,记录失败的时间 failedDownloadTimestamps[key] = DateTime.Now; string msg = $"Download failed for {fileName} from FTP."; - MonitoringEventBus.LogHandler(msg, "FTP信息"); + //MonitoringEventBus.LogHandler(msg, "FTP信息"); return null; // 下载失败,返回null } } diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceBCodeHandle.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceBCodeHandle.cs index 814a1a2..186f707 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceBCodeHandle.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceBCodeHandle.cs @@ -34,37 +34,44 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle _bcodeAndNTPRedis = bcodeAndNTPRedis; _dotNettyTcpServer.MessageReceived += OnMessageReceived; // 订阅事件 } - private async void OnMessageReceived(byte address, byte[] message, byte functionType) { try { + // 检查是否匹配指定的功能码 + if (functionType != 7 && functionType != 6) + { + return; // 如果不是功能码 7 或 6,直接返回 + } + var device = ProtectionDeviceDataCenter._devices.FirstOrDefault(t => t.DeviceAddr == address); if (device == null) return; var bcode = await _bcodeAndNTPRedis.HashSetGetOneAsync(nameof(BCodeAndNTP), address.ToString()) ?? new BCodeAndNTP(); - - switch (functionType) + bcode.EquipmentInfoId = device.EquipmentInfoId; + // 根据功能码处理逻辑 + if (functionType == 7) { - case 7: // B码对时状态 - bcode.BCode = message[1] != 1; - break; - - case 6: - BitArray bit0 = new BitArray(new byte[] { message[0] }); - bcode.NTP = bit0[3]; - break; - - default: - return; + // 处理功能码 7 的逻辑:B码对时状态 + bcode.BCode = message[1] != 1; + } + else if (functionType == 6) + { + // 处理功能码 6 的逻辑:NTP 状态 + BitArray bit0 = new BitArray(new byte[] { message[0] }); + bcode.NTP = bit0[3]; } + // 更新数据到 Redis await _bcodeAndNTPRedis.HashSetUpdateOneAsync(nameof(BCodeAndNTP), address.ToString(), bcode); + string channel = "bcodeAndNTPChannel"; + await _bcodeAndNTPRedis.PublishAsync(channel, bcode); } catch (Exception ex) { Log4Helper.Error(this.GetType(), "B码对时状态", ex); } } + } } diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceDataCenter.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceDataCenter.cs index f149bdc..d37d31b 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceDataCenter.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceDataCenter.cs @@ -45,7 +45,6 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle _protectionDeviceIOInfoHandle = protectionDeviceIOInfoHandle; _dotNettyTcpServer = dotNettyTcpServer; _protectionDeviceRunInfoHandle = protectionDeviceRunInfoHandle; - _dotNettyTcpServer.deviceBoardStatesAction += _dotNettyTcpServer_deviceBoardStatesAction; _deviceBoardStatesRedis = deviceBoardStatesRedis; _protectionDeviceSelfCheckHandle = protectionDeviceSelfCheckHandle; } @@ -60,17 +59,8 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle Log4Helper.Error(this.GetType(), "初始化装置IO错误", ex); } } - /// - /// 将装置状态写入到内存数据库中 - /// - /// - private void _dotNettyTcpServer_deviceBoardStatesAction(Dictionary deviceBoardStates) - { - if (deviceBoardStates.Count>0) - { - _deviceBoardStatesRedis.HashSetUpdateManyAsync(deviceBoardStatesRedisKey, deviceBoardStates.Keys.Select(t => t.ToString()).ToList(), deviceBoardStates.Values.ToList()); - } - } + + public List ProtectionDeviceComms { get; set; } public async Task InitProtectionDeviceComms() @@ -180,6 +170,10 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle { try { + if (ipAddress == "127.0.0.1"|| ipAddress == "localhost") + { + return false; + } using (Ping ping = new Ping()) { // 发送 Ping 请求,设置超时时间为 1000 毫秒 (1秒) diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs index 054aa60..bf1d2a0 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs @@ -17,6 +17,11 @@ using Yunda.ISAS.DataMonitoringServer.DataCenter; using YunDa.SOMS.DataTransferObject.MainStationMaintenanceInfo.OperationReport; using System.Windows.Interop; using FluentFTP; +using System.Collections; +using System.Collections.Concurrent; +using Yunda.SOMS.DataMonitoringServer.SQLiteData; +using Abp; +using YunDa.SOMS.DataTransferObject.CommonDto; namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle { @@ -26,10 +31,12 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle FtpFile _ftpFile; DotNettyTcpServer _dotNettyTcpServer; private readonly RedisDataRepository _redisDataRepository; + private readonly IRedisRepository _deviceBoardStatesRedis; public ProtectionDeviceRunInfoHandle( FtpFile ftpFile, - DotNettyTcpServer dotNettyTcpServer - , WebApiRequest webApiRequest, + DotNettyTcpServer dotNettyTcpServer, + IRedisRepository redisRepository, + WebApiRequest webApiRequest, RedisDataRepository redisDataRepository ) { @@ -38,8 +45,12 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle _dotNettyTcpServer = dotNettyTcpServer; _redisDataRepository = redisDataRepository; _dotNettyTcpServer.MessageReceived += OnMessageReceived; // 订阅事件 + _deviceBoardStatesRedis = redisRepository; } + //Dictionary _deviceRunStates = new Dictionary(); + //private ConcurrentDictionary _communicationStateCounts = new(); + int _commCount = 0; private void OnMessageReceived(byte address, byte[] message, byte functionType) { @@ -47,18 +58,19 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle { if (functionType == 6) //通信状态 { - if (_commCount == 0) + var device = ProtectionDeviceDataCenter._devices.FirstOrDefault(t => t.DeviceAddr == address); + if (device != null) { - var device = ProtectionDeviceDataCenter._devices.FirstOrDefault(t => t.DeviceAddr == address); - if (device != null) + UpdateDeviceBoardState(address, message, device); + if (_commCount == 0) { - SendEquipmentInfoRemainingLifeAssessment(device); + SendEquipmentInfoRemainingLifeAssessment(device); var bytes = _ftpFile.GetFileFromFtpToMem(device.GatewayIP1, "/nor/root/status/", "status.txt"); - if (bytes!=null) + if (bytes != null) { var data = ParseDeviceStatusFromBytes(bytes); - if (data!=null) + if (data != null) { data.ProtectionDeviceId = device.ProtectionDeviceId; data.EquipmentInfoId = device.EquipmentInfoId; @@ -68,8 +80,8 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle } } } - } + _commCount++; if (_commCount == 10) { @@ -97,86 +109,6 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle } } - /// - /// 格式化FTP数据 - /// - /// - /// - private DeviceStatus ParseDeviceStatus(string filePath) - { - var deviceStatus = new DeviceStatus(); - try - { - var networkInterfaces = new List(); - - string[] lines = File.ReadAllLines(filePath); - NetworkInterfaceStatus currentInterface = null; - - foreach (var line in lines) - { - var parts = line.Split(':', 2); - if (parts.Length < 2) continue; - - string key = parts[0].Trim(); - string value = parts[1].Trim(); - - switch (key) - { - case "使用内存": - deviceStatus.UsedMemory = value; - break; - case "空闲内存": - deviceStatus.FreeMemory = value; - break; - case "总磁盘": - deviceStatus.TotalDisk = value; - break; - case "使用磁盘": - deviceStatus.UsedDisk = value; - break; - case "104连接状态": - deviceStatus.ConnectionStatus104 = int.Parse(value); - break; - case "液晶操作密码": - deviceStatus.LcdOperationPassword = value; - break; - default: - if (key.StartsWith("网口")) - { - string[] netParts = key.Split(new[] { "网口", "IP", "状态", "速率", "累计时间", "起始时间", "发生帧数", "发送错误帧数", "接收帧数", "接收错误帧数" }, StringSplitOptions.RemoveEmptyEntries); - if (netParts.Length > 0) - { - string interfaceName = netParts[0]; - if (currentInterface == null || currentInterface.InterfaceName != interfaceName) - { - currentInterface = new NetworkInterfaceStatus { InterfaceName = interfaceName }; - networkInterfaces.Add(currentInterface); - } - - if (key.EndsWith("IP")) currentInterface.IpAddress = value; - if (key.EndsWith("状态")) currentInterface.Status = value; - if (key.EndsWith("速率")) currentInterface.Speed = value; - if (key.EndsWith("累计时间")) currentInterface.CumulativeTime = int.Parse(value.Replace("s", "").Trim()); - if (key.EndsWith("起始时间")) currentInterface.StartTime = value; - if (key.EndsWith("发生帧数")) currentInterface.SentFrames = int.Parse(value); - if (key.EndsWith("发送错误帧数")) currentInterface.SentErrorFrames = int.Parse(value); - if (key.EndsWith("接收帧数")) currentInterface.ReceivedFrames = int.Parse(value); - if (key.EndsWith("接收错误帧数")) currentInterface.ReceivedErrorFrames = int.Parse(value); - } - } - break; - } - } - - deviceStatus.NetworkInterfaces = networkInterfaces; - } - catch (Exception ex) - { - MonitoringEventBus.LogHandler(ex.Message, "格式化FTP数据"); - } - return deviceStatus; - } - /// /// 格式化FTP数据 /// @@ -257,6 +189,56 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle } return deviceStatus; } + + private void UpdateDeviceBoardState(byte address, byte[] data, ProtectionDeviceCommInfoOutput device) + { + if (!_deviceBoardStates.TryGetValue(address, out var boardStates)) + { + boardStates = iopositions.Select(item => new NameIntValueProperty(item.Name, item.Value)).ToList(); + _deviceBoardStates[address] = boardStates; + } + boardStates[0].Value = new BitArray(new byte[] { data[0] })[0] ? 0 : 1;//运行状态 + boardStates[1].Value = new BitArray(new byte[] { data[0] })[1] ? 0 : 1;//报警状态 + boardStates[7].Value = new BitArray(new byte[] { data[1] })[0] ? 0 : 1; // 液晶状态 + BitArray bit2 = new BitArray(new byte[] { data[2] }); + boardStates[2].Value = bit2[0] ? 0 : 1; + boardStates[3].Value = bit2[1] ? 0 : 1; + boardStates[4].Value = bit2[2] ? 0 : 1; + boardStates[5].Value = bit2[3] ? 0 : 1; + boardStates[6].Value = bit2[4] ? 0 : 1; + DeviceBoardStates deviceBoardStates = new DeviceBoardStates() + { + EquipmentInfoId = device.EquipmentInfoId, + EquipmentInfoName = device.EquipmentInfoName, + States = boardStates, + Time = DateTime.Now, + }; + _deviceBoardStatesRedis.HashSetUpdateOneAsync(deviceBoardStatesRedisKey, address.ToString(), deviceBoardStates); + _deviceBoardStatesRedis.PublishAsync(deviceBoardStatesRedisChannelKey, deviceBoardStates); + } + string deviceBoardStatesRedisKey = "deviceBoardStates"; + string deviceBoardStatesRedisChannelKey = "deviceBoardStatesChannel"; + + ConcurrentDictionary> _deviceBoardStates = new(); + List iopositions = new List + { + new NameIntValueProperty("运行", 0), + new NameIntValueProperty("告警", 0), + new NameIntValueProperty("IO插件1", 0), + new NameIntValueProperty("IO插件2", 0), + new NameIntValueProperty("IO插件3", 0), + new NameIntValueProperty("IO插件4", 0), + new NameIntValueProperty("电源插件(IO5)", 0), + new NameIntValueProperty("液晶", 0) + }; } + + // 定义设备信息类 + class DeviceInfo + { + public bool Status { get; set; } // 设备状态(运行或离线) + public DateTime LastUpdate { get; set; } // 最后更新时间 + public int OfflineCount { get; set; } // 连续离线计数 + } } diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceSelfCheckHandle.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceSelfCheckHandle.cs index 9cce09b..69400a2 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceSelfCheckHandle.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceSelfCheckHandle.cs @@ -1,16 +1,18 @@ using Abp.Dependency; using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using ToolLibrary.LogHelper; using Yunda.ISAS.DataMonitoringServer.DataAnalysis; using Yunda.ISAS.DataMonitoringServer.DataCenter; using Yunda.SOMS.DataMonitoringServer.FTPHandle; +using Yunda.SOMS.DataMonitoringServer.SQLiteData; using Yunda.SOMS.DataMonitoringServer.TcpSocket.Server; using YunDa.ISAS.Entities.System; -using YunDa.SOMS.Commdb.Models; using YunDa.SOMS.DataTransferObject.MainStationMaintenanceInfo.OperationReport; namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle @@ -20,46 +22,93 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle WebApiRequest _webApiRequest; DotNettyTcpServer _dotNettyTcpServer; private readonly RedisDataRepository _redisDataRepository; - + FtpFile _ftpFile; public ProtectionDeviceSelfCheckHandle(WebApiRequest webApiRequest, + FtpFile ftpFile, DotNettyTcpServer dotNettyTcpServer, RedisDataRepository redisDataRepository) { + _ftpFile = ftpFile; _webApiRequest = webApiRequest; _dotNettyTcpServer = dotNettyTcpServer; _redisDataRepository = redisDataRepository; _dotNettyTcpServer.MessageReceived += OnMessageReceived; // 订阅事件 } + private ConcurrentDictionary _onlineDevices = new ConcurrentDictionary(); + public bool AddIfNotExists(byte element,string path) + { + // 尝试添加元素,若不存在则添加,若存在则返回 false + return _onlineDevices.TryAdd(element, path); + } private void OnMessageReceived(byte address, byte[] message, byte functionType) { try { - if (functionType == 4) //通信状态 + if (functionType == 4) //自检信息 { var device = ProtectionDeviceDataCenter._devices.FirstOrDefault(t => t.DeviceAddr == address); if (device != null) { if (message.Length > 0) { - if (message[0] != 0) + if (message[12] != 0) { - var abnormalComponent = _webApiRequest.GetDeviceAbnormalComponent(address, message[0]); - if (abnormalComponent != null) + if (_onlineDevices.TryGetValue(address,out string sqlPath)) { - abnormalComponent.EquipmentInfoId = device.EquipmentInfoId; - Task.Run(async () => + if (string.IsNullOrWhiteSpace( sqlPath)) { - string redisChannel = _redisDataRepository.DeviceSelfTestChannelRediskey; - await _redisDataRepository.AbnormalComponentRedis.PublishAsync(redisChannel, abnormalComponent); - }); - + ProtdbHandle protdbHandle = new ProtdbHandle(); + int zjCode = message[12]; + var zjInfo = protdbHandle.GetTbEventZj(sqlPath, zjCode); + if (zjInfo!=null) + { + var abnormalComponent = _webApiRequest.GetDeviceAbnormalComponent(address, message[0]); + if (abnormalComponent != null) + { + //Todo:未来接口 做逻辑关系判定 + abnormalComponent.EquipmentInfoId = device.EquipmentInfoId; + // 定义正则表达式模式 + string pattern = @"(IO插件\d|I/O插件|电源插件)"; + + // 检查字符串是否包含目标值 + MatchCollection matches = Regex.Matches(zjInfo.Description, pattern); + if (matches.Count > 0) + { + abnormalComponent.ComponentName = matches[0].Value; + // 替换匹配的部分为空 + string result = Regex.Replace(zjInfo.Description, pattern, ""); + Console.WriteLine("替换后的字符串: " + result); + abnormalComponent.AbnormalReason = result; + } + else + { + abnormalComponent.ComponentName = "CPU插件/软件系统"; + abnormalComponent.AbnormalReason = zjInfo.Description; + } + Task.Run(async () => + { + string redisChannel = _redisDataRepository.DeviceSelfTestChannelRediskey; + await _redisDataRepository.AbnormalComponentRedis.PublishAsync(redisChannel, abnormalComponent); + }); + } + + } + } } + } } } - } + if (!_onlineDevices.TryGetValue(address,out string path)) + { + //新连接的装置 + var protectionDevice = ProtectionDeviceDataCenter._devices.FirstOrDefault(t => t.DeviceAddr == address); + var localfile = _ftpFile.GetFileFromFtp(protectionDevice.GatewayIP1, "/nor/root/protect/cfg/", "protdb.sql3", address.ToString()); + _onlineDevices[address] = localfile; + } + } catch (Exception ex) { diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/SQLiteData/IODataHandle.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/SQLiteData/IODataHandle.cs index 18e28e9..e600345 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/SQLiteData/IODataHandle.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/SQLiteData/IODataHandle.cs @@ -87,8 +87,5 @@ namespace Yunda.SOMS.DataMonitoringServer.SQLiteData } return (index, iodic); } - - - } } diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/SQLiteData/ProtdbHandle.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/SQLiteData/ProtdbHandle.cs new file mode 100644 index 0000000..8a25c4e --- /dev/null +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/SQLiteData/ProtdbHandle.cs @@ -0,0 +1,35 @@ +using System; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using ToolLibrary.LogHelper; +using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto; +using YunDa.SOMS.ProDB; +using YunDa.SOMS.ProDB.Models; + +namespace Yunda.SOMS.DataMonitoringServer.SQLiteData +{ + public class ProtdbHandle + { + public TbEventZj GetTbEventZj(string sqlPath,int code) + { + var fileName = Path.GetFileName(sqlPath); + try + { + using (var context = new ProtdbContext(sqlPath)) + { + // 查询数据 + var tbEventZj = context.TbEventZjs.FirstOrDefault(t=>t.SelfCheckCode == code); + return tbEventZj; + + } + } + catch (Exception ex) + { + Log4Helper.Error(this.GetType(), "获取装置参数时发生错误", ex); + } + return default; + } + + } +} diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyServerHandler.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyServerHandler.cs index 351ba83..3fb127d 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyServerHandler.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyServerHandler.cs @@ -10,6 +10,7 @@ using System.Diagnostics; using System.Text; using System.Threading.Tasks; using Yunda.ISAS.DataMonitoringServer.DataAnalysis; +using Yunda.SOMS.DataMonitoringServer.FTPHandle; namespace Yunda.SOMS.DataMonitoringServer.TcpSocket.Server { @@ -17,129 +18,17 @@ namespace Yunda.SOMS.DataMonitoringServer.TcpSocket.Server public class DotNettyServerHandler : SimpleChannelInboundHandler { - // 定义设备信息类 - private class DeviceInfo - { - public bool Status { get; set; } // 设备状态(运行或离线) - public DateTime LastUpdate { get; set; } // 最后更新时间 - public int OfflineCount { get; set; } // 连续离线计数 - } + private IChannelHandlerContext _context; // 定义事件,事件处理程序包含消息和功能描述 private readonly ConcurrentDictionary _connections; private readonly Action _onMessageReceived; - private readonly Action _onDeviceConnection; - - - Dictionary _deviceRunStates = new Dictionary(); - Dictionary _deviceBoardStates = new Dictionary(); //0-离线 1-在线 - - public DotNettyServerHandler(ConcurrentDictionary connections, - Action onMessageReceived, Action> deviceBoardStatesAction) + Action onMessageReceived) { _connections = connections; _onMessageReceived = onMessageReceived; - - //_onDeviceConnection = onDeviceConnection; - Task.Factory.StartNew(async () => - { - while (true) - { - try - { - CheckAndUpdateDeviceStates(); - //LogDeviceStates(); - if (_deviceBoardStates.Count > 0) - { - deviceBoardStatesAction(_deviceBoardStates); - } - await Task.Delay(5000); - } - catch (Exception ex) - { - MonitoringEventBus.LogHandler($"客户端连接错误:{ex.StackTrace}", "定值错误信息"); - } - } - }, TaskCreationOptions.LongRunning); - } - async void CheckAndUpdateDeviceStates() - { - try - { - foreach (var entry in _deviceRunStates) - { - - var deviceAddress = entry.Key; - var device = entry.Value; - if (!_deviceBoardStates.ContainsKey(deviceAddress)) - { - _deviceBoardStates.Add(deviceAddress, new int[8]); - } - if (device == null) - { - continue; - } - // 检查是否连续发送“离线”状态 - if (device.OfflineCount >= 5) - { - if (_deviceBoardStates[deviceAddress][0] !=0) - { - _deviceBoardStates[deviceAddress][0] = 0; - MonitoringEventBus.LogHandler($"[{DateTime.Now}] {deviceAddress} 判定为离线(连续离线状态)", "定值错误信息"); - if (_connections.TryGetValue(deviceAddress, out IChannelHandlerContext ctx)) - { - if (ctx.Channel.Active) - { - try - { - await ctx.DisconnectAsync(); - await ctx.CloseAsync(); - } - catch (Exception ex) - { - - } - _connections.TryRemove(deviceAddress, out IChannelHandlerContext channelHandlerContext); - } - } - } - continue; - } - - // 检查是否超过10秒未更新 - if ((DateTime.Now - device.LastUpdate).TotalSeconds > 10) - { - if (_connections.ContainsKey(deviceAddress)) - { - _deviceBoardStates[deviceAddress][0] = 0; - MonitoringEventBus.LogHandler($"[{DateTime.Now}] {deviceAddress} 判定为离线(超过10秒未更新)", "定值错误信息"); - if (_connections.TryGetValue(deviceAddress,out IChannelHandlerContext ctx)) - { - if (ctx.Channel.Active) - { - try - { - await ctx.DisconnectAsync(); - await ctx.CloseAsync(); - } - catch (Exception ex) - { - } - _connections.TryRemove(deviceAddress, out IChannelHandlerContext channelHandlerContext); - } - } - } - continue; - } - _deviceBoardStates[deviceAddress][0] = 1; - } - } - catch (Exception ex) - { - MonitoringEventBus.LogHandler($"{ex.StackTrace}", "103客户端错误信息"); - } } public override void ChannelActive(IChannelHandlerContext context) { @@ -192,14 +81,12 @@ namespace Yunda.SOMS.DataMonitoringServer.TcpSocket.Server // 数据不足,等待更多数据 return; } - byte[] data = new byte[dataLength]; msg.ReadBytes(data); string clientIp = ctx.Channel.RemoteAddress.ToString(); string description = FunctionCodeDescriptions.GetDescription(functionType); - MonitoringEventBus.LogHandler($"装置地址 {address} 功能码:{functionType} 数据长度:{dataLength}", "103客户端消息"); - + //MonitoringEventBus.LogHandler($"装置地址 {address} 功能码:{functionType} 数据长度:{dataLength}", "103客户端消息"); Task.Run(() => _onMessageReceived?.Invoke(address, data, functionType)); HandleFunctionCodeAsync(functionType, address, controlWord, data, ctx); } @@ -210,7 +97,7 @@ namespace Yunda.SOMS.DataMonitoringServer.TcpSocket.Server } private async Task HandleFunctionCodeAsync(byte functionType, byte address, byte controlWord, byte[] data, IChannelHandlerContext ctx) - { + { switch (functionType) { case 0: @@ -250,77 +137,57 @@ namespace Yunda.SOMS.DataMonitoringServer.TcpSocket.Server Debug.WriteLine($"确认开入开出信息: {Encoding.ASCII.GetString(data)}"); // 可以添加发送确认报文的逻辑 } - private ConcurrentDictionary _communicationStateCounts = new (); private async Task UpdateDeviceCommunicationStateAsync(byte address, byte[] data, IChannelHandlerContext ctx) { await Task.Run(async () => { try { - // 更新连接上下文 - if (_connections.ContainsKey(address)) - { - _connections[address] = ctx; - } - else - { - _connections.TryAdd(address, ctx); - - } - if (_communicationStateCounts.ContainsKey(address)) - { - _communicationStateCounts[address]++; - if (_communicationStateCounts[address] == 86400) - { - _communicationStateCounts.TryRemove(address,out _); - } - } - else - { - _communicationStateCounts.TryAdd(address, 0); - for (byte i = 1; i < 6; i++) - { - await SendCustomMessageAsync(ctx, address, 0, 5, i); - } - await SendCustomMessageAsync(ctx, address, 0, 1, 0); - await SendCustomMessageAsync(ctx, address, 0, 2, 0); - await SendCustomMessageAsync(ctx, address, 0, 3, 0); - await SendCustomMessageAsync(ctx, address, 0, 4, 0); - await SendCustomMessageAsync(ctx, address, 0, 7, 0); - } - // 更新设备状态 - BitArray bit0 = new BitArray(new byte[] { data[0] }); - if (!_deviceRunStates.ContainsKey(address)) - { - _deviceRunStates[address] = new DeviceInfo { Status = bit0[7], LastUpdate = DateTime.Now, OfflineCount = 0 }; - } - - var device = _deviceRunStates[address]; - device.Status = bit0[0]; - device.LastUpdate = DateTime.Now; - device.OfflineCount = bit0[0] ? 0 : device.OfflineCount + 1; - - // 更新设备板状态 - if (!_deviceBoardStates.ContainsKey(address)) - { - _deviceBoardStates[address] = new int[8]; - } - _deviceBoardStates[address][7] = new BitArray(new byte[] { data[1] })[0] ? 0 : 1; // 液晶状态 - BitArray bit2 = new BitArray(new byte[] { data[2] }); - _deviceBoardStates[address][2] = bit2[0] ? 0 : 1; - _deviceBoardStates[address][3] = bit2[1] ? 0 : 1; - _deviceBoardStates[address][4] = bit2[2] ? 0 : 1; - _deviceBoardStates[address][5] = bit2[3] ? 0 : 1; - _deviceBoardStates[address][6] = bit2[4] ? 0 : 1; + UpdateConnectionContext(address, ctx); + await UpdateCommunicationStateCountAsync(address, ctx); } catch (Exception ex) { MonitoringEventBus.LogHandler($"Error: {ex.StackTrace}", "103客户端发送消息"); } - }); } + private void UpdateConnectionContext(byte address, IChannelHandlerContext ctx) + { + _connections[address] = ctx; + } + + private async Task UpdateCommunicationStateCountAsync(byte address, IChannelHandlerContext ctx) + { + if (_connections.TryGetValue(address, out _)) + { + //_communicationStateCounts[address]++; + //已经存在的装置地址 + } + else + { + //新加入的装置的地址 + await SendInitMsgToDeviceAsync(ctx, address); + } + } + + private async Task SendInitMsgToDeviceAsync(IChannelHandlerContext ctx, byte address) + { + for (byte i = 1; i < 6; i++) + { + await SendCustomMessageAsync(ctx, address, 0, 5, i); + } + await SendCustomMessageAsync(ctx, address, 0, 1, 0); + await SendCustomMessageAsync(ctx, address, 0, 2, 0); + await SendCustomMessageAsync(ctx, address, 0, 3, 0); + await SendCustomMessageAsync(ctx, address, 0, 4, 0); + await SendCustomMessageAsync(ctx, address, 0, 7, 0); + } + + + + public override async void ExceptionCaught(IChannelHandlerContext context, Exception ex) { try diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyTcpServer.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyTcpServer.cs index 295d819..4d7a0ce 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyTcpServer.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyTcpServer.cs @@ -25,23 +25,24 @@ namespace Yunda.SOMS.DataMonitoringServer.TcpSocket.Server // 定义 MessageReceived 事件 public event Action< byte, byte[], byte> MessageReceived; // 装置地址,功能码,消息 - public event Action> deviceBoardStatesAction; + //public event Action> deviceBoardStatesAction; public DotNettyTcpServer() { //_dotNettyServerHandler = dotNettyServerHandler; } - MultithreadEventLoopGroup bossGroup ; - MultithreadEventLoopGroup workerGroup ; int maxFrameLength = 65536; // 设置最大帧长度 int lengthFieldOffset = 1; // 长度字段的偏移量,从启动字符之后开始 int lengthFieldLength = 2; // 长度字段的字节长度 int lengthAdjustment = -3; // 长度调整,将读取的长度减去启动字符和长度字段的字节数 int initialBytesToStrip = 0; // 保留所有字节 - public async Task RunServerAsync(/*Action recvMsgAc*/) - { + private MultithreadEventLoopGroup bossGroup; + private MultithreadEventLoopGroup workerGroup; + private IChannel boundChannel; - bossGroup = new MultithreadEventLoopGroup(1); - workerGroup = new MultithreadEventLoopGroup(); + public async Task RunServerAsync() + { + bossGroup = new MultithreadEventLoopGroup(1); + workerGroup = new MultithreadEventLoopGroup(); try { GCSettings.LatencyMode = GCLatencyMode.LowLatency; @@ -58,35 +59,50 @@ namespace Yunda.SOMS.DataMonitoringServer.TcpSocket.Server lengthAdjustment, initialBytesToStrip )); - channel.Pipeline.AddLast(new DotNettyServerHandler(connections, MessageReceived, deviceBoardStatesAction)); + channel.Pipeline.AddLast(new DotNettyServerHandler(connections, MessageReceived)); channel.Pipeline.AddLast("hexDumpHandler", new HexDumpHandler()); })); - IChannel boundChannel = await bootstrap.BindAsync(7110); + boundChannel = await bootstrap.BindAsync(7110); MonitoringEventBus.LogHandler("服务器启动并监听端口 7110...", "获取信息"); } - finally - { - //await Task.WhenAll( - // bossGroup.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1)), - // workerGroup.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1))); - } - } - - public async void StopSeverAsync() - { - try - { - await Task.WhenAll( - bossGroup.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1)), - workerGroup.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1))); - } catch (Exception ex) { - MonitoringEventBus.LogHandler("服务器关闭并监听端口 7110...", "获取信息"); + MonitoringEventBus.LogHandler($"服务器启动失败: {ex.Message}", "错误"); + throw; } - } + + public async Task StopServerAsync() + { + try + { + if (boundChannel != null) + { + await boundChannel.CloseAsync(); + boundChannel = null; + } + + if (bossGroup != null) + { + await bossGroup.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1)); + bossGroup = null; + } + + if (workerGroup != null) + { + await workerGroup.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1)); + workerGroup = null; + } + + MonitoringEventBus.LogHandler("服务器已成功关闭并停止监听端口 7110...", "获取信息"); + } + catch (Exception ex) + { + MonitoringEventBus.LogHandler($"服务器关闭失败: {ex.Message}", "错误"); + } + } + public async void SendMessageByIp(byte address, byte controlWord, byte functionCode , byte message) { if (connections.TryGetValue(address, out IChannelHandlerContext context)) diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/Yunda.SOMS.DataMonitoringServer.csproj b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/Yunda.SOMS.DataMonitoringServer.csproj index f1accc0..0cf188a 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/Yunda.SOMS.DataMonitoringServer.csproj +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/Yunda.SOMS.DataMonitoringServer.csproj @@ -114,6 +114,7 @@ + diff --git a/src/YunDa.Util/ToolLibrary/PortProcessManager.cs b/src/YunDa.Util/ToolLibrary/PortProcessManager.cs index 5005e65..9fe3cdb 100644 --- a/src/YunDa.Util/ToolLibrary/PortProcessManager.cs +++ b/src/YunDa.Util/ToolLibrary/PortProcessManager.cs @@ -1,6 +1,9 @@ using System; +using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Net.NetworkInformation; +using System.Security.Cryptography; namespace ToolLibrary { @@ -11,15 +14,17 @@ namespace ToolLibrary /// /// 指定的端口号 /// 占用端口的进程 PID,失败时返回 -1 - public static int GetProcessIdByPort(int port) + public static List GetProcessIdsByPort(int port) { + List pids = new List(); + try { // 使用 netstat 命令获取端口信息 var startInfo = new ProcessStartInfo { - FileName = "netstat", - Arguments = $"-ano | findstr :{port}", // 查找指定端口的占用情况 + FileName = "cmd.exe", + Arguments = $"/c netstat -ano | findstr :{port}", RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true @@ -31,12 +36,19 @@ namespace ToolLibrary string output = reader.ReadToEnd(); if (!string.IsNullOrEmpty(output)) { - // 输出格式: TCP 0.0.0.0:2403 0.0.0.0:0 LISTENING 1234 - var columns = output.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - if (columns.Length > 4) + var lines = output.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + foreach (var line in lines) { - int pid = int.Parse(columns[columns.Length - 1]); // 获取 PID - return pid; + // 输出格式: TCP 0.0.0.0:2403 0.0.0.0:0 LISTENING 1234 + var columns = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + if (columns.Length > 4) + { + if (int.TryParse(columns[columns.Length - 1], out int pid)) + { + pids.Add(pid); // 将 PID 添加到列表中 + } + } } } } @@ -46,9 +58,10 @@ namespace ToolLibrary Console.WriteLine("查询端口进程失败: " + ex.Message); } - return -1; // 返回无效的 PID + return pids.Distinct().ToList(); // 返回所有 PID } + /// /// 根据 PID 杀死指定的进程 /// @@ -77,10 +90,19 @@ namespace ToolLibrary /// 是否成功杀死进程 public static bool KillProcessByPort(int port) { - int pid = GetProcessIdByPort(port); - if (pid > 0) + var pids = GetProcessIdsByPort(port); + if (pids!=null) { - return KillProcessById(pid); + int selfpid = Process.GetCurrentProcess().Id; + foreach (var pid in pids) + { + if (pid!= selfpid) + { + KillProcessById(pid); + + } + } + return true; } else {