Compare commits

..
80 Commits
Author SHA1 Message Date
sc eb2828aab0 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:26:01 +08:00
sc 33b970eff9 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:26:00 +08:00
sc 5caf92be59 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:24:46 +08:00
sc 437b8957ce Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:24:44 +08:00
sc a68fb9ae01 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-27 22:10:41 +08:00
sc 68b98ac7e4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-27 22:10:39 +08:00
sc 2329ac9abc Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-26 01:35:33 +08:00
sc b062420be1 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-26 01:35:30 +08:00
sc a248c41163 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-25 20:18:34 +08:00
sc 2b676adbba 修正错误 2025-10-25 20:18:31 +08:00
sc 00a5cd3ec7 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 22:14:27 +08:00
sc abfcf6e36a Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 22:14:26 +08:00
sc 1df7212414 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 20:49:37 +08:00
sc 751a2b092f Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 20:49:34 +08:00
sc 8a5e0ecfd9 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 00:09:05 +08:00
sc ebcd5b7182 串口通讯部分修改 2025-10-15 00:09:03 +08:00
sc 7f905617fa Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-10 02:02:24 +08:00
sc 54d8cc7266 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-10 02:02:21 +08:00
sc 33e83fa5d6 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-10 00:56:15 +08:00
sc 927c38853d 添加485串口线路指令 2025-10-10 00:56:14 +08:00
sc 552d45485d Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 23:35:40 +08:00
sc 17a5d6b718 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 23:35:38 +08:00
sc 34d3e6c292 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 23:19:40 +08:00
sc 5b60ea4765 添加数据库 2025-10-08 23:19:39 +08:00
sc b2817d1b01 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 23:18:50 +08:00
sc 7403914ba5 串口功能逻辑,810,811,812指令修改 2025-10-08 23:18:48 +08:00
sc 878d49c4a0 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 00:04:22 +08:00
sc e457b0ab21 添加去重逻辑 2025-10-08 00:04:20 +08:00
sc b0ce5bc8f9 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-07 19:52:43 +08:00
sc d3375fd6ac 处理lock (Machines.Rows.SyncRoot)并发写datatable问题 2025-10-07 19:52:42 +08:00
sc 7671f0ef08 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-07 00:24:31 +08:00
sc 25e6ae1563 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-07 00:24:29 +08:00
sc e020333b82 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-07 00:03:53 +08:00
sc 8914ea3660 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-07 00:03:51 +08:00
sc c1da97611d Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-06 22:06:10 +08:00
sc daaa2b5514 添加资源,修改机台设置页面,添加任务开始页面,修改网络连接错误 2025-10-06 22:06:08 +08:00
sc 2c40ac5be0 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-06 00:52:17 +08:00
sc 21500886f0 修复引用添加822指令 2025-10-06 00:52:16 +08:00
sc c5e1978f6a Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-05 21:21:05 +08:00
sc 9a374a0a87 添加 2025-10-05 21:21:04 +08:00
sc f9949c5ec5 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-05 21:05:12 +08:00
sc 91212f03d2 添加资源 2025-10-05 21:05:08 +08:00
sc 31a84a640d Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-05 00:26:27 +08:00
sc 9bdf575674 添加资源 2025-10-05 00:26:26 +08:00
sc 8adea70012 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-03 22:50:28 +08:00
sc 3f9730507e Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-03 22:50:19 +08:00
sc 7fad98f58b Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-02 23:40:29 +08:00
sc 61dbaa3c33 设备连线逻辑修改 2025-10-02 23:40:21 +08:00
sc 5e063092cf Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-01 17:04:54 +08:00
sc 574f468a5e 工艺排程与工艺传输问题错误修正 2025-10-01 17:04:52 +08:00
sc e9f83ea182 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-09-30 21:23:53 +08:00
sc ab5dfa85e1 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 21:23:45 +08:00
sc 8512e720dd Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 20:06:39 +08:00
sc 81ab1623ba Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 20:06:33 +08:00
sc 6cbed8fa62 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 00:54:04 +08:00
sc 60baf3554a Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 00:53:59 +08:00
sc 1ef9b8517c Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 00:47:24 +08:00
sc d5042d92ff Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 00:47:20 +08:00
sc 4a1c5b7eac Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-29 01:05:07 +08:00
sc 896c2bdf9c 数据库 2025-09-29 01:05:03 +08:00
sc 99217977ec Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-29 01:02:35 +08:00
sc 8d0b37f0e2 日志显示,修改缓冲区 2025-09-29 01:02:28 +08:00
sc 898cde7329 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-28 00:58:29 +08:00
sc 4cf411dc10 信息修改,字体大小 2025-09-28 00:58:20 +08:00
sc 3c5e8cd129 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-27 23:36:44 +08:00
sc 818d0e5a3a 网络机台日志 2025-09-27 23:36:35 +08:00
sc e2b48ecc84 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-26 23:50:29 +08:00
sc 2c0f06a83a 修改按钮状态 2025-09-26 23:50:25 +08:00
sc a1b128757d Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-26 01:18:29 +08:00
sc 7c744f72f6 错误修正 2025-09-26 01:18:25 +08:00
sc 7177673a4c Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-25 17:03:25 +08:00
sc a0ac4e094c 程序页面选择异常问题 2025-09-25 17:03:22 +08:00
sc d85d458edb Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-25 00:17:34 +08:00
sc 4f9195c552 步骤编辑相关修改 2025-09-25 00:17:29 +08:00
sc ec6bab3b56 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-14 00:57:54 +08:00
sc 11b9b99d3e 曲线图记录修改 2025-09-14 00:57:51 +08:00
sc 13c64092a0 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-13 01:45:39 +08:00
sc 48eb8a0ad1 部分数据库及串口逻辑修改 2025-09-13 01:45:28 +08:00
sc 9c10e1c2cc Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-12 01:24:22 +08:00
sc baa921ea20 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-12 01:24:13 +08:00
48 changed files with 5368 additions and 980 deletions

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
[SYS]
Language=zh-CN
DyelotsDispenser=True
COMP1=COM7
COMP2=COM8
COMP3=COM9
COMP4=COM10
BAUD1 = 57600
BAUD2= 57600
BAUD3 =57600
BAUD4 =57600
[SQL_SERVER]
SQL1=www.scserverddns.top\EXPRESS ,21344
SQL2=BatchDyeingCentral
SQL3=SQL SERVER
SQL4=sa
SQL5=SC971216@server
[SN]
SN3=5BEE2D9CF3E1A8DD
SN2=BED2E58B6EBB4BD4
SN1=5BEE2D9CF3E1A8DD
[VOICE]
V1=-2
V2=100
+132
View File
@@ -0,0 +1,132 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.KEY.TouchKeyboard"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
mc:Ignorable="d" WindowStyle="None" ResizeMode="NoResize" Topmost="True"
WindowStartupLocation="CenterScreen"
Title="TouchKeyboard" Height="500" Width="750">
<Window.Resources>
<Style x:Key="KeyButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#FFF0F0F0"/>
<Setter Property="BorderBrush" Value="#FFCCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="MinWidth" Value="60"/>
<Setter Property="MinHeight" Value="40"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#FFDDDDDD"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SpecialKeyButtonStyle" BasedOn="{StaticResource KeyButtonStyle}" TargetType="Button">
<Setter Property="Background" Value="#FFE0E0E0"/>
<Setter Property="FontSize" Value="16"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 预览区域 -->
<TextBox x:Name="PreviewTextBox" Grid.Row="0" Height="60" Margin="10"
FontSize="24" VerticalContentAlignment="Center" IsReadOnly="False"/>
<!-- 键盘主体区域 -->
<Grid Grid.Row="1" Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 数字行 -->
<StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Center">
<Button Content="1" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="2" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="3" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="4" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="5" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="6" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="7" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="8" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="9" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="0" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="DEL" Style="{StaticResource SpecialKeyButtonStyle}" Click="Backspace_Click" Width="60"/>
</StackPanel>
<!-- 第一行字母 -->
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
<Button Content="Q" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="W" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="E" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="R" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="T" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="Y" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="U" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="I" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="O" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="P" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
</StackPanel>
<!-- 第二行字母 -->
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
<Button Content="A" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="S" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="D" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="F" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="G" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="H" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="J" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="K" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="L" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="/" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="HIDE" Style="{StaticResource SpecialKeyButtonStyle}" Click="Hide_Click" Width="60"/>
</StackPanel>
<!-- 第三行字母 -->
<StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Center">
<Button x:Name="ShiftButton" Content="⇧" Style="{StaticResource SpecialKeyButtonStyle}" Click="Shift_Click" Width="60"/>
<Button Content="Z" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="X" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="C" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="V" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="B" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="N" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="M" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="." Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="ENTER" Style="{StaticResource SpecialKeyButtonStyle}" Click="Enter_Click" Width="120"/>
</StackPanel>
</Grid>
<!-- 状态栏 -->
<StatusBar Grid.Row="2">
<StatusBarItem>
<TextBlock x:Name="StatusTextBlock" Text="就绪"/>
</StatusBarItem>
</StatusBar>
</Grid>
</Window>
+116
View File
@@ -0,0 +1,116 @@
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;
using static SunlightCentralizedControlManagement_SCCM_.KEY.TouchKeyboardNumeral;
namespace SunlightCentralizedControlManagement_SCCM_.KEY
{
/// <summary>
/// TouchKeyboard.xaml 的交互逻辑
/// </summary>
public partial class TouchKeyboard : Window
{
private bool isShiftActive = false;
public string KeyValue;
public event EventHandler<KeyPressedEventArgs> KeyPressed;
public TouchKeyboard()
{
InitializeComponent();
}
private void KeyButton_Click(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
if (button != null)
{
string key = button.Content.ToString();
if (key.Length == 1 && char.IsLetter(key[0]))
{
key = isShiftActive ? key.ToUpper() : key.ToLower();
}
PreviewTextBox.Text += key;
// 输入后关闭Shift状态
if (isShiftActive)
{
isShiftActive = false;
UpdateButtonAppearance();
}
}
}
private void Shift_Click(object sender, RoutedEventArgs e)
{
isShiftActive = !isShiftActive;
UpdateButtonAppearance();
}
private void Backspace_Click(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(PreviewTextBox.Text))
{
PreviewTextBox.Text = PreviewTextBox.Text.Substring(0, PreviewTextBox.Text.Length - 1);
}
}
private void Enter_Click(object sender, RoutedEventArgs e)
{
// 触发回车事件
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Enter, PreviewTextBox.Text));
this.Close();
// PreviewTextBox.Text += Environment.NewLine;
}
private void Hide_Click(object sender, RoutedEventArgs e)
{
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Hide, ""));
this.Close();
}
private void UpdateButtonAppearance()
{
// 更新Shift按钮的外观以反映当前状态
if (isShiftActive)
{
ShiftButton.Background = new SolidColorBrush(Colors.LightBlue);
}
else
{
ShiftButton.Background = new SolidColorBrush(Color.FromRgb(224, 224, 224));
}
}
public class KeyPressedEventArgs : EventArgs
{
public KeyType KeyType { get; }
public string KeyValue { get; }
public KeyPressedEventArgs(KeyType keyType, string keyValue)
{
KeyType = keyType;
KeyValue = keyValue;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// 初始化为默认模式
// SetKeyboardMode(KeyboardMode.Default);
PreviewTextBox.Text = null;
}
}
}
+100
View File
@@ -0,0 +1,100 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.KEY.TouchKeyboardNumeral"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
mc:Ignorable="d"
WindowStyle="None"
ResizeMode="NoResize"
Topmost="True"
WindowStartupLocation="CenterScreen"
Title="TouchKeyboardNumeral"
Loaded="Window_Loaded"
Height="500" Width="550">
<Window.Resources>
<Style x:Key="KeyButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#FFF0F0F0"/>
<Setter Property="BorderBrush" Value="#FFCCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="MinWidth" Value="100"/>
<Setter Property="MinHeight" Value="40"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#FFDDDDDD"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#FFBBBBBB"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SpecialKeyButtonStyle" BasedOn="{StaticResource KeyButtonStyle}" TargetType="Button">
<Setter Property="Background" Value="#FFE0E0E0"/>
<Setter Property="FontSize" Value="16"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 预览区域 -->
<TextBox x:Name="PreviewTextBox" Grid.Row="0" Height="60" Margin="10"
FontSize="24" VerticalContentAlignment="Center" IsReadOnly="False"/>
<!-- 键盘主体区域 -->
<Grid Grid.Row="1" Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 数字行 -->
<StackPanel x:Name="FirstRow" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Center">
<Button Content="7" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="8" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="9" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="0" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="DEL" Style="{StaticResource SpecialKeyButtonStyle}" Click="Backspace_Click" Width="60"/>
</StackPanel>
<!-- 数字行 -->
<StackPanel x:Name="SecondRow" Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
<Button Content="4" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="5" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="6" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="." Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="HIDE" Style="{StaticResource SpecialKeyButtonStyle}" Click="Hide_Click" Width="60"/>
</StackPanel>
<!-- 数字行 -->
<StackPanel x:Name="ThirdRow" Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
<Button Content="1" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="2" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="3" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="ENTER" Style="{StaticResource SpecialKeyButtonStyle}" Click="Enter_Click" Width="200"/>
</StackPanel>
</Grid>
</Grid>
</Window>
+215
View File
@@ -0,0 +1,215 @@
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 SunlightCentralizedControlManagement_SCCM_.KEY
{
/// <summary>
/// TouchKeyboard.xaml 的交互逻辑
/// </summary>
public partial class TouchKeyboardNumeral : Window
{
private bool mode = false;
public string KeyValue;
public event EventHandler<KeyPressedEventArgs> KeyPressed;
private KeyboardMode currentMode = KeyboardMode.Default;
private int minValue = 0;
private int maxValue = 9;
private TextBox targetTextBox;
// 定义键盘模式枚举
public enum KeyboardMode
{
Default, // 默认模式,所有键可用
NumericOnly, // 只允许数字
DecimalOnly, // 允许数字和小数点
LimitedRange // 限制数字范围
}
public TouchKeyboardNumeral()
{
InitializeComponent();
}
public void SetKeyboardMode(KeyboardMode mode, TextBox target = null, int min = 0, int max = 9)
{
currentMode = mode;
targetTextBox = target;
minValue = min;
maxValue = max;
UpdateKeyboardLayout();
}
private void UpdateKeyboardLayout()
{
switch (currentMode)
{
case KeyboardMode.NumericOnly:
// 只允许数字,禁用小数点
SetButtonEnabled(".", false);
break;
case KeyboardMode.DecimalOnly:
// 允许数字和小数点
SetButtonEnabled(".", true);
break;
case KeyboardMode.LimitedRange:
// 根据范围启用/禁用数字键
for (int i = 0; i <= 9; i++)
{
SetButtonEnabled(i.ToString(), i >= minValue && i <= maxValue);
}
mode = true;
break;
case KeyboardMode.Default:
default:
// 启用所有键
foreach (var element in FirstRow.Children)
{
if (element is Button button && char.IsDigit(button.Content.ToString()[0]))
button.IsEnabled = true;
}
foreach (var element in SecondRow.Children)
{
if (element is Button button && (char.IsDigit(button.Content.ToString()[0]) || button.Content.ToString() == "."))
button.IsEnabled = true;
}
foreach (var element in ThirdRow.Children)
{
if (element is Button button && char.IsDigit(button.Content.ToString()[0]))
button.IsEnabled = true;
}
break;
}
}
// 设置按钮启用状态
private void SetButtonEnabled(string content, bool enabled)
{
// 在第一行查找
foreach (var element in FirstRow.Children)
{
if (element is Button button && button.Content.ToString() == content)
{
button.IsEnabled = enabled;
return;
}
}
// 在第二行查找
foreach (var element in SecondRow.Children)
{
if (element is Button button && button.Content.ToString() == content)
{
button.IsEnabled = enabled;
return;
}
}
// 在第三行查找
foreach (var element in ThirdRow.Children)
{
if (element is Button button && button.Content.ToString() == content)
{
button.IsEnabled = enabled;
return;
}
}
}
// 数字键点击事件
private void KeyButton_Click(object sender, RoutedEventArgs e)
{
if (mode && PreviewTextBox.Text.Length > 0) return;
Button button = sender as Button;
if (button != null && button.IsEnabled)
{
string keyValue = button.Content.ToString();
PreviewTextBox.Text += keyValue;
// 触发按键事件
// KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Character, keyValue));
}
}
// 退格键点击事件
private void Backspace_Click(object sender, RoutedEventArgs e)
{
if (PreviewTextBox.Text.Length > 0)
{
PreviewTextBox.Text = PreviewTextBox.Text.Substring(0, PreviewTextBox.Text.Length - 1);
// 触发退格事件
// KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Backspace, ""));
}
}
// 回车键点击事件
private void Enter_Click(object sender, RoutedEventArgs e)
{
// 触发回车事件
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Enter, PreviewTextBox.Text));
// 隐藏键盘
this.Hide();
}
// 隐藏键点击事件
private void Hide_Click(object sender, RoutedEventArgs e)
{
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Hide, ""));
// 隐藏键盘
this.Hide();
}
public class KeyPressedEventArgs : EventArgs
{
public KeyType KeyType { get; }
public string KeyValue { get; }
public KeyPressedEventArgs(KeyType keyType, string keyValue)
{
KeyType = keyType;
KeyValue = keyValue;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// 初始化为默认模式
// SetKeyboardMode(KeyboardMode.Default);
PreviewTextBox.Text = null;
mode = false;
}
}
// 按键类型枚举
public enum KeyType
{
Character,
Backspace,
Enter,
Hide
}
// 按键事件参数
public class KeyPressedEventArgs : EventArgs
{
public KeyType KeyType { get; }
public string KeyValue { get; }
public KeyPressedEventArgs(KeyType keyType, string keyValue)
{
KeyType = keyType;
KeyValue = keyValue;
}
}
}
+5 -3
View File
@@ -1,4 +1,5 @@
using SunlightCentralizedControlManagement_SCCM_.ViewModel; using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System; using System;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
@@ -82,9 +83,10 @@ namespace SunlightCentralizedControlManagement_SCCM_
} }
} }
} }
catch (Exception) catch (Exception ex)
{ {
System.Windows.MessageBox.Show(Properties.Resources.NPERR, "SCCM", MessageBoxButton.OK, MessageBoxImage.Error); LogGing.ERRDATA(ex);
System.Windows.MessageBox.Show("Unable to start. Check the log for details.", "SCCM", MessageBoxButton.OK, MessageBoxImage.Error);
} }
} }
+18
View File
@@ -32,7 +32,9 @@ namespace SunlightCentralizedControlManagement_SCCM_
{ {
public static string user_; public static string user_;
public static DataTable InfData = new DataTable(); public static DataTable InfData = new DataTable();
// public static string[] Inf_string ;
public UserInformation userInformation; public UserInformation userInformation;
// public UserInf userInf;
public MainWindow() public MainWindow()
{ {
@@ -74,6 +76,22 @@ namespace SunlightCentralizedControlManagement_SCCM_
if (userInformation.WindowState == WindowState.Minimized) userInformation.WindowState = WindowState.Normal; if (userInformation.WindowState == WindowState.Minimized) userInformation.WindowState = WindowState.Normal;
} }
} }
/* private void UserInfTable(string dat)//触发行改变事件
{
userInf.Inf_DAT = dat;
if (userInf == null || !userInf.IsLoaded)//窗口不存在及创建
{
userInf = new UserInf();
userInf.Topmost = true;
userInf.Show();
userInf.Activate();
}
else
{//窗口纯在及置顶
userInf.Activate();
if (userInf.WindowState == WindowState.Minimized) userInf.WindowState = WindowState.Normal;
}
}*/
private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e) private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e)
{ {
+28 -1
View File
@@ -19,7 +19,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。 // (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources { public class Resources {
@@ -1284,6 +1284,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Machines 的本地化字符串。
/// </summary>
public static string Machines {
get {
return ResourceManager.GetString("Machines", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Malfunction 的本地化字符串。 /// 查找类似 Malfunction 的本地化字符串。
/// </summary> /// </summary>
@@ -2004,6 +2013,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 ProgramName 的本地化字符串。
/// </summary>
public static string ProgramName {
get {
return ResourceManager.GetString("ProgramName", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 ProportionalValves 的本地化字符串。 /// 查找类似 ProportionalValves 的本地化字符串。
/// </summary> /// </summary>
@@ -2400,6 +2418,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Start 的本地化字符串。
/// </summary>
public static string Start {
get {
return ResourceManager.GetString("Start", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 StartDate 的本地化字符串。 /// 查找类似 StartDate 的本地化字符串。
/// </summary> /// </summary>
+9
View File
@@ -1083,4 +1083,13 @@
<data name="Swing" xml:space="preserve"> <data name="Swing" xml:space="preserve">
<value>Swing</value> <value>Swing</value>
</data> </data>
<data name="Start" xml:space="preserve">
<value>Start</value>
</data>
<data name="ProgramName" xml:space="preserve">
<value>Program Name</value>
</data>
<data name="Machines" xml:space="preserve">
<value>Machines</value>
</data>
</root> </root>
+9
View File
@@ -1083,4 +1083,13 @@
<data name="Swing" xml:space="preserve"> <data name="Swing" xml:space="preserve">
<value>Swing</value> <value>Swing</value>
</data> </data>
<data name="Start" xml:space="preserve">
<value>Start</value>
</data>
<data name="ProgramName" xml:space="preserve">
<value>ProgramName</value>
</data>
<data name="Machines" xml:space="preserve">
<value>Machines</value>
</data>
</root> </root>
+9
View File
@@ -1083,4 +1083,13 @@
<data name="Swing" xml:space="preserve"> <data name="Swing" xml:space="preserve">
<value>摆布</value> <value>摆布</value>
</data> </data>
<data name="Start" xml:space="preserve">
<value>开始</value>
</data>
<data name="ProgramName" xml:space="preserve">
<value>工艺名</value>
</data>
<data name="Machines" xml:space="preserve">
<value>机台</value>
</data>
</root> </root>
+9 -4
View File
@@ -1080,11 +1080,16 @@
<data name="_Auto" xml:space="preserve"> <data name="_Auto" xml:space="preserve">
<value>手/自動</value> <value>手/自動</value>
</data> </data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Swing" type="System.Resources.ResXNullRef, System.Windows.Forms">
<value />
</data>
<data name="Swing" xml:space="preserve"> <data name="Swing" xml:space="preserve">
<value>擺佈</value> <value>擺佈</value>
</data> </data>
<data name="Start" xml:space="preserve">
<value>開始</value>
</data>
<data name="ProgramName" xml:space="preserve">
<value>工藝名</value>
</data>
<data name="Machines" xml:space="preserve">
<value>機器</value>
</data>
</root> </root>
@@ -77,6 +77,9 @@
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="SkiaSharp">
<HintPath>bin\Debug\SkiaSharp.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
@@ -110,6 +113,12 @@
<DependentUpon>DispenseState.xaml</DependentUpon> <DependentUpon>DispenseState.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="EX\Exchange\BDC_SQL.cs" /> <Compile Include="EX\Exchange\BDC_SQL.cs" />
<Compile Include="KEY\TouchKeyboard.xaml.cs">
<DependentUpon>TouchKeyboard.xaml</DependentUpon>
</Compile>
<Compile Include="KEY\TouchKeyboardNumeral.xaml.cs">
<DependentUpon>TouchKeyboardNumeral.xaml</DependentUpon>
</Compile>
<Compile Include="EX\ManualDyelot.xaml.cs"> <Compile Include="EX\ManualDyelot.xaml.cs">
<DependentUpon>ManualDyelot.xaml</DependentUpon> <DependentUpon>ManualDyelot.xaml</DependentUpon>
</Compile> </Compile>
@@ -126,6 +135,7 @@
<Compile Include="UserClass\CSV.cs" /> <Compile Include="UserClass\CSV.cs" />
<Compile Include="UserClass\DataGridHelper.cs" /> <Compile Include="UserClass\DataGridHelper.cs" />
<Compile Include="UserClass\DataTableForToObservableCollection.cs" /> <Compile Include="UserClass\DataTableForToObservableCollection.cs" />
<Compile Include="UserClass\DataTableManager .cs" />
<Compile Include="UserClass\get_local_ip_address.cs" /> <Compile Include="UserClass\get_local_ip_address.cs" />
<Compile Include="UserClass\HardwareSN.cs" /> <Compile Include="UserClass\HardwareSN.cs" />
<Compile Include="UserClass\IniFile.cs" /> <Compile Include="UserClass\IniFile.cs" />
@@ -144,6 +154,12 @@
<Compile Include="UserControls\DispenseMacInfo.xaml.cs"> <Compile Include="UserControls\DispenseMacInfo.xaml.cs">
<DependentUpon>DispenseMacInfo.xaml</DependentUpon> <DependentUpon>DispenseMacInfo.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="WindowsView\UserWorkOrder.xaml.cs">
<DependentUpon>UserWorkOrder.xaml</DependentUpon>
</Compile>
<Compile Include="WindowsView\UserInf.xaml.cs">
<DependentUpon>UserInf.xaml</DependentUpon>
</Compile>
<Compile Include="WindowsView\UserInformation.xaml.cs"> <Compile Include="WindowsView\UserInformation.xaml.cs">
<DependentUpon>UserInformation.xaml</DependentUpon> <DependentUpon>UserInformation.xaml</DependentUpon>
</Compile> </Compile>
@@ -241,6 +257,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="KEY\TouchKeyboard.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="KEY\TouchKeyboardNumeral.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="EX\ManualDyelot.xaml"> <Page Include="EX\ManualDyelot.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -275,6 +299,14 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="WindowsView\UserWorkOrder.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WindowsView\UserInf.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WindowsView\UserInformation.xaml"> <Page Include="WindowsView\UserInformation.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -480,9 +512,6 @@
<PackageReference Include="MaterialDesignThemes"> <PackageReference Include="MaterialDesignThemes">
<Version>5.2.1</Version> <Version>5.2.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Web.WebView2">
<Version>1.0.3405.78</Version>
</PackageReference>
<PackageReference Include="NModbus"> <PackageReference Include="NModbus">
<Version>3.0.81</Version> <Version>3.0.81</Version>
</PackageReference> </PackageReference>
@@ -514,6 +543,11 @@
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" /> <Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" /> <Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" /> <Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
<Resource Include="lmage\IconParkExtend.png" />
<Resource Include="lmage\IconParkExtendR.png" />
<Resource Include="lmage\IconParkExtendY.png" />
<Resource Include="lmage\IconParkInfo.png" />
<Resource Include="lmage\IconParkUsbOne.png" />
<Resource Include="lmage\00.png" /> <Resource Include="lmage\00.png" />
<Resource Include="lmage\1000-1.png" /> <Resource Include="lmage\1000-1.png" />
<Resource Include="lmage\1000-2.png" /> <Resource Include="lmage\1000-2.png" />
+350 -22
View File
@@ -1,25 +1,56 @@
using ScottPlot.Plottables; using Newtonsoft.Json;
using ScottPlot.Plottables;
using SunlightCentralizedControlManagement_SCCM_.View;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using TouchSocket.Core; using TouchSocket.Core;
using TouchSocket.SerialPorts; using TouchSocket.SerialPorts;
using TouchSocket.Sockets; using TouchSocket.Sockets;
using static SkiaSharp.HarfBuzz.SKShaper; using static SkiaSharp.HarfBuzz.SKShaper;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static System.Net.Mime.MediaTypeNames;
namespace SunlightCentralizedControlManagement_SCCM_.UserClass namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{ {
public class AsyncSerialPortClient public class AsyncSerialPortClient
{ {
public static string ClipBetween(string source, char startChar, char endChar, bool includeBounds = false)
{
if (string.IsNullOrEmpty(source))
return string.Empty;
int startIndex = source.IndexOf(startChar);
if (startIndex == -1) return string.Empty;
int endIndex = source.IndexOf(endChar, startIndex + 1);
if (endIndex == -1) return string.Empty;
if (includeBounds)
{
return source.Substring(startIndex, endIndex - startIndex + 1);
}
else
{
int contentStart = startIndex + 1;
int contentLength = endIndex - startIndex - 1;
return contentLength > 0 ? source.Substring(contentStart, contentLength) : string.Empty;
}
}
public static string PortCOM1 { get; set; } public static string PortCOM1 { get; set; }
public static string PortCOM2 { get; set; } public static string PortCOM2 { get; set; }
public static string PortCOM3 { get; set; } public static string PortCOM3 { get; set; }
public static string PortCOM4 { get; set; } public static string PortCOM4 { get; set; }
public static async Task PortClient(SerialPortClient portclient, string com, int BAUD) public static async Task PortClient(SerialPortClient portclient, string com, int BAUD)
{ {
//var client = new SerialPortClient(); //var client = new SerialPortClient();
@@ -29,14 +60,246 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。 portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
portclient.Received = (client, e) => portclient.Received = (client, e) =>
{ {
//接受重置事件状态
_responseEvent.Set(); _responseEvent.Set();
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8); string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
//string DAT1 = CRCcheck16.ToCRC16(e.ByteBlock.Span.ToString(Encoding.UTF8)); @"\n", RegexOptions.IgnoreCase);
for (int i = 0; i < sArray.Length; i++)
{
if (sArray[i].Length > 5)
{
string SYSAPI = sArray[i].Substring(0, 5);
string Station = ClipBetween(sArray[i], '[', ']');
string DAT = sArray[i].Substring(sArray[i].IndexOf("]") + 1);
if (SYSAPI == "SC800")
{
try
{
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" + Station + "' AND Serial = 'PORT1'").First();
drEmployee.BeginEdit();
drEmployee["State"] = "802";
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
}
catch (Exception ex)
{
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
}
}
else if (SYSAPI == "SC810")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex)
{
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
}
}//回复的工单记录状态后就位111
else if (SYSAPI == "SC811")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkorderSteps", new Dictionary<string, object> { { "Mode", 1 } },
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "' AND Step ='" +
_dat.GetValue("Step") + "'", null);
int x = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkorderSteps where WorkOrder='" +
_dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "' AND Mode <> '1'", null).Tables[0].Rows.Count;
if (x == 0)
{
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//回复的工单明细状态后就位113
else if (SYSAPI == "SC812")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//回复的工单设置状态后就位101
else if (SYSAPI == "SC827")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//获取呼叫领料单
else if (SYSAPI == "SC830")
{
try
{
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
string mac;
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" + Station + "' AND Serial = 'PORT1'").First();
mac = drEmployee["Name"].ToString();
drEmployee.BeginEdit();
drEmployee["ERR"] = _new.GetValue("ERR");
drEmployee["LOCK"] = _new.GetValue("LOCK");
drEmployee["Message"] = _new.GetValue("Status");
drEmployee["WorkOrder"] = _new.GetValue("Work");
drEmployee["Temperature"] = _new.GetValue("MTT");
drEmployee["WaterLevel"] = _new.GetValue("MTL");
drEmployee["Process"] = _new.GetValue("Process");
drEmployee["Step"] = _new.GetValue("Step");
drEmployee["UserButton"] = _new.GetValue("UserB");
if (_new.GetValue("InfoS").ToString() != "900")
{ drEmployee["UserInfoStart"] = _new.GetValue("InfoS"); }
drEmployee["UserInfo"] = _new.GetValue("Info");
drEmployee["WORK_RUN"] = _new.GetValue("RUN");
drEmployee["RUN_STEPID"] = _new.GetValue("STEPID");
drEmployee["CALL"] = _new.GetValue("CALL");
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
if (_new.GetValue("Status").ToString() != "----------")
{
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
Chart_new.Add("WorkOrder", _new.GetValue("Work"));
//Chart_new.Add("Machine", mac);
//Chart_new.Add("Time", _new.GetValue("Time"));
Chart_new.Add("MST", _new.GetValue("MST"));
Chart_new.Add("MTT", _new.GetValue("MTT"));
Chart_new.Add("MTL", _new.GetValue("MTL"));
Chart_new.Add("MTH", _new.GetValue("MTH"));
Chart_new.Add("MUT", _new.GetValue("MUT"));
Chart_new.Add("STTA", _new.GetValue("STTA"));
Chart_new.Add("STLA", _new.GetValue("STLA"));
Chart_new.Add("STTB", _new.GetValue("STTB"));
Chart_new.Add("STLB", _new.GetValue("STLB"));
Chart_new.Add("STTC", _new.GetValue("STTC"));
Chart_new.Add("STLC", _new.GetValue("STLC"));
MainWindowViewModel.SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
}
}
catch (Exception ex)
{
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
}
}//当前信息
else if (SYSAPI == "SC831")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}
else if (SYSAPI == "SC832")
{
try
{
MainWindowViewModel.MachineLOG = DAT;
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//当前细节信息
else if (SYSAPI == "SC833")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//当前领料单信息
else if (SYSAPI == "SC851")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//数字开关表
else if (SYSAPI == "SC852")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//寄存器表
else if (SYSAPI == "SC853")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//缓存表
else if (SYSAPI == "SC854")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//程序设置表
else if (SYSAPI == "SC855")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//系统设置表
else if (SYSAPI == "SC859")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//信息
else if (SYSAPI == "SC910")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//发布失败
else if (SYSAPI == "SC911")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//细节错误
else if (SYSAPI == "SC980")
{
}
}
}
return EasyTask.CompletedTask; ; return EasyTask.CompletedTask; ;
}; };
await portclient.SetupAsync(new TouchSocketConfig() await portclient.SetupAsync(new TouchSocketConfig()
.SetMaxBufferSize(1024 * 1024 * 10)
.SetSerialPortOption(new SerialPortOption() .SetSerialPortOption(new SerialPortOption()
{ {
BaudRate = BAUD,//波特率 BaudRate = BAUD,//波特率
@@ -49,9 +312,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
.ConfigurePlugins(a => .ConfigurePlugins(a =>
{ {
//a.Add<MyPlugin>(); //a.Add<MyPlugin>();
})); }
));
try
{
await portclient.ConnectAsync(); await portclient.ConnectAsync();
} }
catch (Exception ex) { LogGing.ERRDATA(ex); }
}
public static async Task PortClient2(SerialPortClient portclient, string com, int BAUD) public static async Task PortClient2(SerialPortClient portclient, string com, int BAUD)
{ {
//var client = new SerialPortClient(); //var client = new SerialPortClient();
@@ -62,12 +330,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
portclient.Received = (client, e) => portclient.Received = (client, e) =>
{ {
_responseEvent2.Set(); _responseEvent2.Set();
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8); string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
//string DAT1 = CRCcheck16.ToCRC16(e.ByteBlock.Span.ToString(Encoding.UTF8)); @"\n", RegexOptions.IgnoreCase);
return EasyTask.CompletedTask; ; return EasyTask.CompletedTask; ;
}; };
await portclient.SetupAsync(new TouchSocketConfig() await portclient.SetupAsync(new TouchSocketConfig()
.SetSerialPortOption(new SerialPortOption() .SetSerialPortOption(new SerialPortOption()
{ {
@@ -82,8 +351,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{ {
//a.Add<MyPlugin>(); //a.Add<MyPlugin>();
})); }));
try
{
await portclient.ConnectAsync(); await portclient.ConnectAsync();
} }
catch (Exception ex) { LogGing.ERRDATA(ex); }
}
public static async Task PortClient3(SerialPortClient portclient, string com, int BAUD) public static async Task PortClient3(SerialPortClient portclient, string com, int BAUD)
{ {
//var client = new SerialPortClient(); //var client = new SerialPortClient();
@@ -94,12 +367,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
portclient.Received = (client, e) => portclient.Received = (client, e) =>
{ {
_responseEvent3.Set(); _responseEvent3.Set();
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8); string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
//string DAT1 = CRCcheck16.ToCRC16(e.ByteBlock.Span.ToString(Encoding.UTF8)); @"\n", RegexOptions.IgnoreCase);
return EasyTask.CompletedTask; ; return EasyTask.CompletedTask; ;
}; };
await portclient.SetupAsync(new TouchSocketConfig() await portclient.SetupAsync(new TouchSocketConfig()
.SetSerialPortOption(new SerialPortOption() .SetSerialPortOption(new SerialPortOption()
{ {
@@ -114,8 +388,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{ {
//a.Add<MyPlugin>(); //a.Add<MyPlugin>();
})); }));
try
{
await portclient.ConnectAsync(); await portclient.ConnectAsync();
} }
catch (Exception ex) { LogGing.ERRDATA(ex); }
}
public static async Task PortClient4(SerialPortClient portclient, string com, int BAUD) public static async Task PortClient4(SerialPortClient portclient, string com, int BAUD)
{ {
//var client = new SerialPortClient(); //var client = new SerialPortClient();
@@ -126,12 +404,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
portclient.Received = (client, e) => portclient.Received = (client, e) =>
{ {
_responseEvent4.Set(); _responseEvent4.Set();
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8); string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
//string DAT1 = CRCcheck16.ToCRC16(e.ByteBlock.Span.ToString(Encoding.UTF8)); @"\n", RegexOptions.IgnoreCase);
return EasyTask.CompletedTask; ; return EasyTask.CompletedTask; ;
}; };
await portclient.SetupAsync(new TouchSocketConfig() await portclient.SetupAsync(new TouchSocketConfig()
.SetSerialPortOption(new SerialPortOption() .SetSerialPortOption(new SerialPortOption()
{ {
@@ -141,18 +418,22 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
PortName = com,//COM PortName = com,//COM
StopBits = System.IO.Ports.StopBits.One,//停止位 StopBits = System.IO.Ports.StopBits.One,//停止位
}) })
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) }) .SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(500) })
.ConfigurePlugins(a => .ConfigurePlugins(a =>
{ {
//a.Add<MyPlugin>(); //a.Add<MyPlugin>();
})); }));
try
{
await portclient.ConnectAsync(); await portclient.ConnectAsync();
} }
catch (Exception ex) { LogGing.ERRDATA(ex); }
}
private static readonly ManualResetEventSlim _responseEvent = new ManualResetEventSlim(false); public static readonly ManualResetEventSlim _responseEvent = new ManualResetEventSlim(false);
private static readonly ManualResetEventSlim _responseEvent2 = new ManualResetEventSlim(false); public static readonly ManualResetEventSlim _responseEvent2 = new ManualResetEventSlim(false);
private static readonly ManualResetEventSlim _responseEvent3 = new ManualResetEventSlim(false); public static readonly ManualResetEventSlim _responseEvent3 = new ManualResetEventSlim(false);
private static readonly ManualResetEventSlim _responseEvent4 = new ManualResetEventSlim(false); public static readonly ManualResetEventSlim _responseEvent4 = new ManualResetEventSlim(false);
/// <summary> /// <summary>
/// 发送指令并等待响应,超时时间为500ms /// 发送指令并等待响应,超时时间为500ms
/// </summary> /// </summary>
@@ -160,35 +441,82 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
/// <returns>从机的响应数据,超时则为null</returns> /// <returns>从机的响应数据,超时则为null</returns>
public static void SendCommandAndWait(SerialPortClient serialPortClients, string command) public static void SendCommandAndWait(SerialPortClient serialPortClients, string command)
{ {
try
{
var t = CRCcheck16.ToCRC16(command);
_responseEvent.Reset(); _responseEvent.Reset();
serialPortClients.Send(command); // 发送指令 serialPortClients.Send(command); // 发送指令
// 等待500毫秒或直到收到响应 // 等待500毫秒或直到收到响应
_responseEvent.Wait(TimeSpan.FromMilliseconds(1000)); if (!_responseEvent.Wait(TimeSpan.FromMilliseconds(1000)))
// 重置事件状态 {
_responseEvent.Set();
//清楚了解状态
string Station = ClipBetween(command, '[', ']');
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
Station + "' AND Serial = 'PORT1'").First();
if (drEmployee.Field<int>("State") != 800)
{
drEmployee.BeginEdit();
drEmployee["State"] = "800";
drEmployee["WorkOrder"] = "------";
drEmployee["Dyelot"] = "";
drEmployee["Temperature"] = 0.0;
drEmployee["WaterLevel"] = 0.0;
drEmployee["Process"] = "";
drEmployee["Step"] = "";
drEmployee["Message"] = "";
drEmployee["SYSKEY"] = "";
drEmployee["WORK_RUN"] = "-1";
drEmployee["ERR"] = false;
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
}
}
}
catch (Exception) { }
} }
public static void SendCommandAndWait2(SerialPortClient serialPortClients, string command) public static void SendCommandAndWait2(SerialPortClient serialPortClients, string command)
{
try
{ {
_responseEvent2.Reset(); _responseEvent2.Reset();
serialPortClients.Send(command); // 发送指令 serialPortClients.Send(command); // 发送指令
// 等待500毫秒或直到收到响应 // 等待500毫秒或直到收到响应
_responseEvent2.Wait(TimeSpan.FromMilliseconds(1000)); _responseEvent2.Wait(TimeSpan.FromMilliseconds(1000));
// 重置事件状态 // 重置事件状态
_responseEvent2.Set();
}
catch (Exception) { }
} }
public static void SendCommandAndWait3(SerialPortClient serialPortClients, string command) public static void SendCommandAndWait3(SerialPortClient serialPortClients, string command)
{
try
{ {
_responseEvent3.Reset(); _responseEvent3.Reset();
serialPortClients.Send(command); // 发送指令 serialPortClients.Send(command); // 发送指令
// 等待500毫秒或直到收到响应 // 等待500毫秒或直到收到响应
_responseEvent3.Wait(TimeSpan.FromMilliseconds(1000)); _responseEvent3.Wait(TimeSpan.FromMilliseconds(1000));
// 重置事件状态 // 重置事件状态
_responseEvent3.Set();
}
catch (Exception) { }
} }
public static void SendCommandAndWait4(SerialPortClient serialPortClients, string command) public static void SendCommandAndWait4(SerialPortClient serialPortClients, string command)
{
try
{ {
_responseEvent4.Reset(); _responseEvent4.Reset();
serialPortClients.Send(command); // 发送指令 serialPortClients.Send(command); // 发送指令
// 等待500毫秒或直到收到响应 // 等待500毫秒或直到收到响应
_responseEvent4.Wait(TimeSpan.FromMilliseconds(1000)); _responseEvent4.Wait(TimeSpan.FromMilliseconds(1000));
// 重置事件状态 // 重置事件状态
_responseEvent4.Set();
}
catch (Exception) { }
} }
} }
} }
+91 -36
View File
@@ -6,6 +6,7 @@ using ScottPlot.Colormaps;
using SkiaSharp; using SkiaSharp;
using SunlightCentralizedControlManagement_SCCM_.View; using SunlightCentralizedControlManagement_SCCM_.View;
using SunlightCentralizedControlManagement_SCCM_.ViewModel; using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -22,10 +23,11 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Documents;
using System.Xml.Linq; using System.Xml.Linq;
using TouchSocket.Core; using TouchSocket.Core;
using TouchSocket.Sockets;
using TouchSocket.SerialPorts; using TouchSocket.SerialPorts;
using TouchSocket.Sockets;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static SunlightCentralizedControlManagement_SCCM_.View.MachinesView; using static SunlightCentralizedControlManagement_SCCM_.View.MachinesView;
using static System.Windows.Forms.AxHost; using static System.Windows.Forms.AxHost;
@@ -39,9 +41,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
/// </summary> /// </summary>
public class AsyncTcpClient public class AsyncTcpClient
{ {
public static SQLiteHelper SQLiteChartAdress = null; //定义数据库
private static readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
public static async Task TcpClient(TcpClient tcpClient, string ip, string port) public static async Task TcpClient(TcpClient tcpClient, string ip, string port)
{ {
//TcpClient tcpClient = new TcpClient(); //TcpClient tcpClient = new TcpClient();
@@ -49,13 +48,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
tcpClient.Connected = (client, e) => tcpClient.Connected = (client, e) =>
{ {
try try
{
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.BeginEdit(); drEmployee.BeginEdit();
drEmployee["State"] = "801"; drEmployee["State"] = "801";
drEmployee.EndEdit(); drEmployee.EndEdit();
drEmployee.AcceptChanges(); drEmployee.AcceptChanges();
}
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_OK"); LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_OK");
} }
catch (Exception ex) catch (Exception ex)
@@ -68,6 +69,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
tcpClient.Closing = (client, e) => tcpClient.Closing = (client, e) =>
{ {
try try
{
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.BeginEdit(); drEmployee.BeginEdit();
@@ -75,7 +78,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["WorkOrder"] = "------"; drEmployee["WorkOrder"] = "------";
drEmployee["Dyelot"] = ""; drEmployee["Dyelot"] = "";
drEmployee["Temperature"] = 0.0; drEmployee["Temperature"] = 0.0;
drEmployee["WaterLevel"] = "----"; drEmployee["WaterLevel"] = 0.0;
drEmployee["Process"] = ""; drEmployee["Process"] = "";
drEmployee["Step"] = ""; drEmployee["Step"] = "";
drEmployee["Message"] = ""; drEmployee["Message"] = "";
@@ -84,6 +87,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["ERR"] = false; drEmployee["ERR"] = false;
drEmployee.EndEdit(); drEmployee.EndEdit();
drEmployee.AcceptChanges(); drEmployee.AcceptChanges();
}
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP"); LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP");
} }
catch (Exception ex) catch (Exception ex)
@@ -95,6 +99,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
tcpClient.Closed = (client, e) => tcpClient.Closed = (client, e) =>
{ {
try try
{
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.BeginEdit(); drEmployee.BeginEdit();
@@ -102,7 +108,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["WorkOrder"] = "------"; drEmployee["WorkOrder"] = "------";
drEmployee["Dyelot"] = ""; drEmployee["Dyelot"] = "";
drEmployee["Temperature"] = 0.0; drEmployee["Temperature"] = 0.0;
drEmployee["WaterLevel"] = "----"; drEmployee["WaterLevel"] = 0.0;
drEmployee["Process"] = ""; drEmployee["Process"] = "";
drEmployee["Step"] = ""; drEmployee["Step"] = "";
drEmployee["Message"] = ""; drEmployee["Message"] = "";
@@ -111,6 +117,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["ERR"] = false; drEmployee["ERR"] = false;
drEmployee.EndEdit(); drEmployee.EndEdit();
drEmployee.AcceptChanges(); drEmployee.AcceptChanges();
}
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT"); LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT");
} }
catch (Exception ex) catch (Exception ex)
@@ -131,6 +138,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化 Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.BeginEdit(); drEmployee.BeginEdit();
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString(); drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
@@ -140,6 +149,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee.EndEdit(); drEmployee.EndEdit();
drEmployee.AcceptChanges(); drEmployee.AcceptChanges();
} }
}
catch (Exception ex) catch (Exception ex)
{ {
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++; LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
@@ -150,8 +160,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
try try
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } }, MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
"WorkOrder ='" + DAT + "'", null); "WorkOrder ='" + DAT + "'", null);
// Dictionary<string, object> _dat;
// _dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
// MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
// "WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -163,8 +178,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
try try
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
"WorkOrder ='" + DAT + "'", null); "WorkOrder ='" + DAT + "'", null);
// Dictionary<string, object> _dat;
// _dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
// MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
// "WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='"+ _dat.GetValue("ReDye") + "'", null);
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
} }
@@ -178,6 +198,33 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
} }
else if (SYSAPI == "SC822")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
Application.Current.Dispatcher.Invoke(() =>
{
UserWorkOrder userWorkOrder = new UserWorkOrder();
userWorkOrder.WorkOrderTable = dataTable;
userWorkOrder.Show();
});
}
catch (Exception)
{
Application.Current.Dispatcher.Invoke(() =>
{
UserInf userInf = new UserInf();
userInf.Inf_DAT = "没有等待中的工艺";
userInf.Show();
userInf.Activate();
});
// LogGing.LogGingDATA("[ERR='" + ex + "']=Exception");
MainWindowViewModel.ERR_c++;
}
}
else if (SYSAPI == "SC827") else if (SYSAPI == "SC827")
{ {
try try
@@ -186,6 +233,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化 DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
foreach (DataRow sourceRow in dataTable.Rows) foreach (DataRow sourceRow in dataTable.Rows)
{
lock (MainWindowViewModel.Dyelot_CALL.Rows.SyncRoot)
{ {
// 创建新行(基于目标表结构) // 创建新行(基于目标表结构)
DataRow newRow = MainWindowViewModel.Dyelot_CALL.NewRow(); DataRow newRow = MainWindowViewModel.Dyelot_CALL.NewRow();
@@ -221,6 +270,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
}); });
} }
} }
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//获取呼叫领料单 }//获取呼叫领料单
else if (SYSAPI == "SC830") else if (SYSAPI == "SC830")
@@ -230,7 +280,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化 _new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
string mac;
// 首先确保 DataTable 使用线程安全的访问方式
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
mac = drEmployee["Name"].ToString();
drEmployee.BeginEdit(); drEmployee.BeginEdit();
drEmployee["ERR"] = _new.GetValue("ERR"); drEmployee["ERR"] = _new.GetValue("ERR");
drEmployee["LOCK"] = _new.GetValue("LOCK"); drEmployee["LOCK"] = _new.GetValue("LOCK");
@@ -249,13 +304,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["CALL"] = _new.GetValue("CALL"); drEmployee["CALL"] = _new.GetValue("CALL");
drEmployee.EndEdit(); drEmployee.EndEdit();
drEmployee.AcceptChanges(); drEmployee.AcceptChanges();
}
if (_new.GetValue("Status").ToString() != "----------") if (_new.GetValue("Status").ToString() != "----------")
{ {
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder")); Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
Chart_new.Add("Machine", _new.GetValue("Machine")); Chart_new.Add("Machine", mac);
Chart_new.Add("Time", _new.GetValue("Time")); Chart_new.Add("Time", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
Chart_new.Add("MST", _new.GetValue("MST")); Chart_new.Add("MST", _new.GetValue("MST"));
Chart_new.Add("MTT", _new.GetValue("MTT")); Chart_new.Add("MTT", _new.GetValue("MTT"));
Chart_new.Add("MTL", _new.GetValue("MTL")); Chart_new.Add("MTL", _new.GetValue("MTL"));
@@ -268,10 +323,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
Chart_new.Add("STTC", _new.GetValue("STTC")); Chart_new.Add("STTC", _new.GetValue("STTC"));
Chart_new.Add("STLC", _new.GetValue("STLC")); Chart_new.Add("STLC", _new.GetValue("STLC"));
SQLiteChartAdress = new SQLiteHelper(ChartAdress); //数据库连接路径 MainWindowViewModel.SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
SQLiteChartAdress.Open(); //打开数据库
SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
SQLiteChartAdress.Close();
} }
} }
@@ -285,7 +337,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化 MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
} }//步骤信息
else if (SYSAPI == "SC832") else if (SYSAPI == "SC832")
{ {
try try
@@ -349,6 +401,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//系统设置表 }//系统设置表
else if (SYSAPI == "SC859")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MachinesView.LOG_dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//信息
else if (SYSAPI == "SC910") else if (SYSAPI == "SC910")
{ {
try try
@@ -369,6 +430,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//细节错误 }//细节错误
else if (SYSAPI == "SC921")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//错误
else if (SYSAPI == "SC980") else if (SYSAPI == "SC980")
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
@@ -380,38 +449,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
//载入配置 //载入配置
await tcpClient.SetupAsync(new TouchSocketConfig() await tcpClient.SetupAsync(new TouchSocketConfig()
.SetMaxBufferSize(1024*1024) .SetMaxBufferSize(1024* 1024*100)
.SetMinBufferSize(1024*64) .SetMinBufferSize(1024*1024)
.SetRemoteIPHost(ip + ":" + port) .SetRemoteIPHost(ip + ":" + port)
.ConfigurePlugins(a => .ConfigurePlugins(a =>
{ {
//触发型重连
// a.UseTcpReconnection();
//使用Polling轮询连接插件 //使用Polling轮询连接插件
a.UseTcpReconnection() a.UseTcpReconnection()
.UsePolling(TimeSpan.FromSeconds(5)); .UsePolling(TimeSpan.FromSeconds(5));
}) })
.ConfigureContainer(a => .ConfigureContainer(a =>
{ {
// a.AddConsoleLogger();//添加一个日志注入
}));
// Result result = await }
));
await tcpClient.TryConnectAsync(); await tcpClient.TryConnectAsync();
// return result.IsSuccess;
/* try
{
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。
return true;
} }
catch
{
return false;
}*/
}
} }
} }
+360
View File
@@ -0,0 +1,360 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{
/// <summary>
/// 线程安全的 DataTable 管理器
/// 提供对 DataTable 的安全并发访问
/// </summary>
public class DataTableManager : IDisposable
{
private DataTable _dataTable;
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
private bool _disposed = false;
#region 构造函数
public DataTableManager()
{
_dataTable = new DataTable();
}
public DataTableManager(DataTable dataTable)
{
_dataTable = dataTable ?? throw new ArgumentNullException(nameof(dataTable));
}
public DataTableManager(string tableName)
{
_dataTable = new DataTable(tableName);
}
#endregion
#region 基本操作
/// <summary>
/// 安全地添加列
/// </summary>
public void AddColumn(string columnName, Type dataType)
{
ExecuteWriteOperation(table =>
{
table.Columns.Add(columnName, dataType);
});
}
/// <summary>
/// 安全地添加行
/// </summary>
public void AddRow(params object[] values)
{
ExecuteWriteOperation(table =>
{
DataRow newRow = table.NewRow();
for (int i = 0; i < Math.Min(values.Length, table.Columns.Count); i++)
{
newRow[i] = values[i] ?? DBNull.Value;
}
table.Rows.Add(newRow);
});
}
/// <summary>
/// 安全地更新单元格值
/// </summary>
public bool UpdateCell(int rowIndex, string columnName, object value)
{
return ExecuteWriteOperation(table =>
{
if (IsValidRowIndex(table, rowIndex) && table.Columns.Contains(columnName))
{
table.Rows[rowIndex][columnName] = value ?? DBNull.Value;
return true;
}
return false;
});
}
/// <summary>
/// 安全地删除行
/// </summary>
public bool DeleteRow(int rowIndex)
{
return ExecuteWriteOperation(table =>
{
if (IsValidRowIndex(table, rowIndex))
{
table.Rows[rowIndex].Delete();
return true;
}
return false;
});
}
#endregion
#region 查询操作
/// <summary>
/// 安全地获取行
/// </summary>
public DataRow GetRow(int rowIndex)
{
return ExecuteReadOperation(table =>
{
return IsValidRowIndex(table, rowIndex) ? table.Rows[rowIndex] : null;
});
}
/// <summary>
/// 安全地查找行(使用筛选条件)
/// </summary>
public DataRow[] FindRows(string filterExpression)
{
return ExecuteReadOperation(table =>
{
try
{
return string.IsNullOrEmpty(filterExpression)
? table.Select()
: table.Select(filterExpression);
}
catch (EvaluateException)
{
return new DataRow[0];
}
});
}
/// <summary>
/// 安全地获取行数
/// </summary>
public int GetRowCount()
{
return ExecuteReadOperation(table => table.Rows.Count);
}
/// <summary>
/// 安全地检查行是否存在
/// </summary>
public bool RowExists(int rowIndex)
{
return ExecuteReadOperation(table => IsValidRowIndex(table, rowIndex));
}
#endregion
#region 批量操作
/// <summary>
/// 安全地批量添加行
/// </summary>
public void BulkAddRows(IEnumerable<object[]> rowsData)
{
ExecuteWriteOperation(table =>
{
foreach (var rowData in rowsData)
{
DataRow newRow = table.NewRow();
for (int i = 0; i < Math.Min(rowData.Length, table.Columns.Count); i++)
{
newRow[i] = rowData[i] ?? DBNull.Value;
}
table.Rows.Add(newRow);
}
});
}
/// <summary>
/// 安全地清空所有数据
/// </summary>
public void Clear()
{
ExecuteWriteOperation(table =>
{
table.Clear();
});
}
#endregion
#region 数据导出
/// <summary>
/// 获取数据快照(线程安全的副本)
/// </summary>
public DataTable GetSnapshot()
{
return ExecuteReadOperation(table =>
{
return table.Copy(); // 创建数据的独立副本
});
}
/// <summary>
/// 获取只读视图
/// </summary>
public DataView GetReadOnlyView()
{
return ExecuteReadOperation(table =>
{
return new DataView(table) { AllowEdit = false };
});
}
/// <summary>
/// 导出到新 DataTable(包含结构)
/// </summary>
public DataTable ExportToDataTable()
{
return ExecuteReadOperation(table =>
{
DataTable exported = table.Clone();
exported.Merge(table, false, MissingSchemaAction.Add);
return exported;
});
}
#endregion
#region 锁操作核心
/// <summary>
/// 执行读取操作(共享锁)
/// </summary>
private T ExecuteReadOperation<T>(Func<DataTable, T> operation)
{
_lock.EnterReadLock();
try
{
return operation(_dataTable);
}
finally
{
_lock.ExitReadLock();
}
}
/// <summary>
/// 执行写入操作(独占锁)
/// </summary>
private void ExecuteWriteOperation(Action<DataTable> operation)
{
_lock.EnterWriteLock();
try
{
operation(_dataTable);
_dataTable.AcceptChanges();
}
finally
{
_lock.ExitWriteLock();
}
}
private T ExecuteWriteOperation<T>(Func<DataTable, T> operation)
{
_lock.EnterWriteLock();
try
{
var result = operation(_dataTable);
_dataTable.AcceptChanges();
return result;
}
finally
{
_lock.ExitWriteLock();
}
}
private bool IsValidRowIndex(DataTable table, int rowIndex)
{
return rowIndex >= 0 && rowIndex < table.Rows.Count;
}
#endregion
#region 高级功能
/// <summary>
/// 带超时的安全操作
/// </summary>
public bool TryUpdateCell(int rowIndex, string columnName, object value, int timeoutMs = 5000)
{
if (_lock.TryEnterWriteLock(timeoutMs))
{
try
{
if (IsValidRowIndex(_dataTable, rowIndex) && _dataTable.Columns.Contains(columnName))
{
_dataTable.Rows[rowIndex][columnName] = value ?? DBNull.Value;
_dataTable.AcceptChanges();
return true;
}
return false;
}
finally
{
_lock.ExitWriteLock();
}
}
return false;
}
/// <summary>
/// 执行事务性操作
/// </summary>
public void ExecuteTransaction(Action<DataTable> transaction)
{
_lock.EnterWriteLock();
try
{
// 开始事务
_dataTable.BeginLoadData();
try
{
transaction(_dataTable);
_dataTable.AcceptChanges();
}
catch
{
_dataTable.RejectChanges();
throw;
}
finally
{
_dataTable.EndLoadData();
}
}
finally
{
_lock.ExitWriteLock();
}
}
#endregion
#region 属性和清理
public string TableName
{
get => ExecuteReadOperation(table => table.TableName);
set => ExecuteWriteOperation(table => table.TableName = value);
}
public DataColumnCollection Columns
{
get => ExecuteReadOperation(table => table.Columns);
}
public void Dispose()
{
if (!_disposed)
{
_lock?.Dispose();
_dataTable?.Dispose();
_disposed = true;
}
GC.SuppressFinalize(this);
}
~DataTableManager()
{
Dispose();
}
#endregion
}
}
+7 -2
View File
@@ -15,6 +15,8 @@
<UserControl.Resources> <UserControl.Resources>
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/> <ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/> <ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}" <DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
@@ -63,8 +65,11 @@
<materialDesign:PackIcon Width="25" Height="30" <materialDesign:PackIcon Width="25" Height="30"
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}" Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/> Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
<materialDesign:PackIcon Width="25" Height="30" <materialDesign:PackIcon Width="25" Height="30" Kind="Lock"
Kind="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}" Visibility="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
<materialDesign:PackIcon Width="25" Height="30" Kind="HandBackRight"
Visibility="{Binding Path=AUTO,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/> Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
+17 -17
View File
@@ -15,15 +15,15 @@
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/> <ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
</UserControl.Resources> </UserControl.Resources>
<Grid Background="White" Cursor=""> <Grid Background="White" Cursor="">
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,30,10,0" x:Name="comboBoxWorkOrder" VerticalAlignment="Top" Width="270" <ComboBox HorizontalAlignment="Left" Height="40" Margin="140,30,10,0" x:Name="comboBoxWorkOrder" VerticalAlignment="Top" Width="270"
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxWorkOrder_KeyDown"/> FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxWorkOrder_KeyDown"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270" <ComboBox HorizontalAlignment="Left" Height="40" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270"
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxDyelot_KeyDown" /> FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxDyelot_KeyDown" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,130,10,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" <ComboBox HorizontalAlignment="Left" Height="40" Margin="140,130,10,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270"
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" IsReadOnly="True" /> FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" IsReadOnly="True" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
@@ -31,59 +31,59 @@
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="360,180,280,0" x:Name="color" TextWrapping="Wrap" <TextBlock HorizontalAlignment="Left" Height="40" Margin="360,180,280,0" x:Name="color" TextWrapping="Wrap"
VerticalAlignment="Top" Width="50" Background="#FF336FA8" MouseDown="color_color_MouseDoubleClick"/> VerticalAlignment="Top" Width="50" Background="#FF336FA8" MouseDown="color_color_MouseDoubleClick"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,180,10,0" x:Name="TEXTColorNumber" VerticalAlignment="Top" Width="200" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,180,10,0" x:Name="TEXTColorNumber" VerticalAlignment="Top" Width="200"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,230,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ColorName}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,230,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ColorName}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,230,10,0" x:Name="TEXTColorName" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,230,10,0" x:Name="TEXTColorName" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,280,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Client}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,280,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Client}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,280,10,0" x:Name="TEXTClient" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,280,10,0" x:Name="TEXTClient" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,330,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothSpecies}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,330,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothSpecies}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,330,10,0" x:Name="TEXTClothSpecies" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,330,10,0" x:Name="TEXTClothSpecies" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,380,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWeight}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,380,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWeight}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,380,10,0" x:Name="TEXTClothWeight" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,380,10,0" x:Name="TEXTClothWeight" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTClothWeight" InputMethod.IsInputMethodEnabled="False"/> FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTClothWeight" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,430,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.BathRatio}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,430,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.BathRatio}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,430,10,0" x:Name="TEXTBathRatio" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,430,10,0" x:Name="TEXTBathRatio" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTBathRatio" InputMethod.IsInputMethodEnabled="False"/> FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTBathRatio" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,480,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,480,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,480,10,0" x:Name="TEXTTotal" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,480,10,0" x:Name="TEXTTotal" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTTotal" InputMethod.IsInputMethodEnabled="False"/> FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTTotal" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,530,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,530,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,530,10,0" x:Name="TEXTUSER" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,530,10,0" x:Name="TEXTUSER" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,80,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Pump}" <TextBlock HorizontalAlignment="Right" Height="40" Margin="10,80,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Pump}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="30" Margin="140,80,380,0" x:Name="PumpSpeed" VerticalAlignment="Top" Width="100" <TextBox HorizontalAlignment="Right" Height="40" Margin="140,80,380,0" x:Name="PumpSpeed" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,80,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Blower}" <TextBlock HorizontalAlignment="Right" Height="40" Margin="240,80,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Blower}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="30" Margin="360,80,50,0" x:Name="Blower" VerticalAlignment="Top" Width="100" <TextBox HorizontalAlignment="Right" Height="40" Margin="360,80,50,0" x:Name="Blower" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,130,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Swing}" <TextBlock HorizontalAlignment="Right" Height="40" Margin="10,130,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Swing}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="30" Margin="140,130,380,0" x:Name="Swing" VerticalAlignment="Top" Width="100" <TextBox HorizontalAlignment="Right" Height="40" Margin="140,130,380,0" x:Name="Swing" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,130,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWheel}" <TextBlock HorizontalAlignment="Right" Height="40" Margin="240,130,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWheel}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="30" Margin="360,130,50,0" x:Name="ClothWheel" VerticalAlignment="Top" Width="100" <TextBox HorizontalAlignment="Right" Height="40" Margin="360,130,50,0" x:Name="ClothWheel" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,180,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Nozzle}" <TextBlock HorizontalAlignment="Right" Height="40" Margin="10,180,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Nozzle}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="30" Margin="140,180,380,0" x:Name="Nozzle" VerticalAlignment="Top" Width="100" <TextBox HorizontalAlignment="Right" Height="40" Margin="140,180,380,0" x:Name="Nozzle" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<ComboBox HorizontalAlignment="Right" Height="30" Margin="150,30,50,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="470" <ComboBox HorizontalAlignment="Right" Height="40" Margin="150,30,50,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="470"
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxProgram_DropDownClosed" FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxProgram_DropDownClosed"
TextBoxBase.TextChanged="comboBoxProgram_TextChanged"/> TextBoxBase.TextChanged="comboBoxProgram_TextChanged"/>
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,30,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}" <TextBlock HorizontalAlignment="Right" Height="40" Margin="10,30,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}"
+50 -43
View File
@@ -40,6 +40,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DataTable TEMPTable = new DataTable(); DataTable TEMPTable = new DataTable();
DataTable DyelotsBulkedRecipe=new DataTable(); DataTable DyelotsBulkedRecipe=new DataTable();
public string WorkOrder_n; public string WorkOrder_n;
string Numder = null;
string ID = null;
string P1, P2, P3, P4, P5;
public DyeingPlanView() public DyeingPlanView()
{ {
InitializeComponent(); InitializeComponent();
@@ -176,24 +179,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数
for (int x = 0; x < dat.Rows.Count; x++) for (int x = 0; x < dat.Rows.Count; x++)
{ {
WorkOrder_DAT = MainWindowViewModel.SQLiteHelpers.ToDictionary(dat.Rows[x]);
WorkOrder_DAT.Add("WorkOrder", WorkOrder_); WorkOrder_DAT.Add("WorkOrder", WorkOrder_);
WorkOrder_DAT.Add("Dyelot", Dyelot_); WorkOrder_DAT.Add("Dyelot", Dyelot_);
WorkOrder_DAT.Add("ProgramID", dat.Rows[x]["ProgramID"]);
WorkOrder_DAT.Add("Program", dat.Rows[x]["Program"]);
WorkOrder_DAT.Add("Step", dat.Rows[x]["Step"]);
WorkOrder_DAT.Add("StepID", dat.Rows[x]["StepID"]);
WorkOrder_DAT.Add("StepName", dat.Rows[x]["StepName"]);
WorkOrder_DAT.Add("ParameterName", dat.Rows[x]["ParameterName"]);
WorkOrder_DAT.Add("Parameter1", dat.Rows[x]["Parameter1"]);
WorkOrder_DAT.Add("Parameter2", dat.Rows[x]["Parameter2"]);
WorkOrder_DAT.Add("Parameter3", dat.Rows[x]["Parameter3"]);
WorkOrder_DAT.Add("Parameter4", dat.Rows[x]["Parameter4"]);
WorkOrder_DAT.Add("Parameter5", dat.Rows[x]["Parameter5"]);
WorkOrder_DAT.Add("Parameter6", dat.Rows[x]["Parameter6"]);
WorkOrder_DAT.Add("Parameter7", dat.Rows[x]["Parameter7"]);
WorkOrder_DAT.Add("Parameter8", dat.Rows[x]["Parameter8"]);
WorkOrder_DAT.Add("Parameter9", dat.Rows[x]["Parameter9"]);
WorkOrder_DAT.Add("Parameter10", dat.Rows[x]["Parameter10"]);
MainWindowViewModel.SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入 MainWindowViewModel.SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
WorkOrder_DAT.Clear(); WorkOrder_DAT.Clear();
} }
@@ -290,11 +278,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
}//工艺修改事件 }//工艺修改事件
string Numder = null;
string ID = null;
string P1, P2, P3, P4, P5;
private void MenuItem_edit(object sender, RoutedEventArgs e) private void MenuItem_edit(object sender, RoutedEventArgs e)
{ {
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
@@ -310,7 +293,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = dat.Rows.Count.ToString(); if (ID == null) ID = dat.Rows.Count.ToString();
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -335,8 +318,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DatSteps(dat); DatSteps(dat);
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = dat.Rows.Count.ToString(); if (ID == null) ID = dat.Rows.Count.ToString();
ViewStep viewstop = new ViewStep(null, "0", "0", "0", "0", "0"); ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -369,7 +353,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = dat.Rows.Count.ToString(); if (ID == null) ID = dat.Rows.Count.ToString();
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -377,26 +361,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果 private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
{ {
int i = dat.Rows.Count; int n = Convert.ToInt16(ID);
int n = StrToInt.To16Convert10(ID); ID = null;
if (e.Mode) if (e.PNAME != "")
{ {
DataRow dr = dat.Rows[n - 1]; DataRow dr = dat.Rows[n - 1];
dr.BeginEdit(); dr.BeginEdit();
dr["StepID"] = e.StepID; dr["StepID"] = e.StepID;
dr["StepName"] = e.StepNAME; dr["StepName"] = e.StepNAME;
dr["ParameterName"] = e.PNAME; dr["ParameterName"] = e.PNAME;
dr["Parameter1"] = e.P1; dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter2"] = e.P2; dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter3"] = e.P3; dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter4"] = e.P4; dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter5"] = e.P5; dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
dr["Parameter4_S1"] = e.Row_DAT.Field<double>("Parameter4_S1");
dr["Parameter5_S1"] = e.Row_DAT.Field<double>("Parameter5_S1");
dr["Parameter1_S2"] = e.Row_DAT.Field<double>("Parameter1_S2");
dr["Parameter2_S2"] = e.Row_DAT.Field<double>("Parameter2_S2");
dr["Parameter3_S2"] = e.Row_DAT.Field<double>("Parameter3_S2");
dr["Parameter4_S2"] = e.Row_DAT.Field<double>("Parameter4_S2");
dr["Parameter5_S2"] = e.Row_DAT.Field<double>("Parameter5_S2");
dr["Parameter1_S3"] = e.Row_DAT.Field<double>("Parameter1_S3");
dr["Parameter2_S3"] = e.Row_DAT.Field<double>("Parameter2_S3");
dr["Parameter3_S3"] = e.Row_DAT.Field<double>("Parameter3_S3");
dr["Parameter4_S3"] = e.Row_DAT.Field<double>("Parameter4_S3");
dr["Parameter5_S3"] = e.Row_DAT.Field<double>("Parameter5_S3");
dr["StepName_S1"] = e.Row_DAT.Field<string>("StepName_S1");
dr["StepName_S2"] = e.Row_DAT.Field<string>("StepName_S2");
dr["StepName_S3"] = e.Row_DAT.Field<string>("StepName_S3");
dr["StepID_S1"] = e.Row_DAT.Field<string>("StepID_S1");
dr["StepID_S2"] = e.Row_DAT.Field<string>("StepID_S2");
dr["StepID_S3"] = e.Row_DAT.Field<string>("StepID_S3");
dr.EndEdit(); dr.EndEdit();
Grid_data.SelectedIndex = -1;
} }
else else
{ {
dat.Rows.RemoveAt(Convert.ToInt32(ID) - 1); MainWindowViewModel.dt_TP.Rows.RemoveAt(n - 1);
DatSteps(dat); DatSteps(dat);
Grid_data.SelectedIndex = -1;
} }
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
} }
@@ -412,17 +419,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
for (int i = 0; i < dat.Rows.Count; i++) for (int i = 0; i < dat.Rows.Count; i++)
{ {
switch (dat.Rows[i][3].ToString())//步骤用时计算 switch (dat.Rows[i].Field<string>("StepID"))//步骤用时计算
{ {
case "001": case "001":
TT = MSTT; TT = MSTT;
TC = (Double)dat.Rows[i][7]; TC = dat.Rows[i].Field<double>("Parameter2");
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制 if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
MSTT = (Double)dat.Rows[i][6]; MSTT = dat.Rows[i].Field<double>("Parameter1");
TT = Math.Abs(MSTT - TT) / TC * 60; TT = Math.Abs(MSTT - TT) / TC * 60;
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "007": case "007":
@@ -434,15 +441,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "013": case "013":
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]* (Double)dat.Rows[i][9]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3") * dat.Rows[i].Field<double>("Parameter4")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "015": case "015":
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "017": case "017":
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "020": case "020":
@@ -454,11 +461,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "031": case "031":
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][6]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "065": case "065":
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][8]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "091": case "091":
@@ -471,7 +478,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "093": case "093":
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][6]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
default: default:
+1
View File
@@ -65,6 +65,7 @@
<DataGridTextColumn Binding="{Binding Serial}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Serial}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Station}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Station}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding ID}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding ID}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Model}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Type}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Type}" Width="0" IsReadOnly="True"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
+77 -57
View File
@@ -36,14 +36,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
// 获取所有可用串口端口,并添加到comboBoxCOM // 获取所有可用串口端口,并添加到comboBoxCOM
// string[] ports = System.IO.Ports.SerialPort.GetPortNames(); // string[] ports = System.IO.Ports.SerialPort.GetPortNames();
string[] ports = { "PORT1", "PORT2", "PORT3", "PORT4" };
comboBoxCOM0.ItemsSource = ports; comboBoxCOM0.ItemsSource = ports;
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM"); comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM");
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台 comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
string[] type_ = { "828", "838" };
comboBoxtype.ItemsSource = type_; comboBoxtype.ItemsSource = type_;
} }
string[] ports = { "PORT1", "PORT2", "PORT3", "PORT4" };
string[] type_ = { "828", "838" };
string link_model = "838" ;
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
//private string SYS_machines = null; //private string SYS_machines = null;
int ID_; int ID_;
@@ -70,19 +71,22 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void Save_Click(object sender, RoutedEventArgs e) private void Save_Click(object sender, RoutedEventArgs e)
{ {
if (string.IsNullOrEmpty(Station.Text)) Station.Text = "255";
if (!string.IsNullOrEmpty(comboBoxMachine.Text)) if (!string.IsNullOrEmpty(comboBoxMachine.Text))
{ {
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
if (MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Machines where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0) if (MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Machines where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
{ {
DataRow dat_= MainWindowViewModel.Machines.NewRow(); lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow dat_ = MainWindowViewModel.Machines.NewRow();
dat_.BeginEdit(); dat_.BeginEdit();
dat_["Name"] = comboBoxMachine.Text; dat_["Name"] = comboBoxMachine.Text;
dat_["Groups"] = TextMachineGroup.Text; dat_["Groups"] = TextMachineGroup.Text;
dat_["IP"] = IP.Text; dat_["IP"] = IP.Text;
dat_["PORT"] = PORT.Text; dat_["PORT"] = PORT.Text;
dat_["Serial"] = comboBoxCOM0.Text; dat_["Serial"] = comboBoxCOM0.Text;
dat_["Type"] = comboBoxtype.Text; dat_["Model"] = comboBoxtype.Text;
dat_["Station"] = Station.Text; dat_["Station"] = Station.Text;
dat_["ID"] = 999; dat_["ID"] = 999;
dat_["ERR"] = false; dat_["ERR"] = false;
@@ -94,9 +98,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dat_["WaterLevel"] = 0; dat_["WaterLevel"] = 0;
dat_["WORK_RUN"] = -1; dat_["WORK_RUN"] = -1;
dat_["UserInfoStart"] = 900; dat_["UserInfoStart"] = 900;
if (comboBoxtype.Text == "838") if (comboBoxtype.Text.Contains(link_model))
{ dat_["Desktop"] = true; } {
else { dat_["Desktop"] = false; } dat_["Desktop"] = true;
dat_["Type"] = true;
}
else
{
dat_["Desktop"] = false;
dat_["Type"] = false;
}
dat_.EndEdit(); dat_.EndEdit();
MainWindowViewModel.Machines.Rows.Add(dat_); MainWindowViewModel.Machines.Rows.Add(dat_);
DatSteps(MainWindowViewModel.Machines); DatSteps(MainWindowViewModel.Machines);
@@ -113,11 +124,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]); Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]); Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]); Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入 MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
Machines_DAT.Clear(); Machines_DAT.Clear();
} }
} }
}
else else
{
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{ {
DataRow dr = MainWindowViewModel.Machines.Rows[ID_]; DataRow dr = MainWindowViewModel.Machines.Rows[ID_];
dr.BeginEdit(); dr.BeginEdit();
@@ -126,18 +141,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dr["IP"] = IP.Text; dr["IP"] = IP.Text;
dr["PORT"] = PORT.Text; dr["PORT"] = PORT.Text;
dr["Serial"] = comboBoxCOM0.Text; dr["Serial"] = comboBoxCOM0.Text;
dr["Type"] = comboBoxtype.Text; dr["Model"] = comboBoxtype.Text;
dr["Station"] = Station.Text; dr["Station"] = Station.Text;
dr["ID"] = 999; if (comboBoxtype.Text.Contains(link_model))
dr["ERR"] = false; {
dr["AUTO"] = false; dr["Desktop"] = true;
dr["CALL"] = false; dr["Type"] = true;
dr["LOCK"] = false; }
dr["State"] = 800; else
dr["Temperature"] = 0; {
dr["WaterLevel"] = 0; dr["Desktop"] = false;
dr["WORK_RUN"] = -1; dr["Type"] = false;
dr["UserInfoStart"] = 900; }
dr.EndEdit(); dr.EndEdit();
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);// MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++) for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
@@ -152,11 +167,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]); Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]); Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]); Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
Machines_DAT.Add("LOCK", "FALSE"); Machines_DAT.Add("LOCK", "FALSE");
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入 MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
Machines_DAT.Clear(); Machines_DAT.Clear();
} }
} }
}
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView; Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
comboBoxMachine.Text = null; comboBoxMachine.Text = null;
TextMachineGroup.Text = null; TextMachineGroup.Text = null;
@@ -177,10 +194,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question); MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码 if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码
{
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{ {
MainWindowViewModel.Machines.Rows.RemoveAt(ID_ - 1); MainWindowViewModel.Machines.Rows.RemoveAt(ID_ - 1);
DatSteps(MainWindowViewModel.Machines); DatSteps(MainWindowViewModel.Machines);
}
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);// MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
@@ -224,45 +243,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
private void Test_Click(object sender, RoutedEventArgs e)//测试按钮 private void Test_Click(object sender, RoutedEventArgs e)//测试按钮
{ {
if (comboBoxtype.Text == "828")
{
if (!string.IsNullOrEmpty(comboBoxCOM0.Text) && !string.IsNullOrEmpty(Station.Text))
{
textlog.Text = "TEST";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
//------------使用ping类------
string host = IP.Text;
Ping p1 = new Ping();
PingReply reply = p1.Send(host); //发送主机名或Ip地址
//StringBuilder sbuilder;
if (reply.Status == IPStatus.Success)
{
try
{
textlog.Text = "Link succeed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
}
catch (Exception)
{
textlog.Text = "Link failed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
}
}
else
{
textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
else
{
textlog.Text = "Invalid";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
} if (comboBoxtype.Text.Contains(link_model))
else if (comboBoxtype.Text == "838") {//网络
{
if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text)) if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text))
{ {
textlog.Text = "TEST"; textlog.Text = "TEST";
@@ -320,6 +303,43 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
} }
else
{//串口
if (!string.IsNullOrEmpty(comboBoxCOM0.Text) && !string.IsNullOrEmpty(Station.Text))
{
textlog.Text = "TEST";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
//------------使用ping类------
string host = IP.Text;
Ping p1 = new Ping();
PingReply reply = p1.Send(host); //发送主机名或Ip地址
//StringBuilder sbuilder;
if (reply.Status == IPStatus.Success)
{
try
{
textlog.Text = "Link succeed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
}
catch (Exception)
{
textlog.Text = "Link failed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
}
}
else
{
textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
else
{
textlog.Text = "Invalid";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
} }
} }
} }
+51 -6
View File
@@ -16,6 +16,8 @@
<UserControl.Resources> <UserControl.Resources>
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/> <ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/> <ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
<ConvertMoels:BoolRBConvert x:Key="BoolRBConvert"/> <ConvertMoels:BoolRBConvert x:Key="BoolRBConvert"/>
<ConvertMoels:IORBConvert x:Key="IORBConvert"/> <ConvertMoels:IORBConvert x:Key="IORBConvert"/>
</UserControl.Resources> </UserControl.Resources>
@@ -30,7 +32,7 @@
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True"
AutoGenerateColumns="False" MinColumnWidth="30" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalAlignment="Left" Width="310" MouseDoubleClick="Griddata_MouseDoubleClick"> HorizontalAlignment="Left" Width="250" MouseDoubleClick="Griddata_MouseDoubleClick">
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" /> <Setter Property="Height" Value="30" />
@@ -79,8 +81,8 @@
<materialDesign:PackIcon Width="25" Height="30" <materialDesign:PackIcon Width="25" Height="30"
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}" Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/> Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
<materialDesign:PackIcon Width="25" Height="30" <materialDesign:PackIcon Width="25" Height="30" Kind="Lock"
Kind="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}" Visibility="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/> Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
@@ -89,17 +91,52 @@
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="210" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="150" IsReadOnly="True"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Grid Grid.Row="0" Margin="310,0,0,0"> <Grid Grid.Row="0" Margin="250,0,0,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition Height="0"/>
<RowDefinition Height="5"/> <RowDefinition Height="5"/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ContentControl Grid.Row="0" x:Name="machineView"/> <ContentControl Grid.Row="0" x:Name="machineView"/>
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/> <GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/>
<Grid Grid.Row="2" x:Name="LOG_GRID" Visibility="Collapsed">
<DataGrid x:Name="LOG_Grid" AlternationCount="2" Margin="0,0,0,0"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
Background="White" SelectionMode="Single" FontSize="15" >
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="25" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
</DataGrid>
</Grid>
<Grid Grid.Row="2" x:Name="SET_GRID" Visibility="Collapsed"> <Grid Grid.Row="2" x:Name="SET_GRID" Visibility="Collapsed">
<DataGrid x:Name="SET_Grid" AlternationCount="2" Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False" <DataGrid x:Name="SET_Grid" AlternationCount="2" Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False"
ItemsSource="{Binding Path=Paramete_Set,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=Paramete_Set,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
@@ -389,6 +426,14 @@
</StackPanel> </StackPanel>
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_LOG">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="MathLog" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.log}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel>
</ListViewItem>
</ListView>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="2" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="400" HorizontalAlignment="Right"> <StackPanel Grid.Row="2" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="400" HorizontalAlignment="Right">
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
+116 -2
View File
@@ -63,6 +63,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
string machine; string machine;
int LOG_ = 0;
public static DataTable LOG_dataTable = new DataTable();
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e) private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{ {
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
@@ -81,6 +83,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_ArrowLeftRight(object sender, MouseButtonEventArgs e) private void ListViewItem_ArrowLeftRight(object sender, MouseButtonEventArgs e)
{ {
LOG_GRID.Visibility = Visibility.Collapsed;
IO_GRID.Visibility = Visibility.Visible; IO_GRID.Visibility = Visibility.Visible;
SYS_GRID.Visibility = Visibility.Collapsed; SYS_GRID.Visibility = Visibility.Collapsed;
SET_GRID.Visibility = Visibility.Collapsed; SET_GRID.Visibility = Visibility.Collapsed;
@@ -88,13 +91,81 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
private void ListViewItem_VideoHomeSystem(object sender, MouseButtonEventArgs e) private void ListViewItem_VideoHomeSystem(object sender, MouseButtonEventArgs e)
{ {
LOG_GRID.Visibility = Visibility.Collapsed;
IO_GRID.Visibility = Visibility.Collapsed; IO_GRID.Visibility = Visibility.Collapsed;
SYS_GRID.Visibility = Visibility.Visible; SYS_GRID.Visibility = Visibility.Visible;
SET_GRID.Visibility = Visibility.Collapsed; SET_GRID.Visibility = Visibility.Collapsed;
view = 2; view = 2;
} }
private void ListViewItem_LOG(object sender, MouseButtonEventArgs e)
{
if (LOG_ >= 3) { LOG_ = 0; }
else
{ LOG_++; }
LOG_GRID.Visibility = Visibility.Visible;
IO_GRID.Visibility = Visibility.Collapsed;
SYS_GRID.Visibility = Visibility.Collapsed;
SET_GRID.Visibility = Visibility.Collapsed;
view = 3;
LOG_dataTable.Clear();
Dictionary<string, object> dat_859 =new Dictionary<string, object>();
if (LOG_ == 0)
{
MAC_name.Text = machine+ "(SERVER)";
dat_859.Add("INSTRUCTION", "SERVER");
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
}
else if (LOG_ == 1)
{
MAC_name.Text = machine + "(OperationLog)";
dat_859.Add("INSTRUCTION", "OperationLog");
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
}
else if (LOG_ == 2)
{
MAC_name.Text = machine + "(IOLog)";
dat_859.Add("INSTRUCTION", "IOLog");
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
}
else
{
MAC_name.Text = machine + "(ERRLog)";
dat_859.Add("INSTRUCTION", "ERRLog");
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
}
if (!string.IsNullOrEmpty(machine))
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
{
if (drEmployee.Field<bool>("Type"))//
{//网络
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{
ID = index,
DAT = "SC859" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
+ dat_859.ToJsonString()
});
}
else
{//串口
}
}
}
}
private void ListViewItem_Dharmachakra(object sender, MouseButtonEventArgs e) private void ListViewItem_Dharmachakra(object sender, MouseButtonEventArgs e)
{ {
LOG_GRID.Visibility = Visibility.Collapsed;
IO_GRID.Visibility = Visibility.Collapsed; IO_GRID.Visibility = Visibility.Collapsed;
SYS_GRID.Visibility = Visibility.Collapsed; SYS_GRID.Visibility = Visibility.Collapsed;
SET_GRID.Visibility = Visibility.Visible; SET_GRID.Visibility = Visibility.Visible;
@@ -174,12 +245,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID")); int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
if (drEmployee.Field<bool>("Type"))//
{//网络
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{ {
ID = index, ID = index,
DAT = "SC862" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString() DAT = "SC862" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString()
});//发送862指令修改系统设置 });//发送862指令修改系统设置
} }
else
{//串口
}
}
SysSet_view = true; SysSet_view = true;
} }
@@ -197,12 +275,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID")); int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
if (drEmployee.Field<bool>("Type"))//
{//网络
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{ {
ID = index, ID = index,
DAT = "SC861" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") +datagrid_v.ToJsonString() DAT = "SC861" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString()
});//发送861指令修改程序设置 });//发送861指令修改程序设置
} }
else
{//串口
}
}
ParameterSet_view = true; ParameterSet_view = true;
} }
@@ -222,6 +307,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (!string.IsNullOrEmpty(machine)) if (!string.IsNullOrEmpty(machine))
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
if (drEmployee.Field<bool>("Type"))//
{//网络
int State_ = Convert.ToInt16(drEmployee.Field<object>("State")); int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
int index = Convert.ToInt16(drEmployee.Field<object>("ID")); int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息 if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
@@ -243,7 +331,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
ID = index, ID = index,
DAT = "SC853" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") DAT = "SC853" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
}); });
} else if (view==1) }
else if (view == 1)
{ {
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{ {
@@ -261,6 +350,27 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
} }
} }
else
{//串口
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
{
if (view == 0)
{
}
else if (view == 1)
{
}
else if (view == 2)
{
}
}
}
}
} }
public void CountDown() public void CountDown()
@@ -276,6 +386,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
IO_data(); IO_data();
DATA_view(); DATA_view();
if (LOG_dataTable.Rows.Count > 0) {
LOG_Grid.ItemsSource = LOG_dataTable.DefaultView;
// LOG_dataTable.Clear();
}
} }
private async void DATA_view()//IO显示 private async void DATA_view()//IO显示
{ {
+44 -18
View File
@@ -20,6 +20,8 @@
<ContextMenu x:Key="PersoncontextMenu"> <ContextMenu x:Key="PersoncontextMenu">
<MenuItem Header="{x:Static lang:Resources._lock}" Click="MenuItem_LOCK_XML"/> <MenuItem Header="{x:Static lang:Resources._lock}" Click="MenuItem_LOCK_XML"/>
<MenuItem Header="{x:Static lang:Resources._Auto}" Click="MenuItem_AUTO_XML"/> <MenuItem Header="{x:Static lang:Resources._Auto}" Click="MenuItem_AUTO_XML"/>
<MenuItem Header="{x:Static lang:Resources.Stop}" Click="MenuItem_Stop_XML"/>
<MenuItem Header="{x:Static lang:Resources.Start}" Click="MenuItem_Start_XML"/>
</ContextMenu> </ContextMenu>
<ContextMenu x:Key="PersoncontextMenuStep"> <ContextMenu x:Key="PersoncontextMenuStep">
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/> <MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
@@ -35,11 +37,12 @@
<RowDefinition Height="60"/> <RowDefinition Height="60"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" <DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True"
SelectionChanged="Griddata_SelectionChanged" SelectionChanged="Griddata_SelectionChanged" EnableRowVirtualization="True" EnableColumnVirtualization="True"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="True"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" > CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" >
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
@@ -126,19 +129,40 @@
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="150" IsReadOnly="True"> <DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="80" IsReadOnly="True">
<DataGridTextColumn.ElementStyle> <DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}"> <Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/> <Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
</Style> </Style>
</DataGridTextColumn.ElementStyle> </DataGridTextColumn.ElementStyle>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="ToolTip" Value="{Binding WorkOrder}"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="0" MaxWidth="0" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="0" MaxWidth="0" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Temperature}" Binding="{Binding Temperature}" Width="100" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.Temperature}" Binding="{Binding Temperature}" Width="100" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.WaterLevel}" Binding="{Binding WaterLevel}" Width="100" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.WaterLevel}" Binding="{Binding WaterLevel}" Width="100" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.process}" Binding="{Binding Process}" Width="300" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.process}" Binding="{Binding Process}" Width="300" IsReadOnly="True">
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="300" IsReadOnly="True"/> <DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="ToolTip" Value="{Binding Process}"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="300" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="ToolTip" Value="{Binding Step}"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.message}" Binding="{Binding Message}" Width="*" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.message}" Binding="{Binding Message}" Width="*" IsReadOnly="True"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
@@ -150,6 +174,8 @@
<ColumnDefinition MinWidth="1200"/> <ColumnDefinition MinWidth="1200"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" SelectionChanged="Gridstep_SelectionChanged" <DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" SelectionChanged="Gridstep_SelectionChanged"
EnableRowVirtualization="True" EnableColumnVirtualization="True"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30" d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White"
@@ -288,16 +314,16 @@
<TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/> <TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/>
<Grid Margin="0,40,0,0" Grid.ColumnSpan="2" Grid.Column="0" > <Grid Margin="0,40,0,0" Grid.ColumnSpan="2" Grid.Column="0" >
<rdp:RemoteDesktopWpf x:Name="rdp" Visibility="Collapsed" /> <rdp:RemoteDesktopWpf x:Name="rdp" Visibility="Collapsed" />
<ContentControl x:Name="Picture" Background="White"/>
<ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="VerticalOnly"> <ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="VerticalOnly">
<TextBlock x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White"/> <TextBlock x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White"/>
</ScrollViewer> </ScrollViewer>
<ContentControl x:Name="Picture" Background="White"/>
</Grid> </Grid>
<GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/> <GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/>
</Grid> </Grid>
<StackPanel Grid.Row="3" x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Width="800" HorizontalAlignment="Left"> <StackPanel Grid.Row="3" x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Width="800" HorizontalAlignment="Left">
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_DyeingMachine" IsEnabled="False" x:Name="DyeingMachine"> <ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_DyeingMachine" IsHitTestVisible="False" x:Name="DyeingMachine">
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
<materialDesign:PackIcon Kind="CoffeeMachine" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="CoffeeMachine" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.DyeingMachine}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.DyeingMachine}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -305,7 +331,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Curve" IsEnabled="False" x:Name="Curve"> <ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Curve" IsHitTestVisible="False" x:Name="Curve">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="ChartBellCurve" Width="40" Height="30" Margin="10" VerticalAlignment="Center"/> <materialDesign:PackIcon Kind="ChartBellCurve" Width="40" Height="30" Margin="10" VerticalAlignment="Center"/>
<TextBlock Text="{x:Static lang:Resources.Curve}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Curve}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -313,7 +339,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Screen" IsEnabled="False" x:Name="Screen"> <ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Screen" IsHitTestVisible="False" x:Name="Screen">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Monitor" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Monitor" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Screen}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Screen}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -321,7 +347,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Receipt" IsEnabled="False" x:Name="Receipt"> <ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Receipt" IsHitTestVisible="False" x:Name="Receipt">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="ReceiptText" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="ReceiptText" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Receipt}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Receipt}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -331,7 +357,7 @@
</StackPanel> </StackPanel>
<StackPanel Grid.Row="3" x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="800,0,0,0"> <StackPanel Grid.Row="3" x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="800,0,0,0">
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Resume" IsEnabled="False" x:Name="Resume"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Resume" IsHitTestVisible="False" x:Name="Resume">
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
<materialDesign:PackIcon Kind="Resume" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Resume" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Resume}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Resume}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -339,7 +365,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Paused" IsEnabled="False" x:Name="Paused"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Paused" IsHitTestVisible="False" x:Name="Paused">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Pause" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Pause" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Paused}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Paused}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -347,7 +373,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Stop" IsEnabled="False" x:Name="Stop"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Stop" IsHitTestVisible="False" x:Name="Stop">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Stop" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Stop" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Stop}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Stop}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -355,7 +381,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsHitTestVisible="False" x:Name="edit">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -363,7 +389,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Jump" IsEnabled="False" x:Name="Jump"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Jump" IsHitTestVisible="False" x:Name="Jump">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Jump" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Jump" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Jump}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Jump}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -371,7 +397,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsEnabled="False" x:Name="Insert"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsHitTestVisible="False" x:Name="Insert">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="InsertInvitation" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="InsertInvitation" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -379,7 +405,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsHitTestVisible="False" x:Name="Delete">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
+752 -136
View File
File diff suppressed because it is too large. Load diff
+27 -6
View File
@@ -422,7 +422,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = dat.Rows.Count.ToString(); if (ID == null) ID = dat.Rows.Count.ToString();
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -438,11 +438,32 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dr["StepID"] = e.StepID; dr["StepID"] = e.StepID;
dr["StepName"] = e.StepNAME; dr["StepName"] = e.StepNAME;
dr["ParameterName"] = e.PNAME; dr["ParameterName"] = e.PNAME;
dr["Parameter1"] = e.P1; dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter2"] = e.P2; dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter3"] = e.P3; dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter4"] = e.P4; dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter5"] = e.P5; dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
dr["Parameter4_S1"] = e.Row_DAT.Field<double>("Parameter4_S1");
dr["Parameter5_S1"] = e.Row_DAT.Field<double>("Parameter5_S1");
dr["Parameter1_S2"] = e.Row_DAT.Field<double>("Parameter1_S2");
dr["Parameter2_S2"] = e.Row_DAT.Field<double>("Parameter2_S2");
dr["Parameter3_S2"] = e.Row_DAT.Field<double>("Parameter3_S2");
dr["Parameter4_S2"] = e.Row_DAT.Field<double>("Parameter4_S2");
dr["Parameter5_S2"] = e.Row_DAT.Field<double>("Parameter5_S2");
dr["Parameter1_S3"] = e.Row_DAT.Field<double>("Parameter1_S3");
dr["Parameter2_S3"] = e.Row_DAT.Field<double>("Parameter2_S3");
dr["Parameter3_S3"] = e.Row_DAT.Field<double>("Parameter3_S3");
dr["Parameter4_S3"] = e.Row_DAT.Field<double>("Parameter4_S3");
dr["Parameter5_S3"] = e.Row_DAT.Field<double>("Parameter5_S3");
dr["StepName_S1"] = e.Row_DAT.Field<string>("StepName_S1");
dr["StepName_S2"] = e.Row_DAT.Field<string>("StepName_S2");
dr["StepName_S3"] = e.Row_DAT.Field<string>("StepName_S3");
dr["StepID_S1"] = e.Row_DAT.Field<string>("StepID_S1");
dr["StepID_S2"] = e.Row_DAT.Field<string>("StepID_S2");
dr["StepID_S3"] = e.Row_DAT.Field<string>("StepID_S3");
dr.EndEdit(); dr.EndEdit();
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
+5 -5
View File
@@ -280,7 +280,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
{ {
Interval = TimeSpan.FromSeconds(1)//秒 Interval = TimeSpan.FromSeconds(5)//秒
}; };
timer1s.Tick += Tick_Event_1S; timer1s.Tick += Tick_Event_1S;
timer1s.Start(); timer1s.Start();
@@ -288,11 +288,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
public static bool UI; public static bool UI;
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{ {
if (UI) // if (UI)
{ // {
GanttChartNEW(); GanttChartNEW();
UI= false; // UI= false;
} // }
} }
} }
} }
+4 -4
View File
@@ -65,7 +65,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsHitTestVisible="False" x:Name="edit">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -73,7 +73,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Rename" IsEnabled="False" x:Name="Rename"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Rename" IsHitTestVisible="False" x:Name="Rename">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Rename" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Rename" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Rename}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Rename}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -81,7 +81,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Remark" IsEnabled="False" x:Name="Remark"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Remark" IsHitTestVisible="False" x:Name="Remark">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Note" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Note" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Remark}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Remark}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -89,7 +89,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsHitTestVisible="False" x:Name="Delete">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
+25 -21
View File
@@ -54,10 +54,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Programgroup_ID = (Grid.Columns[0].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列, Programgroup_ID = (Grid.Columns[0].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
Programgroup_Numder = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列, Programgroup_Numder = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
} }
edit.IsEnabled = true; edit.IsHitTestVisible = true;
Rename.IsEnabled = true; Rename.IsHitTestVisible = true;
Remark.IsEnabled = true; Remark.IsHitTestVisible = true;
Delete.IsEnabled = true; Delete.IsHitTestVisible = true;
} }
private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件 private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件
@@ -102,20 +102,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件 private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Rename.IsEnabled = false; Rename.IsHitTestVisible = false;
Remark.IsEnabled = false; Remark.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (Programgroup_ID == null) return; if (Programgroup_ID == null) return;
container.Content = new ProgramstepsView(); container.Content = new ProgramstepsView();
} }
private void ListViewItem_Rename(object sender, System.Windows.Input.MouseButtonEventArgs e)//重命名 private void ListViewItem_Rename(object sender, System.Windows.Input.MouseButtonEventArgs e)//重命名
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Rename.IsEnabled = false; Rename.IsHitTestVisible = false;
Remark.IsEnabled = false; Remark.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (Programgroup_ID == null) return; if (Programgroup_ID == null) return;
InputBox frm = new InputBox(); InputBox frm = new InputBox();
frm.Accept += new EventHandler(InputBox_Rename_accept); frm.Accept += new EventHandler(InputBox_Rename_accept);
@@ -130,9 +130,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Dictionary<string, object> Program_Rename = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Program_Rename = new Dictionary<string, object>();//缓存函数
Program_Rename.Add("ProgramName", VALUE); Program_Rename.Add("ProgramName", VALUE);
Program_Rename.Add("Groups", Group.Text); Program_Rename.Add("Groups", Group.Text);
MainWindowViewModel.SQLiteHelpers.Update("ProgramName", Program_Rename, "ProgramID='" + Programgroup_ID + "'", null); MainWindowViewModel.SQLiteHelpers.Update("ProgramName", Program_Rename, "ProgramID='" + Programgroup_ID + "'", null);
Dictionary<string, object> Program_Steps = new Dictionary<string, object>();//缓存函数
Program_Steps.Add("Program", VALUE);
MainWindowViewModel.SQLiteHelpers.Update("ProgramSteps", Program_Steps, "ProgramID='" + Programgroup_ID + "'", null);
Programgroup_sql(); Programgroup_sql();
Programgroup_Numder = null; Programgroup_Numder = null;
Programgroup_ID = null; Programgroup_ID = null;
@@ -140,10 +144,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_Remark(object sender, System.Windows.Input.MouseButtonEventArgs e)//备注 private void ListViewItem_Remark(object sender, System.Windows.Input.MouseButtonEventArgs e)//备注
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Rename.IsEnabled = false; Rename.IsHitTestVisible = false;
Remark.IsEnabled = false; Remark.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (Programgroup_ID == null) return; if (Programgroup_ID == null) return;
InputBox frm = new InputBox(); InputBox frm = new InputBox();
frm.Accept += new EventHandler(InputBox_Remark_accept); frm.Accept += new EventHandler(InputBox_Remark_accept);
@@ -167,10 +171,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除 private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Rename.IsEnabled = false; Rename.IsHitTestVisible = false;
Remark.IsEnabled = false; Remark.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (Programgroup_Numder == null) return; if (Programgroup_Numder == null) return;
///弹窗提示确认删除 ///弹窗提示确认删除
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + Programgroup_Numder, "Delete ", if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + Programgroup_Numder, "Delete ",
+105 -26
View File
@@ -11,18 +11,24 @@
d:DesignHeight="630" d:DesignWidth="1280"> d:DesignHeight="630" d:DesignWidth="1280">
<UserControl.Resources> <UserControl.Resources>
<ConvertMoels:RowToIndexConverter x:Key="RowToIndexConverter"/> <ConvertMoels:RowToIndexConverter x:Key="RowToIndexConverter"/>
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<DataGrid x:Name="Grid" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=90}" <DataGrid x:Name="Grid_step" AlternationCount="2" MouseDoubleClick="Grid_MouseDoubleClick"
PreviewMouseLeftButtonUp="Grid_PreviewMouseLeftButtonUp" MouseDoubleClick="Grid_MouseDoubleClick" MouseLeftButtonUp="Grid_PreviewMouseLeftButtonUp"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" BorderBrush="{x:Null}"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
Margin="0,0,0,60"> CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" CanUserAddRows="True">
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" /> <Setter Property="IsHitTestVisible" Value="{Binding DataContext.IsInteractive,
RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<Setter Property="Height" Value="100" />
<Setter Property="FontSize" Value="25" /> <Setter Property="FontSize" Value="25" />
<Style.Triggers> <Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0"> <Trigger Property="ItemsControl.AlternationIndex" Value="0">
@@ -32,42 +38,115 @@
<Setter Property="Background" Value="#FFF0F0F0" /> <Setter Property="Background" Value="#FFF0F0F0" />
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="False"/> <Trigger Property="IsMouseOver" Value="False"/>
<DataTrigger Binding="{Binding RUN}" Value="1">
<Setter Property="Background" Value="#FF00D6FF"/>
</DataTrigger>
<DataTrigger Binding="{Binding RUN}" Value="2">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding RUN}" Value="9">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</DataGrid.RowStyle> </DataGrid.RowStyle>
<DataGrid.CellStyle> <DataGrid.CellStyle>
<Style TargetType="DataGridCell"> <Style TargetType="{x:Type DataGridCell}">
<Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsSelected" Value="True"> <Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/> <Setter Property="Background" Value="#FF00D6FF"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/> <Setter Property="BorderBrush" Value="#FF00D6FF"/>
<Setter Property="Foreground" Value="Black"/> <Setter Property="Foreground" Value="Black"/>
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</DataGrid.CellStyle> </DataGrid.CellStyle>
<DataGrid.Columns> <DataGrid.Columns>
<!--列信息绑定--> <!--列信息绑定-->
<DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="60" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}"
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="100" Binding="{Binding StepID}" IsReadOnly="True"/> Width="80" IsReadOnly="True">
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="300" Binding="{Binding StepName}" IsReadOnly="True"/> <DataGridTextColumn.ElementStyle>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="*" Binding="{Binding ParameterName}" IsReadOnly="True"/> <Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepID}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepName}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding ParameterName}" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter6}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="100" IsReadOnly="True">
<DataGridTextColumn Binding="{Binding Parameter7}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTemplateColumn.CellTemplate>
<DataGridTextColumn Binding="{Binding Parameter8}" Width="0" MinWidth="0" MaxWidth="0"/> <DataTemplate>
<DataGridTextColumn Binding="{Binding Parameter9}" Width="0" MinWidth="0" MaxWidth="0"/> <Image Source="{Binding Path=StepID,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
<DataGridTextColumn Binding="{Binding Parameter10}" Width="0" MinWidth="0" MaxWidth="0"/> </DataTemplate>
<DataGridTextColumn Binding="{Binding StepTime}" Width="0" MinWidth="0" MaxWidth="0"/> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="600" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0,0,0.5">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.Function}"/>
<Run Text=":"/>
<Run Text="{Binding StepName}"/>
</TextBlock>
</Border>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0.5,0,0">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.ParameterSet}"/>
<Run Text=":"/>
<Run Text="{Binding ParameterName}"/>
</TextBlock>
</Border>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S1,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S2,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S3 ,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Remark}" Binding="{Binding Remark}"
Width="*" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<StackPanel x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,400,0"> <StackPanel x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,400,0">
@@ -80,7 +159,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsHitTestVisible="False" x:Name="edit">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -88,7 +167,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsEnabled="False" x:Name="Insert"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsHitTestVisible="False" x:Name="Insert">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="InsertComment" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="InsertComment" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -104,7 +183,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsHitTestVisible="False" x:Name="Delete">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
+214 -100
View File
@@ -1,4 +1,6 @@
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel; using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using SunlightCentralizedControlManagement_SCCM_.WindowsView; using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System; using System;
@@ -25,6 +27,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Xml.Linq; using System.Xml.Linq;
using TouchSocket.Core;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep; using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement;
@@ -47,8 +50,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Programgroup_sql(); Programgroup_sql();
} }
DataSet sql; //内存数据缓存 // DataSet sql; //内存数据缓存
DataTable Step;
string ProgramID; string ProgramID;
string ProgramNAME; string ProgramNAME;
string Numder = null; string Numder = null;
@@ -58,34 +61,25 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
public void Programgroup_sql() public void Programgroup_sql()
{ {
string sql_script = "select * from ProgramSteps where ProgramID='" + ProgramID + "' order by Step asc"; string sql_script = "select * from ProgramSteps where ProgramID='" + ProgramID + "' order by Step asc";
Step = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //读取计划表写入缓存
if (sql != null) sql.Clear(); //清空缓存 Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
sql = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
//sql.Tables[0].Rows.Add(datatable_t);
DataRow dr = sql.Tables[0].NewRow();//添加表数据
dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME;
sql.Tables[0].Rows.Add(dr);
Dat();
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
} }
public void Dat()//行号刷新 public void Dat(DataTable dat)//行号刷新
{ {
int a = sql.Tables[0].Rows.Count; int a = dat.Rows.Count;
for (int i = 0; i < a; i++) for (int i = 0; i < a; i++)
{ {
DataRow dr = sql.Tables[0].Rows[i]; DataRow dr = dat.Rows[i];
dr.BeginEdit(); dr.BeginEdit();
dr["Step"] = i + 1; dr["Step"] = i + 1;
dr.EndEdit(); dr.EndEdit();
} }
dat.AcceptChanges();
} }
private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面时的操作 private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面时的操作
{ {
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString();
Grid.SelectedIndex = Convert.ToInt32(ID)-1;
} }
public static T GetVisualChild<T>(Visual parent) where T : Visual public static T GetVisualChild<T>(Visual parent) where T : Visual
{ {
@@ -109,43 +103,83 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void Grid_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)//表格选择事件 private void Grid_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)//表格选择事件
{ {
edit.IsEnabled = true; edit.IsHitTestVisible = true;
Insert.IsEnabled = true; Insert.IsHitTestVisible = true;
Delete.IsEnabled = true; Delete.IsHitTestVisible = true;
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效 if (rownum != -1)//判断鼠标定位是否有效
{ {
ID = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列, ID = (Grid_step.Columns[2].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第0列,
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列, Numder = (Grid_step.Columns[3].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第1列,
P1 = (Grid.Columns[6].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第6列, P1 = (Grid_step.Columns[6].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第6列,
P2 = (Grid.Columns[7].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第7列, P2 = (Grid_step.Columns[7].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第7列,
P3 = (Grid.Columns[8].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第8列, P3 = (Grid_step.Columns[8].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第8列,
P4 = (Grid.Columns[9].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第9列, P4 = (Grid_step.Columns[9].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第9列,
P5 = (Grid.Columns[10].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第10列, P5 = (Grid_step.Columns[10].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第10列,
StepTime = (Grid.Columns[16].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;// StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
} }
} }
private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件 private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件
{ {
edit.IsEnabled = true; edit.IsHitTestVisible = true;
Insert.IsEnabled = true; Insert.IsHitTestVisible = true;
Delete.IsEnabled = true; Delete.IsHitTestVisible = true;
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效 if (rownum != -1)//判断鼠标定位是否有效
{ {
ID = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列, ID = (Grid_step.Columns[2].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第0列,
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列, Numder = (Grid_step.Columns[3].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第1列,
P1 = (Grid.Columns[6].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第6列, P1 = (Grid_step.Columns[6].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第6列,
P2 = (Grid.Columns[7].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第7列, P2 = (Grid_step.Columns[7].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第7列,
P3 = (Grid.Columns[8].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第8列, P3 = (Grid_step.Columns[8].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第8列,
P4 = (Grid.Columns[9].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第9列, P4 = (Grid_step.Columns[9].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第9列,
P5 = (Grid.Columns[10].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第10列, P5 = (Grid_step.Columns[10].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第10列,
StepTime = (Grid.Columns[16].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;// StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString(); if (string.IsNullOrEmpty(ID))
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); {
DataRow dr = Step.NewRow();//添加表数据
dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME;
dr["Parameter1"] = 0;
dr["Parameter2"] = 0;
dr["Parameter3"] = 0;
dr["Parameter4"] = 0;
dr["Parameter5"] = 0;
dr["Parameter6"] = 0;
dr["Parameter7"] = 0;
dr["Parameter8"] = 0;
dr["Parameter9"] = 0;
dr["Parameter10"] = 0;
dr["Parameter1_S1"] = 0;
dr["Parameter2_S1"] = 0;
dr["Parameter3_S1"] = 0;
dr["Parameter4_S1"] = 0;
dr["Parameter5_S1"] = 0;
dr["Parameter1_S2"] = 0;
dr["Parameter2_S2"] = 0;
dr["Parameter3_S2"] = 0;
dr["Parameter4_S2"] = 0;
dr["Parameter5_S2"] = 0;
dr["Parameter1_S3"] = 0;
dr["Parameter2_S3"] = 0;
dr["Parameter3_S3"] = 0;
dr["Parameter4_S3"] = 0;
dr["Parameter5_S3"] = 0;
dr["StepName_S1"] = " ";
dr["StepName_S2"] = " ";
dr["StepName_S3"] = " ";
dr["StepID_S1"] = "000";
dr["StepID_S2"] = "000";
dr["StepID_S3"] = "000";
Step.Rows.InsertAt(dr, Step.Rows.Count);
Dat(Step);
ID = (Step.Rows.Count).ToString();
}
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -159,46 +193,76 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件 private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Insert.IsEnabled = false; Insert.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString(); if (string.IsNullOrEmpty(ID))
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); {
DataRow dr = Step.NewRow();//添加表数据
dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME;
dr["Parameter1"] = 0;
dr["Parameter2"] = 0;
dr["Parameter3"] = 0;
dr["Parameter4"] = 0;
dr["Parameter5"] = 0;
dr["Parameter6"] = 0;
dr["Parameter7"] = 0;
dr["Parameter8"] = 0;
dr["Parameter9"] = 0;
dr["Parameter10"] = 0;
dr["Parameter1_S1"] = 0;
dr["Parameter2_S1"] = 0;
dr["Parameter3_S1"] = 0;
dr["Parameter4_S1"] = 0;
dr["Parameter5_S1"] = 0;
dr["Parameter1_S2"] = 0;
dr["Parameter2_S2"] = 0;
dr["Parameter3_S2"] = 0;
dr["Parameter4_S2"] = 0;
dr["Parameter5_S2"] = 0;
dr["Parameter1_S3"] = 0;
dr["Parameter2_S3"] = 0;
dr["Parameter3_S3"] = 0;
dr["Parameter4_S3"] = 0;
dr["Parameter5_S3"] = 0;
dr["StepName_S1"] = " ";
dr["StepName_S2"] = " ";
dr["StepName_S3"] = " ";
dr["StepID_S1"] = "000";
dr["StepID_S2"] = "000";
dr["StepID_S3"] = "000";
Step.Rows.InsertAt(dr, Step.Rows.Count);
Dat(Step);
ID = Step.Rows.Count.ToString();
}
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
} }
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果 private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
{ {
int i = sql.Tables[0].Rows.Count; int i = Step.Rows.Count;
int n = StrToInt.To16Convert10(ID); int n = Convert.ToInt16(ID);
if (i == n)
{
DataRow dr_ = sql.Tables[0].NewRow();//添加表数据
dr_["ProgramID"] = ProgramID;
dr_["Program"] = ProgramNAME;
sql.Tables[0].Rows.Add(dr_);
Dat();
ID = (n + 1).ToString();
}
int steptime=0;//时间秒 int steptime = 0;//时间秒
string[] time_D = { "001", "013", "015", "017", "065" }; string[] time_D = { "001", "013", "015", "017", "065" };
string[] time_J = { "031", "093" }; string[] time_J = { "031", "093" };
string[] time_T = { "054", "055","056" }; string[] time_T = { "054", "055", "056" };
foreach (var item in time_D) foreach (var item in time_D)
{ {
if (item == e.StepID) if (item == e.StepID)
{ {
steptime = Convert.ToUInt16(e.P3)*60; steptime = Convert.ToUInt16(e.Row_DAT.Field<double>("Parameter3")) * 60;
} }
} }
foreach (var item in time_J) foreach (var item in time_J)
{ {
if (item == e.StepID) if (item == e.StepID)
{ {
steptime = Convert.ToUInt16(e.P1) * 60; steptime = Convert.ToUInt16(e.Row_DAT.Field<double>("Parameter1")) * 60;
} }
} }
foreach (var item in time_T) foreach (var item in time_T)
@@ -208,59 +272,112 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
steptime = 5; steptime = 5;
} }
} }
if (steptime==0) if (steptime == 0)
{ {
steptime = 300; steptime = 300;
} }
DataRow dr = sql.Tables[0].Rows[n - 1]; DataRow dr = Step.Rows[n - 1];
dr.BeginEdit(); dr.BeginEdit();
dr["StepID"] = e.StepID; dr["StepID"] = e.StepID;
dr["StepName"] = e.StepNAME; dr["StepName"] = e.StepNAME;
dr["ParameterName"] = e.PNAME; dr["ParameterName"] = e.PNAME;
dr["Parameter1"] = e.P1; dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter2"] = e.P2; dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter2");
dr["Parameter3"] = e.P3; dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter3");
dr["Parameter4"] = e.P4; dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter4");
dr["Parameter5"] = e.P5; dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter5");
dr["StepTime"] =steptime;// dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
dr["Parameter4_S1"] = e.Row_DAT.Field<double>("Parameter4_S1");
dr["Parameter5_S1"] = e.Row_DAT.Field<double>("Parameter5_S1");
dr["Parameter1_S2"] = e.Row_DAT.Field<double>("Parameter1_S2");
dr["Parameter2_S2"] = e.Row_DAT.Field<double>("Parameter2_S2");
dr["Parameter3_S2"] = e.Row_DAT.Field<double>("Parameter3_S2");
dr["Parameter4_S2"] = e.Row_DAT.Field<double>("Parameter4_S2");
dr["Parameter5_S2"] = e.Row_DAT.Field<double>("Parameter5_S2");
dr["Parameter1_S3"] = e.Row_DAT.Field<double>("Parameter1_S3");
dr["Parameter2_S3"] = e.Row_DAT.Field<double>("Parameter2_S3");
dr["Parameter3_S3"] = e.Row_DAT.Field<double>("Parameter3_S3");
dr["Parameter4_S3"] = e.Row_DAT.Field<double>("Parameter4_S3");
dr["Parameter5_S3"] = e.Row_DAT.Field<double>("Parameter5_S3");
dr["StepName_S1"] = e.Row_DAT.Field<string>("StepName_S1");
dr["StepName_S2"] = e.Row_DAT.Field<string>("StepName_S2");
dr["StepName_S3"] = e.Row_DAT.Field<string>("StepName_S3");
dr["StepID_S1"] = e.Row_DAT.Field<string>("StepID_S1");
dr["StepID_S2"] = e.Row_DAT.Field<string>("StepID_S2");
dr["StepID_S3"] = e.Row_DAT.Field<string>("StepID_S3");
dr["StepTime"] = steptime;//
dr.EndEdit(); dr.EndEdit();
Grid.ItemsSource = sql.Tables[0].DefaultView; Grid_step.ItemsSource = Step.DefaultView;
} }
private void ListViewItem_Insert(object sender, System.Windows.Input.MouseButtonEventArgs e)//插入事件 private void ListViewItem_Insert(object sender, System.Windows.Input.MouseButtonEventArgs e)//插入事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Insert.IsEnabled = false; Insert.IsHitTestVisible = false;
Delete.IsEnabled = false; int d = 0; Delete.IsHitTestVisible = false;
int d = 0;
if (ID != null) { d = Convert.ToInt32(ID); } else { return; } if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
DataRow dr = sql.Tables[0].NewRow();//添加表数据 DataRow dr = Step.NewRow();//添加表数据
dr["ProgramID"] = ProgramID; dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME; dr["Program"] = ProgramNAME;
sql.Tables[0].Rows.InsertAt(dr, d - 1); dr["Parameter1"] = 0;
dr["Parameter2"] = 0;
dr["Parameter3"] = 0;
dr["Parameter4"] = 0;
dr["Parameter5"] = 0;
dr["Parameter6"] = 0;
dr["Parameter7"] = 0;
dr["Parameter8"] = 0;
dr["Parameter9"] = 0;
dr["Parameter10"] = 0;
dr["Parameter1_S1"] = 0;
dr["Parameter2_S1"] = 0;
dr["Parameter3_S1"] = 0;
dr["Parameter4_S1"] = 0;
dr["Parameter5_S1"] = 0;
dr["Parameter1_S2"] = 0;
dr["Parameter2_S2"] = 0;
dr["Parameter3_S2"] = 0;
dr["Parameter4_S2"] = 0;
dr["Parameter5_S2"] = 0;
dr["Parameter1_S3"] = 0;
dr["Parameter2_S3"] = 0;
dr["Parameter3_S3"] = 0;
dr["Parameter4_S3"] = 0;
dr["Parameter5_S3"] = 0;
dr["StepName_S1"] = " ";
dr["StepName_S2"] = " ";
dr["StepName_S3"] = " ";
dr["StepID_S1"] = "000";
dr["StepID_S2"] = "000";
dr["StepID_S3"] = "000";
Step.Rows.InsertAt(dr, d - 1);
ID = null; ID = null;
Dat(); Dat(Step);
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表 Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
} }
private void ListViewItem_Save(object sender, System.Windows.Input.MouseButtonEventArgs e)//保存事件 private void ListViewItem_Save(object sender, System.Windows.Input.MouseButtonEventArgs e)//保存事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Insert.IsEnabled = false; Insert.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
int r = 0; int r = 0;
MainWindowViewModel.SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '" + ProgramID + "'", null); MainWindowViewModel.SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '" + ProgramID + "'", null);
DataTable data_t = new DataTable(); DataTable data_t = new DataTable();
data_t = sql.Tables[0].Clone(); data_t = Step.Clone();
int a = sql.Tables[0].Rows.Count; int a = Step.Rows.Count;
for (int i = 0; i < a - 1; i++) for (int i = 0; i < a ; i++)
{ {
data_t.Clear();//清空 data_t.Clear();//清空
DataRow dt = sql.Tables[0].Rows[i];//行转换 DataRow dt = Step.Rows[i];//行转换
DataRow dr = data_t.NewRow(); DataRow dr = data_t.NewRow();
dr.ItemArray = dt.ItemArray; dr.ItemArray = dt.ItemArray;
data_t.Rows.InsertAt(dr, 0); data_t.Rows.InsertAt(dr, 0);
@@ -268,7 +385,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
r = MainWindowViewModel.SQLiteHelpers.InsertData("ProgramSteps", MainWindowViewModel.SQLiteHelpers.DataTableToDictionary(data_t));//行插入 r = MainWindowViewModel.SQLiteHelpers.InsertData("ProgramSteps", MainWindowViewModel.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
} }
int time =Convert.ToUInt16( sql.Tables[0].Compute("sum(StepTime)", ""))/60; int time =Convert.ToUInt16( Step.Compute("sum(StepTime)", ""))/60;
string time_ =DateTime.Parse( TimeSpan.FromMinutes(time).ToString()).ToString("HH:mm");// DateTime.Parse(time.ToString()).ToString("HH:mm"); string time_ =DateTime.Parse( TimeSpan.FromMinutes(time).ToString()).ToString("HH:mm");// DateTime.Parse(time.ToString()).ToString("HH:mm");
Dictionary<string, object> Program_Step = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Program_Step = new Dictionary<string, object>();//缓存函数
Program_Step.Add("Step", a - 1); Program_Step.Add("Step", a - 1);
@@ -284,20 +401,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除事件 private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Insert.IsEnabled = false; Insert.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
int d = 0; int a = Step.Rows.Count;
int a = sql.Tables[0].Rows.Count; int rownum = Grid_step.SelectedIndex;
if (rownum >= 0 && rownum<a)
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
if (a != d)//如果删除不是最后一行执行
{ {
sql.Tables[0].Rows.RemoveAt(d - 1); Step.Rows.RemoveAt(rownum);
Dat(Step);
Dat(); Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
} }
} }
+17 -21
View File
@@ -90,7 +90,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
CrosshairSnapEnabled = true, CrosshairSnapEnabled = true,
Position = LiveChartsCore.Measure.AxisPosition.End Position = LiveChartsCore.Measure.AxisPosition.End
}, //液位轴 }, //液位轴
new Axis // /* new Axis //
{ {
MinLimit =0, MinLimit =0,
MaxLimit =14, MaxLimit =14,
@@ -106,10 +106,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
DrawTicksPath = true, DrawTicksPath = true,
CrosshairSnapEnabled = true, CrosshairSnapEnabled = true,
Position = LiveChartsCore.Measure.AxisPosition.End Position = LiveChartsCore.Measure.AxisPosition.End
}, //PH轴 },*/ //PH轴
}; };
private static Random _r = new Random();
private static ObservableCollection<DateTimePoint> MTT_values; private static ObservableCollection<DateTimePoint> MTT_values;
private static ObservableCollection<DateTimePoint> MTL_values; private static ObservableCollection<DateTimePoint> MTL_values;
private static ObservableCollection<DateTimePoint> MTH_values; private static ObservableCollection<DateTimePoint> MTH_values;
@@ -121,9 +120,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
private static ObservableCollection<DateTimePoint> STLB_values; private static ObservableCollection<DateTimePoint> STLB_values;
private static ObservableCollection<DateTimePoint> STTC_values; private static ObservableCollection<DateTimePoint> STTC_values;
private static ObservableCollection<DateTimePoint> STLC_values; private static ObservableCollection<DateTimePoint> STLC_values;
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
private static string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
static DataTable CDB = new DataTable(); static DataTable CDB = new DataTable();
private static int CDB_Count;//长度 private static int CDB_Count;//长度
@@ -136,10 +132,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
if (mode) if (mode)
{ {
if (string.IsNullOrEmpty(w)) return; if (string.IsNullOrEmpty(w)) return;
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径 CDB = MainWindowViewModel.SQLiteChartAdress.ExecuteDataSet("select * from Chart where WorkOrder = '" + w + "'order by Time", null).Tables[0];
SQLiteHelpers.Open(); //打开数据库
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where WorkOrder = '" + w + "'order by Time", null).Tables[0];
SQLiteHelpers.Close();
} }
else else
@@ -147,18 +140,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
if (string.IsNullOrEmpty(m)) return; if (string.IsNullOrEmpty(m)) return;
if (string.IsNullOrEmpty(s)) return; if (string.IsNullOrEmpty(s)) return;
if (string.IsNullOrEmpty(e)) return; if (string.IsNullOrEmpty(e)) return;
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径 // SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库 // SQLiteHelpers.Open(); //打开数据库
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where Machine = '" + m + "'" + CDB = MainWindowViewModel.SQLiteChartAdress.ExecuteDataSet("select * from Chart where Machine = '" + m + "'" +
" and Time > '" + s + "' and Time < '" + e + "' order by Time", null).Tables[0]; " and Time > '" + s + "' and Time < '" + e + "' order by Time", null).Tables[0];
SQLiteHelpers.Close(); // SQLiteHelpers.Close();
} }
CDB_Count = CDB.Rows.Count; CDB_Count = CDB.Rows.Count;
var MTT_items = new List<DateTimePoint>(); var MTT_items = new List<DateTimePoint>();
var MTL_items = new List<DateTimePoint>(); var MTL_items = new List<DateTimePoint>();
var MTH_items = new List<DateTimePoint>(); // var MTH_items = new List<DateTimePoint>();
var MST_items = new List<DateTimePoint>(); var MST_items = new List<DateTimePoint>();
var MUT_items = new List<DateTimePoint>(); var MUT_items = new List<DateTimePoint>();
var STTA_items = new List<DateTimePoint>(); var STTA_items = new List<DateTimePoint>();
@@ -167,12 +160,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
var STLB_items = new List<DateTimePoint>(); var STLB_items = new List<DateTimePoint>();
var STTC_items = new List<DateTimePoint>(); var STTC_items = new List<DateTimePoint>();
var STLC_items = new List<DateTimePoint>(); var STLC_items = new List<DateTimePoint>();
for (var i = 0; i < CDB_Count; i++) for (var i = 0; i < CDB_Count; i=i+4)
{
try
{ {
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time")); DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT"))); MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT")));
MTL_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTL"))); MTL_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTL")));
MTH_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTH"))); // MTH_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTH")));
MST_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MST"))); MST_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MST")));
MUT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MUT"))); MUT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MUT")));
STTA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTA"))); STTA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTA")));
@@ -181,12 +176,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
STLB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLB"))); STLB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLB")));
STTC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTC"))); STTC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTC")));
STLC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLC"))); STLC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLC")));
}
catch (Exception) { }
} }
MTT_values = new ObservableCollection<DateTimePoint>(MTT_items); MTT_values = new ObservableCollection<DateTimePoint>(MTT_items);
MTL_values = new ObservableCollection<DateTimePoint>(MTL_items); MTL_values = new ObservableCollection<DateTimePoint>(MTL_items);
MTH_values = new ObservableCollection<DateTimePoint>(MTH_items); // MTH_values = new ObservableCollection<DateTimePoint>(MTH_items);
MST_values = new ObservableCollection<DateTimePoint>(MST_items); MST_values = new ObservableCollection<DateTimePoint>(MST_items);
MUT_values = new ObservableCollection<DateTimePoint>(MUT_items); MUT_values = new ObservableCollection<DateTimePoint>(MUT_items);
STTA_values = new ObservableCollection<DateTimePoint>(STTA_items); STTA_values = new ObservableCollection<DateTimePoint>(STTA_items);
@@ -198,7 +194,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
Series = new ISeries[] Series = new ISeries[]
{ {
new LineSeries<DateTimePoint> /* new LineSeries<DateTimePoint>
{ {
Name = Properties.Resources.MasterCylinder +"PH", Name = Properties.Resources.MasterCylinder +"PH",
Values = MTH_values, Values = MTH_values,
@@ -208,7 +204,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
Fill = null, Fill = null,
LineSmoothness = 0, LineSmoothness = 0,
ScalesYAt = 2, ScalesYAt = 2,
}, //PH }, *///PH
new LineSeries<DateTimePoint> new LineSeries<DateTimePoint>
{ {
Name = Resources.Target + Resources.Temperature, Name = Resources.Target + Resources.Temperature,
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -11,7 +11,7 @@
Title="SUNLIGHT" Title="SUNLIGHT"
Height="150" Width="400"> Height="150" Width="400">
<Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}"> <Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}">
<TextBox x:Name="Boxx" Height="40" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26" <TextBox x:Name="Boxx" Height="50" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26"
MaxLines="1" BorderThickness="3,3,3,3" ClipToBounds="True"/> MaxLines="1" BorderThickness="3,3,3,3" ClipToBounds="True"/>
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/> <Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/> <Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
+23
View File
@@ -0,0 +1,23 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.UserInf"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
WindowStartupLocation="CenterScreen"
Loaded ="Window_Loaded"
ResizeMode="NoResize"
mc:Ignorable="d"
Title="SUNLIGHT 800" Height="400" Width="800">
<Grid>
<Grid Margin="0,0,0,100">
<TextBox x:Name="INF_DATA" Margin="140,20,20,20" TextWrapping="Wrap" FontSize="30" IsReadOnly="True" BorderBrush="#FF673AB7" BorderThickness="2,2,2,2" Cursor="Hand" />
<Image Height="100" Width="100" FlowDirection="LeftToRight" HorizontalAlignment="Left" Margin="20,0,0,0" Source="/Lmage/IconParkInfo.png" VerticalAlignment="Center"/>
</Grid>
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="45" Margin="50,70,20,20"
VerticalAlignment="Bottom" Width="100" Click="YES_Click" HorizontalContentAlignment="Center"/>
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="45" Margin="50,70,20,20"
VerticalAlignment="Bottom" Width="100" Click="YES_Click"/>
</Grid>
</Window>
+47
View File
@@ -0,0 +1,47 @@
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
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.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Xml.Linq;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
{
/// <summary>
/// ViewProgram.xaml 的交互逻辑
/// </summary>
public partial class UserInf : Window
{
public string Inf_DAT;//信息
public UserInf()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
INF_DATA.Text = Inf_DAT;
}
private void YES_Click(object sender, RoutedEventArgs e)//确认
{
this.Close(); //关闭窗口
}
}
}
+93
View File
@@ -0,0 +1,93 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.UserWorkOrder"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
WindowStartupLocation="CenterScreen"
Loaded ="Window_Loaded"
ResizeMode="NoResize"
mc:Ignorable="d"
Title="SUNLIGHT 800" Height="400" Width="800">
<Grid>
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="WorkOrder" AlternationCount="2" IsReadOnly="True"
SelectedCellsChanged="WorkOrder_SelectedCellsChanged" EnableRowVirtualization="True" EnableColumnVirtualization="True"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" AutoGenerateColumns="False" MinColumnWidth="30"
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="True"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" Margin="0,0,0,132" >
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="25" />
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
<DataTrigger Binding="{Binding lock}" Value="True">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="309">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="308">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="800">
<Setter Property="IsHitTestVisible" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Resources>
<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ProgramName}" Binding="{Binding ProgramName}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.StartTime}" Binding="{Binding StartTime}" Width="250" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Machines}" Binding="{Binding Machines}" Width="100" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ColorNumber}" Binding="{Binding ColorNumber}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Client}" Binding="{Binding Client}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ClothWeight}" Binding="{Binding ClothWeight}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ClothSpecies}" Binding="{Binding ClothSpecies}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.BathRatio}" Binding="{Binding BathRatio}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Total}" Binding="{Binding Total}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.USER}" Binding="{Binding USER}" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ColorName}" Binding="{Binding ColorName}" Width="200" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
<Image Height="100" Width="100" FlowDirection="LeftToRight" HorizontalAlignment="Left" Margin="20,0,0,20" Source="/Lmage/IconParkInfo.png" VerticalAlignment="Bottom"/>
<Button Content="{x:Static lang:Resources.Start}" HorizontalAlignment="Right" Height="45" Margin="50,70,200,20" IsEnabled="False" x:Name="Start"
VerticalAlignment="Bottom" Width="100" Click="Start_Click" HorizontalContentAlignment="Center"/>
<Button Content="{x:Static lang:Resources.Quit}" HorizontalAlignment="Right" Height="45" Margin="50,70,20,20"
VerticalAlignment="Bottom" Width="100" Click="Quit_Click" HorizontalContentAlignment="Center"/>
</Grid>
</Window>
+139
View File
@@ -0,0 +1,139 @@
using ScottPlot.TickGenerators.TimeUnits;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
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.Forms;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Xml.Linq;
using TouchSocket.Core;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
{
/// <summary>
/// ViewProgram.xaml 的交互逻辑
/// </summary>
public partial class UserWorkOrder : Window
{
public DataTable WorkOrderTable = new DataTable();//信息
private string WorkOrder_=null;
private string machine_ = null;
public UserWorkOrder()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
WorkOrder.ItemsSource = WorkOrderTable.DefaultView;
}
private void Start_Click(object sender, RoutedEventArgs e)//确认
{
Dictionary<string, object> dat_821 = new Dictionary<string, object>();
dat_821.Clear();
dat_821.Add("INSTRUCTION", "START");
dat_821.Add("WorkOrder", WorkOrder_);
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine_ + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
string dat = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString();
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
if (drEmployee.Field<bool>("Type"))
{//网络
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{
ID = index,
DAT = dat
});
}
else
{//串口
if (drEmployee.Field<string>("Serial") == "PORT1")
{
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat);
if (!exists)
{
stringQueueSerial_1.Enqueue(new QueueSerial
{
ID = index,
DAT = dat
});
}
}
else if (drEmployee.Field<string>("Serial") == "PORT2")
{
bool exists = stringQueueSerial_2.Any(item => item.ID == index && item.DAT == dat);
if (!exists)
{
stringQueueSerial_2.Enqueue(new QueueSerial
{
ID = index,
DAT = dat
});
}
}
else if (drEmployee.Field<string>("Serial") == "PORT3")
{
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat);
if (!exists)
{
stringQueueSerial_3.Enqueue(new QueueSerial
{
ID = index,
DAT = dat
});
}
}
else if (drEmployee.Field<string>("Serial") == "PORT4")
{
bool exists = stringQueueSerial_4.Any(item => item.ID == index && item.DAT == dat);
if (!exists)
{
stringQueueSerial_4.Enqueue(new QueueSerial
{
ID = index,
DAT = dat
});
}
}
}
}
this.Close();
}
private void Quit_Click(object sender, RoutedEventArgs e)//退出
{
this.Close(); //关闭窗口
}
private void WorkOrder_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
{
int rownum = WorkOrder.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
WorkOrder_ = (WorkOrder.Columns[0].GetCellContent(WorkOrder.Items[rownum]) as TextBlock).Text;//定位第0列,
machine_ = (WorkOrder.Columns[3].GetCellContent(WorkOrder.Items[rownum]) as TextBlock).Text;//定位第0列,
Start.IsEnabled = true;
}
}
}
}
+138 -25
View File
@@ -5,36 +5,149 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView" xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties" xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d" mc:Ignorable="d"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
ResizeMode="NoResize" ResizeMode="NoResize"
Title="SUNLIGHT 800" Height="400" Width="400"> WindowStyle="None"
<Grid FocusManager.FocusedElement="{Binding ElementName=boxNAME}"> Title="SUNLIGHT 800" Height="800" Width="600">
<TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30" Margin="10,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE"/> <Grid>
<TextBlock Text="{x:Static lang:Resources.Function}" HorizontalAlignment="Left" Height="30" Margin="10,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE"/> <Grid.RowDefinitions>
<ComboBox x:Name="boxID" HorizontalAlignment="Right" Height="30" Margin="0,60,10,0" VerticalAlignment="Top" Width="230" FontSize="18" SelectionChanged="BoxID_SelectionChanged" BorderBrush="#FF5100E0"/> <RowDefinition Height="300"/>
<TextBox x:Name="boxNAME" HorizontalAlignment="Right" Height="30" Margin="0,20,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" ToolTip="code" <RowDefinition/>
TextChanged="TextBox_TextChanged" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="18" HorizontalContentAlignment="Left" MaxLength="3" CaretBrush="#FF5100E0" BorderBrush="#FF5100E0"/> <RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Border Grid.Row="1" BorderThickness="5,5,5,5" BorderBrush="#FFABABAB"/>
<Grid Grid.Row="0">
<TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30"
Margin="210,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150"
FontSize="20" Background="#FFEFEEEE"/>
<TextBlock Text="{x:Static lang:Resources.Function}" HorizontalAlignment="Left" Height="30"
Margin="210,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150"
FontSize="20" Background="#FFEFEEEE"/>
<ComboBox x:Name="boxID" HorizontalAlignment="Right" Height="30" Margin="0,60,10,0"
VerticalAlignment="Top" Width="230" FontSize="20" SelectionChanged="BoxID_SelectionChanged"/>
<TextBox x:Name="boxNAME" HorizontalAlignment="Right" Height="30" Margin="0,20,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
TextChanged="TextBox_TextChanged" PreviewTextInput="Tb_KeyPress"
InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"/>
<Image x:Name="imageP" HorizontalAlignment="Left" Height="200" Margin="10,20,0,0" VerticalAlignment="Top" Width="200">
<Image.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
</Image.OpacityMask>
</Image>
<TextBlock x:Name="P1N" HorizontalAlignment="Left" Height="30" Margin="210,120,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P1" HorizontalAlignment="Right" Height="30" Margin="0,120,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP1" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P1_TextChanged"/>
<TextBlock x:Name="P2N" HorizontalAlignment="Left" Height="30" Margin="210,155,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P2" HorizontalAlignment="Right" Height="30" Margin="0,155,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP2" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P2_TextChanged"/>
<TextBlock x:Name="P3N" HorizontalAlignment="Left" Height="30" Margin="210,190,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P3" HorizontalAlignment="Right" Height="30" Margin="0,190,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP3" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P3_TextChanged"/>
<TextBlock x:Name="P4N" HorizontalAlignment="Left" Height="30" Margin="210,225,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P4" HorizontalAlignment="Right" Height="30" Margin="0,225,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P4_TextChanged"/>
<TextBlock x:Name="P5N" HorizontalAlignment="Left" Height="30" Margin="210,260,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P5" HorizontalAlignment="Right" Height="30" Margin="0,260,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P5_TextChanged"/>
</Grid>
<TextBlock x:Name="P1N" HorizontalAlignment="Left" Height="30" Margin="10,120,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> <Grid Grid.Row="1">
<TextBox x:Name="P1" HorizontalAlignment="Right" Height="30" Margin="0,120,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <TextBlock x:Name="Sub" Text="{x:Static lang:Resources.Subroutine}" HorizontalAlignment="Left"
Text="0" PreviewTextInput="Tb_KeyP1" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Height="40" Margin="210,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="360"
<TextBlock x:Name="P2N" HorizontalAlignment="Left" Height="30" Margin="10,155,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> FontSize="25" Background="#FFEFEEEE"/>
<TextBox x:Name="P2" HorizontalAlignment="Right" Height="30" Margin="0,155,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <Image x:Name="imageP1" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125"
Text="0" PreviewTextInput="Tb_KeyP2" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Margin="20,10,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4"
<TextBlock x:Name="P3N" HorizontalAlignment="Left" Height="30" Margin="10,190,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> MouseLeftButtonDown="imageP1_MouseLeftButtonDown" MouseLeftButtonUp="imageP1_MouseLeftButtonUp"/>
<TextBox x:Name="P3" HorizontalAlignment="Right" Height="30" Margin="0,190,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <Image x:Name="imageP2" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125"
Text="0" PreviewTextInput="Tb_KeyP3" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Margin="20,145,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4"
<TextBlock x:Name="P4N" HorizontalAlignment="Left" Height="30" Margin="10,225,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> MouseLeftButtonDown="imageP2_MouseLeftButtonDown" MouseLeftButtonUp="imageP2_MouseLeftButtonUp"/>
<TextBox x:Name="P4" HorizontalAlignment="Right" Height="30" Margin="0,225,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <Image x:Name="imageP3" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125"
Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Margin="20,280,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4"
<TextBlock x:Name="P5N" HorizontalAlignment="Left" Height="30" Margin="10,260,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> MouseLeftButtonDown="imageP3_MouseLeftButtonDown" MouseLeftButtonUp="imageP3_MouseLeftButtonUp"/>
<TextBox x:Name="P5" HorizontalAlignment="Right" Height="30" Margin="0,260,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30"
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Margin="210,70,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150"
FontSize="20" Background="#FFEFEEEE"/>
<TextBlock Text="{x:Static lang:Resources.Function}" HorizontalAlignment="Left" Height="30"
Margin="210,110,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150"
FontSize="20" Background="#FFEFEEEE"/>
<ComboBox x:Name="boxIDp" HorizontalAlignment="Right" Height="30" Margin="0,110,10,0"
VerticalAlignment="Top" Width="230" FontSize="20" SelectionChanged="boxIDp_SelectionChanged"/>
<TextBox x:Name="boxNAMEp" HorizontalAlignment="Right" Height="30" Margin="0,70,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
IsReadOnly="True" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"
TextChanged="TextBoxp_TextChanged" />
<TextBlock x:Name="P1NP" HorizontalAlignment="Left" Height="30" Margin="210,170,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P1P" HorizontalAlignment="Right" Height="30" Margin="0,170,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP1p"
TextChanged="P1P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P2NP" HorizontalAlignment="Left" Height="30" Margin="210,205,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P2P" HorizontalAlignment="Right" Height="30" Margin="0,205,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP2p"
TextChanged="P2P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P3NP" HorizontalAlignment="Left" Height="30" Margin="210,240,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P3P" HorizontalAlignment="Right" Height="30" Margin="0,240,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP3p"
TextChanged="P3P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P4NP" HorizontalAlignment="Left" Height="30" Margin="210,275,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P4P" HorizontalAlignment="Right" Height="30" Margin="0,275,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP4p"
TextChanged="P4P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P5NP" HorizontalAlignment="Left" Height="30" Margin="210,310,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P5P" HorizontalAlignment="Right" Height="30" Margin="0,310,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP5p"
TextChanged="P5P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
</Grid>
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click" Background="#FF5100E0"/> <Button Grid.Row="2" x:Name="yes" Content="{x:Static lang:Resources.YES}"
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click" Background="#FF5100E0"/> HorizontalAlignment="Right" Height="35" Margin="0,0,200,5"
VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
<Button Grid.Row="2" x:Name="no" Content="{x:Static lang:Resources.NO}"
HorizontalAlignment="Right" Height="35" Margin="0,0,50,5"
VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
</Grid> </Grid>
</Window> </Window>
+1277 -113
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB