diff --git a/HBLConsole.Business/AlarmHelper.cs b/HBLConsole.Business/AlarmHelper.cs
index 3103444..5dd4c00 100644
--- a/HBLConsole.Business/AlarmHelper.cs
+++ b/HBLConsole.Business/AlarmHelper.cs
@@ -36,7 +36,7 @@ namespace HBLConsole.Business
{
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text])
{
- AddAlarm(text, alarmLevel);
+ AddAlarm(Trigger, text, alarmLevel);
flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false;
}
}
@@ -51,16 +51,18 @@ namespace HBLConsole.Business
/// 添加报警信息
///
/// 报警信息
- private void AddAlarm(string AlarmInfo, AlarmLevel alarmLevel)
+ private void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
{
Alarm tempAlarm = new Alarm()
{
+ NumId = Alarms.Count,
Date = DateTime.Now.ToString("yyyy/MM/dd"),
Grade = alarmLevel.ToString(),
Info = AlarmInfo,
+ Value = value.ToString(),
Time = DateTime.Now.ToString("HH:mm:ss"),
};
- Sqlite.GetInstance.Add(tempAlarm);
+ Sqlite.GetInstance.Base.Add(tempAlarm);
if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{
@@ -80,6 +82,10 @@ namespace HBLConsole.Business
if (result != null)
{
Alarms.Remove(result);
+ for (int i = 0; i < Alarms.Count; i++)
+ {
+ Alarms.ElementAt(i).NumId = i + 1;
+ }
if (RemoveAction != null) RemoveAction(AlarmInfo);
if (ChangeAction != null) ChangeAction();
}
diff --git a/HBLConsole.MORKD/Alarm_MORKD.cs b/HBLConsole.MORKD/Alarm_MORKD.cs
index 8269e5d..eff31fd 100644
--- a/HBLConsole.MORKD/Alarm_MORKD.cs
+++ b/HBLConsole.MORKD/Alarm_MORKD.cs
@@ -13,5 +13,6 @@ namespace HBLConsole.MORKD
///
public class Alarm_MORKD : IAlarm
{
+
}
}
diff --git a/HBLConsole.MORKD/Control_MORKD.cs b/HBLConsole.MORKD/Control_MORKD.cs
index e1a6996..d15ba49 100644
--- a/HBLConsole.MORKD/Control_MORKD.cs
+++ b/HBLConsole.MORKD/Control_MORKD.cs
@@ -15,22 +15,6 @@ namespace HBLConsole.MORKD
{
public class Control_MORKD : IControl
{
- #region 单例模式
- //private static Control_MORKD _instance;
- //public static Control_MORKD Instance
- //{
- // get
- // {
- // if (_instance == null)
- // _instance = new Control_MORKD();
- // return _instance;
- // }
- //}
- //public Control_MORKD()
- //{
-
- //}
- #endregion
GVL_MORKD mORKD = new GVL_MORKD();
Alarm_MORKD alarm = new Alarm_MORKD();
public void ConnectOk()
@@ -40,11 +24,6 @@ namespace HBLConsole.MORKD
ResetProgram();
}
- //public object GetT()
- //{
- // return mORKD;
- //}
-
public void DataParse(T order)
{
if (order is MorkOrderPush morkOrderPush)
@@ -77,6 +56,7 @@ namespace HBLConsole.MORKD
public void Init()
{
ActionOperate.GetInstance.Register(new Action(() => { mORKD.InitControl(); }), "InitCommand");
+
}
bool Initing = false;
diff --git a/HBLConsole.MORKIC/Control_MORKIC.cs b/HBLConsole.MORKIC/Control_MORKIC.cs
index 34d6d7c..1cb7e21 100644
--- a/HBLConsole.MORKIC/Control_MORKIC.cs
+++ b/HBLConsole.MORKIC/Control_MORKIC.cs
@@ -17,6 +17,8 @@ using Robotc;
using System.Collections.Concurrent;
using System.Diagnostics;
using BPA.Message.IOT;
+using HBLDevice.ICChip;
+
namespace HBLConsole.MORKIC
{
/*
@@ -33,6 +35,7 @@ namespace HBLConsole.MORKIC
GVL_MORIC mORKD = new GVL_MORIC();
//咖啡机主控程序
private CoffeeMachine coffeeMachine;
+ private ICChipMachine icchipMachine;
//冰淇淋主控程序
private IceCreamMachine iceCreamMachine;
//物料存放位置
@@ -60,7 +63,6 @@ namespace HBLConsole.MORKIC
//构建所有商品物料信息
batchings = PolymerBatching.BuildAll();
- EventBus.GetInstance().Subscribe(IceCreamEndCookHandle);
EventBus.GetInstance().Subscribe(CoffeEndCookHandle);
System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
@@ -70,6 +72,11 @@ namespace HBLConsole.MORKIC
var com_IceCream = config.AppSettings.Settings["COM_IceCream"].Value;
var baud_IceCream = config.AppSettings.Settings["BAUD_IceCream"].Value;
var iceCreamCXBThreshold = int.Parse(config.AppSettings.Settings["IceCream_CXB_Threshold"].Value);
+
+ var com_ICChip = config.AppSettings.Settings["COM_ICChip"].Value;
+ var baud_ICChip = config.AppSettings.Settings["BAUD_IChip"].Value;
+
+
if (iceCreamCXBThreshold > 0)
{
//设置冰淇淋成型比
@@ -79,6 +86,7 @@ namespace HBLConsole.MORKIC
coffeeMachine = new CoffeeMachine(com_Coffee, (BaudRates)Enum.Parse(typeof(BaudRates), baud_Coffee));
//冰淇淋机创建
iceCreamMachine = new IceCreamMachine(com_IceCream, (BaudRates)Enum.Parse(typeof(BaudRates), baud_IceCream));
+ icchipMachine = new ICChipMachine(com_ICChip, (BaudRates)Enum.Parse(typeof(BaudRates), baud_ICChip));
Main();
ReadData();
@@ -167,7 +175,7 @@ namespace HBLConsole.MORKIC
//订单状态改变:开始制作
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
//todo:先调用机器人
-
+
ThreadOperate.GetInstance.Start(new Action(() => { LebaiHelper.GetInstance.Scene(10002); }), "调用乐百机器人做咖啡场景");
while (!(lebai.Ok && lebai.Value == 1))
@@ -211,10 +219,9 @@ namespace HBLConsole.MORKIC
{
Thread.Sleep(5);
}
- new DischargeEvent().Publish();
-
- //冰淇淋没有模式切换,强制等待10s
- Thread.Sleep(10000);
+ new TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();
+ while (!ChipStatus.GetInstance().CompletedTake_CPU_CUP_ICECREAM) { Thread.Sleep(5); }
+ new MakeIceCreamEvent() { SteeringEngine = IC_SE.SE_1 }.Publish();
LebaiHelper.GetInstance.SetValue(100);
//are.WaitOne(100 * 90);
//订单状态改变:完成
@@ -226,12 +233,6 @@ namespace HBLConsole.MORKIC
are.Set();
}
- private void IceCreamEndCookHandle(IEvent @event, EventBus.EventCallBackHandle callBack)
- {
- //are.Set();
- }
-
-
public void Main()
{
//咖啡机开启主线程
@@ -250,7 +251,7 @@ namespace HBLConsole.MORKIC
// MorkIStatus.GetInstance().CanDo &&
// MorkCStatus.GetInstance().CanDo;
GeneralConfig.Healthy =
- LebaiHelper.GetInstance.IsConnected &&
+ LebaiHelper.GetInstance.IsConnected &&
MorkCStatus.GetInstance().CanDo;
Thread.Sleep(100);
}), "MORK-IC心跳刷新");
diff --git a/HBLConsole.MORKIC/HBLConsole.MORKIC.csproj b/HBLConsole.MORKIC/HBLConsole.MORKIC.csproj
index 3cf5084..a5b0a6c 100644
--- a/HBLConsole.MORKIC/HBLConsole.MORKIC.csproj
+++ b/HBLConsole.MORKIC/HBLConsole.MORKIC.csproj
@@ -13,6 +13,7 @@
+
diff --git a/HBLConsole.MainConsole/Main.cs b/HBLConsole.MainConsole/Main.cs
index 00627c7..25fb10a 100644
--- a/HBLConsole.MainConsole/Main.cs
+++ b/HBLConsole.MainConsole/Main.cs
@@ -19,19 +19,25 @@ namespace HBLConsole.MainConsole
private volatile static Main _Instance;
public static Main GetInstance => _Instance ?? (_Instance = new Main());
- private Main() { }
+ private Main()
+ {
+ ActionOperate.GetInstance.Register(new Func