@@ -32,7 +32,7 @@ namespace HBLConsole.Business.MessageServer | |||
OrderPush = morkOrderpush | |||
}); | |||
ActionOperate.GetInstance.Send("AddOrder",morkOrderpush); | |||
ActionOperate.GetInstance.Send("DataParse",morkOrderpush); | |||
ActionOperate.GetInstance.Send("DataParse", morkOrderpush); | |||
} | |||
} | |||
} | |||
@@ -41,16 +41,24 @@ namespace HBLConsole.Communication | |||
} | |||
StartRobot(); | |||
MessageLog.GetInstance.Show("乐百机器人连接成功!"); | |||
//GetSpeed(); | |||
//ActionOperate.GetInstance.Send($"{GVL.GeneralConfig.DeviceType.ToString()}/ConnectOk"); | |||
} | |||
public void GetSpeed() | |||
{ | |||
//client.StartSys().GetAwaiter(); | |||
var aa = client.GetActualTcpSpeed().GetAwaiter(); | |||
//robotData.RobotMode.Mode | |||
} | |||
/// <summary> | |||
/// 获取机器人当前运行的命令 | |||
/// </summary> | |||
/// <returns></returns> | |||
public CmdStatus GetRobotRunCmd() | |||
{ | |||
if (robotData == null) return default(CmdStatus); | |||
return robotData.CurrentCmd; | |||
} | |||
/// <summary> | |||
@@ -121,7 +121,7 @@ | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*"/> | |||
</Grid.RowDefinitions> | |||
<Grid> | |||
@@ -137,6 +137,7 @@ | |||
<TextBlock Text="环境温度:" /> | |||
<TextBlock HorizontalAlignment="Right" Text="电流:" /> | |||
<TextBlock HorizontalAlignment="Right" Text="成型比:" /> | |||
<TextBlock HorizontalAlignment="Right" Text="打料完成:" /> | |||
</StackPanel> | |||
<StackPanel Grid.Column="1" Margin="10,0,0,0"> | |||
@@ -144,6 +145,7 @@ | |||
<TextBlock Text="{Binding HJWD}" /> | |||
<TextBlock Text="{Binding DL}" /> | |||
<TextBlock Text="{Binding CXB}" /> | |||
<TextBlock Text="{Binding DLCompleted}" /> | |||
</StackPanel> | |||
<StackPanel Grid.Column="2" HorizontalAlignment="Right"> | |||
@@ -70,6 +70,10 @@ namespace HBLConsole.Debug | |||
/// 成型比 | |||
/// </summary> | |||
public byte CXB { get; set; } | |||
/// <summary> | |||
/// 打料完成状态 | |||
/// </summary> | |||
public string DLCompleted { get; set; } | |||
public List<string> IceCreamModes { get; set; } = new List<string>(); | |||
public string SelecteIceCreamdMode { get; set; } | |||
@@ -111,7 +115,7 @@ namespace HBLConsole.Debug | |||
CurrentMode = MorkIStatus.GetInstance().CurrentMode; | |||
IceCreamFault = MorkIStatus.GetInstance().Fault; | |||
CXB = MorkIStatus.GetInstance().CXB; | |||
DLCompleted = MorkIStatus.GetInstance().DLCompleted?"打料完成":"打料中"; | |||
Thread.Sleep(500); | |||
}), "MORK IC-状态刷新"); | |||
} | |||
@@ -15,6 +15,7 @@ using HBLDevice.Coffee; | |||
using HBLDevice.IceCream; | |||
using Robotc; | |||
using System.Collections.Concurrent; | |||
using System.Diagnostics; | |||
namespace HBLConsole.MORKIC | |||
{ | |||
@@ -244,20 +245,22 @@ namespace HBLConsole.MORKIC | |||
//开始心跳刷新,根据咖啡机及冰淇淋机来判断 | |||
ThreadOperate.GetInstance.StartLong(new Action(() => | |||
{ | |||
//GeneralConfig.Healthy = true; | |||
GeneralConfig.Healthy = | |||
MorkIStatus.GetInstance().CanDo && | |||
MorkCStatus.GetInstance().CanDo; | |||
GeneralConfig.Healthy = true; | |||
//GeneralConfig.Healthy = | |||
// MorkIStatus.GetInstance().CanDo && | |||
// MorkCStatus.GetInstance().CanDo; | |||
Thread.Sleep(100); | |||
}), "MORK-IC心跳刷新"); | |||
} | |||
public void ReadData() | |||
{ | |||
ThreadOperate.GetInstance.StartLong(new Action(() => | |||
{ | |||
lebai = LebaiHelper.GetInstance.GetValueAsync(); | |||
Debug.WriteLine(LebaiHelper.GetInstance.GetClawWdight()); | |||
Thread.Sleep(100); | |||
}), "乐百机器人数据读取"); | |||
} | |||
@@ -50,7 +50,7 @@ namespace HBLConsole | |||
protected override void OnExit(ExitEventArgs e) | |||
{ | |||
IotReport.GetInstance.Close(); | |||
//IotReport.GetInstance.Close(); | |||
base.OnExit(e); | |||
SqlHelper.GetInstance.Save(); | |||
MainConsole.Main.GetInstance.DataSave(); | |||
@@ -20,6 +20,8 @@ namespace HBLDevice.IceCream | |||
private SerialPortClient commProxy; | |||
private IceCreamEndCook iceCreamEndCook = new IceCreamEndCook(); | |||
public Action<bool> PauseAsk { get; set; } | |||
/// <summary> | |||
/// 初始化 | |||
/// </summary> | |||
@@ -42,9 +44,12 @@ namespace HBLDevice.IceCream | |||
public void ModeSetEventHandle(IEvent @event, EventCallBackHandle callBack = null) | |||
{ | |||
PauseAsk?.Invoke(true); | |||
Thread.Sleep(200); | |||
var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(((ModeSetEvent)@event).Mode)); | |||
commProxy.SendData(data); | |||
Thread.Sleep(200); | |||
PauseAsk?.Invoke(false); | |||
MessageLog.GetInstance.Show(string.Format("设置模式[{0}]", ((ModeSetEvent)@event).Mode)); | |||
} | |||
@@ -81,8 +86,12 @@ namespace HBLDevice.IceCream | |||
if (modeRight) | |||
{ | |||
PauseAsk?.Invoke(true); | |||
Thread.Sleep(200); | |||
var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.打料)); | |||
commProxy.SendData(data); | |||
Thread.Sleep(200); | |||
PauseAsk?.Invoke(false); | |||
iceCreamEndCook.Publish(); | |||
MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]", MORKI_MODE.打料)); | |||
} | |||
@@ -19,7 +19,8 @@ namespace HBLDevice.IceCream | |||
private DataStorage<byte> dataStorage = new DataStorage<byte>(); | |||
//主线程运行标识 | |||
private bool running = false; | |||
//是否下发指令,主线程等待 | |||
private bool free = true; | |||
public Action<string> SendCallback; | |||
public Action<string> ReciveCallback; | |||
@@ -30,7 +31,10 @@ namespace HBLDevice.IceCream | |||
commProxy = new SerialPortClient(portName, baud); | |||
commProxy.SetDataStorage(dataStorage); | |||
commandHandler.Init(commProxy); | |||
commandHandler.PauseAsk = delegate (bool pause) | |||
{ | |||
free = !pause; | |||
}; | |||
} | |||
public void Start() | |||
@@ -49,8 +53,11 @@ namespace HBLDevice.IceCream | |||
{ | |||
ThreadOperate.GetInstance.StartLong(new Action(() => | |||
{ | |||
commProxy.SendData(commandHandler.GetHeartDW()); | |||
SendCallback?.Invoke(BitConverter.ToString(commandHandler.GetHeartDW())); | |||
if (free) | |||
{ | |||
commProxy.SendData(commandHandler.GetHeartDW()); | |||
SendCallback?.Invoke(BitConverter.ToString(commandHandler.GetHeartDW())); | |||
} | |||
Thread.Sleep(500); | |||
}), "冰淇淋询问线程"); | |||
@@ -52,6 +52,10 @@ namespace HBLDevice.IceCream | |||
/// 成型比(门限) | |||
/// </summary> | |||
public byte CXB_Threshold { get; set; } | |||
/// <summary> | |||
/// 打料完成(完成为true,正在打料为false) | |||
/// </summary> | |||
public bool DLCompleted { get; set; } | |||
public bool CanDo | |||
{ | |||
@@ -76,7 +80,17 @@ namespace HBLDevice.IceCream | |||
DL = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0); | |||
Fault = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L, heartUpMsg.GZ_H }, 0); | |||
CXB = heartUpMsg.CXB; | |||
DLCompleted = (heartUpMsg.DLTJ >> 4 & 1) == 1; | |||
if (RTrig.GetInstance("打料完成检测").Start(DLCompleted)) | |||
{ | |||
MessageLog.GetInstance.Show("打料完成"); | |||
} | |||
if(RTrig.GetInstance("打料中检测").Start(!DLCompleted)) | |||
{ | |||
MessageLog.GetInstance.Show("打料中"); | |||
} | |||
//MessageLog.GetInstance.Show(string.Format("当前模式为:{0}", CurrentMode)); | |||
} | |||