|
|
|
@ -13,6 +13,9 @@ using System.Linq;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Button = System.Windows.Forms.Button;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjPlanning;
|
|
|
|
|
using System.Diagnostics.SymbolStore;
|
|
|
|
|
using Mesnac.Basic;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.FreeDb;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
{
|
|
|
|
@ -55,17 +58,32 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int bin1 = Convert.ToInt32(ControlsEntity.ChooseMaterial1.MCValue.ToString());
|
|
|
|
|
int bin2 = Convert.ToInt32(ControlsEntity.ChooseMaterial2.MCValue.ToString());
|
|
|
|
|
int b1 = Convert.ToInt32(ControlsEntity.ChooseMaterial1.MCValue.ToString());
|
|
|
|
|
int b2 = Convert.ToInt32(ControlsEntity.ChooseMaterial2.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
List<RecipePlcView> recipes = new List<RecipePlcView>();
|
|
|
|
|
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 MatWei1 = Convert.ToSingle(ControlsEntity.MaterialWeight1.MCValue.ToString());
|
|
|
|
|
float MatWei2 = Convert.ToSingle(ControlsEntity.MaterialWeight2.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
float t1 = Convert.ToSingle(ControlsEntity.MaterialTolerance1.MCValue.ToString());
|
|
|
|
|
float t2 = Convert.ToSingle(ControlsEntity.MaterialTolerance2.MCValue.ToString());
|
|
|
|
|
float GelSpeed = Convert.ToSingle(ControlsEntity.GelSpeedSet.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
if(bin2 == -1)
|
|
|
|
|
float GelPosA = Convert.ToSingle(ControlsEntity.GelPosTimeA.MCValue.ToString());
|
|
|
|
|
float GelNagB = Convert.ToSingle(ControlsEntity.GelNagTimeB.MCValue.ToString());
|
|
|
|
|
short GelPosC = Convert.ToInt16(ControlsEntity.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());
|
|
|
|
|
|
|
|
|
|
if (b2 == -1)
|
|
|
|
|
{
|
|
|
|
|
if (t1 < 0.1)
|
|
|
|
|
if (MatTol1 < 0.1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("公差不能小于0.1!");
|
|
|
|
|
return;
|
|
|
|
@ -73,24 +91,26 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (t1 < 0.1 || t2 < 0.1)
|
|
|
|
|
if (MatTol1 < 0.1 || MatTol2 < 0.1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("公差不能小于0.1!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<RecipePlcView> recipes = new List<RecipePlcView>();
|
|
|
|
|
|
|
|
|
|
RecipePlcView recipe1 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = (short)StockMaterrialDbHelp.GetCodeById(bin1),
|
|
|
|
|
Set = Convert.ToSingle(ControlsEntity.MaterialWeight1.MCValue.ToString()),
|
|
|
|
|
Tolerance = t1,
|
|
|
|
|
Bin = bin1,
|
|
|
|
|
Set = MatWei1,
|
|
|
|
|
Tolerance = MatTol1,
|
|
|
|
|
};
|
|
|
|
|
RecipePlcView recipe2 = new RecipePlcView()
|
|
|
|
|
{
|
|
|
|
|
Bin = (short)StockMaterrialDbHelp.GetCodeById(bin2),
|
|
|
|
|
Set = Convert.ToSingle(ControlsEntity.MaterialWeight2.MCValue.ToString()),
|
|
|
|
|
Tolerance = t2,
|
|
|
|
|
Bin = bin2,
|
|
|
|
|
Set = MatWei2,
|
|
|
|
|
Tolerance = MatTol2,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
recipes.Add(recipe1);
|
|
|
|
@ -101,7 +121,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
Step step1 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 1,
|
|
|
|
|
MixSpeed = Convert.ToSingle(ControlsEntity.GelSpeedSet.MCValue.ToString())
|
|
|
|
|
MixSpeed = GelSpeed
|
|
|
|
|
};
|
|
|
|
|
Step step2 = new Step()
|
|
|
|
|
{
|
|
|
|
@ -110,9 +130,9 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
Step step3 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 3,
|
|
|
|
|
MixTime = Convert.ToInt16(ControlsEntity.GelPosTimeC.MCValue.ToString()),
|
|
|
|
|
MixTemp = Convert.ToSingle(ControlsEntity.GelPosTimeA.MCValue.ToString()),
|
|
|
|
|
MixSpeed = Convert.ToSingle(ControlsEntity.GelNagTimeB.MCValue.ToString())
|
|
|
|
|
MixTime = GelPosC,
|
|
|
|
|
MixTemp = GelPosA,
|
|
|
|
|
MixSpeed = GelNagB
|
|
|
|
|
};
|
|
|
|
|
Step step4 = new Step()
|
|
|
|
|
{
|
|
|
|
@ -121,7 +141,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
Step step5 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 5,
|
|
|
|
|
MixTime = Convert.ToInt16(ControlsEntity.GelWaterTime.MCValue.ToString())
|
|
|
|
|
MixTime = GelWater
|
|
|
|
|
};
|
|
|
|
|
Step step6 = new Step()
|
|
|
|
|
{
|
|
|
|
@ -130,13 +150,13 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
Step step7 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 5,
|
|
|
|
|
MixTime = Convert.ToInt16(ControlsEntity.GelWaitTime.MCValue.ToString())
|
|
|
|
|
MixTime = GelWait
|
|
|
|
|
};
|
|
|
|
|
Step step8 = new Step()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 7,
|
|
|
|
|
MixTime = Convert.ToInt16(ControlsEntity.GelCloseHeatTime.MCValue.ToString()),
|
|
|
|
|
MixTemp = Convert.ToSingle(ControlsEntity.GelOutDelayTime.MCValue.ToString())
|
|
|
|
|
MixTime = GelCloseHeat,
|
|
|
|
|
MixTemp = GelDelayTime
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
steps.Add(step1);
|
|
|
|
@ -148,6 +168,10 @@ 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());
|
|
|
|
|
|
|
|
|
|
List<MixStep> mixSteps = new List<MixStep>();
|
|
|
|
|
|
|
|
|
|
MixStep mixStep1 = new MixStep()
|
|
|
|
@ -157,12 +181,12 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
MixStep mixStep2 = new MixStep()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 2,
|
|
|
|
|
SetValue = Convert.ToSingle(ControlsEntity.WetDryWeight.MCValue.ToString())
|
|
|
|
|
SetValue = WetDryWei
|
|
|
|
|
};
|
|
|
|
|
MixStep mixStep3 = new MixStep()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 3,
|
|
|
|
|
MixTime = Convert.ToInt16(ControlsEntity.WetMixTime.MCValue.ToString())
|
|
|
|
|
MixTime = WetMix
|
|
|
|
|
};
|
|
|
|
|
MixStep mixStep4 = new MixStep()
|
|
|
|
|
{
|
|
|
|
@ -171,7 +195,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
MixStep mixStep5 = new MixStep()
|
|
|
|
|
{
|
|
|
|
|
MixCode = 5,
|
|
|
|
|
MixTime = Convert.ToInt16(ControlsEntity.WetOutDelayTime.MCValue.ToString()),
|
|
|
|
|
MixTime = WetOutDelay
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
mixSteps.Add(mixStep1);
|
|
|
|
@ -185,16 +209,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
DeviceMaterrial deviceMaterial1 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = SingleSelect(),
|
|
|
|
|
MaterrialId = bin1,
|
|
|
|
|
MaterrialId = b1,
|
|
|
|
|
Type = 2,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(bin1)
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b1)
|
|
|
|
|
};
|
|
|
|
|
DeviceMaterrial deviceMaterial2 = new DeviceMaterrial()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = SingleSelect(),
|
|
|
|
|
MaterrialId = bin2,
|
|
|
|
|
MaterrialId = b2,
|
|
|
|
|
Type = 2,
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(bin2)
|
|
|
|
|
Code = StockMaterrialDbHelp.GetCodeById(b2)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
materials.Add(deviceMaterial1);
|
|
|
|
@ -247,6 +271,33 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "糊化湿混数据下传",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
MaterialBin1 = bin1,
|
|
|
|
|
MaterialBin2 = bin2,
|
|
|
|
|
MaterialWeight1 = MatWei1,
|
|
|
|
|
MaterialWeight2 = MatWei2,
|
|
|
|
|
MaterialTolerance1 = MatTol1,
|
|
|
|
|
MaterialTolerance2 = MatTol2,
|
|
|
|
|
GelSpeedSet = GelSpeed,
|
|
|
|
|
GelPosTimeA = GelPosA,
|
|
|
|
|
GelNagTimeB = GelNagB,
|
|
|
|
|
GelPosTimeC = GelPosC,
|
|
|
|
|
GelWaterTime = GelWater,
|
|
|
|
|
GelWaitTime = GelWait,
|
|
|
|
|
GelCloseHeatTime = GelCloseHeat,
|
|
|
|
|
GelOutDelayTime = GelDelayTime,
|
|
|
|
|
WetDryWeight = WetDryWei,
|
|
|
|
|
WetMixTime = WetMix,
|
|
|
|
|
WetOutDelayTime = WetOutDelay
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("数据下传成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -301,6 +352,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "手动下粉料",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("信号下达成功!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -351,6 +412,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "手动下冷水",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("信号下达成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -403,6 +474,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "手动下热水",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("信号下达成功!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -454,6 +535,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "手动下糊化料",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("信号下达成功!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -466,7 +557,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float t = Convert.ToSingle(ControlsEntity.ManualTolerance.MCValue.ToString());
|
|
|
|
|
|
|
|
|
|
float w = Convert.ToSingle(ControlsEntity.ManualWeight.MCValue.ToString());
|
|
|
|
|
if (t < 0.1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("公差不能小于0.1!");
|
|
|
|
@ -475,7 +566,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
|
|
|
|
|
SetValue value = new SetValue()
|
|
|
|
|
{
|
|
|
|
|
Value = Convert.ToSingle(ControlsEntity.ManualWeight.MCValue.ToString()),
|
|
|
|
|
Value = w,
|
|
|
|
|
Toterance = t
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -519,6 +610,18 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "手动下黑粉",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
ManualTolerance = t,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
ManualWeight = w,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("数据下传成功!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -565,6 +668,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "产线启动",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("产线已启动!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -602,6 +715,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "产线停止",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("已经停止生产");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -622,7 +745,19 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
Db3000Helper.WriteModel(SingleSelect(), true);
|
|
|
|
|
ControlsEntity.RepairState.MCValue = "开";
|
|
|
|
|
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "维修模式开启",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("维修模式已开启");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -634,7 +769,19 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
|
|
|
|
|
}
|
|
|
|
|
Db3000Helper.WriteModel(SingleSelect(), false);
|
|
|
|
|
ControlsEntity.RepairState.MCValue = "关";
|
|
|
|
|
|
|
|
|
|
Auto_Log log = new Auto_Log()
|
|
|
|
|
{
|
|
|
|
|
ActionKind = "维修模式关闭",
|
|
|
|
|
LogTime = DateTime.Now,
|
|
|
|
|
LineNo = SingleSelect(),
|
|
|
|
|
UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("维修模式已关闭");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|