pry pirms 2 gadiem
vecāks
revīzija
2f4cca4d3b
3 mainītis faili ar 17 papildinājumiem un 11 dzēšanām
  1. +1
    -1
      HBLConsole.Factory/SimpleFactory.cs
  2. +14
    -8
      HBLConsole.MORKIC/Control_MORKIC.cs
  3. +2
    -2
      HBLConsole.MainConsole/Main.cs

+ 1
- 1
HBLConsole.Factory/SimpleFactory.cs Parādīt failu

@@ -76,7 +76,7 @@ namespace HBLConsole.Factory
Type type = Assembly.Load(NameSpace).GetType($"{NameSpace}.Control_{DeviceType}");
control = Activator.CreateInstance(type) as IControl;
//IControl business = (IControl)type?.GetProperty("GetInstance").GetValue(null);
GetBatchingInfo();
//GetBatchingInfo();
control?.Init();
ActionOperate.GetInstance.Register(new Action<object>((o) => { control?.DataParse(o); }), "DataParse");
ActionOperate.GetInstance.Register(new Action(() => { control?.ConnectOk(); }), "ConnectOk");


+ 14
- 8
HBLConsole.MORKIC/Control_MORKIC.cs Parādīt failu

@@ -55,7 +55,7 @@ namespace HBLConsole.MORKIC
}
public void Init()
{
mainMaterialLoc = "1";

//构建所有商品物料信息
batchings = PolymerBatching.BuildAll();
@@ -63,7 +63,7 @@ namespace HBLConsole.MORKIC
EventBus.GetInstance().Subscribe<IceCreamEndCook>(IceCreamEndCookHandle);
EventBus.GetInstance().Subscribe<CoffeEndCook>(CoffeEndCookHandle);

Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
//一系列外围基础配置
var com_Coffee = config.AppSettings.Settings["COM_Coffee"].Value;
var baud_Coffee = config.AppSettings.Settings["BAUD_Coffee"].Value;
@@ -84,7 +84,7 @@ namespace HBLConsole.MORKIC
ReadData();
}


public void DataParse<T>(T order)
{
@@ -142,7 +142,7 @@ namespace HBLConsole.MORKIC
return GOODS_TYPE.NEITHER;
}

private AutoResetEvent are=new AutoResetEvent(false);
private AutoResetEvent are = new AutoResetEvent(false);

/// <summary>
/// 做咖啡
@@ -150,13 +150,14 @@ namespace HBLConsole.MORKIC
private void DoCoffee()
{
//订单状态改变:开始制作
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
//todo:先调用机器人
LebaiHelper.GetInstance.Scene(10002);
new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish();
are.WaitOne(100 * 90);
LebaiHelper.GetInstance.SetValue(101);
//订单状态改变:完成
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
}

/// <summary>
@@ -165,15 +166,16 @@ namespace HBLConsole.MORKIC
private void DoIceCream()
{
//订单状态改变:开始制作
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
//todo:先调用机器人
LebaiHelper.GetInstance.Scene(10001);
new DischargeEvent().Publish();
//冰淇淋没有模式切换,强制等待10s
Thread.Sleep(10000);
LebaiHelper.GetInstance.SetValue(100);
//are.WaitOne(100 * 90);
//订单状态改变:完成
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
// SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
}

private void CoffeEndCookHandle(IEvent @event, EventBus.EventCallBackHandle callBack)
@@ -215,6 +217,10 @@ namespace HBLConsole.MORKIC

public void SimOrder<T>(T simOrder)
{
ThreadOperate.GetInstance.Start(new Action(() =>
{
DoIceCream();
}), "aaa");

}
}


+ 2
- 2
HBLConsole.MainConsole/Main.cs Parādīt failu

@@ -51,8 +51,8 @@ namespace HBLConsole.MainConsole
{
ThreadOperate.GetInstance.Start(new Action(() =>
{
InternetInfo.ConfigInit();//从 consul 获取配置数据
//InternetInfo.ConfigInit();//从 consul 获取配置数据
SimpleFactory.GetInstance.DeviceInit();//设备初始化
Topics.Clear();
Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.DeviceType, InternetInfo.ClientId));
Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.DeviceType, InternetInfo.ClientId));


Notiek ielāde…
Atcelt
Saglabāt