Browse Source

Merge branch 'master' of http://10.2.1.24:10244/bpa/BPASmartClient

样式分支
NXX 2 years ago
parent
commit
84becf75bf
22 changed files with 825 additions and 342 deletions
  1. +0
    -22
      BPASmartClient.Business/Plugin/OrderProxy.cs
  2. +2
    -2
      BPASmartClient.CustomResource/Themes/Generic.xaml
  3. +7
    -6
      BPASmartClient.CustomResource/Themes/GenricStyle.xaml
  4. +3
    -6
      BPASmartClient.Device/BaseDevice.cs
  5. +47
    -1
      BPASmartClient.Helper/logHelper.cs
  6. +43
    -0
      BPASmartClient.Model/Book.cs
  7. +1
    -0
      BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj
  8. +273
    -0
      BPASmartClient.ViewModel/LogOrAlarmViewModel.cs
  9. +59
    -103
      BPASmartClient.ViewModel/LogViewModel.cs
  10. +5
    -1
      BPASmartClient.ViewModel/MainViewModel.cs
  11. +101
    -51
      BPASmartClient.ViewModel/OrderStatusViewModel.cs
  12. +9
    -5
      BPASmartClient/App.config
  13. +1
    -2
      BPASmartClient/Control/BatchingAddView.xaml
  14. +2
    -0
      BPASmartClient/Control/BatchingAddView.xaml.cs
  15. +26
    -78
      BPASmartClient/Control/LogOrAlarmView.xaml
  16. +13
    -1
      BPASmartClient/Control/LogOrAlarmView.xaml.cs
  17. +2
    -2
      BPASmartClient/Control/LogView.xaml
  18. +7
    -7
      BPASmartClient/Control/OrderStatusView.xaml
  19. +214
    -40
      BPASmartClient/Control/ShopDeviceConfigView.xaml
  20. +1
    -1
      BPASmartClient/DeviceInfo.xml
  21. +5
    -13
      BPASmartClient/MainWindow.xaml
  22. +4
    -1
      BPASmartClient/MainWindow.xaml.cs

+ 0
- 22
BPASmartClient.Business/Plugin/OrderProxy.cs View File

@@ -56,25 +56,6 @@ namespace BPASmartClient.Business
Thread.Sleep(1000);
}), "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()
@@ -126,9 +107,6 @@ namespace BPASmartClient.Business
if (orders[deviceId].TryDequeue(out MorkOrderPush temp))
{
if (InternetInfo.IsEnableTest) morkOrderPushes.Enqueue(temp);
//#if test
// morkOrderPushes.Enqueue(temp);
//#endif
var orderEvent = DoOrderEvent.Make(temp);
orderEvent.DeviceId = device.DeviceId;
orderEvent.Publish();


+ 2
- 2
BPASmartClient.CustomResource/Themes/Generic.xaml View File

@@ -14,7 +14,7 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
<Grid HorizontalAlignment="Center">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<!--<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
@@ -35,7 +35,7 @@
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
</Grid>
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>


+ 7
- 6
BPASmartClient.CustomResource/Themes/GenricStyle.xaml View File

@@ -538,6 +538,7 @@
<Setter Property="SelectedDateFormat" Value="Short" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="2" />
<Setter Property="Height" Value="24"/>
<Setter Property="BorderBrush" Value="#08335f" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
@@ -558,11 +559,11 @@
<ControlTemplate x:Key="DropDownButtonTemplate" TargetType="{x:Type Button}">
<Grid>
<Grid
Width="19"
Height="18"
Margin="0"
Width="15"
Height="15"
Margin="0,2,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
VerticalAlignment="Top"
Background="#11FFFFFF"
FlowDirection="LeftToRight">
<Grid.ColumnDefinitions>
@@ -2688,13 +2689,13 @@
<Style TargetType="{x:Type TextBox}">
<Setter Property="BorderBrush" Value="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="1" />
<Setter Property="Padding" Value="0" />
<Setter Property="Foreground" Value="{DynamicResource foreground}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Height" Value="24" />
<Setter Property="CaretBrush" Value="White" />
<Setter Property="Padding" Value="10" />
<Setter Property="Padding" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="AllowDrop" Value="true" />


+ 3
- 6
BPASmartClient.Device/BaseDevice.cs View File

@@ -110,8 +110,9 @@ namespace BPASmartClient.Device
/// <param name="info"></param>
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);
if (Log.Count > 100) { Log.RemoveAt(Log.Count - 1);}
}

public void Initliaze()
@@ -132,10 +133,6 @@ namespace BPASmartClient.Device
public virtual void StartMain()
{
#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

ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -233,7 +230,7 @@ namespace BPASmartClient.Device
Type = res.Grade,
Text = res.Info
};
Error.Add(obj);
Error.Insert(0,obj);
AddErrorAction?.Invoke(DeviceId, obj);
}
});


+ 47
- 1
BPASmartClient.Helper/logHelper.cs View File

@@ -353,7 +353,53 @@ namespace BPASmartClient.Helper
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>


+ 43
- 0
BPASmartClient.Model/Book.cs View File

@@ -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;
}
}
}

+ 1
- 0
BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj View File

@@ -12,6 +12,7 @@

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
<ProjectReference Include="..\BPASmartClient.IoT\BPASmartClient.IoT.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />


+ 273
- 0
BPASmartClient.ViewModel/LogOrAlarmViewModel.cs View File

@@ -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


}
}

+ 59
- 103
BPASmartClient.ViewModel/LogViewModel.cs View File

@@ -23,10 +23,10 @@ namespace BPASmartClient.ViewModel
/// </summary>
public class LogViewModel : ObservableObject
{
#region 变量
public DispatcherTimer dispatcherTimer;
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
{
@@ -40,13 +40,53 @@ namespace BPASmartClient.ViewModel
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;
public static LogViewModel GetInstance() => _Instance ?? (_Instance = new 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) =>
{
@@ -56,17 +96,15 @@ namespace BPASmartClient.ViewModel
logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO, 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) =>
{
@@ -76,7 +114,6 @@ namespace BPASmartClient.ViewModel
logHelper.GetLogConfigInstance().WriteLog(LogLevel.WARN, id);
}));
});

//错误日志
MessageLog.GetInstance.ExInfoNotify = new Action<string>((s) =>
{
@@ -106,10 +143,10 @@ namespace BPASmartClient.ViewModel
if (System.Windows.MessageBox.Show(msg, "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
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);

});

dispatcherTimer = new DispatcherTimer();
@@ -127,7 +164,6 @@ namespace BPASmartClient.ViewModel
dispatcherTimer.Interval = TimeSpan.FromSeconds(10);
dispatcherTimer.Start();
}

/// <summary>
/// 导出数据
/// </summary>
@@ -167,104 +203,24 @@ namespace BPASmartClient.ViewModel
string msg = string.Format("记录导出完成,共导出记录{0}条,是否打开!", LogDataGrid.Count);
if (System.Windows.MessageBox.Show(msg, "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
OpenFile(openfile.FileName);
logHelper.GetLogConfigInstance().OpenFile(openfile.FileName);
}
}
else
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 OpenCommand { get; set; }
#endregion
}

public class LogModel : ObservableObject
{
public string time { get; set; }

private 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"));

OnPropertyChanged("type");
OnPropertyChanged("foreground");
}
}
public string message { get; set; }

private Brush _foreground;
public Brush foreground
{


+ 5
- 1
BPASmartClient.ViewModel/MainViewModel.cs View File

@@ -42,9 +42,13 @@ namespace BPASmartClient.ViewModel
/// 是否告警
/// </summary>
public AlarmModel IsAlarm { get; set; }
public System.Windows.Window window;
public DispatcherTimer dispatcherTimer;
#region 单一
private volatile static MainViewModel _Instance;
public static MainViewModel GetInstance() => _Instance ?? (_Instance = new MainViewModel());

#endregion

public MainViewModel()
{


+ 101
- 51
BPASmartClient.ViewModel/OrderStatusViewModel.cs View File

@@ -63,9 +63,6 @@ namespace BPASmartClient.ViewModel
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
};
observableCollection.Add(morkOrder);
//var res = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.DeviceId == device.ToString());
//if (res == null)
//{
Application.Current?.Dispatcher.BeginInvoke((Action)delegate
{
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"),
});
});
//}
//else
//{
// res.morkOrderPushes.Add(new MorkOrder() { OrderPush = morkOrderpush });
//}

}
}
@@ -103,56 +95,114 @@ namespace BPASmartClient.ViewModel

}), "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).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;

}
}
}
}

+ 9
- 5
BPASmartClient/App.config View File

@@ -3,7 +3,7 @@
<appSettings>
<!--通用配置-->
<!--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="OrderServiceUri" value="http://10.2.1.26:21527/order/"/>
<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="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="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 ="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="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"/>-->
@@ -34,16 +37,17 @@
<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"/>

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->
<!--LOCAL:直接使用下方本地“设备连接信息”-->
<add key="StartupMode" value="API"/>
<add key="ProductKey" value="grgpECHSL7q"/>
<add key="DeviceName" value="qsqd"/>
<add key="DeviceSecret" value="3c0f2390943bff4fece523af22655196"/>

<!--外设配置-->
<add key="COM_Coffee" value="COM3"/>


+ 1
- 2
BPASmartClient/Control/BatchingAddView.xaml View File

@@ -11,7 +11,6 @@
<wv2:WebView2
Name="webView"
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>
</UserControl>

+ 2
- 0
BPASmartClient/Control/BatchingAddView.xaml.cs View File

@@ -23,6 +23,8 @@ namespace BPASmartClient.Control
public BatchingAddView()
{
InitializeComponent();
webView.Source=new Uri(System.Configuration.ConfigurationManager.AppSettings["WebServiceUri"].ToString());
}
}
}

+ 26
- 78
BPASmartClient/Control/LogOrAlarmView.xaml View File

@@ -4,6 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Control"
xmlns:k="clr-namespace:BPASmartClient.Model;assembly=BPASmartClient.Model"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
@@ -20,115 +21,62 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="45" />
<RowDefinition />
<RowDefinition Height="*" />
</Grid.RowDefinitions>

<!-- 查询按钮栏 -->
<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>
<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>

<!-- 表格栏 -->
<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>
<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>
<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>
</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="设备ID" Width="100">
<DataGridTemplateColumn.CellTemplate>
<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>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="4.4*" Header="参考值">
</DataGridTemplateColumn>-->

<DataGridTemplateColumn Header="日志类型" Width="300">
<DataGridTemplateColumn.CellTemplate>
<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>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="2*" Header="操作">
<DataGridTemplateColumn Header="日志内容" Width="*">
<DataGridTemplateColumn.CellTemplate>
<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>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>

</Grid>
</Grid>
</UserControl>

+ 13
- 1
BPASmartClient/Control/LogOrAlarmView.xaml.cs View File

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -23,6 +24,17 @@ namespace BPASmartClient.Control
public LogOrAlarmView()
{
InitializeComponent();
this.DataContext = LogOrAlarmViewModel.GetInstance();
}

private void CheckBox_Checked(object sender, RoutedEventArgs e)
{

}

private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
{

}
}
}

+ 2
- 2
BPASmartClient/Control/LogView.xaml View File

@@ -27,8 +27,8 @@
<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 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>

<!--表格栏-->


+ 7
- 7
BPASmartClient/Control/OrderStatusView.xaml View File

@@ -36,7 +36,7 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<!--<RowDefinition />-->
</Grid.RowDefinitions>

<!--#region 制作中的订单列表-->
@@ -118,8 +118,8 @@
<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible">
<ItemsControl ItemsSource="{Binding orderStatusLists}">
<ItemsControl.ItemTemplate>
<DataTemplate>
@@ -206,7 +206,7 @@

<!--#region 表格标题栏设置-->

<Grid Background="#dd2AB2E7">
<!--<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
@@ -271,13 +271,13 @@
Foreground="{StaticResource TitleFontColor}"
Text="完成时间" />

</Grid>
</Grid>-->

<!--#endregion-->

<!--#region 表格数据显示-->

<ScrollViewer
<!--<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
@@ -352,7 +352,7 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</ScrollViewer>-->

<!--#endregion-->



+ 214
- 40
BPASmartClient/Control/ShopDeviceConfigView.xaml View File

@@ -73,6 +73,7 @@
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition Height="70" />
<RowDefinition />
</Grid.RowDefinitions>

@@ -100,6 +101,7 @@

<pry:IcoButton
Width="140"
Margin="0,0,20,0"
Content="新建店铺"
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
@@ -109,46 +111,210 @@

<pry:IcoButton
Width="140"
Content="保存"
Content="保存配置"
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;"
MouseLeftButtonDown="IcoButton_MouseLeftButtonDown"
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>

<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="&#xe626;"
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="&#xe626;"
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
Grid.Row="1"
Margin="0,10,0,0"
@@ -156,14 +322,16 @@
VerticalScrollBarVisibility="Hidden">


<Grid>
<!--<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="200" />
<RowDefinition />
</Grid.RowDefinitions>

<!-- 店铺信息 -->
-->
<!-- 店铺信息 -->
<!--
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
@@ -246,7 +414,9 @@

</Grid>

<!-- 设备信息 -->
-->
<!-- 设备信息 -->
<!--
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
@@ -268,7 +438,9 @@
Text="设备信息" />
</Grid>

<!--#region 使用列表包裹-->
-->
<!--#region 使用列表包裹-->
<!--
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
@@ -359,19 +531,21 @@
Style="{StaticResource ComboBoxStyle}"
Text="{Binding Path=Device.PlcType}" />
</Grid>
<!--#endregion-->
-->
<!--#endregion-->

<!--<pry:IcoButton
<!--<pry:IcoButton
Grid.Row="4"
Content="添加设备"
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;"
Style="{StaticResource NewButtonStyle}" />-->
<!--
</Grid>


</Grid>
</Grid>-->
<!--<ItemsControl ItemsSource="{Binding communicationSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>


+ 1
- 1
BPASmartClient/DeviceInfo.xml View File

@@ -38,7 +38,7 @@
</Peripherals>
</Device>-->

<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="26">
<Device Name="Morks" Module="BPASmartClient.MorkS.Control" DeviceId="28">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.MorksMachine">
<Parameters>


+ 5
- 13
BPASmartClient/MainWindow.xaml View File

@@ -9,11 +9,11 @@
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
Title="MainWindow"
Width="1600"
Height="900"
Width="1300"
Height="800"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="False"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
@@ -25,9 +25,7 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Window.DataContext>
<vm:MainViewModel />
</Window.DataContext>


<Border x:Name="br" Style="{DynamicResource border主窗体背景}">
<Grid>
@@ -114,13 +112,7 @@
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="告警查询"
Tag="LogOrAlarmView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="日志查询"
Header="日志/告警查询"
Tag="LogOrAlarmView" />
<Separator />
<MenuItem


+ 4
- 1
BPASmartClient/MainWindow.xaml.cs View File

@@ -10,6 +10,7 @@ using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -35,7 +36,9 @@ namespace BPASmartClient
{
public MainWindow()
{
InitializeComponent();
InitializeComponent();
MainViewModel.GetInstance().window = this;
this.DataContext = MainViewModel.GetInstance();
Initialize();
}



Loading…
Cancel
Save