@@ -0,0 +1,14 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<PropertyGroup> | |||||
<TargetFramework>net6.0</TargetFramework> | |||||
<ImplicitUsings>enable</ImplicitUsings> | |||||
<Nullable>enable</Nullable> | |||||
</PropertyGroup> | |||||
<ItemGroup> | |||||
<ProjectReference Include="..\BPASmartClient.Peripheral\BPASmartClient.Peripheral.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.SerialPort\BPASmartClient.SerialPort.csproj" /> | |||||
</ItemGroup> | |||||
</Project> |
@@ -0,0 +1,67 @@ | |||||
using BPASmartClient.EventBus; | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.Model; | |||||
using BPASmartClient.Peripheral; | |||||
using BPASmartClient.SerialPort; | |||||
using static BPASmartClient.EventBus.EventBus; | |||||
namespace BPASmartClient.Icemoker | |||||
{ | |||||
public class IceMakerMachine : BasePeripheral | |||||
{ | |||||
IceMakerHelper iceMakerHelper = new IceMakerHelper(); | |||||
public override void Init() | |||||
{ | |||||
iceMakerHelper.Open(communicationPar.SerialPort, communicationPar.BaudRate); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
IsConnected = iceMakerHelper.IsOpen; | |||||
if (!IsConnected) IsWork = false; | |||||
while (IsConnected) | |||||
{ | |||||
IsWork = true; | |||||
if (status != null) | |||||
{ | |||||
SetStatus("GetDeviceStatus", iceMakerHelper.GetDeviceStatus()); | |||||
} | |||||
Thread.Sleep(500); | |||||
} | |||||
Thread.Sleep(1000); | |||||
}), $"设备[{DeviceId}]制冰机读取线程", true); | |||||
EventBus.EventBus.GetInstance().Subscribe<StartMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.StartCook(); | |||||
}); | |||||
EventBus.EventBus.GetInstance().Subscribe<StopMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.EndCook(); | |||||
}); | |||||
EventBus.EventBus.GetInstance().Subscribe<SetIceNumber>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
var parm = @event as SetIceNumber; | |||||
iceMakerHelper.IceValue(Convert.ToByte(parm?.Value)); | |||||
}); | |||||
} | |||||
public override void Start() | |||||
{ | |||||
} | |||||
public override void Stop() | |||||
{ | |||||
} | |||||
public override void WriteData(string address, object value) | |||||
{ | |||||
} | |||||
protected override void InitStatus() | |||||
{ | |||||
} | |||||
} | |||||
} |
@@ -25,7 +25,10 @@ namespace BPASmartClient.JAKA | |||||
{ | { | ||||
SetStatus("GetProgramStatus", (int)jaKaHelper.GetProgramStatus()); | SetStatus("GetProgramStatus", (int)jaKaHelper.GetProgramStatus()); | ||||
SetStatus("Get_RobotAO1", jaKaHelper.Get_RobotAO1()); | SetStatus("Get_RobotAO1", jaKaHelper.Get_RobotAO1()); | ||||
SetStatus("Get_RobotDI0", jaKaHelper.Get_RobotDI(0)); | |||||
SetStatus("Get_RobotDI1", jaKaHelper.Get_RobotDI(1)); | |||||
SetStatus("Get_RobotDI2", jaKaHelper.Get_RobotDI(2)); | |||||
SetStatus("Get_RobotDI3", jaKaHelper.Get_RobotDI(3)); | |||||
} | } | ||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
} | } | ||||
@@ -0,0 +1,26 @@ | |||||
using BPASmartClient.Model.PLC; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.Model | |||||
{ | |||||
public class IceMaker | |||||
{ | |||||
} | |||||
public class StartMakeIce : BaseEvent | |||||
{ | |||||
} | |||||
public class StopMakeIce : BaseEvent | |||||
{ | |||||
} | |||||
public class SetIceNumber : WriteModel | |||||
{ | |||||
} | |||||
} |
@@ -9,79 +9,7 @@ namespace BPASmartClient.Model | |||||
{ | { | ||||
public class JuicerModel | public class JuicerModel | ||||
{ | { | ||||
#region 果汁机设备MORKT2 Lebai机器人 | |||||
//public const int JUICE2_初始位 = 10021; | |||||
//public const int JUICE2_检测位回原点 = 10023; | |||||
//public const int JUICE2_取纸杯 = 10006; | |||||
//public const int JUICE2_二次取杯 = 10008; | |||||
//public const int JUICE2_纸杯检测 = 10007; | |||||
//public const int JUICE2_再检测 = 10024; | |||||
//public const int JUICE2_接咖啡 = 10009; | |||||
//public const int JUICE2_放咖啡杯 = 10010; | |||||
//public const int JUICE2_接茶叶 = 10017; | |||||
//public const int JUICE2_接茶水 = 10018; | |||||
//public const int JUICE2_接水 = 10020; | |||||
//public const int JUICE2_放水杯 = 10019; | |||||
//public const int JUICE2_接果汁公共位 = 10011; | |||||
//public const int JUICE2_接1号果汁 = 10012; | |||||
//public const int JUICE2_接2号果汁 = 10013; | |||||
//public const int JUICE2_接3号果汁 = 10014; | |||||
//public const int JUICE2_接4号果汁 = 10015; | |||||
//public const int JUICE2_放果汁杯 = 10016; | |||||
public const int JUICE2_初始位 = 10001; | |||||
public const int JUICE2_检测位回原点 = 10001; | |||||
public const int JUICE2_取空杯过渡位 = 10004; | |||||
public const int JUICE2_取纸杯 = 10002; | |||||
public const int JUICE2_取纸杯检测 = 10003; | |||||
public const int JUICE2_再检测 = 10024; | |||||
public const int JUICE2_二次取杯 = 10008; | |||||
//public const int JUICE2_取杯完成后接饮料过渡位 = 10004; | |||||
public const int JUICE2_接咖啡 = 10004; | |||||
//public const int JUICE2_接咖啡放杯过渡位 = 10004; | |||||
public const int JUICE2_接果汁1 = 10004; | |||||
public const int JUICE2_接果汁2 = 10004; | |||||
public const int JUICE2_接果汁3 = 10004; | |||||
public const int JUICE2_接果汁4 = 10004; | |||||
public const int JUICE2_接茶叶 = 10004; | |||||
public const int JUICE2_接茶水 = 10004; | |||||
public const int JUICE2_接开水 = 10004; | |||||
//public const int JUICE2_接开水_茶水放杯过渡位 = 10004; | |||||
public const int JUICE2_放咖啡杯 = 10004;//放咖啡杯包括取接好咖啡的流程 | |||||
public const int JUICE2_放果汁杯1 = 10004; | |||||
public const int JUICE2_放果汁杯2 = 10004; | |||||
public const int JUICE2_放果汁杯3 = 10004; | |||||
public const int JUICE2_放果汁杯4 = 10004; | |||||
public const int JUICE2_放水杯 = 10004; | |||||
#endregion | |||||
#region 果汁机设备 MORKT1 JAKA机器人 | |||||
public const int JUICE_初始位 = 20000; | |||||
public const int JUICE_取杯 = 20001; | |||||
public const int JUICE_取杯检测 = 20010; | |||||
public const int JUICE_接咖啡 = 20020; | |||||
public const int JUICE_接1号果汁 = 20030; | |||||
public const int JUICE_接2号果汁 = 20040; | |||||
public const int JUICE_接3号果汁 = 20050; | |||||
public const int JUICE_接4号果汁 = 20060; | |||||
public const int JUICE_接茶 = 20070; | |||||
public const int JUICE_接茶水 = 20075; | |||||
public const int JUICE_接水 = 20080; | |||||
public const int JUICE_放咖啡杯 = 20090; | |||||
public const int JUICE_放果汁杯 = 20100; | |||||
public const int JUICE_放茶水杯 = 20110; | |||||
public const int JUICE_放杯 = 20120; | |||||
public const int JUICE_放杯检测 = 20120; | |||||
#endregion | |||||
} | } | ||||
public class WriteJuicer : WriteModel | public class WriteJuicer : WriteModel | ||||
@@ -440,7 +440,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
{ | { | ||||
DeviceProcessLogShow("咖啡杯取杯完成"); | DeviceProcessLogShow("咖啡杯取杯完成"); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接咖啡); | |||||
Sence(GVL_MorkTLebaiJC.接咖啡); | |||||
Wait(); | Wait(); | ||||
pickUpCoffeeHaveCup = true; | pickUpCoffeeHaveCup = true; | ||||
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | ||||
@@ -448,7 +448,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
else | else | ||||
{ | { | ||||
DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!"); | DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!"); | ||||
Sence(JuicerModel.JUICE2_初始位); | |||||
Sence(GVL_MorkTLebaiJC.机器人初始位); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -465,7 +465,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
} | } | ||||
outCupCheck = false; | outCupCheck = false; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放咖啡杯); | |||||
Sence(GVL_MorkTLebaiJC.放咖啡杯); | |||||
Wait(); | Wait(); | ||||
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | ||||
DeviceProcessLogShow("咖啡制作完成"); | DeviceProcessLogShow("咖啡制作完成"); | ||||
@@ -485,7 +485,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
if (resultTakeCup == 1) | if (resultTakeCup == 1) | ||||
{ | { | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接开水); | |||||
Sence(GVL_MorkTLebaiJC.接开水); | |||||
Wait(); | Wait(); | ||||
Output(false, 1); | Output(false, 1); | ||||
Output(false, 0); | Output(false, 0); | ||||
@@ -524,7 +524,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
{ | { | ||||
DeviceProcessLogShow("取茶杯完成"); | DeviceProcessLogShow("取茶杯完成"); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接茶叶); | |||||
Sence(GVL_MorkTLebaiJC.接茶叶); | |||||
Wait(); | Wait(); | ||||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish(); | new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish(); | ||||
@@ -535,7 +535,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
Thread.Sleep(3000); | Thread.Sleep(3000); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接茶水); | |||||
Sence(GVL_MorkTLebaiJC.接茶水); | |||||
Wait(); | Wait(); | ||||
Output(false, 1); | Output(false, 1); | ||||
Output(false, 0); | Output(false, 0); | ||||
@@ -572,7 +572,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
} | } | ||||
outCupCheck = false; | outCupCheck = false; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放水杯); | |||||
Sence(GVL_MorkTLebaiJC.放水杯); | |||||
Wait(); | Wait(); | ||||
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | ||||
DeviceProcessLogShow("茶水制作完成"); | DeviceProcessLogShow("茶水制作完成"); | ||||
@@ -606,7 +606,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
else | else | ||||
JuicerNum = 0x01; | JuicerNum = 0x01; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁1); | |||||
Sence(GVL_MorkTLebaiJC.接果汁1); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 53: | case 53: | ||||
@@ -615,7 +615,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
else | else | ||||
JuicerNum = 0x03; | JuicerNum = 0x03; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁2); | |||||
Sence(GVL_MorkTLebaiJC.接果汁2); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 54: | case 54: | ||||
@@ -624,7 +624,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
else | else | ||||
JuicerNum = 0x05; | JuicerNum = 0x05; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁3); | |||||
Sence(GVL_MorkTLebaiJC.接果汁3); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 55: | case 55: | ||||
@@ -633,13 +633,13 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
else | else | ||||
JuicerNum = 0x07; | JuicerNum = 0x07; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁4); | |||||
Sence(GVL_MorkTLebaiJC.接果汁4); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
default: | default: | ||||
JuicerNum = 0x00; | JuicerNum = 0x00; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁1); | |||||
Sence(GVL_MorkTLebaiJC.接果汁1); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
} | } | ||||
@@ -669,27 +669,27 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
{ | { | ||||
case 52: | case 52: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯1); | |||||
Sence(GVL_MorkTLebaiJC.放果汁杯1); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 53: | case 53: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯2); | |||||
Sence(GVL_MorkTLebaiJC.放果汁杯2); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 54: | case 54: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯3); | |||||
Sence(GVL_MorkTLebaiJC.放果汁杯3); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 55: | case 55: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯4); | |||||
Sence(GVL_MorkTLebaiJC.放果汁杯4); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
default: | default: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯1); | |||||
Sence(GVL_MorkTLebaiJC.放果汁杯1); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
} | } | ||||
@@ -716,31 +716,17 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
{ | { | ||||
nCnt = 0; | nCnt = 0; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_初始位); | |||||
Sence(GVL_MorkTLebaiJC.机器人初始位); | |||||
Wait(); | Wait(); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_取纸杯); | |||||
Sence(GVL_MorkTLebaiJC.取纸杯); | |||||
Wait(); | Wait(); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_取纸杯检测); | |||||
Sence(GVL_MorkTLebaiJC.取纸杯检测); | |||||
Wait(); | Wait(); | ||||
nCnt++; | nCnt++; | ||||
Thread.Sleep(2000); | Thread.Sleep(2000); | ||||
while (checkCnt < 3) | |||||
{ | |||||
if (!GetStatus<bool>("GetInput")) | |||||
{ | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(JuicerModel.JUICE2_再检测); | |||||
Wait(); | |||||
} | |||||
else | |||||
{ | |||||
break; | |||||
} | |||||
checkCnt++; | |||||
} | |||||
checkCnt = 0; | |||||
while (!GetStatus<bool>("GetInput")) //读取传感器的值 | while (!GetStatus<bool>("GetInput")) //读取传感器的值 | ||||
{ | { | ||||
if (nCnt > 3) | if (nCnt > 3) | ||||
@@ -748,7 +734,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
nCnt = 0; | nCnt = 0; | ||||
DeviceProcessLogShow("三次取杯失败,回原点"); | DeviceProcessLogShow("三次取杯失败,回原点"); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_检测位回原点); | |||||
Sence(GVL_MorkTLebaiJC.机器人初始位); | |||||
Wait(); | Wait(); | ||||
return 2; | return 2; | ||||
} | } | ||||
@@ -756,27 +742,11 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
{ | { | ||||
nCnt++; | nCnt++; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_二次取杯); | |||||
Sence(GVL_MorkTLebaiJC.二次取杯); | |||||
Wait(); | Wait(); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_取纸杯检测); | |||||
Sence(GVL_MorkTLebaiJC.取纸杯检测); | |||||
Wait(); | Wait(); | ||||
checkCnt = 0; | |||||
while (checkCnt < 3) | |||||
{ | |||||
if (!GetStatus<bool>("GetInput")) | |||||
{ | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(JuicerModel.JUICE2_再检测); | |||||
Wait(); | |||||
} | |||||
else | |||||
{ | |||||
checkCnt = 0; | |||||
return 1; | |||||
} | |||||
checkCnt++; | |||||
} | |||||
} | } | ||||
Thread.Sleep(1000); | Thread.Sleep(1000); | ||||
} | } | ||||
@@ -796,10 +766,10 @@ namespace BPASmartClient.MorkTLebaiJC | |||||
try | try | ||||
{ | { | ||||
if (GetStatus<bool>("RobotValue1")) return 2; | if (GetStatus<bool>("RobotValue1")) return 2; | ||||
Sence(JuicerModel.JUICE_放杯); | |||||
Sence(GVL_MorkTLebaiJC.JUICE_放杯); | |||||
Wait(); | Wait(); | ||||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | ||||
Sence(JuicerModel.JUICE_放杯检测); | |||||
Sence(GVL_MorkTLebaiJC.JUICE_放杯检测); | |||||
Wait(); | Wait(); | ||||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | ||||
if (GetStatus<bool>("GetInput2")) | if (GetStatus<bool>("GetInput2")) | ||||
@@ -0,0 +1,136 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using BPASmartClient.Device; | |||||
using System.Collections.Concurrent; | |||||
namespace BPASmartClient.MorkTLebaiJC | |||||
{ | |||||
public class GVL_MorkTLebaiJC : IStatus | |||||
{ | |||||
#region 果汁机设备MORKT2 Lebai机器人 | |||||
public const int 机器人安全位 = 10000;//一个位置(模组可移动,机器人不发生碰撞) | |||||
public const int 机器人初始位 = 10001; | |||||
public const int 初始位_机器人安全位 = 10002;//初始位---安全位 | |||||
public const int 取纸杯 = 10005;//安全位---取杯位 | |||||
public const int 二次取杯 = 10008;//取纸杯检测位---二次取杯位 | |||||
public const int 取纸杯检测 = 10006;//取杯位---取杯检测位 | |||||
public const int 取杯位_机器人安全位 = 10002;//取杯检测位---安全位 | |||||
public const int 接咖啡 = 10010;//安全位---接咖啡位 | |||||
public const int 接果汁过渡位 = 10002;//安全位---接果汁过渡位 | |||||
public const int 接果汁1 = 10011;//接果汁过渡位---果汁1位 | |||||
public const int 接果汁2 = 10012;//接果汁过渡位---果汁2位 | |||||
public const int 接果汁3 = 10013;//接果汁过渡位---果汁3位 | |||||
public const int 接果汁4 = 10014;//接果汁过渡位---果汁4位 | |||||
public const int 接果汁_机器人安全位 = 10002;//接果汁过渡位---安全位 | |||||
public const int 接茶叶 = 10015; | |||||
public const int 接茶水 = 10016; | |||||
public const int 接开水 = 10017; | |||||
public const int 接水_机器人安全位 = 10002; | |||||
public const int 接冰块 = 10018; | |||||
public const int 接冰_机器人安全位 = 10002; | |||||
public const int 放咖啡杯 = 10020; | |||||
public const int 放果汁杯1 = 10021; | |||||
public const int 放果汁杯2 = 10022; | |||||
public const int 放果汁杯3 = 10023; | |||||
public const int 放果汁杯4 = 10024; | |||||
public const int 放水杯 = 10025; | |||||
public const int 放杯 = 10001; | |||||
public const int 放杯_机器人安全位 = 10001; | |||||
#endregion | |||||
#region 果汁机设备 MORKT1 JAKA机器人 | |||||
public const int JUICE_初始位 = 20000; | |||||
public const int JUICE_取杯 = 20001; | |||||
public const int JUICE_取杯检测 = 20010; | |||||
public const int JUICE_接咖啡 = 20020; | |||||
public const int JUICE_接1号果汁 = 20030; | |||||
public const int JUICE_接2号果汁 = 20040; | |||||
public const int JUICE_接3号果汁 = 20050; | |||||
public const int JUICE_接4号果汁 = 20060; | |||||
public const int JUICE_接茶 = 20070; | |||||
public const int JUICE_接茶水 = 20075; | |||||
public const int JUICE_接水 = 20080; | |||||
public const int JUICE_放咖啡杯 = 20090; | |||||
public const int JUICE_放果汁杯 = 20100; | |||||
public const int JUICE_放茶水杯 = 20110; | |||||
public const int JUICE_放杯 = 20120; | |||||
public const int JUICE_放杯检测 = 20120; | |||||
#endregion | |||||
/// <summary> | |||||
/// <summary> | |||||
/// 咖啡订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesCoffee = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 是否有咖啡杯 | |||||
/// </summary> | |||||
public bool IsHaveCoffeeCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeCoffeeEnd = false; | |||||
/// <summary> | |||||
/// 果汁订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuicer = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 果汁是否在制作中 | |||||
/// </summary> | |||||
public bool IsHaveJuiceCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeJuiceEnd = false; | |||||
/// <summary> | |||||
/// 做茶订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTea = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 茶或水是否在制作中 | |||||
/// </summary> | |||||
public bool IsHaveTeaWaterCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeTeaEnd = false; | |||||
/// <summary> | |||||
/// 做开水订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesWater = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 等待取餐订单 | |||||
/// </summary> | |||||
public OrderLocInfo waitMorkOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 当前正在制作咖啡 | |||||
/// </summary> | |||||
public OrderLocInfo MakeCoffeeOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 订单ID | |||||
/// </summary> | |||||
public string SuborderId = null; | |||||
} | |||||
} |
@@ -1,76 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using BPASmartClient.Device; | |||||
using System.Collections.Concurrent; | |||||
namespace BPASmartClient.MorkTLebaiJC | |||||
{ | |||||
public class GVL_MorkTLebaiJC : IStatus | |||||
{ | |||||
/// <summary> | |||||
/// <summary> | |||||
/// 咖啡订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesCoffee = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 是否有咖啡杯 | |||||
/// </summary> | |||||
public bool IsHaveCoffeeCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeCoffeeEnd = false; | |||||
/// <summary> | |||||
/// 果汁订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuicer = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 果汁是否在制作中 | |||||
/// </summary> | |||||
public bool IsHaveJuiceCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeJuiceEnd = false; | |||||
/// <summary> | |||||
/// 做茶订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTea = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 茶或水是否在制作中 | |||||
/// </summary> | |||||
public bool IsHaveTeaWaterCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeTeaEnd = false; | |||||
/// <summary> | |||||
/// 做开水订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesWater = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 等待取餐订单 | |||||
/// </summary> | |||||
public OrderLocInfo waitMorkOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 当前正在制作咖啡 | |||||
/// </summary> | |||||
public OrderLocInfo MakeCoffeeOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 订单ID | |||||
/// </summary> | |||||
public string SuborderId = null; | |||||
} | |||||
} |
@@ -0,0 +1,20 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<PropertyGroup> | |||||
<TargetFramework>net6.0</TargetFramework> | |||||
<ImplicitUsings>enable</ImplicitUsings> | |||||
<Nullable>enable</Nullable> | |||||
</PropertyGroup> | |||||
<ItemGroup> | |||||
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.DRCoffee\BPASmartClient.DRCoffee.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.IceMaker\BPASmartClient.IceMaker.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.Juicer\BPASmartClient.Juicer.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.MCU\BPASmartClient.MCU.csproj" /> | |||||
</ItemGroup> | |||||
</Project> |
@@ -19,7 +19,7 @@ using BPASmartClient.Model.乐白机器人; | |||||
using BPASmartClient.Model.单片机; | using BPASmartClient.Model.单片机; | ||||
using BPASmartClient.Model.PLC; | using BPASmartClient.Model.PLC; | ||||
namespace BPASmartClient.MorkT_Show | |||||
namespace BPASmartClient.MorkT_BarCounter | |||||
{ | { | ||||
/* | /* | ||||
* 冰淇淋咖啡机组合套装 | * 冰淇淋咖啡机组合套装 | ||||
@@ -31,7 +31,7 @@ namespace BPASmartClient.MorkT_Show | |||||
* 9: 茶 | * 9: 茶 | ||||
* 10: 茶杯 | * 10: 茶杯 | ||||
*/ | */ | ||||
public class Control_MORKJC_Show : BaseDevice | |||||
public class Control_MorkT_BarCounter : BaseDevice | |||||
{ | { | ||||
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | ||||
//容器位置 | //容器位置 | ||||
@@ -40,11 +40,15 @@ namespace BPASmartClient.MorkT_Show | |||||
private string mainMaterialLoc; | private string mainMaterialLoc; | ||||
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } | public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } | ||||
GVL_MorkTLebaiJC morkTLebaiJC =new GVL_MorkTLebaiJC(); | |||||
GVL_MorkT morkTJaka =new GVL_MorkT(); | |||||
/// <summary> | /// <summary> | ||||
/// 果汁机做法,true:热饮,false:冷饮 | /// 果汁机做法,true:热饮,false:冷饮 | ||||
/// </summary> | /// </summary> | ||||
private bool GuMake = false; | private bool GuMake = false; | ||||
/// <summary> | |||||
/// 订单是否加冰 | |||||
/// </summary> | |||||
private bool IsAddIce = false; | |||||
public override void DoMain() | public override void DoMain() | ||||
{ | { | ||||
if (Json<KeepDataBase>.Data.IsVerify) | if (Json<KeepDataBase>.Data.IsVerify) | ||||
@@ -55,7 +59,7 @@ namespace BPASmartClient.MorkT_Show | |||||
serverInit(); | serverInit(); | ||||
DataParse(); | DataParse(); | ||||
ActionManage.GetInstance.Register(new Action<object>((o) => { SimOrder(o); }), "SimOrder");//模拟订单委托注册 | ActionManage.GetInstance.Register(new Action<object>((o) => { SimOrder(o); }), "SimOrder");//模拟订单委托注册 | ||||
} | } | ||||
private void serverInit() | private void serverInit() | ||||
@@ -110,9 +114,10 @@ namespace BPASmartClient.MorkT_Show | |||||
switch (currentGoodsType) | switch (currentGoodsType) | ||||
{ | { | ||||
case GOODS_TYPE.COFFEE: | case GOODS_TYPE.COFFEE: | ||||
if (morkTLebaiJC.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
IsAddIce = order.MorkOrder.MakeID == "3";//判断是否加冰 | |||||
if (morkTJaka.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
{ | { | ||||
morkTLebaiJC.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() | |||||
morkTJaka.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() | |||||
{ | { | ||||
SuborderId = order.MorkOrder.SuborderId, | SuborderId = order.MorkOrder.SuborderId, | ||||
BatchingId = res.BatchingId, | BatchingId = res.BatchingId, | ||||
@@ -122,22 +127,22 @@ namespace BPASmartClient.MorkT_Show | |||||
} | } | ||||
break; | break; | ||||
case GOODS_TYPE.JUICE: | case GOODS_TYPE.JUICE: | ||||
GuMake = order.MorkOrder.MakeID == "2";//判断果汁的冷热 | |||||
if (morkTLebaiJC.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
if (morkTJaka.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
{ | { | ||||
morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() | |||||
morkTJaka.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() | |||||
{ | { | ||||
SuborderId = order.MorkOrder.SuborderId, | SuborderId = order.MorkOrder.SuborderId, | ||||
BatchingId = res.BatchingId, | BatchingId = res.BatchingId, | ||||
Loc = ushort.Parse(mainMaterialLoc), | Loc = ushort.Parse(mainMaterialLoc), | ||||
GoodName = order.MorkOrder.GoodsName, | GoodName = order.MorkOrder.GoodsName, | ||||
MakeID = ushort.Parse(order.MorkOrder.MakeID), | |||||
}); | }); | ||||
} | } | ||||
break; | break; | ||||
case GOODS_TYPE.TEA: | case GOODS_TYPE.TEA: | ||||
if (morkTLebaiJC.morkOrderPushesTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
if (morkTJaka.morkOrderPushesTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
{ | { | ||||
morkTLebaiJC.morkOrderPushesTea.Enqueue(new OrderLocInfo() | |||||
morkTJaka.morkOrderPushesTea.Enqueue(new OrderLocInfo() | |||||
{ | { | ||||
SuborderId = order.MorkOrder.SuborderId, | SuborderId = order.MorkOrder.SuborderId, | ||||
BatchingId = res.BatchingId, | BatchingId = res.BatchingId, | ||||
@@ -147,9 +152,9 @@ namespace BPASmartClient.MorkT_Show | |||||
} | } | ||||
break; | break; | ||||
case GOODS_TYPE.WATER: | case GOODS_TYPE.WATER: | ||||
if (morkTLebaiJC.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
if (morkTJaka.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
{ | { | ||||
morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo() | |||||
morkTJaka.morkOrderPushesWater.Enqueue(new OrderLocInfo() | |||||
{ | { | ||||
SuborderId = order.MorkOrder.SuborderId, | SuborderId = order.MorkOrder.SuborderId, | ||||
BatchingId = res.BatchingId, | BatchingId = res.BatchingId, | ||||
@@ -183,8 +188,8 @@ namespace BPASmartClient.MorkT_Show | |||||
{ | { | ||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | ||||
{ | { | ||||
if (morkTLebaiJC.IsHaveCoffeeCup) | |||||
morkTLebaiJC.MakeCoffeeEnd = true; | |||||
if (morkTJaka.IsHaveCoffeeCup) | |||||
morkTJaka.MakeCoffeeEnd = true; | |||||
}); | }); | ||||
if (pickUpCoffeeHaveCup) | if (pickUpCoffeeHaveCup) | ||||
{ | { | ||||
@@ -196,12 +201,12 @@ namespace BPASmartClient.MorkT_Show | |||||
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true) | else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true) | ||||
{ | { | ||||
bFirstTrig_Coffee = false; | bFirstTrig_Coffee = false; | ||||
if (morkTLebaiJC.IsHaveCoffeeCup) | |||||
morkTLebaiJC.MakeCoffeeEnd = true; | |||||
if (morkTJaka.IsHaveCoffeeCup) | |||||
morkTJaka.MakeCoffeeEnd = true; | |||||
} | } | ||||
} | } | ||||
if (morkTLebaiJC.IsHaveJuiceCup) | |||||
if (morkTJaka.IsHaveJuiceCup) | |||||
{ | { | ||||
var Juicestate = GetStatus<int[]>("GetDeviceStatus"); | var Juicestate = GetStatus<int[]>("GetDeviceStatus"); | ||||
if (Juicestate != null) | if (Juicestate != null) | ||||
@@ -212,7 +217,7 @@ namespace BPASmartClient.MorkT_Show | |||||
var Juicestate2 = Juicestate[1]; | var Juicestate2 = Juicestate[1]; | ||||
if (Juicestate1.IndexOf("0") == 1 && Juicestate2 == 0) | if (Juicestate1.IndexOf("0") == 1 && Juicestate2 == 0) | ||||
{ | { | ||||
morkTLebaiJC.MakeJuiceEnd = true; | |||||
morkTJaka.MakeJuiceEnd = true; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -225,10 +230,10 @@ namespace BPASmartClient.MorkT_Show | |||||
else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 30 && bFirstTrig_Juice==true) | else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 30 && bFirstTrig_Juice==true) | ||||
{ | { | ||||
bFirstTrig_Juice = false; | bFirstTrig_Juice = false; | ||||
morkTLebaiJC.MakeJuiceEnd = true; | |||||
morkTJaka.MakeJuiceEnd = true; | |||||
} | } | ||||
} | } | ||||
if (morkTLebaiJC.IsHaveTeaWaterCup) | |||||
if (morkTJaka.IsHaveTeaWaterCup) | |||||
{ | { | ||||
if (!bFirstTrig_TeaWater) | if (!bFirstTrig_TeaWater) | ||||
{ | { | ||||
@@ -238,7 +243,7 @@ namespace BPASmartClient.MorkT_Show | |||||
else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 50 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序 | else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 50 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序 | ||||
{ | { | ||||
bFirstTrig_TeaWater = false; | bFirstTrig_TeaWater = false; | ||||
morkTLebaiJC.MakeTeaEnd = true; | |||||
morkTJaka.MakeTeaEnd = true; | |||||
} | } | ||||
} | } | ||||
DoCoffee(); | DoCoffee(); | ||||
@@ -329,22 +334,22 @@ namespace BPASmartClient.MorkT_Show | |||||
private bool IsMakeCoffee() | private bool IsMakeCoffee() | ||||
{ | { | ||||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesCoffee.Count > 0 && !morkTLebaiJC.IsHaveCoffeeCup) ? true : false; | |||||
bool bMake = (IsHealth && morkTJaka.morkOrderPushesCoffee.Count > 0 && !morkTJaka.IsHaveCoffeeCup) ? true : false; | |||||
return bMake; | return bMake; | ||||
} | } | ||||
private bool IsMakeJuice() | private bool IsMakeJuice() | ||||
{ | { | ||||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesJuicer.Count > 0 && !morkTLebaiJC.IsHaveJuiceCup) ? true : false; | |||||
bool bMake = (IsHealth && morkTJaka.morkOrderPushesJuicer.Count > 0 && !morkTJaka.IsHaveJuiceCup) ? true : false; | |||||
return bMake; | return bMake; | ||||
} | } | ||||
private bool IsMakeTeaWater() | private bool IsMakeTeaWater() | ||||
{ | { | ||||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesTea.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false; | |||||
bool bMake = (IsHealth && morkTJaka.morkOrderPushesTea.Count > 0 && !morkTJaka.IsHaveTeaWaterCup) ? true : false; | |||||
return bMake; | return bMake; | ||||
} | } | ||||
private bool IsMakeWater() | private bool IsMakeWater() | ||||
{ | { | ||||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesWater.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false; | |||||
bool bMake = (IsHealth && morkTJaka.morkOrderPushesWater.Count > 0 && !morkTJaka.IsHaveTeaWaterCup) ? true : false; | |||||
return bMake; | return bMake; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -354,104 +359,122 @@ namespace BPASmartClient.MorkT_Show | |||||
{ | { | ||||
if (IsMakeCoffee()) | if (IsMakeCoffee()) | ||||
{ | { | ||||
if (morkTLebaiJC.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc)) | |||||
if (morkTJaka.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc)) | |||||
{ | { | ||||
PickUpCoffee();//接咖啡 | PickUpCoffee();//接咖啡 | ||||
morkTLebaiJC.IsHaveCoffeeCup = true; | |||||
morkTJaka.IsHaveCoffeeCup = true; | |||||
} | } | ||||
} | } | ||||
else if(morkTLebaiJC.MakeCoffeeEnd) | |||||
else if(morkTJaka.MakeCoffeeEnd) | |||||
{ | { | ||||
PutCoffeeCup(); | PutCoffeeCup(); | ||||
pickUpCoffeeHaveCup = false; | pickUpCoffeeHaveCup = false; | ||||
morkTLebaiJC.IsHaveCoffeeCup = false; | |||||
morkTJaka.IsHaveCoffeeCup = false; | |||||
} | } | ||||
} | } | ||||
private void DoJuice() | private void DoJuice() | ||||
{ | { | ||||
if (IsMakeJuice()) | if (IsMakeJuice()) | ||||
{ | { | ||||
if (morkTLebaiJC.morkOrderPushesJuicer.TryDequeue(out OrderLocInfo orderLoc)) | |||||
if (morkTJaka.morkOrderPushesJuicer.TryDequeue(out OrderLocInfo orderLoc)) | |||||
{ | { | ||||
switch (morkTJaka.morkOrderPushesJuicer.ElementAt(0).Loc) | |||||
{ | |||||
case 1: | |||||
GuMake = true; | |||||
IsAddIce = false; | |||||
break; | |||||
case 2: | |||||
GuMake = false; | |||||
IsAddIce = false; | |||||
break; | |||||
case 3: | |||||
GuMake = false; | |||||
IsAddIce = true; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
PickUpJuicer(); | PickUpJuicer(); | ||||
morkTLebaiJC.IsHaveJuiceCup = true; | |||||
morkTJaka.IsHaveJuiceCup = true; | |||||
} | } | ||||
} | } | ||||
else if (morkTLebaiJC.MakeJuiceEnd) | |||||
else if (morkTJaka.MakeJuiceEnd) | |||||
{ | { | ||||
Thread.Sleep(5000);//延迟五秒,防止接饮料口滴饮料 | Thread.Sleep(5000);//延迟五秒,防止接饮料口滴饮料 | ||||
putJuice(); | putJuice(); | ||||
pickUpJuiceHaveCup = false; | pickUpJuiceHaveCup = false; | ||||
morkTLebaiJC.IsHaveJuiceCup = false; | |||||
morkTLebaiJC.MakeJuiceEnd = false; | |||||
morkTJaka.IsHaveJuiceCup = false; | |||||
morkTJaka.MakeJuiceEnd = false; | |||||
} | } | ||||
} | } | ||||
private void DoBoiledTea() | private void DoBoiledTea() | ||||
{ | { | ||||
if (IsMakeTeaWater()) | if (IsMakeTeaWater()) | ||||
{ | { | ||||
if (morkTLebaiJC.morkOrderPushesTea.TryDequeue(out OrderLocInfo orderLoc)) | |||||
if (morkTJaka.morkOrderPushesTea.TryDequeue(out OrderLocInfo orderLoc)) | |||||
{ | { | ||||
PickUpTea(); | PickUpTea(); | ||||
morkTLebaiJC.IsHaveTeaWaterCup = true; | |||||
morkTJaka.IsHaveTeaWaterCup = true; | |||||
} | } | ||||
} | } | ||||
else if(morkTLebaiJC.MakeTeaEnd) | |||||
else if(morkTJaka.MakeTeaEnd) | |||||
{ | { | ||||
PutWaterCup(); | PutWaterCup(); | ||||
pickUpHotWaterHaveCup = false; | pickUpHotWaterHaveCup = false; | ||||
morkTLebaiJC.IsHaveTeaWaterCup = false ; | |||||
morkTLebaiJC.MakeTeaEnd = false; | |||||
morkTJaka.IsHaveTeaWaterCup = false ; | |||||
morkTJaka.MakeTeaEnd = false; | |||||
} | } | ||||
} | } | ||||
private void DoBoiledWater() | private void DoBoiledWater() | ||||
{ | { | ||||
if (IsMakeWater()) | if (IsMakeWater()) | ||||
{ | { | ||||
if (morkTLebaiJC.morkOrderPushesWater.TryDequeue(out OrderLocInfo orderLoc)) | |||||
if (morkTJaka.morkOrderPushesWater.TryDequeue(out OrderLocInfo orderLoc)) | |||||
{ | { | ||||
PickUpWater(); | PickUpWater(); | ||||
} | } | ||||
} | } | ||||
else if (morkTLebaiJC.MakeTeaEnd) | |||||
else if (morkTJaka.MakeTeaEnd) | |||||
{ | { | ||||
PutWaterCup(); | PutWaterCup(); | ||||
pickUpHotWaterHaveCup = false; | pickUpHotWaterHaveCup = false; | ||||
morkTLebaiJC.IsHaveTeaWaterCup = false; | |||||
morkTLebaiJC.MakeTeaEnd = false; | |||||
morkTJaka.IsHaveTeaWaterCup = false; | |||||
morkTJaka.MakeTeaEnd = false; | |||||
} | } | ||||
} | } | ||||
#region 做咖啡流程 | #region 做咖啡流程 | ||||
/// <summary> | /// <summary> | ||||
/// 接咖啡 | /// 接咖啡 | ||||
/// </summary> | /// </summary> | ||||
private void PickUpCoffee() | private void PickUpCoffee() | ||||
{ | { | ||||
//while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||||
//{ | |||||
// if (!outCupCheck) | |||||
// DeviceProcessLogShow("成品处有纸杯存在,请取走!!"); | |||||
// outCupCheck = true; | |||||
//} | |||||
if (!pickUpCoffeeHaveCup) | if (!pickUpCoffeeHaveCup) | ||||
{ | { | ||||
outCupCheck = false; | outCupCheck = false; | ||||
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
OrderChange(morkTJaka.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
int resultTakeCup = takeCup(); | int resultTakeCup = takeCup(); | ||||
if (resultTakeCup == 1) | if (resultTakeCup == 1) | ||||
{ | { | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
Wait(); | |||||
WritePLCData("",2);//将轴移动到接咖啡的位置 | |||||
DeviceProcessLogShow("咖啡杯取杯完成"); | DeviceProcessLogShow("咖啡杯取杯完成"); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接咖啡); | |||||
Sence(GVL_MorkT.接咖啡); | |||||
Wait(); | Wait(); | ||||
pickUpCoffeeHaveCup = true; | pickUpCoffeeHaveCup = true; | ||||
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||||
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)(morkTJaka.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!"); | DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!"); | ||||
Sence(JuicerModel.JUICE2_初始位); | |||||
Sence(GVL_MorkT.机器人初始位); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -468,9 +491,14 @@ namespace BPASmartClient.MorkT_Show | |||||
} | } | ||||
outCupCheck = false; | outCupCheck = false; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放咖啡杯); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
Wait(); | Wait(); | ||||
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
WritePLCData("", 2);//将轴移动到接咖啡的位置 | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.放咖啡杯); | |||||
Wait(); | |||||
OrderChange(morkTJaka.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
DeviceProcessLogShow("咖啡制作完成"); | DeviceProcessLogShow("咖啡制作完成"); | ||||
} | } | ||||
#endregion | #endregion | ||||
@@ -483,12 +511,12 @@ namespace BPASmartClient.MorkT_Show | |||||
#region 接水流程 | #region 接水流程 | ||||
if (!pickUpHotWaterHaveCup) | if (!pickUpHotWaterHaveCup) | ||||
{ | { | ||||
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
OrderChange(morkTJaka.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
int resultTakeCup = takeCup(); | int resultTakeCup = takeCup(); | ||||
if (resultTakeCup == 1) | if (resultTakeCup == 1) | ||||
{ | { | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接开水); | |||||
Sence(GVL_MorkT.接开水); | |||||
Wait(); | Wait(); | ||||
Output(false, 1); | Output(false, 1); | ||||
Output(false, 0); | Output(false, 0); | ||||
@@ -521,13 +549,13 @@ namespace BPASmartClient.MorkT_Show | |||||
#region 接茶流程 | #region 接茶流程 | ||||
if (!pickUpHotWaterHaveCup) | if (!pickUpHotWaterHaveCup) | ||||
{ | { | ||||
OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
OrderChange(morkTJaka.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
int resultTakeCup = takeCup(); | int resultTakeCup = takeCup(); | ||||
if (resultTakeCup == 1) | if (resultTakeCup == 1) | ||||
{ | { | ||||
DeviceProcessLogShow("取茶杯完成"); | DeviceProcessLogShow("取茶杯完成"); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接茶叶); | |||||
Sence(GVL_MorkT.接茶叶); | |||||
Wait(); | Wait(); | ||||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish(); | new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish(); | ||||
@@ -538,7 +566,7 @@ namespace BPASmartClient.MorkT_Show | |||||
Thread.Sleep(3000); | Thread.Sleep(3000); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接茶水); | |||||
Sence(GVL_MorkT.接茶水); | |||||
Wait(); | Wait(); | ||||
Output(false, 1); | Output(false, 1); | ||||
Output(false, 0); | Output(false, 0); | ||||
@@ -575,9 +603,9 @@ namespace BPASmartClient.MorkT_Show | |||||
} | } | ||||
outCupCheck = false; | outCupCheck = false; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放水杯); | |||||
Sence(GVL_MorkT.放水杯); | |||||
Wait(); | Wait(); | ||||
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
OrderChange(morkTJaka.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
DeviceProcessLogShow("茶水制作完成"); | DeviceProcessLogShow("茶水制作完成"); | ||||
} | } | ||||
@@ -587,6 +615,32 @@ namespace BPASmartClient.MorkT_Show | |||||
/// 果汁机控制信号 | /// 果汁机控制信号 | ||||
/// </summary> | /// </summary> | ||||
private byte JuicerNum; | private byte JuicerNum; | ||||
private void getIce() | |||||
{ | |||||
IsAddIceNow = IsAddIce; | |||||
if (IsAddIce) | |||||
{ | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.取杯位_机器人安全位); | |||||
Wait(); | |||||
WritePLCData("",3);//将模组移动到接冰的位置 | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接冰块); | |||||
Wait(); | |||||
new StartMakeIce() { }.Publish(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接冰_机器人安全位); | |||||
Wait(); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 当前订单是否加冰 | |||||
/// </summary> | |||||
private bool IsAddIceNow = false; | |||||
private int JuiceCH; | private int JuiceCH; | ||||
/// <summary> | /// <summary> | ||||
/// 接果汁 | /// 接果汁 | ||||
@@ -596,11 +650,19 @@ namespace BPASmartClient.MorkT_Show | |||||
#region 接果汁流程 | #region 接果汁流程 | ||||
if (!pickUpJuiceHaveCup) | if (!pickUpJuiceHaveCup) | ||||
{ | { | ||||
OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
OrderChange(morkTJaka.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
int resultTakeCup = takeCup(); | int resultTakeCup = takeCup(); | ||||
JuiceCH = int.Parse(mainMaterialLoc); | |||||
JuiceCH = morkTJaka.morkOrderPushesJuicer.ElementAt(0).Loc; | |||||
if (resultTakeCup == 1) | if (resultTakeCup == 1) | ||||
{ | { | ||||
getIce(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
Wait(); | |||||
WritePLCData("", 3);//将模组移动到接冰的位置 | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接果汁过渡位); | |||||
Wait(); | |||||
switch (JuiceCH) | switch (JuiceCH) | ||||
{ | { | ||||
case 52: | case 52: | ||||
@@ -609,7 +671,7 @@ namespace BPASmartClient.MorkT_Show | |||||
else | else | ||||
JuicerNum = 0x01; | JuicerNum = 0x01; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁1); | |||||
Sence(GVL_MorkT.接果汁1); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 53: | case 53: | ||||
@@ -618,7 +680,7 @@ namespace BPASmartClient.MorkT_Show | |||||
else | else | ||||
JuicerNum = 0x03; | JuicerNum = 0x03; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁2); | |||||
Sence(GVL_MorkT.接果汁2); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 54: | case 54: | ||||
@@ -627,7 +689,7 @@ namespace BPASmartClient.MorkT_Show | |||||
else | else | ||||
JuicerNum = 0x05; | JuicerNum = 0x05; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁3); | |||||
Sence(GVL_MorkT.接果汁3); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 55: | case 55: | ||||
@@ -636,13 +698,13 @@ namespace BPASmartClient.MorkT_Show | |||||
else | else | ||||
JuicerNum = 0x07; | JuicerNum = 0x07; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁4); | |||||
Sence(GVL_MorkT.接果汁4); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
default: | default: | ||||
JuicerNum = 0x00; | JuicerNum = 0x00; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_接果汁1); | |||||
Sence(GVL_MorkT.接果汁1); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
} | } | ||||
@@ -672,31 +734,31 @@ namespace BPASmartClient.MorkT_Show | |||||
{ | { | ||||
case 52: | case 52: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯1); | |||||
Sence(GVL_MorkT.放果汁杯1); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 53: | case 53: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯2); | |||||
Sence(GVL_MorkT.放果汁杯2); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 54: | case 54: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯3); | |||||
Sence(GVL_MorkT.放果汁杯3); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
case 55: | case 55: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯4); | |||||
Sence(GVL_MorkT.放果汁杯4); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
default: | default: | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_放果汁杯1); | |||||
Sence(GVL_MorkT.放果汁杯1); | |||||
Wait(); | Wait(); | ||||
break; | break; | ||||
} | } | ||||
OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
OrderChange(morkTJaka.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
DeviceProcessLogShow("果汁制作完成"); | DeviceProcessLogShow("果汁制作完成"); | ||||
} | } | ||||
#endregion | #endregion | ||||
@@ -706,10 +768,6 @@ namespace BPASmartClient.MorkT_Show | |||||
/// </summary> | /// </summary> | ||||
private int nCnt; | private int nCnt; | ||||
/// <summary> | /// <summary> | ||||
/// 传感器的检测次数 | |||||
/// </summary> | |||||
private int checkCnt; | |||||
/// <summary> | |||||
/// 取杯流程 | /// 取杯流程 | ||||
/// </summary> | /// </summary> | ||||
/// <returns>0:无意义,1:取杯成功 2:取杯失败</returns> | /// <returns>0:无意义,1:取杯成功 2:取杯失败</returns> | ||||
@@ -719,32 +777,28 @@ namespace BPASmartClient.MorkT_Show | |||||
{ | { | ||||
nCnt = 0; | nCnt = 0; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_初始位); | |||||
Sence(GVL_MorkT.机器人初始位); | |||||
Wait(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
Wait(); | Wait(); | ||||
WritePLCData("", SendToPlc.取杯); | |||||
if (!morkTJaka.sensorGetCup) | |||||
{ | |||||
WritePLCData("", 2); | |||||
} | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_取纸杯); | |||||
Sence(GVL_MorkT.取纸杯); | |||||
Wait(); | Wait(); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_取纸杯检测); | |||||
Sence(GVL_MorkT.取纸杯检测); | |||||
Wait(); | Wait(); | ||||
nCnt++; | nCnt++; | ||||
Thread.Sleep(2000); | Thread.Sleep(2000); | ||||
while (checkCnt < 3) | |||||
{ | |||||
if (!GetStatus<bool>("GetInput")) | |||||
{ | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(JuicerModel.JUICE2_再检测); | |||||
Wait(); | |||||
} | |||||
else | |||||
{ | |||||
break; | |||||
} | |||||
checkCnt++; | |||||
} | |||||
checkCnt = 0; | |||||
while (!GetStatus<bool>("GetInput")) //读取传感器的值 | while (!GetStatus<bool>("GetInput")) //读取传感器的值 | ||||
{ | { | ||||
if (nCnt > 3) | if (nCnt > 3) | ||||
@@ -752,7 +806,10 @@ namespace BPASmartClient.MorkT_Show | |||||
nCnt = 0; | nCnt = 0; | ||||
DeviceProcessLogShow("三次取杯失败,回原点"); | DeviceProcessLogShow("三次取杯失败,回原点"); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_检测位回原点); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
Wait(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人初始位); | |||||
Wait(); | Wait(); | ||||
return 2; | return 2; | ||||
} | } | ||||
@@ -760,30 +817,19 @@ namespace BPASmartClient.MorkT_Show | |||||
{ | { | ||||
nCnt++; | nCnt++; | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_二次取杯); | |||||
Sence(GVL_MorkT.二次取杯); | |||||
Wait(); | Wait(); | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | ||||
Sence(JuicerModel.JUICE2_取纸杯检测); | |||||
Sence(GVL_MorkT.取纸杯检测); | |||||
Wait(); | Wait(); | ||||
checkCnt = 0; | |||||
while (checkCnt < 3) | |||||
{ | |||||
if (!GetStatus<bool>("GetInput")) | |||||
{ | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(JuicerModel.JUICE2_再检测); | |||||
Wait(); | |||||
} | |||||
else | |||||
{ | |||||
checkCnt = 0; | |||||
return 1; | |||||
} | |||||
checkCnt++; | |||||
} | |||||
} | } | ||||
Thread.Sleep(1000); | Thread.Sleep(1000); | ||||
} | } | ||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.取杯位_机器人安全位); | |||||
Wait(); | |||||
return 1; | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -799,11 +845,11 @@ namespace BPASmartClient.MorkT_Show | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
if (GetStatus<bool>("RobotValue1")) return 2; | |||||
Sence(JuicerModel.JUICE_放杯); | |||||
if (GetStatus<bool>("GetInput2")) return 2; | |||||
Sence(GVL_MorkT.JUICE_放杯); | |||||
Wait(); | Wait(); | ||||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | ||||
Sence(JuicerModel.JUICE_放杯检测); | |||||
Sence(GVL_MorkT.JUICE_放杯检测); | |||||
Wait(); | Wait(); | ||||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | ||||
if (GetStatus<bool>("GetInput2")) | if (GetStatus<bool>("GetInput2")) | ||||
@@ -831,21 +877,41 @@ namespace BPASmartClient.MorkT_Show | |||||
{ | { | ||||
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); | EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); | ||||
} | } | ||||
public override void Stop() | |||||
private void GetStatus(string key, Action<object> action) | |||||
{ | { | ||||
if (peripheralStatus.ContainsKey(key)) | |||||
{ | |||||
if (peripheralStatus[key] != null) | |||||
{ | |||||
action?.Invoke(peripheralStatus[key]); | |||||
} | |||||
} | |||||
} | } | ||||
public override void ReadData() | public override void ReadData() | ||||
{ | |||||
GetStatus("", new Action<object>((obj) => | |||||
{ | |||||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24) | |||||
{ | |||||
} | |||||
})); | |||||
} | |||||
#endregion | |||||
public override void Stop() | |||||
{ | { | ||||
} | } | ||||
public override void ResetProgram() | public override void ResetProgram() | ||||
{ | { | ||||
} | } | ||||
public override void SimOrder() | public override void SimOrder() | ||||
{ | { | ||||
} | } | ||||
} | } | ||||
} | } |
@@ -0,0 +1,145 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using BPASmartClient.Device; | |||||
using System.Collections.Concurrent; | |||||
namespace BPASmartClient.MorkT_BarCounter | |||||
{ | |||||
public class GVL_MorkT : IStatus | |||||
{ | |||||
#region 果汁机设备MORKT2 Lebai机器人 | |||||
public const int 机器人安全位 = 10000;//一个位置(模组可移动,机器人不发生碰撞) | |||||
public const int 机器人初始位 = 10001; | |||||
public const int 初始位_机器人安全位 = 10002;//初始位---安全位 | |||||
public const int 取纸杯 = 10005;//安全位---取杯位 | |||||
public const int 二次取杯 = 10008;//取纸杯检测位---二次取杯位 | |||||
public const int 取纸杯检测 = 10006;//取杯位---取杯检测位 | |||||
public const int 取杯位_机器人安全位 = 10002;//取杯检测位---安全位 | |||||
public const int 接咖啡 = 10010;//安全位---接咖啡位 | |||||
public const int 接果汁过渡位 = 10002;//安全位---接果汁过渡位 | |||||
public const int 接果汁1 = 10011;//接果汁过渡位---果汁1位 | |||||
public const int 接果汁2 = 10012;//接果汁过渡位---果汁2位 | |||||
public const int 接果汁3 = 10013;//接果汁过渡位---果汁3位 | |||||
public const int 接果汁4 = 10014;//接果汁过渡位---果汁4位 | |||||
public const int 接果汁_机器人安全位 = 10002;//接果汁过渡位---安全位 | |||||
public const int 接茶叶 = 10015; | |||||
public const int 接茶水 = 10016; | |||||
public const int 接开水 = 10017; | |||||
public const int 接水_机器人安全位 = 10002; | |||||
public const int 接冰块 = 10018; | |||||
public const int 接冰_机器人安全位 = 10002; | |||||
public const int 放咖啡杯 = 10020; | |||||
public const int 放果汁杯1 = 10021; | |||||
public const int 放果汁杯2 = 10022; | |||||
public const int 放果汁杯3 = 10023; | |||||
public const int 放果汁杯4 = 10024; | |||||
public const int 放水杯 = 10025; | |||||
public const int 放杯 = 10001; | |||||
public const int 放杯_机器人安全位 = 10001; | |||||
#endregion | |||||
#region 果汁机设备 MORKT1 JAKA机器人 | |||||
public const int JUICE_初始位 = 20000; | |||||
public const int JUICE_取杯 = 20001; | |||||
public const int JUICE_取杯检测 = 20010; | |||||
public const int JUICE_接咖啡 = 20020; | |||||
public const int JUICE_接1号果汁 = 20030; | |||||
public const int JUICE_接2号果汁 = 20040; | |||||
public const int JUICE_接3号果汁 = 20050; | |||||
public const int JUICE_接4号果汁 = 20060; | |||||
public const int JUICE_接茶 = 20070; | |||||
public const int JUICE_接茶水 = 20075; | |||||
public const int JUICE_接水 = 20080; | |||||
public const int JUICE_放咖啡杯 = 20090; | |||||
public const int JUICE_放果汁杯 = 20100; | |||||
public const int JUICE_放茶水杯 = 20110; | |||||
public const int JUICE_放杯 = 20120; | |||||
public const int JUICE_放杯检测 = 20120; | |||||
#endregion | |||||
/// <summary> | |||||
/// <summary> | |||||
/// 咖啡订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesCoffee = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 是否有咖啡杯 | |||||
/// </summary> | |||||
public bool IsHaveCoffeeCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeCoffeeEnd = false; | |||||
/// <summary> | |||||
/// 果汁订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuicer = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 果汁是否在制作中 | |||||
/// </summary> | |||||
public bool IsHaveJuiceCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeJuiceEnd = false; | |||||
/// <summary> | |||||
/// 做茶订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTea = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 茶或水是否在制作中 | |||||
/// </summary> | |||||
public bool IsHaveTeaWaterCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeTeaEnd = false; | |||||
/// <summary> | |||||
/// 做开水订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesWater = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 等待取餐订单 | |||||
/// </summary> | |||||
public OrderLocInfo waitMorkOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 当前正在制作咖啡 | |||||
/// </summary> | |||||
public OrderLocInfo MakeCoffeeOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 订单ID | |||||
/// </summary> | |||||
public string SuborderId = null; | |||||
#region PLC的变量交互 | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public bool sensorGetCup { get; set; } | |||||
public bool sensorPutCup { get; set; } | |||||
#endregion | |||||
} | |||||
} |
@@ -0,0 +1,18 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.MorkT_BarCounter | |||||
{ | |||||
public class OrderLocInfo | |||||
{ | |||||
public string SuborderId { get; set; } | |||||
public ushort Loc { get; set; } | |||||
public ushort RecipeNumber { get; set; } | |||||
public int BatchingId { get; set; } | |||||
public string GoodName { get; set; } | |||||
public int MakeID { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,152 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.MorkT_BarCounter | |||||
{ | |||||
internal enum GOODS_TYPE | |||||
{ | |||||
/// <summary> | |||||
/// 未知 | |||||
/// </summary> | |||||
NEITHER, | |||||
/// <summary> | |||||
/// 咖啡 | |||||
/// </summary> | |||||
COFFEE, | |||||
/// <summary> | |||||
/// 果汁 | |||||
/// </summary> | |||||
JUICE, | |||||
/// <summary> | |||||
/// 茶水 | |||||
/// </summary> | |||||
TEA, | |||||
/// <summary> | |||||
/// 水 | |||||
/// </summary> | |||||
WATER, | |||||
/// <summary> | |||||
/// 杯子 | |||||
/// </summary> | |||||
CUP | |||||
} | |||||
internal enum BATCHING_CLASS | |||||
{ | |||||
HOLDER, | |||||
MAIN_MATERIAL, | |||||
} | |||||
internal class PolymerBatching | |||||
{ | |||||
internal const string Juicer_MAIN_BATCHIN1_LOC = "52"; | |||||
internal const string Juicer_MAIN_BATCHIN2_LOC = "53"; | |||||
internal const string Juicer_MAIN_BATCHIN3_LOC = "54"; | |||||
internal const string Juicer_MAIN_BATCHIN4_LOC = "55"; | |||||
//internal const string Juicer_MAIN_BATCHIN5_LOC = "56"; | |||||
//internal const string Juicer_MAIN_BATCHIN6_LOC = "57"; | |||||
//internal const string Juicer_MAIN_BATCHIN7_LOC = "58"; | |||||
//internal const string Juicer_MAIN_BATCHIN8_LOC = "59"; | |||||
internal const string COFFEE_HOLDER_LOC = "30"; | |||||
internal const string TEA_HOLDER_LOC = "51"; | |||||
public static Dictionary<string, GOODS_TYPE> GOODS_TYPES = new Dictionary<string, GOODS_TYPE>() { | |||||
{"1", GOODS_TYPE.COFFEE}, | |||||
{"2", GOODS_TYPE.COFFEE}, | |||||
{"3", GOODS_TYPE.COFFEE}, | |||||
{"4", GOODS_TYPE.COFFEE}, | |||||
{"5", GOODS_TYPE.COFFEE}, | |||||
{"6", GOODS_TYPE.COFFEE}, | |||||
{"7", GOODS_TYPE.COFFEE}, | |||||
{"8", GOODS_TYPE.COFFEE}, | |||||
{"9", GOODS_TYPE.COFFEE}, | |||||
{"10",GOODS_TYPE.COFFEE}, | |||||
{"11",GOODS_TYPE.COFFEE}, | |||||
{"12",GOODS_TYPE.COFFEE}, | |||||
{"13",GOODS_TYPE.COFFEE}, | |||||
{"14",GOODS_TYPE.COFFEE}, | |||||
{"15",GOODS_TYPE.COFFEE}, | |||||
{"16",GOODS_TYPE.COFFEE}, | |||||
{"17",GOODS_TYPE.COFFEE}, | |||||
{"18",GOODS_TYPE.COFFEE}, | |||||
{"19",GOODS_TYPE.COFFEE}, | |||||
{"20",GOODS_TYPE.COFFEE}, | |||||
{"21",GOODS_TYPE.COFFEE}, | |||||
{"22",GOODS_TYPE.COFFEE}, | |||||
{"23",GOODS_TYPE.COFFEE}, | |||||
{"24",GOODS_TYPE.COFFEE}, | |||||
{"25",GOODS_TYPE.COFFEE}, | |||||
{ COFFEE_HOLDER_LOC,GOODS_TYPE.CUP}, | |||||
{"56",GOODS_TYPE.TEA }, | |||||
{"61",GOODS_TYPE.WATER }, | |||||
{Juicer_MAIN_BATCHIN1_LOC,GOODS_TYPE.JUICE}, | |||||
{Juicer_MAIN_BATCHIN2_LOC,GOODS_TYPE.JUICE}, | |||||
{Juicer_MAIN_BATCHIN3_LOC,GOODS_TYPE.JUICE}, | |||||
{Juicer_MAIN_BATCHIN4_LOC,GOODS_TYPE.JUICE}, | |||||
//{Juicer_MAIN_BATCHIN5_LOC,GOODS_TYPE.JUICE}, | |||||
//{Juicer_MAIN_BATCHIN6_LOC,GOODS_TYPE.JUICE}, | |||||
//{Juicer_MAIN_BATCHIN7_LOC,GOODS_TYPE.JUICE}, | |||||
//{Juicer_MAIN_BATCHIN8_LOC,GOODS_TYPE.JUICE}, | |||||
}; | |||||
public GOODS_TYPE GoodsType { get; set; } | |||||
public BATCHING_CLASS BatchingClass { get; set; } | |||||
private string loc; | |||||
public string Loc | |||||
{ | |||||
get { return loc; } | |||||
set | |||||
{ | |||||
loc = value; | |||||
if (GOODS_TYPES.ContainsKey(loc)) | |||||
GoodsType = GOODS_TYPES[loc]; | |||||
switch (loc) | |||||
{ | |||||
case COFFEE_HOLDER_LOC: | |||||
case TEA_HOLDER_LOC: | |||||
BatchingClass = BATCHING_CLASS.HOLDER; | |||||
break; | |||||
default: | |||||
BatchingClass = BATCHING_CLASS.MAIN_MATERIAL; | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
internal static Dictionary<string, PolymerBatching> BuildAll() | |||||
{ | |||||
Dictionary<string, PolymerBatching> temp = new Dictionary<string, PolymerBatching>(); | |||||
foreach (var item in GOODS_TYPES) | |||||
{ | |||||
temp.Add(item.Key, new PolymerBatching() { Loc = item.Key }); | |||||
} | |||||
return temp; | |||||
} | |||||
//internal static IC_SE GetIceCreamSE(string loc, out string sence) | |||||
//{ | |||||
// switch (loc) | |||||
// { | |||||
// case Juicer_MAIN_BATCHIN1_LOC: | |||||
// sence = JaKaHelper.SENCE_接果汁1; | |||||
// return IC_SE.SE_1; | |||||
// case Juicer_MAIN_BATCHIN2_LOC: | |||||
// sence = JaKaHelper.SENCE_接果汁2; | |||||
// return IC_SE.SE_2; | |||||
// case Juicer_MAIN_BATCHIN3_LOC: | |||||
// sence = JaKaHelper.SENCE_接果汁3; | |||||
// return IC_SE.SE_3; | |||||
// default: | |||||
// sence = JaKaHelper.SENCE_接果汁1; | |||||
// return IC_SE.SE_1; | |||||
// } | |||||
//} | |||||
} | |||||
} |
@@ -0,0 +1,18 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.MorkT_BarCounter | |||||
{ | |||||
public enum SendToPlc | |||||
{ | |||||
取杯, | |||||
咖啡, | |||||
果汁, | |||||
开水, | |||||
落茶, | |||||
制冰, | |||||
} | |||||
} |
@@ -11,6 +11,7 @@ | |||||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | <ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.DRCoffee\BPASmartClient.DRCoffee.csproj" /> | <ProjectReference Include="..\BPASmartClient.DRCoffee\BPASmartClient.DRCoffee.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" /> | <ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.IceMaker\BPASmartClient.IceMaker.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.Juicer\BPASmartClient.Juicer.csproj" /> | <ProjectReference Include="..\BPASmartClient.Juicer\BPASmartClient.Juicer.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" /> | <ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.MCU\BPASmartClient.MCU.csproj" /> | <ProjectReference Include="..\BPASmartClient.MCU\BPASmartClient.MCU.csproj" /> |
@@ -0,0 +1,941 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Configuration; | |||||
using System.Linq; | |||||
using System.Threading; | |||||
using System.Collections.Concurrent; | |||||
using System.Diagnostics; | |||||
using System.Threading.Tasks; | |||||
using BPASmartClient.Device; | |||||
using BPA.Message.Enum; | |||||
using BPA.Message; | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.Model.咖啡机.Enum; | |||||
using BPASmartClient.Model; | |||||
using BPASmartClient.EventBus; | |||||
using static BPASmartClient.EventBus.EventBus; | |||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model.乐白机器人; | |||||
using BPASmartClient.Model.单片机; | |||||
using BPASmartClient.Model.PLC; | |||||
namespace BPASmartClient.MorkT_Container | |||||
{ | |||||
/* | |||||
* 冰淇淋咖啡机组合套装 | |||||
* 物料位置: | |||||
* 1:冰淇料 | |||||
* 2:冰淇淋杯 | |||||
* 5:咖啡 | |||||
* 6:咖啡杯 | |||||
* 9: 茶 | |||||
* 10: 茶杯 | |||||
*/ | |||||
public class Control_MorkT_Container : BaseDevice | |||||
{ | |||||
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | |||||
//容器位置 | |||||
private string holderLoc; | |||||
//主料位置 | |||||
private string mainMaterialLoc; | |||||
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } | |||||
GVL_MorkT morkTLebaiJC =new GVL_MorkT(); | |||||
/// <summary> | |||||
/// 果汁机做法,true:热饮,false:冷饮 | |||||
/// </summary> | |||||
private bool GuMake = false; | |||||
/// <summary> | |||||
/// 订单是否加冰 | |||||
/// </summary> | |||||
private bool IsAddIce = false; | |||||
public override void DoMain() | |||||
{ | |||||
if (Json<KeepDataBase>.Data.IsVerify) | |||||
{ | |||||
IsHealth = true; | |||||
} | |||||
IsHealth = true; | |||||
serverInit(); | |||||
DataParse(); | |||||
ActionManage.GetInstance.Register(new Action<object>((o) => { SimOrder(o); }), "SimOrder");//模拟订单委托注册 | |||||
} | |||||
private void serverInit() | |||||
{ | |||||
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
if (@event is MaterialDeliveryEvent material) | |||||
{ | |||||
orderMaterialDelivery = material.orderMaterialDelivery; | |||||
} | |||||
}); | |||||
} | |||||
private void DataParse() | |||||
{ | |||||
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | |||||
{ | |||||
if (@event == null) return; | |||||
if (@event is DoOrderEvent order) | |||||
{ | |||||
if (order.MorkOrder.GoodBatchings == null) return; | |||||
OrderCount++; | |||||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||||
batchings = PolymerBatching.BuildAll(); | |||||
//商品类型 | |||||
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; | |||||
foreach (var item in order.MorkOrder.GoodBatchings) | |||||
{ | |||||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||||
if (res != null) | |||||
{ | |||||
//验证商品是做的某种饮料 | |||||
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER) | |||||
{ | |||||
//获取当前物料所属商品类型 | |||||
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); | |||||
} | |||||
switch (batchings[res.BatchingLoc].BatchingClass) | |||||
{ | |||||
case BATCHING_CLASS.HOLDER: | |||||
holderLoc = res.BatchingLoc; | |||||
break; | |||||
case BATCHING_CLASS.MAIN_MATERIAL: | |||||
mainMaterialLoc = res.BatchingLoc; | |||||
break; | |||||
} | |||||
//根据商品类型执行具体制作流程 | |||||
switch (currentGoodsType) | |||||
{ | |||||
case GOODS_TYPE.COFFEE: | |||||
if (morkTLebaiJC.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
{ | |||||
morkTLebaiJC.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() | |||||
{ | |||||
SuborderId = order.MorkOrder.SuborderId, | |||||
BatchingId = res.BatchingId, | |||||
Loc = ushort.Parse( mainMaterialLoc), | |||||
GoodName = order.MorkOrder.GoodsName, | |||||
}); | |||||
} | |||||
break; | |||||
case GOODS_TYPE.JUICE: | |||||
if (morkTLebaiJC.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
{ | |||||
morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() | |||||
{ | |||||
SuborderId = order.MorkOrder.SuborderId, | |||||
BatchingId = res.BatchingId, | |||||
Loc = ushort.Parse(mainMaterialLoc), | |||||
GoodName = order.MorkOrder.GoodsName, | |||||
}); | |||||
} | |||||
break; | |||||
case GOODS_TYPE.TEA: | |||||
if (morkTLebaiJC.morkOrderPushesTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
{ | |||||
morkTLebaiJC.morkOrderPushesTea.Enqueue(new OrderLocInfo() | |||||
{ | |||||
SuborderId = order.MorkOrder.SuborderId, | |||||
BatchingId = res.BatchingId, | |||||
Loc = ushort.Parse(mainMaterialLoc), | |||||
GoodName = order.MorkOrder.GoodsName, | |||||
}); | |||||
} | |||||
break; | |||||
case GOODS_TYPE.WATER: | |||||
if (morkTLebaiJC.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||||
{ | |||||
morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo() | |||||
{ | |||||
SuborderId = order.MorkOrder.SuborderId, | |||||
BatchingId = res.BatchingId, | |||||
Loc = ushort.Parse(mainMaterialLoc), | |||||
GoodName = order.MorkOrder.GoodsName, | |||||
}); | |||||
} | |||||
break; | |||||
case GOODS_TYPE.NEITHER: | |||||
DeviceProcessLogShow("未知的商品类型"); | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
/// <summary> | |||||
/// 将空杯放好到接饮料的地方的标志位 | |||||
/// </summary> | |||||
private bool bFirstTrig_TeaWater = false; | |||||
private bool bFirstTrig_Coffee = false; | |||||
private bool bFirstTrig_Juice = false; | |||||
/// <summary> | |||||
/// 延迟的超时时间 | |||||
/// </summary> | |||||
DateTime delayTimeOut_Water; | |||||
DateTime delayTimeOut_Coffee; | |||||
DateTime delayTimeOut_Juice; | |||||
public override void MainTask() | |||||
{ | |||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (morkTLebaiJC.IsHaveCoffeeCup && morkTLebaiJC.MakeCoffeeEnd != true) | |||||
morkTLebaiJC.MakeCoffeeEnd = true; | |||||
}); | |||||
if (morkTLebaiJC.IsHaveCoffeeCup && morkTLebaiJC.MakeCoffeeEnd != true) | |||||
{ | |||||
if (!bFirstTrig_Coffee) | |||||
{ | |||||
bFirstTrig_Coffee = true; | |||||
delayTimeOut_Coffee = DateTime.Now; | |||||
} | |||||
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 18 && bFirstTrig_Coffee == true) | |||||
{ | |||||
bFirstTrig_Coffee = false; | |||||
if (morkTLebaiJC.IsHaveCoffeeCup) | |||||
morkTLebaiJC.MakeCoffeeEnd = true; | |||||
} | |||||
} | |||||
if (morkTLebaiJC.IsHaveJuiceCup && morkTLebaiJC.MakeJuiceEnd != true) | |||||
{ | |||||
var Juicestate = GetStatus<int[]>("GetDeviceStatus"); | |||||
if (Juicestate != null) | |||||
{ | |||||
if (Juicestate.Length > 0) | |||||
{ | |||||
var Juicestate1 = Convert.ToString(Juicestate[0], 2); | |||||
var Juicestate2 = Juicestate[1]; | |||||
if (Juicestate1.IndexOf("0") == 1 && Juicestate2 == 0) | |||||
{ | |||||
morkTLebaiJC.MakeJuiceEnd = true; | |||||
bFirstTrig_Juice = false; | |||||
} | |||||
} | |||||
} | |||||
if (!morkTLebaiJC.MakeJuiceEnd) | |||||
{ | |||||
//若无状态返回 则加延迟 | |||||
if (!bFirstTrig_Juice) | |||||
{ | |||||
bFirstTrig_Juice = true; | |||||
delayTimeOut_Juice = DateTime.Now; | |||||
} | |||||
else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 3 && bFirstTrig_Juice == true) | |||||
{ | |||||
bFirstTrig_Juice = false; | |||||
morkTLebaiJC.MakeJuiceEnd = true; | |||||
} | |||||
} | |||||
} | |||||
if (morkTLebaiJC.IsHaveTeaWaterCup && morkTLebaiJC.MakeTeaEnd != true) | |||||
{ | |||||
if (!bFirstTrig_TeaWater) | |||||
{ | |||||
bFirstTrig_TeaWater = true; | |||||
delayTimeOut_Water = DateTime.Now;//开启接水信号后,记录当前时间 | |||||
} | |||||
else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 5 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序 | |||||
{ | |||||
bFirstTrig_TeaWater = false; | |||||
morkTLebaiJC.MakeTeaEnd = true; | |||||
} | |||||
} | |||||
DoCoffee(); | |||||
DoJuice(); | |||||
DoBoiledTea(); | |||||
DoBoiledWater(); | |||||
} | |||||
/// <summary> | |||||
/// 订单状态改变 | |||||
/// </summary> | |||||
/// <param name="subid"></param> | |||||
/// <param name="oRDER_STATUS"></param> | |||||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||||
{ | |||||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); | |||||
} | |||||
/// <summary> | |||||
/// 验证商品是做的某种饮料 | |||||
/// </summary> | |||||
/// <param name="batchingLoc">物料位置</param> | |||||
private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc) | |||||
{ | |||||
if (batchings.ContainsKey(batchingLoc)) | |||||
return batchings[batchingLoc].GoodsType; | |||||
return GOODS_TYPE.NEITHER; | |||||
} | |||||
/// <summary> | |||||
/// 乐白的场景结束等待 | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
private void Wait(int value = 101) | |||||
{ | |||||
while (!((bool)peripheralStatus["RobotOK"] && (int)peripheralStatus["RobotValue"] == value)) | |||||
{ | |||||
Thread.Sleep(5); | |||||
} | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
} | |||||
/// <summary> | |||||
/// 乐白的场景 | |||||
/// </summary> | |||||
/// <param name="sen"></param> | |||||
private void Sence(int sen) | |||||
{ | |||||
new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = sen }.Publish(); | |||||
} | |||||
/// <summary> | |||||
/// 乐白的数字量输出 | |||||
/// </summary> | |||||
/// <param name="value"></param> | |||||
/// <param name="pin"></param> | |||||
private void Output(bool value,int pin) | |||||
{ | |||||
new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Pin = pin,Value=value }.Publish(); | |||||
} | |||||
private T GetStatus<T>(string key) | |||||
{ | |||||
if (peripheralStatus.ContainsKey(key)) | |||||
{ | |||||
if (peripheralStatus[key] != null) | |||||
{ | |||||
return (T)(peripheralStatus[key]); | |||||
} | |||||
} | |||||
return default; | |||||
} | |||||
int[] devStatusBy = new int[2] { 0, 0 }; | |||||
bool outCupCheck = false;//放纸杯位置有无判断 | |||||
/// <summary> | |||||
/// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确 | |||||
/// </summary> | |||||
int bSensorInput; | |||||
/// <summary> | |||||
/// 判断是否有咖啡订单 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
private bool IsMakeCoffee() | |||||
{ | |||||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesCoffee.Count > 0 && !morkTLebaiJC.IsHaveCoffeeCup) ? true : false; | |||||
return bMake; | |||||
} | |||||
/// <summary> | |||||
/// 判断是否有果汁订单 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
private bool IsMakeJuice() | |||||
{ | |||||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesJuicer.Count > 0 && !morkTLebaiJC.IsHaveJuiceCup) ? true : false; | |||||
return bMake; | |||||
} | |||||
/// <summary> | |||||
/// 判断是否有茶订单 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
private bool IsMakeTeaWater() | |||||
{ | |||||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesTea.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false; | |||||
return bMake; | |||||
} | |||||
/// <summary> | |||||
/// 判断是否有开水订单 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
private bool IsMakeWater() | |||||
{ | |||||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesWater.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false; | |||||
return bMake; | |||||
} | |||||
/// <summary> | |||||
/// 做咖啡流程 | |||||
/// </summary> | |||||
private void DoCoffee() | |||||
{ | |||||
if (IsMakeCoffee()) | |||||
{ | |||||
PickUpCoffee();//接咖啡 | |||||
morkTLebaiJC.IsHaveCoffeeCup = true; | |||||
} | |||||
else if(morkTLebaiJC.MakeCoffeeEnd) | |||||
{ | |||||
try | |||||
{ | |||||
PutCoffeeCup(); | |||||
morkTLebaiJC.MakeCoffeeEnd = false; | |||||
morkTLebaiJC.IsHaveCoffeeCup = false; | |||||
morkTLebaiJC.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||||
} | |||||
} | |||||
} | |||||
private void DoJuice() | |||||
{ | |||||
if (IsMakeJuice()) | |||||
{ | |||||
switch (morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).Loc) | |||||
{ | |||||
case 1: | |||||
GuMake = true; | |||||
IsAddIce = false; | |||||
break; | |||||
case 2: | |||||
GuMake = false; | |||||
IsAddIce = false; | |||||
break; | |||||
case 3: | |||||
GuMake = false; | |||||
IsAddIce = true; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
PickUpJuicer(); | |||||
morkTLebaiJC.IsHaveJuiceCup = true; | |||||
} | |||||
else if (morkTLebaiJC.MakeJuiceEnd) | |||||
{ | |||||
try | |||||
{ | |||||
Thread.Sleep(5000);//延迟五秒,防止饮料口滴饮料 | |||||
putJuice(); | |||||
morkTLebaiJC.IsHaveJuiceCup = false; | |||||
morkTLebaiJC.MakeJuiceEnd = false; | |||||
morkTLebaiJC.morkOrderPushesJuicer.TryDequeue(out OrderLocInfo orderLoc); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||||
} | |||||
} | |||||
} | |||||
public bool DoTeaOrWater; | |||||
private void DoBoiledTea() | |||||
{ | |||||
if (IsMakeTeaWater()) | |||||
{ | |||||
PickUpTea(); | |||||
morkTLebaiJC.IsHaveTeaWaterCup = true; | |||||
DoTeaOrWater = true; | |||||
} | |||||
else if (morkTLebaiJC.MakeTeaEnd && morkTLebaiJC.morkOrderPushesTea.Count > 0 && DoTeaOrWater) | |||||
{ | |||||
try | |||||
{ | |||||
PutWaterCup(); | |||||
DeviceProcessLogShow("-------------茶 制作完成------------"); | |||||
OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
morkTLebaiJC.IsHaveTeaWaterCup = false; | |||||
morkTLebaiJC.MakeTeaEnd = false; | |||||
morkTLebaiJC.morkOrderPushesTea.TryDequeue(out OrderLocInfo orderLoc); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||||
} | |||||
} | |||||
} | |||||
private void DoBoiledWater() | |||||
{ | |||||
if (IsMakeWater()) | |||||
{ | |||||
PickUpWater(); | |||||
morkTLebaiJC.IsHaveTeaWaterCup = true; | |||||
DoTeaOrWater = false; | |||||
} | |||||
else if (morkTLebaiJC.MakeTeaEnd && morkTLebaiJC.morkOrderPushesWater.Count > 0 && DoTeaOrWater == false) | |||||
{ | |||||
try | |||||
{ | |||||
PutWaterCup(); | |||||
DeviceProcessLogShow("-------------开水 制作完成------------"); | |||||
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
morkTLebaiJC.IsHaveTeaWaterCup = false; | |||||
morkTLebaiJC.MakeTeaEnd = false; | |||||
morkTLebaiJC.morkOrderPushesWater.TryDequeue(out OrderLocInfo orderLoc); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||||
} | |||||
} | |||||
} | |||||
#region 做咖啡流程 | |||||
/// <summary> | |||||
/// 接咖啡 | |||||
/// </summary> | |||||
private void PickUpCoffee() | |||||
{ | |||||
if (!morkTLebaiJC.IsHaveCoffeeCup) | |||||
{ | |||||
outCupCheck = false; | |||||
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
int resultTakeCup = takeCup(); | |||||
if (resultTakeCup == 1) | |||||
{ | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
//Wait(); | |||||
WritePLCData("",2);//将轴移动到接咖啡的位置 | |||||
DeviceProcessLogShow("伺服电机移动到接咖啡的位置"); | |||||
DeviceProcessLogShow("咖啡杯取杯完成"); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接咖啡); | |||||
//Wait(); | |||||
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||||
} | |||||
else | |||||
{ | |||||
/*DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!"); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人初始位); | |||||
//Wait();*/ | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 咖啡杯接好,放咖啡杯 | |||||
/// </summary> | |||||
private void PutCoffeeCup() | |||||
{ | |||||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||||
{ | |||||
if (!outCupCheck) | |||||
DeviceProcessLogShow("成品处有纸杯存在,请取走!!"); | |||||
outCupCheck = true; | |||||
} | |||||
outCupCheck = false; | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
//Wait(); | |||||
WritePLCData("", 2);//将轴移动到接咖啡的位置 | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.放咖啡杯); | |||||
//Wait(); | |||||
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
DeviceProcessLogShow($"-------------{morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).GoodName}果汁 制作完成------------"); | |||||
} | |||||
#endregion | |||||
#region 做开水流程 | |||||
/// <summary> | |||||
/// 接开水 | |||||
/// </summary> | |||||
private void PickUpWater() | |||||
{ | |||||
#region 接水流程 | |||||
if (!morkTLebaiJC.IsHaveTeaWaterCup) | |||||
{ | |||||
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
int resultTakeCup = takeCup(); | |||||
if (resultTakeCup == 1) | |||||
{ | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接开水); | |||||
//Wait(); | |||||
Output(false, 1); | |||||
Output(false, 0); | |||||
Thread.Sleep(100); | |||||
Output(true, 0); | |||||
Thread.Sleep(3000); | |||||
Output(false, 0); | |||||
Thread.Sleep(100); | |||||
Output(false, 1); | |||||
Thread.Sleep(100); | |||||
Output(true, 1); | |||||
Thread.Sleep(500); | |||||
Output(false, 1); | |||||
} | |||||
else | |||||
{ | |||||
return; | |||||
} | |||||
} | |||||
#endregion | |||||
} | |||||
#endregion | |||||
#region 做茶流程 | |||||
/// <summary> | |||||
/// 做茶 | |||||
/// </summary> | |||||
private void PickUpTea() | |||||
{ | |||||
#region 接茶流程 | |||||
if (!morkTLebaiJC.IsHaveTeaWaterCup) | |||||
{ | |||||
OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
int resultTakeCup = takeCup(); | |||||
if (resultTakeCup == 1) | |||||
{ | |||||
DeviceProcessLogShow("取茶杯完成"); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接茶叶); | |||||
//Wait(); | |||||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish(); | |||||
Thread.Sleep(1000); | |||||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 150 }.Publish(); | |||||
Thread.Sleep(1000); | |||||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish(); | |||||
Thread.Sleep(3000); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接茶水); | |||||
//Wait(); | |||||
Output(false, 1); | |||||
Output(false, 0); | |||||
Thread.Sleep(100); | |||||
Output(true, 0); | |||||
Thread.Sleep(3000); | |||||
Output(false, 0); | |||||
Thread.Sleep(100); | |||||
Output(false, 1); | |||||
Thread.Sleep(100); | |||||
Output(true, 1); | |||||
Thread.Sleep(500); | |||||
Output(false, 1); | |||||
morkTLebaiJC.IsHaveTeaWaterCup = true; | |||||
} | |||||
else | |||||
{ | |||||
return; | |||||
} | |||||
} | |||||
#endregion | |||||
} | |||||
/// <summary> | |||||
/// 放水杯流程 | |||||
/// </summary> | |||||
private void PutWaterCup() | |||||
{ | |||||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||||
{ | |||||
if (!outCupCheck) | |||||
DeviceProcessLogShow("成品处有纸杯存在,请取走!!"); | |||||
outCupCheck = true; | |||||
} | |||||
outCupCheck = false; | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.放水杯); | |||||
} | |||||
#endregion | |||||
#region 做果汁流程 | |||||
/// <summary> | |||||
/// 果汁机控制信号 | |||||
/// </summary> | |||||
private byte JuicerNum; | |||||
private void getIce() | |||||
{ | |||||
IsAddIceNow = IsAddIce; | |||||
if (IsAddIce) | |||||
{ | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.取杯位_机器人安全位); | |||||
//Wait(); | |||||
WritePLCData("",3);//将模组移动到接冰的位置 | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接冰块); | |||||
//Wait(); | |||||
new StartMakeIce() { }.Publish(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接冰_机器人安全位); | |||||
//Wait(); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 当前订单是否加冰 | |||||
/// </summary> | |||||
private bool IsAddIceNow = false; | |||||
private int JuiceCH; | |||||
/// <summary> | |||||
/// 接果汁 | |||||
/// </summary> | |||||
private void PickUpJuicer() | |||||
{ | |||||
#region 接果汁流程 | |||||
if (!morkTLebaiJC.IsHaveJuiceCup) | |||||
{ | |||||
OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||||
int resultTakeCup = takeCup(); | |||||
JuiceCH = int.Parse(mainMaterialLoc); | |||||
if (resultTakeCup == 1) | |||||
{ | |||||
getIce(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
//Wait(); | |||||
WritePLCData("", 3);//将模组移动到接冰的位置 | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接果汁过渡位); | |||||
//Wait(); | |||||
switch (JuiceCH) | |||||
{ | |||||
case 52: | |||||
if (GuMake) | |||||
JuicerNum = 0x00; | |||||
else | |||||
JuicerNum = 0x01; | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接果汁1); | |||||
//Wait(); | |||||
break; | |||||
case 53: | |||||
if (GuMake) | |||||
JuicerNum = 0x02; | |||||
else | |||||
JuicerNum = 0x03; | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接果汁2); | |||||
//Wait(); | |||||
break; | |||||
case 54: | |||||
if (GuMake) | |||||
JuicerNum = 0x04; | |||||
else | |||||
JuicerNum = 0x05; | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接果汁3); | |||||
//Wait(); | |||||
break; | |||||
case 55: | |||||
if (GuMake) | |||||
JuicerNum = 0x06; | |||||
else | |||||
JuicerNum = 0x07; | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接果汁4); | |||||
//Wait(); | |||||
break; | |||||
default: | |||||
JuicerNum = 0x00; | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.接果汁1); | |||||
//Wait(); | |||||
break; | |||||
} | |||||
new WriteJuicer() { Value = JuicerNum }.Publish(); | |||||
morkTLebaiJC.IsHaveJuiceCup = true; | |||||
} | |||||
else | |||||
{ | |||||
return; | |||||
} | |||||
} | |||||
#endregion | |||||
} | |||||
/// <summary> | |||||
/// 取接好果汁杯 | |||||
/// </summary> | |||||
private void putJuice() | |||||
{ | |||||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||||
{ | |||||
if (!outCupCheck) | |||||
DeviceProcessLogShow("成品处有纸杯存在,请取走!!"); | |||||
outCupCheck = true; | |||||
} | |||||
outCupCheck = false; | |||||
switch (JuiceCH) | |||||
{ | |||||
case 52: | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.放果汁杯1); | |||||
//Wait(); | |||||
break; | |||||
case 53: | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.放果汁杯2); | |||||
//Wait(); | |||||
break; | |||||
case 54: | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.放果汁杯3); | |||||
//Wait(); | |||||
break; | |||||
case 55: | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.放果汁杯4); | |||||
//Wait(); | |||||
break; | |||||
default: | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.放果汁杯1); | |||||
//Wait(); | |||||
break; | |||||
} | |||||
OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||||
DeviceProcessLogShow($"-------------{morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).GoodName}果汁 制作完成------------"); | |||||
} | |||||
#endregion | |||||
/// <summary> | |||||
/// 取杯的次数 | |||||
/// </summary> | |||||
private int nCnt; | |||||
/// <summary> | |||||
/// 取杯流程 | |||||
/// </summary> | |||||
/// <returns>0:无意义,1:取杯成功 2:取杯失败</returns> | |||||
private int takeCup() | |||||
{ | |||||
try | |||||
{ | |||||
nCnt = 0; | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人初始位); | |||||
//Wait(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
//Wait(); | |||||
WritePLCData("", 1); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.取纸杯); | |||||
//Wait(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.取纸杯检测); | |||||
//Wait(); | |||||
nCnt++; | |||||
Thread.Sleep(2000); | |||||
while (!GetStatus<bool>("GetInput")) //读取传感器的值 | |||||
{ | |||||
if (nCnt > 3) | |||||
{ | |||||
nCnt = 0; | |||||
DeviceProcessLogShow("三次取杯失败,回原点"); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人安全位); | |||||
//Wait(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.机器人初始位); | |||||
//Wait(); | |||||
return 2; | |||||
} | |||||
else | |||||
{ | |||||
nCnt++; | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.二次取杯); | |||||
//Wait(); | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.取纸杯检测); | |||||
//Wait(); | |||||
} | |||||
Thread.Sleep(1000); | |||||
} | |||||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||||
Sence(GVL_MorkT.取杯位_机器人安全位); | |||||
//Wait(); | |||||
return 1; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
DeviceProcessLogShow(ex.ToString()); | |||||
} | |||||
return 2; | |||||
} | |||||
/// <summary> | |||||
/// 放杯 | |||||
/// </summary> | |||||
/// <returns>0:无意义 1:放杯成功 2:执行失败(传感器还有信号) 3:放杯异常</returns> | |||||
private int putCup() | |||||
{ | |||||
try | |||||
{ | |||||
if (GetStatus<bool>("GetInput2")) return 2; | |||||
Sence(GVL_MorkT.JUICE_放杯); | |||||
//Wait(); | |||||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | |||||
Sence(GVL_MorkT.JUICE_放杯检测); | |||||
//Wait(); | |||||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | |||||
if (GetStatus<bool>("GetInput2")) | |||||
{ | |||||
return 1; | |||||
} | |||||
else | |||||
{ | |||||
return 3; | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
DeviceProcessLogShow(ex.ToString()); | |||||
return 0; | |||||
} | |||||
} | |||||
public void SimOrder<T>(T simOrder) | |||||
{ | |||||
} | |||||
#region PLC 控制函数 | |||||
private void WritePLCData(string address, object value) | |||||
{ | |||||
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); | |||||
} | |||||
private void GetStatus(string key, Action<object> action) | |||||
{ | |||||
if (peripheralStatus.ContainsKey(key)) | |||||
{ | |||||
if (peripheralStatus[key] != null) | |||||
{ | |||||
action?.Invoke(peripheralStatus[key]); | |||||
} | |||||
} | |||||
} | |||||
public override void ReadData() | |||||
{ | |||||
GetStatus("", new Action<object>((obj) => | |||||
{ | |||||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24) | |||||
{ | |||||
} | |||||
})); | |||||
} | |||||
#endregion | |||||
public override void Stop() | |||||
{ | |||||
} | |||||
public override void ResetProgram() | |||||
{ | |||||
} | |||||
public override void SimOrder() | |||||
{ | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,137 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using BPASmartClient.Device; | |||||
using System.Collections.Concurrent; | |||||
namespace BPASmartClient.MorkT_Container | |||||
{ | |||||
public class GVL_MorkT : IStatus | |||||
{ | |||||
#region 果汁机设备MORKT2 Lebai机器人 | |||||
public const int 机器人安全位 = 10000;//一个位置(模组可移动,机器人不发生碰撞) | |||||
public const int 机器人初始位 = 10001; | |||||
public const int 初始位_机器人安全位 = 10002;//初始位---安全位 | |||||
public const int 取纸杯 = 10005;//安全位---取杯位 | |||||
public const int 二次取杯 = 10008;//取纸杯检测位---二次取杯位 | |||||
public const int 取纸杯检测 = 10006;//取杯位---取杯检测位 | |||||
public const int 取杯位_机器人安全位 = 10002;//取杯检测位---安全位 | |||||
public const int 接咖啡 = 10010;//安全位---接咖啡位 | |||||
public const int 接果汁过渡位 = 10002;//安全位---接果汁过渡位 | |||||
public const int 接果汁1 = 10011;//接果汁过渡位---果汁1位 | |||||
public const int 接果汁2 = 10012;//接果汁过渡位---果汁2位 | |||||
public const int 接果汁3 = 10013;//接果汁过渡位---果汁3位 | |||||
public const int 接果汁4 = 10014;//接果汁过渡位---果汁4位 | |||||
public const int 接果汁_机器人安全位 = 10002;//接果汁过渡位---安全位 | |||||
public const int 接茶叶 = 10015; | |||||
public const int 接茶水 = 10016; | |||||
public const int 接开水 = 10017; | |||||
public const int 接水_机器人安全位 = 10002; | |||||
public const int 接冰块 = 10018; | |||||
public const int 接冰_机器人安全位 = 10002; | |||||
public const int 放咖啡杯 = 10020; | |||||
public const int 放果汁杯1 = 10021; | |||||
public const int 放果汁杯2 = 10022; | |||||
public const int 放果汁杯3 = 10023; | |||||
public const int 放果汁杯4 = 10024; | |||||
public const int 放水杯 = 10025; | |||||
public const int 放杯 = 10001; | |||||
public const int 放杯_机器人安全位 = 10001; | |||||
#endregion | |||||
#region 果汁机设备 MORKT1 JAKA机器人 | |||||
public const int JUICE_初始位 = 20000; | |||||
public const int JUICE_取杯 = 20001; | |||||
public const int JUICE_取杯检测 = 20010; | |||||
public const int JUICE_接咖啡 = 20020; | |||||
public const int JUICE_接1号果汁 = 20030; | |||||
public const int JUICE_接2号果汁 = 20040; | |||||
public const int JUICE_接3号果汁 = 20050; | |||||
public const int JUICE_接4号果汁 = 20060; | |||||
public const int JUICE_接茶 = 20070; | |||||
public const int JUICE_接茶水 = 20075; | |||||
public const int JUICE_接水 = 20080; | |||||
public const int JUICE_放咖啡杯 = 20090; | |||||
public const int JUICE_放果汁杯 = 20100; | |||||
public const int JUICE_放茶水杯 = 20110; | |||||
public const int JUICE_放杯 = 20120; | |||||
public const int JUICE_放杯检测 = 20120; | |||||
#endregion | |||||
/// <summary> | |||||
/// <summary> | |||||
/// 咖啡订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesCoffee = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 是否有咖啡杯 | |||||
/// </summary> | |||||
public bool IsHaveCoffeeCup = false; | |||||
/// <summary> | |||||
/// 出咖啡完成,是否取咖啡杯 | |||||
/// </summary> | |||||
public bool MakeCoffeeEnd = false; | |||||
/// <summary> | |||||
/// 果汁订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuicer = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 是否有果汁杯 | |||||
/// </summary> | |||||
public bool IsHaveJuiceCup = false; | |||||
/// <summary> | |||||
/// 出果汁完成,是否去取果汁 | |||||
/// </summary> | |||||
public bool MakeJuiceEnd = false; | |||||
/// <summary> | |||||
/// 做茶订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTea = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 接水口是否有茶水杯 | |||||
/// </summary> | |||||
public bool IsHaveTeaWaterCup = false; | |||||
/// <summary> | |||||
/// 水已经接完,是否去取水杯 | |||||
/// </summary> | |||||
public bool MakeTeaEnd = false; | |||||
/// <summary> | |||||
/// 做开水订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesWater = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 等待取餐订单 | |||||
/// </summary> | |||||
public OrderLocInfo waitMorkOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 当前正在制作咖啡 | |||||
/// </summary> | |||||
public OrderLocInfo MakeCoffeeOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 订单ID | |||||
/// </summary> | |||||
public string SuborderId = null; | |||||
} | |||||
} |
@@ -1,76 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using BPASmartClient.Device; | |||||
using System.Collections.Concurrent; | |||||
namespace BPASmartClient.MorkT_Show | |||||
{ | |||||
public class GVL_MorkTLebaiJC : IStatus | |||||
{ | |||||
/// <summary> | |||||
/// <summary> | |||||
/// 咖啡订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesCoffee = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 是否有咖啡杯 | |||||
/// </summary> | |||||
public bool IsHaveCoffeeCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeCoffeeEnd = false; | |||||
/// <summary> | |||||
/// 果汁订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuicer = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 果汁是否在制作中 | |||||
/// </summary> | |||||
public bool IsHaveJuiceCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeJuiceEnd = false; | |||||
/// <summary> | |||||
/// 做茶订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTea = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 茶或水是否在制作中 | |||||
/// </summary> | |||||
public bool IsHaveTeaWaterCup = false; | |||||
/// <summary> | |||||
/// 咖啡是否制作完成 | |||||
/// </summary> | |||||
public bool MakeTeaEnd = false; | |||||
/// <summary> | |||||
/// 做开水订单队列 | |||||
/// </summary> | |||||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesWater = new ConcurrentQueue<OrderLocInfo>(); | |||||
/// <summary> | |||||
/// 等待取餐订单 | |||||
/// </summary> | |||||
public OrderLocInfo waitMorkOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 当前正在制作咖啡 | |||||
/// </summary> | |||||
public OrderLocInfo MakeCoffeeOrder = new OrderLocInfo(); | |||||
/// <summary> | |||||
/// 订单ID | |||||
/// </summary> | |||||
public string SuborderId = null; | |||||
} | |||||
} |
@@ -4,7 +4,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
namespace BPASmartClient.MorkT_Show | |||||
namespace BPASmartClient.MorkT_Container | |||||
{ | { | ||||
public class OrderLocInfo | public class OrderLocInfo | ||||
{ | { | ||||
@@ -4,7 +4,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
namespace BPASmartClient.MorkT_Show | |||||
namespace BPASmartClient.MorkT_Container | |||||
{ | { | ||||
internal enum GOODS_TYPE | internal enum GOODS_TYPE | ||||
{ | { | ||||
@@ -252,7 +252,7 @@ namespace BPASmartClient.MorktJAKAJC | |||||
return batchings[batchingLoc].GoodsType; | return batchings[batchingLoc].GoodsType; | ||||
return GOODS_TYPE.NEITHER; | return GOODS_TYPE.NEITHER; | ||||
} | } | ||||
private AutoResetEvent are = new AutoResetEvent(false); | private AutoResetEvent are = new AutoResetEvent(false); | ||||
private T GetStatus<T>(string key) | private T GetStatus<T>(string key) | ||||
@@ -388,6 +388,7 @@ namespace BPASmartClient.MorktJAKAJC | |||||
DeviceProcessLogShow("咖啡杯取杯完成"); | DeviceProcessLogShow("咖啡杯取杯完成"); | ||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡 }.Publish(); | new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡 }.Publish(); | ||||
Wait(int.Parse(JakaModel.SENCE_接咖啡)); | Wait(int.Parse(JakaModel.SENCE_接咖啡)); | ||||
new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | ||||
are.WaitOne(1000 * 180); | are.WaitOne(1000 * 180); | ||||
} | } | ||||
@@ -652,6 +653,77 @@ namespace BPASmartClient.MorktJAKAJC | |||||
/// <returns>0:无意义,1:取杯成功 2:机构有杯子,取杯失败 3:机构没有杯子</returns> | /// <returns>0:无意义,1:取杯成功 2:机构有杯子,取杯失败 3:机构没有杯子</returns> | ||||
private int takeCup() | private int takeCup() | ||||
{ | { | ||||
#region 单片机控制的IO | |||||
//try | |||||
//{ | |||||
// getCup_cnt = 0;//取杯次数复位 | |||||
// new WriteJaka() { TagName = "Set_RobotAO1", Value = 0 }.Publish(); | |||||
// Wait(0); | |||||
// new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||||
// Wait(int.Parse(JakaModel.SENCE_初始位)); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
// Thread.Sleep(10); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
// new WriteJaka() { TagName = "Set_RobotAO1", Value = 0 }.Publish(); | |||||
// Wait(0); | |||||
// new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish(); | |||||
// Wait(int.Parse(JakaModel.SENCE_取杯)); | |||||
// bSensorInput = sensor_Sign(1); | |||||
// if (bSensorInput == 2) | |||||
// { | |||||
// Thread.Sleep(100); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
// Thread.Sleep(100); | |||||
// new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯检测 }.Publish(); | |||||
// Wait(int.Parse(JakaModel.SENCE_取杯检测)); | |||||
// DeviceProcessLogShow("落杯器没有纸杯了"); | |||||
// return 3; | |||||
// } | |||||
// if (bSensorInput == 1) | |||||
// { | |||||
// Thread.Sleep(100); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
// Thread.Sleep(100); | |||||
// new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯检测 }.Publish(); | |||||
// Wait(int.Parse(JakaModel.SENCE_取杯检测)); | |||||
// bSensorInput = sensor_Sign(1); | |||||
// while (getCup_cnt < 4 && (bSensorInput == 2 || bSensorInput == 3)) | |||||
// { | |||||
// DeviceProcessLogShow($"第{getCup_cnt}次取杯失败"); | |||||
// Thread.Sleep(100); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
// Thread.Sleep(100); | |||||
// new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish(); | |||||
// Wait(int.Parse(JakaModel.SENCE_取杯)); | |||||
// getCup_cnt = getCup_cnt + 1; | |||||
// Thread.Sleep(100); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
// new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
// Thread.Sleep(100); | |||||
// new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯检测 }.Publish(); | |||||
// Wait(int.Parse(JakaModel.SENCE_取杯检测)); | |||||
// bSensorInput = sensor_Sign(1); | |||||
// } | |||||
// if (bSensorInput == 1) | |||||
// { | |||||
// return 1; | |||||
// } | |||||
// else | |||||
// { | |||||
// return 2; | |||||
// } | |||||
// } | |||||
// return 1; | |||||
//} | |||||
//catch (Exception ex) | |||||
//{ | |||||
// MessageLog.GetInstance.ShowEx(ex.ToString()); | |||||
// return 0; | |||||
//} | |||||
#endregion | |||||
try | try | ||||
{ | { | ||||
getCup_cnt = 0;//取杯次数复位 | getCup_cnt = 0;//取杯次数复位 | ||||
@@ -659,61 +731,64 @@ namespace BPASmartClient.MorktJAKAJC | |||||
Wait(0); | Wait(0); | ||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | ||||
Wait(int.Parse(JakaModel.SENCE_初始位)); | Wait(int.Parse(JakaModel.SENCE_初始位)); | ||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
Thread.Sleep(10); | |||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
new WriteJaka() { TagName = "JakaDOutput", DO_Index=0, Value = true }.Publish(); | |||||
Thread.Sleep(100); | |||||
new WriteJaka() { TagName = "Set_RobotAO1", Value = 0 }.Publish(); | new WriteJaka() { TagName = "Set_RobotAO1", Value = 0 }.Publish(); | ||||
Wait(0); | Wait(0); | ||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish(); | new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish(); | ||||
Wait(int.Parse(JakaModel.SENCE_取杯)); | Wait(int.Parse(JakaModel.SENCE_取杯)); | ||||
bSensorInput = sensor_Sign(1); | |||||
if (bSensorInput == 2) | |||||
{ | |||||
Thread.Sleep(100); | |||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
Thread.Sleep(100); | |||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯检测 }.Publish(); | |||||
Wait(int.Parse(JakaModel.SENCE_取杯检测)); | |||||
DeviceProcessLogShow("落杯器没有纸杯了"); | |||||
return 3; | |||||
} | |||||
if (bSensorInput == 1) | |||||
{ | |||||
Thread.Sleep(100); | |||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
Thread.Sleep(100); | |||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯检测 }.Publish(); | |||||
Wait(int.Parse(JakaModel.SENCE_取杯检测)); | |||||
bSensorInput = sensor_Sign(1); | |||||
while (getCup_cnt < 4 && (bSensorInput == 2 || bSensorInput == 3)) | |||||
//取杯到位,使用落杯器 | |||||
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 1, Value = true }.Publish(); | |||||
if (sensor_Sign(1)==1 ) | |||||
{ | |||||
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 1, Value = false }.Publish(); | |||||
Thread.Sleep(2000); | |||||
bSensorInput = sensor_Sign(0); | |||||
if (bSensorInput == 2) | |||||
{ | { | ||||
DeviceProcessLogShow($"第{getCup_cnt}次取杯失败"); | |||||
Thread.Sleep(100); | |||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish(); | |||||
Wait(int.Parse(JakaModel.SENCE_取杯)); | |||||
getCup_cnt = getCup_cnt + 1; | |||||
Thread.Sleep(100); | |||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||||
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = false }.Publish(); | |||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯检测 }.Publish(); | new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯检测 }.Publish(); | ||||
Wait(int.Parse(JakaModel.SENCE_取杯检测)); | Wait(int.Parse(JakaModel.SENCE_取杯检测)); | ||||
bSensorInput = sensor_Sign(1); | |||||
DeviceProcessLogShow("落杯器没有纸杯了"); | |||||
return 3; | |||||
} | } | ||||
if (bSensorInput == 1) | if (bSensorInput == 1) | ||||
{ | { | ||||
return 1; | |||||
} | |||||
else | |||||
{ | |||||
return 2; | |||||
Thread.Sleep(100); | |||||
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = false }.Publish(); | |||||
Thread.Sleep(100); | |||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯检测 }.Publish(); | |||||
Wait(int.Parse(JakaModel.SENCE_取杯检测)); | |||||
bSensorInput = sensor_Sign(1); | |||||
while (getCup_cnt < 4 && (bSensorInput == 2 || bSensorInput == 3)) | |||||
{ | |||||
DeviceProcessLogShow($"第{getCup_cnt}次取杯失败"); | |||||
Thread.Sleep(100); | |||||
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = true }.Publish(); | |||||
Thread.Sleep(100); | |||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish(); | |||||
Wait(int.Parse(JakaModel.SENCE_取杯)); | |||||
getCup_cnt = getCup_cnt + 1; | |||||
Thread.Sleep(100); | |||||
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = false }.Publish(); | |||||
Thread.Sleep(100); | |||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯检测 }.Publish(); | |||||
Wait(int.Parse(JakaModel.SENCE_取杯检测)); | |||||
bSensorInput = sensor_Sign(1); | |||||
} | |||||
if (bSensorInput == 1) | |||||
{ | |||||
return 1; | |||||
} | |||||
else | |||||
{ | |||||
return 2; | |||||
} | |||||
} | } | ||||
} | } | ||||
return 1; | return 1; | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -736,18 +811,17 @@ namespace BPASmartClient.MorktJAKAJC | |||||
} | } | ||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯 }.Publish(); | new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯 }.Publish(); | ||||
Wait(int.Parse(JakaModel.SENCE_放杯)); | Wait(int.Parse(JakaModel.SENCE_放杯)); | ||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||||
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = true }.Publish(); | |||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯检测 }.Publish(); | new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯检测 }.Publish(); | ||||
Wait(int.Parse(JakaModel.SENCE_放杯检测)); | Wait(int.Parse(JakaModel.SENCE_放杯检测)); | ||||
bSensorInput = sensor_Sign(2); | |||||
bSensorInput = sensor_Sign(3); | |||||
delayTimeOut = DateTime.Now; | delayTimeOut = DateTime.Now; | ||||
while (bSensorInput == 2) | while (bSensorInput == 2) | ||||
{ | { | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
bSensorInput = sensor_Sign(2); | |||||
bSensorInput = sensor_Sign(3); | |||||
if (DateTime.Now.Subtract(delayTimeOut).TotalSeconds >= 2) return 2; | if (DateTime.Now.Subtract(delayTimeOut).TotalSeconds >= 2) return 2; | ||||
} | } | ||||
if (bSensorInput == 2) | if (bSensorInput == 2) | ||||
@@ -822,7 +896,22 @@ namespace BPASmartClient.MorktJAKAJC | |||||
while (true) | while (true) | ||||
{ | { | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
bSensorInput = McuRead<int>("GetInputStatus", num); | |||||
if (num == 0) | |||||
{ | |||||
bSensorInput = GetStatus<bool>("Get_RobotDI0") ? 1 : 2; | |||||
} | |||||
else if (num == 1) | |||||
{ | |||||
bSensorInput = GetStatus<bool>("Get_RobotDI1") ? 1 : 2; | |||||
} | |||||
else if (num == 2) | |||||
{ | |||||
bSensorInput = GetStatus<bool>("Get_RobotDI2") ? 1 : 2; | |||||
} | |||||
else if (num == 3) | |||||
{ | |||||
bSensorInput = GetStatus<bool>("Get_RobotDI3") ? 1 : 2; | |||||
} | |||||
if (bSensorInput == 1) | if (bSensorInput == 1) | ||||
{ | { | ||||
cnt_Check = cnt_Check + 1; | cnt_Check = cnt_Check + 1; | ||||
@@ -5,6 +5,66 @@ namespace BPASmartClient.MorktJAKAJC | |||||
{ | { | ||||
public class GVL_MORKJC : IStatus | public class GVL_MORKJC : IStatus | ||||
{ | { | ||||
#region 果汁机设备MORKT2 Lebai机器人 | |||||
public const int 机器人安全位 = 10000;//一个位置(模组可移动,机器人不发生碰撞) | |||||
public const int 机器人初始位 = 10001; | |||||
public const int 初始位_机器人安全位 = 10002;//初始位---安全位 | |||||
public const int 取纸杯 = 10005;//安全位---取杯位 | |||||
public const int 二次取杯 = 10008;//取纸杯检测位---二次取杯位 | |||||
public const int 取纸杯检测 = 10006;//取杯位---取杯检测位 | |||||
public const int 取杯位_机器人安全位 = 10002;//取杯检测位---安全位 | |||||
public const int 接咖啡 = 10010;//安全位---接咖啡位 | |||||
public const int 接果汁过渡位 = 10002;//安全位---接果汁过渡位 | |||||
public const int 接果汁1 = 10011;//接果汁过渡位---果汁1位 | |||||
public const int 接果汁2 = 10012;//接果汁过渡位---果汁2位 | |||||
public const int 接果汁3 = 10013;//接果汁过渡位---果汁3位 | |||||
public const int 接果汁4 = 10014;//接果汁过渡位---果汁4位 | |||||
public const int 接果汁_机器人安全位 = 10002;//接果汁过渡位---安全位 | |||||
public const int 接茶叶 = 10015; | |||||
public const int 接茶水 = 10016; | |||||
public const int 接开水 = 10017; | |||||
public const int 接水_机器人安全位 = 10002; | |||||
public const int 接冰块 = 10018; | |||||
public const int 接冰_机器人安全位 = 10002; | |||||
public const int 放咖啡杯 = 10020; | |||||
public const int 放果汁杯1 = 10021; | |||||
public const int 放果汁杯2 = 10022; | |||||
public const int 放果汁杯3 = 10023; | |||||
public const int 放果汁杯4 = 10024; | |||||
public const int 放水杯 = 10025; | |||||
public const int 放杯 = 10001; | |||||
public const int 放杯_机器人安全位 = 10001; | |||||
#endregion | |||||
#region 果汁机设备 MORKT1 JAKA机器人 | |||||
public const int JUICE_初始位 = 20000; | |||||
public const int JUICE_取杯 = 20001; | |||||
public const int JUICE_取杯检测 = 20010; | |||||
public const int JUICE_接咖啡 = 20020; | |||||
public const int JUICE_接1号果汁 = 20030; | |||||
public const int JUICE_接2号果汁 = 20040; | |||||
public const int JUICE_接3号果汁 = 20050; | |||||
public const int JUICE_接4号果汁 = 20060; | |||||
public const int JUICE_接茶 = 20070; | |||||
public const int JUICE_接茶水 = 20075; | |||||
public const int JUICE_接水 = 20080; | |||||
public const int JUICE_放咖啡杯 = 20090; | |||||
public const int JUICE_放果汁杯 = 20100; | |||||
public const int JUICE_放茶水杯 = 20110; | |||||
public const int JUICE_放杯 = 20120; | |||||
public const int JUICE_放杯检测 = 20120; | |||||
#endregion | |||||
/// <summary> | /// <summary> | ||||
/// <summary> | /// <summary> | ||||
/// 咖啡订单队列 | /// 咖啡订单队列 | ||||
@@ -0,0 +1,240 @@ | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.Message; | |||||
using System; | |||||
using System.Collections.Concurrent; | |||||
using System.Collections.Generic; | |||||
using System.IO.Ports; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.SerialPort | |||||
{ | |||||
public class IceMakerHelper | |||||
{ | |||||
private System.IO.Ports.SerialPort comPort = new System.IO.Ports.SerialPort(); | |||||
ConcurrentQueue<byte[]> SerialMessages = new ConcurrentQueue<byte[]>(); | |||||
public bool IsOpen => comPort.IsOpen; | |||||
public bool Open(string portName, int baudRate) | |||||
{ | |||||
while (!System.IO.Ports.SerialPort.GetPortNames().Contains(portName)) | |||||
{ | |||||
Thread.Sleep(1000); | |||||
} | |||||
while (!comPort.IsOpen) | |||||
{ | |||||
comPort.PortName = portName; | |||||
comPort.BaudRate = baudRate; | |||||
comPort.DataBits = 8; | |||||
comPort.Parity = Parity.None; | |||||
comPort.StopBits = StopBits.One; | |||||
comPort.ReadTimeout = 1000; | |||||
comPort.WriteTimeout = 1000; | |||||
//comPort.DataReceived += ComPort_DataReceived; | |||||
comPort.RtsEnable = true; | |||||
try | |||||
{ | |||||
comPort.Open(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||||
Thread.Sleep(5000); | |||||
} | |||||
} | |||||
MessageLog.GetInstance.Show($"{portName} 串口打开成功"); | |||||
return comPort.IsOpen; | |||||
} | |||||
/* | |||||
帧头FF 帧头FE 功能码 数据 1 数据 2 和校验 结束符 | |||||
和校验:只校验功能码和数据。=功能码+数据 | |||||
接口方式:RS485 波特率:9600 | |||||
01 查询状态指令 需要主控板定时发送查询指令,解析制冰机自检后回复的状态信息,以判断是否可以出冰。 | |||||
02 出冰指令 若制冰机状态为等待出冰,此时主控板可以发送出冰指令,以实现定量冰块输出。 | |||||
03 结束出冰指令 制冰机出冰过程中,由主控板按一定的时间发送结束指令折算时间所对应的冰量 | |||||
04 待机指令 当制冰机处于工作时,发送该指令使制冰机处于待机状态 | |||||
05 开机指令 当制冰机处于待机时,发送该指令使制冰机,制满一桶冰。 | |||||
06 抽水请求指令 预留抽水请求指令 | |||||
07 版本查询指令 品牌+硬件版本+软件版本 | |||||
09 冰量控制 通过定时开关方式控制制冰机出冰量 | |||||
*/ | |||||
/// <summary> | |||||
/// 获取制冰机状态 | |||||
/// </summary> | |||||
/// <param name="index"></param> | |||||
/// <returns></returns> | |||||
public byte GetDeviceStatus() | |||||
{ | |||||
List<int> res = new List<int>(); | |||||
byte[] buffers = new byte[7] { 0xFF, 0xFE, 0x01, 0x00, 0x00, 0x01, 0x5A }; | |||||
//发送 0xFF, 0xFE, 0x01, 0x00, 0x00, XX, 0x5A | |||||
//返回 0xFF, 0xFD, XX , 0x01, 0x00, XX, 0x5A | |||||
if (comPort.IsOpen) | |||||
{ | |||||
comPort.Write(buffers, 0, buffers.Length); | |||||
DateTime newDate = DateTime.Now; | |||||
while (comPort.BytesToRead < 7) | |||||
{ | |||||
Thread.Sleep(1); | |||||
if (DateTime.Now.Subtract(newDate).TotalSeconds >= 2) break; | |||||
} | |||||
byte[] receive = new byte[comPort.BytesToRead]; | |||||
comPort.Read(receive, 0, receive.Length); | |||||
if (receive.Length == 7) | |||||
{ | |||||
return receive[2]; | |||||
} | |||||
} | |||||
return default; | |||||
} | |||||
/// <summary> | |||||
/// 开始制做 | |||||
/// </summary> | |||||
/// <returns>true:开始制作</returns> | |||||
public bool StartCook() | |||||
{ | |||||
byte[] buffers = new byte[7] { 0xFF, 0xFE, 0x02, 0x00, 0x00, 0x02, 0x5A }; | |||||
//发送 0xFF, 0xFE, 0x02, 0x00, 0x00, XX, 0x5A | |||||
//返回 0xFF, 0xFD, 0x02, 0x00, 0x00, XX, 0x5A | |||||
if (comPort.IsOpen) | |||||
{ | |||||
comPort.Write(buffers, 0, buffers.Length); | |||||
while (comPort.BytesToRead < 7) | |||||
{ | |||||
Thread.Sleep(1); | |||||
} | |||||
byte[] receive = new byte[comPort.BytesToRead]; | |||||
comPort.Read(receive, 0, receive.Length); | |||||
if (receive.Length == 7) | |||||
return receive[1] == 0xFD; | |||||
} | |||||
return false; | |||||
} | |||||
/// <summary> | |||||
/// 结束制作 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public bool EndCook() | |||||
{ | |||||
byte[] buffers = new byte[7] { 0xFF, 0xFE, 0x03, 0x00, 0x00, 0x03, 0x5A }; | |||||
//发送 0xFF, 0xFE, 0x03, 0x00, 0x00, XX, 0x5A | |||||
//返回 0xFF, 0xFD, 0x03, 0x00, 0x00, XX, 0x5A | |||||
if (comPort.IsOpen) | |||||
{ | |||||
comPort.Write(buffers, 0, buffers.Length); | |||||
while (comPort.BytesToRead < 7) | |||||
{ | |||||
Thread.Sleep(1); | |||||
} | |||||
byte[] receive = new byte[comPort.BytesToRead]; | |||||
comPort.Read(receive, 0, receive.Length); | |||||
if (receive.Length == 7) | |||||
return receive[1] == 0xFD; | |||||
} | |||||
return false; | |||||
} | |||||
/// <summary> | |||||
/// 待机 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public bool Standby() | |||||
{ | |||||
byte[] buffers = new byte[7] { 0xFF, 0xFE, 0x04, 0x00, 0x00, 0x04, 0x5A }; | |||||
//发送 0xFF, 0xFE, 0x04, 0x00, 0x00, XX, 0x5A | |||||
//返回 0xFF, 0xFD, 0x04, 0x00, 0x00, XX, 0x5A | |||||
if (comPort.IsOpen) | |||||
{ | |||||
comPort.Write(buffers, 0, buffers.Length); | |||||
while (comPort.BytesToRead < 7) | |||||
{ | |||||
Thread.Sleep(1); | |||||
} | |||||
byte[] receive = new byte[comPort.BytesToRead]; | |||||
comPort.Read(receive, 0, receive.Length); | |||||
if (receive.Length == 7) | |||||
return receive[1] == 0xFD; | |||||
} | |||||
return default; | |||||
} | |||||
/// <summary> | |||||
/// 开机 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public bool PowerOn() | |||||
{ | |||||
byte[] buffers = new byte[7] { 0xFF, 0xFE, 0x05, 0x00, 0x00, 0x05, 0x5A }; | |||||
//发送 0xFF, 0xFE, 0x05, 0x00, 0x00, XX, 0x5A | |||||
//返回 0xFF, 0xFD, 0x05, 0x00, 0x00, XX, 0x5A | |||||
if (comPort.IsOpen) | |||||
{ | |||||
comPort.Write(buffers, 0, buffers.Length); | |||||
while (comPort.BytesToRead < 7) | |||||
{ | |||||
Thread.Sleep(1); | |||||
} | |||||
byte[] receive = new byte[comPort.BytesToRead]; | |||||
comPort.Read(receive, 0, receive.Length); | |||||
if (receive.Length == 6) | |||||
return receive[1] == 0xFD; | |||||
} | |||||
return default; | |||||
} | |||||
/// <summary> | |||||
/// 抽水 | |||||
/// </summary> | |||||
/// <returns>true:允许抽水,false:不允许抽水</returns> | |||||
public bool pump() | |||||
{ | |||||
byte[] buffers = new byte[7] { 0xFF, 0xFE, 0x06, 0x00, 0x00, 0x06, 0x5A }; | |||||
//发送 0xFF, 0xFE, 0x04, 0x00, 0x00, XX, 0x5A | |||||
//返回 0xFF, 0xFD, 0x04, 0x00, 0x00, XX, 0x5A | |||||
if (comPort.IsOpen) | |||||
{ | |||||
comPort.Write(buffers, 0, buffers.Length); | |||||
while (comPort.BytesToRead < 7) | |||||
{ | |||||
Thread.Sleep(1); | |||||
} | |||||
byte[] receive = new byte[comPort.BytesToRead]; | |||||
comPort.Read(receive, 0, receive.Length); | |||||
if (receive.Length == 7) | |||||
return receive[3] == 0x00; | |||||
} | |||||
return default; | |||||
} | |||||
/// <summary> | |||||
/// 冰量控制 | |||||
/// </summary> | |||||
/// <param name="value">出冰时间 单位0.1s</param> | |||||
/// <returns></returns> | |||||
public bool IceValue(byte value) | |||||
{ | |||||
byte checkNum = (byte)(0x09 + value); | |||||
byte[] buffers = new byte[7] { 0xFF, 0xFE, 0x09, value, 0x00, checkNum, 0x5A }; | |||||
//发送 0xFF, 0xFE, 0x09, value, 0x00, XX, 0x5A | |||||
//返回 0xFF, 0xFD, 0x09, 0x00, 0x00, XX, 0x5A | |||||
if (comPort.IsOpen) | |||||
{ | |||||
comPort.Write(buffers, 0, buffers.Length); | |||||
while (comPort.BytesToRead < 7) | |||||
{ | |||||
Thread.Sleep(1); | |||||
} | |||||
byte[] receive = new byte[comPort.BytesToRead]; | |||||
comPort.Read(receive, 0, receive.Length); | |||||
if (receive.Length == 7) | |||||
return receive[3] == 0x00; | |||||
} | |||||
return default; | |||||
} | |||||
} | |||||
} |
@@ -100,7 +100,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTJuicer" | |||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AGV", "BPASmartClient.AGV\BPASmartClient.AGV.csproj", "{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AGV", "BPASmartClient.AGV\BPASmartClient.AGV.csproj", "{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}" | ||||
EndProject | EndProject | ||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkT_Show", "BPASmartClient.MorkT_Show\BPASmartClient.MorkT_Show.csproj", "{3653724D-3683-4722-B978-EB88DD4AE5DB}" | |||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_Container", "BPASmartClient.MorkT_Show\BPASmartClient.MorkT_Container.csproj", "{3653724D-3683-4722-B978-EB88DD4AE5DB}" | |||||
EndProject | |||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.IceMaker", "BPASmartClient.IceMaker\BPASmartClient.IceMaker.csproj", "{F61AC179-156D-4075-BFEB-355862231F48}" | |||||
EndProject | |||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkT_BarCounter", "BPASmartClient.MorkT_BarCounter\BPASmartClient.MorkT_BarCounter.csproj", "{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}" | |||||
EndProject | EndProject | ||||
Global | Global | ||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
@@ -936,6 +940,46 @@ Global | |||||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x64.Build.0 = Release|Any CPU | {3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x64.Build.0 = Release|Any CPU | ||||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x86.ActiveCfg = Release|Any CPU | {3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x86.ActiveCfg = Release|Any CPU | ||||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x86.Build.0 = Release|Any CPU | {3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x86.Build.0 = Release|Any CPU | ||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|ARM.Build.0 = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|ARM64.Build.0 = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|x64.ActiveCfg = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|x64.Build.0 = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|x86.ActiveCfg = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Debug|x86.Build.0 = Debug|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|ARM.ActiveCfg = Release|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|ARM.Build.0 = Release|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|ARM64.ActiveCfg = Release|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|ARM64.Build.0 = Release|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|x64.ActiveCfg = Release|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|x64.Build.0 = Release|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|x86.ActiveCfg = Release|Any CPU | |||||
{F61AC179-156D-4075-BFEB-355862231F48}.Release|x86.Build.0 = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|ARM.Build.0 = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|ARM64.Build.0 = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|x64.ActiveCfg = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|x64.Build.0 = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|x86.ActiveCfg = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|x86.Build.0 = Debug|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|ARM.ActiveCfg = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|ARM.Build.0 = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|ARM64.ActiveCfg = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|ARM64.Build.0 = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x64.ActiveCfg = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x64.Build.0 = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x86.ActiveCfg = Release|Any CPU | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x86.Build.0 = Release|Any CPU | |||||
EndGlobalSection | EndGlobalSection | ||||
GlobalSection(SolutionProperties) = preSolution | GlobalSection(SolutionProperties) = preSolution | ||||
HideSolutionNode = FALSE | HideSolutionNode = FALSE | ||||
@@ -982,6 +1026,8 @@ Global | |||||
{724087A3-E7E7-4494-B844-414FF5CD1D40} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | {724087A3-E7E7-4494-B844-414FF5CD1D40} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | ||||
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} | {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} | ||||
{3653724D-3683-4722-B978-EB88DD4AE5DB} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | {3653724D-3683-4722-B978-EB88DD4AE5DB} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | ||||
{F61AC179-156D-4075-BFEB-355862231F48} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD} | |||||
{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||||
EndGlobalSection | EndGlobalSection | ||||
GlobalSection(ExtensibilityGlobals) = postSolution | GlobalSection(ExtensibilityGlobals) = postSolution | ||||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | ||||