|
|
|
|
using DataBlockHelper.DBHelpers;
|
|
|
|
|
using DataBlockHelper.Entity.DB2104Entity;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.AutoControl.DB;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.AutoControl.Entity;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjMixManager;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjPlanning;
|
|
|
|
|
using IAction = Mesnac.Action.Base.IAction;
|
|
|
|
|
using Mesnac.Core.Service;
|
|
|
|
|
using static Mesnac.Action.ChemicalWeighing.AutoControl.AutoLogHelper;
|
|
|
|
|
using static Mesnac.Action.ChemicalWeighing.AutoControl.PlcAutoWriteHelper;
|
|
|
|
|
using Mesnac.Controls.Default;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
{
|
|
|
|
|
internal class AutoControl : ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
private List<Control> McControls;
|
|
|
|
|
MCTextBoxEntity TextE = new MCTextBoxEntity();
|
|
|
|
|
ButtonEntity ButtonE = new ButtonEntity();
|
|
|
|
|
MCLabelEntity LabelE = new MCLabelEntity();
|
|
|
|
|
MCComboBoxEntity ComboE = new MCComboBoxEntity();
|
|
|
|
|
MCRadioButtonEntity RadioE = new MCRadioButtonEntity();
|
|
|
|
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime); //必须要调用
|
|
|
|
|
|
|
|
|
|
McControls = GetAllControls();
|
|
|
|
|
|
|
|
|
|
ControlsHelper.ControlImport<MCTextBox>(TextE, McControls);
|
|
|
|
|
ControlsHelper.ControlImport<System.Windows.Forms.Button>(ButtonE, McControls);
|
|
|
|
|
ControlsHelper.ControlImport<MCCombobox>(ComboE, McControls);
|
|
|
|
|
ControlsHelper.ControlImport<MCLabel>(LabelE, McControls);
|
|
|
|
|
ControlsHelper.ControlImport<MCRadioButton>(RadioE, McControls);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
BottomSelect(runtime);
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请检查输入内容格式是否正确!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//按钮事件
|
|
|
|
|
private void BottomSelect(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
#region 自动参数下传
|
|
|
|
|
|
|
|
|
|
#region 湿混机糊化机参数下传
|
|
|
|
|
|
|
|
|
|
if (ButtonE.Download == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下传数据?", "下传确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GelWetDownload(TextE, ComboE, RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("数据下传成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 水称参数下传
|
|
|
|
|
|
|
|
|
|
if (ButtonE.WaterDownload == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下发水称数据?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WaterDownload(TextE,ComboE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 干混机参数下传
|
|
|
|
|
|
|
|
|
|
if(ButtonE.DryDownload == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下传干混机数据?", "下传确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DryDownload(TextE, ComboE, RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("数据下传成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 手动控制
|
|
|
|
|
|
|
|
|
|
if (ButtonE.GelManualPowder == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认手动下粉料?", "下粉确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isReady = GelPowderDownload(RadioE);
|
|
|
|
|
|
|
|
|
|
if (!isReady)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("信号未准备好!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SingleLog("手动下粉料", RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("信号下达成功!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ButtonE.GelManualColdWater == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下冷水?", "下水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isReady = GelColdWaterDownload(RadioE);
|
|
|
|
|
|
|
|
|
|
if (!isReady)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("信号未准备好!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SingleLog("手动下冷水", RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("信号下达成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ButtonE.GelManualHotWater == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下热水?", "下水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isReady = GelHotWaterDownload(RadioE);
|
|
|
|
|
|
|
|
|
|
if (!isReady)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("信号未准备好!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SingleLog("手动下热水", RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("信号下达成功!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ButtonE.WetManualGel == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下糊化料?", "下糊化料确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isReady = WetGelatDownload(RadioE);
|
|
|
|
|
|
|
|
|
|
if (!isReady)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("信号未准备好!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SingleLog("手动下糊化料", RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("信号下达成功!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ButtonE.WetManualControl == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下传数据?", "下传确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WetGelatDownload(TextE, RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("数据下传成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 自动启停
|
|
|
|
|
|
|
|
|
|
if (ButtonE.LineStart == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认启动生产?", "启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LineStart(RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("产线已启动!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ButtonE.LineStop == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
LineStop(RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("已经停止生产");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 维修模式
|
|
|
|
|
|
|
|
|
|
if(ButtonE.RepairMode == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
RepairOnOff(LabelE, RadioE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 粘贴数据
|
|
|
|
|
|
|
|
|
|
if(ButtonE.PasteWet == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
int index = ComboE.PasteChooseWet.SelectedIndex + 1;
|
|
|
|
|
ControlsHelper.GWInit(index, ComboE, TextE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ButtonE.PasteDry == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
int index = ComboE.PasteChooseDry.SelectedIndex + 1;
|
|
|
|
|
ControlsHelper.DInit(index, ComboE, TextE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|