|
|
@@ -154,7 +154,15 @@ namespace BPASmartClient.MorkF |
|
|
|
//FoodLibInit(); |
|
|
|
Task2ReadMaterialData(); |
|
|
|
|
|
|
|
//Json<MaterialSurplus>.Read(); |
|
|
|
//读取坐标系 |
|
|
|
MaterialCoordinate materialCoordinate = ReadMaterialCoordinate(); |
|
|
|
if(materialCoordinate != null) |
|
|
|
{ |
|
|
|
MaterialCoordinate.GetInstance().dicNoMaterialCoordinate = materialCoordinate.dicNoMaterialCoordinate; |
|
|
|
MaterialCoordinate.GetInstance().MLCoordinateList = materialCoordinate.MLCoordinateList; |
|
|
|
} |
|
|
|
////菜品库编号与坐标系对象存储 |
|
|
|
//SaveMaterialCoordinate(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -170,6 +178,50 @@ namespace BPASmartClient.MorkF |
|
|
|
//SingleProcess(); |
|
|
|
} |
|
|
|
|
|
|
|
private static object saveMaterialLock = new object(); |
|
|
|
private void SaveMaterialData() |
|
|
|
{ |
|
|
|
lock (saveMaterialLock) |
|
|
|
{ |
|
|
|
Json<MaterialSurplus>.Data = MaterialSurplusOperation.GetInstance().materialSurplus; |
|
|
|
Json<MaterialSurplus>.Save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static object saveMaterialCoordinateLock = new object(); |
|
|
|
/// <summary> |
|
|
|
/// 保存当前的坐标系 |
|
|
|
/// </summary> |
|
|
|
public void SaveMaterialCoordinate() |
|
|
|
{ |
|
|
|
lock (saveMaterialLock) |
|
|
|
{ |
|
|
|
Json<MaterialCoordinate>.Data = MaterialCoordinate.GetInstance(); |
|
|
|
Json<MaterialCoordinate>.Save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 读取坐标系 |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
private MaterialCoordinate ReadMaterialCoordinate() |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
lock (saveMaterialLock) |
|
|
|
{ |
|
|
|
Json<MaterialCoordinate>.Read(); |
|
|
|
MaterialCoordinate materialCoordinate = Json<MaterialCoordinate>.Data; |
|
|
|
return materialCoordinate; |
|
|
|
} |
|
|
|
} |
|
|
|
catch(Exception ex) |
|
|
|
{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void Task2ReadMaterialData() |
|
|
|
{ |
|
|
|
ThreadManage.GetInstance().StartLong(new Action(() => { |
|
|
@@ -301,6 +353,16 @@ namespace BPASmartClient.MorkF |
|
|
|
FoodLibInit(); |
|
|
|
}), "FoodLibInit"); |
|
|
|
}), "FoodLibInit"); |
|
|
|
ActionManage.GetInstance.Register(new Action(() => |
|
|
|
{ |
|
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
|
{ |
|
|
|
if(!UpdateMaterialLibraryStock()) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.Show("菜品库检测余量失败"); |
|
|
|
} |
|
|
|
}), "SurplusCheck"); |
|
|
|
}), "SurplusCheck"); |
|
|
|
ActionManage.GetInstance.Register(new Action<object>((o) => |
|
|
|
{ |
|
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
@@ -728,7 +790,8 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 菜品库PLC操作方法 |
|
|
|
#region 菜品库方法 |
|
|
|
#region PLC操作 |
|
|
|
/// <summary> |
|
|
|
/// 菜品库数据写入 |
|
|
|
/// </summary> |
|
|
@@ -971,8 +1034,8 @@ namespace BPASmartClient.MorkF |
|
|
|
} |
|
|
|
|
|
|
|
//取反 |
|
|
|
x -= 2 * x; |
|
|
|
y -= 2 * y; |
|
|
|
x = 0 - Math.Abs(x); |
|
|
|
y = 0 - Math.Abs(y); |
|
|
|
if (x > 0 || y > 0) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.Show($"机械臂移动到[{x},{y}]非法"); |
|
|
@@ -1073,6 +1136,7 @@ namespace BPASmartClient.MorkF |
|
|
|
MaterailLibrary_Write("M5.6", startOrStop); |
|
|
|
Thread.Sleep(200); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
//菜品库锁 |
|
|
|
object lock_Materail = new object(); |
|
|
@@ -1236,13 +1300,20 @@ namespace BPASmartClient.MorkF |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
//判断是否初始化 |
|
|
|
if(!ml_morkf.InitialComplete) |
|
|
|
////判断是否初始化 |
|
|
|
//if (!ml_morkf.InitialComplete) |
|
|
|
//{ |
|
|
|
// MessageLog.GetInstance.Show("更新菜品库存量出错,菜品库未初始化"); |
|
|
|
// return false; |
|
|
|
//} |
|
|
|
|
|
|
|
if (MaterialCoordinate.GetInstance().dicNoMaterialCoordinate == null || MaterialCoordinate.GetInstance().dicNoMaterialCoordinate.Count != 27) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.Show("更新菜品库存量出错,菜品库未初始化"); |
|
|
|
MessageLog.GetInstance.Show("更新菜品库存量出错,菜品库坐标系数据未建立"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
//遍历坐标系与位置,并根据位置更新菜品余量 |
|
|
|
foreach(var item in MaterialCoordinate.GetInstance().dicNoMaterialCoordinate) |
|
|
|
{ |
|
|
|
//设置到抓菜处 |
|
|
@@ -1276,6 +1347,7 @@ namespace BPASmartClient.MorkF |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
catch(Exception ex) |
|
|
@@ -1771,16 +1843,6 @@ namespace BPASmartClient.MorkF |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
private static object saveMaterialLock = new object(); |
|
|
|
private void SaveMaterialData() |
|
|
|
{ |
|
|
|
lock(saveMaterialLock) |
|
|
|
{ |
|
|
|
Json<MaterialSurplus>.Data = MaterialSurplusOperation.GetInstance().materialSurplus; |
|
|
|
Json<MaterialSurplus>.Save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool isInitialArrive = false; |
|
|
|
|
|
|
|
bool isInitialPaw = false; |
|
|
@@ -1832,122 +1894,108 @@ namespace BPASmartClient.MorkF |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if(stirFry.stirFrymessage.materials.Count > 0) |
|
|
|
{ |
|
|
|
MaterialSurplusOperation.GetInstance().UpdateSurplusAll(stirFry.stirFrymessage.materials); |
|
|
|
//foreach (var item in stirFry.stirFrymessage.materials) |
|
|
|
//{ |
|
|
|
// MaterialSurplusOperation.GetInstance().materialSurplus.dicSurplus.Add(new MaterialInfo |
|
|
|
// { |
|
|
|
// Id = item.Id, |
|
|
|
// Key = item.Key, |
|
|
|
// Name = item.Name, |
|
|
|
// Loc = item.Loc, |
|
|
|
// Qty = item.Qty, |
|
|
|
// }); |
|
|
|
//} |
|
|
|
SaveMaterialData(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("接收到小炒流程信息"); |
|
|
|
//流程解析 |
|
|
|
foreach (var item in LocalstirFryGoods) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.Show($"添加菜谱{item.GoodsKey}"); |
|
|
|
// morkF.listStirBom.Add(item.StirFryBomInfo);//添加订单制作流程 |
|
|
|
string MenuStep = "菜单步骤:"; |
|
|
|
foreach (var items in item.StirPotActions) |
|
|
|
MessageLog.GetInstance.Show("接收到小炒流程信息"); |
|
|
|
//流程解析 |
|
|
|
foreach (var item in LocalstirFryGoods) |
|
|
|
{ |
|
|
|
switch (items.Actions) |
|
|
|
MessageLog.GetInstance.Show($"添加菜谱{item.GoodsKey}"); |
|
|
|
// morkF.listStirBom.Add(item.StirFryBomInfo);//添加订单制作流程 |
|
|
|
string MenuStep = "菜单步骤:"; |
|
|
|
foreach (var items in item.StirPotActions) |
|
|
|
{ |
|
|
|
case nameof(StirFryPotActionEnum.加热开启): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位1): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位2): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位3): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位4): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位5): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位6): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位7): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位8): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位9): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位10): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.停止加热): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.加调料): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.取原料): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.开启搅拌): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位1): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位2): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位3): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.关闭搅拌): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.出餐启动): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.道菜启动): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.炒制菜品): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.搅拌臂原点位): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.搅拌臂炒制位): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.洗锅): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
|
|
|
|
switch (items.Actions) |
|
|
|
{ |
|
|
|
case nameof(StirFryPotActionEnum.加热开启): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位1): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位2): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位3): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位4): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位5): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位6): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位7): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位8): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位9): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位10): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.停止加热): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.加调料): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.取原料): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.开启搅拌): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位1): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位2): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位3): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.关闭搅拌): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.出餐启动): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.道菜启动): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.炒制菜品): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.搅拌臂原点位): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.搅拌臂炒制位): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
case nameof(StirFryPotActionEnum.洗锅): |
|
|
|
MenuStep += items.Actions + ","; |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show(MenuStep); |
|
|
|
} |
|
|
|
MessageLog.GetInstance.Show(MenuStep); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (stirFry.stirFrymessage.materials.Count > 0) |
|
|
|
{ |
|
|
|
MaterialSurplusOperation.GetInstance().UpdateSurplusAll(stirFry.stirFrymessage.materials); |
|
|
|
SaveMaterialData(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|