diff --git a/HBLConsole.Business/MessageServer/Base.cs b/HBLConsole.Business/MessageServer/Base.cs index 4ecf470..94c6f84 100644 --- a/HBLConsole.Business/MessageServer/Base.cs +++ b/HBLConsole.Business/MessageServer/Base.cs @@ -111,6 +111,7 @@ namespace HBLConsole.Business.MessageServer /// private void WritePlcData() { + return; //写配方数据到PLC List recipeBoms = new List(); foreach (var item in Json.Data.recipeBoms.RecipeIds) diff --git a/HBLConsole.MORKIC/Control_MORKIC.cs b/HBLConsole.MORKIC/Control_MORKIC.cs index 81c107a..09a37b2 100644 --- a/HBLConsole.MORKIC/Control_MORKIC.cs +++ b/HBLConsole.MORKIC/Control_MORKIC.cs @@ -60,7 +60,10 @@ namespace HBLConsole.MORKIC //构建所有商品物料信息 batchings = PolymerBatching.BuildAll(); - System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); + EventBus.GetInstance().Subscribe(IceCreamEndCookHandle); + EventBus.GetInstance().Subscribe(CoffeEndCookHandle); + + 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; @@ -81,6 +84,7 @@ namespace HBLConsole.MORKIC ReadData(); } + public void DataParse(T order) { @@ -138,6 +142,8 @@ namespace HBLConsole.MORKIC return GOODS_TYPE.NEITHER; } + private AutoResetEvent are=new AutoResetEvent(false); + /// /// 做咖啡 /// @@ -148,6 +154,7 @@ namespace HBLConsole.MORKIC //todo:先调用机器人 LebaiHelper.GetInstance.Scene(10002); new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); + are.WaitOne(100 * 90); //订单状态改变:完成 SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK); } @@ -162,10 +169,23 @@ namespace HBLConsole.MORKIC //todo:先调用机器人 LebaiHelper.GetInstance.Scene(10001); new DischargeEvent().Publish(); + //冰淇淋没有模式切换,强制等待10s + Thread.Sleep(10000); + //are.WaitOne(100 * 90); //订单状态改变:完成 SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK); } + private void CoffeEndCookHandle(IEvent @event, EventBus.EventCallBackHandle callBack) + { + are.Set(); + } + + private void IceCreamEndCookHandle(IEvent @event, EventBus.EventCallBackHandle callBack) + { + are.Set(); + } + public void Main() { diff --git a/HBLConsole/App.config b/HBLConsole/App.config index f348a93..5d0a235 100644 --- a/HBLConsole/App.config +++ b/HBLConsole/App.config @@ -11,7 +11,7 @@ - + diff --git a/HBLDevice.Coffee/CommandEvent.cs b/HBLDevice.Coffee/CommandEvent.cs index 71938b7..06921d9 100644 --- a/HBLDevice.Coffee/CommandEvent.cs +++ b/HBLDevice.Coffee/CommandEvent.cs @@ -21,4 +21,20 @@ namespace HBLDevice.Coffee public class CancelMakeCoffeeEvent : IEvent { } + + /// + /// 开始制作 + /// + public class CoffeBeginCook : IEvent + { + + } + + /// + /// 结束制作 + /// + public class CoffeEndCook : IEvent + { + + } } diff --git a/HBLDevice.Coffee/MorkCStatus.cs b/HBLDevice.Coffee/MorkCStatus.cs index 265b6c0..efbab9d 100644 --- a/HBLDevice.Coffee/MorkCStatus.cs +++ b/HBLDevice.Coffee/MorkCStatus.cs @@ -9,6 +9,7 @@ namespace HBLDevice.Coffee { public class MorkCStatus : Singleton { + private CoffeBeginCook coffeBeginCook = new CoffeBeginCook(); private DateTime lastRefreshTime = DateTime.MinValue; /// /// 是否在线 @@ -51,7 +52,15 @@ namespace HBLDevice.Coffee /// public void ProcessPackage(DrCoffeePackage package) { - CoffeeStatus = package.Status; + if (CoffeeStatus != DrCoffeeStatus.Running && package.Status == DrCoffeeStatus.Running) + { + CoffeeStatus = package.Status; + coffeBeginCook.Publish(); + } + else { + CoffeeStatus = package.Status; + } + AppStatus = package.ApplicationStatus; Warning = package.Warning; Fault = package.Fault; diff --git a/HBLDevice.IceCream/CommandEvent.cs b/HBLDevice.IceCream/CommandEvent.cs index c657efb..944eac0 100644 --- a/HBLDevice.IceCream/CommandEvent.cs +++ b/HBLDevice.IceCream/CommandEvent.cs @@ -22,4 +22,20 @@ namespace HBLDevice.IceCream public class DischargeEvent : IEvent { } + + /// + /// 开始制作 + /// + public class IceCreamBeginCook : IEvent + { + + } + + /// + /// 结束制作 + /// + public class IceCreamEndCook : IEvent + { + + } } diff --git a/HBLDevice.IceCream/CommandHandler.cs b/HBLDevice.IceCream/CommandHandler.cs index 4f79154..8a6ae55 100644 --- a/HBLDevice.IceCream/CommandHandler.cs +++ b/HBLDevice.IceCream/CommandHandler.cs @@ -18,7 +18,7 @@ namespace HBLDevice.IceCream byte[] cmdHeartDW; private SerialPortClient commProxy; - + private IceCreamEndCook iceCreamEndCook = new IceCreamEndCook(); /// /// 初始化 /// @@ -81,6 +81,7 @@ namespace HBLDevice.IceCream { var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.打料)); commProxy.SendData(data); + iceCreamEndCook.Publish(); Noticer.ShowEx(string.Format("出料操作->设置模式[{0}]", MORKI_MODE.打料)); } else