|
|
|
@ -0,0 +1,759 @@
|
|
|
|
|
using DataBlockHelper.DBHelpers;
|
|
|
|
|
using DataBlockHelper.Entity.DB2104Entity;
|
|
|
|
|
using DevExpress.XtraEditors.Filtering.Templates;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.AutoControl.DB;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.AutoControl.Entity;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjMixManager;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjPlanning;
|
|
|
|
|
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 static Mesnac.Action.ChemicalWeighing.AutoControl.AutoLogHelper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
{
|
|
|
|
|
public static class PlcAutoWriteHelper
|
|
|
|
|
{
|
|
|
|
|
private static int TFlag = 0;
|
|
|
|
|
|
|
|
|
|
#region 湿混糊化下传
|
|
|
|
|
|
|
|
|
|
public static void GelWetDownload(MCTextBoxEntity TextE, MCComboBoxEntity ComboE, MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
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(TextE.MaterialTolerance1.MCValue.ToString());
|
|
|
|
|
float MatTol2 = Convert.ToSingle(TextE.MaterialTolerance2.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
float MatWei1 = Convert.ToSingle(TextE.MaterialWeight1.MCValue.ToString());
|
|
|
|
|
float MatWei2 = Convert.ToSingle(TextE.MaterialWeight2.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
float GelSpeed = Convert.ToSingle(TextE.GelSpeedSet.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(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)
|
|
|
|
|
{
|
|
|
|
|
if (MatTol1 < 0.1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("公差不能小于0.1!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (MatTol1 < 0.1 || MatTol2 < 0.1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("公差不能小于0.1!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<RecipePlcView> recipes = new List<RecipePlcView>();
|
|
|
|
|
|
|
|
|
|
RecipePlcView recipe1 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin1,
|
|
|
|
|
Set = MatWei1,
|
|
|
|
|
Tolerance = MatTol1,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe2 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin2,
|
|
|
|
|
Set = MatWei2,
|
|
|
|
|
Tolerance = MatTol2,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
recipes.Add(recipe1);
|
|
|
|
|
recipes.Add(recipe2);
|
|
|
|
|
|
|
|
|
|
List<Step> steps = new List<Step>();
|
|
|
|
|
|
|
|
|
|
Step step1 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 1,
|
|
|
|
|
MixSpeed = GelSpeed
|
|
|
|
|
};
|
|
|
|
|
Step step2 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 2,
|
|
|
|
|
};
|
|
|
|
|
Step step3 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 3,
|
|
|
|
|
MixTime = GelPosC,
|
|
|
|
|
MixTemp = GelPosA,
|
|
|
|
|
MixSpeed = GelNagB
|
|
|
|
|
};
|
|
|
|
|
Step step4 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 4,
|
|
|
|
|
};
|
|
|
|
|
Step step5 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 5,
|
|
|
|
|
MixTime = GelWater
|
|
|
|
|
};
|
|
|
|
|
Step step6 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 6,
|
|
|
|
|
};
|
|
|
|
|
Step step7 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 5,
|
|
|
|
|
MixTime = GelWait
|
|
|
|
|
};
|
|
|
|
|
Step step8 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 7,
|
|
|
|
|
MixTime = GelCloseHeat,
|
|
|
|
|
MixTemp = GelDelayTime
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
steps.Add(step1);
|
|
|
|
|
steps.Add(step2);
|
|
|
|
|
steps.Add(step3);
|
|
|
|
|
steps.Add(step4);
|
|
|
|
|
steps.Add(step5);
|
|
|
|
|
steps.Add(step6);
|
|
|
|
|
steps.Add(step7);
|
|
|
|
|
steps.Add(step8);
|
|
|
|
|
|
|
|
|
|
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>();
|
|
|
|
|
|
|
|
|
|
MixStep mixStep1 = new MixStep()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 1,
|
|
|
|
|
};
|
|
|
|
|
MixStep mixStep2 = new MixStep()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 2,
|
|
|
|
|
SetValue = WetDryWei
|
|
|
|
|
};
|
|
|
|
|
MixStep mixStep3 = new MixStep()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 3,
|
|
|
|
|
MixTime = WetMix
|
|
|
|
|
};
|
|
|
|
|
MixStep mixStep4 = new MixStep()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 4,
|
|
|
|
|
};
|
|
|
|
|
MixStep mixStep5 = new MixStep()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 5,
|
|
|
|
|
MixTime = WetOutDelay
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
mixSteps.Add(mixStep1);
|
|
|
|
|
mixSteps.Add(mixStep2);
|
|
|
|
|
mixSteps.Add(mixStep3);
|
|
|
|
|
mixSteps.Add(mixStep4);
|
|
|
|
|
mixSteps.Add(mixStep5);
|
|
|
|
|
|
|
|
|
|
List<DeviceMaterrial> materials = new List<DeviceMaterrial>();
|
|
|
|
|
|
|
|
|
|
DeviceMaterrial deviceMaterial1 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = ControlsHelper.SingleSelect(RadioE),
|
|
|
|
|
MaterrialId = b1,
|
|
|
|
|
Type = 2,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b1)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DeviceMaterrial deviceMaterial2 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = ControlsHelper.SingleSelect(RadioE),
|
|
|
|
|
MaterrialId = b2,
|
|
|
|
|
Type = 2,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b2)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
materials.Add(deviceMaterial1);
|
|
|
|
|
materials.Add(deviceMaterial2);
|
|
|
|
|
|
|
|
|
|
switch (ControlsHelper.SingleSelect(RadioE))
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
LjPlanningPlcHelp.DownG1Recipe(recipes, steps);
|
|
|
|
|
LjPlanningPlcHelp.DownM1Recipe(mixSteps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
LjPlanningPlcHelp.DownG2Recipe(recipes, steps);
|
|
|
|
|
LjPlanningPlcHelp.DownM2Recipe(mixSteps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
LjPlanningPlcHelp.DownG3Recipe(recipes, steps);
|
|
|
|
|
LjPlanningPlcHelp.DownM3Recipe(mixSteps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
LjPlanningPlcHelp.DownG4Recipe(recipes, steps);
|
|
|
|
|
LjPlanningPlcHelp.DownM4Recipe(mixSteps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
LjPlanningPlcHelp.DownG5Recipe(recipes, steps);
|
|
|
|
|
LjPlanningPlcHelp.DownM5Recipe(mixSteps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
LjPlanningPlcHelp.DownG6Recipe(recipes, steps);
|
|
|
|
|
LjPlanningPlcHelp.DownM6Recipe(mixSteps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
LjPlanningPlcHelp.DownG7Recipe(recipes, steps);
|
|
|
|
|
LjPlanningPlcHelp.DownM7Recipe(mixSteps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
LjPlanningPlcHelp.DownG8Recipe(recipes, steps);
|
|
|
|
|
LjPlanningPlcHelp.DownM8Recipe(mixSteps);
|
|
|
|
|
DeviceMaterrialService.Save(materials);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
MessageBox.Show("请选择一条产线!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GWlog(recipes, steps, mixSteps, RadioE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 干混下传
|
|
|
|
|
|
|
|
|
|
public static void DryDownload(MCTextBoxEntity TextE, MCComboBoxEntity ComboE, MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
List<RecipePlcView> recipes = new List<RecipePlcView>();
|
|
|
|
|
|
|
|
|
|
List<Step> steps = new List<Step>();
|
|
|
|
|
|
|
|
|
|
List<DeviceMaterrial> materials = new List<DeviceMaterrial>();
|
|
|
|
|
|
|
|
|
|
DryerGetValue(ComboE.DryM1, TextE.DryW1, TextE.DryT1, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM2, TextE.DryW2, TextE.DryT2, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM3, TextE.DryW3, TextE.DryT3, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM4, TextE.DryW4, TextE.DryT4, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM5, TextE.DryW5, TextE.DryT5, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM6, TextE.DryW6, TextE.DryT6, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM7, TextE.DryW7, TextE.DryT7, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM8, TextE.DryW8, TextE.DryT8, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM9, TextE.DryW9, TextE.DryT9, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM10, TextE.DryW10, TextE.DryT10, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM11, TextE.DryW11, TextE.DryT11, recipes, materials, RadioE);
|
|
|
|
|
DryerGetValue(ComboE.DryM12, TextE.DryW12, TextE.DryT12, recipes, materials, RadioE);
|
|
|
|
|
|
|
|
|
|
if (TFlag == 1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("公差不能小于0.1!");
|
|
|
|
|
TFlag = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (ControlsHelper.DrySelect(RadioE))
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 水称下传
|
|
|
|
|
|
|
|
|
|
public static void WaterDownload(MCTextBoxEntity TextE)
|
|
|
|
|
{
|
|
|
|
|
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 手动控制
|
|
|
|
|
|
|
|
|
|
#region 糊化锅手动下粉料
|
|
|
|
|
|
|
|
|
|
public static bool GelPowderDownload(MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
bool isReady;
|
|
|
|
|
|
|
|
|
|
switch (ControlsHelper.SingleSelect(RadioE))
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG1Pd();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG2Pd();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG3Pd();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG4Pd();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG5Pd();
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG6Pd();
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG7Pd();
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG8Pd();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
isReady = false;
|
|
|
|
|
MessageBox.Show("当前未选择产线!");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return isReady;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 糊化锅手动加冷水
|
|
|
|
|
|
|
|
|
|
public static bool GelColdWaterDownload(MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
bool isReady;
|
|
|
|
|
|
|
|
|
|
switch (ControlsHelper.SingleSelect(RadioE))
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG1Cw();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG2Cw();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG3Cw();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG4Cw();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG5Cw();
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG6Cw();
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG7Cw();
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG8Cw();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
isReady = false;
|
|
|
|
|
MessageBox.Show("当前未选择产线!");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return isReady;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 糊化锅手动加热水
|
|
|
|
|
|
|
|
|
|
public static bool GelHotWaterDownload(MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
bool isReady;
|
|
|
|
|
|
|
|
|
|
switch (ControlsHelper.SingleSelect(RadioE))
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG1Hw();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG2Hw();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG3Hw();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG4Hw();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG5Hw();
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG6Hw();
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG7Hw();
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteG8Hw();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
isReady = false;
|
|
|
|
|
MessageBox.Show("当前未选择产线!");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return isReady;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 湿混机手动下糊化料
|
|
|
|
|
|
|
|
|
|
public static bool WetGelatDownload(MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
bool isReady;
|
|
|
|
|
|
|
|
|
|
switch (ControlsHelper.SingleSelect(RadioE))
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteM1();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteM2();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteM3();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteM4();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteM5();
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteM6();
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteM7();
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
isReady = DB2105WriteHelper.WriteM8();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
isReady = false;
|
|
|
|
|
MessageBox.Show("当前未选择产线!");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return isReady;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 湿混机手动下粉料
|
|
|
|
|
|
|
|
|
|
public static void WetGelatDownload(MCTextBoxEntity TextE, MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
float t = Convert.ToSingle(TextE.ManualTolerance.MCValue.ToString());
|
|
|
|
|
float w = Convert.ToSingle(TextE.ManualWeight.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
if (t < 0.1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("公差不能小于0.1!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetValue value = new SetValue()
|
|
|
|
|
{
|
|
|
|
|
Value = w,
|
|
|
|
|
Toterance = t
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
switch (ControlsHelper.SingleSelect(RadioE))
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
DB2105WriteHelper.WriteManScrewH1();
|
|
|
|
|
DB2105WriteHelper.WriteSetValueH1(value);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
DB2105WriteHelper.WriteManScrewH2();
|
|
|
|
|
DB2105WriteHelper.WriteSetValueH1(value);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
DB2105WriteHelper.WriteManScrewH3();
|
|
|
|
|
DB2105WriteHelper.WriteSetValueH2(value);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
DB2105WriteHelper.WriteManScrewH4();
|
|
|
|
|
DB2105WriteHelper.WriteSetValueH2(value);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
DB2105WriteHelper.WriteManScrewH5();
|
|
|
|
|
DB2105WriteHelper.WriteSetValueH3(value);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
DB2105WriteHelper.WriteManScrewH6();
|
|
|
|
|
DB2105WriteHelper.WriteSetValueH3(value);
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
DB2105WriteHelper.WriteManScrewH7();
|
|
|
|
|
DB2105WriteHelper.WriteSetValueH4(value);
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
DB2105WriteHelper.WriteManScrewH8();
|
|
|
|
|
DB2105WriteHelper.WriteSetValueH4(value);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
MessageBox.Show("当前未选择产线!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ManualWeightLog(w, t, RadioE);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 产线启停
|
|
|
|
|
|
|
|
|
|
#region 产线启动
|
|
|
|
|
|
|
|
|
|
public static void LineStart(MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
switch (ControlsHelper.SingleSelect(RadioE))
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
DB2105WriteHelper.WriteStartJob1();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
DB2105WriteHelper.WriteStartJob2();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
DB2105WriteHelper.WriteStartJob3();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
DB2105WriteHelper.WriteStartJob4();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
DB2105WriteHelper.WriteStartJob5();
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
DB2105WriteHelper.WriteStartJob6();
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
DB2105WriteHelper.WriteStartJob7();
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
DB2105WriteHelper.WriteStartJob8();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
MessageBox.Show("请选择一条产线!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SingleLog("产线启动", RadioE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 产线停止
|
|
|
|
|
|
|
|
|
|
public static void LineStop(MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
switch (ControlsHelper.SingleSelect(RadioE))
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
DB2105WriteHelper.WriteStopJob1();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
DB2105WriteHelper.WriteStopJob2();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
DB2105WriteHelper.WriteStopJob3();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
DB2105WriteHelper.WriteStopJob4();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
DB2105WriteHelper.WriteStopJob5();
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
DB2105WriteHelper.WriteStopJob6();
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
DB2105WriteHelper.WriteStopJob7();
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
DB2105WriteHelper.WriteStopJob8();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
MessageBox.Show("请选择一条产线!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SingleLog("产线停止", RadioE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 维修模式
|
|
|
|
|
|
|
|
|
|
public static void RepairOnOff(MCLabelEntity LabelE, MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
if (LabelE.RepairState.MCValue.ToString() == "关")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (MessageBox.Show("是否开启维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Db3000Helper.WriteModel(ControlsHelper.SingleSelect(RadioE), true);
|
|
|
|
|
LabelE.RepairState.MCValue = "开";
|
|
|
|
|
|
|
|
|
|
SingleLog("维修模式开启", RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("维修模式已开启");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (LabelE.RepairState.MCValue.ToString() == "开")
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("是否关闭维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Db3000Helper.WriteModel(ControlsHelper.SingleSelect(RadioE), false);
|
|
|
|
|
LabelE.RepairState.MCValue = "关";
|
|
|
|
|
|
|
|
|
|
SingleLog("维修模式关闭", RadioE);
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("维修模式已关闭");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 湿混机物料封装
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 干混机数据打包封装
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="DryM">物料类型</param>
|
|
|
|
|
/// <param name="DryW">重量</param>
|
|
|
|
|
/// <param name="DryT">公差</param>
|
|
|
|
|
/// <param name="recipes">物料集合</param>
|
|
|
|
|
/// <param name="steps">步骤集合</param>
|
|
|
|
|
/// <param name="materials">数据库物料记录</param>
|
|
|
|
|
private static void DryerGetValue(MCCombobox DryM, MCTextBox DryW, MCTextBox DryT,
|
|
|
|
|
List<RecipePlcView> recipes, List<DeviceMaterrial> materials, MCRadioButtonEntity RadioE)
|
|
|
|
|
{
|
|
|
|
|
int b = Convert.ToInt32(DryM.MCValue.ToString());
|
|
|
|
|
short bin = (short)StockMaterrialDbHelp.GetCodeById(b);
|
|
|
|
|
float w = Convert.ToSingle(DryW.MCValue.ToString());
|
|
|
|
|
float t = Convert.ToSingle(DryT.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
if (b != -1 && t < 0.1)
|
|
|
|
|
{
|
|
|
|
|
TFlag = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RecipePlcView recipe1 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = bin,
|
|
|
|
|
Set = w,
|
|
|
|
|
Tolerance = t,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
recipes.Add(recipe1);
|
|
|
|
|
|
|
|
|
|
DeviceMaterrial deviceMaterial1 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = ControlsHelper.DrySelect(RadioE),
|
|
|
|
|
MaterrialId = b,
|
|
|
|
|
Type = 1,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
materials.Add(deviceMaterial1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|