pry 2 years ago
parent
commit
6ba3296d84
7 changed files with 67 additions and 4 deletions
  1. +1
    -0
      HBLConsole.Business/MessageServer/Base.cs
  2. +21
    -1
      HBLConsole.MORKIC/Control_MORKIC.cs
  3. +1
    -1
      HBLConsole/App.config
  4. +16
    -0
      HBLDevice.Coffee/CommandEvent.cs
  5. +10
    -1
      HBLDevice.Coffee/MorkCStatus.cs
  6. +16
    -0
      HBLDevice.IceCream/CommandEvent.cs
  7. +2
    -1
      HBLDevice.IceCream/CommandHandler.cs

+ 1
- 0
HBLConsole.Business/MessageServer/Base.cs View File

@@ -111,6 +111,7 @@ namespace HBLConsole.Business.MessageServer
/// </summary>
private void WritePlcData()
{
return;
//写配方数据到PLC
List<ushort> recipeBoms = new List<ushort>();
foreach (var item in Json<BatchingInfoPar>.Data.recipeBoms.RecipeIds)


+ 21
- 1
HBLConsole.MORKIC/Control_MORKIC.cs View File

@@ -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<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 baud_Coffee = config.AppSettings.Settings["BAUD_Coffee"].Value;
@@ -81,6 +84,7 @@ namespace HBLConsole.MORKIC
ReadData();
}


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

private AutoResetEvent are=new AutoResetEvent(false);

/// <summary>
/// 做咖啡
/// </summary>
@@ -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()
{


+ 1
- 1
HBLConsole/App.config View File

@@ -11,7 +11,7 @@

<!--客户端ID-->
<!--MorkD = 2,MorkS 且时且多 = 8,MorkS 珠海 = 9,冰淇淋 = 4,咖啡机 = 13-->
<add key="ClientId" value="2"/>
<add key="ClientId" value="4"/>
<!--IOT大屏上报-->
<add key="ProductKey" value="grgpECHSL7q"/>
<add key="DeviceName" value="qsqd_zmj"/>


+ 16
- 0
HBLDevice.Coffee/CommandEvent.cs View File

@@ -21,4 +21,20 @@ namespace HBLDevice.Coffee
public class CancelMakeCoffeeEvent : IEvent
{
}

/// <summary>
/// 开始制作
/// </summary>
public class CoffeBeginCook : IEvent
{

}

/// <summary>
/// 结束制作
/// </summary>
public class CoffeEndCook : IEvent
{

}
}

+ 10
- 1
HBLDevice.Coffee/MorkCStatus.cs View File

@@ -9,6 +9,7 @@ namespace HBLDevice.Coffee
{
public class MorkCStatus : Singleton<MorkCStatus>
{
private CoffeBeginCook coffeBeginCook = new CoffeBeginCook();
private DateTime lastRefreshTime = DateTime.MinValue;
/// <summary>
/// 是否在线
@@ -51,7 +52,15 @@ namespace HBLDevice.Coffee
/// <param name="package"></param>
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;


+ 16
- 0
HBLDevice.IceCream/CommandEvent.cs View File

@@ -22,4 +22,20 @@ namespace HBLDevice.IceCream
public class DischargeEvent : IEvent
{
}

/// <summary>
/// 开始制作
/// </summary>
public class IceCreamBeginCook : IEvent
{

}

/// <summary>
/// 结束制作
/// </summary>
public class IceCreamEndCook : IEvent
{

}
}

+ 2
- 1
HBLDevice.IceCream/CommandHandler.cs View File

@@ -18,7 +18,7 @@ namespace HBLDevice.IceCream
byte[] cmdHeartDW;

private SerialPortClient commProxy;
private IceCreamEndCook iceCreamEndCook = new IceCreamEndCook();
/// <summary>
/// 初始化
/// </summary>
@@ -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


Loading…
Cancel
Save