|
@@ -136,6 +136,15 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
List<int> resultorder = new List<int>();//调试变量 |
|
|
List<int> resultorder = new List<int>();//调试变量 |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 告警列表 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private List<AlarmModel> alarmModel = new List<AlarmModel>(); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private List<StatsModel> statsModels = new List<StatsModel>(); |
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 入口 |
|
|
/// 入口 |
|
|
/// </summary> |
|
|
/// </summary> |
|
@@ -559,7 +568,8 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
{ |
|
|
{ |
|
|
OutFood(fryIndex); |
|
|
|
|
|
|
|
|
string error; |
|
|
|
|
|
OutFood(fryIndex,out error); |
|
|
}), "OutFood"); |
|
|
}), "OutFood"); |
|
|
}), "OutFood"); |
|
|
}), "OutFood"); |
|
|
|
|
|
|
|
@@ -575,7 +585,8 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
{ |
|
|
{ |
|
|
StirArmGoWork(fryIndex); |
|
|
|
|
|
|
|
|
string error; |
|
|
|
|
|
StirArmGoWork(fryIndex, out error); |
|
|
}), "StirArmGoWork"); |
|
|
}), "StirArmGoWork"); |
|
|
}), "StirArmGoWork"); |
|
|
}), "StirArmGoWork"); |
|
|
|
|
|
|
|
@@ -1625,7 +1636,7 @@ namespace BPASmartClient.MorkF |
|
|
FirePot_Write(item, false, num); |
|
|
FirePot_Write(item, false, num); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}), "炒锅1初始化"); |
|
|
|
|
|
|
|
|
}), $"炒锅{num}初始化"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -1685,12 +1696,13 @@ namespace BPASmartClient.MorkF |
|
|
Thread.Sleep(200); |
|
|
Thread.Sleep(200); |
|
|
} |
|
|
} |
|
|
//倒菜 |
|
|
//倒菜 |
|
|
public bool OutFood(int num,bool isMaterial = false) |
|
|
|
|
|
|
|
|
public bool OutFood(int num,out string error,bool isMaterial = false) |
|
|
{ |
|
|
{ |
|
|
bool ret = true; |
|
|
bool ret = true; |
|
|
|
|
|
|
|
|
if (!morkFs.ContainsKey(num)) |
|
|
if (!morkFs.ContainsKey(num)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
error = $"编号为{num}的炒锅无法找到"; |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
int i = 0; |
|
|
int i = 0; |
|
@@ -1710,6 +1722,7 @@ namespace BPASmartClient.MorkF |
|
|
Thread.Sleep(materialSleepTime); |
|
|
Thread.Sleep(materialSleepTime); |
|
|
if (i >= materialSleepCount - 1) |
|
|
if (i >= materialSleepCount - 1) |
|
|
{ |
|
|
{ |
|
|
|
|
|
error = $"炒锅{num}倒菜超时:未能等到取菜完成,请检查菜品库是否正常运行"; |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时:未能等到取菜完成"); |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时:未能等到取菜完成"); |
|
|
ret &= false; |
|
|
ret &= false; |
|
|
} |
|
|
} |
|
@@ -1734,6 +1747,7 @@ namespace BPASmartClient.MorkF |
|
|
Thread.Sleep(materialSleepTime); |
|
|
Thread.Sleep(materialSleepTime); |
|
|
if (i >= materialSleepCount - 1) |
|
|
if (i >= materialSleepCount - 1) |
|
|
{ |
|
|
{ |
|
|
|
|
|
error = $"炒锅{num}倒菜超时,请联系相关工作人员"; |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时"); |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时"); |
|
|
ret &= false; |
|
|
ret &= false; |
|
|
} |
|
|
} |
|
@@ -1743,6 +1757,7 @@ namespace BPASmartClient.MorkF |
|
|
Thread.Sleep(200); |
|
|
Thread.Sleep(200); |
|
|
MessageLog.GetInstance.Show("倒菜完成"); |
|
|
MessageLog.GetInstance.Show("倒菜完成"); |
|
|
morkFs[num].GetMaterialComplete = false; |
|
|
morkFs[num].GetMaterialComplete = false; |
|
|
|
|
|
error = string.Empty; |
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
//搅拌臂去原点位 |
|
|
//搅拌臂去原点位 |
|
@@ -1771,11 +1786,13 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//搅拌臂去炒制位 |
|
|
//搅拌臂去炒制位 |
|
|
public bool StirArmGoWork(int num) |
|
|
|
|
|
|
|
|
public bool StirArmGoWork(int num,out string error) |
|
|
{ |
|
|
{ |
|
|
|
|
|
error = string.Empty; |
|
|
bool ret = true; |
|
|
bool ret = true; |
|
|
if (!morkFs.ContainsKey(num)) |
|
|
if (!morkFs.ContainsKey(num)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
error = $"编号为{num}的炒锅无法找到"; |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -1789,6 +1806,7 @@ namespace BPASmartClient.MorkF |
|
|
Thread.Sleep(sleepTime); |
|
|
Thread.Sleep(sleepTime); |
|
|
if (i >= sleepCount - 1) |
|
|
if (i >= sleepCount - 1) |
|
|
{ |
|
|
{ |
|
|
|
|
|
error = $"炒锅{num}搅拌臂去炒制位超时"; |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{num}搅拌臂去炒制位超时"); |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{num}搅拌臂去炒制位超时"); |
|
|
ret &= false; |
|
|
ret &= false; |
|
|
} |
|
|
} |
|
@@ -2138,8 +2156,8 @@ namespace BPASmartClient.MorkF |
|
|
//遍历炒锅,找到合适、空闲的炒锅 |
|
|
//遍历炒锅,找到合适、空闲的炒锅 |
|
|
for(int i = 0;i<morkFs.Count;i++) |
|
|
for(int i = 0;i<morkFs.Count;i++) |
|
|
{ |
|
|
{ |
|
|
if (/*morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete &&*/ |
|
|
|
|
|
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&是否在炒菜中 |
|
|
|
|
|
|
|
|
if (morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete && ml_morkf.InitialComplete && |
|
|
|
|
|
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&菜品库初始化&&是否在炒菜中 |
|
|
{ |
|
|
{ |
|
|
Thread.Sleep(5000); |
|
|
Thread.Sleep(5000); |
|
|
|
|
|
|
|
@@ -2161,6 +2179,10 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
|
|
|
string error = string.Empty; |
|
|
|
|
|
//初始化大屏 |
|
|
|
|
|
morkFs[i].ScreenInit(); |
|
|
|
|
|
|
|
|
bool ret = true; |
|
|
bool ret = true; |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show($"炒锅{i}开始炒制菜品{res.GoodName}"); |
|
|
MessageLog.GetInstance.Show($"炒锅{i}开始炒制菜品{res.GoodName}"); |
|
@@ -2182,8 +2204,8 @@ namespace BPASmartClient.MorkF |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//调试大屏用代码 |
|
|
|
|
|
Thread.Sleep(5000); |
|
|
|
|
|
|
|
|
////调试大屏用代码 |
|
|
|
|
|
//Thread.Sleep(5000); |
|
|
|
|
|
|
|
|
//更新 |
|
|
//更新 |
|
|
morkFs[i].UpdateProcess(potActions); |
|
|
morkFs[i].UpdateProcess(potActions); |
|
@@ -2274,22 +2296,6 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{i}获取菜品失败,菜品列表为空"); |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{i}获取菜品失败,菜品列表为空"); |
|
|
} |
|
|
} |
|
|
//if(getMaterailNum == 0) |
|
|
|
|
|
//{ |
|
|
|
|
|
// if (NoMaterial2Coordinate(MaterialCoordinate.MLNumberList[1], out myCoordinate)) |
|
|
|
|
|
// { |
|
|
|
|
|
// materialOperationQuenes.Enqueue(new MaterialOperation() { fryNum = i, coordinate = myCoordinate }); |
|
|
|
|
|
// getMaterailNum++; |
|
|
|
|
|
// } |
|
|
|
|
|
//} |
|
|
|
|
|
//else if(getMaterailNum == 1) |
|
|
|
|
|
//{ |
|
|
|
|
|
// if (NoMaterial2Coordinate(MaterialCoordinate.MLNumberList[4], out myCoordinate)) |
|
|
|
|
|
// { |
|
|
|
|
|
// materialOperationQuenes.Enqueue(new MaterialOperation() { fryNum = i, coordinate = myCoordinate }); |
|
|
|
|
|
// getMaterailNum++; |
|
|
|
|
|
// } |
|
|
|
|
|
//} |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
break; |
|
|
break; |
|
|
case nameof(StirFryPotActionEnum.开启搅拌): |
|
|
case nameof(StirFryPotActionEnum.开启搅拌): |
|
@@ -2316,7 +2322,11 @@ namespace BPASmartClient.MorkF |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
break; |
|
|
break; |
|
|
case nameof(StirFryPotActionEnum.道菜启动): |
|
|
case nameof(StirFryPotActionEnum.道菜启动): |
|
|
ret = OutFood(i, true); |
|
|
|
|
|
|
|
|
ret = OutFood(i, out error, true); |
|
|
|
|
|
if(ret == false) |
|
|
|
|
|
{ |
|
|
|
|
|
alarmModel.Add(new AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error }); |
|
|
|
|
|
} |
|
|
break; |
|
|
break; |
|
|
case nameof(StirFryPotActionEnum.炒制菜品): |
|
|
case nameof(StirFryPotActionEnum.炒制菜品): |
|
|
Thread.Sleep(potActions.During * 1000); |
|
|
Thread.Sleep(potActions.During * 1000); |
|
@@ -2326,7 +2336,11 @@ namespace BPASmartClient.MorkF |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
break; |
|
|
break; |
|
|
case nameof(StirFryPotActionEnum.搅拌臂炒制位): |
|
|
case nameof(StirFryPotActionEnum.搅拌臂炒制位): |
|
|
ret = StirArmGoWork(i); |
|
|
|
|
|
|
|
|
ret = StirArmGoWork(i,out error); |
|
|
|
|
|
if (ret == false) |
|
|
|
|
|
{ |
|
|
|
|
|
alarmModel.Add(new AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error }); |
|
|
|
|
|
} |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
break; |
|
|
break; |
|
|
case nameof(StirFryPotActionEnum.洗锅): |
|
|
case nameof(StirFryPotActionEnum.洗锅): |
|
@@ -2347,6 +2361,16 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
//菜品统计数量+1 |
|
|
//菜品统计数量+1 |
|
|
morkFs[i].orderCount++; |
|
|
morkFs[i].orderCount++; |
|
|
|
|
|
|
|
|
|
|
|
StatsModel statsModel = statsModels.FirstOrDefault(p => p.Name == res.GoodName); |
|
|
|
|
|
if (statsModel != null) |
|
|
|
|
|
{ |
|
|
|
|
|
statsModel.Count++; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
statsModels.Add(new StatsModel() { Name = res.GoodName, Count = 0 }); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
@@ -2360,9 +2384,9 @@ namespace BPASmartClient.MorkF |
|
|
nowStirFryGood[i] = null; |
|
|
nowStirFryGood[i] = null; |
|
|
//炒完后出队列 |
|
|
//炒完后出队列 |
|
|
morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue); |
|
|
morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue); |
|
|
morkFs[i].FryWorking = false; |
|
|
|
|
|
|
|
|
morkFs[i].FryWorking = false; |
|
|
//初始化大屏 |
|
|
//初始化大屏 |
|
|
morkFs[i].ScreenInit(); |
|
|
|
|
|
|
|
|
morkFs[i].ScreenClear(); |
|
|
} |
|
|
} |
|
|
}), String.Format(striConst, i.ToString(), nowStirFryGood[i].GoodName)/*$"炒锅{i}炒制{res.GoodName}线程"*/, true); |
|
|
}), String.Format(striConst, i.ToString(), nowStirFryGood[i].GoodName)/*$"炒锅{i}炒制{res.GoodName}线程"*/, true); |
|
|
} |
|
|
} |
|
@@ -2412,7 +2436,6 @@ namespace BPASmartClient.MorkF |
|
|
LocalMqtt.GetInstance.Init(ScreenDeviceType.小炒); |
|
|
LocalMqtt.GetInstance.Init(ScreenDeviceType.小炒); |
|
|
ThreadManage.GetInstance().StartLong(new Action(() => |
|
|
ThreadManage.GetInstance().StartLong(new Action(() => |
|
|
{ |
|
|
{ |
|
|
List<StatsModel> statsModels = new List<StatsModel>(); |
|
|
|
|
|
statsModels.Add(new StatsModel() { Name = "帝王蟹", Count = 666 }); |
|
|
statsModels.Add(new StatsModel() { Name = "帝王蟹", Count = 666 }); |
|
|
//int i = new Random().Next(0, 100); |
|
|
//int i = new Random().Next(0, 100); |
|
|
//List<ProcessModel> processModels= new List<ProcessModel>(); |
|
|
//List<ProcessModel> processModels= new List<ProcessModel>(); |
|
@@ -2441,11 +2464,11 @@ namespace BPASmartClient.MorkF |
|
|
ScreenModelMinWok maxWok = new ScreenModelMinWok |
|
|
ScreenModelMinWok maxWok = new ScreenModelMinWok |
|
|
{ |
|
|
{ |
|
|
IsRun = IsHealth ? IsRun.运行 : IsRun.停止,//new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, //设备是否运行 |
|
|
IsRun = IsHealth ? IsRun.运行 : IsRun.停止,//new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, //设备是否运行 |
|
|
WorkStatus_1 = morkFs[0].FryPot1_InitialComplete ? WorkStatus.工作 : WorkStatus.停止,// (WorkStatus)new Random().Next(0, 3), //设备运行状态 |
|
|
|
|
|
WorkStatus_2 = morkFs[1].FryPot1_InitialComplete ? WorkStatus.工作 : WorkStatus.停止,//(WorkStatus)new Random().Next(0, 3), //设备运行状态 |
|
|
|
|
|
|
|
|
WorkStatus_1 = morkFs[0].FryPot1_InitialComplete ? ((morkFs[0].Task != null)? WorkStatus.工作:WorkStatus.待机) : WorkStatus.停止,// (WorkStatus)new Random().Next(0, 3), //设备运行状态 |
|
|
|
|
|
WorkStatus_2 = morkFs[1].FryPot1_InitialComplete ? ((morkFs[1].Task != null) ? WorkStatus.工作 : WorkStatus.待机) : WorkStatus.停止,//(WorkStatus)new Random().Next(0, 3), //设备运行状态 |
|
|
RobotStatu = (WorkStatus)new Random().Next(0, 3), //机器人状态 待机 1 正常 |
|
|
RobotStatu = (WorkStatus)new Random().Next(0, 3), //机器人状态 待机 1 正常 |
|
|
Alarm = new List<AlarmModel>(), //告警集合 |
|
|
|
|
|
FailuresCount = 0, //故障数 |
|
|
|
|
|
|
|
|
Alarm = alarmModel, //告警集合 |
|
|
|
|
|
FailuresCount = alarmModel.Count, //故障数 |
|
|
StatsCount = statsModels, //统计菜品数量 |
|
|
StatsCount = statsModels, //统计菜品数量 |
|
|
MinWok_Dishes_1 = morkFs[0].GoodName,//"满汉全席",//当前炒制菜品名 |
|
|
MinWok_Dishes_1 = morkFs[0].GoodName,//"满汉全席",//当前炒制菜品名 |
|
|
MinWok_Dishes_2 = morkFs[1].GoodName, |
|
|
MinWok_Dishes_2 = morkFs[1].GoodName, |
|
|