|
@@ -32,6 +32,10 @@ namespace BPASmartClient.MorkT |
|
|
|
|
|
|
|
|
public override void DoMain() |
|
|
public override void DoMain() |
|
|
{ |
|
|
{ |
|
|
|
|
|
if(Json<KeepDataBase>.Data.IsVerify) |
|
|
|
|
|
{ |
|
|
|
|
|
IsHealth = true; |
|
|
|
|
|
} |
|
|
IsHealth = true; |
|
|
IsHealth = true; |
|
|
ServerInit(); |
|
|
ServerInit(); |
|
|
DataParse(); |
|
|
DataParse(); |
|
@@ -142,7 +146,7 @@ namespace BPASmartClient.MorkT |
|
|
} |
|
|
} |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
GetStatus("IceCreamCBX", new Action<object>((o) => |
|
|
|
|
|
|
|
|
GetStatus("IceCreamCXB", new Action<object>((o) => |
|
|
{ |
|
|
{ |
|
|
if (o is byte bt) |
|
|
if (o is byte bt) |
|
|
{ |
|
|
{ |
|
@@ -178,7 +182,7 @@ namespace BPASmartClient.MorkT |
|
|
{ |
|
|
{ |
|
|
if (o is bool b) |
|
|
if (o is bool b) |
|
|
{ |
|
|
{ |
|
|
morkT.IceCreamIsConnected = b; |
|
|
|
|
|
|
|
|
morkT.CoffeeIsConnected = b; |
|
|
} |
|
|
} |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
@@ -261,7 +265,7 @@ namespace BPASmartClient.MorkT |
|
|
morkT.batchings = PolymerBatching.BuildAll(); |
|
|
morkT.batchings = PolymerBatching.BuildAll(); |
|
|
//商品类型 |
|
|
//商品类型 |
|
|
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; |
|
|
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; |
|
|
string loc_Goods = string.Empty; |
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in order.MorkOrder.GoodBatchings) |
|
|
foreach (var item in order.MorkOrder.GoodBatchings) |
|
|
{ |
|
|
{ |
|
|
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); |
|
|
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); |
|
@@ -273,42 +277,45 @@ namespace BPASmartClient.MorkT |
|
|
//获取当前物料所属商品类型 |
|
|
//获取当前物料所属商品类型 |
|
|
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); |
|
|
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
string loc_Goods = string.Empty; |
|
|
//获取主料和容器位置 |
|
|
//获取主料和容器位置 |
|
|
if (morkT.batchings[res.BatchingLoc].BatchingClass == BATCHING_CLASS.MAIN_MATERIAL) loc_Goods = res.BatchingLoc; |
|
|
if (morkT.batchings[res.BatchingLoc].BatchingClass == BATCHING_CLASS.MAIN_MATERIAL) loc_Goods = res.BatchingLoc; |
|
|
|
|
|
|
|
|
switch (currentGoodsType) |
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(loc_Goods)) |
|
|
{ |
|
|
{ |
|
|
case GOODS_TYPE.COFFEE: |
|
|
|
|
|
if (morkT.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
|
|
{ |
|
|
|
|
|
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() |
|
|
|
|
|
|
|
|
switch (currentGoodsType) |
|
|
|
|
|
{ |
|
|
|
|
|
case GOODS_TYPE.COFFEE: |
|
|
|
|
|
if (morkT.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
{ |
|
|
{ |
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
|
|
BatchingId = res.BatchingId, |
|
|
|
|
|
Loc = loc_Goods, |
|
|
|
|
|
GoodsName = order.MorkOrder.GoodsName, |
|
|
|
|
|
SortNum = order.MorkOrder.SortNum |
|
|
|
|
|
}) ; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case GOODS_TYPE.ICECREAM: |
|
|
|
|
|
if (morkT.morkOrderPushesIceCream.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
|
|
{ |
|
|
|
|
|
morkT.morkOrderPushesIceCream.Enqueue(new OrderLocInfo() |
|
|
|
|
|
|
|
|
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() |
|
|
|
|
|
{ |
|
|
|
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
|
|
BatchingId = res.BatchingId, |
|
|
|
|
|
Loc = loc_Goods, |
|
|
|
|
|
GoodsName = order.MorkOrder.GoodsName, |
|
|
|
|
|
SortNum = order.MorkOrder.SortNum |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case GOODS_TYPE.ICECREAM: |
|
|
|
|
|
if (morkT.morkOrderPushesIceCream.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
{ |
|
|
{ |
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
|
|
BatchingId = res.BatchingId, |
|
|
|
|
|
Loc = loc_Goods, |
|
|
|
|
|
GoodsName = order.MorkOrder.GoodsName, |
|
|
|
|
|
SortNum = order.MorkOrder.SortNum |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case GOODS_TYPE.NEITHER: |
|
|
|
|
|
DeviceProcessLogShow("未知的商品类型"); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
morkT.morkOrderPushesIceCream.Enqueue(new OrderLocInfo() |
|
|
|
|
|
{ |
|
|
|
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
|
|
BatchingId = res.BatchingId, |
|
|
|
|
|
Loc = loc_Goods, |
|
|
|
|
|
GoodsName = order.MorkOrder.GoodsName, |
|
|
|
|
|
SortNum = order.MorkOrder.SortNum |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case GOODS_TYPE.NEITHER: |
|
|
|
|
|
DeviceProcessLogShow("未知的商品类型"); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -363,11 +370,11 @@ namespace BPASmartClient.MorkT |
|
|
if (morkT.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc)) |
|
|
if (morkT.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc)) |
|
|
{ |
|
|
{ |
|
|
DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]"); |
|
|
DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]"); |
|
|
GetAndCheeckCoffe(orderLoc); |
|
|
|
|
|
|
|
|
GetAndCheeckCoffe(orderLoc);//取咖啡杯 |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10051}); //接咖啡后回原点 |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10051}); //接咖啡后回原点 |
|
|
Wait(); |
|
|
Wait(); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); |
|
|
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) }.Publish(); //接咖啡控制 |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) });//接咖啡控制 |
|
|
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); |
|
|
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); |
|
|
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; |
|
|
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; |
|
|
} |
|
|
} |
|
@@ -420,7 +427,7 @@ namespace BPASmartClient.MorkT |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯 |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯 |
|
|
|
|
|
|
|
|
Wait(); |
|
|
Wait(); |
|
|
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId= DeviceId ,Cup = IC_CUP.CUP_COFFEE});//落碗控制 |
|
|
Thread.Sleep(500); |
|
|
Thread.Sleep(500); |
|
|
DeviceProcessLogShow("尝试取咖啡杯!"); |
|
|
DeviceProcessLogShow("尝试取咖啡杯!"); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); |
|
@@ -452,7 +459,7 @@ namespace BPASmartClient.MorkT |
|
|
DeviceProcessLogShow("执行二次取咖啡杯"); |
|
|
DeviceProcessLogShow("执行二次取咖啡杯"); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯 |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯 |
|
|
Wait(); |
|
|
Wait(); |
|
|
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); |
|
|
count++; |
|
|
count++; |
|
|
goto p; |
|
|
goto p; |
|
@@ -477,14 +484,14 @@ namespace BPASmartClient.MorkT |
|
|
{ |
|
|
{ |
|
|
if (IceCreamCanMake()) |
|
|
if (IceCreamCanMake()) |
|
|
{ |
|
|
{ |
|
|
if(peripheralStatus.ContainsKey("CurrentMode")) |
|
|
|
|
|
|
|
|
if(peripheralStatus.ContainsKey("IceCreamCurrentMode")) |
|
|
{ |
|
|
{ |
|
|
if ((MORKI_MODE)peripheralStatus["CurrentMode"] != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); |
|
|
|
|
|
|
|
|
if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(peripheralStatus.ContainsKey(".CBX")) |
|
|
|
|
|
|
|
|
if(peripheralStatus.ContainsKey("IceCreamCXB")) |
|
|
{ |
|
|
{ |
|
|
if ((short)peripheralStatus["CBX"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作 |
|
|
|
|
|
|
|
|
if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作 |
|
|
{ |
|
|
{ |
|
|
bool result = true; |
|
|
bool result = true; |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) => |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) => |
|
@@ -531,7 +538,7 @@ namespace BPASmartClient.MorkT |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10032 }); //SENCE_取冰淇淋杯 |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10032 }); //SENCE_取冰淇淋杯 |
|
|
Wait(); |
|
|
Wait(); |
|
|
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制 |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 |
|
|
Thread.Sleep(500); |
|
|
Thread.Sleep(500); |
|
|
DeviceProcessLogShow("尝试取冰淇淋杯!"); |
|
|
DeviceProcessLogShow("尝试取冰淇淋杯!"); |
|
|
|
|
|
|
|
@@ -569,7 +576,7 @@ namespace BPASmartClient.MorkT |
|
|
} |
|
|
} |
|
|
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!"); |
|
|
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!"); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10036 }); //SENCE_二次取冰淇淋杯 |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10036 }); //SENCE_二次取冰淇淋杯 |
|
|
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制 |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 |
|
|
Wait(); |
|
|
Wait(); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); |
|
|
count++; |
|
|
count++; |
|
@@ -585,17 +592,17 @@ namespace BPASmartClient.MorkT |
|
|
private void GetIceCream(OrderLocInfo order) |
|
|
private void GetIceCream(OrderLocInfo order) |
|
|
{ |
|
|
{ |
|
|
//制冷模式 |
|
|
//制冷模式 |
|
|
new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent {DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }); |
|
|
OrderChange(order.SuborderId, ORDER_STATUS.COOKING); |
|
|
OrderChange(order.SuborderId, ORDER_STATUS.COOKING); |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10039 }); //SENCE_接1号冰淇淋 |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10039 }); //SENCE_接1号冰淇淋 |
|
|
Wait(); |
|
|
Wait(); |
|
|
bool doItResult = true; |
|
|
bool doItResult = true; |
|
|
//出料 |
|
|
//出料 |
|
|
new GSIceCream_DischargeEvent().Publish(delegate (object[] args) |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId },(o)=> |
|
|
{ |
|
|
{ |
|
|
doItResult = (bool)args[0]; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
doItResult = (bool)o[0]; |
|
|
|
|
|
}); |
|
|
if (doItResult) |
|
|
if (doItResult) |
|
|
{ |
|
|
{ |
|
|
IceCreamCookCheck(); |
|
|
IceCreamCookCheck(); |
|
@@ -604,7 +611,7 @@ namespace BPASmartClient.MorkT |
|
|
{ |
|
|
{ |
|
|
int count_1 = 0; |
|
|
int count_1 = 0; |
|
|
|
|
|
|
|
|
while ((short)peripheralStatus["CBX"] <= 86) |
|
|
|
|
|
|
|
|
while ((byte)peripheralStatus["IceCreamCXB"] <= 86) |
|
|
{ |
|
|
{ |
|
|
Thread.Sleep(5); |
|
|
Thread.Sleep(5); |
|
|
count_1++; |
|
|
count_1++; |
|
@@ -647,19 +654,20 @@ namespace BPASmartClient.MorkT |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
public void IceCreamCookCheck() |
|
|
public void IceCreamCookCheck() |
|
|
{ |
|
|
{ |
|
|
bool result = true; |
|
|
|
|
|
|
|
|
bool result = false; |
|
|
int retry = 3; |
|
|
int retry = 3; |
|
|
DateTime beginTime = DateTime.Now; |
|
|
DateTime beginTime = DateTime.Now; |
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 } ,(res)=> |
|
|
|
|
|
{ |
|
|
|
|
|
if (res[0] is bool resultValue) |
|
|
|
|
|
{ |
|
|
|
|
|
result = resultValue; |
|
|
|
|
|
} |
|
|
|
|
|
} ); |
|
|
|
|
|
|
|
|
|
|
|
while (!result) |
|
|
while (!result) |
|
|
{ |
|
|
{ |
|
|
if (retry <= 0 && DateTime.Now.Subtract(beginTime).TotalSeconds >= 10) |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) => |
|
|
|
|
|
{ |
|
|
|
|
|
if (res[0] is bool resultValue) |
|
|
|
|
|
{ |
|
|
|
|
|
result = resultValue; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
if (retry <= 0 || DateTime.Now.Subtract(beginTime).TotalSeconds >= 10) |
|
|
{ |
|
|
{ |
|
|
DeviceProcessLogShow("超时未出料,重试次数用尽"); |
|
|
DeviceProcessLogShow("超时未出料,重试次数用尽"); |
|
|
break; |
|
|
break; |
|
@@ -667,7 +675,7 @@ namespace BPASmartClient.MorkT |
|
|
if (DateTime.Now.Subtract(beginTime).TotalSeconds > 5) |
|
|
if (DateTime.Now.Subtract(beginTime).TotalSeconds > 5) |
|
|
{ |
|
|
{ |
|
|
DeviceProcessLogShow("超时未出料,重新发送打料指令"); |
|
|
DeviceProcessLogShow("超时未出料,重新发送打料指令"); |
|
|
new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.打料 }.Publish(); |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish( new GSIceCream_ModeSetEvent() { DeviceId =DeviceId, Mode = MORKI_MODE.打料 }); |
|
|
beginTime = DateTime.Now; |
|
|
beginTime = DateTime.Now; |
|
|
retry--; |
|
|
retry--; |
|
|
} |
|
|
} |
|
|