Browse Source

小炒锅代码提交;

小炒大屏改为正式环境。
样式分支
yahaha 1 year ago
parent
commit
097e9958fd
4 changed files with 311 additions and 106 deletions
  1. +2
    -2
      BPASmartClient.Business/LocalMqtt.cs
  2. +138
    -101
      BPASmartClient.MorkF/Control_MorkF.cs
  3. +169
    -2
      BPASmartClient.MorkF/GVL_MorkF.cs
  4. +2
    -1
      BPASmartClient.ScreenMinWok/App.config

+ 2
- 2
BPASmartClient.Business/LocalMqtt.cs View File

@@ -32,8 +32,8 @@ namespace BPASmartClient.Business
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)) ;
});
mQTTProxy.Connect("admin", "public", "10.2.1.254", 1883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
});
mQTTProxy.Connect("emqx_u_block", "emqx_p_admin3658765490789", "47.108.65.220", 1883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public"
}

public void Start()


+ 138
- 101
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -19,7 +19,7 @@ namespace BPASmartClient.MorkF
{
public class Control_MorkF : BaseDevice
{
#region 常数定义
/// <summary>
/// while循环最大sleep次数
/// </summary>
@@ -92,6 +92,7 @@ namespace BPASmartClient.MorkF

//当前炒锅,默认为1号炒锅
private int fryIndex = 0;
#endregion

public override DeviceClientType DeviceType => DeviceClientType.MORKCS;
public AutoResetEvent minorReset = new AutoResetEvent(false);
@@ -361,7 +362,7 @@ namespace BPASmartClient.MorkF
{
if(!UpdateMaterialLibraryStock())
{
MessageLog.GetInstance.Show("菜品库检测余量失败");
MessageLog.GetInstance.ShowEx("菜品库检测余量失败");
}
}), "SurplusCheck");
}), "SurplusCheck");
@@ -817,7 +818,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.Show("菜品库初始化超时");
MessageLog.GetInstance.ShowEx("菜品库初始化超时");
return false;
}
}
@@ -832,7 +833,7 @@ namespace BPASmartClient.MorkF
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.Show("电磁阀启停出错,菜品库未初始化");
MessageLog.GetInstance.ShowEx("电磁阀启停出错,菜品库未初始化");
return;
}

@@ -847,7 +848,7 @@ namespace BPASmartClient.MorkF
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.Show("爪子去到1号位出错,菜品库未初始化");
MessageLog.GetInstance.ShowEx("爪子去到1号位出错,菜品库未初始化");
return false;
}

@@ -858,7 +859,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.Show("爪子去到1号位超时");
MessageLog.GetInstance.ShowEx("爪子去到1号位超时");
return false;
}
}
@@ -873,7 +874,7 @@ namespace BPASmartClient.MorkF
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.Show("爪子去到2号位出错,菜品库未初始化");
MessageLog.GetInstance.ShowEx("爪子去到2号位出错,菜品库未初始化");
return false;
}

@@ -884,7 +885,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.Show("爪子去到2号位超时");
MessageLog.GetInstance.ShowEx("爪子去到2号位超时");
return false;
}
}
@@ -899,7 +900,7 @@ namespace BPASmartClient.MorkF
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.Show("爪子去到3号位出错,菜品库未初始化");
MessageLog.GetInstance.ShowEx("爪子去到3号位出错,菜品库未初始化");
return false;
}

@@ -910,7 +911,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.Show("爪子去到3号位超时");
MessageLog.GetInstance.ShowEx("爪子去到3号位超时");
return false;
}
}
@@ -925,7 +926,7 @@ namespace BPASmartClient.MorkF
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.Show("1号测距出错,菜品库未初始化");
MessageLog.GetInstance.ShowEx("1号测距出错,菜品库未初始化");
return false;
}

@@ -940,7 +941,7 @@ namespace BPASmartClient.MorkF
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.Show("2号测距出错,菜品库未初始化");
MessageLog.GetInstance.ShowEx("2号测距出错,菜品库未初始化");
return false;
}

@@ -955,7 +956,7 @@ namespace BPASmartClient.MorkF
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.Show("3号测距出错,菜品库未初始化");
MessageLog.GetInstance.ShowEx("3号测距出错,菜品库未初始化");
return false;
}

@@ -1008,7 +1009,7 @@ namespace BPASmartClient.MorkF
}
if (!ret)
{
MessageLog.GetInstance.Show($"错误:X轴:{x}获取传感器数据出错");
MessageLog.GetInstance.ShowEx($"错误:X轴:{x}获取传感器数据出错");
}
return ret;
}
@@ -1031,7 +1032,7 @@ namespace BPASmartClient.MorkF
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.Show($"机械臂移动出错,菜品库未初始化");
MessageLog.GetInstance.ShowEx($"机械臂移动出错,菜品库未初始化");
return false;
}

@@ -1040,7 +1041,7 @@ namespace BPASmartClient.MorkF
y = 0 - Math.Abs(y);
if (x > 0 || y > 0)
{
MessageLog.GetInstance.Show($"机械臂移动到[{x},{y}]非法");
MessageLog.GetInstance.ShowEx($"机械臂移动到[{x},{y}]非法");
return false;
}
MaterailLibrary_Write("VD836", x);
@@ -1070,7 +1071,7 @@ namespace BPASmartClient.MorkF
}
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.Show("机械臂移动操作超时");
MessageLog.GetInstance.ShowEx("机械臂移动操作超时");
return false;
}
}
@@ -1311,7 +1312,7 @@ namespace BPASmartClient.MorkF

if (MaterialCoordinate.GetInstance().dicNoMaterialCoordinate == null || MaterialCoordinate.GetInstance().dicNoMaterialCoordinate.Count != 27)
{
MessageLog.GetInstance.Show("更新菜品库存量出错,菜品库坐标系数据未建立");
MessageLog.GetInstance.ShowEx("更新菜品库存量出错,菜品库坐标系数据未建立");
return false;
}

@@ -1327,7 +1328,7 @@ namespace BPASmartClient.MorkF
//获取该处的距离
if (!GetDistance(item.Value.X))
{
MessageLog.GetInstance.Show("错误:获取传感器数据出错");
MessageLog.GetInstance.ShowEx("错误:获取传感器数据出错");
return false;
}

@@ -1477,7 +1478,7 @@ namespace BPASmartClient.MorkF
//获取坐标,根据菜品的位置信息
if (!NoMaterial2Coordinate(materialOperation.materialInfo.Loc, out myCoordinate))
{
MessageLog.GetInstance.Show($"炒锅{materialOperation.fryNum}获取菜品[{materialOperation.materialInfo.Name}]失败,找不到对应位置");
MessageLog.GetInstance.ShowEx($"炒锅{materialOperation.fryNum}获取菜品[{materialOperation.materialInfo.Name}]失败,找不到对应位置");
return;
}
lock (lock_Materail)
@@ -1620,7 +1621,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(sleepTime);
if (j >= sleepCount - 1)
{
MessageLog.GetInstance.Show($"炒锅{j}初始化超时");
MessageLog.GetInstance.ShowEx($"炒锅{j}初始化超时");
}
}

@@ -1662,11 +1663,13 @@ namespace BPASmartClient.MorkF
Thread.Sleep(200);
}
//倒菜
public void OutFood(int num,bool isMaterial = false)
public bool OutFood(int num,bool isMaterial = false)
{
bool ret = true;

if (!morkFs.ContainsKey(num))
{
return;
return false;
}
int i = 0;

@@ -1685,8 +1688,8 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.Show($"炒锅{num}倒菜超时:未能等到取菜完成");
return;
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时:未能等到取菜完成");
ret &= false;
}
}

@@ -1709,7 +1712,8 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.Show($"炒锅{num}倒菜超时");
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时");
ret &= false;
}
}

@@ -1717,6 +1721,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(200);
MessageLog.GetInstance.Show("倒菜完成");
morkFs[num].GetMaterialComplete = false;
return ret;
}
//搅拌臂去原点位
public void StirArmGoOrigin(int num)
@@ -1734,7 +1739,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(sleepTime);
if (i >= sleepCount - 1)
{
MessageLog.GetInstance.Show($"炒锅{num}搅拌臂去原点位超时");
MessageLog.GetInstance.ShowEx($"炒锅{num}搅拌臂去原点位超时");
}
}

@@ -1744,11 +1749,12 @@ namespace BPASmartClient.MorkF
}

//搅拌臂去炒制位
public void StirArmGoWork(int num)
public bool StirArmGoWork(int num)
{
bool ret = true;
if (!morkFs.ContainsKey(num))
{
return;
return false;
}

if (!morkFs[num].ArmOnWorking/* && morkFs[num].PotOnOrigin*/)
@@ -1761,7 +1767,8 @@ namespace BPASmartClient.MorkF
Thread.Sleep(sleepTime);
if (i >= sleepCount - 1)
{
MessageLog.GetInstance.Show($"炒锅{num}搅拌臂去炒制位超时");
MessageLog.GetInstance.ShowEx($"炒锅{num}搅拌臂去炒制位超时");
ret &= false;
}
}

@@ -1773,8 +1780,11 @@ namespace BPASmartClient.MorkF
FirePot_Write("LB6", false, num);
Thread.Sleep(200);
MessageLog.GetInstance.Show("搅拌臂到达工作位");
return ret;
}

return true;

}
//HBOT放盒子到位
public void HBOTGoWork(int num)
@@ -1788,7 +1798,7 @@ namespace BPASmartClient.MorkF
{
if (!morkFs[num].ArmOnOrigin /*&& morkFs[num].PotOnOrigin*/)
{
MessageLog.GetInstance.Show("搅拌臂不在原点位,无法完成出餐");
MessageLog.GetInstance.ShowEx("搅拌臂不在原点位,无法完成出餐");
return;
}
FirePot_Write("LB4", true, num);
@@ -2055,7 +2065,7 @@ namespace BPASmartClient.MorkF
DeviceProcessLogShow($"接收到{OrderCount}次订单");
Enum.GetNames(typeof(StirFryPotActionEnum));

//var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.RecipeId);//匹配订单对应制作流程
var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey);//匹配订单对应制作流程
if(order.MorkOrder.GoodBatchings.Count <= 0)
{
return;
@@ -2067,26 +2077,26 @@ namespace BPASmartClient.MorkF
}

//var res = LocalstirFryGoods[0];
//if (res != null)
//{
// /* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程
// //添加到带炒小炒队列
// if (StirFryGoodsQuenes.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
// {
// lock (lock_MainProcessExcute)
// {
// StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
// {
// SuborderId = order.MorkOrder.SuborderId,
// StirPotActions = res.StirPotActions,
// GoodName = order.MorkOrder.GoodsName
// });
// }
// }
//}
//暂时使用本地菜单
StartLocalOrder();
if (res != null)
{
/* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程
//添加到带炒小炒队列
if (StirFryGoodsQuenes.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
{
lock (lock_MainProcessExcute)
{
StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
StirPotActions = res.StirPotActions,
GoodName = order.MorkOrder.GoodsName
});
}
}
}
////暂时使用本地菜单
//StartLocalOrder();
}

});
@@ -2109,6 +2119,8 @@ namespace BPASmartClient.MorkF
if (/*morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete &&*/
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&是否在炒菜中
{
Thread.Sleep(5000);

lock(lock_MainProcessExcute)
{
//待炒小炒队列出队列
@@ -2127,10 +2139,14 @@ namespace BPASmartClient.MorkF
{
try
{
bool ret = true;
MessageLog.GetInstance.Show($"炒锅{i}开始炒制菜品{res.GoodName}");

morkFs[i].GoodName = res.GoodName;

Coordinate myCoordinate = new Coordinate();
int getMaterailNum = 0;
foreach (var potActions in res.StirPotActions)
{
if (ThreadManage.GetInstance().IsCanncel(String.Format(striConst, i.ToString(), nowStirFryGood[i].GoodName)))
@@ -2138,6 +2154,18 @@ namespace BPASmartClient.MorkF
return;
}

if(ret == false)
{
MessageLog.GetInstance.ShowEx("上一步操作未成功");
break;
}

//调试大屏用代码
Thread.Sleep(5000);

//更新
morkFs[i].UpdateProcess(potActions);

switch (potActions.Actions)
{
case nameof(StirFryPotActionEnum.加热开启):
@@ -2205,7 +2233,7 @@ namespace BPASmartClient.MorkF
case nameof(StirFryPotActionEnum.取原料):
//炒锅取菜状态置为未取到
morkFs[i].GetMaterialComplete = false;
if(potActions.MaterialLists != null)
if (potActions.MaterialLists != null)
{
foreach (var item in potActions.MaterialLists)
{
@@ -2213,7 +2241,7 @@ namespace BPASmartClient.MorkF
MaterialInfo materialInfo = MaterialSurplusOperation.GetInstance().GetVailedMaterial(item.MaterialId);
if (materialInfo == null)
{
MessageLog.GetInstance.Show($"炒锅{i}获取菜品[{materialInfo.Name}]失败,库存不足");
MessageLog.GetInstance.ShowEx($"炒锅{i}获取菜品[{item.MaterialId}]失败,库存不足");
continue;
}

@@ -2222,7 +2250,7 @@ namespace BPASmartClient.MorkF
}
else
{
MessageLog.GetInstance.Show($"炒锅{i}获取菜品失败,菜品列表为空");
MessageLog.GetInstance.ShowEx($"炒锅{i}获取菜品失败,菜品列表为空");
}
//if(getMaterailNum == 0)
//{
@@ -2266,7 +2294,7 @@ namespace BPASmartClient.MorkF
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.道菜启动):
OutFood(i, true);
ret = OutFood(i, true);
break;
case nameof(StirFryPotActionEnum.炒制菜品):
Thread.Sleep(potActions.During * 1000);
@@ -2276,7 +2304,7 @@ namespace BPASmartClient.MorkF
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.搅拌臂炒制位):
StirArmGoWork(i);
ret = StirArmGoWork(i);
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.洗锅):
@@ -2294,11 +2322,16 @@ namespace BPASmartClient.MorkF
StirArmGoOrigin(i);

MessageLog.GetInstance.Show($"菜品{res.GoodName}完成");

//菜品统计数量+1
morkFs[i].orderCount++;
}
catch (Exception ex)
{
//异常菜品统计数量+1
morkFs[i].orderAbnormalCount++;
ThreadManage.GetInstance().StopTask($"炒锅{i}{res.GoodName}炒制线程");
MessageLog.GetInstance.Show($"炒锅{i}炒制菜品{res.GoodName}出错,错误信息:" + ex.Message);
MessageLog.GetInstance.ShowEx($"炒锅{i}炒制菜品{res.GoodName}出错,错误信息:" + ex.Message);
}
finally
{
@@ -2306,8 +2339,10 @@ namespace BPASmartClient.MorkF
//炒完后出队列
morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue);
morkFs[i].FryWorking = false;
//初始化大屏
morkFs[i].ScreenInit();
}
}), String.Format(striConst, i.ToString(), nowStirFryGood[i].GoodName)/*$"炒锅{i}炒制{res.GoodName}线程"*/);
}), String.Format(striConst, i.ToString(), nowStirFryGood[i].GoodName)/*$"炒锅{i}炒制{res.GoodName}线程"*/, true);
}
}
break;
@@ -2357,54 +2392,56 @@ namespace BPASmartClient.MorkF
{
List<StatsModel> statsModels = new List<StatsModel>();
statsModels.Add(new StatsModel() { Name = "帝王蟹", Count = 666 });
int i = new Random().Next(0, 100);
List<ProcessModel> processModels= new List<ProcessModel>();
switch ((i / 5) % 6)
{
case 0:
processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } };
break;
case 1:
processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } };
break;
case 2:
processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } };
break;
case 3:
processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } };
break;
case 4:
processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.正在执行 } };
break;
case 5:
processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.执行完成 } };
break;
default: break;
}
//int i = new Random().Next(0, 100);
//List<ProcessModel> processModels= new List<ProcessModel>();
//switch ((i / 5) % 6)
//{
// case 0:
// processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } };
// break;
// case 1:
// processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } };
// break;
// case 2:
// processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } };
// break;
// case 3:
// processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } };
// break;
// case 4:
// processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.正在执行 } };
// break;
// case 5:
// processModels = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.执行完成 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.执行完成 } };
// break;
// default: break;
//}
ScreenModelMinWok maxWok = new ScreenModelMinWok
{
IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, //设备是否运行
WorkStatus_1 = (WorkStatus)new Random().Next(0, 3), //设备运行状态
WorkStatus_2 = (WorkStatus)new Random().Next(0, 3), //设备运行状态
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), //设备运行状态
RobotStatu = (WorkStatus)new Random().Next(0, 3), //机器人状态 待机 1 正常
Alarm = new List<AlarmModel>(), //告警集合
FailuresCount = 0, //故障数
StatsCount = statsModels, //统计菜品数量
MinWok_Dishes_1 = "满汉全席",//当前炒制菜品名
MinWok_Dishes_2 = "海鲜大餐",
MinWok_Task_1 = "炒制菜品",//当前任务
MinWok_Task_2 = "热油", //当前任务
MinWok_Dishes_1 = morkFs[0].GoodName,//"满汉全席",//当前炒制菜品名
MinWok_Dishes_2 = morkFs[1].GoodName,
MinWok_Task_1 = morkFs[0].Task,//当前任务
MinWok_Task_2 = morkFs[1].Task, //当前任务
//MinWok_Process_1 = new List<ProcessModel>() { new ProcessModel() { Id = 1, Name = "启动", Status = ProcessStatus.正在执行 }, new ProcessModel() { Id = 1, Name = "热油", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "炒制", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "出餐", Status = ProcessStatus.未执行 }, new ProcessModel() { Id = 1, Name = "结束", Status = ProcessStatus.未执行 } },
MinWok_Process_1 = processModels, //炒锅当前任务流程
MinWok_Process_2 = new List<ProcessModel>(), //炒锅当前任务流程
MinWok_HeatGear_1 = new Random().Next(0, 5).ToString(), //炒锅加热档位
MinWok_HeatGear_2 = new Random().Next(0, 5).ToString(), //炒锅加热档位
MinWok_StirGear_1 = new Random().Next(0, 5).ToString(), //炒锅搅拌档位
MinWok_StirGear_2 = new Random().Next(0, 5).ToString(), //炒锅搅拌档位
MinWok_OrderCount_1 = 2, //订单数量
MinWok_OrderCount_2 = 2, //订单数量
MinWok_ErrorOrderCount_1 = 0, //异常订单数量
MinWok_ErrorOrderCount_2 = 0, //异常订单数量
MinWok_Process_1 = morkFs[0].processModels, //炒锅当前任务流程
MinWok_Process_2 = morkFs[1].processModels, //炒锅当前任务流程
MinWok_HeatGear_1 = morkFs[0].FireNow, //炒锅加热档位
MinWok_HeatGear_2 = morkFs[1].FireNow, //炒锅加热档位
MinWok_Temp_1 = morkFs[0].TempNow, //炒锅1锅底温度
MinWok_Temp_2 = morkFs[1].TempNow, //炒锅1锅底温度
MinWok_StirGear_1 = morkFs[0].StirNow, //炒锅搅拌档位
MinWok_StirGear_2 = morkFs[1].StirNow, //炒锅搅拌档位
MinWok_OrderCount_1 = morkFs[0].orderCount, //订单数量
MinWok_OrderCount_2 = morkFs[1].orderCount, //订单数量
MinWok_ErrorOrderCount_1 = morkFs[0].orderAbnormalCount, //异常订单数量
MinWok_ErrorOrderCount_2 = morkFs[1].orderAbnormalCount, //异常订单数量

};
LocalMqtt.GetInstance.Publish(maxWok);


+ 169
- 2
BPASmartClient.MorkF/GVL_MorkF.cs View File

@@ -1,4 +1,5 @@
using BPA.Models;
using BPA.Message;
using BPA.Models;
using BPASmartClient.Device;
using System;
using System.Collections.Concurrent;
@@ -14,7 +15,7 @@ namespace BPASmartClient.MorkF
/// <summary>
/// 小炒队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> StirFryGoodsQuenes = new ConcurrentQueue<OrderLocInfo>();
public ConcurrentQueue<OrderLocInfo> StirFryGoodsQuenes { get; set; } = new ConcurrentQueue<OrderLocInfo>();

public bool IsAuto = true;

@@ -88,6 +89,169 @@ namespace BPASmartClient.MorkF

#endregion

#region 炒锅大屏相关

/// <summary>
/// 异常订单数量统计
/// </summary>
public int orderAbnormalCount { get; set; } = 0;

/// <summary>
/// 订单数量统计
/// </summary>
public int orderCount { get; set; } = 0;

/// <summary>
/// 当前炒制菜品
/// </summary>
public string GoodName { get; set; }

/// <summary>
/// 当前任务
/// </summary>
public string Task { get; set; }

/// <summary>
/// 当前加热档位
/// </summary>
public string FireNow { get; set; }

/// <summary>
/// 搅拌档位
/// </summary>
public string StirNow { get; set; }

/// <summary>
/// 炒锅当前锅底温度
/// </summary>
public string TempNow { get; set; }

/// <summary>
/// 当前炒锅进展
/// </summary>
public List<ProcessModel> processModels { get; set; } = new List<ProcessModel>();

public void UpdateProcess(PotActions potActions)
{
switch (potActions.Actions)
{
case nameof(StirFryPotActionEnum.搅拌臂炒制位):
//设置为开始
SetState(0);
Task = "开始";
break;
case nameof(StirFryPotActionEnum.加热开启):
Task = "热油";
//设置为热油
SetState(1);
break;
///以下为不处理,炒制菜品可能为热油阶段,不处理,取原料可能在开启后立即开始
case nameof(StirFryPotActionEnum.取原料):
case nameof(StirFryPotActionEnum.炒制菜品):
break;
case nameof(StirFryPotActionEnum.设置搅拌挡位1):
StirNow = "1";
break;
case nameof(StirFryPotActionEnum.设置搅拌挡位2):
StirNow = "2";
break;
case nameof(StirFryPotActionEnum.设置搅拌挡位3):
StirNow = "3";
break;
case nameof(StirFryPotActionEnum.关闭搅拌):
StirNow = "0";
break;
case nameof(StirFryPotActionEnum.设置加热挡位1):
TempNow = "60";
FireNow = "1";
break;
case nameof(StirFryPotActionEnum.设置加热挡位2):
TempNow = "100";
FireNow = "2";
break;
case nameof(StirFryPotActionEnum.设置加热挡位3):
TempNow = "120";
FireNow = "3";
break;
case nameof(StirFryPotActionEnum.设置加热挡位4):
TempNow = "150";
FireNow = "4";
break;
case nameof(StirFryPotActionEnum.设置加热挡位5):
TempNow = "200";
FireNow = "5";
break;
case nameof(StirFryPotActionEnum.设置加热挡位6):
TempNow = "250";
FireNow = "6";
break;
case nameof(StirFryPotActionEnum.设置加热挡位7):
TempNow = "300";
FireNow = "7";
break;
case nameof(StirFryPotActionEnum.设置加热挡位8):
TempNow = "350";
FireNow = "8";
break;
case nameof(StirFryPotActionEnum.设置加热挡位9):
TempNow = "400";
FireNow = "9";
break;
case nameof(StirFryPotActionEnum.设置加热挡位10):
TempNow = "500";
FireNow = "10";
break;
///以下为待定
case nameof(StirFryPotActionEnum.停止加热):
break;
case nameof(StirFryPotActionEnum.开启搅拌):
break;
case nameof(StirFryPotActionEnum.道菜启动):
case nameof(StirFryPotActionEnum.加调料):
Task = "炒制";
//设置为炒制
SetState(2);
break;
case nameof(StirFryPotActionEnum.出餐启动):
Task = "出餐";
SetState(3);
break;
///设置为结束
case nameof(StirFryPotActionEnum.搅拌臂原点位):
case nameof(StirFryPotActionEnum.洗锅):
Task = "完成";
SetState(4);
break;
default:
break;

}
}

private void SetState(int c)
{
for (int i = 0; i < processModels.Count; i++)
{
if (i == c)
{
processModels[i].Status = ProcessStatus.正在执行;
}
else if (i < c) processModels[i].Status = ProcessStatus.执行完成;
else if (i > c) processModels[i].Status = ProcessStatus.未执行;
}
}

public void ScreenInit()
{
processModels.Clear();
//初始化进度列表
processModels.Add(new ProcessModel() { Id = 1, Name = "开始", Status = ProcessStatus.未执行 });
processModels.Add(new ProcessModel() { Id = 2, Name = "热油", Status = ProcessStatus.未执行 });
processModels.Add(new ProcessModel() { Id = 3, Name = "炒制", Status = ProcessStatus.未执行 });
processModels.Add(new ProcessModel() { Id = 4, Name = "出餐", Status = ProcessStatus.未执行 });
processModels.Add(new ProcessModel() { Id = 5, Name = "完成", Status = ProcessStatus.未执行 });
}
#endregion
#region 调料通道
public bool PassWay1_1Compelete { get; set; }
public bool PassWay1_2Compelete { get; set; }
@@ -122,6 +286,9 @@ namespace BPASmartClient.MorkF
PassWay1_Compelete.Add(12,PassWay1_12Compelete);
PassWay1_Compelete.Add(13,PassWay1_13Compelete);
PassWay1_Compelete.Add(14,PassWay1_14Compelete);

//初始化进度列表
ScreenInit();
}

/// <summary>


+ 2
- 1
BPASmartClient.ScreenMinWok/App.config View File

@@ -2,7 +2,8 @@
<configuration>
<appSettings>
<!--MQTT配置-->
<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>
<!--<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>-->
<add key="MQTTConnection" value="47.108.65.220,1883,emqx_u_block,emqx_p_admin3658765490789"/>
<!--订阅主题设置:大炒,小炒,分餐机,煮面机-->
<add key="DeviceMC" value="大炒,小炒,分餐机,煮面机"/>
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>


Loading…
Cancel
Save