自动模式

dep
我叫锄头 11 months ago
parent 53d3e4921a
commit 728f612e6f

@ -469,6 +469,11 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
RepairOnOff(LabelE, RadioE);
}
if(ButtonE.GRepairMode == runtime.Sender)
{
GRepairOnOff(ButtonE, RadioE);
}
#endregion
#region 粘贴数据

@ -79,6 +79,8 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.Entity
public Button GelManualHotWater { get; set; }
public Button WetManualGel { get; set; }
public Button RepairMode { get; set; }
public Button GRepairMode { get; set; }
public Button DryDownload { get; set; }
public Button WaterDownload { get; set; }
public Button PasteDry { get; set; }

@ -38,7 +38,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
DB2105Helper dB2105Helper = new DB2105Helper();
DB2104Helper dB2104Helper = new DB2104Helper();
Color color;
public Timer timer;
public void Run(RuntimeParameter runtime)
@ -62,6 +62,9 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
ControlsHelper.ControlImport<MCRadioButton>(RadioE, McControls);
ControlsHelper.ControlImport<Button>(buttonE, McControls);
// color = buttonE.GRepairMode;
ControlInit();
RadioE.Line1.CheckedChanged += Mcradion_CheckedChanged;
@ -132,6 +135,56 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
LabelE.RepairState.BackColor = Color.LightGreen;
}
var index = ControlsHelper.SingleSelect(RadioE);
switch (index)
{
case 1:
ConvertBackColor(dB2105Helper.FeededPdG1);
break;
case 2:
ConvertBackColor(dB2105Helper.FeededPdG2);
break;
case 3:
ConvertBackColor(dB2105Helper.FeededPdG3);
break;
case 4:
ConvertBackColor(dB2105Helper.FeededPdG4);
break;
case 5:
ConvertBackColor(dB2105Helper.FeededPdG5);
break;
case 6:
ConvertBackColor(dB2105Helper.FeededPdG6);
break;
case 7:
ConvertBackColor(dB2105Helper.FeededPdG7);
break;
case 8:
ConvertBackColor(dB2105Helper.FeededPdG8);
break;
}
}
private void ConvertBackColor(bool b)
{
if (b)
{
buttonE.GRepairMode.BackColor = Color.Green;
buttonE.GRepairMode.Text = "糊化锅维修模式(开)";
}
else
{
buttonE.GRepairMode.BackColor = Color.Transparent;
buttonE.GRepairMode.Text = "糊化锅维修模式(关)";
}
}
private string ConvertOnOff(bool state)

@ -1046,6 +1046,99 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
}
}
public static void GRepairOnOff(ButtonEntity buttonEntity, MCRadioButtonEntity RadioE)
{
var index = ControlsHelper.SingleSelect(RadioE);
if(index <= 0)
{
MessageBox.Show("请选择机台");
return;
}
if (buttonEntity.GRepairMode.Text.Contains("关"))
{
if (MessageBox.Show("是否开启维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
switch (index)
{
case 1:
DB2105WriteHelper.AddFeededPdG1(true);
break;
case 2:
DB2105WriteHelper.AddFeededPdG2(true);
break;
case 3:
DB2105WriteHelper.AddFeededPdG3(true);
break;
case 4:
DB2105WriteHelper.AddFeededPdG4(true);
break;
case 5:
DB2105WriteHelper.AddFeededPdG5(true);
break;
case 6:
DB2105WriteHelper.AddFeededPdG6(true);
break;
case 7:
DB2105WriteHelper.AddFeededPdG7(true);
break;
case 8:
DB2105WriteHelper.AddFeededPdG8(true);
break;
}
}
else
{
if (buttonEntity.GRepairMode.Text.Contains("开"))
{
if (MessageBox.Show("是否关闭维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
}
switch (index)
{
case 1:
DB2105WriteHelper.AddFeededPdG1(false);
break;
case 2:
DB2105WriteHelper.AddFeededPdG2(false);
break;
case 3:
DB2105WriteHelper.AddFeededPdG3(false);
break;
case 4:
DB2105WriteHelper.AddFeededPdG4(false);
break;
case 5:
DB2105WriteHelper.AddFeededPdG5(false);
break;
case 6:
DB2105WriteHelper.AddFeededPdG6(false);
break;
case 7:
DB2105WriteHelper.AddFeededPdG7(false);
break;
case 8:
DB2105WriteHelper.AddFeededPdG8(false);
break;
}
}
}
#endregion
#region 湿混机物料封装

@ -107,6 +107,20 @@ namespace DataBlockHelper.DBHelpers
}
public bool FeededPdG1 => FeededPdG(94);
public bool FeededPdG2 => FeededPdG(96);
public bool FeededPdG3 => FeededPdG(98);
public bool FeededPdG4 => FeededPdG(100);
public bool FeededPdG5 => FeededPdG(102);
public bool FeededPdG6 => FeededPdG(104);
public bool FeededPdG7 => FeededPdG(106);
public bool FeededPdG8 => FeededPdG(108);
public List<bool> ReadReadyG1 => ReadReady(94);
public List<bool> ReadReadyG2 => ReadReady(96);
@ -197,6 +211,13 @@ namespace DataBlockHelper.DBHelpers
}
public bool FeededPdG(int start)
{
var first = bytes.Skip(start).Take(1).First();
var pd = first.GetBit(6);
return pd;
}
public bool ReadReadyM(int start)
{
var first = bytes.Skip(start).Take(1).First();

@ -719,5 +719,51 @@ namespace DataBlockHelper.DBHelpers
}
public static void AddFeededPd(int start,bool b)
{
//94.6;
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.{start}.6",b);
}
public static void AddFeededPdG1(bool b)
{
AddFeededPd(94, b);
}
public static void AddFeededPdG2(bool b)
{
AddFeededPd(96, b);
}
public static void AddFeededPdG3(bool b)
{
AddFeededPd(98, b);
}
public static void AddFeededPdG4(bool b)
{
AddFeededPd(100, b);
}
public static void AddFeededPdG5(bool b)
{
AddFeededPd(102, b);
}
public static void AddFeededPdG6(bool b)
{
AddFeededPd(104, b);
}
public static void AddFeededPdG7(bool b)
{
AddFeededPd(106, b);
}
public static void AddFeededPdG8(bool b)
{
AddFeededPd(108, b);
}
}
}

@ -1,5 +1,30 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="AutoControlC" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="GRepairMode" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAANAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIERCRTgxOTNENDE2MDRBRDVCOTRBRTNDMkQzNDc1MUQyBgYAAAAV5rm/5re357OK5YyW5py65o6n5Yi2BgcAAAAV5rm/5re357OK5YyW5py65o6n5Yi2Cw==</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">Query</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">糊化锅维修模式</Property>
<Property name="Font">宋体, 12pt</Property>
<Property name="Location">1106, 645</Property>
<Property name="Name">GRepairMode</Property>
<Property name="Size">169, 48</Property>
<Property name="TabIndex">79</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="TimeRecordClear" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAMAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIERCRTgxOTNENDE2MDRBRDVCOTRBRTNDMkQzNDc1MUQyBgYAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2BgcAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2Cw==</Binary>

Loading…
Cancel
Save