You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs

259 lines
7.7 KiB
C#

using DataBlockHelper.DBHelpers;
using DataBlockHelper.Entity.DB2104Entity;
using DataBlockHelper.Entity.DB2106Entity;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.AutoControl.DB;
using Mesnac.Action.ChemicalWeighing.AutoControl.Entity;
using Mesnac.Action.ChemicalWeighing.LjMixManager;
using Mesnac.Controls.Base;
using Mesnac.Controls.Default;
using Mesnac.Core.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesnac.Controls.Default;
using Button = System.Windows.Forms.Button;
using System.Data;
namespace Mesnac.Action.ChemicalWeighing.AutoControl
{
internal class GelerWeterControl : ChemicalWeighingAction, IAction
{
private List<Control> McControls; // 获取Query控件
GelerWeterControlsEntity ControlsEntity = new GelerWeterControlsEntity();
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用
McControls = GetAllControls();
ControlImport();
BottomSelect(runtime);
}
/// <summary>
/// 单选选择
/// </summary>
/// <returns>返回单选的产线号 如果未选择返回0</returns>
private int SingleSelect()
{
if(Convert.ToBoolean(ControlsEntity.Line1.MCValue) == true)
{
return 1;
}
else if (Convert.ToBoolean(ControlsEntity.Line2.MCValue) == true)
{
return 2;
}
else if (Convert.ToBoolean(ControlsEntity.Line3.MCValue) == true)
{
return 3;
}
else if (Convert.ToBoolean(ControlsEntity.Line4.MCValue) == true)
{
return 4;
}
else if (Convert.ToBoolean(ControlsEntity.Line5.MCValue) == true)
{
return 5;
}
else if (Convert.ToBoolean(ControlsEntity.Line6.MCValue) == true)
{
return 6;
}
else if (Convert.ToBoolean(ControlsEntity.Line7.MCValue) == true)
{
return 7;
}
else if (Convert.ToBoolean(ControlsEntity.Line8.MCValue) == true)
{
return 8;
}
else
{
return 0;
}
}
/// <summary>
/// 控件导入
/// </summary>
private void ControlImport()
{
ControlsEntity.Line1 = GetBaseControl("Line1");
ControlsEntity.Line2 = GetBaseControl("Line2");
ControlsEntity.Line3 = GetBaseControl("Line3");
ControlsEntity.Line4 = GetBaseControl("Line4");
ControlsEntity.Line5 = GetBaseControl("Line5");
ControlsEntity.Line6 = GetBaseControl("Line6");
ControlsEntity.Line7 = GetBaseControl("Line7");
ControlsEntity.Line8 = GetBaseControl("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.WetDryWeight = GetBaseControl("WetDryWeight");
ControlsEntity.WetMixTime = GetBaseControl("WetMixTime");
ControlsEntity.WetOutDelayTime = GetBaseControl("WetOutDelayTime");
ControlsEntity.WetManualControl = GetButtonControl("WetManualControl");
ControlsEntity.Download = GetButtonControl("Download");
ControlsEntity.LineStart = GetButtonControl("LineStart");
ControlsEntity.LineStop = GetButtonControl("LineStop");
}
private void BottomSelect(RuntimeParameter runtime)
{
if(ControlsEntity.WetManualControl == runtime.Sender)
{
}
if (ControlsEntity.Download == runtime.Sender)
{
float GelSpeed;
if (float.TryParse(Convert.ToString(ControlsEntity.GelSpeedSet.MCValue), out GelSpeed)
)
{
}
List<RecipePlcView> recipes = new List<RecipePlcView>();
RecipePlcView recipe1 = new RecipePlcView()
{
};
RecipePlcView recipe2 = new RecipePlcView()
{
};
recipes.Add(recipe1);
recipes.Add(recipe2);
List<Step> steps = new List<Step>();
Step step1 = new Step()
{
MixSpeed =
};
Step step2 = new Step()
{
};
Step step3 = new Step()
{
};
Step step4 = new Step()
{
};
Step step5 = new Step()
{
};
Step step6 = new Step()
{
};
Step step7 = new Step()
{
};
Step step8 = new Step()
{
};
steps.Add(step1);
steps.Add(step2);
steps.Add(step3);
steps.Add(step4);
steps.Add(step5);
steps.Add(step6);
steps.Add(step7);
steps.Add(step8);
List<MixStep> mixSteps = new List<MixStep>();
MixStep mixStep1 = new MixStep()
{
};
MixStep mixStep2 = new MixStep()
{
};
MixStep mixStep3 = new MixStep()
{
};
MixStep mixStep4 = new MixStep()
{
};
MixStep mixStep5 = new MixStep()
{
};
mixSteps.Add(mixStep1);
mixSteps.Add(mixStep2);
mixSteps.Add(mixStep3);
mixSteps.Add(mixStep4);
mixSteps.Add(mixStep5);
}
if (ControlsEntity.LineStart == runtime.Sender)
{
}
if (ControlsEntity.LineStop == runtime.Sender)
{
}
}
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)
{
return McControls.First(x => x.Name == name) as MCCombobox;
}
}
}