@@ -56,25 +56,6 @@ namespace BPASmartClient.Business | |||||
Thread.Sleep(1000); | Thread.Sleep(1000); | ||||
}), "sim order"); | }), "sim order"); | ||||
} | } | ||||
//#if test | |||||
// ThreadManage.GetInstance().StartLong(new Action(() => | |||||
// { | |||||
// while (morkOrderPushes.Count > 0) | |||||
// { | |||||
// if (morkOrderPushes.TryDequeue(out MorkOrderPush mork)) | |||||
// { | |||||
// Thread.Sleep(3000); | |||||
// new OrderStatusChangedEvent() { Status = ORDER_STATUS.COOKING, SubOrderId = mork.SuborderId }.Publish(); | |||||
// Thread.Sleep(5000); | |||||
// new OrderStatusChangedEvent() { Status = ORDER_STATUS.COMPLETED_COOK, SubOrderId = mork.SuborderId }.Publish(); | |||||
// Thread.Sleep(5000); | |||||
// new OrderStatusChangedEvent() { Status = ORDER_STATUS.COMPLETED_TAKE, SubOrderId = mork.SuborderId }.Publish(); | |||||
// Thread.Sleep(2000); | |||||
// } | |||||
// } | |||||
// Thread.Sleep(1000); | |||||
// }), "sim order"); | |||||
//#endif | |||||
} | } | ||||
public void Start() | public void Start() | ||||
@@ -126,9 +107,6 @@ namespace BPASmartClient.Business | |||||
if (orders[deviceId].TryDequeue(out MorkOrderPush temp)) | if (orders[deviceId].TryDequeue(out MorkOrderPush temp)) | ||||
{ | { | ||||
if (InternetInfo.IsEnableTest) morkOrderPushes.Enqueue(temp); | if (InternetInfo.IsEnableTest) morkOrderPushes.Enqueue(temp); | ||||
//#if test | |||||
// morkOrderPushes.Enqueue(temp); | |||||
//#endif | |||||
var orderEvent = DoOrderEvent.Make(temp); | var orderEvent = DoOrderEvent.Make(temp); | ||||
orderEvent.DeviceId = device.DeviceId; | orderEvent.DeviceId = device.DeviceId; | ||||
orderEvent.Publish(); | orderEvent.Publish(); | ||||
@@ -14,7 +14,7 @@ | |||||
Background="{TemplateBinding Background}" | Background="{TemplateBinding Background}" | ||||
BorderBrush="{TemplateBinding BorderBrush}" | BorderBrush="{TemplateBinding BorderBrush}" | ||||
BorderThickness="{TemplateBinding BorderThickness}" /> | BorderThickness="{TemplateBinding BorderThickness}" /> | ||||
<Grid HorizontalAlignment="Center"> | |||||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal"> | |||||
<!--<Grid.ColumnDefinitions> | <!--<Grid.ColumnDefinitions> | ||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
@@ -35,7 +35,7 @@ | |||||
FontFamily="{TemplateBinding FontFamily}" | FontFamily="{TemplateBinding FontFamily}" | ||||
FontSize="{TemplateBinding FontSize}" | FontSize="{TemplateBinding FontSize}" | ||||
Foreground="{TemplateBinding Foreground}" /> | Foreground="{TemplateBinding Foreground}" /> | ||||
</Grid> | |||||
</StackPanel> | |||||
</Grid> | </Grid> | ||||
</ControlTemplate> | </ControlTemplate> | ||||
</Setter.Value> | </Setter.Value> | ||||
@@ -538,6 +538,7 @@ | |||||
<Setter Property="SelectedDateFormat" Value="Short" /> | <Setter Property="SelectedDateFormat" Value="Short" /> | ||||
<Setter Property="Background" Value="Transparent" /> | <Setter Property="Background" Value="Transparent" /> | ||||
<Setter Property="Padding" Value="2" /> | <Setter Property="Padding" Value="2" /> | ||||
<Setter Property="Height" Value="24"/> | |||||
<Setter Property="BorderBrush" Value="#08335f" /> | <Setter Property="BorderBrush" Value="#08335f" /> | ||||
<Setter Property="BorderThickness" Value="1" /> | <Setter Property="BorderThickness" Value="1" /> | ||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> | <Setter Property="HorizontalContentAlignment" Value="Stretch" /> | ||||
@@ -558,11 +559,11 @@ | |||||
<ControlTemplate x:Key="DropDownButtonTemplate" TargetType="{x:Type Button}"> | <ControlTemplate x:Key="DropDownButtonTemplate" TargetType="{x:Type Button}"> | ||||
<Grid> | <Grid> | ||||
<Grid | <Grid | ||||
Width="19" | |||||
Height="18" | |||||
Margin="0" | |||||
Width="15" | |||||
Height="15" | |||||
Margin="0,2,0,0" | |||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | |||||
VerticalAlignment="Top" | |||||
Background="#11FFFFFF" | Background="#11FFFFFF" | ||||
FlowDirection="LeftToRight"> | FlowDirection="LeftToRight"> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
@@ -2688,13 +2689,13 @@ | |||||
<Style TargetType="{x:Type TextBox}"> | <Style TargetType="{x:Type TextBox}"> | ||||
<Setter Property="BorderBrush" Value="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" /> | <Setter Property="BorderBrush" Value="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" /> | ||||
<Setter Property="BorderThickness" Value="1" /> | <Setter Property="BorderThickness" Value="1" /> | ||||
<Setter Property="Padding" Value="1" /> | |||||
<Setter Property="Padding" Value="0" /> | |||||
<Setter Property="Foreground" Value="{DynamicResource foreground}" /> | <Setter Property="Foreground" Value="{DynamicResource foreground}" /> | ||||
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" /> | <Setter Property="KeyboardNavigation.TabNavigation" Value="None" /> | ||||
<Setter Property="VerticalContentAlignment" Value="Center" /> | <Setter Property="VerticalContentAlignment" Value="Center" /> | ||||
<Setter Property="Height" Value="24" /> | <Setter Property="Height" Value="24" /> | ||||
<Setter Property="CaretBrush" Value="White" /> | <Setter Property="CaretBrush" Value="White" /> | ||||
<Setter Property="Padding" Value="10" /> | |||||
<Setter Property="Padding" Value="0" /> | |||||
<Setter Property="HorizontalContentAlignment" Value="Left" /> | <Setter Property="HorizontalContentAlignment" Value="Left" /> | ||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | <Setter Property="FocusVisualStyle" Value="{x:Null}" /> | ||||
<Setter Property="AllowDrop" Value="true" /> | <Setter Property="AllowDrop" Value="true" /> | ||||
@@ -110,8 +110,9 @@ namespace BPASmartClient.Device | |||||
/// <param name="info"></param> | /// <param name="info"></param> | ||||
public void DeviceProcessLogShow(string info) | public void DeviceProcessLogShow(string info) | ||||
{ | { | ||||
Log.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "流程", Text = info }); | |||||
Log.Insert(0,new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "流程", Text = info }); | |||||
MessageLog.GetInstance.DeviceProcessLogShow(DeviceId.ToString(), info); | MessageLog.GetInstance.DeviceProcessLogShow(DeviceId.ToString(), info); | ||||
if (Log.Count > 100) { Log.RemoveAt(Log.Count - 1);} | |||||
} | } | ||||
public void Initliaze() | public void Initliaze() | ||||
@@ -132,10 +133,6 @@ namespace BPASmartClient.Device | |||||
public virtual void StartMain() | public virtual void StartMain() | ||||
{ | { | ||||
#region 测试添加几个日志与告警 | #region 测试添加几个日志与告警 | ||||
Error.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "落碗", Text = "落碗异常" }); | |||||
Error.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "煮面机", Text = "煮面机温度异常" }); | |||||
Log.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "初始化", Text = "初始化已完成" }); | |||||
Log.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "启动中", Text = "已完成外设启动" }); | |||||
#endregion | #endregion | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -233,7 +230,7 @@ namespace BPASmartClient.Device | |||||
Type = res.Grade, | Type = res.Grade, | ||||
Text = res.Info | Text = res.Info | ||||
}; | }; | ||||
Error.Add(obj); | |||||
Error.Insert(0,obj); | |||||
AddErrorAction?.Invoke(DeviceId, obj); | AddErrorAction?.Invoke(DeviceId, obj); | ||||
} | } | ||||
}); | }); | ||||
@@ -353,7 +353,53 @@ namespace BPASmartClient.Helper | |||||
return LogConfig.GetLogConfigInstance().EnableThreadId; | return LogConfig.GetLogConfigInstance().EnableThreadId; | ||||
} | } | ||||
/// <summary> | |||||
/// 打开指定路径下文件 | |||||
/// </summary> | |||||
public void OpenFile(string NewFileName) | |||||
{ | |||||
Process process = new Process(); | |||||
ProcessStartInfo processStartInfo = new ProcessStartInfo(NewFileName); | |||||
process.StartInfo = processStartInfo; | |||||
#region 下面这段被注释掉代码(可以用来全屏打开代码) | |||||
//建立新的系统进程 | |||||
////System.Diagnostics.Process process = new System.Diagnostics.Process(); | |||||
//设置文件名,此处为图片的真实路径 + 文件名(需要有后缀) | |||||
////process.StartInfo.FileName = NewFileName; | |||||
//此为关键部分。设置进程运行参数,此时为最大化窗口显示图片。 | |||||
////process.StartInfo.Arguments = "rundll32.exe C://WINDOWS//system32//shimgvw.dll,ImageView_Fullscreen"; | |||||
// 此项为是否使用Shell执行程序,因系统默认为true,此项也可不设,但若设置必须为true | |||||
process.StartInfo.UseShellExecute = true; | |||||
#endregion | |||||
try | |||||
{ | |||||
process.Start(); | |||||
try | |||||
{ | |||||
// process.WaitForExit(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
throw ex; | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
throw ex; | |||||
} | |||||
finally | |||||
{ | |||||
try | |||||
{ | |||||
if (process != null) | |||||
{ | |||||
process.Close(); | |||||
process = null; | |||||
} | |||||
} | |||||
catch { } | |||||
} | |||||
} | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -0,0 +1,43 @@ | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.Model | |||||
{ | |||||
public class Book | |||||
{ | |||||
public string Name { get; set; } | |||||
public string Tag { get; set; } | |||||
} | |||||
public class BookEx : ObservableObject | |||||
{ | |||||
public Book BookN { get; private set; } | |||||
private bool _isChecked=false; | |||||
public bool IsChecked | |||||
{ | |||||
get | |||||
{ | |||||
return _isChecked; | |||||
} | |||||
set | |||||
{ | |||||
if (_isChecked != value) | |||||
{ | |||||
_isChecked = value; | |||||
OnPropertyChanged("IsChecked"); | |||||
} | |||||
} | |||||
} | |||||
public BookEx(Book book) | |||||
{ | |||||
BookN = book; | |||||
} | |||||
} | |||||
} |
@@ -12,6 +12,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" /> | <ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" /> | <ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.IoT\BPASmartClient.IoT.csproj" /> | <ProjectReference Include="..\BPASmartClient.IoT\BPASmartClient.IoT.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | <ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | ||||
@@ -0,0 +1,273 @@ | |||||
using BPASmartClient.CustomResource.UserControls; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.Model; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Collections.ObjectModel; | |||||
using System.ComponentModel; | |||||
using System.Data; | |||||
using System.IO; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Text.RegularExpressions; | |||||
using System.Threading.Tasks; | |||||
using System.Windows.Media; | |||||
namespace BPASmartClient.ViewModel | |||||
{ | |||||
/// <summary> | |||||
/// 告警/日志查询界面 | |||||
/// </summary> | |||||
public class LogOrAlarmViewModel : ObservableObject | |||||
{ | |||||
#region 单一变量 | |||||
private volatile static LogOrAlarmViewModel _Instance; | |||||
public static LogOrAlarmViewModel GetInstance() => _Instance ?? (_Instance = new LogOrAlarmViewModel()); | |||||
private LogOrAlarmViewModel() | |||||
{ | |||||
Init(); | |||||
} | |||||
#endregion | |||||
#region 变量 | |||||
string path = $"{System.AppDomain.CurrentDomain.BaseDirectory}LogDir\\HBL.LogDir2022_5_13.log"; | |||||
private string _SelectedText = ""; | |||||
public string SelectedText | |||||
{ | |||||
get | |||||
{ | |||||
return _SelectedText; | |||||
} | |||||
set | |||||
{ | |||||
if (_SelectedText == value) | |||||
return; | |||||
_SelectedText = value; | |||||
OnPropertyChanged("SelectedText"); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 时间条件 | |||||
/// </summary> | |||||
private DateTime _DateTime; | |||||
public DateTime DateTimeStr | |||||
{ | |||||
get | |||||
{ | |||||
return _DateTime; | |||||
} | |||||
set | |||||
{ | |||||
if (_DateTime == value) | |||||
return; | |||||
_DateTime = value; | |||||
OnPropertyChanged("DateTimeStr"); | |||||
} | |||||
} | |||||
public ObservableCollection<BookEx> SelectBookExs { set; get; } | |||||
private ObservableCollection<BookEx> _books; | |||||
public ObservableCollection<BookEx> BookExs | |||||
{ | |||||
get | |||||
{ | |||||
if (_books == null) | |||||
{ | |||||
_books = new ObservableCollection<BookEx>(); | |||||
_books.CollectionChanged += (sender, e) => | |||||
{ | |||||
if (e.OldItems != null) | |||||
{ | |||||
foreach (BookEx bookEx in e.OldItems) | |||||
{ | |||||
bookEx.PropertyChanged -= ItemPropertyChanged; | |||||
} | |||||
} | |||||
if (e.NewItems != null) | |||||
{ | |||||
foreach (BookEx bookEx in e.NewItems) | |||||
{ | |||||
bookEx.PropertyChanged += ItemPropertyChanged; | |||||
} | |||||
} | |||||
}; | |||||
} | |||||
return _books; | |||||
} | |||||
} | |||||
private ObservableCollection<LogModel> _LogModels; public ObservableCollection<LogModel> LogDataGrid | |||||
{ | |||||
get | |||||
{ | |||||
return _LogModels; | |||||
} | |||||
set | |||||
{ | |||||
if (_LogModels == value) | |||||
return; | |||||
_LogModels = value; | |||||
OnPropertyChanged("LogDataGrid"); | |||||
} | |||||
} | |||||
#endregion | |||||
#region Command | |||||
public RelayCommand QueryCommand { get; set; } | |||||
public RelayCommand OpenCommand { get; set; } | |||||
#endregion | |||||
#region 函数 | |||||
public void Init() | |||||
{ | |||||
LogDataGrid = new ObservableCollection<LogModel>(); | |||||
DateTimeStr = DateTime.Now; | |||||
BookExs.Add(new BookEx(new Book() { Name = "一般日志条件", Tag = "Info" }) { IsChecked = true }); | |||||
BookExs.Add(new BookEx(new Book() { Name = "设备日志条件", Tag = "DeviceLog" })); | |||||
BookExs.Add(new BookEx(new Book() { Name = "错误日志条件", Tag = "Error" })); | |||||
BookExs.Add(new BookEx(new Book() { Name = "设备告警条件", Tag = "DeviceAlarm" })); | |||||
SelectedText = "一般日志条件"; | |||||
SelectBookExs = new ObservableCollection<BookEx>(); | |||||
SelectBookExs.Add(new BookEx(new Book() { Name = "一般日志条件", Tag = "Info" }) { IsChecked = true }); | |||||
//查询 | |||||
QueryCommand = new RelayCommand(() => | |||||
{ | |||||
string sql = string.Empty; | |||||
if (SelectBookExs.Count <= 0) | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "提示", $"至少选中一个条件!"); | |||||
return; | |||||
} | |||||
SelectBookExs?.ToList().ForEach(par => | |||||
{ | |||||
if (string.IsNullOrEmpty(sql)) | |||||
sql += $"LOGGER='{par.BookN.Tag}'"; | |||||
else | |||||
sql += $" OR LOGGER='{par.BookN.Tag}'"; | |||||
}); | |||||
//1.找到某天的文件 | |||||
string path = $"{System.AppDomain.CurrentDomain.BaseDirectory}LogDir\\HBL.LogDir{DateTimeStr.ToString("yyyy_M_d")}.log"; | |||||
if (File.Exists(path)) | |||||
{ | |||||
LogDataGrid.Clear(); | |||||
//2.根据选中查询日志 | |||||
DataTable dataTable = ReadFile(path); | |||||
DataRow[] datas = dataTable.Select(sql); | |||||
if (datas.Count() <= 0) | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "提示", $"查询结果为空!"); | |||||
return; | |||||
} | |||||
foreach (DataRow item in datas) | |||||
{ | |||||
LogDataGrid.Add(new LogModel | |||||
{ | |||||
time = item["TIME"].ToString(), | |||||
type = item["LOGGER"].ToString(), | |||||
message = item["MESSAGE"].ToString(), | |||||
foreground = (item["LOGGER"].ToString() == "Error" || item["LOGGER"].ToString() == "DeviceAlarm") ? new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")) : new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e")) | |||||
}); | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "提示", $"文件不存在,{path}!"); | |||||
} | |||||
}); | |||||
//打开文件目录 | |||||
OpenCommand = new RelayCommand(() => | |||||
{ | |||||
System.Diagnostics.Process.Start("Explorer", "/select," + logHelper.GetLogConfigInstance().directRollfileAppender.File); | |||||
logHelper.GetLogConfigInstance().OpenFile(logHelper.GetLogConfigInstance().directRollfileAppender.File); | |||||
}); | |||||
} | |||||
/// <summary> | |||||
/// 查询告警或日志 | |||||
/// </summary> | |||||
/// <param name="time"></param> | |||||
/// <param name="info"></param> | |||||
public void QueryLogOrAlarm(DateTime time, string info) | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 读取文件 | |||||
/// </summary> | |||||
/// <param name="path"></param> | |||||
public DataTable ReadFile(string path) | |||||
{ | |||||
DataTable dt = new DataTable(); | |||||
dt.Columns.AddRange(new[] | |||||
{ | |||||
new DataColumn("TIME"), | |||||
new DataColumn("LOGGER"), | |||||
new DataColumn("NAME"), | |||||
new DataColumn("PRIORITY"), | |||||
new DataColumn("MESSAGE"), | |||||
}); | |||||
//读取文件 | |||||
string s = ""; | |||||
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) | |||||
{ | |||||
using (StreamReader sr = new StreamReader(fs, System.Text.Encoding.Default)) | |||||
{ | |||||
s = sr.ReadToEnd(); | |||||
} | |||||
} | |||||
//正则表达式匹配,注意RegexOptions.RightToLeft | |||||
var matches = Regex.Matches(s, @"(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([A-Z, ]{0,15}) ([A-Z,a-z]{0,20}) (\[\d{1}\]) (.*)", RegexOptions.RightToLeft); | |||||
foreach (Match m in matches) | |||||
{ | |||||
var time = m.Groups[1].Value; | |||||
var logger = m.Groups[2].Value; | |||||
var name = m.Groups[3].Value; | |||||
var priority = m.Groups[4].Value; | |||||
var msg = m.Groups[5].Value; | |||||
var dr = dt.NewRow(); | |||||
dr.ItemArray = new[] { time, logger, name, priority, msg }; | |||||
dt.Rows.InsertAt(dr, 0); | |||||
} | |||||
return dt; | |||||
} | |||||
/// <summary> | |||||
/// 选中改变 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void ItemPropertyChanged(object sender, PropertyChangedEventArgs e) | |||||
{ | |||||
if (e.PropertyName == "IsChecked") | |||||
{ | |||||
BookEx bookEx = sender as BookEx; | |||||
if (bookEx != null) | |||||
{ | |||||
IEnumerable<BookEx> bookExs = BookExs.Where(b => b.IsChecked == true); | |||||
StringBuilder builder = new StringBuilder(); | |||||
SelectBookExs.Clear(); | |||||
foreach (BookEx item in bookExs) | |||||
{ | |||||
builder.Append(item.BookN.Name + " "); | |||||
SelectBookExs.Add((BookEx)item); | |||||
} | |||||
SelectedText = builder == null ? string.Empty : builder.ToString(); | |||||
} | |||||
} | |||||
} | |||||
#endregion | |||||
} | |||||
} |
@@ -23,10 +23,10 @@ namespace BPASmartClient.ViewModel | |||||
/// </summary> | /// </summary> | ||||
public class LogViewModel : ObservableObject | public class LogViewModel : ObservableObject | ||||
{ | { | ||||
#region 变量 | |||||
public DispatcherTimer dispatcherTimer; | public DispatcherTimer dispatcherTimer; | ||||
public string ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | public string ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | ||||
private ObservableCollection<LogModel> _LogModels; | |||||
public ObservableCollection<LogModel> LogDataGrid | |||||
private ObservableCollection<LogModel> _LogModels;public ObservableCollection<LogModel> LogDataGrid | |||||
{ | { | ||||
get | get | ||||
{ | { | ||||
@@ -40,13 +40,53 @@ namespace BPASmartClient.ViewModel | |||||
OnPropertyChanged("LogDataGrid"); | OnPropertyChanged("LogDataGrid"); | ||||
} | } | ||||
} | } | ||||
private bool _RealTimeModel = true;public bool RealTimeModel | |||||
{ | |||||
get | |||||
{ | |||||
return _RealTimeModel; | |||||
} | |||||
set | |||||
{ | |||||
if (_RealTimeModel == value) | |||||
return; | |||||
_RealTimeModel = value; | |||||
OnPropertyChanged("RealTimeModel"); | |||||
} | |||||
} | |||||
private bool _TimedClear = true;public bool TimedClear | |||||
{ | |||||
get | |||||
{ | |||||
return _TimedClear; | |||||
} | |||||
set | |||||
{ | |||||
if (_TimedClear == value) | |||||
return; | |||||
_TimedClear = value; | |||||
OnPropertyChanged("TimedClear"); | |||||
} | |||||
} | |||||
#endregion | |||||
#region 单一 | |||||
private volatile static LogViewModel _Instance; | private volatile static LogViewModel _Instance; | ||||
public static LogViewModel GetInstance() => _Instance ?? (_Instance = new LogViewModel()); | public static LogViewModel GetInstance() => _Instance ?? (_Instance = new LogViewModel()); | ||||
private LogViewModel() | private LogViewModel() | ||||
{ | { | ||||
logHelper.Fun_InitLog(System.AppDomain.CurrentDomain.BaseDirectory); | |||||
if (LogDataGrid == null) LogDataGrid = new ObservableCollection<LogModel>(); | |||||
Init(); | |||||
} | |||||
#endregion | |||||
#region 函数 | |||||
/// <summary> | |||||
/// 初始化 | |||||
/// </summary> | |||||
public void Init() | |||||
{ | |||||
if (LogDataGrid == null) LogDataGrid = new ObservableCollection<LogModel>(); | |||||
logHelper.Fun_InitLog(System.AppDomain.CurrentDomain.BaseDirectory); | |||||
//一般日志 | //一般日志 | ||||
MessageLog.GetInstance.InfoNotify = new Action<string>((s) => | MessageLog.GetInstance.InfoNotify = new Action<string>((s) => | ||||
{ | { | ||||
@@ -56,17 +96,15 @@ namespace BPASmartClient.ViewModel | |||||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO, s); | logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO, s); | ||||
})); | })); | ||||
}); | }); | ||||
//设备日志 | //设备日志 | ||||
MessageLog.GetInstance.DeviceProcessLogNotify = new Action<string, string>((id, s) => | MessageLog.GetInstance.DeviceProcessLogNotify = new Action<string, string>((id, s) => | ||||
{ | |||||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||||
{ | |||||
LogDataGrid.Insert(0, new LogModel { message = s, type = "DeviceLog" }); | |||||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.DEBUG, s); | |||||
})); | |||||
}); | |||||
{ | |||||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||||
{ | |||||
LogDataGrid.Insert(0, new LogModel { message = s, type = "DeviceLog" }); | |||||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.DEBUG, s); | |||||
})); | |||||
}); | |||||
//设备告警日志 | //设备告警日志 | ||||
MessageLog.GetInstance.DeviceAlarmLogNotify = new Action<string, string>((id, s) => | MessageLog.GetInstance.DeviceAlarmLogNotify = new Action<string, string>((id, s) => | ||||
{ | { | ||||
@@ -76,7 +114,6 @@ namespace BPASmartClient.ViewModel | |||||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.WARN, id); | logHelper.GetLogConfigInstance().WriteLog(LogLevel.WARN, id); | ||||
})); | })); | ||||
}); | }); | ||||
//错误日志 | //错误日志 | ||||
MessageLog.GetInstance.ExInfoNotify = new Action<string>((s) => | MessageLog.GetInstance.ExInfoNotify = new Action<string>((s) => | ||||
{ | { | ||||
@@ -106,10 +143,10 @@ namespace BPASmartClient.ViewModel | |||||
if (System.Windows.MessageBox.Show(msg, "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) | if (System.Windows.MessageBox.Show(msg, "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) | ||||
{ | { | ||||
System.Diagnostics.Process.Start("Explorer", "/select," + logHelper.GetLogConfigInstance().directRollfileAppender.File); | System.Diagnostics.Process.Start("Explorer", "/select," + logHelper.GetLogConfigInstance().directRollfileAppender.File); | ||||
OpenFile(logHelper.GetLogConfigInstance().directRollfileAppender.File); | |||||
}else | |||||
logHelper.GetLogConfigInstance().OpenFile(logHelper.GetLogConfigInstance().directRollfileAppender.File); | |||||
} | |||||
else | |||||
System.Diagnostics.Process.Start("Explorer", "/select," + logHelper.GetLogConfigInstance().directRollfileAppender.File); | System.Diagnostics.Process.Start("Explorer", "/select," + logHelper.GetLogConfigInstance().directRollfileAppender.File); | ||||
}); | }); | ||||
dispatcherTimer = new DispatcherTimer(); | dispatcherTimer = new DispatcherTimer(); | ||||
@@ -127,7 +164,6 @@ namespace BPASmartClient.ViewModel | |||||
dispatcherTimer.Interval = TimeSpan.FromSeconds(10); | dispatcherTimer.Interval = TimeSpan.FromSeconds(10); | ||||
dispatcherTimer.Start(); | dispatcherTimer.Start(); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 导出数据 | /// 导出数据 | ||||
/// </summary> | /// </summary> | ||||
@@ -167,104 +203,24 @@ namespace BPASmartClient.ViewModel | |||||
string msg = string.Format("记录导出完成,共导出记录{0}条,是否打开!", LogDataGrid.Count); | string msg = string.Format("记录导出完成,共导出记录{0}条,是否打开!", LogDataGrid.Count); | ||||
if (System.Windows.MessageBox.Show(msg, "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) | if (System.Windows.MessageBox.Show(msg, "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) | ||||
{ | { | ||||
OpenFile(openfile.FileName); | |||||
logHelper.GetLogConfigInstance().OpenFile(openfile.FileName); | |||||
} | } | ||||
} | } | ||||
else | else | ||||
System.Windows.MessageBox.Show("无数据!"); | System.Windows.MessageBox.Show("无数据!"); | ||||
} | } | ||||
#endregion | |||||
/// <summary> | |||||
/// 打开指定路径下文件,比如:Word、Excel、Dll、图片等都可以(前提是你已经安装打开程序的对应软件) | |||||
/// </summary> | |||||
/// <param name="NewFileName">eg:D:\Test\模版8.doc</param> | |||||
/// <param name="NewFileName">eg:D:\Test\模版8.doc</param> | |||||
private void OpenFile(string NewFileName) | |||||
{ | |||||
Process process = new Process(); | |||||
ProcessStartInfo processStartInfo = new ProcessStartInfo(NewFileName); | |||||
process.StartInfo = processStartInfo; | |||||
#region 下面这段被注释掉代码(可以用来全屏打开代码) | |||||
//建立新的系统进程 | |||||
////System.Diagnostics.Process process = new System.Diagnostics.Process(); | |||||
//设置文件名,此处为图片的真实路径 + 文件名(需要有后缀) | |||||
////process.StartInfo.FileName = NewFileName; | |||||
//此为关键部分。设置进程运行参数,此时为最大化窗口显示图片。 | |||||
////process.StartInfo.Arguments = "rundll32.exe C://WINDOWS//system32//shimgvw.dll,ImageView_Fullscreen"; | |||||
// 此项为是否使用Shell执行程序,因系统默认为true,此项也可不设,但若设置必须为true | |||||
process.StartInfo.UseShellExecute = true; | |||||
#endregion | |||||
try | |||||
{ | |||||
process.Start(); | |||||
try | |||||
{ | |||||
// process.WaitForExit(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
throw ex; | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
throw ex; | |||||
} | |||||
finally | |||||
{ | |||||
try | |||||
{ | |||||
if (process != null) | |||||
{ | |||||
process.Close(); | |||||
process = null; | |||||
} | |||||
} | |||||
catch { } | |||||
} | |||||
} | |||||
private bool _RealTimeModel = true; | |||||
public bool RealTimeModel | |||||
{ | |||||
get | |||||
{ | |||||
return _RealTimeModel; | |||||
} | |||||
set | |||||
{ | |||||
if (_RealTimeModel == value) | |||||
return; | |||||
_RealTimeModel = value; | |||||
OnPropertyChanged("RealTimeModel"); | |||||
} | |||||
} | |||||
private bool _TimedClear = true; | |||||
public bool TimedClear | |||||
{ | |||||
get | |||||
{ | |||||
return _TimedClear; | |||||
} | |||||
set | |||||
{ | |||||
if (_TimedClear == value) | |||||
return; | |||||
_TimedClear = value; | |||||
OnPropertyChanged("TimedClear"); | |||||
} | |||||
} | |||||
#region Command | |||||
public RelayCommand ExcelCommand { get; set; } | public RelayCommand ExcelCommand { get; set; } | ||||
public RelayCommand OpenCommand { get; set; } | public RelayCommand OpenCommand { get; set; } | ||||
#endregion | |||||
} | } | ||||
public class LogModel : ObservableObject | public class LogModel : ObservableObject | ||||
{ | { | ||||
public string time { get; set; } | public string time { get; set; } | ||||
private string _type; | private string _type; | ||||
public string type | public string type | ||||
{ | { | ||||
@@ -280,10 +236,10 @@ namespace BPASmartClient.ViewModel | |||||
if (_type == "Error") foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")); | if (_type == "Error") foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")); | ||||
OnPropertyChanged("type"); | OnPropertyChanged("type"); | ||||
OnPropertyChanged("foreground"); | |||||
} | } | ||||
} | } | ||||
public string message { get; set; } | public string message { get; set; } | ||||
private Brush _foreground; | private Brush _foreground; | ||||
public Brush foreground | public Brush foreground | ||||
{ | { | ||||
@@ -42,9 +42,13 @@ namespace BPASmartClient.ViewModel | |||||
/// 是否告警 | /// 是否告警 | ||||
/// </summary> | /// </summary> | ||||
public AlarmModel IsAlarm { get; set; } | public AlarmModel IsAlarm { get; set; } | ||||
public System.Windows.Window window; | |||||
public DispatcherTimer dispatcherTimer; | public DispatcherTimer dispatcherTimer; | ||||
#region 单一 | |||||
private volatile static MainViewModel _Instance; | |||||
public static MainViewModel GetInstance() => _Instance ?? (_Instance = new MainViewModel()); | |||||
#endregion | |||||
public MainViewModel() | public MainViewModel() | ||||
{ | { | ||||
@@ -63,9 +63,6 @@ namespace BPASmartClient.ViewModel | |||||
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | ||||
}; | }; | ||||
observableCollection.Add(morkOrder); | observableCollection.Add(morkOrder); | ||||
//var res = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.DeviceId == device.ToString()); | |||||
//if (res == null) | |||||
//{ | |||||
Application.Current?.Dispatcher.BeginInvoke((Action)delegate | Application.Current?.Dispatcher.BeginInvoke((Action)delegate | ||||
{ | { | ||||
int index = Array.FindIndex(Json<KeepDataBase>.Data.orderLists.ToArray(), p => p.DeviceId == device.DeviceId.ToString()); | int index = Array.FindIndex(Json<KeepDataBase>.Data.orderLists.ToArray(), p => p.DeviceId == device.DeviceId.ToString()); | ||||
@@ -91,11 +88,6 @@ namespace BPASmartClient.ViewModel | |||||
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | ||||
}); | }); | ||||
}); | }); | ||||
//} | |||||
//else | |||||
//{ | |||||
// res.morkOrderPushes.Add(new MorkOrder() { OrderPush = morkOrderpush }); | |||||
//} | |||||
} | } | ||||
} | } | ||||
@@ -103,56 +95,114 @@ namespace BPASmartClient.ViewModel | |||||
}), "AddOrder"); | }), "AddOrder"); | ||||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||||
EventBus.EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle); | |||||
//ActionManage.GetInstance.Register(new Action<object>((o) => | |||||
//{ | |||||
// if (o is OrderStatusChangedEvent orderStatusChange) | |||||
// { | |||||
// int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId); | |||||
// switch (orderStatusChange.Status) | |||||
// { | |||||
// case ORDER_STATUS.COOKING: | |||||
// if (index >= 0 && index < orderStatusLists.Count) | |||||
// orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status; | |||||
// break; | |||||
// case ORDER_STATUS.COMPLETED_COOK: | |||||
// if (index >= 0 && index < orderStatusLists.Count) | |||||
// { | |||||
// Application.Current.Dispatcher.BeginInvoke((Action)delegate | |||||
// { | |||||
// orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status; | |||||
// orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss"); | |||||
// TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate)); | |||||
// orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S"; | |||||
// //压力测试时注释,正常使用需要取消注释 | |||||
// if (!BPASmartClient.Business.InternetInfo.IsEnableTest) | |||||
// { | |||||
// WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index)); | |||||
// orderStatusLists.RemoveAt(index); | |||||
// } | |||||
// }); | |||||
// } | |||||
// break; | |||||
// case ORDER_STATUS.COMPLETED_TAKE: | |||||
// if (BPASmartClient.Business.InternetInfo.IsEnableTest) | |||||
// orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status; | |||||
// //压力测试时注释,正常使用需要取消注释 | |||||
// var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId); | |||||
// if (re != null) | |||||
// { | |||||
// Application.Current.Dispatcher.BeginInvoke((Action)delegate | |||||
// { | |||||
// WaitTakeMeal.Remove(re); | |||||
// var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null); | |||||
// if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj); | |||||
// }); | |||||
// } | |||||
// break; | |||||
// default: | |||||
// break; | |||||
// } | |||||
// } | |||||
//}), "OrderStatusChange"); | |||||
} | |||||
private static void OrderStatusChangedHandle(IEvent @event, EventBus.EventBus.EventCallBackHandle callBack) | |||||
{ | |||||
OrderStatusChangedEvent orderStatusChange = @event as OrderStatusChangedEvent; | |||||
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId); | |||||
switch (orderStatusChange.Status) | |||||
{ | { | ||||
if (o is OrderStatusChangedEvent orderStatusChange) | |||||
{ | |||||
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId); | |||||
switch (orderStatusChange.Status) | |||||
case ORDER_STATUS.COOKING: | |||||
if (index >= 0 && index < orderStatusLists.Count) | |||||
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status; | |||||
break; | |||||
case ORDER_STATUS.COMPLETED_COOK: | |||||
if (index >= 0 && index < orderStatusLists.Count) | |||||
{ | { | ||||
case ORDER_STATUS.COOKING: | |||||
if (index >= 0 && index < orderStatusLists.Count) | |||||
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status; | |||||
break; | |||||
case ORDER_STATUS.COMPLETED_COOK: | |||||
if (index >= 0 && index < orderStatusLists.Count) | |||||
{ | |||||
Application.Current.Dispatcher.BeginInvoke((Action)delegate | |||||
{ | |||||
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status; | |||||
orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss"); | |||||
TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate)); | |||||
orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S"; | |||||
//压力测试时注释,正常使用需要取消注释 | |||||
//WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index)); | |||||
//orderStatusLists.RemoveAt(index); | |||||
}); | |||||
} | |||||
break; | |||||
case ORDER_STATUS.COMPLETED_TAKE: | |||||
Application.Current.Dispatcher.BeginInvoke((Action)delegate | |||||
{ | |||||
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status; | orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status; | ||||
orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss"); | |||||
TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate)); | |||||
orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S"; | |||||
//压力测试时注释,正常使用需要取消注释 | //压力测试时注释,正常使用需要取消注释 | ||||
//var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId); | |||||
//if (re != null) | |||||
//{ | |||||
// Application.Current.Dispatcher.BeginInvoke((Action)delegate | |||||
// { | |||||
// WaitTakeMeal.Remove(re); | |||||
// var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null); | |||||
// if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj); | |||||
// }); | |||||
//} | |||||
break; | |||||
default: | |||||
break; | |||||
if (!BPASmartClient.Business.InternetInfo.IsEnableTest) | |||||
{ | |||||
WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index)); | |||||
orderStatusLists.RemoveAt(index); | |||||
} | |||||
}); | |||||
} | } | ||||
} | |||||
}), "OrderStatusChange"); | |||||
} | |||||
break; | |||||
case ORDER_STATUS.COMPLETED_TAKE: | |||||
if (BPASmartClient.Business.InternetInfo.IsEnableTest) | |||||
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status; | |||||
//压力测试时注释,正常使用需要取消注释 | |||||
var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId); | |||||
if (re != null) | |||||
{ | |||||
Application.Current.Dispatcher.BeginInvoke((Action)delegate | |||||
{ | |||||
WaitTakeMeal.Remove(re); | |||||
var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null); | |||||
if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj); | |||||
}); | |||||
} | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
} | |||||
} | } | ||||
} | } |
@@ -3,7 +3,7 @@ | |||||
<appSettings> | <appSettings> | ||||
<!--通用配置--> | <!--通用配置--> | ||||
<!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺--> | <!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺--> | ||||
<add key="ClientId" value="2"/> | |||||
<add key="ClientId" value="46"/> | |||||
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/> | <!--<add key="ApolloUri" value="http://10.2.1.21:28080"/> | ||||
<add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/> | <add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/> | ||||
<add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>--> | <add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>--> | ||||
@@ -15,16 +15,19 @@ | |||||
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/> | <!--<add key="ApolloUri" value="http://10.2.1.21:28080"/> | ||||
<add key="OrderServiceUri" value="https://bpa.black-pa.com:21527/order/"/> | <add key="OrderServiceUri" value="https://bpa.black-pa.com:21527/order/"/> | ||||
<add key="StockServiceUri" value="https://bpa.black-pa.com:21527/stock/"/> | <add key="StockServiceUri" value="https://bpa.black-pa.com:21527/stock/"/> | ||||
<add key="DataVServiceUri" value="https://bpa.black-pa.com:21527/datav"/>--> | |||||
<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="AppId" value="order"/> | <add key="AppId" value="order"/> | ||||
<add key ="Namespaces" value="TEST1.Config"/> | <add key ="Namespaces" value="TEST1.Config"/> | ||||
<add key="IsEnableTest" value="False"/> | |||||
<add key="IsEnableTest" value="false"/> | |||||
<!--测试环境--> | <!--测试环境--> | ||||
<!--<add key="ApolloUri" value="http://10.2.1.21:28070"/> | <!--<add key="ApolloUri" value="http://10.2.1.21:28070"/> | ||||
<add key="OrderServiceUri" value="https://bpa.black-pa.com:21528/order/"/> | <add key="OrderServiceUri" value="https://bpa.black-pa.com:21528/order/"/> | ||||
<add key="StockServiceUri" value="https://bpa.black-pa.com:21528/stock/"/> | <add key="StockServiceUri" value="https://bpa.black-pa.com:21528/stock/"/> | ||||
<add key="DataVServiceUri" value="https://bpa.black-pa.com:21527/datav"/> | <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="BroadcastPubTopic" value="/broadcast/grgpECHSL7q/Transit_Test_SetDevice"/> | ||||
<add key="AppId" value="dev1_common"/> | <add key="AppId" value="dev1_common"/> | ||||
<add key ="Namespaces" value="DEV.test1.Config"/>--> | <add key ="Namespaces" value="DEV.test1.Config"/>--> | ||||
@@ -34,16 +37,17 @@ | |||||
<add key="OrderServiceUri" value="https://witt.black-pa.com/order/"/> | <add key="OrderServiceUri" value="https://witt.black-pa.com/order/"/> | ||||
<add key="StockServiceUri" value="https://witt.black-pa.com/stock/"/> | <add key="StockServiceUri" value="https://witt.black-pa.com/stock/"/> | ||||
<add key="DataVServiceUri" value="https://witt.black-pa.com/datav"/> | <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="BroadcastPubTopic" value="/broadcast/grgpECHSL7q/Transit_SetDevice"/> | ||||
<!--阿里云上报启动方式:API 或者 LOCAL--> | |||||
<!--阿里云上报启动方式:API 或者 LOCAL--> | |||||
<!--API :通过客户端ID,调用接口查询“设备连接信息”--> | <!--API :通过客户端ID,调用接口查询“设备连接信息”--> | ||||
<!--LOCAL:直接使用下方本地“设备连接信息”--> | <!--LOCAL:直接使用下方本地“设备连接信息”--> | ||||
<add key="StartupMode" value="API"/> | <add key="StartupMode" value="API"/> | ||||
<add key="ProductKey" value="grgpECHSL7q"/> | <add key="ProductKey" value="grgpECHSL7q"/> | ||||
<add key="DeviceName" value="qsqd"/> | <add key="DeviceName" value="qsqd"/> | ||||
<add key="DeviceSecret" value="3c0f2390943bff4fece523af22655196"/> | <add key="DeviceSecret" value="3c0f2390943bff4fece523af22655196"/> | ||||
<!--外设配置--> | <!--外设配置--> | ||||
<add key="COM_Coffee" value="COM3"/> | <add key="COM_Coffee" value="COM3"/> | ||||
@@ -11,7 +11,6 @@ | |||||
<wv2:WebView2 | <wv2:WebView2 | ||||
Name="webView" | Name="webView" | ||||
Width="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualWidth}" | Width="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualWidth}" | ||||
Height="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualHeight}" | |||||
Source="http://1.14.74.54:8808/welcome" /> | |||||
Height="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualHeight}" /> | |||||
</Grid> | </Grid> | ||||
</UserControl> | </UserControl> |
@@ -23,6 +23,8 @@ namespace BPASmartClient.Control | |||||
public BatchingAddView() | public BatchingAddView() | ||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
webView.Source=new Uri(System.Configuration.ConfigurationManager.AppSettings["WebServiceUri"].ToString()); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -4,6 +4,7 @@ | |||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||
xmlns:local="clr-namespace:BPASmartClient.Control" | xmlns:local="clr-namespace:BPASmartClient.Control" | ||||
xmlns:k="clr-namespace:BPASmartClient.Model;assembly=BPASmartClient.Model" | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
d:DesignHeight="450" | d:DesignHeight="450" | ||||
d:DesignWidth="800" | d:DesignWidth="800" | ||||
@@ -20,115 +21,62 @@ | |||||
<Grid> | <Grid> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="45" /> | <RowDefinition Height="45" /> | ||||
<RowDefinition /> | |||||
<RowDefinition Height="*" /> | |||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<!-- 查询按钮栏 --> | <!-- 查询按钮栏 --> | ||||
<StackPanel Margin="10,0,10,0" Orientation="Horizontal"> | <StackPanel Margin="10,0,10,0" Orientation="Horizontal"> | ||||
<ComboBox Width="80" SelectedIndex="0"> | |||||
<ComboBoxItem>一般日志</ComboBoxItem> | |||||
<ComboBoxItem>错误日志</ComboBoxItem> | |||||
<ComboBoxItem>告警信息</ComboBoxItem> | |||||
<ComboBox Width="120" Text="{Binding SelectedText}" IsEditable="True" ItemsSource="{Binding Path=BookExs}"> | |||||
<ComboBox.ItemTemplate> | |||||
<DataTemplate DataType="{x:Type k:BookEx}"> | |||||
<StackPanel Orientation="Horizontal"> | |||||
<CheckBox IsChecked="{Binding IsChecked}" Margin="2,0,3,0" Background="Red" Content="{Binding BookN.Name}" /> | |||||
</StackPanel> | |||||
</DataTemplate> | |||||
</ComboBox.ItemTemplate> | |||||
</ComboBox> | </ComboBox> | ||||
<Button Margin="10,0,0,0">查询</Button> | |||||
<Button Margin="10,0,0,0">导出</Button> | |||||
<CheckBox Margin="10,0,0,0" IsChecked="True">实时模式</CheckBox> | |||||
<CheckBox Margin="10,0,0,0" IsChecked="True">定时清除</CheckBox> | |||||
<DatePicker Margin="10,0,10,0" Text="{Binding DateTimeStr,Mode=TwoWay,NotifyOnTargetUpdated=True}"></DatePicker> | |||||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding QueryCommand}" Style="{DynamicResource CommonBtn_返回}" Width="75">查询数据</Button> | |||||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding OpenCommand}" Style="{DynamicResource CommonBtn_返回}" Width="102">打开文件目录</Button> | |||||
</StackPanel> | </StackPanel> | ||||
<!-- 表格栏 --> | <!-- 表格栏 --> | ||||
<Grid Grid.Row="1"> | <Grid Grid.Row="1"> | ||||
<DataGrid | |||||
x:Name="datagrid" | |||||
Grid.Row="2" | |||||
Margin="10" | |||||
ItemsSource="{Binding EquiPment1, UpdateSourceTrigger=PropertyChanged}"> | |||||
<DataGrid Margin="10" ItemsSource="{Binding LogDataGrid, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2"> | |||||
<DataGrid.Columns> | <DataGrid.Columns> | ||||
<DataGridTemplateColumn Width="2*" Header="紧急程度"> | |||||
<DataGridTemplateColumn.CellTemplate> | |||||
<DataTemplate> | |||||
<Ellipse | |||||
Width="12" | |||||
Height="12" | |||||
Fill="{Binding color, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | |||||
ToolTip="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> | |||||
</DataTemplate> | |||||
</DataGridTemplateColumn.CellTemplate> | |||||
</DataGridTemplateColumn> | |||||
<DataGridTemplateColumn Width="4.4*" Header="报警时间或恢复时间"> | |||||
<DataGridTemplateColumn.CellTemplate> | |||||
<DataTemplate> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
Foreground="#00ccff" | |||||
Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> | |||||
</DataTemplate> | |||||
</DataGridTemplateColumn.CellTemplate> | |||||
</DataGridTemplateColumn> | |||||
<DataGridTemplateColumn Width="4.4*" Header="类型"> | |||||
<DataGridTemplateColumn.CellTemplate> | |||||
<DataTemplate> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
Foreground="#00ccff" | |||||
Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> | |||||
</DataTemplate> | |||||
</DataGridTemplateColumn.CellTemplate> | |||||
</DataGridTemplateColumn> | |||||
<DataGridTemplateColumn Width="4.4*" Header="状态"> | |||||
<DataGridTemplateColumn Header="日志时间" Width="300"> | |||||
<DataGridTemplateColumn.CellTemplate> | <DataGridTemplateColumn.CellTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
Foreground="#00ccff" | |||||
Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> | |||||
<TextBlock HorizontalAlignment="Center" Text="{Binding time, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||||
</DataTemplate> | </DataTemplate> | ||||
</DataGridTemplateColumn.CellTemplate> | </DataGridTemplateColumn.CellTemplate> | ||||
</DataGridTemplateColumn> | </DataGridTemplateColumn> | ||||
<DataGridTemplateColumn Width="4.4*" Header="变量名"> | |||||
<DataGridTemplateColumn.CellTemplate> | |||||
<DataTemplate> | |||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
Foreground="#00ccff" | |||||
Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> | |||||
</DataTemplate> | |||||
</DataGridTemplateColumn.CellTemplate> | |||||
</DataGridTemplateColumn> | |||||
<DataGridTemplateColumn Width="4.4*" Header="报警值或恢复值"> | |||||
<!--<DataGridTemplateColumn Header="设备ID" Width="100"> | |||||
<DataGridTemplateColumn.CellTemplate> | <DataGridTemplateColumn.CellTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
Foreground="#00ccff" | |||||
Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> | |||||
<TextBlock HorizontalAlignment="Center" Text="{Binding deviceId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||||
</DataTemplate> | </DataTemplate> | ||||
</DataGridTemplateColumn.CellTemplate> | </DataGridTemplateColumn.CellTemplate> | ||||
</DataGridTemplateColumn> | |||||
<DataGridTemplateColumn Width="4.4*" Header="参考值"> | |||||
</DataGridTemplateColumn>--> | |||||
<DataGridTemplateColumn Header="日志类型" Width="300"> | |||||
<DataGridTemplateColumn.CellTemplate> | <DataGridTemplateColumn.CellTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
Foreground="#00ccff" | |||||
Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> | |||||
<TextBlock HorizontalAlignment="Center" Text="{Binding type, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||||
</DataTemplate> | </DataTemplate> | ||||
</DataGridTemplateColumn.CellTemplate> | </DataGridTemplateColumn.CellTemplate> | ||||
</DataGridTemplateColumn> | </DataGridTemplateColumn> | ||||
<DataGridTemplateColumn Width="2*" Header="操作"> | |||||
<DataGridTemplateColumn Header="日志内容" Width="*"> | |||||
<DataGridTemplateColumn.CellTemplate> | <DataGridTemplateColumn.CellTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
<TextBlock | |||||
HorizontalAlignment="Center" | |||||
Foreground="#00ccff" | |||||
Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> | |||||
<TextBlock HorizontalAlignment="Left" Text="{Binding message, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||||
</DataTemplate> | </DataTemplate> | ||||
</DataGridTemplateColumn.CellTemplate> | </DataGridTemplateColumn.CellTemplate> | ||||
</DataGridTemplateColumn> | </DataGridTemplateColumn> | ||||
</DataGrid.Columns> | </DataGrid.Columns> | ||||
</DataGrid> | </DataGrid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</UserControl> | </UserControl> |
@@ -1,4 +1,5 @@ | |||||
using System; | |||||
using BPASmartClient.ViewModel; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
@@ -23,6 +24,17 @@ namespace BPASmartClient.Control | |||||
public LogOrAlarmView() | public LogOrAlarmView() | ||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
this.DataContext = LogOrAlarmViewModel.GetInstance(); | |||||
} | |||||
private void CheckBox_Checked(object sender, RoutedEventArgs e) | |||||
{ | |||||
} | |||||
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) | |||||
{ | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -27,8 +27,8 @@ | |||||
<StackPanel Orientation="Horizontal" Margin="10,0,10,0"> | <StackPanel Orientation="Horizontal" Margin="10,0,10,0"> | ||||
<!--<CheckBox Margin="10,0,0,0" IsChecked="{Binding RealTimeModel, UpdateSourceTrigger=PropertyChanged}" >实时模式</CheckBox> | <!--<CheckBox Margin="10,0,0,0" IsChecked="{Binding RealTimeModel, UpdateSourceTrigger=PropertyChanged}" >实时模式</CheckBox> | ||||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding TimedClear, UpdateSourceTrigger=PropertyChanged}">定时清除</CheckBox>--> | <CheckBox Margin="10,0,0,0" IsChecked="{Binding TimedClear, UpdateSourceTrigger=PropertyChanged}">定时清除</CheckBox>--> | ||||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding ExcelCommand}">导出日志</Button> | |||||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding OpenCommand}">打开文件</Button> | |||||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding ExcelCommand}" Style="{DynamicResource CommonBtn_返回}" Width="75">导出日志</Button> | |||||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding OpenCommand}" Style="{DynamicResource CommonBtn_返回}" Width="75">打开文件</Button> | |||||
</StackPanel> | </StackPanel> | ||||
<!--表格栏--> | <!--表格栏--> | ||||
@@ -36,7 +36,7 @@ | |||||
<Grid> | <Grid> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition /> | <RowDefinition /> | ||||
<RowDefinition /> | |||||
<!--<RowDefinition />--> | |||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<!--#region 制作中的订单列表--> | <!--#region 制作中的订单列表--> | ||||
@@ -118,8 +118,8 @@ | |||||
<!--#region 表格数据显示--> | <!--#region 表格数据显示--> | ||||
<ScrollViewer | <ScrollViewer | ||||
Grid.Row="1" | Grid.Row="1" | ||||
HorizontalScrollBarVisibility="Hidden" | |||||
VerticalScrollBarVisibility="Hidden"> | |||||
HorizontalScrollBarVisibility="Visible" | |||||
VerticalScrollBarVisibility="Visible"> | |||||
<ItemsControl ItemsSource="{Binding orderStatusLists}"> | <ItemsControl ItemsSource="{Binding orderStatusLists}"> | ||||
<ItemsControl.ItemTemplate> | <ItemsControl.ItemTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
@@ -206,7 +206,7 @@ | |||||
<!--#region 表格标题栏设置--> | <!--#region 表格标题栏设置--> | ||||
<Grid Background="#dd2AB2E7"> | |||||
<!--<Grid Background="#dd2AB2E7"> | |||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="0.3*" /> | <ColumnDefinition Width="0.3*" /> | ||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
@@ -271,13 +271,13 @@ | |||||
Foreground="{StaticResource TitleFontColor}" | Foreground="{StaticResource TitleFontColor}" | ||||
Text="完成时间" /> | Text="完成时间" /> | ||||
</Grid> | |||||
</Grid>--> | |||||
<!--#endregion--> | <!--#endregion--> | ||||
<!--#region 表格数据显示--> | <!--#region 表格数据显示--> | ||||
<ScrollViewer | |||||
<!--<ScrollViewer | |||||
Grid.Row="1" | Grid.Row="1" | ||||
HorizontalScrollBarVisibility="Hidden" | HorizontalScrollBarVisibility="Hidden" | ||||
VerticalScrollBarVisibility="Hidden"> | VerticalScrollBarVisibility="Hidden"> | ||||
@@ -352,7 +352,7 @@ | |||||
</DataTemplate> | </DataTemplate> | ||||
</ItemsControl.ItemTemplate> | </ItemsControl.ItemTemplate> | ||||
</ItemsControl> | </ItemsControl> | ||||
</ScrollViewer> | |||||
</ScrollViewer>--> | |||||
<!--#endregion--> | <!--#endregion--> | ||||
@@ -73,6 +73,7 @@ | |||||
<Grid Margin="10"> | <Grid Margin="10"> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="35" /> | <RowDefinition Height="35" /> | ||||
<RowDefinition Height="70" /> | |||||
<RowDefinition /> | <RowDefinition /> | ||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
@@ -100,6 +101,7 @@ | |||||
<pry:IcoButton | <pry:IcoButton | ||||
Width="140" | Width="140" | ||||
Margin="0,0,20,0" | |||||
Content="新建店铺" | Content="新建店铺" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="{StaticResource TextBlockForeground}" | Foreground="{StaticResource TextBlockForeground}" | ||||
@@ -109,46 +111,210 @@ | |||||
<pry:IcoButton | <pry:IcoButton | ||||
Width="140" | Width="140" | ||||
Content="保存" | |||||
Content="保存配置" | |||||
FontSize="16" | FontSize="16" | ||||
Foreground="{StaticResource TextBlockForeground}" | Foreground="{StaticResource TextBlockForeground}" | ||||
IcoText="" | IcoText="" | ||||
MouseLeftButtonDown="IcoButton_MouseLeftButtonDown" | MouseLeftButtonDown="IcoButton_MouseLeftButtonDown" | ||||
Style="{StaticResource NewButtonStyle}" /> | Style="{StaticResource NewButtonStyle}" /> | ||||
<!--<Button | |||||
Width="140" | |||||
Margin="0,0,20,0" | |||||
Background="#FF19B7EC" | |||||
Command="{Binding NewConnectCommand}" | |||||
Content="新建连接" | |||||
FontFamily="楷体" | |||||
FontSize="18" | |||||
Template="{StaticResource NewButtonTemp}"> | |||||
<Button.Foreground> | |||||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||||
<GradientStop Color="#FFBB662A" /> | |||||
<GradientStop Offset="1" Color="White" /> | |||||
</LinearGradientBrush> | |||||
</Button.Foreground> | |||||
</Button>--> | |||||
<!--<Button | |||||
Width="140" | |||||
Command="{Binding SaveConnectSetCommand}" | |||||
Content="保存" | |||||
FontFamily="楷体" | |||||
FontSize="18" | |||||
Template="{StaticResource SaveButtonTemp}"> | |||||
<Button.Foreground> | |||||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||||
<GradientStop Color="#FFBB662A" /> | |||||
<GradientStop Offset="1" Color="White" /> | |||||
</LinearGradientBrush> | |||||
</Button.Foreground> | |||||
</Button>--> | |||||
</StackPanel> | </StackPanel> | ||||
<Grid Grid.Row="1"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<Grid Width="400" HorizontalAlignment="Left"> | |||||
<pry:TitleTextBlock /> | |||||
<TextBlock | |||||
Margin="5" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
FontFamily="雅黑" | |||||
FontSize="20" | |||||
Foreground="Yellow" | |||||
Text="店铺信息" /> | |||||
</Grid> | |||||
<StackPanel | |||||
Grid.Row="1" | |||||
HorizontalAlignment="Right" | |||||
Orientation="Horizontal"> | |||||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="店铺名称:" /> | |||||
<TextBox | |||||
Width="100" | |||||
Margin="10,0,0,0" | |||||
VerticalAlignment="Center" | |||||
Background="Transparent" | |||||
BorderBrush="#FF23CACA" | |||||
CaretBrush="Aqua" | |||||
FontFamily="楷体" | |||||
FontSize="21" | |||||
Foreground="#ff34f7f7" | |||||
Text="{Binding Minute}" /> | |||||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="店铺ID:" /> | |||||
<TextBox | |||||
Width="100" | |||||
Margin="10,0,0,0" | |||||
VerticalAlignment="Center" | |||||
Background="Transparent" | |||||
BorderBrush="#ff19b7ec" | |||||
CaretBrush="Aqua" | |||||
FontFamily="楷体" | |||||
FontSize="21" | |||||
Foreground="#ff34f7f7" | |||||
Text="aa" /> | |||||
<pry:IcoButton | |||||
Width="140" | |||||
Margin="10,0,0,0" | |||||
Content="新建设备" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TextBlockForeground}" | |||||
IcoText="" | |||||
MouseLeftButtonDown="IcoButton_MouseLeftButtonDown" | |||||
Style="{StaticResource NewButtonStyle}" /> | |||||
</StackPanel> | |||||
</Grid> | |||||
<Grid Grid.Row="2"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="35" /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<Grid Width="400" HorizontalAlignment="Left"> | |||||
<pry:TitleTextBlock /> | |||||
<TextBlock | |||||
Margin="5" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
FontFamily="雅黑" | |||||
FontSize="20" | |||||
Foreground="Yellow" | |||||
Text="设备信息" /> | |||||
</Grid> | |||||
<Grid Grid.Row="1"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="130" /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<StackPanel | |||||
Grid.Column="0" | |||||
Margin="10" | |||||
Background="Red"> | |||||
<Button Content="设备1" /> | |||||
<Button Content="设备1" /> | |||||
<Button Content="设备1" /> | |||||
<Button Content="设备1" /> | |||||
<Button Content="设备1" /> | |||||
</StackPanel> | |||||
<Grid Grid.Column="1"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="35" /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="设备名称:" /> | |||||
<TextBox | |||||
Width="100" | |||||
Margin="10,0,0,0" | |||||
VerticalAlignment="Center" | |||||
Background="Transparent" | |||||
BorderBrush="#FF23CACA" | |||||
CaretBrush="Aqua" | |||||
FontFamily="楷体" | |||||
FontSize="21" | |||||
Foreground="#ff34f7f7" | |||||
Text="{Binding Minute}" /> | |||||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="设备ID:" /> | |||||
<TextBox | |||||
Width="100" | |||||
Margin="10,0,0,0" | |||||
VerticalAlignment="Center" | |||||
Background="Transparent" | |||||
BorderBrush="#ff19b7ec" | |||||
CaretBrush="Aqua" | |||||
FontFamily="楷体" | |||||
FontSize="21" | |||||
Foreground="#ff34f7f7" | |||||
Text="aa" /> | |||||
<TextBlock | |||||
HorizontalAlignment="Left" | |||||
Style="{StaticResource TextBlockStyle}" | |||||
Text="选择启动设备:" /> | |||||
<ComboBox | |||||
Width="130" | |||||
VerticalAlignment="Center" | |||||
BorderBrush="#FF23CACA" | |||||
BorderThickness="1" | |||||
FontFamily="楷体" | |||||
FontSize="20" | |||||
Foreground="#ff23caca" | |||||
IsEditable="False" | |||||
ItemsSource="{Binding Path=Device.PlcTypes}" | |||||
Style="{StaticResource ComboBoxStyle}" | |||||
Text="{Binding Path=Device.PlcType}" /> | |||||
<pry:IcoButton | |||||
Width="140" | |||||
Margin="10,0,0,0" | |||||
Content="新建通讯" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TextBlockForeground}" | |||||
IcoText="" | |||||
MouseLeftButtonDown="IcoButton_MouseLeftButtonDown" | |||||
Style="{StaticResource NewButtonStyle}" /> | |||||
</StackPanel> | |||||
<Grid Grid.Row="1"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="130" /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<StackPanel> | |||||
<Button Content="通讯1" /> | |||||
<Button Content="通讯1" /> | |||||
<Button Content="通讯1" /> | |||||
<Button Content="通讯1" /> | |||||
</StackPanel> | |||||
<Grid Grid.Column="1"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
<ScrollViewer | <ScrollViewer | ||||
Grid.Row="1" | Grid.Row="1" | ||||
Margin="0,10,0,0" | Margin="0,10,0,0" | ||||
@@ -156,14 +322,16 @@ | |||||
VerticalScrollBarVisibility="Hidden"> | VerticalScrollBarVisibility="Hidden"> | ||||
<Grid> | |||||
<!--<Grid> | |||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="100" /> | <RowDefinition Height="100" /> | ||||
<RowDefinition Height="200" /> | <RowDefinition Height="200" /> | ||||
<RowDefinition /> | <RowDefinition /> | ||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<!-- 店铺信息 --> | |||||
--> | |||||
<!-- 店铺信息 --> | |||||
<!-- | |||||
<Grid Grid.Row="0"> | <Grid Grid.Row="0"> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="30" /> | <RowDefinition Height="30" /> | ||||
@@ -246,7 +414,9 @@ | |||||
</Grid> | </Grid> | ||||
<!-- 设备信息 --> | |||||
--> | |||||
<!-- 设备信息 --> | |||||
<!-- | |||||
<Grid Grid.Row="1"> | <Grid Grid.Row="1"> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="30" /> | <RowDefinition Height="30" /> | ||||
@@ -268,7 +438,9 @@ | |||||
Text="设备信息" /> | Text="设备信息" /> | ||||
</Grid> | </Grid> | ||||
<!--#region 使用列表包裹--> | |||||
--> | |||||
<!--#region 使用列表包裹--> | |||||
<!-- | |||||
<Grid Grid.Row="1"> | <Grid Grid.Row="1"> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
@@ -359,19 +531,21 @@ | |||||
Style="{StaticResource ComboBoxStyle}" | Style="{StaticResource ComboBoxStyle}" | ||||
Text="{Binding Path=Device.PlcType}" /> | Text="{Binding Path=Device.PlcType}" /> | ||||
</Grid> | </Grid> | ||||
<!--#endregion--> | |||||
--> | |||||
<!--#endregion--> | |||||
<!--<pry:IcoButton | |||||
<!--<pry:IcoButton | |||||
Grid.Row="4" | Grid.Row="4" | ||||
Content="添加设备" | Content="添加设备" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="{StaticResource TextBlockForeground}" | Foreground="{StaticResource TextBlockForeground}" | ||||
IcoText="" | IcoText="" | ||||
Style="{StaticResource NewButtonStyle}" />--> | Style="{StaticResource NewButtonStyle}" />--> | ||||
<!-- | |||||
</Grid> | </Grid> | ||||
</Grid> | |||||
</Grid>--> | |||||
<!--<ItemsControl ItemsSource="{Binding communicationSets}"> | <!--<ItemsControl ItemsSource="{Binding communicationSets}"> | ||||
<ItemsControl.ItemTemplate> | <ItemsControl.ItemTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
@@ -38,7 +38,7 @@ | |||||
</Peripherals> | </Peripherals> | ||||
</Device>--> | </Device>--> | ||||
<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="26"> | |||||
<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="28"> | |||||
<Peripherals> | <Peripherals> | ||||
<Peripheral Module="BPASmartClient.PLC.MorksMachine"> | <Peripheral Module="BPASmartClient.PLC.MorksMachine"> | ||||
<Parameters> | <Parameters> | ||||
@@ -9,11 +9,11 @@ | |||||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | ||||
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel" | xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel" | ||||
Title="MainWindow" | Title="MainWindow" | ||||
Width="1600" | |||||
Height="900" | |||||
Width="1300" | |||||
Height="800" | |||||
AllowsTransparency="True" | AllowsTransparency="True" | ||||
Background="{x:Null}" | Background="{x:Null}" | ||||
Topmost="False" | |||||
Topmost="True" | |||||
WindowStartupLocation="CenterScreen" | WindowStartupLocation="CenterScreen" | ||||
WindowStyle="None" | WindowStyle="None" | ||||
mc:Ignorable="d"> | mc:Ignorable="d"> | ||||
@@ -25,9 +25,7 @@ | |||||
</ResourceDictionary.MergedDictionaries> | </ResourceDictionary.MergedDictionaries> | ||||
</ResourceDictionary> | </ResourceDictionary> | ||||
</Window.Resources> | </Window.Resources> | ||||
<Window.DataContext> | |||||
<vm:MainViewModel /> | |||||
</Window.DataContext> | |||||
<Border x:Name="br" Style="{DynamicResource border主窗体背景}"> | <Border x:Name="br" Style="{DynamicResource border主窗体背景}"> | ||||
<Grid> | <Grid> | ||||
@@ -114,13 +112,7 @@ | |||||
<MenuItem | <MenuItem | ||||
Click="MenuItem_Click" | Click="MenuItem_Click" | ||||
FontSize="12" | FontSize="12" | ||||
Header="告警查询" | |||||
Tag="LogOrAlarmView" /> | |||||
<Separator /> | |||||
<MenuItem | |||||
Click="MenuItem_Click" | |||||
FontSize="12" | |||||
Header="日志查询" | |||||
Header="日志/告警查询" | |||||
Tag="LogOrAlarmView" /> | Tag="LogOrAlarmView" /> | ||||
<Separator /> | <Separator /> | ||||
<MenuItem | <MenuItem | ||||
@@ -10,6 +10,7 @@ using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.冰淇淋.Enum; | using BPASmartClient.Model.冰淇淋.Enum; | ||||
using BPASmartClient.Model.咖啡机.Enum; | using BPASmartClient.Model.咖啡机.Enum; | ||||
using BPASmartClient.ViewModel; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -35,7 +36,9 @@ namespace BPASmartClient | |||||
{ | { | ||||
public MainWindow() | public MainWindow() | ||||
{ | { | ||||
InitializeComponent(); | |||||
InitializeComponent(); | |||||
MainViewModel.GetInstance().window = this; | |||||
this.DataContext = MainViewModel.GetInstance(); | |||||
Initialize(); | Initialize(); | ||||
} | } | ||||