添加项目文件。
BIN
SamplePreSystem.UI/Assets/App.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
SamplePreSystem.UI/Assets/Warning.png
Normal file
|
After Width: | Height: | Size: 905 B |
BIN
SamplePreSystem.UI/Assets/login.png
Normal file
|
After Width: | Height: | Size: 160 KiB |
BIN
SamplePreSystem.UI/Assets/progressBar.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
SamplePreSystem.UI/Assets/分液1.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
SamplePreSystem.UI/Assets/加液1.png
Normal file
|
After Width: | Height: | Size: 955 B |
BIN
SamplePreSystem.UI/Assets/固相萃取1.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
SamplePreSystem.UI/Assets/机器人1.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
SamplePreSystem.UI/Assets/样品管理.png
Normal file
|
After Width: | Height: | Size: 955 B |
BIN
SamplePreSystem.UI/Assets/氮吹1.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
SamplePreSystem.UI/Assets/离心机1.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
156
SamplePreSystem.UI/BaseControls/BaseWindow.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
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.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SamplePre.UIWpf.BaseWindows
|
||||
{
|
||||
public class BaseWindow : Window
|
||||
{
|
||||
public BaseWindow()
|
||||
{
|
||||
//InitializeStyle();
|
||||
//this.Loaded += delegate
|
||||
//{
|
||||
// InitializeEvent();
|
||||
//};
|
||||
|
||||
InitializeStyle();
|
||||
// 一定要在 Loaded 里执行,确保模板已加载
|
||||
Loaded += (s, e) => InitializeEvent();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void InitializeEvent()
|
||||
{
|
||||
// ✅ 关键:从可视化树查找模板内的元素
|
||||
Button btnMin = FindChild<Button>(this, "btnMin");
|
||||
Button btnMax = FindChild<Button>(this, "btnMax");
|
||||
Button btnClose = FindChild<Button>(this, "btnClose");
|
||||
Border borderTitle = FindChild<Border>(this, "borderTitle");
|
||||
|
||||
// 最小化
|
||||
if (btnMin != null)
|
||||
btnMin.Click += (s, e) => WindowState = WindowState.Minimized;
|
||||
|
||||
// 最大化/还原
|
||||
if (btnMax != null)
|
||||
btnMax.Click += (s, e) =>
|
||||
WindowState = WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
|
||||
|
||||
// 关闭
|
||||
if (btnClose != null)
|
||||
btnClose.Click += (s, e) => Close();
|
||||
|
||||
// 拖动窗口
|
||||
if (borderTitle != null)
|
||||
{
|
||||
borderTitle.MouseMove += (s, e) =>
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
DragMove();
|
||||
};
|
||||
|
||||
// 双击标题最大化
|
||||
borderTitle.MouseLeftButtonDown += (s, e) =>
|
||||
{
|
||||
if (e.ClickCount >= 2)
|
||||
WindowState = WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#region 万能查找控件方法(核心)
|
||||
/// <summary>
|
||||
/// 在可视化树中查找指定名称的子元素
|
||||
/// </summary>
|
||||
public static T FindChild<T>(DependencyObject parent, string childName) where T : DependencyObject
|
||||
{
|
||||
if (parent == null) return null;
|
||||
|
||||
T foundChild = null;
|
||||
int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
|
||||
|
||||
for (int i = 0; i < childrenCount; i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(parent, i);
|
||||
|
||||
if (child is T tChild && child is FrameworkElement element && element.Name == childName)
|
||||
{
|
||||
foundChild = tChild;
|
||||
break;
|
||||
}
|
||||
|
||||
foundChild = FindChild<T>(child, childName);
|
||||
if (foundChild != null) break;
|
||||
}
|
||||
return foundChild;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void InitializeStyle()
|
||||
{
|
||||
Style = (Style)Application.Current.Resources["BaseWindowStyle"];
|
||||
}
|
||||
|
||||
////==================================================
|
||||
//private void InitializeEvent()
|
||||
//{
|
||||
// ControlTemplate baseWindowTemplate = (ControlTemplate)App.Current.Resources["BaseWindowControlTemplate"];
|
||||
|
||||
// //Button minBtn = (Button)baseWindowTemplate.FindName("btnMin", this);
|
||||
// //minBtn.Click += delegate
|
||||
// //{
|
||||
|
||||
// // this.WindowState = WindowState.Minimized;
|
||||
// //};
|
||||
|
||||
// //Button maxBtn = (Button)baseWindowTemplate.FindName("btnMax", this);
|
||||
// //maxBtn.Click += delegate
|
||||
// //{
|
||||
|
||||
// // this.WindowState = (this.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal);
|
||||
// //};
|
||||
|
||||
// //Button closeBtn = this.FindName("btnClose") as Button;
|
||||
|
||||
// Button closeBtn = (Button)baseWindowTemplate.FindName("btnClose", this);
|
||||
// closeBtn.Click += delegate
|
||||
// {
|
||||
// this.Close();
|
||||
// };
|
||||
|
||||
// Border borderTitle = (Border)baseWindowTemplate.FindName("borderTitle", this);
|
||||
// borderTitle.MouseMove += delegate (object sender, MouseEventArgs e)
|
||||
// {
|
||||
// if (e.LeftButton == MouseButtonState.Pressed)
|
||||
// {
|
||||
// this.DragMove();
|
||||
// }
|
||||
// };
|
||||
// borderTitle.MouseLeftButtonDown += delegate (object sender, MouseButtonEventArgs e)
|
||||
// {
|
||||
// if (e.ClickCount >= 2)
|
||||
// {
|
||||
// //maxBtn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
|
||||
// }
|
||||
// };
|
||||
//}
|
||||
|
||||
|
||||
//private void InitializeStyle()
|
||||
//{
|
||||
// this.Style = (Style)App.Current.Resources["BaseWindowStyle"];
|
||||
//}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
86
SamplePreSystem.UI/BaseControls/PasswordAttaExt.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace SamplePreSystem.UI.BaseControls
|
||||
{
|
||||
public class PasswordAttaExt
|
||||
{
|
||||
|
||||
|
||||
public static string GetCustomPwd(DependencyObject obj)
|
||||
{
|
||||
return (string)obj.GetValue(CustomPwdProperty);
|
||||
}
|
||||
|
||||
public static void SetCustomPwd(DependencyObject obj, string value)
|
||||
{
|
||||
obj.SetValue(CustomPwdProperty, value);
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for CustomPwd. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty CustomPwdProperty =
|
||||
DependencyProperty.RegisterAttached("CustomPwd", typeof(string), typeof(PasswordAttaExt), new PropertyMetadata("", OnPropertyChangeBack));
|
||||
|
||||
private static void OnPropertyChangeBack(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
PasswordBox pb = d as PasswordBox;
|
||||
if (pb != null)
|
||||
{
|
||||
if (e.NewValue.ToString() != pb.Password)
|
||||
{
|
||||
pb.Password = e.NewValue.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region 设置事件绑定触发条件
|
||||
|
||||
|
||||
public static bool GetIsOpenPwdBading(DependencyObject obj)
|
||||
{
|
||||
return (bool)obj.GetValue(IsOpenPwdBadingProperty);
|
||||
}
|
||||
|
||||
public static void SetIsOpenPwdBading(DependencyObject obj, bool value)
|
||||
{
|
||||
obj.SetValue(IsOpenPwdBadingProperty, value);
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for IsOpenPwdBading. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty IsOpenPwdBadingProperty =
|
||||
DependencyProperty.RegisterAttached("IsOpenPwdBading", typeof(bool), typeof(PasswordAttaExt), new PropertyMetadata(false, OnValEventChangeBack));
|
||||
|
||||
private static void OnValEventChangeBack(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
PasswordBox pd = d as PasswordBox;
|
||||
if (pd != null)
|
||||
{
|
||||
pd.PasswordChanged -= Pd_PasswordChanged;
|
||||
pd.PasswordChanged += Pd_PasswordChanged;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void Pd_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PasswordBox pb = sender as PasswordBox;
|
||||
if (pb != null)
|
||||
{
|
||||
SetCustomPwd((DependencyObject)sender, pb.Password);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
117
SamplePreSystem.UI/BaseControls/RingProgressBar.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SamplePreSystem.UI.BaseControls
|
||||
{
|
||||
public class RingProgressBar : FrameworkElement
|
||||
{
|
||||
/// <summary>
|
||||
/// 声明并注册一个依赖属性 Progress,用于控制进度条显示的百分比(0 ~ 100)。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ProgressProperty =
|
||||
DependencyProperty.Register(
|
||||
nameof(Progress), // 属性名称
|
||||
typeof(double), // 属性类型
|
||||
typeof(RingProgressBar), // 所属类型
|
||||
new FrameworkPropertyMetadata(
|
||||
0.0, // 默认值
|
||||
FrameworkPropertyMetadataOptions.AffectsRender // 当值变化时自动触发重绘
|
||||
));
|
||||
|
||||
/// <summary>
|
||||
/// Progress 属性包装器,提供进度值的获取和设置。
|
||||
/// 设置时自动裁剪到 0~100 范围。
|
||||
/// </summary>
|
||||
public double Progress
|
||||
{
|
||||
get => (double)GetValue(ProgressProperty);
|
||||
set => SetValue(ProgressProperty, Math.Max(0, Math.Min(100, value)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写 OnRender 方法,使用 DrawingContext 绘制控件外观。
|
||||
/// </summary>
|
||||
protected override void OnRender(DrawingContext dc)
|
||||
{
|
||||
double width = ActualWidth;
|
||||
double height = ActualHeight;
|
||||
|
||||
// 根据控件尺寸计算圆环半径,保留 5 像素边距
|
||||
double radius = Math.Min(width, height) / 2 - 5;
|
||||
|
||||
// 圆心位置
|
||||
Point center = new Point(width / 2, height / 2);
|
||||
|
||||
// 1. 绘制背景圆环(灰色圆环)
|
||||
dc.DrawEllipse(
|
||||
null, // 无填充
|
||||
new Pen(Brushes.LightGray, 30), // 使用浅灰色画笔,宽度10
|
||||
center, // 圆心
|
||||
radius, radius // 水平半径 & 垂直半径
|
||||
);
|
||||
|
||||
// 2. 计算进度角度(转换为 0~360)
|
||||
double angle = Progress / 100 * 360;
|
||||
|
||||
// 3. 将角度转换为弧度,-90 是为了从正上方开始绘制
|
||||
double radians = (angle - 90) * Math.PI / 180;
|
||||
|
||||
// 4. 圆环起点:圆顶部
|
||||
Point startPoint = new Point(center.X, center.Y - radius);
|
||||
|
||||
// 5. 计算终点:根据弧度计算 X/Y
|
||||
Point endPoint = new Point(
|
||||
center.X + radius * Math.Cos(radians),
|
||||
center.Y + radius * Math.Sin(radians)
|
||||
);
|
||||
|
||||
// 6. 判断是否需要绘制大角度弧(超过180度)
|
||||
bool isLargeArc = angle > 180;
|
||||
|
||||
// 7. 创建一个弧线段,从 startPoint 到 endPoint,构成圆环的一部分
|
||||
PathFigure figure = new PathFigure(
|
||||
startPoint, // 弧线起点
|
||||
new[]
|
||||
{
|
||||
new ArcSegment(
|
||||
endPoint, // 弧线终点
|
||||
new Size(radius, radius), // 弧线的X/Y半径
|
||||
0, // 旋转角度
|
||||
isLargeArc, // 是否为大角度弧线
|
||||
SweepDirection.Clockwise, // 顺时针方向
|
||||
true // 弧线是否可见(用于裁剪,一般设为 true)
|
||||
)
|
||||
},
|
||||
false // 图形是否闭合(环形不闭合)
|
||||
);
|
||||
|
||||
// 8. 创建 PathGeometry 对象用于绘制
|
||||
PathGeometry geometry = new PathGeometry();
|
||||
geometry.Figures.Add(figure);
|
||||
|
||||
// 9. 绘制进度圆环(蓝色)
|
||||
dc.DrawGeometry(
|
||||
null, // 无填充
|
||||
new Pen(Brushes.SteelBlue, 30), // 钢蓝色画笔,宽度10
|
||||
geometry // 绘制路径
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Measure 阶段:建议大小为 100x100。
|
||||
/// </summary>
|
||||
protected override Size MeasureOverride(Size availableSize) => new Size(100, 100);
|
||||
|
||||
/// <summary>
|
||||
/// Arrange 阶段:直接接受布局系统给予的最终大小。
|
||||
/// </summary>
|
||||
protected override Size ArrangeOverride(Size finalSize) => finalSize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
35
SamplePreSystem.UI/Behaviors/BorderMouseMoveBehavior.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
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.Input;
|
||||
|
||||
namespace SamplePreSystem.UI.Behaviors
|
||||
{
|
||||
public class BorderMouseMoveBehavior :Behavior<Border>
|
||||
{
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
//base.OnAttached();
|
||||
|
||||
AssociatedObject.MouseMove += AssociatedObject_MouseMove;
|
||||
}
|
||||
|
||||
private void AssociatedObject_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
{
|
||||
// 获取窗口并执行拖拽
|
||||
if (Window.GetWindow(AssociatedObject) is Window window)
|
||||
{
|
||||
window.DragMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
90
SamplePreSystem.UI/Behaviors/DataGridDragBehavior.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using SamplePre.Models;
|
||||
using SamplePreSystem.UI.ViewModel.SopManager;
|
||||
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.Input;
|
||||
|
||||
namespace SamplePreSystem.UI.Behaviors
|
||||
{
|
||||
public class DataGridDragBehavior :Behavior<DataGrid>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
//拖拽进入
|
||||
AssociatedObject.DragEnter += AssociatedObject_DragEnter;
|
||||
|
||||
AssociatedObject.Drop += AssociatedObject_Drop;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public ICommand DropCompletedCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(DropCompletedCommandProperty); }
|
||||
set { SetValue(DropCompletedCommandProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for DropCompletedCommand. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty DropCompletedCommandProperty =
|
||||
DependencyProperty.Register("DropCompletedCommand", typeof(ICommand), typeof(DataGridDragBehavior), new PropertyMetadata(null));
|
||||
|
||||
|
||||
|
||||
//// 可选:传递参数(比如拖拽后的数据源、拖拽前后索引)
|
||||
//public static readonly DependencyProperty DropCommandParameterProperty =
|
||||
// DependencyProperty.Register(
|
||||
// nameof(DropCommandParameter),
|
||||
// typeof(object),
|
||||
// typeof(DataGridDragBehavior));
|
||||
|
||||
//public object DropCommandParameter
|
||||
//{
|
||||
// get => GetValue(DropCommandParameterProperty);
|
||||
// set => SetValue(DropCommandParameterProperty, value);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
private void AssociatedObject_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
|
||||
// 获取拖拽的数据
|
||||
if (e.Data.GetData(typeof(TreeListItem)) is TreeListItem dropItem)
|
||||
{
|
||||
|
||||
if (dropItem == null) return;
|
||||
|
||||
//var dataContext = this.DataContext as SopMangerViewModel;
|
||||
//dataContext.AddDragSopAction(dropItem);
|
||||
if (DropCompletedCommand != null && DropCompletedCommand.CanExecute(dropItem))
|
||||
{
|
||||
DropCompletedCommand.Execute(dropItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void AssociatedObject_DragEnter(object sender, System.Windows.DragEventArgs e)
|
||||
{
|
||||
// 验证拖拽数据类型是否是我们需要的TreeItemModel
|
||||
if (!e.Data.GetDataPresent(typeof(TreeListItem)))
|
||||
{
|
||||
e.Effects = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
85
SamplePreSystem.UI/Behaviors/TreeViewDragBehavior.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using SamplePre.Models;
|
||||
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.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SamplePreSystem.UI.Behaviors
|
||||
{
|
||||
public class TreeViewDragBehavior :Behavior<TreeView>
|
||||
{
|
||||
|
||||
// 拖拽起始点(用于判断是否是有效拖拽)
|
||||
private Point _dragStartPoint;
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
|
||||
//记录鼠标按下时的坐标
|
||||
AssociatedObject.PreviewMouseLeftButtonDown += AssociatedObject_PreviewMouseLeftButtonDown;
|
||||
|
||||
//处理TreeView的鼠标移动事件,触发拖拽
|
||||
AssociatedObject.PreviewMouseMove += AssociatedObject_PreviewMouseMove;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理TreeView的鼠标移动事件,触发拖拽
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void AssociatedObject_PreviewMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
|
||||
{
|
||||
// 获取当前鼠标位置
|
||||
Point currentPoint = e.GetPosition(null);
|
||||
// 计算鼠标移动的距离(过滤掉微小移动,避免误触发拖拽)
|
||||
Vector dragVector = _dragStartPoint - currentPoint;
|
||||
|
||||
// 如果鼠标左键按下,且移动距离超过阈值(系统默认的拖拽阈值),则开始拖拽
|
||||
if (e.LeftButton == MouseButtonState.Pressed &&
|
||||
(Math.Abs(dragVector.X) > SystemParameters.MinimumHorizontalDragDistance ||
|
||||
Math.Abs(dragVector.Y) > SystemParameters.MinimumVerticalDragDistance))
|
||||
{
|
||||
// 获取当前鼠标下的TreeViewItem
|
||||
var treeViewItem = FindVisualParent<TreeViewItem>(e.OriginalSource as DependencyObject);
|
||||
if (treeViewItem != null && treeViewItem.DataContext is TreeListItem dragItem)
|
||||
{
|
||||
// 开始拖拽,设置拖拽数据和拖拽效果
|
||||
DragDrop.DoDragDrop(treeViewItem, dragItem, DragDropEffects.Copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找可视化树中的父级控件(通用方法)
|
||||
/// </summary>
|
||||
private T FindVisualParent<T>(DependencyObject child) where T : DependencyObject
|
||||
{
|
||||
DependencyObject parentObject = VisualTreeHelper.GetParent(child);
|
||||
if (parentObject == null) return null;
|
||||
|
||||
if (parentObject is T parent)
|
||||
return parent;
|
||||
else
|
||||
return FindVisualParent<T>(parentObject);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void AssociatedObject_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
// 记录鼠标按下时的坐标
|
||||
_dragStartPoint = e.GetPosition(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
77
SamplePreSystem.UI/SamplePreSystem.UI.csproj
Normal file
@@ -0,0 +1,77 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\app.ico" />
|
||||
<None Remove="Assets\App.png" />
|
||||
<None Remove="Assets\login.png" />
|
||||
<None Remove="Assets\progressBar.png" />
|
||||
<None Remove="Assets\Warning.png" />
|
||||
<None Remove="Assets\分液1.png" />
|
||||
<None Remove="Assets\加液1.png" />
|
||||
<None Remove="Assets\固相萃取1.png" />
|
||||
<None Remove="Assets\机器人1.png" />
|
||||
<None Remove="Assets\样品管理.png" />
|
||||
<None Remove="Assets\氮吹1.png" />
|
||||
<None Remove="Assets\离心机1.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
<PackageReference Include="HandyControl" Version="3.5.1" />
|
||||
<PackageReference Include="MaterialDesignColors" Version="5.3.1" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="5.3.1" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.142" />
|
||||
<PackageReference Include="EPPlus" Version="7.0.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SamplePre.Common\SamplePre.Common.csproj" />
|
||||
<ProjectReference Include="..\SamplePre.Communication\SamplePre.Communication.csproj" />
|
||||
<ProjectReference Include="..\SamplePre.Models\SamplePre.Models.csproj" />
|
||||
<ProjectReference Include="..\SamplePre.ProcessBll\SamplePre.ProcessBll.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Assets\App.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\login.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\progressBar.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\Warning.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\分液1.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\加液1.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\固相萃取1.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\机器人1.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\样品管理.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\氮吹1.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Assets\离心机1.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
59
SamplePreSystem.UI/Styles/BaseButtonStyle.xaml
Normal file
@@ -0,0 +1,59 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
|
||||
|
||||
<!--<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="#106EBE"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
-->
|
||||
<!--<Setter Property="FontSize" Value="16"/>-->
|
||||
<!--<Setter Property="FontFamily" Value="Assets/font/#iconfont"/>-->
|
||||
<!--
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background }">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="LightBlue"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>-->
|
||||
|
||||
|
||||
<!-- ===================== MaterialDesign 图标+文字按钮 ===================== -->
|
||||
<Style
|
||||
x:Key="IconTextButtonStyle"
|
||||
BasedOn="{StaticResource MaterialDesignRaisedButton}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Width" Value="120" />
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<!-- 关键:用 DataTemplate不破坏按钮样式 -->
|
||||
<DataTemplate>
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<materialDesign:PackIcon
|
||||
Width="20"
|
||||
Height="20"
|
||||
Kind="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Tag}" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
23
SamplePreSystem.UI/Styles/BaseDataGrid.xaml
Normal file
@@ -0,0 +1,23 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style x:Key="XBaseDataGrid" TargetType="DataGrid">
|
||||
|
||||
<!-- 表头样式:增加内边距 -->
|
||||
<Setter Property="ColumnHeaderStyle">
|
||||
<Setter.Value>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<!-- 表头背景色 -->
|
||||
<Setter Property="Background" Value="#F5F5F5" />
|
||||
<!-- 表头文字颜色 -->
|
||||
<!--
|
||||
<Setter Property="Foreground" Value="#2C7DBD"/>-->
|
||||
<!-- 表头高度 -->
|
||||
<Setter Property="Height" Value="35" />
|
||||
<!-- 表头文字居中 -->
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
</Style>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
13
SamplePreSystem.UI/Styles/BaseTreeView.xaml
Normal file
@@ -0,0 +1,13 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
<!-- 仅针对字体、间距的TreeView极简美化样式 -->
|
||||
<Style TargetType="TreeView">
|
||||
<!-- TreeView整体内边距:避免控件紧贴窗口 -->
|
||||
<Setter Property="Padding" Value="8" />
|
||||
<!-- 整体背景:白色更清爽 -->
|
||||
<Setter Property="Background" Value="White" />
|
||||
<!-- 滚动条优化:避免文字被遮挡 -->
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
277
SamplePreSystem.UI/Styles/BaseWindowStyle.xaml
Normal file
@@ -0,0 +1,277 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
|
||||
<ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Window}">
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<Grid>
|
||||
<AdornerDecorator>
|
||||
<ContentPresenter />
|
||||
</AdornerDecorator>
|
||||
<ResizeGrip
|
||||
x:Name="WindowResizeGrip"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
IsTabStop="false"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="ResizeMode" Value="CanResizeWithGrip" />
|
||||
<Condition Property="WindowState" Value="Normal" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="WindowResizeGrip" Property="Visibility" Value="Visible" />
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="BaseWindowControlTemplate" TargetType="{x:Type Window}">
|
||||
<DockPanel LastChildFill="True">
|
||||
<!-- 外边框 -->
|
||||
<Border
|
||||
x:Name="borderTitle"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
Background="#0170cc"
|
||||
CornerRadius="0,0,0,0"
|
||||
DockPanel.Dock="Top">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<TextBlock
|
||||
Name="Title"
|
||||
Grid.Column="0"
|
||||
Margin="20,0,2,2"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="{TemplateBinding Title}" />
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<!-- 最小化按钮 -->
|
||||
<!--
|
||||
<Button
|
||||
x:Name="btnMin"
|
||||
Margin="2,2,2,2"
|
||||
Content="M"
|
||||
Style="{DynamicResource MinButtonStyle}" />
|
||||
|
||||
|
||||
-->
|
||||
<!-- 最大化按钮 -->
|
||||
<!--
|
||||
<Button
|
||||
x:Name="btnMax"
|
||||
Margin="2,2,2,2"
|
||||
Content="M"
|
||||
Style="{DynamicResource MaxButtonStyle}" />-->
|
||||
<!-- 关闭按钮 -->
|
||||
|
||||
<Button
|
||||
x:Name="btnClose"
|
||||
Margin="2,2,2,2"
|
||||
Content="🗙"
|
||||
Style="{DynamicResource CloseButtonStyle2}" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</Border>
|
||||
<Border
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="LightGray"
|
||||
BorderThickness="2"
|
||||
CornerRadius="0,0,4,4"
|
||||
DockPanel.Dock="Top">
|
||||
<AdornerDecorator>
|
||||
<ContentPresenter />
|
||||
</AdornerDecorator>
|
||||
</Border>
|
||||
</DockPanel>
|
||||
</ControlTemplate>
|
||||
<Style x:Key="BaseWindowStyle" TargetType="{x:Type Window}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
|
||||
<Setter Property="Template" Value="{StaticResource BaseWindowControlTemplate}" />
|
||||
|
||||
<Setter Property="AllowsTransparency" Value="True" />
|
||||
<Setter Property="WindowStyle" Value="None" />
|
||||
<Setter Property="BorderBrush" Value="#FF7097D0" />
|
||||
<Setter Property="BorderThickness" Value="4,4,4,4" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="ResizeMode" Value="CanResizeWithGrip">
|
||||
<Setter Property="Template" Value="{StaticResource WindowTemplateKey}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!-- 最小化按钮 -->
|
||||
<Style x:Key="MinButtonStyle" TargetType="{x:Type Button}">
|
||||
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<!-- 修改模板属性 -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<!-- 控件模板 -->
|
||||
<ControlTemplate TargetType="Button">
|
||||
<!-- 背景色 -->
|
||||
<Border
|
||||
x:Name="back"
|
||||
Margin="1"
|
||||
Padding="2,0,0,0"
|
||||
Background="#FFFFE9C9"
|
||||
BorderBrush="#FFCDA05F"
|
||||
BorderThickness="1"
|
||||
CornerRadius="0"
|
||||
Opacity="0.8">
|
||||
<!-- 按钮内容 -->
|
||||
<Path
|
||||
x:Name="cp"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Fill="Black"
|
||||
Stroke="#FFCEA15F"
|
||||
StrokeThickness="3">
|
||||
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M 0,6 H 6,6 " />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
|
||||
<Setter TargetName="back" Property="Background" Value="#FFD4BD9B" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="back" Property="Background" Value="#FFCDA05F" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 最大化按钮 -->
|
||||
<Style x:Key="MaxButtonStyle" TargetType="{x:Type Button}">
|
||||
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<!-- 修改模板属性 -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<!-- 控件模板 -->
|
||||
<ControlTemplate TargetType="Button">
|
||||
<!-- 背景色 -->
|
||||
<Border
|
||||
x:Name="back"
|
||||
Margin="1"
|
||||
Padding="2,0,0,0"
|
||||
Background="#FFFFE9C9"
|
||||
BorderBrush="#FFCDA05F"
|
||||
BorderThickness="1"
|
||||
CornerRadius="0"
|
||||
Opacity="0.8">
|
||||
<!-- 按钮内容 -->
|
||||
<Path
|
||||
x:Name="cp"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Stroke="#FFCEA15F"
|
||||
StrokeThickness="3">
|
||||
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M 0,0 L 0,12 12,12 12,0 0,0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
|
||||
<Setter TargetName="back" Property="Background" Value="#FFD4BD9B" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="back" Property="Background" Value="#FFCDA05F" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 关闭按钮 -->
|
||||
<Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}">
|
||||
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<!-- 修改模板属性 -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<!-- 控件模板 -->
|
||||
<ControlTemplate TargetType="Button">
|
||||
<!-- 背景色 -->
|
||||
<Border
|
||||
x:Name="back"
|
||||
Width="30"
|
||||
Height="30"
|
||||
Margin="0,0"
|
||||
Padding="0,0,0,0"
|
||||
BorderThickness="1"
|
||||
CornerRadius="0">
|
||||
<!-- 按钮内容 -->
|
||||
<Path
|
||||
x:Name="cp"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Stroke="White"
|
||||
StrokeThickness="2">
|
||||
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M 0,0 L 12,12 M 0,12 L 12,0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
|
||||
<Setter TargetName="back" Property="Background" Value="DarkRed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="back" Property="Background" Value="DarkRed" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<Style
|
||||
x:Key="CloseButtonStyle2"
|
||||
BasedOn="{StaticResource MaterialDesignFlatMidBgButton}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Width" Value="32" />
|
||||
<Setter Property="Height" Value="32" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="DarkRed" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
211
SamplePreSystem.UI/ViewModel/Child/ImportSampleViewModel.cs
Normal file
@@ -0,0 +1,211 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.ProcessBll.SampleSequence;
|
||||
using SamplePreSystem.UI.ViewModel.SampleManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using static MaterialDesignThemes.Wpf.Theme;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Child
|
||||
{
|
||||
public partial class ImportSampleViewModel: ObservableObject
|
||||
{
|
||||
|
||||
SampleSequenceBll sampleSequenceBll = new SampleSequenceBll();
|
||||
|
||||
|
||||
|
||||
SampleExecViewModel sampleExecViewModel;
|
||||
|
||||
// 关闭窗口的委托
|
||||
public Action<bool> CloseAction { get; set; }
|
||||
|
||||
|
||||
|
||||
public ImportSampleViewModel(SampleExecViewModel _sampleExecViewModel)
|
||||
{
|
||||
GetData();
|
||||
|
||||
sampleExecViewModel = _sampleExecViewModel;
|
||||
}
|
||||
|
||||
|
||||
private DateTime _startDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
|
||||
public DateTime StartDate
|
||||
{
|
||||
get { return _startDate; }
|
||||
set
|
||||
{
|
||||
|
||||
|
||||
SetProperty(ref _startDate, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private DateTime _endDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
|
||||
public DateTime EndDate
|
||||
{
|
||||
get { return _endDate; }
|
||||
set
|
||||
{
|
||||
|
||||
SetProperty(ref _endDate, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<tube_input_ext> _sampleList = new List<tube_input_ext>();
|
||||
|
||||
|
||||
public List<tube_input_ext> SampleList
|
||||
{
|
||||
get { return _sampleList; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _sampleList, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void GetData()
|
||||
{
|
||||
//DateTime dt1 = DateTime.Parse(dt_start.DateTime.ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
//DateTime dt2 = DateTime.Parse(dt_end.DateTime.ToString("yyyy-MM-dd") + " 23:00:00");
|
||||
|
||||
var templist = sampleSequenceBll.GetTubeData(StartDate, EndDate); ///
|
||||
|
||||
List<tube_input_ext> samples = new List<tube_input_ext>();
|
||||
|
||||
foreach(var item in templist)
|
||||
{
|
||||
item.bach_no = $"批号:{item.bach_no}";
|
||||
|
||||
tube_input_ext model = new tube_input_ext();
|
||||
model.qrcode = item.qrcode;
|
||||
model.item_name = item.item_name;
|
||||
model.tube_type = item.tube_type;
|
||||
model.standrad_id = item.standrad_id;
|
||||
model.standrad = item.standrad;
|
||||
model.input_user = item.input_user;
|
||||
model.input_date = item.input_date;
|
||||
model.weight = item.weight;
|
||||
model.tube_count = item.tube_count;
|
||||
model.bach_no = $"批号:{item.bach_no}";
|
||||
model.IsSelected = false;
|
||||
samples.Add(model);
|
||||
}
|
||||
|
||||
SampleList = samples;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public bool? IsAllItems1Selected
|
||||
{
|
||||
get
|
||||
{
|
||||
var selected = SampleList.Select(item => item.IsSelected).Distinct().ToList();
|
||||
return selected.Count == 1 ? selected.Single() : false;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value.HasValue)
|
||||
{
|
||||
SelectAll(value.Value, SampleList);
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择所有
|
||||
/// </summary>
|
||||
/// <param name="select"></param>
|
||||
/// <param name="models"></param>
|
||||
private static void SelectAll(bool select, IEnumerable<tube_input_ext> models)
|
||||
{
|
||||
foreach (var model in models)
|
||||
{
|
||||
model.IsSelected = select;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择组内数据
|
||||
/// </summary>
|
||||
/// <param name="bachCode"></param>
|
||||
/// <param name="isSelect"></param>
|
||||
public void SelectGroupData(string bachCode, bool isSelect)
|
||||
{
|
||||
foreach (var item in SampleList.Where(p => p.bach_no == bachCode))
|
||||
{
|
||||
item.IsSelected = isSelect;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void FindClick()
|
||||
{
|
||||
|
||||
GetData();
|
||||
|
||||
ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(SampleList);//获取数据视图
|
||||
//分组
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("bach_no"));
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
public void ImportClick()
|
||||
{
|
||||
List<tube_input> samples = new List<tube_input>();
|
||||
foreach (var tube in SampleList)
|
||||
{
|
||||
|
||||
if (tube.IsSelected)
|
||||
{
|
||||
samples.Add(tube);
|
||||
}
|
||||
}
|
||||
|
||||
this.sampleExecViewModel.TubeInputs = samples;
|
||||
|
||||
CloseAction?.Invoke(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中导入项
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void CheckBoxClick(object groupName)
|
||||
{
|
||||
System.Windows.Controls.CheckBox checkBox = groupName as System.Windows.Controls.CheckBox;
|
||||
if (checkBox != null)
|
||||
{
|
||||
bool select = (bool)checkBox.IsChecked;
|
||||
string code = checkBox.Content.ToString();
|
||||
|
||||
SelectGroupData(code, select);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
120
SamplePreSystem.UI/ViewModel/Child/NewActionViewModel.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using Models.Const;
|
||||
using Models.Models;
|
||||
using SamplePre.Models;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Child
|
||||
{
|
||||
|
||||
|
||||
|
||||
public class NewActionViewModel: INotifyPropertyChanged
|
||||
{
|
||||
ActionMangerBll actionMangerBll = new ActionMangerBll();
|
||||
|
||||
public NewActionViewModel()
|
||||
{
|
||||
|
||||
BindingUnit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void BindingUnit()
|
||||
{
|
||||
ActionUnits = SystemConst.dictDatas.Where(p => p.class_id == 2).ToList();
|
||||
}
|
||||
|
||||
|
||||
private List<sys_dict> actionUnits;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public List<sys_dict> ActionUnits
|
||||
{
|
||||
get { return actionUnits; }
|
||||
set { actionUnits = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选择的动作单元
|
||||
/// </summary>
|
||||
private sys_dict _selectSysDict;
|
||||
|
||||
public sys_dict SelectSysDict
|
||||
{
|
||||
get { return _selectSysDict; }
|
||||
set { _selectSysDict = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
private sys_action sysAction = new sys_action();
|
||||
|
||||
public sys_action SysAction
|
||||
{
|
||||
get { return sysAction; }
|
||||
set { sysAction = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int SaveNewData()
|
||||
{
|
||||
if (string.IsNullOrEmpty(SysAction.action_name))
|
||||
{
|
||||
MessageBox.Show("内容不能为空");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//判断plc编码是否重复
|
||||
if (actionMangerBll.IsExtisPlCcode(SysAction.plc_type))
|
||||
{
|
||||
MessageBox.Show("存在相同plc编码,不能保存!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
sys_action process = new sys_action();
|
||||
|
||||
process.id = Guid.NewGuid().ToString();
|
||||
process.action_name = SysAction.action_name;
|
||||
process.plc_type = SysAction.plc_type;
|
||||
process.remark = SysAction.remark;
|
||||
|
||||
//var selectItem = cmbActionUnit.SelectedItem as ComboBoxListItem;
|
||||
process.action_unit = SelectSysDict.id;
|
||||
//process.action_adress = actionAdress.Text;
|
||||
|
||||
int val = actionMangerBll.SaveSysAction(process);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
218
SamplePreSystem.UI/ViewModel/Child/SelectParmListViewModel.cs
Normal file
@@ -0,0 +1,218 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Child
|
||||
{
|
||||
public partial class SelectParmListViewModel : ObservableObject
|
||||
{
|
||||
|
||||
ActionMangerBll actionMangerBll = new ActionMangerBll();
|
||||
|
||||
SOPManagerBll sopBll = new SOPManagerBll();
|
||||
|
||||
sys_standard_action_ext sysStandardAction = null;
|
||||
|
||||
sys_action_ext sysAction = null;
|
||||
|
||||
// 关闭窗口的委托
|
||||
public Action<bool> CloseAction { get; set; }
|
||||
|
||||
public SelectParmListViewModel(sys_standard_action_ext _sysStandardAction)
|
||||
{
|
||||
sysStandardAction = _sysStandardAction;
|
||||
GetData();
|
||||
|
||||
FilterData(FilterType);
|
||||
}
|
||||
|
||||
public SelectParmListViewModel(sys_action_ext _sysAction)
|
||||
{
|
||||
sysAction = _sysAction;
|
||||
GetData();
|
||||
|
||||
FilterData(FilterType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<string> dataTypes = new List<string> { "通用", "耗材", "液体" };
|
||||
|
||||
/// <summary>
|
||||
/// 所有参数列表
|
||||
/// </summary>
|
||||
private List<sys_parm> allSysParams = new List<sys_parm>();
|
||||
|
||||
/// <summary>
|
||||
/// 过滤参数列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<sys_parm> parms = new List<sys_parm>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中的参数列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public sys_parm selectParm = new sys_parm();
|
||||
|
||||
|
||||
|
||||
public void GetData()
|
||||
{
|
||||
if (Parms.Count <= 0)
|
||||
{
|
||||
//parms = standardDal.QuerySysParm();
|
||||
allSysParams = actionMangerBll.QuerySysParm();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private string filterType = "通用";
|
||||
/// <summary>
|
||||
/// 类型过滤属性
|
||||
/// </summary>
|
||||
public string FilterType
|
||||
{
|
||||
get { return filterType; }
|
||||
set {
|
||||
|
||||
SetProperty(ref filterType, value);
|
||||
|
||||
FilterData(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void FilterData(string dataType)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dataType))
|
||||
{
|
||||
Parms = allSysParams;
|
||||
return;
|
||||
}
|
||||
|
||||
Parms = allSysParams.Where(p => p.param_type == dataType).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int SaveData(List<sys_parm> selectParam)
|
||||
{
|
||||
int val = -1;
|
||||
if (sysStandardAction != null)
|
||||
{
|
||||
val = SavaDataSop(selectParam);
|
||||
}
|
||||
else if(sysAction != null)
|
||||
{
|
||||
val = SavaDataActionParam(selectParam);
|
||||
}
|
||||
|
||||
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
private int SavaDataActionParam(List<sys_parm> selectParam)
|
||||
{
|
||||
|
||||
//保存
|
||||
List<sys_action_parm_map> actionParams = new List<sys_action_parm_map>();
|
||||
foreach (var item in selectParam)
|
||||
{
|
||||
sys_action_parm_map map = new sys_action_parm_map();
|
||||
map.process_id = sysAction.id;
|
||||
map.parm_id = item.id;
|
||||
//standardDal.Save_process_parm_map(map);
|
||||
actionParams.Add(map);
|
||||
}
|
||||
|
||||
int val = actionMangerBll.SaveActionParm(actionParams);
|
||||
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
private int SavaDataSop(List<sys_parm> selectParam)
|
||||
{
|
||||
//保存
|
||||
List<sys_standard_action_parm> actionParms = new List<sys_standard_action_parm>();
|
||||
foreach (var item in selectParam)
|
||||
{
|
||||
//保存标准动作参数表
|
||||
sys_standard_action_parm parmmodel = new sys_standard_action_parm()
|
||||
{
|
||||
id = Guid.NewGuid().ToString(),
|
||||
standard_id = sysStandardAction.standard_id,
|
||||
action_id = sysStandardAction.process_id,
|
||||
action_seqno = sysStandardAction.process_no,
|
||||
parm_id = item.id,
|
||||
data_value = item.data_value,
|
||||
parm_seqno = 0
|
||||
};
|
||||
|
||||
actionParms.Add(parmmodel);
|
||||
|
||||
}
|
||||
|
||||
int val = sopBll.SaveStandardActionParam(actionParms);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 确定命令
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnOKClick()
|
||||
{
|
||||
|
||||
if (SelectParm != null)
|
||||
{
|
||||
List<sys_parm> selectParams = new List<sys_parm>();
|
||||
|
||||
selectParams.Add(SelectParm);
|
||||
|
||||
if (selectParams.Count > 0)
|
||||
{
|
||||
|
||||
if (SaveData(selectParams) > 0)
|
||||
{
|
||||
CloseAction?.Invoke(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消命令
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnCancelClick()
|
||||
{
|
||||
CloseAction?.Invoke(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.Models.Tables;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.ConfigManager
|
||||
{
|
||||
public class PermissionViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
RolesBll rolesBll = new RolesBll();
|
||||
|
||||
config_role configRole;
|
||||
|
||||
public PermissionViewModel(RoleViewModel vm)
|
||||
{
|
||||
configRole = vm.ConfigRole;
|
||||
|
||||
RoleName = configRole.name;
|
||||
|
||||
GetData();
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private string _roleName;
|
||||
|
||||
public string RoleName
|
||||
{
|
||||
get { return _roleName; }
|
||||
set { _roleName = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<TreeItemModel> _funList = new List<TreeItemModel>();
|
||||
|
||||
public List<TreeItemModel> FunList
|
||||
{
|
||||
get { return _funList; }
|
||||
set { _funList = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void GetData()
|
||||
{
|
||||
var FunListTemp = rolesBll.GetFuncDataTree();
|
||||
|
||||
foreach (var item in FunListTemp.Where(p=>p.parent_id == 0))
|
||||
{
|
||||
// 根节点1
|
||||
var root1 = new TreeItemModel { Id = item.id, Name = item.name };
|
||||
foreach(var child in FunListTemp.Where(p => p.parent_id == item.id))
|
||||
{
|
||||
root1.Children.Add(new TreeItemModel { Id = child.id, Name = child.name, Parent = root1 });
|
||||
|
||||
}
|
||||
|
||||
FunList.Add(root1);
|
||||
}
|
||||
|
||||
|
||||
//选择中角色已有权限
|
||||
List<int> ids = rolesBll.GetPermission(configRole.id);
|
||||
LoadRolePermissions(ids);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载指定角色已分配的权限(用于编辑角色权限)
|
||||
/// </summary>
|
||||
/// <param name="roleFunctionIds">角色已拥有的功能ID列表</param>
|
||||
public void LoadRolePermissions(List<int> roleFunctionIds)
|
||||
{
|
||||
if (roleFunctionIds == null || roleFunctionIds.Count == 0) return;
|
||||
|
||||
foreach (var item in FunList)
|
||||
{
|
||||
bool isAll = true;
|
||||
foreach (var fuc in item.Children)
|
||||
{
|
||||
if (roleFunctionIds.Contains(fuc.Id))
|
||||
{
|
||||
fuc.IsChecked = true;
|
||||
//item.IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isAll = false;
|
||||
}
|
||||
}
|
||||
if(isAll)
|
||||
{
|
||||
item.IsChecked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool SavePermission()
|
||||
{
|
||||
// 获取选中的功能ID列表
|
||||
List<int> selectedIds = GetSelectedFunctionIds();
|
||||
|
||||
if (selectedIds.Count == 0)
|
||||
{
|
||||
MessageBox.Show("请至少选择一个功能权限!", "提示");
|
||||
return false;
|
||||
}
|
||||
List<config_role_permisson> rolePermissonList = new List<config_role_permisson>();
|
||||
foreach (int item in selectedIds)
|
||||
{
|
||||
config_role_permisson rolePermisson = new config_role_permisson();
|
||||
rolePermisson.function_id = item;
|
||||
rolePermisson.role_id = configRole.id;
|
||||
rolePermissonList.Add(rolePermisson);
|
||||
}
|
||||
|
||||
|
||||
if (rolesBll.SavePermission(rolePermissonList) < 0)
|
||||
{
|
||||
MessageBox.Show("保存失败!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private List<int> GetSelectedFunctionIds()
|
||||
{
|
||||
List<int> selectedIds = new List<int>();
|
||||
|
||||
foreach (var item in FunList)
|
||||
{
|
||||
foreach(var fuc in item.Children)
|
||||
{
|
||||
if(fuc.IsChecked)
|
||||
{
|
||||
//添加父节点功能id
|
||||
if(!selectedIds.Contains(item.Id))
|
||||
{
|
||||
selectedIds.Add(item.Id);
|
||||
}
|
||||
|
||||
selectedIds.Add(fuc.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return selectedIds;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
154
SamplePreSystem.UI/ViewModel/ConfigManager/RoleViewModel.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using SamplePre.Models.Tables;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.UIWpf.ConfigManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.ConfigManager
|
||||
{
|
||||
public partial class RoleViewModel : ObservableObject
|
||||
{
|
||||
|
||||
RolesBll roleBll = new RolesBll();
|
||||
|
||||
public RoleViewModel()
|
||||
{
|
||||
|
||||
GetData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
private List<config_role> rolesList;
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
private config_role configRole = new config_role();
|
||||
|
||||
|
||||
|
||||
public void GetData()
|
||||
{
|
||||
|
||||
|
||||
RolesList = roleBll.GetRoles();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存角色
|
||||
/// </summary>
|
||||
public bool SaveRole()
|
||||
{
|
||||
if(string.IsNullOrEmpty(ConfigRole.name.Trim()))
|
||||
{
|
||||
MessageBox.Show("角色名称不能为空!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(ConfigRole.id))
|
||||
{
|
||||
//new
|
||||
ConfigRole.id = Guid.NewGuid().ToString();
|
||||
|
||||
if (roleBll.SaveRoleData(ConfigRole) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (roleBll.UpdateRoleData(ConfigRole) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DeleteRole()
|
||||
{
|
||||
if(!string.IsNullOrEmpty( ConfigRole.id ))
|
||||
{
|
||||
if (MessageBox.Show($"确定删除:{ConfigRole.name}", "提示",MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
if (roleBll.DeleteRole(ConfigRole) < 0)
|
||||
{
|
||||
MessageBox.Show("用户删除失败!");
|
||||
return false;
|
||||
}
|
||||
//刷新用户
|
||||
GetData();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加角色
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnAddClick()
|
||||
{
|
||||
ConfigRole = new config_role();
|
||||
NewRoleWindow frm = new NewRoleWindow(this);
|
||||
if (frm.ShowDialog() == true)
|
||||
{
|
||||
GetData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑角色
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnEditClick()
|
||||
{
|
||||
|
||||
|
||||
NewRoleWindow frm = new NewRoleWindow(this);
|
||||
if (frm.ShowDialog() == true)
|
||||
{
|
||||
GetData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除角色
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnDeleClick()
|
||||
{
|
||||
DeleteRole();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void BtnPermissonClick()
|
||||
{
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(ConfigRole.id)) return;
|
||||
PermissionWindow frm = new PermissionWindow(this);
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Models.Models;
|
||||
using SamplePre.Models;
|
||||
using SamplePre.Models.Models;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePreSystem.UI.ConfigManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.ConfigManager
|
||||
{
|
||||
public partial class SysConfigMangerViewModel : ObservableObject
|
||||
{
|
||||
|
||||
|
||||
SystemBll systemBll = new SystemBll();
|
||||
|
||||
public SysConfigMangerViewModel()
|
||||
{
|
||||
GetDictClassData();
|
||||
}
|
||||
|
||||
|
||||
private List<TreeItemModel> _dictClassList = new List<TreeItemModel>();
|
||||
|
||||
public List<TreeItemModel> DictClassList
|
||||
{
|
||||
get { return _dictClassList; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _dictClassList, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private sys_dict_class _dictClass = new sys_dict_class();
|
||||
|
||||
public sys_dict_class DictClass
|
||||
{
|
||||
get { return _dictClass; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _dictClass, value);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取字典分类数据
|
||||
/// </summary>
|
||||
public void GetDictClassData()
|
||||
{
|
||||
List<TreeItemModel> list = new List<TreeItemModel>();
|
||||
//获取样本
|
||||
var dictClassTemp = systemBll.QueryDictClassData();
|
||||
|
||||
var root1 = new TreeItemModel() { Id = 0, Name = "系统配置", IconKind = PackIconKind.DnsOutline };
|
||||
foreach (var item in dictClassTemp)
|
||||
{
|
||||
root1.Children.Add(new TreeItemModel() { Id = item.id, Name = item.dict_type,Parent = root1 , IconKind = PackIconKind.FileDocumentOutline });
|
||||
}
|
||||
list.Add(root1);
|
||||
|
||||
DictClassList = list;
|
||||
}
|
||||
|
||||
|
||||
private List<sys_dict> _sysdicts = new List<sys_dict>();
|
||||
|
||||
public List<sys_dict> SysDicts
|
||||
{
|
||||
get { return _sysdicts; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _sysdicts, value);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private sys_dict _sysDict = new sys_dict();
|
||||
|
||||
public sys_dict SysDict
|
||||
{
|
||||
get { return _sysDict; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _sysDict, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询字典明细
|
||||
/// </summary>
|
||||
/// <param name="standID"></param>
|
||||
public void GetDictData(int classid)
|
||||
{
|
||||
//查询
|
||||
SysDicts = systemBll.QueryDictByClassId(classid);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public bool NewAddDict()
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.DictClass.dict_type))
|
||||
{
|
||||
MessageBox.Show("内容不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
systemBll.SaveSysDictClass(DictClass);
|
||||
|
||||
//获取数据
|
||||
GetDictClassData();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void DeleteDict()
|
||||
{
|
||||
|
||||
if (MessageBox.Show($"确定移除:{DictClass.dict_type}", "提示",MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
//判断是否有子配置项
|
||||
if (this.systemBll.QueryDictByClassId(DictClass.id).Count > 0)
|
||||
{
|
||||
MessageBox.Show("存在配置子项目,不能删除!");
|
||||
return;
|
||||
}
|
||||
if (this.systemBll.DelDictClassById(DictClass.id) <= 0)
|
||||
{
|
||||
MessageBox.Show("删除失败!");
|
||||
return;
|
||||
}
|
||||
|
||||
//获取数据
|
||||
GetDictClassData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool NewAddDictDetail()
|
||||
{
|
||||
if (SysDict == null || string.IsNullOrEmpty(this.SysDict.data_type) || string.IsNullOrEmpty(this.SysDict.data_value))
|
||||
{
|
||||
MessageBox.Show("内容不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
SysDict.class_id = DictClass.id;
|
||||
SysDict.id = Guid.NewGuid().ToString();
|
||||
|
||||
|
||||
this.systemBll.SaveSysDict(SysDict);
|
||||
|
||||
//刷新
|
||||
GetDictData(DictClass.id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void DeleteDictDetail()
|
||||
{
|
||||
|
||||
if (MessageBox.Show($"确定移除:{SysDict.data_type}", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
//移除
|
||||
this.systemBll.DelSysDictByid(SysDict);
|
||||
|
||||
//刷新
|
||||
GetDictData(DictClass.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void AddClassClick()
|
||||
{
|
||||
//var vm = this.DataContext as SysConfigMangerViewModel;
|
||||
|
||||
//清空对象内容
|
||||
DictClass = new SamplePre.Models.Models.sys_dict_class();
|
||||
|
||||
NewDictClassWindow frm = new NewDictClassWindow(this);
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void DelClassClick()
|
||||
{
|
||||
DeleteDict();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void TvDataSelectedItemChanged(RoutedPropertyChangedEventArgs<object> e)
|
||||
{
|
||||
//var vm = this.DataContext as SysConfigMangerViewModel;
|
||||
|
||||
var node = e.NewValue as TreeItemModel;
|
||||
|
||||
DictClass.dict_type = node.Name;
|
||||
DictClass.id = node.Id;
|
||||
|
||||
GetDictData(node.Id);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void AddItemClick()
|
||||
{
|
||||
SysDict = new Models.Models.sys_dict();
|
||||
if (DictClass.id == null || DictClass.id == 0)
|
||||
{
|
||||
MessageBox.Show("请先选择分类");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NewDictDetailWindow frm = new NewDictDetailWindow(this);
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void DelItemClick()
|
||||
{
|
||||
DeleteDictDetail();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
80
SamplePreSystem.UI/ViewModel/ConfigManager/TreeItemModel.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.ConfigManager
|
||||
{
|
||||
public class TreeItemModel : INotifyPropertyChanged
|
||||
{
|
||||
public bool IsUpdate = true;
|
||||
|
||||
private bool _isChecked;
|
||||
public bool IsChecked
|
||||
{
|
||||
get { return _isChecked; }
|
||||
set
|
||||
{
|
||||
_isChecked = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
|
||||
if (Children.Count > 0)
|
||||
{
|
||||
SetChildrenCheck(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (Parent != null) Parent.IsChecked = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
// 父节点改变子节点
|
||||
private void SetChildrenCheck(bool isChecked)
|
||||
{
|
||||
foreach (var child in Children)
|
||||
{
|
||||
child.IsChecked = isChecked;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 子节点改变后,更新父节点状态
|
||||
private void UpdateParentState(bool isChecked)
|
||||
{
|
||||
if (Parent == null) return;
|
||||
|
||||
//bool anyChecked = Parent.Children.Any(x => x.IsChecked);
|
||||
Parent.IsChecked = isChecked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 子节点
|
||||
public List<TreeItemModel> Children { get; set; } = new List<TreeItemModel>();
|
||||
|
||||
// 父节点(用于联动)
|
||||
public TreeItemModel Parent { get; set; }
|
||||
|
||||
public PackIconKind IconKind { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
286
SamplePreSystem.UI/ViewModel/ConfigManager/UsersViewModel.cs
Normal file
@@ -0,0 +1,286 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.Models.Tables;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.UIWpf.ConfigManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.ConfigManager
|
||||
{
|
||||
public partial class UsersViewModel : ObservableObject
|
||||
{
|
||||
|
||||
|
||||
UsersBll usersBll = new UsersBll();
|
||||
|
||||
// 关闭窗口的委托
|
||||
public Action<bool> CloseAction { get; set; }
|
||||
|
||||
public UsersViewModel()
|
||||
{
|
||||
//获取用户数据
|
||||
GetData();
|
||||
|
||||
}
|
||||
|
||||
private List<config_user_ext> _userList = new List<config_user_ext>();
|
||||
|
||||
public List<config_user_ext> UserList
|
||||
{
|
||||
get { return _userList; }
|
||||
set {
|
||||
SetProperty(ref _userList, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private config_user_ext _selectUser;
|
||||
|
||||
public config_user_ext SelectUser
|
||||
{
|
||||
get { return _selectUser; }
|
||||
set { _selectUser = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
private config_user_ext _configUser =new config_user_ext();
|
||||
|
||||
public config_user_ext ConfigUser
|
||||
{
|
||||
get { return _configUser; }
|
||||
set {
|
||||
SetProperty(ref _configUser, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询用户
|
||||
/// </summary>
|
||||
public void GetData()
|
||||
{
|
||||
|
||||
UserList = usersBll.GetUsers();
|
||||
|
||||
}
|
||||
|
||||
private List<config_role_ext> roles = new List<config_role_ext>();
|
||||
|
||||
public List<config_role_ext> Roles
|
||||
{
|
||||
get { return roles; }
|
||||
set {
|
||||
SetProperty(ref roles, roles);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 绑定角色数据
|
||||
/// </summary>
|
||||
public void InitCheckedListBox()
|
||||
{
|
||||
Roles.Clear();
|
||||
var roleList = usersBll.GetRoles();
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var item in roleList)
|
||||
{
|
||||
config_role_ext model = new config_role_ext();
|
||||
model.id = item.id;
|
||||
model.name = item.name;
|
||||
model.description = item.description;
|
||||
model.IsSelected = false;
|
||||
|
||||
Roles.Add(model);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(ConfigUser.id))
|
||||
{
|
||||
//获取用户的角色
|
||||
var userRoles = usersBll.GetUserRoles(ConfigUser.id);
|
||||
|
||||
foreach(var item in Roles)
|
||||
{
|
||||
if(userRoles.Where(p=>p.role_id == item.id).Count() > 0)
|
||||
{
|
||||
item.IsSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private string isEnable = "启用";
|
||||
|
||||
public string IsEnable
|
||||
{
|
||||
get { return isEnable; }
|
||||
set {
|
||||
|
||||
SetProperty(ref isEnable, isEnable);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool SaveUser()
|
||||
{
|
||||
if (ConfigUser == null) return false;
|
||||
|
||||
//ConfigUser.username = this.txtUserName.Text;
|
||||
//ConfigUser.password = this.txtPwd.Text;
|
||||
ConfigUser.is_enabled = IsEnable == "启用" ? true : false;
|
||||
|
||||
if (string.IsNullOrEmpty(ConfigUser.id))
|
||||
{
|
||||
//new
|
||||
ConfigUser.id = Guid.NewGuid().ToString();
|
||||
|
||||
//选中的角色
|
||||
var roles = GetCheckedData();
|
||||
|
||||
if (usersBll.SaveUserData(ConfigUser, roles) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//update
|
||||
|
||||
//选中的角色
|
||||
var roles = GetCheckedData();
|
||||
|
||||
if (usersBll.UpdateUserData(ConfigUser, roles) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户角色
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<config_user_role> GetCheckedData()
|
||||
{
|
||||
List<config_user_role> userRoles = new List<config_user_role>();
|
||||
|
||||
|
||||
foreach (var role in Roles)
|
||||
{
|
||||
if(role.IsSelected)
|
||||
{
|
||||
//config_role item = cbRoles.GetItem(i) as config_role;
|
||||
|
||||
config_user_role configUserRole = new config_user_role();
|
||||
configUserRole.role_id = role.id.ToString();
|
||||
configUserRole.user_id = ConfigUser.id;
|
||||
|
||||
userRoles.Add(configUserRole);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return userRoles;
|
||||
}
|
||||
|
||||
|
||||
public bool DeleUser()
|
||||
{
|
||||
if(SelectUser != null)
|
||||
{
|
||||
config_user user = SelectUser;
|
||||
|
||||
if (MessageBox.Show($"是否真的删除{user.username}", "删除提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
if (usersBll.DeleteUser(user) < 0)
|
||||
{
|
||||
MessageBox.Show("用户删除失败!");
|
||||
return false;
|
||||
}
|
||||
//刷新用户
|
||||
GetData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
public void BtnAddClick()
|
||||
{
|
||||
ConfigUser = new config_user_ext();
|
||||
|
||||
//初始化角色数据
|
||||
InitCheckedListBox();
|
||||
|
||||
NewUserWindow frm = new NewUserWindow(this);
|
||||
if (frm.ShowDialog() == true)
|
||||
{
|
||||
//刷新数据
|
||||
GetData();
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void BtnEditClick()
|
||||
{
|
||||
ConfigUser = SelectUser;
|
||||
//初始化角色数据
|
||||
InitCheckedListBox();
|
||||
|
||||
NewUserWindow frm = new NewUserWindow(this);
|
||||
if (frm.ShowDialog() == true)
|
||||
{
|
||||
//刷新数据
|
||||
GetData();
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void BtnDeleClick()
|
||||
{
|
||||
DeleUser();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void BtnSaveUserClick()
|
||||
{
|
||||
|
||||
if (SaveUser() == true)
|
||||
{
|
||||
this.CloseAction?.Invoke(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
118
SamplePreSystem.UI/ViewModel/Login/AppMainViewModel.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Models.Const;
|
||||
using SamplePre.Communication;
|
||||
using SamplePre.Models.Tables;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePreSystem.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Login
|
||||
{
|
||||
public partial class AppMainViewModel:ObservableObject
|
||||
{
|
||||
|
||||
SystemBll systemBll = new SystemBll();
|
||||
|
||||
public AppMainViewModel() {
|
||||
|
||||
|
||||
|
||||
//初始化权限信息
|
||||
InitPermisson();
|
||||
|
||||
//GetFunctionList();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 功能菜单
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<MenuBarFuc> menuBars = new List<MenuBarFuc>();
|
||||
|
||||
/// <summary>
|
||||
/// 初始化权限信息
|
||||
/// </summary>
|
||||
private void InitPermisson()
|
||||
{
|
||||
|
||||
if (SystemConst.loginUserInfo.functions == null) return;
|
||||
|
||||
List<MenuBarFuc> newData = new List<MenuBarFuc>();
|
||||
|
||||
foreach (var item in SystemConst.loginUserInfo.functions.Where(p => p.parent_id == 0))
|
||||
{
|
||||
foreach (var newItem in SystemConst.loginUserInfo.functions.Where(p => p.parent_id == item.id).ToList())
|
||||
{
|
||||
MenuBarFuc menuBarFuc = new MenuBarFuc();
|
||||
menuBarFuc.id = newItem.id;
|
||||
menuBarFuc.name = newItem.name;
|
||||
menuBarFuc.code = newItem.code;
|
||||
menuBarFuc.description = item.name;
|
||||
menuBarFuc.parent_id = newItem.parent_id;
|
||||
menuBarFuc.packIconKind = GetIconKind(menuBarFuc.id);
|
||||
|
||||
|
||||
newData.Add(menuBarFuc);
|
||||
}
|
||||
|
||||
}
|
||||
MenuBars = newData;
|
||||
|
||||
|
||||
UserInfo = SystemConst.loginUserInfo.user.username;
|
||||
}
|
||||
|
||||
public string UserInfo { get; set; }
|
||||
|
||||
private PackIconKind GetIconKind(int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 5:
|
||||
return PackIconKind.CameraMeteringMatrix;
|
||||
case 6:
|
||||
return PackIconKind.ClipboardListOutline;
|
||||
case 8:
|
||||
return PackIconKind.FileFindOutline;
|
||||
case 9:
|
||||
return PackIconKind.TagSearch;
|
||||
|
||||
case 10:
|
||||
return PackIconKind.CollapseAllOutline;
|
||||
case 11:
|
||||
return PackIconKind.ContentDuplicate;
|
||||
case 12:
|
||||
return PackIconKind.Console;
|
||||
|
||||
|
||||
case 13:
|
||||
return PackIconKind.AccountOutline;
|
||||
case 14:
|
||||
return PackIconKind.CardAccountDetails;
|
||||
case 15:
|
||||
return PackIconKind.CogOutline;
|
||||
|
||||
default:
|
||||
return PackIconKind.CogOutline;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
113
SamplePreSystem.UI/ViewModel/Login/LoginViewModel.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Login
|
||||
{
|
||||
public partial class LoginViewModel : ObservableObject
|
||||
{
|
||||
|
||||
|
||||
UsersBll usersBll = new UsersBll();
|
||||
|
||||
/// <summary>
|
||||
/// 关闭委托
|
||||
/// </summary>
|
||||
public Action<bool> ColseAction;
|
||||
|
||||
//保持用户名
|
||||
public Action<string> SaveUserAction;
|
||||
|
||||
public LoginViewModel()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
public string errInfo = "";
|
||||
|
||||
[ObservableProperty]
|
||||
public bool isSaveUser = false;
|
||||
|
||||
[ObservableProperty]
|
||||
public string userName = "";
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
public string userPwd = "";
|
||||
|
||||
|
||||
|
||||
public bool UserChecked()
|
||||
{
|
||||
|
||||
if (usersBll.CheckUser(UserName, UserPwd) == false)
|
||||
{
|
||||
|
||||
ErrInfo = "登录账号或密码错误!";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsSaveUser == true)
|
||||
{
|
||||
SaveUserAction?.Invoke(UserName);
|
||||
|
||||
}
|
||||
|
||||
ColseAction?.Invoke(true);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void LoginButtonClick()
|
||||
{
|
||||
UserChecked();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回车登录
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void PwdKeyDown(KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
UserChecked();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 退出
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void CancelClick()
|
||||
{
|
||||
ColseAction?.Invoke(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
20
SamplePreSystem.UI/ViewModel/Login/MenuBarFuc.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Login
|
||||
{
|
||||
public class MenuBarFuc
|
||||
{
|
||||
public int id { get; set; } // 功能ID
|
||||
public string name { get; set; } // 功能名称(如:用户管理、角色新增)
|
||||
public string code { get; set; } // 功能编码(唯一标识,如:User_Manage)
|
||||
public int parent_id { get; set; } // 父功能编码(用于构建菜单层级)
|
||||
public string description { get; set; } // 功能描述
|
||||
|
||||
public PackIconKind packIconKind { get; set; }
|
||||
}
|
||||
}
|
||||
72
SamplePreSystem.UI/ViewModel/Login/UserInfoViewModel.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Models.Const;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Login
|
||||
{
|
||||
public partial class UserInfoViewModel :ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
public string userName;
|
||||
|
||||
[ObservableProperty]
|
||||
public string userRoles;
|
||||
|
||||
public UserInfoViewModel()
|
||||
{
|
||||
|
||||
InitializeUserInfo();
|
||||
}
|
||||
|
||||
|
||||
private void InitializeUserInfo()
|
||||
{
|
||||
// 获取当前登录用户信息
|
||||
if (SystemConst.loginUserInfo != null && SystemConst.loginUserInfo.user != null)
|
||||
{
|
||||
UserName = SystemConst.loginUserInfo.user.username;
|
||||
|
||||
// 这里需要获取用户角色信息
|
||||
// 由于当前登录用户信息中没有直接包含角色信息,我们需要通过查询获取
|
||||
// 这里暂时显示占位符,实际项目中需要从数据库查询
|
||||
UserRoles = "获取中...";
|
||||
|
||||
// 异步获取角色信息
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// 这里应该调用BLL层的方法获取用户角色
|
||||
// 由于系统中已有UsersBll类,我们可以使用它
|
||||
SamplePre.ProcessBll.BLL.UsersBll usersBll = new SamplePre.ProcessBll.BLL.UsersBll();
|
||||
var userExt = usersBll.GetUsers().FirstOrDefault(u => u.username == UserName);
|
||||
|
||||
if (userExt != null)
|
||||
{
|
||||
UserRoles = userExt.all_role_names;
|
||||
}
|
||||
else
|
||||
{
|
||||
UserRoles = "未知角色";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserRoles = "获取角色失败";
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UserName = "未登录";
|
||||
UserRoles = "无";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
57
SamplePreSystem.UI/ViewModel/Monitor/FaultInfo.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
//using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Monitor
|
||||
{
|
||||
/// <summary>
|
||||
/// 监控故障信息实体
|
||||
/// </summary>
|
||||
public class FaultInfo :INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public string FaultName { get; set; } // 故障名称
|
||||
|
||||
public string FaultDesc { get; set; } // 故障描述
|
||||
public FaultType FaultType { get; set; } // 故障类型
|
||||
|
||||
private Brush runColor = Brushes.Orange;
|
||||
|
||||
|
||||
|
||||
public Brush RunColor
|
||||
{
|
||||
get { return runColor; }
|
||||
set
|
||||
{
|
||||
runColor = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 定义故障类型枚举
|
||||
public enum FaultType
|
||||
{
|
||||
Warning = 0, // 警告
|
||||
Error = 1, // 错误
|
||||
Critical = 2, // 严重错误
|
||||
Run = 3 // 严重错误
|
||||
}
|
||||
}
|
||||
549
SamplePreSystem.UI/ViewModel/Monitor/MonitorViewModel.cs
Normal file
@@ -0,0 +1,549 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Models.Const;
|
||||
using Models.Models;
|
||||
using SamplePre.Common;
|
||||
using SamplePre.Communication.Communication;
|
||||
using SamplePre.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.ProcessBll.SampleSequence;
|
||||
using SamplePre.UIWpf.MonitorManager.chirld;
|
||||
using SamplePre.UIWpf.SampleManager.chirld;
|
||||
using SamplePreSystem.UI.Views.MonitorManager;
|
||||
|
||||
|
||||
//using SamplePre.UIWpf.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using static MaterialDesignThemes.Wpf.Theme.ToolBar;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Monitor
|
||||
{
|
||||
public partial class MonitorViewModel: ObservableObject
|
||||
{
|
||||
|
||||
SampleSequenceBll sampleSequenceBll = new SampleSequenceBll();
|
||||
|
||||
ActionMangerBll actionMangerBll = new ActionMangerBll();
|
||||
|
||||
MonitorBll monitorBll = new MonitorBll();
|
||||
|
||||
CommunicationBll communicationBll = new CommunicationBll();
|
||||
|
||||
SOPManagerBll sopManagerBll = new SOPManagerBll();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 所有动作
|
||||
/// </summary>
|
||||
List<sys_action_ext> sys_Actions = new List<sys_action_ext>();
|
||||
|
||||
|
||||
public MonitorViewModel()
|
||||
{
|
||||
//所有动作
|
||||
sys_Actions = actionMangerBll.QuerySysAction();
|
||||
|
||||
GetSampleData();
|
||||
|
||||
//初始化功能单元
|
||||
InitWorkUnits();
|
||||
|
||||
///启动数据监控线程
|
||||
UpdateMonitorData();
|
||||
|
||||
Test();
|
||||
|
||||
|
||||
//获取当前SOP所有动作列表
|
||||
GetCurrentSopByID(this.CurrentSopID);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前SOP所有动作列表
|
||||
/// </summary>
|
||||
/// <param name="sopID"></param>
|
||||
public void GetCurrentSopByID(string sopID)
|
||||
{
|
||||
CurrentstandardActionList = sopManagerBll.QueryStandardActionByStandardId(sopID)?.OrderBy(p => p.process_no).ToList(); ;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算进度百分比
|
||||
/// </summary>
|
||||
/// <param name="actionID"></param>
|
||||
public void CalculationProgress(string actionID)
|
||||
{
|
||||
if (CurrentstandardActionList.Count <= 0) return;
|
||||
|
||||
var item = CurrentstandardActionList.Where(p => p.process_id == actionID && p.ExecFinishFlag == false).FirstOrDefault();
|
||||
if (item != null)
|
||||
{
|
||||
item.ExecFinishFlag = true;
|
||||
|
||||
int finishcount = CurrentstandardActionList.Count(p => p.ExecFinishFlag == true);
|
||||
int totalcount = CurrentstandardActionList.Count;
|
||||
|
||||
double percent = (float)finishcount / totalcount;
|
||||
|
||||
CurrentPercent = Math.Round(percent * 100,0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前SOP_ID
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public string currentSopID = "";
|
||||
|
||||
/// <summary>
|
||||
/// 当前百分比
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public double currentPercent = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 当前SOP动作
|
||||
/// </summary>
|
||||
public List<sys_standard_action_ext> CurrentstandardActionList = new List<sys_standard_action_ext>();
|
||||
|
||||
public void Test()
|
||||
{
|
||||
SopExecInfo.Add(new SopExecInfo()
|
||||
{
|
||||
sapmleName = "DCM固相萃取",
|
||||
actionName = "加液",
|
||||
starDate = DateTime.Now,
|
||||
endDate = DateTime.Now,
|
||||
state = "完成",
|
||||
doIngShow = false
|
||||
|
||||
});
|
||||
SopExecInfo.Add(new SopExecInfo()
|
||||
{
|
||||
sapmleName = "DCM固相萃取",
|
||||
actionName = "加液",
|
||||
starDate = DateTime.Now,
|
||||
endDate = DateTime.Now,
|
||||
state = "完成",
|
||||
doIngShow = false
|
||||
});
|
||||
SopExecInfo.Add(new SopExecInfo()
|
||||
{
|
||||
sapmleName = "DCM固相萃取",
|
||||
actionName = "加液",
|
||||
starDate = DateTime.Now,
|
||||
endDate = DateTime.Now,
|
||||
state = "完成",
|
||||
doIngShow = false
|
||||
|
||||
});
|
||||
SopExecInfo.Add(new SopExecInfo()
|
||||
{
|
||||
sapmleName = "DCM固相萃取",
|
||||
actionName = "离心",
|
||||
starDate = DateTime.Now,
|
||||
endDate = DateTime.Now,
|
||||
state = "执行",
|
||||
doIngShow = true
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<sample_exec_detail_ext> _sampleExecList = new List<sample_exec_detail_ext>();
|
||||
|
||||
|
||||
public List<sample_exec_detail_ext> SampleExecList
|
||||
{
|
||||
get { return _sampleExecList; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _sampleExecList, value);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private string _sopExecData;
|
||||
|
||||
public string SopExecData
|
||||
{
|
||||
get { return _sopExecData; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _sopExecData, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取样本信息
|
||||
/// </summary>
|
||||
/// <param name="standID"></param>
|
||||
private void GetSampleData()
|
||||
{
|
||||
|
||||
List<sample_exec_detail_ext> samples = sampleSequenceBll.GetSampleExecDetails();
|
||||
SampleExecList = samples;
|
||||
|
||||
//设置当前SOP——ID
|
||||
string standrad_id = samples.FirstOrDefault()?.standrad_id;
|
||||
if (!string.IsNullOrEmpty(standrad_id))
|
||||
{
|
||||
if(standrad_id.Contains(","))
|
||||
{
|
||||
CurrentSopID = standrad_id.Split(",")[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentSopID = standrad_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private List<WorkUnit> _workUnits = new List<WorkUnit>();
|
||||
|
||||
public List<WorkUnit> WorkUnits
|
||||
{
|
||||
get { return _workUnits; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _workUnits, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化功能岛
|
||||
/// </summary>
|
||||
public void InitWorkUnits()
|
||||
{
|
||||
|
||||
var list = SystemConst.dictDatas.Where(p => p.class_id == 2).ToList();
|
||||
foreach (var item in list)
|
||||
{
|
||||
string imgPath = GetIcon(item.id);
|
||||
|
||||
var icon = GetIconKind(item.id);
|
||||
|
||||
WorkUnits.Add(new WorkUnit() { actionName= "无", state = 0, StateName = "未连通", unitCode = item.id, unitName = item.data_type ,imgPath = imgPath,packIconKind = icon });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 故障信息
|
||||
/// </summary>
|
||||
private ObservableCollection<FaultInfo> faultInfos = new ObservableCollection<FaultInfo>();
|
||||
|
||||
public ObservableCollection<FaultInfo> FaultInfos
|
||||
{
|
||||
get { return faultInfos; }
|
||||
set {
|
||||
|
||||
SetProperty(ref faultInfos, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新监控数据
|
||||
/// </summary>
|
||||
public void UpdateMonitorData()
|
||||
{
|
||||
//if (tileGroup2.Items.Count <= 0) return;
|
||||
|
||||
Task.Factory.StartNew(async () => {
|
||||
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
//ushort[] data1 = SystemConst.MasterPLC.ReadArraysShort(100, 1000, 1000);
|
||||
ushort[] data1 = communicationBll.ReadSateData(100, 1000, 1000);
|
||||
|
||||
//跨线程
|
||||
Application.Current?.Dispatcher.Invoke(() =>
|
||||
{
|
||||
FaultInfos.Clear();
|
||||
});
|
||||
|
||||
//刷新功能岛
|
||||
UpdateWorkUnit(data1);
|
||||
|
||||
|
||||
//刷新样品列表
|
||||
GetSampleData();
|
||||
|
||||
await Task.Delay(3000);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
LoggerHelper.Logger.Error("更新监控数据异常退出:" + ex.Message + ex.StackTrace);
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新功能岛信息
|
||||
/// </summary>
|
||||
/// <param name="data1"></param>
|
||||
public void UpdateWorkUnit(ushort[] data1)
|
||||
{
|
||||
//WorkUnits
|
||||
if (data1 != null && data1.Length > 0)
|
||||
{
|
||||
|
||||
foreach(var workUnit in WorkUnits)
|
||||
{
|
||||
var unit_actions = sys_Actions.Where(p => p.action_unit == workUnit.unitCode).ToList();
|
||||
foreach (var action in unit_actions)
|
||||
{
|
||||
int plcCode = int.Parse(action.plc_type);
|
||||
ushort state = data1[plcCode];//动作的状态码
|
||||
|
||||
//UCFunUnit uCFunUnit = this.dictUnits[unitCode];
|
||||
if(state >= 2)
|
||||
{
|
||||
//处理sop执行状态,计算执行百分比
|
||||
CalculationProgress(action.id);
|
||||
|
||||
}
|
||||
|
||||
if (state >= workUnit.state || state == 2)
|
||||
{ //发生改变再修改
|
||||
if (workUnit.state != state || workUnit.actionName != action.action_name)
|
||||
{
|
||||
workUnit.state = state;
|
||||
workUnit.StateName = SetStateData(state);
|
||||
workUnit.RunColor = WorkUnit.GetStateColor(state);
|
||||
workUnit.actionName = state < 2 ? "无" : action.action_name;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//如果动作一样,状态发生变化,就要修改
|
||||
if (workUnit.state != state && workUnit.actionName == action.action_name)
|
||||
{
|
||||
workUnit.state = state;
|
||||
workUnit.StateName = SetStateData(state);
|
||||
workUnit.RunColor = WorkUnit.GetStateColor(state);
|
||||
workUnit.actionName = state < 2 ? "无" : action.action_name;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//添加故障信息
|
||||
if (workUnit.state == 0)
|
||||
{
|
||||
Application.Current?.Dispatcher.BeginInvoke(new Action(() => {
|
||||
FaultInfos.Add(new FaultInfo { FaultName = workUnit.unitName + " - 未连通", FaultType = FaultType.Warning });
|
||||
}), DispatcherPriority.Normal);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public string GetIcon(string code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case "300":
|
||||
return "/Assets/机器人1.png";//Resources.机器人1;
|
||||
|
||||
case "301":
|
||||
return "/Assets/分液1.png";//Resources.分液1;
|
||||
|
||||
case "302":
|
||||
return "/Assets/离心机1.png";//Resources.离心机1;
|
||||
|
||||
case "303":
|
||||
return "/Assets/氮吹1.png";
|
||||
|
||||
case "304":
|
||||
return "/Assets/固相萃取1.png";//Resources.固相萃取1;
|
||||
|
||||
default:
|
||||
return "/Assets/机器人1.png";//Resources.机器人1;
|
||||
}
|
||||
}
|
||||
|
||||
public PackIconKind GetIconKind(string code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case "300":
|
||||
return PackIconKind.RobotIndustrialOutline;//Resources.机器人1;
|
||||
|
||||
case "301":
|
||||
return PackIconKind.TestTube;//Resources.分液1;
|
||||
|
||||
case "302":
|
||||
return PackIconKind.GoogleCirclesCommunities;//Resources.离心机1;
|
||||
|
||||
case "303":
|
||||
return PackIconKind.GoogleCirclesGroup;
|
||||
|
||||
case "304":
|
||||
return PackIconKind.InboxMultiple;//Resources.固相萃取1;
|
||||
|
||||
default:
|
||||
return PackIconKind.ThermometerWater; //Resources.机器人1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string SetStateData(int state)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (state == 0)
|
||||
{
|
||||
return "未连接";
|
||||
|
||||
|
||||
}
|
||||
if (state == 1)
|
||||
{
|
||||
return "待机";
|
||||
}
|
||||
else if (state == 2)
|
||||
{
|
||||
return "运行";
|
||||
|
||||
|
||||
}
|
||||
else if (state == 3)
|
||||
{
|
||||
return "完成";
|
||||
}
|
||||
|
||||
|
||||
return "未连接";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.Logger.Error(ex.Message + ex.StackTrace);
|
||||
return "未连接";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
SocketClient client;
|
||||
/// <summary>
|
||||
/// 启动socket
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task StarClientAsync()
|
||||
{
|
||||
client = new SocketClient();
|
||||
|
||||
//回调函数
|
||||
client.ReceiveMsgAction = UpdateSopExecInfo;
|
||||
|
||||
await client.StartClientAsync();
|
||||
}
|
||||
|
||||
public void SendSocketTest(string msg)
|
||||
{
|
||||
client.SendMsgAsync(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新sop执行信息
|
||||
/// </summary>
|
||||
/// <param name="receiveData"></param>
|
||||
public void UpdateSopExecInfo(string receiveData)
|
||||
{
|
||||
SopExecData += receiveData + "\r\n";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sop执行信息
|
||||
/// </summary>
|
||||
private List<SopExecInfo> sopExecInfo = new List<SopExecInfo>();
|
||||
|
||||
public List<SopExecInfo> SopExecInfo
|
||||
{
|
||||
get { return sopExecInfo; }
|
||||
set { sopExecInfo = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 打开详情窗口
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void HLinkDetailClick(string unitName)
|
||||
{
|
||||
|
||||
var param = unitName;
|
||||
var item = SystemConst.dictDatas.Where(p => p.data_type == param.ToString() && p.class_id == 2).FirstOrDefault();
|
||||
if (item != null)
|
||||
{
|
||||
UnitDetailWindow frm = new UnitDetailWindow(item.id);
|
||||
frm.ShowDialog();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开明细进度窗口
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void MouseDoubleDetailWindow()
|
||||
{
|
||||
SampleDetailWindow frm = new SampleDetailWindow();
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
110
SamplePreSystem.UI/ViewModel/Monitor/UnitDetailViewModel.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using SamplePre.Models;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.ProcessBll.SampleSequence;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Monitor
|
||||
{
|
||||
public class UnitDetailViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
MonitorBll monitorBll = new MonitorBll();
|
||||
|
||||
CommunicationBll communicationBll = new CommunicationBll();
|
||||
|
||||
ActionMangerBll actionMangerBll = new ActionMangerBll();
|
||||
|
||||
string unitID;
|
||||
public UnitDetailViewModel(string _unitID)
|
||||
{
|
||||
unitID = _unitID;
|
||||
|
||||
ShowActionInfo();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 动作状态信息
|
||||
/// </summary>
|
||||
private ObservableCollection<FaultInfo> faultInfos = new ObservableCollection<FaultInfo>();
|
||||
|
||||
public ObservableCollection<FaultInfo> FaultInfos
|
||||
{
|
||||
get { return faultInfos; }
|
||||
set
|
||||
{
|
||||
faultInfos = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置异常数据显示
|
||||
/// </summary>
|
||||
public void ShowActionInfo()
|
||||
{
|
||||
//读取下位机状态
|
||||
ushort[] data1 = communicationBll.ReadSateData(100, 1000, 1000);
|
||||
if (data1 == null || data1.Length <= 0) return;
|
||||
|
||||
//查询该单元中的动作
|
||||
var sys_Actions = actionMangerBll.QuerySysAction();
|
||||
sys_Actions = sys_Actions.Where(p => p.action_unit == unitID).ToList();
|
||||
|
||||
|
||||
|
||||
foreach (var sys_action in sys_Actions)
|
||||
{
|
||||
|
||||
if (data1 != null && data1.Length > 0)
|
||||
{
|
||||
int state = data1[int.Parse(sys_action.plc_type)];
|
||||
//state = 2;
|
||||
if (state == 0)
|
||||
{
|
||||
FaultInfos.Add(new FaultInfo() { FaultName = sys_action.action_name, FaultDesc = "未连通", RunColor = WorkUnit.GetStateColor(state) });
|
||||
}
|
||||
if (state == 1)
|
||||
{
|
||||
FaultInfos.Add(new FaultInfo() { FaultName = sys_action.action_name, FaultDesc = "待机", RunColor = WorkUnit.GetStateColor(state) });
|
||||
}
|
||||
if (state == 2)
|
||||
{
|
||||
FaultInfos.Add(new FaultInfo() { FaultName = sys_action.action_name, FaultDesc = "运行", RunColor = WorkUnit.GetStateColor(state) });
|
||||
}
|
||||
if (state == 3)
|
||||
{
|
||||
FaultInfos.Add(new FaultInfo() { FaultName = sys_action.action_name, FaultDesc = "完成", RunColor = WorkUnit.GetStateColor(state) });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FaultInfos.Add(new FaultInfo() { FaultName = sys_action.action_name, FaultDesc = "待机", RunColor = WorkUnit.GetStateColor(0) });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
149
SamplePreSystem.UI/ViewModel/Monitor/WorkUnit.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using SamplePre.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.Monitor
|
||||
{
|
||||
public class WorkUnit : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private int _state;
|
||||
|
||||
public int state
|
||||
{
|
||||
get { return _state; }
|
||||
set { _state = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private string _stateName;
|
||||
|
||||
public string StateName
|
||||
{
|
||||
get { return _stateName; }
|
||||
set { _stateName = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private string _actionName;
|
||||
|
||||
public string actionName
|
||||
{
|
||||
get { return _actionName; }
|
||||
set { _actionName = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private string _unitName;
|
||||
|
||||
public string unitName
|
||||
{
|
||||
get { return _unitName; }
|
||||
set { _unitName = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private string _unitCode;
|
||||
|
||||
public string unitCode
|
||||
{
|
||||
get { return _unitCode; }
|
||||
set { _unitCode = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string imgPath { get; set; }
|
||||
|
||||
public PackIconKind packIconKind { get; set; }
|
||||
|
||||
private Brush runColor = Brushes.Orange ;
|
||||
|
||||
public Brush RunColor
|
||||
{
|
||||
get { return runColor; }
|
||||
set { runColor = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取运行状态的颜色
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
public static Brush GetStateColor(int state)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (state == 0)
|
||||
{
|
||||
return Brushes.Red;
|
||||
|
||||
|
||||
}
|
||||
if (state == 1)
|
||||
{
|
||||
return Brushes.Orange;
|
||||
}
|
||||
else if (state == 2)
|
||||
{
|
||||
return Brushes.LightGreen;
|
||||
|
||||
|
||||
}
|
||||
else if (state == 3)
|
||||
{
|
||||
return Brushes.Green;
|
||||
}
|
||||
|
||||
|
||||
return Brushes.Orange;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.Logger.Error(ex.Message + ex.StackTrace);
|
||||
return Brushes.Orange;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Models;
|
||||
using SamplePre.ProcessBll.SampleSequence;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using OfficeOpenXml;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.QueryManager
|
||||
{
|
||||
public partial class SampleQueryViewModel : ObservableObject
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
SampleSequenceBll sampleSequenceBll = new SampleSequenceBll();
|
||||
public SampleQueryViewModel()
|
||||
{
|
||||
GetData();
|
||||
}
|
||||
|
||||
private DateTime _startDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
|
||||
public DateTime StartDate
|
||||
{
|
||||
get { return _startDate; }
|
||||
set {
|
||||
SetProperty(ref _startDate, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private DateTime _endDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
|
||||
public DateTime EndDate
|
||||
{
|
||||
get { return _endDate; }
|
||||
set
|
||||
{
|
||||
|
||||
SetProperty(ref _endDate, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private List<tube_input> _sampleList = new List<tube_input>();
|
||||
|
||||
public List<tube_input> SampleList
|
||||
{
|
||||
get { return _sampleList; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _sampleList, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
public void GetData()
|
||||
{
|
||||
DateTime dt1 = DateTime.Parse(StartDate.ToString("yyyy-MM-dd") + " 00:00:00");
|
||||
DateTime dt2 = DateTime.Parse(EndDate.ToString("yyyy-MM-dd") + " 23:00:00");
|
||||
|
||||
SampleList = sampleSequenceBll.GetTubeData(dt1, dt2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void ExportExcel()
|
||||
{
|
||||
if (SampleList == null || SampleList.Count == 0)
|
||||
{
|
||||
MessageBox.Show("没有数据可导出", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 设置EPPlus许可证为个人使用
|
||||
ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
|
||||
|
||||
// 创建保存文件对话框
|
||||
Microsoft.Win32.SaveFileDialog saveFileDialog = new Microsoft.Win32.SaveFileDialog();
|
||||
saveFileDialog.Filter = "Excel文件 (*.xlsx)|*.xlsx";
|
||||
saveFileDialog.FileName = "样品查询导出_" + DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
|
||||
if (saveFileDialog.ShowDialog() == true)
|
||||
{
|
||||
string filePath = saveFileDialog.FileName;
|
||||
|
||||
// 创建Excel包
|
||||
using (ExcelPackage package = new ExcelPackage())
|
||||
{
|
||||
// 创建工作表
|
||||
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("样品数据");
|
||||
|
||||
// 设置表头
|
||||
worksheet.Cells[1, 1].Value = "二维码";
|
||||
worksheet.Cells[1, 2].Value = "样品名称";
|
||||
worksheet.Cells[1, 3].Value = "标准ID";
|
||||
worksheet.Cells[1, 4].Value = "标准名称";
|
||||
worksheet.Cells[1, 5].Value = "录入人员";
|
||||
worksheet.Cells[1, 6].Value = "录入日期";
|
||||
worksheet.Cells[1, 7].Value = "批号";
|
||||
|
||||
// 设置表头样式
|
||||
using (var range = worksheet.Cells["A1:G1"])
|
||||
{
|
||||
range.Style.Font.Bold = true;
|
||||
range.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
|
||||
range.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightGray);
|
||||
range.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
|
||||
}
|
||||
|
||||
// 填充数据
|
||||
for (int i = 0; i < SampleList.Count; i++)
|
||||
{
|
||||
var sample = SampleList[i];
|
||||
worksheet.Cells[i + 2, 1].Value = sample.qrcode;
|
||||
worksheet.Cells[i + 2, 2].Value = sample.item_name;
|
||||
worksheet.Cells[i + 2, 3].Value = sample.standrad_id;
|
||||
worksheet.Cells[i + 2, 4].Value = sample.standrad;
|
||||
worksheet.Cells[i + 2, 5].Value = sample.input_user;
|
||||
worksheet.Cells[i + 2, 6].Value = sample.input_date;
|
||||
worksheet.Cells[i + 2, 7].Value = sample.bach_no;
|
||||
}
|
||||
|
||||
// 自动调整列宽
|
||||
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
|
||||
|
||||
// 保存文件
|
||||
FileInfo file = new FileInfo(filePath);
|
||||
package.SaveAs(file);
|
||||
|
||||
MessageBox.Show("导出成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("导出失败:" + ex.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,656 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Const;
|
||||
using Models.Models;
|
||||
using SamplePre.Common;
|
||||
using SamplePre.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.Models.Models;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.ProcessBll.SampleSequence;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using SamplePre.UIWpf.SampleManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using static MaterialDesignThemes.Wpf.Theme.ToolBar;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.SampleManager
|
||||
{
|
||||
public partial class SampleExecViewModel : ObservableObject
|
||||
{
|
||||
SampleSequenceBll sampleSequenceBll = new SampleSequenceBll();
|
||||
|
||||
CommunicationBll communicationBll = new CommunicationBll();
|
||||
|
||||
MonitorBll monitorBll = new MonitorBll();
|
||||
|
||||
// 关闭窗口的委托
|
||||
public Action<bool> CloseAction { get; set; }
|
||||
|
||||
public SampleExecViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private tube_input _tubeInput = new tube_input();
|
||||
/// <summary>
|
||||
/// 样品录入实体
|
||||
/// </summary>
|
||||
public tube_input TubeInput
|
||||
{
|
||||
get { return _tubeInput; }
|
||||
set {
|
||||
SetProperty(ref _tubeInput, value);
|
||||
}
|
||||
}
|
||||
|
||||
private List<sys_dict> _sampleTypeDict;
|
||||
|
||||
/// <summary>
|
||||
/// 样品类型字典
|
||||
/// </summary>
|
||||
public List<sys_dict> SampleTypeDict
|
||||
{
|
||||
get { return _sampleTypeDict; }
|
||||
set {
|
||||
SetProperty(ref _sampleTypeDict, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始化绑定下拉框数据
|
||||
/// </summary>
|
||||
public void InitComboxData()
|
||||
{
|
||||
//绑定样本类型
|
||||
SampleTypeDict = SystemConst.dictDatas.Where(p => p.class_id == 3).ToList();
|
||||
|
||||
//二维码样本序号
|
||||
string strdate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString("00") + DateTime.Now.Day.ToString("00");
|
||||
TubeInput.qrcode = strdate + GetQrcode();
|
||||
|
||||
}
|
||||
|
||||
private List<sys_standard_ext> _standardList = new List<sys_standard_ext>();
|
||||
|
||||
/// <summary>
|
||||
/// 执行标准列表
|
||||
/// </summary>
|
||||
public List<sys_standard_ext> StandardList
|
||||
{
|
||||
get { return _standardList; }
|
||||
set {
|
||||
SetProperty(ref _standardList, value);
|
||||
}
|
||||
}
|
||||
|
||||
private sys_standard _selectStandard;
|
||||
|
||||
/// <summary>
|
||||
/// 选中的标准
|
||||
/// </summary>
|
||||
public sys_standard SelectStandard
|
||||
{
|
||||
get { return _selectStandard; }
|
||||
set {
|
||||
SetProperty(ref _selectStandard, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private sys_dict _selectSampleType;
|
||||
|
||||
public sys_dict SelectSampleType
|
||||
{
|
||||
get { return _selectSampleType; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _selectSampleType, value);
|
||||
//绑定标准
|
||||
BangdingComboxStandard();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 绑定执行标准下拉框
|
||||
/// </summary>
|
||||
public void BangdingComboxStandard()
|
||||
{
|
||||
|
||||
if (SelectSampleType == null) return;
|
||||
|
||||
StandardList.Clear();
|
||||
|
||||
List<sys_standard_ext> templist = new List<sys_standard_ext>();
|
||||
|
||||
var standardList_temp = sampleSequenceBll.QuerySysStandards(SelectSampleType.id);
|
||||
foreach(var item in standardList_temp)
|
||||
{
|
||||
sys_standard_ext ext = new sys_standard_ext();
|
||||
ext.id = item.id;
|
||||
ext.IsSelected = false;
|
||||
ext.standard_name = item.standard_name;
|
||||
ext.sample_id = item.sample_id;
|
||||
|
||||
templist.Add(ext);
|
||||
}
|
||||
|
||||
StandardList = templist;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 二维码编号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetQrcode()
|
||||
{
|
||||
//string qrcode = dbHepler.QueryQrcode();
|
||||
string qrcode = sampleSequenceBll.QueryQrcode();
|
||||
|
||||
if (string.IsNullOrEmpty(qrcode))
|
||||
{
|
||||
MessageBox.Show("二维码编号获取失败!");
|
||||
}
|
||||
|
||||
return qrcode;
|
||||
}
|
||||
|
||||
private List<tube_input> _tubeInputs = new List<tube_input>();
|
||||
|
||||
public List<tube_input> TubeInputs
|
||||
{
|
||||
get { return _tubeInputs; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _tubeInputs, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取样品批次
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetBathNo()
|
||||
{
|
||||
//批次号
|
||||
string bachNo = "";
|
||||
|
||||
|
||||
if (TubeInputs == null || TubeInputs.Count <= 0)
|
||||
{
|
||||
//产生新的批次
|
||||
bachNo = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
bachNo = TubeInputs[0].bach_no;
|
||||
}
|
||||
|
||||
//设置新的批次
|
||||
TubeInput.bach_no = bachNo;
|
||||
|
||||
return bachNo;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存样品
|
||||
/// </summary>
|
||||
public bool SaveSample()
|
||||
{
|
||||
List<tube_input> tempList = new List<tube_input>();
|
||||
|
||||
////二维码序号
|
||||
int sqno = int.Parse(TubeInput.qrcode.Substring(8));// int.Parse(txtSampleSeqno2.Text);
|
||||
string strDate = TubeInput.qrcode.Substring(0, 8);
|
||||
for (int i = 0; i < TubeInput.tube_count; i++)
|
||||
{
|
||||
tube_input qRcode = new tube_input();
|
||||
qRcode.qrcode = strDate + sqno.ToString(); //TubeInput.qrcode;
|
||||
qRcode.item_name = TubeInput.item_name;
|
||||
//qRcode.seqno = txtSampleSeqno.Text + txtSampleSeqno2.Text;
|
||||
//执行标准
|
||||
//ComboBoxListItem item1 = SelectStandard.//cmbStrand.SelectedItem as ComboBoxListItem;
|
||||
|
||||
List<string> ids = new List<string>();
|
||||
List<string> standNames = new List<string>();
|
||||
foreach (var item in StandardList)
|
||||
{
|
||||
if(item.IsSelected)
|
||||
{
|
||||
ids.Add(item.id);
|
||||
standNames.Add(item.standard_name);
|
||||
}
|
||||
}
|
||||
qRcode.standrad_id = string.Join(",", ids.ToArray());
|
||||
qRcode.standrad = string.Join(",", standNames.ToArray());
|
||||
|
||||
|
||||
|
||||
qRcode.input_user = TubeInput.input_user;
|
||||
qRcode.input_date = DateTime.Now;
|
||||
//试管类型
|
||||
//ComboBoxListItem item = cmbTubeType.SelectedItem as ComboBoxListItem;
|
||||
qRcode.bach_no = TubeInput.bach_no;
|
||||
|
||||
//qRcode.weight = textBox5.Text;
|
||||
qRcode.tube_count = TubeInput.tube_count; //int.Parse(txtCount.Text);
|
||||
|
||||
//保持数据库
|
||||
sys_dict sys_Dict = new sys_dict();
|
||||
//int sqno = int.Parse(txtSampleSeqno2.Text);
|
||||
sys_Dict.data_value = sqno.ToString();
|
||||
sqno++;
|
||||
//放入list
|
||||
tempList.Add(qRcode);
|
||||
|
||||
|
||||
//保存数据,更新二维码编号
|
||||
if (sampleSequenceBll.SaveDataAndQrcode(qRcode, sys_Dict) <= 0)
|
||||
{
|
||||
MessageBox.Show("保存失败!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//MessageBox.Show("保存成功!");
|
||||
|
||||
//合并已有数据
|
||||
tempList.AddRange(TubeInputs);
|
||||
//通知更新
|
||||
TubeInputs = tempList;
|
||||
|
||||
return true;
|
||||
|
||||
//this.DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
private tube_input _selectSample;
|
||||
|
||||
/// <summary>
|
||||
/// 选中的样品
|
||||
/// </summary>
|
||||
public tube_input SelectSample
|
||||
{
|
||||
get { return _selectSample; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _selectSample, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除样品
|
||||
/// </summary>
|
||||
public void DeleSelectSample()
|
||||
{
|
||||
|
||||
tube_input[] tube_Inputs = new tube_input[TubeInputs.Count];
|
||||
|
||||
TubeInputs.CopyTo(tube_Inputs);
|
||||
|
||||
if (SelectSample != null)
|
||||
{
|
||||
if (MessageBox.Show($"确定删除:{SelectSample.qrcode}", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
|
||||
sampleSequenceBll.DelTubeInputByCode(SelectSample.qrcode);
|
||||
|
||||
var tubes = tube_Inputs.ToList();
|
||||
tubes.Remove(SelectSample);
|
||||
|
||||
TubeInputs = tubes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<sample_exec_ext> _cmdList = new List<sample_exec_ext>();
|
||||
|
||||
public List<sample_exec_ext> CmdList
|
||||
{
|
||||
get { return _cmdList; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _cmdList, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建指令集合
|
||||
/// </summary>
|
||||
public void CreateCmdList()
|
||||
{
|
||||
List<sample_exec_ext> temp_CmdList = new List<sample_exec_ext>();
|
||||
|
||||
//this.tubes = gridSamples.DataSource as List<tube_input>;
|
||||
|
||||
var groups = TubeInputs.GroupBy(p => new { p.standrad_id, p.standrad });
|
||||
|
||||
foreach (var g in groups)
|
||||
{
|
||||
sample_exec_ext sampleCmdExec = new sample_exec_ext();
|
||||
sampleCmdExec.id = Guid.NewGuid().ToString();
|
||||
sampleCmdExec.standrad_id = g.Key.standrad_id;
|
||||
sampleCmdExec.standradName = g.Key.standrad;
|
||||
|
||||
List<sample_exec_detail> details = new List<sample_exec_detail>();
|
||||
foreach (var item in g)
|
||||
{
|
||||
sampleCmdExec.sample_count++;
|
||||
sampleCmdExec.qrcodes += item.qrcode + "|";
|
||||
sample_exec_detail sample_Exec_Detail = new sample_exec_detail();
|
||||
details.Add(new sample_exec_detail() { master_id = sampleCmdExec.id, qrcode = item.qrcode });
|
||||
}
|
||||
|
||||
sampleCmdExec.sampleExecDetails = details;
|
||||
sampleCmdExec.exec_state = "未执行";
|
||||
temp_CmdList.Add(sampleCmdExec);
|
||||
|
||||
}
|
||||
CmdList = temp_CmdList;
|
||||
//BadingSopData(cmds);
|
||||
}
|
||||
|
||||
private sample_exec_ext _selectItemCmd;
|
||||
|
||||
public sample_exec_ext SelectItemCmd
|
||||
{
|
||||
get { return _selectItemCmd; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _selectItemCmd,value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<string> sopList = new List<string>();
|
||||
/// <summary>
|
||||
/// 初始化指令集合
|
||||
/// </summary>
|
||||
public void InitCmdData()
|
||||
{
|
||||
actionParmList.Clear();
|
||||
sopList.Clear();
|
||||
|
||||
if (SelectItemCmd.standrad_id.Contains(","))
|
||||
{
|
||||
string[] standradIds = SelectItemCmd.standrad_id.Split(',');
|
||||
sopList.AddRange(standradIds);
|
||||
|
||||
foreach (var id in standradIds)
|
||||
{
|
||||
CreateData(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sopList.Add(SelectItemCmd.standrad_id);
|
||||
CreateData(SelectItemCmd.standrad_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void CreateData(string standrad_id)
|
||||
{
|
||||
//查询标准下的动作
|
||||
var standardActions = sampleSequenceBll.GetStrandActionByStrandId(standrad_id);
|
||||
//动作排序
|
||||
standardActions = standardActions.OrderBy(p => p.process_no).ToList(); ;
|
||||
|
||||
//查询动作参数
|
||||
var sys_standard_process_parms = sampleSequenceBll.GetStrandActionParamByStrandId(standrad_id);
|
||||
|
||||
|
||||
if (sys_standard_process_parms.Count <= 0)
|
||||
{
|
||||
MessageBox.Show("没有流程数据!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GetData(standardActions, sys_standard_process_parms);
|
||||
}
|
||||
|
||||
public void GetData(List<sys_standard_action_ext> actions, List<sys_standard_action_parm_ext> standardProcessParmList)
|
||||
{
|
||||
|
||||
foreach (var actionItem in actions)
|
||||
{
|
||||
//判断是否有重复的【进样】动作
|
||||
if (actionItem.action_name == "进样" && actionParmList.Find(p => p.action_name == "进样") != null)
|
||||
{
|
||||
continue; //跳过
|
||||
}
|
||||
|
||||
//查询动作下的参数配置
|
||||
var paramData = standardProcessParmList.Where(p => p.action_id == actionItem.process_id && p.action_seqno == actionItem.process_no).ToList();
|
||||
if (paramData.Count <= 0)
|
||||
{
|
||||
sys_standard_action_parm_ext temp = new sys_standard_action_parm_ext();
|
||||
temp.action_name = actionItem.action_name;
|
||||
temp.action_seqno = actionItem.process_no;
|
||||
temp.title = "无";
|
||||
actionParmList.Add(temp);
|
||||
continue;
|
||||
}
|
||||
|
||||
actionParmList.AddRange(paramData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<sys_standard_action_parm_ext> actionParmList = new List<sys_standard_action_parm_ext>();
|
||||
|
||||
public List<sys_standard_action_parm_ext> ActionParmList
|
||||
{
|
||||
get { return actionParmList; }
|
||||
set {
|
||||
SetProperty(ref actionParmList, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string sopStr = "";
|
||||
public void CmdDo()
|
||||
{
|
||||
if (!CmdExec()) return;
|
||||
|
||||
//保存下发记录
|
||||
|
||||
SelectItemCmd.exec_state = "执行中";
|
||||
SelectItemCmd.cmd_content = sopStr;
|
||||
SelectItemCmd.exec_date = DateTime.Now;
|
||||
MessageBox.Show("下发成功!");
|
||||
//保存主表
|
||||
sampleSequenceBll.SaveCmdExec(SelectItemCmd);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送测试指令
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private bool CmdExec()
|
||||
{
|
||||
//查询所有动作
|
||||
List<sys_action_ext> sysAction = sampleSequenceBll.QuerySysAction();
|
||||
////查询所有参数,及修改
|
||||
List<sys_standard_action_parm_ext> standardProcessParms = actionParmList;// GetEditVal();
|
||||
if (standardProcessParms == null)
|
||||
{
|
||||
//MessageBox.Show("指令生成错误!");
|
||||
return false;
|
||||
}
|
||||
sopStr = "";
|
||||
|
||||
//S7协议
|
||||
List<byte> sop = sampleSequenceBll.CreateCmdBytes(sysAction, sopList, standardProcessParms);
|
||||
|
||||
////modbus协议
|
||||
//List<ushort> sop = this.sampleSequenceBll.CreateCmdUshorts(sysAction, standardActions, standardProcessParms);
|
||||
|
||||
if (sop == null)
|
||||
{
|
||||
MessageBox.Show("指令生成错误!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sopStr = string.Join("-", sop.ToArray());
|
||||
|
||||
//写入PLC
|
||||
bool val = communicationBll.WritePlcData(100, 0, sop.ToArray());
|
||||
|
||||
//bool val = monitorBll.WritePlcData(1, 0, sop.ToArray());
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 总复位
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void InitPlcState()
|
||||
{
|
||||
Task.Run(() => {
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
int a = i+1;
|
||||
communicationBll.WriteSingleData("DB19.DBX0.0", true);
|
||||
Task.Delay(1000).Wait();
|
||||
LoggerHelper.Logger.Error("发生复位指令");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 导入样品
|
||||
///// </summary>
|
||||
///// <param name="list"></param>
|
||||
//public void ImportSamples(List<tube_input> list)
|
||||
//{
|
||||
// TubeInputs = list;
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增样品
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnAddSampleClick()
|
||||
{
|
||||
|
||||
GetBathNo();
|
||||
|
||||
InitComboxData();
|
||||
|
||||
NewSampleWindow frm = new NewSampleWindow(this);
|
||||
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除样品
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnDelSampleClick()
|
||||
{
|
||||
|
||||
DeleSelectSample();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导入样品
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnImportSampleClick()
|
||||
{
|
||||
ImportSampleWindow frm = new ImportSampleWindow(this);
|
||||
if (frm.ShowDialog() == true)
|
||||
{
|
||||
//ImportSamples(frm.samples);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建指令
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnCreateCmdClick()
|
||||
{
|
||||
CreateCmdList();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开命令下发
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void RowDoubleClick()
|
||||
{
|
||||
ActionShowWindow frm = new ActionShowWindow(this);
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 命令下发
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void CmdDoClick()
|
||||
{
|
||||
|
||||
CmdDo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存样本
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnOKClick()
|
||||
{
|
||||
|
||||
if (SaveSample())
|
||||
{
|
||||
this.CloseAction?.Invoke(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Ext;
|
||||
using Models.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.SopManager
|
||||
{
|
||||
public partial class ActionManagerViewModel : ObservableObject
|
||||
{
|
||||
ActionMangerBll actionMangerBll = new ActionMangerBll();
|
||||
|
||||
SOPManagerBll sopBll = new SOPManagerBll();
|
||||
|
||||
public ActionManagerViewModel()
|
||||
{
|
||||
|
||||
///获取所有动作
|
||||
InitActionData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 所有动作列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<sys_action_ext> sysActions = new List<sys_action_ext>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有动作
|
||||
/// </summary>
|
||||
public void InitActionData()
|
||||
{
|
||||
|
||||
SysActions = actionMangerBll.QuerySysAction();
|
||||
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
public List<sys_action_parm_map_ext> actionParams;
|
||||
|
||||
|
||||
private sys_action_ext _selectItem;
|
||||
|
||||
/// <summary>
|
||||
/// 选中的动作行
|
||||
/// </summary>
|
||||
public sys_action_ext SelectItem
|
||||
{
|
||||
get { return _selectItem; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _selectItem, value);
|
||||
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中的参数
|
||||
/// </summary>
|
||||
|
||||
private sys_action_parm_map_ext _selectParam;
|
||||
|
||||
public sys_action_parm_map_ext SelectParam
|
||||
{
|
||||
get { return _selectParam; }
|
||||
set {
|
||||
SetProperty(ref _selectParam, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询动作下参数
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
public void GetParmData(string actionId)
|
||||
{
|
||||
ActionParams = actionMangerBll.GetProcess_parm_mapByProcessId(actionId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取动作下的参数
|
||||
/// </summary>
|
||||
private void OnSelectedActionChanged()
|
||||
{
|
||||
if (SelectItem == null) return;
|
||||
//获取动作下的参数
|
||||
GetParmData(SelectItem.id);
|
||||
}
|
||||
|
||||
public void DeleAction()
|
||||
{
|
||||
if (SelectItem == null) return;
|
||||
|
||||
sys_action_ext action = SelectItem;
|
||||
|
||||
if (action.action_unit == "0") return;
|
||||
|
||||
if (MessageBox.Show($"确定删除:{action.action_name}", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
//校验动作是否已经被使用
|
||||
if (CheckAction(action) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//删除动作
|
||||
actionMangerBll.DelSysActionData(action.id);
|
||||
|
||||
|
||||
//=====刷新列表===================
|
||||
InitActionData();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckAction(sys_action process)
|
||||
{
|
||||
bool isExis = sopBll.IsExisAction(process.id);
|
||||
|
||||
if (isExis)
|
||||
{
|
||||
MessageBox.Show("该动作已经被使用,不能删除!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SelectShowParmList()
|
||||
{
|
||||
if(SelectItem == null)
|
||||
{
|
||||
MessageBox.Show("请先选择动作!");
|
||||
return;
|
||||
}
|
||||
SelectParmListWindow frm = new SelectParmListWindow(SelectItem);
|
||||
if(frm.ShowDialog() == true)
|
||||
{
|
||||
//获取动作下的参数
|
||||
GetParmData(SelectItem.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除参数
|
||||
/// </summary>
|
||||
public void DeleParam()
|
||||
{
|
||||
if (SelectItem == null || SelectParam == null) return;//SelectItem
|
||||
|
||||
sys_action_parm_map_ext process = SelectParam;
|
||||
int id = process.id;
|
||||
string parm_name = process.title;
|
||||
|
||||
if (MessageBox.Show($"确定删除:{parm_name}", "提示",MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
|
||||
actionMangerBll.DelProcessParmMap(id);
|
||||
|
||||
GetParmData(process.process_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增动作
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnAddActionClick()
|
||||
{
|
||||
NewActionWindow frm = new NewActionWindow(this);
|
||||
if (frm.ShowDialog() == true)
|
||||
{
|
||||
//刷新列表
|
||||
|
||||
InitActionData();
|
||||
|
||||
//刷新列表
|
||||
ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(SysActions);//获取数据视图
|
||||
|
||||
////分组
|
||||
//view.SortDescriptions.Add(new SortDescription("action_seqno", ListSortDirection.Ascending));
|
||||
view.GroupDescriptions.Clear();
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("action_unitname"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除动作
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnDelActionClick()
|
||||
{
|
||||
|
||||
DeleAction();
|
||||
|
||||
//刷新列表
|
||||
ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(SysActions);//获取数据视图
|
||||
|
||||
////分组
|
||||
view.GroupDescriptions.Clear();
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("action_unitname"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 动作下新增参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnSelectParamClick()
|
||||
{
|
||||
|
||||
SelectShowParmList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除动作下参数
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnDelParmClick()
|
||||
{
|
||||
|
||||
DeleParam();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
18
SamplePreSystem.UI/ViewModel/SopManager/DataGroup.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using SamplePre.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.SopManager
|
||||
{
|
||||
public class DataGroup
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string SopName { get; set; }
|
||||
|
||||
public List<TreeListItem> ListItems { get; set; } = new List<TreeListItem>();
|
||||
}
|
||||
}
|
||||
258
SamplePreSystem.UI/ViewModel/SopManager/ParamManagerViewModel.cs
Normal file
@@ -0,0 +1,258 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Const;
|
||||
using Models.Models;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.SopManager
|
||||
{
|
||||
public partial class ParamManagerViewModel : ObservableObject
|
||||
{
|
||||
SysParamBll sysParamBll = new SysParamBll();
|
||||
|
||||
|
||||
|
||||
public ParamManagerViewModel()
|
||||
{
|
||||
//初始化标准
|
||||
InitParamData();
|
||||
|
||||
BangdingUnit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 参数列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<sys_parm> sysParams = new List<sys_parm>();
|
||||
|
||||
/// <summary>
|
||||
/// 选中的参数行
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public sys_parm selectItem = new sys_parm();
|
||||
|
||||
List<sys_parm> allSysParams = new List<sys_parm>();
|
||||
|
||||
public void InitParamData()
|
||||
{
|
||||
allSysParams = sysParamBll.QuerySysParm()?.OrderBy(p => p.plc_type).ToList();
|
||||
|
||||
|
||||
OnFilterTypeChange();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<string> dataTypes = new List<string> { "通用", "耗材", "液体" };
|
||||
|
||||
/// <summary>
|
||||
/// 过滤类型
|
||||
/// </summary>
|
||||
private string filterType = "通用";
|
||||
|
||||
public string FilterType
|
||||
{
|
||||
get { return filterType; }
|
||||
set {
|
||||
|
||||
SetProperty(ref filterType, value);
|
||||
|
||||
OnFilterTypeChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void OnFilterTypeChange()
|
||||
{
|
||||
if (string.IsNullOrEmpty(FilterType))
|
||||
{
|
||||
SysParams = allSysParams;
|
||||
return;
|
||||
}
|
||||
|
||||
SysParams = allSysParams.Where(p => p.param_type == FilterType).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单位列表
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public List<sys_dict> units = new List<sys_dict>();
|
||||
|
||||
|
||||
public void BangdingUnit()
|
||||
{
|
||||
Units = SystemConst.dictDatas.Where(p => p.class_id == 4).ToList();
|
||||
|
||||
//cmbUnit.BindingData<sys_dict>(units, "data_value", "id");
|
||||
//cmbUnit.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 参数值绑定
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
public sys_parm sysParm = new sys_parm();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool SaveParam()
|
||||
{
|
||||
if (string.IsNullOrEmpty(SysParm.title) || string.IsNullOrEmpty(SysParm.data_value))
|
||||
{
|
||||
MessageBox.Show("内容不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(SysParm.param_type))
|
||||
{
|
||||
MessageBox.Show("参数类型不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SysParm.data_type == "数值")
|
||||
{
|
||||
string val = SysParm.data_value;
|
||||
if (float.TryParse(val, out _) == false)
|
||||
{
|
||||
MessageBox.Show("参数值格式不正确,请重新修改!");
|
||||
SysParm.data_value = "0";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (SysParm != null && !string.IsNullOrEmpty(SysParm.id))
|
||||
{
|
||||
//修改
|
||||
sysParamBll.UpdateSysParm(SysParm);
|
||||
}
|
||||
else
|
||||
{
|
||||
//判断plc编码是否重复
|
||||
if (sysParamBll.IsExtisPlCcode(SysParm.plc_type))
|
||||
{
|
||||
MessageBox.Show("存在相同plc编码,不能保存!");
|
||||
return false;
|
||||
}
|
||||
//新增
|
||||
SysParm.id = Guid.NewGuid().ToString();
|
||||
|
||||
sysParamBll.SaveSysParm(SysParm);
|
||||
}
|
||||
|
||||
//刷新参数列表
|
||||
InitParamData();
|
||||
OnFilterTypeChange();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool DelParam()
|
||||
{
|
||||
sys_parm parm = SelectItem;
|
||||
string id = parm.id;
|
||||
string title = parm.title;
|
||||
|
||||
|
||||
if (MessageBox.Show($"确定删除:{title}", "提示",MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
//判断该参数是否已经被使用
|
||||
if (IsDelete(id) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
sysParamBll.DelSysParm(id);
|
||||
|
||||
//刷新参数列表
|
||||
InitParamData();
|
||||
OnFilterTypeChange();
|
||||
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private bool IsDelete(string parmId)
|
||||
{
|
||||
bool isExit = sysParamBll.IsExtisActionParam(parmId);
|
||||
if (isExit)
|
||||
{
|
||||
MessageBox.Show("该参数已经被使用,不能删除!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
public void BtnAddParamClick()
|
||||
{
|
||||
SysParm = new sys_parm();
|
||||
NewStandParmWindow frm = new NewStandParmWindow(this);
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑参数
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
public void BtnEditClick()
|
||||
{
|
||||
SysParm = SelectItem;
|
||||
|
||||
NewStandParmWindow frm = new NewStandParmWindow(this);
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
[RelayCommand]
|
||||
private void BtnDelParamClick()
|
||||
{
|
||||
DelParam();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
376
SamplePreSystem.UI/ViewModel/SopManager/SopMangerViewModel.cs
Normal file
@@ -0,0 +1,376 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Models.Const;
|
||||
using Models.Models;
|
||||
using SamplePre.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.ProcessBll.BLL;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace SamplePreSystem.UI.ViewModel.SopManager
|
||||
{
|
||||
public partial class SopMangerViewModel : ObservableObject
|
||||
{
|
||||
|
||||
SOPManagerBll sopManagerBll = new SOPManagerBll();
|
||||
|
||||
SystemBll systemBll = new SystemBll();
|
||||
|
||||
|
||||
public SopMangerViewModel()
|
||||
{
|
||||
//初始化标准
|
||||
InitStandardData();
|
||||
|
||||
//初始化动作
|
||||
InitActionData();
|
||||
//sop
|
||||
GetSopData("111");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sop列表
|
||||
/// </summary>
|
||||
public List<DataGroup> StandardGroups { get; set; } = new List<DataGroup>();
|
||||
|
||||
/// <summary>
|
||||
/// sop列表
|
||||
/// </summary>
|
||||
|
||||
private List<sys_standard_action_ext> _sopList = new List<sys_standard_action_ext>();
|
||||
|
||||
public List<sys_standard_action_ext> SopList
|
||||
{
|
||||
get { return _sopList; }
|
||||
set {
|
||||
SetProperty(ref _sopList, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择的动作
|
||||
/// </summary>
|
||||
private sys_standard_action_ext _selectItem;
|
||||
|
||||
public sys_standard_action_ext SelectItem
|
||||
{
|
||||
get { return _selectItem; }
|
||||
set {
|
||||
SetProperty(ref _selectItem, value);
|
||||
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择的参数
|
||||
/// </summary>
|
||||
private sys_standard_action_parm_ext _selectParamItem;
|
||||
|
||||
public sys_standard_action_parm_ext SelectParamItem
|
||||
{
|
||||
get { return _selectParamItem; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectParamItem, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 动作参数列表
|
||||
/// </summary>
|
||||
private List<sys_standard_action_parm_ext> _actionParamList = new List<sys_standard_action_parm_ext>();
|
||||
|
||||
public List<sys_standard_action_parm_ext> ActionParamList
|
||||
{
|
||||
get { return _actionParamList; }
|
||||
set {
|
||||
|
||||
SetProperty(ref _actionParamList, value);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnSelectedActionChanged()
|
||||
{
|
||||
if (SelectItem == null) return;
|
||||
//获取动作下的参数
|
||||
List<sys_standard_action_parm_ext> paramList = sopManagerBll.GetStrandActionParamByStrandId(SelectItem.standard_id);
|
||||
ActionParamList = paramList.Where(p => p.action_id == SelectItem.process_id && p.action_seqno == SelectItem.process_no).ToList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void InitStandardData()
|
||||
{
|
||||
|
||||
SystemConst.dictDatas = systemBll.QueryDictData();
|
||||
|
||||
List<TreeListItem> treeListItems = sopManagerBll.GetStandardData();
|
||||
|
||||
|
||||
|
||||
var group = treeListItems.Where(p=>p.ParentID == "0").ToList();
|
||||
foreach (TreeListItem item in group)
|
||||
{
|
||||
DataGroup sopGroup = new DataGroup();
|
||||
sopGroup.Id = item.ID;
|
||||
sopGroup.SopName = item.DisplayText;
|
||||
|
||||
sopGroup.ListItems = treeListItems.Where(p => p.ParentID == item.ID).ToList();
|
||||
|
||||
StandardGroups.Add(sopGroup);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<DataGroup> ActionGroups { get; set; } = new List<DataGroup>();
|
||||
|
||||
/// <summary>
|
||||
/// 初始化动作字典
|
||||
/// </summary>
|
||||
public void InitActionData()
|
||||
{
|
||||
|
||||
//获取动作
|
||||
List<sys_action_ext> actions = sopManagerBll.QuerySysAction();
|
||||
|
||||
//拼装组
|
||||
var groups = actions.GroupBy(p => new { p.action_unitname, p.action_unit }).ToList();
|
||||
foreach (var item in groups)
|
||||
{
|
||||
DataGroup sopGroup = new DataGroup();
|
||||
sopGroup.Id = item.Key.action_unit;
|
||||
sopGroup.SopName = item.Key.action_unitname;
|
||||
|
||||
var itemList = actions.Where(p => p.action_unit == item.Key.action_unit).ToList();
|
||||
foreach(var it in itemList)
|
||||
{
|
||||
sopGroup.ListItems.Add(new TreeListItem() { ID = it.id, DisplayText = it.action_name, ParentID = item.Key.action_unit });
|
||||
}
|
||||
|
||||
|
||||
ActionGroups.Add(sopGroup);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public string m_standradId;
|
||||
|
||||
public void GetSopData(string standradId)
|
||||
{
|
||||
m_standradId = standradId;
|
||||
SopList = sopManagerBll.QueryStandardProcessByStandardId(standradId);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 拖拽新增动作
|
||||
/// </summary>
|
||||
/// <param name="dropItem"></param>
|
||||
[RelayCommand]
|
||||
public void AddDragSopAction(TreeListItem dropItem)
|
||||
{
|
||||
List<sys_standard_action_ext> actionList = SopList;
|
||||
|
||||
if (string.IsNullOrEmpty(m_standradId)) return;
|
||||
|
||||
if (dropItem != null && actionList != null)
|
||||
{
|
||||
int maxSeqno = 0;
|
||||
//取最后的动作序号+1;
|
||||
if (actionList.Count > 0)
|
||||
{
|
||||
maxSeqno = actionList[actionList.Count - 1].process_no + 1;
|
||||
}
|
||||
|
||||
|
||||
sys_standard_action procemodel = new sys_standard_action()
|
||||
{
|
||||
id = Guid.NewGuid().ToString(),
|
||||
process_id = dropItem.ID,
|
||||
//process_name = process.process_name,
|
||||
process_no = maxSeqno,//actionList.Count + 1,
|
||||
standard_id = m_standradId
|
||||
};
|
||||
|
||||
//保存标准动作表、动作参数表
|
||||
sopManagerBll.SaveStandardAction_param(procemodel);
|
||||
|
||||
//=======================================================
|
||||
//查询标准下的SOP
|
||||
GetSopData(m_standradId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除动作
|
||||
/// </summary>
|
||||
public void RemoveAction()
|
||||
{
|
||||
|
||||
sys_standard_action_ext pro = SelectItem; //this.gridView1.GetRow(rows[0]) as sys_standard_action_ext;
|
||||
if (pro == null) return;
|
||||
if (MessageBox.Show($"确定移除:{pro.action_name}", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
//移除标准下的动作
|
||||
sopManagerBll.removeStandAction(pro);
|
||||
|
||||
|
||||
//查询标准下的SOP
|
||||
GetSopData(pro.standard_id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上移动作操作
|
||||
/// </summary>
|
||||
public void UpMove()
|
||||
{
|
||||
sys_standard_action_ext[] temp_list = new sys_standard_action_ext[SopList.Count];
|
||||
SopList.CopyTo(temp_list);
|
||||
|
||||
for (int i = 0;i < temp_list.Length;i++)
|
||||
{
|
||||
if (i != 0 && temp_list[i] == SelectItem)
|
||||
{
|
||||
|
||||
var item = temp_list[i - 1];
|
||||
temp_list[i - 1] = SelectItem;
|
||||
temp_list[i] = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SopList = temp_list.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下移动作操作
|
||||
/// </summary>
|
||||
public void DownMove()
|
||||
{
|
||||
sys_standard_action_ext[] temp_list = new sys_standard_action_ext[SopList.Count];
|
||||
SopList.CopyTo(temp_list);
|
||||
|
||||
for (int i = 0; i < temp_list.Length; i++)
|
||||
{
|
||||
if (i < temp_list.Length - 1 && temp_list[i] == SelectItem)
|
||||
{
|
||||
|
||||
var item = temp_list[i + 1];
|
||||
temp_list[i + 1] = SelectItem;
|
||||
temp_list[i] = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SopList = temp_list.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新序号
|
||||
/// </summary>
|
||||
public void UpdateSeqno()
|
||||
{
|
||||
//List<sys_standard_action_ext> sopList = gridActions.DataSource as List<sys_standard_action_ext>;
|
||||
|
||||
int seqno = 1;
|
||||
string standradId = "";
|
||||
foreach (var action in SopList)
|
||||
{
|
||||
//sys_standard_action_ext action = tree_Actions.GetDataRecordByNode(node) as sys_standard_action_ext;
|
||||
standradId = action.standard_id;
|
||||
|
||||
action.new_action_seqno = seqno;
|
||||
|
||||
sopManagerBll.UpdateActionSeqno(action);
|
||||
seqno++;
|
||||
}
|
||||
GetSopData(standradId);
|
||||
}
|
||||
|
||||
public void AddParamShow()
|
||||
{
|
||||
if (SelectItem != null)
|
||||
{
|
||||
SelectParmListWindow frm = new SelectParmListWindow(SelectItem);
|
||||
if(frm.ShowDialog() == true)
|
||||
{
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveParam()
|
||||
{
|
||||
|
||||
if (SelectItem != null && SelectParamItem != null)
|
||||
{
|
||||
if (MessageBox.Show($"是否移除【{SelectParamItem.title}】参数?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
||||
{
|
||||
sopManagerBll.removeActionParmByParamId(SelectItem.standard_id, SelectItem.process_id, SelectItem.process_no, SelectParamItem.parm_id);
|
||||
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void AddEidtParam()
|
||||
{
|
||||
if(ActionParamList.Count > 0)
|
||||
{
|
||||
//List<sys_standard_action_parm> list = uCActionParam.GetEditVal();
|
||||
//if (list == null) return;
|
||||
foreach (var item in ActionParamList)
|
||||
{
|
||||
sopManagerBll.updateStandardActionParm(item);
|
||||
}
|
||||
|
||||
MessageBox.Show("修改成功!");
|
||||
|
||||
OnSelectedActionChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 标准选择命令
|
||||
/// </summary>
|
||||
/// <param name="selectItem"></param>
|
||||
[RelayCommand]
|
||||
public void StandSelectedItemChanged(object obj)
|
||||
{
|
||||
TreeListItem selectItem = obj as TreeListItem;
|
||||
if (selectItem == null) return;
|
||||
GetSopData(selectItem.ID);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
119
SamplePreSystem.UI/Views/ConfigManager/RoleView.xaml
Normal file
@@ -0,0 +1,119 @@
|
||||
<UserControl
|
||||
x:Class="SamplePre.UIWpf.ConfigManager.RoleView"
|
||||
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:SamplePre.UIWpf.ConfigManager"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#e6e6e6"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Border
|
||||
Margin="5"
|
||||
Background="White"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="用户列表" />
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnAdd"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding BtnAddClickCommand}"
|
||||
Content="新增"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="PackageVariantClosedPlus" />
|
||||
<Button
|
||||
x:Name="btnEdit"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding BtnEditClickCommand}"
|
||||
Content="编辑"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="ContentSaveEditOutline" />
|
||||
<Button
|
||||
x:Name="btnDele"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding BtnDeleClickCommand}"
|
||||
Content="删除"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="DeleteForeverOutline" />
|
||||
<Button
|
||||
x:Name="btnPermisson"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding BtnPermissonClickCommand}"
|
||||
Content="权限"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="LayersEdit" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
<!-- 用户列表 -->
|
||||
<DataGrid
|
||||
x:Name="dg_roles"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding RolesList}"
|
||||
SelectedItem="{Binding ConfigRole}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Header="动作" Binding="{Binding action_name}" Width="*"/>-->
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding id}"
|
||||
Header="ID"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding name}"
|
||||
Header="角色名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding description}"
|
||||
Header="描述"
|
||||
IsReadOnly="True" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
</UserControl>
|
||||
71
SamplePreSystem.UI/Views/ConfigManager/RoleView.xaml.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using SamplePre.Models.Tables;
|
||||
using SamplePre.UIWpf.ConfigManager.chirld;
|
||||
using SamplePreSystem.UI.ViewModel.ConfigManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SamplePre.UIWpf.ConfigManager
|
||||
{
|
||||
/// <summary>
|
||||
/// RoleView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class RoleView : UserControl
|
||||
{
|
||||
public RoleView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = new RoleViewModel();
|
||||
}
|
||||
|
||||
//private void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// var vm = this.DataContext as RoleViewModel;
|
||||
|
||||
// vm.ConfigRole = new config_role();
|
||||
// NewRoleWindow frm = new NewRoleWindow(vm);
|
||||
// if (frm.ShowDialog() == true)
|
||||
// {
|
||||
// vm.GetData();
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void btnEdit_Click(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// var vm = this.DataContext as RoleViewModel;
|
||||
|
||||
// NewRoleWindow frm = new NewRoleWindow(vm);
|
||||
// if (frm.ShowDialog() == true)
|
||||
// {
|
||||
// vm.GetData();
|
||||
// }
|
||||
//}
|
||||
|
||||
private void btnDele_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = this.DataContext as RoleViewModel;
|
||||
vm.DeleteRole();
|
||||
}
|
||||
|
||||
private void btnPermisson_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = this.DataContext as RoleViewModel;
|
||||
|
||||
if (string.IsNullOrEmpty(vm.ConfigRole.id)) return;
|
||||
PermissionWindow frm = new PermissionWindow(vm);
|
||||
frm.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
211
SamplePreSystem.UI/Views/ConfigManager/SysConfigMangerView.xaml
Normal file
@@ -0,0 +1,211 @@
|
||||
<UserControl
|
||||
x:Class="SamplePreSystem.UI.ConfigManager.SysConfigMangerView"
|
||||
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:SamplePreSystem.UI.ConfigManager"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#E6E6E6"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<!-- 配置列表 -->
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Margin="5"
|
||||
Background="White"
|
||||
CornerRadius="5">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="配置列表:" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<Button
|
||||
x:Name="btnAdd"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="5,0"
|
||||
Command="{Binding AddClassClickCommand}"
|
||||
Content="{materialDesign:PackIcon PlusCircleOutline}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="新增" />
|
||||
<Button
|
||||
x:Name="btnDel"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="5,0"
|
||||
Command="{Binding DelClassClickCommand}"
|
||||
Content="{materialDesign:PackIcon DeleteCircleOutline}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="删除" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 配置列表 -->
|
||||
<TreeView
|
||||
x:Name="tvData"
|
||||
Grid.Row="1"
|
||||
FontSize="13"
|
||||
ItemsSource="{Binding DictClassList}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectedItemChanged">
|
||||
<i:InvokeCommandAction Command="{Binding TvDataSelectedItemChangedCommand}" PassEventArgsToCommand="True" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<!-- 全局样式:所有节点默认展开 -->
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource MaterialDesignTreeViewItem}" TargetType="TreeViewItem">
|
||||
<Setter Property="IsExpanded" Value="True" />
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="5,0" Kind="{Binding IconKind}" />
|
||||
<!-- 复选框 + 文字 -->
|
||||
<TextBlock Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
</Border>
|
||||
|
||||
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
Margin="0,5,5,5"
|
||||
Background="White"
|
||||
CornerRadius="5">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="配置内容:" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<Button
|
||||
x:Name="btnAddItem"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="5,0"
|
||||
Command="{Binding AddItemClickCommand}"
|
||||
Content="{materialDesign:PackIcon PlusCircleOutline}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="新增" />
|
||||
<Button
|
||||
x:Name="btnDelItem"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="5,0"
|
||||
Command="{Binding DelItemClickCommand}"
|
||||
Content="{materialDesign:PackIcon DeleteCircleOutline}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="删除" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
<DataGrid
|
||||
x:Name="dg_list"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding SysDicts}"
|
||||
SelectedItem="{Binding SysDict}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Header="动作" Binding="{Binding action_name}" Width="*"/>-->
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding id}"
|
||||
Header="ID"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding data_type}"
|
||||
Header="项目名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding data_value}"
|
||||
Header="值"
|
||||
IsReadOnly="True" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,37 @@
|
||||
using SamplePreSystem.UI.ConfigManager.chirld;
|
||||
using SamplePreSystem.UI.ViewModel.ConfigManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using static MaterialDesignThemes.Wpf.Theme.ToolBar;
|
||||
|
||||
namespace SamplePreSystem.UI.ConfigManager
|
||||
{
|
||||
/// <summary>
|
||||
/// SysConfigMangerView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SysConfigMangerView : UserControl
|
||||
{
|
||||
public SysConfigMangerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = new SysConfigMangerViewModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
114
SamplePreSystem.UI/Views/ConfigManager/UsersView.xaml
Normal file
@@ -0,0 +1,114 @@
|
||||
<UserControl
|
||||
x:Class="SamplePre.UIWpf.ConfigManager.UsersView"
|
||||
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:SamplePre.UIWpf.ConfigManager"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#e6e6e6"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Border
|
||||
Margin="5"
|
||||
Background="White"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="用户列表" />
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnAdd"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding BtnAddClickCommand}"
|
||||
Content="新增"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="PackageVariantClosedPlus" />
|
||||
<Button
|
||||
x:Name="btnEdit"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding BtnEditClickCommand}"
|
||||
Content="编辑"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="ContentSaveEditOutline" />
|
||||
<Button
|
||||
x:Name="btnDele"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding BtnDeleClickCommand}"
|
||||
Content="删除"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="DeleteForeverOutline" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
<!-- 用户列表 -->
|
||||
<DataGrid
|
||||
x:Name="dg_users"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding UserList}"
|
||||
SelectedItem="{Binding SelectUser}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Header="动作" Binding="{Binding action_name}" Width="*"/>-->
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding id}"
|
||||
Header="ID"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding username}"
|
||||
Header="用户名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding all_role_names}"
|
||||
Header="角色"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding is_enabled}"
|
||||
Header="是否启用"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
</UserControl>
|
||||
37
SamplePreSystem.UI/Views/ConfigManager/UsersView.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using SamplePre.UIWpf.ConfigManager.chirld;
|
||||
using SamplePreSystem.UI.ViewModel.ConfigManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SamplePre.UIWpf.ConfigManager
|
||||
{
|
||||
/// <summary>
|
||||
/// UsersView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class UsersView : UserControl
|
||||
{
|
||||
public UsersView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var vm = new UsersViewModel();
|
||||
|
||||
this.DataContext = vm ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePreSystem.UI.ConfigManager.chirld.NewDictClassWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="新增分类"
|
||||
Width="400"
|
||||
Height="200"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="名称:" />
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding DictClass.dict_type}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="描述:" />
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding DictClass.remark}" />
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOK"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnOK_Click"
|
||||
Content="确定" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnCancel_Click"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,46 @@
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.ConfigManager;
|
||||
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 SamplePreSystem.UI.ConfigManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// NewDictClassWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class NewDictClassWindow : BaseWindow
|
||||
{
|
||||
public NewDictClassWindow(SysConfigMangerViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = vm;
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = this.DataContext as SysConfigMangerViewModel;
|
||||
if(vm.NewAddDict())
|
||||
{
|
||||
this.DialogResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePreSystem.UI.ConfigManager.chirld.NewDictDetailWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="新增配置项"
|
||||
Width="400"
|
||||
Height="250"
|
||||
FontSize="13"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="名称:" />
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysDict.data_type}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="数值:" />
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysDict.data_value}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
VerticalAlignment="Center"
|
||||
Text="说明:" />
|
||||
|
||||
<TextBox
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysDict.remark}" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOK"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnOK_Click"
|
||||
Content="确定" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnCancel_Click"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,46 @@
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.ConfigManager;
|
||||
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 SamplePreSystem.UI.ConfigManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// NewDictDetailWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class NewDictDetailWindow : BaseWindow
|
||||
{
|
||||
public NewDictDetailWindow(SysConfigMangerViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = vm;
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = this.DataContext as SysConfigMangerViewModel;
|
||||
if(vm.NewAddDictDetail())
|
||||
{
|
||||
this.DialogResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.ConfigManager.chirld.NewRoleWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="角色编辑"
|
||||
Width="400"
|
||||
Height="200"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="角色名称:" />
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding ConfigRole.name}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="描述:" />
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding ConfigRole.description}" />
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOK"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnOK_Click"
|
||||
Content="确定" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnCancel_Click"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,46 @@
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.ConfigManager;
|
||||
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 SamplePre.UIWpf.ConfigManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// NewRoleWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class NewRoleWindow : BaseWindow
|
||||
{
|
||||
public NewRoleWindow(RoleViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = vm;
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = this.DataContext as RoleViewModel;
|
||||
if(vm.SaveRole())
|
||||
{
|
||||
this.DialogResult = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
146
SamplePreSystem.UI/Views/ConfigManager/chirld/NewUserWindow.xaml
Normal file
@@ -0,0 +1,146 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.ConfigManager.chirld.NewUserWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="用户编辑"
|
||||
Width="400"
|
||||
Height="300"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="用户名称:" />
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding ConfigUser.username}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="密码:" />
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding ConfigUser.password}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
VerticalAlignment="Center"
|
||||
Text="角色:" />
|
||||
|
||||
<!-- 多选下拉框,选择后在上方显示选中内容 -->
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Orientation="Vertical">
|
||||
<!-- 显示已选中的内容 -->
|
||||
<TextBox
|
||||
x:Name="txtSelectedRoles"
|
||||
Width="250"
|
||||
Height="30"
|
||||
materialDesign:HintAssist.Hint="已选角色"
|
||||
FontSize="13"
|
||||
IsReadOnly="True" />
|
||||
|
||||
<!-- 多选下拉框 -->
|
||||
<ComboBox
|
||||
x:Name="cmbRole"
|
||||
Width="250"
|
||||
Height="30"
|
||||
Margin="0,-30,0,0"
|
||||
ItemsSource="{Binding Roles}">
|
||||
<!-- 覆盖上去,视觉一体 -->
|
||||
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckbRole"
|
||||
Margin="4,2"
|
||||
Click="ckbRole_Click"
|
||||
Content="{Binding name}"
|
||||
IsChecked="{Binding IsSelected, Mode=TwoWay}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
VerticalAlignment="Center"
|
||||
Text="是否启用:" />
|
||||
<ComboBox
|
||||
x:Name="cmbParamType"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding IsEnable}">
|
||||
<ComboBoxItem Content="启用" />
|
||||
<ComboBoxItem Content="禁用" />
|
||||
</ComboBox>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOK"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Command="{Binding BtnSaveUserClickCommand}"
|
||||
Content="确定" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnCancel_Click"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,56 @@
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.ConfigManager;
|
||||
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 SamplePre.UIWpf.ConfigManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// NewUserWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class NewUserWindow : BaseWindow
|
||||
{
|
||||
public NewUserWindow(UsersViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
vm.CloseAction = (val) => DialogResult = val;
|
||||
|
||||
this.DataContext = vm;
|
||||
}
|
||||
|
||||
private void ckbRole_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
UpdateSelectedText();
|
||||
}
|
||||
|
||||
// 把选中的项显示在文本框中
|
||||
private void UpdateSelectedText()
|
||||
{
|
||||
var selected = cmbRole.ItemsSource.Cast<dynamic>()
|
||||
.Where(x => x.IsSelected == true)
|
||||
.Select(x => x.name);
|
||||
|
||||
txtSelectedRoles.Text = string.Join(",", selected);
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdateSelectedText();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.ConfigManager.chirld.PermissionWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="分配权限"
|
||||
Width="600"
|
||||
Height="650"
|
||||
Background="#F6F6F6"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
Margin="5"
|
||||
Background="White"
|
||||
BorderBrush="LightGray"
|
||||
CornerRadius="4">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
||||
<TextBlock
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="角色:" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding RoleName}" />
|
||||
<Button
|
||||
x:Name="btnSave"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="20,0"
|
||||
Click="btnSave_Click"
|
||||
Content="保存权限" />
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
|
||||
<!-- 用户列表 -->
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="5,0,5,5"
|
||||
Background="White"
|
||||
BorderBrush="LightGray"
|
||||
CornerRadius="4">
|
||||
|
||||
<TreeView
|
||||
x:Name="tvData"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
ItemsSource="{Binding FunList}">
|
||||
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
||||
|
||||
<!-- 复选框 + 文字 -->
|
||||
<CheckBox Content="{Binding Name}" IsChecked="{Binding IsChecked}" />
|
||||
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
|
||||
</Border>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,61 @@
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.ConfigManager;
|
||||
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 SamplePre.UIWpf.ConfigManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// PermissionWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PermissionWindow : BaseWindow
|
||||
{
|
||||
public PermissionWindow(RoleViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = new PermissionViewModel(vm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 递归设置子节点
|
||||
private void SetChildrenChecked(TreeItemModel item, bool isChecked)
|
||||
{
|
||||
foreach (var child in item.Children)
|
||||
{
|
||||
child.IsChecked = isChecked;
|
||||
SetChildrenChecked(child, isChecked);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存权限
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnSave_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = this.DataContext as PermissionViewModel;
|
||||
if(vm.SavePermission())
|
||||
{
|
||||
this.DialogResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
78
SamplePreSystem.UI/Views/MainView/UserInfoWindow.xaml
Normal file
@@ -0,0 +1,78 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePreSystem.UI.Views.UserInfoWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="用户信息"
|
||||
Width="300"
|
||||
Height="200"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowStyle="None"
|
||||
mc:Ignorable="d">
|
||||
<basewindows:BaseWindow.Resources>
|
||||
<Style
|
||||
x:Key="CloseButtonStyle"
|
||||
BasedOn="{StaticResource MaterialDesignFlatMidBgButton}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Width" Value="24" />
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="DarkRed" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</basewindows:BaseWindow.Resources>
|
||||
<Grid>
|
||||
<Border
|
||||
Margin="10"
|
||||
Background="White"
|
||||
CornerRadius="12">
|
||||
<!--<Border.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="20"
|
||||
Opacity="0.2"
|
||||
ShadowDepth="0" />
|
||||
</Border.Effect>-->
|
||||
<Grid>
|
||||
<!-- 内容区域 -->
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center">
|
||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Width="80"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Text="用户名称:" />
|
||||
<TextBlock
|
||||
x:Name="txtUserName"
|
||||
FontSize="14"
|
||||
Text="{Binding UserName}" />
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Width="80"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
Text="角色:" />
|
||||
<TextBlock
|
||||
x:Name="txtUserRoles"
|
||||
FontSize="14"
|
||||
Text="{Binding UserRoles}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</basewindows:BaseWindow>
|
||||
39
SamplePreSystem.UI/Views/MainView/UserInfoWindow.xaml.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Models.Const;
|
||||
using SamplePre.Models.Tables;
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.ViewModel.Login;
|
||||
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 SamplePreSystem.UI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// UserInfoWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class UserInfoWindow : BaseWindow
|
||||
{
|
||||
|
||||
|
||||
public UserInfoWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = new UserInfoViewModel();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
489
SamplePreSystem.UI/Views/MonitorManager/MonitorView.xaml
Normal file
@@ -0,0 +1,489 @@
|
||||
<UserControl
|
||||
x:Class="SamplePre.UIWpf.SampleManager.MonitorView"
|
||||
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:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:SamplePre.UIWpf.SampleManager"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pro="clr-namespace:SamplePreSystem.UI.BaseControls"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#E6E6E6"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="220" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="2*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
|
||||
<Border
|
||||
Margin="5,5,0,0"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Height="30"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
Padding="6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="样品列表" />
|
||||
</StackPanel>
|
||||
<DataGrid
|
||||
x:Name="dg_sample"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding SampleExecList}"
|
||||
SelectedItem="{Binding SelectSample}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseDoubleClick">
|
||||
<i:InvokeCommandAction Command="{Binding MouseDoubleDetailWindowCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding qrcode}"
|
||||
Header="二维码" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding item_name}"
|
||||
Header="样品名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding standrad}"
|
||||
Header="标准名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding input_user}"
|
||||
Header="录入人员" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding input_date}"
|
||||
Header="录入日期" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding exec_state}"
|
||||
Header="状态" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- sop监控内容 -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 进度图 -->
|
||||
<Border
|
||||
Margin="5"
|
||||
Background="White"
|
||||
CornerRadius="5">
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Margin="5,5,0,10"
|
||||
HorizontalAlignment="Left"
|
||||
FontWeight="Bold"
|
||||
Text="样品进度" />
|
||||
<Grid Grid.Row="1">
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
<TextBlock Margin="5" Text="当前SOP:DCM固相萃取" />
|
||||
<TextBlock Margin="5" Text="当前样品:xxx" />
|
||||
<TextBlock Margin="5" Text="当前步骤:离心" />
|
||||
<TextBlock />
|
||||
</StackPanel>
|
||||
<pro:RingProgressBar
|
||||
x:Name="ringProgress"
|
||||
Width="200"
|
||||
Height="200"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Progress="{Binding CurrentPercent}" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Foreground="Black"
|
||||
Text="{Binding Progress, ElementName=ringProgress, StringFormat={}{0}%}" />
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- SOP执行列表 -->
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
Margin="0,5,0,5"
|
||||
Background="White"
|
||||
CornerRadius="5">
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
Margin="5"
|
||||
FontWeight="Bold"
|
||||
Text="SOP执行信息" />
|
||||
<DataGrid
|
||||
x:Name="dg_sopExec"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding SopExecInfo}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="0.5*" Header="">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button
|
||||
Width="13"
|
||||
Height="13"
|
||||
Margin="0"
|
||||
HorizontalContentAlignment="Left"
|
||||
materialDesign:ButtonProgressAssist.IndicatorBackground="#ffcc80"
|
||||
materialDesign:ButtonProgressAssist.IndicatorForeground="#e65100"
|
||||
materialDesign:ButtonProgressAssist.IsIndeterminate="True"
|
||||
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding doIngShow}"
|
||||
materialDesign:ButtonProgressAssist.Value="-1"
|
||||
Style="{StaticResource MaterialDesignFloatingActionButton}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="0.5*"
|
||||
Binding="{Binding state}"
|
||||
Header="状态" />
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding sapmleName}"
|
||||
Header="样品名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding actionName}"
|
||||
Header="动作" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding starDate}"
|
||||
Header="开始时间" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding endDate}"
|
||||
Header="完成时间" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!--<StackPanel>
|
||||
<TextBlock Text="SOP执行信息" Margin="5" FontWeight="Bold"/>
|
||||
<ListBox ItemsSource="{Binding SopExecInfo}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
||||
<Button
|
||||
Width="13"
|
||||
Height="13"
|
||||
Margin="5"
|
||||
HorizontalContentAlignment="Left"
|
||||
materialDesign:ButtonProgressAssist.IsIndeterminate="True"
|
||||
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding doIngShow}"
|
||||
materialDesign:ButtonProgressAssist.Value="-1"
|
||||
Style="{StaticResource MaterialDesignFloatingActionButton}" />
|
||||
|
||||
<TextBlock
|
||||
Margin="2,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding state}" />
|
||||
|
||||
<TextBlock
|
||||
Margin="30,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding sapmleName}" />
|
||||
<TextBlock
|
||||
Margin="30,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding actionName}" />
|
||||
|
||||
<TextBlock
|
||||
Margin="30,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding starDate}" />
|
||||
<TextBlock
|
||||
Margin="30,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding endDate}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>-->
|
||||
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<GridSplitter
|
||||
Grid.Column="1"
|
||||
Width="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="#e6e6e6" />
|
||||
|
||||
<!-- 功能单元 -->
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="31*" />
|
||||
<RowDefinition Height="44*" />
|
||||
<RowDefinition Height="15*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 功能岛信息 -->
|
||||
<Border
|
||||
Grid.RowSpan="2"
|
||||
Margin="0,5,5,5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Height="30"
|
||||
Margin="0,0"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
Padding="6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="功能单元" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding WorkUnits}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid Margin="10,5" Columns="1" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!-- 给 Border 单独写 Style,实现默认背景 + 鼠标悬停背景 -->
|
||||
<Border
|
||||
Margin="0,10"
|
||||
BorderBrush="LightGray"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<!-- 默认背景色 -->
|
||||
<Setter Property="Background" Value="White" />
|
||||
<!-- 鼠标悬停触发器 -->
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#FFF0F8FF" />
|
||||
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding unitName}" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Right">
|
||||
<Hyperlink
|
||||
x:Name="hLinkDetail"
|
||||
Command="{Binding DataContext.HLinkDetailClickCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding unitName}">
|
||||
[详情]
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<!--<Image Grid.Row="1" Grid.Column="0"
|
||||
Source="{Binding imgPath}" Height="48" Width="48" Margin="5"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>-->
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Width="50"
|
||||
Height="50"
|
||||
Margin="5"
|
||||
BorderBrush="#0071b8"
|
||||
BorderThickness="2"
|
||||
CornerRadius="50">
|
||||
<materialDesign:PackIcon
|
||||
Width="40"
|
||||
Height="40"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="#0071b8"
|
||||
Kind="{Binding packIconKind}" />
|
||||
</Border>
|
||||
|
||||
|
||||
|
||||
<UniformGrid
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Columns="1"
|
||||
Rows="2">
|
||||
|
||||
<StackPanel
|
||||
Margin="0,2"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Margin="2" Text="动作:" />
|
||||
<TextBlock Margin="2" Text="{Binding actionName}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Margin="0,2"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
Width="6"
|
||||
Height="6"
|
||||
Margin="2"
|
||||
Background="{Binding RunColor}"
|
||||
CornerRadius="3" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding StateName}" />
|
||||
</StackPanel>
|
||||
</UniformGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
<!-- 故障信息 -->
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Margin="0,0,5,5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Height="30"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
Padding="6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="故障信息" />
|
||||
</StackPanel>
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding FaultInfos}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
||||
<Border
|
||||
Width="6"
|
||||
Height="6"
|
||||
Margin="2"
|
||||
Background="Red"
|
||||
CornerRadius="3" />
|
||||
<TextBlock
|
||||
Margin="3,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding FaultName}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
36
SamplePreSystem.UI/Views/MonitorManager/MonitorView.xaml.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Models.Const;
|
||||
using SamplePre.UIWpf.MonitorManager.chirld;
|
||||
using SamplePre.UIWpf.SampleManager.chirld;
|
||||
using SamplePreSystem.UI.ViewModel.Monitor;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SamplePre.UIWpf.SampleManager
|
||||
{
|
||||
/// <summary>
|
||||
/// MonitorView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MonitorView : UserControl
|
||||
{
|
||||
public MonitorView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = new MonitorViewModel();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
25
SamplePreSystem.UI/Views/MonitorManager/SopExecInfo.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace SamplePreSystem.UI.Views.MonitorManager
|
||||
{
|
||||
public class SopExecInfo
|
||||
{
|
||||
public string sapmleName { get; set; }
|
||||
|
||||
public string actionName { get; set; }
|
||||
|
||||
public string state { get; set; }
|
||||
|
||||
public DateTime starDate { get; set; }
|
||||
public DateTime endDate { get; set; }
|
||||
|
||||
public bool doIngShow { get; set; } = false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.MonitorManager.chirld.SampleDetailWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pro="clr-namespace:SamplePreSystem.UI.BaseControls"
|
||||
Title="样品详情"
|
||||
Width="200"
|
||||
Height="300"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Margin="10">
|
||||
<TextBlock Margin="5" Text="执行标准:固相萃取" />
|
||||
<TextBlock Margin="5" Text="当前动作:离心" />
|
||||
<TextBlock Margin="5" Text="执行时间:30min" />
|
||||
<TextBlock Margin="5" Text="执行进度:40%" />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- // 自定义控件 - 预览主体部分 注意地址不一定是local 要看RingProgressBar类放在哪里 // -->
|
||||
<pro:RingProgressBar
|
||||
x:Name="ringProgress"
|
||||
Width="100"
|
||||
Height="100"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Progress="40" />
|
||||
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Foreground="Black"
|
||||
Text="{Binding Progress, ElementName=ringProgress, StringFormat={}{0}%}" />
|
||||
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,29 @@
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
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 SamplePre.UIWpf.MonitorManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// SampleDetailWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SampleDetailWindow : BaseWindow
|
||||
{
|
||||
public SampleDetailWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.SampleManager.chirld.UnitDetailWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="详情"
|
||||
Width="400"
|
||||
Height="350"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListBox Grid.Row="0" ItemsSource="{Binding FaultInfos}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border
|
||||
Width="6"
|
||||
Height="6"
|
||||
Margin="2"
|
||||
Background="{Binding RunColor}"
|
||||
CornerRadius="3" />
|
||||
<TextBlock
|
||||
Margin="3,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding FaultName}" />
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding FaultDesc}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<TextBlock Text="当前参数信息:" />
|
||||
<TextBlock Text="-" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,33 @@
|
||||
//using SamplePre.UIWpf.ViewModel.Monitor;
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.Monitor;
|
||||
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 SamplePre.UIWpf.SampleManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// UnitDetailWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class UnitDetailWindow : BaseWindow
|
||||
{
|
||||
public UnitDetailWindow(string unitId)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = new UnitDetailViewModel(unitId);
|
||||
}
|
||||
}
|
||||
}
|
||||
148
SamplePreSystem.UI/Views/QueryManager/SampleQueryView.xaml
Normal file
@@ -0,0 +1,148 @@
|
||||
<UserControl
|
||||
x:Class="SamplePre.UIWpf.QueryManager.SampleQueryView"
|
||||
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:SamplePre.UIWpf.QueryManager"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="White"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Margin="10,0" Orientation="Horizontal">
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Text="时间:" />
|
||||
<DatePicker
|
||||
Width="140"
|
||||
Height="40"
|
||||
Margin="10,0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
SelectedDate="{Binding StartDate}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="—" />
|
||||
<DatePicker
|
||||
Width="140"
|
||||
Height="40"
|
||||
Margin="10,0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
SelectedDate="{Binding EndDate}" />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="20,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnFindSample"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="3"
|
||||
Command="{Binding GetDataCommand}"
|
||||
Content="查 询" />
|
||||
<Button
|
||||
x:Name="btnExport"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="3"
|
||||
Command="{Binding ExportExcelCommand}"
|
||||
Content="导 出" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
BorderBrush="LightGray"
|
||||
BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
Background="#E6E6E6">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
Padding="6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Text="样品列表" />
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid
|
||||
x:Name="dg_sample"
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding SampleList}"
|
||||
SelectedItem="{Binding SelectSample}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding qrcode}"
|
||||
Header="二维码" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding item_name}"
|
||||
Header="样品名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding standrad_id}"
|
||||
Header="标准ID" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding standrad}"
|
||||
Header="标准名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding input_user}"
|
||||
Header="录入人员" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding input_date}"
|
||||
Header="录入日期" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding bach_no}"
|
||||
Header="批号" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,34 @@
|
||||
using SamplePreSystem.UI.ViewModel.QueryManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SamplePre.UIWpf.QueryManager
|
||||
{
|
||||
/// <summary>
|
||||
/// SampleQueryView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SampleQueryView : UserControl
|
||||
{
|
||||
public SampleQueryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = new SampleQueryViewModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
230
SamplePreSystem.UI/Views/SOPManager/ActionManagerView.xaml
Normal file
@@ -0,0 +1,230 @@
|
||||
<UserControl
|
||||
x:Class="SamplePre.UIWpf.ParamManager.ActionManagerView"
|
||||
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:SamplePre.UIWpf.ParamManager"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#E6E6E6"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="2*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<!-- 动作列表 -->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel
|
||||
Grid.ColumnSpan="2"
|
||||
Height="30"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
Padding="6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="动作列表" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnAddAction"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="3"
|
||||
Command="{Binding BtnAddActionClickCommand}"
|
||||
Content="新增"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="PackageVariantClosedPlus" />
|
||||
|
||||
<Button
|
||||
x:Name="btnDelAction"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="3"
|
||||
Command="{Binding BtnDelActionClickCommand}"
|
||||
Content="删除"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="DeleteOutline" />
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<DataGrid
|
||||
x:Name="dg_actions"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding SysActions}"
|
||||
SelectedItem="{Binding SelectItem}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
<!-- 分组样式 -->
|
||||
<DataGrid.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<DockPanel Height="25" LastChildFill="True">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding Name}" />
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</DataGrid.GroupStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding action_name}"
|
||||
Header="动作名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding plc_type}"
|
||||
Header="PLC映射" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding action_adress}"
|
||||
Header="设备地址" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding action_unitname}"
|
||||
Header="动作单元" />
|
||||
<DataGridTextColumn
|
||||
Width="2*"
|
||||
Binding="{Binding remark}"
|
||||
Header="备注" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
<!-- 参数列表 -->
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="5,0,5,5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="动作参数:" />
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnSelectParam"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding BtnSelectParamClickCommand}"
|
||||
Content="新增"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="PackageVariantClosedPlus" />
|
||||
<Button
|
||||
x:Name="btnDelParm"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding BtnDelParmClickCommand}"
|
||||
Content="删除"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="DeleteOutline" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
<DataGrid
|
||||
x:Name="dg_params"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="False"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ActionParams}"
|
||||
SelectedItem="{Binding SelectParam}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding title}"
|
||||
Header="参数名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding data_value}"
|
||||
Header="值" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding unit}"
|
||||
Header="单位" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding plc_type}"
|
||||
Header="PLC映射" />
|
||||
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,43 @@
|
||||
using Models.Models;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using SamplePreSystem.UI.ViewModel.SopManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace SamplePre.UIWpf.ParamManager
|
||||
{
|
||||
/// <summary>
|
||||
/// ParamManagerView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ActionManagerView : UserControl
|
||||
{
|
||||
ActionManagerViewModel actionManagerViewModel = new ActionManagerViewModel();
|
||||
|
||||
|
||||
public ActionManagerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = actionManagerViewModel;
|
||||
|
||||
ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(actionManagerViewModel.SysActions);//获取数据视图
|
||||
|
||||
////分组
|
||||
view.GroupDescriptions.Clear();
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("action_unitname"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
141
SamplePreSystem.UI/Views/SOPManager/ParamManagerView.xaml
Normal file
@@ -0,0 +1,141 @@
|
||||
<UserControl
|
||||
x:Class="SamplePre.UIWpf.ParamManager.ParamManagerView"
|
||||
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:SamplePre.UIWpf.ParamManager"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#e6e6e6"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Border
|
||||
Margin="5"
|
||||
Background="White"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Width="100"
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="参数列表" />
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
|
||||
|
||||
<TextBlock
|
||||
Margin="15,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="参数类型:" />
|
||||
<ComboBox
|
||||
x:Name="cmbDataType"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="0,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
ItemsSource="{Binding DataTypes}"
|
||||
SelectedItem="{Binding FilterType}" />
|
||||
<Button
|
||||
x:Name="btnAddParam"
|
||||
Width="90"
|
||||
Height="30"
|
||||
Margin="3"
|
||||
Command="{Binding BtnAddParamClickCommand}"
|
||||
Content="新增"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="PackageVariantClosedPlus" />
|
||||
<Button
|
||||
x:Name="btnEdit"
|
||||
Width="90"
|
||||
Height="30"
|
||||
Margin="3"
|
||||
Command="{Binding BtnEditClickCommand}"
|
||||
Content="编辑"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="ContentSaveEditOutline" />
|
||||
<Button
|
||||
x:Name="btnDelParam"
|
||||
Width="80"
|
||||
Height="30"
|
||||
Margin="3"
|
||||
Command="{Binding BtnDelParamClickCommand}"
|
||||
Content="删除"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="DeleteForeverOutline" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- 参数列表 -->
|
||||
<DataGrid
|
||||
x:Name="dg_params"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="False"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding SysParams}"
|
||||
SelectedItem="{Binding SelectItem}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding title}"
|
||||
Header="参数名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding unit}"
|
||||
Header="单位" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding data_type}"
|
||||
Header="数据类型" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding data_value}"
|
||||
Header="值" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding plc_type}"
|
||||
Header="PLC映射" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding param_type}"
|
||||
Header="参数类型" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</UserControl>
|
||||
37
SamplePreSystem.UI/Views/SOPManager/ParamManagerView.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Models.Models;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using SamplePreSystem.UI.ViewModel.SopManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace SamplePre.UIWpf.ParamManager
|
||||
{
|
||||
/// <summary>
|
||||
/// ParamManagerView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ParamManagerView : UserControl
|
||||
{
|
||||
ParamManagerViewModel paramManagerViewModel = new ParamManagerViewModel();
|
||||
public ParamManagerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = paramManagerViewModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
385
SamplePreSystem.UI/Views/SOPManager/SopManagerView.xaml
Normal file
@@ -0,0 +1,385 @@
|
||||
<UserControl
|
||||
x:Class="SamplePre.UIWpf.SopManagerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:bh="clr-namespace:SamplePreSystem.UI.Behaviors"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:SamplePre.UIWpf"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#E6E6E6"
|
||||
mc:Ignorable="d">
|
||||
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="0.7*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 标准列表 -->
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Margin="5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="35" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Height="30"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
Padding="6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="标准列表" />
|
||||
</StackPanel>
|
||||
|
||||
<TreeView
|
||||
x:Name="standardList"
|
||||
Grid.Row="1"
|
||||
FontSize="13"
|
||||
ItemsSource="{Binding StandardGroups}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectedItemChanged">
|
||||
<i:InvokeCommandAction Command="{Binding StandSelectedItemChangedCommand}" CommandParameter="{Binding Path=SelectedItem, RelativeSource={RelativeSource AncestorType=TreeView}}" />
|
||||
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource MaterialDesignTreeViewItem}" TargetType="TreeViewItem">
|
||||
<Setter Property="IsExpanded" Value="True" />
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
|
||||
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding ListItems}">
|
||||
|
||||
<!-- 一级节点的显示内容 -->
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="5,0" Kind="Book" />
|
||||
<TextBlock Text="{Binding SopName}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 二级节点(子项)的模板 -->
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="5,0" Kind="TextBoxOutline" />
|
||||
<TextBlock Margin="10,0,0,0" Text="{Binding DisplayText}" />
|
||||
</StackPanel>
|
||||
|
||||
</DataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 中间区域 -->
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="2*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- sop动作 -->
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Margin="0,5,5,5"
|
||||
Background="White"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="动作列表" />
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
|
||||
|
||||
<Button
|
||||
x:Name="btnUp"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="2,0"
|
||||
Click="btnUp_Click"
|
||||
Content="{materialDesign:PackIcon MenuUpOutline}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="上移" />
|
||||
<Button
|
||||
x:Name="btnDown"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="2,0"
|
||||
Click="btnDown_Click"
|
||||
Content="{materialDesign:PackIcon MenuDownOutline}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="下移" />
|
||||
<Button
|
||||
x:Name="btnDelAction"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="2,0"
|
||||
Click="btnDelAction_Click"
|
||||
Content="{materialDesign:PackIcon DeleteOutline}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="删除动作" />
|
||||
<Button
|
||||
x:Name="btnUpdateSeq"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="2,0"
|
||||
Click="btnUpdateSeq_Click"
|
||||
Content="{materialDesign:PackIcon ContentSave}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="更新顺序" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<DataGrid
|
||||
x:Name="dg_soplist"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AllowDrop="True"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="False"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding SopList}"
|
||||
SelectedItem="{Binding SelectItem}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
<i:Interaction.Behaviors>
|
||||
<bh:DataGridDragBehavior DropCompletedCommand="{Binding AddDragSopActionCommand}" />
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="auto"
|
||||
Binding="{Binding process_no}"
|
||||
Header="序号" />
|
||||
<DataGridTextColumn
|
||||
Width="auto"
|
||||
Binding="{Binding action_name}"
|
||||
Header="动作名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding all_param}"
|
||||
Header="动作参数" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding remark}"
|
||||
Header="说明" />
|
||||
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 参数 -->
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="0,0,5,5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Width="100"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="参数列表:" />
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnAddParam"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="1,0"
|
||||
Click="btnAddParam_Click"
|
||||
Content="{materialDesign:PackIcon Plus}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="新增参数" />
|
||||
<Button
|
||||
x:Name="btnEidtParam"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="1,0"
|
||||
Click="btnEidtParam_Click"
|
||||
Content="{materialDesign:PackIcon ContentSaveEditOutline}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="修改参数" />
|
||||
<Button
|
||||
x:Name="btnDelParam"
|
||||
Width="50"
|
||||
Height="25"
|
||||
Margin="1,0"
|
||||
Click="btnDelParam_Click"
|
||||
Content="{materialDesign:PackIcon DeleteOutline}"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
|
||||
ToolTip="删除参数" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding ActionParamList}"
|
||||
SelectedItem="{Binding SelectParamItem}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="2*"
|
||||
Binding="{Binding title}"
|
||||
Header="参数名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding data_value}"
|
||||
Header="参数值" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding unit}"
|
||||
Header="单位"
|
||||
IsReadOnly="True" />
|
||||
|
||||
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- //动作字典 -->
|
||||
<Border
|
||||
Grid.Column="2"
|
||||
Margin="0,5,5,5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="动作字典:" />
|
||||
|
||||
<TreeView
|
||||
Grid.Row="1"
|
||||
AllowDrop="False"
|
||||
ItemsSource="{Binding ActionGroups}">
|
||||
|
||||
<i:Interaction.Behaviors>
|
||||
<bh:TreeViewDragBehavior />
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource MaterialDesignTreeViewItem}" TargetType="TreeViewItem">
|
||||
<Setter Property="IsExpanded" Value="True" />
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
|
||||
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding ListItems}">
|
||||
<!-- 一级节点的显示内容 -->
|
||||
<!--<TextBlock Text="{Binding SopName}" />-->
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="5,0" Kind="Collage" />
|
||||
<TextBlock Text="{Binding SopName}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 二级节点(子项)的模板 -->
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Margin="5,0" Kind="TextBoxOutline" />
|
||||
<TextBlock Margin="10,0,0,0" Text="{Binding DisplayText}" />
|
||||
</StackPanel>
|
||||
|
||||
</DataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
|
||||
</UserControl>
|
||||
102
SamplePreSystem.UI/Views/SOPManager/SopManagerView.xaml.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using Models.Models;
|
||||
using SamplePre.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePreSystem.UI.ViewModel.SopManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SamplePre.UIWpf
|
||||
{
|
||||
/// <summary>
|
||||
/// SopManagerView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SopManagerView : UserControl
|
||||
{
|
||||
|
||||
SopMangerViewModel sopMangerViewModel = new SopMangerViewModel();
|
||||
public SopManagerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = sopMangerViewModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除动作
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnDelAction_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dataContext = this.DataContext as SopMangerViewModel;
|
||||
dataContext.RemoveAction();
|
||||
}
|
||||
|
||||
private void btnUp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dataContext = this.DataContext as SopMangerViewModel;
|
||||
dataContext.UpMove();
|
||||
}
|
||||
|
||||
private void btnDown_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dataContext = this.DataContext as SopMangerViewModel;
|
||||
dataContext.DownMove();
|
||||
}
|
||||
|
||||
private void btnUpdateSeq_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
sopMangerViewModel.UpdateSeqno();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnEidtParam_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dataContext = this.DataContext as SopMangerViewModel;
|
||||
dataContext.AddEidtParam();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnAddParam_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dataContext = this.DataContext as SopMangerViewModel;
|
||||
dataContext.AddParamShow();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除参数
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnDelParam_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dataContext = this.DataContext as SopMangerViewModel;
|
||||
dataContext.RemoveParam();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
112
SamplePreSystem.UI/Views/SOPManager/chirld/NewActionWindow.xaml
Normal file
@@ -0,0 +1,112 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.ParamManager.chirld.NewActionWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="新增动作"
|
||||
Width="400"
|
||||
Height="300"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<!--<RowDefinition/>
|
||||
<RowDefinition/>-->
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Text="名称:" />
|
||||
<TextBox
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysAction.action_name}" />
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
VerticalAlignment="Center"
|
||||
Text="备注:" />
|
||||
<TextBox
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysAction.remark}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
VerticalAlignment="Center"
|
||||
Text="动作单元:" />
|
||||
<ComboBox
|
||||
x:Name="cmbDataType"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
DisplayMemberPath="data_type"
|
||||
ItemsSource="{Binding ActionUnits}"
|
||||
SelectedItem="{Binding SelectSysDict}"
|
||||
SelectedValuePath="id" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="PLC映射:" />
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysAction.plc_type}" />
|
||||
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOK"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnOK_Click"
|
||||
Content="确定" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnCancel_Click"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,53 @@
|
||||
using Models.Models;
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.Child;
|
||||
using SamplePreSystem.UI.ViewModel.SopManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
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 SamplePre.UIWpf.ParamManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// NewStandParmWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class NewActionWindow : BaseWindow
|
||||
{
|
||||
ActionManagerViewModel actionManagerVM;
|
||||
public NewActionWindow(ActionManagerViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = new NewActionViewModel();
|
||||
|
||||
this.actionManagerVM = viewModel;
|
||||
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = this.DataContext as NewActionViewModel;
|
||||
|
||||
if (vm.SaveNewData() < 0) return;
|
||||
|
||||
this.DialogResult = true;
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.ParamManager.chirld.NewStandParmWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="参数编辑"
|
||||
Width="400"
|
||||
Height="350"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Text="名称:" />
|
||||
<TextBox
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysParm.title}" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="值:" />
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysParm.data_value}" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
VerticalAlignment="Center"
|
||||
Text="单位:" />
|
||||
<ComboBox
|
||||
x:Name="cmbUnit"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalContentAlignment="Center"
|
||||
DisplayMemberPath="data_type"
|
||||
ItemsSource="{Binding Units}"
|
||||
SelectedValuePath="id"
|
||||
Text="{Binding SysParm.unit}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
VerticalAlignment="Center"
|
||||
Text="数据类型:" />
|
||||
<ComboBox
|
||||
x:Name="cmbDataType"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysParm.data_type}">
|
||||
<ComboBoxItem Content="数值" />
|
||||
<ComboBoxItem Content="字符串" />
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
VerticalAlignment="Center"
|
||||
Text="PLC映射:" />
|
||||
<TextBox
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysParm.plc_type}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="5"
|
||||
VerticalAlignment="Center"
|
||||
Text="参数类型:" />
|
||||
<ComboBox
|
||||
x:Name="cmbParamType"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding SysParm.param_type}">
|
||||
<ComboBoxItem Content="通用" />
|
||||
<ComboBoxItem Content="耗材" />
|
||||
<ComboBoxItem Content="液体" />
|
||||
</ComboBox>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOK"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnOK_Click"
|
||||
Content="确定" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnCancel_Click"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,52 @@
|
||||
using Models.Models;
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.SopManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
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 SamplePre.UIWpf.ParamManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// NewStandParmWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class NewStandParmWindow : BaseWindow
|
||||
{
|
||||
ParamManagerViewModel viewModel;
|
||||
public NewStandParmWindow(ParamManagerViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = viewModel;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var v= this.DataContext as ParamManagerViewModel;
|
||||
|
||||
if (!v.SaveParam()) return;
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<basewindows:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.ParamManager.chirld.SelectParmListWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="选择参数"
|
||||
Width="600"
|
||||
Height="450"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="参数类型:" />
|
||||
<ComboBox
|
||||
x:Name="cmbDataType"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
ItemsSource="{Binding DataTypes}"
|
||||
SelectedItem="{Binding FilterType}" />
|
||||
</StackPanel>
|
||||
<DataGrid
|
||||
x:Name="dg_params"
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding Parms}"
|
||||
SelectedItem="{Binding SelectParm}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding title}"
|
||||
Header="标题" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding unit}"
|
||||
Header="PLC单位" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding data_type}"
|
||||
Header="数据类型" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding data_value}"
|
||||
Header="值" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding plc_type}"
|
||||
Header="PLC映射" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Margin="0,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOK"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Command="{Binding BtnOKClickCommand}"
|
||||
Content="确定" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Command="{Binding BtnCancelClickCommand}"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</basewindows:BaseWindow>
|
||||
@@ -0,0 +1,53 @@
|
||||
using Models.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.Child;
|
||||
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 SamplePre.UIWpf.ParamManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// SelectParmListWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SelectParmListWindow : BaseWindow
|
||||
{
|
||||
public SelectParmListWindow(sys_standard_action_ext sysStandardAction)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var vm = new SelectParmListViewModel(sysStandardAction);
|
||||
|
||||
//关闭窗口委托
|
||||
vm.CloseAction = (val) => DialogResult = val;
|
||||
|
||||
this.DataContext = vm;
|
||||
}
|
||||
|
||||
public SelectParmListWindow(sys_action_ext sysStandardAction)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var vm = new SelectParmListViewModel(sysStandardAction);
|
||||
|
||||
//关闭窗口委托
|
||||
vm.CloseAction = (val) => DialogResult = val;
|
||||
|
||||
this.DataContext = vm;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
250
SamplePreSystem.UI/Views/SampleManager/SampleExecView.xaml
Normal file
@@ -0,0 +1,250 @@
|
||||
<UserControl
|
||||
x:Class="SamplePre.UIWpf.ParamManager.SampleExecView"
|
||||
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:SamplePre.UIWpf.ParamManager"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#E6E6E6"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 样品列表 -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border
|
||||
Margin="5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
Padding="6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Text="样品列表" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
|
||||
|
||||
<Button
|
||||
x:Name="btnAddSample"
|
||||
Command="{Binding BtnAddSampleClickCommand}"
|
||||
Content="添加"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="PackageVariantClosedPlus" />
|
||||
|
||||
<Button
|
||||
x:Name="btnDelSample"
|
||||
Margin="3"
|
||||
Command="{Binding BtnDelSampleClickCommand}"
|
||||
Content="删除"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="StoreRemove" />
|
||||
<Button
|
||||
x:Name="btnImportSample"
|
||||
Margin="3"
|
||||
Command="{Binding BtnImportSampleClickCommand}"
|
||||
Content="导入"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="Import" />
|
||||
<Button
|
||||
x:Name="btnCreateCmd"
|
||||
Margin="3"
|
||||
Command="{Binding BtnCreateCmdClickCommand}"
|
||||
Content="生成指令"
|
||||
Style="{StaticResource IconTextButtonStyle}"
|
||||
Tag="Abacus" />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<DataGrid
|
||||
x:Name="dg_sample"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding TubeInputs}"
|
||||
SelectedItem="{Binding SelectSample}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<!-- 表头背景色 -->
|
||||
<Setter Property="Background" Value="#F5F5F5" />
|
||||
<!-- 表头文字颜色 -->
|
||||
<!--
|
||||
<Setter Property="Foreground" Value="#2C7DBD"/>-->
|
||||
<!-- 表头高度 -->
|
||||
<Setter Property="Height" Value="35" />
|
||||
<!-- 表头文字居中 -->
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding qrcode}"
|
||||
Header="二维码" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding item_name}"
|
||||
Header="样品名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding standrad_id}"
|
||||
Header="标准ID" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding standrad}"
|
||||
Header="标准名称" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding input_user}"
|
||||
Header="录入人员" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding input_date}"
|
||||
Header="录入日期" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding bach_no}"
|
||||
Header="批号" />
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
|
||||
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
Margin="0,5,5,5"
|
||||
Background="White"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Height="40"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Text="指令批次" />
|
||||
</StackPanel>
|
||||
<!-- 指令列表 -->
|
||||
<DataGrid
|
||||
x:Name="dg_cmds"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding CmdList}"
|
||||
SelectedItem="{Binding SelectItemCmd}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
<!-- 引入行为 -->
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseDoubleClick">
|
||||
<i:InvokeCommandAction Command="{Binding RowDoubleClickCommand}" PassEventArgsToCommand="True" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<!-- 表头背景色 -->
|
||||
<Setter Property="Background" Value="#F5F5F5" />
|
||||
<!-- 表头高度 -->
|
||||
<Setter Property="Height" Value="35" />
|
||||
<!-- 表头文字居中 -->
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding exec_state}"
|
||||
Header="状态" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding standradName}"
|
||||
Header="指令集" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding sample_count}"
|
||||
Header="数量" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,38 @@
|
||||
using Models.Models;
|
||||
using SamplePre.UIWpf.ParamManager.chirld;
|
||||
using SamplePre.UIWpf.SampleManager.chirld;
|
||||
using SamplePreSystem.UI.ViewModel.SampleManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace SamplePre.UIWpf.ParamManager
|
||||
{
|
||||
/// <summary>
|
||||
/// ParamManagerView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SampleExecView : UserControl
|
||||
{
|
||||
SampleExecViewModel viewModel = new SampleExecViewModel();
|
||||
public SampleExecView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<local:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.SampleManager.chirld.ActionShowWindow"
|
||||
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:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="命令下发"
|
||||
Width="400"
|
||||
Height="500"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="10,0"
|
||||
Command="{Binding CmdDoClickCommand}"
|
||||
Content="下发命令" />
|
||||
<Button
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="10,0"
|
||||
Command="{Binding InitPlcStateCommand}"
|
||||
Content="复位" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 指令列表 -->
|
||||
<DataGrid
|
||||
x:Name="dg_cmds"
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HeadersVisibility="None"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding ActionParmList}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<!-- 分组样式 -->
|
||||
<DataGrid.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<DockPanel
|
||||
Height="25"
|
||||
Background="#EEEEEE"
|
||||
LastChildFill="True">
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding Name}" />
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</DataGrid.GroupStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Header="动作" Binding="{Binding action_name}" Width="*"/>-->
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding title}"
|
||||
Header="参数名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding data_value}"
|
||||
Header="值"
|
||||
IsReadOnly="False" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding unit}"
|
||||
Header="单位"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</local:BaseWindow>
|
||||
@@ -0,0 +1,46 @@
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.SampleManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
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 SamplePre.UIWpf.SampleManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// ActionShowWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ActionShowWindow : BaseWindow
|
||||
{
|
||||
public ActionShowWindow(SampleExecViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = viewModel;
|
||||
|
||||
viewModel.InitCmdData();
|
||||
|
||||
|
||||
ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(viewModel.ActionParmList);//获取数据视图
|
||||
|
||||
////分组
|
||||
//view.SortDescriptions.Add(new SortDescription("action_seqno", ListSortDirection.Ascending));
|
||||
view.GroupDescriptions.Clear();
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("actionAndseqno"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<local:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.ParamManager.chirld.ImportSampleWindow"
|
||||
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:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="导入历史样品"
|
||||
Width="900"
|
||||
Height="650"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Margin="10,0" Orientation="Horizontal">
|
||||
<FrameworkElement x:Name="DataContextProxy" Visibility="Collapsed" />
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Text="时间:" />
|
||||
<DatePicker
|
||||
Width="140"
|
||||
Height="40"
|
||||
Margin="10,0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
SelectedDate="{Binding StartDate}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="—" />
|
||||
<DatePicker
|
||||
Width="140"
|
||||
Height="40"
|
||||
Margin="10,0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
SelectedDate="{Binding EndDate}" />
|
||||
|
||||
|
||||
<Button
|
||||
x:Name="btnFind"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="15,0,5,0"
|
||||
Command="{Binding FindClickCommand}"
|
||||
Content="查询" />
|
||||
<Button
|
||||
x:Name="btnImport"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="5,0"
|
||||
Command="{Binding ImportClickCommand}"
|
||||
Content="导入" />
|
||||
</StackPanel>
|
||||
<!-- 样品列表 -->
|
||||
<DataGrid
|
||||
x:Name="dg_samples"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="White"
|
||||
CanUserAddRows="False"
|
||||
CanUserSortColumns="True"
|
||||
FrozenColumnCount="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
ItemsSource="{Binding SampleList}"
|
||||
SelectionMode="Extended"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
|
||||
|
||||
<!-- 分组样式 -->
|
||||
<DataGrid.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<DockPanel Height="25" LastChildFill="True">
|
||||
<Border Background="Transparent">
|
||||
<CheckBox
|
||||
Command="{Binding DataContext.CheckBoxClickCommand, Source={x:Reference DataContextProxy}}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Content="{Binding Name}"
|
||||
FontWeight="Bold"
|
||||
IsChecked="{Binding DataContext.IsGroupSelected, Source={x:Reference DataContextProxy}}" />
|
||||
</Border>
|
||||
|
||||
<!--<TextBlock
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding Name}" />-->
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</DataGrid.GroupStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<!-- 列头复选框样式 -->
|
||||
<DataGridCheckBoxColumn Binding="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGridCheckBoxColumn.Header>
|
||||
<Border Background="Transparent">
|
||||
<CheckBox IsChecked="{Binding DataContext.IsAllItems1Selected, Source={x:Reference DataContextProxy}}" />
|
||||
</Border>
|
||||
</DataGridCheckBoxColumn.Header>
|
||||
<DataGridCheckBoxColumn.HeaderStyle>
|
||||
<Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="{x:Type DataGridColumnHeader}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGridCheckBoxColumn.HeaderStyle>
|
||||
</DataGridCheckBoxColumn>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding qrcode}"
|
||||
Header="二维码"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding item_name}"
|
||||
Header="样品名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding standrad}"
|
||||
Header="标准"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding input_date}"
|
||||
Header="录入日期"
|
||||
IsReadOnly="False" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding bach_no}"
|
||||
Header="批次"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</local:BaseWindow>
|
||||
@@ -0,0 +1,52 @@
|
||||
using Models.Models;
|
||||
using SamplePre.Models.Ext;
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.Child;
|
||||
using SamplePreSystem.UI.ViewModel.SampleManager;
|
||||
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 SamplePre.UIWpf.ParamManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// ImportSampleWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ImportSampleWindow : BaseWindow
|
||||
{
|
||||
|
||||
|
||||
|
||||
public ImportSampleWindow(SampleExecViewModel sampleExecViewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
ImportSampleViewModel vm = new ImportSampleViewModel(sampleExecViewModel);
|
||||
|
||||
//关闭窗口委托
|
||||
vm.CloseAction = (val) => DialogResult = val;
|
||||
|
||||
this.DataContext = vm;
|
||||
|
||||
ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(vm.SampleList);//获取数据视图
|
||||
|
||||
//分组
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("bach_no"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<local:BaseWindow
|
||||
x:Class="SamplePre.UIWpf.SampleManager.chirld.NewSampleWindow"
|
||||
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:SamplePre.UIWpf.BaseWindows"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="样品管理"
|
||||
Width="400"
|
||||
Height="350"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Text="样品类型:" />
|
||||
<ComboBox
|
||||
x:Name="cmbSampleType"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalContentAlignment="Center"
|
||||
DisplayMemberPath="data_type"
|
||||
ItemsSource="{Binding SampleTypeDict}"
|
||||
SelectedItem="{Binding SelectSampleType}"
|
||||
SelectedValuePath="id" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="检样名:" />
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding TubeInput.item_name}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
VerticalAlignment="Center"
|
||||
Text="执行标准:" />
|
||||
<!--<ComboBox x:Name="cmbStandard" Grid.Row="2" Grid.Column="1"
|
||||
ItemsSource="{Binding StandardList}"
|
||||
DisplayMemberPath="standard_name"
|
||||
SelectedValuePath="id"
|
||||
SelectedItem="{Binding SelectStandard}"
|
||||
Width="250" Height="30" HorizontalAlignment="Left" VerticalContentAlignment="Center"/>-->
|
||||
|
||||
|
||||
<!-- 多选下拉框,选择后在上方显示选中内容 -->
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Orientation="Vertical">
|
||||
<!-- 显示已选中的内容 -->
|
||||
<TextBox
|
||||
x:Name="txtSelectedStandards"
|
||||
Width="250"
|
||||
Height="30"
|
||||
materialDesign:HintAssist.Hint="已选执行标准"
|
||||
FontSize="13"
|
||||
IsReadOnly="True" />
|
||||
|
||||
<!-- 多选下拉框 -->
|
||||
<ComboBox
|
||||
x:Name="cmbDataType"
|
||||
Width="250"
|
||||
Height="30"
|
||||
Margin="0,-30,0,0"
|
||||
ItemsSource="{Binding StandardList}">
|
||||
<!-- 覆盖上去,视觉一体 -->
|
||||
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
Margin="4,2"
|
||||
Click="ckbStand_Click"
|
||||
Content="{Binding standard_name}"
|
||||
IsChecked="{Binding IsSelected, Mode=TwoWay}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!--<ComboBox x:Name="cmbDataType" ItemsSource="{Binding StandardList}"
|
||||
Grid.Row="2" Grid.Column="1"
|
||||
Width="250" Height="30"
|
||||
materialDesign:HintAssist.Hint="请选择执行标准" >
|
||||
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox x:Name="ckbStand" Click="ckbStand_Click" Content="{Binding standard_name}" IsChecked="{Binding IsSelected, Mode=TwoWay}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>-->
|
||||
|
||||
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
VerticalAlignment="Center"
|
||||
Text="样品编号:" />
|
||||
<TextBox
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding TubeInput.qrcode}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
VerticalAlignment="Center"
|
||||
Text="样品数量:" />
|
||||
<TextBox
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding TubeInput.tube_count}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="5"
|
||||
VerticalAlignment="Center"
|
||||
Text="录入人员:" />
|
||||
<ComboBox
|
||||
x:Name="cmbParamType"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Height="30"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{Binding TubeInput.input_user}">
|
||||
<ComboBoxItem Content="人员1" />
|
||||
<ComboBoxItem Content="人员2" />
|
||||
<ComboBoxItem Content="人员3" />
|
||||
</ComboBox>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOK"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Command="{Binding BtnOKClickCommand}"
|
||||
Content="确定" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="80"
|
||||
Margin="5"
|
||||
Click="btnCancel_Click"
|
||||
Content="取消" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</local:BaseWindow>
|
||||
@@ -0,0 +1,64 @@
|
||||
using SamplePre.UIWpf.BaseWindows;
|
||||
using SamplePreSystem.UI.BaseControls;
|
||||
using SamplePreSystem.UI.ViewModel.SampleManager;
|
||||
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.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace SamplePre.UIWpf.SampleManager.chirld
|
||||
{
|
||||
/// <summary>
|
||||
/// NewSampleWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class NewSampleWindow : BaseWindow
|
||||
{
|
||||
|
||||
public NewSampleWindow(SampleExecViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
viewModel.CloseAction = (val) => this.DialogResult = val;
|
||||
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
||||
private void ckbStand_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
UpdateSelectedText();
|
||||
}
|
||||
|
||||
// 把选中的项显示在文本框中
|
||||
private void UpdateSelectedText()
|
||||
{
|
||||
var selected = cmbDataType.ItemsSource.Cast<dynamic>()
|
||||
.Where(x => x.IsSelected == true)
|
||||
.Select(x => x.standard_name);
|
||||
|
||||
txtSelectedStandards.Text = string.Join(",", selected);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||