@@ -111,6 +111,7 @@ namespace HBLConsole.Business.MessageServer | |||||
/// </summary> | /// </summary> | ||||
private void WritePlcData() | private void WritePlcData() | ||||
{ | { | ||||
return; | |||||
//写配方数据到PLC | //写配方数据到PLC | ||||
List<ushort> recipeBoms = new List<ushort>(); | List<ushort> recipeBoms = new List<ushort>(); | ||||
foreach (var item in Json<BatchingInfoPar>.Data.recipeBoms.RecipeIds) | foreach (var item in Json<BatchingInfoPar>.Data.recipeBoms.RecipeIds) | ||||
@@ -60,7 +60,10 @@ namespace HBLConsole.MORKIC | |||||
//构建所有商品物料信息 | //构建所有商品物料信息 | ||||
batchings = PolymerBatching.BuildAll(); | batchings = PolymerBatching.BuildAll(); | ||||
System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); | |||||
EventBus.GetInstance().Subscribe<IceCreamEndCook>(IceCreamEndCookHandle); | |||||
EventBus.GetInstance().Subscribe<CoffeEndCook>(CoffeEndCookHandle); | |||||
Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); | |||||
//一系列外围基础配置 | //一系列外围基础配置 | ||||
var com_Coffee = config.AppSettings.Settings["COM_Coffee"].Value; | var com_Coffee = config.AppSettings.Settings["COM_Coffee"].Value; | ||||
var baud_Coffee = config.AppSettings.Settings["BAUD_Coffee"].Value; | var baud_Coffee = config.AppSettings.Settings["BAUD_Coffee"].Value; | ||||
@@ -81,6 +84,7 @@ namespace HBLConsole.MORKIC | |||||
ReadData(); | ReadData(); | ||||
} | } | ||||
public void DataParse<T>(T order) | public void DataParse<T>(T order) | ||||
{ | { | ||||
@@ -138,6 +142,8 @@ namespace HBLConsole.MORKIC | |||||
return GOODS_TYPE.NEITHER; | return GOODS_TYPE.NEITHER; | ||||
} | } | ||||
private AutoResetEvent are=new AutoResetEvent(false); | |||||
/// <summary> | /// <summary> | ||||
/// 做咖啡 | /// 做咖啡 | ||||
/// </summary> | /// </summary> | ||||
@@ -148,6 +154,7 @@ namespace HBLConsole.MORKIC | |||||
//todo:先调用机器人 | //todo:先调用机器人 | ||||
LebaiHelper.GetInstance.Scene(10002); | LebaiHelper.GetInstance.Scene(10002); | ||||
new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); | new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); | ||||
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); | ||||
} | } | ||||
@@ -162,10 +169,23 @@ namespace HBLConsole.MORKIC | |||||
//todo:先调用机器人 | //todo:先调用机器人 | ||||
LebaiHelper.GetInstance.Scene(10001); | LebaiHelper.GetInstance.Scene(10001); | ||||
new DischargeEvent().Publish(); | new DischargeEvent().Publish(); | ||||
//冰淇淋没有模式切换,强制等待10s | |||||
Thread.Sleep(10000); | |||||
//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) | |||||
{ | |||||
are.Set(); | |||||
} | |||||
private void IceCreamEndCookHandle(IEvent @event, EventBus.EventCallBackHandle callBack) | |||||
{ | |||||
are.Set(); | |||||
} | |||||
public void Main() | public void Main() | ||||
{ | { | ||||
@@ -11,7 +11,7 @@ | |||||
<!--客户端ID--> | <!--客户端ID--> | ||||
<!--MorkD = 2,MorkS 且时且多 = 8,MorkS 珠海 = 9,冰淇淋 = 4,咖啡机 = 13--> | <!--MorkD = 2,MorkS 且时且多 = 8,MorkS 珠海 = 9,冰淇淋 = 4,咖啡机 = 13--> | ||||
<add key="ClientId" value="2"/> | |||||
<add key="ClientId" value="4"/> | |||||
<!--IOT大屏上报--> | <!--IOT大屏上报--> | ||||
<add key="ProductKey" value="grgpECHSL7q"/> | <add key="ProductKey" value="grgpECHSL7q"/> | ||||
<add key="DeviceName" value="qsqd_zmj"/> | <add key="DeviceName" value="qsqd_zmj"/> | ||||
@@ -21,4 +21,20 @@ namespace HBLDevice.Coffee | |||||
public class CancelMakeCoffeeEvent : IEvent | public class CancelMakeCoffeeEvent : IEvent | ||||
{ | { | ||||
} | } | ||||
/// <summary> | |||||
/// 开始制作 | |||||
/// </summary> | |||||
public class CoffeBeginCook : IEvent | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 结束制作 | |||||
/// </summary> | |||||
public class CoffeEndCook : IEvent | |||||
{ | |||||
} | |||||
} | } |
@@ -9,6 +9,7 @@ namespace HBLDevice.Coffee | |||||
{ | { | ||||
public class MorkCStatus : Singleton<MorkCStatus> | public class MorkCStatus : Singleton<MorkCStatus> | ||||
{ | { | ||||
private CoffeBeginCook coffeBeginCook = new CoffeBeginCook(); | |||||
private DateTime lastRefreshTime = DateTime.MinValue; | private DateTime lastRefreshTime = DateTime.MinValue; | ||||
/// <summary> | /// <summary> | ||||
/// 是否在线 | /// 是否在线 | ||||
@@ -51,7 +52,15 @@ namespace HBLDevice.Coffee | |||||
/// <param name="package"></param> | /// <param name="package"></param> | ||||
public void ProcessPackage(DrCoffeePackage package) | 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; | AppStatus = package.ApplicationStatus; | ||||
Warning = package.Warning; | Warning = package.Warning; | ||||
Fault = package.Fault; | Fault = package.Fault; | ||||
@@ -22,4 +22,20 @@ namespace HBLDevice.IceCream | |||||
public class DischargeEvent : IEvent | public class DischargeEvent : IEvent | ||||
{ | { | ||||
} | } | ||||
/// <summary> | |||||
/// 开始制作 | |||||
/// </summary> | |||||
public class IceCreamBeginCook : IEvent | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 结束制作 | |||||
/// </summary> | |||||
public class IceCreamEndCook : IEvent | |||||
{ | |||||
} | |||||
} | } |
@@ -18,7 +18,7 @@ namespace HBLDevice.IceCream | |||||
byte[] cmdHeartDW; | byte[] cmdHeartDW; | ||||
private SerialPortClient commProxy; | private SerialPortClient commProxy; | ||||
private IceCreamEndCook iceCreamEndCook = new IceCreamEndCook(); | |||||
/// <summary> | /// <summary> | ||||
/// 初始化 | /// 初始化 | ||||
/// </summary> | /// </summary> | ||||
@@ -81,6 +81,7 @@ namespace HBLDevice.IceCream | |||||
{ | { | ||||
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); | ||||
iceCreamEndCook.Publish(); | |||||
Noticer.ShowEx(string.Format("出料操作->设置模式[{0}]", MORKI_MODE.打料)); | Noticer.ShowEx(string.Format("出料操作->设置模式[{0}]", MORKI_MODE.打料)); | ||||
} | } | ||||
else | else | ||||