diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml index 2ccd98d3..5e542e03 100644 --- a/Admin.Core.Api/Admin.Core.Model.xml +++ b/Admin.Core.Api/Admin.Core.Model.xml @@ -1731,6 +1731,181 @@ 创建时间 + + + 测温历史记录 + + + + + 主键 + + + + + 线号 + + + + + 工位号 + + + + + 产品条码 + + + + + 产品型号 + + + + + 基准型号 + + + + + 工作电压 + + + + + 测试通道 + + + + + 计划测试时间 + + + + + 实际测试时间 + + + + + 环温 + + + + + 开始测试时间 + + + + + 测试结果 + + + + + 测试结束时间 + + + + + 系统用户 + + + + + 备注 + + + + + 第几次测试 + + + + + 温度数据 + + + + + 功率数据 + + + + + 部件测试数据 + + + + + 故障代码 + + + + + 内部传感器 1 名称 + + + + + 内部传感器 2 名称 + + + + + 内部传感器 3 名称 + + + + + 内部传感器 4 名称 + + + + + 内部传感器 5 名称 + + + + + 内部传感器 6 名称 + + + + + 是否测试部件(”Y”测试) + + + + + 低压启动测试时间 + + + + + 低压启动标准下限 + + + + + 低压启动标准上限 + + + + + 低压启动实际采集值 + + + + + 低压启动测试电压 + + + + + 创建时间 + + 条码绑定记录 @@ -2941,6 +3116,181 @@ 用户密码 + + + 测温历史记录 + + + + + 主键 + + + + + 线号 + + + + + 工位号 + + + + + 产品条码 + + + + + 产品型号 + + + + + 基准型号 + + + + + 工作电压 + + + + + 测试通道 + + + + + 计划测试时间 + + + + + 实际测试时间 + + + + + 环温 + + + + + 开始测试时间 + + + + + 测试结果 + + + + + 测试结束时间 + + + + + 系统用户 + + + + + 备注 + + + + + 第几次测试 + + + + + 温度数据 + + + + + 功率数据 + + + + + 部件测试数据 + + + + + 故障代码 + + + + + 内部传感器 1 名称 + + + + + 内部传感器 2 名称 + + + + + 内部传感器 3 名称 + + + + + 内部传感器 4 名称 + + + + + 内部传感器 5 名称 + + + + + 内部传感器 6 名称 + + + + + 是否测试部件(”Y”测试) + + + + + 低压启动测试时间 + + + + + 低压启动标准下限 + + + + + 低压启动标准上限 + + + + + 低压启动实际采集值 + + + + + 低压启动测试电压 + + + + + 同步标识 + + 部门视图 diff --git a/Admin.Core.Api/Log/RecordAccessLogs_1681681737.log b/Admin.Core.Api/Log/RecordAccessLogs_1681681737.log index 2df0b69f..929dce58 100644 --- a/Admin.Core.Api/Log/RecordAccessLogs_1681681737.log +++ b/Admin.Core.Api/Log/RecordAccessLogs_1681681737.log @@ -163,3 +163,8 @@ {"User":"","Action":"","Type":0,"IP":"127.0.0.1","API":"/api/seed/getframefilesbytablenames","BeginTime":"2023-10-14 22:40:37","OPTime":"4151","RequestMethod":"POST","RequestData":"[\n \"product_planInfo\"\n]","ResponseBody":"库admin.core-控制器、服务、仓储、实体层生成","Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"}, {"User":"","Action":"","Type":0,"IP":"127.0.0.1","API":"/api/seed/getframefilesbytablenames","BeginTime":"2023-10-14 22:40:56","OPTime":"4161","RequestMethod":"POST","RequestData":"[\n \"product_planInfo\"\n]","ResponseBody":"库admin.core-控制器、服务、仓储、实体层生成","Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"}, {"User":"","Action":"","Type":0,"IP":"127.0.0.1","API":"/api/seed/getframefilesbytablenames","BeginTime":"2023-10-14 22:46:39","OPTime":"181370","RequestMethod":"POST","RequestData":"[\n \"PRODUCT_PLANINFO\"\n]","ResponseBody":"库admin.core-控制器、服务、仓储、实体层生成","Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"}, +{"User":"","Action":"","Type":0,"IP":"127.0.0.1","API":"/api/seed/getframefilesbytablenames","BeginTime":"2024-01-04 11:42:38","OPTime":"5966","RequestMethod":"POST","RequestData":"[\n \"Box_TemperatureMeasurementHistory\"\n]","ResponseBody":"库admin.core-控制器、服务、仓储、实体层生成","Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.61"}, +{"User":"","Action":"","Type":0,"IP":"127.0.0.1","API":"/api/seed/getframefilesbytablenames","BeginTime":"2024-01-04 11:43:46","OPTime":"4902","RequestMethod":"POST","RequestData":"[\n \"Box_TemperatureMeasurementHistory\"\n]","ResponseBody":"库Data Source=localhost;Initial Catalog=Hsdb;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False-控制器、服务、仓储、实体层生成","Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.61"}, +{"User":"","Action":"","Type":0,"IP":"127.0.0.1","API":"/api/seed/getframefilesbytablenames","BeginTime":"2024-01-04 11:47:30","OPTime":"2632","RequestMethod":"POST","RequestData":"[\n \"Box_TemperatureMeasurementHistory\"\n]","ResponseBody":"库admin.core-控制器、服务、仓储、实体层生成","Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.61"}, +{"User":"","Action":"","Type":0,"IP":"127.0.0.1","API":"/api/seed/getframefilesbytablenames","BeginTime":"2024-01-04 14:33:25","OPTime":"2736","RequestMethod":"POST","RequestData":"[\n \"TemperatureHistory\"\n]","ResponseBody":"库admin.core-控制器、服务、仓储、实体层生成","Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.61"}, +{"User":"","Action":"","Type":0,"IP":"127.0.0.1","API":"/api/seed/getframefilesbytablenames","BeginTime":"2024-01-04 14:34:36","OPTime":"2896","RequestMethod":"POST","RequestData":"[\n \"TemperatureHistory\"\n]","ResponseBody":"库admin.core-控制器、服务、仓储、实体层生成","Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.61"}, diff --git a/Admin.Core.Api/appsettings.json b/Admin.Core.Api/appsettings.json index 47e633ef..be4dfcbf 100644 --- a/Admin.Core.Api/appsettings.json +++ b/Admin.Core.Api/appsettings.json @@ -62,7 +62,7 @@ // *** 单库操作,把 MutiDBEnabled 设为false ***; // *** 多库操作,把 MutiDBEnabled 设为true,其他的从库Enabled也为true **; // 具体配置看视频:https://www.bilibili.com/video/BV1BJ411B7mn?p=6 - "MainDB": "Admin.Core", //当前项目的主库,所对应的连接字符串的Enabled必须为true + "MainDB": "Hsdb", //当前项目的主库,所对应的连接字符串的Enabled必须为true "MutiDBEnabled": false, //是否开启多库模式 "CQRSEnabled": false, //是否开启读写分离模式,必须是单库模式,且数据库类型一致,比如都是SqlServer "DBS": [ @@ -77,15 +77,15 @@ Kdbndp = 6,//人大金仓 */ { - "ConnId": "Admin.Core", - "DBType": 3, + "ConnId": "Hsdb", + "DBType": 1, "Enabled": true, "HitRate": 50, //"Connection": "Server=127.0.0.1;Port=5432;User Id=postgres;Password=postgres;Database=Admin.Core;", - //"Connection": "Data Source=localhost;Initial Catalog=Admin.Core;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", + "Connection": "Data Source=localhost;Initial Catalog=Hsdb;User ID=sa;Password=sa;", //"Connection": "Data Source=.;Initial Catalog=Admin.Core;User ID=sa;Password=Password01!;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", //"Connection": "db/hw.db", - "Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=175.27.215.92)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=helowin)));User ID=aucma_mes;Password=aucma;", + //"Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=175.27.215.92)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=helowin)));User ID=aucma_mes;Password=aucma;", "ProviderName": "System.Data.SqlClient" } ], diff --git a/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.GeneratedMSBuildEditorConfig.editorconfig index 2f9c868b..decf85c2 100644 --- a/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.GeneratedMSBuildEditorConfig.editorconfig +++ b/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.GeneratedMSBuildEditorConfig.editorconfig @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = Admin.Core.Common -build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.Common\ +build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Common\ diff --git a/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.GeneratedMSBuildEditorConfig.editorconfig index 0f098310..f38a35e7 100644 --- a/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.GeneratedMSBuildEditorConfig.editorconfig +++ b/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.GeneratedMSBuildEditorConfig.editorconfig @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = Admin.Core.EventBus -build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.EventBus\ +build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.EventBus\ diff --git a/Admin.Core.Extensions/AutoMapper/AutoMapperConfig.cs b/Admin.Core.Extensions/AutoMapper/AutoMapperConfig.cs index b7885f8d..b9d06010 100644 --- a/Admin.Core.Extensions/AutoMapper/AutoMapperConfig.cs +++ b/Admin.Core.Extensions/AutoMapper/AutoMapperConfig.cs @@ -1,4 +1,8 @@ -using AutoMapper; +using Admin.Core.Common; +using Admin.Core.Model; +using AutoMapper; +using SqlSugar; +using static Org.BouncyCastle.Math.EC.ECCurve; namespace Admin.Core.Extensions { @@ -12,6 +16,43 @@ namespace Admin.Core.Extensions return new MapperConfiguration(cfg => { cfg.AddProfile(new CustomProfile()); + + + cfg.CreateMap() + .ForMember(dest => dest.LineNo, src => src.MapFrom(d => d.Line_No)). + ForMember(dest => dest.Gongwno, src => src.MapFrom(d => d.Gongwno)). + ForMember(dest => dest.Cpno, src => src.MapFrom(d => d.Cpno)). + ForMember(dest => dest.Cpmodel, src => src.MapFrom(d => d.CpModel)). + ForMember(dest => dest.Factorymodel, src => src.MapFrom(d => d.FactoryModel)). + ForMember(dest => dest.Voltage, src => src.MapFrom(d => d.Voltage)). + ForMember(dest => dest.Point2, src => src.MapFrom(d => d.Point2)). + ForMember(dest => dest.TestTime, src => src.MapFrom(d => d.TestTime)). + ForMember(dest => dest.TestedTime, src => src.MapFrom(d => d.TestedTime)). + ForMember(dest => dest.Etemp, src => src.MapFrom(d => d.Etemp)). + ForMember(dest => dest.BeginDatetime, src => src.MapFrom(d => d.BeginDateTime)). + ForMember(dest => dest.CpResult, src => src.MapFrom(d => d.CpResult)). + ForMember(dest => dest.EndDateTime, src => src.MapFrom(d => d.EndDateTime)). + ForMember(dest => dest.UserName, src => src.MapFrom(d => d.UserName)). + ForMember(dest => dest.Remark, src => src.MapFrom(d => d.Remark)). + ForMember(dest => dest.TestNo, src => src.MapFrom(d => d.TestNo)). + ForMember(dest => dest.Temp_Mes, src => src.MapFrom(d => d.Temp_Mes)). + ForMember(dest => dest.Power_Mes, src => src.MapFrom(d => d.Power_Mes)). + ForMember(dest => dest.Part_Mes, src => src.MapFrom(d => d.Part_Mes)). + ForMember(dest => dest.ErrorCode_Mes, src => src.MapFrom(d => d.ErrorCode_Mes)). + ForMember(dest => dest.T1Name, src => src.MapFrom(d => d.T1Name)). + ForMember(dest => dest.T2Name, src => src.MapFrom(d => d.T2Name)). + ForMember(dest => dest.T3Name, src => src.MapFrom(d => d.T3Name)). + ForMember(dest => dest.T4Name, src => src.MapFrom(d => d.T4Name)). + ForMember(dest => dest.T5Name, src => src.MapFrom(d => d.T5Name)). + ForMember(dest => dest.T6Name, src => src.MapFrom(d => d.T6Name)). + ForMember(dest => dest.IsOrder, src => src.MapFrom(d => d.IsOrder)). + ForMember(dest => dest.LowV_Time, src => src.MapFrom(d => d.LowV_Time)). + ForMember(dest => dest.LowV_PowerMin, src => src.MapFrom(d => d.LowV_PowerMin)). + ForMember(dest => dest.LowV_PowerMax, src => src.MapFrom(d => d.LowV_PowerMax)). + ForMember(dest => dest.LowV_PowerFact, src => src.MapFrom(d => d.LowV_PowerFact)). + ForMember(dest => dest.LowVoltage, src => src.MapFrom(d => d.LowVoltage)); + //ForMember(dest => dest.CreateTime, src => src.MapFrom(d => d.Create_Time)). + }); } } diff --git a/Admin.Core.Extensions/ServiceExtensions/SqlsugarSetup.cs b/Admin.Core.Extensions/ServiceExtensions/SqlsugarSetup.cs index eb2936d2..2d52972d 100644 --- a/Admin.Core.Extensions/ServiceExtensions/SqlsugarSetup.cs +++ b/Admin.Core.Extensions/ServiceExtensions/SqlsugarSetup.cs @@ -44,7 +44,7 @@ namespace Admin.Core.Extensions ConfigId = m.ConnId.ObjToString().ToLower(), ConnectionString = m.Connection, DbType = (DbType)m.DbType, - IsAutoCloseConnection = true,//自动释放 + IsAutoCloseConnection = false,//自动释放 // Check out more information: https://github.com/anjoy8/Admin.Core/issues/122 MoreSettings = new ConnMoreSettings() { diff --git a/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.GeneratedMSBuildEditorConfig.editorconfig index 5decb385..34f11e1e 100644 --- a/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.GeneratedMSBuildEditorConfig.editorconfig +++ b/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.GeneratedMSBuildEditorConfig.editorconfig @@ -1,3 +1,3 @@ is_global = true build_property.RootNamespace = Admin.Core.FrameWork -build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.FrameWork\ +build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.FrameWork\ diff --git a/Admin.Core.IRepository/IRepository_New/IBoxTemperatureMeasurementHistoryRepository.cs b/Admin.Core.IRepository/IRepository_New/IBoxTemperatureMeasurementHistoryRepository.cs new file mode 100644 index 00000000..801c2891 --- /dev/null +++ b/Admin.Core.IRepository/IRepository_New/IBoxTemperatureMeasurementHistoryRepository.cs @@ -0,0 +1,14 @@ +using Admin.Core.Model; +using Admin.Core.Model.Model_New; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.IRepository +{ + /// + /// IBoxTemperatureMeasurementHistoryRepository + /// + public interface IBoxTemperatureMeasurementHistoryRepository : IBaseRepository + { + } +} \ No newline at end of file diff --git a/Admin.Core.IRepository/IRepository_New/ITemperatureHistoryRepository.cs b/Admin.Core.IRepository/IRepository_New/ITemperatureHistoryRepository.cs new file mode 100644 index 00000000..8cfdc908 --- /dev/null +++ b/Admin.Core.IRepository/IRepository_New/ITemperatureHistoryRepository.cs @@ -0,0 +1,14 @@ +using Admin.Core.Model; +using Admin.Core.Model.Model_New; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.IRepository +{ + /// + /// ITemperatureHistoryRepository + /// + public interface ITemperatureHistoryRepository : IBaseRepository + { + } +} \ No newline at end of file diff --git a/Admin.Core.IService/IService_New/IBoxTemperatureMeasurementHistoryServices.cs b/Admin.Core.IService/IService_New/IBoxTemperatureMeasurementHistoryServices.cs new file mode 100644 index 00000000..311916cf --- /dev/null +++ b/Admin.Core.IService/IService_New/IBoxTemperatureMeasurementHistoryServices.cs @@ -0,0 +1,16 @@ +using Admin.Core.IService; +using Admin.Core.Model; +using Admin.Core.Model.ViewModels; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.IService +{ + /// + /// IBoxTemperatureMeasurementHistoryServices + /// + public interface IBoxTemperatureMeasurementHistoryServices : IBaseServices + { + + } +} \ No newline at end of file diff --git a/Admin.Core.IService/IService_New/ITemperatureHistoryServices.cs b/Admin.Core.IService/IService_New/ITemperatureHistoryServices.cs new file mode 100644 index 00000000..5156fe60 --- /dev/null +++ b/Admin.Core.IService/IService_New/ITemperatureHistoryServices.cs @@ -0,0 +1,16 @@ +using Admin.Core.IService; +using Admin.Core.Model; +using Admin.Core.Model.ViewModels; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.IService +{ + /// + /// ITemperatureHistoryServices + /// + public interface ITemperatureHistoryServices : IBaseServices + { + + } +} \ No newline at end of file diff --git a/Admin.Core.Model/Model_New/BoxTemperatureMeasurementHistory.cs b/Admin.Core.Model/Model_New/BoxTemperatureMeasurementHistory.cs new file mode 100644 index 00000000..971507a0 --- /dev/null +++ b/Admin.Core.Model/Model_New/BoxTemperatureMeasurementHistory.cs @@ -0,0 +1,223 @@ +using NPOI.Util; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Admin.Core.Model +{ + /// + /// 测温历史记录 + /// + [SugarTable("BOX_TEMPERATUREHISTORY", "AUCMA_SCADA")] + + public class BoxTemperatureMeasurementHistory + { + /// + /// 主键 + /// + [SugarColumn(ColumnName = "OBJ_ID", IsPrimaryKey = true, IsIdentity = true, OracleSequenceName = "SEQ_TEMPERATUREMEASUREMENTHISTORY")] + public int ObjId { get; set; } + + /// + /// 线号 + /// + [SugarColumn(ColumnName = "LINE_NO")] + public int LineNo { get; set; } + + /// + /// 工位号 + /// + [SugarColumn(ColumnName = "GONGWNO")] + public int Gongwno { get; set; } + + /// + /// 产品条码 + /// + [SugarColumn(ColumnName = "CPNO")] + public string Cpno { get; set; } + + /// + /// 产品型号 + /// + [SugarColumn(ColumnName = "CPMODEL")] + public string Cpmodel { get; set; } + + /// + /// 基准型号 + /// + [SugarColumn(ColumnName = "FACTORYMODEL")] + public string Factorymodel { get; set; } + + /// + /// 工作电压 + /// + [SugarColumn(ColumnName = "VOLTAGE")] + public int Voltage { get; set; } + + /// + /// 测试通道 + /// + [SugarColumn(ColumnName = "POINT2")] + public string Point2 { get; set; } + + /// + /// 计划测试时间 + /// + [SugarColumn(ColumnName = "TESTTIME")] + public int TestTime { get; set; } + + /// + /// 实际测试时间 + /// + [SugarColumn(ColumnName = "TESTEDTIME")] + public decimal TestedTime { get; set; } + + /// + /// 环温 + /// + [SugarColumn(ColumnName = "ETEMP")] + public decimal Etemp { get; set; } + + /// + /// 开始测试时间 + /// + [SugarColumn(ColumnName = "BEGINDATETIME")] + public DateTime BeginDatetime { get; set; } + + /// + /// 测试结果 + /// + [SugarColumn(ColumnName = "CPRESULT")] + public string CpResult { get; set; } + + /// + /// 测试结束时间 + /// + [SugarColumn(ColumnName = "ENDDATETIME")] + public DateTime EndDateTime { get; set; } + + /// + /// 系统用户 + /// + [SugarColumn(ColumnName = "USERNAME")] + public string UserName { get; set; } + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "REMARK")] + public string Remark { get; set; } + + /// + /// 第几次测试 + /// + [SugarColumn(ColumnName = "TESTNO")] + public int TestNo { get; set; } + + /// + /// 温度数据 + /// + [SugarColumn(ColumnName = "TEMP_MES")] + public string Temp_Mes { get; set; } + + /// + /// 功率数据 + /// + [SugarColumn(ColumnName = "POWER_MES")] + public string Power_Mes { get; set; } + + /// + /// 部件测试数据 + /// + [SugarColumn(ColumnName = "PART_MES")] + public string Part_Mes { get; set; } + + /// + /// 故障代码 + /// + [SugarColumn(ColumnName = "ERRORCODE_MES")] + public string ErrorCode_Mes { get; set; } + + /// + /// 内部传感器 1 名称 + /// + [SugarColumn(ColumnName = "T1NAME")] + public string T1Name { get; set; } + + /// + /// 内部传感器 2 名称 + /// + [SugarColumn(ColumnName = "T2NAME")] + public string T2Name { get; set; } + + /// + /// 内部传感器 3 名称 + /// + [SugarColumn(ColumnName = "T3NAME")] + public string T3Name { get; set; } + + /// + /// 内部传感器 4 名称 + /// + [SugarColumn(ColumnName = "T4NAME")] + public string T4Name { get; set; } + + /// + /// 内部传感器 5 名称 + /// + [SugarColumn(ColumnName = "T5NAME")] + public string T5Name { get; set; } + + /// + /// 内部传感器 6 名称 + /// + [SugarColumn(ColumnName = "T6NAME")] + public string T6Name { get; set; } + + /// + /// 是否测试部件(”Y”测试) + /// + [SugarColumn(ColumnName = "ISORDER")] + public string IsOrder { get; set; } + + /// + /// 低压启动测试时间 + /// + [SugarColumn(ColumnName = "LOWV_TIME")] + public int LowV_Time { get; set; } + + /// + /// 低压启动标准下限 + /// + [SugarColumn(ColumnName = "LOWV_POWERMIN")] + public decimal LowV_PowerMin { get; set; } + + /// + /// 低压启动标准上限 + /// + [SugarColumn(ColumnName = "LOWV_POWERMAX")] + public decimal LowV_PowerMax { get; set; } + + /// + /// 低压启动实际采集值 + /// + [SugarColumn(ColumnName = "LOWV_POWERFACT")] + public decimal LowV_PowerFact { get; set; } + + /// + /// 低压启动测试电压 + /// + [SugarColumn(ColumnName = "LOWVOLTAGE")] + public decimal LowVoltage { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CREATE_TIME")] + public DateTime CreateTime { get; set; } + + } +} diff --git a/Admin.Core.Model/Model_New/TemperatureHistory.cs b/Admin.Core.Model/Model_New/TemperatureHistory.cs new file mode 100644 index 00000000..87b85ba6 --- /dev/null +++ b/Admin.Core.Model/Model_New/TemperatureHistory.cs @@ -0,0 +1,191 @@ +using NPOI.Util; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Admin.Core.Model +{ + /// + /// 测温历史记录 + /// + [Table("TemperatureHistory")] + [SugarTable("TemperatureHistory", "Hsdb")] + public class TemperatureHistory + { + /// + /// 主键 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int ObjId { get; set; } + + /// + /// 线号 + /// + public int Line_No { get; set; } + + /// + /// 工位号 + /// + public int Gongwno { get; set; } + + /// + /// 产品条码 + /// + public string Cpno { get; set; } + + /// + /// 产品型号 + /// + public string CpModel { get; set; } + + /// + /// 基准型号 + /// + public string FactoryModel { get; set; } + + /// + /// 工作电压 + /// + public int Voltage { get; set; } + + /// + /// 测试通道 + /// + public string Point2 { get; set; } + + /// + /// 计划测试时间 + /// + public int TestTime { get; set; } + + /// + /// 实际测试时间 + /// + public decimal TestedTime { get; set; } + + /// + /// 环温 + /// + public decimal Etemp { get; set; } + + /// + /// 开始测试时间 + /// + public DateTime BeginDateTime { get; set; } + + /// + /// 测试结果 + /// + public string CpResult { get; set; } + + /// + /// 测试结束时间 + /// + public DateTime EndDateTime { get; set; } + + /// + /// 系统用户 + /// + public string UserName { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 第几次测试 + /// + public int TestNo { get; set; } + + /// + /// 温度数据 + /// + public string Temp_Mes { get; set; } + + /// + /// 功率数据 + /// + public string Power_Mes { get; set; } + + /// + /// 部件测试数据 + /// + public string Part_Mes { get; set; } + + /// + /// 故障代码 + /// + public string ErrorCode_Mes { get; set; } + + /// + /// 内部传感器 1 名称 + /// + public string T1Name { get; set; } + + /// + /// 内部传感器 2 名称 + /// + public string T2Name { get; set; } + + /// + /// 内部传感器 3 名称 + /// + public string T3Name { get; set; } + + /// + /// 内部传感器 4 名称 + /// + public string T4Name { get; set; } + + /// + /// 内部传感器 5 名称 + /// + public string T5Name { get; set; } + + /// + /// 内部传感器 6 名称 + /// + public string T6Name { get; set; } + + /// + /// 是否测试部件(”Y”测试) + /// + public string IsOrder { get; set; } + + /// + /// 低压启动测试时间 + /// + public int LowV_Time { get; set; } + + /// + /// 低压启动标准下限 + /// + public decimal LowV_PowerMin { get; set; } + + /// + /// 低压启动标准上限 + /// + public decimal LowV_PowerMax { get; set; } + + /// + /// 低压启动实际采集值 + /// + public decimal LowV_PowerFact { get; set; } + + /// + /// 低压启动测试电压 + /// + public decimal LowVoltage { get; set; } + + /// + /// 同步标识 + /// + public int flag { get; set; } + } +} diff --git a/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.GeneratedMSBuildEditorConfig.editorconfig index abc27d01..ce84cb9f 100644 --- a/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.GeneratedMSBuildEditorConfig.editorconfig +++ b/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.GeneratedMSBuildEditorConfig.editorconfig @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = Admin.Core.RealTimeService -build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.RealTimeService\ +build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.RealTimeService\ diff --git a/Admin.Core.Repository/Repository_New/BoxTemperatureMeasurementHistoryRepository.cs b/Admin.Core.Repository/Repository_New/BoxTemperatureMeasurementHistoryRepository.cs new file mode 100644 index 00000000..9f1cb3ae --- /dev/null +++ b/Admin.Core.Repository/Repository_New/BoxTemperatureMeasurementHistoryRepository.cs @@ -0,0 +1,19 @@ +using Admin.Core.IRepository; +using Admin.Core.Model; +using Admin.Core.Model.Model_New; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.Repository +{ + /// + /// BoxTemperatureMeasurementHistoryRepository + /// + public class BoxTemperatureMeasurementHistoryRepository : BaseRepository, IBoxTemperatureMeasurementHistoryRepository + { + public BoxTemperatureMeasurementHistoryRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + } + + } +} \ No newline at end of file diff --git a/Admin.Core.Repository/Repository_New/TemperatureHistoryRepository.cs b/Admin.Core.Repository/Repository_New/TemperatureHistoryRepository.cs new file mode 100644 index 00000000..cde15392 --- /dev/null +++ b/Admin.Core.Repository/Repository_New/TemperatureHistoryRepository.cs @@ -0,0 +1,19 @@ +using Admin.Core.IRepository; +using Admin.Core.Model; +using Admin.Core.Model.Model_New; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.Repository +{ + /// + /// TemperatureHistoryRepository + /// + public class TemperatureHistoryRepository : BaseRepository, ITemperatureHistoryRepository + { + public TemperatureHistoryRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + } + + } +} \ No newline at end of file diff --git a/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.GeneratedMSBuildEditorConfig.editorconfig index a3d7d5ba..a581a844 100644 --- a/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.GeneratedMSBuildEditorConfig.editorconfig +++ b/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.GeneratedMSBuildEditorConfig.editorconfig @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = Admin.Core.Serilog.Es -build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.Serilog.Es\ +build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Serilog.Es\ diff --git a/Admin.Core.Service/Service_New/BoxTemperatureMeasurementHistoryServices.cs b/Admin.Core.Service/Service_New/BoxTemperatureMeasurementHistoryServices.cs new file mode 100644 index 00000000..0a8c5f98 --- /dev/null +++ b/Admin.Core.Service/Service_New/BoxTemperatureMeasurementHistoryServices.cs @@ -0,0 +1,28 @@ +using Admin.Core.IRepository; +using Admin.Core.IService; +using Admin.Core.Model; +using Admin.Core.Model.Model_New; +using Admin.Core.Model.ViewModels; +using log4net; +using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.IdentityModel.Logging; +using NPOI.XSSF.UserModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Admin.Core.Service +{ + public class BoxTemperatureMeasurementHistoryServices : BaseServices, IBoxTemperatureMeasurementHistoryServices + { + private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(BoxTemperatureMeasurementHistoryServices)); + private readonly IBaseRepository _dal; + + public BoxTemperatureMeasurementHistoryServices(IBaseRepository dal) + { + this._dal = dal; + base.BaseDal = dal; + } + } +} \ No newline at end of file diff --git a/Admin.Core.Service/Service_New/TemperatureHistoryServices.cs b/Admin.Core.Service/Service_New/TemperatureHistoryServices.cs new file mode 100644 index 00000000..daf304b4 --- /dev/null +++ b/Admin.Core.Service/Service_New/TemperatureHistoryServices.cs @@ -0,0 +1,28 @@ +using Admin.Core.IRepository; +using Admin.Core.IService; +using Admin.Core.Model; +using Admin.Core.Model.Model_New; +using Admin.Core.Model.ViewModels; +using log4net; +using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.IdentityModel.Logging; +using NPOI.XSSF.UserModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Admin.Core.Service +{ + public class TemperatureHistoryServices : BaseServices,ITemperatureHistoryServices + { + private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(TemperatureHistoryServices)); + private readonly IBaseRepository _dal; + + public TemperatureHistoryServices(IBaseRepository dal) + { + this._dal = dal; + base.BaseDal = dal; + } + } +} \ No newline at end of file diff --git a/Admin.Core.Tasks/QuartzNet/Jobs/Job_TemperatureMeasurement_Quartz.cs b/Admin.Core.Tasks/QuartzNet/Jobs/Job_TemperatureMeasurement_Quartz.cs new file mode 100644 index 00000000..a90c0339 --- /dev/null +++ b/Admin.Core.Tasks/QuartzNet/Jobs/Job_TemperatureMeasurement_Quartz.cs @@ -0,0 +1,139 @@ +using Admin.Core.IService.ISys; +using Admin.Core.IService; +using Quartz; +using System; +using System.Threading.Tasks; +using log4net; +using Admin.Core.Model; +using System.Linq; +using Admin.Core.Model.Model_New; +using Aucma.Core.HwPLc; +using HwCommunication.Core; +using Admin.Core.Common.Helper; +using System.Collections; +using System.Text; +using NetTaste; +using Admin.Core.Service; +using AutoMapper; +using System.Collections.Generic; + +/// +/// 测温数据采集 +/// +namespace Admin.Core.Tasks +{ + public class Job_TemperatureMeasurement_Quartz : JobBase, IJob + { + public delegate Task RefreshBoxFoamDataDelegate(); + public static event RefreshBoxFoamDataDelegate RefreshBoxFoamDataDelegateEvent; + + private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(Job_TemperatureMeasurement_Quartz)); + private readonly IBoxTemperatureMeasurementHistoryServices _boxTMHistoryServices; + private readonly ITemperatureHistoryServices _temperatureHistoryServices; + IMapper _mapper; + + public Job_TemperatureMeasurement_Quartz(ISysTasksQzService SysTasksQzService, ISysJobLogService sysJobLogService, + ITemperatureHistoryServices temperatureHistoryServices, IBoxTemperatureMeasurementHistoryServices boxTMHistoryServices, + IMapper mapper) + { + _SysTasksQzService = SysTasksQzService; + _boxTMHistoryServices = boxTMHistoryServices; + _temperatureHistoryServices = temperatureHistoryServices; + _mapper = mapper; + } + + public async Task Execute(IJobExecutionContext context) + { + await ExecuteJob(context, async () => await Run(context)); + } + + #region PLC 任务处理表 + /// + /// PLC 任务处理表 + /// + /// + /// + public async Task Run(IJobExecutionContext context) + { + try + { + + var list = await _temperatureHistoryServices.QueryAsync(d => d.flag == 0); + if (list == null) return; + Console.WriteLine(list.Count()); + List< BoxTemperatureMeasurementHistory > historyList = new List(); + foreach (var item in list) + { + BoxTemperatureMeasurementHistory dest = new BoxTemperatureMeasurementHistory(); + dest.LineNo = item.Line_No; + dest.Gongwno = item.Gongwno; + dest.Cpno = item.Cpno; + dest.Cpmodel = item.CpModel; + dest.Factorymodel = item.FactoryModel; + dest.Voltage = item.Voltage; + dest.Point2 = item.Point2; + dest.TestTime = item.TestTime; + dest.TestedTime = item.TestedTime; + dest.Etemp = item.Etemp; + dest.BeginDatetime = item.BeginDateTime; + dest.CpResult = item.CpResult; + dest.EndDateTime = item.EndDateTime; + dest.UserName = item.UserName; + dest.Remark = item.Remark; + dest.TestNo = item.TestNo; + dest.Temp_Mes = item.Temp_Mes; + dest.Power_Mes = item.Power_Mes; + dest.Part_Mes = item.Part_Mes; + dest.ErrorCode_Mes = item.ErrorCode_Mes; + dest.T1Name = item.T1Name; + dest.T2Name = item.T2Name; + dest.T3Name = item.T3Name; + dest.T4Name = item.T4Name; + dest.T5Name = item.T5Name; + dest.T6Name = item.T6Name; + dest.IsOrder = item.IsOrder; + dest.LowV_Time = item.LowV_Time; + dest.LowV_PowerMin = item.LowV_PowerMin; + dest.LowV_PowerMax = item.LowV_PowerMax; + dest.LowV_PowerFact = item.LowV_PowerFact; + dest.LowVoltage = item.LowVoltage; + historyList.Add(dest); + } + //List history =new _mapper.Map>(list); + Console.WriteLine(historyList.Count()); + var result = await _boxTMHistoryServices.AddAsync(historyList); + if (result > 0) + { + list.ForEach(x => x.flag = 1); + if (list == null) return; + await _temperatureHistoryServices.UpdateAsync(list); + + Console.WriteLine("保存测温系统成功"); + } + } + catch (Exception ex) + { + logHelper.Error($"数据处理异常:{ex.Message}"); + + } + } + + private async Task UpdateRealData(BoxFoamData item) + { + + try + { + + } + catch (Exception ex) + { + logHelper.Error($"更新测温数据失败"); + } + + return await Task.FromResult(item); + } + #endregion + + + } +} diff --git a/Admin.Core.sln b/Admin.Core.sln index 4a25182c..bdebcd4c 100644 --- a/Admin.Core.sln +++ b/Admin.Core.sln @@ -85,6 +85,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aucma.Core.OldBoxFoam", "Au EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aucma.Core.HwPLc", "Aucma.Core.HwPLc\Aucma.Core.HwPLc.csproj", "{A1473270-1D54-40D5-9E68-5C917347CFE8}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aucam.Core.TemperatureService", "Aucam.Core.TemperatureService\Aucam.Core.TemperatureService.csproj", "{87B08C88-4258-4D57-B9E5-EC6C7F3899BC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -211,6 +213,10 @@ Global {A1473270-1D54-40D5-9E68-5C917347CFE8}.Debug|Any CPU.Build.0 = Debug|Any CPU {A1473270-1D54-40D5-9E68-5C917347CFE8}.Release|Any CPU.ActiveCfg = Release|Any CPU {A1473270-1D54-40D5-9E68-5C917347CFE8}.Release|Any CPU.Build.0 = Release|Any CPU + {87B08C88-4258-4D57-B9E5-EC6C7F3899BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {87B08C88-4258-4D57-B9E5-EC6C7F3899BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {87B08C88-4258-4D57-B9E5-EC6C7F3899BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {87B08C88-4258-4D57-B9E5-EC6C7F3899BC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -249,6 +255,7 @@ Global {A7FF5119-A6DE-4947-A1F2-90FE0C628A88} = {F8FB57F6-5465-4E60-B052-D3A63C3C56AE} {A9E66830-A801-4423-BBC6-8F03BA5EB5BF} = {BD987F3A-4E6C-4C47-B28F-1671F875EAE3} {A1473270-1D54-40D5-9E68-5C917347CFE8} = {F8FB57F6-5465-4E60-B052-D3A63C3C56AE} + {87B08C88-4258-4D57-B9E5-EC6C7F3899BC} = {FA2FF2A3-135E-4CA2-9042-76BB71623D5A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8047AB56-042B-4AE4-B06A-34137067A86A} diff --git a/Aucam.Core.TemperatureService/Aucam.Core.TemperatureService.csproj b/Aucam.Core.TemperatureService/Aucam.Core.TemperatureService.csproj new file mode 100644 index 00000000..0af4424c --- /dev/null +++ b/Aucam.Core.TemperatureService/Aucam.Core.TemperatureService.csproj @@ -0,0 +1,40 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + + + + Always + true + PreserveNewest + + + PreserveNewest + true + PreserveNewest + + + + + + + + + + + + + + + + diff --git a/Aucam.Core.TemperatureService/Filter/AutofacPropertityModuleReg.cs b/Aucam.Core.TemperatureService/Filter/AutofacPropertityModuleReg.cs new file mode 100644 index 00000000..5fff0bf3 --- /dev/null +++ b/Aucam.Core.TemperatureService/Filter/AutofacPropertityModuleReg.cs @@ -0,0 +1,24 @@ +using Autofac; +using Microsoft.AspNetCore.Mvc; + +namespace Aucam.Core.TemperatureService +{ + /// + /// AutofacPropertityModuleReg + /// + public class AutofacPropertityModuleReg : Autofac.Module + { + /// + /// Load + /// + /// + protected override void Load(ContainerBuilder builder) + { + var controllerBaseType = typeof(ControllerBase); + builder.RegisterAssemblyTypes(typeof(Program).Assembly) + .Where(t => controllerBaseType.IsAssignableFrom(t) && t != controllerBaseType) + .PropertiesAutowired(); + + } + } +} diff --git a/Aucam.Core.TemperatureService/Log4net.config b/Aucam.Core.TemperatureService/Log4net.config new file mode 100644 index 00000000..b59f9b09 --- /dev/null +++ b/Aucam.Core.TemperatureService/Log4net.config @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Aucam.Core.TemperatureService/MainService.cs b/Aucam.Core.TemperatureService/MainService.cs new file mode 100644 index 00000000..dea596ff --- /dev/null +++ b/Aucam.Core.TemperatureService/MainService.cs @@ -0,0 +1,59 @@ +using Autofac.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Builder; + +namespace Aucam.Core.TemperatureService +{ + public class MainService + { + private string[] args; + public MainService(string[] vs) + { + CreateHostBuilder(args) + //生成宿主。 + .Build() + // ※※※※ 有异常,查看 Log 文件夹下的异常日志 ※※※※ + .RunAsync(); + } + public void Start() + { + + } + + public void Stop() + { + } + + /// + /// CreateHostBuilder + /// + /// + /// + public static IHostBuilder CreateHostBuilder(string[] args) + { + //初始化默认主机Builder + var hostBuilder = Host.CreateDefaultBuilder(args) + //Autofac服务工厂 + .UseServiceProviderFactory(new AutofacServiceProviderFactory()) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .ConfigureLogging((hostingContext, builder) => + { + //清楚控制台log日志 + builder.ClearProviders(); + // 1.过滤掉系统默认的一些日志 + builder.AddFilter("System", LogLevel.Error); + builder.AddFilter("Microsoft", LogLevel.Error); + + // 默认log4net.confg + builder.AddLog4Net(Path.Combine(Directory.GetCurrentDirectory(), "Log4net.config")); + }); + + return hostBuilder; + } + } +} diff --git a/Aucam.Core.TemperatureService/Program.cs b/Aucam.Core.TemperatureService/Program.cs new file mode 100644 index 00000000..23de7563 --- /dev/null +++ b/Aucam.Core.TemperatureService/Program.cs @@ -0,0 +1,70 @@ +using Autofac.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Builder; +using Topshelf; + +namespace Aucam.Core.TemperatureService +{ + public class Program + { + /// + /// Main + /// + /// + public static void Main(string[] args) + { + MainService ms = new MainService(args); + ms.Start(); + Console.ReadKey(); + //var rc = HostFactory.Run(x => + //{ + // x.Service(s => + // { + // s.ConstructUsing(name => new MainService(args)); + // s.WhenStarted(tc => tc.Start()); + // s.WhenStopped(tc => tc.Stop()); + // }); + // x.RunAsLocalSystem(); + + // x.SetDescription("JwtAPIService"); + // x.SetDisplayName("JwtAPIService"); + // x.SetServiceName("JwtAPIService"); + //}); + + //var exitCode = (int)Convert.ChangeType(rc, rc.GetTypeCode()); + //Environment.ExitCode = exitCode; + } + + /// + /// CreateHostBuilder + /// + /// + /// + //public static IHostBuilder CreateHostBuilder(string[] args) + //{ + // //初始化默认主机Builder + // var hostBuilder = Host.CreateDefaultBuilder(args) + // //Autofac服务工厂 + // .UseServiceProviderFactory(new AutofacServiceProviderFactory()) + // .ConfigureWebHostDefaults(webBuilder => + // { + // webBuilder.UseStartup(); + // }) + // .ConfigureLogging((hostingContext, builder) => + // { + // //清楚控制台log日志 + // builder.ClearProviders(); + // // 1.过滤掉系统默认的一些日志 + // builder.AddFilter("System", LogLevel.Error); + // builder.AddFilter("Microsoft", LogLevel.Error); + + // // 默认log4net.confg + // builder.AddLog4Net(Path.Combine(Directory.GetCurrentDirectory(), "Log4net.config")); + // }); + + // return hostBuilder; + //} + } +} \ No newline at end of file diff --git a/Aucam.Core.TemperatureService/Startup.cs b/Aucam.Core.TemperatureService/Startup.cs new file mode 100644 index 00000000..2f2bb1cb --- /dev/null +++ b/Aucam.Core.TemperatureService/Startup.cs @@ -0,0 +1,111 @@ +using Admin.Core.Common; +using Admin.Core.Extensions; +using Admin.Core.IService.ISys; +using Admin.Core.Tasks; +using Aucma.Core.RunPlc; +using Aucma.Core.Tasks; +using Autofac; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using System.Text; + +namespace Aucam.Core.TemperatureService +{ + /// + /// Startup + /// + public class Startup + { + /// + /// Startup + /// + /// + public Startup(IConfiguration configuration, IWebHostEnvironment env) + { + Configuration = configuration; + Env = env; + } + + /// + /// IConfiguration + /// + public IConfiguration Configuration { get; } + /// + /// Ϣ/ + /// + public IWebHostEnvironment Env { get; } + + /// + /// This method gets called by the runtime. Use this method to add services to the container. + /// + /// + public void ConfigureServices(IServiceCollection services) + { + //Appsettings + services.AddSingleton(new Appsettings(Configuration)); + //־ļĿ¼ + services.AddSingleton(new LogLock(Env.ContentRootPath)); + //Memory + services.AddMemoryCacheSetup(); + //SqlsugarݿģͲѯ + services.AddSqlsugarSetup(); + //AutoMapper + services.AddAutoMapperSetup(); + + //עҵ + AddServices(services); + + // + services.AddJobSetup(); + + //ֱ֧ȫ :֧ System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030") + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + } + + + /// + /// עProgram.CreateHostBuilderAutofac񹤳 + /// + /// + public void ConfigureContainer(ContainerBuilder builder) + { + builder.RegisterModule(new AutofacModuleRegister()); + builder.RegisterModule(); + } + + /// + /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + /// + /// + /// + public void Configure(IApplicationBuilder app, ISysTasksQzService tasksQzService, + ISchedulerCenter schedulerCenter) + { + // ʹþ̬ļ + app.UseStaticFiles(); + // ȻȨм + //app.UseAuthorization(); + // QuartzNetJobȷ + app.UseQuartzJobMildd(tasksQzService, schedulerCenter); + + } + + #region ע + /// + /// ע + /// + /// + private static void AddServices(IServiceCollection services) + { + #region ע + //services.AddScoped(); + //services.AddScoped(); + //services.AddScoped, BaseRepository>(); + //services.AddSingleton, BaseService>(); + #endregion + } + #endregion + } +} diff --git a/Aucam.Core.TemperatureService/appsettings.json b/Aucam.Core.TemperatureService/appsettings.json new file mode 100644 index 00000000..a52d1a73 --- /dev/null +++ b/Aucam.Core.TemperatureService/appsettings.json @@ -0,0 +1,231 @@ +{ + "AllowedHosts": "*", + "Logging": { + "LogLevel": { + "Default": "Information", //加入Default否则log4net本地写入不了日志 + "Admin.Core.Extensions.ApiResponseHandler": "Error" + }, + "Debug": { + "LogLevel": { + "Default": "Warning" + } + }, + "Console": { + "LogLevel": { + "Default": "Warning", + "Microsoft.Hosting.Lifetime": "Debug" + } + }, + "Log4Net": { + "Name": "Admin.Core" + } + }, + "AppSettings": { + "RedisCachingAOP": { + "Enabled": false, + "ConnectionString": "" + }, + "MemoryCachingAOP": { + "Enabled": false + }, + "LogAOP": { + "Enabled": false + }, + "TranAOP": { + "Enabled": false + }, + "SqlAOP": { + "Enabled": false, + "OutToLogFile": { + "Enabled": false + }, + "OutToConsole": { + "Enabled": false + } + }, + "FileRootPath": "/file/", + "Date": "2018-08-28", + "Author": "Admin.Core", + "UseLoadTest": true, + "CacheTimeOut": 60, //服务器本地缓存过期时间:分钟 + "ApiRoot": "http://localhost:55014" + }, + "Audience": { + "Secret": "dk6Vv3oTuo2OMU18w86E3j11DtM7RUX5icQtA0DCKuhYDRUqBLIiL", //不要太短,16位+ + "SecretFile": "E:\\my-file\\admin.core.audience.secret.txt", //安全,内容就是Secret + "Issuer": "Admin.Core", + "Audience": "wr", + "Expiration": "6000000" //接口的过期时间 + }, + + // 请配置MainDB为你想要的主库的ConnId值,并设置对应的Enabled为true; + // *** 单库操作,把 MutiDBEnabled 设为false ***; + // *** 多库操作,把 MutiDBEnabled 设为true,其他的从库Enabled也为true **; + // 具体配置看视频:https://www.bilibili.com/video/BV1BJ411B7mn?p=6 + "MainDB": "AUCMA_SCADA", //当前项目的主库,所对应的连接字符串的Enabled必须为true + "MutiDBEnabled": true, //是否开启多库模式 + "CQRSEnabled": false, //是否开启读写分离模式,必须是单库模式,且数据库类型一致,比如都是SqlServer + "DBS": [ + /* + 对应下边的 DBType + MySql = 0, + SqlServer = 1, + Sqlite = 2, + Oracle = 3, + PostgreSQL = 4, + Dm = 5,//达梦 + Kdbndp = 6,//人大金仓 + */ + { + "ConnId": "AUCMA_SCADA", + "DBType": 3, + "Enabled": true, + "HitRate": 50, + "Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.72.20)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCLCDB)));User ID=c##aucma_scada;Password=aucma;", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "Hsdb", + "DBType": 1, + "Enabled": true, + "HitRate": 40, + "Connection": "Data Source=localhost;Initial Catalog=Hsdb;User ID=sa;Password=sa;", + "ProviderName": "System.Data.SqlClient" + } + ], + "QuartzNetJob": [ + { + "ID": 1, + "Name": "TemperatureMeasurement", + "JobGroup": "DEFAULT", + "Cron": "*/10 * * * * ?", + "AssemblyName": "Admin.Core.Tasks", + "ClassName": "Job_TemperatureMeasurement_Quartz", + "Remark": "执行测温设备数据采集程序", + "RunTimes": 3881, + "BeginTime": "2023-04-23 11:08:50.000", + "EndTime": "2100-08-06 16:45:30.000", + "TriggerType": 1, + "IntervalSecond": 1, + "CycleRunTimes": 1, + "IsStart": true, + "JobParams": null, + "DelFlag": false, + "CreateBy": "admin", + "CreateTime": "2023-04-23 11:09:22.0000000", + "UpdateBy": "admin", + "UpdateTime": "2023-11-15 16:45:45.0530000" + } + ], + "Startup": { + "Cors": { + "PolicyName": "CorsIpAccess", //策略名称 + "EnableAllIPs": true, //当为true时,开放所有IP均可访问。 + // 支持多个域名端口,注意端口号后不要带/斜杆:比如localhost:8000/,是错的 + // 注意,http://127.0.0.1:1818 和 http://localhost:1818 是不一样的 + "IPs": "http://localhost:81,http://127.0.0.1:81" + }, + "AppConfigAlert": { + "Enabled": true + }, + "ApiName": "Admin.Core", + "IdentityServer4": { + "Enabled": false, // 这里默认是false,表示使用jwt,如果设置为true,则表示系统使用Ids4模式 + "AuthorizationUrl": "http://localhost:5004", // 认证中心域名 + "ApiName": "admin.core.api" // 资源服务器 + }, + "RedisMq": { + "Enabled": false //redis 消息队列 + }, + "MiniProfiler": { + "Enabled": false //性能分析开启 + }, + "Nacos": { + "Enabled": false //Nacos注册中心 + } + }, + "Redis": { + //"ConnectionString": "127.0.0.1:6379" + "ConnectionString": "127.0.0.1:6379" + }, + "RabbitMQ": { + "Enabled": true, + "Connection": "http://localhost:15672/", + "UserName": "robin", + "Password": "123456", + "RetryCount": 3 + }, + "EventBus": { + "Enabled": true, + "SubscriptionClientName": "Admin.Core" + }, + "Middleware": { + "Plc": { + "Enabled": true + }, + "QuartzNetJob": { + "Enabled": true + + }, + "AucamTask": { + "Enabled": true + } + }, + "PLCServer": [ + { + "Id": 1, + "EquipName": "PerfusionPlc", + "PlcType": "Siemens", + "Enabled": true, + "IP": "127.0.0.1", + "Port": 102 + } + ], + "IpRateLimiting": { + "EnableEndpointRateLimiting": false, //False: globally executed, true: executed for each + "StackBlockedRequests": false, //False: Number of rejections should be recorded on another counter + "RealIpHeader": "X-Real-IP", + "ClientIdHeader": "X-ClientId", + "IpWhitelist": [], //白名单 + "EndpointWhitelist": [ "get:/api/xxx", "*:/api/yyy" ], + "ClientWhitelist": [ "dev-client-1", "dev-client-2" ], + "QuotaExceededResponse": { + "Content": "{{\"status\":429,\"msg\":\"访问过于频繁,请稍后重试\",\"success\":false}}", + "ContentType": "application/json", + "StatusCode": 429 + }, + "HttpStatusCode": 429, //返回状态码 + "GeneralRules": [ //api规则,结尾一定要带* + { + "Endpoint": "*:/api/Admin*", + "Period": "1m", + "Limit": 20 + }, + { + "Endpoint": "*/api/*", + "Period": "1s", + "Limit": 3 + }, + { + "Endpoint": "*/api/*", + "Period": "1m", + "Limit": 30 + }, + { + "Endpoint": "*/api/*", + "Period": "12h", + "Limit": 500 + } + ] + }, + "LogFiedOutPutConfigs": { + "tcpAddressHost": "", // 输出elk的tcp连接地址 + "tcpAddressPort": 0, // 输出elk的tcp端口号 + "ConfigsInfo": [ // 配置的输出elk节点内容 常用语动态标识 + { + "FiedName": "applicationName", + "FiedValue": "Admin.Core.Api" + } + ] + } +} diff --git a/HwControlLib/bin/Debug/net6.0-windows/HwControlLib.dll b/HwControlLib/bin/Debug/net6.0-windows/HwControlLib.dll index 914b0885..bb9cc798 100644 Binary files a/HwControlLib/bin/Debug/net6.0-windows/HwControlLib.dll and b/HwControlLib/bin/Debug/net6.0-windows/HwControlLib.dll differ diff --git a/HwControlLib/bin/Debug/net6.0-windows/HwControlLib.pdb b/HwControlLib/bin/Debug/net6.0-windows/HwControlLib.pdb index afa0f38e..e11f8d6b 100644 Binary files a/HwControlLib/bin/Debug/net6.0-windows/HwControlLib.pdb and b/HwControlLib/bin/Debug/net6.0-windows/HwControlLib.pdb differ