@@ -1,5 +1,7 @@ | |||
using BPA.Message.Enum; | |||
using BPA.Message; | |||
using BPA.Message.Enum; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Peripheral; | |||
using System; | |||
using System.Collections.Concurrent; | |||
@@ -21,26 +23,41 @@ namespace BPASmartClient.Device | |||
{ | |||
} | |||
/// <summary> | |||
/// 订单物料信息 | |||
/// </summary> | |||
protected OrderMaterialDelivery orderMaterialDelivery { get; set; } = new OrderMaterialDelivery(); | |||
/// <summary> | |||
/// 配方数据信息 | |||
/// </summary> | |||
protected RecipeBoms recipeBoms { get; set; } = new RecipeBoms(); | |||
/// <summary> | |||
/// 设备ID | |||
/// </summary> | |||
public int DeviceId { get; set; } | |||
/// <summary> | |||
/// 设备所有状态 | |||
/// </summary> | |||
public DeviceStatus Status { get; set; } = new DeviceStatus(); | |||
/// <summary> | |||
/// 设备名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 设备类型 | |||
/// </summary> | |||
public abstract DeviceClientType DeviceType { get; } | |||
/// <summary> | |||
/// 是否忙碌 | |||
/// </summary> | |||
public bool IsBusy { get; protected set; } | |||
/// <summary> | |||
/// 是否健康 | |||
/// </summary> | |||
@@ -49,17 +66,32 @@ namespace BPASmartClient.Device | |||
/// <summary> | |||
/// 设备流程日志 | |||
/// </summary> | |||
public ConcurrentQueue<string> Log { get; set; } = new ConcurrentQueue<string>(); | |||
public List<string> DeviceProcessLog { get; set; } = new List<string>(); | |||
/// <summary> | |||
/// 错误报警集合 | |||
/// </summary> | |||
protected ConcurrentDictionary<string, object> Error = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> Error = new ConcurrentDictionary<string, object>(); | |||
public List<VariableMonitor> variableMonitors { get; set; } = new List<VariableMonitor>(); | |||
//外设状态,硬件设备数据 | |||
/// <summary> | |||
/// 外设状态,硬件设备数据 | |||
/// </summary> | |||
protected ConcurrentDictionary<string, object> peripheralStatus = new ConcurrentDictionary<string, object>(); | |||
private List<IPeripheral> peripherals; | |||
/// <summary> | |||
/// 设备过程日志显示 | |||
/// </summary> | |||
/// <param name="info"></param> | |||
public void DeviceProcessLogShow(string info) | |||
{ | |||
DeviceProcessLog.Add(info); | |||
MessageLog.GetInstance.DeviceProcessLogShow(DeviceId.ToString(), info); | |||
} | |||
public void Initliaze() | |||
{ | |||
} | |||
@@ -91,8 +123,182 @@ namespace BPASmartClient.Device | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "GetAllStatus"); | |||
}), $"GetAllStatus:{DeviceId}"); | |||
DoMain(); | |||
GetGvlStatus(); | |||
} | |||
private void GetGvlStatus() | |||
{ | |||
this.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).ToList().ForEach(item => | |||
{ | |||
var res = item.FieldType.GetInterfaces(); | |||
if (res != null) | |||
{ | |||
foreach (var faces in res) | |||
{ | |||
if (faces.Name == "IStatus") | |||
{ | |||
IStatus status = item.GetValue(this) as IStatus; | |||
GetMonitorData(status); | |||
ThreadManage.GetInstance().StopTask($"{item.Name}:{DeviceId}", new Action(() => | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
UpdateValue(status); | |||
Thread.Sleep(1000); | |||
}), $"{item.Name}:{DeviceId}"); | |||
})); | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
/// <summary> | |||
/// 获取流程信息 | |||
/// </summary> | |||
private void GetMonitorData(IStatus status) | |||
{ | |||
if (status == null) return; | |||
foreach (var item in status.GetType().GetProperties()) | |||
{ | |||
if (item.CustomAttributes.Count() > 0) | |||
{ | |||
var attributeName = item.CustomAttributes.FirstOrDefault(p => p.AttributeType.Name == "VariableMonitorAttribute"); | |||
if (attributeName == null) return; | |||
var plcadd = item.GetCustomAttribute<VariableMonitorAttribute>()?.PLCAddress; | |||
var modadd = item.GetCustomAttribute<VariableMonitorAttribute>()?.ModbusTcpAddress; | |||
var notes = item.GetCustomAttribute<VariableMonitorAttribute>()?.Notes; | |||
if (item.PropertyType?.BaseType?.Name == "Array") | |||
{ | |||
if (plcadd?.Length > 0) | |||
{ | |||
var arrayRes = item.GetValue(status, null); | |||
if (arrayRes != null && arrayRes is Array arr) | |||
{ | |||
for (int i = 0; i < arr.Length; i++) | |||
{ | |||
var res = variableMonitors.FirstOrDefault(p => p.VarName == $"{item.Name}_{i + 1}"); | |||
if (res == null) | |||
{ | |||
string[] plc = plcadd?.Substring(1).Split('.'); | |||
string TempPlcAddress = string.Empty; | |||
if (plc?.Length == 2) | |||
{ | |||
int add = int.Parse(plc[1]); | |||
int firstAdd = int.Parse(plc[0]); | |||
if (add >= 0 && add < 7) | |||
{ | |||
add += i; | |||
} | |||
else if (add >= 7) | |||
{ | |||
add = 0; | |||
firstAdd++; | |||
} | |||
plc[0] = firstAdd.ToString(); | |||
plc[1] = add.ToString(); | |||
TempPlcAddress = $"M{plc[0]}.{plc[1]}"; | |||
} | |||
variableMonitors.Add(new VariableMonitor() | |||
{ | |||
Id = variableMonitors.Count, | |||
VarName = $"{item.Name}_{i + 1}", | |||
Notes = $"{notes}_{i + 1}", | |||
ModbusTcpAddress = $"{int.Parse(modadd) + i}", | |||
PLCAddress = TempPlcAddress, | |||
}); | |||
} | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
var arrayRes = item.GetValue(status, null); | |||
if (arrayRes != null && arrayRes is Array arr) | |||
{ | |||
for (int i = 0; i < arr.Length; i++) | |||
{ | |||
var res = variableMonitors.FirstOrDefault(p => p.VarName == $"{item.Name}_{i + 1}"); | |||
if (res == null) | |||
{ | |||
variableMonitors.Add(new VariableMonitor() | |||
{ | |||
Id = variableMonitors.Count, | |||
VarName = $"{item.Name}_{i + 1}", | |||
Notes = $"{notes}_{i + 1}", | |||
}); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
var res = variableMonitors.FirstOrDefault(p => p.VarName == item.Name); | |||
if (res == null) | |||
{ | |||
variableMonitors.Add(new VariableMonitor() | |||
{ | |||
Id = variableMonitors.Count, | |||
VarName = item.Name, | |||
Notes = notes, | |||
ModbusTcpAddress = modadd, | |||
PLCAddress = plcadd, | |||
}); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
public void UpdateValue(IStatus status) | |||
{ | |||
if (status == null) return; | |||
foreach (var item in status.GetType().GetProperties()) | |||
{ | |||
if (item.CustomAttributes.Count() > 0) | |||
{ | |||
if (item.PropertyType?.BaseType?.Name == "Array") | |||
{ | |||
var arrayRes = item.GetValue(status); | |||
if (arrayRes != null && arrayRes is Array arr) | |||
{ | |||
for (int i = 0; i < arr.Length; i++) | |||
{ | |||
int index = Array.FindIndex(variableMonitors.ToArray(), p => p.VarName == $"{item.Name}_{i + 1}"); | |||
if (index >= 0 && index < variableMonitors.Count) | |||
{ | |||
//App.Current.Dispatcher.Invoke(new Action(() => | |||
//{ | |||
variableMonitors.ElementAt(index).CurrentValue = arr.GetValue(i)?.ToString(); | |||
//})); | |||
} | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
int index = Array.FindIndex(variableMonitors.ToArray(), p => p.VarName == item.Name); | |||
if (index >= 0 && index < variableMonitors.Count) | |||
{ | |||
//App.Current.Dispatcher.Invoke(new Action(() => | |||
//{ | |||
variableMonitors.ElementAt(index).CurrentValue = item.GetValue(status)?.ToString(); | |||
//})); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
public abstract void DoMain(); | |||
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Device | |||
{ | |||
public interface IAlarm | |||
{ | |||
} | |||
} |
@@ -29,6 +29,11 @@ namespace BPASmartClient.Device | |||
/// 设备所有状态 | |||
/// </summary> | |||
DeviceStatus Status { get; set; } | |||
/// <summary> | |||
/// 设备变量信息 | |||
/// </summary> | |||
List<VariableMonitor> variableMonitors { get; set; } | |||
/// <summary> | |||
/// 是否忙碌 | |||
/// </summary> | |||
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Device | |||
{ | |||
public interface IStatus | |||
{ | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Device | |||
{ | |||
public class VariableMonitor | |||
{ | |||
public int Id { get { return _mId; } set { _mId = value; } } | |||
private int _mId; | |||
public string VarName { get { return _mVarName; } set { _mVarName = value; } } | |||
private string _mVarName; | |||
public string PLCAddress { get { return _mPLCAddress; } set { _mPLCAddress = value; } } | |||
private string _mPLCAddress; | |||
public string Notes { get { return _mNotes; } set { _mNotes = value; } } | |||
private string _mNotes; | |||
public string ModbusTcpAddress { get { return _mModbusTcpAddress; } set { _mModbusTcpAddress = value; } } | |||
private string _mModbusTcpAddress; | |||
public string CurrentValue { get { return _mCurrentValue; } set { _mCurrentValue = value; } } | |||
private string _mCurrentValue; | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Device | |||
{ | |||
public class VariableMonitorAttribute : Attribute | |||
{ | |||
/// <summary> | |||
/// 变量描述 | |||
/// </summary> | |||
/// <param name="Notes">描述</param> | |||
/// <param name="PLCAddress">PLC 地址</param> | |||
/// <param name="ModbusTcpAddress">Modbus TCP 地址</param> | |||
public VariableMonitorAttribute(string Notes, string PLCAddress = "", string ModbusTcpAddress = "") | |||
{ | |||
this.PLCAddress = PLCAddress; | |||
this.ModbusTcpAddress = ModbusTcpAddress; | |||
this.Notes = Notes; | |||
} | |||
/// <summary> | |||
/// PLC 地址 | |||
/// </summary> | |||
public string PLCAddress { get; set; } | |||
/// <summary> | |||
/// Modbus TCP 地址 | |||
/// </summary> | |||
public string ModbusTcpAddress { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Notes { get; set; } | |||
} | |||
} |
@@ -30,8 +30,14 @@ namespace BPASmartClient.Helper | |||
public void StopTask(string key, Action ExitCallback = null) | |||
{ | |||
if (CancellationTokenSources.ContainsKey(guid + key)) | |||
{ | |||
CancellationTokenSources[guid + key]?.Cancel(); | |||
ActionManage.GetInstance.Register(ExitCallback, guid + key); | |||
ActionManage.GetInstance.Register(ExitCallback, guid + key); | |||
} | |||
else | |||
{ | |||
if (ExitCallback != null) ExitCallback(); | |||
} | |||
} | |||
/// <summary> | |||
@@ -139,16 +139,17 @@ namespace BPASmartClient.IoT | |||
List<object> dataVNode = new List<object>(); | |||
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device => | |||
{ | |||
var obj =new | |||
var obj = new | |||
{ | |||
DeviceId=device.DeviceId, | |||
Name=device.Name, | |||
DeviceType=device.DeviceType.ToString(), | |||
IsBusy= device.IsBusy?"忙碌":"空闲", | |||
IsBusyColor = device.IsBusy ? new ALYColor {r=255,g=0,b=0,a=1} : new ALYColor {r = 51, g = 232, b = 34, a = 1 }, | |||
IsHealth = device.IsHealth?"健康":"故障", | |||
DeviceId = device.DeviceId, | |||
Name = device.Name, | |||
DeviceType = device.DeviceType.ToString(), | |||
IsBusy = device.IsBusy ? "忙碌" : "空闲", | |||
IsBusyColor = device.IsBusy ? new ALYColor { r = 255, g = 0, b = 0, a = 1 } : new ALYColor { r = 51, g = 232, b = 34, a = 1 }, | |||
IsHealth = device.IsHealth ? "健康" : "故障", | |||
IsHealthColor = !device.IsHealth ? new ALYColor { r = 255, g = 0, b = 0, a = 1 } : new ALYColor { r = 51, g = 232, b = 34, a = 1 }, | |||
Status = device.Status.GetStatus(), | |||
Status = device.Status.GetStatus(), | |||
VariableMonitor = device.variableMonitors, | |||
}; | |||
dataVNode.Add(obj); | |||
}); | |||
@@ -6,6 +6,7 @@ using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.Concurrent; | |||
namespace BPASmartClient.Message | |||
{ | |||
@@ -61,6 +62,33 @@ namespace BPASmartClient.Message | |||
} | |||
#endregion | |||
#region 设备过程日志 | |||
/// <summary> | |||
/// 设备过程日志委托 | |||
/// </summary> | |||
public Action<string> DeviceProcessLogNotify { get; set; } | |||
/// <summary> | |||
/// 设备日志信息字典 | |||
/// </summary> | |||
public ConcurrentDictionary<string, string> DPLogInfo = new ConcurrentDictionary<string, string>(); | |||
/// <summary> | |||
/// 设备日志输出 | |||
/// </summary> | |||
/// <param name="info"></param> | |||
public void DeviceProcessLogShow(string id, string info) | |||
{ | |||
if (!DPLogInfo.ContainsKey(id)) | |||
{ | |||
DPLogInfo.TryAdd(id, info); | |||
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}"); | |||
//ExLogInfo = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {ExLogInfo}"; | |||
if (DeviceProcessLogNotify != null) DeviceProcessLogNotify(info); | |||
} | |||
} | |||
#endregion | |||
#region 查找设备ID | |||
/// <summary> | |||
/// 查询设备ID | |||
@@ -87,9 +115,9 @@ namespace BPASmartClient.Message | |||
{ | |||
} | |||
} | |||
return DeviceId; | |||
} | |||
#endregion | |||
@@ -21,19 +21,36 @@ namespace BPASmartClient.MorkS | |||
{ | |||
public override DeviceClientType DeviceType => DeviceClientType.MORKS; | |||
GVL_MORKS mORKS = new GVL_MORKS(); | |||
/// <summary> | |||
/// 订单物料信息 | |||
/// </summary> | |||
private OrderMaterialDelivery orderMaterialDelivery { get; set; } = new OrderMaterialDelivery(); | |||
/// <summary> | |||
/// 配方数据信息 | |||
/// </summary> | |||
private RecipeBoms recipeBoms { get; set; } = new RecipeBoms(); | |||
int OrderCount; | |||
bool Initing; | |||
//private void GetGvlStatus() | |||
//{ | |||
// this.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).ToList().ForEach(item => | |||
// { | |||
// var res = item.FieldType.GetInterfaces(); | |||
// if (res != null) | |||
// { | |||
// foreach (var faces in res) | |||
// { | |||
// if (faces.Name == "IStatus") | |||
// { | |||
// } | |||
// } | |||
// } | |||
// }); | |||
//} | |||
private void GetAlarm() | |||
{ | |||
} | |||
public override void DoMain() | |||
{ | |||
//GetGvlStatus(); | |||
ServerInit(); | |||
DataParse(); | |||
ReadPLCData(); | |||
@@ -190,7 +207,7 @@ namespace BPASmartClient.MorkS | |||
{ | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
OrderCount++; | |||
MessageLog.GetInstance.Show($"接收到{OrderCount}次订单"); | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||
foreach (var item in order.MorkOrder.GoodBatchings) | |||
{ | |||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
@@ -263,7 +280,7 @@ namespace BPASmartClient.MorkS | |||
TakeBowlControl(orderLocInfo.Loc); | |||
SetRecipeNumber(orderLocInfo.RecipeNumber); | |||
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING); | |||
MessageLog.GetInstance.Show($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); | |||
DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); | |||
} | |||
mORKS.TakeBowlInterlock = true; | |||
} | |||
@@ -284,7 +301,7 @@ namespace BPASmartClient.MorkS | |||
// TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc); | |||
// mORKS.TurntableLocLists.Clear(); | |||
// mORKS.AllowTakeNoodle = true; | |||
// MessageLog.GetInstance.Show($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面"); | |||
// DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面"); | |||
// } | |||
// } | |||
//} | |||
@@ -302,7 +319,7 @@ namespace BPASmartClient.MorkS | |||
TurntableStart(mORKS.TurntableFeedbackloc); | |||
mORKS.TurntableLocLists.Clear(); | |||
mORKS.AllowTakeNoodle = true; | |||
MessageLog.GetInstance.Show($"控制机器人去转台【{mORKS.TurntableFeedbackloc}】号位置取面"); | |||
DeviceProcessLogShow($"控制机器人去转台【{mORKS.TurntableFeedbackloc}】号位置取面"); | |||
} | |||
else | |||
{ | |||
@@ -315,7 +332,7 @@ namespace BPASmartClient.MorkS | |||
if (mORKS.TurntableFeedbackloc != loc && !mORKS.TurntableLocLists.Contains(loc)) | |||
{ | |||
TurntableStart(loc); | |||
MessageLog.GetInstance.Show($"没有物料检测的启动转台控制,转台位置:[{loc}]"); | |||
DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]"); | |||
break; | |||
} | |||
else if (mORKS.TurntableFeedbackloc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc); | |||
@@ -324,7 +341,7 @@ namespace BPASmartClient.MorkS | |||
} | |||
} | |||
} | |||
else MessageLog.GetInstance.Show("未找到可用的物料信息"); | |||
else DeviceProcessLogShow("未找到可用的物料信息"); | |||
} | |||
} | |||
@@ -333,7 +350,7 @@ namespace BPASmartClient.MorkS | |||
{ | |||
mORKS.CurrentLoc = 0; | |||
mORKS.TurntableInterlock = false; | |||
MessageLog.GetInstance.Show("转台到位检测"); | |||
DeviceProcessLogShow("转台到位检测"); | |||
} | |||
//补料完成检测 | |||
@@ -343,7 +360,7 @@ namespace BPASmartClient.MorkS | |||
{ | |||
mORKS.TurntableLocLists.Clear(); | |||
mORKS.TurntableInterlock = false; | |||
MessageLog.GetInstance.Show("补料完成检测"); | |||
DeviceProcessLogShow("补料完成检测"); | |||
} | |||
} | |||
@@ -367,7 +384,7 @@ namespace BPASmartClient.MorkS | |||
//机器人开始取面 | |||
RobotTakeNoodle(); | |||
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); | |||
MessageLog.GetInstance.Show($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏"); | |||
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏"); | |||
//写入煮面时间 | |||
//List<ushort> values = new List<ushort>(); | |||
//values.Add(Json<KeepDataBase>.Data.parSets.ElementAt(loc).Minute); | |||
@@ -400,7 +417,7 @@ namespace BPASmartClient.MorkS | |||
mORKS.OutMealId = mORKS.IngredientsCompleteId; | |||
mORKS.IngredientsCompleteId = string.Empty; | |||
mORKS.CookNodelId[loc] = string.Empty; | |||
MessageLog.GetInstance.Show($"{loc + 1}号位置出餐控制"); | |||
DeviceProcessLogShow($"{loc + 1}号位置出餐控制"); | |||
mORKS.OutNoodleing = true; | |||
} | |||
} | |||
@@ -417,7 +434,7 @@ namespace BPASmartClient.MorkS | |||
{ | |||
mORKS.IngredientsCompleteId = mORKS.TakeBowlId; | |||
mORKS.TakeBowlId = string.Empty; | |||
MessageLog.GetInstance.Show($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); | |||
DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); | |||
mORKS.TakeBowlInterlock = false; | |||
} | |||
@@ -425,7 +442,7 @@ namespace BPASmartClient.MorkS | |||
if (RTrig.GetInstance("CompleteChange").Start(mORKS.RbOutMealComplete)) | |||
{ | |||
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK); | |||
MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】制作完成"); | |||
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成"); | |||
mORKS.OutNoodleing = false; | |||
} | |||
@@ -433,7 +450,7 @@ namespace BPASmartClient.MorkS | |||
if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.RbOutMealComplete && !mORKS.TakeMealDetect, 2)) | |||
{ | |||
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); | |||
MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】取餐完成"); | |||
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); | |||
ResetCookComplete(); | |||
mORKS.OutMealId = string.Empty; | |||
} | |||
@@ -444,7 +461,7 @@ namespace BPASmartClient.MorkS | |||
mORKS.TakeNoodleInterlock = false; | |||
mORKS.AllowTakeNoodle = false; | |||
mORKS.TurntableInterlock = false; | |||
MessageLog.GetInstance.Show("机器人取面完成信号检测"); | |||
DeviceProcessLogShow("机器人取面完成信号检测"); | |||
TakeNoodleCompleteReset(); | |||
} | |||
@@ -480,7 +497,7 @@ namespace BPASmartClient.MorkS | |||
//配方数据地址范围:VW2000 - VW2278 | |||
WriteData("VW2000", recipeBoms.ToArray()); | |||
} | |||
else { MessageLog.GetInstance.Show("配方数据为空"); } | |||
else { DeviceProcessLogShow("配方数据为空"); } | |||
} | |||
@@ -502,7 +519,7 @@ namespace BPASmartClient.MorkS | |||
if (num >= 1 && num <= 6) | |||
{ | |||
WriteData($"102.{num - 1}", false); | |||
MessageLog.GetInstance.Show($"{num}号煮面口占用复位"); | |||
DeviceProcessLogShow($"{num}号煮面口占用复位"); | |||
} | |||
} | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.Device; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -7,7 +8,7 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkS | |||
{ | |||
public class GVL_MORKS | |||
public class GVL_MORKS : IStatus | |||
{ | |||
/// <summary> | |||
/// 机器人取面 | |||
@@ -36,48 +37,48 @@ namespace BPASmartClient.MorkS | |||
/// 允许运行 | |||
/// </summary> | |||
//[Circuit(new string[] { "机器人取面", "取碗控制" }, "允许运行")] | |||
//[VariableMonitor("允许运行")] | |||
[VariableMonitor("允许运行")] | |||
public bool AllowRun { get; set; } | |||
/// <summary> | |||
/// //机器人任务互锁信号 | |||
/// </summary> | |||
//[Circuit(new string[] { "机器人取面", "出面控制" }, "机器人互锁", new bool[] { true, false })] | |||
//[VariableMonitor("机器人任务互锁信号")] | |||
[VariableMonitor("机器人任务互锁信号")] | |||
public bool RobotTaskInterlock { get; set; } | |||
/// <summary> | |||
/// 取碗互锁信号 | |||
/// </summary> | |||
//[Circuit("取碗控制", "取碗互锁", true)] | |||
//[VariableMonitor("取碗互锁信号")] | |||
[VariableMonitor("取碗互锁信号")] | |||
public bool TakeBowlInterlock { get; set; } | |||
/// <summary> | |||
/// 取面互锁信号 | |||
/// </summary> | |||
//[Circuit(new string[] { "机器人取面", "出面控制" }, "取面互锁信号", new bool[] { true, true })] | |||
//[VariableMonitor("取面互锁信号")] | |||
[VariableMonitor("取面互锁信号")] | |||
public bool TakeNoodleInterlock { get; set; } | |||
/// <summary> | |||
/// 出面中 | |||
/// </summary> | |||
//[Circuit("机器人取面", "出面中", true)] | |||
//[VariableMonitor("出面中")] | |||
[VariableMonitor("出面中")] | |||
public bool OutNoodleing { get; set; } | |||
/// <summary> | |||
/// 允许取面 | |||
/// </summary> | |||
//[Circuit(new string[] { "转台控制", "机器人取面" }, "允许取面", new bool[] { true, false })] | |||
//[VariableMonitor("允许取面")] | |||
[VariableMonitor("允许取面")] | |||
public bool AllowTakeNoodle { get; set; } | |||
/// <summary> | |||
/// 转台互锁信号 | |||
/// </summary> | |||
//[VariableMonitor("转台互锁信号")] | |||
[VariableMonitor("转台互锁信号")] | |||
public bool TurntableInterlock { get; set; } | |||
#endregion | |||
@@ -88,7 +89,7 @@ namespace BPASmartClient.MorkS | |||
/// ModbusTcp -> 1120 | |||
/// </summary> | |||
//[Circuit(new string[] { "允许运行", "转台控制", "转台控制" }, "初始化完成")] | |||
//[VariableMonitor("初始化完成", "M100.0", "1120")] | |||
[VariableMonitor("初始化完成", "M100.0", "1120")] | |||
public bool InitComplete { get; set; } | |||
/// <summary> | |||
@@ -97,7 +98,7 @@ namespace BPASmartClient.MorkS | |||
/// ModbusTcp -> 1121 | |||
/// </summary> | |||
//[Circuit("取碗控制", "取碗机构空闲", true)] | |||
//[VariableMonitor("取碗机构空闲", "M100.1", "1121")] | |||
[VariableMonitor("取碗机构空闲", "M100.1", "1121")] | |||
public bool TakeBowlIdle { get; set; } | |||
/// <summary> | |||
@@ -106,7 +107,7 @@ namespace BPASmartClient.MorkS | |||
/// ModbusTcp -> 1122 | |||
/// </summary> | |||
//[Circuit("允许运行", "温度到达")] | |||
//[VariableMonitor("温度到达", "M100.2", "1122")] | |||
[VariableMonitor("温度到达", "M100.2", "1122")] | |||
public bool TemperatureReached { get; set; } | |||
/// <summary> | |||
@@ -115,7 +116,7 @@ namespace BPASmartClient.MorkS | |||
/// ModbusTcp -> 1123 | |||
/// </summary> | |||
//[Circuit("出面控制", "允许到面")] | |||
//[VariableMonitor("允许到面", "M100.3", "1123")] | |||
[VariableMonitor("允许到面", "M100.3", "1123")] | |||
public bool AllowFallNoodle { get; set; } | |||
/// <summary> | |||
@@ -123,7 +124,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> M100.4 | |||
/// ModbusTcp -> 1124 | |||
/// </summary> | |||
//[VariableMonitor("机器人取面完成", "M100.4", "1124")] | |||
[VariableMonitor("机器人取面完成", "M100.4", "1124")] | |||
public bool RbTakeNoodleComplete { get; set; } | |||
/// <summary> | |||
@@ -131,7 +132,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> M100.5 | |||
/// ModbusTcp -> 1125 | |||
/// </summary> | |||
//[VariableMonitor("机器人倒面完成", "M100.5", "1125")] | |||
[VariableMonitor("机器人倒面完成", "M100.5", "1125")] | |||
public bool RbFallNoodleComplete { get; set; } | |||
/// <summary> | |||
@@ -139,7 +140,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> M100.6 | |||
/// ModbusTcp -> 1126 | |||
/// </summary> | |||
//[VariableMonitor("机器人出餐完成", "M100.6", "1126")] | |||
[VariableMonitor("机器人出餐完成", "M100.6", "1126")] | |||
public bool RbOutMealComplete { get; set; } | |||
/// <summary> | |||
@@ -148,7 +149,7 @@ namespace BPASmartClient.MorkS | |||
/// ModbusTcp -> 1127 | |||
/// </summary> | |||
//[Circuit(new string[] { "机器人取面", "出面控制" }, "机器人空闲")] | |||
//[VariableMonitor("机器人空闲", "M100.7", "1127")] | |||
[VariableMonitor("机器人空闲", "M100.7", "1127")] | |||
public bool RobotIdle { get; set; } | |||
/// <summary> | |||
@@ -157,7 +158,7 @@ namespace BPASmartClient.MorkS | |||
/// ModbusTcp -> 1128 | |||
/// </summary> | |||
//[Circuit("出面控制", "取餐口检测", true)] | |||
//[VariableMonitor("取餐口检测", "M101.0", "1128")] | |||
[VariableMonitor("取餐口检测", "M101.0", "1128")] | |||
public bool TakeMealDetect { get; set; } | |||
/// <summary> | |||
@@ -165,7 +166,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> M101.1 | |||
/// ModbusTcp -> 1129 | |||
/// </summary> | |||
//[VariableMonitor("缺碗信号", "M101.1", "1129")] | |||
[VariableMonitor("缺碗信号", "M101.1", "1129")] | |||
public bool MissingBowl { get; set; } | |||
/// <summary> | |||
@@ -173,7 +174,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> M101.2 | |||
/// ModbusTcp -> 1130 | |||
/// </summary> | |||
//[VariableMonitor("设备初始化中", "M101.2", "1130")] | |||
[VariableMonitor("设备初始化中", "M101.2", "1130")] | |||
public bool DeviceIniting { get; set; } | |||
/// <summary> | |||
@@ -182,7 +183,7 @@ namespace BPASmartClient.MorkS | |||
/// ModbusTcp -> 1131 | |||
/// </summary> | |||
//[Circuit("转台控制", "转台下限检测有物料")] | |||
//[VariableMonitor("转台下限检测", "M101.3", "1131")] | |||
[VariableMonitor("转台下限检测", "M101.3", "1131")] | |||
public bool TurntableLowerLimit { get; set; } | |||
/// <summary> | |||
@@ -190,7 +191,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> M101.4 | |||
/// ModbusTcp -> 1132 | |||
/// </summary> | |||
//[VariableMonitor("缺碗信号 2", "M101.4", "1132")] | |||
[VariableMonitor("缺碗信号 2", "M101.4", "1132")] | |||
public bool MissingBowlSignal2 { get; set; } | |||
/// <summary> | |||
@@ -198,7 +199,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> M101.5 | |||
/// ModbusTcp -> 1133 | |||
/// </summary> | |||
//[VariableMonitor("转台上限检测", "M101.5", "1133")] | |||
[VariableMonitor("转台上限检测", "M101.5", "1133")] | |||
public bool TurntableUpLimit { get; set; } | |||
/// <summary> | |||
@@ -206,7 +207,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> M101.6 | |||
/// ModbusTcp -> 1134 | |||
/// </summary> | |||
//[VariableMonitor("补料完成", "M101.6", "1134")] | |||
[VariableMonitor("补料完成", "M101.6", "1134")] | |||
public bool FeedComplete { get; set; } | |||
/// <summary> | |||
@@ -215,7 +216,7 @@ namespace BPASmartClient.MorkS | |||
/// ModbusTcp -> 1135 | |||
/// </summary> | |||
//[Circuit(new string[] { "转台控制", "机器人取面" }, "转台移动到位")] | |||
//[VariableMonitor("转台移动到位", "M101.7", "1135")] | |||
[VariableMonitor("转台移动到位", "M101.7", "1135")] | |||
public bool TurntableMoveInPlace { get; set; } | |||
/// <summary> | |||
@@ -223,7 +224,7 @@ namespace BPASmartClient.MorkS | |||
/// M102.0 - M102.5 | |||
/// 1136 - 1141 | |||
/// </summary> | |||
//[VariableMonitor("煮面炉状态", "M102.0", "1136")] | |||
[VariableMonitor("煮面炉状态", "M102.0", "1136")] | |||
public bool[] NoodleCookerStatus { get; set; } = new bool[6] { false, false, false, false, false, false }; | |||
/// <summary> | |||
@@ -231,7 +232,7 @@ namespace BPASmartClient.MorkS | |||
/// M102.6 | |||
/// 1142 | |||
/// </summary> | |||
//[VariableMonitor("补料中", "M102.6", "1142")] | |||
[VariableMonitor("补料中", "M102.6", "1142")] | |||
public bool Feeding { get; set; } | |||
/// <summary> | |||
@@ -239,7 +240,7 @@ namespace BPASmartClient.MorkS | |||
/// M103.0 - M103.5 | |||
/// 1144 - 1149 | |||
/// </summary> | |||
//[VariableMonitor("煮面完成", "M103.0", "1144")] | |||
[VariableMonitor("煮面完成", "M103.0", "1144")] | |||
public bool[] CookNoodlesComplete { get; set; } = new bool[6] { false, false, false, false, false, false }; | |||
/// <summary> | |||
@@ -247,7 +248,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> M235.0 | |||
/// True:设备正常,False:设备异常 | |||
/// </summary> | |||
//[VariableMonitor("硬件设备异常", "M235.0", "")] | |||
[VariableMonitor("硬件设备异常", "M235.0", "")] | |||
public bool Error { get; set; } = false; | |||
/// <summary> | |||
@@ -255,7 +256,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> VW0 | |||
/// ModbusTcp -> 100 | |||
/// </summary> | |||
//[VariableMonitor("配方编号", "VW0", "100")] | |||
[VariableMonitor("配方编号", "VW0", "100")] | |||
public ushort RecipeNumber { get; set; } | |||
/// <summary> | |||
@@ -263,7 +264,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> VW2 | |||
/// ModbusTcp -> 101 | |||
/// </summary> | |||
//[VariableMonitor("转台设置位置", "VW2", "101")] | |||
[VariableMonitor("转台设置位置", "VW2", "101")] | |||
public ushort TurntableLoc { get; set; } | |||
/// <summary> | |||
@@ -271,7 +272,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> VW4 | |||
/// ModbusTcp -> 102 | |||
/// </summary> | |||
//[VariableMonitor("到面至煮面炉位置", "VW4", "102")] | |||
[VariableMonitor("到面至煮面炉位置", "VW4", "102")] | |||
public ushort FallNoodleLoc { get; set; } | |||
/// <summary> | |||
@@ -279,7 +280,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> VW6 | |||
/// ModbusTcp -> 103 | |||
/// </summary> | |||
//[VariableMonitor("取面位置", "VW6", "103")] | |||
[VariableMonitor("取面位置", "VW6", "103")] | |||
public ushort TakeNoodleLoc { get; set; } | |||
/// <summary> | |||
@@ -287,7 +288,7 @@ namespace BPASmartClient.MorkS | |||
/// PLC -> VW372 | |||
/// ModbusTcp -> 286 | |||
/// </summary> | |||
//[VariableMonitor("转台反馈位置", "VW372", "286")] | |||
[VariableMonitor("转台反馈位置", "VW372", "286")] | |||
public ushort TurntableFeedbackloc { get; set; } | |||
/// <summary> | |||
@@ -338,7 +339,7 @@ namespace BPASmartClient.MorkS | |||
/// <summary> | |||
/// 转台当前启动位置 | |||
/// </summary> | |||
//[VariableMonitor("转台当前启动位置")] | |||
[VariableMonitor("转台当前启动位置")] | |||
public ushort CurrentLoc { get; set; } = 0; | |||
#endregion | |||
@@ -27,8 +27,40 @@ | |||
<Peripherals> | |||
<Peripheral Module="BPASmartClient.PLC.MorksMachine"> | |||
<Parameters> | |||
<IpAddress>192.168.1.11</IpAddress> | |||
<Port>508</Port> | |||
<IpAddress>127.0.0.1</IpAddress> | |||
<Port>502</Port> | |||
<!--<PLCReadAddress>M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>--> | |||
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress> | |||
</Parameters> | |||
</Peripheral> | |||
<!--<Peripheral Module="BPASmartClient.MORKSM.BK.PLC.MorksMachine"> | |||
<Parameters> | |||
<IpAddress>127.0.10.1</IpAddress> | |||
<Port>11</Port> | |||
</Parameters> | |||
</Peripheral>--> | |||
<!--<Peripheral Module="BPASmartClient.KLMCoffee.CoffeeMachine"> | |||
<Parameters> | |||
<PortName>COM8</PortName> | |||
<BaudRate>38400</BaudRate> | |||
</Parameters> | |||
</Peripheral>--> | |||
</Peripherals> | |||
</Device> | |||
<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="3"> | |||
<!--<Parameters> | |||
<IpAddress>127.0.10.1</IpAddress> | |||
<Port>11</Port> | |||
</Parameters>--> | |||
<Peripherals> | |||
<Peripheral Module="BPASmartClient.PLC.MorksMachine"> | |||
<Parameters> | |||
<IpAddress>127.0.0.1</IpAddress> | |||
<Port>502</Port> | |||
<!--<PLCReadAddress>M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>--> | |||
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress> | |||
</Parameters> | |||