|
|
|
@ -65,6 +65,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
//系统频率配方
|
|
|
|
|
private RecipeManageCache recipeManageCache = RecipeManageCache.Instance;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DevMonitorPage()
|
|
|
|
|
{
|
|
|
|
@ -752,14 +753,79 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
private void StartButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var result = MessageBox.Show("是否确认启动?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
var result = MessageBox.Show("是否确认启动?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
// 创建一个自定义对话框
|
|
|
|
|
SelectWindow customDialog = new SelectWindow();
|
|
|
|
|
customDialog.ShowDialog();
|
|
|
|
|
|
|
|
|
|
StartAll();
|
|
|
|
|
}
|
|
|
|
|
// 判断有无翻转机移走空托盘任务
|
|
|
|
|
WcsTask? task = sqlClient.AsTenant().GetConnection("mes").Queryable<WcsTask>().First(t => (t.IsDelete == 0 || t.IsDelete == null) && t.TaskType == 42);
|
|
|
|
|
|
|
|
|
|
if (customDialog.SelectIndex == 1)
|
|
|
|
|
{
|
|
|
|
|
if (task == null || task.TaskStatus >= 4)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxAndLog("开始一键启动所有机器!");
|
|
|
|
|
StartAll();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (task.TaskStatus == 0 && task.UseFlag == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxAndLog("当前有托盘未取走,请点击取走托盘按钮下发命令!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBoxAndLog("3楼agv正在从翻转机搬运空托盘到托盘收集架,请稍等几分钟再开机!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (customDialog.SelectIndex == 2)
|
|
|
|
|
{
|
|
|
|
|
if (task == null)
|
|
|
|
|
{
|
|
|
|
|
task = new WcsTask();
|
|
|
|
|
task.TaskType = 42;
|
|
|
|
|
task.UseFlag = 1;
|
|
|
|
|
task.TaskStatus = 0;
|
|
|
|
|
task.IsEmpty = "1";
|
|
|
|
|
task.Qty = 1;
|
|
|
|
|
task.NextPointId = 9;
|
|
|
|
|
task.CurrPointId = 31;
|
|
|
|
|
task.EndPointId = 35;
|
|
|
|
|
task.CreateTime = DateTime.Now;
|
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Insertable(task).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
if (task.TaskStatus == 0 && task.UseFlag == 0) //激活任务
|
|
|
|
|
{
|
|
|
|
|
task.TaskType = 42;
|
|
|
|
|
task.UseFlag = 1;
|
|
|
|
|
task.TaskStatus = 0;
|
|
|
|
|
task.IsEmpty = "1";
|
|
|
|
|
task.Qty = 1;
|
|
|
|
|
task.NextPointId = 9;
|
|
|
|
|
task.CurrPointId = 31;
|
|
|
|
|
task.EndPointId = 35;
|
|
|
|
|
task.CreateTime = DateTime.Now;
|
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Updateable(task).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
else if (task.TaskStatus == 4 && task.UseFlag == 1)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxAndLog("3楼agv正在从翻转机搬运空托盘到托盘收集架,请稍等几分钟再开机!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxAndLog(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -817,7 +883,15 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
{
|
|
|
|
|
// 启动除尘
|
|
|
|
|
bool DustStatus = StartDust();
|
|
|
|
|
if(!DustStatus) return;
|
|
|
|
|
if (!DustStatus)
|
|
|
|
|
{
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
StartButton.IsEnabled = true;
|
|
|
|
|
}));
|
|
|
|
|
MessageBoxAndLog("启动除尘失败!",true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
|
|
|
|
@ -828,24 +902,72 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
|
|
|
|
|
//1.螺旋2
|
|
|
|
|
bool Spiral2Status = StartSpiral2();
|
|
|
|
|
if (!Spiral2Status) return;
|
|
|
|
|
if (!Spiral2Status)
|
|
|
|
|
{
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
StartButton.IsEnabled = true;
|
|
|
|
|
}));
|
|
|
|
|
MessageBoxAndLog("启动螺旋2失败!", true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//2.磁选机
|
|
|
|
|
bool MagNetStatus = StartMagNet();
|
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
|
if (!MagNetStatus)
|
|
|
|
|
{
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
StartButton.IsEnabled = true;
|
|
|
|
|
}));
|
|
|
|
|
MessageBoxAndLog("启动磁选机失败!", true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//3.螺旋1
|
|
|
|
|
bool Spiral1Status = StartSpiral1();
|
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
|
if (!MagNetStatus)
|
|
|
|
|
{
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
StartButton.IsEnabled = true;
|
|
|
|
|
}));
|
|
|
|
|
MessageBoxAndLog("启动螺旋1失败!", true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//4.烘干机:烘干螺旋、烘干风机、烘干燃烧
|
|
|
|
|
|
|
|
|
|
bool DryerStatus1 = StartDryerMagNet();
|
|
|
|
|
if (!DryerStatus1) return;
|
|
|
|
|
if (!DryerStatus1)
|
|
|
|
|
{
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
StartButton.IsEnabled = true;
|
|
|
|
|
}));
|
|
|
|
|
MessageBoxAndLog("启动烘干机螺旋失败!", true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bool DryerStatus2 = StartDryerFan();
|
|
|
|
|
if (!DryerStatus2) return;
|
|
|
|
|
if (!DryerStatus2)
|
|
|
|
|
{
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
StartButton.IsEnabled = true;
|
|
|
|
|
}));
|
|
|
|
|
MessageBoxAndLog("启动烘干机风机失败!", true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bool DryerStatus3 = StartDryerHot();
|
|
|
|
|
if (!DryerStatus3) return;
|
|
|
|
|
if (!DryerStatus3)
|
|
|
|
|
{
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
StartButton.IsEnabled = true;
|
|
|
|
|
}));
|
|
|
|
|
MessageBoxAndLog("启动烘干机燃烧失败!", true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//5.拆包机
|
|
|
|
|
bool unpackStatus = StartUnPack();
|
|
|
|
@ -872,6 +994,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -969,8 +1092,26 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
if (unPackStatus1)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("拆包机未成功停止,请检查");
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
//检测到拆包机未停止,判断请求移走空托盘信号,如果是该信号引起的无法关机,直接下发急停信号
|
|
|
|
|
bool moveSignal = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机请求移走空托盘"));
|
|
|
|
|
if (moveSignal)
|
|
|
|
|
{
|
|
|
|
|
SendPulseSignal("拆包机远程急停");
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
bool unPackStatus = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
if (unPackStatus)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxAndLog("拆包机无法停止!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (stopLevel < 1) return true;
|
|
|
|
|
#region 烘干机
|
|
|
|
|