|
|
|
@ -1,9 +1,6 @@
|
|
|
|
|
using DataBlockHelper.DBHelpers;
|
|
|
|
|
using DataBlockHelper.Entity.DB2106Entity;
|
|
|
|
|
using HslCommunication.Instrument.DLT;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.FreeDb;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.MainDetailControl.Entity;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.Report.Entity;
|
|
|
|
|
using Mesnac.Basic;
|
|
|
|
|
using Mesnac.Controls.ChemicalWeighing;
|
|
|
|
@ -11,108 +8,41 @@ using Mesnac.Controls.Default;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
{
|
|
|
|
|
public class ForceWaterControl : ChemicalWeighingAction, IAction
|
|
|
|
|
public class ForceWaterInitAction : ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
FHslSwitchEntity HslSwitchE = new FHslSwitchEntity();
|
|
|
|
|
FMCTextBoxEntity MCTextBoxE = new FMCTextBoxEntity();
|
|
|
|
|
FMCButtonEntity ButtonE = new FMCButtonEntity();
|
|
|
|
|
FMCRadioButtonEntity RadioButtonE = new FMCRadioButtonEntity();
|
|
|
|
|
DB2105Helper DB2105 = new DB2105Helper();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<Control> Controls;
|
|
|
|
|
|
|
|
|
|
Timer timer;
|
|
|
|
|
|
|
|
|
|
private byte GelChooseA;
|
|
|
|
|
private byte GelChooseB;
|
|
|
|
|
private byte GelChooseA = 0;
|
|
|
|
|
private byte GelChooseB = 0;
|
|
|
|
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime); //必须要调用
|
|
|
|
|
base.RunIni(runtime);
|
|
|
|
|
|
|
|
|
|
Controls = GetAllControls();
|
|
|
|
|
|
|
|
|
|
SetAllControls();
|
|
|
|
|
|
|
|
|
|
StateRefresh();
|
|
|
|
|
|
|
|
|
|
HslSwitchE.ForceControlHA.OnSwitchChanged += ForceControl_OnSwitchChanged;
|
|
|
|
|
HslSwitchE.ForceControlCA.OnSwitchChanged += ForceControl_OnSwitchChanged;
|
|
|
|
|
HslSwitchE.ForceControlHB.OnSwitchChanged += ForceControl_OnSwitchChanged;
|
|
|
|
|
HslSwitchE.ForceControlCB.OnSwitchChanged += ForceControl_OnSwitchChanged;
|
|
|
|
|
|
|
|
|
|
BottomSelect(runtime);
|
|
|
|
|
|
|
|
|
|
//timer = new Timer();
|
|
|
|
|
//timer.Interval = 1000;
|
|
|
|
|
//timer.Enabled = true;
|
|
|
|
|
//timer.Tick += new EventHandler(StateRefresh);//添加事件
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ForceControl_OnSwitchChanged(object obj, bool state)
|
|
|
|
|
{
|
|
|
|
|
DB2105 = new DB2105Helper();
|
|
|
|
|
HslSwitch hslSwitch = obj as HslSwitch;
|
|
|
|
|
if (state)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("是否要打开强制排水模式?", "强制模式启动确认",
|
|
|
|
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
HslSwitch hs = obj as HslSwitch;
|
|
|
|
|
hs.SwitchStatus = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
string name = hslSwitch.Name;
|
|
|
|
|
switch (name)
|
|
|
|
|
{
|
|
|
|
|
case "ForceControlHA":
|
|
|
|
|
DB2105WriteHelper.AddHaAddForceOn(state);
|
|
|
|
|
break;
|
|
|
|
|
case "ForceControlCA":
|
|
|
|
|
DB2105WriteHelper.AddCaAddForceOn(state);
|
|
|
|
|
break;
|
|
|
|
|
case "ForceControlHB":
|
|
|
|
|
DB2105WriteHelper.AddHbAddForceOn(state);
|
|
|
|
|
break;
|
|
|
|
|
case "ForceControlCB":
|
|
|
|
|
DB2105WriteHelper.AddCbAddForceOn(state);
|
|
|
|
|
break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
DefaultSwitch(hslSwitch, state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void StateRefresh()
|
|
|
|
|
private void SetAllControls()
|
|
|
|
|
{
|
|
|
|
|
if (HslSwitchE.ForceControlHA.SwitchStatus != DB2105.Force_HA.forceOn)
|
|
|
|
|
{
|
|
|
|
|
HslSwitchE.ForceControlHA.SwitchStatus = DB2105.Force_HA.forceOn;
|
|
|
|
|
}
|
|
|
|
|
if (HslSwitchE.ForceControlCA.SwitchStatus != DB2105.Force_CA.forceOn)
|
|
|
|
|
{
|
|
|
|
|
HslSwitchE.ForceControlCA.SwitchStatus = DB2105.Force_CA.forceOn;
|
|
|
|
|
}
|
|
|
|
|
if (HslSwitchE.ForceControlHB.SwitchStatus != DB2105.Force_HB.forceOn)
|
|
|
|
|
{
|
|
|
|
|
HslSwitchE.ForceControlHB.SwitchStatus = DB2105.Force_HB.forceOn;
|
|
|
|
|
}
|
|
|
|
|
if (HslSwitchE.ForceControlCB.SwitchStatus != DB2105.Force_CB.forceOn)
|
|
|
|
|
{
|
|
|
|
|
HslSwitchE.ForceControlCB.SwitchStatus = DB2105.Force_CB.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);
|
|
|
|
|
ControlsHelper.ControlImport<MCTextBox>(MCTextBoxE, Controls);
|
|
|
|
|
ControlsHelper.ControlImport<MCButton>(ButtonE, Controls);
|
|
|
|
|
ControlsHelper.ControlImport<MCRadioButton>(RadioButtonE, Controls);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BottomSelect(RuntimeParameter runtime)
|
|
|
|
@ -123,96 +53,105 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
|
|
|
|
|
if (ButtonE.StartMetage1 == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("此按钮暂停使用!");
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//if (!DB2105.Force_CA.forceOn)
|
|
|
|
|
//{
|
|
|
|
|
// MessageBox.Show("冷水称A强制控制按钮未打开!");
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//if (MessageBox.Show("确认向冷水称A补充?", "强制模式启动确认",
|
|
|
|
|
// MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
//{
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//DB2105WriteHelper.AddCaAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue1.Text));
|
|
|
|
|
//DB2105WriteHelper.AddCaAddForceBin(GelChooseA);
|
|
|
|
|
//DB2105WriteHelper.AddCaAddStartIn(true);
|
|
|
|
|
//ManualLogControl("冷水称A强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue1.Text), GelChooseA);
|
|
|
|
|
//MessageBox.Show("冷水称A强制补充");
|
|
|
|
|
if (GelChooseA == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择糊化锅!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!DB2105.Force_CA.forceOn)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("冷水称A强制控制按钮未打开!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (MessageBox.Show("确认向冷水称A补充?", "强制模式启动确认",
|
|
|
|
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DB2105WriteHelper.AddCaAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue1.Text));
|
|
|
|
|
DB2105WriteHelper.AddCaAddForceBin(GelChooseA);
|
|
|
|
|
DB2105WriteHelper.AddCaAddStartIn(true);
|
|
|
|
|
ManualLogControl("冷水称A强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue1.Text), GelChooseA);
|
|
|
|
|
MessageBox.Show("冷水称A强制补充");
|
|
|
|
|
}
|
|
|
|
|
if (ButtonE.StartMetage2 == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("此按钮暂停使用!");
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//if (!DB2105.Force_HA.forceOn)
|
|
|
|
|
//{
|
|
|
|
|
// MessageBox.Show("热水称A强制控制按钮未打开!");
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//if (MessageBox.Show("确认向热水称A补充?", "强制模式启动确认",
|
|
|
|
|
// MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
//{
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//DB2105WriteHelper.AddHaAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue2.Text));
|
|
|
|
|
//DB2105WriteHelper.AddHaAddForceBin(GelChooseA);
|
|
|
|
|
//DB2105WriteHelper.AddHaAddStartIn(true);
|
|
|
|
|
//ManualLogControl("热水称A强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue2.Text), GelChooseA);
|
|
|
|
|
//MessageBox.Show("热水称A强制补充");
|
|
|
|
|
if (GelChooseA == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择糊化锅!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!DB2105.Force_HA.forceOn)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("热水称A强制控制按钮未打开!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (MessageBox.Show("确认向热水称A补充?", "强制模式启动确认",
|
|
|
|
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DB2105WriteHelper.AddHaAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue2.Text));
|
|
|
|
|
DB2105WriteHelper.AddHaAddForceBin(GelChooseA);
|
|
|
|
|
DB2105WriteHelper.AddHaAddStartIn(true);
|
|
|
|
|
ManualLogControl("热水称A强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue2.Text), GelChooseA);
|
|
|
|
|
MessageBox.Show("热水称A强制补充");
|
|
|
|
|
}
|
|
|
|
|
if (ButtonE.StartMetage3 == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("此按钮暂停使用!");
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//if (!DB2105.Force_CB.forceOn)
|
|
|
|
|
//{
|
|
|
|
|
// MessageBox.Show("冷水称B强制控制按钮未打开!");
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//if (MessageBox.Show("确认向冷水称B补充?", "强制模式启动确认",
|
|
|
|
|
// MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
//{
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//DB2105WriteHelper.AddCbAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue3.Text));
|
|
|
|
|
//DB2105WriteHelper.AddCbAddForceBin(GelChooseB);
|
|
|
|
|
//DB2105WriteHelper.AddCbAddStartIn(true);
|
|
|
|
|
//ManualLogControl("冷水称B强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue3.Text), GelChooseB + 4);
|
|
|
|
|
//MessageBox.Show("冷水称B强制补充");
|
|
|
|
|
if (GelChooseB == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择糊化锅!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!DB2105.Force_CB.forceOn)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("冷水称B强制控制按钮未打开!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (MessageBox.Show("确认向冷水称B补充?", "强制模式启动确认",
|
|
|
|
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DB2105WriteHelper.AddCbAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue3.Text));
|
|
|
|
|
DB2105WriteHelper.AddCbAddForceBin(GelChooseB);
|
|
|
|
|
DB2105WriteHelper.AddCbAddStartIn(true);
|
|
|
|
|
ManualLogControl("冷水称B强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue3.Text), GelChooseB + 4);
|
|
|
|
|
MessageBox.Show("冷水称B强制补充");
|
|
|
|
|
}
|
|
|
|
|
if (ButtonE.StartMetage4 == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("此按钮暂停使用!");
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//if (!DB2105.Force_HB.forceOn)
|
|
|
|
|
//{
|
|
|
|
|
// MessageBox.Show("热水称B强制控制按钮未打开!");
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//if (MessageBox.Show("确认向热水称B补充?", "强制模式启动确认",
|
|
|
|
|
// MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
//{
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//DB2105WriteHelper.AddHbAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue4.Text));
|
|
|
|
|
//DB2105WriteHelper.AddHbAddForceBin(GelChooseB);
|
|
|
|
|
//DB2105WriteHelper.AddHbAddStartIn(true);
|
|
|
|
|
//ManualLogControl("热水称B强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue4.Text), GelChooseB + 4);
|
|
|
|
|
//MessageBox.Show("热水称B强制补充");
|
|
|
|
|
if (GelChooseB == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择糊化锅!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!DB2105.Force_HB.forceOn)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("热水称B强制控制按钮未打开!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (MessageBox.Show("确认向热水称B补充?", "强制模式启动确认",
|
|
|
|
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DB2105WriteHelper.AddHbAddValue(Convert.ToInt16(MCTextBoxE.SetWaterValue4.Text));
|
|
|
|
|
DB2105WriteHelper.AddHbAddForceBin(GelChooseB);
|
|
|
|
|
DB2105WriteHelper.AddHbAddStartIn(true);
|
|
|
|
|
ManualLogControl("热水称B强制补充", Convert.ToInt16(MCTextBoxE.SetWaterValue4.Text), GelChooseB + 4);
|
|
|
|
|
MessageBox.Show("热水称B强制补充");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ButtonE.StartOut1 == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (GelChooseA == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择糊化锅!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!DB2105.Force_CA.forceOn)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("冷水称A强制控制按钮未打开!");
|
|
|
|
@ -231,6 +170,11 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
}
|
|
|
|
|
if (ButtonE.StartOut2 == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (GelChooseA == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择糊化锅!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!DB2105.Force_HA.forceOn)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("热水称A强制控制按钮未打开!");
|
|
|
|
@ -249,6 +193,11 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
}
|
|
|
|
|
if (ButtonE.StartOut3 == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (GelChooseB == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择糊化锅!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!DB2105.Force_CB.forceOn)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("冷水称B强制控制按钮未打开!");
|
|
|
|
@ -267,6 +216,11 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
}
|
|
|
|
|
if (ButtonE.StartOut4 == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (GelChooseB == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择糊化锅!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!DB2105.Force_HB.forceOn)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("热水称B强制控制按钮未打开!");
|
|
|
|
@ -283,13 +237,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
ManualLogControl("热水称B强制排水", Convert.ToInt16(MCTextBoxE.StayWaterValue4.Text), GelChooseB + 4);
|
|
|
|
|
MessageBox.Show("热水称B强制排水");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DefaultSwitch(HslSwitch hslSwitch, bool state)
|
|
|
|
|
{
|
|
|
|
|
string status = state ? "强制状态开" : "强制状态关";
|
|
|
|
|
hslSwitch.Text = status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SingleSelect()
|
|
|
|
@ -334,14 +281,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
GelChooseB = 4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SetAllControls()
|
|
|
|
|
{
|
|
|
|
|
ControlsHelper.ControlImport<HslSwitch>(HslSwitchE, Controls);
|
|
|
|
|
ControlsHelper.ControlImport<MCTextBox>(MCTextBoxE, Controls);
|
|
|
|
|
ControlsHelper.ControlImport<MCButton>(ButtonE, Controls);
|
|
|
|
|
ControlsHelper.ControlImport<MCRadioButton>(RadioButtonE, Controls);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 日志插入
|
|
|
|
@ -367,5 +306,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(Log).ExecuteIdentity();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|