Browse Source

MorktTIAOSHI

样式分支
NXX 2 years ago
parent
commit
034cbbdbf2
4 changed files with 64 additions and 30 deletions
  1. +9
    -3
      BPASmartClient.GSIceCream/IceCreamMachine.cs
  2. +36
    -9
      BPASmartClient.MorkT/Control_MorkT.cs
  3. +3
    -2
      BPASmartClient.MorkT/GLV_MorkT.cs
  4. +16
    -16
      BPASmartClient.MorkT/ViewModel/DebugViewModel.cs

+ 9
- 3
BPASmartClient.GSIceCream/IceCreamMachine.cs View File

@@ -88,6 +88,12 @@ namespace BPASmartClient.GSIceCream

ThreadManage.GetInstance().StartLong(new Action(() =>
{
status["test"] = 0;
for (int i = 0; i < 1000; i++)
{
status["test"] = (int)status["test"] + 1;
Thread.Sleep(1000);
}
ResolveMsg();
}), "冰淇淋解析线程");
}
@@ -181,9 +187,9 @@ namespace BPASmartClient.GSIceCream
status["YLWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.YLWD_L,heartUpMsg.YLWD_H },0);
status["HQWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HQWD_L,heartUpMsg.HQWD_H },0);
status["HJWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L,heartUpMsg.HJWD_H },0);
status["DL"] = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L,heartUpMsg.DL_H },0);
status["DL"] = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0);
status["Fault"] = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L,heartUpMsg.GZ_H },0);
status["CXB"] = heartUpMsg.CXB;
status["CXB"] = heartUpMsg.CXB;
status["DLCompleted"] = (heartUpMsg.DLTJ >> 4 & 1) == 1;

if (RTrig.GetInstance("打料完成检测").Start((bool)status["DLCompleted"]))
@@ -195,7 +201,7 @@ namespace BPASmartClient.GSIceCream
{
MessageLog.GetInstance.Show("打料中");
}
Thread.Sleep(1000);
Thread.Sleep(100);
}

private void ProcessModeUp(ICMSG_MODE_UP modeUpMsg)


+ 36
- 9
BPASmartClient.MorkT/Control_MorkT.cs View File

@@ -39,7 +39,12 @@ namespace BPASmartClient.MorkT
if (morkT.MakeCoffeeOrder != null)
morkT.MakeCoffeeOrder.OrderStatus = 1;
});
int i = 0;
////ThreadManage.GetInstance().StartLong(new Action(() =>
////{
//// i = (int)Status.status["GSIceCream.IceCreamMachine.test"];
////}),"test");

MessageLog.GetInstance.Show("MORKT 设备初始化完成");

@@ -51,8 +56,31 @@ namespace BPASmartClient.MorkT
morkT = new GLV_MorkT();
}


private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
}
}
}

public override void MainTask()
{

GetStatus("RobotMode", new Action<object>((o) =>
{


}));





MakeCoffeeProcess();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 },(o)=>
{
@@ -60,7 +88,6 @@ namespace BPASmartClient.MorkT
{
if(!resultValue)//取餐口有空余位置
{

MakeIceCreamProcess();
MakeCoffeeComplete();
}
@@ -196,7 +223,7 @@ namespace BPASmartClient.MorkT

private void Wait(int value = 101)
{
while (!((bool)Status.status["OK"] && (int)Status.status["Value"] == value))
while (!((bool)Status.status["Lebai.LebaiRobot.OK"] && (int)Status.status["Lebai.LebaiRobot.Value"] == value))
{
Thread.Sleep(5);
}
@@ -284,7 +311,7 @@ namespace BPASmartClient.MorkT
Thread.Sleep(500);
DeviceProcessLogShow("尝试取咖啡杯!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
int count = 2;
int count = 1;
bool result = true;
p:
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10033 }); //SENCE_咖啡杯检测
@@ -337,14 +364,14 @@ namespace BPASmartClient.MorkT
{
if (IceCreamCanMake())
{
if(Status.status.ContainsKey("CurrentMode"))
if(Status.status.ContainsKey("GSIceCream.IceCreamMachine.CurrentMode"))
{
if ((MORKI_MODE)Status.status["CurrentMode"] != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
if ((MORKI_MODE)Status.status["GSIceCream.IceCreamMachine.CurrentMode"] != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
}

if(Status.status.ContainsKey("CBX"))
if(Status.status.ContainsKey("GSIceCream.IceCreamMachine.CBX"))
{
if ((short)Status.status["CBX"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
if ((short)Status.status["GSIceCream.IceCreamMachine.CBX"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
{
bool result = true;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
@@ -464,7 +491,7 @@ namespace BPASmartClient.MorkT
{
int count_1 = 0;

while ((short)Status.status["CBX"] <= 86)
while ((short)Status.status["GSIceCream.IceCreamMachine.CBX"] <= 86)
{
Thread.Sleep(5);
count_1++;


+ 3
- 2
BPASmartClient.MorkT/GLV_MorkT.cs View File

@@ -1,4 +1,5 @@
using Robotc;
using BPASmartClient.Device;
using Robotc;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -8,7 +9,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.MorkT
{
public class GLV_MorkT
public class GLV_MorkT:IStatus
{
/// <summary>
/// 咖啡订单队列


+ 16
- 16
BPASmartClient.MorkT/ViewModel/DebugViewModel.cs View File

@@ -197,25 +197,25 @@ namespace BPASmartClient.MorkT.ViewModel
if (CurrentData != null && CurrentData.Count != 0)
{
RobotConnected = (bool)CurrentData["Lebai.LebaiRobot.IsConnected"] ? "已连接" : "未连接";
IceCreamConnected = (bool)CurrentData["GSIceCream.IceCreamMachine.IsConnected"] ? "已连接" : "未连接";
CoffeeConnected = (bool)CurrentData["GSIceCream.IceCreamMachine.IsConnected"] ? "已连接" : "未连接";
//IceCreamConnected = (bool)CurrentData["GSIceCream.IceCreamMachine.IsConnected"] ? "已连接" : "未连接";
//CoffeeConnected = (bool)CurrentData["GSIceCream.IceCreamMachine.IsConnected"] ? "已连接" : "未连接";

RobotMode = (ELebaiRModel)CurrentData["Lebai.LebaiRobot.RobotMode"];

CoffeeStatus = (DrCoffeeStatus)CurrentData["DRCoffee.CoffeeMachine.Status"];
AppStatus = (DrCoffeeAppStatus)CurrentData["DRCoffee.CoffeeMachine.AppStatus"];
Warning = (DrCoffeeWarning)CurrentData["DRCoffee.CoffeeMachine.Warning"];
CaffeeFault = (DrCoffeeFault)CurrentData["DRCoffee.CoffeeMachine.Fault"];
YLWD = (short)CurrentData["GSIceCream.IceCreamMachine.YLWD"];
HQWD = (short)CurrentData["GSIceCream.IceCreamMachine.HQWD"];
HJWD = (short)CurrentData["GSIceCream.IceCreamMachine.HJWD"];
DL = (short)CurrentData["GSIceCream.IceCreamMachine.DL"];
DY = (short)CurrentData["GSIceCream.IceCreamMachine.DY"];
CurrentMode = (MORKI_MODE)CurrentData["GSIceCream.IceCreamMachine.CurrentMode"];
IceCreamFault = (MORKI_FAULT)CurrentData["GSIceCream.IceCreamMachine.Fault"];
CXB = (byte)CurrentData["GSIceCream.IceCreamMachine.CXB"];
DLCompleted = (bool)CurrentData["GSIceCream.IceCreamMachine.DLCompleted"] ? "打料完成" : "打料中";
//CoffeeStatus = (DrCoffeeStatus)CurrentData["DRCoffee.CoffeeMachine.Status"];
//AppStatus = (DrCoffeeAppStatus)CurrentData["DRCoffee.CoffeeMachine.AppStatus"];
//Warning = (DrCoffeeWarning)CurrentData["DRCoffee.CoffeeMachine.Warning"];
//CaffeeFault = (DrCoffeeFault)CurrentData["DRCoffee.CoffeeMachine.Fault"];
//YLWD = (short)CurrentData["GSIceCream.IceCreamMachine.YLWD"];
//HQWD = (short)CurrentData["GSIceCream.IceCreamMachine.HQWD"];
//HJWD = (short)CurrentData["GSIceCream.IceCreamMachine.HJWD"];
//DL = (short)CurrentData["GSIceCream.IceCreamMachine.DL"];
//DY = (short)CurrentData["GSIceCream.IceCreamMachine.DY"];
//CurrentMode = (MORKI_MODE)CurrentData["GSIceCream.IceCreamMachine.CurrentMode"];
//IceCreamFault = (MORKI_FAULT)CurrentData["GSIceCream.IceCreamMachine.Fault"];
//CXB = (byte)CurrentData["GSIceCream.IceCreamMachine.CXB"];
//DLCompleted = (bool)CurrentData["GSIceCream.IceCreamMachine.DLCompleted"] ? "打料完成" : "打料中";
}
Thread.Sleep(500);


Loading…
Cancel
Save