瀏覽代碼

Merge branch 'master' of http://111.9.47.105:10244/bpa/BPASmartClient

样式分支
pry 2 年之前
父節點
當前提交
9d2acb2834
共有 10 個文件被更改,包括 353 次插入187 次删除
  1. +14
    -15
      BPASmartClient.DRCoffee/CoffeeMachine.cs
  2. +33
    -27
      BPASmartClient.GSIceCream/IceCreamMachine.cs
  3. +17
    -0
      BPASmartClient.IoT/DataVClient.cs
  4. +5
    -5
      BPASmartClient.Lebai/LebaiRobot.cs
  5. +2
    -2
      BPASmartClient.Model/单片机/Enum/IC_CUP.cs
  6. +191
    -59
      BPASmartClient.MorkT/Control_MorkT.cs
  7. +18
    -18
      BPASmartClient.MorkT/GLV_MorkT.cs
  8. +67
    -60
      BPASmartClient.MorkT/ViewModel/DebugViewModel.cs
  9. +3
    -1
      BPASmartClient/Control/DataVView.xaml
  10. +3
    -0
      BPASmartClient/Control/DataVView.xaml.cs

+ 14
- 15
BPASmartClient.DRCoffee/CoffeeMachine.cs 查看文件

@@ -142,24 +142,23 @@ namespace BPASmartClient.DRCoffee
public void ProcessPackage(DrCoffeePackage package)
{
if (((DrCoffeeStatus)status["Status"]) == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running)
if (((DrCoffeeStatus)status["CoffeeStatus"]) == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running)
{
status["Status"] = package.Status;
status["CoffeeStatus"] = package.Status;
lastRefreshTime = DateTime.Now;
IsConnected = OnLine;
status["CoffeConnected"] = OnLine;
new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId }.Publish();
}
else status["Status"] = package.Status;
status["AppStatus"] = package.ApplicationStatus;
status["Warning"] = package.Warning;
status["Fault"] = package.Fault;
else status["CoffeeStatus"] = package.Status;
status["CoffeeAppStatus"] = package.ApplicationStatus;
status["CoffeeWarning"] = package.Warning;
status["CoffeeFault"] = package.Fault;
if ((DrCoffeeStatus)status["Status"] == DrCoffeeStatus.Warning
|| (DrCoffeeStatus)status["Status"] == DrCoffeeStatus.Fault
|| (DrCoffeeWarning)status["Warning"] != DrCoffeeWarning.无警告
|| (DrCoffeeFault)status["Fault"] != DrCoffeeFault.无故障
if ((DrCoffeeStatus)status["CoffeeStatus"] == DrCoffeeStatus.Warning
|| (DrCoffeeStatus)status["CoffeeStatus"] == DrCoffeeStatus.Fault
|| (DrCoffeeWarning)status["CoffeeWarning"] != DrCoffeeWarning.无警告
|| (DrCoffeeFault)status["CoffeeFault"] != DrCoffeeFault.无故障
)
{
IsWork = false;
@@ -170,10 +169,10 @@ namespace BPASmartClient.DRCoffee

protected override void InitStatus()
{
status["Status"] = DrCoffeeStatus.Wait;
status["AppStatus"] = DrCoffeeAppStatus.应用无状态;
status["Warning"] = DrCoffeeWarning.无警告;
status["Fault"] = DrCoffeeFault.无故障;
status["CoffeeStatus"] = DrCoffeeStatus.Wait;
status["CoffeeAppStatus"] = DrCoffeeAppStatus.应用无状态;
status["CoffeeWarning"] = DrCoffeeWarning.无警告;
status["CoffeeFault"] = DrCoffeeFault.无故障;
}

public override void Init()


+ 33
- 27
BPASmartClient.GSIceCream/IceCreamMachine.cs 查看文件

@@ -178,21 +178,21 @@ namespace BPASmartClient.GSIceCream
{
IsConnected = OnLine;
status["IceCreamIsConnected"] = OnLine;
status["CurrentMode"] = heartUpMsg.MS;
status["YLWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.YLWD_L,heartUpMsg.YLWD_H },0);
status["HQWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HQWD_L,heartUpMsg.HQWD_H },0);
status["HJWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L,heartUpMsg.HJWD_H },0);
status["DL"] = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0);
status["Fault"] = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L,heartUpMsg.GZ_H },0);
status["CXB"] = heartUpMsg.CXB;
status["DLCompleted"] = (heartUpMsg.DLTJ >> 4 & 1) == 1;
status["IceCreamCurrentMode"] = heartUpMsg.MS;
status["IceCreamYLWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.YLWD_L,heartUpMsg.YLWD_H },0);
status["IceCreamHQWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HQWD_L,heartUpMsg.HQWD_H },0);
status["IceCreamHJWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L,heartUpMsg.HJWD_H },0);
status["IceCreamDL"] = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0);
status["IceCreamFault"] = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L,heartUpMsg.GZ_H },0);
status["IceCreamCXB"] = heartUpMsg.CXB;
status["IceCreamDLCompleted"] = (heartUpMsg.DLTJ >> 4 & 1) == 1;

if (RTrig.GetInstance("打料完成检测").Start((bool)status["DLCompleted"]))
if (RTrig.GetInstance("打料完成检测").Start((bool)status["IceCreamDLCompleted"]))
{
MessageLog.GetInstance.Show("打料完成");
}

if (RTrig.GetInstance("打料中检测").Start(!(bool)status["DLCompleted"]))
if (RTrig.GetInstance("打料中检测").Start(!(bool)status["IceCreamDLCompleted"]))
{
MessageLog.GetInstance.Show("打料中");
}
@@ -231,16 +231,17 @@ namespace BPASmartClient.GSIceCream

protected override void InitStatus()
{
status["YLWD"] = (short)0;
status["HQWD"] = (short)0;
status["HJWD"] = (short)0;
status["DL"] = (short)0;
status["DY"] = (short)0;
status["CurrentMode"] = MORKI_MODE.待机模式;
status["Fault"] = MORKI_FAULT.未发生故障;
status["CXB"] = (byte)0;
status["CXB_Threshold"] = (byte)0;
status["DLCompleted"] = true;
status["IceCreamYLWD"] = (short)0;
status["IceCreamHQWD"] = (short)0;
status["IceCreamHJWD"] = (short)0;
status["IceCreamDL"] = (short)0;
status["IceCreamDY"] = (short)0;
status["IceCreamCurrentMode"] = MORKI_MODE.待机模式;
status["IceCreamFault"] = MORKI_FAULT.未发生故障;
status["IceCreamCXB"] = (byte)0;
status["IceCreamCXB_Threshold"] = (byte)0;
status["IceCreamDLCompleted"] = true;
status["IceCreamIsConnected"] = false;
}

public override void Init()
@@ -272,20 +273,22 @@ namespace BPASmartClient.GSIceCream
{
try
{
if ((MORKI_FAULT)status["Fault"] != MORKI_FAULT.未发生故障)
if ((MORKI_FAULT)status["IceCreamFault"] != MORKI_FAULT.未发生故障)
{
MessageLog.GetInstance.Show(string.Format("当前存在故障[{0}%],不允许制作",(MORKI_FAULT)status["Fault"]));
MessageLog.GetInstance.Show(string.Format("当前存在故障[{0}%],不允许制作",(MORKI_FAULT)status["IceCreamFault"]));
new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status = false }.Publish();
callBack?.Invoke(false);
return;
}
if ((byte)status["CXB"] <= 86)
if ((byte)status["IceCreamCXB"] <= 86)
{
MessageLog.GetInstance.Show(string.Format("当前成型比[{0}%],低于86%,不允许制作",(byte)status["CXB"]));
MessageLog.GetInstance.Show(string.Format("当前成型比[{0}%],低于86%,不允许制作",(byte)status["IceCreamCXB"]));
new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status = false }.Publish();
callBack?.Invoke(false );
return;
}

bool modeRight = (MORKI_MODE)status["CurrentMode"] == MORKI_MODE.制冷模式;
bool modeRight = (MORKI_MODE)status["IceCreamCurrentMode"] == MORKI_MODE.制冷模式;

if (!modeRight)
{
@@ -303,7 +306,7 @@ namespace BPASmartClient.GSIceCream
while (DateTime.Now < freeTime)
{
Thread.Sleep(10);
modeRight = (MORKI_MODE)status["CurrentMode"] == MORKI_MODE.制冷模式;
modeRight = (MORKI_MODE)status["IceCreamCurrentMode"] == MORKI_MODE.制冷模式;
if (modeRight)
break;
}
@@ -319,16 +322,19 @@ namespace BPASmartClient.GSIceCream
free = false;
new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status =true}.Publish();
MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]",MORKI_MODE.打料));
callBack?.Invoke(true);
}
else
{
MessageLog.GetInstance.Show(string.Format("出料操作->模式切换失败,当前模式[{0}],不允许出料",(MORKI_MODE)status["CurrentMode"]));
MessageLog.GetInstance.Show(string.Format("出料操作->模式切换失败,当前模式[{0}],不允许出料",(MORKI_MODE)status["IceCreamCurrentMode"]));
new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status = false }.Publish();
callBack?.Invoke(false);
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.GSIceCream 中引发错误,IceCreamMachine 类,描述:[{ex.Message}]");
callBack?.Invoke(false);
}
});
InitStatus();


+ 17
- 0
BPASmartClient.IoT/DataVClient.cs 查看文件

@@ -91,6 +91,23 @@ namespace BPASmartClient.IoT

#region API调用
/// <summary>
/// 刷新店铺列表
/// </summary>
public void RefreshTheListOfStores()
{
try
{
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null)
{
DeviceDataV.IOT_Publish(BroadcastPubTopic, Tools.JsonConvertTools("刷新店铺列表"));
}
}
catch (Exception ex)
{
MessageLog.GetInstance.Show(ex.Message);
}
}
/// <summary>
/// 增加告警信息
/// </summary>
/// <param name="alarmTable"></param>


+ 5
- 5
BPASmartClient.Lebai/LebaiRobot.cs 查看文件

@@ -46,8 +46,8 @@ namespace BPASmartClient.Lebai
{
IsConnected = LebaiHelper.GetInstance().IsConnected;
status["RobotIsConnected"] = LebaiHelper.GetInstance().IsConnected;
status["OK"] = LebaiHelper.GetInstance().GetValueAsync().Ok;
status["Value"] = LebaiHelper.GetInstance().GetValueAsync().Value;
status["RobotOK"] = LebaiHelper.GetInstance().GetValueAsync().Ok;
status["RobotValue"] = LebaiHelper.GetInstance().GetValueAsync().Value;
if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] = LebaiHelper.GetInstance().robotData.RobotMode.Mode;
LebaiHelper.GetInstance().GetRobotModeStatus();
Thread.Sleep(10);
@@ -76,12 +76,12 @@ namespace BPASmartClient.Lebai
}
});
//获取Tcp信号
EventBus.EventBus.GetInstance().Subscribe<Demo_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_GetTCPInputEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is LebaiRobot_GetInputEvent getTCPInput)
if (@event is LebaiRobot_GetTCPInputEvent getTCPInput)
{
callBack.Invoke(LebaiHelper.GetInstance().GetTcpInput(getTCPInput.Pin));
callBack?.Invoke(LebaiHelper.GetInstance().GetTcpInput(getTCPInput.Pin));
}
});
//机器人输入信号


+ 2
- 2
BPASmartClient.Model/单片机/Enum/IC_CUP.cs 查看文件

@@ -14,10 +14,10 @@ namespace BPASmartClient.Model.单片机.Enum
/// <summary>
/// 冰淇淋杯
/// </summary>
CUP_ICECREAM = 0x01,
CUP_ICECREAM = 0x02,
/// <summary>
/// 咖啡杯
/// </summary>
CUP_COFFEE = 0x02
CUP_COFFEE = 0x01
}
}

+ 191
- 59
BPASmartClient.MorkT/Control_MorkT.cs 查看文件

@@ -1,5 +1,6 @@
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.DRCoffee;
using BPASmartClient.EventBus;
using BPASmartClient.GSIceCream;
using BPASmartClient.Helper;
@@ -31,6 +32,10 @@ namespace BPASmartClient.MorkT

public override void DoMain()
{
if(Json<KeepDataBase>.Data.IsVerify)
{
IsHealth = true;
}
IsHealth = true;
ServerInit();
DataParse();
@@ -84,9 +89,132 @@ namespace BPASmartClient.MorkT

public override void ReadData()
{
GetStatus("IsConnected", new Action<object>((o) =>
GetStatus("RobotIsConnected", new Action<object>((o) =>
{
if (o is bool b)
{
morkT.RobotIsConnected = b;
}
}));

GetStatus("RobotMode", new Action<object>((o) =>
{
if (o is ELebaiRModel eLebaiRModel)
{
morkT.RobotMode = eLebaiRModel;
}
}));


GetStatus("IceCreamIsConnected", new Action<object>((o) =>
{
if (o is bool b)
{
morkT.IceCreamIsConnected = b;
}
}));

GetStatus("IceCreamYLWD", new Action<object>((o) =>
{
if (o is short s)
{
morkT.YLWD = s;
}
}));

GetStatus("IceCreamHQWD", new Action<object>((o) =>
{
if (o is short s)
{
morkT.HQWD = s;
}
}));

GetStatus("IceCreamDL", new Action<object>((o) =>
{
if (o is short s)
{
morkT.DL = s;
}
}));

GetStatus("IceCreamDY", new Action<object>((o) =>
{
if (o is short s)
{
morkT.DY = s;
}
}));

GetStatus("IceCreamCXB", new Action<object>((o) =>
{
if (o is byte bt)
{
morkT.CBX = bt;
}
}));

GetStatus("IceCreamCurrentMode", new Action<object>((o) =>
{
if (o is MORKI_MODE mORKI_MODE)
{
morkT.IceCreamMode = mORKI_MODE;
}
}));

GetStatus("IceCreamFault", new Action<object>((o) =>
{
if (o is MORKI_FAULT mORKI_FAULT)
{
morkT.IceCreamFault = mORKI_FAULT;
}
}));

GetStatus("IceCreamDLCompleted", new Action<object>((o) =>
{
if (o is bool b)
{
morkT.DLCompleted = b;
}
}));

GetStatus("CoffeeIsConnected", new Action<object>((o) =>
{
if (o is bool b)
{
morkT.CoffeeIsConnected = b;
}
}));

GetStatus("CoffeeStatus", new Action<object>((o) =>
{
if (o is DrCoffeeStatus coffeeStatus)
{
morkT.DrCoffeeStatus = coffeeStatus;
}
}));

GetStatus("CoffeeAppStatus", new Action<object>((o) =>
{
if (o is DrCoffeeAppStatus appStatus)
{
morkT.CoffeeAppStatus = appStatus;
}
}));

GetStatus("CoffeeWarning", new Action<object>((o) =>
{
if (o is DrCoffeeWarning coffeeWarning)
{
morkT.CoffeeWarning = coffeeWarning;
}
}));
GetStatus("CoffeeFault", new Action<object>((o) =>
{
if (o is DrCoffeeFault coffeeFault)
{
morkT.CaffeeFault = coffeeFault;
}
}));
}

@@ -137,7 +265,7 @@ namespace BPASmartClient.MorkT
morkT.batchings = PolymerBatching.BuildAll();
//商品类型
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER;
string loc_Goods = string.Empty;
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
@@ -149,42 +277,45 @@ namespace BPASmartClient.MorkT
//获取当前物料所属商品类型
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc);
}
string loc_Goods = string.Empty;
//获取主料和容器位置
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;
}
}
}
}

@@ -212,7 +343,7 @@ namespace BPASmartClient.MorkT

private void Wait(int value = 101)
{
while (!((bool)peripheralStatus["OK"] && (int)peripheralStatus["Value"] == value))
while (!((bool)peripheralStatus["RobotOK"] && (int)peripheralStatus["RobotValue"] == value))
{
Thread.Sleep(5);
}
@@ -239,11 +370,11 @@ namespace BPASmartClient.MorkT
if (morkT.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc))
{
DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]");
GetAndCheeckCoffe(orderLoc);
GetAndCheeckCoffe(orderLoc);//取咖啡杯
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10051}); //接咖啡后回原点
Wait();
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}!");
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc;
}
@@ -296,7 +427,7 @@ namespace BPASmartClient.MorkT
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯

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);
DeviceProcessLogShow("尝试取咖啡杯!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
@@ -328,7 +459,7 @@ namespace BPASmartClient.MorkT
DeviceProcessLogShow("执行二次取咖啡杯");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯
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 });
count++;
goto p;
@@ -353,14 +484,14 @@ namespace BPASmartClient.MorkT
{
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;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
@@ -407,7 +538,7 @@ namespace BPASmartClient.MorkT
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10032 }); //SENCE_取冰淇淋杯
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);
DeviceProcessLogShow("尝试取冰淇淋杯!");

@@ -445,7 +576,7 @@ namespace BPASmartClient.MorkT
}
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!");
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();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
count++;
@@ -461,17 +592,17 @@ namespace BPASmartClient.MorkT
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 });
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10039 }); //SENCE_接1号冰淇淋
Wait();
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)
{
IceCreamCookCheck();
@@ -480,7 +611,7 @@ namespace BPASmartClient.MorkT
{
int count_1 = 0;

while ((short)peripheralStatus["CBX"] <= 86)
while ((byte)peripheralStatus["IceCreamCXB"] <= 86)
{
Thread.Sleep(5);
count_1++;
@@ -523,19 +654,20 @@ namespace BPASmartClient.MorkT
/// </summary>
public void IceCreamCookCheck()
{
bool result = true;
bool result = false;
int retry = 3;
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)
{
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("超时未出料,重试次数用尽");
break;
@@ -543,7 +675,7 @@ namespace BPASmartClient.MorkT
if (DateTime.Now.Subtract(beginTime).TotalSeconds > 5)
{
DeviceProcessLogShow("超时未出料,重新发送打料指令");
new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.打料 }.Publish();
EventBus.EventBus.GetInstance().Publish( new GSIceCream_ModeSetEvent() { DeviceId =DeviceId, Mode = MORKI_MODE.打料 });
beginTime = DateTime.Now;
retry--;
}


+ 18
- 18
BPASmartClient.MorkT/GLV_MorkT.cs 查看文件

@@ -48,55 +48,55 @@ namespace BPASmartClient.MorkT
#region

[VariableMonitor("机器人连接状态")]
public bool RobotIsConnected;
public bool RobotIsConnected { get; set; }

[VariableMonitor("机器人状态")]
public ELebaiRModel RobotMode;
public ELebaiRModel RobotMode { get; set; }

[VariableMonitor("冰淇淋连接状态")]
public bool IceCreamIsConnected;
public bool IceCreamIsConnected { get; set; }

[VariableMonitor("冰淇淋机器预冷温度")]
public short YLWD;
public short YLWD { get; set; }

[VariableMonitor("冰淇淋机器回气温度")]
public short HQWD;
public short HQWD { get; set; }

[VariableMonitor("冰淇淋机器环境温度")]
public short HJWD;
public short HJWD { get; set; }

[VariableMonitor("冰淇淋机器电流")]
public short DL;
public short DL { get; set; }

[VariableMonitor("冰淇淋机器电压")]
public bool DY;
public short DY { get; set; }

[VariableMonitor("冰淇淋机器成型比")]
public byte CBX;
public byte CBX { get; set; }

[VariableMonitor("冰淇淋机器模式")]
public MORKI_MODE IceCreamMode;
public MORKI_MODE IceCreamMode { get; set; }

[VariableMonitor("冰淇淋机器故障")]
public MORKI_FAULT IceCreamFault;
public MORKI_FAULT IceCreamFault { get; set; }

[VariableMonitor("冰淇淋机器打料是否完成")]
public bool DLCompleted;
[VariableMonitor("冰淇淋机器打料完成")]
public bool DLCompleted { get; set; }

[VariableMonitor("咖啡机连接状态")]
public bool CoffeeIsConnected;
public bool CoffeeIsConnected { get; set; }

[VariableMonitor("咖啡机状态")]
public DrCoffeeStatus DrCoffeeStatus;
public DrCoffeeStatus DrCoffeeStatus { get; set; }

[VariableMonitor("咖啡机应用状态")]
public DrCoffeeAppStatus CoffeeAppStatus;
public DrCoffeeAppStatus CoffeeAppStatus { get; set; }

[VariableMonitor("咖啡机告警")]
public DrCoffeeWarning CoffeeWarning;
public DrCoffeeWarning CoffeeWarning { get; set; }

[VariableMonitor("咖啡机故障")]
public DrCoffeeFault CaffeeFault;
public DrCoffeeFault CaffeeFault { get; set; }

#endregion
}


+ 67
- 60
BPASmartClient.MorkT/ViewModel/DebugViewModel.cs 查看文件

@@ -1,4 +1,5 @@
using BPASmartClient.Business;
using BPASmartClient.Device;
using BPASmartClient.DRCoffee;
using BPASmartClient.EventBus;
using BPASmartClient.GSIceCream;
@@ -13,16 +14,15 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;

namespace BPASmartClient.MorkT.ViewModel
{
public class DebugViewModel : ObservableObject
{
/// <summary>
/// 设备ID
/// </summary>
int DeviceId { get; set; }
#region 乐白机器人
/// <summary>
/// 乐白机器人连接状态
@@ -32,8 +32,8 @@ namespace BPASmartClient.MorkT.ViewModel
/// <summary>
/// 乐白机器人的模式状态
/// </summary>
public ELebaiRModel RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } }
private ELebaiRModel _robotMode { get; set; }
public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } }
private string _robotMode { get; set; }
/// <summary>
/// 机器人控制指令
/// </summary>
@@ -67,43 +67,43 @@ namespace BPASmartClient.MorkT.ViewModel
/// <summary>
/// 预冷温度
/// </summary>
public short YLWD { get { return _yLWD; } set { _yLWD = value; OnPropertyChanged(); } }
private short _yLWD { get; set; }
public string YLWD { get { return _yLWD; } set { _yLWD = value; OnPropertyChanged(); } }
private string _yLWD { get; set; }
/// <summary>
/// 回气温度
/// </summary>
public short HQWD { get { return _hQWD; } set { _hQWD = value; OnPropertyChanged(); } }
private short _hQWD { get; set; }
public string HQWD { get { return _hQWD; } set { _hQWD = value; OnPropertyChanged(); } }
private string _hQWD { get; set; }
/// <summary>
/// 环境温度
/// </summary>
public short HJWD { get { return _hJWD; } set { _hJWD = value; OnPropertyChanged(); } }
private short _hJWD { get; set; }
public string HJWD { get { return _hJWD; } set { _hJWD = value; OnPropertyChanged(); } }
private string _hJWD { get; set; }
/// <summary>
/// 电流
/// </summary>
public short DL { get { return _DL; } set { _DL = value; OnPropertyChanged(); } }
private short _DL { get; set; }
public string DL { get { return _DL; } set { _DL = value; OnPropertyChanged(); } }
private string _DL { get; set; }
/// <summary>
/// 电压
/// </summary>
public short DY { get { return _dy; } set { _dy = value; OnPropertyChanged(); } }
private short _dy { get; set; }
public string DY { get { return _dy; } set { _dy = value; OnPropertyChanged(); } }
private string _dy { get; set; }
/// <summary>
/// 当前模式
/// </summary>
public MORKI_MODE CurrentMode { get { return _CurrentMode; } set { _CurrentMode = value; OnPropertyChanged(); } }
private MORKI_MODE _CurrentMode;
public string CurrentMode { get { return _CurrentMode; } set { _CurrentMode = value; OnPropertyChanged(); } }
private string _CurrentMode;
/// <summary>
/// 故障
/// </summary>
public MORKI_FAULT IceCreamFault { get { return _IceCreamFault; } set { _IceCreamFault = value; OnPropertyChanged(); } }
private MORKI_FAULT _IceCreamFault { get; set; }
public string IceCreamFault { get { return _IceCreamFault; } set { _IceCreamFault = value; OnPropertyChanged(); } }
private string _IceCreamFault { get; set; }
/// <summary>
/// 成型比
/// </summary>
public byte CXB { get { return _cXB; } set { _cXB = value; OnPropertyChanged(); } }
private byte _cXB { get; set; }
public string CXB { get { return _cXB; } set { _cXB = value; OnPropertyChanged(); } }
private string _cXB { get; set; }
/// <summary>
/// 打料完成状态
/// </summary>
@@ -133,23 +133,23 @@ namespace BPASmartClient.MorkT.ViewModel
/// <summary>
/// 咖啡机状态
/// </summary>
public DrCoffeeStatus CoffeeStatus { get { return _coffeeStatus; } set { _coffeeStatus = value; OnPropertyChanged(); } }
private DrCoffeeStatus _coffeeStatus { get; set; }
public string CoffeeStatus { get { return _coffeeStatus; } set { _coffeeStatus = value; OnPropertyChanged(); } }
private string _coffeeStatus { get; set; }
/// <summary>
/// 应用状态
/// </summary>
public DrCoffeeAppStatus AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } }
private DrCoffeeAppStatus _appStatus { get; set; }
public string AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } }
private string _appStatus { get; set; }
/// <summary>
/// 告警
/// </summary>
public DrCoffeeWarning Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } }
public DrCoffeeWarning _warning { get; set; }
public string Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } }
public string _warning { get; set; }
/// <summary>
/// 故障信息
/// </summary>
public DrCoffeeFault CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } }
public DrCoffeeFault _caffeeFault { get; set; }
public string CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } }
public string _caffeeFault { get; set; }

public List<string> Coffees { get; set; } = new List<string>();
public string SelectedCoffee { get; set; }
@@ -158,9 +158,13 @@ namespace BPASmartClient.MorkT.ViewModel
public string SelectedCoffeeCmd { get; set; }
#endregion

/// <summary>
/// 设备ID
/// </summary>
public int DeviceId { get; set; }

public ObservableCollection<VariableMonitor> variableMonitors { get; set; }

Dictionary<string, object> CurrentData { get; set; }
public DebugViewModel()
{
Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl);
@@ -184,38 +188,41 @@ namespace BPASmartClient.MorkT.ViewModel
}
SelecteIceCreamdMode = IceCreamModes[0];

Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
{
if (device.Name == "MorkT") DeviceId = device.DeviceId
;
});



ThreadManage.GetInstance().StartLong(new Action(() =>
{
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
{
CurrentData?.Clear();
if (device.Name == "MorkT") CurrentData = device.Status.GetStatus();
DeviceId = device.DeviceId;
});
if (CurrentData != null && CurrentData.Count != 0)

variableMonitors = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;

if (variableMonitors != null && variableMonitors.Count > 0)
{
RobotConnected = (bool)CurrentData["Lebai.LebaiRobot.IsConnected"] ? "已连接" : "未连接";
//IceCreamConnected = (bool)CurrentData["GSIceCream.IceCreamMachine.IsConnected"] ? "已连接" : "未连接";
//CoffeeConnected = (bool)CurrentData["GSIceCream.IceCreamMachine.IsConnected"] ? "已连接" : "未连接";
RobotMode = (ELebaiRModel)CurrentData["Lebai.LebaiRobot.RobotMode"];
//CoffeeStatus = (DrCoffeeStatus)CurrentData["DRCoffee.CoffeeMachine.Status"];
//AppStatus = (DrCoffeeAppStatus)CurrentData["DRCoffee.CoffeeMachine.AppStatus"];
//Warning = (DrCoffeeWarning)CurrentData["DRCoffee.CoffeeMachine.Warning"];
//CaffeeFault = (DrCoffeeFault)CurrentData["DRCoffee.CoffeeMachine.Fault"];
//YLWD = (short)CurrentData["GSIceCream.IceCreamMachine.YLWD"];
//HQWD = (short)CurrentData["GSIceCream.IceCreamMachine.HQWD"];
//HJWD = (short)CurrentData["GSIceCream.IceCreamMachine.HJWD"];
//DL = (short)CurrentData["GSIceCream.IceCreamMachine.DL"];
//DY = (short)CurrentData["GSIceCream.IceCreamMachine.DY"];
//CurrentMode = (MORKI_MODE)CurrentData["GSIceCream.IceCreamMachine.CurrentMode"];
//IceCreamFault = (MORKI_FAULT)CurrentData["GSIceCream.IceCreamMachine.Fault"];
//CXB = (byte)CurrentData["GSIceCream.IceCreamMachine.CXB"];
//DLCompleted = (bool)CurrentData["GSIceCream.IceCreamMachine.DLCompleted"] ? "打料完成" : "打料中";
RobotConnected = variableMonitors.FirstOrDefault(p=>p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接";
IceCreamConnected = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋连接状态").CurrentValue == "True" ? "已连接" : "未连接";
CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
RobotMode = 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;
YLWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器预冷温度").CurrentValue;
HQWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器回气温度").CurrentValue;
HJWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器环境温度").CurrentValue;
DL = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电流").CurrentValue;
DY = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电压").CurrentValue;
CurrentMode = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器模式").CurrentValue;
IceCreamFault = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器故障").CurrentValue;
CXB = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器成型比").CurrentValue;
DLCompleted = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器打料完成")?.CurrentValue == "True" ? "打料完成" : "打料中";
}
Thread.Sleep(500);


+ 3
- 1
BPASmartClient/Control/DataVView.xaml 查看文件

@@ -85,7 +85,9 @@
<Button Margin="80,0,0,0" Tag="Save" Click="Button_Click" >保存text</Button>
<Button Margin="20,0,0,0" Tag="Insert" Click="Button_Click" >导入text</Button>
</StackPanel>

<StackPanel Orientation="Horizontal" Margin="0,20,0,0" >
<Button Margin="80,0,0,0" Tag="刷新" Click="Button_Click" >刷新大屏列表</Button>
</StackPanel>
</StackPanel>

<Grid Grid.Column="1" Margin="10">


+ 3
- 0
BPASmartClient/Control/DataVView.xaml.cs 查看文件

@@ -134,6 +134,9 @@ namespace BPASmartClient.Control
else
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, MainViewModel.GetInstance().window, "提示", $"密码输入错误!");
break;
case "刷新":
DataVClient.GetInstance().RefreshTheListOfStores();
break;
}
}
}


Loading…
取消
儲存