@@ -9,6 +9,7 @@ using BPASmartClient.Http; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Model.小炒机; | |||
using BPASmartClient.Model.调酒机; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Concurrent; | |||
@@ -28,7 +29,9 @@ namespace BPASmartClient.Business | |||
{ | |||
//订单队列 | |||
private ConcurrentDictionary<int, ConcurrentQueue<MorkOrderPush>> orders = new ConcurrentDictionary<int, ConcurrentQueue<MorkOrderPush>>(); | |||
//运行标识 | |||
/// <summary> | |||
/// 运行标识 | |||
/// </summary> | |||
private bool running = false; | |||
//设备管理 | |||
private DeviceMgr deviceMgr; | |||
@@ -73,15 +76,15 @@ namespace BPASmartClient.Business | |||
{ | |||
if (!orders.ContainsKey(morkOrderpush.DeviceId)) | |||
{ | |||
orders.TryAdd(morkOrderpush.DeviceId, new ConcurrentQueue<MorkOrderPush>()); | |||
StartTargetDeviceOrderJob(morkOrderpush.DeviceId); | |||
} | |||
if( orders[morkOrderpush.DeviceId].FirstOrDefault(p=>p.SuborderId == morkOrderpush.SuborderId) == null) | |||
if (orders[morkOrderpush.DeviceId].FirstOrDefault(p => p.SuborderId == morkOrderpush.SuborderId) == null) | |||
{ | |||
orders[morkOrderpush.DeviceId].Enqueue(morkOrderpush); | |||
} | |||
} | |||
//辅料信息 | |||
else if (message is RecipeBoms recipe) | |||
@@ -113,11 +116,19 @@ namespace BPASmartClient.Business | |||
IDevice device = deviceMgr.GetDevices().FirstOrDefault(x => x.DeviceId == 28); | |||
new StirFryGoodsEvent() { | |||
DeviceId = device.DeviceId, | |||
stirFrymessage =frybom | |||
stirFrymessage = frybom | |||
}.Publish(); | |||
MessageLog.GetInstance.Show("接受到【MQTT】的小炒流程信息"); | |||
} | |||
else if (message is MORKMWPushMessage morkMWBom) | |||
{ | |||
IDevice device = deviceMgr.GetDevices().FirstOrDefault(x => x.DeviceId == 113); | |||
new MorkMWGoodsEvent() | |||
{ | |||
DeviceId = device.DeviceId, | |||
morkMWPushMessage = morkMWBom | |||
}.Publish(); | |||
MessageLog.GetInstance.Show("接收到【MQTT】获取的调酒机配方信息"); | |||
} | |||
}); | |||
@@ -14,8 +14,10 @@ using Org.BouncyCastle.Bcpg.OpenPgp; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Net.Http.Json; | |||
using System.Reflection; | |||
using System.Threading; | |||
using System.Windows.Documents; | |||
using static BPASmartClient.EventBus.EventBus; | |||
@@ -24,18 +26,33 @@ namespace BPASmartClient.MorkMW | |||
{ | |||
public class Control_MorkMW : BaseDevice | |||
{ | |||
int id = 0; | |||
ModbusTcp modbus; | |||
public override DeviceClientType DeviceType => DeviceClientType.MORKMW; | |||
GVL_MorkMW morkMW = new GVL_MorkMW(); | |||
public override void DoMain() | |||
{ | |||
VaribleMonitorDis(); | |||
ConnectKlpRobot("192.168.0.100", 8001); | |||
ServerInit(); | |||
DataParse(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => { VariableMonitor();Thread.Sleep(5); }),"机器人变量状态监控线程",true); | |||
} | |||
private void VaribleMonitorDis() | |||
{ | |||
PropertyInfo[] pros= morkMW.GetType().GetProperties(); | |||
foreach (var item in pros) | |||
{ | |||
var res= item.GetCustomAttribute<VariblesAttribute>(); | |||
if(res!=null) | |||
{ | |||
GVL_MorkMW.varibleInfos.Add(new VaribleModel { Id = id + 1, VaribleName = res.VarName,RobotAddress=res.RobotAddress,ModbusAddress=res.ModbusTcpAddress,Notes=res.Notes }); | |||
id++; | |||
} | |||
} | |||
} | |||
private void ServerInit() | |||
{ | |||
//配方数据信息 | |||
@@ -44,14 +61,18 @@ namespace BPASmartClient.MorkMW | |||
if (@event == null) return; | |||
if (@event is MorkMWGoodsEvent recipe) | |||
{ | |||
listMorkMWGoods= recipe.morkMWPushMessage.MorkMWGoods; | |||
DeviceProcessLogShow($"接收到调酒机【{listMorkMWGoods.Count}】个商品配方数据"); | |||
listMorkMWGoods= recipe.morkMWPushMessage?.MorkMWGoods; | |||
DeviceProcessLogShow($"接收到调酒机【{listMorkMWGoods?.Count}】个商品配方数据"); | |||
} | |||
}); | |||
} | |||
public override void MainTask() | |||
{ | |||
if (Json<KeepDataBase>.Data.IsVerify) | |||
IsHealth = modbus.Connected; | |||
else | |||
IsHealth = true;//心跳上报 | |||
ToGetWink(); | |||
ToMixWink(); | |||
ToPourWink(); | |||
@@ -70,6 +91,8 @@ namespace BPASmartClient.MorkMW | |||
morkMW.TaskLock = true; | |||
if (orderLocInfos.TryDequeue(out OrderLocInfo res)) | |||
{ | |||
morkMW.CurrentSuborderId = res.SuborderId; | |||
OrderChange(res.SuborderId,ORDER_STATUS.COOKING); | |||
foreach (var item in res.mixWink) | |||
{ | |||
switch (item.Loc) | |||
@@ -81,7 +104,6 @@ namespace BPASmartClient.MorkMW | |||
case 4: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break; | |||
case 5: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break; | |||
case 6: ToSpecifiedLocTakeWink(item.Loc, item.Qty); break; | |||
} | |||
switch (item.Loc) | |||
{ | |||
@@ -105,7 +127,7 @@ namespace BPASmartClient.MorkMW | |||
} | |||
else | |||
{ | |||
if (morkMW.RobotIdle && orderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal) | |||
if (morkMW.RobotIdle && simOrderLocInfos.Count > 0 && !morkMW.TaskLock && !morkMW.PourWinkComplete && morkMW.CupSignal) | |||
{ | |||
DeviceProcessLogShow("订单开始制作"); | |||
morkMW.TaskLock = true; | |||
@@ -229,6 +251,7 @@ namespace BPASmartClient.MorkMW | |||
{ | |||
if (RTrig.GetInstance("AllComplete").Start(morkMW.ProcessComplete)) | |||
{ | |||
OrderChange(morkMW.CurrentSuborderId, ORDER_STATUS.COMPLETED_COOK); | |||
morkMW.PourWinkComplete = true; | |||
DeviceProcessLogShow("订单制作完成,请取走调好酒杯"); | |||
} | |||
@@ -236,6 +259,7 @@ namespace BPASmartClient.MorkMW | |||
{ | |||
if (TTrig.GetInstance("PoutWinkCom").Start(morkMW.CupSignal)) | |||
{ | |||
OrderChange(morkMW.CurrentSuborderId, ORDER_STATUS.COMPLETED_TAKE); | |||
DeviceProcessLogShow("客户取走调好酒杯,请放置空酒杯,以待下次订单制作"); | |||
} | |||
if (RTrig.GetInstance("PoutWinkCom").Start(morkMW.CupSignal)) | |||
@@ -281,6 +305,8 @@ namespace BPASmartClient.MorkMW | |||
morkMW.TakeWinkSixComplete = modbus.ReadCoils(4611); | |||
morkMW.MixWinkComplte = modbus.ReadCoils(4612); | |||
morkMW.ProcessComplete = modbus.ReadCoils(4613); | |||
} | |||
else | |||
{ | |||
@@ -288,6 +314,30 @@ namespace BPASmartClient.MorkMW | |||
} | |||
} | |||
public void VariableMonitor() | |||
{ | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkOneLoc").CurrentValue = morkMW.ArriveWinkOneLoc; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkTwoLoc").CurrentValue = morkMW.ArriveWinkTwoLoc; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkThreeLoc").CurrentValue = morkMW.ArriveWinkThreeLoc; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkFourLoc").CurrentValue = morkMW.ArriveWinkFourLoc; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkFiveLoc").CurrentValue = morkMW.ArriveWinkFiveLoc; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ArriveWinkSixLoc").CurrentValue = morkMW.ArriveWinkSixLoc; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "RobotIdle").CurrentValue = morkMW.RobotIdle; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "CupSignal").CurrentValue = morkMW.CupSignal; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkOneComplete").CurrentValue = morkMW.TakeWinkOneComplete; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkTwoComplete").CurrentValue = morkMW.TakeWinkTwoComplete; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkThreeComplete").CurrentValue = morkMW.TakeWinkThreeComplete; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkFourComplete").CurrentValue = morkMW.TakeWinkFourComplete; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkFiveComplete").CurrentValue = morkMW.TakeWinkFiveComplete; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "TakeWinkSixComplete").CurrentValue = morkMW.TakeWinkSixComplete; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "MixWinkComplte").CurrentValue = morkMW.MixWinkComplte; | |||
GVL_MorkMW.varibleInfos.FirstOrDefault(p => p.VaribleName == "ProcessComplete").CurrentValue = morkMW.ProcessComplete; | |||
} | |||
public override void ResetProgram() | |||
{ | |||
morkMW = null; | |||
@@ -347,25 +397,51 @@ namespace BPASmartClient.MorkMW | |||
if (@event != null && @event is DoOrderEvent order) | |||
{ | |||
var res= listMorkMWGoods.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey); | |||
morkMW.doOrderEvents.Add(order); | |||
if (listMorkMWGoods.Count == 0) return; | |||
if (morkMW.historySuborderId.FirstOrDefault(p => p == order.MorkOrder.SuborderId) != null) return; | |||
OrderCount++; | |||
var res= listMorkMWGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey); | |||
if (res != null) | |||
{ | |||
string guid = Guid.NewGuid().ToString(); | |||
orderLocInfos.Enqueue(new OrderLocInfo { mixWink = res.MorkMWBoms, SuborderId = order.MorkOrder.SuborderId }); | |||
DeviceProcessLogShow($"收到小程序订单,订单号【{order.MorkOrder.SuborderId}】"); | |||
morkMW.historySuborderId.Add(order.MorkOrder.SuborderId); | |||
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT); | |||
DeviceProcessLogShow($"收到【{OrderCount}】次小程序订单,当前订单【{order.MorkOrder.GoodsName}】,订单号【{order.MorkOrder.SuborderId}】"); | |||
} | |||
else | |||
{ | |||
DeviceProcessLogShow($"未找到订单对应商品,订单号【{order.MorkOrder.SuborderId}】"); | |||
} | |||
} | |||
}); | |||
} | |||
/// <summary> | |||
/// 连接卡乐普机器人 | |||
/// 订单状态上报 | |||
/// </summary> | |||
/// <param name="ip"></param> | |||
/// <param name="port"></param> | |||
public void ConnectKlpRobot(string ip, int port) | |||
/// <param name="subid"></param> | |||
/// <param name="oRDER_STATUS"></param> | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
var res = morkMW.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid); | |||
string goodName = string.Empty; | |||
string SortNum = string.Empty; | |||
if (res != null) | |||
{ | |||
goodName = res.MorkOrder.GoodsName; | |||
SortNum = res.MorkOrder.SortNum.ToString(); | |||
} | |||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); | |||
} | |||
/// <summary> | |||
/// 连接卡乐普机器人 | |||
/// </summary> | |||
/// <param name="ip"></param> | |||
/// <param name="port"></param> | |||
public void ConnectKlpRobot(string ip, int port) | |||
{ | |||
modbus = new ModbusTcp(); | |||
modbus.Show += new Action<string>((s) => | |||
@@ -394,6 +470,8 @@ namespace BPASmartClient.MorkMW | |||
/// 调酒机配方集合 | |||
/// </summary> | |||
public List<MORKMWGoods> listMorkMWGoods = new List<MORKMWGoods>(); | |||
} | |||
} |
@@ -1,5 +1,9 @@ | |||
using System; | |||
| |||
using BPASmartClient.Model; | |||
using BPASmartClient.MorkMW.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -9,42 +13,50 @@ namespace BPASmartClient.MorkMW | |||
public class GVL_MorkMW | |||
{ | |||
#region 机器人信号 | |||
[Varibles("RobotIdle", "初始化位置", "M105", "4201")] | |||
/// <summary> | |||
/// 机器人空闲信号 | |||
/// </summary> | |||
public bool RobotIdle { get; set; } | |||
[Varibles("TakeWinkOneComplete", "1号接酒完成", "M510", "4606")] | |||
public bool TakeWinkOneComplete { get; set; } | |||
[Varibles("TakeWinkTwoComplete", "2号接酒完成", "M511", "4607")] | |||
public bool TakeWinkTwoComplete { get; set; } | |||
[Varibles("TakeWinkThreeComplete", "3号接酒完成", "M512", "4608")] | |||
public bool TakeWinkThreeComplete { get; set; } | |||
[Varibles("TakeWinkFourComplete", "4号接酒完成", "M513", "4609")] | |||
public bool TakeWinkFourComplete { get; set; } | |||
[Varibles("TakeWinkFiveComplete", "5号接酒完成", "M514", "4610")] | |||
public bool TakeWinkFiveComplete { get; set; } | |||
[Varibles("TakeWinkSixComplete", "6号接酒完成", "M515", "4611")] | |||
public bool TakeWinkSixComplete { get; set; } | |||
[Varibles("ArriveWinkOneLoc", "到达1号接酒位置", "M520", "4616")] | |||
public bool ArriveWinkOneLoc { get; set; } | |||
[Varibles("ArriveWinkTwoLoc", "到达2号接酒位置", "M521", "4617")] | |||
public bool ArriveWinkTwoLoc { get; set; } | |||
[Varibles("ArriveWinkThreeLoc", "到达3号接酒位置", "M522", "4618")] | |||
public bool ArriveWinkThreeLoc { get; set; } | |||
[Varibles("ArriveWinkFourLoc", "到达4号接酒位置", "M523", "4619")] | |||
public bool ArriveWinkFourLoc { get; set; } | |||
[Varibles("ArriveWinkFiveLoc", "到达5号接酒位置", "M524", "4620")] | |||
public bool ArriveWinkFiveLoc { get; set; } | |||
[Varibles("ArriveWinkSixLoc", "到达6号接酒位置", "M525", "4621")] | |||
public bool ArriveWinkSixLoc { get; set; } | |||
[Varibles("CupSignal", "放杯处传感器信号", "X0", "0")] | |||
/// <summary> | |||
/// 放杯处传感器信号 | |||
/// </summary> | |||
public bool CupSignal { get; set; } | |||
[Varibles("MixWinkComplte", "摇酒完成信号", "M516", "4612")] | |||
/// <summary> | |||
/// 摇酒完成信号 | |||
/// </summary> | |||
public bool MixWinkComplte { get; set; } | |||
[Varibles("ProcessComplete", "倒酒完成信号", "M517", "4613")] | |||
/// <summary> | |||
/// 机器人倒完酒并回到初始位的完成信号 | |||
/// </summary> | |||
@@ -71,7 +83,27 @@ namespace BPASmartClient.MorkMW | |||
/// </summary> | |||
public bool PourWinkComplete { get; set; } | |||
#endregion | |||
/// <summary> | |||
/// 允许本地下单 | |||
/// </summary> | |||
public static bool AllowLocalSimOrder { get; set; } | |||
/// <summary> | |||
/// 订单集合 | |||
/// </summary> | |||
public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>(); | |||
/// <summary> | |||
/// 历史订单号 | |||
/// </summary> | |||
public List<string> historySuborderId = new List<string>(); | |||
/// <summary> | |||
/// 当前订单号 | |||
/// </summary> | |||
public string CurrentSuborderId { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public static ObservableCollection<VaribleModel> varibleInfos = new ObservableCollection<VaribleModel>(); | |||
} | |||
} |
@@ -0,0 +1,32 @@ | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Documents; | |||
namespace BPASmartClient.MorkMW.Model | |||
{ | |||
public class VaribleModel:ObservableObject | |||
{ | |||
private int _id; | |||
public int Id { get { return _id; }set { _id = value; OnPropertyChanged(); } } | |||
private string _varibleName; | |||
public string VaribleName { get { return _varibleName; } set { _varibleName = value;OnPropertyChanged(); } } | |||
private string _robotAddress; | |||
public string RobotAddress { get { return _robotAddress; } set { _robotAddress = value; OnPropertyChanged(); } } | |||
private string _modbusAddress; | |||
public string ModbusAddress { get { return _modbusAddress; }set { _modbusAddress = value;OnPropertyChanged(); } } | |||
private string _notes; | |||
public string Notes { get { return _notes; } set { _notes = value; OnPropertyChanged(); } } | |||
private bool _currentValue; | |||
public bool CurrentValue { get { return _currentValue; } set { _currentValue = value; OnPropertyChanged(); } } | |||
} | |||
} |
@@ -0,0 +1,32 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkMW.Model | |||
{ | |||
public class VariblesAttribute : Attribute | |||
{ | |||
public string VarName { get; set; } | |||
public string Notes { get; set; } | |||
public string RobotAddress { get; set; } | |||
public string ModbusTcpAddress { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="name">变量名</param> | |||
/// <param name="notes">描述</param> | |||
/// <param name="robotaddress">机器人地址</param> | |||
/// <param name="modbustcpaddress">modbustcp地址</param> | |||
public VariblesAttribute(string name, string notes, string plcaddress, string modbustcpaddress) | |||
{ | |||
VarName = name; | |||
Notes = notes; | |||
RobotAddress = plcaddress; | |||
ModbusTcpAddress = modbustcpaddress; | |||
} | |||
} | |||
} |
@@ -0,0 +1,147 @@ | |||
<UserControl x:Class="BPASmartClient.MorkMW.View.MonitorView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.MorkMW.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkMW.ViewModel" | |||
mc:Ignorable="d" | |||
Name="变量监控" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:MonitorViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<SolidColorBrush Color="White" x:Key="TitleFontColor"/> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
</UserControl.Resources> | |||
<Grid Margin="10,0"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Grid Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="40" /> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="ID" /> | |||
<GridSplitter Background="White" Width="2" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="变量名" /> | |||
<GridSplitter Background="White" Width="2" Grid.Column="1"/> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="机器人地址" /> | |||
<GridSplitter Background="White" Width="2" Grid.Column="2"/> | |||
<TextBlock | |||
Grid.Column="3" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="Modbus地址" /> | |||
<GridSplitter Background="White" Width="2" Grid.Column="3"/> | |||
<TextBlock | |||
Grid.Column="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="注释" /> | |||
<GridSplitter Background="White" Width="2" Grid.Column="4"/> | |||
<TextBlock | |||
Grid.Column="5" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="当前值" /> | |||
<GridSplitter Background="White" Width="2" Grid.Column="5"/> | |||
</Grid> | |||
<ItemsControl ItemsSource="{Binding vars}" Grid.Row="1"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel/> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="40" /> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="{Binding Id}" | |||
Height="30" | |||
Margin="0,5" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}"/> | |||
<TextBlock Text="{Binding VaribleName}" Grid.Column="1" | |||
Height="30" | |||
Margin="0,5" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}"/> | |||
<TextBlock Text="{Binding RobotAddress}" Grid.Column="2" HorizontalAlignment="Center" | |||
Height="30" | |||
Margin="0,5" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}"/> | |||
<TextBlock Text="{Binding ModbusAddress}" Grid.Column="3" HorizontalAlignment="Center" | |||
Height="30" | |||
Margin="0,5" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}"/> | |||
<TextBlock Text="{Binding Notes}" Grid.Column="4" HorizontalAlignment="Center" | |||
Height="30" | |||
Margin="0,5" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}"/> | |||
<TextBlock Text="{Binding CurrentValue}" Grid.Column="5" HorizontalAlignment="Center" | |||
Height="30" | |||
Margin="0,5" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}"/> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.MorkMW.View | |||
{ | |||
/// <summary> | |||
/// MonitorView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class MonitorView : UserControl | |||
{ | |||
public MonitorView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -33,13 +33,13 @@ namespace BPASmartClient.MorkMW.ViewModel | |||
}); | |||
AddMaterial = new RelayCommand(() => { | |||
SimRecipe.recipe.Insert(0, new MixWinkModel()); | |||
}); | |||
ClearMaterial = new RelayCommand(() => { | |||
if(SimRecipe.recipe.Count>1) | |||
SimRecipe.recipe.RemoveAt(SimRecipe.recipe.Count - 2); | |||
if(SimRecipe.recipe.Count>0) | |||
SimRecipe.recipe.RemoveAt(SimRecipe.recipe.Count - 1); | |||
}); | |||
StartLocalSim = new RelayCommand(() => { | |||
@@ -0,0 +1,17 @@ | |||
using BPASmartClient.MorkMW.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkMW.ViewModel | |||
{ | |||
internal class MonitorViewModel:ObservableObject | |||
{ | |||
public MonitorViewModel() { } | |||
public ObservableCollection<VaribleModel> vars { get; set; } = GVL_MorkMW.varibleInfos; | |||
} | |||
} |