Преглед изворни кода

系统配置修改

reconfiguration
pry пре 3 месеци
родитељ
комит
672c772c85
13 измењених фајлова са 426 додато и 41 уклоњено
  1. +30
    -3
      BPASmartClient.Academy/App.xaml.cs
  2. +1
    -0
      BPASmartClient.Academy/GlobalUsing.cs
  3. +23
    -0
      BPASmartClient.Academy/Model/ProjectType.cs
  4. +21
    -17
      BPASmartClient.Academy/Model/Simens_PLC.cs
  5. +8
    -7
      BPASmartClient.Academy/Model/par/DevicePar.cs
  6. +11
    -4
      BPASmartClient.Academy/View/DeviceMotionView.xaml
  7. +1
    -0
      BPASmartClient.Academy/View/HistoryChartView.xaml
  8. +143
    -0
      BPASmartClient.Academy/View/ParameterSetView.xaml
  9. +35
    -0
      BPASmartClient.Academy/View/ParameterSetView.xaml.cs
  10. +13
    -6
      BPASmartClient.Academy/ViewModel/DeviceMotionViewModel.cs
  11. +23
    -0
      BPASmartClient.Academy/ViewModel/ParameterSetViewModel.cs
  12. +112
    -1
      BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
  13. +5
    -3
      BPASmartClient.CustomResource/UserControls/MessageShow/NoticeDemoViewModel.cs

+ 30
- 3
BPASmartClient.Academy/App.xaml.cs Прегледај датотеку

@@ -1,4 +1,5 @@
using LiveCharts;
using BPASmartClient.CustomResource.UserControls;
using LiveCharts;
using System.Collections.Specialized;
using System.Configuration;
using System.Data;
@@ -15,7 +16,7 @@ namespace BPASmartClient.Academy
public static Window MainWindow;

public EventWaitHandle ProgramStarted { get; set; }
protected override async void OnStartup(StartupEventArgs e)
protected override void OnStartup(StartupEventArgs e)
{
bool createNew;

@@ -48,7 +49,9 @@ namespace BPASmartClient.Academy
DataInit();
MenuInit();
MainView mv = new MainView();
mv.TitleName = $"反应釜焖制系统 V1.0.1";
MessageNotify.GetInstance.window = mv;
mv.TitleName = $"10L 反应釜焖制系统 V1.0.1";
#if !DEBUG
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
@@ -79,7 +82,12 @@ namespace BPASmartClient.Academy
}
else
mv.Close();
#else
mv.Show();
#endif
MainWindow = mv;


}

protected override void OnExit(ExitEventArgs e)
@@ -234,6 +242,25 @@ namespace BPASmartClient.Academy
subMenumodels = InfoLog,
});
#endregion

#region 系统设置
ObservableCollection<SubMenumodel> SystemSet = new ObservableCollection<SubMenumodel>();
SystemSet.Add(new SubMenumodel()
{
SubMenuName = "系统设置",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.Academy",
ToggleWindowPath = "View.ParameterSetView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe668;",
MainMenuName = "系统设置",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
Alias = "System Set",
subMenumodels = SystemSet,
});
#endregion
}

private void DataInit()


+ 1
- 0
BPASmartClient.Academy/GlobalUsing.cs Прегледај датотеку

@@ -15,3 +15,4 @@ global using BPASmartClient.CustomResource.Pages.View;
global using BPASmartClient.CustomResource.Pages.Model;
global using BPASmartClient.CustomResource.Pages.Enums;
global using BPA.Communication;
global using BPASmartClient.CustomResource.UserControls;

+ 23
- 0
BPASmartClient.Academy/Model/ProjectType.cs Прегледај датотеку

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Academy.Model
{
/// <summary>
/// 项目类型
/// </summary>
public enum ProjectType
{
/// <summary>
/// 10L反应釜
/// </summary>
HKYF20240714 = 0,
/// <summary>
/// 50L反应釜
/// </summary>
HKYF20240916 = 1,
}
}

+ 21
- 17
BPASmartClient.Academy/Model/Simens_PLC.cs Прегледај датотеку

@@ -47,6 +47,23 @@ namespace BPASmartClient.Academy.Model
siemens = o.Content;
IsConnected = true;
connect?.Invoke(true);
ThreadManage.GetInstance.StartLong(() =>
{
ReadStatus();
}, "状态读取");
ThreadManage.GetInstance.StartLong(() =>
{
Heartbeat();
connect?.Invoke(IsConnected);
}, "心跳监听");
ThreadManage.GetInstance.StartLong(() =>
{
ChartDataRead();
}, "曲线数据");
ThreadManage.GetInstance.StartLong(() =>
{
AlarmRead();
}, "报警监控");
}).OnFailure(o =>
{
IsConnected = false;
@@ -57,23 +74,6 @@ namespace BPASmartClient.Academy.Model
public void Init()
{
AlarmInfoGet();
ThreadManage.GetInstance.StartLong(() =>
{
ReadStatus();
}, "状态读取");
ThreadManage.GetInstance.StartLong(() =>
{
Heartbeat();
connect?.Invoke(IsConnected);
}, "心跳监听");
ThreadManage.GetInstance.StartLong(() =>
{
ChartDataRead();
}, "曲线数据");
ThreadManage.GetInstance.StartLong(() =>
{
AlarmRead();
}, "报警监控");
}
public void AlarmInfoGet()
{
@@ -284,6 +284,10 @@ namespace BPASmartClient.Academy.Model
DeviceMotionViewModel.PipeLine.PipeH_4.Direction = 0;
}
}

public bool IsSave { get; set; } = false;


public void ChartDataRead()
{
//DateTime date = DateTime.Now;


+ 8
- 7
BPASmartClient.Academy/Model/par/DevicePar.cs Прегледај датотеку

@@ -6,14 +6,15 @@ namespace BPASmartClient.Academy
public class DevicePar : NotifyBase
{
/// <summary>
/// 配料设备参数
/// 设备类型
/// </summary>
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } = new ObservableCollection<DeviceParModel>();

public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } = new ObservableCollection<OutletInfoModel>();

public BasePar BaseParModel { get { return _mBaseParModel; } set { _mBaseParModel = value; OnPropertyChanged(); } }
private BasePar _mBaseParModel = new BasePar();
public string ProjectTypeName { get { return _mProjectTypeName; } set { _mProjectTypeName = value; OnPropertyChanged(); } }
private string _mProjectTypeName = ProjectType.HKYF20240714.ToString();

/// <summary>
/// 设备IP地址
/// </summary>
public string IpAddress { get { return _mIpAddress; } set { _mIpAddress = value; OnPropertyChanged(); } }
private string _mIpAddress = "192.168.2.1";
}
}

+ 11
- 4
BPASmartClient.Academy/View/DeviceMotionView.xaml Прегледај датотеку

@@ -3,9 +3,11 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:bpa="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
d:DataContext="{d:DesignInstance Type=vm:DeviceMotionViewModel}"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Academy.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
@@ -954,14 +956,14 @@

<!--#region 水罐重量清零-->
<Button
Width="100"
Height="25"
Canvas.Left="480"
Canvas.Top="370"
FontSize="10"
Width="100"
Height="25"
VerticalAlignment="Center"
Click="ClearBtn_CLick"
Content="水罐重量清零"
FontSize="10"
Style="{StaticResource ButtonStyle}" />
<!--#endregion-->
<!--#region 控制按钮-->
@@ -1478,7 +1480,7 @@
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="请输入配方名称:" />
Text="请输入产品编号:" />
<TextBox
x:Name="recipeName"
Width="200"
@@ -1486,6 +1488,11 @@
VerticalAlignment="Center"
FontSize="20"
Text="{Binding Name}" />
<Button
Margin="10,0,10,0"
Command="{Binding DataRecordCommand}"
Content="开始记录"
Style="{StaticResource ButtonStyle}" />
</StackPanel>
<CheckBox
x:Name="start_check"


+ 1
- 0
BPASmartClient.Academy/View/HistoryChartView.xaml Прегледај датотеку

@@ -54,6 +54,7 @@
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBox Text="111" Width="120" Margin="0 0 60 0"/>
<DatePicker
Margin="0,0,60,0"
SelectedDate="{Binding SelectTime}"


+ 143
- 0
BPASmartClient.Academy/View/ParameterSetView.xaml Прегледај датотеку

@@ -0,0 +1,143 @@
<Window
x:Class="BPASmartClient.Academy.View.ParameterSetView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Academy.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
Title="ParameterSetView"
Width="350"
Height="400"
AllowsTransparency="True"
Background="{x:Null}"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Window.DataContext>
<vm:ParameterSetViewModel />
</Window.DataContext>

<Window.Resources>
<Style x:Key="btnStyle" TargetType="Button">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#4135cb" />
<Setter Property="Height" Value="35" />
<Setter Property="Width" Value="100" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Opacity" Value="0.85" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="br"
Background="{TemplateBinding Background}"
CornerRadius="5">
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>

<Border
Background="#1e293b"
BorderThickness="5"
CornerRadius="20">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Direction="0"
ShadowDepth="0"
Color="DeepSkyBlue" />
</Border.Effect>
<Grid
Name="gr"
Margin="20"
Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.8*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition />
<RowDefinition Height="50" />
</Grid.RowDefinitions>

<TextBlock
Grid.Row="0"
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="16"
Foreground="#8e9db2"
Text="请选择项目类型:" />
<ComboBox
Grid.Row="0"
Grid.Column="1"
MinHeight="30"
BorderThickness="2"
FontSize="16"
Foreground="#ddd"
IsEditable="False"
ItemsSource="{Binding projectNames}"
SelectedValue="{Binding Par.ProjectTypeName}" />

<TextBlock
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="16"
Foreground="#8e9db2"
Text="请输入设备IP:" />

<TextBox
Grid.Row="1"
Grid.Column="1"
Height="30"
VerticalContentAlignment="Center"
Background="Transparent"
BorderBrush="#074b92"
BorderThickness="2"
CaretBrush="DeepSkyBlue"
FontSize="16"
Foreground="#ddd"
Style="{x:Null}"
Text="{Binding Par.IpAddress}" />

<Grid Grid.Row="3" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Name="btn_save"
Grid.Row="3"
Grid.Column="1"
Content="保 存"
Style="{StaticResource btnStyle}" />
<Button
Name="btn_cancel"
Grid.Row="3"
Grid.Column="0"
Background="#ff106e"
Content="取 消"
Style="{StaticResource btnStyle}" />
</Grid>
</Grid>
</Border>
</Window>

+ 35
- 0
BPASmartClient.Academy/View/ParameterSetView.xaml.cs Прегледај датотеку

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BPASmartClient.Academy.View
{
/// <summary>
/// ParameterSetView.xaml 的交互逻辑
/// </summary>
public partial class ParameterSetView : Window
{
public ParameterSetView()
{
InitializeComponent();
this.gr.MouseLeftButtonDown += (o, s) => { this.DragMove(); };
this.btn_cancel.Click += (s, e) => { this.Close(); };
this.btn_save.Click += (s, e) =>
{
Json<DevicePar>.Save();
MessageNotify.GetInstance.OpenMsg(EnumPromptType.Success, "提示", "参数保存成功!");
this.Close();
};
}
}
}

+ 13
- 6
BPASmartClient.Academy/ViewModel/DeviceMotionViewModel.cs Прегледај датотеку

@@ -18,9 +18,9 @@ namespace BPASmartClient.Academy.ViewModel
public static DeviceMotionViewModel GetInstance { get; set; } = Instance ??= new DeviceMotionViewModel();
public DeviceMotionViewModel()
{
Start = new BPARelayCommand(() =>
Start = new BPARelayCommand(() =>
{
if (Name!= "" && Simens_PLC.GetInstance.IsConnected)
if (Name != "" && Simens_PLC.GetInstance.IsConnected)
{
switch (Content)
{
@@ -58,8 +58,14 @@ namespace BPASmartClient.Academy.ViewModel
IsChecked = false;
}
});

DataRecordCommand = new BPARelayCommand(() =>
{
ParameterSetView sv = new ParameterSetView();
sv.Show();
});
}
public static PipeLineMode PipeLine { get; set; } = new PipeLineMode();
public static PipeLineMode PipeLine { get; set; } = new PipeLineMode();

private string _name = "";

@@ -84,22 +90,23 @@ namespace BPASmartClient.Academy.ViewModel
set { _isChecked = value; OnPropertyChanged(); }
}
public BPARelayCommand Start { get; set; }
public BPARelayCommand DataRecordCommand { get; set; }

private DeviceCtrl _deviceStatus = Simens_PLC.GetInstance.deviceCtrl;

public DeviceCtrl DeviceStatus
{
get { return _deviceStatus = Simens_PLC.GetInstance.deviceCtrl; }
set { _deviceStatus = Simens_PLC.GetInstance.deviceCtrl = value;OnPropertyChanged(); }
set { _deviceStatus = Simens_PLC.GetInstance.deviceCtrl = value; OnPropertyChanged(); }
}

}

public class DataValue:NotifyBase
public class DataValue : NotifyBase
{
private DateTime _dateTime;

public DateTime DateTime {get { return _dateTime; }set { _dateTime = value; OnPropertyChanged(); } }
public DateTime DateTime { get { return _dateTime; } set { _dateTime = value; OnPropertyChanged(); } }
private double _value;

public double Value { get { return _value; } set { _value = value; OnPropertyChanged(); } }


+ 23
- 0
BPASmartClient.Academy/ViewModel/ParameterSetViewModel.cs Прегледај датотеку

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Academy.ViewModel
{
public class ParameterSetViewModel : NotifyBase
{
public ParameterSetViewModel()
{
Enum.GetNames(typeof(ProjectType)).ToList().ForEach(name => { projectNames.Add(name); });
}

public ObservableCollection<string> projectNames { get; set; } = new ObservableCollection<string>();

public DevicePar Par { get { return _mPar; } set { _mPar = value; OnPropertyChanged(); } }
private DevicePar _mPar = Json<DevicePar>.Data;

//public BPARelayCommand SaveCommand { get; set; } = new BPARelayCommand(() => { Json<DevicePar>.Save(); });
}
}

+ 112
- 1
BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs Прегледај датотеку

@@ -9,6 +9,7 @@ using System.Windows;
using BPASmartClient.Model;
using System.Windows.Media;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.CustomResource.UserControls;

namespace BPASmartClient.CustomResource.Pages.Model
{
@@ -51,7 +52,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
catch (Exception)
{

// throw;
// throw;
}
}

@@ -182,6 +183,116 @@ namespace BPASmartClient.CustomResource.Pages.Model
});
return result;
}


#region 弹框提示信息

public Notifiaction NotifiactionShow { get; set; } = new Notifiaction();

public Window window { get; set; }

#region 右侧弹框

/// <summary>
/// 手动关闭
/// </summary>
public void OnExit(string e)
{
switch (e)
{
case "Error":
NotifiactionShow.Clear(EnumPromptType.Error);
return;
case "Success":
NotifiactionShow.Clear(EnumPromptType.Success);
return;
case "Warm":
NotifiactionShow.Clear(EnumPromptType.Warn);
return;
case "Info":
NotifiactionShow.Clear(EnumPromptType.Info);
return;
default:
break;
}
//NoticeManager.ExitNotifiaction();

}

/// <summary>
/// 屏幕右下角信息提示弹窗
/// </summary>
/// <param name="e">弹窗类型:Error、Success、Warm、Info,分别对应不同颜色</param>
/// <param name="title">弹窗消息类型:属性判证、XX告警...</param>
/// <param name="content">弹窗消息内容</param>
/// <param name="kcmbbh">一般为对应目标的目标编号</param>
/// <param name="id">该条消息的ID</param>
public void OpenMsg(EnumPromptType type, string title, string content)
{
if (window == null) return;
string text = string.Empty;
if (content != null)
{
if (content.Length < 40)
{
int count = 40 - content.Length;
for (int i = 0; i < count * 2; i++)
{
content += " ";
}

}
text = content;
}
Application.Current.Dispatcher.Invoke(() =>
{
NotifiactionShow.AddNotifiaction(new NotifiactionModel()
{
Title = title,//"这是Error通知标题",
Content = text,//"这条通知不会自动关闭,需要点击关闭按钮",
ContentToolTip = content,
NotifiactionType = type,
window = window
});
});
}
#endregion
public void OpenMsg(EnumPromptType type, string title, string content, byte viewcount, int viewtime)
{
if (window == null) return;
string text = string.Empty;
if (content != null)
{
if (content.Length < 40)
{
int count = 40 - content.Length;
for (int i = 0; i < count * 2; i++)
{
content += " ";
}
}
text = content;
}
Application.Current.Dispatcher.Invoke(() =>
{
NotifiactionShow.MAX_NOTIFICATIONS = viewcount;
NotifiactionShow.AddNotifiaction(new NotifiactionModel()
{
Title = title,//"这是Error通知标题",
Content = text,//"这条通知不会自动关闭,需要点击关闭按钮",
ContentToolTip = content,
NotifiactionType = type,
time = viewtime,
window = window
});
});
}

#endregion




}

public enum DialogType


+ 5
- 3
BPASmartClient.CustomResource/UserControls/MessageShow/NoticeDemoViewModel.cs Прегледај датотеку

@@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Media;

namespace BPASmartClient.CustomResource.UserControls.MessageShow
@@ -57,7 +59,7 @@ namespace BPASmartClient.CustomResource.UserControls.MessageShow
/// <param name="content">弹窗消息内容</param>
/// <param name="kcmbbh">一般为对应目标的目标编号</param>
/// <param name="id">该条消息的ID</param>
public static void OpenMsg(EnumPromptType type,System.Windows.Window window,string title,string content)
public static void OpenMsg(EnumPromptType type, System.Windows.Window window, string title, string content)
{
string text = string.Empty;
if (content != null)
@@ -80,11 +82,11 @@ namespace BPASmartClient.CustomResource.UserControls.MessageShow
Content = text,//"这条通知不会自动关闭,需要点击关闭按钮",
ContentToolTip = content,
NotifiactionType = type,
window= window
window = window
});
}
#endregion
public static void OpenMsg(EnumPromptType type, System.Windows.Window window, string title, string content,byte viewcount,int viewtime)
public static void OpenMsg(EnumPromptType type, System.Windows.Window window, string title, string content, byte viewcount, int viewtime)
{
string text = string.Empty;
if (content != null)


Loading…
Откажи
Сачувај