diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs index 4d9af8e..ad1a905 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs @@ -1,35 +1,27 @@ -using DataBlockHelper; -using DataBlockHelper.DBHelpers; - -using DevExpress.XtraEditors.Filtering.Templates; - +using DataBlockHelper.DBHelpers; using Mesnac.Action.Base; using Mesnac.Controls.Base; using Mesnac.Controls.ChemicalWeighing; using Mesnac.Controls.Default; using Mesnac.Controls.Feeding; using Mesnac.Core.Service; -using Microsoft.Office.Interop.Excel; - using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Data.SqlTypes; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; -using HslCommunication; using IAction = Mesnac.Action.Base.IAction; using Timer = System.Windows.Forms.Timer; +using DataTable = System.Data.DataTable; using Mesnac.Action.ChemicalWeighing.LjMaterial; using System.Data; using Mesnac.Action.ChemicalWeighing.MainDetailControl.Entity; using Mesnac.Action.ChemicalWeighing.RgvPlc; using System.Reflection; -using System.Security.AccessControl; +using DataBlockHelper; namespace Mesnac.Action.ChemicalWeighing.MainDetailControl { @@ -38,15 +30,23 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl #region plc读取类 Timer 线程字典 DataTable - private DB2102Helper DB2102; - private DB2103Helper DB2103; - private DB2107Helper DB2107; + private DB2102Helper DB2102 = new DB2102Helper(); + private DB2103Helper DB2103 = new DB2103Helper(); + private DB2107Helper DB2107 = new DB2107Helper(); private ConcurrentDictionary conCurrentCache = new ConcurrentDictionary(); private Timer timer; - private Timer timer1; - System.Data.DataTable ParametersWithPCTable = new System.Data.DataTable(); + DataTable ParametersWithPCTable = new DataTable(); + DataTable AllAlarmTable = new DataTable(); + DataTable LogAlarmTable = new DataTable(); + DataTable NowAlarmTable = new DataTable(); + DataTable TempTable = new DataTable(); + + byte[] b2; + byte[] b3; + byte[] b7; + #endregion #region 控件变量 @@ -77,8 +77,10 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl //this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "AlarmForm").FirstOrDefault(); //获取物料数据控件 Controls = GetAllControls(); + //更细自定义控件报警灯 FillControlHslLanternAlarm(); + MCWatchDog =Controls.FirstOrDefault(x => x.Name == "MCWatchDog") as MCLabel; ParametersWithPCTable.Columns.Add("id", typeof(string)); @@ -93,17 +95,32 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl ParametersWithPCTable.Columns.Add("currnet", typeof(float)); ParametersWithPCTable.Columns.Add("pressure", typeof(float)); + LogAlarmTable.Columns.Add("Equip_Name", typeof(string)); + LogAlarmTable.Columns.Add("Alarm_ID", typeof(int)); + LogAlarmTable.Columns.Add("Alarm_Cn_Info", typeof(string)); + LogAlarmTable.Columns.Add("Alarm_Other_Info", typeof(string)); + LogAlarmTable.Columns.Add("Alarm_Occur_Time", typeof(string)); + LogAlarmTable.Columns.Add("Alarm_Claer_Time", typeof(string)); + LogAlarmTable.Columns.Add("Alarm_Status", typeof(int)); + LogAlarmTable.Columns.Add("Alarm_GUID", typeof(string)); + + NowAlarmTable.Columns.Add("报警设备", typeof(string)); + NowAlarmTable.Columns.Add("报警内容", typeof(string)); + NowAlarmTable.Columns.Add("报警时间", typeof(string)); + + TempTable.Columns.Add("报警设备", typeof(string)); + TempTable.Columns.Add("报警内容", typeof(string)); + TempTable.Columns.Add("报警时间", typeof(string)); + + AllAlarmTable = DBHelp.GetTable(@"SELECT Alarm_ID, Alarm_Block, Alarm_Word, Alarm_Bit, Alarm_Cn_Info, Alarm_Other_Info FROM Pmt_Alarm"); + SetControl(); - + timer = new Timer(); timer.Interval = 1000; timer.Enabled = true; timer.Tick += GetPlcValue;//添加事件 - timer1 = new Timer(); - timer1.Interval = 2000; - timer1.Enabled = true; - timer1.Tick += new EventHandler(GetDataFromPLCToForm);//添加事件 } @@ -112,22 +129,6 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl #endregion - private void FillControlHslLanternAlarm() - { - hslAlarmEntity = new HslLanternAlarmEntity(); - var sourceType= hslAlarmEntity.GetType(); - PropertyInfo[] sourcePropertyInfoList = sourceType.GetProperties(); - foreach ( PropertyInfo sourceProperty in sourcePropertyInfoList) - { - string name = sourceProperty.Name; - var pro= Controls.FirstOrDefault(x => x.Name == name) as HslLanternAlarm; - sourceProperty.SetValue(hslAlarmEntity, pro); - } - - } - - - #region 线程新建,计时器调用 /// @@ -150,11 +151,10 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl DB2102 = new DB2102Helper(); DB2103 = new DB2103Helper(); DB2107 = new DB2107Helper(); - + NewThreadDb2102(); NewThreadDb2103(); NewThreadDb2107(); - //SetHslLanternAlarm(hslAlarmEntity.HslLanternAlarm3, list[2].Error); //SetHslLanternAlarm(hslAlarmEntity.HslLanternAlarm4, list[3].Error); @@ -191,7 +191,6 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl /// private void GetPlcValue(object sender, EventArgs e) { - int x = GetAllDbMCControlsByOption(DbOptionTypes.QueryAndModify).Count; if (GetAllDbMCControlsByOption(DbOptionTypes.QueryAndModify).Count == 0) { timer.Stop(); @@ -209,9 +208,76 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl SetHslLanternAlarm(hslAlarmEntity.HslLanternAlarm7, list[6].Error); SetHslLanternAlarm(hslAlarmEntity.HslLanternAlarm8, list[7].Error); + + ThreadPool.QueueUserWorkItem(new WaitCallback(NewThread)); + AlarmControl(); + //现有报警刷新 + + } + + + #endregion + + #region 报警管理 + + private void AlarmControl() + { + //DataTable TempTable = DBHelp.GetTable(@"SELECT + // t2.Alarm_Other_Info, + // t2.Alarm_Cn_Info, + // t1.Alarm_OccurTime + // FROM + // LR_Alarmlog t1 + // LEFT JOIN Pmt_Alarm t2 ON t1.Alarm_ID = t2.Alarm_ID + // WHERE + // t1.Alarm_Status = 1 + // ORDER BY + // t1.Alarm_OccurTime desc"); + + b2 = DB2102.bytes; + b3 = DB2103.bytes; + b7 = DB2107.bytes; + + TempTable.Rows.Clear(); + + string nowtime = DateTime.Now.ToString(); + //报警点位遍历 + foreach (DataRow rows in AllAlarmTable.Rows) + { + if ((int)rows["Alarm_Block"] == 2102 && b2[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true) + { + DataRow dr = TempTable.NewRow(); + dr[0] = rows["Alarm_Cn_Info"]; + dr[1] = rows["Alarm_Other_Info"]; + dr[2] = nowtime; + TempTable.Rows.Add(dr); + } + else if ((int)rows["Alarm_Block"] == 2107 && b7[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true) + { + DataRow dr = TempTable.NewRow(); + dr[0] = rows["Alarm_Cn_Info"]; + dr[1] = rows["Alarm_Other_Info"]; + dr[2] = nowtime; + TempTable.Rows.Add(dr); + } + else if ((int)rows["Alarm_Block"] == 2103 && b3[(int)rows["Alarm_Word"]].GetBit((int)rows["Alarm_bit"]) == true) + { + DataRow dr = TempTable.NewRow(); + dr[0] = rows["Alarm_Cn_Info"]; + dr[1] = rows["Alarm_Other_Info"]; + dr[2] = nowtime; + TempTable.Rows.Add(dr); + } + } + + if (this.AlarmForm != null && this.AlarmForm.BaseControl != null) + { + this.AlarmForm.BaseControl.BindDataSource = null; + this.AlarmForm.BaseControl.BindDataSource = TempTable; + } } #endregion @@ -588,6 +654,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl /// private void NewThreadDb2103() { + PlcReadTemp.DM1DRY1_ACT_Speed_Set = DB2103.DM1DRY1.ACT_Speed; PlcReadTemp.DM1DRY2_ACT_Speed_Set = DB2103.DM1DRY2.ACT_Speed; PlcReadTemp.DM1DRY3_ACT_Speed_Set = DB2103.DM1DRY3.ACT_Speed; @@ -1254,6 +1321,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl float current = (float)Math.Round(Convert.ToSingle(row["currnet"]), 2); float pressure = (float)Math.Round(Convert.ToSingle(row["pressure"]), 2); + //根据ID对应一组控件 switch (id) { case "Dryer0": @@ -1514,6 +1582,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl break; default: break; } + } } @@ -2157,20 +2226,6 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl } } - - public void SetHslLanternAlarm(HslLanternAlarm lanternAlarm, bool error) - { - - - if (lanternAlarm.IsAlarm == error) - { - return; - } - - lanternAlarm.IsAlarm = error; - - } - public SwitchLight GetSwitchLight(string name) { return Controls.First(x => x.Name == name) as SwitchLight; @@ -2352,45 +2407,29 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl return Controls.First(x => x.Name == name) as ControlCabinet; } - #endregion - - #region 报警信号处理 - - /// - /// 报警刷新 - /// - /// - /// - public void GetDataFromPLCToForm(object source, EventArgs e) + public void SetHslLanternAlarm(HslLanternAlarm lanternAlarm, bool error) { - if (GetAllDbMCControlsByOption(DbOptionTypes.InitData).Count == 0) + + if (lanternAlarm.IsAlarm == error) { - timer1.Stop(); - timer1.Dispose(); + return; } - System.Data.DataTable AlarmTable = DBHelp.GetTable(@"SELECT - t2.Alarm_ID, - t2.Alarm_Other_Info, - t2.Alarm_Block, - t2.Alarm_Word, - t2.Alarm_Bit, - t1.Alarm_OccurTime, - t1.Alarm_Status - FROM - LR_Alarmlog t1 - LEFT JOIN Pmt_Alarm t2 ON t1.Alarm_ID = t2.Alarm_ID - WHERE - t1.Alarm_Status = 1 - ORDER BY - t1.Alarm_OccurTime desc"); + lanternAlarm.IsAlarm = error; + + } - if (this.AlarmForm != null && this.AlarmForm.BaseControl != null) + private void FillControlHslLanternAlarm() + { + hslAlarmEntity = new HslLanternAlarmEntity(); + var sourceType = hslAlarmEntity.GetType(); + PropertyInfo[] sourcePropertyInfoList = sourceType.GetProperties(); + foreach (PropertyInfo sourceProperty in sourcePropertyInfoList) { - this.AlarmForm.BaseControl.BindDataSource = null; - this.AlarmForm.BaseControl.BindDataSource = AlarmTable; - //DBLog("成功!"); + string name = sourceProperty.Name; + var pro = Controls.FirstOrDefault(x => x.Name == name) as HslLanternAlarm; + sourceProperty.SetValue(hslAlarmEntity, pro); } } diff --git a/DataBlockHelper/DBHelpers/DB2102Helper.cs b/DataBlockHelper/DBHelpers/DB2102Helper.cs index c4af50e..220d5a9 100644 --- a/DataBlockHelper/DBHelpers/DB2102Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2102Helper.cs @@ -8,129 +8,123 @@ using HslCommunication; namespace DataBlockHelper.DBHelpers { - public class DB2102Helper + public class DB2102Helper : DBHelper { - private byte[] _bytes; - - public DB2102Helper(byte[] bytes) - { - _bytes = bytes; - } public DB2102Helper() { OperateResult db2102All = PlcConnect.Instance.Read("DB2102.0.0", 214); - _bytes = db2102All.Content; + bytes = db2102All.Content; } - public FOR_VALVE_DoubleEntity DV2PCP01 => new FOR_VALVE_DoubleEntity(130, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP02 => new FOR_VALVE_DoubleEntity(132, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP03 => new FOR_VALVE_DoubleEntity(134, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP04 => new FOR_VALVE_DoubleEntity(136, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP05 => new FOR_VALVE_DoubleEntity(138, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP06 => new FOR_VALVE_DoubleEntity(140, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP07 => new FOR_VALVE_DoubleEntity(142, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP08 => new FOR_VALVE_DoubleEntity(144, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP09 => new FOR_VALVE_DoubleEntity(146, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP10 => new FOR_VALVE_DoubleEntity(148, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP11 => new FOR_VALVE_DoubleEntity(150, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP12 => new FOR_VALVE_DoubleEntity(152, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP13 => new FOR_VALVE_DoubleEntity(154, _bytes); - public FOR_VALVE_DoubleEntity DV2PCP14 => new FOR_VALVE_DoubleEntity(156, _bytes); + public FOR_VALVE_DoubleEntity DV2PCP01 => new FOR_VALVE_DoubleEntity(130, bytes); + public FOR_VALVE_DoubleEntity DV2PCP02 => new FOR_VALVE_DoubleEntity(132, bytes); + public FOR_VALVE_DoubleEntity DV2PCP03 => new FOR_VALVE_DoubleEntity(134, bytes); + public FOR_VALVE_DoubleEntity DV2PCP04 => new FOR_VALVE_DoubleEntity(136, bytes); + public FOR_VALVE_DoubleEntity DV2PCP05 => new FOR_VALVE_DoubleEntity(138, bytes); + public FOR_VALVE_DoubleEntity DV2PCP06 => new FOR_VALVE_DoubleEntity(140, bytes); + public FOR_VALVE_DoubleEntity DV2PCP07 => new FOR_VALVE_DoubleEntity(142, bytes); + public FOR_VALVE_DoubleEntity DV2PCP08 => new FOR_VALVE_DoubleEntity(144, bytes); + public FOR_VALVE_DoubleEntity DV2PCP09 => new FOR_VALVE_DoubleEntity(146, bytes); + public FOR_VALVE_DoubleEntity DV2PCP10 => new FOR_VALVE_DoubleEntity(148, bytes); + public FOR_VALVE_DoubleEntity DV2PCP11 => new FOR_VALVE_DoubleEntity(150, bytes); + public FOR_VALVE_DoubleEntity DV2PCP12 => new FOR_VALVE_DoubleEntity(152, bytes); + public FOR_VALVE_DoubleEntity DV2PCP13 => new FOR_VALVE_DoubleEntity(154, bytes); + public FOR_VALVE_DoubleEntity DV2PCP14 => new FOR_VALVE_DoubleEntity(156, bytes); - public FOR_VALVE_SingleEntity BU1ASF01 => new FOR_VALVE_SingleEntity(0, _bytes); - public FOR_VALVE_SingleEntity BU1BSF01 => new FOR_VALVE_SingleEntity(2, _bytes); - public FOR_VALVE_SingleEntity BU1CSF01 => new FOR_VALVE_SingleEntity(4, _bytes); - public FOR_VALVE_SingleEntity BU1DSF01 => new FOR_VALVE_SingleEntity(6, _bytes); - public FOR_VALVE_SingleEntity BU1ESF01 => new FOR_VALVE_SingleEntity(8, _bytes); - public FOR_VALVE_SingleEntity BU1FSF01 => new FOR_VALVE_SingleEntity(10, _bytes); - public FOR_VALVE_SingleEntity BU1GSF01 => new FOR_VALVE_SingleEntity(12, _bytes); - public FOR_VALVE_SingleEntity BU1HSF01 => new FOR_VALVE_SingleEntity(14, _bytes); - public FOR_VALVE_SingleEntity BU1ISF01 => new FOR_VALVE_SingleEntity(16, _bytes); - public FOR_VALVE_SingleEntity BU1JSF01 => new FOR_VALVE_SingleEntity(18, _bytes); - public FOR_VALVE_SingleEntity BU1KSF01 => new FOR_VALVE_SingleEntity(20, _bytes); - public FOR_VALVE_SingleEntity BU1LSF01 => new FOR_VALVE_SingleEntity(22, _bytes); - public FOR_VALVE_SingleEntity BU1MSF01 => new FOR_VALVE_SingleEntity(24, _bytes); - public FOR_VALVE_SingleEntity BU1NSF01 => new FOR_VALVE_SingleEntity(26, _bytes); - public FOR_VALVE_SingleEntity BU1OSF01 => new FOR_VALVE_SingleEntity(28, _bytes); - public FOR_VALVE_SingleEntity BU1BLT01 => new FOR_VALVE_SingleEntity(30, _bytes); - public FOR_VALVE_SingleEntity BU1BLT02 => new FOR_VALVE_SingleEntity(32, _bytes); - public FOR_VALVE_SingleEntity BU1BLT03 => new FOR_VALVE_SingleEntity(34, _bytes); - public FOR_VALVE_SingleEntity BU1BLT04 => new FOR_VALVE_SingleEntity(36, _bytes); - public FOR_VALVE_SingleEntity BU1BLT05 => new FOR_VALVE_SingleEntity(38, _bytes); - public FOR_VALVE_SingleEntity BU1BLT06 => new FOR_VALVE_SingleEntity(40, _bytes); - public FOR_VALVE_SingleEntity BU1BLT07 => new FOR_VALVE_SingleEntity(42, _bytes); - public FOR_VALVE_SingleEntity BU2BLT01 => new FOR_VALVE_SingleEntity(44, _bytes); - public FOR_VALVE_SingleEntity BU2BLT02 => new FOR_VALVE_SingleEntity(46, _bytes); - public FOR_VALVE_SingleEntity BU2BLT03 => new FOR_VALVE_SingleEntity(48, _bytes); - public FOR_VALVE_SingleEntity BU2BLT04 => new FOR_VALVE_SingleEntity(50, _bytes); - public FOR_VALVE_SingleEntity BU2BLT05 => new FOR_VALVE_SingleEntity(52, _bytes); - public FOR_VALVE_SingleEntity BU3BLT01 => new FOR_VALVE_SingleEntity(54, _bytes); - public FOR_VALVE_SingleEntity BU3BLT02 => new FOR_VALVE_SingleEntity(56, _bytes); - public FOR_VALVE_SingleEntity BU3BLT03 => new FOR_VALVE_SingleEntity(58, _bytes); - public FOR_VALVE_SingleEntity BU3BLT04 => new FOR_VALVE_SingleEntity(60, _bytes); - public FOR_VALVE_SingleEntity BU3BLT05 => new FOR_VALVE_SingleEntity(62, _bytes); - public FOR_VALVE_SingleEntity BU3BLT06 => new FOR_VALVE_SingleEntity(64, _bytes); - public FOR_VALVE_SingleEntity BU3BLT07 => new FOR_VALVE_SingleEntity(66, _bytes); - public FOR_VALVE_SingleEntity BU4BLT01 => new FOR_VALVE_SingleEntity(68, _bytes); - public FOR_VALVE_SingleEntity BU4BLT02 => new FOR_VALVE_SingleEntity(70, _bytes); - public FOR_VALVE_SingleEntity BU4BLT03 => new FOR_VALVE_SingleEntity(72, _bytes); - public FOR_VALVE_SingleEntity BU4BLT04 => new FOR_VALVE_SingleEntity(74, _bytes); - public FOR_VALVE_SingleEntity BU4BLT05 => new FOR_VALVE_SingleEntity(76, _bytes); - public FOR_VALVE_SingleEntity BU4BLT06 => new FOR_VALVE_SingleEntity(78, _bytes); - public FOR_VALVE_SingleEntity BU4BLT07 => new FOR_VALVE_SingleEntity(80, _bytes); - public FOR_VALVE_SingleEntity BU5BLT01 => new FOR_VALVE_SingleEntity(82, _bytes); - public FOR_VALVE_SingleEntity BU5BLT02 => new FOR_VALVE_SingleEntity(84, _bytes); - public FOR_VALVE_SingleEntity BU5BLT03 => new FOR_VALVE_SingleEntity(86, _bytes); - public FOR_VALVE_SingleEntity BU5BLT04 => new FOR_VALVE_SingleEntity(88, _bytes); - public FOR_VALVE_SingleEntity BU2ASF01 => new FOR_VALVE_SingleEntity(90, _bytes); - public FOR_VALVE_SingleEntity BU2ASF02 => new FOR_VALVE_SingleEntity(92, _bytes); - public FOR_VALVE_SingleEntity BU2BSF01 => new FOR_VALVE_SingleEntity(94, _bytes); - public FOR_VALVE_SingleEntity BU2BSF02 => new FOR_VALVE_SingleEntity(96, _bytes); - public FOR_VALVE_SingleEntity BU2CSF01 => new FOR_VALVE_SingleEntity(98, _bytes); - public FOR_VALVE_SingleEntity BU2CSF02 => new FOR_VALVE_SingleEntity(100, _bytes); - public FOR_VALVE_SingleEntity BU2DSF01 => new FOR_VALVE_SingleEntity(102, _bytes); - public FOR_VALVE_SingleEntity BU2DSF02 => new FOR_VALVE_SingleEntity(104, _bytes); - public FOR_VALVE_SingleEntity BU1ADB01 => new FOR_VALVE_SingleEntity(106, _bytes); - public FOR_VALVE_SingleEntity BU1BDB01 => new FOR_VALVE_SingleEntity(108, _bytes); - public FOR_VALVE_SingleEntity BU1CDB01 => new FOR_VALVE_SingleEntity(110, _bytes); - public FOR_VALVE_SingleEntity BU1DDB01 => new FOR_VALVE_SingleEntity(112, _bytes); - public FOR_VALVE_SingleEntity BU1EDB01 => new FOR_VALVE_SingleEntity(114, _bytes); - public FOR_VALVE_SingleEntity BU1FDB01 => new FOR_VALVE_SingleEntity(116, _bytes); - public FOR_VALVE_SingleEntity BU1GDB01 => new FOR_VALVE_SingleEntity(118, _bytes); - public FOR_VALVE_SingleEntity BU1HDB01 => new FOR_VALVE_SingleEntity(120, _bytes); - public FOR_VALVE_SingleEntity BU1IDB01 => new FOR_VALVE_SingleEntity(122, _bytes); - public FOR_VALVE_SingleEntity BU1JDB01 => new FOR_VALVE_SingleEntity(124, _bytes); - public FOR_VALVE_SingleEntity BU1KDB01 => new FOR_VALVE_SingleEntity(126, _bytes); - public FOR_VALVE_SingleEntity BU1LDB01 => new FOR_VALVE_SingleEntity(128, _bytes); + public FOR_VALVE_SingleEntity BU1ASF01 => new FOR_VALVE_SingleEntity(0, bytes); + public FOR_VALVE_SingleEntity BU1BSF01 => new FOR_VALVE_SingleEntity(2, bytes); + public FOR_VALVE_SingleEntity BU1CSF01 => new FOR_VALVE_SingleEntity(4, bytes); + public FOR_VALVE_SingleEntity BU1DSF01 => new FOR_VALVE_SingleEntity(6, bytes); + public FOR_VALVE_SingleEntity BU1ESF01 => new FOR_VALVE_SingleEntity(8, bytes); + public FOR_VALVE_SingleEntity BU1FSF01 => new FOR_VALVE_SingleEntity(10, bytes); + public FOR_VALVE_SingleEntity BU1GSF01 => new FOR_VALVE_SingleEntity(12, bytes); + public FOR_VALVE_SingleEntity BU1HSF01 => new FOR_VALVE_SingleEntity(14, bytes); + public FOR_VALVE_SingleEntity BU1ISF01 => new FOR_VALVE_SingleEntity(16, bytes); + public FOR_VALVE_SingleEntity BU1JSF01 => new FOR_VALVE_SingleEntity(18, bytes); + public FOR_VALVE_SingleEntity BU1KSF01 => new FOR_VALVE_SingleEntity(20, bytes); + public FOR_VALVE_SingleEntity BU1LSF01 => new FOR_VALVE_SingleEntity(22, bytes); + public FOR_VALVE_SingleEntity BU1MSF01 => new FOR_VALVE_SingleEntity(24, bytes); + public FOR_VALVE_SingleEntity BU1NSF01 => new FOR_VALVE_SingleEntity(26, bytes); + public FOR_VALVE_SingleEntity BU1OSF01 => new FOR_VALVE_SingleEntity(28, bytes); + public FOR_VALVE_SingleEntity BU1BLT01 => new FOR_VALVE_SingleEntity(30, bytes); + public FOR_VALVE_SingleEntity BU1BLT02 => new FOR_VALVE_SingleEntity(32, bytes); + public FOR_VALVE_SingleEntity BU1BLT03 => new FOR_VALVE_SingleEntity(34, bytes); + public FOR_VALVE_SingleEntity BU1BLT04 => new FOR_VALVE_SingleEntity(36, bytes); + public FOR_VALVE_SingleEntity BU1BLT05 => new FOR_VALVE_SingleEntity(38, bytes); + public FOR_VALVE_SingleEntity BU1BLT06 => new FOR_VALVE_SingleEntity(40, bytes); + public FOR_VALVE_SingleEntity BU1BLT07 => new FOR_VALVE_SingleEntity(42, bytes); + public FOR_VALVE_SingleEntity BU2BLT01 => new FOR_VALVE_SingleEntity(44, bytes); + public FOR_VALVE_SingleEntity BU2BLT02 => new FOR_VALVE_SingleEntity(46, bytes); + public FOR_VALVE_SingleEntity BU2BLT03 => new FOR_VALVE_SingleEntity(48, bytes); + public FOR_VALVE_SingleEntity BU2BLT04 => new FOR_VALVE_SingleEntity(50, bytes); + public FOR_VALVE_SingleEntity BU2BLT05 => new FOR_VALVE_SingleEntity(52, bytes); + public FOR_VALVE_SingleEntity BU3BLT01 => new FOR_VALVE_SingleEntity(54, bytes); + public FOR_VALVE_SingleEntity BU3BLT02 => new FOR_VALVE_SingleEntity(56, bytes); + public FOR_VALVE_SingleEntity BU3BLT03 => new FOR_VALVE_SingleEntity(58, bytes); + public FOR_VALVE_SingleEntity BU3BLT04 => new FOR_VALVE_SingleEntity(60, bytes); + public FOR_VALVE_SingleEntity BU3BLT05 => new FOR_VALVE_SingleEntity(62, bytes); + public FOR_VALVE_SingleEntity BU3BLT06 => new FOR_VALVE_SingleEntity(64, bytes); + public FOR_VALVE_SingleEntity BU3BLT07 => new FOR_VALVE_SingleEntity(66, bytes); + public FOR_VALVE_SingleEntity BU4BLT01 => new FOR_VALVE_SingleEntity(68, bytes); + public FOR_VALVE_SingleEntity BU4BLT02 => new FOR_VALVE_SingleEntity(70, bytes); + public FOR_VALVE_SingleEntity BU4BLT03 => new FOR_VALVE_SingleEntity(72, bytes); + public FOR_VALVE_SingleEntity BU4BLT04 => new FOR_VALVE_SingleEntity(74, bytes); + public FOR_VALVE_SingleEntity BU4BLT05 => new FOR_VALVE_SingleEntity(76, bytes); + public FOR_VALVE_SingleEntity BU4BLT06 => new FOR_VALVE_SingleEntity(78, bytes); + public FOR_VALVE_SingleEntity BU4BLT07 => new FOR_VALVE_SingleEntity(80, bytes); + public FOR_VALVE_SingleEntity BU5BLT01 => new FOR_VALVE_SingleEntity(82, bytes); + public FOR_VALVE_SingleEntity BU5BLT02 => new FOR_VALVE_SingleEntity(84, bytes); + public FOR_VALVE_SingleEntity BU5BLT03 => new FOR_VALVE_SingleEntity(86, bytes); + public FOR_VALVE_SingleEntity BU5BLT04 => new FOR_VALVE_SingleEntity(88, bytes); + public FOR_VALVE_SingleEntity BU2ASF01 => new FOR_VALVE_SingleEntity(90, bytes); + public FOR_VALVE_SingleEntity BU2ASF02 => new FOR_VALVE_SingleEntity(92, bytes); + public FOR_VALVE_SingleEntity BU2BSF01 => new FOR_VALVE_SingleEntity(94, bytes); + public FOR_VALVE_SingleEntity BU2BSF02 => new FOR_VALVE_SingleEntity(96, bytes); + public FOR_VALVE_SingleEntity BU2CSF01 => new FOR_VALVE_SingleEntity(98, bytes); + public FOR_VALVE_SingleEntity BU2CSF02 => new FOR_VALVE_SingleEntity(100, bytes); + public FOR_VALVE_SingleEntity BU2DSF01 => new FOR_VALVE_SingleEntity(102, bytes); + public FOR_VALVE_SingleEntity BU2DSF02 => new FOR_VALVE_SingleEntity(104, bytes); + public FOR_VALVE_SingleEntity BU1ADB01 => new FOR_VALVE_SingleEntity(106, bytes); + public FOR_VALVE_SingleEntity BU1BDB01 => new FOR_VALVE_SingleEntity(108, bytes); + public FOR_VALVE_SingleEntity BU1CDB01 => new FOR_VALVE_SingleEntity(110, bytes); + public FOR_VALVE_SingleEntity BU1DDB01 => new FOR_VALVE_SingleEntity(112, bytes); + public FOR_VALVE_SingleEntity BU1EDB01 => new FOR_VALVE_SingleEntity(114, bytes); + public FOR_VALVE_SingleEntity BU1FDB01 => new FOR_VALVE_SingleEntity(116, bytes); + public FOR_VALVE_SingleEntity BU1GDB01 => new FOR_VALVE_SingleEntity(118, bytes); + public FOR_VALVE_SingleEntity BU1HDB01 => new FOR_VALVE_SingleEntity(120, bytes); + public FOR_VALVE_SingleEntity BU1IDB01 => new FOR_VALVE_SingleEntity(122, bytes); + public FOR_VALVE_SingleEntity BU1JDB01 => new FOR_VALVE_SingleEntity(124, bytes); + public FOR_VALVE_SingleEntity BU1KDB01 => new FOR_VALVE_SingleEntity(126, bytes); + public FOR_VALVE_SingleEntity BU1LDB01 => new FOR_VALVE_SingleEntity(128, bytes); - public FOR_VALVE_SingleEntity BU1DRB01 => new FOR_VALVE_SingleEntity(158, _bytes); - public FOR_VALVE_SingleEntity BU2DRB01 => new FOR_VALVE_SingleEntity(160, _bytes); - public FOR_VALVE_SingleEntity BU3DRB01 => new FOR_VALVE_SingleEntity(162, _bytes); - public FOR_VALVE_SingleEntity BU4DRB01 => new FOR_VALVE_SingleEntity(164, _bytes); - public FOR_VALVE_SingleEntity BU1GEB01 => new FOR_VALVE_SingleEntity(166, _bytes); - public FOR_VALVE_SingleEntity BU2GEB01 => new FOR_VALVE_SingleEntity(168, _bytes); - public FOR_VALVE_SingleEntity BU3GEB01 => new FOR_VALVE_SingleEntity(170, _bytes); - public FOR_VALVE_SingleEntity BU4GEB01 => new FOR_VALVE_SingleEntity(172, _bytes); - public FOR_VALVE_SingleEntity BU5GEB01 => new FOR_VALVE_SingleEntity(174, _bytes); - public FOR_VALVE_SingleEntity BU6GEB01 => new FOR_VALVE_SingleEntity(176, _bytes); - public FOR_VALVE_SingleEntity BU7GEB01 => new FOR_VALVE_SingleEntity(178, _bytes); - public FOR_VALVE_SingleEntity BU8GEB01 => new FOR_VALVE_SingleEntity(180, _bytes); - public FOR_VALVE_SingleEntity BUWeter1 => new FOR_VALVE_SingleEntity(182, _bytes); - public FOR_VALVE_SingleEntity BUWeter2 => new FOR_VALVE_SingleEntity(184, _bytes); - public FOR_VALVE_SingleEntity BUWeter3 => new FOR_VALVE_SingleEntity(186, _bytes); - public FOR_VALVE_SingleEntity BUWeter4 => new FOR_VALVE_SingleEntity(188, _bytes); - public FOR_VALVE_SingleEntity BUWeter5 => new FOR_VALVE_SingleEntity(190, _bytes); - public FOR_VALVE_SingleEntity BUWeter6 => new FOR_VALVE_SingleEntity(192, _bytes); - public FOR_VALVE_SingleEntity BUWeter7 => new FOR_VALVE_SingleEntity(194, _bytes); - public FOR_VALVE_SingleEntity BUWeter8 => new FOR_VALVE_SingleEntity(196, _bytes); - public FOR_VALVE_SingleEntity BU1GEB02 => new FOR_VALVE_SingleEntity(198, _bytes); - public FOR_VALVE_SingleEntity BU2GEB02 => new FOR_VALVE_SingleEntity(200, _bytes); - public FOR_VALVE_SingleEntity BU3GEB02 => new FOR_VALVE_SingleEntity(202, _bytes); - public FOR_VALVE_SingleEntity BU4GEB02 => new FOR_VALVE_SingleEntity(204, _bytes); - public FOR_VALVE_SingleEntity BU5GEB02 => new FOR_VALVE_SingleEntity(206, _bytes); - public FOR_VALVE_SingleEntity BU6GEB02 => new FOR_VALVE_SingleEntity(208, _bytes); - public FOR_VALVE_SingleEntity BU7GEB02 => new FOR_VALVE_SingleEntity(210, _bytes); - public FOR_VALVE_SingleEntity BU8GEB02 => new FOR_VALVE_SingleEntity(212, _bytes); + public FOR_VALVE_SingleEntity BU1DRB01 => new FOR_VALVE_SingleEntity(158, bytes); + public FOR_VALVE_SingleEntity BU2DRB01 => new FOR_VALVE_SingleEntity(160, bytes); + public FOR_VALVE_SingleEntity BU3DRB01 => new FOR_VALVE_SingleEntity(162, bytes); + public FOR_VALVE_SingleEntity BU4DRB01 => new FOR_VALVE_SingleEntity(164, bytes); + public FOR_VALVE_SingleEntity BU1GEB01 => new FOR_VALVE_SingleEntity(166, bytes); + public FOR_VALVE_SingleEntity BU2GEB01 => new FOR_VALVE_SingleEntity(168, bytes); + public FOR_VALVE_SingleEntity BU3GEB01 => new FOR_VALVE_SingleEntity(170, bytes); + public FOR_VALVE_SingleEntity BU4GEB01 => new FOR_VALVE_SingleEntity(172, bytes); + public FOR_VALVE_SingleEntity BU5GEB01 => new FOR_VALVE_SingleEntity(174, bytes); + public FOR_VALVE_SingleEntity BU6GEB01 => new FOR_VALVE_SingleEntity(176, bytes); + public FOR_VALVE_SingleEntity BU7GEB01 => new FOR_VALVE_SingleEntity(178, bytes); + public FOR_VALVE_SingleEntity BU8GEB01 => new FOR_VALVE_SingleEntity(180, bytes); + public FOR_VALVE_SingleEntity BUWeter1 => new FOR_VALVE_SingleEntity(182, bytes); + public FOR_VALVE_SingleEntity BUWeter2 => new FOR_VALVE_SingleEntity(184, bytes); + public FOR_VALVE_SingleEntity BUWeter3 => new FOR_VALVE_SingleEntity(186, bytes); + public FOR_VALVE_SingleEntity BUWeter4 => new FOR_VALVE_SingleEntity(188, bytes); + public FOR_VALVE_SingleEntity BUWeter5 => new FOR_VALVE_SingleEntity(190, bytes); + public FOR_VALVE_SingleEntity BUWeter6 => new FOR_VALVE_SingleEntity(192, bytes); + public FOR_VALVE_SingleEntity BUWeter7 => new FOR_VALVE_SingleEntity(194, bytes); + public FOR_VALVE_SingleEntity BUWeter8 => new FOR_VALVE_SingleEntity(196, bytes); + public FOR_VALVE_SingleEntity BU1GEB02 => new FOR_VALVE_SingleEntity(198, bytes); + public FOR_VALVE_SingleEntity BU2GEB02 => new FOR_VALVE_SingleEntity(200, bytes); + public FOR_VALVE_SingleEntity BU3GEB02 => new FOR_VALVE_SingleEntity(202, bytes); + public FOR_VALVE_SingleEntity BU4GEB02 => new FOR_VALVE_SingleEntity(204, bytes); + public FOR_VALVE_SingleEntity BU5GEB02 => new FOR_VALVE_SingleEntity(206, bytes); + public FOR_VALVE_SingleEntity BU6GEB02 => new FOR_VALVE_SingleEntity(208, bytes); + public FOR_VALVE_SingleEntity BU7GEB02 => new FOR_VALVE_SingleEntity(210, bytes); + public FOR_VALVE_SingleEntity BU8GEB02 => new FOR_VALVE_SingleEntity(212, bytes); } } diff --git a/DataBlockHelper/DBHelpers/DB2103Helper.cs b/DataBlockHelper/DBHelpers/DB2103Helper.cs index 677076f..a21a62d 100644 --- a/DataBlockHelper/DBHelpers/DB2103Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2103Helper.cs @@ -8,108 +8,102 @@ using HslCommunication; namespace DataBlockHelper.DBHelpers { - public class DB2103Helper + public class DB2103Helper : DBHelper { - private byte[] _bytes; - - public DB2103Helper(byte[] bytes) - { - _bytes = bytes; - } public DB2103Helper() { OperateResult db2103All = PlcConnect.Instance.Read("DB2103.0.0", 418); - _bytes = db2103All.Content; + bytes = db2103All.Content; } - // public OperateResult GetAll=>PlcConnect.Instance.Read("DB2103.0.0", 418,_bytes); + // public OperateResult GetAll=>PlcConnect.Instance.Read("DB2103.0.0", 418, bytes); - public FOR_MOTOREntity DM1ASI01 => new FOR_MOTOREntity(0, _bytes); - public FOR_MOTOREntity DM1BSI01 => new FOR_MOTOREntity(2, _bytes); - public FOR_MOTOREntity DM1CSI01 => new FOR_MOTOREntity(4, _bytes); - public FOR_MOTOREntity DM1DSI01 => new FOR_MOTOREntity(6, _bytes); - public FOR_MOTOREntity DM1ESI01 => new FOR_MOTOREntity(8, _bytes); - public FOR_MOTOREntity DM1FSI01 => new FOR_MOTOREntity(10, _bytes); - public FOR_MOTOREntity DM1GSI01 => new FOR_MOTOREntity(12, _bytes); - public FOR_MOTOREntity DM1HSI01 => new FOR_MOTOREntity(14, _bytes); - public FOR_MOTOREntity DM1ISI01 => new FOR_MOTOREntity(16, _bytes); - public FOR_MOTOREntity DM1JSI01 => new FOR_MOTOREntity(18, _bytes); - public FOR_MOTOREntity DM1KSI01 => new FOR_MOTOREntity(20, _bytes); - public FOR_MOTOREntity DM1LSI01 => new FOR_MOTOREntity(22, _bytes); - public FOR_MOTOREntity DM1MSI01 => new FOR_MOTOREntity(24, _bytes); - public FOR_MOTOREntity DM1NSI01 => new FOR_MOTOREntity(26, _bytes); - public FOR_MOTOREntity DM1OSI01 => new FOR_MOTOREntity(28, _bytes); - public FOR_MOTOREntity DM1ADB01 => new FOR_MOTOREntity(30, _bytes); - public FOR_MOTOREntity DM1BDB01 => new FOR_MOTOREntity(32, _bytes); - public FOR_MOTOREntity DM1CDB01 => new FOR_MOTOREntity(34, _bytes); - public FOR_MOTOREntity DM1DDB01 => new FOR_MOTOREntity(36, _bytes); - public FOR_MOTOREntity DM1EDB01 => new FOR_MOTOREntity(38, _bytes); - public FOR_MOTOREntity DM1FDB01 => new FOR_MOTOREntity(40, _bytes); - public FOR_MOTOREntity DM1GDB01 => new FOR_MOTOREntity(42, _bytes); - public FOR_MOTOREntity DM1HDB01 => new FOR_MOTOREntity(44, _bytes); - public FOR_MOTOREntity DM1IDB01 => new FOR_MOTOREntity(46, _bytes); - public FOR_MOTOREntity DM1JDB01 => new FOR_MOTOREntity(48, _bytes); - public FOR_MOTOREntity DM1KDB01 => new FOR_MOTOREntity(50, _bytes); - public FOR_MOTOREntity DM1LDB01 => new FOR_MOTOREntity(52, _bytes); - public FOR_MOTOREntity DM1ADF01 => new FOR_MOTOREntity(54, _bytes); - public FOR_MOTOREntity DM1BDF01 => new FOR_MOTOREntity(56, _bytes); - public FOR_MOTOREntity DM1CDF01 => new FOR_MOTOREntity(58, _bytes); - public FOR_MOTOREntity DM1DDF01 => new FOR_MOTOREntity(60, _bytes); - public FOR_MOTOREntity DM1EDF01 => new FOR_MOTOREntity(62, _bytes); - public FOR_MOTOREntity DM1FDF01 => new FOR_MOTOREntity(64, _bytes); - public FOR_MOTOREntity DM1GDF01 => new FOR_MOTOREntity(66, _bytes); - public FOR_MOTOREntity DM1HDF01 => new FOR_MOTOREntity(68, _bytes); - public FOR_MOTOREntity DM1IDF01 => new FOR_MOTOREntity(70, _bytes); - public FOR_MOTOREntity DM1JDF01 => new FOR_MOTOREntity(72, _bytes); - public FOR_MOTOREntity DM1KDF01 => new FOR_MOTOREntity(74, _bytes); - public FOR_MOTOREntity DM1LDF01 => new FOR_MOTOREntity(76, _bytes); - public FOR_MOTOREntity DMFILTER => new FOR_MOTOREntity(78, _bytes); - public FOR_MOTOREntity DM1ASF01 => new FOR_MOTOREntity(80, _bytes); - public FOR_MOTOREntity DM1BSF01 => new FOR_MOTOREntity(82, _bytes); - public FOR_MOTOREntity DM1CSF01 => new FOR_MOTOREntity(84, _bytes); - public FOR_MOTOREntity DM1DSF01 => new FOR_MOTOREntity(86, _bytes); - public FOR_MOTOREntity DM1ESF01 => new FOR_MOTOREntity(88, _bytes); - public FOR_MOTOREntity DM1FSF01 => new FOR_MOTOREntity(90, _bytes); - public FOR_MOTOREntity DM1GSF01 => new FOR_MOTOREntity(92, _bytes); - public FOR_MOTOREntity DM1HSF01 => new FOR_MOTOREntity(94, _bytes); - public FOR_MOTOREntity DM1ISF01 => new FOR_MOTOREntity(96, _bytes); - public FOR_MOTOREntity DM1JSF01 => new FOR_MOTOREntity(98, _bytes); - public FOR_MOTOREntity DM1KSF01 => new FOR_MOTOREntity(100, _bytes); - public FOR_MOTOREntity DM1LSF01 => new FOR_MOTOREntity(102, _bytes); - public FOR_MOTOREntity DM1MSF01 => new FOR_MOTOREntity(104, _bytes); - public FOR_MOTOREntity DM1NSF01 => new FOR_MOTOREntity(106, _bytes); + public FOR_MOTOREntity DM1ASI01 => new FOR_MOTOREntity(0, bytes); + public FOR_MOTOREntity DM1BSI01 => new FOR_MOTOREntity(2, bytes); + public FOR_MOTOREntity DM1CSI01 => new FOR_MOTOREntity(4, bytes); + public FOR_MOTOREntity DM1DSI01 => new FOR_MOTOREntity(6, bytes); + public FOR_MOTOREntity DM1ESI01 => new FOR_MOTOREntity(8, bytes); + public FOR_MOTOREntity DM1FSI01 => new FOR_MOTOREntity(10, bytes); + public FOR_MOTOREntity DM1GSI01 => new FOR_MOTOREntity(12, bytes); + public FOR_MOTOREntity DM1HSI01 => new FOR_MOTOREntity(14, bytes); + public FOR_MOTOREntity DM1ISI01 => new FOR_MOTOREntity(16, bytes); + public FOR_MOTOREntity DM1JSI01 => new FOR_MOTOREntity(18, bytes); + public FOR_MOTOREntity DM1KSI01 => new FOR_MOTOREntity(20, bytes); + public FOR_MOTOREntity DM1LSI01 => new FOR_MOTOREntity(22, bytes); + public FOR_MOTOREntity DM1MSI01 => new FOR_MOTOREntity(24, bytes); + public FOR_MOTOREntity DM1NSI01 => new FOR_MOTOREntity(26, bytes); + public FOR_MOTOREntity DM1OSI01 => new FOR_MOTOREntity(28, bytes); + public FOR_MOTOREntity DM1ADB01 => new FOR_MOTOREntity(30, bytes); + public FOR_MOTOREntity DM1BDB01 => new FOR_MOTOREntity(32, bytes); + public FOR_MOTOREntity DM1CDB01 => new FOR_MOTOREntity(34, bytes); + public FOR_MOTOREntity DM1DDB01 => new FOR_MOTOREntity(36, bytes); + public FOR_MOTOREntity DM1EDB01 => new FOR_MOTOREntity(38, bytes); + public FOR_MOTOREntity DM1FDB01 => new FOR_MOTOREntity(40, bytes); + public FOR_MOTOREntity DM1GDB01 => new FOR_MOTOREntity(42, bytes); + public FOR_MOTOREntity DM1HDB01 => new FOR_MOTOREntity(44, bytes); + public FOR_MOTOREntity DM1IDB01 => new FOR_MOTOREntity(46, bytes); + public FOR_MOTOREntity DM1JDB01 => new FOR_MOTOREntity(48, bytes); + public FOR_MOTOREntity DM1KDB01 => new FOR_MOTOREntity(50, bytes); + public FOR_MOTOREntity DM1LDB01 => new FOR_MOTOREntity(52, bytes); + public FOR_MOTOREntity DM1ADF01 => new FOR_MOTOREntity(54, bytes); + public FOR_MOTOREntity DM1BDF01 => new FOR_MOTOREntity(56, bytes); + public FOR_MOTOREntity DM1CDF01 => new FOR_MOTOREntity(58, bytes); + public FOR_MOTOREntity DM1DDF01 => new FOR_MOTOREntity(60, bytes); + public FOR_MOTOREntity DM1EDF01 => new FOR_MOTOREntity(62, bytes); + public FOR_MOTOREntity DM1FDF01 => new FOR_MOTOREntity(64, bytes); + public FOR_MOTOREntity DM1GDF01 => new FOR_MOTOREntity(66, bytes); + public FOR_MOTOREntity DM1HDF01 => new FOR_MOTOREntity(68, bytes); + public FOR_MOTOREntity DM1IDF01 => new FOR_MOTOREntity(70, bytes); + public FOR_MOTOREntity DM1JDF01 => new FOR_MOTOREntity(72, bytes); + public FOR_MOTOREntity DM1KDF01 => new FOR_MOTOREntity(74, bytes); + public FOR_MOTOREntity DM1LDF01 => new FOR_MOTOREntity(76, bytes); + public FOR_MOTOREntity DMFILTER => new FOR_MOTOREntity(78, bytes); + public FOR_MOTOREntity DM1ASF01 => new FOR_MOTOREntity(80, bytes); + public FOR_MOTOREntity DM1BSF01 => new FOR_MOTOREntity(82, bytes); + public FOR_MOTOREntity DM1CSF01 => new FOR_MOTOREntity(84, bytes); + public FOR_MOTOREntity DM1DSF01 => new FOR_MOTOREntity(86, bytes); + public FOR_MOTOREntity DM1ESF01 => new FOR_MOTOREntity(88, bytes); + public FOR_MOTOREntity DM1FSF01 => new FOR_MOTOREntity(90, bytes); + public FOR_MOTOREntity DM1GSF01 => new FOR_MOTOREntity(92, bytes); + public FOR_MOTOREntity DM1HSF01 => new FOR_MOTOREntity(94, bytes); + public FOR_MOTOREntity DM1ISF01 => new FOR_MOTOREntity(96, bytes); + public FOR_MOTOREntity DM1JSF01 => new FOR_MOTOREntity(98, bytes); + public FOR_MOTOREntity DM1KSF01 => new FOR_MOTOREntity(100, bytes); + public FOR_MOTOREntity DM1LSF01 => new FOR_MOTOREntity(102, bytes); + public FOR_MOTOREntity DM1MSF01 => new FOR_MOTOREntity(104, bytes); + public FOR_MOTOREntity DM1NSF01 => new FOR_MOTOREntity(106, bytes); - public FOR_MOTOR_VFDEntity _24T11A_D => new FOR_MOTOR_VFDEntity(108, _bytes); - public FOR_MOTOR_VFDEntity _64T01G_J => new FOR_MOTOR_VFDEntity(122, _bytes); - public FOR_MOTOR_VFDEntity _64T61E_F => new FOR_MOTOR_VFDEntity(136, _bytes); - public FOR_MOTOR_VFDEntity DM1K_NSF01 => new FOR_MOTOR_VFDEntity(150, _bytes); - public FOR_MOTOR_VFDEntity DM1OSF01 => new FOR_MOTOR_VFDEntity(164, _bytes); - public FOR_MOTOR_VFDEntity DM2ASF01 => new FOR_MOTOR_VFDEntity(178, _bytes); - public FOR_MOTOR_VFDEntity DM2BSF01 => new FOR_MOTOR_VFDEntity(192, _bytes); - public FOR_MOTOR_VFDEntity DM2CSF01 => new FOR_MOTOR_VFDEntity(206, _bytes); - public FOR_MOTOR_VFDEntity DM2DSF01 => new FOR_MOTOR_VFDEntity(220, _bytes); - public FOR_MOTOR_VFDEntity DM1DRY1 => new FOR_MOTOR_VFDEntity(234, _bytes); - public FOR_MOTOR_VFDEntity DM1DRY2 => new FOR_MOTOR_VFDEntity(248, _bytes); - public FOR_MOTOR_VFDEntity DM1DRY3 => new FOR_MOTOR_VFDEntity(262, _bytes); - public FOR_MOTOR_VFDEntity DM1DRY4 => new FOR_MOTOR_VFDEntity(276, _bytes); - public FOR_MOTOR_VFDEntity DM1GEM => new FOR_MOTOR_VFDEntity(290, _bytes); - public FOR_MOTOR_VFDEntity DM2GEM => new FOR_MOTOR_VFDEntity(304, _bytes); - public FOR_MOTOR_VFDEntity DM3GEM => new FOR_MOTOR_VFDEntity(318, _bytes); - public FOR_MOTOR_VFDEntity DM4GEM => new FOR_MOTOR_VFDEntity(332, _bytes); - public FOR_MOTOR_VFDEntity DM5GEM => new FOR_MOTOR_VFDEntity(346, _bytes); - public FOR_MOTOR_VFDEntity DM6GEM => new FOR_MOTOR_VFDEntity(360, _bytes); - public FOR_MOTOR_VFDEntity DM7GEM => new FOR_MOTOR_VFDEntity(374, _bytes); - public FOR_MOTOR_VFDEntity DM8GEM => new FOR_MOTOR_VFDEntity(388, _bytes); + public FOR_MOTOR_VFDEntity _24T11A_D => new FOR_MOTOR_VFDEntity(108, bytes); + public FOR_MOTOR_VFDEntity _64T01G_J => new FOR_MOTOR_VFDEntity(122, bytes); + public FOR_MOTOR_VFDEntity _64T61E_F => new FOR_MOTOR_VFDEntity(136, bytes); + public FOR_MOTOR_VFDEntity DM1K_NSF01 => new FOR_MOTOR_VFDEntity(150, bytes); + public FOR_MOTOR_VFDEntity DM1OSF01 => new FOR_MOTOR_VFDEntity(164, bytes); + public FOR_MOTOR_VFDEntity DM2ASF01 => new FOR_MOTOR_VFDEntity(178, bytes); + public FOR_MOTOR_VFDEntity DM2BSF01 => new FOR_MOTOR_VFDEntity(192, bytes); + public FOR_MOTOR_VFDEntity DM2CSF01 => new FOR_MOTOR_VFDEntity(206, bytes); + public FOR_MOTOR_VFDEntity DM2DSF01 => new FOR_MOTOR_VFDEntity(220, bytes); + public FOR_MOTOR_VFDEntity DM1DRY1 => new FOR_MOTOR_VFDEntity(234, bytes); + public FOR_MOTOR_VFDEntity DM1DRY2 => new FOR_MOTOR_VFDEntity(248, bytes); + public FOR_MOTOR_VFDEntity DM1DRY3 => new FOR_MOTOR_VFDEntity(262, bytes); + public FOR_MOTOR_VFDEntity DM1DRY4 => new FOR_MOTOR_VFDEntity(276, bytes); + public FOR_MOTOR_VFDEntity DM1GEM => new FOR_MOTOR_VFDEntity(290, bytes); + public FOR_MOTOR_VFDEntity DM2GEM => new FOR_MOTOR_VFDEntity(304, bytes); + public FOR_MOTOR_VFDEntity DM3GEM => new FOR_MOTOR_VFDEntity(318, bytes); + public FOR_MOTOR_VFDEntity DM4GEM => new FOR_MOTOR_VFDEntity(332, bytes); + public FOR_MOTOR_VFDEntity DM5GEM => new FOR_MOTOR_VFDEntity(346, bytes); + public FOR_MOTOR_VFDEntity DM6GEM => new FOR_MOTOR_VFDEntity(360, bytes); + public FOR_MOTOR_VFDEntity DM7GEM => new FOR_MOTOR_VFDEntity(374, bytes); + public FOR_MOTOR_VFDEntity DM8GEM => new FOR_MOTOR_VFDEntity(388, bytes); - public FOR_MOTOREntity DMWETER1 => new FOR_MOTOREntity(402, _bytes); - public FOR_MOTOREntity DMWETER2 => new FOR_MOTOREntity(404, _bytes); - public FOR_MOTOREntity DMWETER3 => new FOR_MOTOREntity(406, _bytes); - public FOR_MOTOREntity DMWETER4 => new FOR_MOTOREntity(408, _bytes); - public FOR_MOTOREntity DMWETER5 => new FOR_MOTOREntity(410, _bytes); - public FOR_MOTOREntity DMWETER6 => new FOR_MOTOREntity(412, _bytes); - public FOR_MOTOREntity DMWETER7 => new FOR_MOTOREntity(414, _bytes); - public FOR_MOTOREntity DMWETER8 => new FOR_MOTOREntity(416, _bytes); + public FOR_MOTOREntity DMWETER1 => new FOR_MOTOREntity(402, bytes); + public FOR_MOTOREntity DMWETER2 => new FOR_MOTOREntity(404, bytes); + public FOR_MOTOREntity DMWETER3 => new FOR_MOTOREntity(406, bytes); + public FOR_MOTOREntity DMWETER4 => new FOR_MOTOREntity(408, bytes); + public FOR_MOTOREntity DMWETER5 => new FOR_MOTOREntity(410, bytes); + public FOR_MOTOREntity DMWETER6 => new FOR_MOTOREntity(412, bytes); + public FOR_MOTOREntity DMWETER7 => new FOR_MOTOREntity(414, bytes); + public FOR_MOTOREntity DMWETER8 => new FOR_MOTOREntity(416, bytes); } } diff --git a/DataBlockHelper/DBHelpers/DB2104Helper.cs b/DataBlockHelper/DBHelpers/DB2104Helper.cs index 0e239f5..b7f1f94 100644 --- a/DataBlockHelper/DBHelpers/DB2104Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2104Helper.cs @@ -8,9 +8,8 @@ using System.Threading.Tasks; namespace DataBlockHelper.DBHelpers { - public class DB2104Helper + public class DB2104Helper : DBHelper { - byte[] bytes; public DB2104Helper() { diff --git a/DataBlockHelper/DBHelpers/DB2105Helper.cs b/DataBlockHelper/DBHelpers/DB2105Helper.cs index 4dddd87..6226a03 100644 --- a/DataBlockHelper/DBHelpers/DB2105Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2105Helper.cs @@ -8,9 +8,8 @@ using System.Threading.Tasks; namespace DataBlockHelper.DBHelpers { - public class DB2105Helper + public class DB2105Helper : DBHelper { - byte[] bytes; public DB2105Helper() { this.bytes = PlcConnect.Instance.Read("DB2105.0.0", 52).Content; diff --git a/DataBlockHelper/DBHelpers/DB2106Helper.cs b/DataBlockHelper/DBHelpers/DB2106Helper.cs index 324ac64..a38f725 100644 --- a/DataBlockHelper/DBHelpers/DB2106Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2106Helper.cs @@ -8,9 +8,8 @@ using System.Threading.Tasks; namespace DataBlockHelper.DBHelpers { - public class DB2106Helper + public class DB2106Helper : DBHelper { - byte[] bytes; public DB2106Helper() { this.bytes = PlcConnect.Instance.Read("DB2106.0.0", 5648).Content; diff --git a/DataBlockHelper/DBHelpers/DB2107Helper.cs b/DataBlockHelper/DBHelpers/DB2107Helper.cs index 832f2cb..c6c7865 100644 --- a/DataBlockHelper/DBHelpers/DB2107Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2107Helper.cs @@ -8,25 +8,24 @@ using HslCommunication; namespace DataBlockHelper.DBHelpers { - public class DB2107Helper + public class DB2107Helper : DBHelper { - private byte[] _bytes; public DB2107Helper() { - _bytes = PlcConnect.Instance.Read("DB2107.0.0", 2064).Content; + bytes = PlcConnect.Instance.Read("DB2107.0.0", 2064).Content; } // public OperateResult GetAll=>PlcConnect.Instance.Read("DB2107.0.0", 2057); - public NormalStatusEntity NormalStatus => NormalS(_bytes); + public NormalStatusEntity NormalStatus => NormalS(bytes); private NormalStatusEntity NormalS(byte[] bytes) { return new NormalStatusEntity(bytes); } - public ControlSignEntity ControlSign => ControlS(_bytes); + public ControlSignEntity ControlSign => ControlS(bytes); private ControlSignEntity ControlS(byte[] bytes) @@ -34,53 +33,53 @@ namespace DataBlockHelper.DBHelpers return new ControlSignEntity(bytes); } - public PressureEntity Pressure => Press(_bytes); + public PressureEntity Pressure => Press(bytes); private PressureEntity Press(byte[] bytes) { return new PressureEntity(bytes); } - public PIDEntity PID => Pid(_bytes); + public PIDEntity PID => Pid(bytes); private PIDEntity Pid(byte[] bytes) { return new PIDEntity(bytes); } - public WeightEntity Weight => Weigh(_bytes); + public WeightEntity Weight => Weigh(bytes); private WeightEntity Weigh(byte[] bytes) { return new WeightEntity(bytes); } - public WeightPraEntity WeightPra => WeightP(_bytes); + public WeightPraEntity WeightPra => WeightP(bytes); private WeightPraEntity WeightP(byte[] bytes) { return new WeightPraEntity(bytes); } - public SpeedEntity Speed => Spee(_bytes); + public SpeedEntity Speed => Spee(bytes); private SpeedEntity Spee(byte[] bytes) { return new SpeedEntity(bytes); } - public List Dryer => new UntiStatusHMIArrayManager(4, 1408, 32, _bytes).GetList(); - public List Gelater => new UntiStatusHMIArrayManager(8, 1536, 32, _bytes).GetList(); - public List Weter => new UntiStatusHMIArrayManager(8, 1792, 32, _bytes).GetList(); + public List Dryer => new UntiStatusHMIArrayManager(4, 1408, 32, bytes).GetList(); + public List Gelater => new UntiStatusHMIArrayManager(8, 1536, 32, bytes).GetList(); + public List Weter => new UntiStatusHMIArrayManager(8, 1792, 32, bytes).GetList(); - public ValveEntity Valve => Val(_bytes); + public ValveEntity Valve => Val(bytes); private ValveEntity Val(byte[] bytes) { return new ValveEntity(bytes); } - public LevelEntity Level => Lev(_bytes); + public LevelEntity Level => Lev(bytes); private LevelEntity Lev(byte[] bytes) { diff --git a/DataBlockHelper/DBHelpers/DBHelper.cs b/DataBlockHelper/DBHelpers/DBHelper.cs new file mode 100644 index 0000000..fafa31d --- /dev/null +++ b/DataBlockHelper/DBHelpers/DBHelper.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace DataBlockHelper.DBHelpers +{ + public class DBHelper + { + public byte[] bytes; + + public DBHelper(byte[] bytes) + { + this.bytes = bytes; + } + + public DBHelper() { } + + public bool ReadBitBySet(int word, int bit) + { + return bytes[word].GetBit(bit); + } + } +} diff --git a/DataBlockHelper/DataBlockHelper.csproj b/DataBlockHelper/DataBlockHelper.csproj index b4790bb..31af3bd 100644 --- a/DataBlockHelper/DataBlockHelper.csproj +++ b/DataBlockHelper/DataBlockHelper.csproj @@ -57,6 +57,7 @@ + diff --git a/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml b/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml index b530ef6..528a2e4 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/MainDetail.xml @@ -532,7 +532,7 @@ False - AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJoBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EYXRhR3JpZFZpZXdDb2x1bW5zLCBNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGxdXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBAAAKk1lc25hYy5Db250cm9scy5CYXNlLkRhdGFHcmlkVmlld0NvbHVtbnNbXQIAAAAICAkDAAAAAgAAABwAAAAHAwAAAAABAAAABAAAAAQoTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGF0YUdyaWRWaWV3Q29sdW1ucwIAAAAJBAAAAAkFAAAADQIFBAAAAChNZXNuYWMuQ29udHJvbHMuQmFzZS5EYXRhR3JpZFZpZXdDb2x1bW5zAgAAAApfZmlsZWREYXRhDF9kaXNwbGF5TmFtZQEBAgAAAAYGAAAAEEFsYXJtX090aGVyX0luZm8GBwAAAAzmiqXoraborr7lpIcBBQAAAAQAAAAGCAAAAA9BbGFybV9PY2N1clRpbWUGCQAAAAzmiqXorabml7bpl7QL + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJoBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EYXRhR3JpZFZpZXdDb2x1bW5zLCBNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGxdXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBAAAKk1lc25hYy5Db250cm9scy5CYXNlLkRhdGFHcmlkVmlld0NvbHVtbnNbXQIAAAAICAkDAAAAAwAAAF8AAAAHAwAAAAABAAAABAAAAAQoTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGF0YUdyaWRWaWV3Q29sdW1ucwIAAAAJBAAAAAkFAAAACQYAAAAKBQQAAAAoTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGF0YUdyaWRWaWV3Q29sdW1ucwIAAAAKX2ZpbGVkRGF0YQxfZGlzcGxheU5hbWUBAQIAAAAGBwAAAAzmiqXoraborr7lpIcGCAAAAAzmiqXoraborr7lpIcBBQAAAAQAAAAGCQAAAAzmiqXorablhoXlrrkGCgAAAAzmiqXorablhoXlrrkBBgAAAAQAAAAGCwAAAAzmiqXorabml7bpl7QGDAAAAAzmiqXorabml7bpl7QL AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL