add - DB2105维护 强制排水替换

dep
wangsr 12 months ago
parent 6eb07eb65d
commit 21e4d96221

@ -24,7 +24,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
FMCTextBoxEntity MCTextBoxE = new FMCTextBoxEntity(); FMCTextBoxEntity MCTextBoxE = new FMCTextBoxEntity();
FMCButtonEntity ButtonE = new FMCButtonEntity(); FMCButtonEntity ButtonE = new FMCButtonEntity();
FMCRadioButtonEntity RadioButtonE = new FMCRadioButtonEntity(); FMCRadioButtonEntity RadioButtonE = new FMCRadioButtonEntity();
DB2119Helper DB2119 = new DB2119Helper(); DB2105Helper DB2105 = new DB2105Helper();
private List<Control> Controls; private List<Control> Controls;
@ -59,7 +59,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
private void ForceControl_OnSwitchChanged(object obj, bool state) private void ForceControl_OnSwitchChanged(object obj, bool state)
{ {
DB2119 = new DB2119Helper(); DB2105 = new DB2105Helper();
if (state) if (state)
{ {
if (MessageBox.Show("是否要打开强制排水模式?", "强制模式启动确认", if (MessageBox.Show("是否要打开强制排水模式?", "强制模式启动确认",
@ -75,16 +75,16 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
switch (name) switch (name)
{ {
case "ForceControlHA": case "ForceControlHA":
Db2119WriteHelper.AddHaAddForceOn(state); DB2105WriteHelper.AddHaAddForceOn(state);
break; break;
case "ForceControlCA": case "ForceControlCA":
Db2119WriteHelper.AddCaAddForceOn(state); DB2105WriteHelper.AddCaAddForceOn(state);
break; break;
case "ForceControlHB": case "ForceControlHB":
Db2119WriteHelper.AddHbAddForceOn(state); DB2105WriteHelper.AddHbAddForceOn(state);
break; break;
case "ForceControlCB": case "ForceControlCB":
Db2119WriteHelper.AddCbAddForceOn(state); DB2105WriteHelper.AddCbAddForceOn(state);
break; break;
default: break; default: break;
} }
@ -93,22 +93,25 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
private void StateRefresh(object sender, EventArgs e) private void StateRefresh(object sender, EventArgs e)
{ {
HslSwitchE.ForceControlHA.SwitchStatus = DB2119.Force_HA.forceOn; HslSwitchE.ForceControlHA.SwitchStatus = DB2105.Force_HA.forceOn;
HslSwitchE.ForceControlCA.SwitchStatus = DB2119.Force_CA.forceOn; HslSwitchE.ForceControlCA.SwitchStatus = DB2105.Force_CA.forceOn;
HslSwitchE.ForceControlHB.SwitchStatus = DB2119.Force_HB.forceOn; HslSwitchE.ForceControlHB.SwitchStatus = DB2105.Force_HB.forceOn;
HslSwitchE.ForceControlCB.SwitchStatus = DB2119.Force_CB.forceOn; HslSwitchE.ForceControlCB.SwitchStatus = DB2105.Force_CB.forceOn;
DefaultSwitch(HslSwitchE.ForceControlHA, DB2119.Force_HA.forceOn); DefaultSwitch(HslSwitchE.ForceControlHA, DB2105.Force_HA.forceOn);
DefaultSwitch(HslSwitchE.ForceControlCA, DB2105.Force_CA.forceOn);
DefaultSwitch(HslSwitchE.ForceControlHB, DB2105.Force_HB.forceOn);
DefaultSwitch(HslSwitchE.ForceControlCB, DB2105.Force_CB.forceOn);
} }
private void BottomSelect(RuntimeParameter runtime) private void BottomSelect(RuntimeParameter runtime)
{ {
DB2119 = new DB2119Helper(); DB2105 = new DB2105Helper();
SingleSelect(); SingleSelect();
if (ButtonE.StartMetage1 == runtime.Sender) if (ButtonE.StartMetage1 == runtime.Sender)
{ {
if (!DB2119.Force_CA.forceOn) if (!DB2105.Force_CA.forceOn)
{ {
MessageBox.Show("冷水称A强制控制按钮未打开"); MessageBox.Show("冷水称A强制控制按钮未打开");
return; return;
@ -118,15 +121,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
return; return;
} }
Db2119WriteHelper.AddCaAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue1.Text)); DB2105WriteHelper.AddCaAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue1.Text));
Db2119WriteHelper.AddCaAddForceBin(GelChooseA); DB2105WriteHelper.AddCaAddForceBin(GelChooseA);
Db2119WriteHelper.AddCaAddStartIn(true); DB2105WriteHelper.AddCaAddStartIn(true);
ManualLogControl("冷水称A强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue1.Text), GelChooseA); ManualLogControl("冷水称A强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue1.Text), GelChooseA);
MessageBox.Show("冷水称A强制补充"); MessageBox.Show("冷水称A强制补充");
} }
if (ButtonE.StartMetage2 == runtime.Sender) if (ButtonE.StartMetage2 == runtime.Sender)
{ {
if (!DB2119.Force_HA.forceOn) if (!DB2105.Force_HA.forceOn)
{ {
MessageBox.Show("热水称A强制控制按钮未打开"); MessageBox.Show("热水称A强制控制按钮未打开");
return; return;
@ -136,15 +139,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
return; return;
} }
Db2119WriteHelper.AddHaAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue2.Text)); DB2105WriteHelper.AddHaAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue2.Text));
Db2119WriteHelper.AddHaAddForceBin(GelChooseA); DB2105WriteHelper.AddHaAddForceBin(GelChooseA);
Db2119WriteHelper.AddHaAddStartIn(true); DB2105WriteHelper.AddHaAddStartIn(true);
ManualLogControl("热水称A强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue2.Text), GelChooseA); ManualLogControl("热水称A强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue2.Text), GelChooseA);
MessageBox.Show("热水称A强制补充"); MessageBox.Show("热水称A强制补充");
} }
if (ButtonE.StartMetage3 == runtime.Sender) if (ButtonE.StartMetage3 == runtime.Sender)
{ {
if (!DB2119.Force_CB.forceOn) if (!DB2105.Force_CB.forceOn)
{ {
MessageBox.Show("冷水称B强制控制按钮未打开"); MessageBox.Show("冷水称B强制控制按钮未打开");
return; return;
@ -154,15 +157,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
return; return;
} }
Db2119WriteHelper.AddCbAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue3.Text)); DB2105WriteHelper.AddCbAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue3.Text));
Db2119WriteHelper.AddCbAddForceBin(GelChooseB); DB2105WriteHelper.AddCbAddForceBin(GelChooseB);
Db2119WriteHelper.AddCbAddStartIn(true); DB2105WriteHelper.AddCbAddStartIn(true);
ManualLogControl("冷水称B强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue3.Text), GelChooseB + 4); ManualLogControl("冷水称B强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue3.Text), GelChooseB + 4);
MessageBox.Show("冷水称B强制补充"); MessageBox.Show("冷水称B强制补充");
} }
if (ButtonE.StartMetage4 == runtime.Sender) if (ButtonE.StartMetage4 == runtime.Sender)
{ {
if (!DB2119.Force_HB.forceOn) if (!DB2105.Force_HB.forceOn)
{ {
MessageBox.Show("热水称B强制控制按钮未打开"); MessageBox.Show("热水称B强制控制按钮未打开");
return; return;
@ -172,9 +175,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
return; return;
} }
Db2119WriteHelper.AddHbAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue4.Text)); DB2105WriteHelper.AddHbAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue4.Text));
Db2119WriteHelper.AddHbAddForceBin(GelChooseB); DB2105WriteHelper.AddHbAddForceBin(GelChooseB);
Db2119WriteHelper.AddHbAddStartIn(true); DB2105WriteHelper.AddHbAddStartIn(true);
ManualLogControl("热水称B强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue4.Text), GelChooseB + 4); ManualLogControl("热水称B强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue4.Text), GelChooseB + 4);
MessageBox.Show("热水称B强制补充"); MessageBox.Show("热水称B强制补充");
} }
@ -182,7 +185,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
if (ButtonE.StartOut1 == runtime.Sender) if (ButtonE.StartOut1 == runtime.Sender)
{ {
if (!DB2119.Force_CA.forceOn) if (!DB2105.Force_CA.forceOn)
{ {
MessageBox.Show("冷水称A强制控制按钮未打开"); MessageBox.Show("冷水称A强制控制按钮未打开");
return; return;
@ -192,15 +195,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
return; return;
} }
Db2119WriteHelper.AddCaAddRemainValue(Convert.ToInt16(MCTextBoxE.StayWaterValue1.Text)); DB2105WriteHelper.AddCaAddRemainValue(Convert.ToInt16(MCTextBoxE.StayWaterValue1.Text));
Db2119WriteHelper.AddCaAddForceBin(GelChooseA); DB2105WriteHelper.AddCaAddForceBin(GelChooseA);
Db2119WriteHelper.AddCaAddStartOut(true); DB2105WriteHelper.AddCaAddStartOut(true);
ManualLogControl("冷水称A强制排水", Convert.ToInt16(MCTextBoxE.StayWaterValue1.Text), GelChooseA); ManualLogControl("冷水称A强制排水", Convert.ToInt16(MCTextBoxE.StayWaterValue1.Text), GelChooseA);
MessageBox.Show("冷水称A强制排水"); MessageBox.Show("冷水称A强制排水");
} }
if (ButtonE.StartOut2 == runtime.Sender) if (ButtonE.StartOut2 == runtime.Sender)
{ {
if (!DB2119.Force_HA.forceOn) if (!DB2105.Force_HA.forceOn)
{ {
MessageBox.Show("热水称A强制控制按钮未打开"); MessageBox.Show("热水称A强制控制按钮未打开");
return; return;
@ -210,15 +213,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
return; return;
} }
Db2119WriteHelper.AddHaAddRemainValue(Convert.ToInt16(MCTextBoxE.StayWaterValue2.Text)); DB2105WriteHelper.AddHaAddRemainValue(Convert.ToInt16(MCTextBoxE.StayWaterValue2.Text));
Db2119WriteHelper.AddHaAddForceBin(GelChooseA); DB2105WriteHelper.AddHaAddForceBin(GelChooseA);
Db2119WriteHelper.AddHaAddStartOut(true); DB2105WriteHelper.AddHaAddStartOut(true);
ManualLogControl("热水称A强制排水", Convert.ToInt16(MCTextBoxE.StayWaterValue2.Text), GelChooseA); ManualLogControl("热水称A强制排水", Convert.ToInt16(MCTextBoxE.StayWaterValue2.Text), GelChooseA);
MessageBox.Show("热水称A强制排水"); MessageBox.Show("热水称A强制排水");
} }
if (ButtonE.StartOut3 == runtime.Sender) if (ButtonE.StartOut3 == runtime.Sender)
{ {
if (!DB2119.Force_CB.forceOn) if (!DB2105.Force_CB.forceOn)
{ {
MessageBox.Show("冷水称B强制控制按钮未打开"); MessageBox.Show("冷水称B强制控制按钮未打开");
return; return;
@ -228,15 +231,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
return; return;
} }
Db2119WriteHelper.AddCbAddRemainValue(Convert.ToInt16(MCTextBoxE.StayWaterValue3.Text)); DB2105WriteHelper.AddCbAddRemainValue(Convert.ToInt16(MCTextBoxE.StayWaterValue3.Text));
Db2119WriteHelper.AddCbAddForceBin(GelChooseB); DB2105WriteHelper.AddCbAddForceBin(GelChooseB);
Db2119WriteHelper.AddCbAddStartOut(true); DB2105WriteHelper.AddCbAddStartOut(true);
ManualLogControl("冷水称B强制排水", Convert.ToInt16(MCTextBoxE.StayWaterValue3.Text), GelChooseB + 4); ManualLogControl("冷水称B强制排水", Convert.ToInt16(MCTextBoxE.StayWaterValue3.Text), GelChooseB + 4);
MessageBox.Show("冷水称B强制排水"); MessageBox.Show("冷水称B强制排水");
} }
if (ButtonE.StartOut4 == runtime.Sender) if (ButtonE.StartOut4 == runtime.Sender)
{ {
if (!DB2119.Force_HB.forceOn) if (!DB2105.Force_HB.forceOn)
{ {
MessageBox.Show("热水称B强制控制按钮未打开"); MessageBox.Show("热水称B强制控制按钮未打开");
return; return;
@ -246,9 +249,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
{ {
return; return;
} }
Db2119WriteHelper.AddHbAddRemainValue(Convert.ToInt16(MCTextBoxE.StayWaterValue4.Text)); DB2105WriteHelper.AddHbAddRemainValue(Convert.ToInt16(MCTextBoxE.StayWaterValue4.Text));
Db2119WriteHelper.AddHbAddForceBin(GelChooseB); DB2105WriteHelper.AddHbAddForceBin(GelChooseB);
Db2119WriteHelper.AddHbAddStartOut(true); DB2105WriteHelper.AddHbAddStartOut(true);
ManualLogControl("热水称B强制排水", Convert.ToInt16(MCTextBoxE.StayWaterValue4.Text), GelChooseB + 4); ManualLogControl("热水称B强制排水", Convert.ToInt16(MCTextBoxE.StayWaterValue4.Text), GelChooseB + 4);
MessageBox.Show("热水称B强制排水"); MessageBox.Show("热水称B强制排水");
} }

@ -159,6 +159,11 @@ namespace DataBlockHelper.DBHelpers
public ManualH H4 => ReadH(164); public ManualH H4 => ReadH(164);
public ForceWaterEntity Force_HA => new ForceWaterEntity(bytes, 174);
public ForceWaterEntity Force_HB => new ForceWaterEntity(bytes, 182);
public ForceWaterEntity Force_CA => new ForceWaterEntity(bytes, 190);
public ForceWaterEntity Force_CB => new ForceWaterEntity(bytes, 198);
/// <summary> /// <summary>
/// 获取所有的 feededDry 是不是读取好了 /// 获取所有的 feededDry 是不是读取好了
/// </summary> /// </summary>
@ -228,6 +233,8 @@ namespace DataBlockHelper.DBHelpers
return manual; return manual;
} }
} }

@ -454,7 +454,194 @@ namespace DataBlockHelper.DBHelpers
return operate.IsSuccess; return operate.IsSuccess;
} }
private static readonly int HaNo = 106;
public static readonly int HbNo = 114;
private static readonly int CaNo = 122;
private static readonly int CbNo = 130;
#region 添加方法Ha
public static void AddHaAddValue(short value)
{
AddValue(value, HaNo);
}
public static void AddHaAddRemainValue(short value)
{
AddRemainValue(value, HaNo);
}
public static void AddHaAddForceBin(short value)
{
AddForceBin(value, HaNo);
}
public static void AddHaAddForceOn(bool value)
{
AddForceOn(value, HaNo);
}
public static void AddHaAddStartIn(bool value)
{
AddStartIn(value, HaNo);
}
public static void AddHaAddStartOut(bool value)
{
AddStartOut(value, HaNo);
}
#endregion
#region Hb 添加方法
public static void AddHbAddValue(short value)
{
AddValue(value, HbNo);
}
public static void AddHbAddRemainValue(short value)
{
AddRemainValue(value, HbNo);
}
public static void AddHbAddForceBin(short value)
{
AddForceBin(value, HbNo);
}
public static void AddHbAddForceOn(bool value)
{
AddForceOn(value, HbNo);
}
public static void AddHbAddStartIn(bool value)
{
AddStartIn(value, HbNo);
}
public static void AddHbAddStartOut(bool value)
{
AddStartOut(value, HbNo);
}
#endregion
#region Ca 添加方法
public static void AddCaAddValue(short value)
{
AddValue(value, CaNo);
}
public static void AddCaAddRemainValue(short value)
{
AddRemainValue(value, CaNo);
}
public static void AddCaAddForceBin(short value)
{
AddForceBin(value, CaNo);
}
public static void AddCaAddForceOn(bool value)
{
AddForceOn(value, CaNo);
}
public static void AddCaAddStartIn(bool value)
{
AddStartIn(value, CaNo);
}
public static void AddCaAddStartOut(bool value)
{
AddStartOut(value, CaNo);
}
#endregion
#region Cb 添加方法
public static void AddCbAddValue(short value)
{
AddValue(value, CbNo);
}
public static void AddCbAddRemainValue(short value)
{
AddRemainValue(value, CbNo);
}
public static void AddCbAddForceBin(short value)
{
AddForceBin(value, CbNo);
}
public static void AddCbAddForceOn(bool value)
{
AddForceOn(value, CbNo);
}
public static void AddCbAddStartIn(bool value)
{
AddStartIn(value, CbNo);
}
public static void AddCbAddStartOut(bool value)
{
AddStartOut(value, CbNo);
}
#endregion
private static void AddValue(short value, int start)
{
//106
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.{start}.0", value);
}
private static void AddRemainValue(short value, int start)
{
int nu = start + 2;
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.{nu}.0", value);
}
private static void AddForceBin(short value, int start)
{
int nu = start + 4;
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.{nu}.0", value);
}
private static void AddForceOn(bool value, int start)
{
int nu = start + 6;
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.{nu}.0", value);
}
private static void AddStartIn(bool value, int start)
{
int nu = start + 6;
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.{nu}.1", value);
}
private static void AddStartOut(bool value, int start)
{
int nu = start + 6;
var siemensS7Net = PlcConnect.Instance;
siemensS7Net.Write($"{DbName}.{nu}.2", value);
}
} }

@ -77,6 +77,7 @@
<Compile Include="Entity\DB2104Entity\RecipeCommEntity.cs" /> <Compile Include="Entity\DB2104Entity\RecipeCommEntity.cs" />
<Compile Include="Entity\DB2104Entity\WaterView.cs" /> <Compile Include="Entity\DB2104Entity\WaterView.cs" />
<Compile Include="Entity\DB2104Entity\WeterEntity.cs" /> <Compile Include="Entity\DB2104Entity\WeterEntity.cs" />
<Compile Include="Entity\DB2105Entity\ForceWaterEntity.cs" />
<Compile Include="Entity\DB2105Entity\FourBoolArrayEntity.cs" /> <Compile Include="Entity\DB2105Entity\FourBoolArrayEntity.cs" />
<Compile Include="Entity\DB2105Entity\PlanEntity.cs" /> <Compile Include="Entity\DB2105Entity\PlanEntity.cs" />
<Compile Include="Entity\DB2106Entity\DryReportEntity.cs" /> <Compile Include="Entity\DB2106Entity\DryReportEntity.cs" />

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataBlockHelper.Entity.DB2105Entity
{
public class ForceWaterEntity
{
public ForceWaterEntity(byte[] bytes, int startSet)
{
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2104.2.0", 50);
var content = bytes.Skip(startSet).Take(8).ToArray();
var instanceByteTransform = PlcConnect.Instance.ByteTransform;
addValue = instanceByteTransform.TransInt16(content, 0);
remainValue = instanceByteTransform.TransInt16(content, 2);
forceBin = instanceByteTransform.TransInt16(content, 4);
var byt = content[6];
forceOn = byt.GetBit(0);
startIn = byt.GetBit(1);
startOut = byt.GetBit(2);
}
public short addValue { get; private set; }
public short remainValue { get; private set; }
public short forceBin { get; private set; }
public bool forceOn { get; private set; }
public bool startIn { get; private set; }
public bool startOut { get; private set; }
}
}
Loading…
Cancel
Save