|
|
|
@ -28,19 +28,19 @@ using System.Threading;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
{
|
|
|
|
|
class ManualControlAction : ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
class ManualControlAction : ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private List<DbMCControl> McControllist;
|
|
|
|
|
private List<DbMCControl> _McControllist;
|
|
|
|
|
|
|
|
|
|
private byte GelChooseA;
|
|
|
|
|
private byte GelChooseB;
|
|
|
|
|
private byte GelChooseB;
|
|
|
|
|
|
|
|
|
|
private byte WetChoose1;
|
|
|
|
|
private byte WetChoose2;
|
|
|
|
|
private byte WetChoose3;
|
|
|
|
|
private byte WetChoose4;
|
|
|
|
|
private byte WetChoose1;
|
|
|
|
|
private byte WetChoose2;
|
|
|
|
|
private byte WetChoose3;
|
|
|
|
|
private byte WetChoose4;
|
|
|
|
|
|
|
|
|
|
#region 控件属性定义
|
|
|
|
|
|
|
|
|
@ -115,7 +115,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
IBaseControl PointSpeedSpiralValue3;
|
|
|
|
|
IBaseControl PointSpeedSpiralValue4;
|
|
|
|
|
|
|
|
|
|
MCButton WetRequest1;
|
|
|
|
|
MCButton WetRequest1;
|
|
|
|
|
// MCButton WetRequest2;
|
|
|
|
|
// MCButton WetRequest3;
|
|
|
|
|
// MCButton WetRequest4;
|
|
|
|
@ -131,22 +131,22 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
DbMCControl materialGridControl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//keywords
|
|
|
|
|
|
|
|
|
|
IBaseControl keywords;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime); //必须要调用
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime); //必须要调用
|
|
|
|
|
|
|
|
|
|
materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "ManualLogGridView").FirstOrDefault();
|
|
|
|
|
ManualLogSelect("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ControlImport();
|
|
|
|
|
SingleSelect();
|
|
|
|
|
BottomSelect(runtime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 控件获取导入
|
|
|
|
@ -230,8 +230,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
PointSpeedSpiralValue3 = GetBaseControl("PointSpeedSpiralValue3");
|
|
|
|
|
PointSpeedSpiralValue4 = GetBaseControl("PointSpeedSpiralValue4");
|
|
|
|
|
|
|
|
|
|
WetRequest1 = GetButtonControl("WetRequest1");
|
|
|
|
|
keywords = GetBaseControl("keywords");
|
|
|
|
|
WetRequest1 = GetButtonControl("WetRequest1");
|
|
|
|
|
keywords = GetBaseControl("keywords");
|
|
|
|
|
// WetRequest2 = GetButtonControl("WetRequest2");
|
|
|
|
|
// WetRequest3 = GetButtonControl("WetRequest3");
|
|
|
|
|
// WetRequest4 = GetButtonControl("WetRequest4");
|
|
|
|
@ -346,7 +346,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="runtime">运行时参数</param>
|
|
|
|
|
private void BottomSelect(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
Focus.Focus();
|
|
|
|
|
|
|
|
|
|
#region 水称称量按钮
|
|
|
|
@ -486,7 +486,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
switch (GelChooseA)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
if(SelectAddWaterControl(1) == 2)
|
|
|
|
|
if (SelectAddWaterControl(1) == 2)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("上次糊化锅1已经加过冷水,确认再次添加?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
|
|
|
{
|
|
|
|
@ -886,8 +886,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
|
|
|
|
|
if (SpiralOn1 == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (MinAnPlc.Heir1)
|
|
|
|
|
{
|
|
|
|
|
DialogResult result1 =
|
|
|
|
@ -913,7 +911,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
short.TryParse(Convert.ToString(LowSpeedSpiralValue1.MCValue), out valueSpeedLow) &&
|
|
|
|
|
short.TryParse(Convert.ToString(PointSpeedSpiralValue1.MCValue), out valueSpeedPoint))
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("螺旋1确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
|
|
|
if (MessageBox.Show("螺旋1确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
|
|
|
== DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
@ -929,6 +927,20 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
switch (WetChoose1)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
if (valueSet > 350)
|
|
|
|
|
{
|
|
|
|
|
var record = FreeSqlUnit.Instance.Select<ManualLogEntity>()
|
|
|
|
|
.Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 1 && x.value > 350).ToList().LastOrDefault();
|
|
|
|
|
if(record == null) { return; }
|
|
|
|
|
if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
|
|
|
== DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PlcControl("DB2119.40.0", valueSet);
|
|
|
|
|
PlcControl("DB2119.44.0", valueFast);
|
|
|
|
|
PlcControl("DB2119.46.0", valuePoint);
|
|
|
|
@ -941,6 +953,20 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
ManualLogControl("螺旋1启动向湿混机1", valueSet, 3, 1, 2);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
if (valueSet > 350)
|
|
|
|
|
{
|
|
|
|
|
var record = FreeSqlUnit.Instance.Select<ManualLogEntity>()
|
|
|
|
|
.Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 2 && x.value > 350).ToList().LastOrDefault();
|
|
|
|
|
if (record == null) { return; }
|
|
|
|
|
if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
|
|
|
== DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PlcControl("DB2119.40.0", valueSet);
|
|
|
|
|
PlcControl("DB2119.44.0", valueFast);
|
|
|
|
|
PlcControl("DB2119.46.0", valuePoint);
|
|
|
|
@ -999,6 +1025,20 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
switch (WetChoose2)
|
|
|
|
|
{
|
|
|
|
|
case 3:
|
|
|
|
|
if (valueSet > 350)
|
|
|
|
|
{
|
|
|
|
|
var record = FreeSqlUnit.Instance.Select<ManualLogEntity>()
|
|
|
|
|
.Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 3 && x.value > 350).ToList().LastOrDefault();
|
|
|
|
|
if (record == null) { return; }
|
|
|
|
|
if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
|
|
|
== DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PlcControl("DB2119.62.0", valueSet);
|
|
|
|
|
PlcControl("DB2119.66.0", valueFast);
|
|
|
|
|
PlcControl("DB2119.68.0", valuePoint);
|
|
|
|
@ -1011,6 +1051,20 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
ManualLogControl("螺旋2启动向湿混机3", valueSet, 3, 3, 2);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
if (valueSet > 350)
|
|
|
|
|
{
|
|
|
|
|
var record = FreeSqlUnit.Instance.Select<ManualLogEntity>()
|
|
|
|
|
.Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 4 && x.value > 350).ToList().LastOrDefault();
|
|
|
|
|
if (record == null) { return; }
|
|
|
|
|
if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
|
|
|
== DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PlcControl("DB2119.62.0", valueSet);
|
|
|
|
|
PlcControl("DB2119.66.0", valueFast);
|
|
|
|
|
PlcControl("DB2119.68.0", valuePoint);
|
|
|
|
@ -1069,6 +1123,20 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
switch (WetChoose3)
|
|
|
|
|
{
|
|
|
|
|
case 5:
|
|
|
|
|
if (valueSet > 350)
|
|
|
|
|
{
|
|
|
|
|
var record = FreeSqlUnit.Instance.Select<ManualLogEntity>()
|
|
|
|
|
.Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 5 && x.value > 350).ToList().LastOrDefault();
|
|
|
|
|
if (record == null) { return; }
|
|
|
|
|
if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
|
|
|
== DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PlcControl("DB2119.84.0", valueSet);
|
|
|
|
|
PlcControl("DB2119.88.0", valueFast);
|
|
|
|
|
PlcControl("DB2119.90.0", valuePoint);
|
|
|
|
@ -1081,6 +1149,20 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
ManualLogControl("螺旋3启动向湿混机5", valueSet, 3, 5, 2);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
if (valueSet > 350)
|
|
|
|
|
{
|
|
|
|
|
var record = FreeSqlUnit.Instance.Select<ManualLogEntity>()
|
|
|
|
|
.Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 6 && x.value > 350).ToList().LastOrDefault();
|
|
|
|
|
if (record == null) { return; }
|
|
|
|
|
if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15)
|
|
|
|
|
{
|
|
|
|
|
if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
|
|
|
== DialogResult.No)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PlcControl("DB2119.84.0", valueSet);
|
|
|
|
|
PlcControl("DB2119.88.0", valueFast);
|
|
|
|
|
PlcControl("DB2119.90.0", valuePoint);
|
|
|
|
@ -1195,9 +1277,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
string key = keywords.MCValue.ToString();
|
|
|
|
|
ManualLogSelect(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(SaveSetting == runtime.Sender)
|
|
|
|
|
|
|
|
|
|
if (SaveSetting == runtime.Sender)
|
|
|
|
|
{
|
|
|
|
|
short value1;
|
|
|
|
|
short value2;
|
|
|
|
@ -1207,7 +1289,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
short value6;
|
|
|
|
|
short value7;
|
|
|
|
|
short value8;
|
|
|
|
|
if (short.TryParse(Convert.ToString(SetWaterValue1.MCValue), out value1) &&
|
|
|
|
|
if (short.TryParse(Convert.ToString(SetWaterValue1.MCValue), out value1) &&
|
|
|
|
|
short.TryParse(Convert.ToString(SetWaterValue2.MCValue), out value2) &&
|
|
|
|
|
short.TryParse(Convert.ToString(SetWaterValue3.MCValue), out value3) &&
|
|
|
|
|
short.TryParse(Convert.ToString(SetWaterValue4.MCValue), out value4) &&
|
|
|
|
@ -1225,7 +1307,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
|
|
|
|
|
ManualControlSetting[] settings = new ManualControlSetting[8];
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < 8; i++)
|
|
|
|
|
for (int i = 0; i < 8; i++)
|
|
|
|
|
{
|
|
|
|
|
settings[i] = new ManualControlSetting();
|
|
|
|
|
}
|
|
|
|
@ -1293,16 +1375,16 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
|
|
|
|
|
private void PlcControl(string address, short binNo)
|
|
|
|
|
{
|
|
|
|
|
if(!PlcConnect.Instance.Write(address, binNo).IsSuccess)
|
|
|
|
|
if (!PlcConnect.Instance.Write(address, binNo).IsSuccess)
|
|
|
|
|
{
|
|
|
|
|
if(PlcConnect.Instance.ReadInt16(address).Content == binNo)
|
|
|
|
|
if (PlcConnect.Instance.ReadInt16(address).Content == binNo)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for(int i = 0; i < 3; i++)
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
if(PlcConnect.Instance.Write(address, binNo).IsSuccess)
|
|
|
|
|
if (PlcConnect.Instance.Write(address, binNo).IsSuccess)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1383,12 +1465,12 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
/// <param name="deviceno">设备编号</param>
|
|
|
|
|
/// <param name="devicekind">设备类型 0无 1水称 2螺旋</param>
|
|
|
|
|
private void ManualLogControl(string logName, int value, int valuekind, int deviceno, int devicekind)
|
|
|
|
|
{
|
|
|
|
|
var Log = new ManualLogEntity()
|
|
|
|
|
{
|
|
|
|
|
logtext = logName,
|
|
|
|
|
logtime = DateTime.Now,
|
|
|
|
|
userid = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
{
|
|
|
|
|
var Log = new ManualLogEntity()
|
|
|
|
|
{
|
|
|
|
|
logtext = logName,
|
|
|
|
|
logtime = DateTime.Now,
|
|
|
|
|
userid = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName,
|
|
|
|
|
value = value,
|
|
|
|
|
deviceno = deviceno,
|
|
|
|
|
devicekind = devicekind,
|
|
|
|
@ -1396,10 +1478,10 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
|
|
|
|
|
createdate = DateTime.Now.ToString("yyyyMMdd")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FreeSqlUnit.Instance.Insert(Log).ExecuteIdentity();
|
|
|
|
|
FreeSqlUnit.Instance.Insert(Log).ExecuteIdentity();
|
|
|
|
|
|
|
|
|
|
ManualLogSelect("");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ManualLogControl(string logName, int deviceno, int devicekind)
|
|
|
|
|
{
|
|
|
|
|