|
|
|
@ -16,24 +16,31 @@ using Mesnac.Action.ChemicalWeighing.LjPlanning;
|
|
|
|
|
using System.Diagnostics.SymbolStore;
|
|
|
|
|
using Mesnac.Basic;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.FreeDb;
|
|
|
|
|
using Microsoft.Office.Interop.Excel;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.MainDetailControl.Entity;
|
|
|
|
|
using Mesnac.Controls.ChemicalWeighing;
|
|
|
|
|
using IAction = Mesnac.Action.Base.IAction;
|
|
|
|
|
using Mesnac.Core.Service;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
{
|
|
|
|
|
internal class GelerWeterControl : ChemicalWeighingAction, IAction
|
|
|
|
|
internal class AutoControl : ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
private List<Control> McControls;
|
|
|
|
|
RuntimeParameter _runtime;
|
|
|
|
|
GelerWeterControlsEntity ControlsEntity = new GelerWeterControlsEntity();
|
|
|
|
|
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); //必须要调用
|
|
|
|
|
|
|
|
|
|
this._runtime = runtime;
|
|
|
|
|
|
|
|
|
|
McControls = GetAllControls();
|
|
|
|
|
|
|
|
|
|
ControlImport();
|
|
|
|
|
ControlsHelper.ControlImport(TextE, ButtonE, ComboE, LabelE, RadioE, McControls);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -51,35 +58,37 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
|
|
|
|
|
#region 自动参数下传
|
|
|
|
|
|
|
|
|
|
if (ControlsEntity.Download == runtime.Sender)
|
|
|
|
|
#region 湿混机糊化机参数下传
|
|
|
|
|
|
|
|
|
|
if (ButtonE.Download == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下传数据?", "下传确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int b1 = Convert.ToInt32(ControlsEntity.ChooseMaterial1.MCValue.ToString());
|
|
|
|
|
int b2 = Convert.ToInt32(ControlsEntity.ChooseMaterial2.MCValue.ToString());
|
|
|
|
|
int b1 = Convert.ToInt32(ComboE.ChooseMaterial1.MCValue.ToString());
|
|
|
|
|
int b2 = Convert.ToInt32(ComboE.ChooseMaterial2.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
short bin1 = (short)StockMaterrialDbHelp.GetCodeById(b1);
|
|
|
|
|
short bin2 = (short)StockMaterrialDbHelp.GetCodeById(b2);
|
|
|
|
|
|
|
|
|
|
float MatTol1 = Convert.ToSingle(ControlsEntity.MaterialTolerance1.MCValue.ToString());
|
|
|
|
|
float MatTol2 = Convert.ToSingle(ControlsEntity.MaterialTolerance2.MCValue.ToString());
|
|
|
|
|
float MatTol1 = Convert.ToSingle(TextE.MaterialTolerance1.MCValue.ToString());
|
|
|
|
|
float MatTol2 = Convert.ToSingle(TextE.MaterialTolerance2.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
float MatWei1 = Convert.ToSingle(ControlsEntity.MaterialWeight1.MCValue.ToString());
|
|
|
|
|
float MatWei2 = Convert.ToSingle(ControlsEntity.MaterialWeight2.MCValue.ToString());
|
|
|
|
|
float MatWei1 = Convert.ToSingle(TextE.MaterialWeight1.MCValue.ToString());
|
|
|
|
|
float MatWei2 = Convert.ToSingle(TextE.MaterialWeight2.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
float GelSpeed = Convert.ToSingle(ControlsEntity.GelSpeedSet.MCValue.ToString());
|
|
|
|
|
float GelSpeed = Convert.ToSingle(TextE.GelSpeedSet.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
float GelPosA = Convert.ToSingle(ControlsEntity.GelPosTimeA.MCValue.ToString());
|
|
|
|
|
float GelNagB = Convert.ToSingle(ControlsEntity.GelNagTimeB.MCValue.ToString());
|
|
|
|
|
short GelPosC = Convert.ToInt16(ControlsEntity.GelPosTimeC.MCValue.ToString());
|
|
|
|
|
float GelPosA = Convert.ToSingle(TextE.GelPosTimeA.MCValue.ToString());
|
|
|
|
|
float GelNagB = Convert.ToSingle(TextE.GelNagTimeB.MCValue.ToString());
|
|
|
|
|
short GelPosC = Convert.ToInt16(TextE.GelPosTimeC.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
short GelWater = Convert.ToInt16(ControlsEntity.GelWaterTime.MCValue.ToString());
|
|
|
|
|
short GelWait = Convert.ToInt16(ControlsEntity.GelWaitTime.MCValue.ToString());
|
|
|
|
|
short GelCloseHeat = Convert.ToInt16(ControlsEntity.GelCloseHeatTime.MCValue.ToString());
|
|
|
|
|
float GelDelayTime = Convert.ToSingle(ControlsEntity.GelOutDelayTime.MCValue.ToString());
|
|
|
|
|
short GelWater = Convert.ToInt16(TextE.GelWaterTime.MCValue.ToString());
|
|
|
|
|
short GelWait = Convert.ToInt16(TextE.GelWaitTime.MCValue.ToString());
|
|
|
|
|
short GelCloseHeat = Convert.ToInt16(TextE.GelCloseHeatTime.MCValue.ToString());
|
|
|
|
|
float GelDelayTime = Convert.ToSingle(TextE.GelOutDelayTime.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
if (b2 == -1)
|
|
|
|
|
{
|
|
|
|
@ -168,9 +177,9 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
steps.Add(step7);
|
|
|
|
|
steps.Add(step8);
|
|
|
|
|
|
|
|
|
|
float WetDryWei = Convert.ToSingle(ControlsEntity.WetDryWeight.MCValue.ToString());
|
|
|
|
|
short WetMix = Convert.ToInt16(ControlsEntity.WetMixTime.MCValue.ToString());
|
|
|
|
|
short WetOutDelay = Convert.ToInt16(ControlsEntity.WetOutDelayTime.MCValue.ToString());
|
|
|
|
|
float WetDryWei = Convert.ToSingle(TextE.WetDryWeight.MCValue.ToString());
|
|
|
|
|
short WetMix = Convert.ToInt16(TextE.WetMixTime.MCValue.ToString());
|
|
|
|
|
short WetOutDelay = Convert.ToInt16(TextE.WetOutDelayTime.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
List<MixStep> mixSteps = new List<MixStep>();
|
|
|
|
|
|
|
|
|
@ -303,9 +312,337 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 水称参数下传
|
|
|
|
|
|
|
|
|
|
if (ButtonE.WaterDownload == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下发水称数据?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WaterEntity HotA = new WaterEntity();
|
|
|
|
|
WaterEntity ColdA = new WaterEntity();
|
|
|
|
|
WaterEntity HotB = new WaterEntity();
|
|
|
|
|
WaterEntity ColdB = new WaterEntity();
|
|
|
|
|
|
|
|
|
|
float hotASet, hotBSet, coldASet, coldBSet, hotATol, hotBTol, coldATol, coldBTol;
|
|
|
|
|
|
|
|
|
|
if (float.TryParse(Convert.ToString(TextE.HotValueA.MCValue), out hotASet) &&
|
|
|
|
|
float.TryParse(Convert.ToString(TextE.HotToleranceA.MCValue), out hotATol) &&
|
|
|
|
|
float.TryParse(Convert.ToString(TextE.HotValueB.MCValue), out hotBSet) &&
|
|
|
|
|
float.TryParse(Convert.ToString(TextE.HotToleranceB.MCValue), out hotBTol) &&
|
|
|
|
|
float.TryParse(Convert.ToString(TextE.ColdValueA.MCValue), out coldASet) &&
|
|
|
|
|
float.TryParse(Convert.ToString(TextE.ColdToleranceA.MCValue), out coldATol) &&
|
|
|
|
|
float.TryParse(Convert.ToString(TextE.ColdValueB.MCValue), out coldBSet) &&
|
|
|
|
|
float.TryParse(Convert.ToString(TextE.ColdToleranceB.MCValue), out coldBTol))
|
|
|
|
|
{
|
|
|
|
|
HotA.Set = hotASet;
|
|
|
|
|
HotB.Set = hotBSet;
|
|
|
|
|
ColdA.Set = coldASet;
|
|
|
|
|
ColdB.Set = coldBSet;
|
|
|
|
|
HotA.Tolerance = hotATol;
|
|
|
|
|
HotB.Tolerance = hotBTol;
|
|
|
|
|
ColdA.Tolerance = coldATol;
|
|
|
|
|
ColdB.Tolerance = coldBTol;
|
|
|
|
|
Db2104WriteHelper.WriteAHostWater(HotA);
|
|
|
|
|
Db2104WriteHelper.WriteBHostWater(HotB);
|
|
|
|
|
Db2104WriteHelper.WriteAColWater(ColdA);
|
|
|
|
|
Db2104WriteHelper.WriteBColWater(ColdB);
|
|
|
|
|
MesnacServiceManager.Instance.LoggingService.Info("水称数据下发成功!");
|
|
|
|
|
MessageBox.Show("水称数据下发成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MesnacServiceManager.Instance.LoggingService.Info("输入数值的格式有误");
|
|
|
|
|
MessageBox.Show("输入数值的格式有误!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 干混机参数下传
|
|
|
|
|
|
|
|
|
|
if(ButtonE.DryDownload == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下传干混机数据?", "下传确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int b1 = Convert.ToInt32(ComboE.DryM1.MCValue.ToString());
|
|
|
|
|
int b2 = Convert.ToInt32(ComboE.DryM2.MCValue.ToString());
|
|
|
|
|
int b3 = Convert.ToInt32(ComboE.DryM3.MCValue.ToString());
|
|
|
|
|
int b4 = Convert.ToInt32(ComboE.DryM4.MCValue.ToString());
|
|
|
|
|
int b5 = Convert.ToInt32(ComboE.DryM5.MCValue.ToString());
|
|
|
|
|
int b6 = Convert.ToInt32(ComboE.DryM6.MCValue.ToString());
|
|
|
|
|
int b7 = Convert.ToInt32(ComboE.DryM7.MCValue.ToString());
|
|
|
|
|
int b8 = Convert.ToInt32(ComboE.DryM8.MCValue.ToString());
|
|
|
|
|
int b9 = Convert.ToInt32(ComboE.DryM9.MCValue.ToString());
|
|
|
|
|
int b10 = Convert.ToInt32(ComboE.DryM10.MCValue.ToString());
|
|
|
|
|
int b11 = Convert.ToInt32(ComboE.DryM11.MCValue.ToString());
|
|
|
|
|
int b12 = Convert.ToInt32(ComboE.DryM12.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
short bin1 = (short)StockMaterrialDbHelp.GetCodeById(b1);
|
|
|
|
|
short bin2 = (short)StockMaterrialDbHelp.GetCodeById(b2);
|
|
|
|
|
short bin3 = (short)StockMaterrialDbHelp.GetCodeById(b3);
|
|
|
|
|
short bin4 = (short)StockMaterrialDbHelp.GetCodeById(b4);
|
|
|
|
|
short bin5 = (short)StockMaterrialDbHelp.GetCodeById(b5);
|
|
|
|
|
short bin6 = (short)StockMaterrialDbHelp.GetCodeById(b6);
|
|
|
|
|
short bin7 = (short)StockMaterrialDbHelp.GetCodeById(b7);
|
|
|
|
|
short bin8 = (short)StockMaterrialDbHelp.GetCodeById(b8);
|
|
|
|
|
short bin9 = (short)StockMaterrialDbHelp.GetCodeById(b9);
|
|
|
|
|
short bin10 = (short)StockMaterrialDbHelp.GetCodeById(b10);
|
|
|
|
|
short bin11 = (short)StockMaterrialDbHelp.GetCodeById(b11);
|
|
|
|
|
short bin12 = (short)StockMaterrialDbHelp.GetCodeById(b12);
|
|
|
|
|
|
|
|
|
|
int w1 = Convert.ToInt32(TextE.DryW1.MCValue.ToString());
|
|
|
|
|
int w2 = Convert.ToInt32(TextE.DryW2.MCValue.ToString());
|
|
|
|
|
int w3 = Convert.ToInt32(TextE.DryW3.MCValue.ToString());
|
|
|
|
|
int w4 = Convert.ToInt32(TextE.DryW4.MCValue.ToString());
|
|
|
|
|
int w5 = Convert.ToInt32(TextE.DryW5.MCValue.ToString());
|
|
|
|
|
int w6 = Convert.ToInt32(TextE.DryW6.MCValue.ToString());
|
|
|
|
|
int w7 = Convert.ToInt32(TextE.DryW7.MCValue.ToString());
|
|
|
|
|
int w8 = Convert.ToInt32(TextE.DryW8.MCValue.ToString());
|
|
|
|
|
int w9 = Convert.ToInt32(TextE.DryW9.MCValue.ToString());
|
|
|
|
|
int w10 = Convert.ToInt32(TextE.DryW10.MCValue.ToString());
|
|
|
|
|
int w11 = Convert.ToInt32(TextE.DryW11.MCValue.ToString());
|
|
|
|
|
int w12 = Convert.ToInt32(TextE.DryW12.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
int t1 = Convert.ToInt32(TextE.DryT1.MCValue.ToString());
|
|
|
|
|
int t2 = Convert.ToInt32(TextE.DryT2.MCValue.ToString());
|
|
|
|
|
int t3 = Convert.ToInt32(TextE.DryT3.MCValue.ToString());
|
|
|
|
|
int t4 = Convert.ToInt32(TextE.DryT4.MCValue.ToString());
|
|
|
|
|
int t5 = Convert.ToInt32(TextE.DryT5.MCValue.ToString());
|
|
|
|
|
int t6 = Convert.ToInt32(TextE.DryT6.MCValue.ToString());
|
|
|
|
|
int t7 = Convert.ToInt32(TextE.DryT7.MCValue.ToString());
|
|
|
|
|
int t8 = Convert.ToInt32(TextE.DryT8.MCValue.ToString());
|
|
|
|
|
int t9 = Convert.ToInt32(TextE.DryT9.MCValue.ToString());
|
|
|
|
|
int t10 = Convert.ToInt32(TextE.DryT10.MCValue.ToString());
|
|
|
|
|
int t11 = Convert.ToInt32(TextE.DryT11.MCValue.ToString());
|
|
|
|
|
int t12 = Convert.ToInt32(TextE.DryT12.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
List<RecipePlcView> recipes = new List<RecipePlcView>();
|
|
|
|
|
|
|
|
|
|
RecipePlcView recipe1 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin1,
|
|
|
|
|
Set = w1,
|
|
|
|
|
Tolerance = t1,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe2 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin2,
|
|
|
|
|
Set = w2,
|
|
|
|
|
Tolerance = t2,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe3 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin3,
|
|
|
|
|
Set = w3,
|
|
|
|
|
Tolerance = t3,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe4 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin4,
|
|
|
|
|
Set = w4,
|
|
|
|
|
Tolerance = t4,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe5 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin5,
|
|
|
|
|
Set = w5,
|
|
|
|
|
Tolerance = t5,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe6 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin6,
|
|
|
|
|
Set = w6,
|
|
|
|
|
Tolerance = t6,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe7 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin7,
|
|
|
|
|
Set = w7,
|
|
|
|
|
Tolerance = t7,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe8 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin8,
|
|
|
|
|
Set = w8,
|
|
|
|
|
Tolerance = t8,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe9 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin9,
|
|
|
|
|
Set = w9,
|
|
|
|
|
Tolerance = t9,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe10 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin10,
|
|
|
|
|
Set = w10,
|
|
|
|
|
Tolerance = t10,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe11 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin11,
|
|
|
|
|
Set = w11,
|
|
|
|
|
Tolerance = t11,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe12 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin12,
|
|
|
|
|
Set = w12,
|
|
|
|
|
Tolerance = t12,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
recipes.Add(recipe1);
|
|
|
|
|
recipes.Add(recipe2);
|
|
|
|
|
recipes.Add(recipe3);
|
|
|
|
|
recipes.Add(recipe4);
|
|
|
|
|
recipes.Add(recipe5);
|
|
|
|
|
recipes.Add(recipe6);
|
|
|
|
|
recipes.Add(recipe7);
|
|
|
|
|
recipes.Add(recipe8);
|
|
|
|
|
recipes.Add(recipe9);
|
|
|
|
|
recipes.Add(recipe10);
|
|
|
|
|
recipes.Add(recipe11);
|
|
|
|
|
recipes.Add(recipe12);
|
|
|
|
|
|
|
|
|
|
List<Step> steps = new List<Step>();
|
|
|
|
|
|
|
|
|
|
List<DeviceMaterrial> materials = new List<DeviceMaterrial>();
|
|
|
|
|
|
|
|
|
|
DeviceMaterrial deviceMaterial1 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b1,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b1)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial2 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b2,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b2)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial3 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b3,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b3)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial4 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b4,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b4)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial5 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b5,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b5)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial6 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b6,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b6)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial7 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b7,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b7)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial8 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b8,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b8)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial9 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b9,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b9)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial10 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b10,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b10)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial11 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b11,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b11)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial12 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = DrySelect(),
|
|
|
|
|
MaterrialId = b12,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b12)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
materials.Add(deviceMaterial1);
|
|
|
|
|
materials.Add(deviceMaterial2);
|
|
|
|
|
materials.Add(deviceMaterial3);
|
|
|
|
|
materials.Add(deviceMaterial4);
|
|
|
|
|
materials.Add(deviceMaterial5);
|
|
|
|
|
materials.Add(deviceMaterial6);
|
|
|
|
|
materials.Add(deviceMaterial7);
|
|
|
|
|
materials.Add(deviceMaterial8);
|
|
|
|
|
materials.Add(deviceMaterial9);
|
|
|
|
|
materials.Add(deviceMaterial10);
|
|
|
|
|
materials.Add(deviceMaterial11);
|
|
|
|
|
materials.Add(deviceMaterial12);
|
|
|
|
|
|
|
|
|
|
switch (DrySelect())
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
LjPlanningPlcHelp.DownD1Recipe(recipes, steps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
LjPlanningPlcHelp.DownD2Recipe(recipes, steps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
LjPlanningPlcHelp.DownD3Recipe(recipes, steps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
LjPlanningPlcHelp.DownD4Recipe(recipes, steps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("数据下传成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 手动控制
|
|
|
|
|
|
|
|
|
|
if (ControlsEntity.GelManualPowder == runtime.Sender)
|
|
|
|
|
if (ButtonE.GelManualPowder == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认手动下粉料?", "下粉确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
@ -366,7 +703,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ControlsEntity.GelManualColdWater == runtime.Sender)
|
|
|
|
|
if (ButtonE.GelManualColdWater == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下冷水?", "下水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
@ -427,7 +764,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ControlsEntity.GelManualHotWater == runtime.Sender)
|
|
|
|
|
if (ButtonE.GelManualHotWater == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下热水?", "下水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
@ -488,7 +825,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ControlsEntity.WetManualGel == runtime.Sender)
|
|
|
|
|
if (ButtonE.WetManualGel == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下糊化料?", "下糊化料确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
@ -549,15 +886,15 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ControlsEntity.WetManualControl == runtime.Sender)
|
|
|
|
|
if (ButtonE.WetManualControl == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认下传数据?", "下传确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float t = Convert.ToSingle(ControlsEntity.ManualTolerance.MCValue.ToString());
|
|
|
|
|
float w = Convert.ToSingle(ControlsEntity.ManualWeight.MCValue.ToString());
|
|
|
|
|
float t = Convert.ToSingle(TextE.ManualTolerance.MCValue.ToString());
|
|
|
|
|
float w = Convert.ToSingle(TextE.ManualWeight.MCValue.ToString());
|
|
|
|
|
if (t < 0.1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("公差不能小于0.1!");
|
|
|
|
@ -630,7 +967,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
|
|
|
|
|
#region 自动启停
|
|
|
|
|
|
|
|
|
|
if (ControlsEntity.LineStart == runtime.Sender)
|
|
|
|
|
if (ButtonE.LineStart == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("确认启动生产?", "启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
@ -682,7 +1019,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ControlsEntity.LineStop == runtime.Sender)
|
|
|
|
|
if (ButtonE.LineStop == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
switch (SingleSelect())
|
|
|
|
|
{
|
|
|
|
@ -733,18 +1070,18 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
|
|
|
|
|
#region 维修模式
|
|
|
|
|
|
|
|
|
|
if(ControlsEntity.RepairMode == runtime.Sender)
|
|
|
|
|
if(ButtonE.RepairMode == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ControlsEntity.RepairState.MCValue.ToString() == "关")
|
|
|
|
|
if (LabelE.RepairState.MCValue.ToString() == "关")
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("是否开启维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Db3000Helper.WriteModel(SingleSelect(), true);
|
|
|
|
|
ControlsEntity.RepairState.MCValue = "开";
|
|
|
|
|
LabelE.RepairState.MCValue = "开";
|
|
|
|
|
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
@ -761,14 +1098,14 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (ControlsEntity.RepairState.MCValue.ToString() == "开")
|
|
|
|
|
if (LabelE.RepairState.MCValue.ToString() == "开")
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("是否关闭维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Db3000Helper.WriteModel(SingleSelect(), false);
|
|
|
|
|
ControlsEntity.RepairState.MCValue = "关";
|
|
|
|
|
LabelE.RepairState.MCValue = "关";
|
|
|
|
|
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
@ -800,35 +1137,35 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
/// <returns>返回单选的产线号 如果未选择返回0</returns>
|
|
|
|
|
private int SingleSelect()
|
|
|
|
|
{
|
|
|
|
|
if (Convert.ToBoolean(ControlsEntity.Line1.MCValue) == true)
|
|
|
|
|
if (Convert.ToBoolean(RadioE.Line1.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(ControlsEntity.Line2.MCValue) == true)
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Line2.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(ControlsEntity.Line3.MCValue) == true)
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Line3.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(ControlsEntity.Line4.MCValue) == true)
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Line4.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 4;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(ControlsEntity.Line5.MCValue) == true)
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Line5.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 5;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(ControlsEntity.Line6.MCValue) == true)
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Line6.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 6;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(ControlsEntity.Line7.MCValue) == true)
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Line7.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 7;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(ControlsEntity.Line8.MCValue) == true)
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Line8.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 8;
|
|
|
|
|
}
|
|
|
|
@ -839,73 +1176,33 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 控件导入
|
|
|
|
|
/// 单混机单选选择
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void ControlImport()
|
|
|
|
|
{
|
|
|
|
|
ControlsEntity.Line1 = GetMCRadioButtonControl("Line1");
|
|
|
|
|
ControlsEntity.Line2 = GetMCRadioButtonControl("Line2");
|
|
|
|
|
ControlsEntity.Line3 = GetMCRadioButtonControl("Line3");
|
|
|
|
|
ControlsEntity.Line4 = GetMCRadioButtonControl("Line4");
|
|
|
|
|
ControlsEntity.Line5 = GetMCRadioButtonControl("Line5");
|
|
|
|
|
ControlsEntity.Line6 = GetMCRadioButtonControl("Line6");
|
|
|
|
|
ControlsEntity.Line7 = GetMCRadioButtonControl("Line7");
|
|
|
|
|
ControlsEntity.Line8 = GetMCRadioButtonControl("Line8");
|
|
|
|
|
|
|
|
|
|
ControlsEntity.ChooseMaterial1 = GetComboBoxControl("ChooseMaterial1");
|
|
|
|
|
ControlsEntity.ChooseMaterial2 = GetComboBoxControl("ChooseMaterial2");
|
|
|
|
|
|
|
|
|
|
ControlsEntity.MaterialWeight1 = GetBaseControl("MaterialWeight1");
|
|
|
|
|
ControlsEntity.MaterialWeight2 = GetBaseControl("MaterialWeight2");
|
|
|
|
|
ControlsEntity.MaterialTolerance1 = GetBaseControl("MaterialTolerance1");
|
|
|
|
|
ControlsEntity.MaterialTolerance2 = GetBaseControl("MaterialTolerance2");
|
|
|
|
|
ControlsEntity.GelSpeedSet = GetBaseControl("GelSpeedSet");
|
|
|
|
|
ControlsEntity.GelPosTimeA = GetBaseControl("GelPosTimeA");
|
|
|
|
|
ControlsEntity.GelNagTimeB = GetBaseControl("GelNagTimeB");
|
|
|
|
|
ControlsEntity.GelPosTimeC = GetBaseControl("GelPosTimeC");
|
|
|
|
|
ControlsEntity.GelWaterTime = GetBaseControl("GelWaterTime");
|
|
|
|
|
ControlsEntity.GelWaitTime = GetBaseControl("GelWaitTime");
|
|
|
|
|
ControlsEntity.GelCloseHeatTime = GetBaseControl("GelCloseHeatTime");
|
|
|
|
|
ControlsEntity.GelOutDelayTime = GetBaseControl("GelOutDelayTime");
|
|
|
|
|
|
|
|
|
|
ControlsEntity.RepairState = GetBaseControl("RepairState") as MCLabel;
|
|
|
|
|
|
|
|
|
|
ControlsEntity.WetDryWeight = GetBaseControl("WetDryWeight");
|
|
|
|
|
ControlsEntity.WetMixTime = GetBaseControl("WetMixTime");
|
|
|
|
|
ControlsEntity.WetOutDelayTime = GetBaseControl("WetOutDelayTime");
|
|
|
|
|
ControlsEntity.ManualTolerance = GetBaseControl("ManualTolerance");
|
|
|
|
|
ControlsEntity.ManualWeight = GetBaseControl("ManualWeight");
|
|
|
|
|
|
|
|
|
|
ControlsEntity.WetManualControl = GetButtonControl("WetManualControl");
|
|
|
|
|
ControlsEntity.Download = GetButtonControl("Download");
|
|
|
|
|
ControlsEntity.LineStart = GetButtonControl("LineStart");
|
|
|
|
|
ControlsEntity.LineStop = GetButtonControl("LineStop");
|
|
|
|
|
ControlsEntity.GelManualPowder = GetButtonControl("GelManualPowder");
|
|
|
|
|
ControlsEntity.GelManualColdWater = GetButtonControl("GelManualColdWater");
|
|
|
|
|
ControlsEntity.GelManualHotWater = GetButtonControl("GelManualHotWater");
|
|
|
|
|
ControlsEntity.WetManualGel = GetButtonControl("WetManualGel");
|
|
|
|
|
ControlsEntity.RepairMode = GetButtonControl("RepairMode");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IBaseControl GetBaseControl(string name)
|
|
|
|
|
{
|
|
|
|
|
return McControls.First(x => x.Name == name) as IBaseControl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Button GetButtonControl(string name)
|
|
|
|
|
{
|
|
|
|
|
return McControls.First(x => x.Name == name) as Button;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MCCombobox GetComboBoxControl(string name)
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private int DrySelect()
|
|
|
|
|
{
|
|
|
|
|
return McControls.First(x => x.Name == name) as MCCombobox;
|
|
|
|
|
if (Convert.ToBoolean(RadioE.Dry1.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Dry2.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Dry3.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
else if (Convert.ToBoolean(RadioE.Dry4.MCValue) == true)
|
|
|
|
|
{
|
|
|
|
|
return 4;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MCRadioButton GetMCRadioButtonControl(string name)
|
|
|
|
|
{
|
|
|
|
|
return McControls.First(x => x.Name == name) as MCRadioButton;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|