diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GelBlackPowderCount.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GelBlackPowderCount.cs index c0e1ee0..2c9b227 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GelBlackPowderCount.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/GelBlackPowderCount.cs @@ -75,6 +75,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo dt = new DataTable(); dt.Columns.Add("机台", typeof(string)); dt.Columns.Add("总量", typeof(string)); + dt.Columns.Add("搅拌次数", typeof(string)); MoreDataTable = new DataTable(); MoreDataTable.Columns.Add("设定重量", typeof(string)); @@ -203,6 +204,10 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo var totalWeight = list.Where(x => x.deviceno == i).Sum(x => x.value); dr[1] = totalWeight.ToString(); + var totalCount=list.Where(x => x.deviceno==i).Where(x=>x.value>400).Count(); + dr[2] = totalCount.ToString(); + + dt.Rows.Add(dr); } var edr = dt.NewRow(); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs index 4b13955..bdd6c97 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs @@ -175,7 +175,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl #endregion LogInsertToDatabase(""); - + //读取停止按钮的状态 + FillWaterStop(); #region 配置文件加载 var table = FreeSqlUnit.Instance.Select().Where("1 = 1").ToList(); @@ -241,6 +242,79 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl timer.Tick += new EventHandler(ReadFromPlc);//添加事件 } + //GetAllDbMCControlsByOption(DbOptionTypes.Query); + + + private void FillWaterStop() + { + var query= GetAllDbMCControlsByOption(DbOptionTypes.Query); + + MCButton WaterStop1= query.Where(t => t.BaseControl.MCKey != null + && t.BaseControl.MCKey == "WaterStop1").FirstOrDefault().BaseControl as MCButton; + var plc = PlcConnect.Instance; + var waterStopBool1 = plc.ReadBool("DB2119.28.5").Content; + //如果等于1 文字取反 + if (waterStopBool1) + { + WaterStop1.Text = "冷水称A恢复"; + } + else + { + WaterStop1.Text = "冷水称A停止"; + } + + MCButton WaterStop2= query.Where(t => t.BaseControl.MCKey != null + && t.BaseControl.MCKey == "WaterStop2").FirstOrDefault().BaseControl as MCButton; + + + var waterStopBool2 = plc.ReadBool("DB2119.8.5").Content; + //如果等于1 文字取反 + if (waterStopBool2) + { + WaterStop2.Text = "热水称A恢复"; + } + else + { + WaterStop2.Text = "热水称A停止"; + } + + + MCButton WaterStop3= query.Where(t => t.BaseControl.MCKey != null + && t.BaseControl.MCKey == "WaterStop3").FirstOrDefault().BaseControl as MCButton; + + + var waterStopBool3 = plc.ReadBool("DB2119.38.5").Content; + //如果等于1 文字取反 + if (waterStopBool3) + { + WaterStop3.Text = "冷水称B恢复"; + } + else + { + WaterStop3.Text = "冷水称B停止"; + } + + MCButton WaterStop4= query.Where(t => t.BaseControl.MCKey != null + && t.BaseControl.MCKey == "WaterStop4").FirstOrDefault().BaseControl as MCButton; + + + + var waterStopBool4 = plc.ReadBool("DB2119.18.5").Content; + //如果等于1 文字取反 + if (waterStopBool4) + { + WaterStop3.Text = "热水称B恢复"; + } + else + { + WaterStop3.Text = "热水称B停止"; + } + + } + + + + #region 单选变色控制 private void Wet1_CheckedChanged(object sender, EventArgs e) @@ -307,6 +381,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl #endregion + + + #region 返回数据读取 private void Timer1_Tick() diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs index 4db1404..4e44dac 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs @@ -785,122 +785,130 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl if (WaterStop1 == runtime.Sender) { - switch (GelChooseA) - { - case 1: - PlcControl("DB2119.26.0", 1); - PlcControl("DB2119.28.5", true); - break; - case 2: - PlcControl("DB2119.26.0", 2); - PlcControl("DB2119.28.5", true); - break; - case 3: - PlcControl("DB2119.26.0", 3); - PlcControl("DB2119.28.5", true); - break; - case 4: - PlcControl("DB2119.26.0", 4); - PlcControl("DB2119.28.5", true); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } + //switch (GelChooseA) + //{ + // case 1: + // // PlcControl("DB2119.26.0", 1); + // //PlcControl("DB2119.28.5", true); + // break; + // case 2: + // // PlcControl("DB2119.26.0", 2); + // // PlcControl("DB2119.28.5", true); + // break; + // case 3: + // // PlcControl("DB2119.26.0", 3); + // // PlcControl("DB2119.28.5", true); + // break; + // case 4: + // //PlcControl("DB2119.26.0", 4); + // // PlcControl("DB2119.28.5", true); + // break; + // default: + // MessageBox.Show("请选择一个糊化锅!"); + // return; + //} - MessageBox.Show("冷水称A已停止排水"); - ManualLogControl("冷水称A停止排水"); - MesnacServiceManager.Instance.LoggingService.Info("冷水称A停止排水"); + WaterStopAction("DB2119.28.5", WaterStop1, "冷", "A"); + //MessageBox.Show("冷水称A已停止排水"); + //ManualLogControl("冷水称A停止排水"); + //MesnacServiceManager.Instance.LoggingService.Info("冷水称A停止排水"); } if (WaterStop2 == runtime.Sender) { - switch (GelChooseA) - { - case 1: - PlcControl("DB2119.6.0", 1); - PlcControl("DB2119.8.5", true); - break; - case 2: - PlcControl("DB2119.6.0", 2); - PlcControl("DB2119.8.5", true); - break; - case 3: - PlcControl("DB2119.6.0", 3); - PlcControl("DB2119.8.5", true); - break; - case 4: - PlcControl("DB2119.6.0", 4); - PlcControl("DB2119.8.5", true); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } + //switch (GelChooseA) + //{ + // case 1: + // //PlcControl("DB2119.6.0", 1); + // // PlcControl("DB2119.8.5", true); + // break; + // case 2: + // // PlcControl("DB2119.6.0", 2); + // // PlcControl("DB2119.8.5", true); + // break; + // case 3: + // // PlcControl("DB2119.6.0", 3); + // //PlcControl("DB2119.8.5", true); + // break; + // case 4: + // // PlcControl("DB2119.6.0", 4); + // // PlcControl("DB2119.8.5", true); + // break; + // default: + // MessageBox.Show("请选择一个糊化锅!"); + // return; + //} - MessageBox.Show("热水称A已停止排水"); - ManualLogControl("热水称A停止排水"); - MesnacServiceManager.Instance.LoggingService.Info("热水称A停止排水"); + WaterStopAction("DB2119.8.5", WaterStop2, "热", "A"); + + //MessageBox.Show("热水称A已停止排水"); + //ManualLogControl("热水称A停止排水"); + //MesnacServiceManager.Instance.LoggingService.Info("热水称A停止排水"); } if (WaterStop3 == runtime.Sender) { - switch (GelChooseB) - { - case 5: - PlcControl("DB2119.36.0", 1); - PlcControl("DB2119.38.5", true); - break; - case 6: - PlcControl("DB2119.36.0", 2); - PlcControl("DB2119.38.5", true); - break; - case 7: - PlcControl("DB2119.36.0", 3); - PlcControl("DB2119.38.5", true); - break; - case 8: - PlcControl("DB2119.36.0", 4); - PlcControl("DB2119.38.5", true); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } + //switch (GelChooseB) + //{ + // case 5: + // // PlcControl("DB2119.36.0", 1); + // // PlcControl("DB2119.38.5", true); + // break; + // case 6: + // // PlcControl("DB2119.36.0", 2); + // // PlcControl("DB2119.38.5", true); + // break; + // case 7: + // //PlcControl("DB2119.36.0", 3); + // // PlcControl("DB2119.38.5", true); + // break; + // case 8: + // // PlcControl("DB2119.36.0", 4); + // //PlcControl("DB2119.38.5", true); + // break; + // default: + // MessageBox.Show("请选择一个糊化锅!"); + // return; + //} + + WaterStopAction("DB2119.38.5", WaterStop3, "冷", "B"); + - MessageBox.Show("冷水称B已停止排水"); - ManualLogControl("冷水称B停止排水"); - MesnacServiceManager.Instance.LoggingService.Info("冷水称B停止排水"); + //MessageBox.Show("冷水称B已停止排水"); + //ManualLogControl("冷水称B停止排水"); + //MesnacServiceManager.Instance.LoggingService.Info("冷水称B停止排水"); } if (WaterStop4 == runtime.Sender) { - switch (GelChooseB) - { - case 5: - PlcControl("DB2119.16.0", 1); - PlcControl("DB2119.18.5", true); - break; - case 6: - PlcControl("DB2119.16.0", 2); - PlcControl("DB2119.18.5", true); - break; - case 7: - PlcControl("DB2119.16.0", 3); - PlcControl("DB2119.18.5", true); - break; - case 8: - PlcControl("DB2119.16.0", 4); - PlcControl("DB2119.18.5", true); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } + //switch (GelChooseB) + //{ + // case 5: + // // PlcControl("DB2119.16.0", 1); + // // PlcControl("DB2119.18.5", true); + // break; + // case 6: + // // PlcControl("DB2119.16.0", 2); + // // PlcControl("DB2119.18.5", true); + // break; + // case 7: + // // PlcControl("DB2119.16.0", 3); + // // PlcControl("DB2119.18.5", true); + // break; + // case 8: + // // PlcControl("DB2119.16.0", 4); + // //PlcControl("DB2119.18.5", true); + // break; + // default: + // MessageBox.Show("请选择一个糊化锅!"); + // return; + //} + + WaterStopAction("DB2119.18.5", WaterStop4, "热", "B"); - MessageBox.Show("热水称B已停止排水"); - ManualLogControl("热水称B停止排水"); - MesnacServiceManager.Instance.LoggingService.Info("热水称B停止排水"); + //MessageBox.Show("热水称B已停止排水"); + //ManualLogControl("热水称B停止排水"); + //MesnacServiceManager.Instance.LoggingService.Info("热水称B停止排水"); } #endregion @@ -1569,6 +1577,45 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl + + private void WaterStopAction(string plcAddress,MCButton button,string h,string a) + { + //先读取plc地址 + bool stopMe1 = PlcConnect.Instance.ReadBool(plcAddress).Content; + bool me1 = !stopMe1; + PlcControl(plcAddress, me1); + string txt = $"{h}水称{a}"; + //如果Plc是1 就证明是点了停止称量 + if (me1) + { + txt += "恢复"; + } + else + { + txt += "停止"; + } + button.Text = txt; + + + txt = $"{h}水称{a}"; + //如果Plc是1 就证明是点了停止称量 + if (!me1) + { + txt += "恢复"; + } + else + { + txt += "停止"; + } + + + + MessageBox.Show(txt); + ManualLogControl(txt); + MesnacServiceManager.Instance.LoggingService.Info(txt); + } + + #endregion } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs index a34245d..a1077ce 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs @@ -33,30 +33,13 @@ namespace Mesnac.Action.ChemicalWeighing.Test HslSwitch hslSwitch; + + HslLedDisplay hslLed; + public void timer1EventProcessor(object source, EventArgs e) { - DB2105Helper db2105Helper = new DB2105Helper(); - var lis = db2105Helper.ReadReadyG1; - lis = db2105Helper.ReadReadyG2; - lis = db2105Helper.ReadReadyG3; - lis = db2105Helper.ReadReadyG4; - lis = db2105Helper.ReadReadyG5; - lis = db2105Helper.ReadReadyG6; - lis = db2105Helper.ReadReadyG7; - lis = db2105Helper.ReadReadyG8; - var liss = db2105Helper.ReadReadyM1; - liss = db2105Helper.ReadReadyM2; - liss = db2105Helper.ReadReadyM3; - liss = db2105Helper.ReadReadyM4; - liss = db2105Helper.ReadReadyM5; - liss = db2105Helper.ReadReadyM6; - liss = db2105Helper.ReadReadyM7; - liss = db2105Helper.ReadReadyM8; - - - - var yw= Db3000Helper.ReadModel(); + hslLed.DisplayText = DateTime.Now.ToString("mm:ss"); } @@ -74,7 +57,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test hslSwitch.OnSwitchChanged += HslSwitch_OnSwitchChanged; - + hslLed= allDb.FirstOrDefault(x => x.Name == "HslLedDisplay1") as HslLedDisplay; //MCButton1 //OpenDoorService diff --git a/Main/MCEdit/Data/ComponentProperty.xml b/Main/MCEdit/Data/ComponentProperty.xml index e6d7ad9..2681135 100644 --- a/Main/MCEdit/Data/ComponentProperty.xml +++ b/Main/MCEdit/Data/ComponentProperty.xml @@ -1664,6 +1664,21 @@ + + + + + + + + + + + + + + + diff --git a/Main/MCEdit/Data/MCProject/nodeForm/Form1.xml b/Main/MCEdit/Data/MCProject/nodeForm/Form1.xml index ec195ad..7e15403 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/Form1.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/Form1.xml @@ -1,6 +1,11 @@ + + 448, 67 + HslLedDisplay1 + 325, 58 + 726, 199 HsSwitch1 diff --git a/Main/MCEdit/Data/SharpDevelopControlLibrary.xml b/Main/MCEdit/Data/SharpDevelopControlLibrary.xml index a6db9b9..286a345 100644 --- a/Main/MCEdit/Data/SharpDevelopControlLibrary.xml +++ b/Main/MCEdit/Data/SharpDevelopControlLibrary.xml @@ -116,6 +116,9 @@ + + +