diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml index 60b2ca09..54da5266 100644 --- a/Admin.Core.Api/Admin.Core.Model.xml +++ b/Admin.Core.Api/Admin.Core.Model.xml @@ -2481,6 +2481,16 @@ 所属产线 + + + 上传条码系统保存接口返回信息 + + + + + 当前登录班组(一线白班,一线夜班,二线白班,二线夜班) + + 灌注告警 @@ -3521,7 +3531,7 @@ 工位号 - + 产品条码 @@ -3671,9 +3681,179 @@ 低压启动测试电压 - + + + 同步时间 + + + + + 测温历史记录 + + + + + 主键 + + + + + 线号 + + + + + 工位号 + + + + + 产品条码 + + + + + 产品型号 + + + + + 基准型号 + + + + + 工作电压 + + + + + 测试通道 + + + + + 计划测试时间 + + + + + 实际测试时间 + + + + + 环温 + + + + + 开始测试时间 + + + + + 测试结果 + + + + + 测试结束时间 + + + + + 系统用户 + + + + + 备注 + + + + + 第几次测试 + + + + + 温度数据 + + + + + 功率数据 + + + + + 部件测试数据 + + + + + 故障代码 + + + + + 内部传感器 1 名称 + + + + + 内部传感器 2 名称 + + + + + 内部传感器 3 名称 + + + + + 内部传感器 4 名称 + + + + + 内部传感器 5 名称 + + + + + 内部传感器 6 名称 + + + + + 是否测试部件(”Y”测试) + + + + + 低压启动测试时间 + + + + + 低压启动标准下限 + + + + + 低压启动标准上限 + + + - 同步标识 + 低压启动实际采集值 + + + + + 低压启动测试电压 @@ -5176,6 +5356,171 @@ 班组 + + + 测温信息 + + + + + 线号 + + + + + 工位号 + + + + + 产品条码 + + + + + 产品型号 + + + + + 基准型号 + + + + + 工作电压 + + + + + 测试通道 + + + + + 计划测试时间 + + + + + 实际测试时间 + + + + + 环温 + + + + + 开始测试时间 + + + + + 测试结果 + + + + + 测试结束时间 + + + + + 系统用户 + + + + + 备注 + + + + + 第几次测试 + + + + + 温度数据 + + + + + 功率数据 + + + + + 部件测试数据 + + + + + 故障代码 + + + + + 内部传感器 1 名称 + + + + + 内部传感器 2 名称 + + + + + 内部传感器 3 名称 + + + + + 内部传感器 4 名称 + + + + + 内部传感器 5 名称 + + + + + 内部传感器 6 名称 + + + + + 是否测试部件(”Y”测试) + + + + + 低压启动测试时间 + + + + + 低压启动标准下限 + + + + + 低压启动标准上限 + + + + + 低压启动实际采集值 + + + + + 低压启动测试电压 + + 泡前库入库相信展示 diff --git a/Admin.Core.Api/obj/Debug/net6.0/Admin.Core.Api.AssemblyInfo.cs b/Admin.Core.Api/obj/Debug/net6.0/Admin.Core.Api.AssemblyInfo.cs index 416113a3..6f4432cf 100644 --- a/Admin.Core.Api/obj/Debug/net6.0/Admin.Core.Api.AssemblyInfo.cs +++ b/Admin.Core.Api/obj/Debug/net6.0/Admin.Core.Api.AssemblyInfo.cs @@ -15,7 +15,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Api")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Api")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Api")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.Api/obj/Debug/net6.0/Admin.Core.Api.AssemblyInfoInputs.cache b/Admin.Core.Api/obj/Debug/net6.0/Admin.Core.Api.AssemblyInfoInputs.cache index ffa83db7..56337cba 100644 --- a/Admin.Core.Api/obj/Debug/net6.0/Admin.Core.Api.AssemblyInfoInputs.cache +++ b/Admin.Core.Api/obj/Debug/net6.0/Admin.Core.Api.AssemblyInfoInputs.cache @@ -1 +1 @@ -a93bec2e5ffdf4970a870b00ef63076582f8814a81b11aac5793b179560f6a09 +d3fb98a6e9753e9778fbd74bfb1bab4b2109502e6ffb588dd6ac7fa35784db36 diff --git a/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.AssemblyInfo.cs b/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.AssemblyInfo.cs index 78883a16..1e8da0e5 100644 --- a/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.AssemblyInfo.cs +++ b/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Common")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Common")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Common")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.AssemblyInfoInputs.cache b/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.AssemblyInfoInputs.cache index 2d2656c4..a5b9dc26 100644 --- a/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.AssemblyInfoInputs.cache +++ b/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.AssemblyInfoInputs.cache @@ -1 +1 @@ -7ad81a09147b0478aa0b50225f58a9581fb29a1452bd9a328e249c4af9c9ba8b +87a0600a7f41dbd7fb6e17317b46dab48d599fb88ba27b9ecafe90600b623f5e diff --git a/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.AssemblyInfo.cs b/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.AssemblyInfo.cs index e235b754..5c3fe5d0 100644 --- a/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.AssemblyInfo.cs +++ b/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.EventBus")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.EventBus")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.EventBus")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.AssemblyInfoInputs.cache b/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.AssemblyInfoInputs.cache index 42d93272..2eba2c73 100644 --- a/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.AssemblyInfoInputs.cache +++ b/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.AssemblyInfoInputs.cache @@ -1 +1 @@ -2fc7d476902952a95d287f6f5b416b2d2e0c4d9b481a5e49690d0af6f465138c +0b6334a8eca6220f34a70ef7e8638a5a7d7d915a08c883404c49ce9b20597be9 diff --git a/Admin.Core.Extensions/AutoMapper/AutoMapperConfig.cs b/Admin.Core.Extensions/AutoMapper/AutoMapperConfig.cs index b9d06010..ab14351c 100644 --- a/Admin.Core.Extensions/AutoMapper/AutoMapperConfig.cs +++ b/Admin.Core.Extensions/AutoMapper/AutoMapperConfig.cs @@ -18,42 +18,43 @@ namespace Admin.Core.Extensions 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)). + // 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/obj/Debug/net6.0/Admin.Core.Extensions.AssemblyInfo.cs b/Admin.Core.Extensions/obj/Debug/net6.0/Admin.Core.Extensions.AssemblyInfo.cs index 80f08c91..9ec9f31f 100644 --- a/Admin.Core.Extensions/obj/Debug/net6.0/Admin.Core.Extensions.AssemblyInfo.cs +++ b/Admin.Core.Extensions/obj/Debug/net6.0/Admin.Core.Extensions.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Extensions")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Extensions")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Extensions")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.Extensions/obj/Debug/net6.0/Admin.Core.Extensions.AssemblyInfoInputs.cache b/Admin.Core.Extensions/obj/Debug/net6.0/Admin.Core.Extensions.AssemblyInfoInputs.cache index 58ca4cd9..efc949f3 100644 --- a/Admin.Core.Extensions/obj/Debug/net6.0/Admin.Core.Extensions.AssemblyInfoInputs.cache +++ b/Admin.Core.Extensions/obj/Debug/net6.0/Admin.Core.Extensions.AssemblyInfoInputs.cache @@ -1 +1 @@ -d780f4c71d7f81730d6e88e43ff8d26d1f8e15b705f157a4bf086caa5e7da499 +4a7a5e632f75acc2920835c957e2ba4bacf9c19fa66b0e4b558910512e4ad1f0 diff --git a/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.AssemblyInfo.cs b/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.AssemblyInfo.cs index 0cd9d347..11394b9a 100644 --- a/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.AssemblyInfo.cs +++ b/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.FrameWork")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+09425abb94ddbc502762491aeee6d081b0fd9246")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.FrameWork")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.FrameWork")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.AssemblyInfoInputs.cache b/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.AssemblyInfoInputs.cache index e3975406..96482b8d 100644 --- a/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.AssemblyInfoInputs.cache +++ b/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.AssemblyInfoInputs.cache @@ -1 +1 @@ -8726b4a34e466084643a48e8c0039a17689dbbba68bb056ab0191f984716dde6 +95b9afb20f612087230db37b666e22f3502b9cda1b891f7e39f9c1fa82a9e378 diff --git a/Admin.Core.IRepository/IRepository_New/ITemperatureHistoryRepository.cs b/Admin.Core.IRepository/IRepository_New/ITemperatureHistoryRepository.cs index a5c2d599..c17ca95e 100644 --- a/Admin.Core.IRepository/IRepository_New/ITemperatureHistoryRepository.cs +++ b/Admin.Core.IRepository/IRepository_New/ITemperatureHistoryRepository.cs @@ -1,5 +1,6 @@ using Admin.Core.Model; using Admin.Core.Model.Model_New; +using Admin.Core.Model.ViewModels; using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -11,17 +12,6 @@ namespace Admin.Core.IRepository /// public interface ITemperatureHistoryRepository : IBaseRepository { - /// - /// 传递时间时间 调用存储过程 获取测温历史记录 - /// - /// 起始时间 - /// - List QueryTemperatureHistory(DateTime startTime); - /// - /// 传递条码 调用存储过程 获取测温历史记录 - /// - /// 条码 - /// - List QueryTemperatureHistory(string barCode); + } } \ No newline at end of file diff --git a/Admin.Core.IRepository/IRepository_New/ITestedCodeMESRepository.cs b/Admin.Core.IRepository/IRepository_New/ITestedCodeMESRepository.cs new file mode 100644 index 00000000..ec9dbb9b --- /dev/null +++ b/Admin.Core.IRepository/IRepository_New/ITestedCodeMESRepository.cs @@ -0,0 +1,21 @@ +using Admin.Core.Model; +using Admin.Core.Model.ViewModels; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.IRepository +{ + /// + /// ITestedCodeMESRepository + /// + public interface ITestedCodeMESRepository : IBaseRepository + { + /// + /// 传递时间时间 调用存储过程 获取测温历史记录 + /// + /// 结束时间 + /// + List QueryTemperatureHistory(DateTime time); + } +} \ No newline at end of file diff --git a/Admin.Core.IRepository/obj/Debug/net6.0/Admin.Core.IRepository.AssemblyInfo.cs b/Admin.Core.IRepository/obj/Debug/net6.0/Admin.Core.IRepository.AssemblyInfo.cs index fc4b8314..f65c2f92 100644 --- a/Admin.Core.IRepository/obj/Debug/net6.0/Admin.Core.IRepository.AssemblyInfo.cs +++ b/Admin.Core.IRepository/obj/Debug/net6.0/Admin.Core.IRepository.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IRepository")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IRepository")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IRepository")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.IRepository/obj/Debug/net6.0/Admin.Core.IRepository.AssemblyInfoInputs.cache b/Admin.Core.IRepository/obj/Debug/net6.0/Admin.Core.IRepository.AssemblyInfoInputs.cache index cdfea74e..da998fea 100644 --- a/Admin.Core.IRepository/obj/Debug/net6.0/Admin.Core.IRepository.AssemblyInfoInputs.cache +++ b/Admin.Core.IRepository/obj/Debug/net6.0/Admin.Core.IRepository.AssemblyInfoInputs.cache @@ -1 +1 @@ -72f20f6cf98a472ebf4c20b336a615ec584766bd52e85cd9501f3b4e781988db +1729bdd33c92c32780dfc41d1c8c22b6e81b413dc7bcedea2de590235227a7d0 diff --git a/Admin.Core.IService/IService_New/ITemperatureHistoryServices.cs b/Admin.Core.IService/IService_New/ITemperatureHistoryServices.cs index 8151412a..ceeeebd2 100644 --- a/Admin.Core.IService/IService_New/ITemperatureHistoryServices.cs +++ b/Admin.Core.IService/IService_New/ITemperatureHistoryServices.cs @@ -12,18 +12,6 @@ namespace Admin.Core.IService /// public interface ITemperatureHistoryServices : IBaseServices { - /// - /// 根据起始时间查询 测温历史记录 - /// - /// - /// - List QueryTemperatureHistory(DateTime startTime); - /// - ///根据条码查询历史记录 - /// - /// - /// - List QueryTemperatureHistory(string barCode); } } \ No newline at end of file diff --git a/Admin.Core.IService/IService_New/ITestedCodeMESServices.cs b/Admin.Core.IService/IService_New/ITestedCodeMESServices.cs new file mode 100644 index 00000000..63246d5b --- /dev/null +++ b/Admin.Core.IService/IService_New/ITestedCodeMESServices.cs @@ -0,0 +1,19 @@ +using Admin.Core.Model; +using System; +using System.Collections.Generic; + +namespace Admin.Core.IService +{ + /// + /// IBaseBomInfoServices + /// + public interface ITestedCodeMESServices : IBaseServices + { + + /// + /// 获取系统班组时间 + /// + public List QueryTemperatureHistory(DateTime startTime); + + } +} \ No newline at end of file diff --git a/Admin.Core.IService/obj/Debug/net6.0/Admin.Core.IService.AssemblyInfo.cs b/Admin.Core.IService/obj/Debug/net6.0/Admin.Core.IService.AssemblyInfo.cs index 268689ba..fa459499 100644 --- a/Admin.Core.IService/obj/Debug/net6.0/Admin.Core.IService.AssemblyInfo.cs +++ b/Admin.Core.IService/obj/Debug/net6.0/Admin.Core.IService.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IService")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IService")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IService")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.IService/obj/Debug/net6.0/Admin.Core.IService.AssemblyInfoInputs.cache b/Admin.Core.IService/obj/Debug/net6.0/Admin.Core.IService.AssemblyInfoInputs.cache index 86b58924..5f3f1db5 100644 --- a/Admin.Core.IService/obj/Debug/net6.0/Admin.Core.IService.AssemblyInfoInputs.cache +++ b/Admin.Core.IService/obj/Debug/net6.0/Admin.Core.IService.AssemblyInfoInputs.cache @@ -1 +1 @@ -58e5bcaec14d01e659427d2a8c0b1fbc2e0da050bb91443cceff81b9cb2a3e6c +c83a04ebc368821387c3ab97734761bca5244ace0e4e216ff1cefcac9c4ba4da diff --git a/Admin.Core.Model/Model_New/BoxTemperatureMeasurementHistory.cs b/Admin.Core.Model/Model_New/BoxTemperatureMeasurementHistory.cs index 971507a0..a1a755c4 100644 --- a/Admin.Core.Model/Model_New/BoxTemperatureMeasurementHistory.cs +++ b/Admin.Core.Model/Model_New/BoxTemperatureMeasurementHistory.cs @@ -85,7 +85,7 @@ namespace Admin.Core.Model /// 开始测试时间 /// [SugarColumn(ColumnName = "BEGINDATETIME")] - public DateTime BeginDatetime { get; set; } + public string BeginDatetime { get; set; } /// /// 测试结果 @@ -97,7 +97,7 @@ namespace Admin.Core.Model /// 测试结束时间 /// [SugarColumn(ColumnName = "ENDDATETIME")] - public DateTime EndDateTime { get; set; } + public string EndDateTime { get; set; } /// /// 系统用户 diff --git a/Admin.Core.Model/Model_New/TemperatureHistory.cs b/Admin.Core.Model/Model_New/TemperatureHistory.cs index 87b85ba6..219e62ba 100644 --- a/Admin.Core.Model/Model_New/TemperatureHistory.cs +++ b/Admin.Core.Model/Model_New/TemperatureHistory.cs @@ -1,191 +1,217 @@ -using NPOI.Util; -using SqlSugar; +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")] + [Table("BOX_TEMPERATUREHISTORY")] + [SugarTable("BOX_TEMPERATUREHISTORY", "AUCMA_SCADA")] public class TemperatureHistory { /// /// 主键 /// - [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + [SugarColumn(ColumnName = "OBJ_ID", IsIdentity = true, IsPrimaryKey = true, OracleSequenceName = "SEQ_CODE_BINDING")] public int ObjId { get; set; } /// /// 线号 /// + [SugarColumn(ColumnName = "LINE_NO")] public int Line_No { get; set; } /// /// 工位号 /// + [SugarColumn(ColumnName = "GONGWNO")] public int Gongwno { get; set; } /// /// 产品条码 /// - public string Cpno { 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 = "FACTORYMODEL")] 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; } /// /// 开始测试时间 /// - public DateTime BeginDateTime { get; set; } + [SugarColumn(ColumnName = "BEGINDATETIME")] + public string BeginDateTime { get; set; } /// /// 测试结果 /// + [SugarColumn(ColumnName = "CPRESULT")] public string CpResult { get; set; } /// /// 测试结束时间 /// - public DateTime EndDateTime { get; set; } + [SugarColumn(ColumnName = "ENDDATETIME")] + public string 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; } - /// - /// 同步标识 + /// 同步时间 /// - public int flag { get; set; } + [SugarColumn(ColumnName = "SYNC_DATETIME")] + public DateTime SyncDate { get; set; } } } diff --git a/Admin.Core.Model/Model_New/TestedCode_MES.cs b/Admin.Core.Model/Model_New/TestedCode_MES.cs new file mode 100644 index 00000000..795fe0ef --- /dev/null +++ b/Admin.Core.Model/Model_New/TestedCode_MES.cs @@ -0,0 +1,183 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Admin.Core.Model +{ + /// + /// 测温历史记录 + /// + [Table("TestedCode_MES")] + [SugarTable("TestedCode_MES", "TOPLINE_T10_E_P2_32_AUCMA_HeNan_D_261")] + public class TestedCode_MES + { + /// + /// 主键 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int ID { 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 string BeginDateTime { get; set; } + + /// + /// 测试结果 + /// + public string CpResult { get; set; } + + /// + /// 测试结束时间 + /// + public string 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; } + } +} diff --git a/Admin.Core.Model/ViewModels/Data_ForMES.cs b/Admin.Core.Model/ViewModels/Data_ForMES.cs new file mode 100644 index 00000000..8c9804ed --- /dev/null +++ b/Admin.Core.Model/ViewModels/Data_ForMES.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Admin.Core.Model.ViewModels +{ + /// + /// 测温信息 + /// + public class Data_ForMES + { + /// + /// 线号 + /// + 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 string BeginDateTime { get; set; } + + /// + /// 测试结果 + /// + public string CpResult { get; set; } + + /// + /// 测试结束时间 + /// + public string 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; } + } +} diff --git a/Admin.Core.Model/obj/Debug/net6.0/Admin.Core.Model.AssemblyInfo.cs b/Admin.Core.Model/obj/Debug/net6.0/Admin.Core.Model.AssemblyInfo.cs index 1ba50fcd..a5bc4c36 100644 --- a/Admin.Core.Model/obj/Debug/net6.0/Admin.Core.Model.AssemblyInfo.cs +++ b/Admin.Core.Model/obj/Debug/net6.0/Admin.Core.Model.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Model")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Model")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Model")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.Model/obj/Debug/net6.0/Admin.Core.Model.AssemblyInfoInputs.cache b/Admin.Core.Model/obj/Debug/net6.0/Admin.Core.Model.AssemblyInfoInputs.cache index 005e2754..a31eea14 100644 --- a/Admin.Core.Model/obj/Debug/net6.0/Admin.Core.Model.AssemblyInfoInputs.cache +++ b/Admin.Core.Model/obj/Debug/net6.0/Admin.Core.Model.AssemblyInfoInputs.cache @@ -1 +1 @@ -1ec56689cad54c12209e5fbd483faa339ac415e2614a8fd6b45ec357a392a616 +1aeaf67c9b05c0229d5cde75302719d662a4718be25a06f06faf717d4b7ecb6e diff --git a/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.AssemblyInfo.cs b/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.AssemblyInfo.cs index c8a894b3..c9b4b609 100644 --- a/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.AssemblyInfo.cs +++ b/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.RealTimeService")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.RealTimeService")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.RealTimeService")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.AssemblyInfoInputs.cache b/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.AssemblyInfoInputs.cache index 311d4f37..b65e38b0 100644 --- a/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.AssemblyInfoInputs.cache +++ b/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.AssemblyInfoInputs.cache @@ -1 +1 @@ -0233e45d9021e3993970f80743611620290253700f9f88fdb16a4673a7d9f624 +9b91b2796fb406d49fdb27eb68d79566580a4e8d69d50cc0f88bef80277b52f1 diff --git a/Admin.Core.Repository/Repository_New/TemperatureHistoryRepository.cs b/Admin.Core.Repository/Repository_New/TemperatureHistoryRepository.cs index 350b5dc8..540e53b5 100644 --- a/Admin.Core.Repository/Repository_New/TemperatureHistoryRepository.cs +++ b/Admin.Core.Repository/Repository_New/TemperatureHistoryRepository.cs @@ -1,5 +1,6 @@ using Admin.Core.IRepository; using Admin.Core.Model; +using Admin.Core.Model.ViewModels; using SqlSugar; using System; using System.Collections.Generic; @@ -16,35 +17,7 @@ namespace Admin.Core.Repository { } - #region 传递时间时间 调用存储过程 获取测温历史记录 - /// - /// 传递的参数为信息起始时间,该存储过程会提取从起始时间开始按时间排序的 2000 条数据 - /// - /// - public List QueryTemperatureHistory(DateTime startTime) - { - var s = new SugarParameter("@p", startTime); - var res = new SugarParameter("@History", null, true);//设置为output - var list = Db.CopyNew().Ado.UseStoredProcedure().SqlQuery("Data_ForMES2", s); - return list; - } - #endregion - #region 传递条码 调用存储过程 获取测温历史记录 - /// - /// 调用存储过程 获取测温历史记录 - /// - /// - public List QueryTemperatureHistory(string barCode) - { - string startTime = string.Empty; - string endTime = string.Empty; - var s = new SugarParameter("@p", barCode); - var res = new SugarParameter("@History", null, true);//设置为output - var list = Db.CopyNew().Ado.UseStoredProcedure().SqlQuery("Data_ForMES", s); - return list; - } - #endregion } } \ No newline at end of file diff --git a/Admin.Core.Repository/Repository_New/TestedCodeMESRepository.cs b/Admin.Core.Repository/Repository_New/TestedCodeMESRepository.cs new file mode 100644 index 00000000..edc29879 --- /dev/null +++ b/Admin.Core.Repository/Repository_New/TestedCodeMESRepository.cs @@ -0,0 +1,34 @@ +using Admin.Core.IRepository; +using Admin.Core.Model; +using Admin.Core.Model.Model_New; +using Admin.Core.Model.ViewModels; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.Repository +{ + /// + /// BaseBomInfoRepository + /// + public class TestedCodeMESRepository : BaseRepository, ITestedCodeMESRepository + { + public TestedCodeMESRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + } + + #region 传递时间时间 调用存储过程 获取测温历史记录 + /// + /// 传递的参数为信息起始时间,该存储过程会提取从起始时间开始按时间排序的 2000 条数据 + /// + /// + public List QueryTemperatureHistory(DateTime time) + { + var endDatetime = new SugarParameter("@EndDatetime", time.AddDays(-1)); + var list = Db.CopyNew().Ado.UseStoredProcedure().SqlQuery("Data_ForMES2", endDatetime); + return list; + } + #endregion + } +} \ No newline at end of file diff --git a/Admin.Core.Repository/obj/Debug/net6.0/Admin.Core.Repository.AssemblyInfo.cs b/Admin.Core.Repository/obj/Debug/net6.0/Admin.Core.Repository.AssemblyInfo.cs index eb59bd79..fe8a0702 100644 --- a/Admin.Core.Repository/obj/Debug/net6.0/Admin.Core.Repository.AssemblyInfo.cs +++ b/Admin.Core.Repository/obj/Debug/net6.0/Admin.Core.Repository.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Repository")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Repository")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Repository")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.Repository/obj/Debug/net6.0/Admin.Core.Repository.AssemblyInfoInputs.cache b/Admin.Core.Repository/obj/Debug/net6.0/Admin.Core.Repository.AssemblyInfoInputs.cache index 4f0d0840..293e5c34 100644 --- a/Admin.Core.Repository/obj/Debug/net6.0/Admin.Core.Repository.AssemblyInfoInputs.cache +++ b/Admin.Core.Repository/obj/Debug/net6.0/Admin.Core.Repository.AssemblyInfoInputs.cache @@ -1 +1 @@ -4639e0ce1dff133705f35aae6cc343d3a434fc547d556f93e46bcf77a8fe9d80 +b421458c05255ab19c6ba5623d1ed22be575b82ed8d7983727203ddffdd5b0aa diff --git a/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.AssemblyInfo.cs b/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.AssemblyInfo.cs index 1498f498..d33702e1 100644 --- a/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.AssemblyInfo.cs +++ b/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Serilog.Es")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Serilog.Es")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Serilog.Es")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.AssemblyInfoInputs.cache b/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.AssemblyInfoInputs.cache index 8bb97ffc..22c46a34 100644 --- a/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.AssemblyInfoInputs.cache +++ b/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.AssemblyInfoInputs.cache @@ -1 +1 @@ -4f26aea112ddb2e1ceead1b404f91a11042202d3d8738b7674a88a5c5fae49b0 +9d1ed847a59d4aaa1c69df7da8b87e219b4aa9e3db77ec0e15f4efb6543c845c diff --git a/Admin.Core.Service/Service_New/TemperatureHistoryServices.cs b/Admin.Core.Service/Service_New/TemperatureHistoryServices.cs index 0431a1b1..2bb63055 100644 --- a/Admin.Core.Service/Service_New/TemperatureHistoryServices.cs +++ b/Admin.Core.Service/Service_New/TemperatureHistoryServices.cs @@ -26,23 +26,6 @@ namespace Admin.Core.Service base.BaseDal = dal; _temperatureHistoryRepository = temperatureHistoryRepository; } - /// - /// 传递时间时间 调用存储过程 获取测温历史记录 - /// - /// 开始时间 - /// - public List QueryTemperatureHistory(DateTime startTime) - { - return _temperatureHistoryRepository.QueryTemperatureHistory(startTime); - } - /// - /// 传递条码 调用存储过程 获取测温历史记录 - /// - /// 条码 - /// - public List QueryTemperatureHistory(string barCode) - { - return _temperatureHistoryRepository.QueryTemperatureHistory(barCode); - } + } } \ No newline at end of file diff --git a/Admin.Core.Service/Service_New/TestedCodeMESServices.cs b/Admin.Core.Service/Service_New/TestedCodeMESServices.cs new file mode 100644 index 00000000..545005f2 --- /dev/null +++ b/Admin.Core.Service/Service_New/TestedCodeMESServices.cs @@ -0,0 +1,33 @@ +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 TestedCodeMESServices : BaseServices, ITestedCodeMESServices + { + private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(TestedCodeMESServices)); + private readonly IBaseRepository _dal; + private readonly ITestedCodeMESRepository _testedCodeMESRepository; + public TestedCodeMESServices(IBaseRepository dal, ITestedCodeMESRepository testedCodeMESRepository) + { + this._dal = dal; + _testedCodeMESRepository = testedCodeMESRepository; + } + + public List QueryTemperatureHistory(DateTime time) + { + return _testedCodeMESRepository.QueryTemperatureHistory(time); + } + } +} \ No newline at end of file diff --git a/Admin.Core.Service/obj/Debug/net6.0/Admin.Core.Service.AssemblyInfo.cs b/Admin.Core.Service/obj/Debug/net6.0/Admin.Core.Service.AssemblyInfo.cs index 8f9ec7e2..29957fa1 100644 --- a/Admin.Core.Service/obj/Debug/net6.0/Admin.Core.Service.AssemblyInfo.cs +++ b/Admin.Core.Service/obj/Debug/net6.0/Admin.Core.Service.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Service")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Service")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Service")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.Service/obj/Debug/net6.0/Admin.Core.Service.AssemblyInfoInputs.cache b/Admin.Core.Service/obj/Debug/net6.0/Admin.Core.Service.AssemblyInfoInputs.cache index 9a2fb840..00a9f665 100644 --- a/Admin.Core.Service/obj/Debug/net6.0/Admin.Core.Service.AssemblyInfoInputs.cache +++ b/Admin.Core.Service/obj/Debug/net6.0/Admin.Core.Service.AssemblyInfoInputs.cache @@ -1 +1 @@ -f7af35947834bb2b8700b1aa87f9fe428cf89bd259aefe95cb2c632699945ffb +f06bf3f95de6133293581e9c4d429b8fc9930722c7d92c532fcb3f4c84aab97d diff --git a/Admin.Core.Tasks/QuartzNet/Jobs/Job_TemperatureMeasurement_Quartz.cs b/Admin.Core.Tasks/QuartzNet/Jobs/Job_TemperatureMeasurement_Quartz.cs deleted file mode 100644 index 2b7c93d2..00000000 --- a/Admin.Core.Tasks/QuartzNet/Jobs/Job_TemperatureMeasurement_Quartz.cs +++ /dev/null @@ -1,140 +0,0 @@ -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); - Console.WriteLine(list.Count()); - if (list.Count == 0) return; - - 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) - { - if (list == null) return; - list.ForEach(x => x.flag = 1); - 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.Tasks/obj/Debug/net6.0/Admin.Core.Tasks.AssemblyInfo.cs b/Admin.Core.Tasks/obj/Debug/net6.0/Admin.Core.Tasks.AssemblyInfo.cs index 0ad8feb9..3fb0ad57 100644 --- a/Admin.Core.Tasks/obj/Debug/net6.0/Admin.Core.Tasks.AssemblyInfo.cs +++ b/Admin.Core.Tasks/obj/Debug/net6.0/Admin.Core.Tasks.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Tasks")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")] [assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Tasks")] [assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Tasks")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Admin.Core.Tasks/obj/Debug/net6.0/Admin.Core.Tasks.AssemblyInfoInputs.cache b/Admin.Core.Tasks/obj/Debug/net6.0/Admin.Core.Tasks.AssemblyInfoInputs.cache index 679f537b..6e4f5327 100644 --- a/Admin.Core.Tasks/obj/Debug/net6.0/Admin.Core.Tasks.AssemblyInfoInputs.cache +++ b/Admin.Core.Tasks/obj/Debug/net6.0/Admin.Core.Tasks.AssemblyInfoInputs.cache @@ -1 +1 @@ -357d4cf1da9d0baaf00ea24891148cc7f0ef3028d39279eea9f552730b5fa818 +f7fa8a41ec3905813b997136243c860aeed960ff6eeb235d5d9115eb72d57db0 diff --git a/Aucam.Core.PerfusionService/Startup.cs b/Aucam.Core.PerfusionService/Startup.cs index 764e5744..e1427155 100644 --- a/Aucam.Core.PerfusionService/Startup.cs +++ b/Aucam.Core.PerfusionService/Startup.cs @@ -62,7 +62,6 @@ namespace Aucam.Core.PerfusionService //PLC services.AddPlcSetup(); - services.AddAucmaTaskSetup(); //ֱ֧ȫ :֧ System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030") Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); } @@ -84,8 +83,7 @@ namespace Aucam.Core.PerfusionService /// /// public void Configure(IApplicationBuilder app, ISysTasksQzService tasksQzService, - ISchedulerCenter schedulerCenter, IRunPlcService runPlcService, - IAucamTaskService aucamTaskService) + ISchedulerCenter schedulerCenter, IRunPlcService runPlcService) { // ʹþ̬ļ app.UseStaticFiles(); @@ -95,8 +93,6 @@ namespace Aucam.Core.PerfusionService app.UseQuartzJobMildd(tasksQzService, schedulerCenter); //PLC app.UsePlcMildd(runPlcService); - - app.AucmaTaskMildds(aucamTaskService); } #region ע diff --git a/Aucam.Core.PerfusionService/appsettings.json b/Aucam.Core.PerfusionService/appsettings.json index b4e78b26..99778df0 100644 --- a/Aucam.Core.PerfusionService/appsettings.json +++ b/Aucam.Core.PerfusionService/appsettings.json @@ -109,7 +109,7 @@ "TriggerType": 1, "IntervalSecond": 1, "CycleRunTimes": 1, - "IsStart": false, + "IsStart": true, "JobParams": null, "DelFlag": false, "CreateBy": "admin", @@ -165,11 +165,11 @@ "Enabled": true }, "QuartzNetJob": { - "Enabled": false + "Enabled": true }, "AucamTask": { - "Enabled": true + "Enabled": false } }, "PLCServer": [ diff --git a/Aucam.Core.TemperatureService/appsettings.json b/Aucam.Core.TemperatureService/appsettings.json index a52d1a73..a97bd584 100644 --- a/Aucam.Core.TemperatureService/appsettings.json +++ b/Aucam.Core.TemperatureService/appsettings.json @@ -62,7 +62,7 @@ // *** 单库操作,把 MutiDBEnabled 设为false ***; // *** 多库操作,把 MutiDBEnabled 设为true,其他的从库Enabled也为true **; // 具体配置看视频:https://www.bilibili.com/video/BV1BJ411B7mn?p=6 - "MainDB": "AUCMA_SCADA", //当前项目的主库,所对应的连接字符串的Enabled必须为true + "MainDB": "TOPLINE_T10_E_P2_32_AUCMA_HeNan_D_261", //当前项目的主库,所对应的连接字符串的Enabled必须为true "MutiDBEnabled": true, //是否开启多库模式 "CQRSEnabled": false, //是否开启读写分离模式,必须是单库模式,且数据库类型一致,比如都是SqlServer "DBS": [ @@ -85,37 +85,21 @@ "ProviderName": "System.Data.SqlClient" }, { - "ConnId": "Hsdb", + "ConnId": "TOPLINE_T10_E_P2_32_AUCMA_HeNan_D_261", "DBType": 1, "Enabled": true, "HitRate": 40, - "Connection": "Data Source=localhost;Initial Catalog=Hsdb;User ID=sa;Password=sa;", + "Connection": "Data Source=localhost;Initial Catalog=TOPLINE_T10_E_P2_32_AUCMA_HeNan_D_261;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" - } + //{ + // "ConnId": "Hsdb", + // "DBType": 1, + // "Enabled": true, + // "HitRate": 10, + // "Connection": "Data Source=localhost;Initial Catalog=Hsdb;User ID=sa;Password=sa;", + // "ProviderName": "System.Data.SqlClient" + //} ], "Startup": { "Cors": { @@ -144,88 +128,9 @@ "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/Aucma.Core.DoorFoam/Business/MvCodeHelper.cs b/Aucma.Core.DoorFoam/Business/MvCodeHelper.cs index a45c91d6..301da472 100644 --- a/Aucma.Core.DoorFoam/Business/MvCodeHelper.cs +++ b/Aucma.Core.DoorFoam/Business/MvCodeHelper.cs @@ -110,6 +110,7 @@ namespace Aucma.Core.DoorFoam.Business // ch:打印设备信息 | en:Print device info for (Int32 i = 0; i < stDevList.nDeviceNum; i++) { + stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[i], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO)); if (MvCodeReader.MV_CODEREADER_GIGE_DEVICE == stDevInfo.nTLayerType) @@ -141,7 +142,7 @@ namespace Aucma.Core.DoorFoam.Business } // ch:打开设备 | en:Open device - nRet = device.MV_CODEREADER_OpenDevice_NET(); + nRet = device.MV_CODEREADER_OpenDevice_NET(); if (MvCodeReader.MV_CODEREADER_OK != nRet) { Console.WriteLine("Open device failed:{0:x8}", nRet); diff --git a/Aucma.Core.Palletiz/Aucma.Core.Palletiz.csproj b/Aucma.Core.Palletiz/Aucma.Core.Palletiz.csproj index 25cd8cbe..7cd61b2a 100644 --- a/Aucma.Core.Palletiz/Aucma.Core.Palletiz.csproj +++ b/Aucma.Core.Palletiz/Aucma.Core.Palletiz.csproj @@ -77,6 +77,12 @@ + + + ..\dll\MvCodeReaderSDK.Net.dll + + + Code diff --git a/Aucma.Core.Palletiz/Business/InstoreBusiness.cs b/Aucma.Core.Palletiz/Business/InstoreBusiness.cs index 67f77afe..2b5c2967 100644 --- a/Aucma.Core.Palletiz/Business/InstoreBusiness.cs +++ b/Aucma.Core.Palletiz/Business/InstoreBusiness.cs @@ -1,6 +1,8 @@ using Admin.Core.Common; using Admin.Core.IService; using Admin.Core.Model; +using Admin.Core.Model.Model_New; +using Admin.Core.Service; using Aucma.Core.HwPLc; using Aucma.Core.Scanner; using log4net; @@ -9,6 +11,7 @@ using StackExchange.Profiling.Internal; using System; using System.Collections.Generic; using System.Linq; +using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; @@ -32,9 +35,11 @@ namespace Aucma.Core.Palletiz.Business #region 初始化对象 private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(InstoreBusiness)); - private readonly IBaseSpaceInfoServices? _baseSpaceInfoServices; - private readonly ICodeBindingRecordServices? _codeBindingServices; - private readonly IRecordInStoreServices? _recordInstoreServices; + private readonly IBaseSpaceInfoServices _baseSpaceInfoServices; + private readonly ICodeBindingRecordServices _codeBindingServices; + private readonly IOffLineInfoServices _offLineInfoServices; + private readonly IRecordInStoreServices _recordInstoreServices; + private readonly IBaseOrderInfoServices _baseOrderInfoServices; #endregion #region 构造函数 @@ -43,7 +48,9 @@ namespace Aucma.Core.Palletiz.Business _baseSpaceInfoServices = App.ServiceProvider.GetService(); _codeBindingServices = App.ServiceProvider.GetService(); _recordInstoreServices = App.ServiceProvider.GetService(); - MvCodeHelper.HandlePalletizDelegateEvent += ScannerInStore;//注册扫码器扫码后业务处理事件 + _offLineInfoServices = App.ServiceProvider.GetService(); + _baseOrderInfoServices = App.ServiceProvider.GetService(); + MvCodeHelper.RefreshPalletizDelegateEvent += ScannerInStore;//注册扫码器扫码后业务处理事件 } #endregion @@ -85,7 +92,7 @@ namespace Aucma.Core.Palletiz.Business Task.Run(async () => { Thread.Sleep(3000); - await InStore("16160030000000910999", "192.168.1.19"); + await InStore("15100P000009E360795", "10.10.92.230"); }); } #endregion @@ -130,51 +137,52 @@ namespace Aucma.Core.Palletiz.Business Console.WriteLine($"上位机获取配置的扫码器【IP:{model.ToJson()}》名称:{model.Name}】"); LogInStoreInfoDelegateEvent?.Invoke($"上位机获取配置的扫码器【IP:{model.ToJson()}》名称:{model.Name}】","White"); //1.根据成品码找货道 - List? spaceList = GetSpaceBySNCode(SNCode, recordInstore); - Console.WriteLine($"上位机获取配置的货道数量【{spaceList.Count}】"); - - // 根据货道信息判断下发plc信号 + List spaceList = GetSpaceBySNCode2(SNCode, recordInstore);//2024 + if (spaceList == null || spaceList.Count == 0) { logHelper.Error("未找到匹配货道,请手动入库!"); - // 刷新页面提示信息 Console.WriteLine("未找到匹配货道,请手动入库!"); - LogInStoreInfoDelegateEvent?.Invoke("未找到匹配货道,请手动入库!", "White"); + // 刷新页面提示信息 + LogInStoreInfoDelegateEvent?.Invoke("未找到匹配货道,请手动入库!", "Red"); + return; } + Console.WriteLine($"上位机获取配置的货道数量【{spaceList.Count}】"); // 过滤货道,找到最终需要下发的货道 BaseSpaceInfo finalSpace = FilterSpace(spaceList); Console.WriteLine($"上位机获取需要下发的货道【货道名称:{finalSpace.SpaceName}》货道库存:{finalSpace.SpaceStock}》货道状态:{finalSpace.SpaceStatus}》货道类型:{finalSpace.SpaceType}》所属仓库:{finalSpace.StoreCode}】"); - LogInStoreInfoDelegateEvent?.Invoke($"是否为大产品:【{finalSpace.IsTwoSpace}】", "White"); - Console.WriteLine($"是否为大产品:【{finalSpace.IsTwoSpace}】"); + //LogInStoreInfoDelegateEvent?.Invoke($"是否为大产品:【{finalSpace.IsTwoSpace}】", "White"); + //Console.WriteLine($"是否为大产品:【{finalSpace.IsTwoSpace}】"); LogInStoreInfoDelegateEvent?.Invoke($"下发的货道:【货道名称:{finalSpace.SpaceName}", "White"); // 大产品占两道 - if (finalSpace.IsTwoSpace == 1) - { - spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3))); - spaceNumList.Add(int.Parse(GetOtherSpace(finalSpace, spaceList).SpaceCode.Substring(5, 3))); - plcResult = SendAndAnswerPlc(scannerIp, spaceList[0].RotationRange, spaceNumList); - recordInstore.SpaceCode = finalSpace.SpaceCode; - recordInstore.StoreCode = finalSpace.StoreCode; - // 更新货道信息,大产品last存objId大的,储存上一个货道的主键 如货道7,8存8 - BaseSpaceInfo otherSpace = GetOtherSpace(finalSpace, spaceList); - Console.WriteLine($"大产品入库信息:【{finalSpace.ToJson()}】【{spaceList.ToJson()}】"); - if (otherSpace != null) - { - UpdateSapceList(otherSpace.ObjId, spaceList); - Console.WriteLine("更新货道信息成功!"); - LogInStoreInfoDelegateEvent?.Invoke("更新货道信息成功!", "White"); - } - } - else + //if (finalSpace.IsTwoSpace == 1) + //{ + // spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3))); + // spaceNumList.Add(int.Parse(GetOtherSpace(finalSpace, spaceList).SpaceCode.Substring(5, 3))); + // plcResult = SendAndAnswerPlc(scannerIp, spaceList[0].RotationRange, 1); + // recordInstore.SpaceCode = finalSpace.SpaceCode; + // recordInstore.StoreCode = finalSpace.StoreCode; + // // 更新货道信息,大产品last存objId大的,储存上一个货道的主键 如货道7,8存8 + // BaseSpaceInfo otherSpace = GetOtherSpace(finalSpace, spaceList); + // Console.WriteLine($"大产品入库信息:【{finalSpace.ToJson()}】【{spaceList.ToJson()}】"); + // if (otherSpace != null) + // { + // UpdateSapceList(otherSpace.ObjId, spaceList); + // Console.WriteLine("更新货道信息成功!"); + // LogInStoreInfoDelegateEvent?.Invoke("更新货道信息成功!", "White"); + // } + //} + //else { // last不等于自己,可以先入自己,否则入另一条货道 if (IsOddNumber(finalSpace)) { spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3))); spaceNumList.Add(0); - plcResult = SendAndAnswerPlc(scannerIp, finalSpace.RotationRange, spaceNumList); - UpdateSapceList(finalSpace.ObjId, spaceList); + int space =Convert.ToInt32(finalSpace.SpaceCode.Substring(finalSpace.SpaceCode.Length - 3, 3)); + plcResult = SendAndAnswerPlc(scannerIp, finalSpace.RotationRange, space); + UpdateSapceList(finalSpace.ObjId, finalSpace); Console.WriteLine("更新货道信息成功!"); LogInStoreInfoDelegateEvent?.Invoke("更新货道信息成功!", "White"); } @@ -182,8 +190,9 @@ namespace Aucma.Core.Palletiz.Business { spaceNumList.Add(0); spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3))); - plcResult = SendAndAnswerPlc(scannerIp, finalSpace.RotationRange, spaceNumList);//给PLC下传入库信号 - UpdateSapceList(finalSpace.ObjId, spaceList); + int space = Convert.ToInt32(finalSpace.SpaceCode.Substring(finalSpace.SpaceCode.Length - 3, 3)); + plcResult = SendAndAnswerPlc(scannerIp, finalSpace.RotationRange, space);//给PLC下传入库信号 + UpdateSapceList(finalSpace.ObjId, finalSpace); Console.WriteLine("更新货道信息成功!"); LogInStoreInfoDelegateEvent?.Invoke("更新货道信息成功!", "White"); } @@ -224,13 +233,18 @@ namespace Aucma.Core.Palletiz.Business /// /// /// - private List? GetSpaceBySNCode(string SNCode, RecordInStore recordInstore) + private List GetSpaceBySNCode(string SNCode, RecordInStore recordInstore) { try { CodeBindingRecord bindingRecord = _codeBindingServices.FirstAsync(c => c.ProductCode.Equals(SNCode)).Result; - if (bindingRecord == null) return null; + if (bindingRecord == null) + { + Console.WriteLine("成品下线库未有此成品下线记录!"); + LogInStoreInfoDelegateEvent?.Invoke("成品下线库未有此成品下线记录!qin", "Red"); + return null; + } recordInstore.BarCodeCode = bindingRecord.BoxCode; recordInstore.MaterialCode = bindingRecord.BoxCode; @@ -246,6 +260,8 @@ namespace Aucma.Core.Palletiz.Business } catch (Exception ex) { + Console.WriteLine("成品下线库未有此成品下线记录!"); + LogInStoreInfoDelegateEvent?.Invoke("成品下线库未有此成品下线记录!qin", "Red"); logHelper.Error(ex.Message.ToString()); Console.WriteLine(ex.Message.ToString()); @@ -253,25 +269,62 @@ namespace Aucma.Core.Palletiz.Business } } - #endregion - - private BaseSpaceInfo FilterSpace(List spaceInfos) + /// + /// 根据成品码找货道_临时 2024-03-11 + /// + /// + /// + private List GetSpaceBySNCode2(string SNCode, RecordInStore recordInstore) { - BaseSpaceInfo spaceInfo = spaceInfos.First(); - - if (spaceInfos.Count == 1 || string.IsNullOrEmpty(spaceInfo.LastSpace)) + try { - return spaceInfo; + OffLineInfo record = _offLineInfoServices.FirstAsync(c => c.ProductSNCode.Equals(SNCode)).Result; + + if (record == null) + { + Console.WriteLine("成品下线库未有此成品下线记录!"); + + return null; + } + Console.WriteLine(record.ProductOrderNo); + BaseOrderInfo baseOrderInfo =_baseOrderInfoServices.FirstAsync(d=>"0000"+d.OrderCode== record.ProductOrderNo).Result ; + + recordInstore.BarCodeCode = record.BoxCode; + recordInstore.MaterialCode = baseOrderInfo.MaterialCode; + recordInstore.MaterialType = baseOrderInfo.MaterialCode; + recordInstore.MaterialName = baseOrderInfo.MaterialName; + string mType = baseOrderInfo.MaterialCode; + List bsInfo = _baseSpaceInfoServices.Query(s => (s.MaterialType.Equals(mType) && (s.StoreCode.Equals(storeCodeA)))); + + if (bsInfo.Count > 0) + return bsInfo.OrderBy(x => x.ObjId).ToList(); + else + return null; } - List spaceList = spaceInfos.Where(s => s.ObjId > int.Parse(spaceInfo.LastSpace)).ToList(); - if (spaceList == null || spaceList.Count == 0) + catch (Exception ex) { - return spaceInfo; + Console.WriteLine("成品下线库未有此成品下线记录!"); + //LogInStoreInfoDelegateEvent?.Invoke("成品下线库查询成品下线记录异常!请联系当班负责人处理", "Red"); + logHelper.Error(ex.Message.ToString()); + + Console.WriteLine($"成品下线库未有此成品下线记录!{ex.Message.ToString()}"); + return null; } - else + } + + #endregion + + private BaseSpaceInfo FilterSpace(List spaceInfos) + { + if (spaceInfos == null|| spaceInfos.Count==0) return null; + List baseSpaceInfoList = spaceInfos.OrderBy(d => d.UpdatedTime).ToList(); + BaseSpaceInfo spaceInfo = baseSpaceInfoList.First(); + + if (spaceInfo!=null || string.IsNullOrEmpty(spaceInfo.LastSpace)) { return spaceInfo; } + return null; } /// @@ -336,12 +389,16 @@ namespace Aucma.Core.Palletiz.Business /// /// /// - private bool UpdateSapceList(int objId, List spaceList) + private bool UpdateSapceList(int objId, BaseSpaceInfo spaceList) { - foreach (BaseSpaceInfo space in spaceList) - { - space.LastSpace = objId.ToString(); - } + //foreach (BaseSpaceInfo space in spaceList) + //{ + // space.LastSpace = objId.ToString(); + // space.UpdatedTime =DateTime.Now; + //} + + spaceList.LastSpace = objId.ToString(); + spaceList.UpdatedTime = DateTime.Now; return _baseSpaceInfoServices.UpdateAsync(spaceList).Result; } #endregion @@ -354,19 +411,19 @@ namespace Aucma.Core.Palletiz.Business /// /// 扫码器ip /// 转向角度 - /// 货道号int集合 + /// 货道号 /// - private bool SendAndAnswerPlc(string scannerIp, int range, List spaceNum) + private bool SendAndAnswerPlc(string scannerIp, int range,int spaceNum) { bool result = false; try { PlcModel obj = GetPlcByScanner(scannerIp); - if (obj != null) + if (obj != null&& obj.plc.IsConnected) { if (SendPlc(obj, range, spaceNum)) { - result = WaitAnswerPlc(obj); + return true; } } else @@ -391,37 +448,65 @@ namespace Aucma.Core.Palletiz.Business /// 下发plc信号 /// /// - /// - /// + /// 转向 + /// 库数量 /// - private bool SendPlc(PlcModel obj, int range, List spaceNum) + private bool SendPlc(PlcModel obj, int range,int spaceNum) { try { bool result = false; DateTime targetTime = DateTime.Now.AddSeconds(8); - while (true) + int i= 0; + while (i<3) { - if (DateTime.Now > targetTime) // plc超最大时限无反馈 + if (obj.plc.IsConnected) { - logHelper.Error("等待plc放行反馈信号超时"); - Console.WriteLine("等待plc放行反馈信号超时"); - return false; + Console.WriteLine($"是否可以下发:【{obj.plc.ReadBool("B1000")}】"); + if (obj.plc.ReadBool("B1000"))//如果为true 则可以下发 任务 + { + // 应答字允许下发 + int storeNum = GetStoreNum(obj, spaceNum); + Console.WriteLine($"读取当前货道数量:【{storeNum}】"); + //if (storeNum == 1) + { + //obj.plc.WriteInt16("D7010", range.ToString());//旋转角度1=》90 2=>反转90 D2 1正转 2反转 + //obj.plc.WriteInt16("D29", spaceNum.ToString()); //货道号 + //obj.plc.WriteInt16("B1001", "1");//发送完成信号 + + obj.plc.WriteInt16("D29", spaceNum.ToString());//货道号 + if (range==0) + { + range = 3; + } + if (range == 90) + { + range = 1; + } + if (range == -90) + { + range = 2; + } + if (range == -180) + { + range = 4; + } + obj.plc.WriteInt16("D2", range.ToString());//角度 1正转90 2反转90 3不转 4 反转180 + obj.plc.WriteInt16("B1001", "1");//发送完成信号 + Console.WriteLine($"plc信号货道信号下发成功!【货道号:{spaceNum}"); + result = true; + break; + } + } } - // 应答字允许下发 - Console.WriteLine($"读取应答字是否下传成功!【{obj.plc.ReadInt32("D102")}】"); - if (obj.plc.ReadInt32("D102") == 1) + else { - //obj.plc.WriteInt32("D110", range);//旋转角度暂时不赋值由PLC转向 - - obj.plc.WriteInt32("D112", spaceNum[0]); //货道号 - obj.plc.WriteInt32("D114", spaceNum[1]); //货道号 - Console.WriteLine($"plc信号货道信号下发成功!【D112:{spaceNum[0]}】D114:{spaceNum[1]}"); - result = true; - break; + Console.WriteLine($"plc未连接"); } - Thread.Sleep(500); + + Thread.Sleep(100); + i++; } return result; } @@ -432,6 +517,58 @@ namespace Aucma.Core.Palletiz.Business } } + public int GetStoreNum(PlcModel obj, int spaceNum) + { + int storeNum = 0; + switch (spaceNum) + { + case 1: + storeNum = obj.plc.ReadInt16("D1001"); + break; + case 2: + storeNum = obj.plc.ReadInt16("D1002"); + break; + case 3: + storeNum = obj.plc.ReadInt16("D1003"); + break; + case 4: + storeNum = obj.plc.ReadInt16("D1004"); + break; + case 5: + storeNum = obj.plc.ReadInt16("D1005"); + break; + case 6: + storeNum = obj.plc.ReadInt16("D1006"); + break; + case 7: + storeNum = obj.plc.ReadInt16("D1007"); + break; + case 8: + storeNum = obj.plc.ReadInt16("D1008"); + break; + case 9: + storeNum = obj.plc.ReadInt16("D1009"); + break; + case 10: + storeNum = obj.plc.ReadInt16("D1010"); + break; + case 11: + storeNum = obj.plc.ReadInt16("D1011"); + break; + case 12: + storeNum = obj.plc.ReadInt16("D1012"); + break; + case 13: + storeNum = obj.plc.ReadInt16("D1013"); + break; + case 14: + storeNum = obj.plc.ReadInt16("D1014"); + break; + default: + break; + } + return storeNum; + } #endregion #region 等待plc信号反馈 @@ -482,23 +619,24 @@ namespace Aucma.Core.Palletiz.Business /// private PlcModel GetPlcByScanner(string scannerIp) { - PlcModel obj = null; - ScannerModel model = allScanners.FirstOrDefault(x => x.Ip == scannerIp); - if (model.Id < 3) - { - obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreAPlc")); - } - else - { - obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreBPlc")); - } + //PlcModel obj = null; + //ScannerModel model = allScanners.FirstOrDefault(x => x.Ip == scannerIp); + //if (model.Id < 3) + //{ + // obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreAPlc")); + //} + //else + //{ + // obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreBPlc")); + //} + PlcModel obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreAPlc")); return obj; } #endregion #endregion - #region 手动写入货道号给PLC数据 + #region 写入货道号给PLC数据 /// /// 手动写入PLC数据 /// @@ -513,7 +651,6 @@ namespace Aucma.Core.Palletiz.Business if (tempStackInfo.IsLargeProducts) { obj.plc.WriteInt16("D7000", tempStackInfo.BinNo.ToString());//写入货道 - obj.plc.WriteInt16("D7100", tempStackInfo.BinNo.ToString());//写入货道 } else { @@ -545,32 +682,159 @@ namespace Aucma.Core.Palletiz.Business } #endregion } while (flagA); + return true; + } + else + { + LogInStoreInfoDelegateEvent?.Invoke("PLC未连接!", "Red"); + return false; } //更新货道 - return false; } - private static void GetResposeB() + + #endregion + + #region 人工操作入库 + /// + /// 临时写入入库 + /// + /// 货道号 + /// 转向: 1正转 2反转,3不转 + /// + public static bool TempWritePlc(int freightLaneNumber, int range) { - var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStorePlc")); - //写入PLC - if (obj.plc.IsConnected) + try { + var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreAPlc")); + //写入PLC + bool flag = true; do { - - #region 2号区域码垛——B - int responseWord2 = obj.plc.ReadInt16("D7120");//读取1号区域码垛 等待应答字回去 - Console.WriteLine("手动写入PLC成功!"); - if (responseWord2 == 2) + if (obj == null) { - obj.plc.WriteInt16("D7000", "0");//清空 + return false; } - #endregion + if (obj.plc.IsConnected) + { + bool isDown = false; + int i = 0; + do + { + isDown = obj.plc.ReadBool("B1000"); + if (isDown) + { + Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown}"); + LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 当前下发信号为:{isDown}", "White"); + break; + } + else + { + Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown},不可以下发"); + LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 当前下发信号为:{isDown}", "Red"); + } + Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown}"); + Thread.Sleep(1000); + i++; + } while (i < 3); + if (isDown == false) + { + Console.WriteLine($"[{DateTime.Now}] 下发失败,当前下发信号为:{isDown},请稍等后重试!"); + LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 下发失败,当前下发信号为:{isDown},请稍等后重试!", "Red"); + return false; + } + LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 开始下发PLC》货道号:{freightLaneNumber}》角度(1正转 2反转 3不转):{range}", "Red"); + Console.WriteLine($"[{DateTime.Now}] 开始下发PLC》货道号:{freightLaneNumber}》角度(1正转 2反转 3不转):{range}"); + if (isDown) + { + obj.plc.WriteInt16("D29", freightLaneNumber.ToString());//货道号 + obj.plc.WriteInt16("D2", range.ToString());//角度 1正转90 2反转90 3不转 4 反转180 + obj.plc.WriteInt16("B1001", "1");//发送完成信号 + Console.WriteLine($"[{DateTime.Now}] 下发PLC成功"); + LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 下发PLC成功", "Red"); + //将手动信息保存到库中,设置000000000未手动设置的成品码 + + Thread.Sleep(1000); + isDown = obj.plc.ReadBool("B1000"); + if (isDown) + { + Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown}"); + } + else + { + Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown}"); + } + return true; + } + flag = false; + } + else + { + flag = true; + } + } while (flag); + return true; + } + catch (Exception ex) + { + Console.WriteLine($"[{DateTime.Now}] 手动下发任务异常:{ex.Message}"); + LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 手动下发任务异常:{ex.Message}", "Red"); + return false; + } + } + #endregion - } while (flagA); + public bool WriteIF(PlcModel obj, string space) + { + bool flag = true; + switch (space) + { + case "FD01_001": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_002": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_003": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_004": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_005": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_006": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_007": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_008": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_009": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_010": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_011": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_012": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_013": + flag = obj.plc.ReadBool("D1001"); + break; + case "FD01_014": + flag = obj.plc.ReadBool("D1001"); + break; + default: + break; } + return flag; } - #endregion } } \ No newline at end of file diff --git a/Aucma.Core.Palletiz/Business/MvCodeHelper.cs b/Aucma.Core.Palletiz/Business/MvCodeHelper.cs new file mode 100644 index 00000000..569f683b --- /dev/null +++ b/Aucma.Core.Palletiz/Business/MvCodeHelper.cs @@ -0,0 +1,726 @@ +using Admin.Core.Common; +using Aucma.Core.Scanner; +using log4net; +using MvCodeReaderSDKNet; +using NPOI.SS.Formula.Functions; +using StackExchange.Profiling; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using UAParser; + +namespace Aucma.Core.Palletiz.Business +{ + public class MvCodeHelper + { + + //private static AppConfig appConfig = AppConfig.Instance; + public static bool m_bGrabbing = true; + private static string lastCode; + private static List allScanners = Appsettings.app("ScannerServer").ToList(); + // 10.10.92.230扫码器ip + private static string LinerScannerIp = allScanners.First(x => x.Name == "PalletizStoreCodeA").Ip; + // 10.10.92.231扫码器ip + private static string ShellScannerIp = allScanners.First(x => x.Name == "APalletizStoreCodeB2").Ip; + + private static readonly log4net.ILog log = LogManager.GetLogger(typeof(MvCodeHelper)); + + + #region 全局变量定义 + public static MvCodeReader ShellDevice = null; + public static MvCodeReader LinerDevice = null; + public static DateTime ShellLiveTime = DateTime.Now; + public static DateTime LinerLiveTime = DateTime.Now; + #endregion + + #region 委托事件 + + /// + /// 成品入库委托 + /// + /// + /// + public delegate void RefreshPalletizDelegate(string materialCodeStr, string ip); + public static event RefreshPalletizDelegate RefreshPalletizDelegateEvent; + + /// + /// 刷新扫码器状态 + /// + /// + /// + public delegate void RefreshState(string ip,bool flag); + public static event RefreshState RefreshStateEvent; + + + /// + /// 日志信息刷新 + /// + /// + public delegate void RefreshLogMessage(string message); + public static event RefreshLogMessage RefreshLogMessageEvent; + #endregion + + #region +ShellImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser) + + public static void ShellImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser) + { + var stFrameInfo = (MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)Marshal.PtrToStructure(pstFrameInfoEx2, typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)); + + MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2 stBcrResult = (MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)Marshal.PtrToStructure(stFrameInfo.UnparsedBcrList.pstCodeListEx2, typeof(MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)); + + // Console.WriteLine("CodeNum[" + Convert.ToString(stBcrResult.nCodeNum) + "]"); + if (stBcrResult.nCodeNum == 0) + { + Console.WriteLine(DateTime.Now + ":外侧--->No Read 处理"); + log.Info(DateTime.Now + ":外侧--->No Read 处理"); + //更新扫码器存活时间 + ShellLiveTime = DateTime.Now; + } + for (Int32 i = 0; i < stBcrResult.nCodeNum; i++) + { + bool bIsValidUTF8 = IsTextUTF8(stBcrResult.stBcrInfoEx2[i].chCode); + if (bIsValidUTF8) + { + string strCode = Encoding.UTF8.GetString(stBcrResult.stBcrInfoEx2[i].chCode); + Console.WriteLine(DateTime.Now + ":Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]"); + + } + else + { + string strCode = Encoding.GetEncoding("GB2312").GetString(stBcrResult.stBcrInfoEx2[i].chCode); + Console.WriteLine(DateTime.Now + ":外侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]"); + log.Info(DateTime.Now + ":外侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]"); + // RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), ShellScannerIp); + if (strCode.Trim().TrimEnd('\0').Length == 20) + { + //更新扫码器存活时间 + ShellLiveTime = DateTime.Now; + //RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), ShellScannerIp); + // 业务处理 + Console.WriteLine(strCode.Trim().TrimEnd('\0'), ShellScannerIp); + } + else + { + // 更新存活时间 + LinerLiveTime = DateTime.Now; + Console.WriteLine(DateTime.Now + ":外侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20,当做No Read 处理"); + log.Info(DateTime.Now + ":外侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20,当做No Read 处理"); + } + + } + } + + MvCodeReader.MV_CODEREADER_OCR_INFO_LIST stOcrInfo = (MvCodeReader.MV_CODEREADER_OCR_INFO_LIST)Marshal.PtrToStructure(stFrameInfo.UnparsedOcrList.pstOcrList, typeof(MvCodeReader.MV_CODEREADER_OCR_INFO_LIST)); + + for (int i = 0; i < stOcrInfo.nOCRAllNum; i++) + { + string strOcrCharCode = Encoding.UTF8.GetString(stOcrInfo.stOcrRowInfo[i].chOcr); + // Console.WriteLine("Get OcrInfo:" + "ocrNum[" + i.ToString() + "], ocrLen[" + Convert.ToString(stOcrInfo.stOcrRowInfo[i].nOcrLen) + "], ocrChar[" + strOcrCharCode.Trim().TrimEnd('\0') + "]"); + } + } + + + #endregion + + #region + LinerImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser) + + public static void LinerImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser) + { + var stFrameInfo = (MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)Marshal.PtrToStructure(pstFrameInfoEx2, typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)); + + MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2 stBcrResult = (MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)Marshal.PtrToStructure(stFrameInfo.UnparsedBcrList.pstCodeListEx2, typeof(MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)); + + // Console.WriteLine("CodeNum[" + Convert.ToString(stBcrResult.nCodeNum) + "]"); + if (stBcrResult.nCodeNum == 0) + { + Console.WriteLine(DateTime.Now + ":内侧--->No Read 处理"); + log.Info(DateTime.Now + ":内侧--->No Read 处理"); + // 更新存活时间 + LinerLiveTime = DateTime.Now; + } + for (Int32 i = 0; i < stBcrResult.nCodeNum; i++) + { + bool bIsValidUTF8 = IsTextUTF8(stBcrResult.stBcrInfoEx2[i].chCode); + if (bIsValidUTF8) + { + string strCode = Encoding.UTF8.GetString(stBcrResult.stBcrInfoEx2[i].chCode); + Console.WriteLine(DateTime.Now + ":Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]"); + } + else + { + string strCode = Encoding.GetEncoding("GB2312").GetString(stBcrResult.stBcrInfoEx2[i].chCode); + Console.WriteLine(DateTime.Now + ":内侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]"); + log.Info(DateTime.Now + ":内侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]"); + // RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), LinerScannerIp); + if (strCode.Trim().TrimEnd('\0').Length == 20) + { + // 更新存活时间 + LinerLiveTime = DateTime.Now; + // 业务处理 + RefreshPalletizDelegateEvent?.Invoke(strCode.Trim().TrimEnd('\0'), LinerScannerIp); + //Console.WriteLine(strCode.Trim().TrimEnd('\0'), ShellScannerIp); + } + else + { + // 更新存活时间 + LinerLiveTime = DateTime.Now; + Console.WriteLine(DateTime.Now + "内侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20,当做No Read 处理"); + log.Info(DateTime.Now + "内侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20,当做No Read 处理"); + } + + } + } + + MvCodeReader.MV_CODEREADER_OCR_INFO_LIST stOcrInfo = (MvCodeReader.MV_CODEREADER_OCR_INFO_LIST)Marshal.PtrToStructure(stFrameInfo.UnparsedOcrList.pstOcrList, typeof(MvCodeReader.MV_CODEREADER_OCR_INFO_LIST)); + + Console.WriteLine("ocrAllNum[" + Convert.ToString(stOcrInfo.nOCRAllNum) + "]"); + for (int i = 0; i < stOcrInfo.nOCRAllNum; i++) + { + string strOcrCharCode = Encoding.UTF8.GetString(stOcrInfo.stOcrRowInfo[i].chOcr); + Console.WriteLine("Get OcrInfo:" + "ocrNum[" + i.ToString() + "], ocrLen[" + Convert.ToString(stOcrInfo.stOcrRowInfo[i].nOcrLen) + "], ocrChar[" + strOcrCharCode.Trim().TrimEnd('\0') + "]"); + } + } + + #endregion + + #region Shell() + public static void Shell() + { + ShellLiveTime = DateTime.Now; + MvCodeReader.cbOutputEx2delegate ImageCallback; + + MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2 stFrameInfo = new MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2(); + MvCodeReader device = new MvCodeReader(); + int nRet = MvCodeReader.MV_CODEREADER_OK; + + do + { + // ch:枚举设备 | en:Enum device + MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST stDevList = new MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST(); + nRet = MvCodeReader.MV_CODEREADER_EnumDevices_NET(ref stDevList, MvCodeReader.MV_CODEREADER_GIGE_DEVICE); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + // 刷新扫码器状态 + //RefreshStateEvent?.Invoke("外侧", false); + + //RefreshStateEvent?.Invoke("内侧", false); + Thread.Sleep(1000 * 10); + Console.WriteLine("Enum device failed:{0:x8}", nRet); + break; + } + Console.WriteLine("Enum device count : " + Convert.ToString(stDevList.nDeviceNum)); + if (0 == stDevList.nDeviceNum) + { + // 刷新扫码器状态 + //RefreshStateEvent?.Invoke("外侧", false); + + //RefreshStateEvent?.Invoke("内侧", false); + Thread.Sleep(1000 * 10); + + break; + } + + MvCodeReader.MV_CODEREADER_DEVICE_INFO stDevInfo; // 通用设备信息 + int nDevIndex = -1; + // ch:打印设备信息 | en:Print device info + for (Int32 i = 0; i < stDevList.nDeviceNum; i++) + { + stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[i], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO)); + + if (MvCodeReader.MV_CODEREADER_GIGE_DEVICE == stDevInfo.nTLayerType) + { + MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO stGigEDeviceInfo = (MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO)MvCodeReader.ByteToStruct(stDevInfo.SpecialInfo.stGigEInfo, typeof(MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO)); + uint nIp1 = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24); + uint nIp2 = ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16); + uint nIp3 = ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8); + uint nIp4 = (stGigEDeviceInfo.nCurrentIp & 0x000000ff); + // Console.WriteLine("\n" + i.ToString() + ": [GigE] User Define Name : " + stGigEDeviceInfo.chUserDefinedName); + // Console.WriteLine("device IP :" + nIp1 + "." + nIp2 + "." + nIp3 + "." + nIp4); + string ipStr = nIp1 + "." + nIp2 + "." + nIp3 + "." + nIp4; + if (ipStr == ShellScannerIp) + { + nDevIndex = i; + Console.WriteLine("device IP :" + ipStr); + + } + } + } + if (nDevIndex < 0) + { + Console.WriteLine("未找到外侧扫码器"); + // 刷新扫码器状态 + //RefreshStateEvent?.Invoke("外侧", false); + Thread.Sleep(1000 * 30); + break; + } + stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[nDevIndex], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO)); + + // ch:创建设备 | en:Create device + nRet = device.MV_CODEREADER_CreateHandle_NET(ref stDevInfo); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Create device failed:{0:x8}", nRet); + // 刷新扫码器状态 + RefreshStateEvent?.Invoke("外侧", false); + break; + } + + // ch:打开设备 | en:Open device + nRet = device.MV_CODEREADER_OpenDevice_NET(); + + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Open device failed:{0:x8}", nRet); + // 刷新扫码器状态 + //RefreshStateEvent?.Invoke("外侧", false); + break; + } + + // 刷新扫码器状态 + RefreshStateEvent?.Invoke("外侧", true); + // ch:注册回调函数 | en:Register image callback + ImageCallback = new MvCodeReader.cbOutputEx2delegate(ShellImageCallbackFunc); + nRet = device.MV_CODEREADER_RegisterImageCallBackEx2_NET(ImageCallback, IntPtr.Zero); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Register image callback failed!"); + // 刷新扫码器状态 + //RefreshStateEvent?.Invoke("外侧", false); + break; + } + + // ch:开启抓图 || en: start grab image + nRet = device.MV_CODEREADER_StartGrabbing_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Start grabbing failed:{0:x8}", nRet); + // 刷新扫码器状态 + RefreshStateEvent?.Invoke("外侧", false); + break; + } + + // 关闭使用 + ShellDevice = device; + Console.WriteLine("Press enter to exit"); + Console.WriteLine(DateTime.Now.ToString()); + while (true) + { + Thread.Sleep(1000 * 60); + DateTime dateTime = DateTime.Now; + TimeSpan timeSpan = dateTime.Subtract(ShellLiveTime); + if (timeSpan.TotalMinutes >= 10) + { + Console.WriteLine("外侧扫码器超时"); + //CloseShell(); + //Shell(); + break; + } + + } + // Console.ReadLine(); + // 刷新扫码器状态 + //RefreshStateEvent?.Invoke("外侧", false); + // ch:停止抓图 | en:Stop grabbing + nRet = device.MV_CODEREADER_StopGrabbing_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Stop grabbing failed{0:x8}", nRet); + break; + } + + // ch:关闭设备 | en:Close device + nRet = device.MV_CODEREADER_CloseDevice_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Close device failed{0:x8}", nRet); + break; + } + + // ch:销毁设备 | en:Destroy device + nRet = device.MV_CODEREADER_DestroyHandle_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Destroy device failed:{0:x8}", nRet); + break; + } + } while (false); + Shell(); + //if (MvCodeReader.MV_CODEREADER_OK != nRet) + //{ + // // ch:销毁设备 | en:Destroy device + // nRet = device.MV_CODEREADER_DestroyHandle_NET(); + // if (MvCodeReader.MV_CODEREADER_OK != nRet) + // { + // Console.WriteLine("Destroy device failed:{0:x8}", nRet); + // } + //} + + } + + #endregion + + #region Liner() + public static void Liner() + { + LinerLiveTime = DateTime.Now; + MvCodeReader.cbOutputEx2delegate ImageCallback; + + MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2 stFrameInfo = new MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2(); + MvCodeReader device = new MvCodeReader(); + int nRet = MvCodeReader.MV_CODEREADER_OK; + + do + { + // ch:枚举设备 | en:Enum device + MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST stDevList = new MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST(); + nRet = MvCodeReader.MV_CODEREADER_EnumDevices_NET(ref stDevList, MvCodeReader.MV_CODEREADER_GIGE_DEVICE); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + // 刷新扫码器状态 + RefreshStateEvent?.Invoke("外侧", false); + + RefreshStateEvent?.Invoke("内侧", false); + Thread.Sleep(1000 * 10); + Console.WriteLine("Enum device failed:{0:x8}", nRet); + break; + } + Console.WriteLine("Enum device count : " + Convert.ToString(stDevList.nDeviceNum)); + if (0 == stDevList.nDeviceNum) + { + // 刷新扫码器状态 + RefreshStateEvent?.Invoke("外侧", false); + + RefreshStateEvent?.Invoke("内侧", false); + Thread.Sleep(1000 * 10); + break; + } + + MvCodeReader.MV_CODEREADER_DEVICE_INFO stDevInfo; // 通用设备信息 + Int32 nDevIndex = -1; + // ch:打印设备信息 | en:Print device info + for (Int32 i = 0; i < stDevList.nDeviceNum; i++) + { + stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[i], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO)); + + if (MvCodeReader.MV_CODEREADER_GIGE_DEVICE == stDevInfo.nTLayerType) + { + MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO stGigEDeviceInfo = (MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO)MvCodeReader.ByteToStruct(stDevInfo.SpecialInfo.stGigEInfo, typeof(MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO)); + uint nIp1 = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24); + uint nIp2 = ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16); + uint nIp3 = ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8); + uint nIp4 = (stGigEDeviceInfo.nCurrentIp & 0x000000ff); + // Console.WriteLine("\n" + i.ToString() + ": [GigE] User Define Name : " + stGigEDeviceInfo.chUserDefinedName); + string ip = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8) + "." + (stGigEDeviceInfo.nCurrentIp & 0x000000ff); + string ipStr = nIp1 + "." + nIp2 + "." + nIp3 + "." + nIp4; + if (ipStr == LinerScannerIp) + { + Console.WriteLine("device IP :" + ipStr); + nDevIndex = i; + } + } + } + if (nDevIndex < 0) + { + Console.WriteLine("未找到10.10.92.230扫码器"); + // 刷新扫码器状态 + //RefreshStateEvent?.Invoke("内侧", false); + Thread.Sleep(1000 * 30); + break; + } + + stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[nDevIndex], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO)); + + // ch:创建设备 | en:Create device + nRet = device.MV_CODEREADER_CreateHandle_NET(ref stDevInfo); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Create device failed:{0:x8}", nRet); + break; + } + + // ch:打开设备 | en:Open device + nRet = device.MV_CODEREADER_OpenDevice_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Open device failed:{0:x8}", nRet); + // 刷新扫码器状态 + RefreshStateEvent?.Invoke("外侧", false); + break; + } + // 刷新扫码器状态 + //RefreshStateEvent?.Invoke("内侧", true); + + // ch:注册回调函数 | en:Register image callback + ImageCallback = new MvCodeReader.cbOutputEx2delegate(LinerImageCallbackFunc); + nRet = device.MV_CODEREADER_RegisterImageCallBackEx2_NET(ImageCallback, IntPtr.Zero); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Register image callback failed!"); + break; + } + + // ch:开启抓图 || en: start grab image + nRet = device.MV_CODEREADER_StartGrabbing_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Start grabbing failed:{0:x8}", nRet); + break; + } + // 关闭使用 + ShellDevice = device; + + Console.WriteLine("Press enter to exit"); + Console.WriteLine(DateTime.Now.ToString()); + while (true) + { + Thread.Sleep(1000 * 60); + DateTime dateTime = DateTime.Now; + TimeSpan timeSpan = dateTime.Subtract(LinerLiveTime); + if (timeSpan.TotalMinutes >= 10) + { + Console.WriteLine("内侧扫码器超时"); + //CloseShell(); + //Shell(); + break; + } + + } + //Console.ReadLine(); + + // ch:停止抓图 | en:Stop grabbing + nRet = device.MV_CODEREADER_StopGrabbing_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Stop grabbing failed{0:x8}", nRet); + break; + } + + // ch:关闭设备 | en:Close device + nRet = device.MV_CODEREADER_CloseDevice_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Close device failed{0:x8}", nRet); + break; + } + + // ch:销毁设备 | en:Destroy device + nRet = device.MV_CODEREADER_DestroyHandle_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Destroy device failed:{0:x8}", nRet); + break; + } + + } while (false); + + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + // ch:销毁设备 | en:Destroy device + nRet = device.MV_CODEREADER_DestroyHandle_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Destroy device failed:{0:x8}", nRet); + } + } + Liner(); + + } + + #endregion + + #region 关闭内胆扫码器 + /// + /// 关闭内胆扫码器 + /// + public static void CloseLiner() + { + int nRet = MvCodeReader.MV_CODEREADER_OK; + MvCodeReader device = LinerDevice; + // ch:停止抓图 | en:Stop grabbing + nRet = device.MV_CODEREADER_StopGrabbing_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Stop grabbing failed{0:x8}", nRet); + return; + } + + // ch:关闭设备 | en:Close device + nRet = device.MV_CODEREADER_CloseDevice_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Close device failed{0:x8}", nRet); + return; + } + + // ch:销毁设备 | en:Destroy device + nRet = device.MV_CODEREADER_DestroyHandle_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Destroy device failed:{0:x8}", nRet); + return; + } + Console.WriteLine("关闭内胆扫码器成功"); + return; + } + + #endregion + + #region 关闭箱壳扫码器 + /// + /// 关闭箱壳扫码器 + /// + public static void CloseShell() + { + int nRet = MvCodeReader.MV_CODEREADER_OK; + MvCodeReader device = ShellDevice; + // ch:停止抓图 | en:Stop grabbing + nRet = device.MV_CODEREADER_StopGrabbing_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Stop grabbing failed{0:x8}", nRet); + return; + } + + // ch:关闭设备 | en:Close device + nRet = device.MV_CODEREADER_CloseDevice_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Close device failed{0:x8}", nRet); + return; + } + + // ch:销毁设备 | en:Destroy device + nRet = device.MV_CODEREADER_DestroyHandle_NET(); + if (MvCodeReader.MV_CODEREADER_OK != nRet) + { + Console.WriteLine("Destroy device failed:{0:x8}", nRet); + return; + } + Console.WriteLine("关闭箱壳扫码器成功"); + return; + } + + #endregion + + #region 监测扫码器15分钟以内是否有触发操作,如果超时未触发,关闭再重连扫码器 + /// + /// 监测扫码器15分钟以内是否有触发操作,如果超时未触发,关闭再重连扫码器 + /// + public static void JudgeShellIsConnectedAndReConnect() + { + try + { + DateTime dateTime = DateTime.Now; + TimeSpan timeSpan = dateTime.Subtract(ShellLiveTime); + Task.Run(() => + { + if (timeSpan.TotalMinutes >= 1) + { + Console.WriteLine("箱壳扫码器超时,重连"); + ShellLiveTime = dateTime; + CloseShell(); + Shell(); + } + }); + Task.Run(() => + { + TimeSpan timeSpan2 = dateTime.Subtract(LinerLiveTime); + if (timeSpan2.TotalMinutes >= 1) + { + Console.WriteLine("内胆扫码器超时,重连"); + LinerLiveTime = dateTime; + CloseLiner(); + Liner(); + } + }); + + } + catch (Exception ex) + { + log.Error("JudgeShellIsConnectedAndReConnect判断扫码器重连方法异常:" + ex.Message.ToString()); + } + + } + + #endregion + + #region 判断字符编码 + /// + /// 判断字符编码 + /// + /// + /// + public static bool IsTextUTF8(byte[] inputStream) + { + int encodingBytesCount = 0; + bool allTextsAreASCIIChars = true; + + for (int i = 0; i < inputStream.Length; i++) + { + byte current = inputStream[i]; + + if ((current & 0x80) == 0x80) + { + allTextsAreASCIIChars = false; + } + // First byte + if (encodingBytesCount == 0) + { + if ((current & 0x80) == 0) + { + // ASCII chars, from 0x00-0x7F + continue; + } + + if ((current & 0xC0) == 0xC0) + { + encodingBytesCount = 1; + current <<= 2; + + // More than two bytes used to encoding a unicode char. + // Calculate the real length. + while ((current & 0x80) == 0x80) + { + current <<= 1; + encodingBytesCount++; + } + } + else + { + // Invalid bits structure for UTF8 encoding rule. + return false; + } + } + else + { + // Following bytes, must start with 10. + if ((current & 0xC0) == 0x80) + { + encodingBytesCount--; + } + else + { + // Invalid bits structure for UTF8 encoding rule. + return false; + } + } + } + if (encodingBytesCount != 0) + { + // Invalid bits structure for UTF8 encoding rule. + // Wrong following bytes count. + return false; + } + // Although UTF8 supports encoding for ASCII chars, we regard as a input stream, whose contents are all ASCII as default encoding. + return !allTextsAreASCIIChars; + } + + #endregion + + + } +} diff --git a/Aucma.Core.Palletiz/Startup.cs b/Aucma.Core.Palletiz/Startup.cs index 757e6666..b2bf21a1 100644 --- a/Aucma.Core.Palletiz/Startup.cs +++ b/Aucma.Core.Palletiz/Startup.cs @@ -63,9 +63,9 @@ namespace Aucma.Core.Palletiz AddServices(services); // - services.AddJobSetup(); + //services.AddJobSetup(); //ɨ - services.AddScannerSetup(); + // services.AddScannerSetup(); //PLC services.AddPlcSetup(); //ֱ֧ȫ :֧ System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030") @@ -88,8 +88,7 @@ namespace Aucma.Core.Palletiz /// /// /// - public void Configure(IApplicationBuilder app, ISysTasksQzService tasksQzService, - ISchedulerCenter schedulerCenter, IScannerService scannerService, IRunPlcService runPlcService) + public void Configure(IApplicationBuilder app, IRunPlcService runPlcService) { // ʹþ̬ļ app.UseStaticFiles(); @@ -97,9 +96,9 @@ namespace Aucma.Core.Palletiz //app.UseAuthorization(); // QuartzNetJobȷ - app.UseQuartzJobMildd(tasksQzService, schedulerCenter); + //app.UseQuartzJobMildd(tasksQzService, schedulerCenter); //ɨ - app.UseScannerMildd(scannerService); + //app.UseScannerMildd(scannerService); //PLC app.UsePlcMildd(runPlcService); } diff --git a/Aucma.Core.Palletiz/ViewModels/HandPalletizViewModel.cs b/Aucma.Core.Palletiz/ViewModels/HandPalletizViewModel.cs index 463f248a..fe8af24a 100644 --- a/Aucma.Core.Palletiz/ViewModels/HandPalletizViewModel.cs +++ b/Aucma.Core.Palletiz/ViewModels/HandPalletizViewModel.cs @@ -1,9 +1,15 @@ -using Aucma.Core.Palletiz.Business; +using Admin.Core.IService; +using Admin.Core.Model; +using Admin.Core.Service; +using Aucma.Core.Palletiz.Business; using Aucma.Core.Palletiz.Models; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using log4net; +using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; +using System.Linq; using System.Windows.Forms; namespace Aucma.Core.Palletiz.ViewModels @@ -11,19 +17,17 @@ namespace Aucma.Core.Palletiz.ViewModels public partial class HandPalletizViewModel : ObservableObject { private static readonly log4net.ILog log = LogManager.GetLogger(typeof(HandPalletizViewModel)); - - #region 货道信息 - private int LevelNo = 1; - private int BinNo = 1; - private int PortNo = 1; - private int RangeNo = 1; - #endregion - public static StackInfoModel tempStackInfo = new StackInfoModel(); - - public HandPalletizViewModel() { - - PromptInfo("请选择信息下传......", "White"); + private readonly IBaseSpaceInfoServices _baseSpaceInfoServices; + private readonly IRecordInStoreServices _recordInstoreServices; + public HandPalletizViewModel() + { + _baseSpaceInfoServices = App.ServiceProvider.GetService(); + _recordInstoreServices = App.ServiceProvider.GetService(); + Range = 1; + SpaceNo ="001"; + InstoreBusiness.LogInStoreInfoDelegateEvent += PromptInfo; + PromptInfo("请选择信息下传......", "White"); } #region 分垛信息下传 @@ -35,21 +39,57 @@ namespace Aucma.Core.Palletiz.ViewModels { try { - PromptInfo("分垛信息下传中......", "White"); + DialogResult cr = MessageBox.Show("是否确认下传分垛信息?", "系统提醒", MessageBoxButtons.OKCancel); if (cr != DialogResult.OK) { return; } - tempStackInfo.LevelNo = LevelNo; - tempStackInfo.BinNo = (BinNo - 1) * 2 + PortNo + ((LevelNo - 1) * 10); - tempStackInfo.PortNo = PortNo; - tempStackInfo.RangeNo = RangeNo; + PromptInfo("分垛信息下传中......", "White"); - bool backResult = InstoreBusiness.WritePlc(tempStackInfo); + int range = Range; + int spaceNo =Convert.ToInt32(SpaceNo); + if (spaceNo==0) + { + MessageBox.Show("请选择目的货道!","系统提醒"); + return; + } + string hh = "FD01_" + SpaceNo; + Admin.Core.Model.BaseSpaceInfo spaceInfo = _baseSpaceInfoServices.FirstAsync(X => X.StoreCode.Contains("FD") && X.SpaceCode == "FD01_"+SpaceNo).Result; + if (spaceInfo == null) + { + MessageBox.Show("货道未创建!", "系统提醒"); + return; + } + bool backResult = InstoreBusiness.TempWritePlc(spaceNo, range); if (backResult) { - PromptInfo("分垛信息下传成功!", "White"); + #region 手动入库没有扫码 默认为"0000000000" 添加入库记录 + RecordInStore recordInstore = new RecordInStore();// 入库记录 + recordInstore.SpaceCode = spaceInfo.SpaceCode; + recordInstore.StoreCode = spaceInfo.StoreCode; + recordInstore.MaterialType = "0000000000"; + recordInstore.MaterialCode = "0000000000"; + recordInstore.MaterialName = "0000000000"; + recordInstore.BarCodeCode= "0000000000"; + recordInstore.InStoreAmount = 1; + recordInstore.InStoreTime = DateTime.Now; + recordInstore.InStoreTime = DateTime.Now; + recordInstore.CreatedTime = DateTime.Now; + recordInstore.UpdateTime = DateTime.Now; + + int r= _recordInstoreServices.AddAsync(recordInstore).Result; + if (r>0) + { + PromptInfo("分垛信息下传成功!", "White"); + } + else + { + PromptInfo("分垛信息下传成功!入库明细保存失败!", "Red"); + } + #endregion + + } else { @@ -100,5 +140,27 @@ namespace Aucma.Core.Palletiz.ViewModels })); } #endregion + + #region 目的货道 + + private string spaceNo; + + public string SpaceNo + { + get => spaceNo; + set => SetProperty(ref spaceNo, value); + } + #endregion + + #region 方向 + + private int range; + + public int Range + { + get => range; + set => SetProperty(ref range, value); + } + #endregion } } diff --git a/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs b/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs index fb555eb6..69f81e23 100644 --- a/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs +++ b/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs @@ -15,6 +15,7 @@ using System.Windows.Threading; using System.Threading.Tasks; using Admin.Core.IService; using Microsoft.Extensions.DependencyInjection; +using Aucma.Core.Palletiz.Business; namespace Aucma.Core.Palletiz.ViewModels { @@ -35,8 +36,16 @@ namespace Aucma.Core.Palletiz.ViewModels { await RefreshTeamTime();//班组时间 }); + //测试开启 + //InstoreBusiness instore=new InstoreBusiness(); + //instore.test(); - + Task.Run(() => + { + Thread.Sleep(2000); + + Business.MvCodeHelper.Liner(); + }); } public void init() @@ -110,7 +119,7 @@ namespace Aucma.Core.Palletiz.ViewModels public void RefreshScanner() { string ip1 = Appsettings.app("Middleware", "Scanner1", "Ip"); - bool flag1 = MvCodeHelper.ConnectionStatus(ip1); + bool flag1 = true;// MvCodeHelper.ConnectionStatus(ip1); Scanner1State(flag1); } #endregion diff --git a/Aucma.Core.Palletiz/ViewModels/PalletizPageViewModel.cs b/Aucma.Core.Palletiz/ViewModels/PalletizPageViewModel.cs index d18996a0..250eb1e5 100644 --- a/Aucma.Core.Palletiz/ViewModels/PalletizPageViewModel.cs +++ b/Aucma.Core.Palletiz/ViewModels/PalletizPageViewModel.cs @@ -22,6 +22,7 @@ namespace Aucma.Core.Palletiz.ViewModels LoadDataGrid(); SelectTypeViewModel.RefreshPageEvent += LoadDataGrid; } + public void LoadDataGrid() { Spaces.Clear(); @@ -51,7 +52,6 @@ namespace Aucma.Core.Palletiz.ViewModels SelectType direct = new SelectType(info); direct.ShowDialog(); } - } private BaseSpaceInfo selectedDataItem; diff --git a/Aucma.Core.Palletiz/ViewModels/SelectTypeViewModel.cs b/Aucma.Core.Palletiz/ViewModels/SelectTypeViewModel.cs index fa96e013..eb6c2166 100644 --- a/Aucma.Core.Palletiz/ViewModels/SelectTypeViewModel.cs +++ b/Aucma.Core.Palletiz/ViewModels/SelectTypeViewModel.cs @@ -1,20 +1,16 @@ using Admin.Core.Common; using Admin.Core.IService; using Admin.Core.Model; +using Admin.Core.Model.Model_New; using Admin.Core.Service; using Aucma.Core.Palletiz.Common; using Aucma.Core.Palletiz.Views; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; -using CommunityToolkit.Mvvm.Messaging; using log4net; using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Logging; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Linq; -using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -39,8 +35,8 @@ namespace Aucma.Core.Palletiz.ViewModels private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(BaseSpaceInfoServices)); private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices; + private readonly IBaseOrderInfoServices? _baseOrderInfoServices; private readonly IBaseSpaceInfoServices _baseSpaceInfoServices; - private string spaceCodes = string.Empty; private AppConfigHelper appConfig = new AppConfigHelper(); @@ -48,7 +44,8 @@ namespace Aucma.Core.Palletiz.ViewModels public SelectTypeViewModel(BaseSpaceInfo space) { _baseSpaceInfoServices = App.ServiceProvider.GetService(); - _baseMaterialInfoServices = App.ServiceProvider.GetService(); + _baseOrderInfoServices = App.ServiceProvider.GetService(); + //_baseMaterialInfoServices = App.ServiceProvider.GetService(); SpaceInfo = space; SearchCriteriaViewModel.RefreshConfigDelegateEvent += SaveSearchCriteria; @@ -74,11 +71,11 @@ namespace Aucma.Core.Palletiz.ViewModels string station = Appsettings.app("StationInfo", "StationCode"); if (!string.IsNullOrEmpty(selectedOption)) { - var infos = await _baseMaterialInfoServices.QueryAsync(x => x.MaterialSubclass == "200" && x.MaterialName.Contains(selectedOption)); + var infos = await _baseOrderInfoServices.QueryAsync(x => x.MaterialName.Contains(selectedOption)); MaterialDataGrid.Clear(); Application.Current.Dispatcher.Invoke(() => { - foreach (BaseMaterialInfo info in infos) + foreach (BaseOrderInfo info in infos) { MaterialDataGrid.Add(info); } @@ -113,11 +110,11 @@ namespace Aucma.Core.Palletiz.ViewModels //初始化加载数据 public async void Load(BaseSpaceInfo space) { - var infos = await _baseMaterialInfoServices.QueryAsync(x => x.MaterialSubclass == "200"); + var infos = await _baseOrderInfoServices.QueryAsync(d=>d.CompleteAmount!=d.OrderAmount); MaterialDataGrid.Clear(); Application.Current.Dispatcher.Invoke(() => { - foreach (BaseMaterialInfo info in infos) + foreach (BaseOrderInfo info in infos) { MaterialDataGrid.Add(info); } @@ -133,7 +130,7 @@ namespace Aucma.Core.Palletiz.ViewModels { IsSelectedOptionB = true; } - + planInfo.MaterialCode = space.MaterialType; planInfo.MaterialName = space.typeNameA; @@ -151,9 +148,9 @@ namespace Aucma.Core.Palletiz.ViewModels /// /// 初始化物料信息 /// - private ObservableCollection materialDataGrid = new ObservableCollection(); + private ObservableCollection materialDataGrid = new ObservableCollection(); - public ObservableCollection MaterialDataGrid + public ObservableCollection MaterialDataGrid { get { return materialDataGrid; } set => SetProperty(ref materialDataGrid, value); @@ -173,8 +170,8 @@ namespace Aucma.Core.Palletiz.ViewModels /// /// 初始化下拉列表 /// - private BaseMaterialInfo selectedDataItem; - public BaseMaterialInfo SelectedDataItem + private BaseOrderInfo selectedDataItem; + public BaseOrderInfo SelectedDataItem { get { return selectedDataItem; } set => SetProperty(ref selectedDataItem, value); @@ -220,8 +217,8 @@ namespace Aucma.Core.Palletiz.ViewModels #endregion #region 计划信息 - private BaseMaterialInfo planInfo = new BaseMaterialInfo(); - public BaseMaterialInfo PlanInfo + private BaseOrderInfo planInfo = new BaseOrderInfo(); + public BaseOrderInfo PlanInfo { get { return planInfo; } set => SetProperty(ref planInfo, value); @@ -361,7 +358,6 @@ namespace Aucma.Core.Palletiz.ViewModels try { // 转向角度 - spaceInfo.RotationRange = int.Parse(SelectedRotation.Content.ToString()); spaceInfo.IsTwoSpace = IsSelectedOptionA ? 1 : 0; spaceInfo.LastSpace = string.Empty; @@ -436,11 +432,11 @@ namespace Aucma.Core.Palletiz.ViewModels { if (!string.IsNullOrEmpty(searchText)) { - var infos = await _baseMaterialInfoServices.QueryAsync(x => x.MaterialSubclass == "200" && (x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText))); + var infos = await _baseOrderInfoServices.QueryAsync(x => (x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText))); MaterialDataGrid.Clear(); Application.Current.Dispatcher.Invoke(() => { - foreach (BaseMaterialInfo info in infos) + foreach (BaseOrderInfo info in infos) { MaterialDataGrid.Add(info); } diff --git a/Aucma.Core.Palletiz/Views/HandPalletizView.xaml b/Aucma.Core.Palletiz/Views/HandPalletizView.xaml index 01337351..fae57d26 100644 --- a/Aucma.Core.Palletiz/Views/HandPalletizView.xaml +++ b/Aucma.Core.Palletiz/Views/HandPalletizView.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" WindowStartupLocation="CenterScreen" FontFamily="Microsoft YaHei" - Title="手动分垛" Height="600" Width="800" Name="window" Background="White" + Title="手动分垛" Height="800" Width="800" Name="window" Background="White" ResizeMode="NoResize" Topmost="True"> @@ -26,9 +26,7 @@ - - - + @@ -36,50 +34,61 @@ - + - +