From 513884b90fef0eaead6e392d1220ec67af0b81f6 Mon Sep 17 00:00:00 2001 From: wangsr Date: Tue, 17 Oct 2023 22:36:49 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E6=B7=BB=E5=8A=A0DB2119=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=9D=97=20=E6=89=8B=E5=8A=A8=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=B0=E6=95=B0=E6=8D=AE=E5=9D=97=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=9E=BA=E6=97=8B=E7=A7=B0=E9=87=8F=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManualControl/InitAction.cs | 271 ++++++++---------- .../ManualControl/ManualControlAction.cs | 111 ++++--- DataBlockHelper/DBHelpers/DB2119Helper.cs | 27 ++ DataBlockHelper/DataBlockHelper.csproj | 3 + .../Entity/DB2119Entity/SprialTempEntity.cs | 54 ++++ .../Entity/DB2119Entity/WaterTempEntity.cs | 65 +++++ .../MCProject/nodeForm/ManualWaterControl.xml | 230 ++++++++++++--- 7 files changed, 528 insertions(+), 233 deletions(-) create mode 100644 DataBlockHelper/DBHelpers/DB2119Helper.cs create mode 100644 DataBlockHelper/Entity/DB2119Entity/SprialTempEntity.cs create mode 100644 DataBlockHelper/Entity/DB2119Entity/WaterTempEntity.cs diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs index 2d249ff..65b2630 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs @@ -34,24 +34,23 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl { DB2107Helper DB2107; - + DB2119Helper DB2119; DB2103Helper DB2103; - List McControllist; - List _McControllist; + List McControllist; // InitData控件 + List _McControllist; // Modify控件 List allControl; - OperateResult Read; - - byte[] content; DbMCControl materialGridControl; Timer timer; - int flag = 0; - int no = 0; + Color backColor; + + #region 控件变量 + IBaseControl WaterActualValue1; IBaseControl WaterActualValue2; IBaseControl WaterActualValue3; @@ -64,6 +63,10 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl IBaseControl SpiralActValue2; IBaseControl SpiralActValue3; IBaseControl SpiralActValue4; + IBaseControl SpiralMetValue1; + IBaseControl SpiralMetValue2; + IBaseControl SpiralMetValue3; + IBaseControl SpiralMetValue4; IBaseControl MetageState1; IBaseControl MetageState2; IBaseControl MetageState3; @@ -86,14 +89,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl IBaseControl SetSpiralValue3; IBaseControl SetSpiralValue4; - bool State1; - bool State2; - byte Byt; - - - - Color backColor; - MCRadioButton Gel1; MCRadioButton Gel2; MCRadioButton Gel3; @@ -111,14 +106,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MCRadioButton Wet7; MCRadioButton Wet8; + #endregion public void Run(RuntimeParameter runtime) { - - - + base.RunIni(runtime); //必须要调用的 + #region 控件获取 + McControllist = GetAllDbMCControlsByOption(DbOptionTypes.InitData); _McControllist = GetAllDbMCControlsByOption(DbOptionTypes.Modify); allControl = GetAllControls(); @@ -134,6 +130,10 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl SpiralActValue2 = GetBaseControl("SpiralActValue2"); SpiralActValue3 = GetBaseControl("SpiralActValue3"); SpiralActValue4 = GetBaseControl("SpiralActValue4"); + SpiralMetValue1 = GetBaseControl("SpiralMetValue1"); + SpiralMetValue2 = GetBaseControl("SpiralMetValue2"); + SpiralMetValue3 = GetBaseControl("SpiralMetValue3"); + SpiralMetValue4 = GetBaseControl("SpiralMetValue4"); MetageState1 = GetBaseControl("MetageState1"); MetageState2 = GetBaseControl("MetageState2"); MetageState3 = GetBaseControl("MetageState3"); @@ -147,6 +147,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl SpiralState3 = GetBaseControl("SpiralState3"); SpiralState4 = GetBaseControl("SpiralState4"); + SetWaterValue1 = _GetBaseControl("SetWaterValue1"); SetWaterValue2 = _GetBaseControl("SetWaterValue2"); SetWaterValue3 = _GetBaseControl("SetWaterValue3"); @@ -156,10 +157,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl SetSpiralValue3 = _GetBaseControl("SetSpiralValue3"); SetSpiralValue4 = _GetBaseControl("SetSpiralValue4"); + materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "ManualLogGridView").FirstOrDefault(); + #endregion + LogInsertToDatabase(); + #region 配置文件加载 + SetWaterValue1.MCValue = Setting.Default.SetWaterValue1; SetWaterValue2.MCValue = Setting.Default.SetWaterValue2; SetWaterValue3.MCValue = Setting.Default.SetWaterValue3; @@ -171,6 +177,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MesnacServiceManager.Instance.LoggingService.Info("配置已加载"); ManualLogControl("配置已加载 "); + #endregion + + #region 变色控制 Gel1 = GetMCRadioButton("Gel1"); backColor = Gel1.BackColor; @@ -181,7 +190,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl Gel3.CheckedChanged += McradionA_CheckedChanged; Gel4 = GetMCRadioButton("Gel4"); Gel4.CheckedChanged += McradionA_CheckedChanged; - Gel5 = GetMCRadioButton("Gel5"); Gel5.CheckedChanged += McradionB_CheckedChanged; Gel6 = GetMCRadioButton("Gel6"); @@ -191,7 +199,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl Gel8 = GetMCRadioButton("Gel8"); Gel8.CheckedChanged += McradionB_CheckedChanged; - Wet1 = GetMCRadioButton("Wet1"); Wet1.CheckedChanged += Wet1_CheckedChanged; Wet2 = GetMCRadioButton("Wet2"); @@ -202,19 +209,17 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl Wet4 = GetMCRadioButton("Wet4"); Wet4.CheckedChanged += Wet3_CheckedChanged; - Wet5 = GetMCRadioButton("Wet5"); Wet5.CheckedChanged += Wet5_CheckedChanged; Wet6 = GetMCRadioButton("Wet6"); Wet6.CheckedChanged += Wet5_CheckedChanged; - Wet7 = GetMCRadioButton("Wet7"); Wet7.CheckedChanged += Wet7_CheckedChanged; Wet8 = GetMCRadioButton("Wet8"); - Wet8.CheckedChanged += Wet7_CheckedChanged; + #endregion timer = new Timer(); timer.Interval = 1000; @@ -222,6 +227,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl timer.Tick += new EventHandler(ReadFromPlc);//添加事件 } + #region 单选变色控制 + private void Wet1_CheckedChanged(object sender, EventArgs e) { MCRadioButton mCRadio = sender as MCRadioButton; @@ -254,18 +261,52 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl mCRadio.BackColor = Color.GreenYellow; } + private MCRadioButton GetMCRadioButton(string name) + { + var mcradion = allControl.Where(t => t.Name == name).FirstOrDefault() as MCRadioButton; + + return mcradion; + } + + private void McradionA_CheckedChanged(object sender, EventArgs e) + { + MCRadioButton mCRadio = sender as MCRadioButton; + Gel1.BackColor = backColor; + Gel2.BackColor = backColor; + Gel3.BackColor = backColor; + Gel4.BackColor = backColor; + mCRadio.BackColor = Color.GreenYellow; + + + } + + private void McradionB_CheckedChanged(object sender, EventArgs e) + { + MCRadioButton mCRadio = sender as MCRadioButton; + Gel5.BackColor = backColor; + Gel6.BackColor = backColor; + Gel7.BackColor = backColor; + Gel8.BackColor = backColor; + mCRadio.BackColor = Color.GreenYellow; + } + + + #endregion + + #region 返回数据读取 + private void Timer1_Tick() { bool mixok1 = PlcConnect.Instance.ReadBool("DB3000.0.0").Content; - Time(1, mixok1?1:0); + Time(1, mixok1 ? 1 : 0); + bool mixok2 = PlcConnect.Instance.ReadBool("DB3000.0.1").Content; Time(2, mixok2 ? 1 : 0); bool mixok3 = PlcConnect.Instance.ReadBool("DB3000.0.2").Content; Time(3, mixok3 ? 1 : 0); - bool mixok4 = PlcConnect.Instance.ReadBool("DB3000.0.3").Content; Time(4, mixok4 ? 1 : 0); @@ -280,8 +321,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl bool mixok8 = PlcConnect.Instance.ReadBool("DB3000.0.7").Content; Time(8, mixok8 ? 1 : 0); - } + } private void Time(int deviceNo,int statu) { @@ -312,55 +353,22 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}返回数据" + returnTest); }); - } - private MCRadioButton GetMCRadioButton(string name) - { - var mcradion= allControl.Where(t => t.Name == name).FirstOrDefault() as MCRadioButton; - - return mcradion; - } + #endregion - private void McradionA_CheckedChanged(object sender, EventArgs e) - { - MCRadioButton mCRadio=sender as MCRadioButton; - Gel1.BackColor = backColor; - Gel2.BackColor = backColor; - Gel3.BackColor = backColor; - Gel4.BackColor = backColor; - mCRadio.BackColor = Color.GreenYellow; - - - } - - private void McradionB_CheckedChanged(object sender, EventArgs e) - { - MCRadioButton mCRadio = sender as MCRadioButton; - Gel5.BackColor = backColor; - Gel6.BackColor = backColor; - Gel7.BackColor = backColor; - Gel8.BackColor = backColor; - mCRadio.BackColor = Color.GreenYellow; - } + #region Timer刷新方法 Plc读取 private void ReadFromPlc(object sender, EventArgs e) { DB2107 = new DB2107Helper(); - DB2103 = new DB2103Helper(); - + DB2119 = new DB2119Helper(); - flag += 1; - if (flag > 10) - { - flag = 0; - //LogInsertToDatabase(); - } + DB2103 = new DB2103Helper(); no += 1; - if(no > 5) { no = 0; @@ -373,6 +381,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl timer.Dispose(); } + #region 实际值 称量值指示 + WaterActualValue1.MCValue = DB2107.Weight.WScale_3.ActWeight; WaterActualValue2.MCValue = DB2107.Weight.WScale_1.ActWeight; @@ -381,32 +391,13 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl WaterActualValue4.MCValue = DB2107.Weight.WScale_2.ActWeight; - Read = PlcConnect.Instance.Read("DB2119.24.0", 2); - - content = Read.Content; - - WaterMetValue1.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); - - Read = PlcConnect.Instance.Read("DB2119.4.0", 2); - - content = Read.Content; - - WaterMetValue2.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); - - Read = PlcConnect.Instance.Read("DB2119.34.0", 2); - - content = Read.Content; - - WaterMetValue3.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); - - Read = PlcConnect.Instance.Read("DB2119.14.0", 2); - - content = Read.Content; - - WaterMetValue4.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); + WaterMetValue1.MCValue = DB2119.Coolwater_A.Value_Initial; + WaterMetValue2.MCValue = DB2119.Hotwater_A.Value_Initial; + WaterMetValue3.MCValue = DB2119.Coolwater_B.Value_Initial; + WaterMetValue4.MCValue = DB2119.Hotwater_B.Value_Initial; SpiralActValue1.MCValue = DB2103.DM2ASF01.ACT_Speed; @@ -416,17 +407,17 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl SpiralActValue4.MCValue = DB2103.DM2DSF01.ACT_Speed; + SpiralMetValue1.MCValue = DB2119.Spiral_A.Value_Weight; - Read = PlcConnect.Instance.Read("DB2119.28.0", 1); + SpiralMetValue2.MCValue = DB2119.Spiral_B.Value_Weight; - content = Read.Content; + SpiralMetValue3.MCValue = DB2119.Spiral_C.Value_Weight; - Byt = content[0]; + #endregion - State1 = Byt.GetBit(2); - State2 = Byt.GetBit(6); + #region 水称状态指示 - if (State1) + if (DB2119.Coolwater_A.Dos_Status) { MetageState1.MCValue = "正在称量"; } @@ -435,7 +426,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MetageState1.MCValue = "停止称量"; } - if (State2) + if (DB2119.Coolwater_A.Dis_Status) { WaterOutState1.MCValue = "正在排水"; } @@ -444,16 +435,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl WaterOutState1.MCValue = "停止排水"; } - Read = PlcConnect.Instance.Read("DB2119.8.0", 1); - - content = Read.Content; - - Byt = content[0]; - - State1 = Byt.GetBit(2); - State2 = Byt.GetBit(6); - - if (State1) + if (DB2119.Hotwater_A.Dos_Status) { MetageState2.MCValue = "正在称量"; } @@ -462,7 +444,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MetageState2.MCValue = "停止称量"; } - if (State2) + if (DB2119.Hotwater_A.Dis_Status) { WaterOutState2.MCValue = "正在排水"; } @@ -471,16 +453,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl WaterOutState2.MCValue = "停止排水"; } - Read = PlcConnect.Instance.Read("DB2119.38.0", 1); - - content = Read.Content; - - Byt = content[0]; - - State1 = Byt.GetBit(2); - State2 = Byt.GetBit(6); - - if (State1) + if (DB2119.Coolwater_B.Dos_Status) { MetageState3.MCValue = "正在称量"; } @@ -489,7 +462,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MetageState3.MCValue = "停止称量"; } - if (State2) + if (DB2119.Coolwater_B.Dis_Status) { WaterOutState3.MCValue = "正在排水"; } @@ -498,16 +471,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl WaterOutState3.MCValue = "停止排水"; } - Read = PlcConnect.Instance.Read("DB2119.18.0", 1); - - content = Read.Content; - - Byt = content[0]; - - State1 = Byt.GetBit(2); - State2 = Byt.GetBit(6); - - if (State1) + if (DB2119.Hotwater_B.Dos_Status) { MetageState4.MCValue = "正在称量"; } @@ -516,7 +480,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MetageState4.MCValue = "停止称量"; } - if (State2) + if (DB2119.Hotwater_B.Dis_Status) { WaterOutState4.MCValue = "正在排水"; } @@ -525,16 +489,11 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl WaterOutState4.MCValue = "停止排水"; } + #endregion - Read = PlcConnect.Instance.Read("DB2119.60.0", 1); - - content = Read.Content; + #region 螺旋状态指示 - Byt = content[0]; - - State1 = Byt.GetBit(2); - - if (State1) + if (DB2119.Spiral_A.Dos_Status) { SpiralState1.MCValue = "正在螺旋"; } @@ -543,15 +502,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl SpiralState1.MCValue = "停止螺旋"; } - Read = PlcConnect.Instance.Read("DB2119.82.0", 1); - - content = Read.Content; - - Byt = content[0]; - - State1 = Byt.GetBit(2); - - if (State1) + if (DB2119.Spiral_B.Dos_Status) { SpiralState2.MCValue = "正在螺旋"; } @@ -560,15 +511,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl SpiralState2.MCValue = "停止螺旋"; } - Read = PlcConnect.Instance.Read("DB2119.104.0", 1); - - content = Read.Content; - - Byt = content[0]; - - State1 = Byt.GetBit(2); - - if (State1) + if (DB2119.Spiral_C.Dos_Status) { SpiralState3.MCValue = "正在螺旋"; } @@ -594,19 +537,38 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl // MetageState4.MCValue = "停止螺旋"; //} + #endregion } + #endregion + + #region 控件获取帮助 + + /// + /// InitData控件获取 + /// + /// + /// private IBaseControl GetBaseControl(string name) { return McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl; } + /// + /// Modify控件获取 + /// + /// + /// private IBaseControl _GetBaseControl(string name) { return _McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl; } + #endregion + + #region 日志控制 + private void LogInsertToDatabase() { DataTable table = DBHelp.GetTable(@"select top 200 id, logtext, logtime from Manual_Log order by id desc"); @@ -633,5 +595,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl FreeSqlUnit.Instance.Insert(Log).ExecuteIdentity(); } + + #endregion + } } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs index 25583a5..70d278a 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs @@ -146,29 +146,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl BottomSelect(runtime); } - - private void LogInsertToDatabase(string txt) - { - string sql = "select top 500 id, logtext, logtime from Manual_Log "; - - if (!string.IsNullOrEmpty(txt)) - { - sql += $" where logtext like '%{txt}%'"; - } - - sql += " order by id desc"; - DataTable table = DBHelp.GetTable(sql); - if (this.materialGridControl != null && this.materialGridControl.BaseControl != null) - { - this.materialGridControl.BaseControl.BindDataSource = null; - this.materialGridControl.BaseControl.BindDataSource = table; - } - else - { - ICSharpCode.Core.LoggingService.Warn("ManualContrlolAction 手动操作日志信息控件为Null..."); - } - } + #region 控件获取导入 /// /// 控件导入 @@ -265,6 +244,10 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl LoadSetting = GetButtonControl("LoadSetting"); } + #endregion + + #region 单选框选择扫描 + /// /// 单选框选择操作机台 /// @@ -352,6 +335,10 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl } } + #endregion + + #region 按钮事件 + /// /// 按钮选择事件 /// @@ -359,6 +346,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl private void BottomSelect(RuntimeParameter runtime) { Focus.Focus(); + + #region 水称称量按钮 + if (StartMetage1 == runtime.Sender) { short value; @@ -480,6 +470,10 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MessageBox.Show("称量已停止!"); } + #endregion + + #region 排水按钮 + if (WaterOut1 == runtime.Sender) { if (MessageBox.Show("冷水称A确认开始排水?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) @@ -756,6 +750,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MesnacServiceManager.Instance.LoggingService.Info("热水称B停止排水"); } + #endregion + + #region 螺旋控制按钮 if (SpiralOn1 == runtime.Sender) { @@ -1086,14 +1083,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl // default: return; //} } - - //点击日志查询 - if (WetRequest1 == runtime.Sender) - { - string key = keywords.MCValue.ToString(); - LogInsertToDatabase(key); - } - if (SpiralOff1 == runtime.Sender) { @@ -1127,20 +1116,18 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl //MessageBox.Show("螺旋4已停止!"); } + #endregion - - - - - - - + #region 日志查询 配置加载 + //点击日志查询 + if (WetRequest1 == runtime.Sender) + { + string key = keywords.MCValue.ToString(); + LogInsertToDatabase(key); + } - - - if(SaveSetting == runtime.Sender) { short value1; @@ -1195,8 +1182,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl MesnacServiceManager.Instance.LoggingService.Info("配置已加载"); ManualLogControl("配置已加载 "); } + + #endregion + } + #endregion + + #region plc插入控制 + private void PlcControl(string address, short binNo) { PlcConnect.Instance.Write(address, binNo); @@ -1205,6 +1199,11 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl { PlcConnect.Instance.Write(address, state); } + + #endregion + + #region 控件获取 + private IBaseControl GetBaseControl(string name) { return _McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl; @@ -1214,6 +1213,33 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl return McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl as MCButton; } + #endregion + + #region 日志控制 + + private void LogInsertToDatabase(string txt) + { + string sql = "select top 500 id, logtext, logtime from Manual_Log "; + + if (!string.IsNullOrEmpty(txt)) + { + sql += $" where logtext like '%{txt}%'"; + } + + sql += " order by id desc"; + DataTable table = DBHelp.GetTable(sql); + + if (this.materialGridControl != null && this.materialGridControl.BaseControl != null) + { + this.materialGridControl.BaseControl.BindDataSource = null; + this.materialGridControl.BaseControl.BindDataSource = table; + } + else + { + ICSharpCode.Core.LoggingService.Warn("ManualContrlolAction 手动操作日志信息控件为Null..."); + } + } + private void ManualLogControl(string logName) { var Log = new ManualLogEntity() @@ -1227,5 +1253,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl LogInsertToDatabase(""); } - } + + #endregion + + } } diff --git a/DataBlockHelper/DBHelpers/DB2119Helper.cs b/DataBlockHelper/DBHelpers/DB2119Helper.cs new file mode 100644 index 0000000..484cf1f --- /dev/null +++ b/DataBlockHelper/DBHelpers/DB2119Helper.cs @@ -0,0 +1,27 @@ +using DataBlockHelper.Entity.DB2102Entity; +using DataBlockHelper.Entity.DB2119Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataBlockHelper.DBHelpers +{ + public class DB2119Helper : DBHelper + { + public DB2119Helper() + { + bytes = PlcConnect.Instance.Read("DB2119.0.0", 106).Content; + } + + public WaterTempEntity Hotwater_A => new WaterTempEntity(0, bytes); + public WaterTempEntity Hotwater_B => new WaterTempEntity(10, bytes); + public WaterTempEntity Coolwater_A => new WaterTempEntity(20, bytes); + public WaterTempEntity Coolwater_B => new WaterTempEntity(30, bytes); + public SprialTempEntity Spiral_A => new SprialTempEntity(40, bytes); + public SprialTempEntity Spiral_B => new SprialTempEntity(62, bytes); + public SprialTempEntity Spiral_C => new SprialTempEntity(84, bytes); + + } +} diff --git a/DataBlockHelper/DataBlockHelper.csproj b/DataBlockHelper/DataBlockHelper.csproj index 31af3bd..5661917 100644 --- a/DataBlockHelper/DataBlockHelper.csproj +++ b/DataBlockHelper/DataBlockHelper.csproj @@ -54,6 +54,7 @@ + @@ -77,6 +78,8 @@ + + diff --git a/DataBlockHelper/Entity/DB2119Entity/SprialTempEntity.cs b/DataBlockHelper/Entity/DB2119Entity/SprialTempEntity.cs new file mode 100644 index 0000000..8250f8c --- /dev/null +++ b/DataBlockHelper/Entity/DB2119Entity/SprialTempEntity.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataBlockHelper.Entity.DB2119Entity +{ + public class SprialTempEntity + { + public SprialTempEntity(ushort startSet, byte[] bytes) + { + // OperateResult read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2); + + byte[] content = bytes.Skip(startSet).Take(22).ToArray(); + + Value_Set = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); + Value_Ack = PlcConnect.Instance.ByteTransform.TransInt16(content, 2); + Value_Fast = PlcConnect.Instance.ByteTransform.TransInt16(content, 4); + Value_Point = PlcConnect.Instance.ByteTransform.TransInt16(content, 6); + Motor_Speed = PlcConnect.Instance.ByteTransform.TransInt16(content, 8); + Speed_Fast = PlcConnect.Instance.ByteTransform.TransInt16(content, 10); + Speed_Low = PlcConnect.Instance.ByteTransform.TransInt16(content, 12); + Speed_Point = PlcConnect.Instance.ByteTransform.TransInt16(content, 14); + Value_Weight = PlcConnect.Instance.ByteTransform.TransInt16(content, 16); + Weter_Bin = PlcConnect.Instance.ByteTransform.TransInt16(content, 18); + + byte byt = content[20]; + + Dos_Start = byt.GetBit(0); + Dos_Stop = byt.GetBit(1); + Dos_Status = byt.GetBit(2); + Dos_End = byt.GetBit(3); + Polarty = byt.GetBit(4); + + } + + public short Value_Set { get; private set; } + public short Value_Ack { get; private set; } + public short Value_Fast { get; private set; } + public short Value_Point { get; private set; } + public short Motor_Speed { get; private set; } + public short Speed_Fast { get; private set; } + public short Speed_Low { get; private set; } + public short Speed_Point { get; private set; } + public short Value_Weight { get; private set; } + public short Weter_Bin { get; private set; } + public bool Dos_Start { get; private set; } + public bool Dos_Stop { get; private set; } + public bool Dos_Status { get; private set; } + public bool Dos_End { get; private set; } + public bool Polarty { get; private set; } + } +} diff --git a/DataBlockHelper/Entity/DB2119Entity/WaterTempEntity.cs b/DataBlockHelper/Entity/DB2119Entity/WaterTempEntity.cs new file mode 100644 index 0000000..391f9c6 --- /dev/null +++ b/DataBlockHelper/Entity/DB2119Entity/WaterTempEntity.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataBlockHelper.Entity.DB2119Entity +{ + public class WaterTempEntity + { + public WaterTempEntity(ushort startSet, byte[] bytes) + { + // OperateResult read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2); + + byte[] content = bytes.Skip(startSet).Take(10).ToArray(); + + Value_Set = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); + Value_Act = PlcConnect.Instance.ByteTransform.TransInt16(content, 2); + Value_Initial = PlcConnect.Instance.ByteTransform.TransInt16(content, 4); + Gela_Bin = PlcConnect.Instance.ByteTransform.TransInt16(content, 6); + + byte byt = content[0]; + + Dos_Start = byt.GetBit(0); + Dos_Stop = byt.GetBit(1); + Dos_Status = byt.GetBit(2); + Dos_End = byt.GetBit(3); + Dis_Start = byt.GetBit(4); + Dis_Stop = byt.GetBit(5); + Dis_Status = byt.GetBit(6); + Dis_End = byt.GetBit(7); + + byt = content[1]; + + In_Value1 = byt.GetBit(0); + In_Value2 = byt.GetBit(1); + Out_Value = byt.GetBit(2); + Out_Value1 = byt.GetBit(3); + Out_Value2 = byt.GetBit(4); + Out_Value3 = byt.GetBit(5); + Out_Value4 = byt.GetBit(6); + + } + + public short Value_Set { get; private set; } + public short Value_Act { get; private set; } + public short Value_Initial { get; private set; } + public short Gela_Bin { get; private set; } + public bool Dos_Start { get; private set; } + public bool Dos_Stop { get; private set; } + public bool Dos_Status { get; private set; } + public bool Dos_End { get; private set; } + public bool Dis_Start { get; private set; } + public bool Dis_Stop { get; private set; } + public bool Dis_Status { get; private set; } + public bool Dis_End { get; private set; } + public bool In_Value1 { get; private set; } + public bool In_Value2 { get; private set; } + public bool Out_Value { get; private set; } + public bool Out_Value1 { get; private set; } + public bool Out_Value2 { get; private set; } + public bool Out_Value3 { get; private set; } + public bool Out_Value4 { get; private set; } + } +} diff --git a/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml b/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml index da0d9d3..ebeb9e7 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml @@ -133,17 +133,36 @@ False 3, 17 MCDataGridView3 - 357, 745 + 357, 775 2 False 操作日志 862, 12 GroupBox9 - 366, 771 + 366, 800 27 + + + + Red + DarkGray + SpiralMetValue2 + + False + + + + InitData + True + True + 0 + 53, 222 + MCLabel89 + 11, 12 + @@ -159,10 +178,29 @@ True True 停止螺旋 - 58, 226 + 57, 255 MCLabel84 53, 12 + + + + Red + DarkGray + + + False + + + + None + True + True + 称量值 + 11, 222 + MCLabel90 + 41, 12 + @@ -178,7 +216,7 @@ True True 状态: - 11, 226 + 10, 255 MCLabel79 41, 12 @@ -226,7 +264,7 @@ DarkGray System 螺旋2停止 - 86, 294 + 85, 323 MCButton6 74, 38 27 @@ -318,7 +356,7 @@ DarkGray System 螺旋2启动 - 7, 293 + 6, 322 SpiralOn2 74, 38 22 @@ -363,7 +401,7 @@ True True 湿混机3 - 12, 255 + 11, 284 Wet3 69, 24 22 @@ -465,7 +503,7 @@ True True 湿混机4 - 84, 255 + 83, 284 Wet4 69, 24 23 @@ -546,10 +584,10 @@ None True True - 实际值 + 速度 11, 193 MCLabel19 - 41, 12 + 29, 12 @@ -574,10 +612,29 @@ 湿混机螺旋2 184, 443 GroupBox6 - 165, 340 + 165, 369 25 + + + + Red + DarkGray + SpiralMetValue3 + + False + + + + InitData + True + True + 0 + 53, 222 + MCLabel91 + 11, 12 + @@ -593,10 +650,29 @@ True True 停止螺旋 - 58, 226 + 58, 255 MCLabel85 53, 12 + + + + Red + DarkGray + + + False + + + + None + True + True + 称量值 + 11, 222 + MCLabel92 + 41, 12 + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL @@ -636,7 +712,7 @@ True True 状态: - 11, 226 + 11, 255 MCLabel81 41, 12 @@ -851,7 +927,7 @@ DarkGray System 螺旋3停止 - 85, 293 + 85, 322 MCButton7 74, 38 28 @@ -876,7 +952,7 @@ DarkGray System 螺旋3启动 - 6, 293 + 6, 322 SpiralOn3 74, 38 22 @@ -897,7 +973,7 @@ True True 湿混机5 - 11, 254 + 11, 283 Wet5 69, 24 22 @@ -937,7 +1013,7 @@ True True 湿混机6 - 83, 254 + 83, 283 Wet6 69, 24 23 @@ -999,19 +1075,38 @@ None True True - 实际值 + 速度 11, 193 MCLabel22 - 41, 12 + 29, 12 False 湿混机螺旋3 354, 443 GroupBox7 - 165, 340 + 165, 369 25 + + + + Red + DarkGray + SpiralMetValue4 + + False + + + + InitData + True + True + 0 + 53, 222 + MCLabel93 + 11, 12 + @@ -1027,10 +1122,29 @@ True True 停止螺旋 - 58, 226 + 58, 255 MCLabel86 53, 12 + + + + Red + DarkGray + + + False + + + + None + True + True + 称量值 + 11, 222 + MCLabel94 + 41, 12 + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL @@ -1070,7 +1184,7 @@ True True 状态: - 11, 226 + 11, 255 MCLabel83 41, 12 @@ -1285,7 +1399,7 @@ DarkGray System 螺旋4停止 - 85, 293 + 85, 322 MCButton8 74, 38 29 @@ -1310,7 +1424,7 @@ DarkGray System 螺旋4启动 - 6, 293 + 6, 322 SpiralOn4 74, 38 22 @@ -1331,7 +1445,7 @@ True True 湿混机7 - 11, 255 + 11, 284 Wet7 69, 24 22 @@ -1371,7 +1485,7 @@ True True 湿混机8 - 83, 255 + 83, 284 Wet8 69, 24 23 @@ -1433,19 +1547,38 @@ None True True - 实际值 + 速度 11, 193 MCLabel25 - 41, 12 + 29, 12 False 湿混机螺旋4 525, 443 GroupBox8 - 165, 340 + 165, 369 25 + + + + Red + DarkGray + SpiralMetValue1 + + False + + + + InitData + True + True + 0 + 53, 222 + MCLabel87 + 11, 12 + @@ -1461,10 +1594,29 @@ True True 停止螺旋 - 58, 226 + 58, 254 MCLabel62 53, 12 + + + + Red + DarkGray + + + False + + + + None + True + True + 称量值 + 11, 222 + MCLabel88 + 41, 12 + @@ -1480,7 +1632,7 @@ True True 状态: - 11, 226 + 11, 254 MCLabel63 41, 12 @@ -1719,7 +1871,7 @@ DarkGray System 螺旋1停止 - 86, 294 + 86, 322 MCButton5 74, 38 26 @@ -1744,7 +1896,7 @@ DarkGray System 螺旋1启动 - 7, 294 + 7, 322 SpiralOn1 74, 38 22 @@ -1765,7 +1917,7 @@ True True 湿混机1 - 11, 255 + 11, 283 Wet1 69, 24 22 @@ -1805,7 +1957,7 @@ True True 湿混机2 - 83, 255 + 83, 283 Wet2 69, 24 23 @@ -1867,16 +2019,16 @@ None True True - 实际值 + 速度 11, 193 MCLabel15 - 41, 12 + 29, 12 False 湿混机螺旋1 13, 443 GroupBox5 - 165, 340 + 165, 369 15 @@ -3385,7 +3537,7 @@ False False Control - 1256, 832 + 1256, 861 WindowsDefaultLocation 手动控制 Normal