@@ -59,6 +59,21 @@ namespace BPASmartClient.Business | |||
/// 是否启用测试模式 | |||
/// </summary> | |||
public static bool IsEnableTest { get; set; } | |||
/// <summary> | |||
/// 大屏地址 | |||
/// </summary> | |||
public static string DataVApiAddress { get; set; } | |||
/// <summary> | |||
/// 大屏主题 | |||
/// </summary> | |||
public static string BroadcastPubTopic { get; set; } | |||
/// <summary> | |||
/// 物料管理地址 | |||
/// </summary> | |||
public static string WebServiceUri { get; set; } | |||
#endregion | |||
} | |||
@@ -26,6 +26,10 @@ namespace BPASmartClient.Business | |||
/// </summary> | |||
public MQTT_Entity MQTT_Config { get; set; } | |||
public MQTT_Account Mqtt_Account { get; set; } | |||
public UriConfig uriConfig { get; set; } | |||
//Apollo地址 | |||
private string apolloUri; | |||
private string apoid; | |||
@@ -42,11 +46,11 @@ namespace BPASmartClient.Business | |||
apolloUri = System.Configuration.ConfigurationManager.AppSettings["ApolloUri"].ToString(); | |||
apoid = System.Configuration.ConfigurationManager.AppSettings["AppId"].ToString(); | |||
namespa = System.Configuration.ConfigurationManager.AppSettings["Namespaces"].ToString(); | |||
InternetInfo.OrderServer = System.Configuration.ConfigurationManager.AppSettings["OrderServiceUri"].ToString(); | |||
InternetInfo.StockServer = System.Configuration.ConfigurationManager.AppSettings["StockServiceUri"].ToString(); | |||
//InternetInfo.OrderServer = System.Configuration.ConfigurationManager.AppSettings["OrderServiceUri"].ToString(); | |||
//InternetInfo.StockServer = System.Configuration.ConfigurationManager.AppSettings["StockServiceUri"].ToString(); | |||
InternetInfo.IsEnableTest = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["IsEnableTest"].ToString()); | |||
InitDeviceModel(); | |||
InitMQTT(); | |||
InitConfig(); | |||
} | |||
public List<DeviceConfig> GetDeviceConfigs() | |||
@@ -132,30 +136,45 @@ namespace BPASmartClient.Business | |||
/// <summary> | |||
/// 加载MQTT配置 | |||
/// </summary> | |||
private void InitMQTT() | |||
//private void InitMQTT() | |||
//{ | |||
// IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); | |||
// configurationBuilder.AddApolloConfiguration(p => | |||
// { | |||
// p.AppId = apoid; | |||
// p.MetaServer = apolloUri; | |||
// p.Namespaces = new List<string>() { namespa }; | |||
// }); | |||
// IConfiguration config = configurationBuilder.Build(); | |||
// var mqttBroker = config.GetSection("BrokerHostSettings"); | |||
// MQTT_Config = mqttBroker.Value.FromJSON<MQTT_Entity>(); | |||
// if (MQTT_Config == null) MessageLog.GetInstance.Show("获取配置数据为空!"); | |||
//} | |||
public void InitConfig() | |||
{ | |||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); | |||
//测试版本 | |||
//configurationBuilder.AddApolloConfiguration(p => | |||
// { | |||
// p.AppId = "dev1_order"; | |||
// p.MetaServer = apolloUri; | |||
// p.Namespaces = new List<string>() { "DEV.Config" }; | |||
// }); | |||
//正式版本 | |||
configurationBuilder.AddApolloConfiguration(p => | |||
{ | |||
p.AppId = apoid; | |||
p.AppId = "HostComputer"; | |||
p.MetaServer = apolloUri; | |||
p.Namespaces = new List<string>() { namespa }; | |||
p.Namespaces = new List<string>() { "application", namespa }; | |||
}); | |||
IConfiguration config = configurationBuilder.Build(); | |||
var mqttBroker = config.GetSection("BrokerHostSettings"); | |||
MQTT_Config = mqttBroker.Value.FromJSON<MQTT_Entity>(); | |||
if (MQTT_Config == null) MessageLog.GetInstance.Show("获取配置数据为空!"); | |||
MQTT_Config = config.GetSection("BrokerHostSettings").Value.FromJSON<MQTT_Entity>(); | |||
Mqtt_Account = config.GetSection("MqttAccount").Value.FromJSON<MQTT_Account>(); | |||
uriConfig = config.GetSection("URL").Value.FromJSON<UriConfig>(); | |||
if (uriConfig != null) | |||
{ | |||
InternetInfo.OrderServer = uriConfig.OrderServiceUrl; | |||
InternetInfo.StockServer = uriConfig.StockServiceUrl; | |||
InternetInfo.BroadcastPubTopic = uriConfig.BroadcastPubTopic; | |||
InternetInfo.DataVApiAddress = uriConfig.DataVServiceUrl; | |||
InternetInfo.WebServiceUri = uriConfig.WebServiceUrl; | |||
ActionManage.GetInstance.Send("配置初始化完成Iot启动"); | |||
} | |||
} | |||
public void Start() | |||
@@ -167,5 +186,20 @@ namespace BPASmartClient.Business | |||
public string Host { get; set; } | |||
public int Port { get; set; } | |||
} | |||
public class MQTT_Account | |||
{ | |||
public string UserName { get; set; } | |||
public string Password { get; set; } | |||
} | |||
public class UriConfig | |||
{ | |||
public string OrderServiceUrl { get; set; } | |||
public string StockServiceUrl { get; set; } | |||
public string DataVServiceUrl { get; set; } | |||
public string WebServiceUrl { get; set; } | |||
public string BroadcastPubTopic { get; set; } | |||
} | |||
} | |||
} |
@@ -46,6 +46,7 @@ namespace BPASmartClient.Business | |||
mqttProxy.Connected = new Action(() => | |||
{ | |||
mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray()); | |||
MessageLog.GetInstance.Show("MQTT 连接成功"); | |||
}); | |||
//MQTT 连接成功 | |||
mqttProxy.LostConnect = new Action(() => | |||
@@ -57,10 +58,10 @@ namespace BPASmartClient.Business | |||
{ | |||
msg.Enqueue(message); | |||
}); | |||
MessageLog.GetInstance.Show("准备连接MQTT"); | |||
var MqttServerConfig = Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config; | |||
var MqttServerAccount = Plugin.GetInstance().GetPlugin<ConfigMgr>().Mqtt_Account; | |||
//MQTT 初始化 | |||
mqttProxy.Connect(Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config.Host, Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config.Port, | |||
Guid.NewGuid().ToString()); | |||
mqttProxy.Connect(MqttServerAccount.UserName, MqttServerAccount.Password, MqttServerConfig.Host, MqttServerConfig.Port, Guid.NewGuid().ToString()); | |||
ThreadManage.GetInstance().Start(() => | |||
{ | |||
@@ -12,6 +12,7 @@ using System.Reflection; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.Device | |||
{ | |||
@@ -88,7 +89,7 @@ namespace BPASmartClient.Device | |||
/// <summary> | |||
/// 设备变量监控 | |||
/// </summary> | |||
public List<VariableMonitor> variableMonitors { get; set; } = new List<VariableMonitor>(); | |||
public ObservableCollection<VariableMonitor> variableMonitors { get; set; } = new ObservableCollection<VariableMonitor>(); | |||
/// <summary> | |||
/// 外设状态,硬件设备数据 | |||
@@ -105,6 +106,7 @@ namespace BPASmartClient.Device | |||
public List<Alarm> alarms { get; set; } = new List<Alarm>(); | |||
public IAlarm InterfaceAlarm { get; set; } | |||
public AlarmHelper alarmHelper { get; set; } = new AlarmHelper(); | |||
public IStatus InterfaceStatus { get; set; } | |||
#endregion | |||
@@ -204,16 +206,16 @@ namespace BPASmartClient.Device | |||
{ | |||
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}"); | |||
})); | |||
InterfaceStatus = item.GetValue(this) as IStatus; | |||
GetMonitorData(InterfaceStatus); | |||
//ThreadManage.GetInstance().StopTask($"{item.Name}:{DeviceId}", new Action(() => | |||
// { | |||
//ThreadManage.GetInstance().StartLong(new Action(() => | |||
//{ | |||
// UpdateValue(InterfaceStatus); | |||
// Thread.Sleep(1000); | |||
//}), $"GvlStatusMonitor:{DeviceId}"); | |||
//})); | |||
} | |||
else if (faces.Name == "IAlarm") | |||
{ | |||
@@ -288,8 +290,11 @@ namespace BPASmartClient.Device | |||
{ | |||
ThreadManage.GetInstance().StopTask($"ReadData:{DeviceId}", new Action(() => | |||
{ | |||
ResetProgram(); | |||
InitTask(); | |||
ThreadManage.GetInstance().StopTask($"GvlStatusMonitor:{DeviceId}", new Action(() => | |||
{ | |||
ResetProgram(); | |||
InitTask(); | |||
})); | |||
})); | |||
})); | |||
} | |||
@@ -316,6 +321,13 @@ namespace BPASmartClient.Device | |||
}), $"MainTask:{DeviceId}"); | |||
#endregion | |||
#region 设备状态监控 | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
UpdateValue(InterfaceStatus); | |||
Thread.Sleep(1000); | |||
}), $"GvlStatusMonitor:{DeviceId}"); | |||
#endregion | |||
} | |||
/// <summary> | |||
@@ -8,6 +8,7 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.Device | |||
{ | |||
@@ -54,7 +55,7 @@ namespace BPASmartClient.Device | |||
/// <summary> | |||
/// 设备变量信息 | |||
/// </summary> | |||
List<VariableMonitor> variableMonitors { get; set; } | |||
ObservableCollection<VariableMonitor> variableMonitors { get; set; } | |||
/// <summary> | |||
/// 设备报警信息集合 | |||
@@ -66,6 +67,11 @@ namespace BPASmartClient.Device | |||
/// </summary> | |||
IAlarm InterfaceAlarm { get; set; } | |||
/// <summary> | |||
/// 接口设备状态 | |||
/// </summary> | |||
IStatus InterfaceStatus { get; set; } | |||
/// <summary> | |||
/// 报警实体 | |||
/// </summary> | |||
@@ -3,46 +3,49 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.Device | |||
{ | |||
public class VariableMonitor | |||
public class VariableMonitor : ObservableObject | |||
{ | |||
public int Id { get { return _mId; } set { _mId = value; } } | |||
public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } } | |||
private int _mId; | |||
public string VarName { get { return _mVarName; } set { _mVarName = value; } } | |||
public string VarName { get { return _mVarName; } set { _mVarName = value; OnPropertyChanged(); } } | |||
private string _mVarName; | |||
public string PLCAddress { get { return _mPLCAddress; } set { _mPLCAddress = value; } } | |||
public string PLCAddress { get { return _mPLCAddress; } set { _mPLCAddress = value; OnPropertyChanged(); } } | |||
private string _mPLCAddress; | |||
public string Notes { get { return _mNotes; } set { _mNotes = value; } } | |||
public string Notes { get { return _mNotes; } set { _mNotes = value; OnPropertyChanged(); } } | |||
private string _mNotes; | |||
public string ModbusTcpAddress { get { return _mModbusTcpAddress; } set { _mModbusTcpAddress = value; } } | |||
public string ModbusTcpAddress { get { return _mModbusTcpAddress; } set { _mModbusTcpAddress = value; OnPropertyChanged(); } } | |||
private string _mModbusTcpAddress; | |||
public string CurrentValue | |||
{ | |||
get { return _mCurrentValue; } | |||
set | |||
{ | |||
public string CurrentValue | |||
{ | |||
get { return _mCurrentValue; } | |||
set | |||
{ | |||
_mCurrentValue = value; | |||
OnPropertyChanged(); | |||
if (_mCurrentValue == "False" || _mCurrentValue == "True") | |||
{ | |||
if (_mCurrentValue == "True") | |||
StatusColor = new { r = 51, g = 232, b = 34, a = 1 }; | |||
else | |||
StatusColor = new { r = 255, g = 0, b = 0, a = 1 }; | |||
}else | |||
} | |||
else | |||
StatusColor = new { r = 51, g = 232, b = 34, a = 1 }; | |||
} | |||
} | |||
} | |||
private string _mCurrentValue; | |||
@@ -34,13 +34,15 @@ namespace BPASmartClient.IoT | |||
/// </summary> | |||
public DataVClient() | |||
{ | |||
DataVApiAddress = System.Configuration.ConfigurationManager.AppSettings["DataVServiceUri"].ToString(); | |||
DataVApiAddress = InternetInfo.DataVApiAddress; | |||
//DataVApiAddress = System.Configuration.ConfigurationManager.AppSettings["DataVServiceUri"].ToString(); | |||
ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | |||
DeviceName = System.Configuration.ConfigurationManager.AppSettings["DeviceName"].ToString(); | |||
ProductKey = System.Configuration.ConfigurationManager.AppSettings["ProductKey"].ToString(); | |||
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString(); | |||
StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString(); | |||
BroadcastPubTopic = System.Configuration.ConfigurationManager.AppSettings["BroadcastPubTopic"].ToString(); | |||
BroadcastPubTopic = InternetInfo.BroadcastPubTopic; | |||
//BroadcastPubTopic = System.Configuration.ConfigurationManager.AppSettings["BroadcastPubTopic"].ToString(); | |||
} | |||
#endregion | |||
@@ -178,7 +180,7 @@ namespace BPASmartClient.IoT | |||
{ | |||
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null) | |||
{ | |||
iOTDevSXModel.Device1=String.Empty;iOTDevSXModel.Device2=String.Empty;iOTDevSXModel.Device3 = String.Empty; | |||
iOTDevSXModel.Device1 = String.Empty; iOTDevSXModel.Device2 = String.Empty; iOTDevSXModel.Device3 = String.Empty; | |||
List<object> dataVNode = new List<object>(); | |||
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device => | |||
{ | |||
@@ -314,7 +316,7 @@ namespace BPASmartClient.IoT | |||
{ | |||
FileUploadModelResult result = Tools.JsonToObjectTools<FileUploadModelResult>(message); | |||
} | |||
} | |||
/// <summary> | |||
@@ -22,15 +22,17 @@ namespace BPASmartClient.MQTT | |||
private IMqttClient client; | |||
public void Connect(string ip, int port, string clientId) | |||
public void Connect(string userName, string Password, string ip, int port, string clientId) | |||
{ | |||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); | |||
configurationBuilder.AddMqttClientHostedService(p => | |||
{ | |||
p.Server = ip; | |||
p.Port = port; | |||
p.UserName = "rafiul"; | |||
p.Password = "12345678"; | |||
//p.UserName = "rafiul"; | |||
//p.Password = "12345678"; | |||
p.UserName = userName; | |||
p.Password = Password; | |||
p.mqttClientConnectedHandlerDelegate = new MQTTnet.Client.Connecting.MqttClientConnectedHandlerDelegate(e => | |||
{ | |||
IsConnected = true; | |||
@@ -22,11 +22,5 @@ namespace BPASmartClient.Model | |||
/// </summary> | |||
public ObservableCollection<OrderData> orderLists { get; set; } = new ObservableCollection<OrderData>(); | |||
/// <summary> | |||
/// 参数设置 | |||
/// </summary> | |||
//public ObservableCollection<ParSet> parSets { get; set; } = new ObservableCollection<ParSet>(); | |||
} | |||
} |
@@ -14,6 +14,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.EventBus\BPASmartClient.EventBus.csproj" /> | |||
@@ -16,6 +16,7 @@ using System.Threading.Tasks; | |||
using System.Reflection; | |||
using BPASmartClient.MorkS.Model; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.MorkS.ViewModel; | |||
namespace BPASmartClient.MorkS | |||
{ | |||
@@ -27,6 +28,7 @@ namespace BPASmartClient.MorkS | |||
public override void DoMain() | |||
{ | |||
MonitorViewModel.DeviceId = DeviceId; | |||
ServerInit(); | |||
DataParse(); | |||
@@ -218,14 +220,6 @@ namespace BPASmartClient.MorkS | |||
if (obj is ushort[] UshortValue && UshortValue.Length > 0 && UshortValue.Length <= 1) | |||
mORKS.TurntableFeedbackloc = UshortValue[0]; | |||
})); | |||
//EventBus.EventBus.GetInstance().Publish(new ReadModel() { DeviceId = DeviceId, Address = "VW372", Length = 1 }, (o) => | |||
//{ | |||
// if (o != null && o.Length > 0 && o[0] is ushort value) | |||
// { | |||
// mORKS.TurntableFeedbackloc = value; | |||
// } | |||
//}); | |||
} | |||
/// <summary> | |||
@@ -484,11 +478,10 @@ namespace BPASmartClient.MorkS | |||
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); | |||
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏"); | |||
//写入煮面时间 | |||
//List<ushort> values = new List<ushort>(); | |||
//values.Add(Json<KeepDataBase>.Data.parSets.ElementAt(loc).Minute); | |||
//values.Add(Json<KeepDataBase>.Data.parSets.ElementAt(loc).Second); | |||
//ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetWordAddress($"VW{116 + (loc * 6)}"), WriteType.HoldingRegisters, values.ToArray()); | |||
List<ushort> values = new List<ushort>(); | |||
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Minute); | |||
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Second); | |||
WriteData($"VW{116 + (loc * 6)}", values.ToArray()); | |||
mORKS.TakeNoodleInterlock = true; | |||
} | |||
} | |||
@@ -15,11 +15,228 @@ | |||
<vm:MonitorViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<Label | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="监控画面" | |||
FontSize="40" /> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary> | |||
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" /> | |||
<convert:IsEnableConvert x:Key="isEnableConvert" /> | |||
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" /> | |||
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" /> | |||
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />--> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="BorderBrush" Value="#FF23CACA" /> | |||
<Setter Property="CaretBrush" Value="Aqua" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="ID" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="变量名" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="PLC 地址" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="注释" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,0,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Grid Grid.Column="4"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="Modbus TCP 地址" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="5" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="当前值" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 表格数据显示--> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding variableMonitors}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}" | |||
Text="{Binding Id}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}" | |||
Text="{Binding VarName}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}" | |||
Text="{Binding PLCAddress}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}" | |||
Text="{Binding Notes}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,0,0" /> | |||
</Grid> | |||
<Grid Grid.Column="4"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}" | |||
Text="{Binding ModbusTcpAddress}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="5" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="14" | |||
Foreground="{StaticResource FontColor}" | |||
Text="{Binding CurrentValue}" /> | |||
<Border | |||
Grid.ColumnSpan="8" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -3,7 +3,10 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Business; | |||
using BPASmartClient.Device; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.MorkS.ViewModel | |||
{ | |||
@@ -13,5 +16,10 @@ namespace BPASmartClient.MorkS.ViewModel | |||
{ | |||
} | |||
public static int DeviceId { get; set; } | |||
public ObservableCollection<VariableMonitor> variableMonitors { get; set; } = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors; | |||
} | |||
} |
@@ -47,8 +47,6 @@ namespace BPASmartClient.ViewModel | |||
GetData(); | |||
} | |||
private void GetData() | |||
{ | |||
var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig"); | |||
@@ -1,48 +1,21 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<configuration> | |||
<appSettings> | |||
<!--通用配置--> | |||
<!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺--> | |||
<add key="ClientId" value="50"/> | |||
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/> | |||
<add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/> | |||
<add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>--> | |||
<!--<add key="ApolloUri" value="https://bpa.black-pa.com:28080"/>--> | |||
<!--<add key="ClientId" value="2"/>--> | |||
<!--通用配置--> | |||
<add key="ClientId" value="51"/> | |||
<!--开发环境--> | |||
<!--<add key="apollouri" value="http://10.2.1.21:28080"/> | |||
<add key="orderserviceuri" value="https://bpa.black-pa.com:21527/order/"/> | |||
<add key="stockserviceuri" value="https://bpa.black-pa.com:21527/stock/"/> | |||
<add key="datavserviceuri" value="https://bpa.black-pa.com:21527/datav"/> | |||
<add key="webserviceuri" value="https://bpa.black-pa.com:21527"/> | |||
<add key="broadcastpubtopic" value="/broadcast/grgpechsl7q/transit_test_setdevice"/> | |||
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="dev1_common"/> | |||
<add key ="Namespaces" value="DEV.Config"/> | |||
<add key="IsEnableTest" value="False"/>--> | |||
<!--测试环境--> | |||
<!--<add key="ApolloUri" value="http://10.2.1.21:28070"/> | |||
<add key="OrderServiceUri" value="https://bpa.black-pa.com:21528/order/"/> | |||
<add key="StockServiceUri" value="https://bpa.black-pa.com:21528/stock/"/> | |||
<add key="DataVServiceUri" value="https://bpa.black-pa.com:21527/datav"/> | |||
<add key="WebServiceUri" value="https://bpa.black-pa.com:21528/stock/"/> | |||
<add key="BroadcastPubTopic" value="/broadcast/grgpECHSL7q/Transit_Test_SetDevice"/> | |||
<add key="AppId" value="dev1_common"/> | |||
<add key ="Namespaces" value="DEV.test1.Config"/>--> | |||
<!--正式环境--> | |||
<add key="ApolloUri" value="http://47.108.65.220:28080"/> | |||
<add key="OrderServiceUri" value="https://witt.black-pa.com/order/"/> | |||
<add key="StockServiceUri" value="https://witt.black-pa.com/stock/"/> | |||
<add key="DataVServiceUri" value="https://witt.black-pa.com/datav"/> | |||
<add key="WebServiceUri" value="https://witt.black-pa.com"/> | |||
<add key="BroadcastPubTopic" value="/broadcast/grgpECHSL7q/Transit_SetDevice"/> | |||
<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<add key="AppId" value="order"/> | |||
<add key ="Namespaces" value="TEST1.Config"/> | |||
<add key="IsEnableTest" value="false"/> | |||
<add key="IsEnableTest" value="False"/> | |||
<!--阿里云上报启动方式:API 或者 LOCAL--> | |||
<!--API :通过客户端ID,调用接口查询“设备连接信息”--> | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.Business; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -18,13 +19,14 @@ namespace BPASmartClient.Control | |||
/// <summary> | |||
/// BatchingAddView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class BatchingAddView :UserControl | |||
public partial class BatchingAddView : UserControl | |||
{ | |||
public BatchingAddView() | |||
{ | |||
InitializeComponent(); | |||
webView.Source=new Uri(System.Configuration.ConfigurationManager.AppSettings["WebServiceUri"].ToString()); | |||
//webView.Source=new Uri(System.Configuration.ConfigurationManager.AppSettings["WebServiceUri"].ToString()); | |||
webView.Source = new Uri(InternetInfo.WebServiceUri); | |||
} | |||
} | |||
} |
@@ -46,7 +46,7 @@ namespace BPASmartClient | |||
ActionManage.GetInstance.Register(new Action(() => | |||
{ | |||
myMenu.Visibility = Visibility.Visible; | |||
MenuItem_Click(new MenuItem() { Tag = "LogView", Header = "日志监视" },null); | |||
MenuItem_Click(new MenuItem() { Tag = "LogView", Header = "日志监视" }, null); | |||
}), "LoginSuccess"); | |||
Initialize(); | |||
} | |||
@@ -78,18 +78,21 @@ namespace BPASmartClient | |||
GetDevices(); | |||
}), "启动主控制台", false); | |||
ThreadManage.GetInstance().Start(new Action(() => | |||
ActionManage.GetInstance.Register(new Action(() => | |||
{ | |||
try | |||
ThreadManage.GetInstance().Start(new Action(() => | |||
{ | |||
DataVClient.GetInstance().Initialize(); | |||
DataVClient.GetInstance().Start(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
} | |||
}), "启动主IoT", false); | |||
try | |||
{ | |||
DataVClient.GetInstance().Initialize(); | |||
DataVClient.GetInstance().Start(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
} | |||
}), "启动主IoT", false); | |||
}), "配置初始化完成Iot启动"); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
@@ -100,14 +103,14 @@ namespace BPASmartClient | |||
switch (iot.CommandName) | |||
{ | |||
case 0://控制类 | |||
if (iot.CommandValue != null && iot.CommandValue.Count>0) | |||
if (iot.CommandValue != null && iot.CommandValue.Count > 0) | |||
{ | |||
switch (iot.CommandValue.Keys.ToList()[0]) | |||
{ | |||
case "程序启动": | |||
//mainConsole.Start(); | |||
break; | |||
//mainConsole.Stop(); | |||
//mainConsole.Stop(); | |||
case "程序停止": | |||
break; | |||
case "程序复位": | |||