Browse Source

调试修改

master
pry 2 years ago
parent
commit
e68cb670d0
6 changed files with 32 additions and 24 deletions
  1. +4
    -3
      HBLConsole.Communication/LebaiHelper.cs
  2. +9
    -9
      HBLConsole.MORKIC/Control_MORKIC.cs
  3. +1
    -3
      HBLConsole.MORKS/Control_MORKS.cs
  4. +5
    -3
      HBLConsole.Service/MessageLog.cs
  5. +2
    -2
      HBLConsole/App.config
  6. +11
    -4
      HBLConsole/ViewModel/ViewModelBase.cs

+ 4
- 3
HBLConsole.Communication/LebaiHelper.cs View File

@@ -100,6 +100,7 @@ namespace HBLConsole.Communication

public void GetRobotModeStatus()
{

if (robotData == null) return;
int mode = robotData.RobotMode.Mode;
IsIdle = mode == 5;
@@ -161,7 +162,7 @@ namespace HBLConsole.Communication
/// <param name="index"></param>
/// <param name="value"></param>
/// <returns></returns>
public SignalResult SetValue(int value,int index = 0)
public SignalResult SetValue(int value, int index = 0)
{
if (robotData == null) return default(SignalResult);
SignalValue signalValue = new SignalValue();
@@ -193,13 +194,13 @@ namespace HBLConsole.Communication
public async void Scene(int id)
{
CancellationToken cancellationToken = default(CancellationToken);
var result = await client.GetTasks(new GetTasksInput { PageIndex = 1,PageSize = 1 },cancellationToken);
var result = await client.GetTasks(new GetTasksInput { PageIndex = 1, PageSize = 1 }, cancellationToken);
var first = result?.Items?.FirstOrDefault();
var r = first == null || first.Status != Lebai.SDK.Dtos.TaskStatus.Running && first.Status != Lebai.SDK.Dtos.TaskStatus.Pause;
while (!r)
{
Thread.Sleep(5);
result = await client.GetTasks(new GetTasksInput { PageIndex = 1,PageSize = 1 },cancellationToken);
result = await client.GetTasks(new GetTasksInput { PageIndex = 1, PageSize = 1 }, cancellationToken);
first = result?.Items?.FirstOrDefault();
r = first == null || first.Status != Lebai.SDK.Dtos.TaskStatus.Running && first.Status != Lebai.SDK.Dtos.TaskStatus.Pause;
}


+ 9
- 9
HBLConsole.MORKIC/Control_MORKIC.cs View File

@@ -272,12 +272,12 @@ namespace HBLConsole.MORKIC
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_取咖啡杯);
Wait();
new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制

Thread.Sleep(500);
MessageLog.GetInstance.Show("咖啡杯取杯完成");
LebaiHelper.GetInstance.SetValue(1);
p:
p:
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡杯检测);
Wait();
LebaiHelper.GetInstance.SetValue(1);
@@ -289,7 +289,7 @@ namespace HBLConsole.MORKIC
Wait();

new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制

LebaiHelper.GetInstance.SetValue(1);
goto p;
@@ -537,16 +537,16 @@ namespace HBLConsole.MORKIC
LebaiHelper.GetInstance.SetValue(0);
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_取冰淇淋杯);
Wait();

new TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制

Thread.Sleep(500);
MessageLog.GetInstance.Show("冰淇淋杯取杯完成");
LebaiHelper.GetInstance.SetValue(1);
p:
p:
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_冰淇淋杯检测);
//Thread.Sleep(2000);
//if (lebai.Value != 101)
@@ -562,7 +562,7 @@ namespace HBLConsole.MORKIC
//if (lebai.Value != 101)
// LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_二次取冰淇淋杯);
new TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制

Wait();
LebaiHelper.GetInstance.SetValue(1);
@@ -584,7 +584,7 @@ namespace HBLConsole.MORKIC
// LebaiHelper.GetInstance.Scene(scene);
Wait();
new MakeIceCreamEvent() { SteeringEngine = res }.Publish(); //控制舵机

Thread.Sleep(500);
LebaiHelper.GetInstance.SetValue(1);
@@ -646,7 +646,7 @@ namespace HBLConsole.MORKIC


Thread.Sleep(100);
}), "乐百机器人数据读取");
}), "乐百机器人数据读取", true);
}

public void SimOrder<T>(T simOrder)


+ 1
- 3
HBLConsole.MORKS/Control_MORKS.cs View File

@@ -122,11 +122,8 @@ namespace HBLConsole.MORKS
mORKS.TurntableUpLimit = bools[13];
mORKS.FeedComplete = bools[14];
mORKS.TurntableMoveInPlace = bools[15];


}));

//Read(startAddress, ReadType.Coils, len);
var errorStatus = ModbusTcpHelper.GetInstance.Read((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M235.0"), ReadType.Coils, 1);
if (errorStatus != null && errorStatus is bool error) mORKS.Error = error;

@@ -522,6 +519,7 @@ namespace HBLConsole.MORKS
private void WriteRecipeBoms()
{
List<ushort> recipeBoms = new List<ushort>();
if (Json<BatchingInfoPar>.Data.recipeBoms == null) return;
foreach (var item in Json<BatchingInfoPar>.Data.recipeBoms.RecipeIds)
{
foreach (var rec in item.Recipes)


+ 5
- 3
HBLConsole.Service/MessageLog.cs View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -17,7 +18,7 @@ namespace HBLConsole.Service
/// <summary>
/// 日志显示委托
/// </summary>
public Action<string> InfoNotify { get; set; }
public Action<string, Color> InfoNotify { get; set; }

/// <summary>
/// 日志信息
@@ -28,11 +29,12 @@ namespace HBLConsole.Service
/// 普通日志输出
/// </summary>
/// <param name="info"></param>
public void Show(string info)
public void Show(string info, Color color = default(Color))
{
if (color.A == 0 && color.R == 0 && color.G == 0 && color.B == 0) color = Color.Aqua;
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
LogInfo = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {LogInfo}";
if (InfoNotify != null) InfoNotify(info);
if (InfoNotify != null) InfoNotify(info, color);
}
#endregion



+ 2
- 2
HBLConsole/App.config View File

@@ -10,8 +10,8 @@
<!--<add key="ConsulAddress" value="http://162.14.105.138:9005" />-->

<!--客户端ID-->
<!--MorkD = 2,MorkS 且时且多 = 8,MorkS 珠海 = 9,冰淇淋 = 4,咖啡机 = 13-->
<add key="ClientId" value="1"/>
<!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺-->
<add key="ClientId" value="3"/>

<add key="COM_Coffee" value="COM3"/>
<add key="BAUD_Coffee" value="115200"/>


+ 11
- 4
HBLConsole/ViewModel/ViewModelBase.cs View File

@@ -19,6 +19,7 @@ using System.Threading;
using HBLConsole.Business;
using HBLConsole.GVL;
using HBLConsole.Communication;
using System.Drawing;

namespace HBLConsole.ViewModel
{
@@ -32,15 +33,16 @@ namespace HBLConsole.ViewModel

public static void Init()
{
MessageLog.GetInstance.InfoNotify = new Action<string>((s) =>
{
LogMessage = $"{DateTime.Now.ToString("HH:mm:ss")}:{s} \n\r {LogMessage}";
//LogMessage = MessageLog.GetInstance.LogInfo;
MessageLog.GetInstance.InfoNotify = new Action<string, Color>((s, c) =>
{
LogMessage = $"{DateTime.Now.ToString("HH:mm:ss")}:{s} \n\r {LogMessage}";
//Messages.Add($"{DateTime.Now.ToString("HH:mm:ss")}:{s}");
});

MessageLog.GetInstance.ExInfoNotify = new Action<string>((s) =>
{
LogMessage = $"{DateTime.Now.ToString("HH:mm:ss")}:{s} \n\r {LogMessage}";
//Messages.Add($"{DateTime.Now.ToString("HH:mm:ss")}:{s}");
IotReport.GetInstance.HttpAddLog(new BPA.Message.API请求.LogTable
{
ClientId = InternetInfo.ClientId.ToString(),
@@ -99,6 +101,11 @@ namespace HBLConsole.ViewModel
/// </summary>
public static ObservableCollection<OrderData> WaitTakeMeal { get; set; } = new ObservableCollection<OrderData>();

/// <summary>
/// 消息列表
/// </summary>
public static ObservableCollection<string> Messages { get; set; } = new ObservableCollection<string>();

/// <summary>
/// 显示当前窗体名称
/// </summary>


Loading…
Cancel
Save