222
schangxiang@126.com
2024-06-27 9c806a573d5d34a3ebe4bfaec2580770de813e80
222
已添加155个文件
39395 ■■■■■ 文件已修改
DataCapture/iWare_SCADA_DataCapture_Test/DLL/HslCommunication.dll 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/DLL/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/DLL/Newtonsoft.Json.xml 10752 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/DLL/log4net.dll 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/Test_iWare_SCADA_DataCapture_Test.sln 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/App.config 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/CommonManager.cs 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/DataCaptureColumnDictManager.cs 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/DataCaptureConfigManager.cs 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/SystemValue.cs 2466 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs 2322 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/WorkPieceLogManager.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/Dao/CommonDao.cs 553 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/Dao/CommonService.cs 404 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/Dao/_system~.ini 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/EFHelp.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/ICommonEntity.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/IService.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/QueryParam.cs 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DBDataCapture/AlarmLogManager.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP05.cs 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP0501.cs 472 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP0502.cs 191 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP0503.cs 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP0504.cs 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP1001.cs 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP1002.cs 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP1003.cs 172 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP1004.cs 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP3002.cs 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/HMIBeartBeatMonitor.cs 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/HMI_WorkpieceReading.cs 358 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/HMI_WorkpieceWrite.cs 409 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCFactory.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCManger.cs 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCService.cs 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/Siemens_HslCommunicationService.cs 433 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Properties/AssemblyInfo.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Properties/Resources.Designer.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Properties/Resources.resx 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Test/MyTest.cs 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/CSVHelper.cs 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/ComboBoxHelper.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/ConfigHelper.cs 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/DataCache.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/DateTimeHelper.cs 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/EntityPropHelper.cs 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/EnumberHelper.cs 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FileDirectoryEnumerator.cs 569 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FileHelper.cs 399 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FileOperationHelper.cs 470 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FindFiles.cs 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FolderHelper.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/Log4Net/C_LogWriter.cs 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/Log4Net/Log4netHelper.cs 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/LogTextHelper.cs 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/RandomHelper.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/RegexExtension.cs 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/SystemHelper.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/log4net_iWare - 复制用.config 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/log4net_iWare.config 528 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/packages.config 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/App - 本机环境.config 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/App - 生产环境.config 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/App.config 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormMain.Designer.cs 2941 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormMain.cs 1929 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormMain.resx 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormTest.Designer.cs 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormTest.cs 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormTest.resx 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Program.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/AssemblyInfo.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/Resources.Designer.cs 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/Resources.resx 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/Settings.Designer.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/Settings.settings 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test.csproj 182 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/packages.config 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/App.Config 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/EnumberEntity.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/Enums.cs 225 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/ListItem.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/MessageModel.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/MiddleModel/ThreadStatusMonitorMiddle.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/MiddleModel/WorkPieceLogMiddle.cs 439 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/PLCDataCapture/BasePlcParam.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/PLCDataCapture/HslCommunicationParam.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/Properties/AssemblyInfo.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/SystemValue.cs 2430 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/DataCaptureColumnConfig.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/DataCaptureConfig.cs 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/DbModel.cs 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/EquipmentBaseInfo.cs 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/EquipmentCurrentMonitor.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/EquipmentWorkingLog.cs 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/KnifeToolBaseInfo.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/KnifeToolDataMonitor.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/QualityDataInfo.cs 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/SystemLog.cs 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/WorkPieceInfo.cs 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/WorkPieceInfoLog.cs 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/WorkPieceLog.cs 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/DataCaptureColumnConfig.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/DataCaptureConfig.cs 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/DbModel.cs 222 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/EquipmentBaseInfo.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/EquipmentCurrentMonitor.cs 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/EquipmentFailureCode.cs 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/EquipmentWorkingLog.cs 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolBaseInfo.cs 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolDataMonitor.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolEquipmentInfo.cs 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolEquipmentInfoLog.cs 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolEquipmentMonitor.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolEquipmentUpdateLog.cs 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/Model1.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/QualityDataInfo.cs 475 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/QualityDataInfoLog.cs 372 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/SystemLog.cs 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/ThreadStatusMonitor.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/WorkPieceInfo.cs 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/WorkPieceInfoLog.cs 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/WorkPieceLog.cs 137 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/WorkPieceProcess.cs 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/v_get_equipment_alert.cs 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/AlarmLog.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/CNCStatus.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/Count.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/CumulativeTime.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/CurrentToolNumber.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/FeedAndSpindle.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/Load.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/OEE.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/Postion.cs 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/ProgramBlock.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/ProgramInfo.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/SCModel.cs 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/TimeData.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/iWare_SCADA_Model.csproj 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/packages.config 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/DataCaptureColumnConfig.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/DataCaptureConfig.cs 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/EquipmentBaseInfo.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/EquipmentCurrentMonitor.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/EquipmentWorkingLog.cs 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/Model1.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/Model2.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/Model3.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/QualityDataInfo.cs 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/QualityDataInfoLog.cs 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/WorkPieceInfo.cs 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/WorkPieceInfoLog.cs 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/WorkPieceLog.cs 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataCapture/iWare_SCADA_DataCapture_Test/DLL/HslCommunication.dll
Binary files differ
DataCapture/iWare_SCADA_DataCapture_Test/DLL/Newtonsoft.Json.dll
Binary files differ
DataCapture/iWare_SCADA_DataCapture_Test/DLL/Newtonsoft.Json.xml
¶Ô±ÈÐÂÎļþ
ÎļþÌ«´ó
DataCapture/iWare_SCADA_DataCapture_Test/DLL/log4net.dll
Binary files differ
DataCapture/iWare_SCADA_DataCapture_Test/Test_iWare_SCADA_DataCapture_Test.sln
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,42 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iWare_SCADA_Model", "iWare_SCADA_Model\iWare_SCADA_Model.csproj", "{91C185DE-15AB-44AE-B585-53799FC51BE0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iWare_SCADA_BusinessLogical", "iWare_SCADA_BusinessLogical\iWare_SCADA_BusinessLogical.csproj", "{32708F19-FE1A-48F5-B373-8E1C776F216C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{9BB6FA0E-C431-4F4F-8EC7-BC62383F412D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iWare_SCADA_DataCapture_Test", "iWare_SCADA_DataCapture_Test\iWare_SCADA_DataCapture_Test.csproj", "{E07C6E80-A875-482C-9427-BA5703DFF7EB}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {91C185DE-15AB-44AE-B585-53799FC51BE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {91C185DE-15AB-44AE-B585-53799FC51BE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {91C185DE-15AB-44AE-B585-53799FC51BE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {91C185DE-15AB-44AE-B585-53799FC51BE0}.Release|Any CPU.Build.0 = Release|Any CPU
        {32708F19-FE1A-48F5-B373-8E1C776F216C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {32708F19-FE1A-48F5-B373-8E1C776F216C}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {32708F19-FE1A-48F5-B373-8E1C776F216C}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {32708F19-FE1A-48F5-B373-8E1C776F216C}.Release|Any CPU.Build.0 = Release|Any CPU
        {E07C6E80-A875-482C-9427-BA5703DFF7EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {E07C6E80-A875-482C-9427-BA5703DFF7EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {E07C6E80-A875-482C-9427-BA5703DFF7EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {E07C6E80-A875-482C-9427-BA5703DFF7EB}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(NestedProjects) = preSolution
        {E07C6E80-A875-482C-9427-BA5703DFF7EB} = {9BB6FA0E-C431-4F4F-8EC7-BC62383F412D}
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {71AEA756-11BA-4085-8E3F-7DAA18D3F7DB}
    EndGlobalSection
EndGlobal
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/App.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/CommonManager.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,161 @@
using iTextSharp.text.pdf;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static log4net.Appender.RollingFileAppender;
namespace iWare_SCADA_BusinessLogical.BLL
{
    public class CommonManager
    {
        public static readonly CommonManager Instance = new CommonManager();
        /// <summary>
        /// è§£æžå·¥ä»¶å·äºŒç»´ç 
        /// </summary>
        /// <param name="log"></param>
        /// <returns></returns>
        public WorkPieceLog GetWorkPieceID(WorkPieceLog log,LogType type)
        {
            try
            {
                if(log==null|| log.WorkPieceID.Trim().Length!=22)
                {
                    Log4NetHelper.WriteErrorLog(type, $"解析工件号{CheckNULLForString(log.WorkPieceID)} {log.Id}二维码时出错,二维码格式不对");
                    return log;
                }
                log.WorkPieceIDTo1 = log.WorkPieceID.Substring(0, 2);
                log.WorkPieceIDTo2 = log.WorkPieceID.Substring(2, 4);
                log.WorkPieceIDTo3 = log.WorkPieceID.Substring(6, 6);
                log.WorkPieceIDTo4 = log.WorkPieceID.Substring(12, 2);
                log.WorkPieceIDTo5 = log.WorkPieceID.Substring(14, 4);
                log.WorkPieceIDTo6 = log.WorkPieceID.Substring(18, 2);
                log.WorkPieceIDTo7 = log.WorkPieceID.Substring(20, 2);
            }
            catch(Exception ex)
            {
                Log4NetHelper.WriteErrorLog(type, $"解析工件号{CheckNULLForString(log.WorkPieceID)} {log.Id}二维码时异常:", ex);
            }
            return log;
        }
        public string CheckNULLForString(string str)
        {
            return string.IsNullOrEmpty(str) ? "" : str;
        }
        public string CheackPath(string path, int type, int time)
        {
            var directory = Path.GetDirectoryName(path);
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            if (!File.Exists(path))
            {
                File.Create(path).Close();
            }
            string content = "";
            // åŒæ­¥æ¥æºæ•°æ®
            using (StreamReader reader = new StreamReader(path))
            {
                content = reader.ReadToEnd();
                Console.WriteLine("读取的内容是:" + content);
                if (content == null || content == "")
                {
                    switch (type)
                    {
                        case 1: content = DateTimeHelper.GetDateTime().AddYears(time).ToString(); break;
                        case 2: content = DateTimeHelper.GetDateTime().AddMonths(time).ToString(); break;
                        case 3: content = DateTimeHelper.GetDateTime().AddDays(time).ToString(); break;
                        case 4: content = DateTimeHelper.GetDateTime().AddHours(time).ToString(); break;
                        case 5: content = DateTimeHelper.GetDateTime().AddMinutes(time).ToString(); break;
                        case 6: content = DateTimeHelper.GetDateTime().AddSeconds(time).ToString(); break;
                        default:
                            content = DateTimeHelper.GetDateTime().ToString(); break;
                    }
                    //content = DateTimeHelper.GetDateTime().AddMinutes(-10).ToString();
                }
            }
            return content;
        }
        /// <summary>
        /// è§£æžpdf文件
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="getPdfValue"></param>
        /// <returns></returns>
        public static List<string> ReadPdfConntent(string filePath, string getPdfValue)
        {
            List<string> lst = new List<string>();
            try
            {
                string pdffilename = filePath;
                PdfReader pdfreader = new PdfReader(pdffilename);
                int numberOfPages = pdfreader.NumberOfPages;
                //for (int i = 1; i <= numberOfPages; ++i)
                //{
                //    lst.Add(iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(pdfreader,i));
                //    text.AppendLine();
                //}
                string text = iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(pdfreader, 1);
                string[] words = text.Split('\n');
                foreach (var item in words)
                {
                    string value = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(item));
                    if (value.Contains(getPdfValue))
                    {
                        string[] splitValue = value.Split(':');
                        lst.Add(splitValue[1].Trim());
                    }
                }
                pdfreader.Close();
                return lst;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DateTime? GetOP60Time(string datetime)
        {
            try
            {
                string regex = @"^(\d{1,2})\.(\d{1,2})\.(\d{4})\/(\d{1,2}):(\d{1,2}):(\d{1,2})";
                var macth = RegexExtension.Match(datetime, regex, 20000);
                if (macth.Success)
                {
                    string date = $"{macth.Groups[3].Value}/{macth.Groups[2].Value}/{macth.Groups[1].Value} {macth.Groups[4].Value}:{macth.Groups[5].Value}:{macth.Groups[6].Value}";
                    DateTime Time;
                    if (DateTime.TryParseExact(date, "yyyy/MM/dd HH:mm:ss", CultureInfo.CurrentCulture, DateTimeStyles.None, out Time))
                    {
                        return Time;
                    }
                }
                return null;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/DataCaptureColumnDictManager.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,70 @@
using iWare_SCADA_BusinessLogical.DLA.Dao;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    public class DataCaptureColumnDictManager
    {
        ///// <summary>
        ///// èŽ·å– è°ƒåº¦ç³»ç»Ÿå¯åŠ¨ç›¸å…³
        ///// </summary>
        ///// <param name="edm"></param>
        ///// <returns></returns>
        //public static IList<DataCaptureColumnDict> GetCCSystem(DbModel edm)
        //{
        //    return edm.DataCaptureColumnDictList.Where(x => x.EquipmentID == "1").ToList();//.FirstOrDefault();
        //}
        /// <summary>
        /// èŽ·å– è°ƒåº¦ç³»ç»Ÿå¯åŠ¨ç›¸å…³
        /// </summary>
        /// <param name="edm"></param>
        /// <returns></returns>
        public static List<EquipmentBaseInfo> GetEquipmentBaseInfo()
        {
            using (DbModel db = new DbModel())
            {
                //
                //var a = db.EquipmentBaseInfos.Find(1);//主键为1的
                var b = db.EquipmentBaseInfo.Where(o=>o.EquipmentId=="1").ToList();
                var query = db.EquipmentBaseInfo.Where(s => s.EquipmentId == "1").ToList();//返回IQueryable è¯´æ˜Žæ˜¯å»¶è¿ŸæŸ¥è¯¢
                //查询所有
                var query2 = db.EquipmentBaseInfo.ToList();//这个不是延迟查询
                //var query3 = db.DataCaptureConfigs.ToList();//这个不是延迟查询
                return b;
                //var ccSystem = DataCaptureColumnDictManager.GetEquipmentBaseInfo(edm);
                //if (ccSystem == null)
                //{
                //    MessageBox.Show("请联系管理员维护系统调度相关的数据!");
                //    return;
                //};
            }
            //return edm.EquipmentBaseInfos.Find;
        }
        /// <summary>
        /// åˆ†é¡µæŸ¥è¯¢
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        public static void pageselect(int pageIndex,int pageSize)
        {
            using (DbModel db = new DbModel())
            {
                var query3 = db.EquipmentBaseInfo.Skip((pageIndex - 1) * pageSize).Take(pageSize);
            }
            //CommonDao<EquipmentBaseInfo, EquipmentBaseInfo> CommonDao=new CommonDao<EquipmentBaseInfo, EquipmentBaseInfo>();
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/DataCaptureConfigManager.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,107 @@
using iWare_SCADA_Model;
using iWare_SCADA_Model.TableModelSC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical.BLL
{
    public class DataCaptureConfigManager
    {
        public static List<DataCaptureConfig> GetDataCaptureConfigs()
        {
            using (DbModel db = new DbModel())
            {
                //查询所有未删除数据
                var query = db.DataCaptureConfig.Where(o=>o.IsDeleted==false).ToList();//这个不是延迟查询
                return query;
            }
        }
        public static List<DataCaptureColumnConfig> GetDataCaptureColumnConfig()
        {
            using (DbModel db = new DbModel())
            {
                //查询所有
                var query = db.DataCaptureColumnConfig.Where(o=>1==1).ToList();//这个不是延迟查询
                return query;
                //var ccSystem = DataCaptureColumnDictManager.GetEquipmentBaseInfo(edm);
                //if (ccSystem == null)
                //{
                //    MessageBox.Show("请联系管理员维护系统调度相关的数据!");
                //    return;
                //};
            }
        }
        public static List<AlarmLog> getdate()
        {
            using (SCModel db = new SCModel())
            {
                List<AlarmLog> query = db.AlarmLog.ToList();
                return query;
            }
        }
        public static void InsertDataCaptureConfig(DataCaptureConfig info)
        {
            using (DbModel db = new DbModel())
            {
                db.DataCaptureConfig.Add(info);
                db.SaveChanges();
            }
        }
        public static void UpdateDataCaptureConfig(DataCaptureConfig info,out string message)
        {
            using (DbModel db = new DbModel())
            {
                message = "";
                var model = db.DataCaptureConfig.Where(o => o.Id == info.Id).FirstOrDefault();
                if(model!=null && model.Id > 0)
                {
                    var num=db.DataCaptureConfig.Where(o => o.DataCapturePointCode == info.DataCapturePointCode && o.Id != model.Id).Count();
                    if(num>0)
                    {
                        message = $"收集点代码{info.DataCapturePointCode}已存在,不能重复,请确认后再次修改!";
                        return;
                    }
                    model.EquipmentID = info.EquipmentID;
                    model.WorkingProcedure = info.WorkingProcedure;
                    model.DataCapturePointCode = info.DataCapturePointCode;
                    model.DataCapturePointCname = info.DataCapturePointCname;
                    model.DataCaptureType = info.DataCaptureType;
                    model.DataCapturePLCType = info.DataCapturePLCType;
                    model.PLCIP = info.PLCIP;
                    model.PLCPort = info.PLCPort;
                    model.DbNumber = info.DbNumber;
                    model.Offset = info.Offset;
                    model.DataCaptureColumnType = info.DataCaptureColumnType;
                    db.SaveChanges();
                }
                else
                {
                    message = "当前修改项不存在,请刷新后再次修改!";
                    return;
                }
            }
        }
        public static int DeleteDataCaptureConfig(DataCaptureConfig info)
        {
            using (DbModel db = new DbModel())
            {
                var config = db.DataCaptureConfig.FirstOrDefault(m => m.Id == info.Id);
                if (config != null)
                {
                    db.DataCaptureConfig.Remove(config);
                }
                return db.SaveChanges();
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/SystemValue.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,2466 @@

using iWare_SCADA_Model;
using iWare_SCADA_Model.MiddleModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// ç³»ç»Ÿå˜é‡
    /// </summary>
    public class SystemValue
    {
        /// <summary>
        /// OP20的当前检测面值
        /// </summary>
        public static string OP20_Side_Value = "";
        #region PLC链接
        public static object lockPlcService = new object();
        private static Dictionary<string, PLCService> plcServiceList = new Dictionary<string, PLCService>();
        public static PLCService GetPLCService(DataCaptureConfig dataCaptureConfig)
        {
            PLCService plcService = null;
            lock (lockPlcService)
            {
                if (plcServiceList.ContainsKey(dataCaptureConfig.PLCIP))
                {
                    plcService = plcServiceList[dataCaptureConfig.PLCIP];
                }
                else
                {
                    plcService = PLCManger.GetSinglePLCService(dataCaptureConfig);
                    plcServiceList.Add(dataCaptureConfig.PLCIP, plcService);
                }
            }
            return plcService;
        }
        public static void PLCServiceReconnect(PLCService plcService)
        {
            if(plcService==null)
            {
                return;
            }
            plcService.Close();
            plcService.OpenService();
        }
        #endregion
        /// <summary>
        /// ç³»ç»Ÿå¯åŠ¨çš„GUID
        /// </summary>
        public static string SystemStartGuid = string.Empty;
        /// <summary>
        /// æ¨¡å¼æ˜¯å¦å¯åЍ
        /// </summary>
        public static bool isStartedModel = false;
        /// <summary>
        /// å»¶è¿Ÿçº¿ç¨‹æ‰§è¡Œçš„æ—¶é—´ï¼ˆæ¯«ç§’)
        /// </summary>
        public static int DelayExcuteNumber = 2000;
        /// <summary>
        /// PLC地址分隔符 ï¼Œç”¨äºŽåˆ†éš” DB地址和偏移量的
        /// </summary>
        public static char PLCDBADDRESS_SEPARATE = '|';
        public static List<ThreadStatusMonitor> MainList=new List<ThreadStatusMonitor>();
        private static object lockMainList = new object();
        public static async void UpdateMainList(ThreadStatusMonitor threadinfo)
        {
            await Task.Run(() => {
                lock (lockMainList)
                {
                    var info = MainList.Where(o => o.Threadcode == threadinfo.Threadcode).FirstOrDefault();
                    if(info == null)
                    {
                        MainList.Add(threadinfo);
                    }
                    else
                    {
                        DateTime time = DateTime.Now;
                        info.Remarks = threadinfo.Remarks;
                        info.Threadendtime = time;//每次都更新
                        info.Threadlastmodifytime = threadinfo.Threadlastmodifytime>DateTime.MinValue? threadinfo.Threadlastmodifytime: info.Threadlastmodifytime;//如果有传参则更新
                        info.ThreadId = threadinfo.ThreadId;
                        info.ThreadFrequency = threadinfo.ThreadFrequency;
                        info.UpdatedTime = time;
                        info.UpdatedUserName = threadinfo.Threadcode;
                        if (info.Threadstatue == 1)
                        {
                            info.Threadlastmodifytime = time;//最新跑到数据
                        }
                    }
                }
            });
        }
        #region OP05工序
        public static object lock5QRcodeList = new object();
        private static Dictionary<string, DateTime> _qRcodeList = new Dictionary<string, DateTime>();
        /// <summary>
        /// OP05读取的二维码列表 //注意,使用中add å’Œèµ‹å€¼éƒ½éœ€è¦æ·»åР锁 lock5QRcodeList
        /// </summary>
        public static Dictionary<string, DateTime> QRcodeList
        {
            get { return _qRcodeList; }
            set
            {
                _qRcodeList = value;
            }
        }
        private static object lockOP0501Runing = new object();
        private static object lockOP0502Runing = new object();
        private static object lockOP0503Runing = new object();
        private static object lockOP0504Runing = new object();
        private static object lockOP0506Runing = new object();
        private static object lockOP0507Runing = new object();
        private static bool _isAllowRuning_OP0501 = false;
        private static bool _isAllowRuning_OP0502 = false;
        private static bool _isAllowRuning_OP0503 = false;
        private static bool _isAllowRuning_OP0504 = false;
        private static bool _isAllowRuning_OP0506 = false;
        private static bool _isAllowRuning_OP0507 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP05工序打码完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP0501
        {
            get { return _isAllowRuning_OP0501; }
            set {
                lock (lockOP0501Runing)
                {
                    _isAllowRuning_OP0501 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP05工序读码完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP0502
        {
            get { return _isAllowRuning_OP0502; }
            set
            {
                lock (lockOP0502Runing)
                {
                    _isAllowRuning_OP0502 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP05工序推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP0503
        {
            get { return _isAllowRuning_OP0503; }
            set
            {
                lock (lockOP0503Runing)
                {
                    _isAllowRuning_OP0503 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP05工序完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP0504
        {
            get { return _isAllowRuning_OP0504; }
            set
            {
                lock (lockOP0504Runing)
                {
                    _isAllowRuning_OP0504 = value;
                }
            }
        }
        private static object lockOP0501Alert = new object();
        private static object lockOP0502Alert = new object();
        private static object lockOP0503Alert = new object();
        private static object lockOP0504Alert = new object();
        private static object lockOP0506Alert = new object();
        private static object lockOP0507Alert = new object();
        private static string _lbl_Alert_OP0501 = string.Empty;
        private static string _lbl_Alert_OP0502 = string.Empty;
        private static string _lbl_Alert_OP0503 = string.Empty;
        private static string _lbl_Alert_OP0504 = string.Empty;
        private static string _lbl_Alert_OP0506 = string.Empty;
        private static string _lbl_Alert_OP0507 = string.Empty;
        /// <summary>
        /// ç›‘控OP05工序打码完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP0501
        {
            get { return _lbl_Alert_OP0501; }
            set
            {
                lock (lockOP0501Alert)
                {
                    _lbl_Alert_OP0501 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP05工序读码完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP0502
        {
            get { return _lbl_Alert_OP0502; }
            set
            {
                lock (lockOP0502Alert)
                {
                    _lbl_Alert_OP0502 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP05工序推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP0503
        {
            get { return _lbl_Alert_OP0503; }
            set
            {
                lock (lockOP0503Alert)
                {
                    _lbl_Alert_OP0503 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP05工序完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP0504
        {
            get { return _lbl_Alert_OP0504; }
            set
            {
                lock (lockOP0504Alert)
                {
                    _lbl_Alert_OP0504 = value;
                }
            }
        }
        public static string lbl_Alert_OP0506
        {
            get { return _lbl_Alert_OP0506; }
            set
            {
                lock (lockOP0506Alert)
                {
                    _lbl_Alert_OP0506 = value;
                }
            }
        }
        public static string lbl_Alert_OP0507
        {
            get { return _lbl_Alert_OP0507; }
            set
            {
                lock (lockOP0507Alert)
                {
                    _lbl_Alert_OP0507 = value;
                }
            }
        }
        private static object lockOP0501Value = new object();
        private static object lockOP0502Value = new object();
        private static object lockOP0503Value = new object();
        private static object lockOP0504Value = new object();
        private static object lockOP0506Value = new object();
        private static object lockOP0507Value = new object();
        private static string _value_OP0501 = string.Empty;
        private static string _value_OP0502 = string.Empty;
        private static string _value_OP0503 = string.Empty;
        private static string _value_OP0504 = string.Empty;
        private static string _value_OP0506 = string.Empty;
        private static string _value_OP0507 = string.Empty;
        /// <summary>
        /// OP05工序打码完成标记值
        /// </summary>
        public static string value_OP0501
        {
            get { return _value_OP0501; }
            set
            {
                lock (lockOP0501Value)
                {
                    _value_OP0501 = value;
                }
            }
        }
        /// <summary>
        /// OP05工序读码完成标记值
        /// </summary>
        public static string value_OP0502
        {
            get { return _value_OP0502; }
            set
            {
                lock (lockOP0502Value)
                {
                    _value_OP0502 = value;
                }
            }
        }
        /// <summary>
        /// OP05工序推出标记值
        /// </summary>
        public static string value_OP0503
        {
            get { return _value_OP0503; }
            set
            {
                lock (lockOP0503Value)
                {
                    _value_OP0503 = value;
                }
            }
        }
        /// <summary>
        /// OP05工序完成标记值
        /// </summary>
        public static string value_OP0504
        {
            get { return _value_OP0504; }
            set
            {
                lock (lockOP0504Value)
                {
                    _value_OP0504 = value;
                }
            }
        }
        public static string value_OP0506
        {
            get { return _value_OP0506; }
            set
            {
                lock (lockOP0506Value)
                {
                    _value_OP0506 = value;
                }
            }
        }
        public static string value_OP0507
        {
            get { return _value_OP0507; }
            set
            {
                lock (lockOP0507Value)
                {
                    _value_OP0507 = value;
                }
            }
        }
        #endregion
        #region OP10工序
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP10工序读码完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP1001 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP10工序测试完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP1002 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP10工序推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP1003 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP10工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP1004 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP10工序完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP1005 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP10工序告警标记线程
        /// </summary>
        public static bool isAllowRuning_OP1006 = false;
        public static bool isAllowRuning_OP1007 = false;
        /// <summary>
        /// ç›‘控OP10工序读码完成标记的警告消息
        /// </summary>
        private static string _lbl_Alert_OP1001 = string.Empty;
        /// <summary>
        /// ç›‘控OP10工序测试完成标记的警告消息
        /// </summary>
        private static string _lbl_Alert_OP1002 = string.Empty;
        /// <summary>
        /// ç›‘控OP10工序推出标记的警告消息
        /// </summary>
        private static string _lbl_Alert_OP1003 = string.Empty;
        /// <summary>
        /// ç›‘控OP10工序SPC推出标记的警告消息
        /// </summary>
        private static string _lbl_Alert_OP1004 = string.Empty;
        /// <summary>
        /// ç›‘控OP10工序完成标记的警告消息
        /// </summary>
        private static string _lbl_Alert_OP1005 = string.Empty;
        /// <summary>
        /// ç›‘控OP10工序告警信息
        /// </summary>
        private static string _lbl_Alert_OP1006 = string.Empty;
        private static string _lbl_Alert_OP1007 = string.Empty;
        /// <summary>
        /// OP10工序读码完成标记值
        /// </summary>
        public static string value_OP1001 = string.Empty;
        /// <summary>
        /// OP10工序测试完成标记值
        /// </summary>
        public static string value_OP1002 = string.Empty;
        /// <summary>
        /// OP10工序推出标记值
        /// </summary>
        public static string value_OP1003 = string.Empty;
        /// <summary>
        /// OP10工序SPC推出标记值
        /// </summary>
        public static string value_OP1004 = string.Empty;
        /// <summary>
        /// OP10工序完成标记值
        /// </summary>
        public static string value_OP1005 = string.Empty;
        /// <summary>
        /// OP10工序告警标记值
        /// </summary>
        public static string value_OP1006 = string.Empty;
        public static string value_OP1007 = string.Empty;
        private static object lockOP1001Alert = new object();
        private static object lockOP1002Alert = new object();
        private static object lockOP1003Alert = new object();
        private static object lockOP1004Alert = new object();
        private static object lockOP1005Alert = new object();
        private static object lockOP1006Alert = new object();
        private static object lockOP1007Alert = new object();
        public static string lbl_Alert_OP1001
        {
            get { return _lbl_Alert_OP1001; }
            set
            {
                lock (lockOP1001Alert)
                {
                    _lbl_Alert_OP1001 = value;
                }
            }
        }
        public static string lbl_Alert_OP1002
        {
            get { return _lbl_Alert_OP1002; }
            set
            {
                lock (lockOP1002Alert)
                {
                    _lbl_Alert_OP1002 = value;
                }
            }
        }
        public static string lbl_Alert_OP1003
        {
            get { return _lbl_Alert_OP1003; }
            set
            {
                lock (lockOP1003Alert)
                {
                    _lbl_Alert_OP1003 = value;
                }
            }
        }
        public static string lbl_Alert_OP1004
        {
            get { return _lbl_Alert_OP1004; }
            set
            {
                lock (lockOP1004Alert)
                {
                    _lbl_Alert_OP1004 = value;
                }
            }
        }
        public static string lbl_Alert_OP1005
        {
            get { return _lbl_Alert_OP1005; }
            set
            {
                lock (lockOP1005Alert)
                {
                    _lbl_Alert_OP1005 = value;
                }
            }
        }
        public static string lbl_Alert_OP1006
        {
            get { return _lbl_Alert_OP1006; }
            set
            {
                lock (lockOP1006Alert)
                {
                    _lbl_Alert_OP1006 = value;
                }
            }
        }
        public static string lbl_Alert_OP1007
        {
            get { return _lbl_Alert_OP1007; }
            set
            {
                lock (lockOP1007Alert)
                {
                    _lbl_Alert_OP1007 = value;
                }
            }
        }
        #endregion
        #region OP20工序
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP20工序读码完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP2001 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP20工序测试完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP2002 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP20工序推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP2003 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP20工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP2004 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP20工序完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP2005 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP20工序告警标记线程
        /// </summary>
        public static bool isAllowRuning_OP2006 = false;
        /// <summary>
        /// ç›‘控OP20工序读码完成标记的警告消息
        /// </summary>
        public static string _lbl_Alert_OP2001 = string.Empty;
        /// <summary>
        /// ç›‘控OP20工序测试完成标记的警告消息
        /// </summary>
        public static string _lbl_Alert_OP2002 = string.Empty;
        /// <summary>
        /// ç›‘控OP20工序推出标记的警告消息
        /// </summary>
        public static string _lbl_Alert_OP2003 = string.Empty;
        /// <summary>
        /// ç›‘控OP20工序SPC推出标记的警告消息
        /// </summary>
        public static string _lbl_Alert_OP2004 = string.Empty;
        /// <summary>
        /// ç›‘控OP20工序完成标记的警告消息
        /// </summary>
        public static string _lbl_Alert_OP2005 = string.Empty;
        /// <summary>
        /// ç›‘控OP20工序告警信息
        /// </summary>
        public static string _lbl_Alert_OP2006 = string.Empty;
        /// <summary>
        /// OP20工序读码完成标记值
        /// </summary>
        public static string value_OP2001 = string.Empty;
        /// <summary>
        /// OP20工序测试完成标记值
        /// </summary>
        public static string value_OP2002 = string.Empty;
        /// <summary>
        /// OP20工序推出标记值
        /// </summary>
        public static string value_OP2003 = string.Empty;
        /// <summary>
        /// OP20工序SPC推出标记值
        /// </summary>
        public static string value_OP2004 = string.Empty;
        /// <summary>
        /// OP20工序完成标记值
        /// </summary>
        public static string value_OP2005 = string.Empty;
        /// <summary>
        /// OP20工序告警标记值
        /// </summary>
        public static string value_OP2006 = string.Empty;
        #endregion
        #region OP30工序
        private static object lockOP3001Runing = new object();
        private static object lockOP3002Runing = new object();
        private static object lockOP3003Runing = new object();
        private static object lockOP3004Runing = new object();
        private static bool _isAllowRuning_OP3001 = false;
        private static bool _isAllowRuning_OP3002 = false;
        private static bool _isAllowRuning_OP3003 = false;
        private static bool _isAllowRuning_OP3004 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP30工序读码完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP3001
        {
            get { return _isAllowRuning_OP3001; }
            set
            {
                lock (lockOP3001Runing)
                {
                    _isAllowRuning_OP3001 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP30工序测量完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP3002
        {
            get { return _isAllowRuning_OP3002; }
            set
            {
                lock (lockOP3002Runing)
                {
                    _isAllowRuning_OP3002 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP30工序推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3003
        {
            get { return _isAllowRuning_OP3003; }
            set
            {
                lock (lockOP3003Runing)
                {
                    _isAllowRuning_OP3003 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP30工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3004
        {
            get { return _isAllowRuning_OP3004; }
            set
            {
                lock (lockOP3004Runing)
                {
                    _isAllowRuning_OP3004 = value;
                }
            }
        }
        private static object lockOP3001Alert = new object();
        private static object lockOP3002Alert = new object();
        private static object lockOP3003Alert = new object();
        private static object lockOP3004Alert = new object();
        private static string _lbl_Alert_OP3001 = string.Empty;
        private static string _lbl_Alert_OP3002 = string.Empty;
        private static string _lbl_Alert_OP3003 = string.Empty;
        private static string _lbl_Alert_OP3004 = string.Empty;
        /// <summary>
        /// ç›‘控OP30工序读码完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3001
        {
            get { return _lbl_Alert_OP3001; }
            set
            {
                lock (lockOP3001Alert)
                {
                    _lbl_Alert_OP3001 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP30工序测量完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3002
        {
            get { return _lbl_Alert_OP3002; }
            set
            {
                lock (lockOP3002Alert)
                {
                    _lbl_Alert_OP3002 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP30工序推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3003
        {
            get { return _lbl_Alert_OP3003; }
            set
            {
                lock (lockOP3003Alert)
                {
                    _lbl_Alert_OP3003 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP30工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3004
        {
            get { return _lbl_Alert_OP3004; }
            set
            {
                lock (lockOP3004Alert)
                {
                    _lbl_Alert_OP3004 = value;
                }
            }
        }
        private static object lockOP3001Value = new object();
        private static object lockOP3002Value = new object();
        private static object lockOP3003Value = new object();
        private static object lockOP3004Value = new object();
        private static string _value_OP3001 = string.Empty;
        private static string _value_OP3002 = string.Empty;
        private static string _value_OP3003 = string.Empty;
        private static string _value_OP3004 = string.Empty;
        /// <summary>
        /// OP30工序读码完成标记值
        /// </summary>
        public static string value_OP3001
        {
            get { return _value_OP3001; }
            set
            {
                lock (lockOP3001Value)
                {
                    _value_OP3001 = value;
                }
            }
        }
        /// <summary>
        /// OP30工序测量完成标记值
        /// </summary>
        public static string value_OP3002
        {
            get { return _value_OP3002; }
            set
            {
                lock (lockOP3002Value)
                {
                    _value_OP3002 = value;
                }
            }
        }
        /// <summary>
        /// OP30工序推出标记值
        /// </summary>
        public static string value_OP3003
        {
            get { return _value_OP3003; }
            set
            {
                lock (lockOP3003Value)
                {
                    _value_OP3003 = value;
                }
            }
        }
        /// <summary>
        /// OP30工序SPC推出标记值
        /// </summary>
        public static string value_OP3004
        {
            get { return _value_OP3004; }
            set
            {
                lock (lockOP3004Value)
                {
                    _value_OP3004 = value;
                }
            }
        }
        private static object lockOP3005Runing = new object();
        private static bool _isAllowRuning_OP3005 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP30工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3005
        {
            get { return _isAllowRuning_OP3005; }
            set
            {
                lock (lockOP3005Runing)
                {
                    _isAllowRuning_OP3005 = value;
                }
            }
        }
        private static object lockOP3005Alert = new object();
        private static string _lbl_Alert_OP3005 = string.Empty;
        /// <summary>
        /// ç›‘控OP30工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3005
        {
            get { return _lbl_Alert_OP3005; }
            set
            {
                lock (lockOP3005Alert)
                {
                    _lbl_Alert_OP3005 = value;
                }
            }
        }
        private static string _value_OP3005 = string.Empty;
        private static object lockOP3005Value = new object();
        /// <summary>
        /// OP30工序SPC推出标记值
        /// </summary>
        public static string value_OP3005
        {
            get { return _value_OP3005; }
            set
            {
                lock (lockOP3005Value)
                {
                    _value_OP3005 = value;
                }
            }
        }
        private static object lockOP3006Runing = new object();
        private static bool _isAllowRuning_OP3006 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP30工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3006
        {
            get { return _isAllowRuning_OP3006; }
            set
            {
                lock (lockOP3006Runing)
                {
                    _isAllowRuning_OP3006 = value;
                }
            }
        }
        private static object lockOP3006Alert = new object();
        private static string _lbl_Alert_OP3006 = string.Empty;
        /// <summary>
        /// ç›‘控OP30工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3006
        {
            get { return _lbl_Alert_OP3006; }
            set
            {
                lock (lockOP3006Alert)
                {
                    _lbl_Alert_OP3006 = value;
                }
            }
        }
        private static string _value_OP3006 = string.Empty;
        private static object lockOP3006Value = new object();
        /// <summary>
        /// OP30工序SPC推出标记值
        /// </summary>
        public static string value_OP3006
        {
            get { return _value_OP3006; }
            set
            {
                lock (lockOP3006Value)
                {
                    _value_OP3006 = value;
                }
            }
        }
        private static object lockOP3007Runing = new object();
        private static bool _isAllowRuning_OP3007 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP30工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3007
        {
            get { return _isAllowRuning_OP3007; }
            set
            {
                lock (lockOP3007Runing)
                {
                    _isAllowRuning_OP3007 = value;
                }
            }
        }
        private static object lockOP3007Alert = new object();
        private static string _lbl_Alert_OP3007 = string.Empty;
        /// <summary>
        /// ç›‘控OP30工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3007
        {
            get { return _lbl_Alert_OP3007; }
            set
            {
                lock (lockOP3007Alert)
                {
                    _lbl_Alert_OP3007 = value;
                }
            }
        }
        private static string _value_OP3007 = string.Empty;
        private static object lockOP3007Value = new object();
        /// <summary>
        /// OP30工序SPC推出标记值
        /// </summary>
        public static string value_OP3007
        {
            get { return _value_OP3007; }
            set
            {
                lock (lockOP3007Value)
                {
                    _value_OP3007 = value;
                }
            }
        }
        #endregion
        #region OP35工序
        private static object lockOP3501Runing = new object();
        private static object lockOP3502Runing = new object();
        private static object lockOP3503Runing = new object();
        private static object lockOP3504Runing = new object();
        private static bool _isAllowRuning_OP3501 = false;
        private static bool _isAllowRuning_OP3502 = false;
        private static bool _isAllowRuning_OP3503 = false;
        private static bool _isAllowRuning_OP3504 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP35工序读码完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP3501
        {
            get { return _isAllowRuning_OP3501; }
            set
            {
                lock (lockOP3501Runing)
                {
                    _isAllowRuning_OP3501 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP35工序测量完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP3502
        {
            get { return _isAllowRuning_OP3502; }
            set
            {
                lock (lockOP3502Runing)
                {
                    _isAllowRuning_OP3502 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP35工序推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3503
        {
            get { return _isAllowRuning_OP3503; }
            set
            {
                lock (lockOP3503Runing)
                {
                    _isAllowRuning_OP3503 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP35工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3504
        {
            get { return _isAllowRuning_OP3504; }
            set
            {
                lock (lockOP3504Runing)
                {
                    _isAllowRuning_OP3504 = value;
                }
            }
        }
        private static object lockOP3501Alert = new object();
        private static object lockOP3502Alert = new object();
        private static object lockOP3503Alert = new object();
        private static object lockOP3504Alert = new object();
        private static string _lbl_Alert_OP3501 = string.Empty;
        private static string _lbl_Alert_OP3502 = string.Empty;
        private static string _lbl_Alert_OP3503 = string.Empty;
        private static string _lbl_Alert_OP3504 = string.Empty;
        /// <summary>
        /// ç›‘控OP35工序读码完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3501
        {
            get { return _lbl_Alert_OP3501; }
            set
            {
                lock (lockOP3501Alert)
                {
                    _lbl_Alert_OP3501 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP35工序测量完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3502
        {
            get { return _lbl_Alert_OP3502; }
            set
            {
                lock (lockOP3502Alert)
                {
                    _lbl_Alert_OP3502 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP35工序推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3503
        {
            get { return _lbl_Alert_OP3503; }
            set
            {
                lock (lockOP3503Alert)
                {
                    _lbl_Alert_OP3503 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP35工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3504
        {
            get { return _lbl_Alert_OP3504; }
            set
            {
                lock (lockOP3504Alert)
                {
                    _lbl_Alert_OP3504 = value;
                }
            }
        }
        private static object lockOP3501Value = new object();
        private static object lockOP3502Value = new object();
        private static object lockOP3503Value = new object();
        private static object lockOP3504Value = new object();
        private static string _value_OP3501 = string.Empty;
        private static string _value_OP3502 = string.Empty;
        private static string _value_OP3503 = string.Empty;
        private static string _value_OP3504 = string.Empty;
        /// <summary>
        /// OP35工序读码完成标记值
        /// </summary>
        public static string value_OP3501
        {
            get { return _value_OP3501; }
            set
            {
                lock (lockOP3501Value)
                {
                    _value_OP3501 = value;
                }
            }
        }
        /// <summary>
        /// OP35工序测量完成标记值
        /// </summary>
        public static string value_OP3502
        {
            get { return _value_OP3502; }
            set
            {
                lock (lockOP3502Value)
                {
                    _value_OP3502 = value;
                }
            }
        }
        /// <summary>
        /// OP35工序推出标记值
        /// </summary>
        public static string value_OP3503
        {
            get { return _value_OP3503; }
            set
            {
                lock (lockOP3503Value)
                {
                    _value_OP3503 = value;
                }
            }
        }
        /// <summary>
        /// OP35工序SPC推出标记值
        /// </summary>
        public static string value_OP3504
        {
            get { return _value_OP3504; }
            set
            {
                lock (lockOP3504Value)
                {
                    _value_OP3504 = value;
                }
            }
        }
        private static object lockOP3505Runing = new object();
        private static bool _isAllowRuning_OP3505 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP35工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3505
        {
            get { return _isAllowRuning_OP3505; }
            set
            {
                lock (lockOP3505Runing)
                {
                    _isAllowRuning_OP3505 = value;
                }
            }
        }
        private static object lockOP3505Alert = new object();
        private static string _lbl_Alert_OP3505 = string.Empty;
        /// <summary>
        /// ç›‘控OP35工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3505
        {
            get { return _lbl_Alert_OP3505; }
            set
            {
                lock (lockOP3505Alert)
                {
                    _lbl_Alert_OP3505 = value;
                }
            }
        }
        private static string _value_OP3505 = string.Empty;
        private static object lockOP3505Value = new object();
        /// <summary>
        /// OP35工序SPC推出标记值
        /// </summary>
        public static string value_OP3505
        {
            get { return _value_OP3505; }
            set
            {
                lock (lockOP3505Value)
                {
                    _value_OP3505 = value;
                }
            }
        }
        private static object lockOP3506Runing = new object();
        private static bool _isAllowRuning_OP3506 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP35工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3506
        {
            get { return _isAllowRuning_OP3506; }
            set
            {
                lock (lockOP3506Runing)
                {
                    _isAllowRuning_OP3506 = value;
                }
            }
        }
        private static object lockOP3506Alert = new object();
        private static string _lbl_Alert_OP3506 = string.Empty;
        /// <summary>
        /// ç›‘控OP35工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3506
        {
            get { return _lbl_Alert_OP3506; }
            set
            {
                lock (lockOP3506Alert)
                {
                    _lbl_Alert_OP3506 = value;
                }
            }
        }
        private static string _value_OP3506 = string.Empty;
        private static object lockOP3506Value = new object();
        /// <summary>
        /// OP35工序SPC推出标记值
        /// </summary>
        public static string value_OP3506
        {
            get { return _value_OP3506; }
            set
            {
                lock (lockOP3506Value)
                {
                    _value_OP3506 = value;
                }
            }
        }
        private static object lockOP3507Runing = new object();
        private static bool _isAllowRuning_OP3507 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP35工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP3507
        {
            get { return _isAllowRuning_OP3507; }
            set
            {
                lock (lockOP3507Runing)
                {
                    _isAllowRuning_OP3507 = value;
                }
            }
        }
        private static object lockOP3507Alert = new object();
        private static string _lbl_Alert_OP3507 = string.Empty;
        /// <summary>
        /// ç›‘控OP35工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP3507
        {
            get { return _lbl_Alert_OP3507; }
            set
            {
                lock (lockOP3507Alert)
                {
                    _lbl_Alert_OP3507 = value;
                }
            }
        }
        private static string _value_OP3507 = string.Empty;
        private static object lockOP3507Value = new object();
        /// <summary>
        /// OP35工序SPC推出标记值
        /// </summary>
        public static string value_OP3507
        {
            get { return _value_OP3507; }
            set
            {
                lock (lockOP3507Value)
                {
                    _value_OP3507 = value;
                }
            }
        }
        #endregion
        #region OP70工序
        private static object lockOP7001Runing = new object();
        private static object lockOP7002Runing = new object();
        private static object lockOP7003Runing = new object();
        private static object lockOP7004Runing = new object();
        private static bool _isAllowRuning_OP7001 = false;
        private static bool _isAllowRuning_OP7002 = false;
        private static bool _isAllowRuning_OP7003 = false;
        private static bool _isAllowRuning_OP7004 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP70工序读码完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP7001
        {
            get { return _isAllowRuning_OP7001; }
            set
            {
                lock (lockOP7001Runing)
                {
                    _isAllowRuning_OP7001 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP70工序测量完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP7002
        {
            get { return _isAllowRuning_OP7002; }
            set
            {
                lock (lockOP7002Runing)
                {
                    _isAllowRuning_OP7002 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP70工序推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP7003
        {
            get { return _isAllowRuning_OP7003; }
            set
            {
                lock (lockOP7003Runing)
                {
                    _isAllowRuning_OP7003 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP70工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP7004
        {
            get { return _isAllowRuning_OP7004; }
            set
            {
                lock (lockOP7004Runing)
                {
                    _isAllowRuning_OP7004 = value;
                }
            }
        }
        private static object lockOP7001Alert = new object();
        private static object lockOP7002Alert = new object();
        private static object lockOP7003Alert = new object();
        private static object lockOP7004Alert = new object();
        private static string _lbl_Alert_OP7001 = string.Empty;
        private static string _lbl_Alert_OP7002 = string.Empty;
        private static string _lbl_Alert_OP7003 = string.Empty;
        private static string _lbl_Alert_OP7004 = string.Empty;
        /// <summary>
        /// ç›‘控OP70工序读码完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP7001
        {
            get { return _lbl_Alert_OP7001; }
            set
            {
                lock (lockOP7001Alert)
                {
                    _lbl_Alert_OP7001 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP70工序测量完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP7002
        {
            get { return _lbl_Alert_OP7002; }
            set
            {
                lock (lockOP7002Alert)
                {
                    _lbl_Alert_OP7002 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP70工序推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP7003
        {
            get { return _lbl_Alert_OP7003; }
            set
            {
                lock (lockOP7003Alert)
                {
                    _lbl_Alert_OP7003 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP70工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP7004
        {
            get { return _lbl_Alert_OP7004; }
            set
            {
                lock (lockOP7004Alert)
                {
                    _lbl_Alert_OP7004 = value;
                }
            }
        }
        private static object lockOP7001Value = new object();
        private static object lockOP7002Value = new object();
        private static object lockOP7003Value = new object();
        private static object lockOP7004Value = new object();
        private static string _value_OP7001 = string.Empty;
        private static string _value_OP7002 = string.Empty;
        private static string _value_OP7003 = string.Empty;
        private static string _value_OP7004 = string.Empty;
        /// <summary>
        /// OP70工序读码完成标记值
        /// </summary>
        public static string value_OP7001
        {
            get { return _value_OP7001; }
            set
            {
                lock (lockOP7001Value)
                {
                    _value_OP7001 = value;
                }
            }
        }
        /// <summary>
        /// OP70工序测量完成标记值
        /// </summary>
        public static string value_OP7002
        {
            get { return _value_OP7002; }
            set
            {
                lock (lockOP7002Value)
                {
                    _value_OP7002 = value;
                }
            }
        }
        /// <summary>
        /// OP70工序推出标记值
        /// </summary>
        public static string value_OP7003
        {
            get { return _value_OP7003; }
            set
            {
                lock (lockOP7003Value)
                {
                    _value_OP7003 = value;
                }
            }
        }
        /// <summary>
        /// OP70工序读码(就是OP70工序测量完成后会打印一个新二维码,绑定原工件号)
        /// </summary>
        public static string value_OP7004
        {
            get { return _value_OP7004; }
            set
            {
                lock (lockOP7004Value)
                {
                    _value_OP7004 = value;
                }
            }
        }
        private static object lockOP7005Runing = new object();
        private static bool _isAllowRuning_OP7005 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP70工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP7005
        {
            get { return _isAllowRuning_OP7005; }
            set
            {
                lock (lockOP7005Runing)
                {
                    _isAllowRuning_OP7005 = value;
                }
            }
        }
        private static object lockOP7005Alert = new object();
        private static string _lbl_Alert_OP7005 = string.Empty;
        /// <summary>
        /// ç›‘控OP70工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP7005
        {
            get { return _lbl_Alert_OP7005; }
            set
            {
                lock (lockOP7005Alert)
                {
                    _lbl_Alert_OP7005 = value;
                }
            }
        }
        private static string _value_OP7005 = string.Empty;
        private static object lockOP7005Value = new object();
        /// <summary>
        /// OP70工序SPC推出标记值
        /// </summary>
        public static string value_OP7005
        {
            get { return _value_OP7005; }
            set
            {
                lock (lockOP7005Value)
                {
                    _value_OP7005 = value;
                }
            }
        }
        private static object lockOP7006Runing = new object();
        private static bool _isAllowRuning_OP7006 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP70工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP7006
        {
            get { return _isAllowRuning_OP7006; }
            set
            {
                lock (lockOP7006Runing)
                {
                    _isAllowRuning_OP7006 = value;
                }
            }
        }
        private static object lockOP7006Alert = new object();
        private static string _lbl_Alert_OP7006 = string.Empty;
        /// <summary>
        /// ç›‘控OP70工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP7006
        {
            get { return _lbl_Alert_OP7006; }
            set
            {
                lock (lockOP7006Alert)
                {
                    _lbl_Alert_OP7006 = value;
                }
            }
        }
        private static string _value_OP7006 = string.Empty;
        private static object lockOP7006Value = new object();
        /// <summary>
        /// OP70工序SPC推出标记值
        /// </summary>
        public static string value_OP7006
        {
            get { return _value_OP7006; }
            set
            {
                lock (lockOP7006Value)
                {
                    _value_OP7006 = value;
                }
            }
        }
        private static object lockOP7007Runing = new object();
        private static bool _isAllowRuning_OP7007 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP70工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP7007
        {
            get { return _isAllowRuning_OP7007; }
            set
            {
                lock (lockOP7007Runing)
                {
                    _isAllowRuning_OP7007 = value;
                }
            }
        }
        private static object lockOP7007Alert = new object();
        private static string _lbl_Alert_OP7007 = string.Empty;
        /// <summary>
        /// ç›‘控OP70工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP7007
        {
            get { return _lbl_Alert_OP7007; }
            set
            {
                lock (lockOP7007Alert)
                {
                    _lbl_Alert_OP7007 = value;
                }
            }
        }
        private static string _value_OP7007 = string.Empty;
        private static object lockOP7007Value = new object();
        /// <summary>
        /// OP70工序SPC推出标记值
        /// </summary>
        public static string value_OP7007
        {
            get { return _value_OP7007; }
            set
            {
                lock (lockOP7007Value)
                {
                    _value_OP7007 = value;
                }
            }
        }
        #endregion
        #region OP80工序
        private static object lockOP8001Runing = new object();
        private static object lockOP8002Runing = new object();
        private static object lockOP8003Runing = new object();
        private static object lockOP8004Runing = new object();
        private static bool _isAllowRuning_OP8001 = false;
        private static bool _isAllowRuning_OP8002 = false;
        private static bool _isAllowRuning_OP8003 = false;
        private static bool _isAllowRuning_OP8004 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP80工序读码完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP8001
        {
            get { return _isAllowRuning_OP8001; }
            set
            {
                lock (lockOP8001Runing)
                {
                    _isAllowRuning_OP8001 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP80工序测量完成标记线程
        /// </summary>
        public static bool isAllowRuning_OP8002
        {
            get { return _isAllowRuning_OP8002; }
            set
            {
                lock (lockOP8002Runing)
                {
                    _isAllowRuning_OP8002 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP80工序推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP8003
        {
            get { return _isAllowRuning_OP8003; }
            set
            {
                lock (lockOP8003Runing)
                {
                    _isAllowRuning_OP8003 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP80工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP8004
        {
            get { return _isAllowRuning_OP8004; }
            set
            {
                lock (lockOP8004Runing)
                {
                    _isAllowRuning_OP8004 = value;
                }
            }
        }
        private static object lockOP8001Alert = new object();
        private static object lockOP8002Alert = new object();
        private static object lockOP8003Alert = new object();
        private static object lockOP8004Alert = new object();
        private static string _lbl_Alert_OP8001 = string.Empty;
        private static string _lbl_Alert_OP8002 = string.Empty;
        private static string _lbl_Alert_OP8003 = string.Empty;
        private static string _lbl_Alert_OP8004 = string.Empty;
        /// <summary>
        /// ç›‘控OP80工序读码完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP8001
        {
            get { return _lbl_Alert_OP8001; }
            set
            {
                lock (lockOP8001Alert)
                {
                    _lbl_Alert_OP8001 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP80工序测量完成标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP8002
        {
            get { return _lbl_Alert_OP8002; }
            set
            {
                lock (lockOP8002Alert)
                {
                    _lbl_Alert_OP8002 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP80工序推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP8003
        {
            get { return _lbl_Alert_OP8003; }
            set
            {
                lock (lockOP8003Alert)
                {
                    _lbl_Alert_OP8003 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控OP80工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP8004
        {
            get { return _lbl_Alert_OP8004; }
            set
            {
                lock (lockOP8004Alert)
                {
                    _lbl_Alert_OP8004 = value;
                }
            }
        }
        private static object lockOP8001Value = new object();
        private static object lockOP8002Value = new object();
        private static object lockOP8003Value = new object();
        private static object lockOP8004Value = new object();
        private static string _value_OP8001 = string.Empty;
        private static string _value_OP8002 = string.Empty;
        private static string _value_OP8003 = string.Empty;
        private static string _value_OP8004 = string.Empty;
        /// <summary>
        /// OP80工序读码完成标记值
        /// </summary>
        public static string value_OP8001
        {
            get { return _value_OP8001; }
            set
            {
                lock (lockOP8001Value)
                {
                    _value_OP8001 = value;
                }
            }
        }
        /// <summary>
        /// OP80工序测量完成标记值
        /// </summary>
        public static string value_OP8002
        {
            get { return _value_OP8002; }
            set
            {
                lock (lockOP8002Value)
                {
                    _value_OP8002 = value;
                }
            }
        }
        /// <summary>
        /// OP80工序推出标记值
        /// </summary>
        public static string value_OP8003
        {
            get { return _value_OP8003; }
            set
            {
                lock (lockOP8003Value)
                {
                    _value_OP8003 = value;
                }
            }
        }
        /// <summary>
        /// OP80工序读码(就是OP80工序测量完成后会打印一个新二维码,绑定原工件号)
        /// </summary>
        public static string value_OP8004
        {
            get { return _value_OP8004; }
            set
            {
                lock (lockOP8004Value)
                {
                    _value_OP8004 = value;
                }
            }
        }
        private static object lockOP8005Runing = new object();
        private static bool _isAllowRuning_OP8005 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP80工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP8005
        {
            get { return _isAllowRuning_OP8005; }
            set
            {
                lock (lockOP8005Runing)
                {
                    _isAllowRuning_OP8005 = value;
                }
            }
        }
        private static object lockOP8005Alert = new object();
        private static string _lbl_Alert_OP8005 = string.Empty;
        /// <summary>
        /// ç›‘控OP80工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP8005
        {
            get { return _lbl_Alert_OP8005; }
            set
            {
                lock (lockOP8005Alert)
                {
                    _lbl_Alert_OP8005 = value;
                }
            }
        }
        private static string _value_OP8005 = string.Empty;
        private static object lockOP8005Value = new object();
        /// <summary>
        /// OP80工序SPC推出标记值
        /// </summary>
        public static string value_OP8005
        {
            get { return _value_OP8005; }
            set
            {
                lock (lockOP8005Value)
                {
                    _value_OP8005 = value;
                }
            }
        }
        private static object lockOP8006Runing = new object();
        private static bool _isAllowRuning_OP8006 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP80工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP8006
        {
            get { return _isAllowRuning_OP8006; }
            set
            {
                lock (lockOP8006Runing)
                {
                    _isAllowRuning_OP8006 = value;
                }
            }
        }
        private static object lockOP8006Alert = new object();
        private static string _lbl_Alert_OP8006 = string.Empty;
        /// <summary>
        /// ç›‘控OP80工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP8006
        {
            get { return _lbl_Alert_OP8006; }
            set
            {
                lock (lockOP8006Alert)
                {
                    _lbl_Alert_OP8006 = value;
                }
            }
        }
        private static string _value_OP8006 = string.Empty;
        private static object lockOP8006Value = new object();
        /// <summary>
        /// OP80工序SPC推出标记值
        /// </summary>
        public static string value_OP8006
        {
            get { return _value_OP8006; }
            set
            {
                lock (lockOP8006Value)
                {
                    _value_OP8006 = value;
                }
            }
        }
        private static object lockOP8007Runing = new object();
        private static bool _isAllowRuning_OP8007 = false;
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控OP80工序SPC推出标记线程
        /// </summary>
        public static bool isAllowRuning_OP8007
        {
            get { return _isAllowRuning_OP8007; }
            set
            {
                lock (lockOP8007Runing)
                {
                    _isAllowRuning_OP8007 = value;
                }
            }
        }
        private static object lockOP8007Alert = new object();
        private static string _lbl_Alert_OP8007 = string.Empty;
        /// <summary>
        /// ç›‘控OP80工序SPC推出标记的警告消息
        /// </summary>
        public static string lbl_Alert_OP8007
        {
            get { return _lbl_Alert_OP8007; }
            set
            {
                lock (lockOP8007Alert)
                {
                    _lbl_Alert_OP8007 = value;
                }
            }
        }
        private static string _value_OP8007 = string.Empty;
        private static object lockOP8007Value = new object();
        /// <summary>
        /// OP80工序SPC推出标记值
        /// </summary>
        public static string value_OP8007
        {
            get { return _value_OP8007; }
            set
            {
                lock (lockOP8007Value)
                {
                    _value_OP8007 = value;
                }
            }
        }
        #endregion
        #region HMI
        private static object lockHMIBeartBeatMonitorRuning = new object();
        private static bool _isAllowRuning_HMIBeartBeatMonitor = false;
        private static object lockHMIBeartBeatMonitorAlert = new object();
        private static string _lbl_Alert_HMIBeartBeatMonitor = string.Empty;
        /// <summary>
        /// ç›‘控HMI心跳信息
        /// </summary>
        public static bool isAllowRuning_HMIBeartBeatMonitor
        {
            get { return _isAllowRuning_HMIBeartBeatMonitor; }
            set
            {
                lock (lockHMIBeartBeatMonitorRuning)
                {
                    _isAllowRuning_HMIBeartBeatMonitor = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控HMI心跳信息的警告消息
        /// </summary>
        public static string lbl_Alert_HMIBeartBeatMonitor
        {
            get { return _lbl_Alert_HMIBeartBeatMonitor; }
            set
            {
                lock (lockHMIBeartBeatMonitorAlert)
                {
                    _lbl_Alert_HMIBeartBeatMonitor = value;
                }
            }
        }
        private static object lockHMIOP104001Runing = new object();
        private static object lockHMIOP2001Runing = new object();
        private static object lockHMIOP303501Runing = new object();
        private static object lockHMIOP5001Runing = new object();
        private static object lockHMIOP6001Runing = new object();
        private static object lockHMIOP104002Runing = new object();
        private static object lockHMIOP2002Runing = new object();
        private static object lockHMIOP303502Runing = new object();
        private static object lockHMIOP5002Runing = new object();
        private static object lockHMIOP6002Runing = new object();
        private static bool _isAllowRuning_HMIOP104001 = false;
        private static bool _isAllowRuning_HMIOP2001 = false;
        private static bool _isAllowRuning_HMIOP303501 = false;
        private static bool _isAllowRuning_HMIOP5001 = false;
        private static bool _isAllowRuning_HMIOP6001 = false;
        private static bool _isAllowRuning_HMIOP104002 = false;
        private static bool _isAllowRuning_HMIOP2002 = false;
        private static bool _isAllowRuning_HMIOP303502 = false;
        private static bool _isAllowRuning_HMIOP5002 = false;
        private static bool _isAllowRuning_HMIOP6002 = false;
        private static object lockHMIOP104001Alert = new object();
        private static object lockHMIOP2001Alert = new object();
        private static object lockHMIOP303501Alert = new object();
        private static object lockHMIOP5001Alert = new object();
        private static object lockHMIOP6001Alert = new object();
        private static object lockHMIOP104002Alert = new object();
        private static object lockHMIOP2002Alert = new object();
        private static object lockHMIOP303502Alert = new object();
        private static object lockHMIOP5002Alert = new object();
        private static object lockHMIOP6002Alert = new object();
        private static string _lbl_Alert_HMIOP104001 = string.Empty;
        private static string _lbl_Alert_HMIOP2001 = string.Empty;
        private static string _lbl_Alert_HMIOP303501 = string.Empty;
        private static string _lbl_Alert_HMIOP5001 = string.Empty;
        private static string _lbl_Alert_HMIOP6001 = string.Empty;
        private static string _lbl_Alert_HMIOP104002 = string.Empty;
        private static string _lbl_Alert_HMIOP2002 = string.Empty;
        private static string _lbl_Alert_HMIOP303502 = string.Empty;
        private static string _lbl_Alert_HMIOP5002 = string.Empty;
        private static string _lbl_Alert_HMIOP6002 = string.Empty;
        #region ç›‘控读取线程
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP104001读取二维码线程
        /// </summary>
        public static bool isAllowRuning_HMIOP104001
        {
            get { return _isAllowRuning_HMIOP104001; }
            set
            {
                lock (lockHMIOP104001Runing)
                {
                    _isAllowRuning_HMIOP104001 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP2001读取二维码线程
        /// </summary>
        public static bool isAllowRuning_HMIOP2001
        {
            get { return _isAllowRuning_HMIOP2001; }
            set
            {
                lock (lockHMIOP2001Runing)
                {
                    _isAllowRuning_HMIOP2001 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP303501读取二维码线程
        /// </summary>
        public static bool isAllowRuning_HMIOP303501
        {
            get { return _isAllowRuning_HMIOP303501; }
            set
            {
                lock (lockHMIOP303501Runing)
                {
                    _isAllowRuning_HMIOP303501 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP5001读取二维码线程
        /// </summary>
        public static bool isAllowRuning_HMIOP5001
        {
            get { return _isAllowRuning_HMIOP5001; }
            set
            {
                lock (lockHMIOP5001Runing)
                {
                    _isAllowRuning_HMIOP5001 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP6001读取二维码线程
        /// </summary>
        public static bool isAllowRuning_HMIOP6001
        {
            get { return _isAllowRuning_HMIOP6001; }
            set
            {
                lock (lockHMIOP6001Runing)
                {
                    _isAllowRuning_HMIOP6001 = value;
                }
            }
        }
        #endregion
        #region ç›‘控写入线程
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP104002写入质量数据线程
        /// </summary>
        public static bool isAllowRuning_HMIOP104002
        {
            get { return _isAllowRuning_HMIOP104002; }
            set
            {
                lock (lockHMIOP104002Runing)
                {
                    _isAllowRuning_HMIOP104002 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP2002写入质量数据线程
        /// </summary>
        public static bool isAllowRuning_HMIOP2002
        {
            get { return _isAllowRuning_HMIOP2002; }
            set
            {
                lock (lockHMIOP2002Runing)
                {
                    _isAllowRuning_HMIOP2002 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP303502写入质量数据线程
        /// </summary>
        public static bool isAllowRuning_HMIOP303502
        {
            get { return _isAllowRuning_HMIOP303502; }
            set
            {
                lock (lockHMIOP303502Runing)
                {
                    _isAllowRuning_HMIOP303502 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP5002写入质量数据线程
        /// </summary>
        public static bool isAllowRuning_HMIOP5002
        {
            get { return _isAllowRuning_HMIOP5002; }
            set
            {
                lock (lockHMIOP5002Runing)
                {
                    _isAllowRuning_HMIOP5002 = value;
                }
            }
        }
        /// <summary>
        /// æ˜¯å¦å…è®¸æ‰§è¡Œç›‘控HMIOP6002更新质量数据线程
        /// </summary>
        public static bool isAllowRuning_HMIOP6002
        {
            get { return _isAllowRuning_HMIOP6002; }
            set
            {
                lock (lockHMIOP6002Runing)
                {
                    _isAllowRuning_HMIOP6002 = value;
                }
            }
        }
        #endregion
        #region ç›‘控读取线程二维码的警告信息
        /// <summary>
        /// ç›‘控HMIOP104001读取二维码的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP104001
        {
            get { return _lbl_Alert_HMIOP104001; }
            set
            {
                lock (lockHMIOP104001Alert)
                {
                    _lbl_Alert_HMIOP104001 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控HMIOP2001读取二维码的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP2001
        {
            get { return _lbl_Alert_HMIOP2001; }
            set
            {
                lock (lockHMIOP2001Alert)
                {
                    _lbl_Alert_HMIOP2001 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控HMIOP303501读取二维码的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP303501
        {
            get { return _lbl_Alert_HMIOP303501; }
            set
            {
                lock (lockHMIOP303501Alert)
                {
                    _lbl_Alert_HMIOP303501 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控HMIOP5001读取二维码的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP5001
        {
            get { return _lbl_Alert_HMIOP5001; }
            set
            {
                lock (lockHMIOP5001Alert)
                {
                    _lbl_Alert_HMIOP5001 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控HMIOP6001读取二维码的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP6001
        {
            get { return _lbl_Alert_HMIOP6001; }
            set
            {
                lock (lockHMIOP6001Alert)
                {
                    _lbl_Alert_HMIOP6001 = value;
                }
            }
        }
        #endregion
        #region ç›‘控写入线程二维码的警告信息
        /// <summary>
        /// ç›‘控HMIOP104002写入质量数据的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP104002
        {
            get { return _lbl_Alert_HMIOP104002; }
            set
            {
                lock (lockHMIOP104002Alert)
                {
                    _lbl_Alert_HMIOP104002 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控HMIOP2002写入质量数据的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP2002
        {
            get { return _lbl_Alert_HMIOP2002; }
            set
            {
                lock (lockHMIOP2002Alert)
                {
                    _lbl_Alert_HMIOP2002 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控HMIOP303502写入质量数据的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP303502
        {
            get { return _lbl_Alert_HMIOP303502; }
            set
            {
                lock (lockHMIOP303502Alert)
                {
                    _lbl_Alert_HMIOP303502 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控HMIOP5002更新质量数据的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP5002
        {
            get { return _lbl_Alert_HMIOP5002; }
            set
            {
                lock (lockHMIOP5002Alert)
                {
                    _lbl_Alert_HMIOP5002 = value;
                }
            }
        }
        /// <summary>
        /// ç›‘控HMIOP6002更新质量数据的警告消息
        /// </summary>
        public static string lbl_Alert_HMIOP6002
        {
            get { return _lbl_Alert_HMIOP6002; }
            set
            {
                lock (lockHMIOP6002Alert)
                {
                    _lbl_Alert_HMIOP6002 = value;
                }
            }
        }
        #endregion
        #endregion
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,2322 @@
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using iWare_SCADA_Model.MiddleModel;
using iWare_SCADA_Model.TableModel;
using log4net;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
//using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Windows.Forms;
using static System.Windows.Forms.AxHost;
namespace iWare_SCADA_BusinessLogical.BLL
{
    public class WorkPieceInfoManager
    {
        public static WorkPieceInfo GetWorkPieceInfo(string WorkPieceID)
        {
            using (DbModel db = new DbModel())
            {
                //查询所有
                var query = db.WorkPieceInfo.Where(o => o.WorkPieceID == WorkPieceID).FirstOrDefault();
                return query;
            }
        }
        public static long InsertWorkPieceInfo(WorkPieceInfo workPiece)
        {
            using (DbModel db = new DbModel())
            {
                db.WorkPieceInfo.Add(workPiece);
                db.SaveChanges();
                return workPiece.Id;
            }
        }
        public static WorkPieceLogMiddle GetAddWorkPieceLog(WorkPieceLogMiddle loginfo)
        {
            loginfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
            return loginfo;
        }
        /// <summary>
        /// ç»™WorkPieceLog主键等公共的的属性赋值
        /// </summary>
        /// <param name="loginfo"></param>
        /// <returns></returns>
        public static WorkPieceLog GetAddWorkPieceLog(WorkPieceLog loginfo)
        {
            loginfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
            return loginfo;
        }
        public static WorkPieceLog GetAddWorkPieceLog1(WorkPieceLogMiddle loginfo)
        {
            loginfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
            return loginfo;
        }
        /// <summary>
        /// é€šè¿‡WorkPieceInfo   ç»™WorkPieceInfoLog å±žæ€§èµ‹å€¼
        /// </summary>
        /// <param name="wpinfo"></param>
        /// <returns></returns>
        public static WorkPieceInfoLog GetAddWorkPieceInfoLog(WorkPieceInfo wpinfo)
        {
            WorkPieceInfoLog infolog = EntityPropHelper.Mapper<WorkPieceInfoLog, WorkPieceInfo>(wpinfo);
            infolog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
            infolog.WorkPieceInfoID = wpinfo.Id;
            infolog.LogAddTime = DateTime.Now;
            return infolog;
        }
        /// <summary>
        /// ç»™QualityDataInfo主键等公共的的属性赋值
        /// </summary>
        /// <param name="loginfo"></param>
        /// <returns></returns>
        public static QualityDataInfo GetAddQualityDataInfo(QualityDataInfo qdinfo)
        {
            qdinfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
            return qdinfo;
        }
        /// <summary>
        /// é€šè¿‡QualityDataInfo   ç»™QualityDataInfoLog å±žæ€§èµ‹å€¼
        /// </summary>
        /// <param name="wpinfo"></param>
        /// <returns></returns>
        public static QualityDataInfoLog GetAddQualityDataInfoLog(QualityDataInfo qdinfo)
        {
            QualityDataInfoLog infolog = EntityPropHelper.Mapper<QualityDataInfoLog, QualityDataInfo>(qdinfo);
            infolog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
            return infolog;
        }
        public static void test()
        {
            using (DbModel db = new DbModel())
            {
                //WorkPieceLogMiddle a = new WorkPieceLogMiddle();
                //a.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                //a.WorkPieceID="test01"+ new Random().Next(4).ToString();
                //a.QualityType = QualityType.SPC.ToString();
                //if(a.QualityType.Equals(QualityType.SPC.ToString()))
                //{
                //    a.Remarks = "SPC";
                //}
                //else
                //{
                //    a.Remarks = "AUTO";
                //}
                //WorkPieceLog b = new WorkPieceLog();
                //b.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                //b.WorkPieceID = "testxxx" + new Random().Next(0,1000).ToString();
                //b.QualityType = QualityType.SPC.ToString();
                //b.Remarks = "SPC insert into";
                //b.QualityState = 2;
                //b.QualityStateUpdateMode = "heheh";
                //db.WorkPieceLog.Add(b);
                //db.SaveChanges();
            }
        }
        /// <summary>
        /// æ ¹æ®è®¾å¤‡id更新刀具寿命信息(目前设定每生产一个工件,所有刀具寿命都会减1)
        /// </summary>
        /// <param name="db"></param>
        /// <param name="loginfo"></param>
        public static void UpdateKnifeToolLift(DbModel db, WorkPieceLog loginfo)
        {
            try
            {
                var info = db.KnifeToolEquipmentInfo.Where(o => o.EquipmentID.Equals(loginfo.EquipmentID)).ToList();
                foreach (var item in info)
                {
                    item.CurrentLife++;
                    item.UpdatedTime = DateTime.Now;
                }
            }
            catch (Exception ex)
            {
                loginfo.Remarks = (loginfo.Remarks ?? "") + $"{loginfo.WorkPieceID ?? "空"}刀具寿命更新数据异常{ex.Message}";
            }
        }
        /// <summary>
        /// è¯»å–二维码时逻辑
        /// æ ¡éªŒå·¥ä»¶æ˜¯å¦è·³åºï¼Œè´¨é‡æ˜¯å¦åˆæ ¼
        /// </summary>
        public static void ReadQRcode(WorkPieceLog loginfo, LogType type, PLCService plcService, int? IsFeedback)
        {//此处同时插入了WorkPieceLog,WorkPieceInfoLog表,并新增或修改WorkPieceInfo表
            using (DbModel db = new DbModel())
            {
                try
                {
                    bool isAddWorkPieceInfo = false;
                    if (loginfo.WorkPieceID.Length == 22)
                    {
                        WorkPieceInfo info = new WorkPieceInfo();
                        info = db.WorkPieceInfo.Where(o => o.WorkPieceID == loginfo.WorkPieceID).FirstOrDefault();
                        if (info == null || info.WorkPieceID.Length < 1)
                        {//插入WorkPieceInfo表
                            loginfo = CommonManager.Instance.GetWorkPieceID(loginfo, type);
                            info = EntityPropHelper.Mapper<WorkPieceInfo, WorkPieceLog>(loginfo);
                            //EntityPropHelper<WorkPieceLog, WorkPieceInfo>.CopyProp(loginfo, info, loginfo.GetWorkPieceInfoDict());
                            if (!loginfo.WorkingProcedure.Equals("OP05"))
                            {//当工件二维码第一次出现的工序不是OP05,则设置为可疑状态
                                info.QualityState = (int)QualityState.Suspected;
                                info.QualityErrorInfo = $"工件二维码第一次出现的工序{loginfo.MonitoringPoint}不是OP05,数据缺失,请确认情况并做相应处理!";
                                info.Remarks = $"工件二维码第一次出现的工序{loginfo.WorkingProcedure}不是OP05,数据缺失,请确认情况并做相应处理!";
                            }
                            else
                            {
                                info.QualityState = (int)QualityState.OK;//此处需要注意,判断所有工序质量,然后再赋值
                                info.Remarks = "OP05新增工件信息";
                            }
                            info.WorkPieceinitOnlineTime = DateTimeHelper.GetDateTime();
                            info.WorkingProcedurePlan = ConfigHelper.GetConfigString("WorkingProcedureAllStr") ?? "OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80";
                            info.CreatedUserName = loginfo.MonitoringPoint;
                            info.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                            info = ParseQRCode(info);
                            isAddWorkPieceInfo = true;
                        }
                        else
                        {
                            if (info.WorkingProcedureCurrent.Equals("OP05"))
                            {
                                loginfo.Remarks = (loginfo.Remarks ?? "") + $"读取二维码{loginfo.WorkPieceID ?? "空"} OP05工序重复读取了";
                                return;
                            }
                        }
                        info.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();//
                        info.WorkingProcedureEndTime = null;
                        info.WorkPieceState = (int)WorkPieceState.WIP;
                        info.EquipmentID = loginfo.EquipmentID;
                        info.QualityStateUpdateUser = loginfo.UpdatedUserName;
                        info.QualityStateUpdateTime = loginfo.UpdatedTime.Value.LocalDateTime;
                        info.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
                        info.UpdatedUserName = loginfo.MonitoringPoint;
                        info.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                        info.WorkPieceCurrentPosition = loginfo.WorkingProcedure;
                        info.WorkPieceCurrentPositionOrder = info.WorkingProcedurePlan.IndexOf(loginfo.WorkingProcedure) / 2;
                        info.WorkingProcedureCurrent = loginfo.WorkingProcedure;
                        info.Remarks = info.Remarks ?? "" + $"{info.WorkingProcedureCurrent}工件上线";
                        var pro = db.WorkPieceProcess.Where(o => o.WorkPieceID == loginfo.WorkPieceID && !o.OperationType.Equals("SPC") && (o.EndTime == null || o.EndTime <= DateTime.MinValue)).OrderByDescending(o => o.StartTime).FirstOrDefault();
                        if (pro != null && pro.WorkPieceID.Length > 1)
                        {
                            pro.EndTime = DateTimeHelper.GetDateTime();
                            pro.UpdatedUserName = loginfo.MonitoringPoint;
                            pro.UpdatedTime = DateTimeHelper.GetDateTime();
                            pro.Remarks = (pro.Remarks ?? "") + "又一次上线,更新结束时间";
                        }
                        //每次扫描上线都插入追溯表
                        WorkPieceProcess process = new WorkPieceProcess();
                        process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(info);
                        process.StartTime = DateTimeHelper.GetDateTime();
                        process.QualityState = info.QualityState.HasValue ? info.QualityState.Value : (int)QualityState.OK;
                        process.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                        process.CreatedUserName = loginfo.MonitoringPoint;
                        process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                        process.UpdatedUserName = loginfo.MonitoringPoint;
                        process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                        process.OperationType = OperationType.生产.ToString();
                        process.Remarks = "";
                        if (loginfo.WorkingProcedure.Equals("OP05"))
                        {
                            process.EndTime = process.StartTime;
                        }
                        db.WorkPieceProcess.Add(process);
                        //db.Database.AutoTransactionsEnabled = false;// åŒä¸€ä¸ªSaveChanges默认事务, å…³é—­é»˜è®¤äº‹åŠ¡ï¼š... å¥½åƒä¸èƒ½ç”¨å•Šï¼ŒåŽé¢å†ç ”究吧
                        if (isAddWorkPieceInfo)
                        {
                            db.WorkPieceInfo.Add(info);
                        }
                        else
                        {//不确定info是直接会修改还是需要再次查询,待测试
                         //info.Remarks = "修改,具体修改逻辑待定";
                        }
                        #region åˆ¤æ–­æ˜¯å¦è·³åº,或质量不符合 ç„¶åŽåé¦ˆPLC
                        if (IsFeedback.HasValue && IsFeedback.Value == (int)FeedbackMode.FeedbackPLC)
                        {
                            bool checkQualityInfoCompleteFlag = false;
                            bool plcFlag = true;//反馈给PLC的标记
                            string message = "";
                            checkQualityInfoCompleteFlag = WorkPieceInfoManager.CheckQualityInfoComplete(info, loginfo, type);
                            if (!checkQualityInfoCompleteFlag || info.QualityState != (int)QualityState.OK)
                            {
                                plcFlag = false;
                                message = !checkQualityInfoCompleteFlag ? "跳序," : "";
                                message += info.QualityState != (int)QualityState.OK ? "质量不符合" : "";
                            }
                            ////反馈给PLC,(写入点待定)
                            //MessageModel fr = null;
                            //fr = plcService.WriteValuePoint("", "", plcFlag, PLCManger.GetTypeForString("bool"));
                            //if (fr.result)
                            //{
                            //    Log4NetHelper.WriteInfoLog(type, $" å·¥ä»¶{info.WorkPieceID} {loginfo.WorkingProcedure}工序反馈给PLC æˆåŠŸï¼Œ å‡ºçް {message}");
                            //}
                            //else
                            //{
                            //    Log4NetHelper.WriteErrorLog(type, $" å·¥ä»¶{info.WorkPieceID} {loginfo.WorkingProcedure}工序反馈给PLC å¤±è´¥ï¼Œ å‡ºçް {message} ï¼Œå¤±è´¥åŽŸå› ï¼š{fr.resMsg}");
                            //}
                            //#region åé¦ˆPLC
                            //bool checkQualityInfoCompleteFlag = false;
                            //bool plcFlag = true;//反馈给PLC的标记
                            //string message = "";
                            //checkQualityInfoCompleteFlag = WorkPieceInfoManager.CheckQualityInfoComplete(info, wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                            //if (!checkQualityInfoCompleteFlag || info.QualityState != (int)QualityState.OK)
                            //{
                            //    plcFlag = false;
                            //    message = !checkQualityInfoCompleteFlag ? "跳序," : "";
                            //message += info.QualityState != (int)QualityState.OK ? "质量不符合" : "";
                            //}
                            ////反馈给PLC,(写入点待定)
                            //MessageModel fr = null;
                            //fr = plcService.WriteValuePoint("", "", plcFlag, PLCManger.GetTypeForString("bool"));
                            //if (fr.result)
                            //{
                            //    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" å·¥ä»¶{wplog.WorkPieceID} {WorkingProcedure}工序反馈给PLC æˆåŠŸï¼Œ å‡ºçް {message}");
                            //}
                            //else
                            //{
                            //    Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" å·¥ä»¶{wplog.WorkPieceID} {WorkingProcedure}工序反馈给PLC å¤±è´¥ï¼Œ å‡ºçް {message} ï¼Œå¤±è´¥åŽŸå› ï¼š{fr.resMsg}");
                            //}
                            //#endregion
                        }
                        else
                        {//读码完成若工件质量不符合或发生跳序,不用管设备是否把工件放过去,数采系统都不变更当前工序,反馈设备PLC工件不符合,
                         //若工序后续收集点收到相关工件信息再变更当前工序,  ä½†è´¨é‡ä¿¡æ¯ä¸å˜
                            info.WorkingProcedureCurrent = loginfo.WorkingProcedure;
                        }
                        #endregion
                        #region æ›´æ–°è®¾å¤‡å®žæ—¶è¡¨
                        bool isAddEquipmentCurrentMonitor = false;
                        EquipmentCurrentMonitor equinfo = new EquipmentCurrentMonitor();
                        equinfo = db.EquipmentCurrentMonitor.Where(o => o.EquipmentID == loginfo.EquipmentID).FirstOrDefault();
                        if (equinfo == null || equinfo.Id < 1)
                        {//没有工件信息,不做更新
                            Log4NetHelper.WriteErrorLog(type, $"设备{loginfo.EquipmentID} å‘Šè­¦ç›‘控{loginfo.WorkingProcedure} æ²¡æœ‰èŽ·å–åˆ°è®¾å¤‡ç›‘æŽ§ä¿¡æ¯ï¼ŒçŽ°æ–°å¢ž");
                            equinfo = EntityPropHelper.Mapper<EquipmentCurrentMonitor, WorkPieceLog>(loginfo);
                            equinfo.OnlineTime = DateTime.Now;
                            isAddEquipmentCurrentMonitor = true;
                        }
                        else
                        {//更新工件
                            equinfo.WorkPieceID = loginfo.WorkPieceID;
                            equinfo.UpdatedUserName = loginfo.MonitoringPoint;
                            equinfo.UpdatedTime = DateTime.Now;
                            equinfo.OnlineTime = DateTime.Now;
                        }
                        if (isAddEquipmentCurrentMonitor)
                        {
                            equinfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                            db.EquipmentCurrentMonitor.Add(equinfo);
                        }
                        #endregion
                        //db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo));
                        db.WorkPieceInfoLog.Add(GetAddWorkPieceInfoLog(info));
                        //UpdateKnifeToolLift(db, loginfo);//更新刀具寿命信息
                    }
                    else
                    {
                        loginfo.Remarks = (loginfo.Remarks ?? "") + $"上线完成读取二维码{loginfo.WorkPieceID ?? "空"}异常";
                        Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}上线监控读码标记 è¯»å–工件码数据[{loginfo.WorkPieceID ?? "空"}]时异常:");
                    }
                }
                catch (Exception e)
                {
                    loginfo.Remarks = (loginfo.Remarks ?? "") + $"读取二维码{loginfo.WorkPieceID ?? "空"}更新数据异常{e.Message}";
                }
                finally
                {
                    loginfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                    db.WorkPieceLog.Add(loginfo);
                    db.SaveChanges();
                }
            }
        }
        public static WorkPieceLogMiddle QualityDataHand(WorkPieceLogMiddle loginfo, List<EquipmentQualityConfig> qcofig)
        {
            try
            {
                switch (loginfo.WorkingProcedure)
                {
                    case "OP10":
                        var cof = qcofig.Where(o => o.ParamColName.Equals("QualityOP10To1")).FirstOrDefault();
                        if (cof != null && cof.Id > 0)
                        {
                            double oldvalue = 0;
                            double StandardValue = 0;
                            var flag1 = double.TryParse(loginfo.QualityOP10To1, out oldvalue);
                            var flag2 = double.TryParse(cof.StandardValue, out StandardValue);
                            if (!flag1 || !flag2)
                            {
                                return loginfo;
                            }
                            loginfo.QualityOP10To1 = ((StandardValue + oldvalue * 1.0 / cof.DecimalPlaces).ToString());
                            //+(string.IsNullOrEmpty(cof.Unit) ? "" : cof.Unit)
                        }
                        break;
                    case "OP40":
                        var cofOP40 = qcofig.Where(o => o.ParamColName.Equals("QualityOP40To1")).FirstOrDefault();
                        if (cofOP40 != null && cofOP40.Id > 0)
                        {
                            double oldvalue = 0;
                            double StandardValue = 0;
                            var flag1 = double.TryParse(loginfo.QualityOP40To1, out oldvalue);
                            var flag2 = double.TryParse(cofOP40.StandardValue, out StandardValue);
                            if (!flag1 || !flag2)
                            {
                                return loginfo;
                            }
                            loginfo.QualityOP40To1 = ((StandardValue + oldvalue * 1.0 / cofOP40.DecimalPlaces).ToString());
                            //+(string.IsNullOrEmpty(cofOP40.Unit) ? "" : cofOP40.Unit)
                        }
                        break;
                    case "OP20":
                        var cofOP20 = qcofig.Where(o => o.ParamColName.Equals("QualityOP20To1")).FirstOrDefault();
                        if (cofOP20 != null && cofOP20.Id > 0)
                        {
                            double oldvalue = 0;
                            double StandardValue = 0;
                            var flag1 = double.TryParse(loginfo.QualityOP20To1, out oldvalue);
                            var flag2 = double.TryParse(cofOP20.StandardValue, out StandardValue);
                            if (!flag1 || !flag2)
                            {
                                return loginfo;
                            }
                            loginfo.QualityOP20To1 = ((StandardValue + oldvalue * 1.0 / cofOP20.DecimalPlaces).ToString());
                        }
                        break;
                    case "OP60":
                        var cofOP60to1 = qcofig.Where(o => o.ParamColName.Equals("QualityOP60To1")).FirstOrDefault();
                        if (cofOP60to1 != null && cofOP60to1.Id > 0)
                        {
                            double oldvalue = 0;
                            double StandardValue = 0;
                            var flag1 = double.TryParse(loginfo.QualityOP60To1, out oldvalue);
                            var flag2 = double.TryParse(cofOP60to1.StandardValue, out StandardValue);
                            if (!flag1 || !flag2)
                            {
                                return loginfo;
                            }
                            loginfo.QualityOP60To1 = ((StandardValue + oldvalue * 1.0 / cofOP60to1.DecimalPlaces).ToString());
                        }
                        var cofOP60to2 = qcofig.Where(o => o.ParamColName.Equals("QualityOP60To2")).FirstOrDefault();
                        if (cofOP60to2 != null && cofOP60to2.Id > 0)
                        {
                            double oldvalue = 0;
                            double StandardValue = 0;
                            var flag1 = double.TryParse(loginfo.QualityOP60To2, out oldvalue);
                            var flag2 = double.TryParse(cofOP60to2.StandardValue, out StandardValue);
                            if (!flag1 || !flag2)
                            {
                                return loginfo;
                            }
                            loginfo.QualityOP60To2 = ((StandardValue + oldvalue * 1.0 / (10 * cofOP60to2.DecimalPlaces)).ToString() + (string.IsNullOrEmpty(cofOP60to2.Unit) ? "" : cofOP60to2.Unit));
                        }
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
            }
            return loginfo;
        }
        /// <summary>
        /// è´¨é‡æ£€æµ‹å®Œæˆ
        /// </summary>
        /// <param name="logMiddle"></param>
        /// <param name="type"></param>
        public static void QualityInfoComplete(WorkPieceLogMiddle logMiddle, LogType type)
        {
            //此处同时插入了WorkPieceLog,WorkPieceInfoLog表,并新增或修改WorkPieceInfo表
            //插入质量相关表QualityDataInfo
            using (DbModel db = new DbModel())
            {
                bool isAddWorkPieceInfo = false;
                WorkPieceLog loginfo2 = new WorkPieceLog();
                loginfo2 = EntityPropHelper.Mapper<WorkPieceLog, WorkPieceLogMiddle>(logMiddle);
                try
                {
                    if (logMiddle.WorkPieceID.Length == 22)
                    {//获取到的工件号异常
                        WorkPieceInfo pieceInfo = new WorkPieceInfo();
                        pieceInfo = db.WorkPieceInfo.Where(o => o.WorkPieceID == logMiddle.WorkPieceID).FirstOrDefault();
                        if (pieceInfo == null || pieceInfo.WorkPieceID.Length < 1)
                        {//没有工件信息,不做更新
                            if (logMiddle.MonitoringPoint.Equals("OP1002") || logMiddle.MonitoringPoint.Equals("OP1003") || logMiddle.MonitoringPoint.Contains("OP2002"))
                            {//OP10 æ²¡æœ‰ä¸Šçº¿æ‰«ç æžªï¼Œçº¦å®šç”¨æµ‹é‡å®Œæˆä¿¡å·å½“上线标记
                                pieceInfo = EntityPropHelper.Mapper<WorkPieceInfo, WorkPieceLogMiddle>(logMiddle);
                                //EntityPropHelper<WorkPieceLog, WorkPieceInfo>.CopyProp(loginfo, info, loginfo.GetWorkPieceInfoDict());
                                if (!logMiddle.WorkingProcedure.Equals("OP05"))
                                {//当工件二维码第一次出现的工序不是OP05,则设置为可疑状态
                                    pieceInfo.QualityState = (int)QualityState.Suspected;
                                    pieceInfo.QualityErrorInfo = $"工件二维码第一次出现的工序{logMiddle.MonitoringPoint}不是OP05,数据缺失,请确认情况并做相应处理!";
                                    pieceInfo.Remarks = $"工件二维码第一次出现的工序{logMiddle.WorkingProcedure}不是OP05,数据缺失,请确认情况并做相应处理!";
                                }
                                else
                                {
                                    pieceInfo.QualityState = (int)QualityState.OK;//此处需要注意,判断所有工序质量,然后再赋值
                                    pieceInfo.Remarks = "OP05新增工件信息";
                                }
                                pieceInfo.WorkPieceinitOnlineTime = DateTimeHelper.GetDateTime();
                                pieceInfo.WorkingProcedurePlan = ConfigHelper.GetConfigString("WorkingProcedureAllStr") ?? "OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80";
                                pieceInfo.CreatedUserName = logMiddle.MonitoringPoint;
                                pieceInfo.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                                pieceInfo.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();//
                                pieceInfo.WorkingProcedureEndTime = null;
                                pieceInfo = ParseQRCode(pieceInfo);
                                isAddWorkPieceInfo = true;
                            }
                            else
                            {
                                loginfo2.Remarks = loginfo2.Remarks ?? "" + $"|工件{logMiddle.WorkPieceID} è´¨é‡æ£€æµ‹å®Œæˆå·¥åº{logMiddle.MonitoringPoint} æ²¡æœ‰èŽ·å–åˆ°å·¥ä»¶ä¿¡æ¯ä¸åšæ›´æ–°";
                                Log4NetHelper.WriteErrorLog(type, $"工件{logMiddle.WorkPieceID} è´¨é‡æ£€æµ‹å®Œæˆå·¥åº{logMiddle.MonitoringPoint} æ²¡æœ‰èŽ·å–åˆ°å·¥ä»¶ä¿¡æ¯ä¸åšæ›´æ–°");
                                return;
                            }
                        }
                        if (logMiddle.MonitoringPoint.Equals("OP1002") || logMiddle.MonitoringPoint.Equals("OP1003") || logMiddle.MonitoringPoint.Contains("OP2002"))
                        {// OP10 æ²¡æœ‰ä¸Šçº¿æ‰«ç æžªï¼Œçº¦å®šç”¨æµ‹é‡å®Œæˆä¿¡å·å½“上线标记,所以上线需要修改的字段放这里
                            if (logMiddle.WorkingProcedure.Equals("OP10"))
                            {
                                var WorkingProcedure = (logMiddle.MonitoringPoint.Equals("OP1002") ? "OP10" : "OP40");
                                loginfo2.WorkingProcedure = WorkingProcedure;//解决OP10,OP40同一个的问题
                                logMiddle.WorkingProcedure = WorkingProcedure;//解决OP10,OP40同一个的问题
                            }
                            pieceInfo.WorkPieceCurrentPosition = logMiddle.WorkingProcedure;
                            pieceInfo.WorkPieceCurrentPositionOrder = pieceInfo.WorkingProcedurePlan.IndexOf(logMiddle.WorkingProcedure) / 2;
                            pieceInfo.WorkingProcedureCurrent = logMiddle.WorkingProcedure;
                            pieceInfo.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();
                            #region æ›´æ–°è®¾å¤‡å®žæ—¶è¡¨
                            bool isAddEquipmentCurrentMonitor = false;
                            EquipmentCurrentMonitor equinfo = new EquipmentCurrentMonitor();
                            equinfo = db.EquipmentCurrentMonitor.Where(o => o.EquipmentID == logMiddle.EquipmentID).FirstOrDefault();
                            if (equinfo == null || equinfo.Id < 1)
                            {//没有工件信息,不做更新
                                Log4NetHelper.WriteErrorLog(type, $"设备{logMiddle.EquipmentID} å‘Šè­¦ç›‘控{logMiddle.WorkingProcedure} æ²¡æœ‰èŽ·å–åˆ°è®¾å¤‡ç›‘æŽ§ä¿¡æ¯ï¼ŒçŽ°æ–°å¢ž");
                                equinfo = EntityPropHelper.Mapper<EquipmentCurrentMonitor, WorkPieceLog>(logMiddle);
                                equinfo.OnlineTime = DateTime.Now;
                                isAddEquipmentCurrentMonitor = true;
                            }
                            else
                            {//更新工件
                                equinfo.WorkPieceID = logMiddle.WorkPieceID;
                                equinfo.UpdatedUserName = logMiddle.MonitoringPoint;
                                equinfo.UpdatedTime = DateTime.Now;
                                equinfo.OnlineTime = DateTime.Now;
                            }
                            if (isAddEquipmentCurrentMonitor)
                            {
                                equinfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                db.EquipmentCurrentMonitor.Add(equinfo);
                            }
                            #endregion
                            //UpdateKnifeToolLift(db, loginfo);//更新刀具寿命信息
                        }
                        pieceInfo.WorkPieceState = (int)WorkPieceState.WIP;//推出后和SPC抽检后 è´¨é‡å½•入时状态修改回在制品
                        pieceInfo.EquipmentID = logMiddle.EquipmentID;
                        pieceInfo.QualityStateUpdateUser = logMiddle.UpdatedUserName;
                        pieceInfo.QualityStateUpdateTime = logMiddle.UpdatedTime.Value.LocalDateTime;
                        pieceInfo.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
                        pieceInfo.Remarks = pieceInfo.Remarks ?? "" + $"{logMiddle.WorkingProcedure}质量检测完成修改";
                        pieceInfo.UpdatedUserName = logMiddle.MonitoringPoint;
                        pieceInfo.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                        if (!(pieceInfo.WorkingProcedureStartTime.HasValue && pieceInfo.WorkingProcedureStartTime > DateTime.Parse("1900/01/01")))
                        {//工序开始时间没有则赋值
                            pieceInfo.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();
                        }
                        pieceInfo.QualityState = (int)((logMiddle.QualityStateStr.Equals("OK") || logMiddle.QualityStateStr.Equals("0K")) ? QualityState.OK : QualityState.NG);
                        //赋值不合格原因
                        SetQualityNoOk_WorkPieceInfo(logMiddle, ref pieceInfo);
                        if (!pieceInfo.QualityState.Equals(((int)QualityState.OK).ToString()))
                        {
                            pieceInfo.QualityErrorInfo = $"{logMiddle.WorkingProcedure}工序质量采集数据不合格{pieceInfo.QualityState}";
                        }
                        else
                        {
                            pieceInfo.QualityErrorInfo = "";
                        }
                        logMiddle.QualityState = pieceInfo.QualityState;
                        if (isAddWorkPieceInfo)
                        {
                            db.WorkPieceInfo.Add(pieceInfo);
                        }
                        #region æ ¹æ®æ ‡å‡†å€¼æ›´æ–°æœ€æ–°è´¨é‡æ•°æ®ï¼ˆOP10/OP40/OP20/OP60)
                        var qcofig = db.EquipmentQualityConfig.Where(o => o.WorkingProcedure.Equals(logMiddle.WorkingProcedure) && o.ParamType != 1 && o.IsDeleted == false).ToList();
                        if (qcofig.Count > 0)
                        {
                            QualityDataHand(logMiddle, qcofig);
                        }
                        #endregion
                        var qualityData = db.QualityDataInfo.Where(o => o.WorkPieceID == logMiddle.WorkPieceID).FirstOrDefault();
                        if (qualityData == null || qualityData.WorkPieceID.Length < 1 || qualityData.WorkingProcedure.Length < 1)
                        {//插入QualityDataInfo表
                            qualityData = EntityPropHelper.Mapper<QualityDataInfo, WorkPieceLog>(logMiddle);
                            db.QualityDataInfo.Add(GetAddQualityDataInfo(qualityData));
                        }
                        //修改QualityDataInfo表 //重复收到质量信息,会覆盖之前的
                        EntityPropHelper<WorkPieceLogMiddle, QualityDataInfo>.CopyProp(logMiddle, qualityData, GetQualityDataInfoUpdate(logMiddle, logMiddle.WorkingProcedure, logMiddle.MonitoringPoint));//指定修改字段
                        qualityData.QualityStateUpdateUser = pieceInfo.UpdatedUserName;
                        qualityData.QualityReceiveTime = pieceInfo.UpdatedTime.Value.LocalDateTime;
                        qualityData.QualityStateUpdateMode = pieceInfo.QualityStateUpdateMode;
                        if (logMiddle.WorkingProcedure.Equals("OP10"))
                        {
                            qualityData.OP10QualityState = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                            qualityData.OP10QualityReceiveTime = DateTimeHelper.GetDateTime();
                        }
                        else if (logMiddle.WorkingProcedure.Equals("OP20"))
                        {
                            //Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}质量信息【{loginfo.QualityStateStr ?? "空"}】" +
                            //    $"【{(loginfo.QualityState.HasValue? loginfo.QualityState.Value:999)}】【{(info.QualityState.HasValue ? info.QualityState.Value : 888)}】 è¯»å–工件码数据[{loginfo.WorkPieceID ?? "空"}]");
                            qualityData.OP20QualityState = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                            qualityData.OP20QualityReceiveTime = DateTimeHelper.GetDateTime();
                            qualityData.OP20QualityFilePath = logMiddle.OP20QualityFilePath;
                        }
                        else if (logMiddle.WorkingProcedure.Equals("OP30"))
                        {
                            switch (logMiddle.MonitoringPoint)
                            {
                                case "OP3002CH3":
                                    qualityData.OP30QualityFilePathCH3 = logMiddle.OP30QualityFilePathCH3;
                                    qualityData.OP30QualityStateCH3 = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                                    qualityData.OP30QualityReceiveTimeCH3 = DateTimeHelper.GetDateTime();
                                    if (qualityData.OP30QualityStateCH3 == ((int)QualityState.NG).ToString())
                                    {
                                        logMiddle.QualityNoOk = (int)QualityNoOkEnum.OP30涨断工位力矩大;
                                        logMiddle.QualityNoOkReason = QualityNoOkEnum.OP30涨断工位力矩大.ToString();
                                        //赋值不合格原因
                                        SetQualityNoOk_WorkPieceInfo(logMiddle, ref pieceInfo);
                                    }
                                    break;
                                case "OP3002CH4":
                                    qualityData.OP30QualityFilePathCH4 = logMiddle.OP30QualityFilePathCH4;
                                    qualityData.OP30QualityStateCH4 = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                                    qualityData.OP30QualityReceiveTimeCH4 = DateTimeHelper.GetDateTime();
                                    if (qualityData.OP30QualityStateCH4 == ((int)QualityState.NG).ToString())
                                    {
                                        logMiddle.QualityNoOk = (int)QualityNoOkEnum.OP30预拧紧工位力矩大;
                                        logMiddle.QualityNoOkReason = QualityNoOkEnum.OP30预拧紧工位力矩大.ToString();
                                        //赋值不合格原因
                                        SetQualityNoOk_WorkPieceInfo(logMiddle, ref pieceInfo);
                                    }
                                    break;
                                case "OP3002CH5":
                                    qualityData.OP30QualityFilePathCH5 = logMiddle.OP30QualityFilePathCH5;
                                    qualityData.OP30QualityStateCH5 = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                                    qualityData.OP30QualityReceiveTimeCH5 = DateTimeHelper.GetDateTime();
                                    if (qualityData.OP30QualityStateCH5 == ((int)QualityState.NG).ToString())
                                    {
                                        logMiddle.QualityNoOk = (int)QualityNoOkEnum.OP30终拧紧工位力矩大;
                                        logMiddle.QualityNoOkReason = QualityNoOkEnum.OP30终拧紧工位力矩大.ToString();
                                        //赋值不合格原因
                                        SetQualityNoOk_WorkPieceInfo(logMiddle, ref pieceInfo);
                                    }
                                    break;
                                case "OP3002CH6":
                                    qualityData.OP30QualityFilePathCH6 = logMiddle.OP30QualityFilePathCH6;
                                    qualityData.OP30QualityStateCH6 = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                                    qualityData.OP30QualityReceiveTimeCH6 = DateTimeHelper.GetDateTime();
                                    if (qualityData.OP30QualityStateCH6 == ((int)QualityState.NG).ToString())
                                    {
                                        logMiddle.QualityNoOk = (int)QualityNoOkEnum.OP30压衬套工位力矩大;
                                        logMiddle.QualityNoOkReason = QualityNoOkEnum.OP30压衬套工位力矩大.ToString();
                                        //赋值不合格原因
                                        SetQualityNoOk_WorkPieceInfo(logMiddle, ref pieceInfo);
                                    }
                                    break;
                                default:
                                    break;
                            }
                            //qualityData.OP30QualityState = loginfo.QualityState.HasValue ? loginfo.QualityState.Value.ToString() : "3";
                            //qualityData.OP30QualityReceiveTime = DateTimeHelper.GetDateTime();
                        }
                        else if (logMiddle.WorkingProcedure.Equals("OP35"))
                        {
                            qualityData.OP35QualityState = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                            qualityData.OP35QualityReceiveTime = DateTimeHelper.GetDateTime();
                        }
                        else if (logMiddle.WorkingProcedure.Equals("OP40"))
                        {
                            qualityData.OP40QualityState = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                            qualityData.OP40QualityReceiveTime = DateTimeHelper.GetDateTime();
                        }
                        else if (logMiddle.WorkingProcedure.Equals("OP60"))
                        {
                            qualityData.OP60QualityFilePath = logMiddle.OP60QualityFilePath;
                            qualityData.OP60QualityState = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                            qualityData.OP60QualityReceiveTime = DateTimeHelper.GetDateTime();
                        }
                        else if (logMiddle.WorkingProcedure.Equals("OP80"))
                        {
                            qualityData.OP80QualityFilePath = logMiddle.OP80QualityFilePath;
                            qualityData.OP80QualityState = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                            qualityData.OP80QualityReceiveTime = DateTimeHelper.GetDateTime();
                        }
                        var pro = db.WorkPieceProcess.Where(o => o.WorkPieceID == logMiddle.WorkPieceID && o.WorkingProcedureCurrent == pieceInfo.WorkingProcedureCurrent && o.OperationType == OperationType.生产.ToString()).OrderByDescending(o => o.StartTime).FirstOrDefault();
                        if (pro == null || pro.WorkPieceID.Length < 1 || logMiddle.MonitoringPoint.Equals("OP1002") || logMiddle.MonitoringPoint.Equals("OP1003") || logMiddle.MonitoringPoint.Contains("OP2002"))
                        {// OP10 æ²¡æœ‰ä¸Šçº¿æ‰«ç æžªï¼Œçº¦å®šç”¨æµ‹é‡å®Œæˆä¿¡å·å½“上线标记,所以上线需要修改的字段放这里
                            //上线是每次都插入
                            WorkPieceProcess process = new WorkPieceProcess();
                            process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(pieceInfo);
                            process.StartTime = DateTimeHelper.GetDateTime();
                            process.QualityState = pieceInfo.QualityState.HasValue ? pieceInfo.QualityState.Value : (int)QualityState.OK;
                            //记录质量不合格原因 ã€Editby shaocx,2024-06-26】
                            //赋值不合格原因
                            SetQualityNoOk_WorkPieceProcess(logMiddle, ref process);
                            process.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                            process.CreatedUserName = logMiddle.MonitoringPoint;
                            process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                            process.UpdatedUserName = logMiddle.MonitoringPoint;
                            process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                            process.OperationType = OperationType.生产.ToString();
                            process.QualityDataInfoID = qualityData.Id;
                            process.Remarks = "";
                            db.WorkPieceProcess.Add(process);
                        }
                        else
                        {//其他的都只是修改
                            pro.QualityDataInfoID = qualityData.Id;
                            pro.UpdatedUserName = logMiddle.MonitoringPoint;
                            pro.UpdatedTime = DateTimeHelper.GetDateTime();
                            pro.QualityState = pieceInfo.QualityState.HasValue ? pieceInfo.QualityState.Value : 9;
                            //赋值不合格原因
                            SetQualityNoOk_WorkPieceProcess(logMiddle, ref pro);
                            //TODO:判断如果是60工序,那么就要更新pro表的创建人为loginfo.MonitoringPoint ã€Editby shaocx,2024-06-05】
                            if (logMiddle.WorkingProcedure == "OP60")
                            {
                                pro.CreatedUserName = logMiddle.MonitoringPoint;
                            }
                        }
                        if (logMiddle.QualityType != null && logMiddle.QualityType.Equals(QualityType.SPC.ToString()))
                        {//SPC反馈,
                            if (logMiddle.QualityState != (int)QualityState.OK)
                            {
                                //当某到工序检测到不合格工件时,从该工件加工完成时刻前指定时间起至报检不合格时间止,系统将该工件的最后加工工序在该时间段内加工的所有工件、正在加工的工件、该工序入口处的第一个工件全部标记为疑似状态,由人工复检工件并修改状态,并支持批量变更。
                                //答复:在线测量不需要走这个流程,只有SPC抽检才需要,需要把这时间段的工件全部置为疑似,哪怕是已完成工件
                                //时间段起始时间:抽检工件生产时间前一SPC抽检时间
                                //时间段结束时间:抽检工件质量结果出现后的时间
                                //抽检工件工序扫描枪外入口处的第一个工件 ä¹ŸæŠŠè´¨é‡çŠ¶æ€ç½®ä¸ºç–‘ä¼¼
                                //(每一工序SPC抽检是设置的固定的,比如200抽4,状态置为疑似时若工件还在设备内,会继续生产完毕后排出)
                                //目前这块逻辑放到了 WebAPI中了
                            }
                        }
                        db.WorkPieceInfoLog.Add(GetAddWorkPieceInfoLog(pieceInfo));
                        db.QualityDataInfoLog.Add(GetAddQualityDataInfoLog(qualityData));//插入日志
                    }
                    else
                    {
                        loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"质量检测完成读取二维码{logMiddle.WorkPieceID ?? "空"}异常";
                        Log4NetHelper.WriteErrorLog(type, $" {logMiddle.WorkingProcedure}工序监控读码标记 è¯»å–工件码数据[{logMiddle.WorkPieceID ?? "空"}]时异常:");
                    }
                }
                catch (Exception ex)
                {
                    loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"质量检测完成{logMiddle.WorkPieceID ?? "空"}更新数据异常{ex.Message}++{ex.StackTrace}";
                    Log4NetHelper.WriteErrorLog(type, $" {logMiddle.WorkingProcedure}工序监控读码标记 è¯»å–工件码数据[{logMiddle.WorkPieceID ?? "空"}]时异常:");
                }
                finally
                {
                    loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"质量:{logMiddle.QualityStateStr ?? "空"}";
                    db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo2));//插入工件采集日志表
                    db.SaveChanges();
                }
            }
        }
        /// <summary>
        /// å·¥ä»¶æŽ¨å‡ºNOOK
        /// </summary>
        /// <param name="loginfo"></param>
        /// <param name="type"></param>
        public static void WorkPiecePushOff(WorkPieceLogMiddle loginfo, LogType type)
        {
            using (DbModel db = new DbModel())
            {
                WorkPieceLog loginfo2 = new WorkPieceLog();
                loginfo2 = EntityPropHelper.Mapper<WorkPieceLog, WorkPieceLogMiddle>(loginfo);
                try
                {
                    if (loginfo.WorkPieceID != null && loginfo.WorkPieceID.Trim('\0').Length == 22)
                    {
                        WorkPieceInfo info = new WorkPieceInfo();
                        info = db.WorkPieceInfo.Where(o => o.WorkPieceID == loginfo.WorkPieceID).FirstOrDefault();
                        if (info == null || info.WorkPieceID.Length < 1)
                        {//没有工件信息,不做更新
                            Log4NetHelper.WriteErrorLog(type, $"工件{loginfo.WorkPieceID} å·¥ä»¶æŽ¨å‡ºå·¥åº{loginfo.WorkingProcedure} æ²¡æœ‰èŽ·å–åˆ°å·¥ä»¶ä¿¡æ¯ä¸åšæ›´æ–°");
                            return;
                        }
                        else
                        {//更新表WorkPieceInfo
                            if (loginfo.WorkingProcedure.Equals("OP10"))
                            {
                                info.WorkPieceCurrentPosition = info.WorkingProcedureCurrent + "NOOK";
                                //var WorkingProcedure = (loginfo.MonitoringPoint.Equals("OP1002") ? "OP10" : "OP40");
                                loginfo2.WorkingProcedure = info.WorkingProcedureCurrent;//解决OP10,OP40同一个的问题
                                loginfo.WorkingProcedure = info.WorkingProcedureCurrent; //解决OP10,OP40同一个的问题
                            }
                            else
                            {
                                info.WorkingProcedureCurrent = loginfo.WorkingProcedure;
                                info.WorkPieceCurrentPosition = loginfo.WorkingProcedure + "NOOK";
                            }
                            info.WorkPieceState = (int)WorkPieceState.NOOKPush;
                            info.UpdatedUserName = loginfo.MonitoringPoint;
                            info.UpdatedTime = DateTime.Now;
                            info.Remarks = "工件NOOK推出";
                            if (!(info.WorkingProcedureStartTime.HasValue && info.WorkingProcedureStartTime > DateTime.Parse("1900/01/01")))
                            {
                                info.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();
                            }
                            info.WorkingProcedureEndTime = DateTimeHelper.GetDateTime();
                            info.WorkingProcedureCompleted = info.WorkingProcedureCompleted + loginfo.WorkingProcedure;//已完成工序
                            info.WorkPieceCurrentPositionOrder = info.WorkingProcedurePlan.IndexOf(loginfo.WorkingProcedure) / 2;
                        }
                        if (loginfo.WorkingProcedure.Equals("OP35"))
                        {//为了解决OP35的采集到的质量信息是OK还NOOK的情况,OP35 NOOK时更新质量信息
                            loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"OP35NOOK原质量信息{(info.QualityState.HasValue ? info.QualityState.Value.ToString() : "空")}";
                            info.QualityState = (int)QualityState.NG;
                            if (!info.QualityState.Equals(((int)QualityState.OK).ToString()))
                            {
                                info.QualityErrorInfo = $"{loginfo.WorkingProcedure}工序质量NOOK采集数据不合格{info.QualityState}";
                            }
                            else
                            {
                                info.QualityErrorInfo = "";
                            }
                            loginfo.QualityState = info.QualityState;
                            var qualityData = db.QualityDataInfo.Where(o => o.WorkPieceID == loginfo.WorkPieceID).FirstOrDefault();
                            if (qualityData != null)
                            {
                                qualityData.OP35QualityState = loginfo.QualityState.HasValue ? loginfo.QualityState.Value.ToString() : "3";
                                qualityData.OP35QualityReceiveTime = DateTimeHelper.GetDateTime();
                                db.QualityDataInfoLog.Add(GetAddQualityDataInfoLog(qualityData));
                            }
                        }
                        //更新上一工序的结束时间
                        var pro = db.WorkPieceProcess.Where(o => o.WorkPieceID == loginfo.WorkPieceID && o.WorkingProcedureCurrent == loginfo.WorkingProcedure && o.OperationType == OperationType.生产.ToString()).OrderByDescending(o => o.StartTime).FirstOrDefault();
                        if (pro != null && pro.WorkPieceID.Length > 0)
                        {
                            pro.EndTime = DateTimeHelper.GetDateTime();
                            pro.Remarks = (pro.Remarks ?? "") + "NOOK结束";
                            pro.UpdatedUserName = loginfo.MonitoringPoint;
                            pro.UpdatedTime = DateTimeHelper.GetDateTime();
                        }
                        db.WorkPieceInfoLog.Add(GetAddWorkPieceInfoLog(info));
                    }
                    else
                    {
                        loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"工件NOOK推出读取二维码{loginfo.WorkPieceID ?? "空"}异常";
                        Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}工件NOOK推出读码标记 è¯»å–工件码数据[{loginfo.WorkPieceID ?? "空"}]时异常:");
                    }
                }
                catch (Exception e)
                {
                    loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"读取二维码{loginfo.WorkPieceID ?? "空"}更新数据异常{e.Message}";
                }
                db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo2));//插入工件采集日志表
                db.SaveChanges();
            }
        }
        /// <summary>
        /// å·¥ä»¶SPC抽检推出
        /// </summary>
        /// <param name="loginfo"></param>
        /// <param name="type"></param>
        public static void WorkPieceSPCPushOff(WorkPieceLogMiddle loginfo, LogType type)
        {
            using (DbModel db = new DbModel())
            {
                WorkPieceLog loginfo2 = new WorkPieceLog();
                loginfo2 = EntityPropHelper.Mapper<WorkPieceLog, WorkPieceLogMiddle>(loginfo);
                try
                {
                    if ((loginfo.WorkPieceID != null && loginfo.WorkPieceID.Trim('\0').Length == 22)
                        //|| !((loginfo.WorkingProcedure.Equals("OP10") || loginfo.WorkingProcedure.Equals("OP40")) && loginfo.Remarks.Length > 0)
                        )
                    {
                        WorkPieceInfo info = new WorkPieceInfo();
                        info = db.WorkPieceInfo.Where(o => o.WorkPieceID == loginfo.WorkPieceID).FirstOrDefault();
                        if (info == null || info.WorkPieceID.Length < 1)
                        {//没有工件信息,不做更新
                            loginfo2.Remarks = $"工件{loginfo.WorkPieceID} å·¥ä»¶SPC推出工序{loginfo.WorkingProcedure} æ²¡æœ‰èŽ·å–åˆ°å·¥ä»¶ä¿¡æ¯ä¸åšæ›´æ–°";
                            Log4NetHelper.WriteErrorLog(type, $"工件{loginfo.WorkPieceID} å·¥ä»¶SPC推出工序{loginfo.WorkingProcedure} æ²¡æœ‰èŽ·å–åˆ°å·¥ä»¶ä¿¡æ¯ä¸åšæ›´æ–°");
                            return;
                        }
                        else
                        {//更新表WorkPieceInfo
                            if (loginfo.WorkingProcedure.Equals("OP10"))
                            {
                                info.WorkPieceCurrentPosition = info.WorkingProcedureCurrent + "SPC";
                                //var WorkingProcedure = (loginfo.MonitoringPoint.Equals("OP1002") ? "OP10" : "OP40");
                                loginfo2.WorkingProcedure = info.WorkingProcedureCurrent;//解决OP10,OP40同一个的问题
                                loginfo.WorkingProcedure = info.WorkingProcedureCurrent; //解决OP10,OP40同一个的问题
                            }
                            else
                            {
                                info.WorkingProcedureCurrent = loginfo.WorkingProcedure;
                                info.WorkPieceCurrentPosition = loginfo.WorkingProcedure + "SPC";
                            }
                            info.WorkPieceState = (int)WorkPieceState.SPCPush;
                            info.UpdatedUserName = loginfo.MonitoringPoint;
                            info.UpdatedTime = DateTime.Now;
                            info.WorkingProcedureEndTime = DateTimeHelper.GetDateTime();
                            if (!(info.WorkingProcedureStartTime.HasValue && info.WorkingProcedureStartTime > DateTime.Parse("1900/01/01")))
                            {
                                info.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();
                            }
                            info.WorkingProcedureCompleted = info.WorkingProcedureCompleted + loginfo.WorkingProcedure;//已完成工序
                            info.WorkPieceCurrentPositionOrder = info.WorkingProcedurePlan.IndexOf(loginfo.WorkingProcedure) / 2;
                        }
                        info.Remarks = "工件SPC抽检推出";
                        //更新上一工序的结束时间
                        var pro = db.WorkPieceProcess.Where(o => o.WorkPieceID == loginfo.WorkPieceID && o.WorkingProcedureCurrent == loginfo.WorkingProcedure && o.OperationType == OperationType.生产.ToString()).OrderByDescending(o => o.StartTime).FirstOrDefault();
                        if (pro != null && pro.WorkPieceID.Length > 0)
                        {
                            pro.EndTime = DateTimeHelper.GetDateTime();
                            pro.Remarks = (pro.Remarks ?? "") + "SPC抽检结束";
                            pro.UpdatedUserName = loginfo.MonitoringPoint;
                            pro.UpdatedTime = DateTimeHelper.GetDateTime();
                        }
                        //每次SPC éƒ½æ’入追溯表
                        WorkPieceProcess process = new WorkPieceProcess();
                        process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(info);
                        process.StartTime = DateTimeHelper.GetDateTime();
                        process.OperationType = OperationType.SPC.ToString();
                        process.QualityState = (int)QualityState.Suspected;
                        process.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                        process.CreatedUserName = loginfo.MonitoringPoint;
                        process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                        process.UpdatedUserName = loginfo.MonitoringPoint;
                        process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                        process.Remarks = "工件SPC抽检推出";
                        db.WorkPieceProcess.Add(process);
                        db.WorkPieceInfoLog.Add(GetAddWorkPieceInfoLog(info));
                    }
                    else
                    {
                        loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"工件SPC抽检推出读取二维码{loginfo.WorkPieceID ?? "空"}异常";
                        Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}工件SPC抽检推出读码标记 è¯»å–工件码数据[{loginfo.WorkPieceID ?? "空"}]时异常:");
                    }
                }
                catch (Exception e)
                {
                    loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"读取二维码{loginfo.WorkPieceID ?? "空"}更新数据异常{e.Message}";
                }
                finally
                {
                    db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo2));//插入工件采集日志表
                    db.SaveChanges();
                }
            }
        }
        /// <summary>
        /// å·¥åºå®Œæˆ
        /// </summary>
        /// <param name="logMiddle"></param>
        /// <param name="type"></param>
        public static void WorkingProcedureComplete(WorkPieceLogMiddle logMiddle, LogType type)
        {
            using (DbModel db = new DbModel())
            {
                if (logMiddle.WorkingProcedure.Equals("OP70"))
                {
                    logMiddle.QualityState = (int)QualityState.OK; //如果是OP70,则默认是合格 ã€Editby shaocx,2024-06-25】
                }
                WorkPieceLog loginfo2 = new WorkPieceLog();
                loginfo2 = EntityPropHelper.Mapper<WorkPieceLog, WorkPieceLogMiddle>(logMiddle);
                try
                {
                    if (logMiddle.WorkPieceID != null && logMiddle.WorkPieceID.Trim('\0').Length == 22)
                    {
                        bool isAddWorkPieceInfo = false;
                        WorkPieceInfo info = new WorkPieceInfo();
                        info = db.WorkPieceInfo.Where(o => o.WorkPieceID == logMiddle.WorkPieceID).FirstOrDefault();
                        if (info == null || info.WorkPieceID.Length < 1)
                        {//没有工件信息,不做更新  ï¼ˆä¸ºäº†æµ‹è¯•先先新增)
                            Log4NetHelper.WriteErrorLog(type, $"工件{logMiddle.WorkPieceID} å·¥ä»¶æŽ¨å‡ºå·¥åº{logMiddle.WorkingProcedure} æ²¡æœ‰èŽ·å–åˆ°å·¥ä»¶ä¿¡æ¯ä¸åšæ›´æ–°");
                            //db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo));//插入工件采集日志表
                            //db.SaveChanges();
                            loginfo2 = CommonManager.Instance.GetWorkPieceID(logMiddle, type);
                            info = EntityPropHelper.Mapper<WorkPieceInfo, WorkPieceLog>(logMiddle);
                            //EntityPropHelper<WorkPieceLog, WorkPieceInfo>.CopyProp(loginfo, info, loginfo.GetWorkPieceInfoDict());
                            if (!logMiddle.WorkingProcedure.Equals("OP05"))
                            {//当工件二维码第一次出现的工序不是OP05,则设置为可疑状态
                                info.QualityState = (int)QualityState.Suspected;
                                info.QualityErrorInfo = $"工件二维码第一次出现的工序{logMiddle.MonitoringPoint}不是OP05,数据缺失,请确认情况并做相应处理!";
                                info.Remarks = $"工件二维码第一次出现的工序{logMiddle.MonitoringPoint}不是OP05,数据缺失,请确认情况并做相应处理!";
                            }
                            else
                            {
                                info.QualityState = (int)QualityState.OK;//此处需要注意,判断所有工序质量,然后再赋值
                                info.Remarks = "OP05新增工件信息";
                            }
                            info.WorkPieceinitOnlineTime = DateTimeHelper.GetDateTime();//WorkPieceInitOnlineTime
                            info.WorkingProcedurePlan = ConfigHelper.GetConfigString("WorkingProcedureAllStr") ?? "OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80";
                            info.CreatedUserName = logMiddle.MonitoringPoint;
                            info.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                            info.WorkingProcedureCurrent = logMiddle.WorkingProcedure;
                            info.WorkingProcedureEndTime = null;
                            info = ParseQRCode(info);
                            isAddWorkPieceInfo = true;
                        }
                        if (logMiddle.WorkingProcedure.Equals("OP10"))
                        {
                            //var WorkingProcedure = (loginfo.MonitoringPoint.Equals("OP1002") ? "OP10" : "OP40");
                            loginfo2.WorkingProcedure = info.WorkingProcedureCurrent;//解决OP10,OP40同一个的问题
                            logMiddle.WorkingProcedure = info.WorkingProcedureCurrent; //解决OP10,OP40同一个的问题
                        }
                        info.UpdatedUserName = logMiddle.MonitoringPoint;
                        info.UpdatedTime = DateTimeHelper.GetDateTime();
                        info.WorkingProcedureCompleted = info.WorkingProcedureCompleted + logMiddle.WorkingProcedure;//已完成工序
                        if (!(info.WorkingProcedureStartTime.HasValue && info.WorkingProcedureStartTime > DateTime.Parse("1900/01/01")))
                        {//若一直没有工序开始时间,则赋值当前时间
                            info.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();
                        }
                        info.WorkingProcedureEndTime = DateTimeHelper.GetDateTime();
                        info.WorkPieceCurrentPositionOrder = info.WorkingProcedurePlan.IndexOf(logMiddle.WorkingProcedure) / 2;
                        info.Remarks = $"{logMiddle.WorkingProcedure}工序完成";
                        long op80id = 0;
                        if (logMiddle.WorkingProcedure.Equals("OP80"))
                        {
                            info.WorkPieceState = (int)WorkPieceState.FinishedProducts;
                            info.WorkPieceLastOfflineTime = DateTimeHelper.GetDateTime();
                            info.WorkPieceCurrentPosition = "OP80";
                            info.CompleteTime = DateTimeHelper.GetDateTime();
                            info.OP80NewCode = logMiddle.OP80NewCode;
                            //质检数据改为 èŽ·å–æ–‡ä»¶åŽä¿®æ”¹ ã€Editby shaocx,2024-06-15】
                            /*
                            info.QualityState = (int)((loginfo.QualityStateStr.Equals("OK") || loginfo.QualityStateStr.Equals("0K")) ? QualityState.OK : QualityState.NG);
                            loginfo.QualityState = info.QualityState;
                            info.QualityStateUpdateUser = loginfo.UpdatedUserName;
                            info.QualityStateUpdateTime = loginfo.UpdatedTime.Value.LocalDateTime;
                            info.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
                            //*/
                            var qualityData = db.QualityDataInfo.Where(o => o.WorkPieceID == logMiddle.WorkPieceID).FirstOrDefault();
                            if (qualityData == null || qualityData.WorkPieceID.Length < 1 || qualityData.WorkingProcedure.Length < 1)
                            {//插入QualityDataInfo表
                                qualityData = EntityPropHelper.Mapper<QualityDataInfo, WorkPieceLog>(logMiddle);
                                db.QualityDataInfo.Add(GetAddQualityDataInfo(qualityData));
                            }
                            //修改QualityDataInfo表 //重复收到质量信息,会覆盖之前的
                            EntityPropHelper<WorkPieceLogMiddle, QualityDataInfo>.CopyProp(logMiddle, qualityData, GetQualityDataInfoUpdate(logMiddle, logMiddle.WorkingProcedure, logMiddle.MonitoringPoint));//指定修改字段
                            //质检数据改为 èŽ·å–æ–‡ä»¶åŽä¿®æ”¹ ã€Editby shaocx,2024-06-15】
                            /*
                            qualityData.QualityStateUpdateUser = info.UpdatedUserName;
                            qualityData.QualityReceiveTime = info.UpdatedTime.Value.LocalDateTime;
                            qualityData.QualityStateUpdateMode = info.QualityStateUpdateMode;
                            qualityData.OP80QualityState = loginfo.QualityState.HasValue ? loginfo.QualityState.Value.ToString() : "3";
                            qualityData.OP80QualityReceiveTime = DateTimeHelper.GetDateTime();
                            qualityData.OP80QualityFilePath = loginfo.OP80QualityFilePath;
                            op80id = qualityData.Id;
                            loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"质量:{loginfo.QualityStateStr ?? "空"}";
                            if (!info.QualityState.Equals(((int)QualityState.OK).ToString()))
                            {
                                info.QualityErrorInfo = $"{loginfo.WorkingProcedure}工序质量采集数据不合格";
                            }
                            else
                            {
                                info.QualityErrorInfo = "";
                            }
                            //*/
                        }
                        else if (logMiddle.WorkingProcedure.Equals("OP30"))
                        {
                            info.QualityState = (int)((logMiddle.QualityStateStr.Equals("OK") || logMiddle.QualityStateStr.Equals("0K")) ? QualityState.OK : QualityState.NG);
                            logMiddle.QualityState = info.QualityState;
                            info.QualityStateUpdateUser = logMiddle.UpdatedUserName;
                            info.QualityStateUpdateTime = logMiddle.UpdatedTime.Value.LocalDateTime;
                            info.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
                            var qualityData = db.QualityDataInfo.Where(o => o.WorkPieceID == logMiddle.WorkPieceID).FirstOrDefault();
                            if (qualityData == null || qualityData.WorkPieceID.Length < 1 || qualityData.WorkingProcedure.Length < 1)
                            {//插入QualityDataInfo表
                                qualityData = EntityPropHelper.Mapper<QualityDataInfo, WorkPieceLog>(logMiddle);
                                db.QualityDataInfo.Add(GetAddQualityDataInfo(qualityData));
                            }
                            qualityData.QualityStateUpdateUser = info.UpdatedUserName;
                            qualityData.QualityReceiveTime = info.UpdatedTime.Value.LocalDateTime;
                            qualityData.QualityStateUpdateMode = info.QualityStateUpdateMode;
                            qualityData.OP30QualityState = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value.ToString() : "3";
                            qualityData.OP30QualityReceiveTime = DateTimeHelper.GetDateTime();
                            loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"质量:{logMiddle.QualityStateStr ?? "空"}";
                            if (!info.QualityState.Equals(((int)QualityState.OK).ToString()))
                            {
                                info.QualityErrorInfo = $"{logMiddle.WorkingProcedure}工序质量采集数据不合格";
                            }
                            else
                            {
                                info.QualityErrorInfo = "";
                            }
                        }
                        else
                        {
                            info.WorkPieceState = (int)WorkPieceState.WIP;
                            if (info.WorkingProcedurePlan.IndexOf(logMiddle.WorkingProcedure) + 4 <= info.WorkingProcedurePlan.Length)
                            {
                                info.WorkPieceCurrentPosition = info.WorkingProcedurePlan.Substring(info.WorkingProcedurePlan.IndexOf(logMiddle.WorkingProcedure), 8);
                            }
                        }
                        var pro = db.WorkPieceProcess.Where(o => o.WorkPieceID == logMiddle.WorkPieceID && o.WorkingProcedureCurrent == info.WorkingProcedureCurrent && o.OperationType == OperationType.生产.ToString()).OrderByDescending(o => o.StartTime).FirstOrDefault();
                        if (pro == null || pro.WorkPieceID.Length < 1)
                        {
                            WorkPieceProcess process = new WorkPieceProcess();
                            process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(info);
                            process.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                            process.StartTime = DateTimeHelper.GetDateTime();
                            process.EndTime = DateTimeHelper.GetDateTime();
                            if (logMiddle.WorkingProcedure.Equals("OP80"))
                            {//OP80的质量数据是后来获取文件搞的
                            }
                            else
                            {
                                process.QualityState = logMiddle.QualityState.HasValue ? logMiddle.QualityState.Value : (int)QualityState.OK;
                            }
                            process.CreatedUserName = logMiddle.MonitoringPoint;
                            process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                            process.UpdatedUserName = logMiddle.MonitoringPoint;
                            process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                            process.OperationType = OperationType.生产.ToString();
                            process.Remarks = "";
                            if (logMiddle.WorkingProcedure.Equals("OP80"))
                            {
                                process.GetQcDataFlag = logMiddle.GetQcDataFlag;//赋值标记 [Editby shaocx,2024-06-15]
                            }
                            if (op80id > 0)
                            {
                                process.QualityDataInfoID = op80id;
                            }
                            db.WorkPieceProcess.Add(process);
                        }
                        else
                        {
                            if (op80id > 0)
                            {
                                pro.QualityDataInfoID = op80id;
                            }
                            pro.EndTime = DateTimeHelper.GetDateTime();
                            pro.UpdatedUserName = logMiddle.MonitoringPoint;
                            pro.UpdatedTime = DateTimeHelper.GetDateTime();
                            if (logMiddle.WorkingProcedure.Equals("OP80"))
                            {
                                if (pro.GetQcDataFlag != 0)
                                {
                                    pro.GetQcDataFlag = logMiddle.GetQcDataFlag;//赋值标记 [Editby shaocx,2024-06-15]
                                }
                            }
                        }
                        if (isAddWorkPieceInfo)
                        {
                            db.WorkPieceInfo.Add(info);
                        }
                        db.WorkPieceInfoLog.Add(GetAddWorkPieceInfoLog(info));
                    }
                    else
                    {
                        loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"下线完成读取二维码{logMiddle.WorkPieceID ?? "空"}异常";
                        Log4NetHelper.WriteErrorLog(type, $" {logMiddle.WorkingProcedure}工序下线 è¯»å–工件码数据[{logMiddle.WorkPieceID ?? "空"}]时异常:");
                    }
                }
                catch (Exception e)
                {
                    loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"读取二维码{logMiddle.WorkPieceID ?? "空"}更新数据异常{e.Message}";
                }
                db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo2));//插入工件采集日志表
                db.SaveChanges();
            }
        }
        public static void AlertMonitor(WorkPieceLog loginfo, LogType type)
        {
        }
        /// <summary>
        /// è®¾å¤‡å‘Šè­¦ç›‘控(清洗液,切削液,刀具告警等)
        /// </summary>
        /// <param name="loginfo"></param>
        /// <param name="type"></param>
        public static void AlertMonitor(LogType type)
        {
            using (DbModel db = new DbModel())
            {
                bool isAddAlert = false;
                try
                {
                    var equipmentlist = db.EquipmentBaseInfo.Where(o => o.IsDeleted == false).ToList();
                    var alertlist = db.v_get_equipment_alert.Where(o => o.IsDeleted == false).ToList();
                    var knifetoolbase = db.KnifeToolBaseInfo.Where(o => o.IsDeleted == false).ToList();
                    var knifetoolinfo = db.KnifeToolEquipmentInfo.Where(o => o.IsDeleted == false).ToList();
                    //var knifelist = db.KnifeToolEquipmentInfo.GroupJoin(db.KnifeToolBaseInfo.Where(o => o.IsDeleted == false).ToList(), a => a.EquipmentID, b => b.EquipmentID, (a, b) => new { a,b})
                    //.SelectMany(ab => ab.b.DefaultIfEmpty(), (ab, b) => new { ab.a, b.KnifeToolChangeAlertThreshold,b.KnifeToolLife })
                    //.Where(o => o.a.IsDeleted == false)
                    //.ToList();
                    foreach (var item in equipmentlist)
                    {
                        try
                        {
                            var alert = alertlist.Where(o => o.EquipmentId.Equals(item.EquipmentId)).FirstOrDefault();
                            if (alert == null || alert.Id < 1)
                            {
                                alert = EntityPropHelper.Mapper<v_get_equipment_alert, EquipmentBaseInfo>(item);
                                isAddAlert = true;
                            }
                            //if(item.WorkingProcedure.Equals("OP70"))
                            {
                                if (item.Detergentchangetime.HasValue)
                                {
                                    if (item.Detergentchangetime.Value.AddDays(item.DetergentChangeAlertThreshold).Date <= DateTime.Now.Date)
                                    {//op70清洗液告警
                                        alert.IsAlertDetergent = true;
                                        alert.Detergentchangetime = item.Detergentchangetime;
                                        alert.DetergentChangeAlertThreshold = item.DetergentChangeAlertThreshold;
                                        alert.DetergentChangeCycle = item.DetergentChangeCycle;
                                        alert.DetergentDesc = $"设备【{item.EquipmentName}】清洗液最新更换时间为【{item.Detergentchangetime.Value}】,已达到告警阈值,请注意!";
                                    }
                                    else
                                    {
                                        alert.IsAlertDetergent = false;
                                        alert.DetergentDesc = "";
                                    }
                                }
                                else
                                {
                                    alert.IsAlertDetergent = false;
                                    alert.DetergentDesc = "";
                                }
                            }
                            //if (!item.WorkingProcedure.Equals("OP05")&& !item.WorkingProcedure.Equals("OP30") && !item.WorkingProcedure.Equals("OP70") && !item.WorkingProcedure.Equals("OP80"))
                            {
                                if (item.CuttingFluidChangeTime.HasValue)
                                {
                                    if (item.CuttingFluidChangeTime.Value.AddDays(item.CuttingFluidChangeAlertThreshold).Date <= DateTime.Now.Date)
                                    {//切削液告警
                                        alert.IsAlertCuttingFluid = true;
                                        alert.CuttingFluidChangeTime = item.CuttingFluidChangeTime;
                                        alert.CuttingFluidChangeAlertThreshold = item.CuttingFluidChangeAlertThreshold;
                                        alert.CuttingFluidDesc = $"设备【{item.EquipmentName}】切削液最新更换时间为【{item.CuttingFluidChangeTime.Value}】,已达到告警阈值,请注意!";
                                    }
                                    else
                                    {
                                        alert.IsAlertCuttingFluid = false;
                                        alert.CuttingFluidDesc = "";
                                    }
                                }
                                else
                                {
                                    alert.IsAlertCuttingFluid = false;
                                    alert.CuttingFluidDesc = "";
                                }
                            }
                            bool flag = false;
                            string desc = $"设备【{item.EquipmentName}】";
                            foreach (var knife in knifetoolinfo.Where(o => o.EquipmentID.Equals(item.EquipmentId)))
                            {
                                var list = knifetoolbase.Where(o => o.KnifeToolID.Equals(knife.KnifeToolID)).FirstOrDefault();
                                if (list != null)
                                {
                                    if ((knife.CurrentLife + list.KnifeToolChangeAlertThreshold) >= list.KnifeToolLife)
                                    {//刀具告警
                                        flag = true;
                                        alert.IsAlertKnifeTool = true;
                                        alert.KnifeToolChangeAlertThreshold = list.KnifeToolChangeAlertThreshold;
                                        desc += $"\r\n工位【{knife.Station}】上刀具【{knife.KnifeToolID}】计划寿命【{list.KnifeToolLife}】次,当前已使用寿命【{knife.CurrentLife}】次,已达到告警阈值,请注意!";
                                    }
                                }
                            }
                            if (!flag)
                            {//没有刀具告警
                                alert.IsAlertKnifeTool = false;
                                alert.KnifeToolDesc = "";
                            }
                            else
                            {
                                alert.IsAlertKnifeTool = true;
                                alert.KnifeToolDesc = desc;
                            }
                            EquipmentCurrentMonitor info = new EquipmentCurrentMonitor();
                            info = db.EquipmentCurrentMonitor.Where(o => o.EquipmentID == item.EquipmentId).FirstOrDefault();
                            if (info == null || info.Id < 1)
                            {//没有工件信息,不做更新
                                Log4NetHelper.WriteErrorLog(type, $"设备{item.EquipmentId} è®¡ç®—告警{item.WorkingProcedure} æ²¡æœ‰èŽ·å–åˆ°è®¾å¤‡ç›‘æŽ§ä¿¡æ¯ï¼");
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(info.Alertmsg))
                                {
                                    alert.IsAlert = false;
                                    alert.AlertDesc = "";
                                }
                                else
                                {
                                    alert.IsAlert = true;
                                    alert.AlertDesc = info.Alertmsg;
                                }
                            }
                            if (isAddAlert)
                            {
                                db.v_get_equipment_alert.Add(alert);
                            }
                        }
                        catch (Exception ex)
                        {
                            Log4NetHelper.WriteErrorLog(type, $" {item.EquipmentName}设备计算告警时异常:");
                        }
                    }
                }
                catch (Exception e)
                {
                    Log4NetHelper.WriteErrorLog(type, $" è®¾å¤‡å‘Šè­¦ç›‘控(清洗液,切削液,刀具告警等) è®¡ç®—时异常:{e.Message} {e.StackTrace}");
                }
                //db.WorkPieceLog.Add(loginfo2);//插入设备采集日志表
                db.SaveChanges();
            }
        }
        /// <summary>
        /// è®¾å¤‡ç›‘控
        /// </summary>
        /// <param name="loginfo"></param>
        /// <param name="type"></param>
        public static void EquipmentMonitor(WorkPieceLogMiddle loginfo, LogType type)
        {
            using (DbModel db = new DbModel())
            {
                var loginfo2 = EntityPropHelper.Mapper<WorkPieceLog, WorkPieceLogMiddle>(loginfo);
                try
                {
                    bool isAddEquipmentCurrentMonitor = false;
                    EquipmentCurrentMonitor info = new EquipmentCurrentMonitor();
                    info = db.EquipmentCurrentMonitor.Where(o => o.EquipmentID == loginfo.EquipmentID).FirstOrDefault();
                    if (info == null || info.Id < 1)
                    {//没有工件信息,不做更新
                        Log4NetHelper.WriteErrorLog(type, $"设备{loginfo.EquipmentID} å‘Šè­¦ç›‘控{loginfo.MonitoringPoint} æ²¡æœ‰èŽ·å–åˆ°è®¾å¤‡ç›‘æŽ§ä¿¡æ¯ï¼ŒçŽ°æ–°å¢ž");
                        info = EntityPropHelper.Mapper<EquipmentCurrentMonitor, WorkPieceLogMiddle>(loginfo);
                        isAddEquipmentCurrentMonitor = true;
                    }
                    //最新设备状态
                    string State = "";
                    //OP20,OP30,OP35,OP50,OP60等等都不区分告警和message,但code都不会重复,所以本处就不需要判断告警类型了
                    var codelist = db.EquipmentFailureCode.Where(o => o.WorkingProcedure.Equals(loginfo.WorkingProcedure)).ToList();
                    #region æ•…障代码处理
                    List<long> Failueslist = new List<long>();
                    Failueslist.Add(loginfo.FailureType1);
                    Failueslist.Add(loginfo.FailureType2);
                    Failueslist.Add(loginfo.FailureType3);
                    Failueslist.Add(loginfo.FailureType4);
                    Failueslist.Add(loginfo.FailureType5);
                    Failueslist.Add(loginfo.FailureType6);
                    Failueslist.Add(loginfo.FailureType7);
                    Failueslist.Add(loginfo.FailureType8);
                    Failueslist.Add(loginfo.FailureType9);
                    Failueslist.Add(loginfo.FailureType10);
                    Failueslist.Add(loginfo.FailureType11);
                    Failueslist.Add(loginfo.FailureType12);
                    Failueslist.Add(loginfo.FailureType13);
                    Failueslist.Add(loginfo.FailureType14);
                    Failueslist.Add(loginfo.FailureType15);
                    Failueslist.Add(loginfo.FailureType16);
                    Failueslist.Add(loginfo.FailureType17);
                    Failueslist.Add(loginfo.FailureType18);
                    Failueslist.Add(loginfo.FailureType19);
                    Failueslist.Add(loginfo.FailureType20);
                    Failueslist.RemoveAll(o => o == 0);
                    string faultall = "";
                    string faultmsg = "";
                    int i = 1;
                    foreach (var failues in Failueslist)
                    {
                        faultall += (failues + "\r\n");
                        EquipmentFailureCode codeinfo = codelist.Where(o => o.Code == failues.ToString()).FirstOrDefault();
                        if (codeinfo != null && codeinfo.Code.Length > 0)
                        {
                            faultmsg += (i.ToString() + "." + (codeinfo.CodeDesc ?? codeinfo.Code) + "\r\n");
                        }
                        else
                        {
                            faultmsg += (i.ToString() + "." + failues.ToString() + "\r\n");
                        }
                        i++;
                    }
                    //var faultall = string.Join("\r\n", Failueslist.OrderBy(o=>o));
                    #endregion
                    #region å‘Šè­¦ä»£ç å¤„理
                    List<long> Alertlist = new List<long>();
                    Alertlist.Add(loginfo.FailureMessage1);
                    Alertlist.Add(loginfo.FailureMessage2);
                    Alertlist.Add(loginfo.FailureMessage3);
                    Alertlist.Add(loginfo.FailureMessage4);
                    Alertlist.Add(loginfo.FailureMessage5);
                    Alertlist.Add(loginfo.FailureMessage6);
                    Alertlist.Add(loginfo.FailureMessage7);
                    Alertlist.Add(loginfo.FailureMessage8);
                    Alertlist.Add(loginfo.FailureMessage9);
                    Alertlist.Add(loginfo.FailureMessage10);
                    Alertlist.Add(loginfo.FailureMessage11);
                    Alertlist.Add(loginfo.FailureMessage12);
                    Alertlist.Add(loginfo.FailureMessage13);
                    Alertlist.Add(loginfo.FailureMessage14);
                    Alertlist.Add(loginfo.FailureMessage15);
                    Alertlist.Add(loginfo.FailureMessage16);
                    Alertlist.Add(loginfo.FailureMessage17);
                    Alertlist.Add(loginfo.FailureMessage18);
                    Alertlist.Add(loginfo.FailureMessage19);
                    Alertlist.Add(loginfo.FailureMessage20);
                    Alertlist.RemoveAll(o => o == 0);
                    string alertall = "";
                    string warnmsg = "";
                    i = 1;
                    foreach (var alert in Alertlist)
                    {
                        alertall += (alert + "\r\n");
                        var codeinfo = codelist.Where(o => o.Code == alert.ToString()).FirstOrDefault();
                        if (codeinfo != null && codeinfo.Code.Length > 0)
                        {
                            warnmsg += (i.ToString() + "." + (codeinfo.CodeDesc ?? codeinfo.Code) + "\r\n");
                        }
                        else
                        {
                            warnmsg += (i.ToString() + "." + alert.ToString() + "\r\n");
                        }
                        i++;
                    }
                    #endregion
                    //var alertall = string.Join("\r\n", Alertlist.OrderBy(o=>o));
                    EquipmentWorkingLog infolog = new EquipmentWorkingLog();
                    infolog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                    infolog.LogAddTime = DateTimeHelper.GetDateTime();
                    infolog.WorkPieceLogID = loginfo2.Id;
                    infolog.EquipmentID = info.EquipmentID;
                    bool isAddEquipmentWorkingLog = false;
                    bool isStatechange = false;
                    #region è®¾å¤‡çŠ¶æ€å¤„ç†
                    //故障》警告》其他
                    if (loginfo.IsCloseAlert)
                    {//故障
                        info.AlertTime = info.AlertTime ?? DateTime.Now;
                        info.FailureType = "";
                        info.WarnType = "";
                        info.Alertmsg = faultmsg;//这个需要代码对应字典维护信息才知道
                        info.FailureType = faultall;
                        State = ((int)EnumEquipmentCurrentStateDisplay.故障).ToString();
                        //infolog.FailureStartTime = DateTimeHelper.GetDateTime();
                        //infolog.FailureType = faultall;
                        //infolog.FailureMsg = faultmsg;
                        if (loginfo.IsMessage)
                        {
                            info.WarnTime = info.WarnTime ?? DateTime.Now;
                            info.Warnmsg = warnmsg;//这个需要代码对应字典维护信息才知道
                            info.WarnType = alertall;
                        }
                    }
                    //else if (loginfo.IsMessage)
                    //{//警告
                    //    info.AlertTime = null;
                    //    info.Alertmsg = "";//这个需要代码对应字典维护信息才知道
                    //    info.FailureType = "";
                    //    info.WarnTime = info.WarnTime ?? DateTime.Now;
                    //    info.Warnmsg = warnmsg;//这个需要代码对应字典维护信息才知道
                    //    info.WarnType = alertall;
                    //    //infolog.WarnStartTime = DateTimeHelper.GetDateTime();
                    //    //infolog.WarnType = alertall;
                    //    //infolog.Warnmsg = warnmsg;
                    //    State = ((int)EnumEquipmentCurrentStateDisplay.警告).ToString();
                    //}
                    else
                    {//告警结束,获取有告警的数据,然后关闭他
                        info.AlertTime = null;
                        info.Alertmsg = "";//这个需要代码对应字典维护信息才知道
                        info.FailureType = "";
                        info.WarnType = "";
                        info.WarnTime = null;
                        info.Warnmsg = "";
                        if (loginfo.IsMessage)
                        {//警告会覆盖下面的状态,先不用警告了
                            info.WarnTime = info.WarnTime ?? DateTime.Now;
                            info.Warnmsg = warnmsg;//这个需要代码对应字典维护信息才知道
                            info.WarnType = alertall;
                        }
                        if (info.EquipmentCurrentState == null || (!info.EquipmentCurrentState.Equals(((int)EnumEquipmentCurrentStateDisplay.离线).ToString())))
                        {//如果设备状态为离线,则此处不需要判断任何信息
                            if (loginfo.IsNormalProduction && !loginfo.LackMaterial && !loginfo.FullMaterial)
                            {//自动运行状态+不缺料+不堵料
                                State = ((int)EnumEquipmentCurrentStateDisplay.生产).ToString();
                            }
                            else if (loginfo.IsNormalProduction && loginfo.FullMaterial)
                            {//自动运行状态+下料道满料 =  å®Œæˆ ï¼ˆå°±æ˜¯æœ‰ç”Ÿäº§å‡ºæ¥ä½†æ²¡æœ‰å‡ºè®¾å¤‡ï¼‰
                                State = ((int)EnumEquipmentCurrentStateDisplay.完成).ToString();
                            }
                            //else if (loginfo.IsNormalProduction && loginfo.LackMaterial)
                            //{//其他状态全算待机
                            //    State = ((int)EnumEquipmentCurrentStateDisplay.待机).ToString();
                            //}
                            else
                            {//其他状态全算待机
                                State = ((int)EnumEquipmentCurrentStateDisplay.待机).ToString();
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(State) && State != info.EquipmentCurrentState)
                    {//只有状态出现变化才变更,状态变更,肯定有新的一条数据
                        //状态变更,获取旧状态的信息,若有则更新(准确的说,只要没有结束时间的设备状态都需要更新结束时间,以便于插入新的数据)
                        var equlogState = db.EquipmentWorkingLog.Where(o => o.EquipmentID == loginfo.EquipmentID
                        && o.EquipmentStateStartTime != null && o.EquipmentStateStartTime != DateTime.MinValue && (o.EquipmentStateEndTime == null || o.EquipmentStateEndTime == DateTime.MinValue)
                        //&& o.EquipmentState== info.EquipmentCurrentState
                        )
                            .OrderByDescending(o => o.EquipmentStateStartTime).FirstOrDefault();
                        if (equlogState != null)
                        {
                            equlogState.MonitoringPoint = loginfo.MonitoringPoint;
                            equlogState.EquipmentStateEndTime = DateTimeHelper.GetDateTime();
                        }
                        info.UpdatedUserName = loginfo.MonitoringPoint;
                        info.UpdatedTime = DateTime.Now;
                        info.EquipmentCurrentState = State;
                        //状态变更,需要更新原来的,肯定会插入新的
                        infolog.EquipmentState = State;
                        infolog.EquipmentStateStartTime = DateTimeHelper.GetDateTime();
                        infolog.WorkingProcedure = loginfo.WorkingProcedure;
                        infolog.MonitoringPoint = loginfo.MonitoringPoint;
                        infolog.Remarks = "告警信息出现变更3";
                        infolog.UpdateDesc = (infolog.UpdateDesc ?? "") + $"设备状态变更为{((EnumEquipmentCurrentStateDisplay)int.Parse(State)).ToString()}\r\n";
                        isAddEquipmentWorkingLog = true;
                        isStatechange = true;
                    }
                    #endregion
                    //1.有故障则是故障状态, æœ‰æ•…障信息+告警信息
                    //2.没有故障有告警则是告警状态,有告警信息
                    //3.即没故障,也没告警,则是其他状态
                    //查找是否有未结束的故障
                    var equlogFailure = db.EquipmentWorkingLog.Where(o => o.EquipmentID == loginfo.EquipmentID
                    && o.FailureStartTime != null && o.FailureStartTime != DateTime.MinValue && (o.FailureEndTime == null || o.FailureEndTime == DateTime.MinValue))
                        .OrderByDescending(o => o.FailureStartTime).FirstOrDefault();
                    if (loginfo.IsCloseAlert)
                    {//有故障标志位,设备状态若有变更则肯定有新增,此处直接更新即可
                     //有故障标志位,设备状态若没有更新,有故障,也不会插入新的(有故障设备状态变更肯定是变成故障)
                        infolog.FailureStartTime = DateTimeHelper.GetDateTime();
                        infolog.FailureType = faultall;
                        infolog.FailureMsg = faultmsg;
                        infolog.WorkingProcedure = loginfo.WorkingProcedure;
                        infolog.MonitoringPoint = loginfo.MonitoringPoint;
                        infolog.Remarks = "故障信息出现变更1";
                        infolog.UpdateDesc = (infolog.UpdateDesc ?? "") + "故障信息变更\r\n";
                    }
                    else
                    {
                        if (equlogFailure != null)
                        {//故障关闭的
                            equlogFailure.MonitoringPoint = loginfo.MonitoringPoint;
                            equlogFailure.FailureEndTime = DateTimeHelper.GetDateTime();
                        }
                    }
                    //查找是否有未结束的告警
                    var equlogalert = db.EquipmentWorkingLog.Where(o => o.EquipmentID == loginfo.EquipmentID
                    && o.WarnStartTime != null && o.WarnStartTime != DateTime.MinValue && (o.WarnEndTime == null || o.WarnEndTime == DateTime.MinValue))
                        .OrderByDescending(o => o.WarnStartTime).FirstOrDefault();
                    if (loginfo.IsMessage)
                    {//若有告警,如果有设备状态变更,肯定插入,此处只修改即可
                        //若有告警,如果设备状态没有变更,有告警,也不插入新的(问题:当状态没有更改,如一直是故障,但告警信息有变化,怎么办  ps:此处先不管)
                        infolog.WarnStartTime = DateTimeHelper.GetDateTime();
                        infolog.WarnType = alertall;
                        infolog.Warnmsg = warnmsg;
                        infolog.WorkingProcedure = loginfo.WorkingProcedure;
                        infolog.MonitoringPoint = loginfo.MonitoringPoint;
                        infolog.Remarks = "告警信息出现变更2";
                        infolog.UpdateDesc = (infolog.UpdateDesc ?? "") + "告警信息变更\r\n";
                    }
                    else
                    {
                        if (equlogalert != null)
                        {//故障关闭的
                            equlogalert.MonitoringPoint = loginfo.MonitoringPoint;
                            equlogalert.WarnEndTime = DateTimeHelper.GetDateTime();
                        }
                    }
                    #region åŽŸæ¥çš„ä»£ç ï¼Œä»¥åŽåˆ æŽ‰
                    //EquipmentWorkingLog infolog =new EquipmentWorkingLog();
                    //infolog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                    //infolog.LogAddTime = DateTimeHelper.GetDateTime();
                    //infolog.WorkPieceLogID = loginfo2.Id;
                    //infolog.EquipmentID = info.EquipmentID;
                    //bool isAddEquipmentWorkingLog = false;
                    //if (loginfo.ischeckAlertStatus)
                    //{//告警状态发生变更
                    //    //说明是一个新告警,需要更新设备监控表
                    //    //查找未结束的告警
                    //    var equlog = db.EquipmentWorkingLog.Where(o => o.EquipmentID == loginfo.EquipmentID
                    //    && o.FailureStartTime != null && o.FailureStartTime != DateTime.MinValue)
                    //        .OrderByDescending(o=>o.FailureStartTime).FirstOrDefault();
                    //    if (loginfo.IsCloseAlert)
                    //    {
                    //        if (equlog == null|| (equlog.FailureEndTime!=null&& equlog.FailureEndTime > DateTime.MinValue))
                    //        {
                    //            info.AlertTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                    //            infolog.FailureStartTime = DateTimeHelper.GetDateTime();
                    //            infolog.FailureType = faultall;
                    //            infolog.FailureMsg = faultmsg;
                    //            infolog.WorkingProcedure = loginfo.WorkingProcedure;
                    //            infolog.MonitoringPoint = loginfo.MonitoringPoint;
                    //            infolog.Remarks = "故障信息出现变更1";
                    //            infolog.UpdateDesc = (infolog.UpdateDesc??"")+"故障信息变更\r\n";
                    //            isAddEquipmentWorkingLog =true;
                    //        }
                    //    }
                    //    else
                    //    {
                    //        if (equlog != null && (equlog.FailureEndTime == null || equlog.FailureEndTime <= DateTime.MinValue))
                    //        {//告警关闭的,若没有告警信息,不用管
                    //            equlog.MonitoringPoint = loginfo.MonitoringPoint;
                    //            equlog.FailureEndTime = DateTimeHelper.GetDateTime();
                    //        }
                    //    }
                    //}
                    //if (loginfo.ischeckMessageStatus)
                    //{//告警状态发生变更
                    //    //说明是一个新告警,需要更新设备监控表
                    //    //查找未结束的告警
                    //    var equlog = db.EquipmentWorkingLog.Where(o => o.EquipmentID == loginfo.EquipmentID
                    //    && o.WarnStartTime != null && o.WarnStartTime != DateTime.MinValue).OrderByDescending(o => o.WarnStartTime).FirstOrDefault();
                    //    if (loginfo.IsMessage)
                    //    {
                    //        if (equlog == null || (equlog.WarnEndTime != null && equlog.WarnEndTime > DateTime.MinValue))
                    //        {
                    //            info.WarnTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                    //            infolog.WarnStartTime = DateTimeHelper.GetDateTime();
                    //            infolog.WarnType = alertall;
                    //            infolog.Warnmsg = warnmsg;
                    //            infolog.WorkingProcedure = loginfo.WorkingProcedure;
                    //            infolog.MonitoringPoint = loginfo.MonitoringPoint;
                    //            infolog.Remarks = "告警信息出现变更2";
                    //            infolog.UpdateDesc = (infolog.UpdateDesc ?? "") + "告警信息变更\r\n";
                    //            isAddEquipmentWorkingLog = true;
                    //        }
                    //    }
                    //    else
                    //    {
                    //        if (equlog != null && (equlog.WarnEndTime == null || equlog.WarnEndTime <= DateTime.MinValue))
                    //        {//告警关闭的,若没有告警信息,不用管
                    //            equlog.MonitoringPoint = loginfo.MonitoringPoint;
                    //            equlog.WarnEndTime = DateTimeHelper.GetDateTime();
                    //        }
                    //    }
                    //}
                    ////故障》警告》其他
                    //if (loginfo.IsCloseAlert)
                    //{//故障
                    //    info.AlertTime = info.AlertTime??DateTime.Now;
                    //    info.FailureType = "";
                    //    info.WarnType = "";
                    //    info.Alertmsg = faultmsg;//这个需要代码对应字典维护信息才知道
                    //    info.FailureType = faultall;
                    //    State = ((int)EnumEquipmentCurrentStateDisplay.故障).ToString();
                    //    infolog.FailureStartTime = DateTimeHelper.GetDateTime();
                    //    infolog.FailureType = faultall;
                    //    infolog.FailureMsg = faultmsg;
                    //    if (loginfo.IsMessage)
                    //    {
                    //        info.WarnTime = info.WarnTime ?? DateTime.Now;
                    //        info.Warnmsg = warnmsg;//这个需要代码对应字典维护信息才知道
                    //        info.WarnType = alertall;
                    //    }
                    //}
                    //else if(loginfo.IsMessage)
                    //{//警告
                    //    info.AlertTime = null;
                    //    info.Alertmsg = "";//这个需要代码对应字典维护信息才知道
                    //    info.FailureType = "";
                    //    info.WarnTime = info.WarnTime ?? DateTime.Now;
                    //    info.Warnmsg = warnmsg;//这个需要代码对应字典维护信息才知道
                    //    info.WarnType = alertall;
                    //    infolog.WarnStartTime = DateTimeHelper.GetDateTime();
                    //    infolog.WarnType = alertall;
                    //    infolog.Warnmsg = warnmsg;
                    //    State = ((int)EnumEquipmentCurrentStateDisplay.警告).ToString();
                    //}
                    //else
                    //{//告警结束,获取有告警的数据,然后关闭他
                    //    info.AlertTime = null;
                    //    info.Alertmsg = "";//这个需要代码对应字典维护信息才知道
                    //    info.FailureType = "";
                    //    info.WarnType = "";
                    //    info.WarnTime = null;
                    //    info.Warnmsg = "";
                    //    if (loginfo.IsNormalProduction&& loginfo.LackMaterial)
                    //    {
                    //        State = ((int)EnumEquipmentCurrentStateDisplay.待机).ToString();
                    //    }
                    //    else if(loginfo.IsNormalProduction && !loginfo.LackMaterial)
                    //    {
                    //        State = ((int)EnumEquipmentCurrentStateDisplay.生产).ToString();
                    //    }
                    //    else if(loginfo.IsNormalProduction && loginfo.FullMaterial)
                    //    {//正常生产+下料道满料 =  å®Œæˆ ï¼ˆå°±æ˜¯æœ‰ç”Ÿäº§å‡ºæ¥ä½†æ²¡æœ‰å‡ºè®¾å¤‡ï¼‰
                    //        State = ((int)EnumEquipmentCurrentStateDisplay.完成).ToString();
                    //    }
                    //    else
                    //    {//理论上不可能走到这,只是避免空值
                    //        State = ((int)EnumEquipmentCurrentStateDisplay.待机).ToString();
                    //    }
                    //}
                    //if (!string.IsNullOrEmpty(State) && State != info.EquipmentCurrentState)
                    //{//只有状态出现变化才变更
                    //    info.UpdatedUserName = loginfo.MonitoringPoint;
                    //    info.UpdatedTime = DateTime.Now;
                    //    info.EquipmentCurrentState = State;
                    //    var equlog = db.EquipmentWorkingLog.Where(o => o.EquipmentID == loginfo.EquipmentID
                    //    && o.EquipmentStateStartTime != null && o.EquipmentStateStartTime != DateTime.MinValue).OrderByDescending(o => o.EquipmentStateStartTime).FirstOrDefault();
                    //    if (equlog != null && (equlog.EquipmentStateEndTime == null || equlog.EquipmentStateEndTime <= DateTime.MinValue))
                    //    {
                    //        equlog.MonitoringPoint = loginfo.MonitoringPoint;
                    //        equlog.EquipmentStateEndTime = DateTimeHelper.GetDateTime();
                    //    }
                    //    //状态变更,需要更新原来的,并插入新的
                    //    infolog.EquipmentState = State;
                    //    infolog.EquipmentStateStartTime = DateTimeHelper.GetDateTime();
                    //    infolog.WorkingProcedure = loginfo.WorkingProcedure;
                    //    infolog.MonitoringPoint = loginfo.MonitoringPoint;
                    //    infolog.Remarks = "告警信息出现变更3";
                    //    infolog.UpdateDesc = (infolog.UpdateDesc ?? "") + $"设备状态变更为{((EnumEquipmentCurrentStateDisplay)int.Parse(State)).ToString()}\r\n";
                    //    isAddEquipmentWorkingLog = true;
                    //}
                    ////info.Remarks = $"{loginfo.WorkingProcedure}工序告警";
                    #endregion
                    if (isAddEquipmentCurrentMonitor)
                    {
                        info.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                        db.EquipmentCurrentMonitor.Add(info);
                    }
                    if (isAddEquipmentWorkingLog)
                    {
                        db.EquipmentWorkingLog.Add(infolog);
                    }
                }
                catch (Exception e)
                {
                    loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"{loginfo2.MonitoringPoint}设备监控更新数据异常{e.Message}.{e.StackTrace}";
                    Log4NetHelper.WriteErrorLog(type, $"{loginfo2.MonitoringPoint}设备监控更新数据异常{e.Message}.{e.StackTrace}");
                }
                //db.WorkPieceLog.Add(loginfo2);//插入设备采集日志表
                db.SaveChanges();
            }
        }
        /// <summary>
        /// å¿ƒè·³ç›‘控
        /// </summary>
        /// <param name="loginfo"></param>
        /// <param name="type"></param>
        public static void EquipmentBeartBeatMonitor(WorkPieceLogMiddle loginfo, LogType type)
        {
            using (DbModel db = new DbModel())
            {
                bool isAddEquipmentCurrentMonitor = false;
                EquipmentCurrentMonitor info = new EquipmentCurrentMonitor();
                info = db.EquipmentCurrentMonitor.Where(o => o.WorkingProcedure == loginfo.WorkingProcedure).FirstOrDefault();
                if (info == null)
                {//没有工件信息,不做更新
                    Log4NetHelper.WriteErrorLog(type, $"设备{loginfo.EquipmentID} å‘Šè­¦ç›‘控{loginfo.MonitoringPoint} æ²¡æœ‰èŽ·å–åˆ°è®¾å¤‡ç›‘æŽ§ä¿¡æ¯ï¼ŒçŽ°æ–°å¢ž");
                    info = EntityPropHelper.Mapper<EquipmentCurrentMonitor, WorkPieceLogMiddle>(loginfo);
                    isAddEquipmentCurrentMonitor = true;
                    info.EquipmentCurrentState = ((int)EnumEquipmentCurrentStateDisplay.待机).ToString();
                    info.IsDeleted = false;
                }
                string state = "";
                EquipmentWorkingLog infolog = new EquipmentWorkingLog();
                infolog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                infolog.LogAddTime = DateTimeHelper.GetDateTime();
                infolog.WorkPieceLogID = loginfo.Id;
                infolog.EquipmentID = info.EquipmentID;
                bool isAddEquipmentWorkingLog = false;
                if (!loginfo.IsConnect)
                {//最新状态为离线
                    state = ((int)EnumEquipmentCurrentStateDisplay.离线).ToString();
                    info.EquipmentCurrentState = state;
                    info.UpdatedUserName = loginfo.MonitoringPoint;
                    info.UpdatedTime = DateTime.Now;
                    info.Alertmsg = "设备离线";
                    info.AlertTime = DateTimeHelper.GetDateTime();
                    info.FailureType = "";
                    //若没有离线的信息,则新增一条
                    var equlog = db.EquipmentWorkingLog.Where(o => o.EquipmentID == loginfo.EquipmentID
                    && o.EquipmentStateStartTime != null && o.EquipmentStateStartTime != DateTime.MinValue && (o.EquipmentStateEndTime == null || o.EquipmentStateEndTime == DateTime.MinValue)
                    && o.EquipmentState.Equals(state)
                    ).OrderByDescending(o => o.EquipmentStateStartTime).FirstOrDefault();
                    if (equlog == null)
                    {
                        infolog.EquipmentState = state;
                        infolog.EquipmentStateStartTime = DateTimeHelper.GetDateTime();
                        infolog.WorkingProcedure = loginfo.WorkingProcedure;
                        infolog.MonitoringPoint = loginfo.MonitoringPoint;
                        infolog.Remarks = "离线";
                        infolog.UpdateDesc = (infolog.UpdateDesc ?? "") + $"设备状态变更为{((EnumEquipmentCurrentStateDisplay)int.Parse(state)).ToString()}\r\n";
                        isAddEquipmentWorkingLog = true;
                    }
                    //若有非离线的状态数据,则更新
                    var equlog2 = db.EquipmentWorkingLog.Where(o => o.EquipmentID == loginfo.EquipmentID
                && o.EquipmentStateStartTime != null && o.EquipmentStateStartTime != DateTime.MinValue && (o.EquipmentStateEndTime == null || o.EquipmentStateEndTime == DateTime.MinValue)
                && !o.EquipmentState.Equals(state)
                ).OrderByDescending(o => o.EquipmentStateStartTime).FirstOrDefault();
                    if (equlog2 != null)
                    {
                        equlog2.MonitoringPoint = loginfo.MonitoringPoint;
                        equlog2.EquipmentStateEndTime = DateTimeHelper.GetDateTime();
                    }
                }
                else
                {//最新状态为开机
                    if (((int)EnumEquipmentCurrentStateDisplay.离线).ToString() == info.EquipmentCurrentState)
                    {//只有离线状态,才能变成开机
                        state = ((int)EnumEquipmentCurrentStateDisplay.待机).ToString();
                        info.EquipmentCurrentState = state;
                        info.UpdatedUserName = loginfo.MonitoringPoint;
                        info.UpdatedTime = DateTime.Now;
                        info.Alertmsg = "";
                        info.AlertTime = null;
                        //有离线的数据,则更新
                        var equlog = db.EquipmentWorkingLog.Where(o => o.EquipmentID == loginfo.EquipmentID
                        && o.EquipmentStateStartTime != null && o.EquipmentStateStartTime != DateTime.MinValue && (o.EquipmentStateEndTime == null || o.EquipmentStateEndTime == DateTime.MinValue)
                        && o.EquipmentState.Equals(((int)EnumEquipmentCurrentStateDisplay.离线).ToString())
                        ).OrderByDescending(o => o.EquipmentStateStartTime).FirstOrDefault();
                        if (equlog != null)
                        {
                            equlog.MonitoringPoint = loginfo.MonitoringPoint;
                            equlog.EquipmentStateEndTime = DateTimeHelper.GetDateTime();
                        }
                        //离线变开机,肯定会插入一条
                        infolog.EquipmentState = state;
                        infolog.EquipmentStateStartTime = DateTimeHelper.GetDateTime();
                        infolog.WorkingProcedure = loginfo.WorkingProcedure;
                        infolog.MonitoringPoint = loginfo.MonitoringPoint;
                        infolog.Remarks = "开机";
                        infolog.UpdateDesc = (infolog.UpdateDesc ?? "") + $"设备状态变更为{((EnumEquipmentCurrentStateDisplay)int.Parse(state)).ToString()}\r\n";
                        isAddEquipmentWorkingLog = true;
                    }
                }
                if (isAddEquipmentWorkingLog)
                {
                    db.EquipmentWorkingLog.Add(infolog);
                }
                if (isAddEquipmentCurrentMonitor)
                {
                    info.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                    db.EquipmentCurrentMonitor.Add(info);
                }
                db.SaveChanges();
            }
        }
        public static void ThreadMonitor(ThreadStatusMonitorMiddle threadinfo)
        {
            ThreadMonitor(EntityPropHelper.Mapper<ThreadStatusMonitor, ThreadStatusMonitorMiddle>(threadinfo));
            try
            {
                SystemValue.UpdateMainList(threadinfo);
            }
            catch (Exception ex)
            {
            }
        }
        public static void ThreadMonitor(ThreadStatusMonitor threadinfo)
        {
            try
            {
                using (DbModel db = new DbModel())
                {
                    var info = db.ThreadStatusMonitor.Where(o => o.Threadcode == threadinfo.Threadcode).FirstOrDefault();
                    if (info == null || info.Id == 0)
                    {//没有工件信息,不做更新
                        threadinfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                        threadinfo.CreatedTime = DateTimeHelper.GetDateTime();
                        threadinfo.CreatedUserName = threadinfo.Threadcode;
                        db.ThreadStatusMonitor.Add(threadinfo);
                    }
                    else
                    {//更新表WorkPieceInfo
                        info.Remarks = threadinfo.Remarks;
                        info.ErrorMsg = threadinfo.ErrorMsg;
                        info.Threadendtime = DateTimeHelper.GetDateTime();//每次都更新
                        info.ThreadId = threadinfo.ThreadId;
                        info.ThreadFrequency = threadinfo.ThreadFrequency;
                        info.UpdatedTime = DateTimeHelper.GetDateTime();
                        info.UpdatedUserName = threadinfo.Threadcode;
                        info.Threadlastmodifytime = threadinfo.Threadlastmodifytime > DateTime.MinValue ? threadinfo.Threadlastmodifytime : info.Threadlastmodifytime;//如果有传参则更新
                        //if (info.Threadstatue==1)
                        //{
                        //    info.Threadlastmodifytime = DateTimeHelper.GetDateTime();//最新跑到数据
                        //}
                    }
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
        }
        #region ä¸šåŠ¡æ–¹æ³•
        /// <summary>
        ///  ã€è´¨é‡æ•°æ®æ›´æ–°ä¸“用】 dict中前面一个是原对象,后面一个是目标对象
        /// </summary>
        /// <param name="WorkingProcedure"></param>
        /// <returns></returns>
        public static Dictionary<string, string> GetQualityDataInfoUpdate(WorkPieceLogMiddle logMiddle, string WorkingProcedure = "", string MonitoringPoint = "")
        {
            Dictionary<string, string> dict = new Dictionary<string, string>();
            dict.Add("QualityState", "QualityState");
            dict.Add("EquipmentID", "EquipmentID");
            dict.Add("WorkingProcedure", "WorkingProcedure");
            dict.Add("QualityStateUpdateMode", "QualityStateUpdateMode");
            dict.Add("QualityStateUpdateUser", "QualityStateUpdateUser");
            dict.Add("OfflineTime", "OfflineTime");
            switch (WorkingProcedure)
            {
                case "OP10":
                    dict.Add("QualityOP10To1", "QualityOP10To1");
                    dict.Add("QualityNoOk", "QualityNoOk_OP10");
                    dict.Add("QualityNoOkReason", "QualityNoOkReason_OP10");
                    break;
                case "OP20":
                    dict.Add("QualityOP20To1", "QualityOP20To1");
                    dict.Add("QualityNoOk", "QualityNoOk_OP20");
                    dict.Add("QualityNoOkReason", "QualityNoOkReason_OP20");
                    break;
                case "OP30":
                    dict.Add("QualityNoOk", "QualityNoOk_OP30");
                    dict.Add("QualityNoOkReason", "QualityNoOkReason_OP30");
                    switch (MonitoringPoint)
                    {
                        case "OP3002CH3":
                            dict.Add("QualityOP30To1", "QualityOP30To1");
                            break;
                        case "OP3002CH4":
                            dict.Add("QualityOP30To2", "QualityOP30To2");
                            dict.Add("QualityOP30To8", "QualityOP30To8");
                            break;
                        case "OP3002CH5":
                            dict.Add("QualityOP30To3", "QualityOP30To3");
                            dict.Add("QualityOP30To4", "QualityOP30To4");
                            dict.Add("QualityOP30To5", "QualityOP30To5");
                            dict.Add("QualityOP30To9", "QualityOP30To9");
                            dict.Add("QualityOP30To10", "QualityOP30To10");
                            dict.Add("QualityOP30To11", "QualityOP30To11");
                            break;
                        case "OP3002CH6":
                            dict.Add("QualityOP30To6", "QualityOP30To6");
                            dict.Add("QualityOP30To7", "QualityOP30To7");
                            break;
                        default:
                            break;
                    }
                    break;
                case "OP35":
                    dict.Add("QualityOP35To1", "QualityOP35To1");
                    dict.Add("QualityOP35To2", "QualityOP35To2");
                    dict.Add("QualityNoOk", "QualityNoOk_OP35");
                    dict.Add("QualityNoOkReason", "QualityNoOkReason_OP35");
                    break;
                case "OP40":
                    dict.Add("QualityOP40To1", "QualityOP40To1");
                    dict.Add("QualityNoOk", "QualityNoOk_OP40");
                    dict.Add("QualityNoOkReason", "QualityNoOkReason_OP40");
                    break;
                case "OP60":
                    dict.Add("QualityOP60To1", "QualityOP60To1");
                    dict.Add("QualityOP60To2", "QualityOP60To2");
                    dict.Add("QualityNoOk", "QualityNoOk_OP60");
                    dict.Add("QualityNoOkReason", "QualityNoOkReason_OP60");
                    break;
                case "OP70":
                    dict.Add("QualityOP70To1", "QualityOP70To1");
                    dict.Add("QualityOP70To2", "QualityOP70To2");
                    dict.Add("QualityOP70To3", "QualityOP70To3");
                    break;
                case "OP80":
                    //dict.Add("OP80NewCode", "OP80NewCode");
                    dict.Add("QualityOP80To1", "QualityOP80To1");
                    dict.Add("QualityOP80To2", "QualityOP80To2");
                    dict.Add("QualityOP80To3", "QualityOP80To3");
                    dict.Add("QualityOP80To4", "QualityOP80To4");
                    dict.Add("QualityOP80To5", "QualityOP80To5");
                    dict.Add("QualityOP80To6", "QualityOP80To6");
                    dict.Add("QualityOP80To7", "QualityOP80To7");
                    dict.Add("QualityOP80To8", "QualityOP80To8");
                    dict.Add("QualityOP80To9", "QualityOP80To9");
                    dict.Add("QualityOP80To10", "QualityOP80To10");
                    //新增 ã€Editby shaocx,2024-06-16】
                    dict.Add("QualityOP80_Houdu", "QualityOP80_Houdu");
                    dict.Add("QualityOP80_ZXJ", "QualityOP80_ZXJ");
                    dict.Add("QualityOP80_DTKYZD", "QualityOP80_DTKYZD");
                    dict.Add("QualityOP80_XTSMYD", "QualityOP80_XTSMYD");
                    dict.Add("QualityOP80_XTXMYD", "QualityOP80_XTXMYD");
                    dict.Add("QualityOP80_D_TKZJ", "QualityOP80_D_TKZJ");
                    dict.Add("QualityOP80_D_S_X", "QualityOP80_D_S_X");
                    dict.Add("QualityOP80_D_S_Y", "QualityOP80_D_S_Y");
                    dict.Add("QualityOP80_D_X_X", "QualityOP80_D_X_X");
                    dict.Add("QualityOP80_D_X_Y", "QualityOP80_D_X_Y");
                    dict.Add("QualityOP80_X_TKZJ", "QualityOP80_X_TKZJ");
                    dict.Add("QualityOP80_X_S_X", "QualityOP80_X_S_X");
                    dict.Add("QualityOP80_X_S_Y", "QualityOP80_X_S_Y");
                    dict.Add("QualityOP80_X_X_X", "QualityOP80_X_X_X");
                    dict.Add("QualityOP80_X_X_Y", "QualityOP80_X_X_Y");
                    dict.Add("QualityNoOk", "QualityNoOk_OP80");
                    dict.Add("QualityNoOkReason", "QualityNoOkReason_OP80");
                    break;
                default:
                    break;
            }
            return dict;
        }
        /// <summary>
        ///  ã€å·¥ä»¶æˆ–工序数据数据更新专用】 dict中前面一个是原对象,后面一个是目标对象
        /// </summary>
        /// <param name="WorkingProcedure"></param>
        /// <returns></returns>
        public static Dictionary<string, string> GetWorkPieceInfoUpdateForQualityNoOk(WorkPieceLogMiddle loginfo)
        {
            Dictionary<string, string> dict = new Dictionary<string, string>();
            //if (loginfo.QualityState != null)
            //{
            //    QualityState qualityState;
            //    bool isRight = Enum.TryParse<QualityState>(loginfo.QualityState.ToString(), out qualityState);
            //    if (isRight && (qualityState == QualityState.NG || qualityState == QualityState.Suspected))
            //    {
            //    }
            //}
            dict.Add("QualityNoOk", "QualityNoOk");
            dict.Add("QualityNoOkReason", "QualityNoOkReason");
            return dict;
        }
        public static void SetQualityNoOk_WorkPieceInfo(WorkPieceLogMiddle logMiddle, ref WorkPieceInfo pieceInfo)
        {
            pieceInfo.QualityNoOk = logMiddle.QualityNoOk;
            pieceInfo.QualityNoOkReason = logMiddle.QualityNoOkReason;
        }
        public static void SetQualityNoOk_WorkPieceProcess(WorkPieceLogMiddle logMiddle, ref WorkPieceProcess pieceProcess)
        {
            pieceProcess.QualityNoOk = logMiddle.QualityNoOk;
            pieceProcess.QualityNoOkReason = logMiddle.QualityNoOkReason;
        }
        /// <summary>
        /// åˆ¤æ–­æ˜¯å¦è·³åº
        /// </summary>
        /// <param name="loginfo"></param>
        /// <param name="type"></param>
        public static bool CheckQualityInfoComplete(WorkPieceInfo info, WorkPieceLog loginfo, LogType type)
        {
            //判断是否跳序
            if (info == null || info.WorkPieceID.Length < 1)
            {
                Log4NetHelper.WriteErrorLog(type, $"校验工件信息{loginfo.WorkPieceID}工序是否跳序时,传入工件信息异常");
                return true;//没取到工件信息,不做判断是否跳序
            }
            else
            {
                try
                {
                    string wproStr = info.WorkingProcedureCurrent + loginfo.WorkingProcedure;
                    if (wproStr.Length != 8)
                    {
                        Log4NetHelper.WriteErrorLog(type, $"校验工件{info.WorkPieceID}  {loginfo.WorkingProcedure}工序 æ˜¯å¦è·³åºæ—¶ï¼Œå·¥åºæ‹¼æŽ¥æœ‰é—®é¢˜é•¿åº¦ä¸ä¸º8位:{wproStr}");
                        return true;//工序拼接有问题
                    }
                    if (!ConfigHelper.GetConfigString("WorkingProcedureAllStr").Contains(wproStr))
                    {
                        Log4NetHelper.WriteErrorLog(type, $"校验工件{info.WorkPieceID}  {loginfo.WorkingProcedure}工序 å‡ºçŽ°è·³åºï¼Œè¯·è®¾å¤‡æ³¨æ„:{wproStr}");
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    Log4NetHelper.WriteErrorLog(type, $"校验工件{info.WorkPieceID}  {loginfo.WorkingProcedure}工序 æ˜¯å¦è·³åºæ—¶å‡ºçް异叏", ex);
                }
            }
            return true;
            //using (var trans = db.Database.BeginTransaction())
            //{ }
            //var conStr = @"server=localhost;Database=EFDBO1;User ID=sa;Password=123456;";
            //using (var connection = new SqlConnection(conStr))
            //{
            //    connection.Open();
            //    using (var scope = new Transactionscope())
            //    {
            //        //AD0.Net
            //        var command = connection.CreateCommand();
            //        command.CommandText = "DELETE FROM T_RoleInfor";
            //        command.ExecuteNonQuery();
            //        //综合提交
            //        scope.complete();
            //    }
            //}
        }
        /// <summary>
        ///         è§£æžäºŒç»´ç 
        /// </summary>
        /// <param name="loginfo"></param>
        /// <returns></returns>
        public static WorkPieceInfo ParseQRCode(WorkPieceInfo loginfo)
        {
            if (string.IsNullOrEmpty(loginfo.WorkPieceID) || loginfo.WorkPieceID.Length != 22)
            {
                return loginfo;
            }
            loginfo.WorkPieceIDTo1 = loginfo.WorkPieceID.Substring(0, 2);
            loginfo.WorkPieceIDTo2 = loginfo.WorkPieceID.Substring(2, 4);
            loginfo.WorkPieceIDTo3 = loginfo.WorkPieceID.Substring(6, 6);
            loginfo.WorkPieceIDTo4 = loginfo.WorkPieceID.Substring(12, 2);
            loginfo.WorkPieceIDTo5 = loginfo.WorkPieceID.Substring(14, 4);
            loginfo.WorkPieceIDTo6 = loginfo.WorkPieceID.Substring(18, 2);
            loginfo.WorkPieceIDTo7 = loginfo.WorkPieceID.Substring(20, 2);
            return loginfo;
        }
        /// <summary>
        /// è®¡ç®—OP è´¨é‡æ•°æ®æ˜¯å¦åˆæ ¼
        /// </summary>
        public static QualityState CalcQualityStateForOP(WorkPieceLogMiddle logMiddle, ref QualityNoOkEnum? qualityNoOkEnum)
        {
            QualityState qualityState = QualityState.Suspected;
            if (logMiddle.WorkingProcedure == "OP60")
            {
                decimal _QualityOP60To1 = SystemHelper.GetDecimal(logMiddle.QualityOP60To1);
                decimal _QualityOP60To2 = SystemHelper.GetDecimal(logMiddle.QualityOP60To2);
                var isPass_QualityOP60To1 = false;
                var isPass_QualityOP60To2 = false;
                if (_QualityOP60To1 >= (decimal)53.018 && _QualityOP60To1 <= (decimal)53.030)
                {
                    isPass_QualityOP60To1 = true;
                }
                else
                {
                    qualityNoOkEnum = QualityNoOkEnum.OP60大头孔直径超差;
                }
                if (_QualityOP60To2 >= (decimal)22.005 && _QualityOP60To2 <= (decimal)22.011)
                {
                    isPass_QualityOP60To2 = true;
                }
                else
                {
                    qualityNoOkEnum = QualityNoOkEnum.OP60小头孔直径超差;
                }
                if (isPass_QualityOP60To1 && isPass_QualityOP60To2)
                {
                    qualityState = QualityState.OK;
                }
                else
                {
                    qualityState = QualityState.NG;
                }
                if (_QualityOP60To1 == 0 || _QualityOP60To2 == 0)
                {
                    qualityState = QualityState.Suspected;
                    return qualityState;
                }
                return qualityState;
            }
            else if (logMiddle.WorkingProcedure == "OP10")
            {
                if (logMiddle.QualityState == (int)QualityState.NG)
                {
                    qualityNoOkEnum = QualityNoOkEnum.OP10厚度超差;
                }
                return qualityState;
            }
            else if (logMiddle.WorkingProcedure == "OP20")
            {
                if (logMiddle.QualityState == (int)QualityState.NG)
                {
                    qualityNoOkEnum = QualityNoOkEnum.OP20小头孔直径超差;
                }
                return qualityState;
            }
            else if (logMiddle.WorkingProcedure == "OP35")
            {
                if (logMiddle.QualityState == (int)QualityState.NG)
                {
                    qualityNoOkEnum = QualityNoOkEnum.OP35滚压力不合格;
                }
                return qualityState;
            }
            else if (logMiddle.WorkingProcedure == "OP40")
            {
                if (logMiddle.QualityState == (int)QualityState.NG)
                {
                    qualityNoOkEnum = QualityNoOkEnum.OP40厚度超差;
                }
                return qualityState;
            }
            return qualityState;
        }
        #endregion
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/BLL/WorkPieceLogManager.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
using iWare_SCADA_BusinessLogical.DLA.Dao;
using iWare_SCADA_Model;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical.BLL
{
    public class WorkPieceLogManager//: CommonService<WorkPieceLog, WorkPieceLog,DbModel>
    {
        public static List<WorkPieceLog> GetWorkPieceLog(string WorkPieceID)
        {
            using (DbModel db = new DbModel())
            {
                //查询所有
                var query = db.WorkPieceLog.Where(o=>o.WorkPieceID== WorkPieceID).ToList();
                return query;
            }
        }
        public static long InsertWorkPieceLog(WorkPieceLog workPiece)
        {
            using (DbModel db = new DbModel())
            {
                db.WorkPieceLog.Add(workPiece);
                db.SaveChanges();
                return workPiece.Id;
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/Dao/CommonDao.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,553 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data.Entity;
namespace iWare_SCADA_BusinessLogical.DLA.Dao
{
    /// <summary>
    /// å…¬ç”¨æ–¹æ³•的抽象类
    /// å¼ å±•
    /// </summary>
    /// <typeparam name="T">自定义的实体类</typeparam>
    /// <typeparam name="S">ORM中的实体类</typeparam>
    public abstract class CommonDao<T, S> where T : class, ICommonEntity<S>  where S : class
    {
        #region éœ€è¦åœ¨å­ç±»ä¸­å®žçŽ°çš„æŠ½è±¡æ–¹æ³•
        /// <summary>
        /// è¯¥æ–¹æ³•获取在自定义实体和ORM自动生成实体之间字段的对应关系
        /// </summary>
        protected abstract string GetColumnName(string name);
        /// <summary>
        /// èŽ·å–T中属性名列表
        /// </summary>
        /// <returns>T中属性名列表</returns>
        protected abstract List<string> GetColumnNames();
        /// <summary>
        ///  è¯¥æ–¹æ³•å°†Orm的S对象转换为自定义类型T的对象
        /// </summary>
        /// <param name="s">Orm中的S实体的实例</param>
        /// <returns>自定义的T类型实例</returns>
        protected abstract T ToEntity(S s);
        /// <summary>
        /// è¯¥æ–¹æ³•将定义类型T的S对象转换为自Orm的对象
        /// </summary>
        /// <param name="t">自定义T类型的对象</param>
        /// <returns>Orm中S的对象</returns>
        protected abstract S ToOrm(T t);
        /// <summary>
        /// è¯¥æ–¹æ³•获取在自定义实体和ORM自动生成实体之间字段的对应关系
        /// </summary>
        protected abstract string GetTableName();
        #endregion
        #region æ ¹æ®æ¡ä»¶æŸ¥è¯¢
        /// <summary>
        /// æ ¹æ®æ¡ä»¶æŸ¥è¯¢è‡ªå®šä¹‰å®žä½“T的列表
        /// </summary>
        /// <param name="param">查询条件</param>
        /// <param name="msg">错误信息</param>
        /// <returns>自定义实体T的记录列表</returns>
        public virtual List<T> QueryByParam(QueryParam param, DbContext dbModel)
        {
            var res = new List<T>();
            var filter = param.Filter == null || param.Filter.Count <= 0 ? new Dictionary<string, object>() : param.Filter;
            var notfilter = param.NotFilter == null || param.NotFilter.Count <= 0 ? new Dictionary<string, object>() : param.NotFilter;
            var search = param.Search == null || param.Search.Count <= 0 ? new Dictionary<string, object>() : param.Search;
            var leqd = param.Leqd == null || param.Leqd.Count <= 0 ? new Dictionary<string, object>() : param.Leqd;
            var geqd = param.Geqd == null || param.Geqd.Count <= 0 ? new Dictionary<string, object>() : param.Geqd;
            var ltd = param.Ltd == null || param.Ltd.Count <= 0 ? new Dictionary<string, object>() : param.Ltd;
            var gtd = param.Gtd == null || param.Gtd.Count <= 0 ? new Dictionary<string, object>() : param.Gtd;
            var leq = param.Leq == null || param.Leq.Count <= 0 ? new Dictionary<string, object>() : param.Leq;
            var geq = param.Geq == null || param.Geq.Count <= 0 ? new Dictionary<string, object>() : param.Geq;
            var lt = param.Lt == null || param.Lt.Count <= 0 ? new Dictionary<string, object>() : param.Lt;
            var gt = param.Gt == null || param.Gt.Count <= 0 ? new Dictionary<string, object>() : param.Gt;
            var neq = param.Neq == null || param.Neq.Count <= 0 ? new Dictionary<string, object>() : param.Neq;
            var order = param.Order == null || param.Order.Count <= 0 ? new Dictionary<string, object>() { { "Id", "DESC" } } : param.Order;
            var sql = string.Format("SELECT * FROM {0} WHERE 1=1", GetTableName());
            var sqlParams = new List<SqlParameter>();
            foreach (var key in filter.Keys)
            {
                if (filter[key] != null && !string.IsNullOrEmpty(filter[key] + ""))
                {
                    sqlParams.Add(new SqlParameter(("@F_" + key), filter[key]));
                    sql += string.Format(" AND {0} = {1}", GetColumnName(key), "@F_" + key);
                }
            }
            foreach (var key in notfilter.Keys)
            {
                if (notfilter[key] != null && !string.IsNullOrEmpty(notfilter[key] + ""))
                {
                    sqlParams.Add(new SqlParameter(("@F_" + key), notfilter[key]));
                    sql += string.Format(" AND {0} != {1}", GetColumnName(key), "@F_" + key);
                }
            }
            foreach (var key in search.Keys)
            {
                if (search[key] != null && !string.IsNullOrEmpty(search[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@S_" + key, "%" + search[key] + "%"));
                    sql += string.Format(" AND {0} LIKE {1}", GetColumnName(key), "@S_" + key);
                }
            }
            foreach (var key in leqd.Keys)
            {
                if (leqd[key] != null && !string.IsNullOrEmpty(leqd[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@LEQD_" + key, leqd[key]));
                    sql += string.Format(" AND {0} <= {1}", GetColumnName(key), "@LEQD_" + key);
                }
            }
            foreach (var key in geqd.Keys)
            {
                if (geqd[key] != null && !string.IsNullOrEmpty(geqd[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@GEQD_" + key, geqd[key]));
                    sql += string.Format(" AND {0} >= {1}", GetColumnName(key), "@GEQD_" + key);
                }
            }
            foreach (var key in ltd.Keys)
            {
                if (ltd[key] != null && !string.IsNullOrEmpty(ltd[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@LTD_" + key, ltd[key]));
                    sql += string.Format(" AND {0} < {1}", GetColumnName(key), "@LTD_" + key);
                }
            }
            foreach (var key in gtd.Keys)
            {
                if (gtd[key] != null && !string.IsNullOrEmpty(gtd[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@GTD_" + key, gtd[key]));
                    sql += string.Format(" AND {0} > {1}", GetColumnName(key), "@GTD_" + key);
                }
            }
            foreach (var key in leq.Keys)
            {
                if (leq[key] != null && !string.IsNullOrEmpty(leq[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@LEQ_" + key, leq[key]));
                    sql += string.Format(" AND {0} <= {1}", GetColumnName(key), "@LEQ_" + key);
                }
            }
            foreach (var key in geq.Keys)
            {
                if (geq[key] != null && !string.IsNullOrEmpty(geq[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@GEQ_" + key, geq[key]));
                    sql += string.Format(" AND {0} >= {1}", GetColumnName(key), "@GEQ_" + key);
                }
            }
            foreach (var key in lt.Keys)
            {
                if (lt[key] != null && !string.IsNullOrEmpty(lt[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@LT_" + key, lt[key]));
                    sql += string.Format(" AND {0} < {1}", GetColumnName(key), "@LT_" + key);
                }
            }
            foreach (var key in gt.Keys)
            {
                if (gt[key] != null && !string.IsNullOrEmpty(gt[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@GT_" + key, gt[key]));
                    sql += string.Format(" AND {0} > {1}", GetColumnName(key), "@GT_" + key);
                }
            }
            foreach (var key in neq.Keys)
            {
                if (neq[key] != null && !string.IsNullOrEmpty(neq[key] + ""))
                {
                    sqlParams.Add(new SqlParameter("@NEQ_" + key, neq[key]));
                    sql += string.Format(" AND {0} <> {1}", GetColumnName(key), "@NEQ_" + key);
                }
            }
            sql += " ORDER BY ";
            foreach (var key in order.Keys)
            {
                var value = string.IsNullOrEmpty(order[key].ToString()) ? "DESC" : order[key].ToString().ToUpper();
                sqlParams.Add(new SqlParameter("@O_" + key, order[key]));
                sql += string.Format("{0} {1},", GetColumnName(key), value);
            }
            if (sql.EndsWith(","))
            {
                sql = sql.Substring(0, sql.Length - 1);
            }
            var datas = dbModel.Database.SqlQuery<S>(sql, sqlParams.ToArray()).ToList();
            datas.ForEach(x => res.Add(ToEntity(x)));
            return res;
        }
        #endregion
        #region æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢
        /// <summary>
        /// æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢è‡ªå®šä¹‰å®žä½“T的列表,同时返回记录的总条数及当前所在的页数
        /// </summary>
        /// <param name="param">查询条件</param>
        /// <param name="msg">异常错误消息</param>
        /// <param name="totalNum">记录的总条数</param>
        /// <param name="currentPage">当前页面数</param>
        /// <returns>自定义实体T的记录列表</returns>
        public virtual List<T> QueryByParam(QueryParam param, DbContext dbModel, out int totalNum, out int currentPage)
        {
            totalNum = 0;
            currentPage = 1;
            var res = new List<T>();
            var filter = param.Filter == null || param.Filter.Count <= 0 ? new Dictionary<string, object>() : param.Filter;
            var search = param.Search == null || param.Search.Count <= 0 ? new Dictionary<string, object>() : param.Search;
            var leqd = param.Leqd == null || param.Leqd.Count <= 0 ? new Dictionary<string, object>() : param.Leqd;
            var geqd = param.Geqd == null || param.Geqd.Count <= 0 ? new Dictionary<string, object>() : param.Geqd;
            var ltd = param.Ltd == null || param.Ltd.Count <= 0 ? new Dictionary<string, object>() : param.Ltd;
            var gtd = param.Gtd == null || param.Gtd.Count <= 0 ? new Dictionary<string, object>() : param.Gtd;
            var leq = param.Leq == null || param.Leq.Count <= 0 ? new Dictionary<string, object>() : param.Leq;
            var geq = param.Geq == null || param.Geq.Count <= 0 ? new Dictionary<string, object>() : param.Geq;
            var lt = param.Lt == null || param.Lt.Count <= 0 ? new Dictionary<string, object>() : param.Lt;
            var gt = param.Gt == null || param.Gt.Count <= 0 ? new Dictionary<string, object>() : param.Gt;
            var neq = param.Neq == null || param.Neq.Count <= 0 ? new Dictionary<string, object>() : param.Neq;
            var pageIndex = param.PageIndex < 1 ? 1 : param.PageIndex;
            var pageSize = param.PageSize < 1 ? 5 : param.PageSize;
            var order = param.Order == null || param.Order.Count <= 0 ? new Dictionary<string, object>() { { "Id", "DESC" } } : param.Order;
            //查询数量的sql语句
            var sqlCount = string.Format("SELECT COUNT(*) FROM {0} WHERE 1=1", GetTableName());
            //查询数量使用的sql参数列表
            var sqlParamsCount = new List<SqlParameter>();
            var orderStr = "";
            foreach (var key in order.Keys)
            {
                var value = string.IsNullOrEmpty(order[key].ToString()) ? "DESC" : order[key].ToString().ToUpper();
                sqlParamsCount.Add(new SqlParameter("@O_" + key, order[key]));
                orderStr += string.Format("{0} {1},", GetColumnName(key), value);
            }
            if (orderStr.EndsWith(","))
            {
                orderStr = orderStr.Substring(0, orderStr.Length - 1);
            }
            //查询记录列表的sql语句
            var sqlData = string.Format("SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY {0} ) AS ROWNUM from {1} where 1=1", orderStr, GetTableName());
            //查询记录列表使用的sql参数列表
            var sqlParamsData = new List<SqlParameter>();
            foreach (var key in filter.Keys)
            {
                if (filter[key] != null && !string.IsNullOrEmpty(filter[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@F_" + key, filter[key]));
                    sqlParamsData.Add(new SqlParameter("@F_" + key, filter[key]));
                    sqlCount += string.Format(" AND {0} = {1}", GetColumnName(key), "@F_" + key);
                    sqlData += string.Format(" AND {0} = {1}", GetColumnName(key), "@F_" + key);
                }
            }
            foreach (var key in search.Keys)
            {
                if (search[key] != null && !string.IsNullOrEmpty(search[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@S_" + key, "%" + search[key] + "%"));
                    sqlParamsData.Add(new SqlParameter("@S_" + key, "%" + search[key] + "%"));
                    sqlCount += string.Format(" AND {0} LIKE {1}", GetColumnName(key), "@S_" + key);
                    sqlData += string.Format(" AND {0} LIKE {1}", GetColumnName(key), "@S_" + key);
                }
            }
            foreach (var key in leqd.Keys)
            {
                if (leqd[key] != null && !string.IsNullOrEmpty(leqd[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@LEQD_" + key, leqd[key]));
                    sqlParamsData.Add(new SqlParameter("@LEQD_" + key, leqd[key]));
                    sqlCount += string.Format(" AND {0} <= {1}", GetColumnName(key), "@LEQD_" + key);
                    sqlData += string.Format(" AND {0} <= {1}", GetColumnName(key), "@LEQD_" + key);
                }
            }
            foreach (var key in geqd.Keys)
            {
                if (geqd[key] != null && !string.IsNullOrEmpty(geqd[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@GEQD_" + key, geqd[key]));
                    sqlParamsData.Add(new SqlParameter("@GEQD_" + key, geqd[key]));
                    sqlCount += string.Format(" AND {0} >= {1}", GetColumnName(key), "@GEQD_" + key);
                    sqlData += string.Format(" AND {0} >= {1}", GetColumnName(key), "@GEQD_" + key);
                }
            }
            foreach (var key in ltd.Keys)
            {
                if (ltd[key] != null && !string.IsNullOrEmpty(ltd[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@LTD_" + key, ltd[key]));
                    sqlParamsData.Add(new SqlParameter("@LTD_" + key, ltd[key]));
                    sqlCount += string.Format(" AND {0} < {1}", GetColumnName(key), "@LTD_" + key);
                    sqlData += string.Format(" AND {0} < {1}", GetColumnName(key), "@LTD_" + key);
                }
            }
            foreach (var key in gtd.Keys)
            {
                if (gtd[key] != null && !string.IsNullOrEmpty(gtd[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@GTD_" + key, gtd[key]));
                    sqlParamsData.Add(new SqlParameter("@GTD_" + key, gtd[key]));
                    sqlCount += string.Format(" AND {0} > {1}", GetColumnName(key), "@GTD_" + key);
                    sqlData += string.Format(" AND {0} > {1}", GetColumnName(key), "@GTD_" + key);
                }
            }
            foreach (var key in leq.Keys)
            {
                if (leq[key] != null && !string.IsNullOrEmpty(leq[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@LEQ_" + key, leq[key]));
                    sqlParamsData.Add(new SqlParameter("@LEQ_" + key, leq[key]));
                    sqlCount += string.Format(" AND {0} <= {1}", GetColumnName(key), "@LEQ_" + key);
                    sqlData += string.Format(" AND {0} <= {1}", GetColumnName(key), "@LEQ_" + key);
                }
            }
            foreach (var key in geq.Keys)
            {
                if (geq[key] != null && !string.IsNullOrEmpty(geq[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@GEQ_" + key, geq[key]));
                    sqlParamsData.Add(new SqlParameter("@GEQ_" + key, geq[key]));
                    sqlCount += string.Format(" AND {0} >= {1}", GetColumnName(key), "@GEQ_" + key);
                    sqlData += string.Format(" AND {0} >= {1}", GetColumnName(key), "@GEQ_" + key);
                }
            }
            foreach (var key in lt.Keys)
            {
                if (lt[key] != null && !string.IsNullOrEmpty(lt[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@LT_" + key, lt[key]));
                    sqlParamsData.Add(new SqlParameter("@LT_" + key, lt[key]));
                    sqlCount += string.Format(" AND {0} < {1}", GetColumnName(key), "@LT_" + key);
                    sqlData += string.Format(" AND {0} < {1}", GetColumnName(key), "@LT_" + key);
                }
            }
            foreach (var key in gt.Keys)
            {
                if (gt[key] != null && !string.IsNullOrEmpty(gt[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@GT_" + key, gt[key]));
                    sqlParamsData.Add(new SqlParameter("@GT_" + key, gt[key]));
                    sqlCount += string.Format(" AND {0} > {1}", GetColumnName(key), "@GT_" + key);
                    sqlData += string.Format(" AND {0} > {1}", GetColumnName(key), "@GT_" + key);
                }
            }
            foreach (var key in neq.Keys)
            {
                if (neq[key] != null && !string.IsNullOrEmpty(neq[key] + ""))
                {
                    sqlParamsCount.Add(new SqlParameter("@NEQ_" + key, neq[key]));
                    sqlParamsData.Add(new SqlParameter("@NEQ_" + key, neq[key]));
                    sqlCount += string.Format(" AND {0} <> {1}", GetColumnName(key), "@NEQ_" + key);
                    sqlData += string.Format(" AND {0} <> {1}", GetColumnName(key), "@NEQ_" + key);
                }
            }
            totalNum = dbModel.Database.SqlQuery<int>(sqlCount, sqlParamsCount.ToArray()).ToList()[0];
            int totalPage = Convert.ToInt32(totalNum / pageSize);
            if ((totalNum % pageSize) > 0)
            {
                totalPage += 1;
            }
            currentPage = pageIndex > totalPage ? totalPage : pageIndex;
            currentPage = Math.Max(currentPage,1);
            sqlParamsData.Add(new SqlParameter("@PI_Start", (currentPage - 1) * pageSize + 1));
            sqlParamsData.Add(new SqlParameter("@PI_End", currentPage * pageSize));
            sqlData += string.Format(") t Where t.ROWNUM   between {0} and {1} ", "@PI_Start", "@PI_End");
            var datas = dbModel.Database.SqlQuery<S>(sqlData, sqlParamsData.ToArray()).ToList();
            datas.ForEach(x => res.Add(ToEntity(x)));
            return res;
        }
        #endregion
        #region æ’入新的对象
        /// <summary>
        /// å°†è‡ªå®šä¹‰çš„实体T的实例列表批量保存到数据库
        /// </summary>
        /// <param name="ts">自定义类型T的实例列表</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>保存的数量</returns>
        public virtual int Save(List<T> ts, DbContext dbModel)
        {
            if (ts == null)
            {
                return 0;
            }
            ts.ForEach(x => dbModel.Set<S>().Add(ToOrm(x)));
            dbModel.SaveChanges();
            return ts.Count;
        }
        /// <summary>
        /// å°†è‡ªå®šä¹‰çš„实体T的实例保存到数据库
        /// </summary>
        /// <param name="t">自定义类型T的实例</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>新添加T对象的id</returns>
        public virtual int Save(T t, DbContext dbModel)
        {
            var s = ToOrm(t);
            dbModel.Set<S>().Add(s);
            dbModel.SaveChanges();
            return ToEntity(s).Id;
        }
        #endregion
        #region ä¿®æ”¹å¯¹è±¡
        /// <summary>
        /// ä¿®æ”¹è‡ªå®šä¹‰ç±»åž‹T的实体并保存到数据库
        /// </summary>
        /// <param name="t">自定义类型T的实例</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>需改实体的id</returns>
        public virtual int Update(T t, DbContext dbModel)
        {
            var entry = dbModel.Entry<S>(ToOrm(t));
            entry.State = System.Data.Entity.EntityState.Unchanged;
            var propStrs = GetColumnNames();
            propStrs.ForEach(x => entry.Property(GetColumnName(x)).IsModified = true);
            dbModel.SaveChanges();
            return t.Id;
        }
        /// <summary>
        /// ä¿®æ”¹è‡ªå®šä¹‰ç±»åž‹T的实体并保存到数据库
        /// </summary>
        /// <param name="t">自定义类型T的实例</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>需改实体的id</returns>
        ///
        public virtual int Update(List<T> ts, DbContext dbModel)
        {
            foreach (var t in ts)
            {
                var entry = dbModel.Entry<S>(ToOrm(t));
                entry.State = System.Data.Entity.EntityState.Unchanged;
                var propStrs = GetColumnNames();
                propStrs.ForEach(x => entry.Property(GetColumnName(x)).IsModified = true);
            }
            dbModel.SaveChanges();
            return ts.Count;
        }
        #endregion
        #region åˆ é™¤å¯¹è±¡
        /// <summary>
        /// ä»Žæ•°æ®åº“中删除主键为id的记录
        /// </summary>
        /// <param name="id">需要删除对象的id</param>
        /// <param name="msg">异常错误信息</param>
        /// <returns>被删除对象的主键</returns>
        public virtual int Delete(int id, DbContext dbModel)
        {
            var count = Delete(new List<int> { id }, dbModel);
            return id;
        }
        /// <summary>
        /// ä»Žæ•°æ®åº“中批量删除主键列表为ids的记录
        /// </summary>
        /// <param name="id">需要删除对象的id列表</param>
        /// <param name="msg">异常错误信息</param>
        /// <returns>被删除对象的数量</returns>
        public virtual int Delete(List<int> ids, DbContext dbModel)
        {
            foreach (var id in ids)
            {
                var t = Activator.CreateInstance(typeof(T));
                ((T)t).Id = id;
                var s = ToOrm((T)t);
                dbModel.Set<S>().Attach(s);
                dbModel.Set<S>().Remove(s);
            }
            dbModel.SaveChanges();
            return ids.Count;
        }
        #endregion
        #region æ‹¼è£…å­—å…¸
        /// <summary>
        /// å°†æ»¡è¶³æ¡ä»¶çš„T类型拼装成以id为键,类型本身为值的字典
        /// </summary>
        /// <param name="param">查询条件</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>以id为键,类型本身为值的字典</returns>
        public virtual Dictionary<int, T> ToDictionary(QueryParam param, DbContext dbModel)
        {
            var res = new Dictionary<int, T>();
            var datas = QueryByParam(param, dbModel);
            datas.ForEach(x => res.Add(x.Id,x));
            return res;
        }
        #endregion
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/Dao/CommonService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,404 @@
using iWare_SCADA_BusinessLogical.Properties;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Validation;
using System.Linq;
namespace iWare_SCADA_BusinessLogical.DLA.Dao
{
    /// <summary>
    /// å…¬ç”¨æ–¹æ³•的抽象类
    /// å¼ å±•
    /// </summary>
    /// <typeparam name="T">自定义的实体类</typeparam>
    /// <typeparam name="S">ORM中的实体类</typeparam>
    public abstract class CommonService<T, S, D>:IService<T> where T : class, ICommonEntity<S>  where S : class where D: DbContext,IDisposable
    {
        #region éœ€è¦åœ¨å­ç±»ä¸­å®žçŽ°çš„æŠ½è±¡æ–¹æ³•
        private CommonDao<T, S> CommonDao;
        public CommonService(CommonDao<T, S> commonDao)
        {
            this.CommonDao = commonDao;
        }
        #endregion
        #region æ ¹æ®æ¡ä»¶æŸ¥è¯¢
        /// <summary>
        /// æ ¹æ®æ¡ä»¶æŸ¥è¯¢è‡ªå®šä¹‰å®žä½“T的列表
        /// </summary>
        /// <param name="param">查询条件</param>
        /// <param name="msg">错误信息</param>
        /// <returns>自定义实体T的记录列表</returns>
        public virtual List<T> QueryByParam(QueryParam param, out string msg)
        {
            msg = "";
            var type = typeof(D);
            using (var dbModel = type.Assembly.CreateInstance(type.FullName) as DbContext)
            {
                try
                {
                    return CommonDao.QueryByParam(param, dbModel);
                }
                catch (DbEntityValidationException ex)
                {
                    var errs = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
                    msg = string.Join(", ", errs);
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "QueryByParam", msg);
                    return new List<T>();
                }
                catch (Exception ex)
                {
                    msg = ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "QueryByParam", ex.Message);
                    return new List<T>();
                }
            }
        }
        #endregion
        #region æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢
        /// <summary>
        /// æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢è‡ªå®šä¹‰å®žä½“T的列表,同时返回记录的总条数及当前所在的页数
        /// </summary>
        /// <param name="param">查询条件</param>
        /// <param name="msg">异常错误消息</param>
        /// <param name="totalNum">记录的总条数</param>
        /// <param name="currentPage">当前页面数</param>
        /// <returns>自定义实体T的记录列表</returns>
        public virtual List<T> QueryByParam(QueryParam param, out string msg, out int totalNum, out int currentPage)
        {
            msg = "";
            totalNum = 0;
            currentPage = 1;
            var type = typeof(D);
            using (var dbModel = type.Assembly.CreateInstance(type.FullName) as DbContext)
            {
                try
                {
                    return CommonDao.QueryByParam(param, dbModel, out totalNum, out currentPage);
                }
                catch (DbEntityValidationException ex)
                {
                    var errs = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
                    msg = string.Join(", ", errs);
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "QueryByParam", msg);
                    return new List<T>();
                }
                catch (Exception ex)
                {
                    msg = ex.Message;
                    totalNum = 0;
                    currentPage = 1;
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "QueryByParam", ex.Message);
                    return new List<T>();
                }
            }
        }
        #endregion
        #region æ’入新的对象
        /// <summary>
        /// å°†è‡ªå®šä¹‰çš„实体T的实例列表批量保存到数据库
        /// </summary>
        /// <param name="ts">自定义类型T的实例列表</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>保存的数量</returns>
        public virtual int Save(List<T> ts, out string msg)
        {
            msg = "";
            var type = typeof(D);
            using (var dbModel = type.Assembly.CreateInstance(type.FullName) as DbContext)
            {
                try
                {
                    return CommonDao.Save(ts, dbModel);
                }
                catch (DbEntityValidationException ex)
                {
                    var errs = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
                    msg = string.Join(", ", errs);
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Save", msg);
                    return 0;
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex)
                {
                    msg = ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir,  this.ToString(), "Save", ex.Message);
                    return 0;
                }
                catch (Exception ex)
                {
                    msg = ex.HResult == (int)EDbError.记录已存在 ? EDbError.记录已存在.ToString() : ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir,  this.ToString(), "Save", msg);
                    return 0;
                }
            }
        }
        /// <summary>
        /// å°†è‡ªå®šä¹‰çš„实体T的实例保存到数据库
        /// </summary>
        /// <param name="t">自定义类型T的实例</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>新添加T对象的id</returns>
        public virtual int Save(T t, out string msg)
        {
            msg = "";
            var type = typeof(D);
            using (var dbModel = type.Assembly.CreateInstance(type.FullName) as DbContext)
            {
                try
                {
                    return CommonDao.Save(t, dbModel);
                }
                catch (DbEntityValidationException ex)
                {
                    var errs = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
                    msg = string.Join(", ", errs);
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Save", msg);
                    return -1;
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex)
                {
                    msg = ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir,  this.ToString(), "Save", ex.Message);
                    return -1;
                }
                catch (Exception ex)
                {
                    msg = ex.HResult == (int)EDbError.记录已存在 ? EDbError.记录已存在.ToString() : ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir,  this.ToString(), "Save", msg);
                    return -1;
                }
            }
        }
        #endregion
        #region ä¿®æ”¹å¯¹è±¡
        /// <summary>
        /// ä¿®æ”¹è‡ªå®šä¹‰ç±»åž‹T的实体并保存到数据库
        /// </summary>
        /// <param name="t">自定义类型T的实例</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>需改实体的id</returns>
        public virtual int Update(T t, out string msg)
        {
            msg = "";
            var type = typeof(D);
            using (var dbModel = type.Assembly.CreateInstance(type.FullName) as DbContext)
            {
                try
                {
                    return CommonDao.Update(t, dbModel);
                }
                catch (DbEntityValidationException ex)
                {
                    var errs = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
                    msg = string.Join(", ", errs);
                    LogTextHelper.WriteLog(Resources.LogDir,  this.ToString(), "Update", msg);
                    return -1;
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex)
                {
                    msg = ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir,  this.ToString(), "SaveUpdate", ex.Message);
                    return -1;
                }
                catch (Exception ex)
                {
                    msg = ex.HResult == (int)EDbError.记录已存在 ? EDbError.记录已存在.ToString() : ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir,  this.ToString(), "Update", msg);
                    return -1;
                }
            }
        }
        /// <summary>
        /// ä¿®æ”¹è‡ªå®šä¹‰ç±»åž‹T的实体并保存到数据库
        /// </summary>
        /// <param name="t">自定义类型T的实例</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>需改实体的id</returns>
        public virtual int Update(List<T> ts, out string msg)
        {
            msg = "";
            var type = typeof(D);
            using (var dbModel = type.Assembly.CreateInstance(type.FullName) as DbContext)
            {
                try
                {
                    CommonDao.Update(ts, dbModel);
                    return ts.Count;
                }
                catch (DbEntityValidationException ex)
                {
                    var errs = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
                    msg = string.Join(", ", errs);
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Update", msg);
                    return -1;
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex)
                {
                    msg = ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "SaveUpdate", ex.Message);
                    return -1;
                }
                catch (Exception ex)
                {
                    msg = ex.HResult == (int)EDbError.记录已存在 ? EDbError.记录已存在.ToString() : ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Update", msg);
                    return -1;
                }
            }
        }
        #endregion
        #region åˆ é™¤å¯¹è±¡
        /// <summary>
        /// ä»Žæ•°æ®åº“中删除主键为id的记录
        /// </summary>
        /// <param name="id">需要删除对象的id</param>
        /// <param name="msg">异常错误信息</param>
        /// <returns>被删除对象的主键</returns>
        public virtual int Delete(int id, out string msg)
        {
            msg = "";
            var type = typeof(D);
            using (var dbModel = type.Assembly.CreateInstance(type.FullName) as DbContext)
            {
                try
                {
                    return CommonDao.Delete(id, dbModel);
                }
                catch (DbEntityValidationException ex)
                {
                    var errs = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
                    msg = string.Join(", ", errs);
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Delete", msg);
                    return -1;
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex)
                {
                    msg = ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Delete", ex.Message);
                    return -1;
                }
                catch (Exception ex)
                {
                    msg = "记录已被其他对象引用,不能删除";
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Delete", ex.Message);
                    return -1;
                }
            }
        }
        /// <summary>
        /// ä»Žæ•°æ®åº“中批量删除主键列表为ids的记录
        /// </summary>
        /// <param name="id">需要删除对象的id列表</param>
        /// <param name="msg">异常错误信息</param>
        /// <returns>被删除对象的数量</returns>
        public virtual int Delete(List<int> ids, out string msg)
        {
            msg = "";
            var type = typeof(D);
            using (var dbModel = type.Assembly.CreateInstance(type.FullName) as DbContext)
            {
                try
                {
                    return CommonDao.Delete(ids, dbModel);
                }
                catch (DbEntityValidationException ex)
                {
                    var errs = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
                    msg = string.Join(", ", errs);
                    LogTextHelper.WriteLog(Resources.LogDir,  this.ToString(), "Delete", msg);
                    return 0;
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex)
                {
                    msg = ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Delete", ex.Message);
                    return 0;
                }
                catch (Exception ex)
                {
                    msg = "记录已被其他对象引用,不能删除";
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Delete", ex.Message);
                    return 0;
                }
            }
        }
        #endregion
        #region æ‹¼è£…å­—å…¸
        /// <summary>
        /// å°†æ»¡è¶³æ¡ä»¶çš„T类型拼装成以id为键,类型本身为值的字典
        /// </summary>
        /// <param name="param">查询条件</param>
        /// <param name="msg">异常错误消息</param>
        /// <returns>以id为键,类型本身为值的字典</returns>
        public virtual Dictionary<int, T> ToDictionary(QueryParam param,out string msg)
        {
            msg = "";
            var type = typeof(D);
            using (var dbModel = type.Assembly.CreateInstance(type.FullName) as DbContext)
            {
                try
                {
                    return CommonDao.ToDictionary(param, dbModel);
                }
                catch (DbEntityValidationException ex)
                {
                    var errs = ex.EntityValidationErrors.SelectMany(validationResult => validationResult.ValidationErrors).Select(m => m.ErrorMessage);
                    msg = string.Join(", ", errs);
                    LogTextHelper.WriteLog(Resources.LogDir,  this.ToString(), "ToDictionary", msg);
                    return new Dictionary<int, T>();
                }
                catch (Exception ex)
                {
                    msg = ex.Message;
                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "ToDictionary", ex.Message);
                    return new Dictionary<int, T>();
                }
            }
        }
        #endregion
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/Dao/_system~.ini
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/EFHelp.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical.DLA
{
    internal class EFHelp
    {
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/ICommonEntity.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// å…¬ç”¨çš„实体类接口
    /// å¼ å±•
    /// </summary>
    /// <typeparam name="T">自定义的实体类型</typeparam>
    /// <typeparam name="S">ORM中的实体类型</typeparam>
    public interface ICommonEntity<S>
    {
        int Id { get; set; }
        /// <summary>
        /// å°†T类型的实体转换成Orm中的对象
        /// </summary>
        /// <returns>Orm中的对象</returns>
        S ToOrm();
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/IService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@

using System.Collections.Generic;
namespace iWare_SCADA_BusinessLogical
{
    public interface IService<T>
    {
        List<T> QueryByParam(QueryParam param, out string msg);
        int Save(T t, out string msg);
        int Update(T t, out string msg);
        int Delete(int id, out string msg);
        int Delete(List<int> ids, out string msg);
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DLA/QueryParam.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,102 @@
using iWare_SCADA_BusinessLogical.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Globalization;
using System.Windows.Forms;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// ç”¨äºŽæŸ¥è¯¢çš„参数
    /// </summary>
    public class QueryParam
    {
        /// <summary>
        /// ç”¨äºŽç²¾ç¡®æŸ¥è¯¢çš„字段
        /// </summary>
        public Dictionary<string, object> Filter { get; set; }
        /// <summary>
        /// ç”¨äºŽç²¾ç¡®æŸ¥è¯¢ä¸ç­‰å¾çš„字段
        /// </summary>
        public Dictionary<string, object> NotFilter { get; set; }
        /// <summary>
        /// ç”¨äºŽæ¨¡ç³ŠæŸ¥è¯¢çš„字段
        /// </summary>
        public Dictionary<string, object> Search { get; set; }
        /// <summary>
        /// ç”¨äºŽæŽ’序查询的字段
        /// </summary>
        public Dictionary<string, object> Order { get; set; }
        /// <summary>
        /// ç”¨äºŽæŸ¥è¯¢æ—¶é—´å°äºŽç­‰äºŽçš„字段
        /// </summary>
        public Dictionary<string, object> Leqd { get; set; }
        /// <summary>
        /// ç”¨äºŽæŸ¥è¯¢æ—¶é—´å¤§äºŽç­‰äºŽçš„字段
        /// </summary>
        public Dictionary<string, object> Geqd { get; set; }
        /// <summary>
        /// ç”¨äºŽæŸ¥è¯¢æ—¶é—´å°äºŽçš„字段
        /// </summary>
        public Dictionary<string, object> Ltd { get; set; }
        /// <summary>
        /// ç”¨äºŽæŸ¥è¯¢æ—¶é—´å¤§äºŽçš„字段
        /// </summary>
        public Dictionary<string, object> Gtd { get; set; }
        /// <summary>
        /// ç”¨äºŽæŸ¥è¯¢å°äºŽç­‰äºŽçš„字段
        /// </summary>
        public Dictionary<string, object> Leq { get; set; }
        /// <summary>
        /// ç”¨äºŽæŸ¥è¯¢å¤§äºŽç­‰äºŽçš„字段
        /// </summary>
        public Dictionary<string, object> Geq { get; set; }
        /// <summary>
        /// ç”¨äºŽæŸ¥è¯¢å°äºŽçš„字段
        /// </summary>
        public Dictionary<string, object> Lt { get; set; }
        /// <summary>
        /// ç”¨äºŽæŸ¥è¯¢å¤§äºŽçš„字段
        /// </summary>
        public Dictionary<string, object> Gt { get; set; }
        /// <summary>
        /// ç”¨äºŽæŸ¥è¯¢å¤§äºŽçš„字段
        /// </summary>
        public Dictionary<string, object> Neq { get; set; }
        /// <summary>
        /// ç”¨äºŽåˆ†é¡µï¼Œç¬¬å‡ é¡µ
        /// </summary>
        public int PageIndex { get; set; }
        /// <summary>
        /// ç”¨äºŽåˆ†é¡µï¼Œæ¯ä¸ªé¡µé¢çš„æ•°æ®æ•°é‡
        /// </summary>
        public int PageSize { get; set; }
    }
    public class OP60Info
    {
        public string datetime { get; set; }
        public string col2 { get; set; }
        public string value { get; set; }
        public DateTime? datetimeHandle{get;set;}
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DBDataCapture/AlarmLogManager.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
using iWare_SCADA_Model.TableModelSC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    public class AlarmLogManager
    {
        public static List<AlarmLog> GetAlarmLogs()
        {
            using (SCModel db = new SCModel())
            {
                //查询所有
                var query = db.AlarmLog.ToList();//这个不是延迟查询
                return query;
            }
        }
        public static void UpdateAlarmLogs(AlarmLog log)
        {
            using (SCModel db = new SCModel())
            {
                //查询所有
                var query = db.AlarmLog.Where(o => o.id == 1).FirstOrDefault();//这个不是延迟查询
                query.alarmMsg = $"测试啊!{DateTime.Now.ToString()}";
                db.SaveChanges();
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP05.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,112 @@
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// OP05工序监控打码标记
    /// </summary>
    public class DataCaptureHandler_OP05 : DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP05 Instance = new DataCaptureHandler_OP05();
        public List<DataCaptureConfig> _dataCaptureConfig = new List<DataCaptureConfig>();
        public DataCaptureHandler_OP05() {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.FirstOrDefault().WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.FirstOrDefault().DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.FirstOrDefault().DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
            //try
            //{
            //    foreach (var dataCaptureColumnDict in dataCaptureConfig)
            //    {
            //        switch (dataCaptureColumnDict.DataCapturePointCode)
            //        {
            //            case "OP0501":
            //                //_dataCaptureConfig = dataCaptureColumnDict;
            //                IsCaptureflag = true;
            //                return;
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    SystemValue._lbl_Alert_OP0501 = $" {RandomHelper.GenerateRandomCode(4)} OP05工序监控打码标记 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
            //    Log4NetHelper.WriteErrorLog(LogType.PLCOP05, "刷新 OP05工序监控打码标记数据时异常:", ex);
            //}
        }
        public override void DataCaptureStart()
        {
            if(IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig.FirstOrDefault());
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_OP0501 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    try
                    {
                        //_dataCaptureConfig
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_OP0501 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.FirstOrDefault().WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            //业务代码
                            plcService.ReadValuePoint("", "", PLCManger.GetTypeForString(_dataCaptureConfig.FirstOrDefault().DataCaptureColumnType));
                        }
                        SystemValue.lbl_Alert_OP0501 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}";
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP0501 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–OP05工序监控打码标记 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
                        Log4NetHelper.WriteErrorLog(LogType.PLCOP05, "读取 OP05工序监控打码标记数据时异常:", ex);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP0501 = $" {RandomHelper.GenerateRandomCode(4)} OP05工序监控打码标记 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                Log4NetHelper.WriteInfoLog(LogType.PLCOP05, "读OP05工序监控打码标记 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤æ˜¯å¦é…ç½®å¼‚常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP0501.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,472 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// OP05 æ‰“标完成标记,读取工控机中打印二维码信息
    /// </summary>
    public class DataCaptureHandler_OP0501 : DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP0501 Instance = new DataCaptureHandler_OP0501();
        public DataCaptureHandler_OP0501()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        private string CheackPath(string path,int type,int time)
        {
            var directory = Path.GetDirectoryName(path);
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            if (!File.Exists(path))
            {
                File.Create(path).Close();
            }
            string content = "";
            // åŒæ­¥æ¥æºæ•°æ®
            using (StreamReader reader = new StreamReader(path))
            {
                content = reader.ReadToEnd();
                Console.WriteLine("读取的内容是:" + content);
                if (content == null || content == "")
                {
                    switch (type)
                    {
                        case 1: content = DateTimeHelper.GetDateTime().AddYears(time).ToString();break;
                        case 2: content = DateTimeHelper.GetDateTime().AddMonths(time).ToString();break;
                        case 3: content = DateTimeHelper.GetDateTime().AddDays(time).ToString();break;
                        case 4: content = DateTimeHelper.GetDateTime().AddHours(time).ToString();break;
                        case 5: content = DateTimeHelper.GetDateTime().AddMinutes(time).ToString();break;
                        case 6: content = DateTimeHelper.GetDateTime().AddSeconds(time).ToString();break;
                        default:
                            content = DateTimeHelper.GetDateTime().ToString(); break;
                    }
                    //content = DateTimeHelper.GetDateTime().AddMinutes(-10).ToString();
                }
            }
            return content;
        }
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                //// plc连接
                //var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                //if (plcService == null)
                //{
                //    SystemValue.lbl_Alert_OP0501 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                //    return;
                //}
                //if (plcService != null && !plcService.IsConnected)
                //{
                //    plcService.Close();
                //    plcService.OpenService();
                //}
                while (true)
                {
                    ThreadStatusMonitor threadStatusMonitor = new ThreadStatusMonitor();
                    threadStatusMonitor.Threadcode = DataCapturePointCode;
                    threadStatusMonitor.Threadcname = DataCapturePointCname;
                    threadStatusMonitor.Threadendtime = DateTime.Now;
                    threadStatusMonitor.Threadlastmodifytime = DateTime.Now;
                    threadStatusMonitor.Threadstatue = 0;
                    threadStatusMonitor.ThreadId = Thread.CurrentThread.ManagedThreadId.ToString();
                    try
                    {
                        ////_dataCaptureConfig
                        //if (plcService == null || !plcService.IsConnected)
                        //{
                        //    SystemValue.lbl_Alert_OP0501 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                        //    plcService.Close();
                        //    plcService.OpenService();
                        //    Thread.Sleep(100);
                        //    continue;
                        //}
                        //else
                        {
                            //var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            //if (SystemValue.value_OP0501.Equals("0") && value.ToString().Equals("1"))
                            {//当上一标记位0,当前获取标记为1时,
                             //触发操作,  å¹¶ç»™é™æ€å˜é‡èµ‹å€¼ä¸º1
                             //业务代码
                             //读码完成没啥业务操作,获取二维码,然后放到队列中
                                #region ä»Žå·¥æŽ§æœºèŽ·å–ç›¸å…³äºŒç»´ç 
                                var path = ConfigHelper.GetConfigString("WorkPeiceIDPath");//打码机打码二维码路径
                                //扫描共享目录并将新的文件扫描返回  ä¸€èˆ¬èŠ‚æ‹åœ¨15秒左右(可以确认一下)
                                //扫描修改时间在上次扫描时间之前10秒到当前时间的之间的文件
                                var dataTime = CheackPath(Environment.CurrentDirectory + "\\OP05-LastScapTime.txt",4,-10);
                                var scapEndTime = DateTimeHelper.GetDateTime();
                                var newFiles = FileHelper.DetectNewFilesCSV(path, 60, Convert.ToDateTime(dataTime), scapEndTime);
                                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
                                    $"{_dataCaptureConfig.WorkingProcedure}工序读取工控机中二维码信息开始:{dataTime}");
                                foreach (System.IO.FileInfo file in newFiles)
                                {
                                    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
                                        $"{_dataCaptureConfig.WorkingProcedure}工序读取工控机中二维码信息,文件名:{file.FullName}");
                                    DataTable dt = null;
                                    dt = CSVHelper.ReadCSV(file.FullName);
                                    if (dt == null)
                                    {
                                        continue;
                                    }
                                    lock (SystemValue.lock5QRcodeList)
                                    {
                                        #region æ¸…过期缓存
                                        try
                                        {
                                            //清过期缓存
                                            var lstRemoveKey = SystemValue.QRcodeList
                                                .Where(p => p.Value < DateTimeHelper.GetDateTime().AddMinutes(-600))
                                                .Select(p => p.Key).ToList();
                                            if (lstRemoveKey.Count > 0)
                                            {
                                                foreach (var key in lstRemoveKey) SystemValue.QRcodeList.Remove(key);
                                                Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"清除缓存数量:({lstRemoveKey.Count}) å‰©ä½™ç¼“存数量:({SystemValue.QRcodeList.Count})");
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            Log4NetHelper.WriteErrorLog(LogType.PLCOP05, "清除告警报文ID缓存错误!", ex);
                                        }
                                        #endregion
                                        ////筛选需要处理的二维码信息
                                        //DataRow[] drArr = dt.Select(" æ‰«ç ç»“æžœ='成功'");    //查询
                                        //DataTable dtNew = dt.Clone();
                                        //for (int i = 0; i < drArr.Length; i++)
                                        //{
                                        //    var now = DateTime.Now;
                                        //    var list = drArr[i]["时间"].ToString().Split(':');
                                        //    var d = new DateTime(now.Year, now.Month, now.Day, Convert.ToInt32(list[0]), Convert.ToInt32(list[1]), Convert.ToInt32(list[2]), DateTimeKind.Local);
                                        //    //and æ—¶é—´> '19:19:34:547'
                                        //    if (Convert.ToDateTime(DateTime.Now.ToShortDateString() + " " +drArr[i]["时间"]).TimeOfDay> Convert.ToDateTime(DateTime.Now.ToShortDateString() + " 19:19:34:547").TimeOfDay)
                                        //        dtNew.ImportRow(drArr[i]);
                                        //    //获取到的工件号异常
                                        //    SystemValue.lbl_Alert_OP0501 = $"{_dataCaptureConfig.WorkingProcedure}工序打标完成标记,读取工控机中打印二维码信息:【" + WorkPieceID + "】长度异常,长度不等于22位";
                                        //    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
                                        //        $"{_dataCaptureConfig.WorkingProcedure}工序打标完成标记,读取工控机中打印二维码信息:【" + WorkPieceID + "】长度异常,长度不等于22位");
                                        //}
                                        DataTable newDt = new DataTable();
                                        var dates = file.Name.Split('-', '.');
                                        var date = string.Format("{0:D4}-{1:D2}-{2:D2}", int.Parse(dates[0]), int.Parse(dates[1]), int.Parse(dates[2]));
                                        if (DateTimeHelper.GetDateTime().Date != Convert.ToDateTime(date) && DateTimeHelper.GetDateTime().AddDays(-1).Date != Convert.ToDateTime(date))
                                        {
                                            continue;
                                        }
                                        DataRow[] filteredRows = new DataRow[dt.Rows.Count];
                                        if (dt.Rows.Count > 0)
                                        {
                                            int j = 0;
                                            var cache = DataCache.GetCache("OP501-LastTime");
                                            DateTime? lasttime = null;
                                            if (cache != null)
                                            {
                                                lasttime = Convert.ToDateTime(cache);
                                            }
                                            Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
                                                $"{_dataCaptureConfig.WorkingProcedure}工序读取工控机中二维码信息,工件最新时间:{(cache==null?"无缓存":cache.ToString())}");
                                            for (int i = dt.Rows.Count - 1; i >= 0; i--)
                                            {
                                                try
                                                {
                                                    string timeValue = dt.Rows[i]["时间"].ToString();
                                                    string[] timeComponents = timeValue.Split(':');
                                                    string correctedTime = string.Format("{0:D2}:{1:D2}:{2:D2}", int.Parse(timeComponents[0]), int.Parse(timeComponents[1]), int.Parse(timeComponents[2]));
                                                    var newTime = date + " " + correctedTime;
                                                    dt.Rows[i]["时间"] = newTime;
                                                    var currrentTime = Convert.ToDateTime(dt.Rows[i]["时间"]);
                                                    if (cache == null)
                                                    {
                                                        if (j == 0)
                                                        {
                                                            lasttime = currrentTime;
                                                        }
                                                        var oldTime = DateTime.Now.AddMinutes(-10);
                                                        if (currrentTime <= oldTime)
                                                        {
                                                            break;
                                                        }
                                                        filteredRows[j] = dt.Rows[i];
                                                    }
                                                    else
                                                    {
                                                        var cacheTime = Convert.ToDateTime(cache);
                                                        if (currrentTime <= cacheTime)
                                                        {
                                                            break;
                                                        }
                                                        filteredRows[j] = dt.Rows[i];
                                                    }
                                                    if (lasttime != null && lasttime < currrentTime)
                                                    {
                                                        lasttime = currrentTime;
                                                    }
                                                    j++;
                                                }
                                                catch (Exception ex)
                                                {
                                                    SystemValue.lbl_Alert_OP0501 = $" {_dataCaptureConfig.WorkingProcedure}文件打标时间异常,请查看日志!";
                                                    Log4NetHelper.WriteErrorLog(LogType.PLCOP05, $" {_dataCaptureConfig.WorkingProcedure}文件打标时间,出现异常:", ex);
                                                }
                                            }
                                            filteredRows = filteredRows.Where(item=>item!=null).ToArray();
                                            // è®¾ç½®ç¼“存值
                                            DateTime absoluteExpiration = DateTime.Now.AddDays(30);
                                            TimeSpan slidingExpiration = TimeSpan.FromMinutes(20);
                                            if (slidingExpiration == TimeSpan.Zero)
                                            {
                                                absoluteExpiration = DateTime.Now.AddDays(30);
                                            }
                                            else
                                            {
                                                absoluteExpiration = DateTime.MaxValue;
                                            }
                                            DataCache.SetCache("OP501-LastTime", lasttime, absoluteExpiration, slidingExpiration);
                                            if (filteredRows.Count() <= 0)
                                            {
                                                return;
                                            }
                                            if (file.LastAccessTime < Convert.ToDateTime(dataTime)) continue;
                                            using (StreamWriter writer = new StreamWriter(Environment.CurrentDirectory + "\\OP05-LastScapTime.txt", false))
                                            {
                                                dataTime = file.LastAccessTime.ToString();
                                                writer.Write(dataTime);
                                            }
                                            Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"读取到{filteredRows.Count()}行数据,时间范围是{filteredRows[j-1]["时间"]}-{filteredRows[0]["时间"]}");
                                        }
                                        //// å·¥ä»¶å·ï¼ˆäºŒç»´ç å€¼ï¼‰
                                        //string WorkPieceID = dt.Rows[0][""].ToString();
                                        //if (WorkPieceID.Length != 22)
                                        //{
                                        //    //获取到的工件号异常
                                        //    SystemValue.lbl_Alert_HMI01 = $"{_dataCaptureConfig.WorkingProcedure}工序打标完成标记,读取工控机中打印二维码信息:【" + WorkPieceID + "】长度异常,长度不等于22位";
                                        //    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
                                        //        $"{_dataCaptureConfig.WorkingProcedure}工序打标完成标记,读取工控机中打印二维码信息:【" + WorkPieceID + "】长度异常,长度不等于22位");
                                        //}
                                        //SystemValue.QRcodeList.Add("", DateTimeHelper.GetDateTime());//二维码添加到列表中
                                        WorkPieceLog wplog = new WorkPieceLog();
                                        wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                        wplog.WorkingProcedure = "OP05";
                                        //wplog.EquipmentID = WorkingProcedure;
                                        wplog.Remarks = "cs";
                                        wplog.MonitoringPoint = DataCapturePointCode;
                                        wplog.CreatedTime = DateTimeHelper.GetDateTime();
                                        wplog.CreatedUserName = CultureInfo.CurrentUICulture.Name;
                                        wplog.UpdatedTime = DateTimeHelper.GetDateTime();
                                        wplog.UpdatedUserName = "测试";
                                        wplog.IsDeleted = false;
                                        wplog.EquipmentID = "123";
                                        wplog.OnlineTime = DateTimeHelper.GetDateTime();//给上线时间用
                                        wplog.QualityState = 1;
                                        wplog.ProcessingDuration = 1;
                                        wplog.MachineToolState = 1;
                                        wplog.AlertType = 1;
                                        wplog.WorkPieceNumber = 1;
                                        wplog.WorkPieceOnlineTime = Convert.ToDateTime(dataTime);
                                        wplog.WorkPieceOfflineTime = Convert.ToDateTime(dataTime).AddHours(1);
                                        wplog.WorkPieceStartMachiningTime = Convert.ToDateTime(dataTime);
                                        wplog.WorkPieceEndMachiningTime = DateTime.Now.AddDays(7);
                                        wplog.KnifeEdgeNumber = 10;
                                        wplog.KnifeToolLife = 10;
                                        wplog.KnifeToolEarlyWarningLife = 3;
                                        wplog.KnifeToolSurplusLife = 10;
                                        foreach (var item in filteredRows)
                                        {
                                            Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
                                                   $"{_dataCaptureConfig.WorkingProcedure}工序读取工控机中二维码信息,读取工件二维码:{item["打标内容"].ToString()}");
                                            if (item == null) break;
                                            wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                            wplog.WorkPieceID = item["打标内容"].ToString();
                                            wplog.OfflineTime = Convert.ToDateTime(dataTime);
                                            wplog.Remarks = item["时间"].ToString() + "|" + item["打标内容"].ToString() + "|" + item["打标内容"].ToString() + "|" + item["扫码等级"].ToString() + "|" + item["扫码结果"].ToString();
                                            WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), null, _dataCaptureConfig.IsFeedback);
                                            threadStatusMonitor.Threadstatue = 1;
                                        }
                                    }
                                }
                                #endregion
                                var fileCount = newFiles.Cast<string>().ToList();
                                Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"扫描完成,共扫描到:({fileCount.Count()})个文件");
                            }
                            //SystemValue.value_OP0501 = value.ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP0501 = $" {_dataCaptureConfig.WorkingProcedure}工序打标完成标记,读取工控机中打印二维码信息,出现异常,请查看日志!";
                        Log4NetHelper.WriteErrorLog(LogType.PLCOP05, $" {_dataCaptureConfig.WorkingProcedure}工序打标完成标记,读取工控机中打印二维码信息,出现异常:", ex);
                    }
                    finally
                    {
                        WorkPieceInfoManager.ThreadMonitor(threadStatusMonitor);
                    }
                    //线程多久执行一次(不包含业务处理时间)
                    if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                    {
                        Thread.Sleep(3000);
                    }
                    else
                    {
                        Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP0501 = $"{_dataCaptureConfig.WorkingProcedure}工序打标完成标记,读取工控机中打印二维码信息,不做校验,请确认配置信息!";
                Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"{_dataCaptureConfig.WorkingProcedure}工序打标完成标记,读取工控机中打印二维码信息,不做校验,请确认配置异常");
            }
            //if (SystemValue.isStartedModel)
            //{
            //    #region ä»Žå·¥æŽ§æœºèŽ·å–ç›¸å…³äºŒç»´ç 
            //    //扫描共享目录并将新的文件扫描返回
            //    var newFiles = FileHelper.DetectNewFilesCSV("", 10, DateTimeHelper.GetDateTime());
            //    foreach (System.IO.FileInfo file in newFiles)
            //    {
            //        var datatable = CSVHelper.ReadCSV(file.FullName);
            //    }
            //    lock (SystemValue.lock5QRcodeList)
            //    {
            //        try
            //        {
            //            var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
            //            //清过期缓存
            //            var lstRemoveKey = SystemValue.QRcodeList
            //                .Where(p => p.Value < DateTimeHelper.GetDateTime().AddMinutes(-600))
            //                .Select(p => p.Key).ToList();
            //            if (lstRemoveKey.Count > 0)
            //            {
            //                foreach (var key in lstRemoveKey) SystemValue.QRcodeList.Remove(key);
            //                Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"清除缓存数量:({lstRemoveKey.Count}) å‰©ä½™ç¼“存数量:({SystemValue.QRcodeList.Count})");
            //            }
            //            WorkPieceLog wplog = new WorkPieceLog();
            //            wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
            //            wplog.WorkingProcedure = WorkingProcedure;
            //            //wplog.EquipmentID = WorkingProcedure;
            //            wplog.Remarks = WorkingProcedure;
            //            wplog.MonitoringPoint = DataCapturePointCode;
            //            wplog.CreatedTime = DateTimeHelper.GetDateTime();
            //            wplog.CreatedUserName = DataCapturePointCode;
            //            wplog.UpdatedTime = DateTimeHelper.GetDateTime();
            //            wplog.UpdatedUserName = DataCapturePointCode;
            //            wplog.IsDeleted = false;
            //            wplog.EquipmentID= _dataCaptureConfig.EquipmentID;
            //            wplog.QualityState = (int)QualityState.OK;
            //            wplog.OnlineTime = DateTimeHelper.GetDateTime();//给上线时间用
            //            wplog.WorkPieceID = WorkPieceID;
            //            if (wplog.WorkPieceID.Length != 22)
            //            {//获取到的工件号异常
            //            }
            //            else
            //            {//获取其他配置的待采集项
            //                //foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
            //                //{
            //                //    var valuecol = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
            //                //    wplog.GetType().GetProperty(col.DataCaptureColumnTabelName).SetValue(wplog, valuecol);//给动态字段赋值
            //                //}
            //            }
            //            //读取二维码后更新数据库
            //            var info = WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), plcService, _dataCaptureConfig.IsFeedback);
            //        }
            //        catch (Exception ex)
            //        {
            //            Log4NetHelper.WriteErrorLog(LogType.PLCOP05, "清除告警报文ID缓存错误!", ex);
            //        }
            //        if (SystemValue.QRcodeList.ContainsKey(WorkPieceID))
            //        {
            //            SystemValue.QRcodeList[WorkPieceID] = DateTimeHelper.GetDateTime();
            //        }
            //        else
            //        {
            //            SystemValue.QRcodeList.Add(WorkPieceID, DateTimeHelper.GetDateTime());//二维码添加到列表中
            //        }
            //    }
            //    #endregion
            //}
            //else
            //{
            //}
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP0502.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,191 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// è¯»ç å®Œæˆæ ‡è®°ï¼Œè¯»å–工控机中读取二维码信息
    /// </summary>
    public class DataCaptureHandler_OP0502 : DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP0502 Instance = new DataCaptureHandler_OP0502();
        public DataCaptureHandler_OP0502()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                // plc连接
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_OP0501 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    try
                    {
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_OP0502 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            if (SystemValue.value_OP0502.Equals("0") && value.ToString().Equals("1"))
                            {
                                #region ä»Žå·¥æŽ§æœºèŽ·å–ç›¸å…³äºŒç»´ç 
                                //打码机打码二维码路径
                                var path = ConfigHelper.GetConfigString("WorkPeiceIDPath");
                                //扫描共享目录并将新的文件扫描返回  ä¸€èˆ¬èŠ‚æ‹åœ¨15秒左右(可以确认一下)
                                var newFiles = FileHelper.DetectNewFilesCSV(path, 10, DateTimeHelper.GetDateTime(), DateTimeHelper.GetDateTime());
                                foreach (System.IO.FileInfo file in newFiles)
                                {
                                    DataTable dt = null;
                                    dt = CSVHelper.ReadCSV(file.FullName);
                                    if (dt == null)
                                    {
                                        continue;
                                    }
                                    lock (SystemValue.lock5QRcodeList)
                                    {
                                        #region æ¸…过期缓存
                                        try
                                        {
                                            //清过期缓存
                                            var lstRemoveKey = SystemValue.QRcodeList
                                                .Where(p => p.Value < DateTimeHelper.GetDateTime().AddMinutes(-600))
                                                .Select(p => p.Key).ToList();
                                            if (lstRemoveKey.Count > 0)
                                            {
                                                foreach (var key in lstRemoveKey) SystemValue.QRcodeList.Remove(key);
                                                Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"清除缓存数量:({lstRemoveKey.Count}) å‰©ä½™ç¼“存数量:({SystemValue.QRcodeList.Count})");
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            Log4NetHelper.WriteErrorLog(LogType.PLCOP05, "清除告警报文ID缓存错误!", ex);
                                        }
                                        #endregion
                                        // å·¥ä»¶å·ï¼ˆäºŒç»´ç å€¼ï¼‰
                                        string WorkPieceID = dt.Rows[0][""].ToString();
                                        if (WorkPieceID.Length != 22)
                                        {
                                            //获取到的工件号异常
                                            SystemValue.lbl_Alert_OP0502 = $"{_dataCaptureConfig.WorkingProcedure}工序读码完成标记,读取工控机中读取二维码信息:【" + WorkPieceID + "】长度异常,长度不等于22位";
                                            Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
                                                $"{_dataCaptureConfig.WorkingProcedure}工序读码完成标记,读取工控机中读取二维码信息:【" + WorkPieceID + "】长度异常,长度不等于22位");
                                        }
                                        if (SystemValue.QRcodeList.ContainsKey(WorkPieceID))
                                        {
                                            // å­˜åœ¨æ¸…理缓存
                                            SystemValue.QRcodeList.Remove(WorkPieceID);
                                        }
                                        else
                                        {
                                            // ä¸å­˜åœ¨åé¦ˆPLC
                                            var col = colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode).ToList();
                                            if (col.Count == 0)
                                            {
                                                SystemValue.lbl_Alert_OP0502 = $"{_dataCaptureConfig.WorkingProcedure}工序读码完成标记,读取工控机中读取二维码信息不存在,请先配置数据收集点对于字段表信息!";
                                                Log4NetHelper.WriteErrorLog(LogType.PLCOP05, $"{_dataCaptureConfig.WorkingProcedure}工序读码完成标记,读取工控机中读取二维码信息不存在,请先配置数据收集点对于字段表信息!");
                                            }
                                            plcService.WriteValuePoint(col[0].DbNumber, col[0].Offset, col[0].DataCaptureColumnTabelName);
                                        }
                                        SystemValue.QRcodeList.Add("", DateTimeHelper.GetDateTime());//二维码添加到列表中
                                        //WorkPieceLog wplog = new WorkPieceLog();
                                        //wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                        //wplog.WorkingProcedure = WorkingProcedure;
                                        ////wplog.EquipmentID = WorkingProcedure;
                                        //wplog.Remarks = WorkingProcedure;
                                        //wplog.MonitoringPoint = DataCapturePointCode;
                                        //wplog.CreatedTime = DateTimeHelper.GetDateTime();
                                        //wplog.CreatedUserName = DataCapturePointCode;
                                        //wplog.UpdatedTime = DateTimeHelper.GetDateTime();
                                        //wplog.UpdatedUserName = DataCapturePointCode;
                                        //wplog.IsDeleted = false;
                                        //wplog.EquipmentID = _dataCaptureConfig.EquipmentID;
                                        //wplog.OnlineTime = DateTimeHelper.GetDateTime();//给上线时间用
                                        //wplog.WorkPieceID = dt.Rows[0][""].ToString();
                                        // è¯»å–二维码后更新数据库
                                        // var info = WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), plcService, _dataCaptureConfig.IsFeedback);
                                    }
                                }
                                #endregion
                            }
                            SystemValue.value_OP0502 = value.ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP0502 = $" {_dataCaptureConfig.WorkingProcedure}工序读码完成标记,读取工控机中读取二维码信息,出现异常,请查看日志!";
                        Log4NetHelper.WriteErrorLog(LogType.PLCOP05, $" {_dataCaptureConfig.WorkingProcedure}工序读码完成标记,读取工控机中读取二维码信息,出现异常:", ex);
                    }
                    //线程多久执行一次(不包含业务处理时间)
                    if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                    {
                        Thread.Sleep(5000);
                    }
                    else
                    {
                        Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP0502 = $"{_dataCaptureConfig.WorkingProcedure}工序读码完成标记,读取工控机中读取二维码信息,不做校验,请确认配置信息!";
                Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"{_dataCaptureConfig.WorkingProcedure}工序读码完成标记,读取工控机中读取二维码信息,不做校验,请确认配置异常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP0503.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using iWare_SCADA_Model;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using iWare_SCADA_BusinessLogical.Utils;
using System.Threading;
using iWare_SCADA_BusinessLogical.BLL;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// å·¥ä»¶æŽ¨å‡ºæ ‡è®°ï¼Œç¡®è®¤å·¥ä»¶æ˜¯å¦è¢«æŽ¨å‡ºï¼ˆä¸åˆæ ¼ï¼‰
    /// </summary>
    public class DataCaptureHandler_OP0503 : DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP0503 Instance = new DataCaptureHandler_OP0503();
        public DataCaptureHandler_OP0503()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_OP0503 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    try
                    {
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_OP0503 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            object value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            if (SystemValue.value_OP0503.Equals("0") && value.ToString().Equals("1"))
                            {
                                string WorkPieceID = "";
                                string HowToExit = "";
                                foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                {
                                    switch (col.DataCaptureColumnTabelName)
                                    {
                                        case "WorkPieceID":
                                            WorkPieceID = plcService.ReadValuePoint(col.DbNumber, col.Offset, PLCManger.GetTypeForString(col.DataCaptureColumnType)).ToString();
                                            break;
                                        case "HowToExit":
                                            HowToExit = plcService.WriteValuePoint(col.DbNumber, col.Offset, PLCManger.GetTypeForString(col.DataCaptureColumnType)).ToString();
                                            break;
                                        default:
                                            break;
                                    }
                                }
                                if (WorkPieceID.Length != 22)
                                {
                                    SystemValue.lbl_Alert_OP0503 = $"工件推出标记,确认工件号:【" + WorkPieceID + "】长度异常,长度不等于22位";
                                    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"工件推出标记,确认工件号:【" + WorkPieceID + "】长度异常,长度不等于22位");
                                }
                                else
                                {
                                    WorkPieceLog wplog = new WorkPieceLog();
                                    wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                    wplog.WorkPieceID = WorkPieceID;
                                    wplog.WorkingProcedure = WorkingProcedure;
                                    wplog.EquipmentID = WorkingProcedure;
                                    wplog.Remarks = WorkingProcedure;
                                    wplog.MonitoringPoint = DataCapturePointCode;
                                    wplog.CreatedTime = DateTimeHelper.GetDateTime();
                                    wplog.CreatedUserName = DataCapturePointCode;
                                    wplog.IsDeleted = false;
                                    if ("NOOK".Equals(HowToExit))
                                    {
                                        // NOOK退出
                                        //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                                        WorkPieceInfoManager.WorkPiecePushOff(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                                    }
                                    else if("SPC".Equals(HowToExit))
                                    {
                                        //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                                        WorkPieceInfoManager.WorkPieceSPCPushOff(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                                    }
                                }
                            }
                            SystemValue.value_OP0503 = value.ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP0503 = $"读取{WorkingProcedure}工序工件推出标记,确认工件是否被推出监控,出现异常,请查看日志!";
                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取{WorkingProcedure}工序工件推出标记,确认工件是否被推出监控,数据时异常:", ex);
                    }
                    //线程多久执行一次(不包含业务处理时间)
                    if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                    {
                        Thread.Sleep(5000);
                    }
                    else
                    {
                        Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP0503 = $"读取{WorkingProcedure}工序工件推出标记,确认工件是否被推出监控,请确认配置信息!";
                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取{WorkingProcedure}工序工件推出标记,确认工件是否被推出监控,请确认是否配置异常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP0504.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,139 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// ä¸‹æ–™æ ‡è®°ï¼Œç¡®è®¤å·¥ä»¶OP05工序已完成
    /// </summary>
    public class DataCaptureHandler_OP0504 : DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP0504 Instance = new DataCaptureHandler_OP0504();
        public DataCaptureHandler_OP0504()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_OP0504 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    try
                    {
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_OP0504 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            object value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            if (SystemValue.value_OP0504.Equals("0") && value.ToString().Equals("1"))
                            {
                                string WorkPieceID = "";
                                foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                {
                                    switch (col.DataCaptureColumnTabelName)
                                    {
                                        case "WorkPieceID":
                                            WorkPieceID = plcService.ReadValuePoint(col.DbNumber, col.Offset, PLCManger.GetTypeForString(col.DataCaptureColumnType)).ToString();
                                            break;
                                        default:
                                            break;
                                    }
                                }
                                if (WorkPieceID.Length != 22)
                                {
                                    SystemValue.lbl_Alert_OP0504 = $"工件推出标记,确认工件号:【" + WorkPieceID + "】长度异常,长度不等于22位";
                                    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"工件推出标记,确认工件号:【" + WorkPieceID + "】长度异常,长度不等于22位");
                                }
                                else
                                {
                                    // OP05工序完成
                                    WorkPieceLog wplog = new WorkPieceLog();
                                    wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                    wplog.WorkPieceID = WorkPieceID;
                                    wplog.WorkingProcedure = WorkingProcedure;
                                    wplog.EquipmentID = WorkingProcedure;
                                    wplog.Remarks = WorkingProcedure;
                                    wplog.MonitoringPoint = DataCapturePointCode;
                                    wplog.CreatedTime = DateTimeHelper.GetDateTime();
                                    wplog.CreatedUserName = DataCapturePointCode;
                                    wplog.IsDeleted = false;
                                    //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                                    WorkPieceInfoManager.WorkingProcedureComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                                }
                            }
                            SystemValue.value_OP0503 = value.ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP0504 = $"读取{WorkingProcedure}工序下料标记确认工件工序已完成监控,出现异常,请查看日志!";
                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取{WorkingProcedure}工序下料标记确认工件工序已完成监控,数据时异常:", ex);
                    }
                    if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                    {
                        Thread.Sleep(5000);
                    }
                    else
                    {
                        Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP0504 = $"读取{WorkingProcedure}工序下料标记确认工件工序已完成监控,请确认配置信息!";
                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取{WorkingProcedure}工序下料标记确认工件工序已完成监控,请确认是否配置异常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP1001.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,154 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// OP10读码完成标记
    /// </summary>
    public class DataCaptureHandler_OP1001: DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP1001 Instance = new DataCaptureHandler_OP1001();
        public DataCaptureHandler_OP1001()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
            //try
            //{
            //    foreach (var dataCaptureColumnDict in dataCaptureConfig)
            //    {
            //        switch (dataCaptureColumnDict.DataCapturePointCode)
            //        {
            //            case "OP1001":
            //                //_dataCaptureConfig = dataCaptureColumnDict;
            //                IsCaptureflag = true;
            //                return;
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    SystemValue.lbl_Alert_OP1001 = $" {RandomHelper.GenerateRandomCode(4)} OP05工序监控打码标记 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
            //    Log4NetHelper.WriteErrorLog(LogType.PLCOP05, "刷新 OP05工序监控打码标记数据时异常:", ex);
            //}
        }
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_OP1001 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    try
                    {
                        //_dataCaptureConfig
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_OP1001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            if (SystemValue.value_OP1001.Equals("0") && value.ToString().Equals("1"))
                            {//当上一标记位0,当前获取标记为1时,
                             //触发操作,  å¹¶ç»™é™æ€å˜é‡èµ‹å€¼ä¸º1
                             //业务代码
                                WorkPieceLog wplog = new WorkPieceLog();
                                wplog.WorkingProcedure = "OP10";
                                wplog.EquipmentID = "OP10";
                                wplog.Remarks = "OP10";
                                wplog.MonitoringPoint = "OP1001";
                                foreach (var col in colConfig)
                                {
                                    switch(col.DbNumber+ col.Offset)
                                    {
                                        case "":
                                            var valuecol = plcService.ReadValuePoint(col.DbNumber, col.Offset, PLCManger.GetTypeForString(col.DataCaptureColumnType));
                                            wplog.WorkPieceID = valuecol.ToString();
                                            break;
                                    }
                                }
                                //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                                WorkPieceInfoManager.ReadQRcode(wplog, LogType.PLCOP10, plcService, _dataCaptureConfig.IsFeedback);
                                //判断是否跳序,上一工序质量是否合格
                                //反馈给PLC,写入
                            }
                            SystemValue.value_OP1001 = value.ToString();
                        }
                        SystemValue.lbl_Alert_OP1001 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}";
                        if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                        {
                            Thread.Sleep(5000);
                        }
                        else
                        {
                            Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP1001 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{DataCapturePointCode}工序上线标记 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
                        Log4NetHelper.WriteErrorLog(LogType.PLCOP05, $"读取 {DataCapturePointCode}工序上线数据时异常:", ex);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP1001 = $" {RandomHelper.GenerateRandomCode(4)} {DataCapturePointCode}工序上线标记 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                Log4NetHelper.WriteInfoLog(LogType.PLCOP10, $"{DataCapturePointCode}上线标记 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤æ˜¯å¦é…ç½®å¼‚常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP1002.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,171 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// OP10测试完成标记 ï¼ˆOP10)
    /// </summary>
    public class DataCaptureHandler_OP1002: DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP1002 Instance = new DataCaptureHandler_OP1002();
        public DataCaptureHandler_OP1002()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_OP1002 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{WorkingProcedure}的PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    ThreadStatusMonitor threadStatusMonitor = new ThreadStatusMonitor();
                    threadStatusMonitor.Threadcode = DataCapturePointCode;
                    threadStatusMonitor.Threadcname = DataCapturePointCname;
                    threadStatusMonitor.Threadendtime = DateTime.Now;
                    threadStatusMonitor.Threadlastmodifytime = DateTime.Now;
                    threadStatusMonitor.Threadstatue = 0;
                    threadStatusMonitor.ThreadId = Thread.CurrentThread.ManagedThreadId.ToString();
                    try
                    {
                        //_dataCaptureConfig
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_OP1002 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            if (SystemValue.value_OP1002.Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE"))
                            {//当上一标记位0,当前获取标记为1时,
                             //触发操作,  å¹¶ç»™é™æ€å˜é‡èµ‹å€¼ä¸º1
                             //业务代码
                                WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                                wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                wplog.WorkingProcedure = WorkingProcedure;
                                wplog.EquipmentID = WorkingProcedure;
                                wplog.Remarks = WorkingProcedure;
                                wplog.MonitoringPoint = DataCapturePointCode;
                                wplog.CreatedTime = DateTimeHelper.GetDateTime();
                                wplog.CreatedUserName = DataCapturePointCode;
                                wplog.UpdatedTime = DateTimeHelper.GetDateTime();
                                wplog.UpdatedUserName = "自动";
                                wplog.OnlineTime = DateTimeHelper.GetDateTime();
                                wplog.IsDeleted = false;
                                wplog.QualityType = QualityType.Online.ToString();
                                foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                {
                                    try
                                    {
                                        var valuecol = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
                                        //wplog.GetType().GetProperty(col.DataCaptureColumnTabelName).SetValue(wplog, valuecol);//给动态字段赋值
                                        var set = wplog.GetType().GetProperty(col.DataCaptureColumnTabelName);
                                        if (set == null)
                                        {
                                            Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {WorkingProcedure}工序监控读码标记 è¯»å–工件码动态由于字段名没找到,赋值【{WorkingProcedure ?? "空字符串"}】失败{wplog.Id}");
                                        }
                                        set.SetValue(wplog, valuecol);//给动态字段赋值
                                    }
                                    catch (Exception setex)
                                    {
                                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {WorkingProcedure}工序监控读码标记 è¯»å–工件码动态赋值【{WorkingProcedure ?? "空字符串"}】异常{wplog.Id}", setex);
                                    }
                                }
                                //#region å·¥æŽ§æœºè¯»å–质量信息
                                ////扫描共享目录并将新的文件扫描返回
                                //var newFiles = FileHelper.DetectNewFilesCSV("", 10, DateTimeHelper.GetDateTime(), DateTimeHelper.GetDateTime());
                                //foreach (System.IO.FileInfo file in newFiles)
                                //{
                                //    var datatable = CSVHelper.ReadCSV(file.FullName);
                                //}
                                //#endregion
                                //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                                WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                                threadStatusMonitor.Threadstatue = 1;
                            }
                            SystemValue.value_OP1002 = value.ToString();
                        }
                        SystemValue.lbl_Alert_OP1002 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}";
                        if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                        {
                            Thread.Sleep(5000);
                        }
                        else
                        {
                            Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP1002 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{DataCapturePointCode}质量信息 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode}质量信息时异常:", ex);
                    }
                    finally
                    {
                        WorkPieceInfoManager.ThreadMonitor(threadStatusMonitor);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP1002 = $" {RandomHelper.GenerateRandomCode(4)} {DataCapturePointCode}质量信息 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}质量信息 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤æ˜¯å¦é…ç½®å¼‚常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP1003.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,172 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// OP10测试完成标记 ï¼ˆOP40)
    /// </summary>
    public class DataCaptureHandler_OP1003 : DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP1003 Instance = new DataCaptureHandler_OP1003();
        public DataCaptureHandler_OP1003()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_OP1003 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{WorkingProcedure}的PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    ThreadStatusMonitor threadStatusMonitor = new ThreadStatusMonitor();
                    threadStatusMonitor.Threadcode = DataCapturePointCode;
                    threadStatusMonitor.Threadcname = DataCapturePointCname;
                    threadStatusMonitor.Threadendtime = DateTime.Now;
                    threadStatusMonitor.Threadlastmodifytime = DateTime.Now;
                    threadStatusMonitor.Threadstatue = 0;
                    threadStatusMonitor.ThreadId = Thread.CurrentThread.ManagedThreadId.ToString();
                    try
                    {
                        //_dataCaptureConfig
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_OP1003 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            if (SystemValue.value_OP1003.Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE"))
                            {//当上一标记位0,当前获取标记为1时,
                             //触发操作,  å¹¶ç»™é™æ€å˜é‡èµ‹å€¼ä¸º1
                             //业务代码
                                WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                                wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                wplog.WorkingProcedure = WorkingProcedure;
                                wplog.EquipmentID = WorkingProcedure;
                                wplog.Remarks = WorkingProcedure;
                                wplog.MonitoringPoint = DataCapturePointCode;
                                wplog.CreatedTime = DateTimeHelper.GetDateTime();
                                wplog.CreatedUserName = DataCapturePointCode;
                                wplog.UpdatedTime = DateTimeHelper.GetDateTime();
                                wplog.UpdatedUserName = "自动";
                                wplog.OnlineTime = DateTimeHelper.GetDateTime();
                                wplog.IsDeleted = false;
                                foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                {
                                    try
                                    {
                                        var valuecol = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
                                        //wplog.GetType().GetProperty(col.DataCaptureColumnTabelName).SetValue(wplog, valuecol);//给动态字段赋值
                                        var set = wplog.GetType().GetProperty(col.DataCaptureColumnTabelName);
                                        if (set == null)
                                        {
                                            Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {WorkingProcedure}工序监控读码标记 è¯»å–工件码动态由于字段名没找到,赋值【{WorkingProcedure ?? "空字符串"}】失败{wplog.Id}");
                                        }
                                        set.SetValue(wplog, valuecol);//给动态字段赋值
                                    }
                                    catch (Exception setex)
                                    {
                                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {WorkingProcedure}工序监控读码标记 è¯»å–工件码动态赋值【{WorkingProcedure ?? "空字符串"}】异常{wplog.Id}", setex);
                                    }
                                }
                                if (wplog.WorkPieceID.Length != 22)
                                {//获取到的工件号异常
                                    Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {WorkingProcedure}工序监控读码标记 è¯»å–工件码数据时异常:");
                                    continue;
                                }
                                //#region å·¥æŽ§æœºè¯»å–质量信息
                                ////扫描共享目录并将新的文件扫描返回
                                //var newFiles = FileHelper.DetectNewFilesCSV("", 10, DateTimeHelper.GetDateTime(), DateTimeHelper.GetDateTime());
                                //foreach (System.IO.FileInfo file in newFiles)
                                //{
                                //    var datatable = CSVHelper.ReadCSV(file.FullName);
                                //}
                                //#endregion
                                //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                                WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                                threadStatusMonitor.Threadstatue = 1;
                            }
                            SystemValue.value_OP1003 = value.ToString();
                        }
                        SystemValue.lbl_Alert_OP1003 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}";
                        if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                        {
                            Thread.Sleep(5000);
                        }
                        else
                        {
                            Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP1003 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{DataCapturePointCode}质量信息 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode}质量信息时异常:", ex);
                    }
                    finally
                    {
                        WorkPieceInfoManager.ThreadMonitor(threadStatusMonitor);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP1003 = $" {RandomHelper.GenerateRandomCode(4)} {DataCapturePointCode}质量信息 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}质量信息 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤æ˜¯å¦é…ç½®å¼‚常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP1004.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,171 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// OP10/OP40推出标记
    /// </summary>
    public class DataCaptureHandler_OP1004: DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP1004 Instance = new DataCaptureHandler_OP1004();
        public DataCaptureHandler_OP1004()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_OP1004 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    ThreadStatusMonitor threadStatusMonitor = new ThreadStatusMonitor();
                    threadStatusMonitor.Threadcode = DataCapturePointCode;
                    threadStatusMonitor.Threadcname = DataCapturePointCname;
                    threadStatusMonitor.Threadendtime = DateTime.Now;
                    threadStatusMonitor.Threadlastmodifytime = DateTime.Now;
                    threadStatusMonitor.Threadstatue = 0;
                    threadStatusMonitor.ThreadId = Thread.CurrentThread.ManagedThreadId.ToString();
                    try
                    {
                        //_dataCaptureConfig
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_OP1004 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            if (SystemValue.value_OP1004.Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE"))
                            {//当上一标记位0,当前获取标记为1时,
                             //触发操作,  å¹¶ç»™é™æ€å˜é‡èµ‹å€¼ä¸º1
                             //业务代码  1.取推出标记,2取推出原因(1:nok,2和3:spc,4:状态不明 ï¼‰ï¼Œ3 å–推出二维码
                                WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                                wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                wplog.WorkingProcedure = WorkingProcedure;
                                wplog.EquipmentID = WorkingProcedure;
                                wplog.MonitoringPoint = DataCapturePointCode;
                                wplog.CreatedTime = DateTimeHelper.GetDateTime();
                                wplog.CreatedUserName = DataCapturePointCode;
                                wplog.UpdatedTime = DateTimeHelper.GetDateTime();
                                wplog.UpdatedUserName = "自动";
                                wplog.OnlineTime = DateTimeHelper.GetDateTime();
                                wplog.IsDeleted = false;
                                foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                {
                                    try
                                    {
                                        var valuecol = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
                                        //wplog.GetType().GetProperty(col.DataCaptureColumnTabelName).SetValue(wplog, valuecol);//给动态字段赋值
                                        var set = wplog.GetType().GetProperty(col.DataCaptureColumnTabelName);
                                        if (set == null)
                                        {
                                            Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {WorkingProcedure}工序监控读码标记 è¯»å–工件码动态由于字段名没找到,赋值【{WorkingProcedure ?? "空字符串"}】失败{wplog.Id}");
                                        }
                                        set.SetValue(wplog, valuecol);//给动态字段赋值
                                    }
                                    catch (Exception setex)
                                    {
                                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {WorkingProcedure}工序监控读码标记 è¯»å–工件码动态赋值【{WorkingProcedure ?? "空字符串"}】异常{wplog.Id}", setex);
                                    }
                                }
                                if (wplog.OP10Flag != 1 && wplog.OP10Flag != 2 && wplog.OP10Flag != 3)
                                {//获取到的工件号异常
                                    Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {WorkingProcedure}工序监控读码标记 è¯»å–工件码数据{wplog.WorkPieceID}推出原因[{wplog.OP10Flag}]异常");
                                    wplog.Remarks = $"推出原因[{wplog.OP10Flag}]异常";
                                }
                                if (wplog.OP10Flag == 1)
                                {
                                    WorkPieceInfoManager.WorkPiecePushOff(wplog, LogType.PLCOP10);
                                    threadStatusMonitor.Threadstatue = 1;
                                }
                                //else if (wplog.OP10Flag == 2 || wplog.OP10Flag == 3)
                                else
                                {
                                    WorkPieceInfoManager.WorkPieceSPCPushOff(wplog, LogType.PLCOP10);
                                    threadStatusMonitor.Threadstatue = 1;
                                }
                            }
                            SystemValue.value_OP1004 = value.ToString();
                        }
                        SystemValue.lbl_Alert_OP1004 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}";
                        if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                        {
                            Thread.Sleep(5000);
                        }
                        else
                        {
                            Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP1004 = $" {RandomHelper.GenerateRandomCode(4)} {DataCapturePointCode}推出信息 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}推出信息 æ•°æ®æ—¶å¼‚常:", ex);
                    }
                    finally
                    {
                        WorkPieceInfoManager.ThreadMonitor(threadStatusMonitor);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP1004 = $" {RandomHelper.GenerateRandomCode(4)} {DataCapturePointCode}推出信息 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼ï¼";
                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}推出信息 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤æ˜¯å¦é…ç½®å¼‚常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/DataCaptureHandler_OP3002.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,194 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// OP30测量完成标记
    /// </summary>
    public class DataCaptureHandler_OP3002: DataCaptureHandler
    {
        public static readonly DataCaptureHandler_OP3002 Instance = new DataCaptureHandler_OP3002();
        public DataCaptureHandler_OP3002()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
            //try
            //{
            //    foreach (var dataCaptureColumnDict in dataCaptureConfig)
            //    {
            //        switch (dataCaptureColumnDict.DataCapturePointCode)
            //        {
            //            case "OP3002":
            //                //_dataCaptureConfig = dataCaptureColumnDict;
            //                IsCaptureflag = true;
            //                return;
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    SystemValue._lbl_Alert_OP3002 = $" {RandomHelper.GenerateRandomCode(4)} OP30工序监控打码标记 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
            //    Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), "刷新 OP30工序监控打码标记数据时异常:", ex);
            //}
        }
        public override void DataCaptureStart()
        {
            if (SystemValue.isStartedModel)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                wplog.WorkingProcedure = WorkingProcedure;
                wplog.EquipmentID = WorkingProcedure;
                wplog.Remarks = WorkingProcedure;
                wplog.MonitoringPoint = DataCapturePointCode;
                wplog.WorkPieceID = "123456";
                wplog.CreatedTime = DateTimeHelper.GetDateTime();
                wplog.CreatedUserName = DataCapturePointCode;
                wplog.IsDeleted = false;
                wplog.QualityType = QualityType.Online.ToString();
                wplog.WorkPieceID = WorkPieceID;
                wplog.EquipmentID = _dataCaptureConfig.EquipmentID;
                wplog.UpdatedTime = DateTimeHelper.GetDateTime();
                wplog.UpdatedUserName = DataCapturePointCode;
                wplog.QualityState = (int)QualityState.NG;
                wplog.QualityStateUpdateUser = WorkingProcedure;
                wplog.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
                wplog.QualityOP30To1 = "QualityOP30To1";
                wplog.QualityOP30To2 = "QualityOP30To2";
                wplog.QualityOP30To3 = "QualityOP30To3";
                wplog.QualityOP30To4 = "QualityOP30To4";
                wplog.QualityOP30To5 = "QualityOP30To5";
                wplog.QualityOP30To6 = "QualityOP30To6";
                wplog.QualityOP30To7 = "QualityOP30To7";
                //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                return;
            }
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_OP3002 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    try
                    {
                        //_dataCaptureConfig
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_OP3002 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            if (SystemValue.value_OP3002.Equals("0") && value.ToString().Equals("1"))
                            {//当上一标记位0,当前获取标记为1时,
                             //触发操作,  å¹¶ç»™é™æ€å˜é‡èµ‹å€¼ä¸º1
                             //业务代码
                                WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                                wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                wplog.WorkingProcedure = WorkingProcedure;
                                wplog.EquipmentID = WorkingProcedure;
                                wplog.Remarks = WorkingProcedure;
                                wplog.MonitoringPoint = DataCapturePointCode;
                                wplog.WorkPieceID = "123456";
                                wplog.CreatedTime = DateTimeHelper.GetDateTime();
                                wplog.CreatedUserName = DataCapturePointCode;
                                wplog.IsDeleted = false;
                                wplog.QualityType = QualityType.Online.ToString();
                                //foreach (var col in colConfig)
                                //{
                                //    switch(col.DbNumber+ col.Offset)
                                //    {
                                //        case "":
                                            var valuecol = plcService.ReadValuePoint("2050", "28", 25, typeof(string));
                                            wplog.WorkPieceID = valuecol.ToString();
                                //            break;
                                //    }
                                //}
                                //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                                WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                            }
                            SystemValue.value_OP3002 = value.ToString();
                        }
                        SystemValue.lbl_Alert_OP3002 = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}";
                        if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                        {
                            Thread.Sleep(5000);
                        }
                        else
                        {
                            Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_OP3002 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序监控打码标记 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), "读取 {WorkingProcedure}工序监控打码标记数据时异常:", ex);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_OP3002 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序监控打码标记 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), "读{WorkingProcedure}工序监控打码标记 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤æ˜¯å¦é…ç½®å¼‚常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/HMIBeartBeatMonitor.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,189 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Data.Entity.Core.Common.CommandTrees;
using System.Data.Entity.Validation;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// HMI心跳监控
    /// </summary>
    public class HMIBeartBeatMonitor: DataCaptureHandler
    {
        public static readonly HMIBeartBeatMonitor Instance = new HMIBeartBeatMonitor();
        public HMIBeartBeatMonitor()
        {
        }
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    SystemValue.lbl_Alert_HMIBeartBeatMonitor = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                Dictionary<bool, DateTime> beartBeatDic = new Dictionary<bool, DateTime>();
                bool BeartBeatMonitorflag = true;
                while (true)
                {
                    ThreadStatusMonitor threadStatusMonitor = new ThreadStatusMonitor();
                    threadStatusMonitor.Threadcode = DataCapturePointCode;
                    threadStatusMonitor.Threadcname = DataCapturePointCname;
                    threadStatusMonitor.Threadendtime = DateTime.Now;
                    threadStatusMonitor.Threadlastmodifytime = DateTime.Now;
                    threadStatusMonitor.Threadstatue = 0;
                    threadStatusMonitor.ThreadId = Thread.CurrentThread.ManagedThreadId.ToString();
                    try
                    {
                        if(DataCapturePointCode.Equals("OP1008"))
                        {
                        }
                        //_dataCaptureConfig
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_HMIBeartBeatMonitor = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            try
                            {//获取设备plc的心跳
                                var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                                if (BeartBeatMonitorflag != (bool)value)
                                {//PLC心跳变化
                                    if(beartBeatDic.ContainsKey((bool)value))
                                    {
                                        beartBeatDic[(bool)value]=DateTime.Now;
                                    }
                                    else
                                    {
                                        beartBeatDic.Add((bool)value, DateTime.Now);
                                    }
                                }
                                WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                                wplog.WorkingProcedure = WorkingProcedure;
                                wplog.EquipmentID = _dataCaptureConfig.EquipmentID;
                                wplog.Remarks = "HMI";
                                wplog.MonitoringPoint = DataCapturePointCode;
                                var max = beartBeatDic.Max(kvp => kvp.Value);
                                if(max==null||(DateTime.Now-max).TotalSeconds>10)
                                {//心跳10秒没有更新认为设备断线了
                                    wplog.IsConnect = false;
                                }
                                else
                                {
                                    wplog.IsConnect = true;
                                }
                                //更新设备当前连接情况
                                WorkPieceInfoManager.EquipmentBeartBeatMonitor(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                                BeartBeatMonitorflag = (bool)value;
                                threadStatusMonitor.Threadstatue = 1;
                            }
                            catch (DbEntityValidationException ex1)
                            {
                                Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{WorkingProcedure}心跳读取异常1:", ex1);
                            }
                            catch (Exception ex)
                            {
                                Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{WorkingProcedure}心跳读取异常:", ex);
                            }
                            try
                            {//反写心跳
                                foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode && o.IsFeedback == 1))
                                {//获取配置详情表中需写入心跳信息 pc
                                    bool flag = true;
                                    var colflag = plcService.ReadValuePoint(col.DbNumber, col.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                                    if ((bool)colflag)
                                    {
                                        flag = false;
                                    }
                                    else
                                    {
                                        flag = true;
                                    }
                                    var write= plcService.WriteValuePointNew(col.DbNumber, col.Offset, flag);
                                    if(!write.result)
                                    {
                                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{WorkingProcedure}数采心跳写入异常:{write.resMsg}");
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{WorkingProcedure}数采心跳写入异常:", ex);
                            }
                        }
                        SystemValue.lbl_Alert_HMIBeartBeatMonitor = $"abcdefg:{RandomHelper.GenerateRandomCode(4)}";
                    }
                    catch (Exception ex)
                    {
                        SystemValue.lbl_Alert_HMIBeartBeatMonitor = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序心跳 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {WorkingProcedure}工序心跳异常:", ex);
                    }
                    finally
                    {
                        WorkPieceInfoManager.ThreadMonitor(threadStatusMonitor);
                    }
                }
            }
            else
            {
                SystemValue.lbl_Alert_HMIBeartBeatMonitor = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序心跳 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读{WorkingProcedure}工序心跳 ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤æ˜¯å¦é…ç½®å¼‚常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/HMI_WorkpieceReading.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,358 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// HML读取
    /// </summary>
    public class HMI_WorkpieceReading : DataCaptureHandler
    {
        public static readonly HMI_WorkpieceReading Instance = new HMI_WorkpieceReading();
        /// <summary>
        ///
        /// </summary>
        public HMI_WorkpieceReading()
        {
        }
        /// <summary>
        ///
        /// </summary>
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        /// <summary>
        ///
        /// </summary>
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        /// <summary>
        ///
        /// </summary>
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        /// <summary>
        /// åˆ·æ–°æ•°æ®åˆ—表
        /// </summary>
        /// <param name="dataCaptureConfig"></param>
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        /// <summary>
        /// æ•°æ®é‡‡é›†å¼€å§‹
        /// </summary>
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    switch (_dataCaptureConfig.DataCapturePointCode)
                    {
                        case "RHMIOP104001":
                            SystemValue.lbl_Alert_HMIOP104001 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        case "RHMIOP2001":
                            SystemValue.lbl_Alert_HMIOP2001 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        case "RHMIOP303501":
                            SystemValue.lbl_Alert_HMIOP303501 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        case "RHMIOP5001":
                            SystemValue.lbl_Alert_HMIOP5001 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        case "RHMIOP6001":
                            SystemValue.lbl_Alert_HMIOP6001 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        default:
                            break;
                    }
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    try
                    {
                        if (plcService == null || !plcService.IsConnected)
                        {
                            SystemValue.lbl_Alert_HMIOP104001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            SystemValue.lbl_Alert_HMIOP2001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            SystemValue.lbl_Alert_HMIOP303501 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            SystemValue.lbl_Alert_HMIOP5001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            SystemValue.lbl_Alert_HMIOP6001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            //switch (_dataCaptureConfig.DataCapturePointCode)
                            //{
                            //    case "RHMIOP104001":
                            //        SystemValue.lbl_Alert_HMIOP104001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            //        break;
                            //    case "RHMIOP2001":
                            //        SystemValue.lbl_Alert_HMIOP2001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            //        break;
                            //    case "RHMIOP303501":
                            //        SystemValue.lbl_Alert_HMIOP303501 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            //        break;
                            //    case "RHMIOP5001":
                            //        SystemValue.lbl_Alert_HMIOP5001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            //        break;
                            //    case "RHMIOP6001":
                            //        SystemValue.lbl_Alert_HMIOP6001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                            //        break;
                            //    default:
                            //        break;
                            //}
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            SystemValue.lbl_Alert_HMIOP104001 = $" {RandomHelper.GenerateRandomCode(4)}";
                            SystemValue.lbl_Alert_HMIOP2001 = $" {RandomHelper.GenerateRandomCode(4)}";
                            SystemValue.lbl_Alert_HMIOP303501 = $" {RandomHelper.GenerateRandomCode(4)}";
                            SystemValue.lbl_Alert_HMIOP5001 = $" {RandomHelper.GenerateRandomCode(4)}";
                            SystemValue.lbl_Alert_HMIOP6001 = $" {RandomHelper.GenerateRandomCode(4)}";
                            object value1 = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, "88", 2, PLCManger.GetTypeForString("int"));
                            string value2 = value1 == null ? "" : value1.ToString();
                            if ("21" .Equals(value2))
                            {
                                //10:数采读取失败
                                //11 :数采读取成功
                                //21:扫码成功标记
                                plcService.WriteValuePointNew(_dataCaptureConfig.DbNumber, "88", 11);
                                object value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, _dataCaptureConfig.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                                if (value != null)
                                {
                                    string WorkPieceID = value.ToString().Trim();
                                    if (WorkPieceID.Length == 22)
                                    {
                                        // æ ¹æ®å·¥ä»¶å·èŽ·å–å·¥ä»¶ä¿¡æ¯
                                        WorkPieceInfo info = null;
                                        using (DbModel db = new DbModel())
                                        {
                                            info = new WorkPieceInfo();
                                            info = db.WorkPieceInfo.Where(o => o.WorkPieceID == WorkPieceID&&o.IsDeleted==false).FirstOrDefault();
                                        }
                                        if (info != null && info.Id > 0)
                                        {
                                            // æŠŠå¯¹åº”的工件信息写入PLC对应地址
                                            foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                            {
                                                switch (col.DataCaptureColumnTabelName)
                                                {
                                                    case "WorkPieceID":
                                                        //plcService.WriteValuePointNew(col.DbNumber, col.Offset, info.WorkPieceID);
                                                        break;
                                                    case "WorkingProcedureCurrent":
                                                        plcService.WriteValuePointNew(col.DbNumber, col.Offset, info.WorkingProcedureCurrent);
                                                        break;
                                                    case "WorkPieceState":
                                                        plcService.WriteValuePointNew(col.DbNumber, col.Offset, info.WorkPieceState);
                                                        break;
                                                    case "QualityState":
                                                        plcService.WriteValuePointNew(col.DbNumber, col.Offset, info.QualityState);
                                                        break;
                                                    case "ReaderEndState":
                                                        plcService.WriteValuePointNew(col.DbNumber, col.Offset, 11);
                                                        break;
                                                    default:
                                                        break;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                            {
                                                switch (col.DataCaptureColumnTabelName)
                                                {
                                                    case "ReaderEndState":
                                                        plcService.WriteValuePointNew(col.DbNumber, col.Offset, 10);
                                                        break;
                                                    default:
                                                        break;
                                                }
                                            }
                                            switch (_dataCaptureConfig.DataCapturePointCode)
                                            {
                                                case "RHMIOP104001":
                                                    SystemValue.lbl_Alert_HMIOP104001 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】在数据库中不存在";
                                                    break;
                                                case "RHMIOP2001":
                                                    SystemValue.lbl_Alert_HMIOP2001 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】在数据库中不存在";
                                                    break;
                                                case "RHMIOP303501":
                                                    SystemValue.lbl_Alert_HMIOP303501 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】在数据库中不存在";
                                                    break;
                                                case "RHMIOP5001":
                                                    SystemValue.lbl_Alert_HMIOP5001 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】在数据库中不存在";
                                                    break;
                                                case "RHMIOP6001":
                                                    SystemValue.lbl_Alert_HMIOP6001 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】在数据库中不存在";
                                                    break;
                                                default:
                                                    break;
                                            }
                                            Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】在数据库中不存在");
                                        }
                                    }
                                    else
                                    {
                                        foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                        {
                                            switch (col.DataCaptureColumnTabelName)
                                            {
                                                case "ReaderEndState":
                                                    plcService.WriteValuePointNew(col.DbNumber, col.Offset, 10);
                                                    break;
                                                default:
                                                    break;
                                            }
                                        }
                                        switch (_dataCaptureConfig.DataCapturePointCode)
                                        {
                                            case "RHMIOP104001":
                                                SystemValue.lbl_Alert_HMIOP104001 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】长度异常,长度不等于22位";
                                                break;
                                            case "RHMIOP2001":
                                                SystemValue.lbl_Alert_HMIOP2001 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】长度异常,长度不等于22位";
                                                break;
                                            case "RHMIOP303501":
                                                SystemValue.lbl_Alert_HMIOP303501 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】长度异常,长度不等于22位";
                                                break;
                                            case "RHMIOP5001":
                                                SystemValue.lbl_Alert_HMIOP5001 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】长度异常,长度不等于22位";
                                                break;
                                            case "RHMIOP6001":
                                                SystemValue.lbl_Alert_HMIOP6001 = $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】长度异常,长度不等于22位";
                                                break;
                                            default:
                                                break;
                                        }
                                        Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"HMI读取监控 äºŒç»´ç å€¼ï¼šã€" + WorkPieceID + "】长度异常,长度不等于22位");
                                    }
                                }
                                else
                                {
                                    foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                    {
                                        switch (col.DataCaptureColumnTabelName)
                                        {
                                            case "ReaderEndState":
                                                plcService.WriteValuePointNew(col.DbNumber, col.Offset, 10);
                                                break;
                                            default:
                                                break;
                                        }
                                    }
                                }
                            }
                        }
                        if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                        {
                            Thread.Sleep(1000);
                        }
                        else
                        {
                            Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        switch (_dataCaptureConfig.DataCapturePointCode)
                        {
                            case "RHMIOP104001":
                                SystemValue.lbl_Alert_HMIOP104001 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            case "RHMIOP2001":
                                SystemValue.lbl_Alert_HMIOP2001 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            case "RHMIOP303501":
                                SystemValue.lbl_Alert_HMIOP303501 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            case "RHMIOP5001":
                                SystemValue.lbl_Alert_HMIOP5001 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            case "RHMIOP6001":
                                SystemValue.lbl_Alert_HMIOP6001 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            default:
                                break;
                        }
                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {WorkingProcedure}工序HMI读取二维码监控,数据时异常:", ex);
                    }
                }
            }
            else
            {
                switch (_dataCaptureConfig.DataCapturePointCode)
                {
                    case "RHMIOP104001":
                        SystemValue.lbl_Alert_HMIOP104001 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    case "RHMIOP2001":
                        SystemValue.lbl_Alert_HMIOP2001 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    case "RHMIOP303501":
                        SystemValue.lbl_Alert_HMIOP303501 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    case "RHMIOP5001":
                        SystemValue.lbl_Alert_HMIOP5001 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    case "RHMIOP6001":
                        SystemValue.lbl_Alert_HMIOP6001 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    default:
                        break;
                }
                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读{WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤æ˜¯å¦é…ç½®å¼‚常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/HMI_WorkpieceWrite.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,409 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// HMI写入
    /// </summary>
    public class HMI_WorkpieceWrite : DataCaptureHandler
    {
        public static readonly HMI_WorkpieceWrite Instance = new HMI_WorkpieceWrite();
        /// <summary>
        ///
        /// </summary>
        public HMI_WorkpieceWrite()
        {
        }
        /// <summary>
        ///
        /// </summary>
        public override string WorkingProcedure
        {
            get { return _dataCaptureConfig.WorkingProcedure; }
        }
        /// <summary>
        ///
        /// </summary>
        public override string DataCapturePointCode
        {
            get { return _dataCaptureConfig.DataCapturePointCode; }
        }
        /// <summary>
        ///
        /// </summary>
        public override string DataCapturePointCname
        {
            get { return _dataCaptureConfig.DataCapturePointCname; }
        }
        /// <summary>
        /// åˆ·æ–°æ•°æ®åˆ—表
        /// </summary>
        /// <param name="dataCaptureConfig"></param>
        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
        {
        }
        /// <summary>
        /// æ•°æ®é‡‡é›†å¼€å§‹
        /// </summary>
        public override void DataCaptureStart()
        {
            if (IsCaptureflag)
            {
                var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
                if (plcService == null)
                {
                    switch (_dataCaptureConfig.DataCapturePointCode)
                    {
                        case "WHMIOP104002":
                            SystemValue.lbl_Alert_HMIOP104001 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        case "WHMIOP2002":
                            SystemValue.lbl_Alert_HMIOP2001 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        case "WHMIOP303502":
                            SystemValue.lbl_Alert_HMIOP303501 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        case "WHMIOP5002":
                            SystemValue.lbl_Alert_HMIOP5001 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        case "WHMIOP6002":
                            SystemValue.lbl_Alert_HMIOP6001 = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                            break;
                        default:
                            break;
                    }
                    return;
                }
                if (plcService != null && !plcService.IsConnected)
                {
                    plcService.Close();
                    plcService.OpenService();
                }
                while (true)
                {
                    try
                    {
                        if (plcService == null && !plcService.IsConnected)
                        {
                            switch (_dataCaptureConfig.DataCapturePointCode)
                            {
                                case "WHMIOP104002":
                                    SystemValue.lbl_Alert_HMIOP104001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                                    break;
                                case "WHMIOP2002":
                                    SystemValue.lbl_Alert_HMIOP2001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                                    break;
                                case "WHMIOP303502":
                                    SystemValue.lbl_Alert_HMIOP303501 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                                    break;
                                case "WHMIOP5002":
                                    SystemValue.lbl_Alert_HMIOP5001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                                    break;
                                case "WHMIOP6002":
                                    SystemValue.lbl_Alert_HMIOP6001 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                                    break;
                                default:
                                    break;
                            }
                            plcService.Close();
                            plcService.OpenService();
                            Thread.Sleep(100);
                            continue;
                        }
                        else
                        {
                            Object WorkPieceID = null;
                            Object QualityState = null;
                            Object CheckUpdate = null;
                            Object QualityErrorInfo = null;
                            int UpdateIsOK = 0;
                            // æŠŠå¯¹åº”的工件信息写入PLC对应地址
                            foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                            {
                                switch (col.DataCaptureColumnTabelName)
                                {
                                    case "WorkPieceID":
                                        WorkPieceID = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
                                        break;
                                    case "QualityState":
                                        QualityState = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
                                        break;
                                    case "CheckUpdate":
                                        CheckUpdate = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
                                        //plcService.WriteValuePoint(col.DbNumber, col.Offset, 0, PLCManger.GetTypeForString(col.DataCaptureColumnType));
                                        break;
                                    case "QualityErrorInfo":
                                        QualityErrorInfo = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
                                        break;
                                    case "UpdateIsOK":
                                        UpdateIsOK = col.IsFeedback;
                                        break;
                                    default:
                                        break;
                                }
                            }
                            if ((bool)CheckUpdate)
                            {
                                // è¯»å–内容检查
                                StringBuilder builder = new StringBuilder();
                                if (WorkPieceID != null)
                                {
                                    if (WorkPieceID.ToString().Length != 22)
                                    {
                                        builder.AppendLine("工件二维码值:【" + WorkPieceID + "】长度异常,长度不等于22位!");
                                    }
                                    if (QualityState == null)
                                    {
                                        builder.AppendLine("工件二维码值:【" + WorkPieceID + "】质量状态不能为空");
                                    }
                                    else
                                    {
                                        if ((int)QualityState != 1 && (int)QualityState != 2 && (int)QualityState != 3)
                                        {
                                            builder.AppendLine("工件二维码值:【" + WorkPieceID + "】质量状态【" + QualityState + "】错误,只能为1:合格 2:不合格 3:疑似");
                                        }
                                        else if ((int)QualityState == 2 || (int)QualityState == 3)
                                        {
                                            if (QualityErrorInfo == null|| string.IsNullOrEmpty(QualityErrorInfo.ToString()))
                                            {
                                                builder.AppendLine("工件二维码值:【" + WorkPieceID + "】质量不合格原因不能为空");
                                            }
                                        }
                                    }
                                }
                                if (!string.IsNullOrEmpty(builder.ToString()))
                                {
                                    switch (_dataCaptureConfig.DataCapturePointCode)
                                    {
                                        case "WHMIOP104002":
                                            SystemValue.lbl_Alert_HMIOP104001 = $"{WorkingProcedure}工序HML写入监控,数据返回格式异常:" + builder.ToString();
                                            break;
                                        case "WHMIOP2002":
                                            SystemValue.lbl_Alert_HMIOP2001 = $"{WorkingProcedure}工序HML写入监控,数据返回格式异常:" + builder.ToString();
                                            break;
                                        case "WHMIOP303502":
                                            SystemValue.lbl_Alert_HMIOP303501 = $"{WorkingProcedure}工序HML写入监控,数据返回格式异常:" + builder.ToString();
                                            break;
                                        case "WHMIOP5002":
                                            SystemValue.lbl_Alert_HMIOP5001 = $"{WorkingProcedure}工序HML写入监控,数据返回格式异常:" + builder.ToString();
                                            break;
                                        case "WHMIOP6002":
                                            SystemValue.lbl_Alert_HMIOP6001 = $"{WorkingProcedure}工序HML写入监控,数据返回格式异常:" + builder.ToString();
                                            break;
                                        default:
                                            break;
                                    }
                                    // æŠŠå¯¹åº”的工件信息写入PLC对应地址
                                    foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                    {
                                        switch (col.DataCaptureColumnTabelName)
                                        {
                                            case "UpdateIsOK":
                                                var aa = plcService.WriteValuePointNew(col.DbNumber, col.Offset, false);
                                                break;
                                            default:
                                                //plcService.WriteValuePoint(col.DbNumber, col.Offset, "", PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                                                break;
                                        }
                                    }
                                    Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"工序HML写入监控,数据返回格式异常:" + builder.ToString());
                                    continue;
                                }
                                // å·¥ä»¶ä¿¡æ¯
                                WorkPieceInfo info = null;
                                // å·¥ä»¶æŽ¥æ”¶ä¿¡æ¯å±¥åކ
                                WorkPieceLog wplog = new WorkPieceLog();
                                using (DbModel db = new DbModel())
                                {
                                    info = new WorkPieceInfo();
                                    info = db.WorkPieceInfo.Where(o => o.WorkPieceID == WorkPieceID.ToString()&&o.IsDeleted==false).FirstOrDefault();
                                    if (info == null)
                                    {
                                        switch (_dataCaptureConfig.DataCapturePointCode)
                                        {
                                            case "WHMIOP104002":
                                                SystemValue.lbl_Alert_HMIOP104001 = $"工件{WorkPieceID},{WorkingProcedure}工序HML写入监控时,工件信息表中不存在";
                                                break;
                                            case "WHMIOP2002":
                                                SystemValue.lbl_Alert_HMIOP2001 = $"工件{WorkPieceID},{WorkingProcedure}工序HML写入监控时,工件信息表中不存在";
                                                break;
                                            case "WHMIOP303502":
                                                SystemValue.lbl_Alert_HMIOP303501 = $"工件{WorkPieceID},{WorkingProcedure}工序HML写入监控时,工件信息表中不存在";
                                                break;
                                            case "WHMIOP5002":
                                                SystemValue.lbl_Alert_HMIOP5001 = $"工件{WorkPieceID},{WorkingProcedure}工序HML写入监控时,工件信息表中不存在";
                                                break;
                                            case "WHMIOP6002":
                                                SystemValue.lbl_Alert_HMIOP6001 = $"工件{WorkPieceID},{WorkingProcedure}工序HML写入监控时,工件信息表中不存在";
                                                break;
                                            default:
                                                break;
                                        }
                                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"工序HML写入监控,数据返回格式异常:" + builder.ToString());
                                        continue;
                                    }
                                    info.QualityState = Convert.ToInt32(QualityState);
                                    info.QualityStateUpdateUser = "HMI";
                                    info.QualityStateUpdateTime = DateTime.Now;
                                    info.QualityStateUpdateMode = "自动";
                                    info.QualityErrorInfo = QualityErrorInfo.ToString();
                                    // å†™å…¥å·¥ä»¶æŽ¥æ”¶ä¿¡æ¯å±¥åކ
                                    //wplog = CommonManager.Instance.GetWorkPieceID(wplog, LogType.PLCHMI04);
                                    wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                                    wplog.WorkPieceID = info.WorkPieceID;
                                    wplog.WorkingProcedure = WorkingProcedure;
                                    wplog.EquipmentID = WorkingProcedure;
                                    wplog.Remarks = WorkingProcedure;
                                    wplog.MonitoringPoint = DataCapturePointCode;
                                    wplog.QualityState = Convert.ToInt32(QualityState);
                                    wplog.CreatedTime = DateTimeHelper.GetDateTime();
                                    wplog.CreatedUserName = DataCapturePointCode;
                                    wplog.IsDeleted = false;
                                    db.WorkPieceLog.Add(wplog);
                                    db.SaveChanges();
                                }
                                if (UpdateIsOK == 1)
                                {
                                    // æŠŠå¯¹åº”的工件信息写入PLC对应地址
                                    foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                                    {
                                        switch (col.DataCaptureColumnTabelName)
                                        {
                                            case "UpdateIsOK":
                                                var aa =  plcService.WriteValuePointNew(col.DbNumber, col.Offset, true);
                                                break;
                                            //case "WorkPieceID":
                                            //    plcService.WriteValuePointNew(col.DbNumber, col.Offset, "");
                                            //    break;
                                            default:
                                                //plcService.WriteValuePoint(col.DbNumber, col.Offset, "", PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                                                break;
                                        }
                                    }
                                }
                            }
                        }
                        if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
                        {
                            Thread.Sleep(5000);
                        }
                        else
                        {
                            Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
                        {
                            switch (col.DataCaptureColumnTabelName)
                            {
                                case "UpdateIsOK":
                                    var aa = plcService.WriteValuePointNew(col.DbNumber, col.Offset, true);
                                    break;
                                default:
                                    break;
                            }
                        }
                        switch (_dataCaptureConfig.DataCapturePointCode)
                        {
                            case "WHMIOP104002":
                                SystemValue.lbl_Alert_HMIOP104001 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            case "WHMIOP2002":
                                SystemValue.lbl_Alert_HMIOP2001 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            case "WHMIOP303502":
                                SystemValue.lbl_Alert_HMIOP303501 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            case "WHMIOP5002":
                                SystemValue.lbl_Alert_HMIOP5001 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            case "WHMIOP6002":
                                SystemValue.lbl_Alert_HMIOP6001 = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{WorkingProcedure}工序HMI读取二维码监控,出现异常,请查看日志!";
                                break;
                            default:
                                break;
                        }
                        Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {WorkingProcedure}工序HML写入监控,数据时异常:", ex);
                    }
                }
            }
            else
            {
                switch (_dataCaptureConfig.DataCapturePointCode)
                {
                    case "WHMIOP104002":
                        SystemValue.lbl_Alert_HMIOP104001 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    case "WHMIOP2002":
                        SystemValue.lbl_Alert_HMIOP2001 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    case "WHMIOP303502":
                        SystemValue.lbl_Alert_HMIOP303501 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    case "WHMIOP5002":
                        SystemValue.lbl_Alert_HMIOP5001 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    case "WHMIOP6002":
                        SystemValue.lbl_Alert_HMIOP6001 = $" {RandomHelper.GenerateRandomCode(4)} {WorkingProcedure}工序HML读取二维码监控 ä¸åšæ•°æ®é‡‡é›†ï¼Œè¯·ç¡®è®¤é…ç½®ä¿¡æ¯ï¼";
                        break;
                    default:
                        break;
                }
                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读{WorkingProcedure}工序HML写入监控, ä¸åšæ ¡éªŒï¼Œè¯·ç¡®è®¤æ˜¯å¦é…ç½®å¼‚常");
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCFactory.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@

using iWare_SCADA_Model;
namespace iWare_SCADA_BusinessLogical
{
    public class PLCFactory
    {
        public static PLCService GetOPCService(PLCServiceTypeEnum _OPCServiceTypeEnum, HslCommunicationParam hslcpParam)
        {
            PLCService plcService = null;
            switch (_OPCServiceTypeEnum)
            {
                case PLCServiceTypeEnum.Siemens_HslCommunicationService:
                    plcService = new Siemens_HslCommunicationService(hslcpParam);
                    break;
            }
            return plcService;
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCManger.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,132 @@
using HslCommunication.Profinet.Siemens;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using log4net;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    public class PLCManger
    {
        /// <summary>
        ///  å®žä¾‹åŒ–单个PLCService
        /// </summary>
        /// <param name="_ip"></param>
        /// <param name="device"></param>
        /// <returns></returns>
        public static PLCService GetSinglePLCService(DataCaptureConfig dataCaptureConfig)
        {
            HslCommunicationParam hslCommunicationParam = new HslCommunicationParam()
            {
                cpu = (SiemensPLCS)dataCaptureConfig.DataCapturePLCType,
                ip = dataCaptureConfig.PLCIP,
                //rack = WareSdaStruct.Srm_Rack,
                //slot = WareSdaStruct.Srm_Slot,
                port = dataCaptureConfig.PLCPort.Value
            };
            PLCService PLCService = PLCFactory.GetOPCService(PLCServiceTypeEnum.Siemens_HslCommunicationService, hslCommunicationParam);
            return PLCService;
        }
        public static Type GetTypeForString(string datatype)
        {
            switch (datatype.ToLower())
            {
                case "int":
                    return typeof(Int16);
                case "dint":
                    return typeof(Int32);
                case "char":
                    return typeof(Char);
                case "real":
                    return typeof(double);
                    //return typeof(Single);
                case "bool":
                    return typeof(bool);
                case "string":
                    return typeof(string);
                case "byte":
                    return typeof(Byte);
                case "other":
                    return typeof(string);
                default:
                    return typeof(string);
            }
        }
        public static object GetVauleForObjectType(object vaule,TypeCode type)
        {
            switch (type)
            {
                case TypeCode.Int16:
                    return Convert.ToInt16(vaule);
                case TypeCode.Int32:
                    return Convert.ToInt32(vaule);
                case TypeCode.Char:
                    return Convert.ToChar(vaule);
                case TypeCode.Single:
                    return Convert.ToSingle(vaule);
                case TypeCode.Boolean:
                    return Convert.ToBoolean(vaule);
                case TypeCode.String:
                    return Convert.ToString(vaule);
                case TypeCode.Byte:
                    return Convert.ToByte(vaule);
                default:
                    return Convert.ToString(vaule);
            }
        }
        public static LogType GetLogTypeForWorkingProcedure(string wp)
        {
            switch(wp)
            {
                case "OP05":
                    return LogType.PLCOP05;
                case "OP10":
                    return LogType.PLCOP10;
                case "OP20":
                    return LogType.PLCOP20;
                case "OP30":
                    return LogType.PLCOP30;
                case "OP35":
                    return LogType.PLCOP35;
                case "OP40":
                    return LogType.PLCOP40;
                case "OP50":
                    return LogType.PLCOP50;
                case "OP60":
                    return LogType.PLCOP60;
                case "OP70":
                    return LogType.PLCOP70;
                case "OP80":
                    return LogType.PLCOP80;
                case "HMI":
                    return LogType.PLCHMI;
                default:
                    return LogType.PLCService;
            }
        }
        public static string GetWorkPieceIDForPLC(DataCaptureConfig _dataCaptureConfig,PLCService plcService)
        {
            try
            {
                var valueid = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, _dataCaptureConfig.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                return valueid.ToString().Trim();
            }
            catch(Exception ex)
            {
                Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(_dataCaptureConfig.WorkingProcedure), $" {_dataCaptureConfig.WorkingProcedure}工序监控读码标记 è¯»å–工件码数据时异常:", ex);
                throw;
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/PLCService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,140 @@

using iWare_SCADA_Model;
using System;
namespace iWare_SCADA_BusinessLogical
{
    public class PLCService
    {
        public LogType _LogType;
        public bool IsConnected { get; set; }
        /// <summary>
        /// æ‰“开服务
        /// </summary>
        /// <returns></returns>
        public virtual MessageModel OpenService()
        {
            this.IsConnected = false;
            return new MessageModel()
            {
                result = true
            };
        }
        ///// <summary>
        ///// å†™å…¥
        ///// </summary>
        ///// <param name="address">地址</param>
        ///// <param name="value">值</param>
        ///// <returns></returns>
        //public virtual MessageModel WriteValuePoint(string dbNumber, string offset, object value)
        //{
        //    return new MessageModel()
        //    {
        //        result = true
        //    };
        //}
        /// <summary>
        /// å†™å…¥
        /// </summary>
        /// <param name="fullAddress">地址</param>
        /// <param name="value">值</param>
        ///  <param name="proObj">属性对象</param>
        /// <returns></returns>
        public virtual MessageModel WriteValuePointNew(string dbNumber, string offset, object value)
        {
            return new MessageModel()
            {
                result = true
            };
        }
        /// <summary>
        /// å†™å…¥
        /// </summary>
        /// <param name="address">地址</param>
        /// <param name="value">值</param>
        ///  <param name="proObj">属性对象</param>
        /// <returns></returns>
        public virtual MessageModel WriteValuePoint(string dbNumber, string offset, object value, Object proObj)
        {
            return new MessageModel()
            {
                result = true
            };
        }
        /// <summary>
        /// å†™å…¥
        /// </summary>
        /// <param name="fullAddress">地址</param>
        /// <param name="value">值</param>
        ///  <param name="proObj">属性对象</param>
        /// <returns></returns>
        public virtual MessageModel WriteValuePoint(string fullAddress, object value, Object proObj)
        {
            return new MessageModel()
            {
                result = true
            };
        }
        /// <summary>
        /// è¯»å–
        /// </summary>
        /// <param name="dbNumber">DB块名</param>
        /// <param name="offset">偏移量</param>
        /// <param name="type"></param>
        /// <returns></returns>
        public virtual object ReadValuePoint(string dbNumber, string offset,int stringlen, Type type = default(Type))
        {
            return null;
        }
        /// <summary>
        /// è¯»å–
        /// </summary>
        /// <param name="dbNumber">DB块名</param>
        /// <param name="offset">偏移量</param>
        /// <param name="type"></param>
        /// <returns></returns>
        public virtual object ReadValuePoint(string dbNumber, string offset, Type type = default(Type))
        {
            return null;
        }
        public virtual object ReadValuePointV2(string fullAddress, Type type = default(Type), int stringlen = 0)
        {
            return null;
        }
        /// <summary>
        /// è¯»å–
        /// </summary>
        /// <param name="fullAddress">地址</param>
        /// <param name="type"></param>
        /// <returns></returns>
        public virtual object ReadValuePoint(string fullAddress, Type type = default(Type))
        {
            return null;
        }
        /// <summary>
        /// èŽ·å–æœ€ç»ˆçš„DB块地址
        /// </summary>
        /// <param name="dbNumber"></param>
        /// <param name="offset"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public virtual string GetAddress(string dbNumber, string offset, Type type = default(Type))
        {
            return null;
        }
        /// <summary>
        /// å…³é—­è¿žæŽ¥
        /// </summary>
        public virtual void Close()
        {
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/DataCaptureHandler/PLCDataCapture/Siemens_HslCommunicationService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,433 @@
using System;
using System.Net;
using System.Security.Cryptography;
using HslCommunication;
using HslCommunication.Profinet.Siemens;
using iTextSharp.text.pdf;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// è¥¿ä¹ˆå­PLC
    /// </summary>
    public class Siemens_HslCommunicationService : PLCService
    {
        private SiemensS7Net siemensTcpNet = null;
        private readonly SiemensPLCS _cpu;
        private readonly string _ip;
        private readonly int _port;
        public Siemens_HslCommunicationService(HslCommunicationParam hslcpParam)
        {
            _cpu = hslcpParam.cpu;
            _ip = hslcpParam.ip;
            _port = hslcpParam.port;
            _LogType = LogType.HslCommunicationService;
        }
        /// <summary>
        /// æ‰“开连接
        /// </summary>
        /// <returns></returns>
        public override MessageModel OpenService()
        {
            MessageModel fre = new MessageModel();
            try
            {
                //创建连接对象
                siemensTcpNet = new SiemensS7Net(_cpu, _ip);
                siemensTcpNet.IpAddress = _ip;
                siemensTcpNet.Port = Convert.ToInt16(_port);
                //siemensTcpNet.Rack = Convert.ToInt16(tb_Rack.Text);
                //siemensTcpNet
                //不记录日志!!!!否则文件太大导致问题!
                //siemensTcpNet.LogNet = new HslCommunication.LogNet.LogNetSingle("Siemens_HslCommunicationService_logs.txt");
                OperateResult operateResult = siemensTcpNet.ConnectServer();
                if (operateResult.IsSuccess)
                {
                    base.IsConnected = true;
                    fre.result = true;
                    return fre;
                }
                base.IsConnected = false;
                fre.result = false;
                fre.resMsg = "打开失败," + operateResult.Message;
                return fre;
            }
            catch (Exception ex)
            {
                base.IsConnected = false;
                Log4NetHelper.WriteErrorLog(_LogType, "初始化西门子PLC出现异常", ex);
                throw ex;
            }
        }
        public override MessageModel WriteValuePointNew(string dbNumber, string offset, object value)
        {//此方法不再使用西门子PLC
            if (dbNumber.IndexOf(SystemValue.PLCDBADDRESS_SEPARATE.ToString()) > -1)
            {
                throw new Exception("参数不正确,不应该带" + SystemValue.PLCDBADDRESS_SEPARATE.ToString());
            }
            MessageModel fre = new MessageModel();
            OperateResult operateResult = null;
            //Type proObjType = proObj.GetType();
            var address = GetAddress(dbNumber, offset, value.GetType());
            try
            {
                if (value is bool)
                {
                    bool myData = Convert.ToBoolean(value);
                    operateResult = siemensTcpNet.Write(address, myData);
                }
                else if (value is int)
                {
                    operateResult = siemensTcpNet.Write(address, Int16.Parse(value.ToString()));
                }
                else if (value is short)
                {
                    operateResult = siemensTcpNet.Write(address, (short)value);
                }
                else if (value is string)
                {
                    operateResult = siemensTcpNet.Write(address, (string)value);
                }
                else if (value is char)
                {
                    operateResult = siemensTcpNet.Write(address, (char)value);
                }
                else if (value is double|| value is float)
                {
                    operateResult = siemensTcpNet.Write(address, (double)value);
                }
                else
                {
                    operateResult = siemensTcpNet.Write(address, value.ToString());
                }
                if (!operateResult.IsSuccess)
                {
                    Log4NetHelper.WriteErrorLog(_LogType, String.Format("写入出现异常:" + operateResult.Message + ",地址:{0},值:{1}", address, value.ToString()), null);
                    fre.result = false;
                    fre.resMsg = "写入失败:" + operateResult.Message;
                }
                else
                {
                    fre.result = true;
                    //Log4NetHelper.WriteInfoLog(_LogType, String.Format("写入成功,写入地址:{0},值:{1}", address, value.ToString()));
                }
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(_LogType, String.Format("写入出现异常:" + ex.Message + ",地址:{0},值:{1}", address, value.ToString()), ex);
                fre.result = false;
                fre.resMsg = "写入失败:" + ex.Message;
            }
            return fre;
        }
        /// <summary>
        /// å†™å…¥
        /// </summary>
        /// <param name="address">地址</param>
        /// <param name="value">值</param>
        /// <returns></returns>
        public override MessageModel WriteValuePoint(string dbNumber, string offset, object value, Object proObj)
        {//此方法不再使用西门子PLC
            if (dbNumber.IndexOf(SystemValue.PLCDBADDRESS_SEPARATE.ToString()) > -1)
            {
                throw new Exception("参数不正确,不应该带" + SystemValue.PLCDBADDRESS_SEPARATE.ToString());
            }
            MessageModel fre = new MessageModel();
            OperateResult operateResult = null;
            Type proObjType = proObj.GetType();
            var address = GetAddress(dbNumber, offset, value.GetType());
            try
            {
                if (proObjType == typeof(Boolean))
                {//布尔类型
                    bool myData = Convert.ToBoolean(value);
                    operateResult = siemensTcpNet.Write(address, myData);
                }
                //浮点
                else if (proObjType == typeof(double) || proObjType == typeof(float))
                {
                    double MyData = Convert.ToDouble(value);
                    operateResult = siemensTcpNet.Write(address, MyData);
                }
                //整数
                else if (proObjType == typeof(Int16) || proObjType == typeof(short))
                {
                    short MyData = Convert.ToInt16(value);
                    operateResult = siemensTcpNet.Write(address, MyData);//此处需要注意,短整型的此处不确定是否会报错,需要测试
                    //operateResult = siemensTcpNet.Write(address, MyData.ConvertToUshort());
                }
                //双整数
                else if (proObjType == typeof(Int32))
                {
                    int myData = Convert.ToInt32(value);
                    operateResult = siemensTcpNet.Write(address, myData);
                }
                //Char
                else if (proObjType == typeof(Char))
                {//char要转换成int类型,写给PLC
                    int myData = Convert.ToInt32(value);
                    byte b = (byte)myData;
                    operateResult = siemensTcpNet.Write(address, b);
                }
                //String
                else if (proObjType == typeof(String))
                {
                    operateResult = siemensTcpNet.Write(address, value.ToString());
                }
                else
                {
                    operateResult = siemensTcpNet.Write(address, value.ToString());
                }
                if (!operateResult.IsSuccess)
                {
                    Log4NetHelper.WriteErrorLog(_LogType, String.Format("写入出现异常:" + operateResult.Message + ",地址:{0},值:{1}", address, value.ToString()), null);
                    fre.result = false;
                    fre.resMsg = "写入失败:" + operateResult.Message;
                }
                else
                {
                    fre.result = true;
                    //Log4NetHelper.WriteInfoLog(_LogType, String.Format("写入成功,写入地址:{0},值:{1}", address, value.ToString()));
                }
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(_LogType, String.Format("写入出现异常:" + ex.Message + ",地址:{0},值:{1}", address, value.ToString()), ex);
                fre.result = false;
                fre.resMsg = "写入失败:" + ex.Message;
            }
            return fre;
        }
        public override MessageModel WriteValuePoint(string fullAddress, object value, object proObj)
        {
            var arr = fullAddress.Split(SystemValue.PLCDBADDRESS_SEPARATE);
            string dbNumber = arr[0];
            string offset = arr[1];
            return WriteValuePoint(dbNumber, offset, value, proObj);
        }
        /// <summary>
        /// è¯»å–
        /// </summary>
        /// <param name="dbNumber">DB块名</param>
        /// <param name="offset">偏移量</param>
        /// <param name="type"></param>
        /// <returns></returns>
        public override object ReadValuePoint(string dbNumber, string offset, int stringlen, Type type = default(Type))
        {
            if (dbNumber.IndexOf(SystemValue.PLCDBADDRESS_SEPARATE.ToString()) > -1)
            {
                throw new Exception("参数不正确,不应该带" + SystemValue.PLCDBADDRESS_SEPARATE.ToString());
            }
            var address = GetAddress(dbNumber, offset, type);
            try
            {
                if (type == typeof(bool))
                {//布尔要转换成1和0写入
                    bool MyPlcData = siemensTcpNet.ReadBool(address).Content;
                    return MyPlcData;
                }
                //浮点
                else if (type == typeof(double) || type == typeof(float))
                {
                    var MyPlcData = siemensTcpNet.ReadFloat(address).Content;
                    return MyPlcData;
                }
                //整数
                else if (type == typeof(short))
                {
                    int MyPlcData = siemensTcpNet.ReadInt16(address).Content;
                    return MyPlcData;
                }
                //双整数
                else if (type == typeof(Int32))
                {
                    long MyPlcData = siemensTcpNet.ReadInt32(address).Content;
                    return MyPlcData;
                }
                //Char
                else if (type == typeof(Char))
                {//char要转换成int类型,写给PLC
                    char MyPlcData = (char)(siemensTcpNet.ReadByte(address).Content);
                    return MyPlcData.ToString();
                }
                //String
                else if (type == typeof(String))
                {
                    var data = siemensTcpNet.ReadString(address, (ushort)stringlen);
                    var MyPlcData = siemensTcpNet.ReadString(address, (ushort)stringlen).Content;
                    //write.Message = siemensTcpNet.ReadString(write.Name).Message;
                    //string MyPlcData = siemensTcpNet.ReadString(address).Content;
                    return MyPlcData == null ? "" : MyPlcData.ToString();
                }
                else
                {
                    var MyPlcData = siemensTcpNet.ReadString(address).Content;
                    return MyPlcData == null ? "" : MyPlcData.ToString();
                }
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(_LogType, String.Format("读取出现异常:" + ex.Message + ",地址:{0}", address), ex);
                throw;
            }
        }
        /// <summary>
        /// è¯»å–
        /// </summary>
        /// <param name="dbNumber">DB块名</param>
        /// <param name="offset">偏移量</param>
        /// <param name="type"></param>
        /// <returns></returns>
        public override object ReadValuePoint(string dbNumber, string offset, Type type = default(Type))
        {
            if (dbNumber.IndexOf(SystemValue.PLCDBADDRESS_SEPARATE.ToString()) > -1)
            {
                throw new Exception("参数不正确,不应该带" + SystemValue.PLCDBADDRESS_SEPARATE.ToString());
            }
            var address = GetAddress(dbNumber, offset, type);
            try
            {
                if (type == typeof(bool))
                {//布尔要转换成1和0写入
                    var MyPlcData11 = siemensTcpNet.ReadBool(address);
                    bool MyPlcData = siemensTcpNet.ReadBool(address).Content;
                    return MyPlcData;
                }
                //浮点
                else if (type == typeof(double) || type == typeof(float))
                {
                    var MyPlcData = siemensTcpNet.ReadFloat(address).Content;
                    return MyPlcData;
                }
                //整数
                else if (type == typeof(short))
                {
                    int MyPlcData = siemensTcpNet.ReadInt16(address).Content;
                    return MyPlcData;
                }
                //双整数
                else if (type == typeof(Int32))
                {
                    long MyPlcData = siemensTcpNet.ReadInt32(address).Content;
                    return MyPlcData;
                }
                //Char
                else if (type == typeof(Char))
                {//char要转换成int类型,写给PLC
                    char MyPlcData = (char)(siemensTcpNet.ReadByte(address).Content);
                    return MyPlcData.ToString();
                }
                //String
                else if (type == typeof(String))
                {
                    string MyPlcData = siemensTcpNet.ReadString(address).Content;
                    return MyPlcData == null ? "" : MyPlcData.ToString();
                }
                else
                {
                    var MyPlcData = siemensTcpNet.ReadString(address).Content;
                    return MyPlcData == null ? "" : MyPlcData.ToString();
                }
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(_LogType, String.Format("读取出现异常:" + ex.Message + ",地址:{0}", address), ex);
                throw;
            }
        }
        public override object ReadValuePointV2(string fullAddress, Type type = default(Type), int stringlen=0)
        {
            if (fullAddress.IndexOf(SystemValue.PLCDBADDRESS_SEPARATE.ToString()) > -1)
            {
                throw new Exception("参数不正确,不应该带" + SystemValue.PLCDBADDRESS_SEPARATE.ToString());
            }
            var address = fullAddress;
            try
            {
                if (type == typeof(bool))
                {//布尔要转换成1和0写入
                    bool MyPlcData = siemensTcpNet.ReadBool(address).Content;
                    return MyPlcData;
                }
                //浮点
                else if (type == typeof(double) || type == typeof(float))
                {
                    var MyPlcData = siemensTcpNet.ReadFloat(address).Content;
                    return MyPlcData;
                }
                //整数
                else if (type == typeof(short))
                {
                    int MyPlcData = siemensTcpNet.ReadInt16(address).Content;
                    return MyPlcData;
                }
                //双整数
                else if (type == typeof(Int32))
                {
                    long MyPlcData = siemensTcpNet.ReadInt32(address).Content;
                    return MyPlcData;
                }
                //Char
                else if (type == typeof(Char))
                {//char要转换成int类型,写给PLC
                    char MyPlcData = (char)(siemensTcpNet.ReadByte(address).Content);
                    return MyPlcData.ToString();
                }
                //String
                else if (type == typeof(String))
                {
                    var data = siemensTcpNet.ReadString(address, (ushort)stringlen);
                    var MyPlcData = siemensTcpNet.ReadString(address, (ushort)stringlen).Content;
                    //write.Message = siemensTcpNet.ReadString(write.Name).Message;
                    //string MyPlcData = siemensTcpNet.ReadString(address).Content;
                    return MyPlcData == null ? "" : MyPlcData.ToString();
                }
                else
                {
                    var MyPlcData = siemensTcpNet.ReadString(address).Content;
                    return MyPlcData == null ? "" : MyPlcData.ToString();
                }
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(_LogType, String.Format("读取出现异常:" + ex.Message + ",地址:{0}", address), ex);
                throw;
            }
        }
        public override object ReadValuePoint(string fullAddress, Type type = default(Type))
        {
            var arr = fullAddress.Split(SystemValue.PLCDBADDRESS_SEPARATE);
            string dbNumber = arr[0];
            string offset = arr[1];
            return ReadValuePoint(dbNumber, offset, type);
        }
        public override string GetAddress(string dbNumber, string offset, Type type = default(Type))
        {
            return "DB" + dbNumber + "." + offset;
        }
        public override void Close()
        {
            if (siemensTcpNet != null)
                siemensTcpNet.ConnectClose();
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Properties/AssemblyInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// æœ‰å…³ç¨‹åºé›†çš„一般信息由以下
// æŽ§åˆ¶ã€‚更改这些特性值可修改
// ä¸Žç¨‹åºé›†å…³è”的信息。
[assembly: AssemblyTitle("iWare_SCADA_BusinessLogical")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("iWare_SCADA_BusinessLogical")]
[assembly: AssemblyCopyright("Copyright Â©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// å°† ComVisible è®¾ç½®ä¸º false ä¼šä½¿æ­¤ç¨‹åºé›†ä¸­çš„类型
//对 COM ç»„件不可见。如果需要从 COM è®¿é—®æ­¤ç¨‹åºé›†ä¸­çš„类型
//请将此类型的 ComVisible ç‰¹æ€§è®¾ç½®ä¸º true。
[assembly: ComVisible(false)]
// å¦‚果此项目向 COM å…¬å¼€ï¼Œåˆ™ä¸‹åˆ— GUID ç”¨äºŽç±»åž‹åº“çš„ ID
[assembly: Guid("32708f19-fe1a-48f5-b373-8e1c776f216c")]
// ç¨‹åºé›†çš„版本信息由下列四个值组成:
//
//      ä¸»ç‰ˆæœ¬
//      æ¬¡ç‰ˆæœ¬
//      ç”Ÿæˆå·
//      ä¿®è®¢å·
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Properties/Resources.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     æ­¤ä»£ç ç”±å·¥å…·ç”Ÿæˆã€‚
//     è¿è¡Œæ—¶ç‰ˆæœ¬:4.0.30319.42000
//
//     å¯¹æ­¤æ–‡ä»¶çš„æ›´æ”¹å¯èƒ½ä¼šå¯¼è‡´ä¸æ­£ç¡®çš„行为,并且如果
//     é‡æ–°ç”Ÿæˆä»£ç ï¼Œè¿™äº›æ›´æ”¹å°†ä¼šä¸¢å¤±ã€‚
// </auto-generated>
//------------------------------------------------------------------------------
namespace iWare_SCADA_BusinessLogical.Properties {
    using System;
    /// <summary>
    ///   ä¸€ä¸ªå¼ºç±»åž‹çš„资源类,用于查找本地化的字符串等。
    /// </summary>
    // æ­¤ç±»æ˜¯ç”± StronglyTypedResourceBuilder
    // ç±»é€šè¿‡ç±»ä¼¼äºŽ ResGen æˆ– Visual Studio çš„工具自动生成的。
    // è‹¥è¦æ·»åŠ æˆ–ç§»é™¤æˆå‘˜ï¼Œè¯·ç¼–è¾‘ .ResX æ–‡ä»¶ï¼Œç„¶åŽé‡æ–°è¿è¡Œ ResGen
    // (以 /str ä½œä¸ºå‘½ä»¤é€‰é¡¹),或重新生成 VS é¡¹ç›®ã€‚
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {
        private static global::System.Resources.ResourceManager resourceMan;
        private static global::System.Globalization.CultureInfo resourceCulture;
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }
        /// <summary>
        ///   è¿”回此类使用的缓存的 ResourceManager å®žä¾‹ã€‚
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("iWare_SCADA_BusinessLogical.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        /// <summary>
        ///   é‡å†™å½“前线程的 CurrentUICulture å±žæ€§ï¼Œå¯¹
        ///   ä½¿ç”¨æ­¤å¼ºç±»åž‹èµ„源类的所有资源查找执行重写。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        /// <summary>
        ///   æŸ¥æ‰¾ç±»ä¼¼ C:\LOG_BusinessLogical çš„æœ¬åœ°åŒ–字符串。
        /// </summary>
        internal static string LogDir {
            get {
                return ResourceManager.GetString("LogDir", resourceCulture);
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Properties/Resources.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="LogDir" xml:space="preserve">
    <value>C:\LOG_BusinessLogical</value>
  </data>
</root>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Test/MyTest.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,134 @@
using HslCommunication.Profinet.Siemens;
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using Newtonsoft.Json.Linq;
using Spire.Pdf.HtmlConverter;
using System;
using System.Collections.Generic;
using System.Data.Entity.Core.Common.CommandTrees;
using System.Data.Entity.Validation;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical
{
    /// <summary>
    /// æµ‹è¯•内容
    /// </summary>
    public class MyTest
    {
        public static readonly MyTest Instance = new MyTest();
        string WorkingProcedure = "";
        public MyTest()
        {
        }
        public void DataCaptureStart()
        {
            DataCaptureConfig _dataCaptureConfig = new DataCaptureConfig()
            {
                DataCapturePLCType = (int)SiemensPLCS.S1200,
                PLCIP = "192.168.216.5",
                PLCPort = 102,
                DbNumber = "1141",
                Offset = "746.0",
                DataCaptureColumnType = "string"
            };
            var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
            if (plcService == null)
            {
                SystemValue.lbl_Alert_HMIBeartBeatMonitor = $"{RandomHelper.GenerateRandomCode(4)} æ²¡æœ‰æ‰¾åˆ°{_dataCaptureConfig.WorkingProcedure}的PLC设备";
                return;
            }
            if (plcService != null && !plcService.IsConnected)
            {
                plcService.Close();
                plcService.OpenService();
            }
            var str = $"读取OP35上线二维码";
            var str2 = $"读取OP35下线二维码";
            Dictionary<bool, DateTime> beartBeatDic = new Dictionary<bool, DateTime>();
            beartBeatDic.Add(false, DateTime.Now);
            bool BeartBeatMonitorflag = true;
            while (true)
            {
                try
                {
                    //_dataCaptureConfig
                    if (plcService == null || !plcService.IsConnected)
                    {
                        SystemValue.lbl_Alert_HMIBeartBeatMonitor = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC连接已断开,正在尝试打开!";
                        plcService.Close();
                        plcService.OpenService();
                        Thread.Sleep(100);
                        continue;
                    }
                    else
                    {
                        try
                        {//获取设备plc的心跳
                            var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset,
                                PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
                            Log4NetHelper.WriteInfoLog(LogType.FormMain, str + $",值:{value}");
                            var value2 = plcService.ReadValuePoint("4", "920.0",
                               PLCManger.GetTypeForString("string"));
                            Log4NetHelper.WriteInfoLog(LogType.FormMain, str2 + $",值:{value2}");
                            var str3 = $"读取OP35 SPC二维码";
                            var value3 = plcService.ReadValuePoint("4", "716.0",
                            PLCManger.GetTypeForString("string"));
                            Log4NetHelper.WriteInfoLog(LogType.FormMain, str3 + $",值:{value3}");
                            var str4 = $"读取OP35 OP3502A测量二维码";
                            var value4 = plcService.ReadValuePoint("2901", "514.0",
                            PLCManger.GetTypeForString("string"));
                            Log4NetHelper.WriteInfoLog(LogType.FormMain, str4 + $",值:{value4}");
                            var str5 = $"读取OP35 NOOK推出二维码";
                            var value5 = plcService.ReadValuePoint("4", "818",
                            PLCManger.GetTypeForString("string"));
                            Log4NetHelper.WriteInfoLog(LogType.FormMain, str5 + $",值:{value5}");
                        }
                        catch (Exception ex)
                        {
                            Log4NetHelper.WriteErrorLog(LogType.FormMain, str + $",读取异常1:", ex);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log4NetHelper.WriteErrorLog(LogType.FormMain, str + $",异常:", ex);
                }
                finally
                {
                    Thread.Sleep(1000);
                }
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/CSVHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical.Utils
{
    public class CSVHelper
    {
        /// <summary>
        /// å†™å…¥CSV
        /// </summary>
        /// <param name="fileName">文件名</param>
        /// <param name="dt">要写入的datatable</param>
        public static void WriteCSV(string fileName, DataTable dt)
        {
            FileStream fs;
            StreamWriter sw;
            string data = null;
            //判断文件是否存在,存在就不再次写入列名
            if (!File.Exists(fileName))
            {
                fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
                sw = new StreamWriter(fs, Encoding.UTF8);
                //写出列名称
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    data += dt.Columns[i].ColumnName.ToString();
                    if (i < dt.Columns.Count - 1)
                    {
                        data += ",";//中间用,隔开
                    }
                }
                sw.WriteLine(data);
            }
            else
            {
                fs = new FileStream(fileName, FileMode.Append, FileAccess.Write);
                sw = new StreamWriter(fs, Encoding.UTF8);
            }
            //写出各行数据
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                data = null;
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    data += dt.Rows[i][j].ToString();
                    if (j < dt.Columns.Count - 1)
                    {
                        data += ",";//中间用,隔开
                    }
                }
                sw.WriteLine(data);
            }
            sw.Close();
            fs.Close();
        }
        public static List<string> ReadCSVList(string fileName)
        {
            List<string> dt = new List<string>();
            FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            StreamReader sr = new StreamReader(fs, Encoding.UTF8);
            //记录每次读取的一行记录
            string strLine = null;
            //逐行读取CSV文件
            while ((strLine = sr.ReadLine()) != null)
            {
                strLine = strLine.Trim();//去除头尾空格
                dt.Add(strLine);
            }
            sr.Close();
            fs.Close();
            return dt;
        }
        /// <summary>
        /// è¯»å–CSV文件
        /// </summary>
        /// <param name="fileName">文件路径</param>
        public static DataTable ReadCSV(string fileName)
        {
            DataTable dt = new DataTable();
            FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            StreamReader sr = new StreamReader(fs, Encoding.Default);
            //记录每次读取的一行记录
            string strLine = null;
            //记录每行记录中的各字段内容
            string[] arrayLine = null;
            //分隔符
            string[] separators = { "," };
            char[] separators2 = { ',' };
            //判断,若是第一次,建立表头
            bool isFirst = true;
            //逐行读取CSV文件
            while ((strLine = sr.ReadLine()) != null)
            {
                strLine = strLine.Trim();//去除头尾空格
                //arrayLine = strLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);//分隔字符串,返回数组
                arrayLine = strLine.Split(separators2);//分隔字符串,返回数组
                int dtColumns = arrayLine.Length;//列的个数
                if (isFirst)  //建立表头
                {
                    for (int i = 0; i < dtColumns; i++)
                    {
                        dt.Columns.Add(arrayLine[i]);//每一列名称
                    }
                    isFirst = false;
                }
                else   //表内容
                {
                    DataRow dataRow = dt.NewRow();//新建一行
                    for (int j = 0; j < dtColumns; j++)
                    {
                        if(j+1> dataRow.ItemArray.Count())
                        {
                            break;
                        }
                        dataRow[j] = arrayLine[j];
                    }
                    dt.Rows.Add(dataRow);//添加一行
                }
            }
            sr.Close();
            fs.Close();
            return dt;
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/ComboBoxHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@

using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// ComboBox帮助类
    /// </summary>
    public class ComboBoxHelper
    {
        /// <summary>
        /// èŽ·å–ä¸‹æ‹‰æ¡†çš„é€‰æ‹©çš„æ•°æ®
        /// </summary>
        /// <param name="cmb"></param>
        /// <returns></returns>
        public static string GetComboxSelectValue(System.Windows.Forms.ComboBox cmb, ref ListItem selProFlag)
        {
            selProFlag = (ListItem)cmb.SelectedItem;
            var sselProFlagValue = selProFlag.Value;
            return sselProFlagValue;
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/ConfigHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,106 @@
using System;
using System.Configuration;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// web.config操作类
    /// Copyright (C) TBEA.WMS
    /// </summary>
    public sealed class ConfigHelper
    {
        /// <summary>
        /// å¾—到AppSettings中的配置字符串信息
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetConfigString(string key)
        {
            string CacheKey = "AppSettings-" + key;
            object objModel = DataCache.GetCache(CacheKey);
            if (objModel == null)
            {
                try
                {
                    objModel = ConfigurationManager.AppSettings[key];
                    if (objModel != null)
                    {
                        DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(180), TimeSpan.Zero);
                    }
                }
                catch
                { }
            }
            return objModel.ToString();
        }
        /// <summary>
        /// å¾—到AppSettings中的配置Bool信息
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static bool GetConfigBool(string key)
        {
            bool result = false;
            string cfgVal = GetConfigString(key);
            if(null != cfgVal && string.Empty != cfgVal)
            {
                try
                {
                    result = bool.Parse(cfgVal);
                }
                catch(FormatException)
                {
                    // Ignore format exceptions.
                }
            }
            return result;
        }
        /// <summary>
        /// å¾—到AppSettings中的配置Decimal信息
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static decimal GetConfigDecimal(string key)
        {
            decimal result = 0;
            string cfgVal = GetConfigString(key);
            if(null != cfgVal && string.Empty != cfgVal)
            {
                try
                {
                    result = decimal.Parse(cfgVal);
                }
                catch(FormatException)
                {
                    // Ignore format exceptions.
                }
            }
            return result;
        }
        /// <summary>
        /// å¾—到AppSettings中的配置int信息
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static int GetConfigInt(string key)
        {
            int result = 0;
            string cfgVal = GetConfigString(key);
            if(null != cfgVal && string.Empty != cfgVal)
            {
                try
                {
                    result = int.Parse(cfgVal);
                }
                catch(FormatException)
                {
                    // Ignore format exceptions.
                }
            }
            return result;
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/DataCache.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,45 @@
using System;
using System.Web;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// ç¼“存相关的操作类
    /// Copyright (C) TBEA.WMS
    /// </summary>
    public class DataCache
    {
        /// <summary>
        /// èŽ·å–å½“å‰åº”ç”¨ç¨‹åºæŒ‡å®šCacheKey的Cache值
        /// </summary>
        /// <param name="CacheKey"></param>
        /// <returns></returns>
        public static object GetCache(string CacheKey)
        {
            System.Web.Caching.Cache objCache = HttpRuntime.Cache;
            return objCache[CacheKey];
        }
        /// <summary>
        /// è®¾ç½®å½“前应用程序指定CacheKey的Cache值
        /// </summary>
        /// <param name="CacheKey"></param>
        /// <param name="objObject"></param>
        public static void SetCache(string CacheKey, object objObject)
        {
            System.Web.Caching.Cache objCache = HttpRuntime.Cache;
            objCache.Insert(CacheKey, objObject);
        }
        /// <summary>
        /// è®¾ç½®å½“前应用程序指定CacheKey的Cache值
        /// </summary>
        /// <param name="CacheKey"></param>
        /// <param name="objObject"></param>
        public static void SetCache(string CacheKey, object objObject, DateTime absoluteExpiration,TimeSpan slidingExpiration )
        {
            System.Web.Caching.Cache objCache = HttpRuntime.Cache;
            objCache.Insert(CacheKey, objObject,null,absoluteExpiration,slidingExpiration);
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/DateTimeHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,83 @@

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// æ—¥æœŸå¤„理类
    /// </summary>
    public class DateTimeHelper
    {
        /// <summary>
        /// ç»Ÿä¸€æ—¶é—´
        /// </summary>
        /// <returns></returns>
        public static DateTime GetDateTime()
        {
            return DateTime.Now;
        }
        /// <summary>
        /// è®¡ç®—两个时间的时间差,返回秒数
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static int GetTimeDiffer(DateTime? startTime, DateTime? endTime, ref string msg)
        {
            if (startTime == null || endTime == null)
            {
                return 0;
            }
            TimeSpan ts = ((DateTime)endTime - (DateTime)startTime);
            msg = "";
            if (ts.Days != 0)
            {
                msg += ts.Days + "天";
            }
            if (ts.Hours != 0)
            {
                msg += ts.Hours + "小时";
            }
            if (ts.Minutes != 0)
            {
                msg += ts.Minutes + "分钟";
            }
            if (ts.Seconds != 0)
            {
                msg += ts.Seconds + "秒";
            }
            return (int)ts.TotalSeconds;
        }
        /// <summary>
        /// è½¬æ¢æ—¥æœŸæ ¼å¼ä¸ºå­—符串
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static string ConvertToString(DateTime? dt)
        {
            if (dt == null)
            {
                return string.Empty;
            }
            return Convert.ToDateTime(dt).ToString("yyyy-MM-dd HH:mm:ss");
        }
        /// <summary>
        /// è½¬æ¢æ—¥æœŸæ ¼å¼ä¸ºå­—符串
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static string ConvertToStringForOnlyShowTime(DateTime? dt)
        {
            if (dt == null)
            {
                return string.Empty;
            }
            return Convert.ToDateTime(dt).ToString("HH:mm:ss");
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/EntityPropHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,155 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace iWare_SCADA_BusinessLogical.Utils
{
    public class EntityPropHelper
    {
        /// <summary>
        /// åå°„实现两个类的对象之间相同属性的值的复制
        /// é€‚用于初始化新实体
        /// </summary>
        /// <typeparam name="D">返回的实体</typeparam>
        /// <typeparam name="S">数据源实体</typeparam>
        /// <param name="s">数据源实体</param>
        /// <returns>返回的新实体</returns>
        public static D Mapper<D, S>(S s)
        {
            D d = Activator.CreateInstance<D>(); //构造新实例
            try
            {
                var Types = s.GetType();//获得类型
                var Typed = typeof(D);
                foreach (PropertyInfo sp in Types.GetProperties())//获得类型的属性字段
                {
                    foreach (PropertyInfo dp in Typed.GetProperties())
                    {
                        if (dp.Name == sp.Name && dp.PropertyType == sp.PropertyType && dp.Name != "Error" && dp.Name != "Item")//判断属性名是否相同
                        {
                            dp.SetValue(d, sp.GetValue(s, null), null);//获得s对象属性的值复制给d对象的属性
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return d;
        }
    }
    /// <summary>
    /// ç”¨äºŽå±žæ€§å±žæ€§èµ‹å€¼æ“ä½œçš„帮助类
    /// </summary>
    /// <typeparam name="T">原对象类</typeparam>
    /// <typeparam name="S">目标对象类</typeparam>
    public class EntityPropHelper<T,S> where T:class where S:class
    {
        /// <summary>
        /// å°†t中的各个对于的属性值赋值到s中相应的属性
        /// </summary>
        /// <param name="t">原对象</param>
        /// <param name="s">目标对象</param>
        /// <param name="columnMap">以T中的属性名为键,S中的属性名为值的字典</param>
        public static void CopyProp(T t, S s, Dictionary<string,string> columnMap)
        {
            Type typeT = typeof(T);
            Type typeS = typeof(S);
            var sProps = typeS.GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList();
            var sPropDic = new Dictionary<string, PropertyInfo>();
            var keys = columnMap.Keys;
            var values = columnMap.Values;
            //遍历S的所有属性,将符合修改的存入字典中
            sProps.ForEach(p => { if (values.Contains(p.Name)) { sPropDic.Add(p.Name, p); } });
            var tProps = typeT.GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList();
            var tPropDic = new Dictionary<string, PropertyInfo>();
            //遍历S的所有属性,将符合修改的存入字典中
            tProps.ForEach(p => { if (keys.Contains(p.Name)) { tPropDic.Add(p.Name, p); } });
            foreach(var key in keys)
            {
                var propValue = tPropDic[key].GetValue(t, null);
                sPropDic[columnMap[key]].SetValue(s, propValue, null);
            }
        }
        ///// <summary>
        ///// å°†s中的各个对于的属性值赋值到t中相应的属性
        ///// </summary>
        ///// <param name="t">目标对象</param>
        ///// <param name="s">原对象</param>
        ///// <param name="columnMap">以T中的属性名为键,S中的属性名为值的字典</param>
        //public static void CopyProp(S s,T t , Dictionary<string, string> columnMap)
        //{
        //        Type typeT = typeof(T);
        //        Type typeS = typeof(S);
        //        var sProps = typeS.GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList();
        //        var sPropDic = new Dictionary<string, PropertyInfo>();
        //        var keys = columnMap.Keys;
        //        var values = columnMap.Values;
        //        //遍历S的所有属性,将符合修改的存入字典中
        //        sProps.ForEach(p => { if (values.Contains(p.Name)) { sPropDic.Add(p.Name, p); } });
        //        var tProps = typeT.GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList();
        //        var tPropDic = new Dictionary<string, PropertyInfo>();
        //        //遍历S的所有属性,将符合修改的存入字典中
        //        tProps.ForEach(p => { if (keys.Contains(p.Name)) { tPropDic.Add(p.Name, p); } });
        //        foreach (var key in keys)
        //        {
        //            var propValue = sPropDic[columnMap[key]].GetValue(s, null);
        //            tPropDic[key].SetValue(t, propValue, null);
        //        }
        //}
        /// <summary>
        /// å°†t中的各个对于的属性值赋值到s中相应的属性
        /// </summary>
        /// <param name="t">原对象</param>
        /// <param name="s">目标对象</param>
        /// <param name="columnMap">以T中的属性名为键,S中的属性名为值的字典</param>
        public static void CopyProp(T t, S s,List<string> propNames)
        {
            Type typeT = typeof(T);
            Type typeS = typeof(S);
            var sProps = typeS.GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList();
            var sPropDic = new Dictionary<string, PropertyInfo>();
            //遍历S的所有属性,将符合修改的存入字典中
            sProps.ForEach(p => { if (propNames.Contains(p.Name)) { sPropDic.Add(p.Name, p); } });
            var tProps = typeT.GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList();
            var tPropDic = new Dictionary<string, PropertyInfo>();
            //遍历S的所有属性,将符合修改的存入字典中
            tProps.ForEach(p => { if (propNames.Contains(p.Name)) { tPropDic.Add(p.Name, p); } });
            foreach (var propName in propNames)
            {
                var propValue = tPropDic[propName].GetValue(t, null);
                sPropDic[propName].SetValue(s, propValue, null);
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/EnumberHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,126 @@

using iTextSharp.text.pdf.qrcode;
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// æžšä¸¾ç±»
    /// </summary>
    public class EnumberHelper
    {
        /// <summary>
        /// èŽ·å–è½¬æ¢æžšä¸¾å€¼çš„å­—ç¬¦ä¸²
        /// </summary>
        /// <param name="mode"></param>
        /// <returns></returns>
        public static string GetEnumName<T>(int mode) where T : struct
        {
            T t = default(T);
            bool isRight = EnumberHelper.GetEnumObject<T>(mode.ToString(), out t);
            if (isRight)
            {
                return t.ToString();
            }
            return "";
        }
        ///// <summary>
        ///// èŽ·å–è½¬æ¢æžšä¸¾å€¼çš„å­—ç¬¦ä¸²
        ///// </summary>
        ///// <param name="mode"></param>
        ///// <returns></returns>
        //public static T GetEnum<T>(int mode) where T : struct
        //{
        //    T t = default(T);
        //    bool isRight = EnumberHelper.GetEnumObject<T>(mode.ToString(), out t);
        //    if (isRight)
        //    {
        //        return t;
        //    }
        //    throw new Exception("转换失败");
        //}
        /// <summary>
        /// æ ¹æ®æžšä¸¾å€¼è½¬æ¢æžšä¸¾
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="enumValue"></param>
        /// <returns></returns>
        public static bool GetEnumObject<T>(string enumValue, out T t) where T : struct
        {
            bool right = Enum.TryParse(enumValue.ToString(), out t);
            if (right)
            {
                // éœ€è¦é€šè¿‡æ­¤æ–¹æ³•再次确定是否是枚举实际定义的内容
                if (!Enum.IsDefined(typeof(T), t))
                {
                    return false;
                }
                return true;
            }
            else
            {
                return false;
            }
        }
        public static T GetEnumForString<T>(string enumValue) where T : struct
        {
            T t = default(T);
            bool isRight = EnumberHelper.GetEnumObject<T>(enumValue, out t);
            return t;
        }
        /// <summary>
        /// æžšä¸¾è½¬é›†åˆ
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static List<EnumberEntity> EnumToList<T>()
        {
            List<EnumberEntity> list = new List<EnumberEntity>();
            foreach (var e in Enum.GetValues(typeof(T)))
            {
                EnumberEntity m = new EnumberEntity();
                object[] objArr = e.GetType().GetField(e.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), true);
                if (objArr != null && objArr.Length > 0)
                {
                    DescriptionAttribute da = objArr[0] as DescriptionAttribute;
                    m.Desction = da.Description;
                }
                m.EnumValue = Convert.ToInt32(e);
                m.EnumName = e.ToString();
                list.Add(m);
            }
            return list;
        }
        /// <summary>
        /// èŽ·å–æžšä¸¾çš„æè¿°å±žæ€§
        /// </summary>
        /// <param name="enumValue">枚举值</param>
        /// <returns>枚举的描述属性</returns>
        public static string GetEnumDescription(Enum en)
        {
            Type type = en.GetType();   //获取类型
            MemberInfo[] memberInfos = type.GetMember(en.ToString());   //获取成员
            if (memberInfos != null && memberInfos.Length > 0)
            {
                DescriptionAttribute[] attrs = memberInfos[0].GetCustomAttributes(typeof(DescriptionAttribute), false) as DescriptionAttribute[];   //获取描述特性
                if (attrs != null && attrs.Length > 0)
                {
                    return attrs[0].Description;    //返回当前描述
                }
            }
            return en.ToString();
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FileDirectoryEnumerator.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,569 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    ///
    /// </summary>
    /// <remarks>
    /// è°ƒç”¨Win32API方法 FindFirstFile , FindNextFile, FindClose
    /// </remarks>
    public class FileDirectoryEnumerator : System.Collections.IEnumerator
    {
        #region å±žæ€§
        /// <summary>
        /// å½“前对象文件
        /// </summary>
        private object objCurrentObject = null;
        private bool bolIsEmpty = false;
        /// <summary>
        /// æ˜¯å¦æ‰¾ä¸åˆ°æ–‡ä»¶
        /// </summary>
        public bool IsEmpty
        {
            get { return bolIsEmpty; }
        }
        private int intSearchedCount = 0;
        /// <summary>
        /// æ‰¾åˆ°çš„æ–‡ä»¶æ•°
        /// </summary>
        public int SearchedCount
        {
            get { return intSearchedCount; }
        }
        private bool bolIsFile = true;
        /// <summary>
        /// æ˜¯å¦ä¸ºæ–‡ä»¶
        /// </summary>
        public bool IsFile
        {
            get { return bolIsFile; }
        }
        private int intLastErrorCode = 0;
        /// <summary>
        /// é”™è¯¯ä»£ç Win32
        /// </summary>
        public int LastErrorCode
        {
            get { return intLastErrorCode; }
        }
        /// <summary>
        /// æ–‡ä»¶åç§°
        /// </summary>
        public string Name
        {
            get
            {
                if (this.objCurrentObject != null)
                {
                    if (objCurrentObject is string)
                        return (string)this.objCurrentObject;
                    else
                        return ((System.IO.FileSystemInfo)this.objCurrentObject).Name;
                }
                return null;
            }
        }
        /// <summary>
        /// æ–‡ä»¶å±žæ€§
        /// </summary>
        public System.IO.FileAttributes Attributes
        {
            get { return (System.IO.FileAttributes)myData.dwFileAttributes; }
        }
        /// <summary>
        /// æ–‡ä»¶åˆ›å»ºæ—¶é—´
        /// </summary>
        public System.DateTime CreationTime
        {
            get
            {
                //long time = ToLong(myData.ftCreationTime_dwHighDateTime,
                //    myData.ftCreationTime_dwLowDateTime);
                //System.DateTime dtm = System.DateTime.FromFileTimeUtc(time);
                //return dtm.ToLocalTime();
                return ToDateTime(myData.ftCreationTime);
            }
        }
        /// <summary>
        /// æ–‡ä»¶æœ€åŽè®¿é—®æ—¶é—´
        /// </summary>
        public System.DateTime LastAccessTime
        {
            get
            {
                //long time = ToLong(myData.ftLastAccessTime_dwHighDateTime,
                //    myData.ftLastAccessTime_dwLowDateTime);
                //System.DateTime dtm = System.DateTime.FromFileTimeUtc(time);
                //return dtm.ToLocalTime();
                return ToDateTime(myData.ftLastAccessTime);
            }
        }
        /// <summary>
        /// æ–‡ä»¶æœ€åŽå†™å…¥æ—¶é—´
        /// </summary>
        public System.DateTime LastWriteTime
        {
            get
            {
                //long time = ToLong(myData.ftLastWriteTime_dwHighDateTime,
                //    myData.ftLastWriteTime_dwLowDateTime);
                //System.DateTime dtm = System.DateTime.FromFileTimeUtc(time);
                //return dtm.ToLocalTime();
                return ToDateTime(myData.ftLastWriteTime);
            }
        }
        /// <summary>
        /// æ–‡ä»¶å¤§å°
        /// </summary>
        public long FileLength
        {
            get
            {
                if (this.bolIsFile)
                    return ToLong(myData.nFileSizeHigh, myData.nFileSizeLow);
                else
                    return 0;
            }
        }
        #endregion
        #region æŸ¥è¯¢å±žæ€§
        private bool bolThrowIOException = true;
        /// <summary>
        /// æ˜¯å¦æŠ›å‡ºå¼‚常
        /// </summary>
        public bool ThrowIOException
        {
            get { return this.bolThrowIOException; }
            set { this.bolThrowIOException = value; }
        }
        private bool bolReturnStringType = true;
        /// <summary>
        /// è¿”回类型
        /// </summary>
        public bool ReturnStringType
        {
            get { return bolReturnStringType; }
            set { bolReturnStringType = value; }
        }
        private string strSearchPattern = "*";
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶å
        /// </summary>
        public string SearchPattern
        {
            get { return strSearchPattern; }
            set { strSearchPattern = value; }
        }
        private string strSearchPath = null;
        /// <summary>
        /// æŸ¥è¯¢è·¯å¾„
        /// </summary>
        public string SearchPath
        {
            get { return strSearchPath; }
            set { strSearchPath = value; }
        }
        private bool bolSearchForFile = true;
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶
        /// </summary>
        public bool SearchForFile
        {
            get { return bolSearchForFile; }
            set { bolSearchForFile = value; }
        }
        private bool bolSearchForDirectory = true;
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶å¤¹
        /// </summary>
        public bool SearchForDirectory
        {
            get { return bolSearchForDirectory; }
            set { bolSearchForDirectory = value; }
        }
        //private int? searchCreationTime_High;
        //private int? searchCreationTime_Low;
        private DateTime? searchCreationTime;
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶åˆ›å»ºæ—¶é—´åœ¨è®¾ç½®æ—¶é—´ä¹‹åŽçš„æ–‡ä»¶
        /// </summary>
        public DateTime? SearchCreationTime
        {
            get { return searchCreationTime; }
            set
            {
                searchCreationTime = value;
            }
        }
        private DateTime? searchCreationEndTime;
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶åˆ›å»ºæ—¶é—´åœ¨è®¾ç½®æ—¶é—´ä¹‹å‰çš„æ–‡ä»¶
        /// </summary>
        public DateTime? SearchCreationEndTime
        {
            get { return searchCreationEndTime; }
            set
            {
                searchCreationEndTime = value;
            }
        }
        private DateTime? searchModifyTime;
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶ä¿®æ”¹æ—¶é—´åœ¨è®¾ç½®æ—¶é—´ä¹‹åŽçš„æ–‡ä»¶
        /// </summary>
        public DateTime? SearchModifyTime
        {
            get { return searchModifyTime; }
            set
            {
                searchModifyTime = value;
            }
        }
        private DateTime? searchModifyEndTime;
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶ä¿®æ”¹æ—¶é—´åœ¨è®¾ç½®æ—¶é—´ä¹‹å‰çš„æ–‡ä»¶
        /// </summary>
        public DateTime? SearchModifyEndTime
        {
            get { return searchModifyEndTime; }
            set
            {
                searchModifyEndTime = value;
            }
        }
        #endregion
        /// <summary>
        /// å…³é—­æ–‡ä»¶
        /// </summary>
        public void Close()
        {
            this.CloseHandler();
        }
        #region IEnumerator
        /// <summary>
        /// å½“前文件
        /// </summary>
        public object Current
        {
            get { return objCurrentObject; }
        }
        /// <summary>
        /// æŸ¥è¯¢ä¸‹ä¸€æ–‡ä»¶
        /// </summary>
        /// <returns>是否成功</returns>
        public bool MoveNext()
        {
            bool success = false;
            while (true)
            {
                if (this.bolStartSearchFlag)
                    success = this.SearchNext();
                else
                    success = this.StartSearch();
                if (success)
                {
                    var time = ToDateTime(myData.ftCreationTime);
                    if (searchCreationTime.HasValue)
                        if (time <= searchCreationTime.Value)
                            continue;
                    if (searchCreationEndTime.HasValue)
                        if (time > searchCreationEndTime.Value)
                            continue;
                    time = ToDateTime(myData.ftLastWriteTime);
                    if (searchModifyTime.HasValue)
                        if (time <= searchModifyTime.Value)
                            continue;
                    if (searchModifyEndTime.HasValue)
                        if (time > searchModifyEndTime.Value)
                            continue;
                    if (this.UpdateCurrentObject())
                        return true;
                }
                else
                {
                    this.objCurrentObject = null;
                    return false;
                }
            }
        }
        /// <summary>
        /// é‡è®¾
        /// </summary>
        public void Reset()
        {
            if (this.strSearchPath == null)
                throw new System.ArgumentNullException("SearchPath can not null");
            if (this.strSearchPattern == null || this.strSearchPattern.Length == 0)
                this.strSearchPattern = "*";
            this.intSearchedCount = 0;
            this.objCurrentObject = null;
            this.CloseHandler();
            this.bolStartSearchFlag = false;
            this.bolIsEmpty = false;
            this.intLastErrorCode = 0;
        }
        #endregion
        #region WIN32API
        //[Serializable, System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto), System.Runtime.InteropServices.BestFitMapping(false)]
        //private struct WIN32_FIND_DATA
        //{
        //    public int dwFileAttributes;
        //    public int ftCreationTime_dwLowDateTime;
        //    public int ftCreationTime_dwHighDateTime;
        //    public int ftLastAccessTime_dwLowDateTime;
        //    public int ftLastAccessTime_dwHighDateTime;
        //    public int ftLastWriteTime_dwLowDateTime;
        //    public int ftLastWriteTime_dwHighDateTime;
        //    public int nFileSizeHigh;
        //    public int nFileSizeLow;
        //    public int dwReserved0;
        //    public int dwReserved1;
        //    [System.Runtime.InteropServices.MarshalAs
        //    (System.Runtime.InteropServices.UnmanagedType.ByValTStr,
        //    SizeConst = 260)]
        //    public string cFileName;
        //    [System.Runtime.InteropServices.MarshalAs
        //    (System.Runtime.InteropServices.UnmanagedType.ByValTStr,
        //    SizeConst = 14)]
        //    public string cAlternateFileName;
        //}
        [Serializable, System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto), System.Runtime.InteropServices.BestFitMapping(false)]
        public struct FILETIME
        {
            public int dwLowDateTime;
            public int dwHighDateTime;
        }
        //[Serializable, System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto), System.Runtime.InteropServices.BestFitMapping(false)]
        //public struct WIN32_FIND_DATA
        //{
        //    public int dwFileAttributes;
        //    public FILETIME ftCreationTime;
        //    public FILETIME ftLastAccessTime;
        //    public FILETIME ftLastWriteTime;
        //    public int nFileSizeHigh;
        //    public int nFileSizeLow;
        //    public int dwOID;
        //    [System.Runtime.InteropServices.MarshalAs
        //   (System.Runtime.InteropServices.UnmanagedType.ByValTStr,
        //   SizeConst = 260)]
        //    public string cFileName;
        //    [System.Runtime.InteropServices.MarshalAs
        //    (System.Runtime.InteropServices.UnmanagedType.ByValTStr,
        //    SizeConst = 14)]
        //    public string cAlternateFileName;
        //}
        [Serializable, System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto), System.Runtime.InteropServices.BestFitMapping(false)]
        public struct WIN32_FIND_DATA
        {
            public int dwFileAttributes;
            public FILETIME ftCreationTime;
            public FILETIME ftLastAccessTime;
            public FILETIME ftLastWriteTime;
            public int nFileSizeHigh;
            public int nFileSizeLow;
            public int dwReserved0;
            public int dwReserved1;
            [System.Runtime.InteropServices.MarshalAs
            (System.Runtime.InteropServices.UnmanagedType.ByValTStr,
            SizeConst = 260)]
            public string cFileName;
            [System.Runtime.InteropServices.MarshalAs
            (System.Runtime.InteropServices.UnmanagedType.ByValTStr,
            SizeConst = 14)]
            public string cAlternateFileName;
        }
        [System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
        private static extern IntPtr FindFirstFile(IntPtr pFileName, ref WIN32_FIND_DATA pFindFileData);
        [System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
        private static extern bool FindNextFile(IntPtr hndFindFile, ref WIN32_FIND_DATA lpFindFileData);
        [System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
        private static extern bool FindClose(IntPtr hndFindFile);
        private static long ToLong(int height, int low)
        {
            long v = (uint)height;
            v = v << 0x20;
            v = v | ((uint)low);
            return v;
        }
        public static DateTime ToDateTime(FILETIME time)
        {
            return DateTime.FromFileTime(ToLong(time.dwHighDateTime, time.dwLowDateTime));
        }
        private static void WinIOError(int errorCode, string str)
        {
            switch (errorCode)
            {
                case 80:
                    throw new System.IO.IOException("IO_FileExists :" + str);
                case 0x57:
                    throw new System.IO.IOException("IOError:" + MakeHRFromErrorCode(errorCode));
                case 0xce:
                    throw new System.IO.PathTooLongException("PathTooLong:" + str);
                case 2:
                    throw new System.IO.FileNotFoundException("FileNotFound:" + str);
                case 3:
                    throw new System.IO.DirectoryNotFoundException("PathNotFound:" + str);
                case 5:
                    throw new UnauthorizedAccessException("UnauthorizedAccess:" + str);
                case 0x20:
                    throw new System.IO.IOException("IO_SharingViolation:" + str);
            }
            throw new System.IO.IOException("IOError:" + MakeHRFromErrorCode(errorCode));
        }
        private static int MakeHRFromErrorCode(int errorCode)
        {
            return (-2147024896 | errorCode);
        }
        private static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
        /// <summary>
        /// æ— æ•ˆå¥æŸ„
        /// </summary>
        private System.IntPtr intSearchHandler = INVALID_HANDLE_VALUE;
        private WIN32_FIND_DATA myData = new WIN32_FIND_DATA();
        /// <summary>
        /// æ˜¯å¦å·²ç»å¼€å§‹æŸ¥è¯¢
        /// </summary>
        private bool bolStartSearchFlag = false;
        /// <summary>
        /// å…³é—­
        /// </summary>
        private void CloseHandler()
        {
            if (this.intSearchHandler != INVALID_HANDLE_VALUE)
            {
                FindClose(this.intSearchHandler);
                this.intSearchHandler = INVALID_HANDLE_VALUE;
            }
        }
        /// <summary>
        /// å¼€å§‹æŸ¥è¯¢
        /// </summary>
        /// <returns></returns>
        private bool StartSearch()
        {
            bolStartSearchFlag = true;
            bolIsEmpty = false;
            objCurrentObject = null;
            intLastErrorCode = 0;
            string strPath = System.IO.Path.Combine(strSearchPath, this.strSearchPattern);
            this.CloseHandler();
            intSearchHandler = FindFirstFile(System.Runtime.InteropServices.Marshal.StringToHGlobalAuto(strPath), ref myData);
            if (intSearchHandler == INVALID_HANDLE_VALUE)
            {
                intLastErrorCode = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
                if (intLastErrorCode == 2)
                {
                    bolIsEmpty = true;
                    return false;
                }
                if (this.bolThrowIOException)
                    WinIOError(intLastErrorCode, strSearchPath);
                else
                    return false;
            }
            return true;
        }
        /// <summary>
        /// æŸ¥è¯¢ä¸‹ä¸€æ–‡ä»¶
        /// </summary>
        /// <returns></returns>
        private bool SearchNext()
        {
            if (bolStartSearchFlag == false)
                return false;
            if (bolIsEmpty)
                return false;
            if (intSearchHandler == INVALID_HANDLE_VALUE)
                return false;
            intLastErrorCode = 0;
            if (FindNextFile(intSearchHandler, ref myData) == false)
            {
                intLastErrorCode = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
                this.CloseHandler();
                if (intLastErrorCode != 0 && intLastErrorCode != 0x12)
                {
                    if (this.bolThrowIOException)
                        WinIOError(intLastErrorCode, strSearchPath);
                    else
                        return false;
                }
                return false;
            }
            return true;
        }
        /// <summary>
        /// æ›´æ–°å½“前文件信息
        /// </summary>
        /// <returns></returns>
        private bool UpdateCurrentObject()
        {
            if (intSearchHandler == INVALID_HANDLE_VALUE)
                return false;
            bool Result = false;
            this.objCurrentObject = null;
            if ((myData.dwFileAttributes & 0x10) == 0)
            {
                //
                this.bolIsFile = true;
                if (this.bolSearchForFile)
                    Result = true;
            }
            else
            {
                //
                this.bolIsFile = false;
                if (this.bolSearchForDirectory)
                {
                    if (myData.cFileName == "." || myData.cFileName == "..")
                        Result = false;
                    else
                        Result = true;
                }
            }
            if (Result)
            {
                if (this.bolReturnStringType)
                    this.objCurrentObject = myData.cFileName;
                else
                {
                    string p = System.IO.Path.Combine(this.strSearchPath, myData.cFileName);
                    if (this.bolIsFile)
                    {
                        this.objCurrentObject = new System.IO.FileInfo(p);
                    }
                    else
                    {
                        this.objCurrentObject = new System.IO.DirectoryInfo(p);
                    }
                }
                this.intSearchedCount++;
            }
            return Result;
        }
        #endregion
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FileHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,399 @@

using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;
using iWare_SCADA_BusinessLogical.Properties;
using Newtonsoft.Json.Linq;
using Spire.Additions.Xps.Schema;
using Spire.Pdf;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime;
using System.Text;
using Resources = iWare_SCADA_BusinessLogical.Properties.Resources;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// æ–‡ä»¶å¸®åŠ©
    /// </summary>
    public class FileHelper
    {
        private static char[] base64CodeArray = new char[]
        {
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
            'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
            '0', '1', '2', '3', '4',  '5', '6', '7', '8', '9', '+', '/', '='
        };
        /// <summary>
        /// åˆ¤æ–­ä¸€ä¸ªæ–‡ä»¶æ˜¯å¦æ˜¯å›¾ç‰‡
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static bool IsImage(string name)
        {
            var extension = System.IO.Path.GetExtension(name).ToLower();
            var imageExtensions = new List<string> { ".jpg", ".png", ".ico", ".tif", ".bmp", ".gif" };
            return imageExtensions.Contains(extension);
        }
        /// <summary>
        /// åˆ¤æ–­ä¸€ä¸ªæ–‡ä»¶æ˜¯å¦ä¸ºpdf文件
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static bool IsPdf(string name)
        {
            var extension = System.IO.Path.GetExtension(name).ToLower();
            var pdfExtensions = new List<string> { ".pdf" };
            return pdfExtensions.Contains(extension);
        }
        /// <summary>
        /// å°†æŒ‡å®šè·¯å¾„下的文件转为byte数组
        /// </summary>
        /// <param name="path">指定路径</param>
        /// <returns></returns>
        public static byte[] GetBytesByFile(string path)
        {
            try
            {
                if (!File.Exists(path))
                {
                    return new byte[0];
                }
                var fileInfo = new FileInfo(path);
                byte[] buff = new byte[fileInfo.Length];
                var fileStream = fileInfo.OpenRead();
                fileStream.Read(buff, 0, int.Parse(fileStream.Length.ToString()));
                fileStream.Close();
                return buff;
            }
            catch (Exception ex)
            {
                LogTextHelper.WriteLog(Resources.LogDir, "FileHelper", "GetBytesByFile", ex.Message);
                return new byte[0];
            }
        }
        /// <summary>
        /// å°†æŒ‡å®šè·¯å¾„下的图片转成base64字符串
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string GetBase64Str(string path)
        {
            try
            {
                using (MemoryStream ms1 = new MemoryStream())
                {
                    var bmp1 = new Bitmap(path);
                    bmp1.Save(ms1, System.Drawing.Imaging.ImageFormat.Jpeg);
                    byte[] arr1 = new byte[ms1.Length];
                    ms1.Position = 0;
                    ms1.Read(arr1, 0, (int)ms1.Length);
                    ms1.Close();
                    bmp1.Dispose();
                    return Convert.ToBase64String(arr1);
                }
            }
            catch (Exception ex)
            {
                LogTextHelper.WriteLog(Resources.LogDir, "FileHelper", "GetBytesByFile", ex.Message);
                return null;
            }
        }
        public static string GetBase64Str(Bitmap bitMap)
        {
            try
            {
                using (MemoryStream ms1 = new MemoryStream())
                {
                    bitMap.Save(ms1, System.Drawing.Imaging.ImageFormat.Jpeg);
                    byte[] arr1 = new byte[ms1.Length];
                    ms1.Position = 0;
                    ms1.Read(arr1, 0, (int)ms1.Length);
                    ms1.Close();
                    return Convert.ToBase64String(arr1);
                }
            }
            catch (Exception ex)
            {
                LogTextHelper.WriteLog(Resources.LogDir, "FileHelper", "GetBytesByFile", ex.Message);
                return null;
            }
        }
        /// <summary>
        /// æ˜¯å¦base64字符串
        /// </summary>
        /// <param name="base64Str">要判断的字符串</param>
        /// <param name="bytes">字符串转换成的字节数组</param>
        /// <returns></returns>
        public static bool IsBase64(string base64Str, out byte[] bytes)
        {
            //string strRegex = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$";
            bytes = null;
            if (string.IsNullOrEmpty(base64Str))
                return false;
            else
            {
                if (base64Str.Contains(","))
                    base64Str = base64Str.Split(',')[1];
                if (base64Str.Length % 4 != 0)
                    return false;
                if (base64Str.Any(c => !base64CodeArray.Contains(c)))
                    return false;
            }
            try
            {
                bytes = Convert.FromBase64String(base64Str);
                return true;
            }
            catch (FormatException)
            {
                return false;
            }
        }
        /// <summary>
        /// æŠŠbase64字符串转换成Bitmap
        /// </summary>
        /// <param name="base64Str">要转换的base64字符串</param>
        /// <returns></returns>
        public static Bitmap Base64ToBitmap(string base64Str)
        {
            Bitmap bitmap = null;
            byte[] bytes = null;
            try
            {
                if (IsBase64(base64Str, out bytes))
                {
                    using (MemoryStream stream = new MemoryStream(bytes))
                    {
                        stream.Seek(0, SeekOrigin.Begin);//为了避免有时候流指针定位错误,显式定义一下指针位置
                        bitmap = new Bitmap(stream);
                    }
                }
            }
            catch (Exception)
            {
                bitmap = null;
            }
            return bitmap;
        }
        /// <summary>
        /// åˆ é™¤æ–‡ä»¶å¤¹strDir中nDays天以前的文件
        /// </summary>
        /// <param name="dir"></param>
        /// <param name="days"></param>
        public static void DeleteOldFiles(string dir, int days)
        {
            try
            {
                if (!Directory.Exists(dir) || days < 1) return;
                var now = DateTime.Now;
                foreach (var f in Directory.GetFileSystemEntries(dir).Where(f => File.Exists(f)))
                {
                    var t = File.GetCreationTime(f);
                    var elapsedTicks = now.Ticks - t.Ticks;
                    var elapsedSpan = new TimeSpan(elapsedTicks);
                    if (elapsedSpan.TotalDays > days) File.Delete(f);
                }
            }
            catch (Exception)
            {
                // ignored
            }
        }
        /// <summary>
        /// serch new file
        /// </summary>
        /// <returns></returns>
        public static System.Collections.IEnumerable DetectNewFilesCSV(string MonitorDicPath,int seconds,DateTime startTime,DateTime endTime)
        {
            FindFiles findFiles;
            string localpath = MonitorDicPath;
            findFiles = new FindFiles();
            findFiles.SearchPath = localpath;
            findFiles.ReturnStringType = false;
            //   findFiles.SearchPattern = "*.XML-1";
            findFiles.SearchPattern = "*.csv";
            findFiles.SearchForDirectory = false;
            findFiles.SearchForFile = true;
            //findFiles.SearchCreationTime = LastTime;//不等于时间
            //findFiles.SearchCreationEndTime = DateTime.Now.AddMinutes(-5);
            //findFiles.SearchModifyTime = DateTimeHelper.GetDateTime().AddSeconds(-seconds);//不等于时间
            findFiles.SearchModifyTime = startTime.AddSeconds(-seconds);//不等于时间
            findFiles.SearchModifyEndTime = endTime;
            return findFiles;
        }
        /// <summary>
        /// serch new file
        /// </summary>
        /// <param name="MonitorDicPath"></param>
        /// <param name="seconds"></param>
        /// <param name="SearchPattern">*.csv</param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public static System.Collections.IEnumerable DetectNewFiles(string MonitorDicPath, string SearchPattern, int seconds, DateTime startTime, DateTime endTime)
        {
            FindFiles findFiles;
            string localpath = MonitorDicPath;
            findFiles = new FindFiles();
            findFiles.SearchPath = localpath;
            findFiles.ReturnStringType = false;
            //   findFiles.SearchPattern = "*.XML-1";
            findFiles.SearchPattern =string.IsNullOrEmpty(SearchPattern)?"*.csv": SearchPattern;
            findFiles.SearchForDirectory = false;
            findFiles.SearchForFile = true;
            //findFiles.SearchCreationTime = LastTime;//不等于时间
            //findFiles.SearchCreationEndTime = DateTime.Now.AddMinutes(-5);
            //findFiles.SearchModifyTime = DateTimeHelper.GetDateTime().AddSeconds(-seconds);//不等于时间
            findFiles.SearchModifyTime = startTime.AddSeconds(-seconds);//不等于时间
            findFiles.SearchModifyEndTime = endTime;
            return findFiles;
        }
        //public static string[] ReadPdf(string path)
        //{
        //    PdfReader pdfreader = new PdfReader(path);
        //    string text = iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(pdfreader, 1);
        //    string[] words = text.Split('\n');
        //    pdfreader.Close();
        //    return words;
        //}
        public static string ReadPdfFileForSpire(string fileName, string getPdfValue)
        {
            try
            {
                //FreeSpire读取PDF
                PdfReader reader = new PdfReader(fileName);
                int iPageNum = reader.NumberOfPages;
                //if (iPageNum <= 10)//Spire超过10页的会出问题
                //{
                //实例化pdfdocment对象
                Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
                //加载pdf文件
                doc.LoadFromFile(fileName);
                //实例化一个StringBuilder å¯¹è±¡
                StringBuilder content = new StringBuilder();
                //提取PDF所有页面的文本
                foreach (PdfPageBase page in doc.Pages)
                {
                    content.Append(page.ExtractText());
                }
                var text = content.ToString();
                string[] words = text.Split('\n');
                if (getPdfValue.Equals("Result"))
                {
                    var list = words[0].Split(' ');
                    //取第一行最后一个值就是质量结果
                    var Result = list[list.Length - 1].Replace("\r", "");
                    return Result;
                }
                //}
                foreach (var item in words)
                {
                    if (item.Contains(getPdfValue))
                    {
                        string[] splitValue = item.Split(':');
                        if (splitValue.Count() > 1)
                        {
                            var spectlist= splitValue[1].Trim().Split(' ');
                            return spectlist[0].Trim();
                        }
                    }
                }
            }
            catch(Exception ex)
            {
            }
            return "";
        }
        public static string ReadPdfConntent(string filePath, string getPdfValue)
        {
            List<string> lst = new List<string>();
            try
            {
                string pdffilename = filePath;
                PdfReader pdfreader = new PdfReader(pdffilename);
                PdfReader.unethicalreading = true;
                int numberOfPages = pdfreader.NumberOfPages;
                //for (int i = 1; i <= numberOfPages; ++i)
                //{
                //    lst.Add(iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(pdfreader,i));
                //    text.AppendLine();
                //}
                var pdfReader = new PdfReader(pdffilename);
                StreamWriter output = new StreamWriter(new FileStream("处理结果.txt", FileMode.Create));
                int pageCount = pdfReader.NumberOfPages;
                for (int pg = 1; pg <= pageCount; pg++)
                {
                    ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
                    var value = PdfTextExtractor.GetTextFromPage(pdfReader, pg, strategy);
                    value = value.Replace(" ", "");
                    Console.WriteLine(value);
                    output.Write(value);
                }
                output.Flush();
                output.Close();
                string text = iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(pdfreader, 1);
                string[] words = text.Split('\n');
                foreach (var item in words)
                {
                    string value = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(item));
                    if (value.Contains(getPdfValue))
                    {
                        string[] splitValue = value.Split(':');
                        lst.Add(splitValue[1].Trim());
                    }
                }
                pdfreader.Close();
                return lst.First();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FileOperationHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,470 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
namespace iWare_SCADA_BusinessLogical.Utils
{
    public static class FileOperationHelper
    {
        public static string read(string path)
        {
            FileStream fin;
            if (!File.Exists(path)) fin = File.Create(path);
            else fin = new FileStream(path, FileMode.Open, FileAccess.Read);
            StreamReader brin = new StreamReader(fin, Encoding.UTF8);
            string s = brin.ReadToEnd(); brin.Close(); return s;
        }
        //public static string oprater(string s) { return s = s + "\r\n" + textBox1.Text + "\r\n" + DateTime.Now.ToString(); }
        public static void save(string s, string path)
        {
            FileStream fout = new FileStream(path, FileMode.Create, FileAccess.Write);
            StreamWriter brout = new StreamWriter(fout, Encoding.Default);
            try
            {
                brout.Write(s);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                brout.Close();
            }
        }
        public static string ReadFileToString(FileInfo file)
        {
            StreamReader sr = null;
            string fileContent = string.Empty;
            try
            {
                sr = File.OpenText(file.FullName);
                fileContent = sr.ReadToEnd();
            }
            catch { }
            finally
            {
                if (sr != null)
                    sr.Close();
                sr = null;
            }
            return fileContent;
        }
        #region ã€å†…部类型定义】
        private struct SHFILEOPSTRUCT
        {
            public IntPtr hwnd;         //父窗口句柄
            public wFunc wFunc;         //要执行的动作
            public string pFrom;        //源文件路径,可以是多个文件,以结尾符号"\0"结束
            public string pTo;          //目标路径,可以是路径或文件名
            public FILEOP_FLAGS fFlags;             //标志,附加选项
            public bool fAnyOperationsAborted;      //是否可被中断
            public IntPtr hNameMappings;            //文件映射名字,可在其它 Shell å‡½æ•°ä¸­ä½¿ç”¨
            public string lpszProgressTitle;        // åªåœ¨ FOF_SIMPLEPROGRESS æ—¶ï¼ŒæŒ‡å®šå¯¹è¯æ¡†çš„æ ‡é¢˜ã€‚
        }
        private enum wFunc
        {
            FO_MOVE = 0x0001,   //移动文件
            FO_COPY = 0x0002,   //复制文件
            FO_DELETE = 0x0003, //删除文件,只是用pFrom
            FO_RENAME = 0x0004  //文件重命名
        }
        private enum FILEOP_FLAGS
        {
            FOF_MULTIDESTFILES = 0x0001,    //pTo æŒ‡å®šäº†å¤šä¸ªç›®æ ‡æ–‡ä»¶ï¼Œè€Œä¸æ˜¯å•个目录
            FOF_CONFIRMMOUSE = 0x0002,
            FOF_SILENT = 0x0044,            // ä¸æ˜¾ç¤ºä¸€ä¸ªè¿›åº¦å¯¹è¯æ¡†
            FOF_RENAMEONCOLLISION = 0x0008, // ç¢°åˆ°æœ‰æŠµè§¦çš„名字时,自动分配前缀
            FOF_NOCONFIRMATION = 0x10,      // ä¸å¯¹ç”¨æˆ·æ˜¾ç¤ºæç¤º
            FOF_WANTMAPPINGHANDLE = 0x0020, // å¡«å…… hNameMappings å­—段,必须使用 SHFreeNameMappings é‡Šæ”¾
            FOF_ALLOWUNDO = 0x40,           // å…è®¸æ’¤é”€
            FOF_FILESONLY = 0x0080,         // ä½¿ç”¨ *.* æ—¶, åªå¯¹æ–‡ä»¶æ“ä½œ
            FOF_SIMPLEPROGRESS = 0x0100,    // ç®€å•进度条,意味者不显示文件名。
            FOF_NOCONFIRMMKDIR = 0x0200,    // å»ºæ–°ç›®å½•时不需要用户确定
            FOF_NOERRORUI = 0x0400,         // ä¸æ˜¾ç¤ºå‡ºé”™ç”¨æˆ·ç•Œé¢
            FOF_NOCOPYSECURITYATTRIBS = 0x0800,     // ä¸å¤åˆ¶ NT æ–‡ä»¶çš„安全属性
            FOF_NORECURSION = 0x1000        // ä¸é€’归目录
        }
        #endregion ã€å†…部类型定义】
        #region ã€DllImport】
        [DllImport("shell32.dll")]
        private static extern int SHFileOperation(ref SHFILEOPSTRUCT lpFileOp);
        #endregion ã€DllImport】
        #region ã€åˆ é™¤æ–‡ä»¶æ“ä½œã€‘
        /// <summary>
        /// åˆ é™¤å•个文件。
        /// </summary>
        /// <param name="fileName">删除的文件名</param>
        /// <param name="toRecycle">指示是将文件放入回收站还是永久删除,true-放入回收站,false-永久删除</param>
        /// <param name="showDialog">指示是否显示确认对话框,true-显示确认删除对话框,false-不显示确认删除对话框</param>
        /// <param name="showProgress">指示是否显示进度对话框,true-显示,false-不显示。该参数当指定永久删除文件时有效</param>
        /// <param name="errorMsg">反馈错误消息的字符串</param>
        /// <returns>操作执行结果标识,删除文件成功返回0,否则,返回错误代码</returns>
        public static int DeleteFile(string fileName, bool toRecycle, bool showDialog, bool showProgress, ref string errorMsg)
        {
            try
            {
                string fName = GetFullName(fileName);
                return ToDelete(fName, toRecycle, showDialog, showProgress, ref errorMsg);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return -200;
            }
        }
        /// <summary>
        /// åˆ é™¤ä¸€ç»„文件。
        /// </summary>
        /// <param name="fileNames">字符串数组,表示一组文件名</param>
        /// <param name="toRecycle">指示是将文件放入回收站还是永久删除,true-放入回收站,false-永久删除</param>
        /// <param name="showDialog">指示是否显示确认对话框,true-显示确认删除对话框,false-不显示确认删除对话框</param>
        /// <param name="showProgress">指示是否显示进度对话框,true-显示,false-不显示。该参数当指定永久删除文件时有效</param>
        /// <param name="errorMsg">反馈错误消息的字符串</param>
        /// <returns>操作执行结果标识,删除文件成功返回0,否则,返回错误代码</returns>
        public static int DeleteFiles(string[] fileNames, bool toRecycle, bool showDialog, bool showProgress, ref string errorMsg)
        {
            try
            {
                string fName = "";
                foreach (string str in fileNames)
                {
                    fName += GetFullName(str) + "\0";     //组件文件组字符串
                }
                return ToDelete(fName, toRecycle, showDialog, showProgress, ref errorMsg);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return -200;
            }
        }
        #endregion ã€åˆ é™¤æ–‡ä»¶æ“ä½œã€‘
        #region ã€ç§»åŠ¨æ–‡ä»¶æ“ä½œã€‘
        /// <summary>
        /// ç§»åŠ¨ä¸€ä¸ªæ–‡ä»¶åˆ°æŒ‡å®šè·¯å¾„ä¸‹
        /// </summary>
        /// <param name="sourceFileName">要移动的文件名</param>
        /// <param name="destinationPath">移动到的目的路径</param>
        /// <param name="showDialog">指示是否显示确认对话框,true-显示确认对话框,false-不显示确认对话框</param>
        /// <param name="showProgress">指示是否显示进度对话框</param>
        /// <param name="autoRename">指示当文件名重复时,是否自动为新文件加上后缀名</param>
        /// <param name="errorMsg">反馈错误消息的字符串</param>
        /// <returns>返回移动操作是否成功的标识,成功返回0,失败返回错误代码</returns>
        public static int MoveFile(string sourceFileName, string destinationPath, bool showDialog, bool showProgress, bool autoRename, ref string errorMsg)
        {
            try
            {
                string sfName = GetFullName(sourceFileName);
                string dfName = GetFullName(destinationPath);
                return ToMoveOrCopy(wFunc.FO_MOVE, sfName, dfName, showDialog, showProgress, autoRename, ref errorMsg);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return -200;
            }
        }
        /// <summary>
        /// ç§»åŠ¨ä¸€ç»„æ–‡ä»¶åˆ°æŒ‡å®šçš„è·¯å¾„ä¸‹
        /// </summary>
        /// <param name="sourceFileNames">要移动的文件名数组</param>
        /// <param name="destinationPath">移动到的目的路径</param>
        /// <param name="showDialog">指示是否显示确认对话框,true-显示确认对话框,false-不显示确认对话框</param>
        /// <param name="showProgress">指示是否显示进度对话框</param>
        /// <param name="autoRename">指示当文件名重复时,是否自动为新文件加上后缀名</param>
        /// <param name="errorMsg">反馈错误消息的字符串</param>
        /// <returns>返回移动操作是否成功的标识,成功返回0,失败返回错误代码,-200:表示其他异常</returns>
        public static int MoveFiles(string[] sourceFileNames, string destinationPath, bool showDialog, bool showProgress, bool autoRename, ref string errorMsg)
        {
            try
            {
                string sfName = "";
                foreach (string str in sourceFileNames)
                {
                    sfName += GetFullName(str) + "\0";   //组件文件组字符串
                }
                string dfName = GetFullName(destinationPath);
                return ToMoveOrCopy(wFunc.FO_MOVE, sfName, dfName, showDialog, showProgress, autoRename, ref errorMsg);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return -200;
            }
        }
        #endregion ã€ç§»åŠ¨æ–‡ä»¶æ“ä½œã€‘
        #region ã€å¤åˆ¶æ–‡ä»¶æ“ä½œã€‘
        /// <summary>
        /// å¤åˆ¶ä¸€ä¸ªæ–‡ä»¶åˆ°æŒ‡å®šçš„æ–‡ä»¶åæˆ–路径
        /// </summary>
        /// <param name="sourceFileName">要复制的文件名</param>
        /// <param name="destinationFileName">复制到的目的文件名或路径</param>
        /// <param name="showDialog">指示是否显示确认对话框,true-显示确认对话框,false-不显示确认对话框</param>
        /// <param name="showProgress">指示是否显示进度对话框</param>
        /// <param name="autoRename">指示当文件名重复时,是否自动为新文件加上后缀名</param>
        /// <returns>返回移动操作是否成功的标识,成功返回0,失败返回错误代码,-200:表示其他异常</returns>
        public static int CopyFile(string sourceFileName, string destinationFileName, bool showDialog, bool showProgress, bool autoRename, ref string errorMsg)
        {
            try
            {
                string sfName = GetFullName(sourceFileName);
                string dfName = GetFullName(destinationFileName);
                return ToMoveOrCopy(wFunc.FO_COPY, sfName, dfName, showDialog, showProgress, autoRename, ref errorMsg);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return -200;
            }
        }
        /// <summary>
        /// å¤åˆ¶ä¸€ç»„文件到指定的路径
        /// </summary>
        /// <param name="sourceFileNames">要复制的文件名数组</param>
        /// <param name="destinationPath">复制到的目的路径</param>
        /// <param name="showDialog">指示是否显示确认对话框,true-显示确认对话框,false-不显示确认对话框</param>
        /// <param name="showProgress">指示是否显示进度对话框</param>
        /// <param name="autoRename">指示当文件名重复时,是否自动为新文件加上后缀名</param>
        /// <returns>返回移动操作是否成功的标识,成功返回0,失败返回错误代码,-200:表示其他异常</returns>
        public static int CopyFiles(string[] sourceFileNames, string destinationPath, bool showDialog, bool showProgress, bool autoRename, ref string errorMsg)
        {
            try
            {
                string sfName = "";
                foreach (string str in sourceFileNames)
                {
                    sfName += GetFullName(str) + "\0";     //组件文件组字符串
                }
                string dfName = GetFullName(destinationPath);
                return ToMoveOrCopy(wFunc.FO_COPY, sfName, dfName, showDialog, showProgress, autoRename, ref errorMsg);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return -200;
            }
        }
        #endregion ã€å¤åˆ¶æ–‡ä»¶æ“ä½œã€‘
        #region ã€é‡å‘½åæ–‡ä»¶ã€‘
        /// <summary>
        /// é‡å‘½åä¸€ä¸ªæ–‡ä»¶ä¸ºæ–°åç§°ï¼Œå»ºè®®æ‚¨ä½¿ç”¨æ›´æ–¹ä¾¿çš„Microsoft.VisualBasic.FileSystem.ReName();替换该方法
        /// </summary>
        /// <param name="sourceFileName">要复制的文件名</param>
        /// <param name="destinationFileName">复制到的目的文件名或路径</param>
        /// <param name="showDialog">指示是否显示确认对话框,true-显示确认对话框,false-不显示确认对话框</param>
        /// <returns>返回移动操作是否成功的标识,成功返回0,失败返回错误代码,-200:表示其他异常</returns>
        [Obsolete("建议使用 Microsoft.VisualBasic.FileSystem.ReName()方法")]
        public static int ReNameFile(string sourceFileName, string destinationFileName, bool showDialog, ref string errorMsg)
        {
            try
            {
                SHFILEOPSTRUCT lpFileOp = new SHFILEOPSTRUCT();
                lpFileOp.wFunc = wFunc.FO_RENAME;
                lpFileOp.pFrom = GetFullName(sourceFileName) + "\0\0";         //将文件名以结尾字符"\0\0"结束
                lpFileOp.pTo = GetFullName(destinationFileName) + "\0\0";
                lpFileOp.fFlags = FILEOP_FLAGS.FOF_NOERRORUI;
                if (!showDialog)
                    lpFileOp.fFlags |= FILEOP_FLAGS.FOF_NOCONFIRMATION;     //设定不显示提示对话框
                lpFileOp.fAnyOperationsAborted = true;
                int n = SHFileOperation(ref lpFileOp);
                if (n == 0)
                    return 0;
                string tmp = GetErrorString(n);
                errorMsg = string.Format("{0}({1})", tmp, sourceFileName);
                return n;
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return -200;
            }
        }
        /// <summary>
        /// åˆ©ç”¨Microsoft.VisualBasic.FileSystem.ReName()方法实现
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="newFileName"></param>
        public static void ReNameFile(string filePath, string newFileName)
        {
            try
            {
                string extensName = Path.GetExtension(filePath);
                string newName = newFileName + extensName;
                Microsoft.VisualBasic.FileIO.FileSystem.RenameFile(filePath, newName);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion ã€é‡å‘½åæ–‡ä»¶ã€‘
        /// <summary>
        /// åˆ é™¤å•个或多个文件
        /// </summary>
        /// <param name="fileName">删除的文件名,如果是多个文件,文件名之间以字符串结尾符'\0'隔开</param>
        /// <param name="toRecycle">指示是将文件放入回收站还是永久删除,true-放入回收站,false-永久删除</param>
        /// <param name="showDialog">指示是否显示确认对话框,true-显示确认删除对话框,false-不显示确认删除对话框</param>
        /// <param name="showProgress">指示是否显示进度对话框,true-显示,false-不显示。该参数当指定永久删除文件时有效</param>
        /// <param name="errorMsg">反馈错误消息的字符串</param>
        /// <returns>操作执行结果标识,删除文件成功返回0,否则,返回错误代码</returns>
        private static int ToDelete(string fileName, bool toRecycle, bool showDialog, bool showProgress, ref string errorMsg)
        {
            SHFILEOPSTRUCT lpFileOp = new SHFILEOPSTRUCT();
            lpFileOp.wFunc = wFunc.FO_DELETE;
            lpFileOp.pFrom = fileName + "\0";       //将文件名以结尾字符"\0"结束
            lpFileOp.fFlags = FILEOP_FLAGS.FOF_NOERRORUI;
            if (toRecycle)
                lpFileOp.fFlags |= FILEOP_FLAGS.FOF_ALLOWUNDO;  //设定删除到回收站
            if (!showDialog)
                lpFileOp.fFlags |= FILEOP_FLAGS.FOF_NOCONFIRMATION;     //设定不显示提示对话框
            if (!showProgress)
                lpFileOp.fFlags |= FILEOP_FLAGS.FOF_SILENT;     //设定不显示进度对话框
            lpFileOp.fAnyOperationsAborted = true;
            int n = SHFileOperation(ref lpFileOp);
            if (n == 0)
                return 0;
            string tmp = GetErrorString(n);
            //.av æ–‡ä»¶æ­£å¸¸åˆ é™¤äº†ä½†ä¹Ÿæç¤º 402 é”™è¯¯ï¼Œä¸çŸ¥é“为什么。屏蔽之。
            if ((fileName.ToLower().EndsWith(".av") && n.ToString("X") == "402"))
                return 0;
            errorMsg = string.Format("{0}({1})", tmp, fileName);
            return n;
        }
        /// <summary>
        /// ç§»åŠ¨æˆ–å¤åˆ¶ä¸€ä¸ªæˆ–å¤šä¸ªæ–‡ä»¶åˆ°æŒ‡å®šè·¯å¾„ä¸‹
        /// </summary>
        /// <param name="flag">操作类型,是移动操作还是复制操作</param>
        /// <param name="sourceFileName">要移动或复制的文件名,如果是多个文件,文件名之间以字符串结尾符'\0'隔开</param>
        /// <param name="destinationFileName">移动到的目的位置</param>
        /// <param name="showDialog">指示是否显示确认对话框,true-显示确认对话框,false-不显示确认对话框</param>
        /// <param name="showProgress">指示是否显示进度对话框</param>
        /// <param name="autoRename">指示当文件名重复时,是否自动为新文件加上后缀名</param>
        /// <param name="errorMsg">反馈错误消息的字符串</param>
        /// <returns>返回移动操作是否成功的标识,成功返回0,失败返回错误代码</returns>
        private static int ToMoveOrCopy(wFunc flag, string sourceFileName, string destinationFileName, bool showDialog, bool showProgress, bool autoRename, ref string errorMsg)
        {
            SHFILEOPSTRUCT lpFileOp = new SHFILEOPSTRUCT();
            lpFileOp.wFunc = flag;
            lpFileOp.pFrom = sourceFileName + "\0";         //将文件名以结尾字符"\0\0"结束
            lpFileOp.pTo = destinationFileName + "\0\0";
            lpFileOp.fFlags = FILEOP_FLAGS.FOF_NOERRORUI;
            lpFileOp.fFlags |= FILEOP_FLAGS.FOF_NOCONFIRMMKDIR; //指定在需要时可以直接创建路径
            if (!showDialog)
                lpFileOp.fFlags |= FILEOP_FLAGS.FOF_NOCONFIRMATION;     //设定不显示提示对话框
            if (!showProgress)
                lpFileOp.fFlags |= FILEOP_FLAGS.FOF_SILENT;     //设定不显示进度对话框
            if (autoRename)
                lpFileOp.fFlags |= FILEOP_FLAGS.FOF_RENAMEONCOLLISION;  //自动为重名文件添加名称后缀
            lpFileOp.fAnyOperationsAborted = true;
            int n = SHFileOperation(ref lpFileOp);
            if (n == 0)
                return 0;
            string tmp = GetErrorString(n);
            errorMsg = string.Format("{0}({1})", tmp, sourceFileName);
            return n;
        }
        /// <summary>
        /// èŽ·å–ä¸€ä¸ªæ–‡ä»¶çš„å…¨å
        /// </summary>
        /// <param name="fileName">文件名</param>
        /// <returns>返回生成文件的完整路径名</returns>
        private static string GetFullName(string fileName)
        {
            System.IO.FileInfo fi = new System.IO.FileInfo(fileName);
            return fi.FullName;
        }
        /// <summary>
        /// è§£é‡Šé”™è¯¯ä»£ç 
        /// </summary>
        /// <param name="n">代码号</param>
        /// <returns>返回关于错误代码的文字描述</returns>
        private static string GetErrorString(int n)
        {
            if (n == 0) return string.Empty;
            switch (n)
            {
                case 2:
                    return "系统找不到指定的文件。";
                case 7:
                    return "存储控制块被销毁。您是否选择的“取消”操作?";
                case 113:
                    return "文件已存在!";
                case 115:
                    return "重命名文件操作,原始文件和目标文件必须具有相同的路径名。不能使用相对路径。";
                case 117:
                    return "I/O控制错误";
                case 123:
                    return "指定了重复的文件名";
                case 116:
                    return "The source is a root directory, which cannot be moved or renamed.";
                case 118:
                    return "Security settings denied access to the source.";
                case 124:
                    return "The path in the source or destination or both was invalid.";
                case 65536:
                    return "An unspecified error occurred on the destination.";
                case 1026:
                    return "在试图移动或拷贝一个不存在的文件.";
                case 1223:
                    return "操作被取消!";
                default:
                    return "未识别的错误代码:" + n;
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FindFiles.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// FindFiles å®žæ—¶æŸ¥æ‰¾æ–‡ä»¶
    /// </summary>
    /// <remarks>
    /// FindFiles e = new FindFiles();
    /// e.SearchPath = @"c:\";
    /// e.ReturnStringType = true ;
    /// e.SearchPattern = "*.exe";
    /// e.SearchForDirectory = false ;
    /// e.SearchForFile = true;
    /// e.SearchCreationTime = DateTime.Now.AddDays(-1);
    /// foreach (object name in e)
    /// {
    /// System.Console.WriteLine(name);
    /// }
    /// System.Console.ReadLine();
    ///
    ///</remarks>
    public class FindFiles : System.Collections.IEnumerable
    {
        private bool bolReturnStringType = true;
        /// <summary>
        /// å¦‚果为True返回文件名,否则返回 System.IO.FileInfo æˆ– System.IO.DirectoryInfo
        /// </summary>
        public bool ReturnStringType
        {
            get { return bolReturnStringType; }
            set { bolReturnStringType = value; }
        }
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶åˆ›å»ºå¼€å§‹æ—¶é—´
        /// </summary>
        public DateTime? SearchCreationTime { get; set; }
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶åˆ›å»ºç»“束时间
        /// </summary>
        public DateTime? SearchCreationEndTime { get; set; }
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶ä¿®æ”¹å¼€å§‹æ—¶é—´
        /// </summary>
        public DateTime? SearchModifyTime { get; set; }
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶ä¿®æ”¹ç»“束时间
        /// </summary>
        public DateTime? SearchModifyEndTime { get; set; }
        private string strSearchPattern = "*";
        /// <summary>
        /// æŸ¥è¯¢æ¡ä»¶
        /// </summary>
        public string SearchPattern
        {
            get { return strSearchPattern; }
            set { strSearchPattern = value; }
        }
        private string strSearchPath = null;
        /// <summary>
        /// æŸ¥è¯¢è·¯å¾„
        /// </summary>
        public string SearchPath
        {
            get { return strSearchPath; }
            set { strSearchPath = value; }
        }
        private bool bolSearchForFile = true;
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶
        /// </summary>
        public bool SearchForFile
        {
            get { return bolSearchForFile; }
            set { bolSearchForFile = value; }
        }
        private bool bolSearchForDirectory = true;
        /// <summary>
        /// æŸ¥è¯¢æ–‡ä»¶å¤¹
        /// </summary>
        public bool SearchForDirectory
        {
            get { return bolSearchForDirectory; }
            set { bolSearchForDirectory = value; }
        }
        private bool bolThrowIOException = true;
        /// <summary>
        /// æ˜¯å¦æŠ›å‡ºå¼‚常
        /// </summary>
        public bool ThrowIOException
        {
            get { return this.bolThrowIOException; }
            set { this.bolThrowIOException = value; }
        }
        /// <summary>
        /// IEnumerator接口
        /// </summary>
        /// <returns></returns>
        public System.Collections.IEnumerator GetEnumerator()
        {
            FileDirectoryEnumerator e = new FileDirectoryEnumerator();
            e.ReturnStringType = this.bolReturnStringType;
            e.SearchForDirectory = this.bolSearchForDirectory;
            e.SearchForFile = this.bolSearchForFile;
            e.SearchPath = this.strSearchPath;
            e.SearchPattern = this.strSearchPattern;
            e.ThrowIOException = this.bolThrowIOException;
            e.SearchCreationTime = this.SearchCreationTime;
            e.SearchCreationEndTime = this.SearchCreationEndTime;
            e.SearchModifyTime = this.SearchModifyTime;
            e.SearchModifyEndTime = this.SearchModifyEndTime;
            myList.Add(e);
            return e;
        }
        /// <summary>
        /// å…³é—­å¯¹è±¡
        /// </summary>
        public void Close()
        {
            foreach (FileDirectoryEnumerator e in myList)
            {
                e.Close();
            }
            myList.Clear();
        }
        private System.Collections.ArrayList myList = new System.Collections.ArrayList();
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/FolderHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// æ–‡ä»¶å¤¹å¸®åŠ©
    /// </summary>
    public class FolderHelper
    {
        /// <summary>
        /// èŽ·å–æŸæ–‡ä»¶å¤¹çš„æ‰€æœ‰å­ç›®å½•
        /// </summary>
        /// <param name="folderPath"></param>
        /// <returns></returns>
        public static DirectoryInfo[] GetDirectories(string folderPath)
        {
            DirectoryInfo mainFolder = new DirectoryInfo(folderPath);
            //找到该文件夹下的子目录
            return mainFolder.GetDirectories();
        }
        /// <summary>
        /// åˆ—出path路径对应的文件夹中的子文件夹和文件
        /// ç„¶åŽå†é€’归列出子文件夹内的文件夹
        /// </summary>
        /// <param name="path">需要列出内容的文件夹的路径</param>
        /// <param name="leval">当前递归层级,用于控制输出前导空格的数量,从0开始</param>
        public static void ListDirectory(string path, int leval, ref List<string> findFolderList)
        {
            DirectoryInfo theFolder = new DirectoryInfo(@path);
            findFolderList.Add(theFolder.FullName);
            leval++;
            //遍历文件
            foreach (FileInfo NextFile in theFolder.GetFiles())
            {
            }
            //遍历文件夹
            foreach (DirectoryInfo NextFolder in theFolder.GetDirectories())
            {
                findFolderList.Add(NextFolder.FullName);
                ListDirectory(NextFolder.FullName, leval, ref findFolderList);
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/Log4Net/C_LogWriter.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,111 @@
using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//配置config文件名
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net_iWare.config", Watch = true)]
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// æ—¥å¿—等级
    /// </summary>
    enum LogLevel
    {
        Error,
        Debug,
        Warning,
        Info
    }
    /// <summary>
    /// æ—¥å¿—记录服务
    /// </summary>
    class C_LogWriter
    {
        /// <summary>
        /// æ—¥å¿—接口
        /// </summary>
        private log4net.ILog m_Log;
        /// <summary>
        /// åˆå§‹åŒ–log4net对象
        /// </summary>
        /// <param name="_LogType">日志类型</param>
        /// <param name="suffix">后缀</param>
        public void Init(LogType _LogType, string suffix)
        {
            string s = _LogType.ToString() + suffix;
            m_Log = log4net.LogManager.GetLogger(s);
        }
        /// <summary>
        /// è¾“出错误级别日志
        /// </summary>
        /// <param name="message">输出的消息</param>
        public void Error(string message, Exception ex)
        {
            //记录日志
            WriteLog(LogLevel.Error, message, ex);
        }
        /// <summary>
        /// è¾“出警告级别日志
        /// </summary>
        /// <param name="message">输出的消息</param>
        public void Warning(string message)
        {
            //记录日志
            WriteLog(LogLevel.Warning, message);
        }
        /// <summary>
        /// è¾“出信息级别日志
        /// </summary>
        /// <param name="message">输出的消息</param>
        public void Info(string message)
        {
            //记录日志
            WriteLog(LogLevel.Info, message);
        }
        /// <summary>
        /// è¾“出调试级别日志
        /// </summary>
        /// <param name="message">输出的消息</param>
        public void Debug(string message)
        {
            //记录日志
            WriteLog(LogLevel.Debug, message);
        }
        /// <summary>
        /// è®°å½•系统日志
        /// </summary>
        /// <param name="logLevel">日志级别</param>
        /// <param name="message">输出的消息</param>
        private void WriteLog(LogLevel logLevel, string message, Exception ex = null)
        {
            switch (logLevel)
            {
                case LogLevel.Debug:
                    m_Log.Debug(message);
                    break;
                case LogLevel.Error:
                    m_Log.Error(message, ex);
                    break;
                case LogLevel.Info:
                    m_Log.Info(message);
                    break;
                case LogLevel.Warning:
                    m_Log.Warn(message);
                    break;
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/Log4Net/Log4netHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
using iWare_SCADA_Model;
using System;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// Log4Net日志帮助
    /// </summary>
    public class Log4NetHelper
    {
        /// <summary>
        /// è¾“出异常日志到Log4Net
        /// </summary>
        /// <param name="_LogType">日志类型</param>
        /// <param name="msg">消息内容</param>
        /// <param name="ex">异常对象</param>
        public static void WriteErrorLog(LogType _LogType, string msg, Exception ex = null)
        {
            C_LogWriter log = new C_LogWriter();
            log.Init(_LogType, "_Error");
            log.Error(msg, ex);
        }
        /// <summary>
        /// è¾“出info日志到Log4Net
        /// </summary>
        /// <param name="_LogType">日志类型</param>
        /// <param name="msg">消息内容</param>
        public static void WriteInfoLog(LogType _LogType, string msg)
        {
            C_LogWriter log = new C_LogWriter();
            log.Init(_LogType, "_Info");
            log.Info(msg);
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/LogTextHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,99 @@
using Newtonsoft.Json;
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
namespace iWare_SCADA_BusinessLogical.Utils
{
    public class LogTextHelper
    {
        /// <summary>
        /// æ‰¹æ¬¡åˆ é™¤æ—¥å¿—文件
        /// </summary>
        public static void BatchDeleteLog()
        {
            List<string> deleteFolder = new System.Collections.Generic.List<string>();
            string folderPath = @"d:\\Log";
            FolderHelper.ListDirectory(folderPath, 0, ref deleteFolder);
            foreach (var item in deleteFolder)
            {
                FileHelper.DeleteOldFiles(item, 30);//删除一个月的数据
            }
        }
        /// <summary>
        /// å¾€æ—¥å¿—里追加内容
        /// </summary>
        /// <param name="folder">日志目录</param>
        /// <param name="logContent">内容</param>
        private static void DoWriteLogContent(string folder, string logContent, Exception ex)
        {
            try
            {
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
                string message = string.Format("【{0}】{1}\r\n", DateTime.Now.ToString("HH:mm:ss"), logContent);
                if (ex != null)
                {
                    message += ",异常堆栈:" + JsonConvert.SerializeObject(ex);
                }
                File.AppendAllText(Path.Combine(folder, DateTime.Now.ToString("yyyyMMdd") + ".txt"), message);
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// å¾€æ—¥å¿—里追加内容
        /// </summary>
        /// <param name="folder">日志目录</param>
        /// <param name="format">内容格式</param>
        /// <param name="args">内容参数</param>
        public static void WriteLine(string folder, string format, params object[] args)
        {
            try
            {
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
                string message = string.Format("【{0}】{1}\r\n", DateTime.Now.ToString("HH:mm:ss"), string.Format(format, args));
                File.AppendAllText(Path.Combine(folder, DateTime.Now.ToString("yyyyMMdd") + ".txt"), message);
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// æ·»åŠ æ—¥å¿—
        /// </summary>
        /// <param name="folder">日志目录</param>
        /// <param name="className">类名</param>
        /// <param name="methodName">方法名</param>
        /// <param name="format">内容格式</param>
        /// <param name="args">内容参数</param>
        public static void WriteLog(string folder, string className, string methodName, string format, params object[] args)
        {
            WriteLine(folder, "在类{0}的{1}方法中:{2}", className, methodName, string.Format(format, args));
        }
        /// <summary>
        /// å†™å…¥æ—¥å¿—
        /// </summary>
        /// <param name="folder">日志目录</param>
        /// <param name="className">类名</param>
        /// <param name="methodName">方法名</param>
        /// <param name="format">内容格式</param>
        /// <param name="args">内容参数</param>
        public static void WriteLogContent(string folder, string className, string methodName, string logContent, Exception ex)
        {
            DoWriteLogContent(folder, string.Format("在类{0}的{1}方法中:{2}", className, methodName, logContent), ex);
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/RandomHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical.Utils
{
    public class RandomHelper
    {
        /// <summary>
        ///生成制定位数的随机码(数字)
        /// </summary>
        /// <param name="length"></param>
        /// <returns></returns>
        public static string GenerateRandomCode(int length)
        {
            var result = new StringBuilder();
            for (var i = 0; i < length; i++)
            {
                var r = new Random(Guid.NewGuid().GetHashCode());
                result.Append(r.Next(0, 10));
            }
            return result.ToString();
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/RegexExtension.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,213 @@
using System;
using System.Text.RegularExpressions;
using System.Threading;
namespace iWare_SCADA_BusinessLogical
{
    public static class RegexExtension
    {
        /// <summary>
        /// å¯åŠ¨ä¸€ä¸ªçº¿ç¨‹æ‰§è¡Œæ“ä½œï¼ŒåŒæ—¶è®¾ç½®è¶…æ—¶æ—¶é—´ã€‚
        /// var r = WithTimeout(() => regex.Match(foo), 1000);
        /// </summary>
        /// <typeparam name="TR"></typeparam>
        /// <param name="proc"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        private static TR WithTimeout<TR>(Func<TR> proc, int duration)
        {
            var reset = new AutoResetEvent(false);
            var r = default(TR);
            Exception ex = null;
            var t = new Thread(() =>
            {
                try
                {
                    r = proc();
                }
                catch (Exception e)
                {
                    ex = e;
                }
                reset.Set();
            });
            t.Start();
            if (!reset.WaitOne(duration))
            {
                t.Abort();
                throw new TimeoutException();
            }
            if (ex != null)
            {
                throw ex;
            }
            return r;
        }
        /// <summary>
        /// åˆ¤æ–­æ­£åˆ™æ˜¯å¦åŒ¹é…, duration毫秒后报超时异常
        /// </summary>
        /// <param name="regex"></param>
        /// <param name="input"></param>
        /// <param name="startat"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static bool IsMatchWithTimeout(this Regex regex, string input, int startat, int duration)
        {
            return regex.IsMatchWithTimeout(input, 0, duration);
        }
        /// <summary>
        /// åˆ¤æ–­æ­£åˆ™æ˜¯å¦åŒ¹é…, duration毫秒后报超时异常
        /// </summary>
        /// <param name="regex"></param>
        /// <param name="input"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static bool IsMatchWithTimeout(this Regex regex, string input, int duration)
        {
            if (regex == null)
                throw new NullReferenceException();
            return WithTimeout(() => regex.IsMatch(input), duration);
        }
        /// <summary>
        /// åŒ¹é…æ­£åˆ™, duration毫秒后报超时异常
        /// </summary>
        /// <param name="regex"></param>
        /// <param name="input"></param>
        /// <param name="startat"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static Match MatchWithTimeout(this Regex regex, string input, int startat, int duration)
        {
            if (regex == null)
                throw new NullReferenceException();
            return WithTimeout(() => regex.Match(input, startat), duration);
        }
        /// <summary>
        /// åŒ¹é…æ­£åˆ™, duration毫秒后报超时异常
        /// </summary>
        /// <param name="regex"></param>
        /// <param name="input"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static Match MatchWithTimeout(this Regex regex, string input, int duration)
        {
            return regex.MatchWithTimeout(input, 0, duration);
        }
        /// <summary>
        /// åŒ¹é…æ­£åˆ™, duration毫秒后报超时异常
        /// </summary>
        /// <param name="regex"></param>
        /// <param name="input"></param>
        /// <param name="startat"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static MatchCollection MatchesWithTimeout(this Regex regex, string input, int startat, int duration)
        {
            if (regex == null)
                throw new NullReferenceException();
            return WithTimeout(() => regex.Matches(input, startat), duration);
        }
        /// <summary>
        /// åŒ¹é…æ­£åˆ™, duration毫秒后报超时异常
        /// </summary>
        /// <param name="regex"></param>
        /// <param name="input"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static MatchCollection MatchesWithTimeout(this Regex regex, string input, int duration)
        {
            return regex.MatchesWithTimeout(input, 0, duration);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <param name="pattern"></param>
        /// <param name="options"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static bool IsMatch(string input, string pattern, RegexOptions options, int duration)
        {
            var regex = new Regex(pattern, options);
            return regex.IsMatchWithTimeout(input, duration);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <param name="pattern"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static bool IsMatch(string input, string pattern, int duration)
        {
            return IsMatch(input, pattern, RegexOptions.None, duration);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <param name="pattern"></param>
        /// <param name="options"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static Match Match(string input, string pattern, RegexOptions options, int duration)
        {
            var regex = new Regex(pattern, options);
            return regex.MatchWithTimeout(input, duration);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <param name="pattern"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static Match Match(string input, string pattern, int duration)
        {
            return Match(input, pattern, RegexOptions.None, duration);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <param name="pattern"></param>
        /// <param name="options"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static MatchCollection Matches(string input, string pattern, RegexOptions options, int duration)
        {
            var regex = new Regex(pattern, options);
            return regex.MatchesWithTimeout(input, duration);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <param name="pattern"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static MatchCollection Matches(string input, string pattern, int duration)
        {
            return Matches(input, pattern, RegexOptions.None, duration);
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/Utils/SystemHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@

using iWare_SCADA_Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_BusinessLogical.Utils
{
    /// <summary>
    /// ç³»ç»Ÿå¸®åŠ©ç±»
    /// </summary>
    public class SystemHelper
    {
        /// <summary>
        /// å­—符串转换decimal类型
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static decimal GetDecimal(string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return 0;
            }
            decimal decimalValue = 0;
            var isRight = decimal.TryParse(value, out decimalValue);
            if (isRight)
            {
                return decimalValue;
            }
            return 0;
        }
        /// <summary>
        /// decimal集合计算平均值
        /// </summary>
        /// <param name="valueList">集合</param>
        /// <param name="digits">精度</param>
        /// <returns></returns>
        public static string CalcDecimalAvg(List<decimal> valueList, int digits)
        {
            var sum = valueList.Sum();
            var count = valueList.Count;
            var bb = Convert.ToDecimal((sum / (decimal)count).ToString("f" + digits.ToString()));
            return bb.ToString();
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{32708F19-FE1A-48F5-B373-8E1C776F216C}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>iWare_SCADA_BusinessLogical</RootNamespace>
    <AssemblyName>iWare_SCADA_BusinessLogical</AssemblyName>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <Deterministic>true</Deterministic>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
      <HintPath>..\packages\BouncyCastle.1.8.9\lib\BouncyCastle.Crypto.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
    </Reference>
    <Reference Include="HslCommunication">
      <HintPath>..\DLL\HslCommunication.dll</HintPath>
    </Reference>
    <Reference Include="itextsharp, Version=5.5.13.3, Culture=neutral, PublicKeyToken=8354ae6d2174ddca, processorArchitecture=MSIL">
      <HintPath>..\packages\iTextSharp.5.5.13.3\lib\itextsharp.dll</HintPath>
    </Reference>
    <Reference Include="log4net">
      <HintPath>..\DLL\log4net.dll</HintPath>
    </Reference>
    <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\DLL\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="Spire.Pdf, Version=9.11.4.0, Culture=neutral, PublicKeyToken=663f351905198cb3, processorArchitecture=MSIL">
      <HintPath>..\packages\Spire.PDF.9.11.4\lib\net40\Spire.Pdf.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.Configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Web" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
    <Reference Include="Yitter.IdGenerator.Net45, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\Yitter.IdGenerator.Net45.1.0.0\lib\net452\Yitter.IdGenerator.Net45.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="BLL\CommonManager.cs" />
    <Compile Include="BLL\DataCaptureColumnDictManager.cs" />
    <Compile Include="BLL\DataCaptureConfigManager.cs" />
    <Compile Include="BLL\SystemValue.cs" />
    <Compile Include="BLL\WorkPieceInfoManager.cs" />
    <Compile Include="BLL\WorkPieceLogManager.cs" />
    <Compile Include="DataCaptureHandler\DBDataCapture\AlarmLogManager.cs" />
    <Compile Include="DLA\Dao\CommonDao.cs" />
    <Compile Include="DLA\Dao\CommonService.cs" />
    <Compile Include="DLA\EFHelp.cs" />
    <Compile Include="DLA\ICommonEntity.cs" />
    <Compile Include="DLA\IService.cs" />
    <Compile Include="DLA\QueryParam.cs" />
    <Compile Include="DataCaptureHandler\PLCDataCapture\PLCService.cs" />
    <Compile Include="DataCaptureHandler\PLCDataCapture\Siemens_HslCommunicationService.cs" />
    <Compile Include="DataCaptureHandler\PLCDataCapture\PLCFactory.cs" />
    <Compile Include="DataCaptureHandler\PLCDataCapture\PLCManger.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="Test\MyTest.cs" />
    <Compile Include="Utils\SystemHelper.cs" />
    <Compile Include="Utils\ComboBoxHelper.cs" />
    <Compile Include="Utils\ConfigHelper.cs" />
    <Compile Include="Utils\CSVHelper.cs" />
    <Compile Include="Utils\DataCache.cs" />
    <Compile Include="Utils\DateTimeHelper.cs" />
    <Compile Include="Utils\EntityPropHelper.cs" />
    <Compile Include="Utils\EnumberHelper.cs" />
    <Compile Include="Utils\FileDirectoryEnumerator.cs" />
    <Compile Include="Utils\FileHelper.cs" />
    <Compile Include="Utils\FindFiles.cs" />
    <Compile Include="Utils\FolderHelper.cs" />
    <Compile Include="Utils\Log4Net\C_LogWriter.cs" />
    <Compile Include="Utils\Log4Net\Log4netHelper.cs" />
    <Compile Include="Utils\LogTextHelper.cs" />
    <Compile Include="Utils\RandomHelper.cs" />
    <Compile Include="Utils\RegexExtension.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="DataCaptureHandlerV2\" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\iWare_SCADA_Model\iWare_SCADA_Model.csproj">
      <Project>{91c185de-15ab-44ae-b585-53799fc51be0}</Project>
      <Name>iWare_SCADA_Model</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
    <None Include="DLA\Dao\_system~.ini" />
    <None Include="log4net_iWare - å¤åˆ¶ç”¨.config">
      <SubType>Designer</SubType>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Include="log4net_iWare.config">
      <SubType>Designer</SubType>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>这台计算机上缺少此项目引用的 NuGet ç¨‹åºåŒ…。使用“NuGet ç¨‹åºåŒ…还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
    <Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
  </Target>
  <Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
</Project>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/log4net_iWare - ¸´ÖÆÓÃ.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
<configuration>
  <configSections>
    <section name="log4net" type="System.Configuration.IgnoreSectionHandler"/>
  </configSections>
  <appSettings>
  </appSettings>
  <log4net>
    <!--  OP80质量采集线程【信息】日志-->
    <appender name="PLCOP80_QC_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log\\SCADALog\\PLCOP80_QC_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP80_QC_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--OP80质量采集线程【错误】日志-->
    <appender name="PLCOP80_QC_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log\\SCADALog\\PLCOP80_QC_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP80_QC_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <root>
      <level value="ALL"/>
      <appender-ref ref="PLCOP80_QC_Info"/>
      <appender-ref ref="PLCOP80_QC_Error"/>
    </root>
  </log4net>
</configuration>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/log4net_iWare.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,528 @@
<configuration>
  <configSections>
    <section name="log4net" type="System.Configuration.IgnoreSectionHandler"/>
  </configSections>
  <appSettings>
  </appSettings>
  <log4net>
    <!--  OP80质量采集线程【信息】日志-->
    <appender name="PLCOP80_QC_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP80_QC_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP80_QC_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--OP80质量采集线程【错误】日志-->
    <appender name="PLCOP80_QC_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP80_QC_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP80_QC_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  è™šæ‹Ÿåº“存出库线程【信息】日志-->
    <appender name="FormMain_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\FormMain_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="FormMain_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--虚拟库存出库线程【错误】日志-->
    <appender name="FormMain_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\FormMain_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="FormMain_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP05线程【信息】日志-->
    <appender name="PLCOP05_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP05_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP05_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP05线程【错误】日志-->
    <appender name="PLCOP05_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP05_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP05_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP10线程【信息】日志-->
    <appender name="PLCOP10_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP10_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP10_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP10线程【错误】日志-->
    <appender name="PLCOP10_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP10_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP10_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP20线程【信息】日志-->
    <appender name="PLCOP20_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP20_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP20_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP20线程【错误】日志-->
    <appender name="PLCOP20_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP20_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP20_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP30线程【信息】日志-->
    <appender name="PLCOP30_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP30_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP30_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP30线程【错误】日志-->
    <appender name="PLCOP30_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP30_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP30_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP35线程【信息】日志-->
    <appender name="PLCOP35_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP35_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP35_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP35线程【错误】日志-->
    <appender name="PLCOP35_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP35_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP35_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP40线程【信息】日志-->
    <appender name="PLCOP40_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP40_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP40_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP40线程【错误】日志-->
    <appender name="PLCOP40_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP40_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP40_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP50线程【信息】日志-->
    <appender name="PLCOP50_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP50_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP50_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP50线程【错误】日志-->
    <appender name="PLCOP50_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP50_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP50_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP60线程【信息】日志-->
    <appender name="PLCOP60_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP60_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP60_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP60线程【错误】日志-->
    <appender name="PLCOP60_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP60_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP60_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP70线程【信息】日志-->
    <appender name="PLCOP70_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP70_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP70_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP70线程【错误】日志-->
    <appender name="PLCOP70_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP70_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP70_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCOP80线程【信息】日志-->
    <appender name="PLCOP80_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP80_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP80_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCOP80线程【错误】日志-->
    <appender name="PLCOP80_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCOP80_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCOP80_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  HslCommunicationService【信息】日志-->
    <appender name="HslCommunicationService_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\HslCommunicationService_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="HslCommunicationService_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--HslCommunicationService【错误】日志-->
    <appender name="HslCommunicationService_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\HslCommunicationService_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="HslCommunicationService_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  PLCService【信息】日志-->
    <appender name="PLCService_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCService_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCService_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--PLCService【错误】日志-->
    <appender name="PLCService_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\PLCService_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="PLCService_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--  DBDataCapture【信息】日志-->
    <appender name="DBDataCapture_Info" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\DBDataCapture_Info\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n消息时间:%d [%t] %n消息级别:%-5p %n消 æ¯ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="DBDataCapture_Info" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <!--DBDataCapture【错误】日志-->
    <appender name="DBDataCapture_Error" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\Log_Test\\SCADALog\\DBDataCapture_Error\\" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <staticLogFileName value="false" />
      <datePattern value="yyyy-MM-dd.LOG" />
      <layout type="log4net.Layout.PatternLayout">
        <!--输出格式-->
        <param name="ConversionPattern" value="%n异常时间:%d [%t] %n异常级别:%-5p %n异 å¸¸ ç±»ï¼š%c [%x] %n%m %n "/>
      </layout>
      <filter type="log4net.Filter.LoggerMatchFilter">
        <loggerToMatch value="DBDataCapture_Error" />
      </filter>
      <filter type="log4net.Filter.DenyAllFilter" />
    </appender>
    <root>
      <level value="ALL"/>
      <appender-ref ref="PLCOP80_QC_Info"/>
      <appender-ref ref="PLCOP80_QC_Error"/>
      <appender-ref ref="FormMain_Info"/>
      <appender-ref ref="FormMain_Error"/>
      <appender-ref ref="PLCOP05_Info"/>
      <appender-ref ref="PLCOP05_Error"/>
      <appender-ref ref="PLCOP10_Info"/>
      <appender-ref ref="PLCOP10_Error"/>
      <appender-ref ref="PLCOP20_Info"/>
      <appender-ref ref="PLCOP20_Error"/>
      <appender-ref ref="PLCOP30_Info"/>
      <appender-ref ref="PLCOP30_Error"/>
      <appender-ref ref="PLCOP35_Info"/>
      <appender-ref ref="PLCOP35_Error"/>
      <appender-ref ref="PLCOP40_Info"/>
      <appender-ref ref="PLCOP40_Error"/>
      <appender-ref ref="PLCOP50_Info"/>
      <appender-ref ref="PLCOP50_Error"/>
      <appender-ref ref="PLCOP60_Info"/>
      <appender-ref ref="PLCOP60_Error"/>
      <appender-ref ref="PLCOP70_Info"/>
      <appender-ref ref="PLCOP70_Error"/>
      <appender-ref ref="PLCOP80_Info"/>
      <appender-ref ref="PLCOP80_Error"/>
      <appender-ref ref="HslCommunicationService_Info"/>
      <appender-ref ref="HslCommunicationService_Error"/>
      <appender-ref ref="PLCService_Info"/>
      <appender-ref ref="PLCService_Error"/>
      <appender-ref ref="DBDataCapture_Info"/>
      <appender-ref ref="DBDataCapture_Error"/>
    </root>
  </log4net>
</configuration>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_BusinessLogical/packages.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="BouncyCastle" version="1.8.9" targetFramework="net472" />
  <package id="EntityFramework" version="6.4.4" targetFramework="net472" />
  <package id="iTextSharp" version="5.5.13.3" targetFramework="net472" />
  <package id="Spire.PDF" version="9.11.4" targetFramework="net472" />
  <package id="Yitter.IdGenerator.Net45" version="1.0.0" targetFramework="net472" />
</packages>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/App - ±¾»ú»·¾³.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <!--net use x: \\192.168.216.133\Destination /savecred /persistent:yes
    net use z: \\192.168.216.130\kistler /savecred /persistent:yes
    net use y: \\192.168.216.6\data /savecred /persistent:yes
    net use u: \\192.168.216.130\NutrunnerData /savecred /persistent:yes-->
    <!-- åˆ¤æ–­å·¥åºæ˜¯å¦è·³åºçš„基准配置 -->
    <add key="WorkingProcedureAllStr" value="OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80" />
      <add key="WorkPeiceIDPath" value="Y:\qualified" />
    <!-- op30工序的工位质量信息 -->
    <add key="OP30QualityDataFor36Station" value="Z:\" />
    <add key="OP30QualityDataFor45Station" value="U:\" />
    <add key="OP60QualityData" value="V:\" />
    <add key="OP20QualityData" value="W:\" />
    <add key="OP80QualityData" value="X:\CA4GC20TD\" />
      <!--<add key="WorkPeiceIDPath" value="C:\Users\13650\Desktop\yiqi" />-->
    <add key="HeartBeatAlertInterval" value="2000" />
  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
  </startup>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <!--<add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
    <!--<add name="SCADA_DF22001_CORE" connectionString="Server=10.10.40.166;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
    <add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    <add name="SCModel" connectionString="data source=.;initial catalog=SCTest_new;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/App - Éú²ú»·¾³.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <!--net use x: \\192.168.216.133\Destination /savecred /persistent:yes
    net use z: \\192.168.216.130\kistler /savecred /persistent:yes
    net use y: \\192.168.216.6\data /savecred /persistent:yes
    net use u: \\192.168.216.130\NutrunnerData /savecred /persistent:yes-->
    <!-- åˆ¤æ–­å·¥åºæ˜¯å¦è·³åºçš„基准配置 -->
    <add key="WorkingProcedureAllStr" value="OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80" />
      <add key="WorkPeiceIDPath" value="Y:\qualified" />
    <!-- op30工序的工位质量信息 -->
    <add key="OP30QualityDataFor36Station" value="Z:\" />
    <add key="OP30QualityDataFor45Station" value="U:\" />
    <add key="OP60QualityData" value="V:\" />
    <add key="OP20QualityData" value="W:\" />
    <add key="OP80QualityData" value="X:\CA4GC20TD\" />
      <!--<add key="WorkPeiceIDPath" value="C:\Users\13650\Desktop\yiqi" />-->
    <add key="HeartBeatAlertInterval" value="2000" />
  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
  </startup>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <!--<add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
    <!--<add name="SCADA_DF22001_CORE" connectionString="Server=10.10.40.166;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
    <add name="SCADA_DF22001_CORE" connectionString="Server=192.168.216.203;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    <add name="SCModel" connectionString="data source=192.168.216.203;initial catalog=SCTest_new;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/App.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <!--net use x: \\192.168.216.133\Destination /savecred /persistent:yes
    net use z: \\192.168.216.130\kistler /savecred /persistent:yes
    net use y: \\192.168.216.6\data /savecred /persistent:yes
    net use u: \\192.168.216.130\NutrunnerData /savecred /persistent:yes-->
    <!-- åˆ¤æ–­å·¥åºæ˜¯å¦è·³åºçš„基准配置 -->
    <add key="WorkingProcedureAllStr" value="OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80" />
    <add key="WorkPeiceIDPath" value="Y:\qualified" />
    <!-- op30工序的工位质量信息 -->
    <add key="OP30QualityDataFor36Station" value="Z:\" />
    <add key="OP30QualityDataFor45Station" value="U:\" />
    <add key="OP60QualityData" value="V:\" />
    <add key="OP20QualityData" value="W:\" />
    <add key="OP80QualityData" value="X:\CA4GC20TD\" />
    <!--<add key="WorkPeiceIDPath" value="C:\Users\13650\Desktop\yiqi" />-->
    <add key="HeartBeatAlertInterval" value="2000" />
  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
  </startup>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <!--<add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
    <!--<add name="SCADA_DF22001_CORE" connectionString="Server=10.10.40.166;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
    <add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    <add name="SCModel" connectionString="data source=.;initial catalog=SCTest_new;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormMain.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,2941 @@

namespace iWare_SCADA_DataCaptureV3
{
    partial class FormMain
    {
        /// <summary>
        /// å¿…需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// æ¸…理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows çª—体设计器生成的代码
        /// <summary>
        /// è®¾è®¡å™¨æ”¯æŒæ‰€éœ€çš„æ–¹æ³• - ä¸è¦ä¿®æ”¹
        /// ä½¿ç”¨ä»£ç ç¼–辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tabPage5 = new System.Windows.Forms.TabPage();
            this.groupBox11 = new System.Windows.Forms.GroupBox();
            this.dataGridView2 = new System.Windows.Forms.DataGridView();
            this.Threadcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Threadcname = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.button23 = new System.Windows.Forms.Button();
            this.button24 = new System.Windows.Forms.Button();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.button27 = new System.Windows.Forms.Button();
            this.textBox12 = new System.Windows.Forms.TextBox();
            this.btnHMIWrite = new System.Windows.Forms.Button();
            this.button17 = new System.Windows.Forms.Button();
            this.button18 = new System.Windows.Forms.Button();
            this.button19 = new System.Windows.Forms.Button();
            this.button20 = new System.Windows.Forms.Button();
            this.button21 = new System.Windows.Forms.Button();
            this.button22 = new System.Windows.Forms.Button();
            this.btnHMI04Reading = new System.Windows.Forms.Button();
            this.button15 = new System.Windows.Forms.Button();
            this.button14 = new System.Windows.Forms.Button();
            this.button13 = new System.Windows.Forms.Button();
            this.button12 = new System.Windows.Forms.Button();
            this.button11 = new System.Windows.Forms.Button();
            this.button10 = new System.Windows.Forms.Button();
            this.button9 = new System.Windows.Forms.Button();
            this.label34 = new System.Windows.Forms.Label();
            this.textBox10 = new System.Windows.Forms.TextBox();
            this.button8 = new System.Windows.Forms.Button();
            this.button25 = new System.Windows.Forms.Button();
            this.button16 = new System.Windows.Forms.Button();
            this.button26 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.groupBox10 = new System.Windows.Forms.GroupBox();
            this.panel4 = new System.Windows.Forms.Panel();
            this.HMIOP60Write = new System.Windows.Forms.CheckBox();
            this.HMIOP50Write = new System.Windows.Forms.CheckBox();
            this.HMIOP3035Write = new System.Windows.Forms.CheckBox();
            this.HMIOP20Write = new System.Windows.Forms.CheckBox();
            this.HMIOP1040Write = new System.Windows.Forms.CheckBox();
            this.lbl_Alert_HMIOP6001 = new System.Windows.Forms.Label();
            this.ckHMIOP60Reading = new System.Windows.Forms.CheckBox();
            this.lbl_Alert_HMIOP5001 = new System.Windows.Forms.Label();
            this.ckHMIOP50Reading = new System.Windows.Forms.CheckBox();
            this.lbl_Alert_HMIOP303501 = new System.Windows.Forms.Label();
            this.ckHMIOP3035Reading = new System.Windows.Forms.CheckBox();
            this.lbl_Alert_HMIOP6002 = new System.Windows.Forms.Label();
            this.lbl_Alert_HMIOP2001 = new System.Windows.Forms.Label();
            this.lbl_Alert_HMIOP5002 = new System.Windows.Forms.Label();
            this.ckHMIOP20Reading = new System.Windows.Forms.CheckBox();
            this.lbl_Alert_HMIOP303502 = new System.Windows.Forms.Label();
            this.lbl_Alert_HMIOP104001 = new System.Windows.Forms.Label();
            this.lbl_Alert_HMIOP2002 = new System.Windows.Forms.Label();
            this.ckHMIOP1040Reading = new System.Windows.Forms.CheckBox();
            this.lbl_Alert_HMIOP104002 = new System.Windows.Forms.Label();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.panel3 = new System.Windows.Forms.Panel();
            this.label35 = new System.Windows.Forms.Label();
            this.checkBox1 = new System.Windows.Forms.CheckBox();
            this.label36 = new System.Windows.Forms.Label();
            this.checkBox2 = new System.Windows.Forms.CheckBox();
            this.checkBox10 = new System.Windows.Forms.CheckBox();
            this.label6 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.checkBox6 = new System.Windows.Forms.CheckBox();
            this.checkBox9 = new System.Windows.Forms.CheckBox();
            this.label7 = new System.Windows.Forms.Label();
            this.checkBox8 = new System.Windows.Forms.CheckBox();
            this.label8 = new System.Windows.Forms.Label();
            this.checkBox7 = new System.Windows.Forms.CheckBox();
            this.label9 = new System.Windows.Forms.Label();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.panel2 = new System.Windows.Forms.Panel();
            this.lbl_Alter_OP2007 = new System.Windows.Forms.Label();
            this.ckBOP2007 = new System.Windows.Forms.CheckBox();
            this.ckBOP2001 = new System.Windows.Forms.CheckBox();
            this.lbl_Alter_OP2006 = new System.Windows.Forms.Label();
            this.lbl_Alter_OP2001 = new System.Windows.Forms.Label();
            this.ckBOP2006 = new System.Windows.Forms.CheckBox();
            this.ckBOP2002 = new System.Windows.Forms.CheckBox();
            this.lbl_Alter_OP2005 = new System.Windows.Forms.Label();
            this.ckBOP2003 = new System.Windows.Forms.CheckBox();
            this.ckBOP2005 = new System.Windows.Forms.CheckBox();
            this.ckBOP2004 = new System.Windows.Forms.CheckBox();
            this.lbl_Alter_OP2004 = new System.Windows.Forms.Label();
            this.lbl_Alter_OP2002 = new System.Windows.Forms.Label();
            this.lbl_Alter_OP2003 = new System.Windows.Forms.Label();
            this.btn_StopAllThread = new System.Windows.Forms.Button();
            this.btn_StartUpAllThread = new System.Windows.Forms.Button();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.panel1 = new System.Windows.Forms.Panel();
            this.ckBOP0501 = new System.Windows.Forms.CheckBox();
            this.lbl_Alter_OP0504 = new System.Windows.Forms.Label();
            this.lbl_Alter_OP0501 = new System.Windows.Forms.Label();
            this.lbl_Alter_OP0503 = new System.Windows.Forms.Label();
            this.ckBOP0502 = new System.Windows.Forms.CheckBox();
            this.lbl_Alter_OP0502 = new System.Windows.Forms.Label();
            this.ckBOP0503 = new System.Windows.Forms.CheckBox();
            this.ckBOP0504 = new System.Windows.Forms.CheckBox();
            this.tabPage3 = new System.Windows.Forms.TabPage();
            this.groupBox7 = new System.Windows.Forms.GroupBox();
            this.txt_ID = new System.Windows.Forms.TextBox();
            this.label19 = new System.Windows.Forms.Label();
            this.cbox_DataCapturePLCType = new System.Windows.Forms.ComboBox();
            this.txt_PLCPort = new System.Windows.Forms.TextBox();
            this.label18 = new System.Windows.Forms.Label();
            this.cbox_DataCaptureColumnType = new System.Windows.Forms.ComboBox();
            this.cbox_DataCaptureType = new System.Windows.Forms.ComboBox();
            this.cbox_WorkingProcedure = new System.Windows.Forms.ComboBox();
            this.txt_DbNumber = new System.Windows.Forms.TextBox();
            this.btn_Cancel = new System.Windows.Forms.Button();
            this.btn_Save = new System.Windows.Forms.Button();
            this.label15 = new System.Windows.Forms.Label();
            this.txt_Offset = new System.Windows.Forms.TextBox();
            this.label14 = new System.Windows.Forms.Label();
            this.label13 = new System.Windows.Forms.Label();
            this.txt_DataCapturePointCode = new System.Windows.Forms.TextBox();
            this.label12 = new System.Windows.Forms.Label();
            this.txt_DataCapturePointCname = new System.Windows.Forms.TextBox();
            this.label11 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.txt_PLCIP = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.txt_EquipmentID = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.groupBox5 = new System.Windows.Forms.GroupBox();
            this.btn_Delete = new System.Windows.Forms.Button();
            this.dgv_DataCaptureConfig = new System.Windows.Forms.DataGridView();
            this.EquipmentID = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.WorkingProcedure = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.DataCapturePointCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.DataCapturePointCname = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.DataCaptureType = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.DataCapturePLCType = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.PLCIP = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.PLCPort = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.DataCaptureColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.DataCaptureColumnType = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.btn_Update = new System.Windows.Forms.Button();
            this.btn_Insert = new System.Windows.Forms.Button();
            this.groupBox4 = new System.Windows.Forms.GroupBox();
            this.cbox_WorkingProcedure_Query = new System.Windows.Forms.ComboBox();
            this.label17 = new System.Windows.Forms.Label();
            this.textBox11 = new System.Windows.Forms.TextBox();
            this.label16 = new System.Windows.Forms.Label();
            this.btn_Query = new System.Windows.Forms.Button();
            this.tabPage4 = new System.Windows.Forms.TabPage();
            this.groupBox9 = new System.Windows.Forms.GroupBox();
            this.comboBox5 = new System.Windows.Forms.ComboBox();
            this.label32 = new System.Windows.Forms.Label();
            this.textBox9 = new System.Windows.Forms.TextBox();
            this.label33 = new System.Windows.Forms.Label();
            this.button7 = new System.Windows.Forms.Button();
            this.groupBox8 = new System.Windows.Forms.GroupBox();
            this.button4 = new System.Windows.Forms.Button();
            this.dataGridView1 = new System.Windows.Forms.DataGridView();
            this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dataGridViewTextBoxColumn10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.button5 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.groupBox6 = new System.Windows.Forms.GroupBox();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.label20 = new System.Windows.Forms.Label();
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.label21 = new System.Windows.Forms.Label();
            this.comboBox2 = new System.Windows.Forms.ComboBox();
            this.comboBox3 = new System.Windows.Forms.ComboBox();
            this.comboBox4 = new System.Windows.Forms.ComboBox();
            this.textBox3 = new System.Windows.Forms.TextBox();
            this.button2 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.label22 = new System.Windows.Forms.Label();
            this.textBox4 = new System.Windows.Forms.TextBox();
            this.label23 = new System.Windows.Forms.Label();
            this.label24 = new System.Windows.Forms.Label();
            this.textBox5 = new System.Windows.Forms.TextBox();
            this.label25 = new System.Windows.Forms.Label();
            this.textBox6 = new System.Windows.Forms.TextBox();
            this.label26 = new System.Windows.Forms.Label();
            this.label27 = new System.Windows.Forms.Label();
            this.label28 = new System.Windows.Forms.Label();
            this.textBox7 = new System.Windows.Forms.TextBox();
            this.label29 = new System.Windows.Forms.Label();
            this.label30 = new System.Windows.Forms.Label();
            this.textBox8 = new System.Windows.Forms.TextBox();
            this.label31 = new System.Windows.Forms.Label();
            this.tabControl1.SuspendLayout();
            this.tabPage5.SuspendLayout();
            this.groupBox11.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
            this.tabPage1.SuspendLayout();
            this.tabPage2.SuspendLayout();
            this.groupBox10.SuspendLayout();
            this.panel4.SuspendLayout();
            this.groupBox3.SuspendLayout();
            this.panel3.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.panel2.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.panel1.SuspendLayout();
            this.tabPage3.SuspendLayout();
            this.groupBox7.SuspendLayout();
            this.groupBox5.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgv_DataCaptureConfig)).BeginInit();
            this.groupBox4.SuspendLayout();
            this.tabPage4.SuspendLayout();
            this.groupBox9.SuspendLayout();
            this.groupBox8.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
            this.groupBox6.SuspendLayout();
            this.SuspendLayout();
            //
            // tabControl1
            //
            this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.tabControl1.Controls.Add(this.tabPage5);
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.Controls.Add(this.tabPage3);
            this.tabControl1.Controls.Add(this.tabPage4);
            this.tabControl1.Location = new System.Drawing.Point(13, 12);
            this.tabControl1.Margin = new System.Windows.Forms.Padding(4);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(1451, 729);
            this.tabControl1.TabIndex = 0;
            //
            // tabPage5
            //
            this.tabPage5.Controls.Add(this.groupBox11);
            this.tabPage5.Controls.Add(this.button23);
            this.tabPage5.Controls.Add(this.button24);
            this.tabPage5.Location = new System.Drawing.Point(4, 25);
            this.tabPage5.Margin = new System.Windows.Forms.Padding(4);
            this.tabPage5.Name = "tabPage5";
            this.tabPage5.Padding = new System.Windows.Forms.Padding(4);
            this.tabPage5.Size = new System.Drawing.Size(1443, 700);
            this.tabPage5.TabIndex = 4;
            this.tabPage5.Text = "线程监控";
            this.tabPage5.UseVisualStyleBackColor = true;
            //
            // groupBox11
            //
            this.groupBox11.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox11.Controls.Add(this.dataGridView2);
            this.groupBox11.Location = new System.Drawing.Point(4, 71);
            this.groupBox11.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox11.Name = "groupBox11";
            this.groupBox11.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox11.Size = new System.Drawing.Size(1428, 598);
            this.groupBox11.TabIndex = 5;
            this.groupBox11.TabStop = false;
            this.groupBox11.Text = "线程信息";
            //
            // dataGridView2
            //
            this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Threadcode,
            this.Threadcname,
            this.Column1,
            this.Column2,
            this.Column3,
            this.Column4,
            this.Column5,
            this.Column6});
            this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.dataGridView2.Location = new System.Drawing.Point(4, 22);
            this.dataGridView2.Margin = new System.Windows.Forms.Padding(4);
            this.dataGridView2.Name = "dataGridView2";
            this.dataGridView2.RowHeadersWidth = 51;
            this.dataGridView2.RowTemplate.Height = 23;
            this.dataGridView2.Size = new System.Drawing.Size(1420, 572);
            this.dataGridView2.TabIndex = 0;
            //
            // Threadcode
            //
            this.Threadcode.DataPropertyName = "Threadcode";
            this.Threadcode.HeaderText = "采集编号";
            this.Threadcode.MinimumWidth = 6;
            this.Threadcode.Name = "Threadcode";
            this.Threadcode.Width = 125;
            //
            // Threadcname
            //
            this.Threadcname.DataPropertyName = "Threadcname";
            this.Threadcname.HeaderText = "采集点描述";
            this.Threadcname.MinimumWidth = 6;
            this.Threadcname.Name = "Threadcname";
            this.Threadcname.Width = 125;
            //
            // Column1
            //
            this.Column1.DataPropertyName = "Threadendtime";
            dataGridViewCellStyle1.Format = "yyyy/MM/dd hh:mm:ss";
            this.Column1.DefaultCellStyle = dataGridViewCellStyle1;
            this.Column1.HeaderText = "最新执行时间";
            this.Column1.MinimumWidth = 6;
            this.Column1.Name = "Column1";
            this.Column1.Width = 125;
            //
            // Column2
            //
            this.Column2.DataPropertyName = "Threadlastmodifytime";
            dataGridViewCellStyle2.Format = "yyyy/MM/dd hh:mm:ss";
            this.Column2.DefaultCellStyle = dataGridViewCellStyle2;
            this.Column2.HeaderText = "最新跑逻辑时间";
            this.Column2.MinimumWidth = 6;
            this.Column2.Name = "Column2";
            this.Column2.Width = 125;
            //
            // Column3
            //
            this.Column3.DataPropertyName = "ThreadId";
            this.Column3.HeaderText = "线程ID";
            this.Column3.MinimumWidth = 6;
            this.Column3.Name = "Column3";
            this.Column3.Width = 125;
            //
            // Column4
            //
            this.Column4.DataPropertyName = "ThreadFrequency";
            this.Column4.HeaderText = "线程频率";
            this.Column4.MinimumWidth = 6;
            this.Column4.Name = "Column4";
            this.Column4.Width = 125;
            //
            // Column5
            //
            this.Column5.DataPropertyName = "Remarks";
            this.Column5.HeaderText = "备注";
            this.Column5.MinimumWidth = 6;
            this.Column5.Name = "Column5";
            this.Column5.Width = 150;
            //
            // Column6
            //
            this.Column6.DataPropertyName = "ErrorMsg";
            this.Column6.HeaderText = "异常信息";
            this.Column6.MinimumWidth = 6;
            this.Column6.Name = "Column6";
            this.Column6.Width = 200;
            //
            // button23
            //
            this.button23.Location = new System.Drawing.Point(380, 22);
            this.button23.Margin = new System.Windows.Forms.Padding(4);
            this.button23.Name = "button23";
            this.button23.Size = new System.Drawing.Size(195, 41);
            this.button23.TabIndex = 4;
            this.button23.Text = "停止所有选中线程";
            this.button23.UseVisualStyleBackColor = true;
            this.button23.Click += new System.EventHandler(this.button23_Click);
            //
            // button24
            //
            this.button24.Location = new System.Drawing.Point(69, 22);
            this.button24.Margin = new System.Windows.Forms.Padding(4);
            this.button24.Name = "button24";
            this.button24.Size = new System.Drawing.Size(195, 41);
            this.button24.TabIndex = 3;
            this.button24.Text = "启动所有选中线程";
            this.button24.UseVisualStyleBackColor = true;
            this.button24.Click += new System.EventHandler(this.button24_Click);
            //
            // tabPage1
            //
            this.tabPage1.Controls.Add(this.button27);
            this.tabPage1.Controls.Add(this.textBox12);
            this.tabPage1.Controls.Add(this.btnHMIWrite);
            this.tabPage1.Controls.Add(this.button17);
            this.tabPage1.Controls.Add(this.button18);
            this.tabPage1.Controls.Add(this.button19);
            this.tabPage1.Controls.Add(this.button20);
            this.tabPage1.Controls.Add(this.button21);
            this.tabPage1.Controls.Add(this.button22);
            this.tabPage1.Controls.Add(this.btnHMI04Reading);
            this.tabPage1.Controls.Add(this.button15);
            this.tabPage1.Controls.Add(this.button14);
            this.tabPage1.Controls.Add(this.button13);
            this.tabPage1.Controls.Add(this.button12);
            this.tabPage1.Controls.Add(this.button11);
            this.tabPage1.Controls.Add(this.button10);
            this.tabPage1.Controls.Add(this.button9);
            this.tabPage1.Controls.Add(this.label34);
            this.tabPage1.Controls.Add(this.textBox10);
            this.tabPage1.Controls.Add(this.button8);
            this.tabPage1.Controls.Add(this.button25);
            this.tabPage1.Controls.Add(this.button16);
            this.tabPage1.Controls.Add(this.button26);
            this.tabPage1.Controls.Add(this.button1);
            this.tabPage1.Location = new System.Drawing.Point(4, 25);
            this.tabPage1.Margin = new System.Windows.Forms.Padding(4);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Padding = new System.Windows.Forms.Padding(4);
            this.tabPage1.Size = new System.Drawing.Size(1443, 700);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "首页";
            this.tabPage1.UseVisualStyleBackColor = true;
            //
            // button27
            //
            this.button27.Location = new System.Drawing.Point(669, 432);
            this.button27.Margin = new System.Windows.Forms.Padding(4);
            this.button27.Name = "button27";
            this.button27.Size = new System.Drawing.Size(100, 29);
            this.button27.TabIndex = 18;
            this.button27.Text = "文件扫描";
            this.button27.UseVisualStyleBackColor = true;
            this.button27.Click += new System.EventHandler(this.button27_Click);
            //
            // textBox12
            //
            this.textBox12.Location = new System.Drawing.Point(643, 55);
            this.textBox12.Margin = new System.Windows.Forms.Padding(4);
            this.textBox12.Name = "textBox12";
            this.textBox12.Size = new System.Drawing.Size(236, 25);
            this.textBox12.TabIndex = 17;
            this.textBox12.Text = "DZ045L2104250100001A1A\n";
            //
            // btnHMIWrite
            //
            this.btnHMIWrite.Location = new System.Drawing.Point(356, 420);
            this.btnHMIWrite.Margin = new System.Windows.Forms.Padding(4);
            this.btnHMIWrite.Name = "btnHMIWrite";
            this.btnHMIWrite.Size = new System.Drawing.Size(139, 29);
            this.btnHMIWrite.TabIndex = 16;
            this.btnHMIWrite.Text = "HMI04写入";
            this.btnHMIWrite.UseVisualStyleBackColor = true;
            this.btnHMIWrite.Click += new System.EventHandler(this.btnHMIWrite_Click);
            //
            // button17
            //
            this.button17.Location = new System.Drawing.Point(403, 340);
            this.button17.Margin = new System.Windows.Forms.Padding(4);
            this.button17.Name = "button17";
            this.button17.Size = new System.Drawing.Size(139, 29);
            this.button17.TabIndex = 16;
            this.button17.Text = "OP8007告警监控";
            this.button17.UseVisualStyleBackColor = true;
            this.button17.Click += new System.EventHandler(this.button17_Click);
            //
            // button18
            //
            this.button18.Location = new System.Drawing.Point(403, 282);
            this.button18.Margin = new System.Windows.Forms.Padding(4);
            this.button18.Name = "button18";
            this.button18.Size = new System.Drawing.Size(139, 29);
            this.button18.TabIndex = 15;
            this.button18.Text = "OP8005工序完成";
            this.button18.UseVisualStyleBackColor = true;
            this.button18.Click += new System.EventHandler(this.button18_Click);
            //
            // button19
            //
            this.button19.Location = new System.Drawing.Point(403, 246);
            this.button19.Margin = new System.Windows.Forms.Padding(4);
            this.button19.Name = "button19";
            this.button19.Size = new System.Drawing.Size(139, 29);
            this.button19.TabIndex = 14;
            this.button19.Text = "OP8004 buyong";
            this.button19.UseVisualStyleBackColor = true;
            this.button19.Click += new System.EventHandler(this.button19_Click);
            //
            // button20
            //
            this.button20.Location = new System.Drawing.Point(403, 210);
            this.button20.Margin = new System.Windows.Forms.Padding(4);
            this.button20.Name = "button20";
            this.button20.Size = new System.Drawing.Size(139, 29);
            this.button20.TabIndex = 13;
            this.button20.Text = "OP3003推出";
            this.button20.UseVisualStyleBackColor = true;
            this.button20.Click += new System.EventHandler(this.button20_Click);
            //
            // button21
            //
            this.button21.Location = new System.Drawing.Point(403, 174);
            this.button21.Margin = new System.Windows.Forms.Padding(4);
            this.button21.Name = "button21";
            this.button21.Size = new System.Drawing.Size(139, 29);
            this.button21.TabIndex = 12;
            this.button21.Text = "OP3002检测完成";
            this.button21.UseVisualStyleBackColor = true;
            this.button21.Click += new System.EventHandler(this.button21_Click);
            //
            // button22
            //
            this.button22.Location = new System.Drawing.Point(403, 138);
            this.button22.Margin = new System.Windows.Forms.Padding(4);
            this.button22.Name = "button22";
            this.button22.Size = new System.Drawing.Size(124, 29);
            this.button22.TabIndex = 11;
            this.button22.Text = "OP8001读码";
            this.button22.UseVisualStyleBackColor = true;
            this.button22.Click += new System.EventHandler(this.button22_Click);
            //
            // btnHMI04Reading
            //
            this.btnHMI04Reading.Location = new System.Drawing.Point(192, 420);
            this.btnHMI04Reading.Margin = new System.Windows.Forms.Padding(4);
            this.btnHMI04Reading.Name = "btnHMI04Reading";
            this.btnHMI04Reading.Size = new System.Drawing.Size(139, 29);
            this.btnHMI04Reading.TabIndex = 10;
            this.btnHMI04Reading.Text = "HMI04读取";
            this.btnHMI04Reading.UseVisualStyleBackColor = true;
            this.btnHMI04Reading.Click += new System.EventHandler(this.btnHMI04Reading_Click);
            //
            // button15
            //
            this.button15.Location = new System.Drawing.Point(192, 340);
            this.button15.Margin = new System.Windows.Forms.Padding(4);
            this.button15.Name = "button15";
            this.button15.Size = new System.Drawing.Size(139, 29);
            this.button15.TabIndex = 10;
            this.button15.Text = "OP3007告警监控";
            this.button15.UseVisualStyleBackColor = true;
            this.button15.Click += new System.EventHandler(this.button15_Click);
            //
            // button14
            //
            this.button14.Location = new System.Drawing.Point(192, 282);
            this.button14.Margin = new System.Windows.Forms.Padding(4);
            this.button14.Name = "button14";
            this.button14.Size = new System.Drawing.Size(139, 29);
            this.button14.TabIndex = 9;
            this.button14.Text = "OP3005工序完成";
            this.button14.UseVisualStyleBackColor = true;
            this.button14.Click += new System.EventHandler(this.button14_Click);
            //
            // button13
            //
            this.button13.Location = new System.Drawing.Point(192, 246);
            this.button13.Margin = new System.Windows.Forms.Padding(4);
            this.button13.Name = "button13";
            this.button13.Size = new System.Drawing.Size(139, 29);
            this.button13.TabIndex = 8;
            this.button13.Text = "OP3004SPC推出";
            this.button13.UseVisualStyleBackColor = true;
            this.button13.Click += new System.EventHandler(this.button13_Click);
            //
            // button12
            //
            this.button12.Location = new System.Drawing.Point(192, 210);
            this.button12.Margin = new System.Windows.Forms.Padding(4);
            this.button12.Name = "button12";
            this.button12.Size = new System.Drawing.Size(139, 29);
            this.button12.TabIndex = 7;
            this.button12.Text = "OP3003推出";
            this.button12.UseVisualStyleBackColor = true;
            this.button12.Click += new System.EventHandler(this.button12_Click);
            //
            // button11
            //
            this.button11.Location = new System.Drawing.Point(192, 174);
            this.button11.Margin = new System.Windows.Forms.Padding(4);
            this.button11.Name = "button11";
            this.button11.Size = new System.Drawing.Size(139, 29);
            this.button11.TabIndex = 6;
            this.button11.Text = "OP3002检测完成";
            this.button11.UseVisualStyleBackColor = true;
            this.button11.Click += new System.EventHandler(this.button11_Click);
            //
            // button10
            //
            this.button10.Location = new System.Drawing.Point(192, 101);
            this.button10.Margin = new System.Windows.Forms.Padding(4);
            this.button10.Name = "button10";
            this.button10.Size = new System.Drawing.Size(124, 29);
            this.button10.TabIndex = 5;
            this.button10.Text = "OP0501 è¯»ç ";
            this.button10.UseVisualStyleBackColor = true;
            this.button10.Click += new System.EventHandler(this.button10_Click);
            //
            // button9
            //
            this.button9.Location = new System.Drawing.Point(192, 138);
            this.button9.Margin = new System.Windows.Forms.Padding(4);
            this.button9.Name = "button9";
            this.button9.Size = new System.Drawing.Size(124, 29);
            this.button9.TabIndex = 4;
            this.button9.Text = "OP3001读码";
            this.button9.UseVisualStyleBackColor = true;
            this.button9.Click += new System.EventHandler(this.button9_Click);
            //
            // label34
            //
            this.label34.AutoSize = true;
            this.label34.Location = new System.Drawing.Point(16, 55);
            this.label34.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label34.Name = "label34";
            this.label34.Size = new System.Drawing.Size(52, 15);
            this.label34.TabIndex = 3;
            this.label34.Text = "工件号";
            //
            // textBox10
            //
            this.textBox10.Location = new System.Drawing.Point(79, 24);
            this.textBox10.Margin = new System.Windows.Forms.Padding(4);
            this.textBox10.Multiline = true;
            this.textBox10.Name = "textBox10";
            this.textBox10.Size = new System.Drawing.Size(473, 53);
            this.textBox10.TabIndex = 2;
            this.textBox10.Text = "DZ045L2104250100001A1A\n";
            //
            // button8
            //
            this.button8.BackColor = System.Drawing.Color.OrangeRed;
            this.button8.Location = new System.Drawing.Point(37, 101);
            this.button8.Margin = new System.Windows.Forms.Padding(4);
            this.button8.Name = "button8";
            this.button8.Size = new System.Drawing.Size(100, 54);
            this.button8.TabIndex = 1;
            this.button8.Text = "启动模拟";
            this.button8.UseVisualStyleBackColor = false;
            this.button8.Click += new System.EventHandler(this.button8_Click);
            //
            // button25
            //
            this.button25.Location = new System.Drawing.Point(669, 329);
            this.button25.Margin = new System.Windows.Forms.Padding(4);
            this.button25.Name = "button25";
            this.button25.Size = new System.Drawing.Size(153, 29);
            this.button25.TabIndex = 0;
            this.button25.Text = "各线程单独测试";
            this.button25.UseVisualStyleBackColor = true;
            this.button25.Click += new System.EventHandler(this.button25_Click);
            //
            // button16
            //
            this.button16.Location = new System.Drawing.Point(669, 246);
            this.button16.Margin = new System.Windows.Forms.Padding(4);
            this.button16.Name = "button16";
            this.button16.Size = new System.Drawing.Size(100, 29);
            this.button16.TabIndex = 0;
            this.button16.Text = "button1";
            this.button16.UseVisualStyleBackColor = true;
            this.button16.Click += new System.EventHandler(this.button16_Click);
            //
            // button26
            //
            this.button26.Location = new System.Drawing.Point(900, 329);
            this.button26.Margin = new System.Windows.Forms.Padding(4);
            this.button26.Name = "button26";
            this.button26.Size = new System.Drawing.Size(100, 29);
            this.button26.TabIndex = 0;
            this.button26.Text = "个别线程调试";
            this.button26.UseVisualStyleBackColor = true;
            this.button26.Click += new System.EventHandler(this.button26_Click);
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(643, 151);
            this.button1.Margin = new System.Windows.Forms.Padding(4);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(100, 29);
            this.button1.TabIndex = 0;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // tabPage2
            //
            this.tabPage2.Controls.Add(this.groupBox10);
            this.tabPage2.Controls.Add(this.groupBox3);
            this.tabPage2.Controls.Add(this.groupBox2);
            this.tabPage2.Controls.Add(this.btn_StopAllThread);
            this.tabPage2.Controls.Add(this.btn_StartUpAllThread);
            this.tabPage2.Controls.Add(this.groupBox1);
            this.tabPage2.Location = new System.Drawing.Point(4, 25);
            this.tabPage2.Margin = new System.Windows.Forms.Padding(4);
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Padding = new System.Windows.Forms.Padding(4);
            this.tabPage2.Size = new System.Drawing.Size(1443, 700);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = " çº¿ç¨‹æŽ§åˆ¶";
            this.tabPage2.UseVisualStyleBackColor = true;
            //
            // groupBox10
            //
            this.groupBox10.Controls.Add(this.panel4);
            this.groupBox10.Location = new System.Drawing.Point(513, 119);
            this.groupBox10.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox10.Name = "groupBox10";
            this.groupBox10.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox10.Size = new System.Drawing.Size(900, 286);
            this.groupBox10.TabIndex = 5;
            this.groupBox10.TabStop = false;
            this.groupBox10.Text = "HMI";
            //
            // panel4
            //
            this.panel4.AutoScroll = true;
            this.panel4.Controls.Add(this.HMIOP60Write);
            this.panel4.Controls.Add(this.HMIOP50Write);
            this.panel4.Controls.Add(this.HMIOP3035Write);
            this.panel4.Controls.Add(this.HMIOP20Write);
            this.panel4.Controls.Add(this.HMIOP1040Write);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP6001);
            this.panel4.Controls.Add(this.ckHMIOP60Reading);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP5001);
            this.panel4.Controls.Add(this.ckHMIOP50Reading);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP303501);
            this.panel4.Controls.Add(this.ckHMIOP3035Reading);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP6002);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP2001);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP5002);
            this.panel4.Controls.Add(this.ckHMIOP20Reading);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP303502);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP104001);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP2002);
            this.panel4.Controls.Add(this.ckHMIOP1040Reading);
            this.panel4.Controls.Add(this.lbl_Alert_HMIOP104002);
            this.panel4.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel4.Location = new System.Drawing.Point(4, 22);
            this.panel4.Margin = new System.Windows.Forms.Padding(0);
            this.panel4.Name = "panel4";
            this.panel4.Size = new System.Drawing.Size(892, 260);
            this.panel4.TabIndex = 21;
            //
            // HMIOP60Write
            //
            this.HMIOP60Write.AutoSize = true;
            this.HMIOP60Write.Checked = true;
            this.HMIOP60Write.CheckState = System.Windows.Forms.CheckState.Checked;
            this.HMIOP60Write.Location = new System.Drawing.Point(16, 239);
            this.HMIOP60Write.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.HMIOP60Write.Name = "HMIOP60Write";
            this.HMIOP60Write.Size = new System.Drawing.Size(145, 19);
            this.HMIOP60Write.TabIndex = 13;
            this.HMIOP60Write.Text = "HMIOP60写入监控";
            this.HMIOP60Write.UseVisualStyleBackColor = true;
            //
            // HMIOP50Write
            //
            this.HMIOP50Write.AutoSize = true;
            this.HMIOP50Write.Checked = true;
            this.HMIOP50Write.CheckState = System.Windows.Forms.CheckState.Checked;
            this.HMIOP50Write.Location = new System.Drawing.Point(16, 212);
            this.HMIOP50Write.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.HMIOP50Write.Name = "HMIOP50Write";
            this.HMIOP50Write.Size = new System.Drawing.Size(145, 19);
            this.HMIOP50Write.TabIndex = 13;
            this.HMIOP50Write.Text = "HMIOP50写入监控";
            this.HMIOP50Write.UseVisualStyleBackColor = true;
            //
            // HMIOP3035Write
            //
            this.HMIOP3035Write.AutoSize = true;
            this.HMIOP3035Write.Checked = true;
            this.HMIOP3035Write.CheckState = System.Windows.Forms.CheckState.Checked;
            this.HMIOP3035Write.Location = new System.Drawing.Point(16, 186);
            this.HMIOP3035Write.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.HMIOP3035Write.Name = "HMIOP3035Write";
            this.HMIOP3035Write.Size = new System.Drawing.Size(161, 19);
            this.HMIOP3035Write.TabIndex = 13;
            this.HMIOP3035Write.Text = "HMIOP3035写入监控";
            this.HMIOP3035Write.UseVisualStyleBackColor = true;
            //
            // HMIOP20Write
            //
            this.HMIOP20Write.AutoSize = true;
            this.HMIOP20Write.Checked = true;
            this.HMIOP20Write.CheckState = System.Windows.Forms.CheckState.Checked;
            this.HMIOP20Write.Location = new System.Drawing.Point(16, 160);
            this.HMIOP20Write.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.HMIOP20Write.Name = "HMIOP20Write";
            this.HMIOP20Write.Size = new System.Drawing.Size(145, 19);
            this.HMIOP20Write.TabIndex = 13;
            this.HMIOP20Write.Text = "HMIOP20写入监控";
            this.HMIOP20Write.UseVisualStyleBackColor = true;
            //
            // HMIOP1040Write
            //
            this.HMIOP1040Write.AutoSize = true;
            this.HMIOP1040Write.Checked = true;
            this.HMIOP1040Write.CheckState = System.Windows.Forms.CheckState.Checked;
            this.HMIOP1040Write.Location = new System.Drawing.Point(16, 134);
            this.HMIOP1040Write.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.HMIOP1040Write.Name = "HMIOP1040Write";
            this.HMIOP1040Write.Size = new System.Drawing.Size(161, 19);
            this.HMIOP1040Write.TabIndex = 13;
            this.HMIOP1040Write.Text = "HMIOP1040写入监控";
            this.HMIOP1040Write.UseVisualStyleBackColor = true;
            //
            // lbl_Alert_HMIOP6001
            //
            this.lbl_Alert_HMIOP6001.AutoSize = true;
            this.lbl_Alert_HMIOP6001.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP6001.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP6001.Location = new System.Drawing.Point(367, 109);
            this.lbl_Alert_HMIOP6001.Name = "lbl_Alert_HMIOP6001";
            this.lbl_Alert_HMIOP6001.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP6001.TabIndex = 14;
            this.lbl_Alert_HMIOP6001.Text = "未连接";
            //
            // ckHMIOP60Reading
            //
            this.ckHMIOP60Reading.AutoSize = true;
            this.ckHMIOP60Reading.Checked = true;
            this.ckHMIOP60Reading.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckHMIOP60Reading.Location = new System.Drawing.Point(16, 108);
            this.ckHMIOP60Reading.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckHMIOP60Reading.Name = "ckHMIOP60Reading";
            this.ckHMIOP60Reading.Size = new System.Drawing.Size(145, 19);
            this.ckHMIOP60Reading.TabIndex = 15;
            this.ckHMIOP60Reading.Text = "HMIOP60读取监控";
            this.ckHMIOP60Reading.UseVisualStyleBackColor = true;
            //
            // lbl_Alert_HMIOP5001
            //
            this.lbl_Alert_HMIOP5001.AutoSize = true;
            this.lbl_Alert_HMIOP5001.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP5001.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP5001.Location = new System.Drawing.Point(367, 84);
            this.lbl_Alert_HMIOP5001.Name = "lbl_Alert_HMIOP5001";
            this.lbl_Alert_HMIOP5001.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP5001.TabIndex = 14;
            this.lbl_Alert_HMIOP5001.Text = "未连接";
            //
            // ckHMIOP50Reading
            //
            this.ckHMIOP50Reading.AutoSize = true;
            this.ckHMIOP50Reading.Checked = true;
            this.ckHMIOP50Reading.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckHMIOP50Reading.Location = new System.Drawing.Point(16, 81);
            this.ckHMIOP50Reading.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckHMIOP50Reading.Name = "ckHMIOP50Reading";
            this.ckHMIOP50Reading.Size = new System.Drawing.Size(145, 19);
            this.ckHMIOP50Reading.TabIndex = 15;
            this.ckHMIOP50Reading.Text = "HMIOP50读取监控";
            this.ckHMIOP50Reading.UseVisualStyleBackColor = true;
            //
            // lbl_Alert_HMIOP303501
            //
            this.lbl_Alert_HMIOP303501.AutoSize = true;
            this.lbl_Alert_HMIOP303501.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP303501.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP303501.Location = new System.Drawing.Point(367, 56);
            this.lbl_Alert_HMIOP303501.Name = "lbl_Alert_HMIOP303501";
            this.lbl_Alert_HMIOP303501.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP303501.TabIndex = 14;
            this.lbl_Alert_HMIOP303501.Text = "未连接";
            //
            // ckHMIOP3035Reading
            //
            this.ckHMIOP3035Reading.AutoSize = true;
            this.ckHMIOP3035Reading.Checked = true;
            this.ckHMIOP3035Reading.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckHMIOP3035Reading.Location = new System.Drawing.Point(16, 55);
            this.ckHMIOP3035Reading.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckHMIOP3035Reading.Name = "ckHMIOP3035Reading";
            this.ckHMIOP3035Reading.Size = new System.Drawing.Size(161, 19);
            this.ckHMIOP3035Reading.TabIndex = 15;
            this.ckHMIOP3035Reading.Text = "HMIOP3035读取监控";
            this.ckHMIOP3035Reading.UseVisualStyleBackColor = true;
            //
            // lbl_Alert_HMIOP6002
            //
            this.lbl_Alert_HMIOP6002.AutoSize = true;
            this.lbl_Alert_HMIOP6002.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP6002.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP6002.Location = new System.Drawing.Point(367, 241);
            this.lbl_Alert_HMIOP6002.Name = "lbl_Alert_HMIOP6002";
            this.lbl_Alert_HMIOP6002.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP6002.TabIndex = 18;
            this.lbl_Alert_HMIOP6002.Text = "未连接";
            //
            // lbl_Alert_HMIOP2001
            //
            this.lbl_Alert_HMIOP2001.AutoSize = true;
            this.lbl_Alert_HMIOP2001.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP2001.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP2001.Location = new System.Drawing.Point(367, 30);
            this.lbl_Alert_HMIOP2001.Name = "lbl_Alert_HMIOP2001";
            this.lbl_Alert_HMIOP2001.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP2001.TabIndex = 14;
            this.lbl_Alert_HMIOP2001.Text = "未连接";
            //
            // lbl_Alert_HMIOP5002
            //
            this.lbl_Alert_HMIOP5002.AutoSize = true;
            this.lbl_Alert_HMIOP5002.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP5002.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP5002.Location = new System.Drawing.Point(367, 215);
            this.lbl_Alert_HMIOP5002.Name = "lbl_Alert_HMIOP5002";
            this.lbl_Alert_HMIOP5002.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP5002.TabIndex = 18;
            this.lbl_Alert_HMIOP5002.Text = "未连接";
            //
            // ckHMIOP20Reading
            //
            this.ckHMIOP20Reading.AutoSize = true;
            this.ckHMIOP20Reading.Checked = true;
            this.ckHMIOP20Reading.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckHMIOP20Reading.Location = new System.Drawing.Point(16, 29);
            this.ckHMIOP20Reading.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckHMIOP20Reading.Name = "ckHMIOP20Reading";
            this.ckHMIOP20Reading.Size = new System.Drawing.Size(145, 19);
            this.ckHMIOP20Reading.TabIndex = 15;
            this.ckHMIOP20Reading.Text = "HMIOP20读取监控";
            this.ckHMIOP20Reading.UseVisualStyleBackColor = true;
            //
            // lbl_Alert_HMIOP303502
            //
            this.lbl_Alert_HMIOP303502.AutoSize = true;
            this.lbl_Alert_HMIOP303502.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP303502.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP303502.Location = new System.Drawing.Point(367, 189);
            this.lbl_Alert_HMIOP303502.Name = "lbl_Alert_HMIOP303502";
            this.lbl_Alert_HMIOP303502.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP303502.TabIndex = 18;
            this.lbl_Alert_HMIOP303502.Text = "未连接";
            //
            // lbl_Alert_HMIOP104001
            //
            this.lbl_Alert_HMIOP104001.AutoSize = true;
            this.lbl_Alert_HMIOP104001.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP104001.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP104001.Location = new System.Drawing.Point(367, 4);
            this.lbl_Alert_HMIOP104001.Name = "lbl_Alert_HMIOP104001";
            this.lbl_Alert_HMIOP104001.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP104001.TabIndex = 14;
            this.lbl_Alert_HMIOP104001.Text = "未连接";
            //
            // lbl_Alert_HMIOP2002
            //
            this.lbl_Alert_HMIOP2002.AutoSize = true;
            this.lbl_Alert_HMIOP2002.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP2002.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP2002.Location = new System.Drawing.Point(367, 162);
            this.lbl_Alert_HMIOP2002.Name = "lbl_Alert_HMIOP2002";
            this.lbl_Alert_HMIOP2002.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP2002.TabIndex = 18;
            this.lbl_Alert_HMIOP2002.Text = "未连接";
            //
            // ckHMIOP1040Reading
            //
            this.ckHMIOP1040Reading.AutoSize = true;
            this.ckHMIOP1040Reading.Checked = true;
            this.ckHMIOP1040Reading.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckHMIOP1040Reading.Location = new System.Drawing.Point(16, 2);
            this.ckHMIOP1040Reading.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckHMIOP1040Reading.Name = "ckHMIOP1040Reading";
            this.ckHMIOP1040Reading.Size = new System.Drawing.Size(161, 19);
            this.ckHMIOP1040Reading.TabIndex = 15;
            this.ckHMIOP1040Reading.Text = "HMIOP1040读取监控";
            this.ckHMIOP1040Reading.UseVisualStyleBackColor = true;
            //
            // lbl_Alert_HMIOP104002
            //
            this.lbl_Alert_HMIOP104002.AutoSize = true;
            this.lbl_Alert_HMIOP104002.BackColor = System.Drawing.Color.White;
            this.lbl_Alert_HMIOP104002.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alert_HMIOP104002.Location = new System.Drawing.Point(367, 136);
            this.lbl_Alert_HMIOP104002.Name = "lbl_Alert_HMIOP104002";
            this.lbl_Alert_HMIOP104002.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alert_HMIOP104002.TabIndex = 18;
            this.lbl_Alert_HMIOP104002.Text = "未连接";
            //
            // groupBox3
            //
            this.groupBox3.Controls.Add(this.panel3);
            this.groupBox3.Location = new System.Drawing.Point(8, 442);
            this.groupBox3.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox3.Size = new System.Drawing.Size(447, 211);
            this.groupBox3.TabIndex = 4;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "OP30";
            //
            // panel3
            //
            this.panel3.AutoScroll = true;
            this.panel3.Controls.Add(this.label35);
            this.panel3.Controls.Add(this.checkBox1);
            this.panel3.Controls.Add(this.label36);
            this.panel3.Controls.Add(this.checkBox2);
            this.panel3.Controls.Add(this.checkBox10);
            this.panel3.Controls.Add(this.label6);
            this.panel3.Controls.Add(this.label10);
            this.panel3.Controls.Add(this.checkBox6);
            this.panel3.Controls.Add(this.checkBox9);
            this.panel3.Controls.Add(this.label7);
            this.panel3.Controls.Add(this.checkBox8);
            this.panel3.Controls.Add(this.label8);
            this.panel3.Controls.Add(this.checkBox7);
            this.panel3.Controls.Add(this.label9);
            this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel3.Location = new System.Drawing.Point(4, 22);
            this.panel3.Margin = new System.Windows.Forms.Padding(4);
            this.panel3.Name = "panel3";
            this.panel3.Size = new System.Drawing.Size(439, 185);
            this.panel3.TabIndex = 23;
            //
            // label35
            //
            this.label35.AutoSize = true;
            this.label35.BackColor = System.Drawing.Color.White;
            this.label35.ForeColor = System.Drawing.Color.Red;
            this.label35.Location = new System.Drawing.Point(224, 158);
            this.label35.Name = "label35";
            this.label35.Size = new System.Drawing.Size(52, 15);
            this.label35.TabIndex = 30;
            this.label35.Text = "未连接";
            //
            // checkBox1
            //
            this.checkBox1.AutoSize = true;
            this.checkBox1.Checked = true;
            this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox1.Location = new System.Drawing.Point(16, 156);
            this.checkBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.checkBox1.Name = "checkBox1";
            this.checkBox1.Size = new System.Drawing.Size(89, 19);
            this.checkBox1.TabIndex = 29;
            this.checkBox1.Text = "心跳监控";
            this.checkBox1.UseVisualStyleBackColor = true;
            //
            // label36
            //
            this.label36.AutoSize = true;
            this.label36.BackColor = System.Drawing.Color.White;
            this.label36.ForeColor = System.Drawing.Color.Red;
            this.label36.Location = new System.Drawing.Point(224, 132);
            this.label36.Name = "label36";
            this.label36.Size = new System.Drawing.Size(52, 15);
            this.label36.TabIndex = 28;
            this.label36.Text = "未连接";
            //
            // checkBox2
            //
            this.checkBox2.AutoSize = true;
            this.checkBox2.Checked = true;
            this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox2.Location = new System.Drawing.Point(16, 131);
            this.checkBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.checkBox2.Name = "checkBox2";
            this.checkBox2.Size = new System.Drawing.Size(119, 19);
            this.checkBox2.TabIndex = 27;
            this.checkBox2.Text = "报警信息监控";
            this.checkBox2.UseVisualStyleBackColor = true;
            //
            // checkBox10
            //
            this.checkBox10.AutoSize = true;
            this.checkBox10.Checked = true;
            this.checkBox10.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox10.Location = new System.Drawing.Point(17, 5);
            this.checkBox10.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.checkBox10.Name = "checkBox10";
            this.checkBox10.Size = new System.Drawing.Size(119, 19);
            this.checkBox10.TabIndex = 13;
            this.checkBox10.Text = "读码完成监控";
            this.checkBox10.UseVisualStyleBackColor = true;
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.BackColor = System.Drawing.Color.White;
            this.label6.ForeColor = System.Drawing.Color.Red;
            this.label6.Location = new System.Drawing.Point(225, 106);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(52, 15);
            this.label6.TabIndex = 22;
            this.label6.Text = "未连接";
            //
            // label10
            //
            this.label10.AutoSize = true;
            this.label10.BackColor = System.Drawing.Color.White;
            this.label10.ForeColor = System.Drawing.Color.Red;
            this.label10.Location = new System.Drawing.Point(225, 5);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(52, 15);
            this.label10.TabIndex = 14;
            this.label10.Text = "未连接";
            //
            // checkBox6
            //
            this.checkBox6.AutoSize = true;
            this.checkBox6.Checked = true;
            this.checkBox6.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox6.Location = new System.Drawing.Point(17, 105);
            this.checkBox6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.checkBox6.Name = "checkBox6";
            this.checkBox6.Size = new System.Drawing.Size(119, 19);
            this.checkBox6.TabIndex = 21;
            this.checkBox6.Text = "工序完成监控";
            this.checkBox6.UseVisualStyleBackColor = true;
            //
            // checkBox9
            //
            this.checkBox9.AutoSize = true;
            this.checkBox9.Checked = true;
            this.checkBox9.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox9.Location = new System.Drawing.Point(17, 30);
            this.checkBox9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.checkBox9.Name = "checkBox9";
            this.checkBox9.Size = new System.Drawing.Size(119, 19);
            this.checkBox9.TabIndex = 15;
            this.checkBox9.Text = "测量完成监控";
            this.checkBox9.UseVisualStyleBackColor = true;
            //
            // label7
            //
            this.label7.AutoSize = true;
            this.label7.BackColor = System.Drawing.Color.White;
            this.label7.ForeColor = System.Drawing.Color.Red;
            this.label7.Location = new System.Drawing.Point(225, 81);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(52, 15);
            this.label7.TabIndex = 20;
            this.label7.Text = "未连接";
            //
            // checkBox8
            //
            this.checkBox8.AutoSize = true;
            this.checkBox8.Checked = true;
            this.checkBox8.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox8.Location = new System.Drawing.Point(17, 55);
            this.checkBox8.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.checkBox8.Name = "checkBox8";
            this.checkBox8.Size = new System.Drawing.Size(119, 19);
            this.checkBox8.TabIndex = 16;
            this.checkBox8.Text = "工件推出监控";
            this.checkBox8.UseVisualStyleBackColor = true;
            //
            // label8
            //
            this.label8.AutoSize = true;
            this.label8.BackColor = System.Drawing.Color.White;
            this.label8.ForeColor = System.Drawing.Color.Red;
            this.label8.Location = new System.Drawing.Point(225, 55);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(52, 15);
            this.label8.TabIndex = 19;
            this.label8.Text = "未连接";
            //
            // checkBox7
            //
            this.checkBox7.AutoSize = true;
            this.checkBox7.Checked = true;
            this.checkBox7.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox7.Location = new System.Drawing.Point(17, 80);
            this.checkBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.checkBox7.Name = "checkBox7";
            this.checkBox7.Size = new System.Drawing.Size(143, 19);
            this.checkBox7.TabIndex = 17;
            this.checkBox7.Text = "工件SPC推出监控";
            this.checkBox7.UseVisualStyleBackColor = true;
            //
            // label9
            //
            this.label9.AutoSize = true;
            this.label9.BackColor = System.Drawing.Color.White;
            this.label9.ForeColor = System.Drawing.Color.Red;
            this.label9.Location = new System.Drawing.Point(225, 31);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(52, 15);
            this.label9.TabIndex = 18;
            this.label9.Text = "未连接";
            //
            // groupBox2
            //
            this.groupBox2.Controls.Add(this.panel2);
            this.groupBox2.Location = new System.Drawing.Point(8, 235);
            this.groupBox2.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox2.Size = new System.Drawing.Size(447, 204);
            this.groupBox2.TabIndex = 3;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "OP20";
            //
            // panel2
            //
            this.panel2.AutoScroll = true;
            this.panel2.Controls.Add(this.lbl_Alter_OP2007);
            this.panel2.Controls.Add(this.ckBOP2007);
            this.panel2.Controls.Add(this.ckBOP2001);
            this.panel2.Controls.Add(this.lbl_Alter_OP2006);
            this.panel2.Controls.Add(this.lbl_Alter_OP2001);
            this.panel2.Controls.Add(this.ckBOP2006);
            this.panel2.Controls.Add(this.ckBOP2002);
            this.panel2.Controls.Add(this.lbl_Alter_OP2005);
            this.panel2.Controls.Add(this.ckBOP2003);
            this.panel2.Controls.Add(this.ckBOP2005);
            this.panel2.Controls.Add(this.ckBOP2004);
            this.panel2.Controls.Add(this.lbl_Alter_OP2004);
            this.panel2.Controls.Add(this.lbl_Alter_OP2002);
            this.panel2.Controls.Add(this.lbl_Alter_OP2003);
            this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel2.Location = new System.Drawing.Point(4, 22);
            this.panel2.Margin = new System.Windows.Forms.Padding(4);
            this.panel2.Name = "panel2";
            this.panel2.Size = new System.Drawing.Size(439, 178);
            this.panel2.TabIndex = 25;
            //
            // lbl_Alter_OP2007
            //
            this.lbl_Alter_OP2007.AutoSize = true;
            this.lbl_Alter_OP2007.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP2007.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP2007.Location = new System.Drawing.Point(227, 154);
            this.lbl_Alter_OP2007.Name = "lbl_Alter_OP2007";
            this.lbl_Alter_OP2007.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP2007.TabIndex = 26;
            this.lbl_Alter_OP2007.Text = "未连接";
            //
            // ckBOP2007
            //
            this.ckBOP2007.AutoSize = true;
            this.ckBOP2007.Checked = true;
            this.ckBOP2007.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP2007.Location = new System.Drawing.Point(19, 152);
            this.ckBOP2007.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP2007.Name = "ckBOP2007";
            this.ckBOP2007.Size = new System.Drawing.Size(89, 19);
            this.ckBOP2007.TabIndex = 25;
            this.ckBOP2007.Text = "心跳监控";
            this.ckBOP2007.UseVisualStyleBackColor = true;
            //
            // ckBOP2001
            //
            this.ckBOP2001.AutoSize = true;
            this.ckBOP2001.Checked = true;
            this.ckBOP2001.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP2001.Location = new System.Drawing.Point(19, 2);
            this.ckBOP2001.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP2001.Name = "ckBOP2001";
            this.ckBOP2001.Size = new System.Drawing.Size(119, 19);
            this.ckBOP2001.TabIndex = 13;
            this.ckBOP2001.Text = "读码完成监控";
            this.ckBOP2001.UseVisualStyleBackColor = true;
            //
            // lbl_Alter_OP2006
            //
            this.lbl_Alter_OP2006.AutoSize = true;
            this.lbl_Alter_OP2006.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP2006.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP2006.Location = new System.Drawing.Point(227, 129);
            this.lbl_Alter_OP2006.Name = "lbl_Alter_OP2006";
            this.lbl_Alter_OP2006.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP2006.TabIndex = 24;
            this.lbl_Alter_OP2006.Text = "未连接";
            //
            // lbl_Alter_OP2001
            //
            this.lbl_Alter_OP2001.AutoSize = true;
            this.lbl_Alter_OP2001.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP2001.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP2001.Location = new System.Drawing.Point(227, 2);
            this.lbl_Alter_OP2001.Name = "lbl_Alter_OP2001";
            this.lbl_Alter_OP2001.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP2001.TabIndex = 14;
            this.lbl_Alter_OP2001.Text = "未连接";
            //
            // ckBOP2006
            //
            this.ckBOP2006.AutoSize = true;
            this.ckBOP2006.Checked = true;
            this.ckBOP2006.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP2006.Location = new System.Drawing.Point(19, 128);
            this.ckBOP2006.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP2006.Name = "ckBOP2006";
            this.ckBOP2006.Size = new System.Drawing.Size(119, 19);
            this.ckBOP2006.TabIndex = 23;
            this.ckBOP2006.Text = "报警信息监控";
            this.ckBOP2006.UseVisualStyleBackColor = true;
            //
            // ckBOP2002
            //
            this.ckBOP2002.AutoSize = true;
            this.ckBOP2002.Checked = true;
            this.ckBOP2002.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP2002.Location = new System.Drawing.Point(19, 28);
            this.ckBOP2002.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP2002.Name = "ckBOP2002";
            this.ckBOP2002.Size = new System.Drawing.Size(119, 19);
            this.ckBOP2002.TabIndex = 15;
            this.ckBOP2002.Text = "测量完成监控";
            this.ckBOP2002.UseVisualStyleBackColor = true;
            //
            // lbl_Alter_OP2005
            //
            this.lbl_Alter_OP2005.AutoSize = true;
            this.lbl_Alter_OP2005.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP2005.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP2005.Location = new System.Drawing.Point(227, 104);
            this.lbl_Alter_OP2005.Name = "lbl_Alter_OP2005";
            this.lbl_Alter_OP2005.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP2005.TabIndex = 22;
            this.lbl_Alter_OP2005.Text = "未连接";
            //
            // ckBOP2003
            //
            this.ckBOP2003.AutoSize = true;
            this.ckBOP2003.Checked = true;
            this.ckBOP2003.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP2003.Location = new System.Drawing.Point(19, 52);
            this.ckBOP2003.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP2003.Name = "ckBOP2003";
            this.ckBOP2003.Size = new System.Drawing.Size(119, 19);
            this.ckBOP2003.TabIndex = 16;
            this.ckBOP2003.Text = "工件推出监控";
            this.ckBOP2003.UseVisualStyleBackColor = true;
            //
            // ckBOP2005
            //
            this.ckBOP2005.AutoSize = true;
            this.ckBOP2005.Checked = true;
            this.ckBOP2005.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP2005.Location = new System.Drawing.Point(19, 102);
            this.ckBOP2005.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP2005.Name = "ckBOP2005";
            this.ckBOP2005.Size = new System.Drawing.Size(119, 19);
            this.ckBOP2005.TabIndex = 21;
            this.ckBOP2005.Text = "工序完成监控";
            this.ckBOP2005.UseVisualStyleBackColor = true;
            //
            // ckBOP2004
            //
            this.ckBOP2004.AutoSize = true;
            this.ckBOP2004.Checked = true;
            this.ckBOP2004.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP2004.Location = new System.Drawing.Point(19, 78);
            this.ckBOP2004.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP2004.Name = "ckBOP2004";
            this.ckBOP2004.Size = new System.Drawing.Size(143, 19);
            this.ckBOP2004.TabIndex = 17;
            this.ckBOP2004.Text = "工件SPC推出监控";
            this.ckBOP2004.UseVisualStyleBackColor = true;
            //
            // lbl_Alter_OP2004
            //
            this.lbl_Alter_OP2004.AutoSize = true;
            this.lbl_Alter_OP2004.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP2004.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP2004.Location = new System.Drawing.Point(227, 79);
            this.lbl_Alter_OP2004.Name = "lbl_Alter_OP2004";
            this.lbl_Alter_OP2004.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP2004.TabIndex = 20;
            this.lbl_Alter_OP2004.Text = "未连接";
            //
            // lbl_Alter_OP2002
            //
            this.lbl_Alter_OP2002.AutoSize = true;
            this.lbl_Alter_OP2002.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP2002.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP2002.Location = new System.Drawing.Point(227, 29);
            this.lbl_Alter_OP2002.Name = "lbl_Alter_OP2002";
            this.lbl_Alter_OP2002.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP2002.TabIndex = 18;
            this.lbl_Alter_OP2002.Text = "未连接";
            //
            // lbl_Alter_OP2003
            //
            this.lbl_Alter_OP2003.AutoSize = true;
            this.lbl_Alter_OP2003.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP2003.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP2003.Location = new System.Drawing.Point(227, 52);
            this.lbl_Alter_OP2003.Name = "lbl_Alter_OP2003";
            this.lbl_Alter_OP2003.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP2003.TabIndex = 19;
            this.lbl_Alter_OP2003.Text = "未连接";
            //
            // btn_StopAllThread
            //
            this.btn_StopAllThread.Location = new System.Drawing.Point(375, 32);
            this.btn_StopAllThread.Margin = new System.Windows.Forms.Padding(4);
            this.btn_StopAllThread.Name = "btn_StopAllThread";
            this.btn_StopAllThread.Size = new System.Drawing.Size(195, 41);
            this.btn_StopAllThread.TabIndex = 2;
            this.btn_StopAllThread.Text = "停止所有选中线程";
            this.btn_StopAllThread.UseVisualStyleBackColor = true;
            //
            // btn_StartUpAllThread
            //
            this.btn_StartUpAllThread.Location = new System.Drawing.Point(64, 32);
            this.btn_StartUpAllThread.Margin = new System.Windows.Forms.Padding(4);
            this.btn_StartUpAllThread.Name = "btn_StartUpAllThread";
            this.btn_StartUpAllThread.Size = new System.Drawing.Size(195, 41);
            this.btn_StartUpAllThread.TabIndex = 1;
            this.btn_StartUpAllThread.Text = "启动所有选中线程";
            this.btn_StartUpAllThread.UseVisualStyleBackColor = true;
            this.btn_StartUpAllThread.Click += new System.EventHandler(this.btn_StartUpAllThread_Click);
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.panel1);
            this.groupBox1.Location = new System.Drawing.Point(8, 110);
            this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox1.Size = new System.Drawing.Size(447, 125);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "OP05";
            //
            // panel1
            //
            this.panel1.AutoScroll = true;
            this.panel1.Controls.Add(this.ckBOP0501);
            this.panel1.Controls.Add(this.lbl_Alter_OP0504);
            this.panel1.Controls.Add(this.lbl_Alter_OP0501);
            this.panel1.Controls.Add(this.lbl_Alter_OP0503);
            this.panel1.Controls.Add(this.ckBOP0502);
            this.panel1.Controls.Add(this.lbl_Alter_OP0502);
            this.panel1.Controls.Add(this.ckBOP0503);
            this.panel1.Controls.Add(this.ckBOP0504);
            this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel1.Location = new System.Drawing.Point(4, 22);
            this.panel1.Margin = new System.Windows.Forms.Padding(0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(439, 99);
            this.panel1.TabIndex = 21;
            //
            // ckBOP0501
            //
            this.ckBOP0501.AutoSize = true;
            this.ckBOP0501.Checked = true;
            this.ckBOP0501.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP0501.Location = new System.Drawing.Point(16, 2);
            this.ckBOP0501.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP0501.Name = "ckBOP0501";
            this.ckBOP0501.Size = new System.Drawing.Size(119, 19);
            this.ckBOP0501.TabIndex = 13;
            this.ckBOP0501.Text = "打码完成监控";
            this.ckBOP0501.UseVisualStyleBackColor = true;
            this.ckBOP0501.CheckedChanged += new System.EventHandler(this.CommonCheckedChanged);
            //
            // lbl_Alter_OP0504
            //
            this.lbl_Alter_OP0504.AutoSize = true;
            this.lbl_Alter_OP0504.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP0504.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP0504.Location = new System.Drawing.Point(224, 79);
            this.lbl_Alter_OP0504.Name = "lbl_Alter_OP0504";
            this.lbl_Alter_OP0504.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP0504.TabIndex = 20;
            this.lbl_Alter_OP0504.Text = "未连接";
            //
            // lbl_Alter_OP0501
            //
            this.lbl_Alter_OP0501.AutoSize = true;
            this.lbl_Alter_OP0501.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP0501.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP0501.Location = new System.Drawing.Point(224, 2);
            this.lbl_Alter_OP0501.Name = "lbl_Alter_OP0501";
            this.lbl_Alter_OP0501.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP0501.TabIndex = 14;
            this.lbl_Alter_OP0501.Text = "未连接";
            //
            // lbl_Alter_OP0503
            //
            this.lbl_Alter_OP0503.AutoSize = true;
            this.lbl_Alter_OP0503.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP0503.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP0503.Location = new System.Drawing.Point(224, 52);
            this.lbl_Alter_OP0503.Name = "lbl_Alter_OP0503";
            this.lbl_Alter_OP0503.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP0503.TabIndex = 19;
            this.lbl_Alter_OP0503.Text = "未连接";
            //
            // ckBOP0502
            //
            this.ckBOP0502.AutoSize = true;
            this.ckBOP0502.Checked = true;
            this.ckBOP0502.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP0502.Location = new System.Drawing.Point(16, 28);
            this.ckBOP0502.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP0502.Name = "ckBOP0502";
            this.ckBOP0502.Size = new System.Drawing.Size(119, 19);
            this.ckBOP0502.TabIndex = 15;
            this.ckBOP0502.Text = "读码完成监控";
            this.ckBOP0502.UseVisualStyleBackColor = true;
            this.ckBOP0502.CheckedChanged += new System.EventHandler(this.CommonCheckedChanged);
            //
            // lbl_Alter_OP0502
            //
            this.lbl_Alter_OP0502.AutoSize = true;
            this.lbl_Alter_OP0502.BackColor = System.Drawing.Color.White;
            this.lbl_Alter_OP0502.ForeColor = System.Drawing.Color.Red;
            this.lbl_Alter_OP0502.Location = new System.Drawing.Point(224, 29);
            this.lbl_Alter_OP0502.Name = "lbl_Alter_OP0502";
            this.lbl_Alter_OP0502.Size = new System.Drawing.Size(52, 15);
            this.lbl_Alter_OP0502.TabIndex = 18;
            this.lbl_Alter_OP0502.Text = "未连接";
            //
            // ckBOP0503
            //
            this.ckBOP0503.AutoSize = true;
            this.ckBOP0503.Checked = true;
            this.ckBOP0503.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP0503.Location = new System.Drawing.Point(16, 52);
            this.ckBOP0503.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP0503.Name = "ckBOP0503";
            this.ckBOP0503.Size = new System.Drawing.Size(119, 19);
            this.ckBOP0503.TabIndex = 16;
            this.ckBOP0503.Text = "工件推出监控";
            this.ckBOP0503.UseVisualStyleBackColor = true;
            this.ckBOP0503.CheckedChanged += new System.EventHandler(this.CommonCheckedChanged);
            //
            // ckBOP0504
            //
            this.ckBOP0504.AutoSize = true;
            this.ckBOP0504.Checked = true;
            this.ckBOP0504.CheckState = System.Windows.Forms.CheckState.Checked;
            this.ckBOP0504.Location = new System.Drawing.Point(16, 78);
            this.ckBOP0504.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.ckBOP0504.Name = "ckBOP0504";
            this.ckBOP0504.Size = new System.Drawing.Size(119, 19);
            this.ckBOP0504.TabIndex = 17;
            this.ckBOP0504.Text = "工序完成监控";
            this.ckBOP0504.UseVisualStyleBackColor = true;
            this.ckBOP0504.CheckedChanged += new System.EventHandler(this.CommonCheckedChanged);
            //
            // tabPage3
            //
            this.tabPage3.Controls.Add(this.groupBox7);
            this.tabPage3.Controls.Add(this.groupBox5);
            this.tabPage3.Controls.Add(this.groupBox4);
            this.tabPage3.Location = new System.Drawing.Point(4, 25);
            this.tabPage3.Margin = new System.Windows.Forms.Padding(4);
            this.tabPage3.Name = "tabPage3";
            this.tabPage3.Padding = new System.Windows.Forms.Padding(4);
            this.tabPage3.Size = new System.Drawing.Size(1443, 700);
            this.tabPage3.TabIndex = 2;
            this.tabPage3.Text = "数据收集点配置";
            this.tabPage3.UseVisualStyleBackColor = true;
            //
            // groupBox7
            //
            this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox7.Controls.Add(this.txt_ID);
            this.groupBox7.Controls.Add(this.label19);
            this.groupBox7.Controls.Add(this.cbox_DataCapturePLCType);
            this.groupBox7.Controls.Add(this.txt_PLCPort);
            this.groupBox7.Controls.Add(this.label18);
            this.groupBox7.Controls.Add(this.cbox_DataCaptureColumnType);
            this.groupBox7.Controls.Add(this.cbox_DataCaptureType);
            this.groupBox7.Controls.Add(this.cbox_WorkingProcedure);
            this.groupBox7.Controls.Add(this.txt_DbNumber);
            this.groupBox7.Controls.Add(this.btn_Cancel);
            this.groupBox7.Controls.Add(this.btn_Save);
            this.groupBox7.Controls.Add(this.label15);
            this.groupBox7.Controls.Add(this.txt_Offset);
            this.groupBox7.Controls.Add(this.label14);
            this.groupBox7.Controls.Add(this.label13);
            this.groupBox7.Controls.Add(this.txt_DataCapturePointCode);
            this.groupBox7.Controls.Add(this.label12);
            this.groupBox7.Controls.Add(this.txt_DataCapturePointCname);
            this.groupBox7.Controls.Add(this.label11);
            this.groupBox7.Controls.Add(this.label5);
            this.groupBox7.Controls.Add(this.label4);
            this.groupBox7.Controls.Add(this.txt_PLCIP);
            this.groupBox7.Controls.Add(this.label3);
            this.groupBox7.Controls.Add(this.label2);
            this.groupBox7.Controls.Add(this.txt_EquipmentID);
            this.groupBox7.Controls.Add(this.label1);
            this.groupBox7.Location = new System.Drawing.Point(4, 515);
            this.groupBox7.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox7.Name = "groupBox7";
            this.groupBox7.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox7.Size = new System.Drawing.Size(1420, 168);
            this.groupBox7.TabIndex = 4;
            this.groupBox7.TabStop = false;
            this.groupBox7.Text = "编辑收集点信息";
            this.groupBox7.Visible = false;
            //
            // txt_ID
            //
            this.txt_ID.Location = new System.Drawing.Point(124, 101);
            this.txt_ID.Margin = new System.Windows.Forms.Padding(4);
            this.txt_ID.Name = "txt_ID";
            this.txt_ID.Size = new System.Drawing.Size(132, 25);
            this.txt_ID.TabIndex = 27;
            this.txt_ID.Visible = false;
            //
            // label19
            //
            this.label19.AutoSize = true;
            this.label19.Location = new System.Drawing.Point(29, 105);
            this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label19.Name = "label19";
            this.label19.Size = new System.Drawing.Size(68, 15);
            this.label19.TabIndex = 26;
            this.label19.Text = "主键ID:";
            this.label19.Visible = false;
            //
            // cbox_DataCapturePLCType
            //
            this.cbox_DataCapturePLCType.FormattingEnabled = true;
            this.cbox_DataCapturePLCType.Location = new System.Drawing.Point(439, 26);
            this.cbox_DataCapturePLCType.Margin = new System.Windows.Forms.Padding(4);
            this.cbox_DataCapturePLCType.Name = "cbox_DataCapturePLCType";
            this.cbox_DataCapturePLCType.Size = new System.Drawing.Size(132, 23);
            this.cbox_DataCapturePLCType.TabIndex = 25;
            //
            // txt_PLCPort
            //
            this.txt_PLCPort.Location = new System.Drawing.Point(439, 94);
            this.txt_PLCPort.Margin = new System.Windows.Forms.Padding(4);
            this.txt_PLCPort.Name = "txt_PLCPort";
            this.txt_PLCPort.Size = new System.Drawing.Size(132, 25);
            this.txt_PLCPort.TabIndex = 24;
            this.txt_PLCPort.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_PLCPort_KeyPress);
            //
            // label18
            //
            this.label18.AutoSize = true;
            this.label18.Location = new System.Drawing.Point(352, 98);
            this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label18.Name = "label18";
            this.label18.Size = new System.Drawing.Size(76, 15);
            this.label18.TabIndex = 23;
            this.label18.Text = "PLC端口:";
            //
            // cbox_DataCaptureColumnType
            //
            this.cbox_DataCaptureColumnType.FormattingEnabled = true;
            this.cbox_DataCaptureColumnType.Items.AddRange(new object[] {
            "Int",
            "DInt",
            "Char",
            "Real",
            "Bool",
            "String"});
            this.cbox_DataCaptureColumnType.Location = new System.Drawing.Point(1029, 98);
            this.cbox_DataCaptureColumnType.Margin = new System.Windows.Forms.Padding(4);
            this.cbox_DataCaptureColumnType.Name = "cbox_DataCaptureColumnType";
            this.cbox_DataCaptureColumnType.Size = new System.Drawing.Size(132, 23);
            this.cbox_DataCaptureColumnType.TabIndex = 22;
            //
            // cbox_DataCaptureType
            //
            this.cbox_DataCaptureType.FormattingEnabled = true;
            this.cbox_DataCaptureType.Location = new System.Drawing.Point(720, 90);
            this.cbox_DataCaptureType.Margin = new System.Windows.Forms.Padding(4);
            this.cbox_DataCaptureType.Name = "cbox_DataCaptureType";
            this.cbox_DataCaptureType.Size = new System.Drawing.Size(132, 23);
            this.cbox_DataCaptureType.TabIndex = 21;
            //
            // cbox_WorkingProcedure
            //
            this.cbox_WorkingProcedure.FormattingEnabled = true;
            this.cbox_WorkingProcedure.Items.AddRange(new object[] {
            "OP05",
            "OP10",
            "OP20",
            "OP30",
            "OP35",
            "OP40",
            "OP50",
            "OP60",
            "OP70",
            "OP80"});
            this.cbox_WorkingProcedure.Location = new System.Drawing.Point(124, 61);
            this.cbox_WorkingProcedure.Margin = new System.Windows.Forms.Padding(4);
            this.cbox_WorkingProcedure.Name = "cbox_WorkingProcedure";
            this.cbox_WorkingProcedure.Size = new System.Drawing.Size(132, 23);
            this.cbox_WorkingProcedure.TabIndex = 20;
            //
            // txt_DbNumber
            //
            this.txt_DbNumber.Location = new System.Drawing.Point(1029, 26);
            this.txt_DbNumber.Margin = new System.Windows.Forms.Padding(4);
            this.txt_DbNumber.Name = "txt_DbNumber";
            this.txt_DbNumber.Size = new System.Drawing.Size(132, 25);
            this.txt_DbNumber.TabIndex = 19;
            //
            // btn_Cancel
            //
            this.btn_Cancel.Location = new System.Drawing.Point(660, 126);
            this.btn_Cancel.Margin = new System.Windows.Forms.Padding(4);
            this.btn_Cancel.Name = "btn_Cancel";
            this.btn_Cancel.Size = new System.Drawing.Size(100, 29);
            this.btn_Cancel.TabIndex = 3;
            this.btn_Cancel.Text = "取消";
            this.btn_Cancel.UseVisualStyleBackColor = true;
            this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click);
            //
            // btn_Save
            //
            this.btn_Save.Location = new System.Drawing.Point(552, 126);
            this.btn_Save.Margin = new System.Windows.Forms.Padding(4);
            this.btn_Save.Name = "btn_Save";
            this.btn_Save.Size = new System.Drawing.Size(100, 29);
            this.btn_Save.TabIndex = 2;
            this.btn_Save.Text = "保存";
            this.btn_Save.UseVisualStyleBackColor = true;
            this.btn_Save.Click += new System.EventHandler(this.btn_Save_Click);
            //
            // label15
            //
            this.label15.AutoSize = true;
            this.label15.Location = new System.Drawing.Point(903, 30);
            this.label15.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(113, 15);
            this.label15.TabIndex = 18;
            this.label15.Text = "节点DB块地址:";
            //
            // txt_Offset
            //
            this.txt_Offset.Location = new System.Drawing.Point(1029, 60);
            this.txt_Offset.Margin = new System.Windows.Forms.Padding(4);
            this.txt_Offset.Name = "txt_Offset";
            this.txt_Offset.Size = new System.Drawing.Size(132, 25);
            this.txt_Offset.TabIndex = 17;
            //
            // label14
            //
            this.label14.AutoSize = true;
            this.label14.Location = new System.Drawing.Point(919, 64);
            this.label14.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(97, 15);
            this.label14.TabIndex = 16;
            this.label14.Text = "节点偏移量:";
            //
            // label13
            //
            this.label13.AutoSize = true;
            this.label13.Location = new System.Drawing.Point(903, 101);
            this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(112, 15);
            this.label13.TabIndex = 14;
            this.label13.Text = "节点数据类型:";
            //
            // txt_DataCapturePointCode
            //
            this.txt_DataCapturePointCode.Location = new System.Drawing.Point(720, 26);
            this.txt_DataCapturePointCode.Margin = new System.Windows.Forms.Padding(4);
            this.txt_DataCapturePointCode.Name = "txt_DataCapturePointCode";
            this.txt_DataCapturePointCode.Size = new System.Drawing.Size(132, 25);
            this.txt_DataCapturePointCode.TabIndex = 13;
            //
            // label12
            //
            this.label12.AutoSize = true;
            this.label12.Location = new System.Drawing.Point(609, 30);
            this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(97, 15);
            this.label12.TabIndex = 12;
            this.label12.Text = "收集点代码:";
            //
            // txt_DataCapturePointCname
            //
            this.txt_DataCapturePointCname.Location = new System.Drawing.Point(720, 60);
            this.txt_DataCapturePointCname.Margin = new System.Windows.Forms.Padding(4);
            this.txt_DataCapturePointCname.Name = "txt_DataCapturePointCname";
            this.txt_DataCapturePointCname.Size = new System.Drawing.Size(132, 25);
            this.txt_DataCapturePointCname.TabIndex = 11;
            //
            // label11
            //
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(609, 64);
            this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(97, 15);
            this.label11.TabIndex = 10;
            this.label11.Text = "收集点描述:";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(625, 98);
            this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(82, 15);
            this.label5.TabIndex = 8;
            this.label5.Text = "收集方式:";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(352, 30);
            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(76, 15);
            this.label4.TabIndex = 6;
            this.label4.Text = "PLC型号:";
            //
            // txt_PLCIP
            //
            this.txt_PLCIP.Location = new System.Drawing.Point(439, 60);
            this.txt_PLCIP.Margin = new System.Windows.Forms.Padding(4);
            this.txt_PLCIP.Name = "txt_PLCIP";
            this.txt_PLCIP.Size = new System.Drawing.Size(132, 25);
            this.txt_PLCIP.TabIndex = 5;
            this.txt_PLCIP.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_PLCIP_KeyPress);
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(328, 64);
            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(100, 15);
            this.label3.TabIndex = 4;
            this.label3.Text = "PLC IP地址:";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(45, 64);
            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(67, 15);
            this.label2.TabIndex = 2;
            this.label2.Text = "工序号:";
            //
            // txt_EquipmentID
            //
            this.txt_EquipmentID.Location = new System.Drawing.Point(124, 26);
            this.txt_EquipmentID.Margin = new System.Windows.Forms.Padding(4);
            this.txt_EquipmentID.Name = "txt_EquipmentID";
            this.txt_EquipmentID.Size = new System.Drawing.Size(132, 25);
            this.txt_EquipmentID.TabIndex = 1;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(29, 30);
            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(82, 15);
            this.label1.TabIndex = 0;
            this.label1.Text = "设备编号:";
            //
            // groupBox5
            //
            this.groupBox5.Controls.Add(this.btn_Delete);
            this.groupBox5.Controls.Add(this.dgv_DataCaptureConfig);
            this.groupBox5.Controls.Add(this.btn_Update);
            this.groupBox5.Controls.Add(this.btn_Insert);
            this.groupBox5.Location = new System.Drawing.Point(4, 89);
            this.groupBox5.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox5.Name = "groupBox5";
            this.groupBox5.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox5.Size = new System.Drawing.Size(1428, 419);
            this.groupBox5.TabIndex = 1;
            this.groupBox5.TabStop = false;
            this.groupBox5.Text = "收集点信息";
            //
            // btn_Delete
            //
            this.btn_Delete.Location = new System.Drawing.Point(720, 382);
            this.btn_Delete.Margin = new System.Windows.Forms.Padding(4);
            this.btn_Delete.Name = "btn_Delete";
            this.btn_Delete.Size = new System.Drawing.Size(100, 29);
            this.btn_Delete.TabIndex = 7;
            this.btn_Delete.Text = "删除";
            this.btn_Delete.UseVisualStyleBackColor = true;
            this.btn_Delete.Click += new System.EventHandler(this.btn_Delete_Click);
            //
            // dgv_DataCaptureConfig
            //
            this.dgv_DataCaptureConfig.AllowUserToAddRows = false;
            this.dgv_DataCaptureConfig.AllowUserToDeleteRows = false;
            this.dgv_DataCaptureConfig.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgv_DataCaptureConfig.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.EquipmentID,
            this.WorkingProcedure,
            this.DataCapturePointCode,
            this.DataCapturePointCname,
            this.DataCaptureType,
            this.DataCapturePLCType,
            this.PLCIP,
            this.PLCPort,
            this.DataCaptureColumn,
            this.DataCaptureColumnType});
            this.dgv_DataCaptureConfig.Location = new System.Drawing.Point(4, 21);
            this.dgv_DataCaptureConfig.Margin = new System.Windows.Forms.Padding(4);
            this.dgv_DataCaptureConfig.MultiSelect = false;
            this.dgv_DataCaptureConfig.Name = "dgv_DataCaptureConfig";
            this.dgv_DataCaptureConfig.ReadOnly = true;
            this.dgv_DataCaptureConfig.RowHeadersWidth = 51;
            this.dgv_DataCaptureConfig.RowTemplate.Height = 23;
            this.dgv_DataCaptureConfig.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dgv_DataCaptureConfig.Size = new System.Drawing.Size(1420, 354);
            this.dgv_DataCaptureConfig.TabIndex = 3;
            //
            // EquipmentID
            //
            this.EquipmentID.DataPropertyName = "EquipmentID";
            this.EquipmentID.HeaderText = "设备编号";
            this.EquipmentID.MinimumWidth = 6;
            this.EquipmentID.Name = "EquipmentID";
            this.EquipmentID.ReadOnly = true;
            this.EquipmentID.Width = 125;
            //
            // WorkingProcedure
            //
            this.WorkingProcedure.DataPropertyName = "WorkingProcedure";
            this.WorkingProcedure.HeaderText = "工序号";
            this.WorkingProcedure.MinimumWidth = 6;
            this.WorkingProcedure.Name = "WorkingProcedure";
            this.WorkingProcedure.ReadOnly = true;
            this.WorkingProcedure.Width = 125;
            //
            // DataCapturePointCode
            //
            this.DataCapturePointCode.DataPropertyName = "DataCapturePointCode";
            this.DataCapturePointCode.HeaderText = "数据收集点代码";
            this.DataCapturePointCode.MinimumWidth = 6;
            this.DataCapturePointCode.Name = "DataCapturePointCode";
            this.DataCapturePointCode.ReadOnly = true;
            this.DataCapturePointCode.Width = 125;
            //
            // DataCapturePointCname
            //
            this.DataCapturePointCname.DataPropertyName = "DataCapturePointCname";
            this.DataCapturePointCname.HeaderText = "收集收集点描述";
            this.DataCapturePointCname.MinimumWidth = 6;
            this.DataCapturePointCname.Name = "DataCapturePointCname";
            this.DataCapturePointCname.ReadOnly = true;
            this.DataCapturePointCname.Width = 125;
            //
            // DataCaptureType
            //
            this.DataCaptureType.DataPropertyName = "DataCaptureType";
            this.DataCaptureType.HeaderText = "收集方式";
            this.DataCaptureType.MinimumWidth = 6;
            this.DataCaptureType.Name = "DataCaptureType";
            this.DataCaptureType.ReadOnly = true;
            this.DataCaptureType.Width = 125;
            //
            // DataCapturePLCType
            //
            this.DataCapturePLCType.DataPropertyName = "DataCapturePLCType";
            this.DataCapturePLCType.HeaderText = "收集PLC型号";
            this.DataCapturePLCType.MinimumWidth = 6;
            this.DataCapturePLCType.Name = "DataCapturePLCType";
            this.DataCapturePLCType.ReadOnly = true;
            this.DataCapturePLCType.Width = 125;
            //
            // PLCIP
            //
            this.PLCIP.DataPropertyName = "PLCIP";
            this.PLCIP.HeaderText = "PLC的IP地址";
            this.PLCIP.MinimumWidth = 6;
            this.PLCIP.Name = "PLCIP";
            this.PLCIP.ReadOnly = true;
            this.PLCIP.Width = 125;
            //
            // PLCPort
            //
            this.PLCPort.DataPropertyName = "PLCPort";
            this.PLCPort.HeaderText = "PLC端口";
            this.PLCPort.MinimumWidth = 6;
            this.PLCPort.Name = "PLCPort";
            this.PLCPort.ReadOnly = true;
            this.PLCPort.Width = 125;
            //
            // DataCaptureColumn
            //
            this.DataCaptureColumn.DataPropertyName = "DataCaptureColumn";
            this.DataCaptureColumn.HeaderText = "收集字段名";
            this.DataCaptureColumn.MinimumWidth = 6;
            this.DataCaptureColumn.Name = "DataCaptureColumn";
            this.DataCaptureColumn.ReadOnly = true;
            this.DataCaptureColumn.Width = 125;
            //
            // DataCaptureColumnType
            //
            this.DataCaptureColumnType.DataPropertyName = "DataCaptureColumnType";
            this.DataCaptureColumnType.HeaderText = "收集字段类型";
            this.DataCaptureColumnType.MinimumWidth = 6;
            this.DataCaptureColumnType.Name = "DataCaptureColumnType";
            this.DataCaptureColumnType.ReadOnly = true;
            this.DataCaptureColumnType.Width = 125;
            //
            // btn_Update
            //
            this.btn_Update.Location = new System.Drawing.Point(569, 382);
            this.btn_Update.Margin = new System.Windows.Forms.Padding(4);
            this.btn_Update.Name = "btn_Update";
            this.btn_Update.Size = new System.Drawing.Size(100, 29);
            this.btn_Update.TabIndex = 6;
            this.btn_Update.Text = "修改";
            this.btn_Update.UseVisualStyleBackColor = true;
            this.btn_Update.Click += new System.EventHandler(this.btn_Update_Click);
            //
            // btn_Insert
            //
            this.btn_Insert.Location = new System.Drawing.Point(423, 382);
            this.btn_Insert.Margin = new System.Windows.Forms.Padding(4);
            this.btn_Insert.Name = "btn_Insert";
            this.btn_Insert.Size = new System.Drawing.Size(100, 29);
            this.btn_Insert.TabIndex = 5;
            this.btn_Insert.Text = "新增";
            this.btn_Insert.UseVisualStyleBackColor = true;
            this.btn_Insert.Click += new System.EventHandler(this.btn_Insert_Click);
            //
            // groupBox4
            //
            this.groupBox4.Controls.Add(this.cbox_WorkingProcedure_Query);
            this.groupBox4.Controls.Add(this.label17);
            this.groupBox4.Controls.Add(this.textBox11);
            this.groupBox4.Controls.Add(this.label16);
            this.groupBox4.Controls.Add(this.btn_Query);
            this.groupBox4.Location = new System.Drawing.Point(4, 9);
            this.groupBox4.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox4.Name = "groupBox4";
            this.groupBox4.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox4.Size = new System.Drawing.Size(1427, 72);
            this.groupBox4.TabIndex = 0;
            this.groupBox4.TabStop = false;
            this.groupBox4.Text = "查询条件";
            //
            // cbox_WorkingProcedure_Query
            //
            this.cbox_WorkingProcedure_Query.FormattingEnabled = true;
            this.cbox_WorkingProcedure_Query.Items.AddRange(new object[] {
            "OP05",
            "OP10",
            "OP20",
            "OP30",
            "OP35",
            "OP40",
            "OP50",
            "OP60",
            "OP70",
            "OP80"});
            this.cbox_WorkingProcedure_Query.Location = new System.Drawing.Point(396, 31);
            this.cbox_WorkingProcedure_Query.Margin = new System.Windows.Forms.Padding(4);
            this.cbox_WorkingProcedure_Query.Name = "cbox_WorkingProcedure_Query";
            this.cbox_WorkingProcedure_Query.Size = new System.Drawing.Size(132, 23);
            this.cbox_WorkingProcedure_Query.TabIndex = 22;
            //
            // label17
            //
            this.label17.AutoSize = true;
            this.label17.Location = new System.Drawing.Point(317, 34);
            this.label17.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label17.Name = "label17";
            this.label17.Size = new System.Drawing.Size(67, 15);
            this.label17.TabIndex = 21;
            this.label17.Text = "工序号:";
            //
            // textBox11
            //
            this.textBox11.Location = new System.Drawing.Point(143, 28);
            this.textBox11.Margin = new System.Windows.Forms.Padding(4);
            this.textBox11.Name = "textBox11";
            this.textBox11.Size = new System.Drawing.Size(132, 25);
            this.textBox11.TabIndex = 15;
            //
            // label16
            //
            this.label16.AutoSize = true;
            this.label16.Location = new System.Drawing.Point(32, 31);
            this.label16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(97, 15);
            this.label16.TabIndex = 14;
            this.label16.Text = "收集点代码:";
            //
            // btn_Query
            //
            this.btn_Query.Location = new System.Drawing.Point(1207, 25);
            this.btn_Query.Margin = new System.Windows.Forms.Padding(4);
            this.btn_Query.Name = "btn_Query";
            this.btn_Query.Size = new System.Drawing.Size(100, 29);
            this.btn_Query.TabIndex = 1;
            this.btn_Query.Text = "查询";
            this.btn_Query.UseVisualStyleBackColor = true;
            this.btn_Query.Click += new System.EventHandler(this.button5_Click);
            //
            // tabPage4
            //
            this.tabPage4.Controls.Add(this.groupBox9);
            this.tabPage4.Controls.Add(this.groupBox8);
            this.tabPage4.Controls.Add(this.groupBox6);
            this.tabPage4.Location = new System.Drawing.Point(4, 25);
            this.tabPage4.Margin = new System.Windows.Forms.Padding(4);
            this.tabPage4.Name = "tabPage4";
            this.tabPage4.Padding = new System.Windows.Forms.Padding(4);
            this.tabPage4.Size = new System.Drawing.Size(1443, 700);
            this.tabPage4.TabIndex = 3;
            this.tabPage4.Text = "数据收集字段配置";
            this.tabPage4.UseVisualStyleBackColor = true;
            //
            // groupBox9
            //
            this.groupBox9.Controls.Add(this.comboBox5);
            this.groupBox9.Controls.Add(this.label32);
            this.groupBox9.Controls.Add(this.textBox9);
            this.groupBox9.Controls.Add(this.label33);
            this.groupBox9.Controls.Add(this.button7);
            this.groupBox9.Location = new System.Drawing.Point(9, 9);
            this.groupBox9.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox9.Name = "groupBox9";
            this.groupBox9.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox9.Size = new System.Drawing.Size(1427, 72);
            this.groupBox9.TabIndex = 7;
            this.groupBox9.TabStop = false;
            this.groupBox9.Text = "查询条件";
            //
            // comboBox5
            //
            this.comboBox5.FormattingEnabled = true;
            this.comboBox5.Items.AddRange(new object[] {
            "OP05",
            "OP10",
            "OP20",
            "OP30",
            "OP35",
            "OP40",
            "OP50",
            "OP60",
            "OP70",
            "OP80"});
            this.comboBox5.Location = new System.Drawing.Point(396, 31);
            this.comboBox5.Margin = new System.Windows.Forms.Padding(4);
            this.comboBox5.Name = "comboBox5";
            this.comboBox5.Size = new System.Drawing.Size(132, 23);
            this.comboBox5.TabIndex = 22;
            //
            // label32
            //
            this.label32.AutoSize = true;
            this.label32.Location = new System.Drawing.Point(317, 34);
            this.label32.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label32.Name = "label32";
            this.label32.Size = new System.Drawing.Size(67, 15);
            this.label32.TabIndex = 21;
            this.label32.Text = "工序号:";
            //
            // textBox9
            //
            this.textBox9.Location = new System.Drawing.Point(143, 28);
            this.textBox9.Margin = new System.Windows.Forms.Padding(4);
            this.textBox9.Name = "textBox9";
            this.textBox9.Size = new System.Drawing.Size(132, 25);
            this.textBox9.TabIndex = 15;
            //
            // label33
            //
            this.label33.AutoSize = true;
            this.label33.Location = new System.Drawing.Point(32, 31);
            this.label33.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label33.Name = "label33";
            this.label33.Size = new System.Drawing.Size(97, 15);
            this.label33.TabIndex = 14;
            this.label33.Text = "收集点代码:";
            //
            // button7
            //
            this.button7.Location = new System.Drawing.Point(1207, 25);
            this.button7.Margin = new System.Windows.Forms.Padding(4);
            this.button7.Name = "button7";
            this.button7.Size = new System.Drawing.Size(100, 29);
            this.button7.TabIndex = 1;
            this.button7.Text = "查询";
            this.button7.UseVisualStyleBackColor = true;
            //
            // groupBox8
            //
            this.groupBox8.Controls.Add(this.button4);
            this.groupBox8.Controls.Add(this.dataGridView1);
            this.groupBox8.Controls.Add(this.button5);
            this.groupBox8.Controls.Add(this.button6);
            this.groupBox8.Location = new System.Drawing.Point(8, 89);
            this.groupBox8.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox8.Name = "groupBox8";
            this.groupBox8.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox8.Size = new System.Drawing.Size(1428, 419);
            this.groupBox8.TabIndex = 6;
            this.groupBox8.TabStop = false;
            this.groupBox8.Text = "收集点信息";
            //
            // button4
            //
            this.button4.Location = new System.Drawing.Point(720, 382);
            this.button4.Margin = new System.Windows.Forms.Padding(4);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(100, 29);
            this.button4.TabIndex = 7;
            this.button4.Text = "删除";
            this.button4.UseVisualStyleBackColor = true;
            //
            // dataGridView1
            //
            this.dataGridView1.AllowUserToAddRows = false;
            this.dataGridView1.AllowUserToDeleteRows = false;
            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.dataGridViewTextBoxColumn1,
            this.dataGridViewTextBoxColumn2,
            this.dataGridViewTextBoxColumn3,
            this.dataGridViewTextBoxColumn4,
            this.dataGridViewTextBoxColumn5,
            this.dataGridViewTextBoxColumn6,
            this.dataGridViewTextBoxColumn7,
            this.dataGridViewTextBoxColumn8,
            this.dataGridViewTextBoxColumn9,
            this.dataGridViewTextBoxColumn10});
            this.dataGridView1.Location = new System.Drawing.Point(4, 21);
            this.dataGridView1.Margin = new System.Windows.Forms.Padding(4);
            this.dataGridView1.MultiSelect = false;
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.ReadOnly = true;
            this.dataGridView1.RowHeadersWidth = 51;
            this.dataGridView1.RowTemplate.Height = 23;
            this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.dataGridView1.Size = new System.Drawing.Size(1420, 354);
            this.dataGridView1.TabIndex = 3;
            //
            // dataGridViewTextBoxColumn1
            //
            this.dataGridViewTextBoxColumn1.DataPropertyName = "EquipmentID";
            this.dataGridViewTextBoxColumn1.HeaderText = "设备编号";
            this.dataGridViewTextBoxColumn1.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
            this.dataGridViewTextBoxColumn1.ReadOnly = true;
            this.dataGridViewTextBoxColumn1.Width = 125;
            //
            // dataGridViewTextBoxColumn2
            //
            this.dataGridViewTextBoxColumn2.DataPropertyName = "WorkingProcedure";
            this.dataGridViewTextBoxColumn2.HeaderText = "工序号";
            this.dataGridViewTextBoxColumn2.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
            this.dataGridViewTextBoxColumn2.ReadOnly = true;
            this.dataGridViewTextBoxColumn2.Width = 125;
            //
            // dataGridViewTextBoxColumn3
            //
            this.dataGridViewTextBoxColumn3.DataPropertyName = "DataCapturePointCode";
            this.dataGridViewTextBoxColumn3.HeaderText = "数据收集点代码";
            this.dataGridViewTextBoxColumn3.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
            this.dataGridViewTextBoxColumn3.ReadOnly = true;
            this.dataGridViewTextBoxColumn3.Width = 125;
            //
            // dataGridViewTextBoxColumn4
            //
            this.dataGridViewTextBoxColumn4.DataPropertyName = "DataCapturePointCname";
            this.dataGridViewTextBoxColumn4.HeaderText = "收集收集点描述";
            this.dataGridViewTextBoxColumn4.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
            this.dataGridViewTextBoxColumn4.ReadOnly = true;
            this.dataGridViewTextBoxColumn4.Width = 125;
            //
            // dataGridViewTextBoxColumn5
            //
            this.dataGridViewTextBoxColumn5.DataPropertyName = "DataCaptureType";
            this.dataGridViewTextBoxColumn5.HeaderText = "收集方式";
            this.dataGridViewTextBoxColumn5.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
            this.dataGridViewTextBoxColumn5.ReadOnly = true;
            this.dataGridViewTextBoxColumn5.Width = 125;
            //
            // dataGridViewTextBoxColumn6
            //
            this.dataGridViewTextBoxColumn6.DataPropertyName = "DataCapturePLCType";
            this.dataGridViewTextBoxColumn6.HeaderText = "收集PLC型号";
            this.dataGridViewTextBoxColumn6.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
            this.dataGridViewTextBoxColumn6.ReadOnly = true;
            this.dataGridViewTextBoxColumn6.Width = 125;
            //
            // dataGridViewTextBoxColumn7
            //
            this.dataGridViewTextBoxColumn7.DataPropertyName = "PLCIP";
            this.dataGridViewTextBoxColumn7.HeaderText = "PLC的IP地址";
            this.dataGridViewTextBoxColumn7.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
            this.dataGridViewTextBoxColumn7.ReadOnly = true;
            this.dataGridViewTextBoxColumn7.Width = 125;
            //
            // dataGridViewTextBoxColumn8
            //
            this.dataGridViewTextBoxColumn8.DataPropertyName = "PLCPort";
            this.dataGridViewTextBoxColumn8.HeaderText = "PLC端口";
            this.dataGridViewTextBoxColumn8.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
            this.dataGridViewTextBoxColumn8.ReadOnly = true;
            this.dataGridViewTextBoxColumn8.Width = 125;
            //
            // dataGridViewTextBoxColumn9
            //
            this.dataGridViewTextBoxColumn9.DataPropertyName = "DataCaptureColumn";
            this.dataGridViewTextBoxColumn9.HeaderText = "收集字段名";
            this.dataGridViewTextBoxColumn9.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
            this.dataGridViewTextBoxColumn9.ReadOnly = true;
            this.dataGridViewTextBoxColumn9.Width = 125;
            //
            // dataGridViewTextBoxColumn10
            //
            this.dataGridViewTextBoxColumn10.DataPropertyName = "DataCaptureColumnType";
            this.dataGridViewTextBoxColumn10.HeaderText = "收集字段类型";
            this.dataGridViewTextBoxColumn10.MinimumWidth = 6;
            this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
            this.dataGridViewTextBoxColumn10.ReadOnly = true;
            this.dataGridViewTextBoxColumn10.Width = 125;
            //
            // button5
            //
            this.button5.Location = new System.Drawing.Point(569, 382);
            this.button5.Margin = new System.Windows.Forms.Padding(4);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(100, 29);
            this.button5.TabIndex = 6;
            this.button5.Text = "修改";
            this.button5.UseVisualStyleBackColor = true;
            //
            // button6
            //
            this.button6.Location = new System.Drawing.Point(423, 382);
            this.button6.Margin = new System.Windows.Forms.Padding(4);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(100, 29);
            this.button6.TabIndex = 5;
            this.button6.Text = "新增";
            this.button6.UseVisualStyleBackColor = true;
            //
            // groupBox6
            //
            this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox6.Controls.Add(this.textBox1);
            this.groupBox6.Controls.Add(this.label20);
            this.groupBox6.Controls.Add(this.comboBox1);
            this.groupBox6.Controls.Add(this.textBox2);
            this.groupBox6.Controls.Add(this.label21);
            this.groupBox6.Controls.Add(this.comboBox2);
            this.groupBox6.Controls.Add(this.comboBox3);
            this.groupBox6.Controls.Add(this.comboBox4);
            this.groupBox6.Controls.Add(this.textBox3);
            this.groupBox6.Controls.Add(this.button2);
            this.groupBox6.Controls.Add(this.button3);
            this.groupBox6.Controls.Add(this.label22);
            this.groupBox6.Controls.Add(this.textBox4);
            this.groupBox6.Controls.Add(this.label23);
            this.groupBox6.Controls.Add(this.label24);
            this.groupBox6.Controls.Add(this.textBox5);
            this.groupBox6.Controls.Add(this.label25);
            this.groupBox6.Controls.Add(this.textBox6);
            this.groupBox6.Controls.Add(this.label26);
            this.groupBox6.Controls.Add(this.label27);
            this.groupBox6.Controls.Add(this.label28);
            this.groupBox6.Controls.Add(this.textBox7);
            this.groupBox6.Controls.Add(this.label29);
            this.groupBox6.Controls.Add(this.label30);
            this.groupBox6.Controls.Add(this.textBox8);
            this.groupBox6.Controls.Add(this.label31);
            this.groupBox6.Location = new System.Drawing.Point(8, 515);
            this.groupBox6.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox6.Name = "groupBox6";
            this.groupBox6.Padding = new System.Windows.Forms.Padding(4);
            this.groupBox6.Size = new System.Drawing.Size(1420, 168);
            this.groupBox6.TabIndex = 5;
            this.groupBox6.TabStop = false;
            this.groupBox6.Text = "编辑收集点信息";
            this.groupBox6.Visible = false;
            //
            // textBox1
            //
            this.textBox1.Location = new System.Drawing.Point(124, 101);
            this.textBox1.Margin = new System.Windows.Forms.Padding(4);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(132, 25);
            this.textBox1.TabIndex = 27;
            this.textBox1.Visible = false;
            //
            // label20
            //
            this.label20.AutoSize = true;
            this.label20.Location = new System.Drawing.Point(29, 105);
            this.label20.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label20.Name = "label20";
            this.label20.Size = new System.Drawing.Size(68, 15);
            this.label20.TabIndex = 26;
            this.label20.Text = "主键ID:";
            this.label20.Visible = false;
            //
            // comboBox1
            //
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Location = new System.Drawing.Point(439, 26);
            this.comboBox1.Margin = new System.Windows.Forms.Padding(4);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new System.Drawing.Size(132, 23);
            this.comboBox1.TabIndex = 25;
            //
            // textBox2
            //
            this.textBox2.Location = new System.Drawing.Point(439, 94);
            this.textBox2.Margin = new System.Windows.Forms.Padding(4);
            this.textBox2.Name = "textBox2";
            this.textBox2.Size = new System.Drawing.Size(132, 25);
            this.textBox2.TabIndex = 24;
            //
            // label21
            //
            this.label21.AutoSize = true;
            this.label21.Location = new System.Drawing.Point(352, 98);
            this.label21.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label21.Name = "label21";
            this.label21.Size = new System.Drawing.Size(76, 15);
            this.label21.TabIndex = 23;
            this.label21.Text = "PLC端口:";
            //
            // comboBox2
            //
            this.comboBox2.FormattingEnabled = true;
            this.comboBox2.Items.AddRange(new object[] {
            "Int",
            "DInt",
            "Char",
            "Real",
            "Bool",
            "String",
            ""});
            this.comboBox2.Location = new System.Drawing.Point(1029, 98);
            this.comboBox2.Margin = new System.Windows.Forms.Padding(4);
            this.comboBox2.Name = "comboBox2";
            this.comboBox2.Size = new System.Drawing.Size(132, 23);
            this.comboBox2.TabIndex = 22;
            //
            // comboBox3
            //
            this.comboBox3.FormattingEnabled = true;
            this.comboBox3.Location = new System.Drawing.Point(720, 90);
            this.comboBox3.Margin = new System.Windows.Forms.Padding(4);
            this.comboBox3.Name = "comboBox3";
            this.comboBox3.Size = new System.Drawing.Size(132, 23);
            this.comboBox3.TabIndex = 21;
            //
            // comboBox4
            //
            this.comboBox4.FormattingEnabled = true;
            this.comboBox4.Items.AddRange(new object[] {
            "OP05",
            "OP10",
            "OP20",
            "OP30",
            "OP35",
            "OP40",
            "OP50",
            "OP60",
            "OP70",
            "OP80"});
            this.comboBox4.Location = new System.Drawing.Point(124, 61);
            this.comboBox4.Margin = new System.Windows.Forms.Padding(4);
            this.comboBox4.Name = "comboBox4";
            this.comboBox4.Size = new System.Drawing.Size(132, 23);
            this.comboBox4.TabIndex = 20;
            //
            // textBox3
            //
            this.textBox3.Location = new System.Drawing.Point(1029, 26);
            this.textBox3.Margin = new System.Windows.Forms.Padding(4);
            this.textBox3.Name = "textBox3";
            this.textBox3.Size = new System.Drawing.Size(132, 25);
            this.textBox3.TabIndex = 19;
            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(660, 126);
            this.button2.Margin = new System.Windows.Forms.Padding(4);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(100, 29);
            this.button2.TabIndex = 3;
            this.button2.Text = "取消";
            this.button2.UseVisualStyleBackColor = true;
            //
            // button3
            //
            this.button3.Location = new System.Drawing.Point(552, 126);
            this.button3.Margin = new System.Windows.Forms.Padding(4);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(100, 29);
            this.button3.TabIndex = 2;
            this.button3.Text = "保存";
            this.button3.UseVisualStyleBackColor = true;
            //
            // label22
            //
            this.label22.AutoSize = true;
            this.label22.Location = new System.Drawing.Point(903, 30);
            this.label22.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label22.Name = "label22";
            this.label22.Size = new System.Drawing.Size(113, 15);
            this.label22.TabIndex = 18;
            this.label22.Text = "节点DB块地址:";
            //
            // textBox4
            //
            this.textBox4.Location = new System.Drawing.Point(1029, 60);
            this.textBox4.Margin = new System.Windows.Forms.Padding(4);
            this.textBox4.Name = "textBox4";
            this.textBox4.Size = new System.Drawing.Size(132, 25);
            this.textBox4.TabIndex = 17;
            //
            // label23
            //
            this.label23.AutoSize = true;
            this.label23.Location = new System.Drawing.Point(919, 64);
            this.label23.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label23.Name = "label23";
            this.label23.Size = new System.Drawing.Size(97, 15);
            this.label23.TabIndex = 16;
            this.label23.Text = "节点偏移量:";
            //
            // label24
            //
            this.label24.AutoSize = true;
            this.label24.Location = new System.Drawing.Point(903, 101);
            this.label24.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label24.Name = "label24";
            this.label24.Size = new System.Drawing.Size(112, 15);
            this.label24.TabIndex = 14;
            this.label24.Text = "节点数据类型:";
            //
            // textBox5
            //
            this.textBox5.Location = new System.Drawing.Point(720, 26);
            this.textBox5.Margin = new System.Windows.Forms.Padding(4);
            this.textBox5.Name = "textBox5";
            this.textBox5.Size = new System.Drawing.Size(132, 25);
            this.textBox5.TabIndex = 13;
            //
            // label25
            //
            this.label25.AutoSize = true;
            this.label25.Location = new System.Drawing.Point(609, 30);
            this.label25.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label25.Name = "label25";
            this.label25.Size = new System.Drawing.Size(97, 15);
            this.label25.TabIndex = 12;
            this.label25.Text = "收集点代码:";
            //
            // textBox6
            //
            this.textBox6.Location = new System.Drawing.Point(720, 60);
            this.textBox6.Margin = new System.Windows.Forms.Padding(4);
            this.textBox6.Name = "textBox6";
            this.textBox6.Size = new System.Drawing.Size(132, 25);
            this.textBox6.TabIndex = 11;
            //
            // label26
            //
            this.label26.AutoSize = true;
            this.label26.Location = new System.Drawing.Point(609, 64);
            this.label26.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label26.Name = "label26";
            this.label26.Size = new System.Drawing.Size(97, 15);
            this.label26.TabIndex = 10;
            this.label26.Text = "收集点描述:";
            //
            // label27
            //
            this.label27.AutoSize = true;
            this.label27.Location = new System.Drawing.Point(625, 98);
            this.label27.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label27.Name = "label27";
            this.label27.Size = new System.Drawing.Size(82, 15);
            this.label27.TabIndex = 8;
            this.label27.Text = "收集方式:";
            //
            // label28
            //
            this.label28.AutoSize = true;
            this.label28.Location = new System.Drawing.Point(352, 30);
            this.label28.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label28.Name = "label28";
            this.label28.Size = new System.Drawing.Size(76, 15);
            this.label28.TabIndex = 6;
            this.label28.Text = "PLC型号:";
            //
            // textBox7
            //
            this.textBox7.Location = new System.Drawing.Point(439, 60);
            this.textBox7.Margin = new System.Windows.Forms.Padding(4);
            this.textBox7.Name = "textBox7";
            this.textBox7.Size = new System.Drawing.Size(132, 25);
            this.textBox7.TabIndex = 5;
            //
            // label29
            //
            this.label29.AutoSize = true;
            this.label29.Location = new System.Drawing.Point(328, 64);
            this.label29.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label29.Name = "label29";
            this.label29.Size = new System.Drawing.Size(100, 15);
            this.label29.TabIndex = 4;
            this.label29.Text = "PLC IP地址:";
            //
            // label30
            //
            this.label30.AutoSize = true;
            this.label30.Location = new System.Drawing.Point(45, 64);
            this.label30.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label30.Name = "label30";
            this.label30.Size = new System.Drawing.Size(67, 15);
            this.label30.TabIndex = 2;
            this.label30.Text = "工序号:";
            //
            // textBox8
            //
            this.textBox8.Location = new System.Drawing.Point(124, 26);
            this.textBox8.Margin = new System.Windows.Forms.Padding(4);
            this.textBox8.Name = "textBox8";
            this.textBox8.Size = new System.Drawing.Size(132, 25);
            this.textBox8.TabIndex = 1;
            //
            // label31
            //
            this.label31.AutoSize = true;
            this.label31.Location = new System.Drawing.Point(29, 30);
            this.label31.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label31.Name = "label31";
            this.label31.Size = new System.Drawing.Size(82, 15);
            this.label31.TabIndex = 0;
            this.label31.Text = "设备编号:";
            //
            // FormMain
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(1448, 724);
            this.Controls.Add(this.tabControl1);
            this.Margin = new System.Windows.Forms.Padding(4);
            this.Name = "FormMain";
            this.Text = "测试用-一汽连杆数据采集系统采集后台";
            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormMain_FormClosed);
            this.Load += new System.EventHandler(this.FormMain_Load);
            this.Scroll += new System.Windows.Forms.ScrollEventHandler(this.FormMain_Scroll);
            this.tabControl1.ResumeLayout(false);
            this.tabPage5.ResumeLayout(false);
            this.groupBox11.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
            this.tabPage1.ResumeLayout(false);
            this.tabPage1.PerformLayout();
            this.tabPage2.ResumeLayout(false);
            this.groupBox10.ResumeLayout(false);
            this.panel4.ResumeLayout(false);
            this.panel4.PerformLayout();
            this.groupBox3.ResumeLayout(false);
            this.panel3.ResumeLayout(false);
            this.panel3.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.panel2.ResumeLayout(false);
            this.panel2.PerformLayout();
            this.groupBox1.ResumeLayout(false);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.tabPage3.ResumeLayout(false);
            this.groupBox7.ResumeLayout(false);
            this.groupBox7.PerformLayout();
            this.groupBox5.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.dgv_DataCaptureConfig)).EndInit();
            this.groupBox4.ResumeLayout(false);
            this.groupBox4.PerformLayout();
            this.tabPage4.ResumeLayout(false);
            this.groupBox9.ResumeLayout(false);
            this.groupBox9.PerformLayout();
            this.groupBox8.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
            this.groupBox6.ResumeLayout(false);
            this.groupBox6.PerformLayout();
            this.ResumeLayout(false);
        }
        #endregion
        private System.Windows.Forms.TabControl tabControl1;
        private System.Windows.Forms.TabPage tabPage1;
        private System.Windows.Forms.TabPage tabPage2;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.CheckBox ckBOP0504;
        private System.Windows.Forms.CheckBox ckBOP0503;
        private System.Windows.Forms.CheckBox ckBOP0502;
        private System.Windows.Forms.Label lbl_Alter_OP0501;
        private System.Windows.Forms.CheckBox ckBOP0501;
        private System.Windows.Forms.Label lbl_Alter_OP0504;
        private System.Windows.Forms.Label lbl_Alter_OP0503;
        private System.Windows.Forms.Label lbl_Alter_OP0502;
        private System.Windows.Forms.Button btn_StartUpAllThread;
        private System.Windows.Forms.Button btn_StopAllThread;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Label lbl_Alter_OP2004;
        private System.Windows.Forms.Label lbl_Alter_OP2003;
        private System.Windows.Forms.Label lbl_Alter_OP2002;
        private System.Windows.Forms.CheckBox ckBOP2004;
        private System.Windows.Forms.CheckBox ckBOP2003;
        private System.Windows.Forms.CheckBox ckBOP2002;
        private System.Windows.Forms.Label lbl_Alter_OP2001;
        private System.Windows.Forms.CheckBox ckBOP2001;
        private System.Windows.Forms.GroupBox groupBox3;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.CheckBox checkBox6;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.CheckBox checkBox7;
        private System.Windows.Forms.CheckBox checkBox8;
        private System.Windows.Forms.CheckBox checkBox9;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.CheckBox checkBox10;
        private System.Windows.Forms.Label lbl_Alter_OP2005;
        private System.Windows.Forms.CheckBox ckBOP2005;
        private System.Windows.Forms.Label lbl_Alter_OP2006;
        private System.Windows.Forms.CheckBox ckBOP2006;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.TabPage tabPage3;
        private System.Windows.Forms.Button btn_Cancel;
        private System.Windows.Forms.Button btn_Save;
        private System.Windows.Forms.GroupBox groupBox5;
        private System.Windows.Forms.DataGridView dgv_DataCaptureConfig;
        private System.Windows.Forms.DataGridViewTextBoxColumn EquipmentID;
        private System.Windows.Forms.DataGridViewTextBoxColumn WorkingProcedure;
        private System.Windows.Forms.DataGridViewTextBoxColumn DataCapturePointCode;
        private System.Windows.Forms.DataGridViewTextBoxColumn DataCapturePointCname;
        private System.Windows.Forms.DataGridViewTextBoxColumn DataCaptureType;
        private System.Windows.Forms.DataGridViewTextBoxColumn DataCapturePLCType;
        private System.Windows.Forms.DataGridViewTextBoxColumn PLCIP;
        private System.Windows.Forms.DataGridViewTextBoxColumn PLCPort;
        private System.Windows.Forms.DataGridViewTextBoxColumn DataCaptureColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn DataCaptureColumnType;
        private System.Windows.Forms.TabPage tabPage4;
        private System.Windows.Forms.GroupBox groupBox7;
        private System.Windows.Forms.ComboBox cbox_DataCaptureType;
        private System.Windows.Forms.ComboBox cbox_WorkingProcedure;
        private System.Windows.Forms.TextBox txt_DbNumber;
        private System.Windows.Forms.Label label15;
        private System.Windows.Forms.TextBox txt_Offset;
        private System.Windows.Forms.Label label14;
        private System.Windows.Forms.Label label13;
        private System.Windows.Forms.TextBox txt_DataCapturePointCode;
        private System.Windows.Forms.Label label12;
        private System.Windows.Forms.TextBox txt_DataCapturePointCname;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.TextBox txt_PLCIP;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txt_EquipmentID;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.GroupBox groupBox4;
        private System.Windows.Forms.TextBox textBox11;
        private System.Windows.Forms.Label label16;
        private System.Windows.Forms.Button btn_Query;
        private System.Windows.Forms.ComboBox cbox_WorkingProcedure_Query;
        private System.Windows.Forms.Label label17;
        private System.Windows.Forms.ComboBox cbox_DataCaptureColumnType;
        private System.Windows.Forms.TextBox txt_PLCPort;
        private System.Windows.Forms.Label label18;
        private System.Windows.Forms.ComboBox cbox_DataCapturePLCType;
        private System.Windows.Forms.Button btn_Delete;
        private System.Windows.Forms.Button btn_Update;
        private System.Windows.Forms.Button btn_Insert;
        private System.Windows.Forms.TextBox txt_ID;
        private System.Windows.Forms.Label label19;
        private System.Windows.Forms.GroupBox groupBox9;
        private System.Windows.Forms.ComboBox comboBox5;
        private System.Windows.Forms.Label label32;
        private System.Windows.Forms.TextBox textBox9;
        private System.Windows.Forms.Label label33;
        private System.Windows.Forms.Button button7;
        private System.Windows.Forms.GroupBox groupBox8;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.DataGridView dataGridView1;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn9;
        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn10;
        private System.Windows.Forms.Button button5;
        private System.Windows.Forms.Button button6;
        private System.Windows.Forms.GroupBox groupBox6;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Label label20;
        private System.Windows.Forms.ComboBox comboBox1;
        private System.Windows.Forms.TextBox textBox2;
        private System.Windows.Forms.Label label21;
        private System.Windows.Forms.ComboBox comboBox2;
        private System.Windows.Forms.ComboBox comboBox3;
        private System.Windows.Forms.ComboBox comboBox4;
        private System.Windows.Forms.TextBox textBox3;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Label label22;
        private System.Windows.Forms.TextBox textBox4;
        private System.Windows.Forms.Label label23;
        private System.Windows.Forms.Label label24;
        private System.Windows.Forms.TextBox textBox5;
        private System.Windows.Forms.Label label25;
        private System.Windows.Forms.TextBox textBox6;
        private System.Windows.Forms.Label label26;
        private System.Windows.Forms.Label label27;
        private System.Windows.Forms.Label label28;
        private System.Windows.Forms.TextBox textBox7;
        private System.Windows.Forms.Label label29;
        private System.Windows.Forms.Label label30;
        private System.Windows.Forms.TextBox textBox8;
        private System.Windows.Forms.Label label31;
        private System.Windows.Forms.Panel panel2;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Panel panel3;
        private System.Windows.Forms.Label lbl_Alter_OP2007;
        private System.Windows.Forms.CheckBox ckBOP2007;
        private System.Windows.Forms.Button button9;
        private System.Windows.Forms.Label label34;
        private System.Windows.Forms.TextBox textBox10;
        private System.Windows.Forms.Button button8;
        private System.Windows.Forms.Label label35;
        private System.Windows.Forms.CheckBox checkBox1;
        private System.Windows.Forms.Label label36;
        private System.Windows.Forms.CheckBox checkBox2;
        private System.Windows.Forms.Button button10;
        private System.Windows.Forms.Button button11;
        private System.Windows.Forms.Button button14;
        private System.Windows.Forms.Button button13;
        private System.Windows.Forms.Button button12;
        private System.Windows.Forms.Button button15;
        private System.Windows.Forms.Button button16;
        private System.Windows.Forms.Button button17;
        private System.Windows.Forms.Button button18;
        private System.Windows.Forms.Button button19;
        private System.Windows.Forms.Button button20;
        private System.Windows.Forms.Button button21;
        private System.Windows.Forms.Button button22;
        private System.Windows.Forms.GroupBox groupBox10;
        private System.Windows.Forms.Panel panel4;
        private System.Windows.Forms.CheckBox HMIOP1040Write;
        private System.Windows.Forms.Label lbl_Alert_HMIOP104001;
        private System.Windows.Forms.CheckBox ckHMIOP1040Reading;
        private System.Windows.Forms.Label lbl_Alert_HMIOP104002;
        private System.Windows.Forms.Button btnHMIWrite;
        private System.Windows.Forms.Button btnHMI04Reading;
        private System.Windows.Forms.CheckBox HMIOP60Write;
        private System.Windows.Forms.CheckBox HMIOP50Write;
        private System.Windows.Forms.CheckBox HMIOP3035Write;
        private System.Windows.Forms.CheckBox HMIOP20Write;
        private System.Windows.Forms.Label lbl_Alert_HMIOP6001;
        private System.Windows.Forms.CheckBox ckHMIOP60Reading;
        private System.Windows.Forms.Label lbl_Alert_HMIOP5001;
        private System.Windows.Forms.CheckBox ckHMIOP50Reading;
        private System.Windows.Forms.Label lbl_Alert_HMIOP303501;
        private System.Windows.Forms.CheckBox ckHMIOP3035Reading;
        private System.Windows.Forms.Label lbl_Alert_HMIOP6002;
        private System.Windows.Forms.Label lbl_Alert_HMIOP2001;
        private System.Windows.Forms.Label lbl_Alert_HMIOP5002;
        private System.Windows.Forms.CheckBox ckHMIOP20Reading;
        private System.Windows.Forms.Label lbl_Alert_HMIOP303502;
        private System.Windows.Forms.Label lbl_Alert_HMIOP2002;
        private System.Windows.Forms.TabPage tabPage5;
        private System.Windows.Forms.Button button23;
        private System.Windows.Forms.Button button24;
        private System.Windows.Forms.GroupBox groupBox11;
        private System.Windows.Forms.DataGridView dataGridView2;
        private System.Windows.Forms.DataGridViewTextBoxColumn Threadcode;
        private System.Windows.Forms.DataGridViewTextBoxColumn Threadcname;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
        private System.Windows.Forms.TextBox textBox12;
        private System.Windows.Forms.Button button25;
        private System.Windows.Forms.Button button26;
        private System.Windows.Forms.Button button27;
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormMain.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1929 @@
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;
using iTextSharp.text.pdf.qrcode;
using iWare_SCADA_BusinessLogical;
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using iWare_SCADA_Model.TableModelSC;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Net.WebRequestMethods;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
using File = System.IO.File;
namespace iWare_SCADA_DataCaptureV3
{
    public partial class FormMain : Form
    {
        #region ä¿¡æ¯èŽ·å–çº¿ç¨‹
        Thread tskSetLableText;//各种lable动态显示
        Thread tskSetGridSource;//各种lable动态显示
        #endregion
        public FormMain()
        {
            InitializeComponent();
        }
        private void btn_StartUpAllThread_Click(object sender, EventArgs e)
        {
            try
            {
                #region æ•°æ®é‡‡é›†é¡¹ç¡®å®š
                var dataCaptureConfigslist = DataCaptureConfigManager.GetDataCaptureConfigs();
                var columnList = DataCaptureConfigManager.GetDataCaptureColumnConfig();
                //var keyvalue = dataCaptureConfigslist.GroupBy(o => o.WorkingProcedure).Select(g => new
                //{
                //    keyword = g.Key,
                //    RecordIDs = g.Where(c =>c.WorkingProcedure.Equals(g.Key)).ToList()
                //});
                foreach (var config in dataCaptureConfigslist)
                {
                    switch (config.DataCapturePointCode)
                    {
                    }
                }
                #endregion
                try
                {
                }
                catch (Exception ex)
                {
                    Log4NetHelper.WriteErrorLog(LogType.FormMain, "启动线程时----btn_StartUpAllThread_Click报错:", ex);
                }
                #region è®¾ç½®æ˜¾ç¤ºUI
                tskSetLableText = new Thread(DataRead_Label);
                tskSetLableText.Start();
                #endregion
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "启动线程时----btn_StartUpAllThread_Click all报错:", ex);
            }
        }
        private void FormMain_Load(object sender, EventArgs e)
        {
            try
            {//加载需要的数据
            }
            catch (Exception ex)
            {
            }
        }
        private void LoadItemType()
        {
            List<ListItem> itemList = new List<ListItem>();
            itemList.Add(new ListItem() { Value = "-1", Text = "请选择" });
            itemList.Add(new ListItem()
            {
                Text = "PLC",
                Value = "1"
            });
            itemList.Add(new ListItem()
            {
                Text = "数据网关",
                Value = "2"
            });
            itemList.Add(new ListItem()
            {
                Text = "工控机",
                Value = "3"
            });
            cbox_DataCaptureType.ValueMember = "Value";
            cbox_DataCaptureType.DisplayMember = "Text";
            cbox_DataCaptureType.DataSource = itemList;
            cbox_DataCaptureType.SelectedIndex = 0;
            List<ListItem> itemList2 = new List<ListItem>();
            itemList2.Add(new ListItem() { Value = "-1", Text = "请选择" });
            itemList2.Add(new ListItem()
            {
                Text = "西门子S7",
                Value = "1"
            });
            itemList2.Add(new ListItem()
            {
                Text = "西门子300",
                Value = "2"
            });
            cbox_DataCapturePLCType.ValueMember = "Value";
            cbox_DataCapturePLCType.DisplayMember = "Text";
            cbox_DataCapturePLCType.DataSource = itemList2;
            cbox_DataCapturePLCType.SelectedIndex = 0;
        }
        List<ThreadStatusMonitor> sourcelist = new List<ThreadStatusMonitor>();
        /// <summary>
        /// è®¾ç½®çŽ°åœºå‘Šè­¦ä¿¡æ¯å‰ç«¯æ˜¾ç¤º
        /// </summary>
        private void GridRefresh()
        {
            //while (true)
            //{
            try
            {
                Action action = () =>
                {
                    using (DbModel db = new DbModel())
                    {
                        sourcelist = db.ThreadStatusMonitor.Where(o => o.IsDeleted == false).ToList();
                        dataGridView2.DataSource = sourcelist.OrderBy(o => o.Threadcode);
                        dataGridView2.Refresh();
                    }
                    //dataGridView2.DataSource = null;
                    //dataGridView2.DataSource = SystemValue.MainList;
                };
                Invoke(action);
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "方法GridRefresh出现异常:" + ex.Message, ex);
                //continue;
            }
            //Thread.Sleep(10000);
            //}
        }
        /// <summary>
        /// è®¾ç½®çŽ°åœºå‘Šè­¦ä¿¡æ¯å‰ç«¯æ˜¾ç¤º
        /// </summary>
        private void DataRead_Label()
        {
            while (true)
            {
                Thread.Sleep(1000);
                try
                {
                    var showNowTime = "(" + DateTimeHelper.ConvertToStringForOnlyShowTime(DateTime.Now) + ")";
                    Action action = () =>
                    {
                        //TimeBox.Text = TimeString; ResultBox.Text = hv_Resultstr;
                        //DisplayImageHalconwindow(AcqImage, GrayImage);
                        //DisplayImageHalconwindow(ThresholdImage,MeanImage);
                        //设置堆垛机任务下发和任务确认线程消息
                        this.lbl_Alter_OP0501.Text = showNowTime + SystemValue.lbl_Alert_OP0501;
                        this.lbl_Alter_OP0502.Text = showNowTime + SystemValue.lbl_Alert_OP0502;
                        this.lbl_Alter_OP0503.Text = showNowTime + SystemValue.lbl_Alert_OP0503;
                        this.lbl_Alter_OP0504.Text = showNowTime + SystemValue.lbl_Alert_OP0504;
                        this.lbl_Alter_OP2001.Text = showNowTime + SystemValue._lbl_Alert_OP2001;
                        this.lbl_Alter_OP2002.Text = showNowTime + SystemValue._lbl_Alert_OP2002;
                        this.lbl_Alter_OP2003.Text = showNowTime + SystemValue._lbl_Alert_OP2003;
                        this.lbl_Alter_OP2004.Text = showNowTime + SystemValue._lbl_Alert_OP2004;
                        this.lbl_Alter_OP2005.Text = showNowTime + SystemValue._lbl_Alert_OP2005;
                        this.lbl_Alter_OP2006.Text = showNowTime + SystemValue._lbl_Alert_OP2006;
                        this.lbl_Alert_HMIOP104001.Text = showNowTime + SystemValue.lbl_Alert_HMIOP104001;
                        this.lbl_Alert_HMIOP104002.Text = showNowTime + SystemValue.lbl_Alert_HMIOP104002;
                        this.lbl_Alert_HMIOP2001.Text = showNowTime + SystemValue.lbl_Alert_HMIOP2001;
                        this.lbl_Alert_HMIOP2002.Text = showNowTime + SystemValue.lbl_Alert_HMIOP2002;
                        this.lbl_Alert_HMIOP303501.Text = showNowTime + SystemValue.lbl_Alert_HMIOP303501;
                        this.lbl_Alert_HMIOP303502.Text = showNowTime + SystemValue.lbl_Alert_HMIOP303502;
                        this.lbl_Alert_HMIOP5001.Text = showNowTime + SystemValue.lbl_Alert_HMIOP5001;
                        this.lbl_Alert_HMIOP5002.Text = showNowTime + SystemValue.lbl_Alert_HMIOP5002;
                        this.lbl_Alert_HMIOP6001.Text = showNowTime + SystemValue.lbl_Alert_HMIOP6001;
                        this.lbl_Alert_HMIOP6002.Text = showNowTime + SystemValue.lbl_Alert_HMIOP6002;
                    };
                    Invoke(action);
                }
                catch (Exception ex)
                {
                    Log4NetHelper.WriteErrorLog(LogType.FormMain, "方法DataRead_Label出现异常:" + ex.Message, ex);
                    continue;
                }
            }
        }
        /// <summary>
        /// é€šç”¨çš„checkbox改变事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CommonCheckedChanged(object sender, EventArgs e)
        {
            // HMI
            SystemValue.isAllowRuning_HMIOP104001 = DoCommonCheckedChanged(ckHMIOP1040Reading);
            SystemValue.isAllowRuning_HMIOP104002 = DoCommonCheckedChanged(HMIOP1040Write);
            SystemValue.isAllowRuning_HMIOP2001 = DoCommonCheckedChanged(ckHMIOP20Reading);
            SystemValue.isAllowRuning_HMIOP2002 = DoCommonCheckedChanged(HMIOP20Write);
            SystemValue.isAllowRuning_HMIOP303501 = DoCommonCheckedChanged(ckHMIOP3035Reading);
            SystemValue.isAllowRuning_HMIOP303502 = DoCommonCheckedChanged(HMIOP3035Write);
            SystemValue.isAllowRuning_HMIOP5001 = DoCommonCheckedChanged(ckHMIOP50Reading);
            SystemValue.isAllowRuning_HMIOP5002 = DoCommonCheckedChanged(HMIOP50Write);
            SystemValue.isAllowRuning_HMIOP6001 = DoCommonCheckedChanged(ckHMIOP60Reading);
            SystemValue.isAllowRuning_HMIOP6002 = DoCommonCheckedChanged(HMIOP60Write);
            //OP05工序监控任务
            SystemValue.isAllowRuning_OP0501 = DoCommonCheckedChanged(ckBOP0501);
            SystemValue.isAllowRuning_OP0502 = DoCommonCheckedChanged(ckBOP0502);
            SystemValue.isAllowRuning_OP0503 = DoCommonCheckedChanged(ckBOP0503);
            SystemValue.isAllowRuning_OP0504 = DoCommonCheckedChanged(ckBOP0504);
            SystemValue.isAllowRuning_OP2001 = DoCommonCheckedChanged(ckBOP2001);
            SystemValue.isAllowRuning_OP2002 = DoCommonCheckedChanged(ckBOP2002);
            SystemValue.isAllowRuning_OP2003 = DoCommonCheckedChanged(ckBOP2003);
            SystemValue.isAllowRuning_OP2004 = DoCommonCheckedChanged(ckBOP2004);
        }
        private bool DoCommonCheckedChanged(CheckBox cb)
        {
            return cb.Checked ? true : false;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string Station = "03";
                string value_02 = "";
                string path = ConfigHelper.GetConfigString("OP30QualityDataForStation");//打码机打码二维码路径
                if (string.IsNullOrEmpty(path))
                {
                    path = @"Z:\";
                }
                if (Station.Equals("03"))
                {//工位3 æ¶¨æ–­åŠ›çŸ©
                    path = path + "kistler_crack";
                }
                else if (Station.Equals("04"))
                {//工位4 é¢„拧紧力矩
                    path = path + "Bosch_Rexroth";
                }
                else if (Station.Equals("05"))
                {//工位5 æ‹§ç´§åŠ›çŸ©
                    path = path + "Bosch_Rexroth";
                }
                else if (Station.Equals("06"))
                {//工位6 è¡¬å¥—压装力矩
                    path = path + "kistler_bush";
                }
                //扫描共享目录并将新的文件扫描返回  ä¸€èˆ¬èŠ‚æ‹åœ¨15秒左右(可以确认一下)
                //扫描修改时间在上次扫描时间之前10秒到当前时间的之间的文件
                var startTime = CommonManager.Instance.CheackPath(Environment.CurrentDirectory + $"\\LastModifyTime\\OP30Station{Station}-LastScapTime.txt", 6, -10);
                var endTime = DateTimeHelper.GetDateTime();
                var newFiles = FileHelper.DetectNewFilesCSV(textBox10.Text, 100000000, Convert.ToDateTime(startTime), endTime);
                var list = newFiles.GetEnumerator();
                foreach (System.IO.FileInfo file in newFiles)
                {
                }
                var a = ReadPdfConntent(textBox10.Text, textBox12.Text);
                //var ccSystem = DataCaptureColumnDictManager.GetEquipmentBaseInfo();
                //if (ccSystem == null)
                //{
                //    MessageBox.Show("请联系管理员维护系统调度相关的数据!");
                //    return;
                //};
                //WorkPieceInfoManager.test();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                var list = DataCaptureConfigManager.GetDataCaptureConfigs();
                if (list == null)
                {
                    MessageBox.Show("请联系管理员维护数据收集点相关的数据!");
                    return;
                };
                dgv_DataCaptureConfig.DataSource = list;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void txt_PLCPort_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
            {
                e.Handled = true;
            }
            ///*只能数字键、退格键、负号、小数点*/
            //if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 &&
            //   (int)e.KeyChar != 45 && (int)e.KeyChar != 46) e.Handled = true;
            ///*输入为负号和小数点时,且只能输入一次(负号只能最前面输入,小数点不可最前面输入)*/
            //if (e.KeyChar == 45 && (((TextBox)sender).SelectionStart != 0 ||
            //   ((TextBox)sender).Text.IndexOf("-") >= 0)) e.Handled = true;
            //if (e.KeyChar == 46 && (((TextBox)sender).SelectionStart == 0 ||
            //     ((TextBox)sender).Text.IndexOf(".") >= 0)) e.Handled = true;
        }
        private void txt_PLCIP_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 && (int)e.KeyChar != 46)
            {
                e.Handled = true;
            }
        }
        private void btn_Insert_Click(object sender, EventArgs e)
        {
            btn_Save.Tag = "create";
            setControlsVisible(true);
            setControlsEmpty();
            btn_Update.Enabled = false;
            btn_Delete.Enabled = false;
            btn_Insert.Enabled = false;
        }
        private void setControlsVisible(bool flag)
        {
            groupBox7.Visible = flag;
        }
        private void setControlsEmpty()
        {
            txt_EquipmentID.Text = "";
            txt_EquipmentID.Focus();
            cbox_WorkingProcedure.SelectedIndex = -1;
            cbox_DataCaptureColumnType.SelectedIndex = -1;
            cbox_DataCapturePLCType.SelectedIndex = 0;
            cbox_DataCaptureType.SelectedIndex = 0;
        }
        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            setControlsVisible(false);
            btn_Update.Enabled = true;
            btn_Delete.Enabled = true;
            btn_Insert.Enabled = true;
        }
        private void btn_Update_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv_DataCaptureConfig.CurrentRow == null || dgv_DataCaptureConfig.CurrentRow.Index < 0)
                {
                    MessageBox.Show("请选择一条需修改的数据!");
                    return;
                }
                btn_Save.Tag = "update";
                setControlsVisible(true);
                btn_Update.Enabled = false;
                btn_Delete.Enabled = false;
                btn_Insert.Enabled = false;
                var model = dgv_DataCaptureConfig.SelectedRows[0].DataBoundItem as DataCaptureConfig;
                txt_ID.Text = model.Id.ToString();
                txt_EquipmentID.Text = model.EquipmentID;
                cbox_WorkingProcedure.Text = model.WorkingProcedure;
                txt_DataCapturePointCode.Text = model.DataCapturePointCode;
                txt_DataCapturePointCname.Text = model.DataCapturePointCname;
                cbox_DataCaptureType.SelectedValue = model.DataCaptureType.ToString();
                cbox_DataCapturePLCType.SelectedValue = model.DataCapturePLCType.ToString();
                txt_PLCIP.Text = model.PLCIP;
                txt_PLCPort.Text = model.PLCPort.ToString();
                txt_DbNumber.Text = model.DbNumber;
                txt_Offset.Text = model.Offset;
                cbox_DataCaptureColumnType.Text = model.DataCaptureColumnType;
            }
            catch (Exception ex)
            {
                MessageBox.Show($"修改收集点信息失败! {ex.Message}");
                btn_Update.Enabled = true;
                btn_Delete.Enabled = true;
                btn_Insert.Enabled = true;
            }
        }
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv_DataCaptureConfig.CurrentRow.Index < 0)
                {
                    MessageBox.Show("请选择一条收集点!");
                    return;
                }
                if (MessageBox.Show("确认删除此记录?", "删除确认", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
                var model = dgv_DataCaptureConfig.SelectedRows[0].DataBoundItem as DataCaptureConfig;
                var num = DataCaptureConfigManager.DeleteDataCaptureConfig(model);
                if (num > 0)
                {
                    MessageBox.Show($"删除成功{num}条");
                }
                else
                {
                    MessageBox.Show("删除异常,请刷新后重试");
                }
                button5_Click(null, null);
                //if (service.DeleteAlertRule(ID))
                //{
                //    ShowStatusMsg("删除成功");
                //    BindDataGrid();
                //    dgAlertRuleList.Rows[0].Selected = true;
                //    dgAlertRuleList.CurrentCell = dgAlertRuleList.Rows[0].Cells[1];
                //    dgAlertRuleList_SelectionChanged(null, null);
                //}
                //else
                //{
                //    ShowErrMsg("删除失败");
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show($"删除收集点信息异常!{ex.Message}");
            }
        }
        private DataCaptureConfig GetFormDataCaptureConfigInfo()
        {
            ListItem DataCaptureTypeFlag = null;
            var itemType = ComboBoxHelper.GetComboxSelectValue(cbox_DataCaptureType, ref DataCaptureTypeFlag);
            ListItem DataCapturePLCTypeFlag = null;
            var itemType2 = ComboBoxHelper.GetComboxSelectValue(cbox_DataCapturePLCType, ref DataCapturePLCTypeFlag);
            DataCaptureConfig model = new DataCaptureConfig();
            model.Id = string.IsNullOrEmpty(txt_ID.Text.Trim()) ? 0 : Convert.ToInt32(txt_ID.Text.Trim());
            model.EquipmentID = txt_EquipmentID.Text.Trim();
            model.WorkingProcedure = cbox_WorkingProcedure.Text.Trim();
            model.DataCapturePointCode = txt_DataCapturePointCode.Text.Trim();
            model.DataCapturePointCname = txt_DataCapturePointCname.Text.Trim();
            model.DataCaptureType = Convert.ToInt32(DataCaptureTypeFlag.Value);
            model.DataCapturePLCType = Convert.ToInt32(DataCapturePLCTypeFlag.Value);
            model.PLCIP = txt_PLCIP.Text;
            model.PLCPort = Convert.ToInt32(txt_PLCPort.Text.Trim());
            model.DbNumber = txt_DbNumber.Text;
            model.Offset = txt_Offset.Text;
            model.DataCaptureColumnType = cbox_DataCaptureColumnType.Text;
            return model;
        }
        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                #region æ ¡éªŒæ ¼å¼
                if (cbox_WorkingProcedure.SelectedIndex < 0)
                {
                    MessageBox.Show($"请选择工序");
                    return;
                }
                if (cbox_DataCapturePLCType.SelectedIndex < 0)
                {
                    MessageBox.Show($"输入PLC型号异常,请选中PLC型号");
                    return;
                }
                if (string.IsNullOrEmpty(txt_PLCIP.Text.Trim()))
                {
                    MessageBox.Show($"PLC IP不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(txt_PLCPort.Text.Trim()))
                {
                    MessageBox.Show($"PLC端口不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(txt_DataCapturePointCode.Text.Trim()))
                {
                    MessageBox.Show($"收集点代码不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(txt_DbNumber.Text.Trim()))
                {
                    MessageBox.Show($"节点DB块地址不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(txt_Offset.Text.Trim()))
                {
                    MessageBox.Show($"节点偏移量不能为空");
                    return;
                }
                if (cbox_DataCaptureColumnType.SelectedIndex < 0)
                {
                    MessageBox.Show($"请选择节点数据类型");
                    return;
                }
                if (cbox_DataCaptureType.SelectedIndex < 1)
                {
                    MessageBox.Show($"请选择收集方式");
                    return;
                }
                #endregion
                var data = GetFormDataCaptureConfigInfo();
                //data.ID = Convert.ToInt32(dgv_DataCaptureConfig.CurrentRow.Cells["ID"].Value);
                if (btn_Save.Tag.Equals("update"))
                {//修改
                    string message = "";
                    DataCaptureConfigManager.UpdateDataCaptureConfig(data, out message);
                    if (message.Length == 0)
                    {
                        setControlsVisible(false);
                        btn_Update.Enabled = true;
                        btn_Delete.Enabled = true;
                        btn_Insert.Enabled = true;
                        MessageBox.Show("修改成功!");
                        button5_Click(null, null);
                    }
                    else
                    {
                        MessageBox.Show($"修改失败!{message}");
                    }
                }
                else if (btn_Save.Tag.Equals("create"))
                {//新增
                    DataCaptureConfigManager.InsertDataCaptureConfig(data);
                    setControlsVisible(false);
                    btn_Update.Enabled = true;
                    btn_Delete.Enabled = true;
                    btn_Insert.Enabled = true;
                    MessageBox.Show("新增成功");
                    button5_Click(null, null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"保存收集点信息异常!{ex.Message}");
            }
            finally
            {
            }
        }
        private void button8_Click(object sender, EventArgs e)
        {
        }
        private void button10_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button9_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button11_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button12_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button15_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button13_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button14_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button16_Click(object sender, EventArgs e)
        {
            try
            {
                textBox10.Text = EnumberHelper.GetEnumName<WorkingProcedureForHMI>(int.Parse(textBox12.Text)).ToString();
                var bb = EnumberHelper.GetEnumForString<WorkingProcedureForHMI>(textBox12.Text);
                var A = EnumberHelper.GetEnumName<WorkingProcedureForHMI>(1);
                WorkingProcedureForHMI t = default(WorkingProcedureForHMI);
                bool isRight = EnumberHelper.GetEnumObject<WorkingProcedureForHMI>("OP10", out t);
                //int workProcedure = 0;
                //workProcedure = (int)((WorkingProcedureForHMI)"OP10");
                //using (DbModel db = new DbModel())
                //{
                //    var qualityData = db.QualityDataInfo.Where(o => o.WorkPieceID == "DZ045L2309210100201A1A").FirstOrDefault();
                //}
                //    WorkPieceLog wplog = new WorkPieceLog();
                //wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                //wplog.WorkingProcedure = "OP999";
                //wplog.EquipmentID = "AA";
                //wplog.Remarks = "CES";
                //wplog.MonitoringPoint = "AAA";
                //wplog.CreatedTime = DateTimeHelper.GetDateTime();
                //wplog.CreatedUserName = "BAO";
                //wplog.IsDeleted = false;
                //wplog.GetType().GetProperty("workpieceid").SetValue(wplog, "WorkPieceIDGONGJIANMA");//给动态字段赋值
            }
            catch (Exception ex)
            {
            }
        }
        /// <summary>
        /// è§£æžpdf文件
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="getPdfValue"></param>
        /// <returns></returns>
        public static List<string> ReadPdfConntent(string filePath, string getPdfValue)
        {
            List<string> lst = new List<string>();
            try
            {
                string pdffilename = filePath;
                PdfReader pdfreader = new PdfReader(pdffilename);
                int numberOfPages = pdfreader.NumberOfPages;
                //for (int i = 1; i <= numberOfPages; ++i)
                //{
                //    lst.Add(iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(pdfreader,i));
                //    text.AppendLine();
                //}
                string text = iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(pdfreader, 1);
                string[] words = text.Split('\n');
                foreach (var item in words)
                {
                    string value = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(item));
                    if (value.Contains(getPdfValue))
                    {
                        string[] splitValue = value.Split(':');
                        lst.Add(splitValue[1].Trim());
                    }
                }
                pdfreader.Close();
                return lst;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void button22_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button21_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button20_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button19_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button18_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void button17_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        /// <summary>
        /// HMI04读取
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnHMI04Reading_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
                var dataCaptureConfigslist = DataCaptureConfigManager.GetDataCaptureConfigs();
                foreach (var config in dataCaptureConfigslist)
                {
                    switch (config.DataCapturePointCode)
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        /// <summary>
        /// HMI04写入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnHMIWrite_Click(object sender, EventArgs e)
        {
            try
            {
                if (!SystemValue.isStartedModel)
                {
                    MessageBox.Show("请点击调试模式按钮");
                    return;
                }
                var dataCaptureConfigslist = DataCaptureConfigManager.GetDataCaptureConfigs();
                foreach (var config in dataCaptureConfigslist)
                {
                    switch (config.DataCapturePointCode)
                    {
                    }
                }
                // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"模拟异常:{ex.Message}");
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex);
            }
        }
        private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
            //强制结束进程并退出
            //System.Diagnostics.Process.GetCurrentProcess().Kill();
            System.Environment.Exit(0);
        }
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            //if (MessageBox.Show("将要关闭采集程序,是否继续?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes)
            //{
            //    e.Cancel = false;
            //}
            //else
            //{
            //    e.Cancel = true;
            //}
            e.Cancel = false;
        }
        private void button24_Click(object sender, EventArgs e)
        {
            try
            {
                #region æ•°æ®é‡‡é›†é¡¹ç¡®å®š
                var dataCaptureConfigslist = DataCaptureConfigManager.GetDataCaptureConfigs();
                var columnList = DataCaptureConfigManager.GetDataCaptureColumnConfig();
                //var keyvalue = dataCaptureConfigslist.GroupBy(o => o.WorkingProcedure).Select(g => new
                //{
                //    keyword = g.Key,
                //    RecordIDs = g.Where(c =>c.WorkingProcedure.Equals(g.Key)).ToList()
                //});
                foreach (var config in dataCaptureConfigslist)
                {
                    switch (config.DataCapturePointCode)
                    {
                    }
                }
                #endregion
                try
                {
                }
                catch (Exception ex)
                {
                    Log4NetHelper.WriteErrorLog(LogType.FormMain, "启动线程时----btn_StartUpAllThread_Click报错:", ex);
                }
                #region è®¾ç½®æ˜¾ç¤ºUI
                tskSetGridSource = new Thread(GridRefresh);
                tskSetGridSource.Start();
                dataGridView2.DataSource = sourcelist;
                #endregion
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "启动线程时----btn_StartUpAllThread_Click all报错:", ex);
            }
        }
        private void FormMain_Scroll(object sender, ScrollEventArgs e)
        {
            Rectangle rect;
            DataGridView ctrl = (DataGridView)sender;
            Point pt = PointToScreen(ctrl.Location);
            if (pt.X < 0)
            {
                int left = -pt.X;
                int top = ctrl.ColumnHeadersHeight;
                int width = e.OldValue - e.NewValue;
                int height = ctrl.ClientSize.Height;
                ctrl.Invalidate(new Rectangle(new Point(left, top), new Size(width, height)));
            }
            pt.X += ctrl.Width;
            rect = Screen.GetBounds(pt);
            if (pt.X > rect.Right)
            {
                int left = ctrl.ClientSize.Width - (pt.X - rect.Right) - (e.NewValue - e.OldValue);
                int top = ctrl.ColumnHeadersHeight;
                int width = e.NewValue - e.OldValue;
                int height = ctrl.ClientSize.Height;
                ctrl.Invalidate(new Rectangle(new Point(left, top), new Size(width, height)));
            }
            pt.Y += ctrl.Height;
            if (pt.Y > rect.Bottom)
            {
                int left = 0;
                int top = ctrl.ColumnHeadersHeight;
                int width = ctrl.ClientSize.Width;
                int height = ctrl.ClientSize.Height - (pt.Y - rect.Bottom) - (e.NewValue - e.OldValue);
                ctrl.Invalidate(new Rectangle(new Point(left, top), new Size(width, height)));
            }
        }
        private void button23_Click(object sender, EventArgs e)
        {
            GridRefresh();
        }
        private void button25_Click(object sender, EventArgs e)
        {
            try
            {
                var WorkingProcedure = "OP35";
                var EquipmentID = "EOP35";
                var DataCapturePointCode = "OP3502A";
                //var DataCapturePointCode = "OP3002CH3";
                WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                wplog.WorkingProcedure = WorkingProcedure;
                wplog.EquipmentID = EquipmentID; ;
                wplog.Remarks = WorkingProcedure;
                wplog.MonitoringPoint = DataCapturePointCode;
                wplog.WorkPieceID = "DZ045L2309080100181A1A";
                wplog.CreatedTime = DateTimeHelper.GetDateTime();
                wplog.CreatedUserName = DataCapturePointCode;
                wplog.UpdatedUserName = Environment.MachineName + "自动" + Thread.CurrentThread.ManagedThreadId.ToString();
                wplog.UpdatedTime = DateTimeHelper.GetDateTime();
                wplog.IsDeleted = false;
                wplog.QualityOP10To1 = "-500";
                WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //string path = ConfigHelper.GetConfigString("OP30QualityDataForStation");//打码机打码二维码路径
                //if (string.IsNullOrEmpty(path))
                //{
                //    path = @"C:\work\003-一汽连杆数据采集\整理文档\设备接口文档\";
                //}
                //path = @"C:\work\003-一汽连杆数据采集\整理文档\设备接口文档\";
                //if (DataCapturePointCode.Contains("CH3"))
                //{//工位3 æ¶¨æ–­åŠ›çŸ©
                //    path = path + "kistler_crack";
                //}
                //else if (DataCapturePointCode.Contains("CH4"))
                //{//工位4 é¢„拧紧力矩
                //    path = path + "Bosch_Rexroth";
                //}
                //else if (DataCapturePointCode.Contains("CH5"))
                //{//工位5 æ‹§ç´§åŠ›çŸ©
                //    path = path + "Bosch_Rexroth";
                //}
                //else if (DataCapturePointCode.Contains("CH6"))
                //{//工位6 è¡¬å¥—压装力矩
                //    path = path + "kistler_bush";
                //}
                //wplog.WorkPieceID = "DZ045L2309270100371A1A";
                //try
                //{
                //    var get = wplog.GetType().GetProperty("WorkPieceID");
                //    if (get == null)
                //    {
                //        //Log4NetHelper.WriteErrorLog(LogType.DBDataCapture, $" {group.EquipmentNo}设备由于源头字段名{item.DataCaptureColumnTabelColName}没找到,赋值失败{currentlog.Id}");
                //        //continue;
                //    }
                //    var valuecol = get.GetValue(wplog);
                //}
                //catch (Exception setex)
                //{
                //    }
                ////wplog.QualityStateStr = "OK";
                ////wplog.QualityOP30To1 = "test0122";
                ////wplog.QualityOP30To2 = "test0122";
                ////wplog.QualityOP80To1 = "test990222";
                //try
                //{
                //    if (WorkingProcedure.Equals("OP30"))
                //    {
                //        var time = DateTimeHelper.GetDateTime();
                //        //获取文件夹名称
                //        List<string> directorylist = new List<string>();
                //        string directory = time.ToString("yyyy-MM-dd_HH");
                //        string directoryOther = time.AddSeconds(-30).ToString("yyyy-MM-dd_HH");
                //        directorylist.Add(directory);
                //        if (!directory.Equals(directoryOther))
                //        {//如果30秒前是另一个文件夹
                //            directorylist.Add(directoryOther);
                //        }
                //        List<FileInfo> files = new List<FileInfo>();
                //        foreach (var dir in directorylist)
                //        {
                //            try
                //            {
                //                //扫描当前时间与30秒前出现的文件,一般节拍在15秒左右(两个服务器时间不一样会导致取不到文件)
                //                var newFiles = FileHelper.DetectNewFiles(path + @"\" + dir, "*.pdf", 1000000000, time, time);
                //                foreach (var file in newFiles)
                //                {
                //                    files.Add((FileInfo)file);
                //                }
                //            }
                //            catch (Exception ex)
                //            {
                //                Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}下线完成读取文件{dir}数据时异常,避免工序完成异常1:", ex);
                //            }
                //        }
                //        files = files.OrderByDescending(o => o.LastWriteTime).ToList();
                //        if (files.Count > 0)
                //        {
                //            switch (DataCapturePointCode)
                //            {
                //                case "OP3002CH3":
                //                    wplog.QualityStateStr = FileHelper.ReadPdfConntent(files[0].FullName, "Result");
                //                    wplog.QualityStateStr = FileHelper.ReadPdfConntent(files[1].FullName, "Result");
                //                    wplog.QualityOP30To1 = FileHelper.ReadPdfConntent(files[0].FullName, "Y-Maximum");//涨断力矩
                //                    break;
                //                case "OP3002CH4":
                //                    wplog.QualityStateStr = FileHelper.ReadPdfConntent(files[0].FullName, "Result");
                //                    wplog.QualityOP30To2 = FileHelper.ReadPdfConntent(files[0].FullName, "Y-Maximum");//预拧紧力矩
                //                    wplog.QualityOP30To3 = FileHelper.ReadPdfConntent(files[0].FullName, "Y-Maximum");//预拧紧角度
                //                    break;
                //                case "OP3002CH5":
                //                    wplog.QualityStateStr = FileHelper.ReadPdfConntent(files[0].FullName, "Result");
                //                    wplog.QualityOP30To4 = FileHelper.ReadPdfConntent(files[0].FullName, "Y-Maximum");//终拧紧力矩
                //                    wplog.QualityOP30To5 = FileHelper.ReadPdfConntent(files[0].FullName, "Y-Maximum");//终拧紧角度
                //                    break;
                //                case "OP3002CH6":
                //                    wplog.QualityStateStr = FileHelper.ReadPdfConntent(files[0].FullName, "Result");
                //                    wplog.QualityOP30To6 = FileHelper.ReadPdfConntent(files[0].FullName, "Y-Maximum");//衬套压装力矩
                //                    wplog.QualityOP30To7 = FileHelper.ReadPdfConntent(files[0].FullName, "Block X");//衬套压装位移
                //                    break;
                //                default:
                //                    break;
                //            }
                //        }
                //    }
                //}
                //catch (Exception ex)
                //{
                //    //threadStatusMonitor.ErrorMsg = $" {RandomHelper.GenerateRandomCode(4)} è¯»å–{DataCapturePointCode}下线标记 å‡ºçŽ°å¼‚å¸¸ï¼Œè¯·æŸ¥çœ‹æ—¥å¿—ï¼";
                //    Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"OP80下线完成读取文件数据时异常,避免工序完成异常:", ex);
                //}
                ////更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                //WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //threadStatusMonitor.Threadstatue = 1;
                //WorkPieceInfoManager.WorkPieceSPCPushOff(wplog, LogType.PLCOP10);
                //WorkPieceInfoManager.WorkPieceSPCPushOff(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //WorkPieceInfoManager.WorkingProcedureComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), new PLCService(), 1);
                //if (WorkingProcedure.Equals("OP20")
                //    //|| _dataCaptureConfig.WorkingProcedure.Equals("OP50")|| _dataCaptureConfig.WorkingProcedure.Equals("OP60")
                //    )
                //{//op20,op50,op60 ä¼šåŒæ—¶æŽ¨å‡ºå¤šä»¶ï¼Œæ‰€ä»¥ç‰¹æ®Šå¤„理
                //    wplog.WorkPieceID = wplog.WorkPieceIDA;
                //    wplog.Remarks = "NOOK推出工件A";
                //    WorkPieceInfoManager.WorkPiecePushOff(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //    wplog.WorkPieceID = wplog.WorkPieceIDB;
                //    wplog.Remarks = "NOOK推出工件B";
                //    WorkPieceInfoManager.WorkPiecePushOff(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //    wplog.WorkPieceID = wplog.WorkPieceIDC;
                //    wplog.Remarks = "NOOK推出工件C";
                //    WorkPieceInfoManager.WorkPiecePushOff(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //    wplog.WorkPieceID = wplog.WorkPieceIDD;
                //    wplog.Remarks = "NOOK推出工件D";
                //    WorkPieceInfoManager.WorkPiecePushOff(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //}
                //else
                //{
                //    //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表
                //    WorkPieceInfoManager.WorkPiecePushOff(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void button26_Click(object sender, EventArgs e)
        {
            try
            {
                MyTest myTest = new MyTest();
                Thread tskdataCapture = new Thread(myTest.DataCaptureStart);
                tskdataCapture.Start();
            }
            catch (Exception ex)
            {
                Log4NetHelper.WriteErrorLog(LogType.FormMain, "启动线程时----btn_StartUpAllThread_Click all报错:", ex);
            }
        }
        public WorkPieceLogMiddle GetCH4Info(string FullName, WorkPieceLogMiddle wplog)
        {
            try
            {
                string fileContent = File.ReadAllText(FullName);
                string[] lines2 = fileContent.Split('\n');
                bool IDCodeIndex = false;
                int Mcount = 0;
                int i = 0;
                int count = 0;
                foreach (string line in lines2)
                {
                    count++;
                    if (count == 4)
                    {//获取质量结果
                        var list = line.Split(' ');
                        if (list.Count() > 0)
                        {
                            var str = list[list.Count() - 1].ToString().Trim();
                            wplog.QualityStateStr = str.Equals("OK") ? "OK" : "NG";
                        }
                    }
                    // å¤„理每一行的逻辑
                    if (line.Contains("ID-Code"))//两个拧紧,每个前面都有ID-Code
                    {
                        i++;
                        IDCodeIndex = true;
                        Mcount = 0;
                    }
                    if (IDCodeIndex)
                    {
                        if (line.Contains(" M "))//第三个M行是拧紧数据
                        {//预拧紧力矩
                            Mcount++;
                            if (Mcount == 3)
                            {
                                i++;
                                var str = line.Replace("+", "").Replace("-", "");
                                var list = str.Split('M');
                                if (list.Count() == 4)
                                {
                                    if (i <= 2)
                                    {//CH1
                                        wplog.QualityOP30To2 = list[2].ToString().Trim();
                                    }
                                    else
                                    {//CH2
                                        wplog.QualityOP30To8 = list[2].ToString().Trim();
                                    }
                                }
                                IDCodeIndex = false;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode}CH4工位质量数据异常工件号:{(wplog.WorkPieceID == null ? "" : wplog.WorkPieceID)} æ–‡ä»¶åï¼š{FullName}:", ex);
            }
            return wplog;
        }
        public WorkPieceLogMiddle GetCH5Info(string FullName, WorkPieceLogMiddle wplog)
        {
            try
            {
                string fileContent = File.ReadAllText(FullName);
                string[] lines2 = fileContent.Split('\n');
                bool IDCodeIndex = false;
                int Mcount = 0;
                int i = 0;
                int count = 0;
                foreach (string line in lines2)
                {
                    count++;
                    if (count == 4)
                    {//获取质量结果
                        var list = line.Split(' ');
                        if (list.Count() > 0)
                        {
                            var str = list[list.Count() - 1].ToString().Trim();
                            wplog.QualityStateStr = str.Equals("OK") ? "OK" : "NG";
                        }
                    }
                    // å¤„理每一行的逻辑
                    if (line.Contains("ID-Code"))//两个拧紧,每个前面都有ID-Code
                    {
                        i++;
                        IDCodeIndex = true;
                        Mcount = 0;
                    }
                    if (IDCodeIndex)
                    {
                        if (line.Contains(" M "))//第三个M行是拧紧数据
                        {//最终力矩
                            Mcount++;
                            if (Mcount == 3)
                            {
                                var str = line.Replace("+", "").Replace("-", "");
                                var list = str.Split('M');
                                if (list.Count() == 4)
                                {
                                    if (i == 1)
                                    {//CH3
                                        wplog.QualityOP30To3 = list[2].ToString().Trim();
                                    }
                                    else
                                    {//CH4
                                        wplog.QualityOP30To9 = list[2].ToString().Trim();
                                    }
                                }
                                IDCodeIndex = false;
                            }
                        }
                    }
                    if (line.Contains(" MWSP "))
                    {//终拧紧力矩  ç»ˆæ‹§ç´§è§’度
                        var list = line.Split(new String[] { " MWS " }, StringSplitOptions.None);
                        if (list.Count() == 2)
                        {
                            if (i == 1)
                            {//CH3
                                wplog.QualityOP30To4 = list[1].ToString().Trim();
                            }
                            else
                            {//CH4
                                wplog.QualityOP30To10 = list[1].ToString().Trim();
                            }
                            var list2 = list[0].Split(new String[] { " W " }, StringSplitOptions.None);
                            if (list2.Count() == 2)
                            {
                                var str = list2[1].ToString();
                                if (i == 1)
                                {//CH3
                                    wplog.QualityOP30To5 = str.Substring(0, str.IndexOf("MWSP")).Trim();
                                }
                                else
                                {//CH4
                                    wplog.QualityOP30To11 = str.Substring(0, str.IndexOf("MWSP")).Trim();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode}CH5工位质量数据异常工件号:{(wplog.WorkPieceID == null ? "" : wplog.WorkPieceID)} æ–‡ä»¶åï¼š{FullName}:", ex);
            }
            return wplog;
        }
        private void button27_Click(object sender, EventArgs e)
        {
            try
            {
                #region OP80
                ////string str = "#123";
                ////str=str?.Replace("#", "");
                //WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                //string path = "C:\\Users\\SY-PC\\Desktop\\FO";//OP80的地址
                //var time = DateTimeHelper.GetDateTime();
                //DateTime? fileFindTime = null;
                //if (fileFindTime == null)
                //{
                //    fileFindTime = time.AddMinutes(-10);
                //}
                ////OP80 éœ€è¦æ‰«ææ–‡ä»¶è¯»å–质量信息
                ////扫描修改时间在上次扫描时间之前30秒到当前时间的之间的文件
                //List<FileInfo> files = new List<FileInfo>();
                //var newFiles = FileHelper.DetectNewFilesCSV(path, 3000000, fileFindTime.Value, time.AddHours(2));
                //foreach (var file in newFiles)
                //{
                //    files.Add((FileInfo)file);
                //}
                //files = files.OrderByDescending(o => o.LastWriteTime).ToList();
                //foreach (var file in files)
                //{//取倒序匹配的文件名为工件号的文件
                //    var datatable = CSVHelper.ReadCSVList(file.FullName);
                //    List<string> rowFirst = new List<string>();
                //    List<string> rowSecond = new List<string>();
                //    if (datatable.Count == 2)
                //    {
                //        rowFirst = datatable[0].Split(',').ToList();
                //        rowSecond = datatable[1].Split(',').ToList();
                //        if (rowSecond.Count < 11)
                //        {
                //            continue;
                //        }
                //        //日期和时间    æ‰¹å·/标识号    åµŒå¥—号/主轴号    æ“ä½œç¬¦    æ–‡æœ¬    æµ‹é‡æœº    è¿‡ç¨‹å‚æ•°    æµ‹é‡ç³»ç»Ÿ    è¿‡ç¨‹å‚数值    åºåˆ—号    é›¶ä»¶è¯†åˆ«å·    1
                //        OP80Info oP80Info = new OP80Info();
                //        oP80Info.日期和时间 = rowSecond[0];
                //        oP80Info.批号 = rowSecond[1];
                //        oP80Info.嵌套号 = rowSecond[2];
                //        oP80Info.操作符 = rowSecond[3];
                //        oP80Info.文本 = rowSecond[4];
                //        oP80Info.测量机 = rowSecond[5];
                //        oP80Info.过程参数 = rowSecond[6];
                //        oP80Info.测量系统 = rowSecond[7];
                //        oP80Info.过程参数值 = rowSecond[8];
                //        oP80Info.序列号 = rowSecond[9];
                //        oP80Info.零件识别号 = rowSecond[10];
                //        for (int i = 1; i <= (rowSecond.Count - 11) / 10; i++)
                //        {
                //            if (rowSecond.Count < (11 + i * 10))
                //            {
                //                break;
                //            }
                //            //名称 ç›¸å¯¹å€¼ ç›¸å¯¹å€¼å•位 ç»å¯¹å€¼ ç»å¯¹å€¼å•位 åä¹‰å€¼ ä¸Šé™ ä¸‹é™  çŠ¶æ€/等级 åˆ†éš”符
                //            OP80ItemInfo item = new OP80ItemInfo();
                //            item.分隔符 = rowSecond[1 + i * 10];
                //            item.名称 = rowSecond[2 + i * 10];
                //            item.相对值 = rowSecond[3 + i * 10];
                //            item.相对值单位 = rowSecond[4 + i * 10];
                //            item.绝对值 = rowSecond[5 + i * 10];
                //            item.绝对值单位 = rowSecond[6 + i * 10];
                //            item.名义值 = rowSecond[7 + i * 10];
                //            item.上限 = rowSecond[8 + i * 10];
                //            item.下限 = rowSecond[9 + i * 10];
                //            item.状态 = rowSecond[10 + i * 10];
                //            oP80Info.OP80ItemInfolist.Add(item);
                //            if (item.名称.Equals("Weight Class") || item.名称.Equals("Weight Small End")
                //                || item.名称.Equals("Weight Big End") || item.名称.Equals("Dime Small_End Class")
                //                || item.名称.Equals("Dime Big_End Class"))
                //            {
                //            }
                //            else
                //            {
                //                if (!string.IsNullOrEmpty(item.状态))
                //                {
                //                    oP80Info.OP80ItemStatusInfolist.Add(item);
                //                }
                //            }
                //        }
                //        if (oP80Info.OP80ItemStatusInfolist.Count > 0)
                //        {
                //            if (oP80Info.OP80ItemStatusInfolist.Any(o => !o.状态.Equals("OK")))
                //            {
                //                wplog.QualityStateStr = "NG";
                //            }
                //            else
                //            {
                //                wplog.QualityStateStr = "OK";
                //            }
                //        }
                //        else
                //        {
                //            wplog.QualityStateStr = "OK";
                //        }
                //        wplog.OP80NewCode = oP80Info.批号?.Replace("#", "");
                //        //大头重量
                //        wplog.QualityOP80To1 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Weight Big End")).FirstOrDefault()?.绝对值;
                //        //小头重量
                //        wplog.QualityOP80To2 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Weight Small End")).FirstOrDefault()?.绝对值;
                //        //总重
                //        wplog.QualityOP80To3 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Total Weight")).FirstOrDefault()?.绝对值;
                //        //弯曲
                //        wplog.QualityOP80To4 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Bend to A")).FirstOrDefault()?.绝对值;
                //        //扭度
                //        wplog.QualityOP80To5 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Twist to A")).FirstOrDefault()?.绝对值;
                //        //大头垂直度
                //        wplog.QualityOP80To6 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Big_End_C_Squareness")).FirstOrDefault()?.绝对值;
                //        //小头垂直度
                //        wplog.QualityOP80To10 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Sma_End_C_Squareness")).FirstOrDefault()?.绝对值;
                //        //大头孔分组级别
                //        wplog.QualityOP80To7 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Dime Big_End Class")).FirstOrDefault()?.状态;
                //        //小头孔分组级别
                //        wplog.QualityOP80To8 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Dime Small_End Class")).FirstOrDefault()?.状态;
                //        //重量组别
                //        wplog.QualityOP80To9 = oP80Info.OP80ItemInfolist.Where(o => o.名称.Equals("Weight Class")).FirstOrDefault()?.状态;
                //    }
                //    else
                //    {
                //        wplog.Remarks = (wplog.Remarks ?? "") + $"OP80下线完成读取文件{file.FullName}异常,行数不是2行";
                //    }
                //    fileFindTime = files[0].LastWriteTime;
                //    break;
                //}
                #endregion
                #region OP30
                //////var QualityStateStr = FileHelper.ReadPdfFileForSpire(textBox10.Text, "Result");
                //////var QualityOP30To6 = FileHelper.ReadPdfFileForSpire(textBox10.Text, "Y-Maximum");//衬套压装力矩
                //////var QualityOP30To7 = FileHelper.ReadPdfFileForSpire(textBox10.Text, "Block X");//衬套压装位移
                ////var dt = CSVHelper.ReadCSV(textBox10.Text);
                //////var datatable = CSVHelper.ReadCSVList(textBox10.Text);
                //////List<string> rowFirst = new List<string>();
                //////List<string> rowSecond = new List<string>();
                //////if(datatable.Count==2)
                //////{
                //////    rowFirst = datatable[0].Split(',').ToList();
                //////    rowSecond = datatable[1].Split(',').ToList();
                //////}
                //string d = DateTime.Now.AddHours(-10).ToString("yyyy-MM-dd_HH");
                ////扫描共享目录并将新的文件扫描返回  ä¸€èˆ¬èŠ‚æ‹åœ¨15秒左右(可以确认一下)
                ////扫描修改时间在上次扫描时间之前10秒到当前时间的之间的文件
                //var startTime = DateTimeHelper.GetDateTime().AddYears(-1);
                //var endTime = DateTimeHelper.GetDateTime();
                ////var newFiles = FileHelper.DetectNewFilesCSV(textBox10.Text+@"\"+d, 10, Convert.ToDateTime(startTime), endTime);
                ////List<FileInfo> files = new List<FileInfo>();
                ////foreach (var file in newFiles)
                ////{
                ////    files.Add((FileInfo)file);
                ////}
                ////files = files.OrderByDescending(o => o.LastAccessTime).ToList();
                ////foreach (var file in files)
                ////{
                ////    //var datatable = CSVHelper.ReadCSV(file.FullName);
                ////}
                //var newFiles = FileHelper.DetectNewFiles(textBox10.Text, "*.txt", 10, Convert.ToDateTime(startTime), endTime);
                //List<FileInfo> files = new List<FileInfo>();
                //foreach (var file in newFiles)
                //{
                //    files.Add((FileInfo)file);
                //}
                //files = files.OrderByDescending(o => o.LastAccessTime).ToList();
                //foreach (var file in files)
                //{
                //    //string[] lines = File.ReadAllLines(file.FullName);
                //    //foreach (string line in lines)
                //    //{
                //    //    // å¤„理每一行的逻辑
                //    //}
                //    ////var datatable = CSVHelper.ReadCSV(file.FullName);
                //    //using (StreamReader reader = new StreamReader(file.FullName))
                //    //{
                //    //    string line;
                //    //    while ((line = reader.ReadLine()) != null)
                //    //    {
                //    //        // å¤„理每一行的逻辑
                //    //    }
                //    //}
                //    string fileContent = File.ReadAllText(file.FullName);
                //    string[] lines2 = fileContent.Split('\n');
                //    bool IDCodeIndex = false;
                //    int Mcount = 0;
                //    foreach (string line in lines2)
                //    {
                //        // å¤„理每一行的逻辑
                //        if (line.Contains("ID-Code"))//两个拧紧,每个前面都有ID-Code
                //        {
                //            IDCodeIndex = true;
                //            Mcount = 0;
                //        }
                //        if(IDCodeIndex)
                //        {
                //            if (line.Contains(" M "))//第三个M行是拧紧数据
                //            {
                //                Mcount++;
                //                if(Mcount==3)
                //                {
                //                    var str=line.Replace("+", "").Replace("-", "");
                //                    var list = str.Split('M');
                //                    if(list.Count()==4)
                //                    {
                //                    }
                //                    IDCodeIndex = false;
                //                }
                //            }
                //        }
                //    }
                //}
                #endregion
                #region OP60
                WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                string path = "C:\\Users\\SY-PC\\Desktop\\FO";//OP80的地址
                var time = DateTimeHelper.GetDateTime();
                DateTime? fileFindTime = null;
                if (fileFindTime == null)
                {
                    fileFindTime = time.AddMinutes(-100);
                }
                //OP60 éœ€è¦æ‰«ææ–‡ä»¶è¯»å–质量信息
                //扫描修改时间在上次扫描时间之前30秒到当前时间的之间的文件
                List<FileInfo> files = new List<FileInfo>();
                var newFiles = FileHelper.DetectNewFiles(path, "*.dfq", 300000, fileFindTime.Value, time.AddHours(2));
                foreach (var file in newFiles)
                {
                    files.Add((FileInfo)file);
                }
                files = files.OrderByDescending(o => o.LastWriteTime).ToList();
                List<OP60Info> op60Infos = new List<OP60Info>();
                foreach (var file in files)
                {//取倒序匹配的文件名为工件号的文件
                    string DataCapturePointCode = "OP6002A";
                    if (file.Name.Contains("SP-" + DataCapturePointCode.Substring(DataCapturePointCode.Length - 1, 1)))
                    {
                    }
                    var datatable = CSVHelper.ReadCSVList(file.FullName);
                    if (datatable.Count < 106)
                    {//质量数据从106行开始
                    }
                    datatable.Reverse();
                    System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
                    byte[] byteArray = new byte[] { (byte)15 };
                    string strCharacter = asciiEncoding.GetString(byteArray);
                    var list = datatable[0].Split(new String[] { strCharacter }, StringSplitOptions.None);
                    byte[] byteArray2 = new byte[] { (byte)20 };
                    string strCharacter2 = asciiEncoding.GetString(byteArray2);
                    foreach (var item in list)
                    {
                        var listitem = item.Split(new String[] { strCharacter2 }, StringSplitOptions.None);
                        if (listitem.Count() == 3)
                        {
                            OP60Info info = new OP60Info();
                            info.datetime = listitem[2];
                            info.col2 = listitem[1];
                            info.value = listitem[0];
                            info.datetimeHandle = CommonManager.GetOP60Time(info.datetime);
                            op60Infos.Add(info);
                        }
                    }
                    if (op60Infos.Count() >= 2)
                    {
                        //if (op60QualityTime.HasValue)
                        {
                            //if (op60Infos[0].datetimeHandle > op60QualityTime.Value)
                            {
                                wplog.QualityOP60To1 = op60Infos[0].value;
                                wplog.QualityOP60To2 = op60Infos[1].value;
                            }
                        }
                        //op60QualityTime = op60Infos[0].datetimeHandle;
                        break;
                    }
                }
                #endregion
                #region QITA
                //var WorkingProcedure = "OP20";
                //var EquipmentID = "EOP20";
                //var DataCapturePointCode = "OP2002A";
                ////var DataCapturePointCode = "OP3002CH3";
                //WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
                //wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
                //wplog.WorkingProcedure = WorkingProcedure;
                //wplog.EquipmentID = EquipmentID;
                //wplog.Remarks = WorkingProcedure;
                //wplog.MonitoringPoint = DataCapturePointCode;
                //wplog.WorkPieceID = "DZ045L2312150101041CAO";
                //wplog.CreatedTime = DateTimeHelper.GetDateTime();
                //wplog.CreatedUserName = DataCapturePointCode;
                //wplog.UpdatedUserName = Environment.MachineName + "自动" + Thread.CurrentThread.ManagedThreadId.ToString();
                //wplog.UpdatedTime = DateTimeHelper.GetDateTime();
                //wplog.IsDeleted = false;
                //wplog.QualityStateStr = "OK";
                ////try
                ////{
                ////    using (DbModel db = new DbModel())
                ////    {
                ////        var info = db.KnifeToolEquipmentInfo.Where(o => o.EquipmentID.Equals(wplog.EquipmentID)).ToList();
                ////        foreach (var item in info)
                ////        {
                ////            item.CurrentLife++;
                ////            item.UpdatedTime = DateTime.Now;
                ////        }
                ////        //db.SaveChanges();
                ////    }
                ////}
                ////catch (Exception ex)
                ////{
                ////}
                ////wplog.Remarks = "";
                ////wplog.Remarks = (wplog.Remarks ?? "") + $"质量:{wplog.Remarks ?? "空"}";
                ////wplog.Remarks = null;
                ////wplog.Remarks = (wplog.Remarks ?? "") + $"质量:{wplog.Remarks ?? "空"}";
                ////wplog.Remarks = "111";
                ////wplog.Remarks = (wplog.Remarks ?? "") + $"质量:{wplog.Remarks ?? "空"}";
                ////wplog = GetCH4Info(textBox10.Text, wplog);
                //WorkPieceInfoManager.QualityInfoComplete(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
                ////WorkPieceLogMiddle log = new WorkPieceLogMiddle();
                ////log = GetCH5Info(textBox10.Text, log);
                #endregion
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
    public enum test
    {
        test1,
        test2 = 3,
        test3 = 4
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormMain.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <metadata name="Threadcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="Threadcname.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="Column6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="EquipmentID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="WorkingProcedure.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="DataCapturePointCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="DataCapturePointCname.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="DataCaptureType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="DataCapturePLCType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="PLCIP.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="PLCPort.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="DataCaptureColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="DataCaptureColumnType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn9.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
  <metadata name="dataGridViewTextBoxColumn10.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
</root>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormTest.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,94 @@

namespace iWare_SCADA_DataCaptureV3
{
    partial class FormTest
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.button1 = new System.Windows.Forms.Button();
            this.dataGridView1 = new System.Windows.Forms.DataGridView();
            this.button2 = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
            this.SuspendLayout();
            //
            // openFileDialog1
            //
            this.openFileDialog1.FileName = "openFileDialog1";
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(126, 30);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 0;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // dataGridView1
            //
            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Location = new System.Drawing.Point(59, 128);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.RowTemplate.Height = 23;
            this.dataGridView1.Size = new System.Drawing.Size(707, 150);
            this.dataGridView1.TabIndex = 1;
            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(282, 30);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(75, 23);
            this.button2.TabIndex = 0;
            this.button2.Text = "button1";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // FormTest
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(800, 450);
            this.Controls.Add(this.dataGridView1);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Name = "FormTest";
            this.Text = "FormTest";
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
            this.ResumeLayout(false);
        }
        #endregion
        private System.Windows.Forms.OpenFileDialog openFileDialog1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.DataGridView dataGridView1;
        private System.Windows.Forms.Button button2;
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormTest.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
using iWare_SCADA_BusinessLogical.BLL;
using iWare_SCADA_BusinessLogical;
using iWare_SCADA_BusinessLogical.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using iWare_SCADA_Model.TableModelSC;
namespace iWare_SCADA_DataCaptureV3
{
    public partial class FormTest : Form
    {
        public FormTest()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                AlarmLogManager.UpdateAlarmLogs(new AlarmLog());
                //openFileDialog1.Filter = "Excel2003(*.xls)|*.csv|Excel2007(*.xlsx)|*.xlsx";
                //if (openFileDialog1.ShowDialog() != DialogResult.OK)
                //    return;
                //string FileNameWrite = openFileDialog1.FileName;
                //var datatable = CSVHelper.ReadCSV(FileNameWrite);
                //this.dataGridView1.DataSource = datatable;
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                var log2=AlarmLogManager.GetAlarmLogs();
                   //var log = WorkPieceLogManager.GetAlarmLog();
                this.dataGridView1.DataSource = log2;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/FormTest.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>17, 17</value>
  </metadata>
</root>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Program.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace iWare_SCADA_DataCaptureV3
{
    static class Program
    {
        /// <summary>
        /// åº”用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Yitter.IdGenerator.IdGeneratorOptions options = new Yitter.IdGenerator.IdGeneratorOptions(1);
            Yitter.IdGenerator.YitIdHelper.SetIdGenerator(options);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
            //Application.Run(new FormTest());
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/AssemblyInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// æœ‰å…³ç¨‹åºé›†çš„一般信息由以下
// æŽ§åˆ¶ã€‚更改这些特性值可修改
// ä¸Žç¨‹åºé›†å…³è”的信息。
[assembly: AssemblyTitle("iWare_SCADA_DataCaptureV3")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("iWare_SCADA_DataCaptureV3")]
[assembly: AssemblyCopyright("Copyright Â©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// å°† ComVisible è®¾ç½®ä¸º false ä¼šä½¿æ­¤ç¨‹åºé›†ä¸­çš„类型
//对 COM ç»„件不可见。如果需要从 COM è®¿é—®æ­¤ç¨‹åºé›†ä¸­çš„类型
//请将此类型的 ComVisible ç‰¹æ€§è®¾ç½®ä¸º true。
[assembly: ComVisible(false)]
// å¦‚果此项目向 COM å…¬å¼€ï¼Œåˆ™ä¸‹åˆ— GUID ç”¨äºŽç±»åž‹åº“çš„ ID
[assembly: Guid("29ff4f3c-b142-4ba4-85e8-83241232f709")]
// ç¨‹åºé›†çš„版本信息由下列四个值组成:
//
//      ä¸»ç‰ˆæœ¬
//      æ¬¡ç‰ˆæœ¬
//      ç”Ÿæˆå·
//      ä¿®è®¢å·
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/Resources.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     æ­¤ä»£ç ç”±å·¥å…·ç”Ÿæˆã€‚
//     è¿è¡Œæ—¶ç‰ˆæœ¬:4.0.30319.42000
//
//     å¯¹æ­¤æ–‡ä»¶çš„æ›´æ”¹å¯èƒ½ä¼šå¯¼è‡´ä¸æ­£ç¡®çš„行为,并且如果
//     é‡æ–°ç”Ÿæˆä»£ç ï¼Œè¿™äº›æ›´æ”¹å°†ä¼šä¸¢å¤±ã€‚
// </auto-generated>
//------------------------------------------------------------------------------
namespace iWare_SCADA_DataCapture_Test.Properties {
    using System;
    /// <summary>
    ///   ä¸€ä¸ªå¼ºç±»åž‹çš„资源类,用于查找本地化的字符串等。
    /// </summary>
    // æ­¤ç±»æ˜¯ç”± StronglyTypedResourceBuilder
    // ç±»é€šè¿‡ç±»ä¼¼äºŽ ResGen æˆ– Visual Studio çš„工具自动生成的。
    // è‹¥è¦æ·»åŠ æˆ–ç§»é™¤æˆå‘˜ï¼Œè¯·ç¼–è¾‘ .ResX æ–‡ä»¶ï¼Œç„¶åŽé‡æ–°è¿è¡Œ ResGen
    // (以 /str ä½œä¸ºå‘½ä»¤é€‰é¡¹),或重新生成 VS é¡¹ç›®ã€‚
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {
        private static global::System.Resources.ResourceManager resourceMan;
        private static global::System.Globalization.CultureInfo resourceCulture;
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }
        /// <summary>
        ///   è¿”回此类使用的缓存的 ResourceManager å®žä¾‹ã€‚
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("iWare_SCADA_DataCapture_Test.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        /// <summary>
        ///   é‡å†™å½“前线程的 CurrentUICulture å±žæ€§ï¼Œå¯¹
        ///   ä½¿ç”¨æ­¤å¼ºç±»åž‹èµ„源类的所有资源查找执行重写。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/Resources.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/Settings.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     æ­¤ä»£ç ç”±å·¥å…·ç”Ÿæˆã€‚
//     è¿è¡Œæ—¶ç‰ˆæœ¬:4.0.30319.42000
//
//     å¯¹æ­¤æ–‡ä»¶çš„æ›´æ”¹å¯èƒ½ä¼šå¯¼è‡´ä¸æ­£ç¡®çš„行为,并且如果
//     é‡æ–°ç”Ÿæˆä»£ç ï¼Œè¿™äº›æ›´æ”¹å°†ä¼šä¸¢å¤±ã€‚
// </auto-generated>
//------------------------------------------------------------------------------
namespace iWare_SCADA_DataCapture_Test.Properties {
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
        public static Settings Default {
            get {
                return defaultInstance;
            }
        }
    }
}
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/Properties/Settings.settings
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
  <Profiles>
    <Profile Name="(Default)" />
  </Profiles>
  <Settings />
</SettingsFile>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test.csproj
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,182 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{E07C6E80-A875-482C-9427-BA5703DFF7EB}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <RootNamespace>iWare_SCADA_DataCapture_Test</RootNamespace>
    <AssemblyName>iWare_SCADA_DataCapture_Test</AssemblyName>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <Deterministic>true</Deterministic>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
    <IsWebBootstrapper>false</IsWebBootstrapper>
    <PublishUrl>C:\2.ProjectFolder\安装文件\</PublishUrl>
    <Install>true</Install>
    <InstallFrom>Disk</InstallFrom>
    <UpdateEnabled>false</UpdateEnabled>
    <UpdateMode>Foreground</UpdateMode>
    <UpdateInterval>7</UpdateInterval>
    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    <UpdatePeriodically>false</UpdatePeriodically>
    <UpdateRequired>false</UpdateRequired>
    <MapFileExtensions>true</MapFileExtensions>
    <ApplicationRevision>3</ApplicationRevision>
    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
    <UseApplicationTrust>false</UseApplicationTrust>
    <PublishWizardCompleted>true</PublishWizardCompleted>
    <BootstrapperEnabled>true</BootstrapperEnabled>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup>
    <ManifestCertificateThumbprint>FD4004E500823F6C9EAF9596D7157A90E034751E</ManifestCertificateThumbprint>
  </PropertyGroup>
  <PropertyGroup>
    <ManifestKeyFile>iWare_SCADA_DataCaptureV3_TemporaryKey.pfx</ManifestKeyFile>
  </PropertyGroup>
  <PropertyGroup>
    <GenerateManifests>true</GenerateManifests>
  </PropertyGroup>
  <PropertyGroup>
    <SignManifests>false</SignManifests>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
      <HintPath>..\packages\BouncyCastle.1.8.9\lib\BouncyCastle.Crypto.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
    </Reference>
    <Reference Include="itextsharp, Version=5.5.13.3, Culture=neutral, PublicKeyToken=8354ae6d2174ddca, processorArchitecture=MSIL">
      <HintPath>..\packages\iTextSharp.5.5.13.3\lib\itextsharp.dll</HintPath>
    </Reference>
    <Reference Include="System">
      <HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.dll</HintPath>
    </Reference>
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="Yitter.IdGenerator.Net45, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\Yitter.IdGenerator.Net45.1.0.0\lib\net452\Yitter.IdGenerator.Net45.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="FormMain.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="FormMain.Designer.cs">
      <DependentUpon>FormMain.cs</DependentUpon>
    </Compile>
    <Compile Include="FormTest.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="FormTest.Designer.cs">
      <DependentUpon>FormTest.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <EmbeddedResource Include="FormMain.resx">
      <DependentUpon>FormMain.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="FormTest.resx">
      <DependentUpon>FormTest.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
      <DesignTime>True</DesignTime>
    </Compile>
    <None Include="App - ç”Ÿäº§çŽ¯å¢ƒ.config">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Include="App - æœ¬æœºçŽ¯å¢ƒ.config">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Include="iWare_SCADA_DataCaptureV3_TemporaryKey.pfx" />
    <None Include="packages.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\iWare_SCADA_BusinessLogical\iWare_SCADA_BusinessLogical.csproj">
      <Project>{32708f19-fe1a-48f5-b373-8e1c776f216c}</Project>
      <Name>iWare_SCADA_BusinessLogical</Name>
    </ProjectReference>
    <ProjectReference Include="..\iWare_SCADA_Model\iWare_SCADA_Model.csproj">
      <Project>{91c185de-15ab-44ae-b585-53799fc51be0}</Project>
      <Name>iWare_SCADA_Model</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
      <Visible>False</Visible>
      <ProductName>Microsoft .NET Framework 4.7.2 %28x86 å’Œ x64%29</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>这台计算机上缺少此项目引用的 NuGet ç¨‹åºåŒ…。使用“NuGet ç¨‹åºåŒ…还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
    <Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
  </Target>
  <Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
</Project>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_DataCapture_Test/packages.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="BouncyCastle" version="1.8.9" targetFramework="net472" />
  <package id="EntityFramework" version="6.4.4" targetFramework="net472" />
  <package id="iTextSharp" version="5.5.13.3" targetFramework="net472" />
  <package id="Yitter.IdGenerator.Net45" version="1.0.0" targetFramework="net472" />
</packages>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/App.Config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="SCTest" connectionString="data source=.;initial catalog=SCTest_new;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
    <add name="Model1" connectionString="data source=.;initial catalog=SCADA_DF22001_CORE;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
    <add name="Model2" connectionString="data source=.;initial catalog=SCADA_DF22001_CORE;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
    <add name="Model3" connectionString="data source=82.156.32.44;initial catalog=iWare.SCADA;persist security info=True;user id=sa;password=123abc.com;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
    <add name="Entities" connectionString="metadata=res://*/test.Model1.csdl|res://*/test.Model1.ssdl|res://*/test.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=82.156.32.44;initial catalog=iWare.SCADA;persist security info=True;user id=sa;password=123abc.com;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="Model11" connectionString="data source=82.156.32.44;initial catalog=iWare.SCADA;persist security info=True;user id=sa;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
    <add name="Model12" connectionString="data source=10.10.40.166;initial catalog=iWare.SCADA;persist security info=True;user id=sa;password=123abc.com;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/EnumberEntity.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWare_SCADA_Model
{
    /// <summary>
    /// æžšä¸¾å®žä½“ç±»
    /// </summary>
    public class EnumberEntity
    {
        /// <summary>
        /// æžšä¸¾çš„æè¿°
        /// </summary>
        public string Desction { set; get; }
        /// <summary>
        /// æžšä¸¾åç§°
        /// </summary>
        public string EnumName { set; get; }
        /// <summary>
        /// æžšä¸¾å¯¹è±¡çš„值
        /// </summary>
        public int EnumValue { set; get; }
    }
}
在上述文件截断后对比
DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/Enums.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/ListItem.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/MessageModel.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/MiddleModel/ThreadStatusMonitorMiddle.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/MiddleModel/WorkPieceLogMiddle.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/PLCDataCapture/BasePlcParam.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/PLCDataCapture/HslCommunicationParam.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/Properties/AssemblyInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/SystemValue.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/DataCaptureColumnConfig.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/DataCaptureConfig.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/DbModel.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/EquipmentBaseInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/EquipmentCurrentMonitor.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/EquipmentWorkingLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/KnifeToolBaseInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/KnifeToolDataMonitor.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/QualityDataInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/SystemLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/WorkPieceInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/WorkPieceInfoLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel - 副本/WorkPieceLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/DataCaptureColumnConfig.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/DataCaptureConfig.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/DbModel.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/EquipmentBaseInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/EquipmentCurrentMonitor.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/EquipmentFailureCode.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/EquipmentWorkingLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolBaseInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolDataMonitor.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolEquipmentInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolEquipmentInfoLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolEquipmentMonitor.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/KnifeToolEquipmentUpdateLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/Model1.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/QualityDataInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/QualityDataInfoLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/SystemLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/ThreadStatusMonitor.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/WorkPieceInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/WorkPieceInfoLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/WorkPieceLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/WorkPieceProcess.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModel/v_get_equipment_alert.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/AlarmLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/CNCStatus.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/Count.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/CumulativeTime.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/CurrentToolNumber.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/FeedAndSpindle.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/Load.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/OEE.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/Postion.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/ProgramBlock.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/ProgramInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/SCModel.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/TableModelSC/TimeData.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/iWare_SCADA_Model.csproj DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/packages.config DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/DataCaptureColumnConfig.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/DataCaptureConfig.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/EquipmentBaseInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/EquipmentCurrentMonitor.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/EquipmentWorkingLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/Model1.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/Model2.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/Model3.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/QualityDataInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/QualityDataInfoLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/WorkPieceInfo.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/WorkPieceInfoLog.cs DataCapture/iWare_SCADA_DataCapture_Test/iWare_SCADA_Model/test/WorkPieceLog.cs