@@ -243,5 +243,9 @@ namespace BPASmartClient.DRCoffee | |||
public override void WriteData(string address, object value) | |||
{ | |||
} | |||
//public override void ReadData(string address) | |||
//{ | |||
//} | |||
} | |||
} |
@@ -13,6 +13,8 @@ using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.Model.单片机; | |||
using BPASmartClient.EventBus; | |||
namespace BPASmartClient.Device | |||
{ | |||
@@ -110,6 +112,11 @@ namespace BPASmartClient.Device | |||
#endregion | |||
/// <summary> | |||
/// 写控制 | |||
/// </summary> | |||
/// <param name="address"></param> | |||
/// <param name="value"></param> | |||
public void WriteControl(string address, object value) | |||
{ | |||
if (peripherals != null) | |||
@@ -536,5 +543,6 @@ namespace BPASmartClient.Device | |||
IEnumerable<System.Reflection.PropertyInfo> property = from pi in t.GetProperties() where pi.Name.ToLower() == field.ToLower() select pi; | |||
return property.First().GetValue(info, null); | |||
} | |||
} | |||
} |
@@ -79,37 +79,20 @@ namespace BPASmartClient.Helper | |||
} | |||
///// <summary> | |||
///// 保存数据 | |||
///// </summary> | |||
//public static void Save<T>(this T ot) | |||
//{ | |||
// string outjson = JsonConvert.SerializeObject(ot); | |||
// var str = ot.GetType().GenericTypeArguments; | |||
// if (str != null && str.Length > 0) | |||
// { | |||
// File.WriteAllText(LocaPath.GetInstance.Getpath(str[0].Name), outjson); | |||
// } | |||
//} | |||
///// <summary> | |||
///// 获取保存的数据 | |||
///// </summary> | |||
//public static void Read(this object ot) | |||
//{ | |||
// var str = ot.GetType().GenericTypeArguments; | |||
// if (str != null && str.Length > 0) | |||
// { | |||
// string pa = LocaPath.GetInstance.Getpath(str[0].Name); | |||
// if (File.Exists(pa)) | |||
// { | |||
// string JsonString = File.ReadAllText(pa); | |||
// var result = JsonConvert.DeserializeObject<object>(JsonString); | |||
// if (result != null) { Json<object>.Data = result; } | |||
// } | |||
// } | |||
//} | |||
/// <summary> | |||
/// 字节数组转换成32位整数 | |||
/// </summary> | |||
/// <param name="bytes"></param> | |||
/// <returns></returns> | |||
public static int BytesToInt(this byte[] bytes) | |||
{ | |||
if (bytes.Length > 4) return -1; | |||
int ReturnVlaue = 0; | |||
for (int i = 0; i < bytes.Length; i++) | |||
{ | |||
ReturnVlaue += (int)(bytes[i] << (i * 8)); | |||
} | |||
return ReturnVlaue; | |||
} | |||
} | |||
} |
@@ -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.JakaRobot\BPASmartClient.JakaRobot.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Peripheral\BPASmartClient.Peripheral.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,83 @@ | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.JakaRobot; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Peripheral; | |||
using static BPASmartClient.EventBus.EventBus; | |||
namespace BPASmartClient.JAKA | |||
{ | |||
public class JakaMachine : BasePeripheral | |||
{ | |||
JaKaHelper jaKaHelper = new JaKaHelper(); | |||
public override void Init() | |||
{ | |||
jaKaHelper.Connect(communicationPar.IPAddress); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
IsConnected = jaKaHelper.IsConnected; | |||
if (!IsConnected) IsWork = false; | |||
while (IsConnected) | |||
{ | |||
IsWork = true; | |||
if (status != null) | |||
{ | |||
SetStatus("GetProgramStatus", (int)jaKaHelper.GetProgramStatus()); | |||
SetStatus("Get_RobotAO1", jaKaHelper.Get_RobotAO1()); | |||
} | |||
Thread.Sleep(500); | |||
} | |||
Thread.Sleep(1000); | |||
}), $"设备[{DeviceId}]节卡机器人读取线程", true); | |||
EventBus.EventBus.GetInstance().Subscribe<WriteJaka>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
var par = @event as WriteJaka; | |||
switch (par?.TagName) | |||
{ | |||
case "Power_On": | |||
jaKaHelper.Power_On(); | |||
break; | |||
case "Enable_robot": | |||
jaKaHelper.Enable_robot(); | |||
break; | |||
case "Set_RobotAO1": | |||
if (par?.Value is int intvalue) jaKaHelper.Set_RobotAO1(intvalue); | |||
break; | |||
case "JaKaProgramName": | |||
if (par?.Value is string stringvalue) jaKaHelper.JaKaProgramName(stringvalue); | |||
break; | |||
default: | |||
break; | |||
} | |||
}); | |||
} | |||
//public override void ReadData(string address) | |||
//{ | |||
//} | |||
public override void Start() | |||
{ | |||
} | |||
public override void Stop() | |||
{ | |||
} | |||
public override void WriteData(string address, object value) | |||
{ | |||
} | |||
protected override void InitStatus() | |||
{ | |||
} | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Message\BPASmartClient.Message.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,371 @@ | |||
using BPASmartClient.Message; | |||
using System.Text; | |||
namespace BPASmartClient.JakaRobot | |||
{ | |||
public class JaKaHelper | |||
{ | |||
#region 果汁机设备 | |||
/*public const string SENCE_取咖啡杯 = "10000"; | |||
public const string SENCE_取果汁杯 = "10001"; | |||
public const string SENCE_取茶水杯 = "10002"; | |||
public const string SENCE_取水杯 = "10003"; | |||
public const string SENCE_取咖啡杯检测 = "11000"; | |||
public const string SENCE_取果汁杯检测 = "11001"; | |||
public const string SENCE_取茶水杯检测 = "11002"; | |||
public const string SENCE_取水杯检测 = "11003"; | |||
public const string SENCE_接咖啡 = "12000"; | |||
public const string SENCE_接果汁1 = "12001"; | |||
public const string SENCE_接果汁2 = "12002"; | |||
public const string SENCE_接果汁3 = "12003"; | |||
public const string SENCE_接果汁4 = "12004"; | |||
public const string SENCE_接茶 = "12005"; | |||
public const string SENCE_接水 = "12006"; | |||
public const string SENCE_放咖啡杯 = "13000"; | |||
public const string SENCE_放果汁杯1 = "13001"; | |||
public const string SENCE_放果汁杯2 = "13002"; | |||
public const string SENCE_放果汁杯3 = "13003"; | |||
public const string SENCE_放果汁杯4 = "13004"; | |||
public const string SENCE_放茶水杯 = "13005"; | |||
public const string SENCE_放水杯 = "13006";*/ | |||
//public const string SENCE_取杯 = "10000"; | |||
//public const string SENCE_放杯位检测 = "10100"; | |||
//public const string SENCE_取杯检测 = "11000"; | |||
//public const string SENCE_接咖啡 = "12000"; | |||
//public const string SENCE_接果汁1 = "12001"; | |||
//public const string SENCE_接果汁2 = "12002"; | |||
//public const string SENCE_接果汁3 = "12003"; | |||
//public const string SENCE_接果汁4 = "12004"; | |||
//public const string SENCE_接茶 = "12005"; | |||
//public const string SENCE_接水 = "12006"; | |||
//public const string SENCE_接茶_接水 = "12007"; | |||
//public const string SENCE_放咖啡杯 = "13000";//接饮料位---放饮料过渡位 | |||
//public const string SENCE_放果汁杯1 = "13001"; | |||
//public const string SENCE_放果汁杯2 = "13002"; | |||
//public const string SENCE_放果汁杯3 = "13003"; | |||
//public const string SENCE_放果汁杯4 = "13004"; | |||
//public const string SENCE_放茶水杯 = "13005"; | |||
//public const string SENCE_放杯 = "14000";//放杯过渡位到-放杯 | |||
//public const string SENCE_放杯检测 = "15000"; | |||
//public const string SENCE_初始位 = "20000"; | |||
#endregion | |||
private int rshd = -1; | |||
private bool login = false; | |||
/// <summary> | |||
/// 机器人的状态 | |||
/// </summary> | |||
private JKTYPE.RobotStatus robot_Status; | |||
private JKTYPE.ProgramState program_status; | |||
//private volatile static JaKaHelper _Instance; | |||
//public static JaKaHelper GetInstance => _Instance ?? (_Instance = new JaKaHelper()); | |||
//private JaKaHelper() { } | |||
public bool IsIdle { get; set; } = false; | |||
public bool IsConnected { get { return login; } } | |||
public void Connect(string ip) | |||
{ | |||
bool ErrorFlag = false; | |||
while (rshd == -1 || login == false) | |||
{ | |||
try | |||
{ | |||
jakaAPI.create_handler(ip.ToCharArray(), ref rshd); | |||
login = true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (!ErrorFlag) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
ErrorFlag = true; | |||
login = false; | |||
} | |||
Thread.Sleep(3000); | |||
} | |||
} | |||
if (login) | |||
{ | |||
try | |||
{ | |||
Power_On();//打开机器人电源 | |||
Thread.Sleep(1000); | |||
Enable_robot();//机器人上使能 | |||
MessageLog.GetInstance.Show("机器人已上电使能"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx("机器人未完成上电和使能"); | |||
} | |||
} | |||
} | |||
public void Power_On() | |||
{ | |||
if (login) | |||
{ | |||
try | |||
{ | |||
jakaAPI.power_on(ref rshd); | |||
} | |||
catch (System.AccessViolationException ave) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ave.ToString()); | |||
} | |||
//catch (Exception ex) | |||
//{ | |||
// MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
//} | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show("jaka机器人未连接成功!"); | |||
} | |||
} | |||
public void Power_Off() | |||
{ | |||
if (login) | |||
{ | |||
try | |||
{ | |||
jakaAPI.power_off(ref rshd); | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show("jaka机器人未连接成功!"); | |||
} | |||
} | |||
public void Enable_robot() | |||
{ | |||
if (!(rshd == -1)) | |||
{ | |||
try | |||
{ | |||
jakaAPI.enable_robot(ref rshd); | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show("jaka机器人未连接成功!"); | |||
} | |||
} | |||
public void disEnable_robot() | |||
{ | |||
if (!(rshd == -1)) | |||
{ | |||
try | |||
{ | |||
jakaAPI.disable_robot(ref rshd); | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show("jaka机器人未连接成功!"); | |||
} | |||
} | |||
/// <summary> | |||
/// 设置机器人的DO值 | |||
/// </summary> | |||
/// <param name="DOIndex"></param> | |||
/// <param name="value"></param> | |||
/// <returns></returns> | |||
public bool Set_RobotDO(int DOIndex, bool value) | |||
{ | |||
try | |||
{ | |||
jakaAPI.set_digital_output(ref rshd, JKTYPE.IOType.IO_CABINET, DOIndex, value); | |||
return value; | |||
} | |||
catch (Exception ex) | |||
{ | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// 设置机器人的AO值 | |||
/// </summary> | |||
/// <param name="value">设置值</param> | |||
/// <returns></returns> | |||
public int Set_RobotAO1(int Value) | |||
{ | |||
try | |||
{ | |||
return jakaAPI.set_analog_output(ref rshd, JKTYPE.IOType.IO_CABINET, 0, Value); | |||
} | |||
catch (Exception ex) | |||
{ | |||
return 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 设置机器人的AO值 | |||
/// </summary> | |||
/// <param name="Index">索引值</param> | |||
/// <param name="value">设置值</param> | |||
/// <returns></returns> | |||
public int Set_RobotAO(int Index, int Value) | |||
{ | |||
try | |||
{ | |||
return jakaAPI.set_analog_output(ref rshd, JKTYPE.IOType.IO_CABINET, Index, Value); | |||
} | |||
catch (Exception ex) | |||
{ | |||
return 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 获取机器人的AO值 | |||
/// </summary> | |||
/// <param name="Index">索引值</param> | |||
/// <param name="value">设置值</param> | |||
/// <returns></returns> | |||
public float Get_RobotAO(int Index, int value) | |||
{ | |||
try | |||
{ | |||
float bResult = 0; | |||
jakaAPI.get_analog_output(ref rshd, JKTYPE.IOType.IO_CABINET, Index, ref bResult); | |||
return bResult; | |||
} | |||
catch (Exception ex) | |||
{ | |||
return 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 获取机器人的AO值 | |||
/// </summary> | |||
/// <param name="Index">索引值</param> | |||
/// <param name="value">设置值</param> | |||
/// <returns></returns> | |||
public float Get_RobotAO1() | |||
{ | |||
try | |||
{ | |||
float bResult = 0; | |||
jakaAPI.get_analog_output(ref rshd, JKTYPE.IOType.IO_CABINET, 0, ref bResult); | |||
return bResult; | |||
} | |||
catch (Exception ex) | |||
{ | |||
return 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 获取机器人的DI输入 | |||
/// </summary> | |||
/// <param name="index"></param> | |||
/// <returns></returns> | |||
public bool Get_RobotDI(int index) | |||
{ | |||
bool bResult = false; | |||
jakaAPI.get_digital_input(ref rshd, JKTYPE.IOType.IO_CABINET, index, ref bResult); | |||
return bResult; | |||
} | |||
/// <summary> | |||
/// 获取机器人的状态 | |||
/// </summary> | |||
public void GetRobotStatus() | |||
{ | |||
jakaAPI.get_robot_status(ref rshd, ref robot_Status); | |||
} | |||
public JKTYPE.ProgramState GetProgramStatus() | |||
{ | |||
jakaAPI.get_program_state(ref rshd, ref program_status); | |||
return program_status; | |||
} | |||
StringBuilder jakafile; | |||
JKTYPE.ProgramState status; | |||
char[] file; | |||
public void JaKaProgramName(String Programname) | |||
{ | |||
try | |||
{ | |||
//加载 | |||
file = Programname.ToCharArray(); | |||
MessageLog.GetInstance.Show($"调用文件名:{Programname}"); | |||
status = new JKTYPE.ProgramState(); | |||
jakaAPI.get_program_state(ref rshd, ref status); | |||
if (status != JKTYPE.ProgramState.PROGRAM_IDLE) | |||
{ | |||
MessageLog.GetInstance.Show($"程序运行中,无法加载程序!!!"); | |||
} | |||
else | |||
{ | |||
if (jakaAPI.program_load(ref rshd, file) == 0) | |||
{ | |||
MessageLog.GetInstance.Show($"加载程序完成"); | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show($"加载程序失败!!!"); | |||
} | |||
} | |||
if (status == JKTYPE.ProgramState.PROGRAM_RUNNING) | |||
{ | |||
MessageLog.GetInstance.Show($"程序处于已处于启动状态!!!"); | |||
} | |||
else if (status == JKTYPE.ProgramState.PROGRAM_IDLE) | |||
{ | |||
jakafile = new StringBuilder(); | |||
jakaAPI.get_loaded_program(ref rshd, jakafile); | |||
if (jakafile.Length == 0) | |||
{ | |||
MessageLog.GetInstance.Show($"未加载程序,无法运行!!!"); | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show($"当前加载程序为:" + jakafile); | |||
jakaAPI.program_run(ref rshd); | |||
MessageLog.GetInstance.Show($"程序启动"); | |||
} | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show($"程序处于暂停状态,无法重新启动程序!!!"); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,364 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
//using System.Numerics; | |||
using System.Text; | |||
using System.Runtime.InteropServices; | |||
namespace BPASmartClient.JakaRobot | |||
{ | |||
public class JKTYPE | |||
{ | |||
/** | |||
* @brief 笛卡尔空间位置数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct CartesianTran | |||
{ | |||
public double x; ///< x轴坐标,单位mm | |||
public double y; ///< y轴坐标,单位mm | |||
public double z; ///< z轴坐标,单位mm | |||
}; | |||
/** | |||
* @brief 欧拉角姿态数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct Rpy | |||
{ | |||
public double rx; ///< 绕固定轴X旋转角度,单位:rad | |||
public double ry; ///< 绕固定轴Y旋转角度,单位:rad | |||
public double rz; ///< 绕固定轴Z旋转角度,单位:rad | |||
}; | |||
/** | |||
* @brief 四元数姿态数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct Quaternion | |||
{ | |||
public double s; | |||
public double x; | |||
public double y; | |||
public double z; | |||
}; | |||
/** | |||
*@brief 笛卡尔空间位姿类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct CartesianPose | |||
{ | |||
public CartesianTran tran; ///< 笛卡尔空间位置 | |||
public Rpy rpy; ///< 笛卡尔空间姿态 | |||
}; | |||
/** | |||
* @brief 旋转矩阵数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct RotMatrix | |||
{ | |||
public CartesianTran x; ///< x轴列分量 | |||
public CartesianTran y; ///< y轴列分量 | |||
public CartesianTran z; ///< z轴列分量 | |||
}; | |||
/** | |||
* @brief 程序运行状态枚举类型 | |||
*/ | |||
public enum ProgramState | |||
{ | |||
PROGRAM_IDLE, ///< 机器人停止运行 | |||
PROGRAM_RUNNING, ///< 机器人正在运行 | |||
PROGRAM_PAUSED ///< 机器人暂停 | |||
}; | |||
/** | |||
* @brief 坐标系选择枚举类型 | |||
*/ | |||
public enum CoordType | |||
{ | |||
COORD_BASE, ///< 基坐标系 | |||
COORD_JOINT, ///< 关节空间 | |||
COORD_TOOL ///< 工具坐标系 | |||
}; | |||
/** | |||
* @brief jog运动模式枚举 | |||
*/ | |||
public enum MoveMode | |||
{ | |||
ABS = 0, ///< 绝对运动 | |||
INCR ///< 增量运动 | |||
}; | |||
/** | |||
* @brief 系统监测数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct SystemMonitorData | |||
{ | |||
public int scbMajorVersion; ///<scb主版本号 | |||
public int scbMinorVersion; ///<scb次版本号 | |||
public int cabTemperature; ///<控制柜温度 | |||
public double robotAveragePower; ///<控制柜总线平均功率 | |||
public double robotAverageCurrent; ///<控制柜总线平均电流 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public double[] instCurrent; ///<机器人6个轴的瞬时电流 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public double[] instVoltage; ///<机器人6个轴的瞬时电压 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public double[] instTemperature; ///<机器人6个轴的瞬时温度 | |||
}; | |||
/** | |||
* @brief 负载数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct PayLoad | |||
{ | |||
public double mass; ///<负载质量,单位:kg | |||
public CartesianTran centroid; ///<负载质心, 单位:mm | |||
}; | |||
/** | |||
* @brief 关节位置数据类型 | |||
*/ | |||
public struct JointValue | |||
{ | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public double[] jVal; ///< 6关节位置值,单位:rad | |||
}; | |||
/** | |||
* @brief IO类型枚举 | |||
*/ | |||
public enum IOType | |||
{ | |||
IO_CABINET, ///< 控制柜面板IO | |||
IO_TOOL, ///< 工具IO | |||
IO_EXTEND ///< 扩展IO | |||
}; | |||
/** | |||
* @brief 机器人状态数据 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct RobotState | |||
{ | |||
public int estoped; ///< 是否急停 | |||
public int poweredOn; ///< 是否打开电源 | |||
public int servoEnabled; ///< 是否使能 | |||
}; | |||
/** | |||
* @brief 机器人力矩数据 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct TorqueValue | |||
{ | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public double[] jTorque; ///< 是否使能 | |||
} | |||
/** | |||
* @brief 机器人关节监测数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct JointMonitorData | |||
{ | |||
double instCurrent; ///< 瞬时电流 | |||
double instVoltage; ///< 瞬时电压 | |||
double instTemperature; ///< 瞬时温度 | |||
} | |||
/** | |||
* @brief 机器人监测数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct RobotMonitorData | |||
{ | |||
double scbMajorVersion; ///< scb主版本号 | |||
double scbMinorVersion; ///< scb小版本号 | |||
double cabTemperature; ///< 控制器温度 | |||
double robotAveragePower; ///< 机器人平均电压 | |||
double robotAverageCurrent; ///< 机器人平均电流 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public JointMonitorData[] jointMonitorData; ///< 机器人6个关节的监测数据 | |||
} | |||
/** | |||
* @brief 力矩传感器监测数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct TorqSensorMonitorData | |||
{ | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] | |||
public char[] ip; ///< 力矩传感器ip地址 | |||
int port; ///< 力矩传感器端口号 | |||
PayLoad payLoad; ///< 工具负载 | |||
int status; ///< 力矩传感器状态 | |||
int errcode; ///< 力矩传感器异常错误码 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public double[] actTorque; ///< 力矩传感器实际接触力值 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public double[] torque; ///< 力矩传感器原始读数值 | |||
} | |||
/** | |||
* @brief 机器人状态监测数据,使用get_robot_status函数更新机器人状态数据 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct RobotStatus | |||
{ | |||
public int errcode; ///< 机器人运行出错时错误编号,0为运行正常,其它为运行异常 | |||
public int inpos; ///< 机器人运动是否到位标志,0为没有到位,1为运动到位 | |||
public int powered_on; ///< 机器人是否上电标志,0为没有上电,1为上电 | |||
public int enabled; ///< 机器人是否使能标志,0为没有使能,1为使能 | |||
public double rapidrate; ///< 机器人运动倍率 | |||
public int protective_stop; ///< 机器人是否检测到碰撞,0为没有检测到碰撞,1为检测到碰撞 | |||
public int emergency_stop; ///< 机器人是否急停,0为没有急停,1为急停 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65)] | |||
public int[] dout; ///< 机器人控制柜数字输出信号,dout[0]为信号的个数 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] | |||
public int[] tio_dout; ///< 机器人末端工具数字输出信号,tio_dout[0]为信号的个数 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65)] | |||
public int[] extio; ///< 机器人外部应用数字输出信号,extio[0]为信号的个数 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65)] | |||
public int[] din; ///< 机器人控制柜数字输入信号,din[0]为信号的个数 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] | |||
public int[] tio_din; ///< 机器人末端工具数字输入信号,tio_din[0]为信号的个数 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65)] | |||
public double[] ain; ///< 机器人控制柜模拟输入信号,ain[0]为信号的个数 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] | |||
public double[] tio_ain; ///< 机器人末端工具模拟输入信号,tio_ain[0]为信号的个数 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65)] | |||
public double[] aout; ///< 机器人控制柜模拟输出信号,aout[0]为信号的个数 | |||
public int current_tool_id; ///< 机器人目前使用的工具坐标系id | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public double[] cartesiantran_position; ///< 机器人末端所在的笛卡尔空间位置 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public double[] joint_position; ///< 机器人关节空间位置 | |||
public int on_soft_limit; ///< 机器人是否处于限位,0为没有触发限位保护,1为触发限位保护 | |||
public int current_user_id; ///< 机器人目前使用的用户坐标系id | |||
public int drag_status; ///< 机器人是否处于拖拽状态,0为没有处于拖拽状态,1为处于拖拽状态 | |||
public RobotMonitorData robot_monitor_data; ///< 机器人状态监测数据 | |||
public TorqSensorMonitorData torq_sensor_monitor_data; ///< 机器人力矩传感器状态监测数据 | |||
int is_socket_connect; ///< sdk与控制器连接通道是否正常,0为连接通道异常,1为连接通道正常 | |||
} | |||
/** | |||
* @brief 机器人错误码数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct ErrorCode | |||
{ | |||
public long code; ///< 错误码编号 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 120)] | |||
public char[] message; ///< 错误码对应提示信息 | |||
} | |||
/** | |||
* @brief 轨迹复现配置参数数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct TrajTrackPara | |||
{ | |||
public double xyz_interval; ///< 空间位置采集精度 | |||
public double rpy_interval; ///< 姿态采集精度 | |||
public double vel; ///< 执行脚本运行速度 | |||
public double acc; ///< 执行脚本运行加速度 | |||
} | |||
/** | |||
* @brief 多个字符串存储数据类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct MultStrStorType | |||
{ | |||
public int len; ///< 字符串个数 | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128 * 128)] | |||
public char[] message; ///< 错误码对应提示信息 | |||
} | |||
/** | |||
* @brief 运动参数可选项 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct OptionalCond | |||
{ | |||
int executingLineId; ///< 控制命令id编号 | |||
} | |||
/** | |||
* @brief 网络异常机器人运动自动终止类型枚举 | |||
*/ | |||
public enum ProcessType | |||
{ | |||
MOT_KEEP, ///< 网络异常时机器人继续保持原来的运动 | |||
MOT_PAUSE, ///< 网络异常时机器人暂停运动 | |||
MOT_ABORT ///< 网络异常时机器人终止运动 | |||
} | |||
/** | |||
* @brief 柔顺控制参数类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct AdmitCtrlType | |||
{ | |||
int opt; ///< 柔顺方向,可选值为 1 2 3 4 5 6分别对应 fx fy fz mx my mz,0代表没有勾选 | |||
double ft_user; ///< 用户用多大的力才能让机器人的沿着某个方向以最大速度进行运动 | |||
double ft_rebound; ///< 回弹力:机器人回到初始状态的能力 | |||
double ft_constant; ///< 恒力 | |||
int ft_normal_track; ///< 法向跟踪是否开启,0为没有开启,1为开启 | |||
} | |||
/** | |||
* @brief 机器人柔顺控制参数类型 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct RobotAdmitCtrl | |||
{ | |||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] | |||
public AdmitCtrlType[] admit_ctrl; | |||
} | |||
/** | |||
* @brief 速度柔顺控制等级和比率等级设置 | |||
* 速度柔顺控制分三个等级,并且 1>rate1>rate2>rate3>rate4>0 | |||
* 等级为1时,只能设置rate1,rate2两个等级。rate3,rate4的值为0 | |||
* 等级为2时,只能设置rate1,rate2,rate3 三个等级。rate4的值为0 | |||
* 等级为3时,能设置 rate1,rate2,rate3,rate4 4个等级 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct VelCom | |||
{ | |||
int vc_level; //速度柔顺控制等级 | |||
double rate1; //比率1等级 | |||
double rate2; //比率2等级 | |||
double rate3; //比率3等级 | |||
double rate4; //比率4等级 | |||
} | |||
/** | |||
* @brief 力传感器的受力分量和力矩分量 | |||
*/ | |||
[StructLayout(LayoutKind.Sequential)] | |||
public struct FTxyz | |||
{ | |||
double fx; // 沿x轴受力分量 | |||
double fy; // 沿y轴受力分量 | |||
double fz; // 沿z轴受力分量 | |||
double tx; // 绕x轴力矩分量 | |||
double ty; // 绕y轴力矩分量 | |||
double tz; // 绕z轴力矩分量 | |||
} | |||
} | |||
} |
@@ -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,61 @@ | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Peripheral; | |||
using BPASmartClient.SerialPort; | |||
using static BPASmartClient.EventBus.EventBus; | |||
namespace BPASmartClient.Juicer | |||
{ | |||
public class JuicerMachine : BasePeripheral | |||
{ | |||
JuicerHelper juicerHelper = new JuicerHelper(); | |||
public override void Init() | |||
{ | |||
juicerHelper.Open(communicationPar.SerialPort, communicationPar.BaudRate); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
IsConnected = juicerHelper.IsOpen; | |||
if (!IsConnected) IsWork = false; | |||
while (IsConnected) | |||
{ | |||
IsWork = true; | |||
if (status != null) | |||
{ | |||
SetStatus("GetDeviceStatus", juicerHelper.GetDeviceStatus()); | |||
} | |||
Thread.Sleep(500); | |||
} | |||
Thread.Sleep(1000); | |||
}), $"设备[{DeviceId}]果汁机读取线程", true); | |||
EventBus.EventBus.GetInstance().Subscribe<WriteJuicer>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
var par = @event as WriteJuicer; | |||
juicerHelper.StartCook(Convert.ToByte(par?.Value)); | |||
}); | |||
} | |||
//public override void ReadData(string address) | |||
//{ | |||
//} | |||
public override void Start() | |||
{ | |||
} | |||
public override void Stop() | |||
{ | |||
} | |||
public override void WriteData(string address, object value) | |||
{ | |||
} | |||
protected override void InitStatus() | |||
{ | |||
} | |||
} | |||
} |
@@ -48,6 +48,9 @@ namespace BPASmartClient.Lebai | |||
status["RobotIsConnected"] = LebaiHelper.GetInstance().IsConnected; | |||
status["RobotOK"] = LebaiHelper.GetInstance().GetValueAsync().Ok; | |||
status["RobotValue"] = LebaiHelper.GetInstance().GetValueAsync().Value; | |||
status["RobotValue1"] = LebaiHelper.GetInstance().GetValueAsync(1).Value; | |||
status["GetInput"] = LebaiHelper.GetInstance().GetInput(); | |||
status["GetInput2"] = LebaiHelper.GetInstance().GetInput(2); | |||
if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] = LebaiHelper.GetInstance().robotData.RobotMode.Mode; | |||
LebaiHelper.GetInstance().GetRobotModeStatus(); | |||
Thread.Sleep(10); | |||
@@ -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,71 @@ | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Model.PLC; | |||
using BPASmartClient.Model.单片机; | |||
using BPASmartClient.Peripheral; | |||
using BPASmartClient.SerialPort; | |||
using static BPASmartClient.EventBus.EventBus; | |||
namespace BPASmartClient.MCU | |||
{ | |||
public class MCUMachine : BasePeripheral | |||
{ | |||
MCUSerialHelper mCUSerialHelper = new MCUSerialHelper(); | |||
public override void Init() | |||
{ | |||
mCUSerialHelper.Open(communicationPar.SerialPort, communicationPar.BaudRate); | |||
EventBus.EventBus.GetInstance().Subscribe<ReadMcu>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
var par = @event as ReadMcu; | |||
if (status != null) | |||
{ | |||
SetStatus(par?.TagName, mCUSerialHelper.GetInputStatus(Convert.ToByte(par?.ReadPar))); | |||
} | |||
}); | |||
EventBus.EventBus.GetInstance().Subscribe<WriteMcu>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
var par = @event as WriteMcu; | |||
switch (par?.TagName) | |||
{ | |||
case "OutputControl": | |||
mCUSerialHelper.OutputControl(Convert.ToByte(par?.Address), Convert.ToBoolean(par?.Value)); | |||
break; | |||
case "ServoControl": | |||
mCUSerialHelper.ServoControl(Convert.ToByte(par?.Address), Convert.ToByte(par?.Value)); | |||
break; | |||
default: | |||
break; | |||
} | |||
}); | |||
} | |||
//public override void ReadData(string address) | |||
//{ | |||
//} | |||
public override void Start() | |||
{ | |||
} | |||
public override void Stop() | |||
{ | |||
} | |||
public override void WriteData(string address, object value) | |||
{ | |||
} | |||
protected override void InitStatus() | |||
{ | |||
} | |||
} | |||
} |
@@ -48,11 +48,15 @@ namespace BPASmartClient.PLC | |||
{ | |||
if (@event == null) return; | |||
var par = @event as WriteModel; | |||
//M32.7地址复位 | |||
modbusTcp.Write(par?.Address, par?.Value); | |||
}); | |||
} | |||
//public override void ReadData(string address) | |||
//{ | |||
//} | |||
public override void Start() | |||
{ | |||
@@ -11,6 +11,8 @@ namespace BPASmartClient.Model | |||
public class BaseEvent : IEvent | |||
{ | |||
public int DeviceId { get; set; } | |||
public string TagName { get; set; } | |||
public DeviceClientType deviceClientType { get; set; } | |||
} | |||
} |
@@ -8,7 +8,9 @@ namespace BPASmartClient.Model.PLC | |||
{ | |||
public class ReadModel : BaseEvent | |||
{ | |||
public string Address { get; set; } | |||
public ushort Length { get; set; } | |||
public object ReadPar { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using BPASmartClient.Model.单片机.Enum; | |||
using BPASmartClient.Model.PLC; | |||
using BPASmartClient.Model.单片机.Enum; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -16,7 +17,7 @@ namespace BPASmartClient.Model.单片机 | |||
/// <summary> | |||
/// STM32F103RCT6单片机下杯 | |||
/// </summary> | |||
public class SCChip_TakeCupEvent :BaseEvent | |||
public class SCChip_TakeCupEvent : BaseEvent | |||
{ | |||
/// <summary> | |||
/// 杯 | |||
@@ -27,7 +28,7 @@ namespace BPASmartClient.Model.单片机 | |||
/// <summary> | |||
/// STM32F103RCT6单片机舵机打料 | |||
/// </summary> | |||
public class SCChip_MakeIceCreamEvent :BaseEvent | |||
public class SCChip_MakeIceCreamEvent : BaseEvent | |||
{ | |||
public IC_SE SteeringEngine { get; set; } | |||
} | |||
@@ -35,7 +36,7 @@ namespace BPASmartClient.Model.单片机 | |||
/// <summary> | |||
/// STM32F103RCT6单片机舵机打开或者关闭 | |||
/// </summary> | |||
public class SCChip_SESwitchCreamEvent :BaseEvent | |||
public class SCChip_SESwitchCreamEvent : BaseEvent | |||
{ | |||
public IC_SE SteeringEngine { get; set; } | |||
public bool IsOpen { get; set; } | |||
@@ -44,7 +45,7 @@ namespace BPASmartClient.Model.单片机 | |||
/// <summary> | |||
/// STM32F103RCT6单片机控制冰淇淋机器转 | |||
/// </summary> | |||
public class SCChip_RotorSwitchEvent :BaseEvent | |||
public class SCChip_RotorSwitchEvent : BaseEvent | |||
{ | |||
public bool TurnOn { get; set; } | |||
} | |||
@@ -62,4 +63,14 @@ namespace BPASmartClient.Model.单片机 | |||
{ | |||
} | |||
public class WriteMcu : WriteModel | |||
{ | |||
} | |||
public class ReadMcu : ReadModel | |||
{ | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
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 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; | |||
#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 ReadJuicer : ReadModel | |||
{ | |||
} | |||
} |
@@ -0,0 +1,51 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Model | |||
{ | |||
public class JakaModel | |||
{ | |||
public const string SENCE_取杯 = "10000"; | |||
public const string SENCE_放杯位检测 = "10100"; | |||
public const string SENCE_取杯检测 = "11000"; | |||
public const string SENCE_接咖啡 = "12000"; | |||
public const string SENCE_接果汁1 = "12001"; | |||
public const string SENCE_接果汁2 = "12002"; | |||
public const string SENCE_接果汁3 = "12003"; | |||
public const string SENCE_接果汁4 = "12004"; | |||
public const string SENCE_接茶 = "12005"; | |||
public const string SENCE_接水 = "12006"; | |||
public const string SENCE_接茶_接水 = "12007"; | |||
public const string SENCE_放咖啡杯 = "13000";//接饮料位---放饮料过渡位 | |||
public const string SENCE_放果汁杯1 = "13001"; | |||
public const string SENCE_放果汁杯2 = "13002"; | |||
public const string SENCE_放果汁杯3 = "13003"; | |||
public const string SENCE_放果汁杯4 = "13004"; | |||
public const string SENCE_放茶水杯 = "13005"; | |||
public const string SENCE_放杯 = "14000";//放杯过渡位到-放杯 | |||
public const string SENCE_放杯检测 = "15000"; | |||
public const string SENCE_初始位 = "20000"; | |||
} | |||
public class WriteJaka : BaseEvent | |||
{ | |||
public string Address { get; set; } | |||
public object Value { get; set; } | |||
} | |||
public class ReadJaka : BaseEvent | |||
{ | |||
public string Address { get; set; } | |||
public ushort Length { get; set; } | |||
public object ReadPar { get; set; } | |||
} | |||
} | |||
@@ -6,4 +6,8 @@ | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -1,8 +0,0 @@ | |||
using System; | |||
namespace BPASmartClient.MorkTLebaiJC | |||
{ | |||
public class Class1 | |||
{ | |||
} | |||
} |
@@ -0,0 +1,865 @@ | |||
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.单片机; | |||
namespace BPASmartClient.MorkTLebaiJC | |||
{ | |||
/* | |||
* 冰淇淋咖啡机组合套装 | |||
* 物料位置: | |||
* 1:冰淇料 | |||
* 2:冰淇淋杯 | |||
* 5:咖啡 | |||
* 6:咖啡杯 | |||
* 9: 茶 | |||
* 10: 茶杯 | |||
*/ | |||
public class Control_MORKJC2 : BaseDevice | |||
{ | |||
//private CoffeEndCook coffeEndCook = new CoffeEndCook();//模拟咖啡制作成功 | |||
//咖啡机主控程序 | |||
//private CoffeeMachine coffeeMachine; | |||
//物料存放位置 | |||
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | |||
//容器位置 | |||
private string holderLoc; | |||
/// <summary> | |||
/// 获取乐百机器人的数据 | |||
/// </summary> | |||
//SignalResult lebai = new SignalResult(); | |||
//主料位置 | |||
private string mainMaterialLoc; | |||
//子订单ID | |||
private string subOrderId; | |||
private bool enableFunny = false; | |||
private DateTime lastRecvdOrder = DateTime.Now; | |||
private bool working = false; | |||
/// <summary> | |||
/// 果汁机做法,true:热饮,false:冷饮 | |||
/// </summary> | |||
private bool GuMake = false; | |||
//private SerialPortClient commProxy; | |||
public void ConnectOk() | |||
{ | |||
} | |||
ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>(); | |||
public void Init() | |||
{ | |||
//ActionManage.GetInstance.Register(new Action<object>((s) => | |||
//{ | |||
// if (s is DrCoffeeDrinksCode cf) | |||
// { | |||
// DoCoffee(); | |||
// } | |||
// else if (s is Dictionary<string, string> ms) | |||
// { | |||
// if (ms.ContainsKey("Button")) | |||
// { | |||
// switch (ms["Button"]) | |||
// { | |||
// case "启动示教": | |||
// JuicerModel.GetInstance.StartTeachMode(); | |||
// break; | |||
// case "停止示教": | |||
// JuicerModel.GetInstance.EndtTeachMode(); | |||
// break; | |||
// case "启动机器人": | |||
// JuicerModel.GetInstance.StartRobot(); | |||
// break; | |||
// case "急停": | |||
// JuicerModel.GetInstance.EStopRobot(); | |||
// break; | |||
// default: | |||
// break; | |||
// } | |||
// } | |||
// } | |||
//}), "SimCoffee"); | |||
//构建所有商品物料信息 | |||
batchings = PolymerBatching.BuildAll(); | |||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, CoffeEndCookHandle); | |||
System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); | |||
//一系列外围基础配置 | |||
var com_Coffee = config.AppSettings.Settings["COM_Coffee"].Value; | |||
var baud_Coffee = config.AppSettings.Settings["BAUD_Coffee"].Value; | |||
//咖啡机创建 | |||
//coffeeMachine = new CoffeeMachine(com_Coffee, (BaudRates)Enum.Parse(typeof(BaudRates), baud_Coffee)); | |||
Main(); | |||
ReadData(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
while (IsHealth && (morkOrderPushes.Count > 0)) | |||
{ | |||
working = true; | |||
if (morkOrderPushes.TryDequeue(out MorkOrderPush order)) | |||
{ | |||
MessageLog.GetInstance.Show($"开始制作订单[{order.SortNum}]"); | |||
//商品类型 | |||
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; | |||
//子订单ID | |||
subOrderId = order.SuborderId; | |||
//遍历物料 | |||
foreach (var item in order.GoodBatchings) | |||
{ | |||
var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
if (res != null) | |||
{ | |||
//获取主料和容器位置 | |||
switch (batchings[res.BatchingLoc].BatchingClass) | |||
{ | |||
case BATCHING_CLASS.HOLDER: | |||
holderLoc = res.BatchingLoc; | |||
break; | |||
case BATCHING_CLASS.MAIN_MATERIAL: | |||
// mainMaterialLoc ="1"; | |||
mainMaterialLoc = res.BatchingLoc; | |||
//验证商品是咖啡还是冰淇淋 | |||
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER) | |||
{ | |||
//获取当前物料所属商品类型 | |||
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); | |||
} | |||
break; | |||
} | |||
} | |||
} | |||
//根据商品类型执行具体制作流程 | |||
switch (currentGoodsType) | |||
{ | |||
case GOODS_TYPE.COFFEE: | |||
DoCoffee(); | |||
break; | |||
case GOODS_TYPE.JUICE: | |||
GuMake = order.MakeID == "2"; | |||
DoJuicer(); | |||
break; | |||
case GOODS_TYPE.TEA: | |||
DoTea(); | |||
break; | |||
case GOODS_TYPE.WATER: | |||
DoWater(); | |||
break; | |||
case GOODS_TYPE.NEITHER: | |||
MessageLog.GetInstance.Show("未知的商品类型"); | |||
break; | |||
} | |||
} | |||
working = false; | |||
lastRecvdOrder = DateTime.Now; | |||
} | |||
Thread.Sleep(1000); | |||
}), "订单制作"); | |||
} | |||
public void Main() | |||
{ | |||
//咖啡机开启主线程 | |||
//coffeeMachine.Start(); | |||
//开始心跳刷新,根据咖啡机及冰淇淋机来判断 | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//GeneralConfig.Healthy = | |||
// JuicerModel.GetInstance.IsConnected && | |||
// MorkCStatus.GetInstance().CanDo && | |||
// JuicerHelper.GetInstance.IsOpen && | |||
// MCUSerialHelper.GetInstance.IsOpen; | |||
//GeneralConfig.Healthy = true; | |||
Thread.Sleep(100); | |||
}), "MORK-IC心跳刷新"); | |||
//ThreadManage.GetInstance.Start(new Action(() => | |||
//{ | |||
// while (!JuicerModel.GetInstance.IsConnected) | |||
// { | |||
// Thread.Sleep(10); | |||
// } | |||
// //Sence(JuicerModel.SENCE_欢迎); | |||
//}), "MORK-JC欢迎"); | |||
} | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); | |||
} | |||
public void DataParse<T>(T order) | |||
{ | |||
if (order is MorkOrderPush morkOrderPush) | |||
{ | |||
morkOrderPushes.Enqueue(morkOrderPush); | |||
} | |||
} | |||
/// <summary> | |||
/// 验证当前是做咖啡还是做冰淇淋 | |||
/// </summary> | |||
/// <param name="batchingLoc">物料位置</param> | |||
private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc) | |||
{ | |||
if (batchings.ContainsKey(batchingLoc)) | |||
return batchings[batchingLoc].GoodsType; | |||
return GOODS_TYPE.NEITHER; | |||
} | |||
private AutoResetEvent are = new AutoResetEvent(false); | |||
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(); | |||
} | |||
private void Sence(int sen) | |||
{ | |||
new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = sen }.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> | |||
DateTime delayTimeOut; | |||
/// <summary> | |||
/// 做咖啡 | |||
/// </summary> | |||
private void DoCoffee() | |||
{ | |||
#region 接咖啡流程 | |||
are.Reset(); | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
MessageLog.GetInstance.Show("咖啡杯取杯完成"); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接咖啡); | |||
Wait(); | |||
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||
//Task.Delay(10000).Wait();//模拟接咖啡 | |||
//coffeEndCook.Publish();//模拟咖啡制作完成 | |||
are.WaitOne(1000 * 360); | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放咖啡杯); | |||
Wait(); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
MessageLog.GetInstance.Show("咖啡制作完成"); | |||
} | |||
else | |||
{ | |||
return; | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 做茶 | |||
/// </summary> | |||
private void DoTea() | |||
{ | |||
#region 接茶流程 | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
MessageLog.GetInstance.Show("取茶杯完成"); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接茶叶); | |||
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(JuicerModel.JUICE2_接茶水); | |||
Wait(); | |||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||
new WriteMcu() { TagName = "OutputControl", Address = "0", Value = false }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Address = "0", Value = true }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteMcu() { TagName = "OutputControl", Address = "0", Value = false }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||
Thread.Sleep(500); | |||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||
Thread.Sleep(46000); | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放水杯); | |||
Wait(); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
MessageLog.GetInstance.Show("茶水制作完成"); | |||
} | |||
else | |||
{ | |||
return; | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 接开水 | |||
/// </summary> | |||
private void DoWater() | |||
{ | |||
#region 接水流程 | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接水); | |||
Wait(); | |||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||
new WriteMcu() { TagName = "OutputControl", Address = "0", Value = false }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Address = "0", Value = true }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteMcu() { TagName = "OutputControl", Address = "0", Value = false }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = true }.Publish(); | |||
Thread.Sleep(500); | |||
new WriteMcu() { TagName = "OutputControl", Address = "1", Value = false }.Publish(); | |||
Thread.Sleep(46000); | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
//添加控制接水机构程序 | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放水杯); | |||
Wait(); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
MessageLog.GetInstance.Show("纯净水制作完成"); | |||
} | |||
else | |||
{ | |||
return; | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 果汁机控制信号 | |||
/// </summary> | |||
private byte JuicerNum; | |||
/// <summary> | |||
/// 做果汁 | |||
/// </summary> | |||
private void DoJuicer() | |||
{ | |||
#region 接果汁流程 | |||
are.Reset(); | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
int JuicerNum1 = int.Parse(mainMaterialLoc); | |||
switch (JuicerNum1) | |||
{ | |||
case 52: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x00; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x01; | |||
} | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁公共位); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接1号果汁); | |||
Wait(); | |||
break; | |||
case 53: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x02; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x03; | |||
} | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁公共位); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接2号果汁); | |||
Wait(); | |||
break; | |||
case 54: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x04; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x05; | |||
} | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁公共位); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接3号果汁); | |||
Wait(); | |||
break; | |||
case 55: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x06; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x07; | |||
} | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁公共位); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接4号果汁); ; | |||
Wait(); | |||
break; | |||
default: | |||
JuicerNum = 0x00; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁公共位); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE_接1号果汁); | |||
Wait(); | |||
break; | |||
} | |||
var devStatus = GetStatus<int[]>("GetDeviceStatus"); | |||
var devStatus1 = Convert.ToString(devStatus[0], 2); | |||
var devStatus2 = devStatus[1]; | |||
if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0) | |||
{ | |||
new WriteJuicer() { Value = JuicerNum }.Publish(); | |||
Thread.Sleep(100); | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
while (!(devStatusBy[1] == 0)) | |||
{ | |||
Thread.Sleep(100); | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
while (devStatusBy.Length != 2) | |||
{ | |||
Thread.Sleep(100); | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
} | |||
} | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
Thread.Sleep(5000); | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放果汁杯); | |||
Wait(); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
MessageLog.GetInstance.Show("果汁制作完成"); | |||
} | |||
////模拟果汁 | |||
//Thread.Sleep(15000); | |||
//while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
//{ | |||
// if (!outCupCheck) | |||
// MessageLog.GetInstance.ShowEx("成品处有纸杯存在,请取走!!"); | |||
// outCupCheck = true; | |||
//} | |||
//outCupCheck = false; | |||
//new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
//Sence(JuicerModel.JUICE2_放果汁杯); | |||
//Wait(); | |||
//OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
//MessageLog.GetInstance.Show("果汁制作完成"); | |||
} | |||
else | |||
{ | |||
return; | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 取杯的次数 | |||
/// </summary> | |||
private int nCnt; | |||
private int checkCnt;//检测次数 | |||
public override DeviceClientType DeviceType => throw new NotImplementedException(); | |||
/// <summary> | |||
/// 取杯流程 | |||
/// </summary> | |||
/// <returns>0:无意义,1:取杯成功 2:取杯失败</returns> | |||
private int takeCup() | |||
{ | |||
try | |||
{ | |||
nCnt = 0; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_初始位); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_取纸杯); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_纸杯检测); | |||
Wait(); | |||
nCnt++; | |||
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")) //读取传感器的值 | |||
{ | |||
if (nCnt > 3) | |||
{ | |||
nCnt = 0; | |||
MessageLog.GetInstance.ShowEx("三次取杯失败,回原点"); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_检测位回原点); | |||
Wait(); | |||
return 2; | |||
} | |||
else | |||
{ | |||
nCnt++; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_二次取杯); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_纸杯检测); | |||
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); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.Show(ex.ToString()); | |||
} | |||
return 1; | |||
} | |||
/// <summary> | |||
/// 放杯 | |||
/// </summary> | |||
/// <returns>0:无意义 1:放杯成功 2:执行失败(传感器还有信号) 3:放杯异常</returns> | |||
private int putCup() | |||
{ | |||
try | |||
{ | |||
if (GetStatus<bool>("RobotValue1")) return 2; | |||
Sence(JuicerModel.JUICE_放杯); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | |||
Sence(JuicerModel.JUICE_放杯检测); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | |||
if (GetStatus<bool>("GetInput2")) | |||
{ | |||
return 1; | |||
} | |||
else | |||
{ | |||
return 3; | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.Show(ex.ToString()); | |||
return 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 检测放杯位,是否有杯子 | |||
/// </summary> | |||
/// <returns>0:无意义 1:没有杯子 2:有杯子 </returns> | |||
private int checkCup() | |||
{ | |||
try | |||
{ | |||
while (GetStatus<bool>("RobotValue1")) | |||
{ | |||
Thread.Sleep(100); | |||
if (DateTime.Now.Subtract(delayTimeOut).TotalSeconds >= 1) return 2; | |||
} | |||
MessageLog.GetInstance.Show("放杯位有杯子未取走,等待取走,最多等待60s,即跳出流程"); | |||
return 1; | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.Show(ex.ToString()); | |||
return 0; | |||
} | |||
} | |||
private void CoffeEndCookHandle(IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
are.Set(); | |||
} | |||
//public void ReadData() | |||
//{ | |||
// //ThreadManage.GetInstance.StartLong(new Action(() => | |||
// //{ | |||
// // lebai = JuicerModel.GetInstance.GetValueAsync(); | |||
// // JuicerModel.GetInstance.GetRobotModeStatus(); | |||
// // //JuicerModel.GetInstance.GetInput(); | |||
// // Thread.Sleep(100); | |||
// //}), "乐百机器人数据读取", true); | |||
//} | |||
public void SimOrder<T>(T simOrder) | |||
{ | |||
//if (morkOrderPushes.Count > 0) | |||
//{ | |||
// morkOrderPushes.Clear(); | |||
//} | |||
//morkOrderPushes.Enqueue(simOrder as MorkOrderPush); | |||
} | |||
/// <summary> | |||
/// IOT 广播消息命令 | |||
/// </summary> | |||
//public void IotBroadcast<T>(T broadcast) | |||
//{ | |||
// if (broadcast != null && broadcast is IOTCommandModel iOTCommand) | |||
// { | |||
// switch (iOTCommand.CommandName) | |||
// { | |||
// case 0://控制类 | |||
// if (iOTCommand.CommandValue != null) | |||
// { | |||
// if (iOTCommand.CommandValue.ContainsKey("SimOrder")) | |||
// { | |||
// //SimOrder(new SimOrderData { NoodleLoc = 1, BowlLoc = 10 }); | |||
// } | |||
// } | |||
// break; | |||
// case 1://设置属性 | |||
// break; | |||
// case 2://通知消息 | |||
// break; | |||
// default: | |||
// break; | |||
// } | |||
// } | |||
//} | |||
public override void DoMain() | |||
{ | |||
} | |||
public override void Stop() | |||
{ | |||
} | |||
public override void ReadData() | |||
{ | |||
} | |||
public override void MainTask() | |||
{ | |||
} | |||
public override void ResetProgram() | |||
{ | |||
} | |||
public class SimOrderData | |||
{ | |||
public string id { get; set; } | |||
public int OrderStatus { get; set; } | |||
public string Loc { get; set; } | |||
public MorkOrderPush morkOrder { get; set; } | |||
public SimOrderData() | |||
{ | |||
id = Guid.NewGuid().ToString(); | |||
OrderStatus = 0; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,152 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkTLebaiJC | |||
{ | |||
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; | |||
// } | |||
//} | |||
} | |||
} |
@@ -6,4 +6,8 @@ | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -1,8 +0,0 @@ | |||
using System; | |||
namespace BPASmartClient.MorktJAKAJC | |||
{ | |||
public class Class1 | |||
{ | |||
} | |||
} |
@@ -0,0 +1,828 @@ | |||
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.Model.PLC; | |||
using BPASmartClient.Model.单片机; | |||
namespace BPASmartClient.MorktJAKAJC | |||
{ | |||
/* | |||
* 冰淇淋咖啡机组合套装 | |||
* 物料位置: | |||
* 1:冰淇料 | |||
* 2:冰淇淋杯 | |||
* 5:咖啡 | |||
* 6:咖啡杯 | |||
* 9: 茶 | |||
* 10: 茶杯 | |||
*/ | |||
public class Control_MORKJC : BaseDevice | |||
{ | |||
GVL_MORKJC mORKD = new GVL_MORKJC(); | |||
//咖啡机主控程序 | |||
//private CoffeeMachine coffeeMachine; | |||
////果汁机主控程序 | |||
//private JuicerMachine juicerMachine; | |||
////单片机主控程序 | |||
//private ICChipMachine icchipMachine; | |||
//物料存放位置 | |||
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | |||
//容器位置 | |||
private string holderLoc; | |||
//主料位置 | |||
private string mainMaterialLoc; | |||
//子订单ID | |||
private string subOrderId; | |||
private bool enableFunny = false; | |||
private DateTime lastRecvdOrder = DateTime.Now; | |||
private bool working = false; | |||
/// <summary> | |||
/// 果汁机做法,true:热饮,false:冷饮 | |||
/// </summary> | |||
private bool GuMake = false; | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); | |||
} | |||
//private SerialPortClient commProxy; | |||
public void ConnectOk() | |||
{ | |||
} | |||
ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>(); | |||
public void Init() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((s) => | |||
{ | |||
if (s is DrCoffeeDrinksCode cf) | |||
{ | |||
mainMaterialLoc = ((int)cf).ToString(); | |||
DoCoffee(); | |||
} | |||
}), "SimCoffee"); | |||
//构建所有商品物料信息 | |||
batchings = PolymerBatching.BuildAll(); | |||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, DRCoffee_CoffeEndCookEventHandle); | |||
System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); | |||
//一系列外围基础配置 | |||
var com_Coffee = config.AppSettings.Settings["COM_Coffee"].Value; | |||
var baud_Coffee = config.AppSettings.Settings["BAUD_Coffee"].Value; | |||
//咖啡机创建 | |||
//coffeeMachine = new CoffeeMachine(com_Coffee, (BaudRates)Enum.Parse(typeof(BaudRates), baud_Coffee)); | |||
Main(); | |||
ReadData(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
while (morkOrderPushes.Count > 0) | |||
{ | |||
while (enableFunny) { Thread.Sleep(10); } | |||
DeviceProcessLogShow("当前非自嗨模式,允许开工"); | |||
working = true; | |||
if (morkOrderPushes.TryDequeue(out MorkOrderPush order)) | |||
{ | |||
DeviceProcessLogShow($"开始制作订单[{order.SortNum}]"); | |||
//商品类型 | |||
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; | |||
//子订单ID | |||
subOrderId = order.SuborderId; | |||
//遍历物料 | |||
foreach (var item in order.GoodBatchings) | |||
{ | |||
var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
if (res != null) | |||
{ | |||
//获取主料和容器位置 | |||
switch (batchings[res.BatchingLoc].BatchingClass) | |||
{ | |||
case BATCHING_CLASS.HOLDER: | |||
holderLoc = res.BatchingLoc; | |||
break; | |||
case BATCHING_CLASS.MAIN_MATERIAL: | |||
// mainMaterialLoc ="1"; | |||
mainMaterialLoc = res.BatchingLoc; | |||
//验证商品是咖啡还是冰淇淋 | |||
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER) | |||
{ | |||
//获取当前物料所属商品类型 | |||
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); | |||
} | |||
break; | |||
} | |||
} | |||
} | |||
//根据商品类型执行具体制作流程 | |||
switch (currentGoodsType) | |||
{ | |||
case GOODS_TYPE.COFFEE: | |||
DoCoffee(); | |||
break; | |||
case GOODS_TYPE.JUICE: | |||
GuMake = order.MakeID == "2"; | |||
DoJuicer(); | |||
break; | |||
case GOODS_TYPE.TEA: | |||
DoTea(); | |||
break; | |||
case GOODS_TYPE.WATER: | |||
DoWater(); | |||
break; | |||
case GOODS_TYPE.NEITHER: | |||
DeviceProcessLogShow("未知的商品类型"); | |||
break; | |||
} | |||
} | |||
working = false; | |||
lastRecvdOrder = DateTime.Now; | |||
} | |||
Thread.Sleep(1000); | |||
}), "订单制作"); | |||
} | |||
public void Main() | |||
{ | |||
//咖啡机开启主线程 | |||
//coffeeMachine.Start(); | |||
//开始心跳刷新,根据咖啡机及冰淇淋机来判断 | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//IsHealth = | |||
// Write.IsConnected && | |||
// MorkCStatus.GetInstance().CanDo && | |||
// JuicerHelper.GetInstance.IsOpen && | |||
// MCUSerialHelper.GetInstance.IsOpen; | |||
//GeneralConfig.Healthy = true; | |||
Thread.Sleep(100); | |||
}), "MORK-IC心跳刷新"); | |||
//ThreadManage.GetInstance().Start(new Action(() => | |||
//{ | |||
// while (!Write.IsConnected) | |||
// { | |||
// Thread.Sleep(10); | |||
// } | |||
// //LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_欢迎); | |||
//}), "MORK-JC欢迎"); | |||
} | |||
public void DataParse<T>(T order) | |||
{ | |||
if (order is MorkOrderPush morkOrderPush) | |||
{ | |||
morkOrderPushes.Enqueue(morkOrderPush); | |||
} | |||
} | |||
/// <summary> | |||
/// 验证当前是做咖啡还是做冰淇淋 | |||
/// </summary> | |||
/// <param name="batchingLoc">物料位置</param> | |||
private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc) | |||
{ | |||
if (batchings.ContainsKey(batchingLoc)) | |||
return batchings[batchingLoc].GoodsType; | |||
return GOODS_TYPE.NEITHER; | |||
} | |||
private AutoResetEvent are = new AutoResetEvent(false); | |||
private T GetStatus<T>(string key) | |||
{ | |||
if (peripheralStatus.ContainsKey(key)) | |||
{ | |||
if (peripheralStatus[key] != null) | |||
{ | |||
return (T)(peripheralStatus[key]); | |||
} | |||
} | |||
return default; | |||
} | |||
private void Wait(int value) | |||
{ | |||
while (!((GetStatus<int>("Get_RobotAO1") == value) && GetStatus<int>("GetProgramStatus") == 0))//判断文件是否已经执行结束 且 文件末端变量值==文件名 | |||
{ | |||
Thread.Sleep(5); | |||
} | |||
} | |||
int[] devStatusBy = new int[2] { 0, 0 }; | |||
/// <summary> | |||
/// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确 | |||
/// </summary> | |||
int bSensorInput; | |||
/// <summary> | |||
/// 延迟的超时时间 | |||
/// </summary> | |||
DateTime delayTimeOut; | |||
/// <summary> | |||
/// 做咖啡 | |||
/// </summary> | |||
private void DoCoffee() | |||
{ | |||
#region 接咖啡流程 | |||
are.Reset(); | |||
// OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
DeviceProcessLogShow("咖啡杯取杯完成"); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡 }.Publish(); | |||
// Write("JaKaProgramName",JakaModel.SENCE_接咖啡); | |||
Wait(int.Parse(JakaModel.SENCE_接咖啡)); | |||
new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||
are.WaitOne(1000 * 180); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放咖啡杯 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放咖啡杯)); | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
//订单状态改变:完成 | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
} | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 做茶 | |||
/// </summary> | |||
private void DoTea() | |||
{ | |||
#region 接茶流程 | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
DeviceProcessLogShow("取茶杯完成"); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接茶 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接茶)); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 105 }.Publish(); | |||
Thread.Sleep(1000); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 130 }.Publish(); | |||
Thread.Sleep(1000); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 105 }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接茶_接水 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接茶_接水)); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "3" }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "4" }.Publish(); | |||
Thread.Sleep(500); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
Thread.Sleep(50000); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放茶水杯 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放茶水杯)); | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
} | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 接开水 | |||
/// </summary> | |||
private void DoWater() | |||
{ | |||
#region 接水流程 | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接水 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接水)); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "3" }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "4" }.Publish(); | |||
Thread.Sleep(500); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
Thread.Sleep(50000); | |||
//添加控制接水机构程序 | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放茶水杯 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放茶水杯)); | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
} | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 果汁机控制信号 | |||
/// </summary> | |||
private byte JuicerNum; | |||
/// <summary> | |||
/// 做果汁 | |||
/// </summary> | |||
private void DoJuicer() | |||
{ | |||
#region 接果汁流程 | |||
are.Reset(); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
int JuicerNum1 = int.Parse(mainMaterialLoc); | |||
switch (JuicerNum1) | |||
{ | |||
case 52: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x00; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x01; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁1)); | |||
break; | |||
case 53: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x02; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x03; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁2 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁2)); | |||
break; | |||
case 54: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x04; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x05; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁3 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁3)); | |||
break; | |||
case 55: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x06; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x07; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁4 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁4)); | |||
break; | |||
default: | |||
JuicerNum = 0x00; | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁1)); | |||
break; | |||
} | |||
var devStatus = GetStatus<int[]>("GetDeviceStatus"); | |||
var devStatus1 = Convert.ToString(devStatus[0], 2); | |||
var devStatus2 = devStatus[1]; | |||
if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0) | |||
{ | |||
if (sensor_Sign(1) == 1) | |||
{ | |||
new WriteJuicer() { Value = JuicerNum }.Publish(); | |||
} | |||
Thread.Sleep(100); | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
while (!(devStatusBy[1] == 0)) | |||
{ | |||
Thread.Sleep(100); | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
while (devStatusBy.Length != 2) | |||
{ | |||
Thread.Sleep(100); | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
} | |||
} | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
Thread.Sleep(5000); | |||
switch (JuicerNum1) | |||
{ | |||
case 52: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
break; | |||
case 53: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯2 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯2)); | |||
break; | |||
case 54: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯3 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯3)); | |||
break; | |||
case 55: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯4 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯4)); | |||
break; | |||
default: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
break; | |||
} | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
} | |||
else | |||
{ | |||
switch (JuicerNum1) | |||
{ | |||
case 52: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
break; | |||
case 53: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯2 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯2)); | |||
break; | |||
case 54: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯3 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯3)); | |||
break; | |||
case 55: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯4 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯4)); | |||
break; | |||
default: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
break; | |||
} | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
} | |||
} | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
#endregion | |||
} | |||
private int getCup_cnt; | |||
/// <summary> | |||
/// 取杯流程 | |||
/// </summary> | |||
/// <returns>0:无意义,1:取杯成功 2:机构有杯子,取杯失败 3:机构没有杯子</returns> | |||
private int takeCup() | |||
{ | |||
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); | |||
/*delayTimeOut = DateTime.Now; | |||
bSensorInput = sensor_Sign(1); | |||
while (bSensorInput == 3) | |||
{ | |||
Thread.Sleep(100); | |||
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) | |||
{ | |||
DeviceProcessLogShow(ex.ToString()); | |||
return 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 放杯 | |||
/// </summary> | |||
/// <returns>0:无意义 1:执行成功 2:执行失败(传感器还有信号)</returns> | |||
private int putCup() | |||
{ | |||
try | |||
{ | |||
while (checkCup() == 2) | |||
{ | |||
Thread.Sleep(100); | |||
} | |||
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(); | |||
Thread.Sleep(10); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯检测 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放杯检测)); | |||
bSensorInput = sensor_Sign(2); | |||
delayTimeOut = DateTime.Now; | |||
while (bSensorInput == 2) | |||
{ | |||
Thread.Sleep(100); | |||
bSensorInput = sensor_Sign(2); | |||
if (DateTime.Now.Subtract(delayTimeOut).TotalSeconds >= 2) return 2; | |||
} | |||
if (bSensorInput == 2) | |||
{ | |||
DeviceProcessLogShow("放杯失败传感器没有信号"); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
return 1; | |||
} | |||
return 1; | |||
} | |||
catch (Exception ex) | |||
{ | |||
DeviceProcessLogShow(ex.ToString()); | |||
return 0; | |||
} | |||
} | |||
private int cnt_Check; | |||
public override DeviceClientType DeviceType => throw new NotImplementedException(); | |||
/// <summary> | |||
/// 检测放杯位,是否有杯子 | |||
/// </summary> | |||
/// <returns>0:无意义 1:没有杯子 2:有杯子 </returns> | |||
private int checkCup() | |||
{ | |||
try | |||
{ | |||
//cnt_Check = 0; | |||
bSensorInput = sensor_Sign(2); | |||
if (bSensorInput == 2) | |||
{ | |||
DeviceProcessLogShow($"放杯位传感器没有信号:{cnt_Check}"); | |||
return 1; | |||
} | |||
else if (bSensorInput == 1) | |||
{ | |||
DeviceProcessLogShow($"放杯位传感器有信号:{cnt_Check}"); | |||
return 2; | |||
} | |||
return 2; | |||
} | |||
catch (Exception ex) | |||
{ | |||
DeviceProcessLogShow(ex.ToString()); | |||
return 0; | |||
} | |||
} | |||
private T McuRead<T>(string tagName, object par) | |||
{ | |||
new ReadMcu() { DeviceId = DeviceId, TagName = tagName, ReadPar = par }; | |||
if (peripheralStatus.ContainsKey(tagName)) | |||
{ | |||
if (peripheralStatus[tagName] != null) | |||
{ | |||
return (T)peripheralStatus[tagName]; | |||
} | |||
} | |||
return default; | |||
} | |||
/// <summary> | |||
/// 传感器防抖0.2s内检测20次, | |||
/// </summary> | |||
/// <param name="num"></param> | |||
/// <returns></returns> | |||
private int sensor_Sign(byte num) | |||
{ | |||
DeviceProcessLogShow($"开始检测{num}号传感器信号"); | |||
int cnt = 0; | |||
cnt_Check = 0; | |||
while (true) | |||
{ | |||
Thread.Sleep(10); | |||
bSensorInput = McuRead<int>("GetInputStatus", num); | |||
if (bSensorInput == 1) | |||
{ | |||
cnt_Check = cnt_Check + 1; | |||
cnt = cnt + 1; | |||
} | |||
else if (bSensorInput == 2) | |||
{ | |||
cnt_Check = cnt_Check - 1; | |||
cnt = cnt + 1; | |||
} | |||
if (cnt >= 20) | |||
{ | |||
break; | |||
} | |||
} | |||
if (cnt_Check >= 0) | |||
{ | |||
DeviceProcessLogShow($"{num}传感器有信号:{cnt_Check}"); | |||
return 1; | |||
} | |||
else | |||
{ | |||
DeviceProcessLogShow($"{num}传感器没有信号:{cnt_Check}"); | |||
return 2; | |||
} | |||
} | |||
private void DRCoffee_CoffeEndCookEventHandle(IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
are.Set(); | |||
} | |||
public void SimOrder<T>(T simOrder) | |||
{ | |||
} | |||
public override void DoMain() | |||
{ | |||
} | |||
public override void Stop() | |||
{ | |||
} | |||
public override void ReadData() | |||
{ | |||
} | |||
public override void MainTask() | |||
{ | |||
} | |||
public override void ResetProgram() | |||
{ | |||
} | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
using BPASmartClient.Device; | |||
namespace BPASmartClient.MorktJAKAJC | |||
{ | |||
public class GVL_MORKJC : IStatus | |||
{ | |||
} | |||
} |
@@ -0,0 +1,152 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorktJAKAJC | |||
{ | |||
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 }, | |||
{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}, | |||
{"61",GOODS_TYPE.WATER}, | |||
//{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; | |||
// } | |||
//} | |||
} | |||
} |
@@ -47,12 +47,22 @@ namespace BPASmartClient.Peripheral | |||
return null; | |||
} | |||
public void SetStatus(string statusName, object value) | |||
{ | |||
if (status.ContainsKey(statusName)) | |||
status[statusName] = value; | |||
else | |||
status.TryAdd(statusName, value); | |||
} | |||
public abstract void Start(); | |||
public abstract void Stop(); | |||
public abstract void Init(); | |||
//public abstract void ReadData(string address); | |||
public abstract void WriteData(string address, object value); | |||
public ConcurrentDictionary<string, object> GetAllStatus() | |||
@@ -55,6 +55,8 @@ namespace BPASmartClient.Peripheral | |||
void WriteData(string address, object value); | |||
//void ReadData(string address); | |||
/// <summary> | |||
/// 初始化 | |||
/// </summary> | |||
@@ -39,5 +39,6 @@ namespace BPASmartClient.SCChip | |||
/// 检测物品距离 | |||
/// </summary> | |||
ARTICLE_DIST = 0x06 | |||
} | |||
} |
@@ -0,0 +1,113 @@ | |||
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 JuicerHelper | |||
{ | |||
//private volatile static JuicerHelper _Instance; | |||
//public static JuicerHelper GetInstance => _Instance ?? (_Instance = new JuicerHelper()); | |||
//private JuicerHelper() { } | |||
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; | |||
} | |||
/// <summary> | |||
/// 开始制作 | |||
/// </summary> | |||
/// <param name="aisle"></param> | |||
/// <returns></returns> | |||
public bool StartCook(byte aisle) | |||
{ | |||
byte sum = (byte)(0x21 + aisle); | |||
byte checksum = (byte)~sum; | |||
checksum++; | |||
byte[] buffers = new byte[6] { 0x7E, 0x03, 0x00, 0x21, aisle, checksum }; | |||
if (comPort.IsOpen) | |||
{ | |||
comPort.Write(buffers, 0, buffers.Length); | |||
while (comPort.BytesToRead < 6) | |||
{ | |||
Thread.Sleep(1); | |||
} | |||
byte[] receive = new byte[comPort.BytesToRead]; | |||
comPort.Read(receive, 0, receive.Length); | |||
if (receive.Length == 6) | |||
return receive[4] == 1; | |||
} | |||
return false; | |||
} | |||
/// <summary> | |||
/// 获取果汁机状态 | |||
/// </summary> | |||
/// <param name="index"></param> | |||
/// <returns></returns> | |||
public int[] GetDeviceStatus() | |||
{ | |||
List<int> res = new List<int>(); | |||
byte[] buffers = new byte[5] { 0x7E, 0x02, 0x00, 0x13, 0xED }; | |||
if (comPort.IsOpen) | |||
{ | |||
comPort.Write(buffers, 0, buffers.Length); | |||
DateTime newDate = DateTime.Now; | |||
while (comPort.BytesToRead < 33) | |||
{ | |||
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 == 33) | |||
{ | |||
res.Add(receive.Skip(24).Take(4).ToArray().BytesToInt()); | |||
res.Add(receive.Skip(28).Take(4).ToArray().BytesToInt()); | |||
} | |||
return res.ToArray(); | |||
} | |||
return default; | |||
} | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.IO; | |||
using System.IO.Ports; | |||
using System.Threading; | |||
using System.Collections.Concurrent; | |||
using BPASmartClient.Message; | |||
namespace BPASmartClient.SerialPort | |||
{ | |||
public class MCUSerialHelper | |||
{ | |||
//private volatile static MCUSerialHelper _Instance; | |||
//public static MCUSerialHelper GetInstance => _Instance ?? (_Instance = new MCUSerialHelper()); | |||
//private MCUSerialHelper() { } | |||
private System.IO.Ports.SerialPort comPort = new System.IO.Ports.SerialPort(); | |||
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.RtsEnable = true; //设置为 true后会读取不到数据 | |||
//comPort.DtrEnable = true;//获取或设置一个值,该值在串行通信过程中启用数据终端就绪 (DTR) 信号。 | |||
//comPort.RtsEnable = true;//获取或设置一个值,该值指示在串行通信中是否启用请求发送 (RTS) 信号 | |||
try | |||
{ | |||
comPort.Open(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
Thread.Sleep(5000); | |||
} | |||
} | |||
MessageLog.GetInstance.Show($"{portName} 串口打开成功"); | |||
return comPort.IsOpen; | |||
} | |||
private static readonly object OutPutLock = new object(); | |||
/// <summary> | |||
/// 单片机输出端口控制 | |||
/// </summary> | |||
/// <param name="index">通道号 1 - 8 </param> | |||
/// <param name="value">控制值</param> | |||
public void OutputControl(byte index, bool value) | |||
{ | |||
lock (OutPutLock) | |||
{ | |||
byte NumValue = (byte)(value ? 0x01 : 0x00); | |||
byte[] buffers = new byte[6] { 0xCC, 0x01, 0x01, index, NumValue, 0xDD }; | |||
if (IsOpen) comPort.Write(buffers, 0, buffers.Length); | |||
} | |||
} | |||
/// <summary> | |||
/// 舵机控制 | |||
/// </summary> | |||
/// <param name="index">通道号 1 - 8</param> | |||
/// <param name="value">舵机位置 0 - 180</param> | |||
public void ServoControl(byte index, byte value) | |||
{ | |||
byte[] buffers = new byte[6] { 0xCC, 0x01, 0x02, index, value, 0xDD }; | |||
if (IsOpen) comPort.Write(buffers, 0, buffers.Length); | |||
} | |||
/// <summary> | |||
/// 获取单片机输入端口状态 | |||
/// </summary> | |||
/// <param name="index"></param> | |||
/// <returns>0:无意义 1:有信号 2:无信号 3:信号不正确</returns> | |||
public int GetInputStatus(byte index) | |||
{ | |||
if (index <= 0 || index > 8) return 0; | |||
byte[] buffers = new byte[6] { 0xCC, 0x01, 0x03, index, 0x00, 0xDD }; | |||
if (IsOpen) | |||
{ | |||
comPort.Write(buffers, 0, buffers.Length); | |||
DateTime dt = DateTime.Now; | |||
List<byte> receive = new List<byte>(); | |||
while (true) | |||
{ | |||
byte[] re = new byte[comPort.BytesToRead]; | |||
comPort.Read(re, 0, re.Length); | |||
if (re.Contains<byte>(0xcc) && re.Contains<byte>(0xDD)) receive.AddRange(re); | |||
comPort.DiscardInBuffer(); | |||
if (receive.Contains(0xcc) && receive.Contains(0xdd)) break; | |||
if (DateTime.Now.Subtract(dt).TotalSeconds >= 2) break; | |||
Thread.Sleep(1); | |||
} | |||
if (receive != null) | |||
{ | |||
int Reindex = Array.FindIndex(receive.ToArray(), p => p == 0xcc); | |||
if (Reindex < receive.Count && Reindex >= 0) | |||
{ | |||
var res = receive.GetRange(Array.FindIndex(receive.ToArray(), p => p == 0xcc), 6); | |||
if (res.ElementAt(2) == 0x03) | |||
{ | |||
if (res != null && res.Count() == 6 && res.ElementAt(4) == 0x01) | |||
{ | |||
return 1; | |||
} | |||
else if (res != null && res.Count() == 6 && res.ElementAt(4) == 0x00) | |||
{ | |||
return 2; | |||
} | |||
} | |||
else | |||
{ | |||
return 3; | |||
} | |||
} | |||
else | |||
{ | |||
return 0; | |||
} | |||
} | |||
} | |||
return 0; | |||
} | |||
} | |||
} |
@@ -78,11 +78,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkF", "BPA | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.LebaiRobot", "BPASmartClient.LebaiRobot\BPASmartClient.LebaiRobot.csproj", "{D40C3CC7-C07C-4882-93D3-7F9ABCD3B5F0}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkM", "BPASmartClient.MorkM\BPASmartClient.MorkM.csproj", "{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkM", "BPASmartClient.MorkM\BPASmartClient.MorkM.csproj", "{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkTLebaiJC", "BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj", "{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTLebaiJC", "BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj", "{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkTJAKAJC", "BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj", "{6B0FD858-A60D-41B9-A923-358B0CE2A254}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTJAKAJC", "BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj", "{6B0FD858-A60D-41B9-A923-358B0CE2A254}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MCU", "BPASmartClient.MCU\BPASmartClient.MCU.csproj", "{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.JakaRobot", "BPASmartClient.JakaRobot\BPASmartClient.JakaRobot.csproj", "{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.JAKA", "BPASmartClient.JAKA\BPASmartClient.JAKA.csproj", "{C935435D-6182-4A01-8E59-B832B2FF0D72}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Juicer", "BPASmartClient.Juicer\BPASmartClient.Juicer.csproj", "{C28A88B1-E449-484C-AC67-B5038FF2CA79}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
@@ -738,6 +746,86 @@ Global | |||
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|x64.Build.0 = Release|Any CPU | |||
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|x86.ActiveCfg = Release|Any CPU | |||
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|x86.Build.0 = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|x64.Build.0 = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Debug|x86.Build.0 = Debug|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|ARM.Build.0 = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|ARM64.Build.0 = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|x64.ActiveCfg = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|x64.Build.0 = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|x86.ActiveCfg = Release|Any CPU | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB}.Release|x86.Build.0 = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|x64.Build.0 = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Debug|x86.Build.0 = Debug|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|ARM.Build.0 = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|ARM64.Build.0 = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|x64.ActiveCfg = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|x64.Build.0 = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|x86.ActiveCfg = Release|Any CPU | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9}.Release|x86.Build.0 = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|x64.Build.0 = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Debug|x86.Build.0 = Debug|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|ARM.Build.0 = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|ARM64.Build.0 = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|x64.ActiveCfg = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|x64.Build.0 = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|x86.ActiveCfg = Release|Any CPU | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72}.Release|x86.Build.0 = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|x64.Build.0 = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Debug|x86.Build.0 = Debug|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|ARM.Build.0 = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|ARM64.Build.0 = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|x64.ActiveCfg = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|x64.Build.0 = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|x86.ActiveCfg = Release|Any CPU | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -775,6 +863,10 @@ Global | |||
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{6B0FD858-A60D-41B9-A923-358B0CE2A254} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{1C7E17B3-40E0-44ED-B8E0-C52D824604DB} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD} | |||
{1055EA6E-6C10-4A0D-A053-85871AF8D7A9} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} | |||
{C935435D-6182-4A01-8E59-B832B2FF0D72} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD} | |||
{C28A88B1-E449-484C-AC67-B5038FF2CA79} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | |||