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