@@ -142,24 +142,23 @@ namespace BPASmartClient.DRCoffee | |||||
public void ProcessPackage(DrCoffeePackage package) | 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; | lastRefreshTime = DateTime.Now; | ||||
IsConnected = OnLine; | IsConnected = OnLine; | ||||
status["CoffeConnected"] = OnLine; | status["CoffeConnected"] = OnLine; | ||||
new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId }.Publish(); | 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; | IsWork = false; | ||||
@@ -170,10 +169,10 @@ namespace BPASmartClient.DRCoffee | |||||
protected override void InitStatus() | 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() | public override void Init() | ||||
@@ -178,21 +178,21 @@ namespace BPASmartClient.GSIceCream | |||||
{ | { | ||||
IsConnected = OnLine; | IsConnected = OnLine; | ||||
status["IceCreamIsConnected"] = 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("打料完成"); | MessageLog.GetInstance.Show("打料完成"); | ||||
} | } | ||||
if (RTrig.GetInstance("打料中检测").Start(!(bool)status["DLCompleted"])) | |||||
if (RTrig.GetInstance("打料中检测").Start(!(bool)status["IceCreamDLCompleted"])) | |||||
{ | { | ||||
MessageLog.GetInstance.Show("打料中"); | MessageLog.GetInstance.Show("打料中"); | ||||
} | } | ||||
@@ -231,16 +231,17 @@ namespace BPASmartClient.GSIceCream | |||||
protected override void InitStatus() | 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() | public override void Init() | ||||
@@ -272,20 +273,20 @@ namespace BPASmartClient.GSIceCream | |||||
{ | { | ||||
try | 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(); | new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status = false }.Publish(); | ||||
return; | 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(); | new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status = false }.Publish(); | ||||
return; | return; | ||||
} | } | ||||
bool modeRight = (MORKI_MODE)status["CurrentMode"] == MORKI_MODE.制冷模式; | |||||
bool modeRight = (MORKI_MODE)status["IceCreamCurrentMode"] == MORKI_MODE.制冷模式; | |||||
if (!modeRight) | if (!modeRight) | ||||
{ | { | ||||
@@ -303,7 +304,7 @@ namespace BPASmartClient.GSIceCream | |||||
while (DateTime.Now < freeTime) | while (DateTime.Now < freeTime) | ||||
{ | { | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
modeRight = (MORKI_MODE)status["CurrentMode"] == MORKI_MODE.制冷模式; | |||||
modeRight = (MORKI_MODE)status["IceCreamCurrentMode"] == MORKI_MODE.制冷模式; | |||||
if (modeRight) | if (modeRight) | ||||
break; | break; | ||||
} | } | ||||
@@ -322,7 +323,7 @@ namespace BPASmartClient.GSIceCream | |||||
} | } | ||||
else | 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(); | new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status = false }.Publish(); | ||||
} | } | ||||
} | } | ||||
@@ -46,8 +46,8 @@ namespace BPASmartClient.Lebai | |||||
{ | { | ||||
IsConnected = LebaiHelper.GetInstance().IsConnected; | IsConnected = LebaiHelper.GetInstance().IsConnected; | ||||
status["RobotIsConnected"] = 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; | if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] = LebaiHelper.GetInstance().robotData.RobotMode.Mode; | ||||
LebaiHelper.GetInstance().GetRobotModeStatus(); | LebaiHelper.GetInstance().GetRobotModeStatus(); | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
@@ -1,5 +1,6 @@ | |||||
using BPA.Message.Enum; | using BPA.Message.Enum; | ||||
using BPASmartClient.Device; | using BPASmartClient.Device; | ||||
using BPASmartClient.DRCoffee; | |||||
using BPASmartClient.EventBus; | using BPASmartClient.EventBus; | ||||
using BPASmartClient.GSIceCream; | using BPASmartClient.GSIceCream; | ||||
using BPASmartClient.Helper; | using BPASmartClient.Helper; | ||||
@@ -84,9 +85,132 @@ namespace BPASmartClient.MorkT | |||||
public override void ReadData() | 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("IceCreamCBX", 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.IceCreamIsConnected = 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; | |||||
} | |||||
})); | })); | ||||
} | } | ||||
@@ -212,7 +336,7 @@ namespace BPASmartClient.MorkT | |||||
private void Wait(int value = 101) | 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); | Thread.Sleep(5); | ||||
} | } | ||||
@@ -48,55 +48,55 @@ namespace BPASmartClient.MorkT | |||||
#region | #region | ||||
[VariableMonitor("机器人连接状态")] | [VariableMonitor("机器人连接状态")] | ||||
public bool RobotIsConnected; | |||||
public bool RobotIsConnected { get; set; } | |||||
[VariableMonitor("机器人状态")] | [VariableMonitor("机器人状态")] | ||||
public ELebaiRModel RobotMode; | |||||
public ELebaiRModel RobotMode { get; set; } | |||||
[VariableMonitor("冰淇淋连接状态")] | [VariableMonitor("冰淇淋连接状态")] | ||||
public bool IceCreamIsConnected; | |||||
public bool IceCreamIsConnected { get; set; } | |||||
[VariableMonitor("冰淇淋机器预冷温度")] | [VariableMonitor("冰淇淋机器预冷温度")] | ||||
public short YLWD; | |||||
public short YLWD { get; set; } | |||||
[VariableMonitor("冰淇淋机器回气温度")] | [VariableMonitor("冰淇淋机器回气温度")] | ||||
public short HQWD; | |||||
public short HQWD { get; set; } | |||||
[VariableMonitor("冰淇淋机器环境温度")] | [VariableMonitor("冰淇淋机器环境温度")] | ||||
public short HJWD; | |||||
public short HJWD { get; set; } | |||||
[VariableMonitor("冰淇淋机器电流")] | [VariableMonitor("冰淇淋机器电流")] | ||||
public short DL; | |||||
public short DL { get; set; } | |||||
[VariableMonitor("冰淇淋机器电压")] | [VariableMonitor("冰淇淋机器电压")] | ||||
public bool DY; | |||||
public short DY { get; set; } | |||||
[VariableMonitor("冰淇淋机器成型比")] | [VariableMonitor("冰淇淋机器成型比")] | ||||
public byte CBX; | |||||
public byte CBX { get; set; } | |||||
[VariableMonitor("冰淇淋机器模式")] | [VariableMonitor("冰淇淋机器模式")] | ||||
public MORKI_MODE IceCreamMode; | |||||
public MORKI_MODE IceCreamMode { get; set; } | |||||
[VariableMonitor("冰淇淋机器故障")] | [VariableMonitor("冰淇淋机器故障")] | ||||
public MORKI_FAULT IceCreamFault; | |||||
public MORKI_FAULT IceCreamFault { get; set; } | |||||
[VariableMonitor("冰淇淋机器打料是否完成")] | |||||
public bool DLCompleted; | |||||
[VariableMonitor("冰淇淋机器打料完成")] | |||||
public bool DLCompleted { get; set; } | |||||
[VariableMonitor("咖啡机连接状态")] | [VariableMonitor("咖啡机连接状态")] | ||||
public bool CoffeeIsConnected; | |||||
public bool CoffeeIsConnected { get; set; } | |||||
[VariableMonitor("咖啡机状态")] | [VariableMonitor("咖啡机状态")] | ||||
public DrCoffeeStatus DrCoffeeStatus; | |||||
public DrCoffeeStatus DrCoffeeStatus { get; set; } | |||||
[VariableMonitor("咖啡机应用状态")] | [VariableMonitor("咖啡机应用状态")] | ||||
public DrCoffeeAppStatus CoffeeAppStatus; | |||||
public DrCoffeeAppStatus CoffeeAppStatus { get; set; } | |||||
[VariableMonitor("咖啡机告警")] | [VariableMonitor("咖啡机告警")] | ||||
public DrCoffeeWarning CoffeeWarning; | |||||
public DrCoffeeWarning CoffeeWarning { get; set; } | |||||
[VariableMonitor("咖啡机故障")] | [VariableMonitor("咖啡机故障")] | ||||
public DrCoffeeFault CaffeeFault; | |||||
public DrCoffeeFault CaffeeFault { get; set; } | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -1,4 +1,5 @@ | |||||
using BPASmartClient.Business; | using BPASmartClient.Business; | ||||
using BPASmartClient.Device; | |||||
using BPASmartClient.DRCoffee; | using BPASmartClient.DRCoffee; | ||||
using BPASmartClient.EventBus; | using BPASmartClient.EventBus; | ||||
using BPASmartClient.GSIceCream; | using BPASmartClient.GSIceCream; | ||||
@@ -13,16 +14,15 @@ using Microsoft.Toolkit.Mvvm.ComponentModel; | |||||
using Microsoft.Toolkit.Mvvm.Input; | using Microsoft.Toolkit.Mvvm.Input; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | |||||
using System.Linq; | |||||
using System.Threading; | using System.Threading; | ||||
namespace BPASmartClient.MorkT.ViewModel | namespace BPASmartClient.MorkT.ViewModel | ||||
{ | { | ||||
public class DebugViewModel : ObservableObject | public class DebugViewModel : ObservableObject | ||||
{ | { | ||||
/// <summary> | |||||
/// 设备ID | |||||
/// </summary> | |||||
int DeviceId { get; set; } | |||||
#region 乐白机器人 | #region 乐白机器人 | ||||
/// <summary> | /// <summary> | ||||
/// 乐白机器人连接状态 | /// 乐白机器人连接状态 | ||||
@@ -32,8 +32,8 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
/// <summary> | /// <summary> | ||||
/// 乐白机器人的模式状态 | /// 乐白机器人的模式状态 | ||||
/// </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> | ||||
/// 机器人控制指令 | /// 机器人控制指令 | ||||
/// </summary> | /// </summary> | ||||
@@ -67,43 +67,43 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
/// <summary> | /// <summary> | ||||
/// 预冷温度 | /// 预冷温度 | ||||
/// </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> | ||||
/// 回气温度 | /// 回气温度 | ||||
/// </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> | ||||
/// 环境温度 | /// 环境温度 | ||||
/// </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> | ||||
/// 电流 | /// 电流 | ||||
/// </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> | ||||
/// 电压 | /// 电压 | ||||
/// </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> | ||||
/// 当前模式 | /// 当前模式 | ||||
/// </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> | ||||
/// 故障 | /// 故障 | ||||
/// </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> | ||||
/// 成型比 | /// 成型比 | ||||
/// </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> | ||||
/// 打料完成状态 | /// 打料完成状态 | ||||
/// </summary> | /// </summary> | ||||
@@ -133,23 +133,23 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
/// <summary> | /// <summary> | ||||
/// 咖啡机状态 | /// 咖啡机状态 | ||||
/// </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> | ||||
/// 应用状态 | /// 应用状态 | ||||
/// </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> | ||||
/// 告警 | /// 告警 | ||||
/// </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> | ||||
/// 故障信息 | /// 故障信息 | ||||
/// </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 List<string> Coffees { get; set; } = new List<string>(); | ||||
public string SelectedCoffee { get; set; } | public string SelectedCoffee { get; set; } | ||||
@@ -158,9 +158,13 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
public string SelectedCoffeeCmd { get; set; } | public string SelectedCoffeeCmd { get; set; } | ||||
#endregion | #endregion | ||||
/// <summary> | |||||
/// 设备ID | |||||
/// </summary> | |||||
public int DeviceId { get; set; } | |||||
public ObservableCollection<VariableMonitor> variableMonitors { get; set; } | |||||
Dictionary<string, object> CurrentData { get; set; } | |||||
public DebugViewModel() | public DebugViewModel() | ||||
{ | { | ||||
Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl); | Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl); | ||||
@@ -184,38 +188,41 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
} | } | ||||
SelecteIceCreamdMode = IceCreamModes[0]; | SelecteIceCreamdMode = IceCreamModes[0]; | ||||
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device => | |||||
{ | |||||
if (device.Name == "MorkT") DeviceId = device.DeviceId | |||||
; | |||||
}); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | 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); | Thread.Sleep(500); | ||||