@@ -191,6 +191,7 @@ namespace BPASmartClient.DRCoffee | |||||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | commProxy.SendData(DrCoffee.Packe(drinksOrder)); | ||||
Thread.Sleep(200); | Thread.Sleep(200); | ||||
free = false; | free = false; | ||||
MessageLog.GetInstance.Show($"咖啡机: 制作咖啡指令"); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -210,6 +211,7 @@ namespace BPASmartClient.DRCoffee | |||||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | commProxy.SendData(DrCoffee.Packe(drinksOrder)); | ||||
Thread.Sleep(200); | Thread.Sleep(200); | ||||
free = false; | free = false; | ||||
MessageLog.GetInstance.Show($"咖啡机: 咖啡取消指令"); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -228,6 +230,7 @@ namespace BPASmartClient.DRCoffee | |||||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | commProxy.SendData(DrCoffee.Packe(drinksOrder)); | ||||
Thread.Sleep(200); | Thread.Sleep(200); | ||||
free = false; | free = false; | ||||
MessageLog.GetInstance.Show($"咖啡机: 咖啡模式设置指令"); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -17,6 +17,7 @@ namespace BPASmartClient.Juicer | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
IsConnected = juicerHelper.IsOpen; | IsConnected = juicerHelper.IsOpen; | ||||
status["JuiceIsConnect"] = juicerHelper.IsOpen; | |||||
if (!IsConnected) IsWork = false; | if (!IsConnected) IsWork = false; | ||||
while (IsConnected) | while (IsConnected) | ||||
{ | { | ||||
@@ -24,6 +25,7 @@ namespace BPASmartClient.Juicer | |||||
if (status != null) | if (status != null) | ||||
{ | { | ||||
SetStatus("GetDeviceStatus", juicerHelper.GetDeviceStatus()); | SetStatus("GetDeviceStatus", juicerHelper.GetDeviceStatus()); | ||||
} | } | ||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
} | } | ||||
@@ -139,12 +139,18 @@ namespace BPASmartClient.KLMCoffee | |||||
SystemStatusModel systemStatus = new K95Command().StateResolution(data); | SystemStatusModel systemStatus = new K95Command().StateResolution(data); | ||||
if (systemStatus != null) | if (systemStatus != null) | ||||
{ | { | ||||
status["Status"] = systemStatus.temStatus; | |||||
status["drinkType"] = systemStatus.drinkType; | |||||
status["AppStatus"] = systemStatus.taskIndex; | |||||
status["progress"] = systemStatus.progress; | |||||
status["Warning"] = systemStatus.faultMessage.dataFault(); | |||||
status["Keep"] = systemStatus.upkeepMessage; | |||||
status["CoffeeIsconnected"] = OnLine; | |||||
if((K95SysTemStatus)status["Status"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡) | |||||
{ | |||||
status["Status"] = systemStatus.temStatus; | |||||
EventBus.EventBus.GetInstance().Publish(new KLMCoffee_CoffeEndCookEvent { DeviceId = DeviceId }); | |||||
} | |||||
else status["CoffeeStatus"] = systemStatus.temStatus; | |||||
status["CoffeedrinkType"] = systemStatus.drinkType; | |||||
status["CoffeeAppStatus"] = systemStatus.taskIndex; | |||||
status["Coffeeprogress"] = systemStatus.progress; | |||||
status["CoffeeWarning"] = systemStatus.faultMessage.dataFault(); | |||||
status["CoffeeKeep"] = systemStatus.upkeepMessage; | |||||
if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep()) | if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep()) | ||||
IsWork = false; | IsWork = false; | ||||
else | else | ||||
@@ -160,18 +166,18 @@ namespace BPASmartClient.KLMCoffee | |||||
protected override void InitStatus() | protected override void InitStatus() | ||||
{ | { | ||||
status["Status"] = K95SysTemStatus.空闲状态; | |||||
status["drinkType"] = DrinkType.意式; | |||||
status["AppStatus"] = TaskIndex.无任务; | |||||
status["progress"] = 0; | |||||
status["Warning"] = new FaultMessage(0x00, 0x00).dataFault(); | |||||
status["Keep"] = new UpkeepMessage(0x00).dataFault(); | |||||
status["CoffeeStatus"] = K95SysTemStatus.空闲状态; | |||||
status["CoffeedrinkType"] = DrinkType.意式; | |||||
status["CoffeeAppStatus"] = TaskIndex.无任务; | |||||
status["Coffeeprogress"] = 0; | |||||
status["CoffeeWarning"] = new FaultMessage(0x00, 0x00).dataFault(); | |||||
status["CoffeeKeep"] = new UpkeepMessage(0x00).dataFault(); | |||||
} | } | ||||
public override void Init() | public override void Init() | ||||
{ | { | ||||
commProxy = new SerialPortClient(PortName, (BaudRates)Enum.Parse(typeof(BaudRates), BaudRate)); | |||||
commProxy = new SerialPortClient(communicationPar.SerialPort, (BaudRates)communicationPar.BaudRate); | |||||
commProxy.SetDataStorage(dataStorage); | commProxy.SetDataStorage(dataStorage); | ||||
//伽乐美咖啡机制作 | //伽乐美咖啡机制作 | ||||
@@ -136,9 +136,9 @@ namespace BPASmartClient.Lebai | |||||
EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_SetOutPutEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_SetOutPutEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | ||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
if (@event is LebaiRobot_LebaiSenceEvent lebaiSenceEvent) | |||||
if (@event is LebaiRobot_SetOutPutEvent SetOutEvent) | |||||
{ | { | ||||
LebaiHelper.GetInstance().SetOutput(SetOutEvent.bDO, SetOutEvent.pin); | |||||
} | } | ||||
}); | }); | ||||
@@ -312,5 +312,37 @@ namespace BPASmartClient.LebaiRobot | |||||
await client?.RunScene(id); | await client?.RunScene(id); | ||||
MessageLog.GetInstance.Show($"调用场景:{id}"); | MessageLog.GetInstance.Show($"调用场景:{id}"); | ||||
} | } | ||||
/// <summary> | |||||
/// 设置输出 | |||||
/// </summary> | |||||
/// <param name="bDO"></param> | |||||
/// <param name="pin"></param> | |||||
public void SetOutput(bool bDO, int pin = 0) | |||||
{ | |||||
try | |||||
{ | |||||
if (client == null) { return; } | |||||
var res = client.SetDIO(new DIO() { Pin = pin, Value = bDO ? 1 : 0 }); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||||
} | |||||
} | |||||
public void MoveL(double pose) | |||||
{ | |||||
//try | |||||
//{ | |||||
// if (client == null) { return; } | |||||
// var res = client.MovePT(new PVATRequest() { }) | |||||
//} | |||||
//catch (Exception ex) | |||||
//{ | |||||
// MessageLog.GetInstance.ShowEx(ex.ToString()); | |||||
//} | |||||
} | |||||
} | } | ||||
} | } |
@@ -29,6 +29,7 @@ namespace BPASmartClient.Model.乐白机器人.Enum | |||||
public const int SENCE_冰淇淋杯回原点 = 10049; | public const int SENCE_冰淇淋杯回原点 = 10049; | ||||
public const int SENCE_取咖啡出餐 = 10052; | public const int SENCE_取咖啡出餐 = 10052; | ||||
public const int SENCE_机器人回原点 = 10058; | |||||
// 单片机冰淇淋机器场景 | // 单片机冰淇淋机器场景 | ||||
public const int SENCE_单片机接冰淇淋 = 10055; | public const int SENCE_单片机接冰淇淋 = 10055; | ||||
public const int SENCE_单片机放冰淇淋位置 = 10056; | public const int SENCE_单片机放冰淇淋位置 = 10056; | ||||
@@ -48,7 +48,8 @@ namespace BPASmartClient.Model.乐白机器人 | |||||
public class LebaiRobot_SetOutPutEvent : BaseEvent | public class LebaiRobot_SetOutPutEvent : BaseEvent | ||||
{ | { | ||||
public int RobotSetOut { get; set; } | |||||
public bool bDO { get; set; } = true; | |||||
public int pin { get; set; } | |||||
} | } | ||||
} | } | ||||
@@ -432,7 +432,7 @@ namespace BPASmartClient.MorkT | |||||
/// </summary> | /// </summary> | ||||
private void DoCoffeeQC(OrderLocInfo order) | private void DoCoffeeQC(OrderLocInfo order) | ||||
{ | { | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10052 }); //SENCE_取咖啡出餐 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡出餐 }); //SENCE_取咖啡出餐 | |||||
Wait(); | Wait(); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
//订单状态改变:完成 | //订单状态改变:完成 | ||||
@@ -451,7 +451,7 @@ namespace BPASmartClient.MorkT | |||||
{ | { | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 },(o)=>{ }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 },(o)=>{ }); | ||||
OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡杯 }); //SENCE_取咖啡杯 | |||||
Wait(); | Wait(); | ||||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | ||||
@@ -461,7 +461,7 @@ namespace BPASmartClient.MorkT | |||||
int count = 1; | int count = 1; | ||||
bool result = true; | bool result = true; | ||||
p: | p: | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10033 }); //SENCE_咖啡杯检测 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯检测 }); //SENCE_咖啡杯检测 | |||||
Wait(); | Wait(); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o)=> | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o)=> | ||||
@@ -478,14 +478,14 @@ namespace BPASmartClient.MorkT | |||||
{ | { | ||||
//退出循环回到初始位置 | //退出循环回到初始位置 | ||||
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10050 }); //SENCE_咖啡杯回原点 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯回原点 }); //SENCE_咖啡杯回原点 | |||||
Wait(); | Wait(); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
morkT.GetCoffeeCup = false; | morkT.GetCoffeeCup = false; | ||||
return; | return; | ||||
} | } | ||||
DeviceProcessLogShow("执行二次取咖啡杯"); | DeviceProcessLogShow("执行二次取咖啡杯"); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取咖啡杯 }); //SENCE_二次取咖啡杯 | |||||
Wait(); | Wait(); | ||||
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | 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 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
@@ -575,7 +575,7 @@ namespace BPASmartClient.MorkT | |||||
{ | { | ||||
MessageLog.GetInstance.Show("准备开始制作冰淇淋"); | MessageLog.GetInstance.Show("准备开始制作冰淇淋"); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10032 }); //SENCE_取冰淇淋杯 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取冰淇淋杯 }); //SENCE_取冰淇淋杯 | |||||
Wait(); | Wait(); | ||||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | ||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
@@ -592,7 +592,7 @@ namespace BPASmartClient.MorkT | |||||
bool result = true; | bool result = true; | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
p: | p: | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10034 }); //SENCE_冰淇淋杯检测 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯检测 }); //SENCE_冰淇淋杯检测 | |||||
Wait(); | Wait(); | ||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => | ||||
@@ -627,14 +627,14 @@ namespace BPASmartClient.MorkT | |||||
{ | { | ||||
//退出循环回到初始位置 | //退出循环回到初始位置 | ||||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!"); | DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!"); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10049 }); //SENCE_冰淇淋杯回原点 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯回原点 }); //SENCE_冰淇淋杯回原点 | |||||
Wait(); | Wait(); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 },(o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 },(o) => { }); | ||||
morkT.GetIceCreamCup = false; | morkT.GetIceCreamCup = false; | ||||
return; | return; | ||||
} | } | ||||
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 = Lebai_qsqdCode.SENCE_二次取冰淇淋杯 }); //SENCE_二次取冰淇淋杯 | |||||
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | 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 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
@@ -655,7 +655,7 @@ namespace BPASmartClient.MorkT | |||||
//EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent {DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | //EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent {DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | ||||
OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10055 }); //SENCE_接1号冰淇淋 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_单片机接冰淇淋 }); //SENCE_接1号冰淇淋 | |||||
Wait(); | Wait(); | ||||
bool doItResult = true; | bool doItResult = true; | ||||
@@ -663,7 +663,9 @@ namespace BPASmartClient.MorkT | |||||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | //EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | ||||
//Thread.Sleep(500); | //Thread.Sleep(500); | ||||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | //EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | ||||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId=DeviceId,}) | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = true ,pin = 1}); | |||||
Thread.Sleep(500); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = false, pin = 1 }); | |||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料 | EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料 | ||||
@@ -714,7 +716,7 @@ namespace BPASmartClient.MorkT | |||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
} | } | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10056 }); //SENCE_放冰淇淋位置 | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_放冰淇淋位置 }); //SENCE_放冰淇淋位置 | |||||
Wait(); | Wait(); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
//订单状态改变:完成 | //订单状态改变:完成 | ||||
@@ -79,10 +79,16 @@ | |||||
Command="{Binding Button_RobotControlCommand}" | Command="{Binding Button_RobotControlCommand}" | ||||
CommandParameter="机器人急停"/> | CommandParameter="机器人急停"/> | ||||
<!--<Button Content="机器人回原点" | |||||
Margin="20,5" Width="110" Height="60" | |||||
Command="{Binding Button_GoToHomeCommand}" | |||||
CommandParameter="机器人急停">--> | |||||
<!--</Button>--> | |||||
</ListBox> | </ListBox> | ||||
</Grid> | </Grid> | ||||
</GroupBox> | </GroupBox> | ||||
<!--<GroupBox Grid.Row="2" | |||||
<GroupBox Grid.Row="2" | |||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="20" | FontSize="20" | ||||
Header=" 冰淇淋机器 "> | Header=" 冰淇淋机器 "> | ||||
@@ -172,8 +178,8 @@ | |||||
</StackPanel> | </StackPanel> | ||||
</StackPanel> | </StackPanel> | ||||
</Grid> | </Grid> | ||||
</GroupBox>--> | |||||
<GroupBox Grid.Row="2" Grid.Column="0" | |||||
</GroupBox> | |||||
<!--<GroupBox Grid.Row="2" Grid.Column="0" | |||||
FontSize="20" FontFamily="楷体" | FontSize="20" FontFamily="楷体" | ||||
Header="单片机冰淇淋" > | Header="单片机冰淇淋" > | ||||
<Grid> | <Grid> | ||||
@@ -214,7 +220,7 @@ | |||||
</ListBox> | </ListBox> | ||||
</Grid> | </Grid> | ||||
</GroupBox> | |||||
</GroupBox>--> | |||||
<GroupBox Grid.Row="2" Grid.Column="1" | <GroupBox Grid.Row="2" Grid.Column="1" | ||||
FontFamily="楷体" | FontFamily="楷体" | ||||
@@ -8,6 +8,7 @@ using BPASmartClient.LebaiRobot; | |||||
using BPASmartClient.Message; | using BPASmartClient.Message; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.乐白机器人; | using BPASmartClient.Model.乐白机器人; | ||||
using BPASmartClient.Model.乐白机器人.Enum; | |||||
using BPASmartClient.Model.冰淇淋.Enum; | using BPASmartClient.Model.冰淇淋.Enum; | ||||
using BPASmartClient.Model.单片机; | using BPASmartClient.Model.单片机; | ||||
using BPASmartClient.Model.单片机.Enum; | using BPASmartClient.Model.单片机.Enum; | ||||
@@ -47,6 +48,8 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
public RelayCommand Button_SetValueCommand { get; set; } | public RelayCommand Button_SetValueCommand { get; set; } | ||||
public RelayCommand Button_GoToHomeCommand { get; set; } | |||||
private void Button_SetValue() | private void Button_SetValue() | ||||
{ | { | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); | ||||
@@ -56,6 +59,14 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() }); | ||||
} | } | ||||
private void Button_GoToHome() | |||||
{ | |||||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | |||||
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点"); | |||||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_机器人回原点 }); | |||||
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点-----"); | |||||
} | |||||
#endregion | #endregion | ||||
#region 冰淇淋机器 | #region 冰淇淋机器 | ||||
@@ -222,10 +233,13 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
private void Button_SCChipRefrigeration() | private void Button_SCChipRefrigeration() | ||||
{ | { | ||||
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||||
//Thread.Sleep(500); | |||||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = true, pin = 1 }); | |||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = false, pin = 1 }); | |||||
} | } | ||||
private void Button_SCChipDischarge() | private void Button_SCChipDischarge() | ||||
@@ -248,6 +262,7 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
{ | { | ||||
Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl); | Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl); | ||||
Button_SetValueCommand = new RelayCommand(Button_SetValue); | Button_SetValueCommand = new RelayCommand(Button_SetValue); | ||||
Button_GoToHomeCommand = new RelayCommand(Button_GoToHome); | |||||
Button_MakeIceCreamCommand = new RelayCommand(Button_MakeIceCream); | Button_MakeIceCreamCommand = new RelayCommand(Button_MakeIceCream); | ||||
Button_SetIceCreamModelCommand = new RelayCommand(Button_SetIceCreamModel); | Button_SetIceCreamModelCommand = new RelayCommand(Button_SetIceCreamModel); | ||||
@@ -1,4 +1,5 @@ | |||||
using BPA.Message.Enum; | |||||
using BPA.Message; | |||||
using BPA.Message.Enum; | |||||
using BPASmartClient.Device; | using BPASmartClient.Device; | ||||
using BPASmartClient.DRCoffee; | using BPASmartClient.DRCoffee; | ||||
using BPASmartClient.EventBus; | using BPASmartClient.EventBus; | ||||
@@ -22,14 +23,14 @@ using System.Threading; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using static BPASmartClient.EventBus.EventBus; | using static BPASmartClient.EventBus.EventBus; | ||||
namespace BPASmartClient.MorkT_HQ | |||||
namespace BPASmartClient.MorkTHQ | |||||
{ | { | ||||
public class Control_MorkT_HQ : BaseDevice | |||||
public class Control_MorkTHQ : BaseDevice | |||||
{ | { | ||||
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } | public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } | ||||
GLV_MorkT_HQ morkT = new GLV_MorkT_HQ(); | |||||
GLV_MorkTHQ morkT = new GLV_MorkTHQ(); | |||||
int[] devStatusBy = new int[2] { 0, 0 }; | |||||
public override void DoMain() | public override void DoMain() | ||||
{ | { | ||||
@@ -40,7 +41,7 @@ namespace BPASmartClient.MorkT_HQ | |||||
IsHealth = true; | IsHealth = true; | ||||
ServerInit(); | ServerInit(); | ||||
DataParse(); | DataParse(); | ||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (morkT.MakeCoffeeOrder != null) | if (morkT.MakeCoffeeOrder != null) | ||||
morkT.MakeCoffeeOrder.OrderStatus = 1; | morkT.MakeCoffeeOrder.OrderStatus = 1; | ||||
@@ -55,7 +56,7 @@ namespace BPASmartClient.MorkT_HQ | |||||
public override void ResetProgram() | public override void ResetProgram() | ||||
{ | { | ||||
morkT = null; | morkT = null; | ||||
morkT = new GLV_MorkT_HQ(); | |||||
morkT = new GLV_MorkTHQ(); | |||||
} | } | ||||
@@ -72,34 +73,16 @@ namespace BPASmartClient.MorkT_HQ | |||||
public override void MainTask() | public override void MainTask() | ||||
{ | { | ||||
if (morkT.waitMorkOrder != null)//更新订单取走状态 | |||||
{ | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (o) => | |||||
{ | |||||
if (o != null && o.Length > 0 && o[0] is bool res) | |||||
{ | |||||
if (!res) | |||||
{ | |||||
OrderChange(morkT.waitMorkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE); | |||||
DeviceProcessLogShow("订单取餐完成"); | |||||
morkT.waitMorkOrder = null; | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
//制作咖啡 | |||||
MakeCoffeeProcess(); | MakeCoffeeProcess(); | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 },(o)=> | |||||
{ | |||||
if(o != null && o.Length > 0 && o[0] is bool resultValue) | |||||
{ | |||||
if(!resultValue)//取餐口有空余位置 | |||||
{ | |||||
MakeIceCreamProcess(); | |||||
MakeCoffeeComplete(); | |||||
} | |||||
} | |||||
}); | |||||
//制作果汁 | |||||
MakeJuiceProcess(); | |||||
//制作冰淇淋 | |||||
MakeIceCreamProcess(); | |||||
//制作完取咖啡 | |||||
MakeCoffeeComplete(); | |||||
} | } | ||||
@@ -232,6 +215,14 @@ namespace BPASmartClient.MorkT_HQ | |||||
morkT.CaffeeFault = coffeeFault; | morkT.CaffeeFault = coffeeFault; | ||||
} | } | ||||
})); | })); | ||||
GetStatus("Coffeeprogress", new Action<object>((o) => | |||||
{ | |||||
if (o is int coffeeFault) | |||||
{ | |||||
morkT.Coffeeprogress = coffeeFault; | |||||
} | |||||
})); | |||||
GetStatus("SCChipIsConnect", new Action<object>((o) => | GetStatus("SCChipIsConnect", new Action<object>((o) => | ||||
{ | { | ||||
if (o is bool b) | if (o is bool b) | ||||
@@ -239,6 +230,13 @@ namespace BPASmartClient.MorkT_HQ | |||||
morkT.SCChipIsConnect = b; | morkT.SCChipIsConnect = b; | ||||
} | } | ||||
})); | })); | ||||
GetStatus("JuiceIsConnect", new Action<object>((o) => | |||||
{ | |||||
if (o is bool b) | |||||
{ | |||||
morkT.JuiceIsConnect = b; | |||||
} | |||||
})); | |||||
} | } | ||||
@@ -333,6 +331,20 @@ namespace BPASmartClient.MorkT_HQ | |||||
}); | }); | ||||
} | } | ||||
break; | break; | ||||
case GOODS_TYPE.JUICE: | |||||
if(morkT.morkOrderPushesIceCream.FirstOrDefault(p=>p.SuborderId == order?.MorkOrder.SuborderId) == null) | |||||
{ | |||||
morkT.GuMake = order.MorkOrder.MakeID == "2"; | |||||
morkT.morkOrderPushesJuice.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: | case GOODS_TYPE.NEITHER: | ||||
DeviceProcessLogShow("未知的商品类型"); | DeviceProcessLogShow("未知的商品类型"); | ||||
break; | break; | ||||
@@ -371,6 +383,7 @@ namespace BPASmartClient.MorkT_HQ | |||||
} | } | ||||
} | } | ||||
#region 咖啡 | |||||
/// <summary> | /// <summary> | ||||
/// 是否可以开始制作咖啡 | /// 是否可以开始制作咖啡 | ||||
/// </summary> | /// </summary> | ||||
@@ -397,7 +410,7 @@ namespace BPASmartClient.MorkT_HQ | |||||
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 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) });//接咖啡控制 | |||||
EventBus.EventBus.GetInstance().Publish(new KLMCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrinkType)int.Parse(orderLoc.Loc) });//接咖啡控制 | |||||
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); | DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); | ||||
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; | morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; | ||||
} | } | ||||
@@ -450,50 +463,16 @@ namespace BPASmartClient.MorkT_HQ | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 },(o)=>{ }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 },(o)=>{ }); | ||||
OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | ||||
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(); | ||||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId= DeviceId ,Cup = IC_CUP.CUP_COFFEE});//落碗控制 | |||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
DeviceProcessLogShow("尝试取咖啡杯!"); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
int count = 1; | |||||
bool result = true; | |||||
p: | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10033 }); //SENCE_咖啡杯检测 | |||||
Wait(); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o)=> | |||||
{ | |||||
if(o != null && o.Length > 0 && o[0] is bool resultValue) | |||||
{ | |||||
result = resultValue; | |||||
} | |||||
}); | |||||
if (!result) | |||||
{ | |||||
if (count >= 3) | |||||
{ | |||||
//退出循环回到初始位置 | |||||
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10050 }); //SENCE_咖啡杯回原点 | |||||
Wait(); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||||
morkT.GetCoffeeCup = false; | |||||
return; | |||||
} | |||||
DeviceProcessLogShow("执行二次取咖啡杯"); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯 | |||||
Wait(); | |||||
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 }, (o) => { }); | |||||
count++; | |||||
goto p; | |||||
} | |||||
morkT.GetCoffeeCup = true; | morkT.GetCoffeeCup = true; | ||||
DeviceProcessLogShow("取咖啡杯完成"); | DeviceProcessLogShow("取咖啡杯完成"); | ||||
} | } | ||||
#endregion | |||||
#region 冰淇淋 | |||||
/// <summary> | /// <summary> | ||||
/// 冰淇淋是否可以开始制作 | /// 冰淇淋是否可以开始制作 | ||||
/// </summary> | /// </summary> | ||||
@@ -509,45 +488,40 @@ namespace BPASmartClient.MorkT_HQ | |||||
/// </summary> | /// </summary> | ||||
private void MakeIceCreamProcess() | private void MakeIceCreamProcess() | ||||
{ | { | ||||
//if (IceCreamCanMake()) | |||||
//{ | |||||
if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) | |||||
{ | |||||
DoIceCream(order); | |||||
} | |||||
//if(peripheralStatus.ContainsKey("IceCreamCurrentMode")) | |||||
//{ | |||||
// if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | |||||
//} | |||||
//if(peripheralStatus.ContainsKey("IceCreamCXB")) | |||||
//{ | |||||
// if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作 | |||||
// { | |||||
// bool result = true; | |||||
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) => | |||||
// { | |||||
// if (res[0] is bool resultValue) | |||||
// { | |||||
// result = resultValue; | |||||
// } | |||||
// }); | |||||
// if (result) | |||||
// { | |||||
// if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡"); | |||||
// morkT.IceIsOK = false; | |||||
// } | |||||
// else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) | |||||
// { | |||||
// morkT.IceIsOK = true; | |||||
// DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]"); | |||||
// DoIceCream(order); | |||||
// } | |||||
// } | |||||
//} | |||||
if (IceCreamCanMake()) | |||||
{ | |||||
if (peripheralStatus.ContainsKey("IceCreamCurrentMode")) | |||||
{ | |||||
if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | |||||
} | |||||
//} | |||||
if (peripheralStatus.ContainsKey("IceCreamCXB")) | |||||
{ | |||||
if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作 | |||||
{ | |||||
bool result = true; | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) => | |||||
{ | |||||
if (res[0] is bool resultValue) | |||||
{ | |||||
result = resultValue; | |||||
} | |||||
}); | |||||
if (result) | |||||
{ | |||||
if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡"); | |||||
morkT.IceIsOK = false; | |||||
} | |||||
else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) | |||||
{ | |||||
morkT.IceIsOK = true; | |||||
DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]"); | |||||
DoIceCream(order); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
@@ -557,12 +531,9 @@ namespace BPASmartClient.MorkT_HQ | |||||
private void DoIceCream(OrderLocInfo order) | private void DoIceCream(OrderLocInfo order) | ||||
{ | { | ||||
GetIceCreamCup(); | GetIceCreamCup(); | ||||
CheckICeCreaCup(); | |||||
if(morkT.GetIceCreamCup) | |||||
{ | |||||
GetIceCream(order); | |||||
PutIceCream(order); | |||||
} | |||||
//CheckICeCreaCup(); | |||||
GetIceCream(order); | |||||
PutIceCream(order); | |||||
} | } | ||||
@@ -575,7 +546,6 @@ namespace BPASmartClient.MorkT_HQ | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | ||||
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(); | ||||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | |||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
DeviceProcessLogShow("尝试取冰淇淋杯!"); | DeviceProcessLogShow("尝试取冰淇淋杯!"); | ||||
@@ -657,37 +627,37 @@ namespace BPASmartClient.MorkT_HQ | |||||
Wait(); | Wait(); | ||||
bool doItResult = true; | bool doItResult = true; | ||||
//出料 | |||||
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||||
Thread.Sleep(500); | |||||
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||||
Thread.Sleep(500); | |||||
EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料 | |||||
DeviceProcessLogShow("开始等待6s"); | |||||
Thread.Sleep(5000); | |||||
////出料 | |||||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||||
//Thread.Sleep(500); | |||||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||||
//Thread.Sleep(500); | |||||
//EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料 | |||||
//DeviceProcessLogShow("开始等待6s"); | |||||
//Thread.Sleep(5000); | |||||
// 出料 | |||||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }, (o) => | |||||
{ | |||||
doItResult = (bool)o[0]; | |||||
}); | |||||
if (doItResult) | |||||
{ | |||||
IceCreamCookCheck(); | |||||
} | |||||
else | |||||
{ | |||||
int count_1 = 0; | |||||
//出料 | |||||
//EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId },(o)=> | |||||
//{ | |||||
// doItResult = (bool)o[0]; | |||||
//}); | |||||
//if (doItResult) | |||||
//{ | |||||
// IceCreamCookCheck(); | |||||
//} | |||||
//else | |||||
//{ | |||||
// int count_1 = 0; | |||||
// while ((byte)peripheralStatus["IceCreamCXB"] <= 86) | |||||
// { | |||||
// Thread.Sleep(5); | |||||
// count_1++; | |||||
// if (count_1 >= 2000) | |||||
// break; | |||||
// } | |||||
// IceCreamCookCheck(); | |||||
//} | |||||
while ((byte)peripheralStatus["IceCreamCXB"] <= 86) | |||||
{ | |||||
Thread.Sleep(5); | |||||
count_1++; | |||||
if (count_1 >= 2000) | |||||
break; | |||||
} | |||||
IceCreamCookCheck(); | |||||
} | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
} | } | ||||
@@ -757,10 +727,138 @@ namespace BPASmartClient.MorkT_HQ | |||||
Thread.Sleep(5000); | Thread.Sleep(5000); | ||||
} | } | ||||
#endregion | |||||
#region 果汁 | |||||
/// <summary> | |||||
/// 制作果汁流程 | |||||
/// </summary> | |||||
private void MakeJuiceProcess() | |||||
{ | |||||
if(morkT.morkOrderPushesJuice.TryDequeue(out OrderLocInfo order)) | |||||
{ | |||||
OrderChange(order.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 11111 });//SENCE_取果汁杯位置 | |||||
int JuicerNum1 = int.Parse(order.Loc); | |||||
switch (JuicerNum1) | |||||
{ | |||||
case 52: | |||||
if (morkT.GuMake) | |||||
{ | |||||
morkT.JuicerNum = 0x00; | |||||
} | |||||
else | |||||
{ | |||||
morkT.JuicerNum = 0x01; | |||||
} | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||||
Wait(); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接1号果汁位置 }); | |||||
Wait(); | |||||
break; | |||||
case 53: | |||||
if (morkT.GuMake) | |||||
{ | |||||
morkT.JuicerNum = 0x02; | |||||
} | |||||
else | |||||
{ | |||||
morkT.JuicerNum = 0x03; | |||||
} | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||||
Wait(); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接2号果汁位置 }); | |||||
Wait(); | |||||
break; | |||||
case 54: | |||||
if (morkT.GuMake) | |||||
{ | |||||
morkT.JuicerNum = 0x04; | |||||
} | |||||
else | |||||
{ | |||||
morkT.JuicerNum = 0x05; | |||||
} | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||||
Wait(); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接3号果汁位置 }); | |||||
Wait(); | |||||
break; | |||||
case 55: | |||||
if (morkT.GuMake) | |||||
{ | |||||
morkT.JuicerNum = 0x06; | |||||
} | |||||
else | |||||
{ | |||||
morkT.JuicerNum = 0x07; | |||||
} | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||||
Wait(); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接4号果汁位置 }); | |||||
Wait(); | |||||
break; | |||||
default: | |||||
morkT.JuicerNum = 0x00; | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||||
Wait(); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接1号果汁位置 }); | |||||
Wait(); | |||||
break; | |||||
} | |||||
var devStatus = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||||
var devStatus1 = Convert.ToString(devStatus[0], 2); | |||||
var devStatus2 = devStatus[1]; | |||||
if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0) | |||||
{ | |||||
EventBus.EventBus.GetInstance().Publish(new WriteJuicer() { Value = morkT.JuicerNum }); | |||||
Thread.Sleep(100); | |||||
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||||
while (!(devStatusBy[1] == 0)) | |||||
{ | |||||
Thread.Sleep(100); | |||||
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||||
while (devStatusBy.Length != 2) | |||||
{ | |||||
Thread.Sleep(100); | |||||
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||||
} | |||||
} | |||||
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||||
Thread.Sleep(5000); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_放果汁杯位置后回原点 }); | |||||
Wait(); | |||||
OrderChange(order.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
MessageLog.GetInstance.Show("果汁制作完成"); | |||||
} | |||||
} | |||||
} | |||||
private T GetDeviceStatus<T>(string key) | |||||
{ | |||||
if (peripheralStatus.ContainsKey(key)) | |||||
{ | |||||
if (peripheralStatus[key] != null) | |||||
{ | |||||
return (T)(peripheralStatus[key]); | |||||
} | |||||
} | |||||
return default; | |||||
} | |||||
#endregion | |||||
public override void SimOrder() | public override void SimOrder() | ||||
{ | { | ||||
throw new NotImplementedException(); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -11,9 +11,9 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
namespace BPASmartClient.MorkT_HQ | |||||
namespace BPASmartClient.MorkTHQ | |||||
{ | { | ||||
public class GLV_MorkT_HQ:IStatus | |||||
public class GLV_MorkTHQ:IStatus | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 咖啡订单队列 | /// 咖啡订单队列 | ||||
@@ -25,6 +25,10 @@ namespace BPASmartClient.MorkT_HQ | |||||
/// </summary> | /// </summary> | ||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesIceCream = new ConcurrentQueue<OrderLocInfo>(); | public ConcurrentQueue<OrderLocInfo> morkOrderPushesIceCream = new ConcurrentQueue<OrderLocInfo>(); | ||||
/// <summary> | /// <summary> | ||||
/// 果汁订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuice = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 等待取餐订单 | /// 等待取餐订单 | ||||
/// </summary> | /// </summary> | ||||
public OrderLocInfo waitMorkOrder = null; | public OrderLocInfo waitMorkOrder = null; | ||||
@@ -57,6 +61,16 @@ namespace BPASmartClient.MorkT_HQ | |||||
/// </summary> | /// </summary> | ||||
public bool GetIceCreamCup; | public bool GetIceCreamCup; | ||||
/// <summary> | |||||
/// 果汁机做法,true:热饮,false:冷饮 | |||||
/// </summary> | |||||
public bool GuMake = false; | |||||
/// <summary> | |||||
/// 果汁机控制信号 | |||||
/// </summary> | |||||
public byte JuicerNum; | |||||
#region | #region | ||||
[VariableMonitor("机器人连接状态")] | [VariableMonitor("机器人连接状态")] | ||||
@@ -110,9 +124,36 @@ namespace BPASmartClient.MorkT_HQ | |||||
[VariableMonitor("咖啡机故障")] | [VariableMonitor("咖啡机故障")] | ||||
public DrCoffeeFault CaffeeFault { get; set; } | public DrCoffeeFault CaffeeFault { get; set; } | ||||
[VariableMonitor("咖啡机制作进度")] | |||||
public int Coffeeprogress { get; set; } | |||||
[VariableMonitor("单片机连接状态")] | [VariableMonitor("单片机连接状态")] | ||||
public bool SCChipIsConnect { get; set; } | public bool SCChipIsConnect { get; set; } | ||||
[VariableMonitor("果汁机连接状态")] | |||||
public bool JuiceIsConnect { get; set; } | |||||
#endregion | |||||
} | |||||
public class Lebai_HQ | |||||
{ | |||||
#region 环球设备 | |||||
public const int SENCE_取咖啡杯 = 10001; | |||||
public const int SENCE_取冰淇淋杯 = 10002; | |||||
public const int SENCE_接咖啡后回原点 = 10003; | |||||
public const int SENCE_取咖啡出餐 = 10004; | |||||
public const int SENCE_接1号冰淇淋 = 10005; | |||||
public const int SENCE_放冰淇淋位置 = 10006; | |||||
public const int SENCE_取果汁杯位置 = 10007; | |||||
public const int SENCE_接果汁公共位置 = 10008; | |||||
public const int SENCE_接1号果汁位置 = 10009; | |||||
public const int SENCE_接2号果汁位置 = 10010; | |||||
public const int SENCE_接3号果汁位置 = 10011; | |||||
public const int SENCE_接4号果汁位置 = 10012; | |||||
public const int SENCE_放果汁杯位置后回原点 = 10013; | |||||
#endregion | #endregion | ||||
} | } | ||||
} | } |
@@ -4,7 +4,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
namespace BPASmartClient.MorkT_HQ | |||||
namespace BPASmartClient.MorkTHQ | |||||
{ | { | ||||
public class OrderLocInfo | public class OrderLocInfo | ||||
{ | { | ||||
@@ -16,7 +16,7 @@ namespace BPASmartClient.MorkT_HQ | |||||
public int OrderStatus { get; set; } | public int OrderStatus { get; set; } | ||||
public string MakeID { get; set; } | |||||
public OrderLocInfo() | public OrderLocInfo() | ||||
{ | { | ||||
OrderStatus = 0; | OrderStatus = 0; | ||||
@@ -8,7 +8,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
namespace BPASmartClient.MorkT_HQ | |||||
namespace BPASmartClient.MorkTHQ | |||||
{ | { | ||||
public enum GOODS_TYPE | public enum GOODS_TYPE | ||||
{ | { | ||||
@@ -29,6 +29,10 @@ namespace BPASmartClient.MorkT_HQ | |||||
internal const string ICE_MAIN_BATCHIN1_LOC = "52"; | internal const string ICE_MAIN_BATCHIN1_LOC = "52"; | ||||
internal const string ICE_MAIN_BATCHIN2_LOC = "53"; | internal const string ICE_MAIN_BATCHIN2_LOC = "53"; | ||||
internal const string ICE_MAIN_BATCHIN3_LOC = "54"; | internal const string ICE_MAIN_BATCHIN3_LOC = "54"; | ||||
//internal const string Juicer_MAIN_BATCHIN1_LOC = "52"; | |||||
//internal const string Juicer_MAIN_BATCHIN2_LOC = "53"; | |||||
//internal const string Juicer_MAIN_BATCHIN3_LOC = "54"; | |||||
//internal const string Juicer_MAIN_BATCHIN4_LOC = "55"; | |||||
internal const string COFFEE_HOLDER_LOC = "30"; | internal const string COFFEE_HOLDER_LOC = "30"; | ||||
internal const string ICE_HOLDER_LOC = "51"; | internal const string ICE_HOLDER_LOC = "51"; | ||||
public static Dictionary<string, GOODS_TYPE> GOODS_TYPES = new Dictionary<string, GOODS_TYPE>() { | public static Dictionary<string, GOODS_TYPE> GOODS_TYPES = new Dictionary<string, GOODS_TYPE>() { | ||||
@@ -1,9 +1,9 @@ | |||||
<UserControl x:Class="BPASmartClient.MorkT_HQ.View.DebugView" | |||||
<UserControl x:Class="BPASmartClient.MorkTHQ.View.DebugView" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||
xmlns:vm ="clr-namespace:BPASmartClient.MorkT_HQ.ViewModel" | |||||
xmlns:vm ="clr-namespace:BPASmartClient.MorkTHQ.ViewModel" | |||||
mc:Ignorable="d" | mc:Ignorable="d" | ||||
Name="调试界面" | Name="调试界面" | ||||
d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded"> | d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded"> | ||||
@@ -25,7 +25,7 @@ | |||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="14*"/> | <RowDefinition Height="14*"/> | ||||
<RowDefinition Height="*"/> | |||||
<RowDefinition Height="10*"/> | |||||
<RowDefinition Height="20*"/> | <RowDefinition Height="20*"/> | ||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
@@ -198,6 +198,7 @@ | |||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition /> | <RowDefinition /> | ||||
<RowDefinition /> | <RowDefinition /> | ||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="99" /> | <ColumnDefinition Width="99" /> | ||||
@@ -209,20 +210,23 @@ | |||||
<TextBlock FontSize="18" | <TextBlock FontSize="18" | ||||
Grid.Column="1" | Grid.Column="1" | ||||
Text="{Binding CoffeeStatus}" Height="23" /> | Text="{Binding CoffeeStatus}" Height="23" /> | ||||
<TextBlock Grid.Column="2" Height="23" Width="80" FontSize="18">应用状态</TextBlock> | |||||
<TextBlock Grid.Column="2" Height="23" Width="80" FontSize="18">制作任务</TextBlock> | |||||
<TextBlock FontSize="18" | <TextBlock FontSize="18" | ||||
Grid.Column="3" | Grid.Column="3" | ||||
Text="{Binding AppStatus}" Height="23"/> | |||||
Text="{Binding CoffeeAppStatus}" Height="23"/> | |||||
<TextBlock Grid.Row="1" Grid.Column="0" Height="22" Width="80" FontSize="18">告警信息</TextBlock> | <TextBlock Grid.Row="1" Grid.Column="0" Height="22" Width="80" FontSize="18">告警信息</TextBlock> | ||||
<TextBlock FontSize="15" | <TextBlock FontSize="15" | ||||
Grid.Row="1" | Grid.Row="1" | ||||
Grid.Column="1" | Grid.Column="1" | ||||
Text="{Binding Warning}" /> | |||||
<TextBlock Grid.Row="1" Grid.Column="2" Height="22" Width="80" FontSize="18">故障信息</TextBlock> | |||||
Text="{Binding CoffeeWarning}" /> | |||||
<TextBlock Grid.Row="1" Grid.Column="2" Height="22" Width="80" FontSize="18">保养信息</TextBlock> | |||||
<TextBlock FontSize="18" | <TextBlock FontSize="18" | ||||
Grid.Row="1" | Grid.Row="1" | ||||
Grid.Column="3" | Grid.Column="3" | ||||
Text="{Binding CaffeeFault}" Height="22" Width="60" /> | |||||
Text="{Binding CoffeeFault}" Height="22" Width="60" /> | |||||
<TextBlock Text="制作进度" Grid.Row="2"/> | |||||
<TextBlock Grid.Row="2" Grid.Column="1" | |||||
Text="{Binding Coffeeprogress}"/> | |||||
</Grid> | </Grid> | ||||
<StackPanel Grid.Row="2" Orientation="Vertical"> | <StackPanel Grid.Row="2" Orientation="Vertical"> | ||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | <StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | ||||
@@ -238,28 +242,41 @@ | |||||
Command="{}" | Command="{}" | ||||
Content="停止制作"/> | Content="停止制作"/> | ||||
</StackPanel> | </StackPanel> | ||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||||
<TextBlock>模式</TextBlock> | |||||
<ComboBox Margin="10,0" | |||||
Width="100" | |||||
ItemsSource="{Binding CoffeeCmds}" | |||||
SelectedItem="{Binding SelectedCoffeeCmd}"/> | |||||
<Button Margin="10,0" | |||||
Command="{}" | |||||
Content="设置" Cursor="Hand"/> | |||||
</StackPanel> | |||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"/> | |||||
</StackPanel> | </StackPanel> | ||||
</Grid> | </Grid> | ||||
</GroupBox> | </GroupBox> | ||||
<GroupBox Header="单片机控制" | |||||
<GroupBox Header="果汁机" Margin="10" | |||||
FontSize="18" | FontSize="18" | ||||
Grid.Row="1" Grid.ColumnSpan="2" | Grid.Row="1" Grid.ColumnSpan="2" | ||||
Margin="0,0,0,10" HorizontalAlignment="Right" Width="1000"> | |||||
<StackPanel Orientation="Horizontal" | |||||
VerticalAlignment="Center" > | |||||
HorizontalAlignment="Left" > | |||||
<Grid> | |||||
<Grid.ColumnDefinitions > | |||||
<ColumnDefinition Width="*"/> | |||||
<ColumnDefinition Width="*"/> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock Text="连接状态" /> | |||||
<TextBlock Text="{Binding JuiceIsConnect}" | |||||
Margin="120,0,0,0"/> | |||||
<StackPanel Orientation="Horizontal" Grid.Column="1"> | |||||
<TextBlock Text="果汁:" Margin="10"/> | |||||
<TextBlock Text="{Binding JuiceIsConnect}"/> | |||||
<ComboBox Margin="10,0" | |||||
Width="100" FontSize="16" | |||||
ItemsSource="{Binding Juice}" | |||||
SelectedItem="{Binding SelectedJuice}" | |||||
IsReadOnly="True"/> | |||||
<ComboBox Margin="10,0" | |||||
Width="49" FontSize="16" | |||||
ItemsSource="{Binding Temperature}" | |||||
SelectedItem="{Binding SelectedTemperature}" | |||||
IsReadOnly="True"/> | |||||
<Button Margin="10,0" | |||||
Command="{Binding MakeJuiceCommand}" | |||||
Content="制作"/> | |||||
</StackPanel> | |||||
</StackPanel> | |||||
</Grid> | |||||
</GroupBox> | </GroupBox> | ||||
</Grid> | </Grid> | ||||
@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging; | |||||
using System.Windows.Navigation; | using System.Windows.Navigation; | ||||
using System.Windows.Shapes; | using System.Windows.Shapes; | ||||
namespace BPASmartClient.MorkT_HQ.View | |||||
namespace BPASmartClient.MorkTHQ.View | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// MorkT_DebugView.xaml 的交互逻辑 | /// MorkT_DebugView.xaml 的交互逻辑 | ||||
@@ -1,10 +1,10 @@ | |||||
<UserControl x:Class="BPASmartClient.MorkT_HQ.View.Monitor" | |||||
<UserControl x:Class="BPASmartClient.MorkTHQ.View.Monitor" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||
xmlns:local="clr-namespace:BPASmartClient.MorkT_HQ.View" | |||||
xmlns:vm="clr-namespace:BPASmartClient.MorkT_HQ.ViewModel" | |||||
xmlns:local="clr-namespace:BPASmartClient.MorkTHQ.View" | |||||
xmlns:vm="clr-namespace:BPASmartClient.MorkTHQ.ViewModel" | |||||
mc:Ignorable="d" | mc:Ignorable="d" | ||||
Name="监控画面" | Name="监控画面" | ||||
d:DesignHeight="450" d:DesignWidth="800" Unloaded="Monitor_Unloaded"> | d:DesignHeight="450" d:DesignWidth="800" Unloaded="Monitor_Unloaded"> | ||||
@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging; | |||||
using System.Windows.Navigation; | using System.Windows.Navigation; | ||||
using System.Windows.Shapes; | using System.Windows.Shapes; | ||||
namespace BPASmartClient.MorkT_HQ.View | |||||
namespace BPASmartClient.MorkTHQ.View | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Monitor.xaml 的交互逻辑 | /// Monitor.xaml 的交互逻辑 | ||||
@@ -1,9 +1,9 @@ | |||||
<UserControl x:Class="BPASmartClient.MorkT_HQ.View.ParSer" | |||||
<UserControl x:Class="BPASmartClient.MorkTHQ.View.ParSer" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||
xmlns:local="clr-namespace:BPASmartClient.MorkT_HQ.View" | |||||
xmlns:local="clr-namespace:BPASmartClient.MorkTHQ.View" | |||||
mc:Ignorable="d" | mc:Ignorable="d" | ||||
Name="参数设置界面" | Name="参数设置界面" | ||||
d:DesignHeight="450" d:DesignWidth="800"> | d:DesignHeight="450" d:DesignWidth="800"> | ||||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||||
using System.Windows.Navigation; | using System.Windows.Navigation; | ||||
using System.Windows.Shapes; | using System.Windows.Shapes; | ||||
namespace BPASmartClient.MorkT_HQ.View | |||||
namespace BPASmartClient.MorkTHQ.View | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// ParSer.xaml 的交互逻辑 | /// ParSer.xaml 的交互逻辑 | ||||
@@ -20,7 +20,7 @@ using System.Collections.ObjectModel; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Threading; | using System.Threading; | ||||
namespace BPASmartClient.MorkT_HQ.ViewModel | |||||
namespace BPASmartClient.MorkTHQ.ViewModel | |||||
{ | { | ||||
public class DebugViewModel : ObservableObject | public class DebugViewModel : ObservableObject | ||||
{ | { | ||||
@@ -124,7 +124,7 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||||
private void Button_MakeIceCream() | private void Button_MakeIceCream() | ||||
{ | { | ||||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }); | |||||
} | } | ||||
private void Button_SetIceCreamModel() | private void Button_SetIceCreamModel() | ||||
{ | { | ||||
@@ -147,19 +147,21 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||||
/// <summary> | /// <summary> | ||||
/// 应用状态 | /// 应用状态 | ||||
/// </summary> | /// </summary> | ||||
public string AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } } | |||||
private string _appStatus { get; set; } | |||||
public string CoffeeAppStatus { get { return _coffeAappStatus; } set { _coffeAappStatus = value; OnPropertyChanged(); } } | |||||
private string _coffeAappStatus { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 告警 | /// 告警 | ||||
/// </summary> | /// </summary> | ||||
public string Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } } | |||||
public string _warning { get; set; } | |||||
public string CoffeeWarning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } } | |||||
private string _warning { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 故障信息 | /// 故障信息 | ||||
/// </summary> | /// </summary> | ||||
public string CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } } | |||||
public string _caffeeFault { get; set; } | |||||
public string CoffeeFault { get { return _coffeeFault; } set { _coffeeFault = value; OnPropertyChanged(); } } | |||||
private string _coffeeFault { get; set; } | |||||
public string Coffeeprogress { get { return _coffeeprogress; } set { _coffeeprogress = value; OnPropertyChanged(); } } | |||||
private string _coffeeprogress { get; set; } | |||||
public List<string> Coffees { get; set; } = new List<string>(); | public List<string> Coffees { get; set; } = new List<string>(); | ||||
public string SelectedCoffee { get; set; } | public string SelectedCoffee { get; set; } | ||||
@@ -235,6 +237,65 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||||
#endregion | #endregion | ||||
#region 果汁机 | |||||
/// <summary> | |||||
/// 果汁机连接状态 | |||||
/// </summary> | |||||
public string JuiceIsConnect { get { return _juiceIsConnect; } set { _juiceIsConnect = value; OnPropertyChanged(); } } | |||||
private string _juiceIsConnect { get; set; } | |||||
public List<string> Juice { get; set; } = new List<string>() { "果汁1", "果汁2", "果汁3", "果汁4" }; | |||||
public string SelectedJuice { get; set; } = "果汁1"; | |||||
public List<string> Temperature { get; set; } = new List<string>() { "冷", "热" }; | |||||
public string SelectedTemperature { get; set; } = "冷"; | |||||
public RelayCommand MakeJuiceCommand { get; set; } | |||||
private void MakeJuice() | |||||
{ | |||||
switch (SelectedJuice) | |||||
{ | |||||
case "果汁1": | |||||
if (SelectedTemperature == "冷") | |||||
{ | |||||
MakeJuiceEvent(0x01); | |||||
} | |||||
else MakeJuiceEvent(0x00); | |||||
break; | |||||
case "果汁2": | |||||
if (SelectedTemperature == "冷") | |||||
{ | |||||
MakeJuiceEvent(0x03); | |||||
} | |||||
else MakeJuiceEvent(0x02); | |||||
break; | |||||
case "果汁3": | |||||
if (SelectedTemperature == "冷") | |||||
{ | |||||
MakeJuiceEvent(0x05); | |||||
} | |||||
else MakeJuiceEvent(0x04); | |||||
break; | |||||
case "果汁4": | |||||
if (SelectedTemperature == "冷") | |||||
{ | |||||
MakeJuiceEvent(0x07); | |||||
} | |||||
else MakeJuiceEvent(0x06); | |||||
break; | |||||
default: | |||||
MakeJuiceEvent(0x00); | |||||
break; | |||||
} | |||||
} | |||||
private void MakeJuiceEvent(byte b) | |||||
{ | |||||
EventBus.EventBus.GetInstance().Publish(new WriteJuicer { DeviceId = DeviceId, Value = b }); | |||||
} | |||||
#endregion | |||||
/// <summary> | /// <summary> | ||||
/// 设备ID | /// 设备ID | ||||
/// </summary> | /// </summary> | ||||
@@ -266,7 +327,9 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||||
Button_SCChipDischarge(); | Button_SCChipDischarge(); | ||||
}); | }); | ||||
foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode))) | |||||
MakeJuiceCommand = new RelayCommand(MakeJuice); | |||||
foreach (DrinkType code in Enum.GetValues(typeof(DrinkType))) | |||||
{ | { | ||||
Coffees.Add(code.ToString()); | Coffees.Add(code.ToString()); | ||||
} | } | ||||
@@ -283,9 +346,11 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||||
} | } | ||||
SelecteIceCreamdMode = IceCreamModes[0]; | SelecteIceCreamdMode = IceCreamModes[0]; | ||||
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device => | Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device => | ||||
{ | { | ||||
if (device.Name == "MorkT") DeviceId = device.DeviceId | |||||
if (device.Name == "MorkTHQ") DeviceId = device.DeviceId | |||||
; | ; | ||||
}); | }); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -299,13 +364,15 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||||
IceCreamConnected = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | IceCreamConnected = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | ||||
CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | ||||
SCChipIsConnect = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | SCChipIsConnect = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | ||||
JuiceIsConnect = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||||
RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue; | RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue; | ||||
CoffeeStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机状态").CurrentValue; | CoffeeStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机状态").CurrentValue; | ||||
AppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue; | |||||
Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue; | |||||
CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue; | |||||
CoffeeAppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue; | |||||
CoffeeWarning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue; | |||||
CoffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue; | |||||
Coffeeprogress = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机制作进度").CurrentValue; | |||||
YLWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器预冷温度").CurrentValue; | YLWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器预冷温度").CurrentValue; | ||||
HQWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器回气温度").CurrentValue; | HQWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器回气温度").CurrentValue; | ||||
@@ -12,7 +12,7 @@ using System.Threading.Tasks; | |||||
using System.Windows.Data; | using System.Windows.Data; | ||||
using System.Windows.Media; | using System.Windows.Media; | ||||
namespace BPASmartClient.MorkT_HQ.ViewModel | |||||
namespace BPASmartClient.MorkTHQ.ViewModel | |||||
{ | { | ||||
public class MonitorViewModel: ObservableObject | public class MonitorViewModel: ObservableObject | ||||
@@ -1,5 +1,6 @@ | |||||
| | ||||
using BPASmartClient.EventBus; | using BPASmartClient.EventBus; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model.单片机; | using BPASmartClient.Model.单片机; | ||||
using BPASmartClient.Model.单片机.Enum; | using BPASmartClient.Model.单片机.Enum; | ||||
using BPASmartClient.SCChip; | using BPASmartClient.SCChip; | ||||
@@ -148,6 +149,7 @@ namespace BPASmartClient.SCChip | |||||
package.Cmd = IC_CMD.TAKE_CUP; | package.Cmd = IC_CMD.TAKE_CUP; | ||||
package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup; | package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup; | ||||
commProxy.SendData(StructureToByte(package)); | commProxy.SendData(StructureToByte(package)); | ||||
MessageLog.GetInstance.Show($"发送落杯指令--{(@event as SCChip_TakeCupEvent).Cup}"); | |||||
bool wait = true; | bool wait = true; | ||||
var waitTimeout = DateTime.Now.AddSeconds(3); | var waitTimeout = DateTime.Now.AddSeconds(3); | ||||
@@ -166,7 +168,7 @@ namespace BPASmartClient.SCChip | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
Thread.Sleep(10); | |||||
Thread.Sleep(50); | |||||
} | } | ||||
} | } | ||||
@@ -144,7 +144,7 @@ namespace BPASmartClient.SCChip | |||||
} | } | ||||
continue; | continue; | ||||
} | } | ||||
Thread.Sleep(5); | |||||
Thread.Sleep(10); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -281,7 +281,7 @@ namespace BPASmartClient.SCChip | |||||
package.Cmd = IC_CMD.TAKE_CUP; | package.Cmd = IC_CMD.TAKE_CUP; | ||||
package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup; | package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup; | ||||
commProxy.SendData(StructureToByte(package)); | commProxy.SendData(StructureToByte(package)); | ||||
MessageLog.GetInstance.Show($"发送落杯指令--{(@event as SCChip_TakeCupEvent).Cup}"); | |||||
bool wait = true; | bool wait = true; | ||||
var waitTimeout = DateTime.Now.AddSeconds(3); | var waitTimeout = DateTime.Now.AddSeconds(3); | ||||
while (wait) | while (wait) | ||||
@@ -351,7 +351,7 @@ namespace BPASmartClient.SCChip | |||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
} | } | ||||
Thread.Sleep(1700); | |||||
Thread.Sleep(1800); | |||||
switch ((IC_SE)(@event as SCChip_MakeIceCreamEvent).SteeringEngine) | switch ((IC_SE)(@event as SCChip_MakeIceCreamEvent).SteeringEngine) | ||||
{ | { | ||||
case IC_SE.SE_1: | case IC_SE.SE_1: | ||||
@@ -92,7 +92,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.JAKA", "BPAS | |||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Juicer", "BPASmartClient.Juicer\BPASmartClient.Juicer.csproj", "{C28A88B1-E449-484C-AC67-B5038FF2CA79}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Juicer", "BPASmartClient.Juicer\BPASmartClient.Juicer.csproj", "{C28A88B1-E449-484C-AC67-B5038FF2CA79}" | ||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_HQ", "BPASmartClient.MorkT_HQ\BPASmartClient.MorkT_HQ.csproj", "{00C17D87-A323-4A97-BC21-7039E55614DE}" | |||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTHQ", "BPASmartClient.MorkT_HQ\BPASmartClient.MorkTHQ.csproj", "{00C17D87-A323-4A97-BC21-7039E55614DE}" | |||||
EndProject | EndProject | ||||
Global | Global | ||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||