Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb2828aab0 | ||
|
|
33b970eff9 | ||
|
|
5caf92be59 | ||
|
|
437b8957ce | ||
|
|
a68fb9ae01 | ||
|
|
68b98ac7e4 | ||
|
|
2329ac9abc | ||
|
|
b062420be1 | ||
|
|
a248c41163 | ||
|
|
2b676adbba | ||
|
|
00a5cd3ec7 | ||
|
|
abfcf6e36a | ||
|
|
1df7212414 | ||
|
|
751a2b092f | ||
|
|
8a5e0ecfd9 | ||
|
|
ebcd5b7182 | ||
|
|
7f905617fa | ||
|
|
54d8cc7266 | ||
|
|
33e83fa5d6 | ||
|
|
927c38853d | ||
|
|
552d45485d | ||
|
|
17a5d6b718 | ||
|
|
34d3e6c292 | ||
|
|
5b60ea4765 | ||
|
|
b2817d1b01 | ||
|
|
7403914ba5 | ||
|
|
878d49c4a0 | ||
|
|
e457b0ab21 | ||
|
|
b0ce5bc8f9 | ||
|
|
d3375fd6ac | ||
|
|
7671f0ef08 | ||
|
|
25e6ae1563 | ||
|
|
e020333b82 | ||
|
|
8914ea3660 | ||
|
|
c1da97611d | ||
|
|
daaa2b5514 | ||
|
|
2c40ac5be0 | ||
|
|
21500886f0 | ||
|
|
c5e1978f6a | ||
|
|
9a374a0a87 | ||
|
|
f9949c5ec5 | ||
|
|
91212f03d2 | ||
|
|
31a84a640d | ||
|
|
9bdf575674 | ||
|
|
8adea70012 | ||
|
|
3f9730507e | ||
|
|
7fad98f58b | ||
|
|
61dbaa3c33 | ||
|
|
5e063092cf | ||
|
|
574f468a5e | ||
|
|
e9f83ea182 | ||
|
|
ab5dfa85e1 | ||
|
|
8512e720dd | ||
|
|
81ab1623ba | ||
|
|
6cbed8fa62 | ||
|
|
60baf3554a | ||
|
|
1ef9b8517c | ||
|
|
d5042d92ff | ||
|
|
4a1c5b7eac | ||
|
|
896c2bdf9c | ||
|
|
99217977ec | ||
|
|
8d0b37f0e2 | ||
|
|
898cde7329 | ||
|
|
4cf411dc10 | ||
|
|
3c5e8cd129 | ||
|
|
818d0e5a3a | ||
|
|
e2b48ecc84 | ||
|
|
2c0f06a83a | ||
|
|
a1b128757d | ||
|
|
7c744f72f6 | ||
|
|
7177673a4c | ||
|
|
a0ac4e094c | ||
|
|
d85d458edb | ||
|
|
4f9195c552 | ||
|
|
ec6bab3b56 | ||
|
|
11b9b99d3e | ||
|
|
13c64092a0 | ||
|
|
48eb8a0ad1 | ||
|
|
9c10e1c2cc | ||
|
|
baa921ea20 | ||
|
|
0c5666ddd4 | ||
|
|
157666d836 | ||
|
|
ab655a94e0 | ||
|
|
4af9042d5f | ||
|
|
fc799a2510 | ||
|
|
22c061db9e | ||
|
|
737c5e7e71 | ||
|
|
6120fe283a | ||
|
|
cedd2c189b | ||
|
|
379db4b738 | ||
|
|
908a7ce56e | ||
|
|
243cb6126b | ||
|
|
963f514bac | ||
|
|
2120a1e1ea | ||
|
|
5b8aa656e4 | ||
|
|
0311582679 | ||
|
|
951765de9a | ||
|
|
70b04e0892 | ||
|
|
151251586c | ||
|
|
8ade983214 | ||
|
|
e3370c0b63 | ||
|
|
8091b3dcc4 | ||
|
|
ff4ab5b349 | ||
|
|
206204711b | ||
|
|
aeaba92942 | ||
|
|
6e690b78b7 | ||
|
|
4d6619944c | ||
|
|
acdfc68def | ||
|
|
b307aa433c | ||
|
|
c235d91a8b | ||
|
|
72d513fdfe | ||
|
|
7ba38facc2 | ||
|
|
d3583311e2 | ||
|
|
8b7593dceb | ||
|
|
3ba1a7e6c4 | ||
|
|
4449530bb7 | ||
|
|
6bfef306be | ||
|
|
e4e7853624 | ||
|
|
7416bc332b | ||
|
|
435a54a61a | ||
|
|
54d6ddd918 | ||
|
|
2659b01329 | ||
|
|
2866dddbd9 | ||
|
|
1fff37ad63 | ||
|
|
2e6d18b719 | ||
|
|
bfba0f15d3 | ||
|
|
539d2763ee | ||
|
|
ce84169794 | ||
|
|
1d2c749642 | ||
|
|
d13edd4070 | ||
|
|
52b09f4a8f | ||
|
|
c32e34df73 | ||
|
|
dc4161337b | ||
|
|
ce603a9afd | ||
|
|
a1c16815d1 | ||
|
|
3d501babf9 | ||
|
|
f29817be05 | ||
|
|
1d2d97bd65 | ||
|
|
b14643bc31 | ||
|
|
9a0a60793e | ||
|
|
6556e469cd | ||
|
|
9ce3d975b4 | ||
|
|
76c0f41fde | ||
|
|
993d43951e | ||
|
|
b08e53ee04 | ||
|
|
cd74fb8103 | ||
|
|
4ac748f002 | ||
|
|
cdc7b896d9 | ||
|
|
7e61d7bd9d | ||
|
|
ac86200576 | ||
|
|
c9d576bf99 | ||
|
|
9bcffdc6df | ||
|
|
c30a2e7a01 | ||
|
|
8d5631a651 | ||
|
|
ab324d65bb | ||
|
|
3d64a4474d | ||
|
|
6d18349fc7 | ||
|
|
d047a4f23e | ||
|
|
91584c0d8c | ||
|
|
7d7ed08f96 | ||
|
|
ea3073eae0 | ||
|
|
586e5cb69e | ||
|
|
5b09426c59 | ||
|
|
37435ca60c | ||
|
|
bb736e2c0d | ||
|
|
85ec4fdbc4 | ||
|
|
a5e46708b6 | ||
|
|
60e8a5699b | ||
|
|
dd58e05c35 | ||
|
|
3c4761aed4 | ||
|
|
707850a551 | ||
|
|
7242195f45 | ||
|
|
4442397069 | ||
|
|
ce2a80c50b | ||
|
|
734649fa57 | ||
|
|
3c3b608bfb | ||
|
|
6b82f3b3ce | ||
|
|
6eae137bd1 | ||
|
|
74225cea5f | ||
|
|
54addaff17 | ||
|
|
35ca13ded3 | ||
|
|
5f7c6bee47 | ||
|
|
0345229416 | ||
|
|
de843f4e90 | ||
|
|
98afe7a263 | ||
|
|
76178b40b4 | ||
|
|
115449a736 | ||
|
|
7fa6f2c53b | ||
|
|
14ae9d34a7 | ||
|
|
b7df741f08 | ||
|
|
79833989b5 | ||
|
|
db1ac43edb | ||
|
|
bfc15cca8b | ||
|
|
224a97cba4 | ||
|
|
51510fd83a | ||
|
|
b3d2884ffa | ||
|
|
30de321875 | ||
|
|
4d2a10a870 | ||
|
|
cfc64511f8 | ||
|
|
4d7fccc878 | ||
|
|
786c770914 | ||
|
|
49a3da7967 | ||
|
|
26c41a0c10 | ||
|
|
7f0b030f13 | ||
|
|
3b6ab69a71 | ||
|
|
195389db98 | ||
|
|
a9f505e960 | ||
|
|
f253d11902 | ||
|
|
41350cbd12 | ||
|
|
122f548e9c | ||
|
|
0a80ae9db4 | ||
|
|
144cb73d26 | ||
|
|
2cf6b0ab6a | ||
|
|
23e461b85d | ||
|
|
24c4daf4f7 | ||
|
|
7cc54d8e33 | ||
|
|
18d6aa3e87 | ||
|
|
feaaa47e86 | ||
|
|
e11373d5f8 | ||
|
|
fd669617d8 | ||
|
|
289a9fbf81 | ||
|
|
1fb7986213 | ||
|
|
982b9a8f28 | ||
|
|
5f73676b92 | ||
|
|
2d4cba6cc4 | ||
|
|
0297cd7136 | ||
|
|
35852e08a9 | ||
|
|
7fbc98f832 | ||
|
|
65d0504c68 | ||
|
|
17ae98aa02 | ||
|
|
9001efee9c | ||
|
|
fbf01a04fe | ||
|
|
acd37a8245 | ||
|
|
c375c05d6b | ||
|
|
ea95535612 | ||
|
|
33a92747ed | ||
|
|
ed94ddb180 | ||
|
|
63ee0e68af | ||
|
|
f9ba766711 | ||
|
|
e477d6de59 | ||
|
|
a2bb445e1d | ||
|
|
797d7e0123 | ||
|
|
4ea3785f05 | ||
|
|
c568c45c01 | ||
|
|
ba202dcd61 | ||
|
|
e2b112b049 | ||
|
|
3f2fb3d2e8 | ||
|
|
ebf24d5895 | ||
|
|
4ec1505bc5 | ||
|
|
8f6f5edf14 | ||
|
|
1eb54327db | ||
|
|
a43f871946 | ||
|
|
6188bfb6ef | ||
|
|
083278d7bf | ||
|
|
5e64b1a3cb | ||
|
|
11a064dd23 | ||
|
|
81f05cec06 | ||
|
|
4a270b87b6 | ||
|
|
cd5a2f0541 | ||
|
|
fa8777f9a7 | ||
|
|
0cf31e6a3c | ||
|
|
32b0050b4f | ||
|
|
d33ba004bb | ||
|
|
6e6809b020 | ||
|
|
c42fe16a7e | ||
|
|
f4127b1510 | ||
|
|
89c7868ad0 | ||
|
|
280df807d1 | ||
|
|
0b6e394a61 | ||
|
|
20edc08763 | ||
|
|
78b5ebafdb | ||
|
|
194dc40515 | ||
|
|
e2267d7e38 | ||
|
|
09cb79fb14 | ||
|
|
1cccf3efc4 | ||
|
|
b373c452c0 | ||
|
|
b6f065a19d | ||
|
|
c20c095bf8 | ||
|
|
e2c76d7780 | ||
|
|
e911eb2e0e | ||
|
|
967734d644 | ||
|
|
7d93249975 | ||
|
|
80e5fece0e | ||
|
|
66cccfddcd | ||
|
|
64c2403a32 | ||
|
|
f0b4966f2a | ||
|
|
63aeca284e | ||
|
|
69e9c1c501 | ||
|
|
bb1c3e01e5 | ||
|
|
fb4c0cb9b8 | ||
|
|
80717953c5 | ||
|
|
04f0798c17 | ||
|
|
d4334451f1 | ||
|
|
4d2506ca7f | ||
|
|
86e2e78fb6 | ||
|
|
051c015b05 | ||
|
|
23725f7f37 | ||
|
|
82360f9ac2 | ||
|
|
653b359796 | ||
|
|
65fc78f092 | ||
|
|
b75711171b | ||
|
|
d8dad60041 | ||
|
|
e633cee220 | ||
|
|
e56ca33ecb | ||
|
|
7e54fba210 | ||
|
|
8210f4aeda | ||
|
|
6da9aa6475 | ||
|
|
e91b536ba4 | ||
|
|
d374f2f83e | ||
|
|
8b64370bb3 | ||
|
|
dfd8f31419 | ||
|
|
0c6bc3105f | ||
|
|
baf7a060ab | ||
|
|
f2eb7902d0 | ||
|
|
58454b38a7 | ||
|
|
e940649023 | ||
|
|
c0e3070294 | ||
|
|
b278a10f9f | ||
|
|
6e00adc64b | ||
|
|
523faf4392 | ||
|
|
95450d8e52 | ||
|
|
2c2867ae69 | ||
|
|
e67b5729de | ||
|
|
4d101da1ff | ||
|
|
d32b74b31e | ||
|
|
2263777da5 | ||
|
|
28bb2c9603 | ||
|
|
62b448ccee | ||
|
|
38f85dcfea | ||
|
|
1e75144916 | ||
|
|
d59a828ce8 | ||
|
|
ab52f71bd5 | ||
|
|
0e56ac4198 | ||
|
|
dce1c2b478 | ||
|
|
5484736fa1 | ||
|
|
ff1bf70124 | ||
|
|
014f0b0627 | ||
|
|
4116d04d5c | ||
|
|
6f276ecbce | ||
|
|
76c2fa65a5 | ||
|
|
6f5365813d | ||
|
|
bcf69999d9 | ||
|
|
7237f7a696 | ||
|
|
f1b310c10d | ||
|
|
4075649b03 | ||
|
|
68c6401d9f | ||
|
|
67e8af1919 | ||
|
|
a1c1f182fe | ||
|
|
2473f7b77d | ||
|
|
b8e9f17d2b | ||
|
|
d701d27bc6 | ||
|
|
649b595936 | ||
|
|
4e88c69cce | ||
|
|
3a3e2abd34 | ||
|
|
3624aef0d5 | ||
|
|
b1065c0396 | ||
|
|
8879c3f4dd | ||
|
|
11f0ffd0ea | ||
|
|
1872aa0267 | ||
|
|
a8c7fd9272 | ||
|
|
6750031e36 | ||
|
|
ac3d12b899 | ||
|
|
c1b32eae92 | ||
|
|
c7a29d81d2 | ||
|
|
93c54dbf6c | ||
|
|
c80895c4ff | ||
|
|
105341ada6 | ||
|
|
5bdc3f7087 | ||
|
|
2b3bd7fad9 | ||
|
|
c70c5ce1fb | ||
|
|
5a89929c1d | ||
|
|
b9f6e9f108 | ||
|
|
0e8af339ae | ||
|
|
418f9203de |
No files matched your search
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_"
|
||||
Startup="Application_Startup"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DyeingComputer.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using LiveChartsCore;
|
||||
using LiveChartsCore.SkiaSharpView;
|
||||
using SkiaSharp;
|
||||
@@ -22,6 +22,10 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
/// <summary>
|
||||
///公共变量来自Login的用户名
|
||||
/// </summary>
|
||||
public static string USER_Purview { get; set; }
|
||||
private static Assembly OnResolveAssembly(object sender, ResolveEventArgs args)
|
||||
{
|
||||
Assembly executingAssembly = Assembly.GetExecutingAssembly();
|
||||
@@ -119,10 +123,10 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
{
|
||||
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!"
|
||||
+ "(1)错误" + Environment.NewLine
|
||||
// + "(2)错误源:" + e.Exception.InnerException.Source + Environment.NewLine
|
||||
+ "(2)错误源:" + e.Exception.InnerException.Source + Environment.NewLine
|
||||
+ "(3)错误信息:" + e.Exception.Message + Environment.NewLine
|
||||
// + "(4)详细信息:" + e.Exception.InnerException.Message + Environment.NewLine
|
||||
// + "(5)报错区域:" + e.Exception.InnerException.StackTrace
|
||||
+ "(4)详细信息:" + e.Exception.InnerException.Message + Environment.NewLine
|
||||
+ "(5)报错区域:" + e.Exception.InnerException.StackTrace
|
||||
);
|
||||
}
|
||||
|
||||
@@ -169,7 +173,8 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
/// </summary>
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
Application.Current.StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);//和MainWindwo同一目录
|
||||
Current.StartupUri = new Uri("Login.xaml", UriKind.Relative);
|
||||
//Current.StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);//和MainWindwo同一目录
|
||||
}
|
||||
|
||||
public static class SystemSleepTool
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
|
||||
{
|
||||
internal class BoolToVisidilityConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return (value is bool boolvalue && boolvalue) ?
|
||||
Visibility.Visible:
|
||||
Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,16 +21,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
|
||||
{
|
||||
string i = value.ToString();
|
||||
|
||||
if (i == "101") return "Gray";
|
||||
else if (i == "201") return "green";
|
||||
else if (i == "202") return "yellow";
|
||||
else return "Red";
|
||||
if (i == "201") return "#FF00FF00";
|
||||
else if (i == "202") return "Green";
|
||||
else if (i == "309") return "#FF000000";
|
||||
else if (i == "800") return "Red";
|
||||
else return "#FF000000";
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return "Gray";
|
||||
return "#FFF0F0F0";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
|
||||
{
|
||||
internal class StatenClassConvert
|
||||
{
|
||||
public static string Convert(object value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
string Staten = null;
|
||||
string i = value.ToString();
|
||||
|
||||
if (i == "100") Staten = Properties.Resources.NotSent;//等待
|
||||
else if (i == "101") Staten = Properties.Resources.Ready;//准备
|
||||
else if (i == "102") Staten = Properties.Resources.Measure;//计量
|
||||
else if (i == "109") Staten = Properties.Resources.ERR;//错误
|
||||
else if (i == "110") Staten = Properties.Resources.NotSent;//未发送
|
||||
else if (i == "111") Staten = Properties.Resources.LtemizedSending;//发送明细
|
||||
else if (i == "112") Staten = Properties.Resources.DNotSent;//未发送明细
|
||||
else if (i == "119") Staten = Properties.Resources.Fail;//失败
|
||||
else if (i == "201") Staten = Properties.Resources.Auto;//自动
|
||||
else if (i == "202") Staten = Properties.Resources.LineUp;//排队
|
||||
else if (i == "203") Staten = Properties.Resources.Await;//等待
|
||||
else if (i == "301") Staten = Properties.Resources.Finish;//完成
|
||||
else if (i == "309") Staten = Properties.Resources.Abnormal;//错误
|
||||
else if (i == "800") Staten = Properties.Resources.Notimplementation;//未连接
|
||||
else if (i == "801") Staten = Properties.Resources.Implementation;//连接成功
|
||||
else if (i == "802") Staten = Properties.Resources.Online;//在线
|
||||
else if (i == "899") Staten = Properties.Resources.CloseTheConnection;//关闭连接
|
||||
else if (i == "1") Staten = Properties.Resources.dye;//染料
|
||||
else if (i == "2") Staten = Properties.Resources.chemicals;//助剂
|
||||
else if (i == "3") Staten = Properties.Resources.powder;//粉体
|
||||
else Staten = "null";
|
||||
|
||||
return Staten;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,16 +21,27 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
|
||||
string Staten = null;
|
||||
string i = value.ToString();
|
||||
|
||||
if (i == "101") Staten = Properties.Resources.Ready;
|
||||
else if (i == "102") Staten = Properties.Resources.Measure;
|
||||
else if (i == "201") Staten = Properties.Resources.Auto;
|
||||
else if (i == "202") Staten = Properties.Resources.LineUp;
|
||||
else if (i == "203") Staten = Properties.Resources.Await;
|
||||
else if (i == "301") Staten = Properties.Resources.Finish;
|
||||
else if (i == "309") Staten = Properties.Resources.Abnormal;
|
||||
else if (i == "800") Staten = Properties.Resources.Notimplementation;
|
||||
else if (i == "801") Staten = Properties.Resources.Implementation;
|
||||
else Staten = "null";
|
||||
if (i == "100") Staten = Properties.Resources.Await;//等待
|
||||
else if (i == "101") Staten = Properties.Resources.Ready;//准备
|
||||
else if (i == "102") Staten = Properties.Resources.Measure;//计量
|
||||
else if (i == "109") Staten = Properties.Resources.ERR;//错误
|
||||
else if (i == "110") Staten = Properties.Resources.NotSent;//未发送
|
||||
else if (i == "111") Staten = Properties.Resources.LtemizedSending;//发送明细
|
||||
else if (i == "112") Staten = Properties.Resources.DNotSent;//未发送明细
|
||||
else if (i == "119") Staten = Properties.Resources.Fail;//失败
|
||||
else if (i == "201") Staten = Properties.Resources.Auto;//自动
|
||||
else if (i == "202") Staten = Properties.Resources.LineUp;//排队
|
||||
else if (i == "203") Staten = Properties.Resources.Await;//等待
|
||||
else if (i == "301") Staten = Properties.Resources.Finish;//完成
|
||||
else if (i == "309") Staten = Properties.Resources.Abnormal;//错误
|
||||
else if (i == "800") Staten = Properties.Resources.Notimplementation;//未连接
|
||||
else if (i == "801") Staten = Properties.Resources.Implementation;//连接成功
|
||||
else if (i == "801") Staten = Properties.Resources.Online;//在线
|
||||
else if (i == "899") Staten = Properties.Resources.CloseTheConnection;//关闭连接
|
||||
else if (i == "1") Staten = Properties.Resources.dye;//染料
|
||||
else if (i == "2") Staten = Properties.Resources.chemicals;//助剂
|
||||
else if (i == "3") Staten = Properties.Resources.powder;//粉体
|
||||
else Staten = "";
|
||||
|
||||
return Staten;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
|
||||
{
|
||||
internal class StatenToImageConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case "001":
|
||||
return new BitmapImage(new Uri("/Lmage/ID001.png", UriKind.Relative));//功能模块001温度控制
|
||||
case "007":
|
||||
return new BitmapImage(new Uri("/Lmage/ID007.png", UriKind.Relative));//液位入水
|
||||
case "008":
|
||||
return new BitmapImage(new Uri("/Lmage/ID008.png", UriKind.Relative));//流量入水
|
||||
case "013":
|
||||
return new BitmapImage(new Uri("/Lmage/ID013.png", UriKind.Relative));//批次水位水洗
|
||||
case "015":
|
||||
return new BitmapImage(new Uri("/Lmage/ID015.png", UriKind.Relative));//溢流水洗
|
||||
case "017":
|
||||
return new BitmapImage(new Uri("/Lmage/ID017.png", UriKind.Relative));//降温水洗
|
||||
case "020":
|
||||
return new BitmapImage(new Uri("/Lmage/ID020.png", UriKind.Relative));//排水
|
||||
case "022":
|
||||
return new BitmapImage(new Uri("/Lmage/ID022.png", UriKind.Relative));//动力排水
|
||||
case "031":
|
||||
return new BitmapImage(new Uri("/Lmage/ID031.png", UriKind.Relative));//运转时间
|
||||
case "035":
|
||||
return new BitmapImage(new Uri("/Lmage/ID035.png", UriKind.Relative));//准备入布
|
||||
case "036":
|
||||
return new BitmapImage(new Uri("/Lmage/ID036.png", UriKind.Relative));//准备出布
|
||||
case "039":
|
||||
return new BitmapImage(new Uri("/Lmage/ID039.png", UriKind.Relative));//呼叫人工
|
||||
case "040":
|
||||
return new BitmapImage(new Uri("/Lmage/ID040.png", UriKind.Relative));//取样
|
||||
case "041":
|
||||
return new BitmapImage(new Uri("/Lmage/ID041.png", UriKind.Relative));//结束
|
||||
case "049":
|
||||
return new BitmapImage(new Uri("/Lmage/ID049.png", UriKind.Relative));//等待
|
||||
case "050":
|
||||
return new BitmapImage(new Uri("/Lmage/ID050.png", UriKind.Relative));//主缸加压
|
||||
case "051":
|
||||
return new BitmapImage(new Uri("/Lmage/ID051.png", UriKind.Relative));//主缸减压
|
||||
case "054":
|
||||
return new BitmapImage(new Uri("/Lmage/ID054.png", UriKind.Relative));//主泵/风机速度
|
||||
case "055":
|
||||
return new BitmapImage(new Uri("/Lmage/ID055.png", UriKind.Relative));//主泵启动
|
||||
case "056":
|
||||
return new BitmapImage(new Uri("/Lmage/ID056.png", UriKind.Relative));//
|
||||
case "064":
|
||||
return new BitmapImage(new Uri("/Lmage/ID064.png", UriKind.Relative));//
|
||||
case "065":
|
||||
return new BitmapImage(new Uri("/Lmage/ID065.png", UriKind.Relative));//
|
||||
case "066":
|
||||
return new BitmapImage(new Uri("/Lmage/ID066.png", UriKind.Relative));//
|
||||
case "067":
|
||||
return new BitmapImage(new Uri("/Lmage/ID067.png", UriKind.Relative));//
|
||||
case "090":
|
||||
return new BitmapImage(new Uri("/Lmage/ID090.png", UriKind.Relative));//
|
||||
case "091":
|
||||
return new BitmapImage(new Uri("/Lmage/ID091.png", UriKind.Relative));//
|
||||
case "093":
|
||||
return new BitmapImage(new Uri("/Lmage/ID093.png", UriKind.Relative));//
|
||||
case "094":
|
||||
return new BitmapImage(new Uri("/Lmage/ID094.png", UriKind.Relative));//
|
||||
default:
|
||||
return new BitmapImage(new Uri("", UriKind.Relative));
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using ScottPlot.TickGenerators.Financial;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
|
||||
{
|
||||
internal class StatexmlConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
string Staten = "None";
|
||||
string i = value.ToString();
|
||||
if (i == "101") Staten = "Walk";//运行
|
||||
else if (i == "202") Staten = "RunFast";//运行
|
||||
else if (i == "301") Staten = "Stop";//完成
|
||||
else if (i == "309") Staten = "ErrorOutline";//错误
|
||||
else if (i == "800") Staten = "LinkOff";//未连接
|
||||
else if (i == "801") Staten = "Link";//连接成功
|
||||
else if (i == "899") Staten = "LinkOff";//关闭连接
|
||||
else if (i == "True") Staten = "Visible";//
|
||||
else if (i == "False") Staten = "Collapsed";//
|
||||
|
||||
return Staten;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,59 @@
|
||||
[2025-07-02 21:49:42];[Error] ||
|
||||
|
||||
[2025-07-02 21:49:42];[Error source] ||.Net SqlClient Data Provider
|
||||
|
||||
[2025-07-02 21:49:42];[Error message] ||在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)
|
||||
|
||||
[2025-07-02 21:49:42];[Error area] || 在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
|
||||
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.Open()
|
||||
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
|
||||
[2025-07-02 21:50:08];[Error] ||
|
||||
|
||||
[2025-07-02 21:50:08];[Error source] ||System.Data.SqlClient.SqlException (0x80131904): 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接) ---> System.ComponentModel.Win32Exception (0x80004005): 系统找不到指定的文件。
|
||||
在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
|
||||
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.Open()
|
||||
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
|
||||
ClientConnectionId:00000000-0000-0000-0000-000000000000
|
||||
Error Number:2,State:0,Class:20
|
||||
|
||||
[2025-07-02 21:50:08];[Error message] ||在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)
|
||||
|
||||
[2025-07-02 21:50:08];[Error area] ||System.Data.SqlClient.SqlException (0x80131904): 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接) ---> System.ComponentModel.Win32Exception (0x80004005): 系统找不到指定的文件。
|
||||
在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
|
||||
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.Open()
|
||||
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
|
||||
ClientConnectionId:00000000-0000-0000-0000-000000000000
|
||||
Error Number:2,State:0,Class:20
|
||||
@@ -0,0 +1,20 @@
|
||||
[2025-07-24 21:48:12];[Error] ||
|
||||
|
||||
[2025-07-24 21:48:12];[Error source] ||.Net SqlClient Data Provider
|
||||
|
||||
[2025-07-24 21:48:12];[Error message] ||在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)
|
||||
|
||||
[2025-07-24 21:48:12];[Error area] || 在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
|
||||
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.Open()
|
||||
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
|
||||
@@ -0,0 +1,20 @@
|
||||
[2025-08-28 17:45:02];[Error] ||
|
||||
|
||||
[2025-08-28 17:45:02];[Error source] ||.Net SqlClient Data Provider
|
||||
|
||||
[2025-08-28 17:45:02];[Error message] ||在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)
|
||||
|
||||
[2025-08-28 17:45:02];[Error area] || 在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
|
||||
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
|
||||
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
|
||||
在 System.Data.SqlClient.SqlConnection.Open()
|
||||
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
|
||||
@@ -0,0 +1,64 @@
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.EX.DispenseState"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.EX"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
|
||||
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" BorderBrush="#FFC9C9C9" FontSize="16" BorderThickness="5,5,5,5" >
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="25" />
|
||||
<Setter Property="FontSize" Value="15" />
|
||||
<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.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.ID}" Binding="{Binding ID}" Width="80" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Machine}" Width="100" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="200" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Redye}" Binding="{Binding ReDye}" Width="80" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding StepNumber}" Width="80" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Time}" Binding="{Binding CreationTime}" Width="200" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.ProductCode}" Binding="{Binding ProductCode}" Width="200" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.ProductName}" Binding="{Binding ProductName}" Width="200" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Grams}" Binding="{Binding Weight}" Width="200" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.State}" Binding="{Binding State}" Width="100" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Volume}" Binding="{Binding Volume}" Width="100" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.DispenseModule}" Binding="{Binding DispenseModule}" Width="100" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.StartTime}" Binding="{Binding DispenseStartTime}" Width="200" IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,69 @@
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.EX
|
||||
{
|
||||
/// <summary>
|
||||
/// DispenseState.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DispenseState : UserControl
|
||||
{
|
||||
public DispenseState()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public async void State(object dat,string mac)
|
||||
{
|
||||
string Connstr_SC;
|
||||
string WaitChemical_WaitDispenseDyestuff;
|
||||
string DAT = mac.Substring(0,3);
|
||||
if (DAT == "252")
|
||||
{
|
||||
WaitChemical_WaitDispenseDyestuff = "SELECT * FROM [dbo].[WaitDispenseDyestuff] WHERE DispenseMachine = '" + dat + "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitChemical_WaitDispenseDyestuff = "SELECT * FROM [dbo].[WaitChemical] WHERE DispenseMachine = '" + dat + "'";
|
||||
}
|
||||
try
|
||||
{
|
||||
if (MainWindowViewModel.SQMOD == "Windows Authentication")
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
|
||||
}
|
||||
else
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
|
||||
}
|
||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||
await conn_SC.OpenAsync(); //连接数据库
|
||||
SqlDataAdapter WaitChemical_data = new SqlDataAdapter(WaitChemical_WaitDispenseDyestuff, Connstr_SC); //查询
|
||||
conn_SC.Close();
|
||||
|
||||
DataTable ds = new DataTable();//载入信息
|
||||
WaitChemical_data.Fill(ds);
|
||||
Grid_data.ItemsSource = ds.DefaultView;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
using LiveChartsCore.Kernel;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Runtime.Remoting;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Core;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.EX.Exchange
|
||||
{
|
||||
public class BDC_SQL
|
||||
{
|
||||
public class BDCSqlHelper
|
||||
{
|
||||
// SqlConnection conn_SC = new SqlConnection();//数据库
|
||||
string db;
|
||||
public void Config(string IP, string DATABASE, string USER, string PAWSSD, bool MODE)//连接dbc数据库
|
||||
{
|
||||
if (MODE) //连接数据库测试
|
||||
{
|
||||
db="server=" + IP + ";database=" + DATABASE + ";Trusted_Connection=SSPI";
|
||||
}
|
||||
else
|
||||
{
|
||||
db="server=" + IP + ";database=" + DATABASE + ";User ID=" + USER + ";Password=" + PAWSSD;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<int> UPDATA(string name,string where,DataRow entity)//dbc数据库
|
||||
{
|
||||
string DAT = null;
|
||||
int rowsAffected = 0;
|
||||
int type = 0;
|
||||
try { type = entity.Field<int>("Type"); } catch { }
|
||||
try
|
||||
{
|
||||
|
||||
DAT = "DispenseDyelot='" + entity.Field<string>("Dyelot") + "',DispenseReDye='" + entity.Field<int>("Redye")+"',";
|
||||
if (type == 2)
|
||||
{
|
||||
DAT = DAT+"DyeCallOff=" + entity.Field<int>("Step") + ",DyeState = 201,DyeTank=" +
|
||||
entity.Field<int>("Tank");
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
DAT = DAT+"PowderCallOff=" + entity.Field<int>("Step") +",PowderState=201,PowderTank=" +
|
||||
entity.Field<int>("Tank");
|
||||
}
|
||||
else
|
||||
{
|
||||
DAT = DAT+"ChemicalCallOff=" + entity.Field<int>("Step") +",ChemicalState=201,ChemicalTank=" +
|
||||
entity.Field<int>("Tank");
|
||||
}
|
||||
|
||||
using (var connection = new SqlConnection(db))
|
||||
{
|
||||
await connection.OpenAsync();
|
||||
var command = connection.CreateCommand();
|
||||
command.CommandText = "UPDATE "+ name + " SET "+ DAT + " WHERE "+ where;
|
||||
// command.Parameters.AddWithValue("@table", name);
|
||||
// command.Parameters.AddWithValue("@Id", where);
|
||||
// command.Parameters.AddWithValue("@data", DAT);
|
||||
rowsAffected = await command.ExecuteNonQueryAsync();
|
||||
|
||||
LogGing.ExchangeDATA( command.CommandText.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
}
|
||||
return rowsAffected;
|
||||
}
|
||||
|
||||
public async Task<DataTable> SELECT(string name, string where)//dbc数据库
|
||||
{
|
||||
DataTable rowsAffected = new DataTable();
|
||||
try
|
||||
{
|
||||
using (var connection = new SqlConnection(db))
|
||||
{
|
||||
await connection.OpenAsync();
|
||||
var command = connection.CreateCommand();
|
||||
command.CommandText = "SELECT * FROM " + name + " WHERE " + where;
|
||||
var dat = await command.ExecuteReaderAsync();
|
||||
rowsAffected.Load(dat);
|
||||
|
||||
LogGing.ExchangeDATA(command.CommandText.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
}
|
||||
return rowsAffected;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.EX.ManualDyelot"
|
||||
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_.EX"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
||||
xmlns:System="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:core="clr-namespace:System;assembly=netstandard"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:ManualDyelotModel}"
|
||||
mc:Ignorable="d" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen"
|
||||
Title="ManualDyelot" Height="960" Width="1280">
|
||||
<Window.Resources>
|
||||
<viewmodel:ManualDyelotModel x:Key="ManualDyelotModel"/>
|
||||
</Window.Resources>
|
||||
<Grid Background="#FFC9C9C9">
|
||||
<Grid Margin="5,5,5,5" Background="White">
|
||||
<DataGrid x:Name="Grid_data" AlternationCount="2" d:ItemsSource="{d:SampleData ItemCount=99}"
|
||||
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="50" BorderThickness="0,0,5,0"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column"
|
||||
SelectionMode="Single" FontSize="20" Margin="5,5,500,5">
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="35" />
|
||||
<Setter Property="FontSize" Value="20" />
|
||||
<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.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.ProductCode}" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0"
|
||||
ItemsSource="{Binding stuff_Product, Source={StaticResource ManualDyelotModel}}"
|
||||
DisplayMemberPath="ProductCode"
|
||||
Text="{Binding PRODUCT_CODE}" IsTextSearchEnabled="True" StaysOpenOnEdit="True"
|
||||
BorderBrush="{x:Null}" Background="{x:Null}"
|
||||
DropDownClosed="CP_PRODUCT_CODE_DropDownClosed">
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.ProcessName}" Width="200" MaxWidth="400" MinWidth="100" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox x:Name="CP_PRODUCT_NAME" BorderThickness="0,0,0,0"
|
||||
ItemsSource="{Binding stuff_Product, Source={StaticResource ManualDyelotModel}}"
|
||||
DisplayMemberPath="ProductName"
|
||||
Text="{Binding PRODUCT_NAME}"
|
||||
DropDownClosed="CP_PRODUCT_NAME_DropDownClosed"
|
||||
BorderBrush="{x:Null}" Background="{x:Null}" Focusable="True" IsTabStop="False"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.Grams}" Width="200" MaxWidth="400" MinWidth="100" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox x:Name="CP_CONC" BorderThickness="0,0,0,0" Text="{Binding CONC}"
|
||||
BorderBrush="{x:Null}" Background="{x:Null}"
|
||||
KeyDown="CP_CONC_KeyDown" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
<Button x:Name="State" Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Right" Height="55" Margin="0,0,280,10" VerticalAlignment="Bottom" Width="200" Click="State_Click" Padding="0,4,0,4" FontSize="20"/>
|
||||
<Button x:Name="Cancel" Content="{x:Static lang:Resources.Cancel}" HorizontalAlignment="Right" Height="55" Margin="0,0,15,10" VerticalAlignment="Bottom" Width="200" Click="Cancel_Click" Padding="0,4,0,4" FontSize="20"/>
|
||||
|
||||
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,100,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
|
||||
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,100,15,0" TextWrapping="Wrap" x:Name="orders"
|
||||
VerticalAlignment="Top" Width="350" FontSize="35"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,150,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
|
||||
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,150,15,0" TextWrapping="Wrap" x:Name="dyelot"
|
||||
VerticalAlignment="Top" Width="350" FontSize="35"/>
|
||||
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="50" VerticalAlignment="Top" Margin="150,200,15,0" HorizontalAlignment="Right" Width="350">
|
||||
<ComboBox Height="50" x:Name="comboBoxMachine" VerticalAlignment="Stretch"
|
||||
FontSize="35" DropDownClosed="comboBoxMachine_DropDownClosed" />
|
||||
</Border>
|
||||
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,200,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}"
|
||||
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
|
||||
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="50" VerticalAlignment="Top" Margin="150,250,15,0" HorizontalAlignment="Right" Width="350">
|
||||
<ComboBox Height="50" x:Name="comboBoxtank" VerticalAlignment="Stretch" FontSize="35" />
|
||||
</Border>
|
||||
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,250,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Tank}"
|
||||
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
|
||||
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="50" VerticalAlignment="Top" Margin="150,300,15,0" HorizontalAlignment="Right" Width="350">
|
||||
<TextBox Height="50" x:Name="comboBoxTotal" VerticalAlignment="Stretch" FontSize="35" />
|
||||
</Border>
|
||||
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,300,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
|
||||
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,334 @@
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
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 System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
using DyeingComputer.UserClass;
|
||||
using System.Windows.Forms;
|
||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
using ScottPlot.TickGenerators.TimeUnits;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.EX
|
||||
{
|
||||
/// <summary>
|
||||
/// ManualDyelot.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ManualDyelot : Window
|
||||
{
|
||||
|
||||
DataTable dyelotdat = new DataTable();
|
||||
public static string Machines;
|
||||
DataTable mach = new DataTable();
|
||||
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
|
||||
int ID_N = 1;
|
||||
int type_;
|
||||
DateTime time = DateTime.Now;
|
||||
public ManualDyelot()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
State.IsEnabled = false;
|
||||
string[] strings = { "0", "1", "2", "3" };
|
||||
comboBoxtank.ItemsSource = strings;
|
||||
comboBoxtank.Text = "0";
|
||||
comboBoxTotal.Text = "0";
|
||||
int mrc = MainWindowViewModel.Machines.Rows.Count;
|
||||
string[] stringsM = new string[mrc];
|
||||
for (int i = 0; i < mrc; i++)
|
||||
{
|
||||
stringsM[i] = MainWindowViewModel.Machines.Rows[i]["name"].ToString();
|
||||
}
|
||||
comboBoxMachine.ItemsSource = stringsM;
|
||||
dyelot.Text = "00_" + DateTime.Now.ToString("yyMMddHHmmss");
|
||||
RRODUCTdataTable.Columns.Add("ID", typeof(int));
|
||||
RRODUCTdataTable.Columns.Add("DYELOT", typeof(string));
|
||||
RRODUCTdataTable.Columns.Add("ReDye", typeof(int));
|
||||
RRODUCTdataTable.Columns.Add("STEP", typeof(int));
|
||||
RRODUCTdataTable.Columns.Add("ProductType", typeof(int));
|
||||
RRODUCTdataTable.Columns.Add("Created", typeof(string));
|
||||
RRODUCTdataTable.Columns.Add("PRODUCT_CODE", typeof(string));
|
||||
RRODUCTdataTable.Columns.Add("PRODUCT_NAME", typeof(string));
|
||||
RRODUCTdataTable.Columns.Add("TARGET_WT", typeof(float));
|
||||
RRODUCTdataTable.Columns.Add("Amount", typeof(string));
|
||||
RRODUCTdataTable.Columns.Add("UNIT", typeof(string));
|
||||
DataRow row = RRODUCTdataTable.NewRow(); //ID列
|
||||
row["ID"] = ID_N;
|
||||
row["DYELOT"] = dyelot.Text;
|
||||
row["ReDye"] = 0;
|
||||
row["STEP"] = "1";
|
||||
row["ProductType"] = type_;
|
||||
row["Created"] = time;
|
||||
row["UNIT"] = "g";
|
||||
RRODUCTdataTable.Rows.Add(row);
|
||||
Grid_data.ItemsSource = RRODUCTdataTable.DefaultView;
|
||||
}
|
||||
public void MAC(object Mac,int t)
|
||||
{
|
||||
Machines = Mac.ToString();
|
||||
type_ = t;
|
||||
/* string Connstr_SC;
|
||||
string sql = "SELECT * FROM [dbo].[Pipes] WHERE Dispenser = '" + Machines + "'";
|
||||
|
||||
try
|
||||
{
|
||||
if (MainWindowViewModel.SQMOD == "Windows Authentication")
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
|
||||
}
|
||||
else
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
|
||||
}
|
||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||
await conn_SC.OpenAsync(); //连接数据库
|
||||
new SqlDataAdapter(sql, Connstr_SC).Fill(dyelotdat);
|
||||
// SqlDataAdapter _data = new SqlDataAdapter(sql, Connstr_SC); //查询
|
||||
conn_SC.Close();
|
||||
|
||||
for (int i = 0; i < dyelotdat.Rows.Count; i++)
|
||||
{
|
||||
SelectProductCode.Add(dyelotdat.Rows[i].Field<string>("ProductCode"));
|
||||
SelectProductName.Add(dyelotdat.Rows[i].Field<string>("ProductName"));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
}*/
|
||||
}
|
||||
|
||||
private async void State_Click(object sender, RoutedEventArgs e)//确认按键
|
||||
{
|
||||
int t = RRODUCTdataTable.Rows.Count; //获取数据行包含空白行
|
||||
RRODUCTdataTable.Rows[t - 1].Delete();
|
||||
RRODUCTdataTable.AcceptChanges();
|
||||
if (string.IsNullOrEmpty(comboBoxMachine.Text)) return;//未输入机台时返回
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> Dyelot_DAT = new Dictionary<string, object>();//缓存函数
|
||||
for (int x = 0; x < RRODUCTdataTable.Rows.Count; x++)
|
||||
{
|
||||
Dyelot_DAT.Add("WorkOrder", orders.Text);
|
||||
Dyelot_DAT.Add("Dyelot", RRODUCTdataTable.Rows[x]["Dyelot"]);
|
||||
Dyelot_DAT.Add("Redye", RRODUCTdataTable.Rows[x]["Redye"]);
|
||||
Dyelot_DAT.Add("Step", RRODUCTdataTable.Rows[x]["Step"]);
|
||||
Dyelot_DAT.Add("TIME", RRODUCTdataTable.Rows[x]["Created"]);
|
||||
Dyelot_DAT.Add("Tank", comboBoxtank.Text);
|
||||
Dyelot_DAT.Add("State", "201");
|
||||
Dyelot_DAT.Add("Machine", comboBoxMachine.Text);
|
||||
Dyelot_DAT.Add("ProductCode", RRODUCTdataTable.Rows[x]["PRODUCT_CODE"]);
|
||||
Dyelot_DAT.Add("ProductName", RRODUCTdataTable.Rows[x]["PRODUCT_NAME"]);
|
||||
Dyelot_DAT.Add("ProductType", RRODUCTdataTable.Rows[x]["ProductType"]);
|
||||
Dyelot_DAT.Add("DispenseStartTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
Dyelot_DAT.Add("Grams", RRODUCTdataTable.Rows[x]["TARGET_WT"]);
|
||||
Dyelot_DAT.Add("Amount", RRODUCTdataTable.Rows[x]["Amount"]);
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("Dyelot", Dyelot_DAT);//行插入
|
||||
Dyelot_DAT.Clear();
|
||||
}
|
||||
|
||||
LogGing.ExchangeDATA("Dyelot=" + dyelot.Text + ";Machine=" + comboBoxMachine.Text +
|
||||
";Program=------;User=" + MainWindowViewModel.USER_data + ";");
|
||||
|
||||
|
||||
string Connstr_SC;
|
||||
if (MainWindowViewModel.SQMOD == "Windows Authentication")
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
|
||||
}
|
||||
else
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
|
||||
}
|
||||
SqlConnection destinationConnection = new SqlConnection(Connstr_SC); //创建一个数据库连接;
|
||||
await destinationConnection.OpenAsync(); //打开连接
|
||||
|
||||
//写总览
|
||||
string dyelots_sql = string.Format("INSERT INTO [dbo].[DYELOTS]([Dyelot] ,[ReDye] , [OrderNo] , [Machine] ,[DispenseMachine] ,[UserAccount] ) " +
|
||||
"VALUES ('" + dyelot.Text + "','0','" + orders.Text + "','" + comboBoxMachine.Text + "','" + comboBoxMachine.Text + "','" + MainWindow.user_ + "')");
|
||||
SqlCommand INSERT_cmd = new SqlCommand(dyelots_sql, destinationConnection);
|
||||
int dyelots_sqlIN = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||
|
||||
//写明细
|
||||
SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection);// 实例化 sqlbulkcopy;
|
||||
bulkCopy.DestinationTableName = "dbo.DyelotsBulkedRecipe";// 目标表名称/
|
||||
bulkCopy.ColumnMappings.Add("DYELOT", "Dyelot");
|
||||
bulkCopy.ColumnMappings.Add("ReDye", "ReDye");
|
||||
bulkCopy.ColumnMappings.Add("STEP", "StepNumber");
|
||||
bulkCopy.ColumnMappings.Add("PRODUCT_CODE", "ProductCode");
|
||||
bulkCopy.ColumnMappings.Add("PRODUCT_NAME", "ProductName");
|
||||
bulkCopy.ColumnMappings.Add("ProductType", "ProductType");
|
||||
bulkCopy.ColumnMappings.Add("Created", "Created");
|
||||
bulkCopy.ColumnMappings.Add("Amount", "Amount");
|
||||
bulkCopy.ColumnMappings.Add("TARGET_WT", "Grams");
|
||||
bulkCopy.WriteToServer(RRODUCTdataTable); //将传入的数据写到数据库;
|
||||
|
||||
string mac_sql = string.Format("UPDATE [dbo].[Machines] SET DispenseDyelot='" + dyelot.Text
|
||||
+ "',DispenseReDye='0',ChemicalCallOff=1,ChemicalState=201,ChemicalTank='" + comboBoxtank.Text
|
||||
+ "' WHERE NAME='" + comboBoxMachine.Text + "'");
|
||||
SqlCommand UPDATE_mac = new SqlCommand(mac_sql, destinationConnection);
|
||||
int mac_ = UPDATE_mac.ExecuteNonQuery(); //执行语句
|
||||
if (mac_ == 0) System.Windows.Forms.MessageBox.Show(Properties.Resources.Not_M);
|
||||
destinationConnection.Close();
|
||||
|
||||
this.Close();//退出页面
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
System.Windows.Forms.MessageBox.Show(ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxMachine_DropDownClosed(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
|
||||
{
|
||||
string Macht= MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "WorkOrder", "NAME = '" + comboBoxMachine.Text + "'").ToString();
|
||||
|
||||
if (Macht != "------")
|
||||
{
|
||||
orders.Text = Macht;
|
||||
}
|
||||
else
|
||||
{
|
||||
orders.Text = dyelot.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
public ObservableCollection<string> SelectProductCode
|
||||
{
|
||||
get { return _selectProductCode; }
|
||||
set { _selectProductCode = value; }
|
||||
}
|
||||
private ObservableCollection<string> _selectProductCode = new ObservableCollection<string>();
|
||||
public ObservableCollection<string> SelectProductName
|
||||
{
|
||||
get { return _selectProductName; }
|
||||
set { _selectProductName = value; }
|
||||
}
|
||||
private ObservableCollection<string> _selectProductName = new ObservableCollection<string>();
|
||||
|
||||
string Code_;
|
||||
string Name_;
|
||||
|
||||
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//代码选择事件
|
||||
{
|
||||
State.IsEnabled = false;
|
||||
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
||||
int grid_row = Grid_data.SelectedIndex; //获取当前行
|
||||
|
||||
Code_ = curComboBox.Text.TrimEnd();
|
||||
|
||||
DataRow[] r = ManualDyelotModel.STUFFdataTable.Select("ProductCode ='" + Code_ + "'"); //查询判断原料代码是否有效
|
||||
if (!r.Any()) //检查原料信息
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int ID_ = grid_row + 1;
|
||||
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'and ID <> '" + ID_ + "'");//查询判断原料代码是否重复
|
||||
if (c.Any())
|
||||
{
|
||||
curComboBox.Text = null;
|
||||
System.Windows.MessageBox.Show(Properties.Resources.RTRM);
|
||||
return;
|
||||
}
|
||||
|
||||
Name_ = r[0].ItemArray[1].ToString();
|
||||
|
||||
if (grid_row == -1) grid_row = 0;
|
||||
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
||||
row.BeginEdit();
|
||||
row["PRODUCT_CODE"] = Code_;
|
||||
row["PRODUCT_NAME"] = Name_;
|
||||
row.EndEdit();
|
||||
DataGridHelper.SetRealTimeCommit(Grid_data, true); //实时更新datagrid
|
||||
}
|
||||
|
||||
private void CP_PRODUCT_NAME_DropDownClosed(object sender, EventArgs e)//选择原料事件
|
||||
{
|
||||
State.IsEnabled = false;
|
||||
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
||||
int grid_row = Grid_data.SelectedIndex; //获取当前行
|
||||
|
||||
if (curComboBox.Text != "")
|
||||
{
|
||||
Name_ = curComboBox.Text.TrimEnd();
|
||||
|
||||
DataRow[] r = ManualDyelotModel.STUFFdataTable.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
|
||||
|
||||
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_NAME ='" + Name_ + "'");//查询判断原料代码是否重复
|
||||
if (c.Any())
|
||||
{
|
||||
curComboBox.Text = null;
|
||||
System.Windows.MessageBox.Show(Properties.Resources.RTRM);
|
||||
return;
|
||||
}
|
||||
Code_ = r[0].ItemArray[0].ToString();
|
||||
|
||||
if (grid_row == -1) grid_row = 0;
|
||||
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
||||
row.BeginEdit();
|
||||
row["PRODUCT_CODE"] = Code_;
|
||||
row["PRODUCT_NAME"] = Name_;
|
||||
row.EndEdit();
|
||||
}
|
||||
}
|
||||
|
||||
private void CP_CONC_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)//输入目标量事件
|
||||
{
|
||||
System.Windows.Controls.TextBox textBox = sender as System.Windows.Controls.TextBox;
|
||||
int grid_row = Grid_data.SelectedIndex; //获取当前行
|
||||
if (string.IsNullOrEmpty(textBox.Text)) return;
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
if (grid_row == -1) grid_row = 0;
|
||||
DataRow row = RRODUCTdataTable.Rows[grid_row];
|
||||
if (string.IsNullOrEmpty(row["PRODUCT_CODE"].ToString()))
|
||||
{
|
||||
textBox.Text = null;
|
||||
return;
|
||||
}
|
||||
row.BeginEdit();
|
||||
row["Amount"] = textBox.Text + "g";
|
||||
row["TARGET_WT"] = textBox.Text;
|
||||
row.EndEdit();
|
||||
|
||||
ID_N++;
|
||||
DataRow rowadd = RRODUCTdataTable.NewRow(); //ID列
|
||||
rowadd["ID"] = ID_N;
|
||||
rowadd["DYELOT"] = dyelot.Text;
|
||||
rowadd["ReDye"] = 0;
|
||||
rowadd["STEP"] = "1";
|
||||
row["ProductType"] = type_;
|
||||
rowadd["Created"] = time;
|
||||
rowadd["UNIT"] = "g";
|
||||
RRODUCTdataTable.Rows.Add(rowadd);
|
||||
State.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.EX.VNC"
|
||||
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_.EX"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
|
||||
xmlns:rdp="clr-namespace:VncSharpWpf;assembly=VncSharpWpf"
|
||||
mc:Ignorable="d" Loaded="Window_Loaded"
|
||||
Title="VNC" Height="1140" Width="1920">
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Button x:Name="Save" Content="{x:Static lang:Resources.Cancel}" HorizontalAlignment="Right" Height="35" Margin="450,0,50,10" VerticalAlignment="Bottom" Width="80" Click="Save_Click"/>
|
||||
<TextBlock x:Name="log" VerticalAlignment="Bottom" Text="LINK-------" Margin="0,0,0,10" HorizontalAlignment="Left" Width="600" Height="35" FontSize="24" FontWeight="Bold" FontStyle="Italic" />
|
||||
<Grid Margin="0,0,0,60">
|
||||
<rdp:RemoteDesktopWpf x:Name="rdp" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,96 @@
|
||||
using SunlightCentralizedControlManagement_SCCM_.View;
|
||||
using SunlightCentralizedControlManagement_SCCM_.EX;
|
||||
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 System.Net.NetworkInformation;
|
||||
using VncSharpWpf;
|
||||
using System.Net.Sockets;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.EX
|
||||
{
|
||||
/// <summary>
|
||||
/// UserMessage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class VNC : Window
|
||||
{
|
||||
string host = "127.0.0.1"; // 替换为你的 VNC 服务器地址
|
||||
int port = 5901; // 替换为你的 VNC 服务器端口
|
||||
string password = "123456"; // 替换为你的 VNC 服务器密码
|
||||
|
||||
public VNC()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Save_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (rdp.IsConnected) { rdp.Disconnect(); }//断开连接
|
||||
this.Close();
|
||||
}
|
||||
|
||||
public void Parameter(object IP, object PROT, object USER, object PASSWD)
|
||||
{
|
||||
host = IP.ToString();
|
||||
port = Convert.ToInt16(PROT);
|
||||
password = PASSWD.ToString();
|
||||
}
|
||||
|
||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (await PingTest(host))
|
||||
{
|
||||
if (!rdp.IsConnected)
|
||||
{
|
||||
log.Text = host + " OK";
|
||||
try
|
||||
{
|
||||
rdp.VncPort = port;
|
||||
rdp.Passwd = password;
|
||||
rdp.Connect(host, false, false);
|
||||
|
||||
//rdp.SetScalingMode(false);//自动缩放全屏
|
||||
// rdp.SetInputMode(false);//可交互
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<bool> PingTest(string ip)
|
||||
{
|
||||
bool result = false;
|
||||
Ping pingSender = new Ping();
|
||||
|
||||
try
|
||||
{
|
||||
PingReply reply = await pingSender.SendPingAsync(ip, 3000);
|
||||
|
||||
if (reply.Status == IPStatus.Success)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
catch (PingException)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 822 B |
@@ -1,105 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DEA91CB9-1011-4EE7-B8E1-72428F731789}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>GanttChart</RootNamespace>
|
||||
<AssemblyName>GanttChart</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GanttChartBrushes.cs" />
|
||||
<Compile Include="GanttChartItemClickEventArgs.cs" />
|
||||
<Compile Include="GanttChartItemDoubleClickEventArgs.cs" />
|
||||
<Compile Include="GanttChartPropertyChangeEventArgs.cs" />
|
||||
<Compile Include="GanttChartRangeSelectedEventArgs.cs" />
|
||||
<Compile Include="GanttChartRowSelectedEventArgs.cs" />
|
||||
<Compile Include="GanttChartView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GanttChartView.Events.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GanttChartView.Logic.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GanttChartView.Properties.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GanttChartView.Render.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GanttChartViewColumn.cs" />
|
||||
<Compile Include="GanttChartViewColumnGroup.cs" />
|
||||
<Compile Include="GanttChartViewItem.cs" />
|
||||
<Compile Include="GanttChartCollection.cs" />
|
||||
<Compile Include="GanttChartViewItemBlockType.cs" />
|
||||
<Compile Include="GanttChartViewRow.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TimeRange.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="GanttChart.bmp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,197 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图笔刷
|
||||
/// </summary>
|
||||
class GanttChartBrushes: IDisposable
|
||||
{
|
||||
GanttChartView View { get; set; }
|
||||
public GanttChartBrushes(GanttChartView view)
|
||||
{
|
||||
View = view;
|
||||
this.GridBrush = new SolidBrush(view.GridColor);
|
||||
|
||||
this.ColumnDateTextBrush = new SolidBrush(view.ColumnDateTextColor);
|
||||
this.ColumnHourTextBrush = new SolidBrush(view.ColumnHourTextColor);
|
||||
this.HeaderBackBrush = new SolidBrush(view.HeaderBackColor);
|
||||
|
||||
this.BackBrush = new SolidBrush(view.BackColor);
|
||||
this.ContentBackBrush = new SolidBrush(view.ContentBackColor);
|
||||
|
||||
this.CurrentTimeLineBrush = new SolidBrush(view.CurrentTimeLineColor);
|
||||
|
||||
this.ItemTextBrush = new SolidBrush(view.ItemTextColor);
|
||||
this.ItemBackBrush = new SolidBrush(view.ItemBackColor);
|
||||
this.ItemBorderBrush = new SolidBrush(view.ItemBorderColor);
|
||||
this.ItemStartFlagBrush = new SolidBrush(view.ItemStartFlagColor);
|
||||
this.ItemSubRangeBackBrush = new SolidBrush(view.ItemSubRangeBackColor);
|
||||
this.ItemSelectionTextBrush = new SolidBrush(view.ItemSelectionTextColor);
|
||||
this.ItemSelectionBackBrush = new SolidBrush(view.ItemSelectionBackColor);
|
||||
this.ItemSelectionBorderBrush = new SolidBrush(view.ItemSelectionBorderColor);
|
||||
this.ItemSelectionSubRangeBackBrush = new SolidBrush(view.ItemSelectionSubRangeBackColor);
|
||||
this.ItemWarnningTextBrush = new SolidBrush(view.ItemWarnningTextColor);
|
||||
|
||||
this.RowHeaderTextBrush = new SolidBrush(view.RowHeaderTextColor);
|
||||
this.RowSelectionHeaderTextBrush = new SolidBrush(view.RowSelectionHeaderTextColor);
|
||||
this.RowSelectionBorderBrush = new SolidBrush(view.RowSelectionBorderColor);
|
||||
this.RowSelectionHeaderBackBrush = new SolidBrush(view.RowSelectionHeaderBackColor);
|
||||
this.RowSelectionContentBackBrush = new SolidBrush(view.RowSelectionContentBackColor);
|
||||
|
||||
this.TooltipTextBrush = new SolidBrush(view.TooltipTextColor);
|
||||
this.TooltipBorderBrush = new SolidBrush(view.TooltipBorderColor);
|
||||
this.TooltipBackBrush = new SolidBrush(view.TooltipBackColor);
|
||||
|
||||
this.TimeRangeSelecetionBackBrush = new SolidBrush(view.TimeRangeSelecetionBackColor);
|
||||
this.SelectionRectangleBackBrush = new SolidBrush(view.SelectionRectangleBackColor);
|
||||
|
||||
this.GridPen = new Pen(this.GridBrush, 1);
|
||||
this.CurrentTimeLinePen = new Pen(this.CurrentTimeLineBrush, 1);
|
||||
this.ItemBorderPen = new Pen(this.ItemBorderBrush, 1);
|
||||
this.ItemBackPen = new Pen(this.ItemBackBrush, 1);
|
||||
this.ItemSelectionBorderPen = new Pen(this.ItemSelectionBorderBrush, 1);
|
||||
this.RowSelectionBorderPen = new Pen(this.RowSelectionBorderBrush, 1);
|
||||
this.TooltipBorderPen = new Pen(this.TooltipBorderBrush, 1);
|
||||
this.ItemStartFlagPen = new Pen(this.ItemStartFlagBrush, 2);
|
||||
this.ItemSubRangeBackPen = new Pen(this.ItemSubRangeBackBrush, 1);
|
||||
this.ItemSelectionSubRangeBackPen = new Pen(this.ItemSelectionSubRangeBackBrush, 1);
|
||||
}
|
||||
public SolidBrush GridBrush { get; set; }
|
||||
|
||||
public SolidBrush ColumnDateTextBrush { get; set; }
|
||||
public SolidBrush ColumnHourTextBrush { get; set; }
|
||||
public SolidBrush HeaderBackBrush { get; set; }
|
||||
|
||||
public SolidBrush BackBrush { get; set; }
|
||||
public SolidBrush ContentBackBrush { get; set; }
|
||||
|
||||
public SolidBrush CurrentTimeLineBrush { get; set; }
|
||||
|
||||
public SolidBrush ItemTextBrush { get; set; }
|
||||
public SolidBrush ItemBackBrush { get; set; }
|
||||
public SolidBrush ItemBorderBrush { get; set; }
|
||||
public SolidBrush ItemStartFlagBrush { get; set; }
|
||||
public SolidBrush ItemSubRangeBackBrush { get; set; }
|
||||
public SolidBrush ItemSelectionTextBrush { get; set; }
|
||||
public SolidBrush ItemSelectionBackBrush { get; set; }
|
||||
public SolidBrush ItemSelectionBorderBrush { get; set; }
|
||||
public SolidBrush ItemSelectionSubRangeBackBrush { get; set; }
|
||||
public SolidBrush ItemWarnningTextBrush { get; set; }
|
||||
|
||||
|
||||
public SolidBrush RowHeaderTextBrush { get; set; }
|
||||
public SolidBrush RowSelectionHeaderTextBrush { get; set; }
|
||||
public SolidBrush RowSelectionBorderBrush { get; set; }
|
||||
public SolidBrush RowSelectionHeaderBackBrush { get; set; }
|
||||
public SolidBrush RowSelectionContentBackBrush { get; set; }
|
||||
|
||||
public SolidBrush TooltipTextBrush { get; set; }
|
||||
public SolidBrush TooltipBorderBrush { get; set; }
|
||||
public SolidBrush TooltipBackBrush { get; set; }
|
||||
|
||||
public SolidBrush TimeRangeSelecetionBackBrush { get; set; }
|
||||
public SolidBrush SelectionRectangleBackBrush { get; set; }
|
||||
|
||||
public Pen GridPen { get; }
|
||||
public Pen CurrentTimeLinePen { get; }
|
||||
public Pen ItemBorderPen { get; }
|
||||
public Pen ItemBackPen { get; }
|
||||
public Pen ItemSelectionBorderPen { get; }
|
||||
public Pen RowSelectionBorderPen { get; }
|
||||
public Pen TooltipBorderPen { get; }
|
||||
public Pen ItemStartFlagPen { get; }
|
||||
public Pen ItemSubRangeBackPen { get; }
|
||||
public Pen ItemSelectionSubRangeBackPen { get; }
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
this.GridBrush.Color = View.GridColor;
|
||||
|
||||
this.ColumnDateTextBrush.Color = View.ColumnDateTextColor;
|
||||
this.ColumnHourTextBrush.Color = View.ColumnHourTextColor;
|
||||
this.HeaderBackBrush.Color = View.HeaderBackColor;
|
||||
|
||||
this.ContentBackBrush.Color = View.ContentBackColor;
|
||||
|
||||
this.CurrentTimeLineBrush.Color = View.CurrentTimeLineColor;
|
||||
|
||||
this.ItemTextBrush.Color = View.ItemTextColor;
|
||||
this.ItemBackBrush.Color = View.ItemBackColor;
|
||||
this.ItemBorderBrush.Color = View.ItemBorderColor;
|
||||
this.ItemStartFlagBrush.Color = View.ItemStartFlagColor;
|
||||
this.ItemSubRangeBackBrush.Color = View.ItemSubRangeBackColor;
|
||||
this.ItemSelectionTextBrush.Color = View.ItemSelectionTextColor;
|
||||
this.ItemSelectionBackBrush.Color = View.ItemSelectionBackColor;
|
||||
this.ItemSelectionBorderBrush.Color = View.ItemSelectionBorderColor;
|
||||
this.ItemSelectionSubRangeBackBrush.Color = View.ItemSelectionSubRangeBackColor;
|
||||
this.ItemWarnningTextBrush.Color = View.ItemWarnningTextColor;
|
||||
|
||||
this.RowHeaderTextBrush.Color = View.RowHeaderTextColor;
|
||||
this.RowSelectionHeaderTextBrush.Color = View.RowSelectionHeaderTextColor;
|
||||
this.RowSelectionBorderBrush.Color = View.RowSelectionBorderColor;
|
||||
this.RowSelectionHeaderBackBrush.Color = View.RowSelectionHeaderBackColor;
|
||||
this.RowSelectionContentBackBrush.Color = View.RowSelectionContentBackColor;
|
||||
|
||||
this.TooltipTextBrush.Color = View.TooltipTextColor;
|
||||
this.TooltipBorderBrush.Color = View.TooltipBorderColor;
|
||||
this.TooltipBackBrush.Color = View.TooltipBackColor;
|
||||
|
||||
this.TimeRangeSelecetionBackBrush.Color = View.TimeRangeSelecetionBackColor;
|
||||
this.SelectionRectangleBackBrush.Color = View.SelectionRectangleBackColor;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.GridPen.Dispose();
|
||||
this.CurrentTimeLinePen.Dispose();
|
||||
this.ItemBorderPen.Dispose();
|
||||
this.ItemBackPen.Dispose();
|
||||
this.ItemSelectionBorderPen.Dispose();
|
||||
this.RowSelectionBorderPen.Dispose();
|
||||
this.TooltipBorderPen.Dispose();
|
||||
this.ItemStartFlagPen.Dispose();
|
||||
this.ItemSubRangeBackPen.Dispose();
|
||||
this.ItemSelectionSubRangeBackPen.Dispose();
|
||||
|
||||
this.BackBrush.Dispose();
|
||||
this.GridBrush.Dispose();
|
||||
|
||||
this.ColumnDateTextBrush.Dispose();
|
||||
this.ColumnHourTextBrush.Dispose();
|
||||
this.HeaderBackBrush.Dispose();
|
||||
|
||||
this.ContentBackBrush.Dispose();
|
||||
|
||||
this.CurrentTimeLineBrush.Dispose();
|
||||
|
||||
this.ItemTextBrush.Dispose();
|
||||
this.ItemBackBrush.Dispose();
|
||||
this.ItemBorderBrush.Dispose();
|
||||
this.ItemStartFlagBrush.Dispose();
|
||||
this.ItemSubRangeBackBrush.Dispose();
|
||||
this.ItemSelectionTextBrush.Dispose();
|
||||
this.ItemSelectionBackBrush.Dispose();
|
||||
this.ItemSelectionBorderBrush.Dispose();
|
||||
this.ItemSelectionSubRangeBackBrush.Dispose();
|
||||
this.ItemWarnningTextBrush.Dispose();
|
||||
|
||||
this.RowHeaderTextBrush.Dispose();
|
||||
this.RowSelectionHeaderTextBrush.Dispose();
|
||||
this.RowSelectionBorderBrush.Dispose();
|
||||
this.RowSelectionHeaderBackBrush.Dispose();
|
||||
this.RowSelectionContentBackBrush.Dispose();
|
||||
|
||||
this.TooltipTextBrush.Dispose();
|
||||
this.TooltipBorderBrush.Dispose();
|
||||
this.TooltipBackBrush.Dispose();
|
||||
|
||||
this.TimeRangeSelecetionBackBrush.Dispose();
|
||||
this.SelectionRectangleBackBrush.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图像集合
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class GanttChartCollection<T> : ICollection<T>
|
||||
{
|
||||
private List<T> Items;
|
||||
internal bool IsChanged { get; set; }
|
||||
internal DateTime StartDate { get; set; }
|
||||
public GanttChartCollection()
|
||||
{
|
||||
Items = new List<T>();
|
||||
}
|
||||
public GanttChartCollection(ICollection<T> items):this()
|
||||
{
|
||||
Items.AddRange(items);
|
||||
IsChanged = true;
|
||||
}
|
||||
public int Count => Items.Count;
|
||||
|
||||
bool ICollection<T>.IsReadOnly => false;
|
||||
|
||||
public void Add(T item)
|
||||
{
|
||||
Items.Add(item);
|
||||
IsChanged = true;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Items.Clear();
|
||||
IsChanged = false;
|
||||
}
|
||||
|
||||
public bool Contains(T item) => Items.Contains(item);
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex) => Items.CopyTo(array, arrayIndex);
|
||||
|
||||
public IEnumerator<T> GetEnumerator() => Items.GetEnumerator();
|
||||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
if (Items.Remove(item))
|
||||
{
|
||||
IsChanged = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return Items.GetEnumerator();
|
||||
}
|
||||
public T this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return Items[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图项单击事件参数
|
||||
/// </summary>
|
||||
public class GanttChartItemClickEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 项
|
||||
/// </summary>
|
||||
public GanttChartViewItem Item { get; private set; }
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public GanttChartItemClickEventArgs(GanttChartViewItem item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图项双击事件参数
|
||||
/// </summary>
|
||||
public class GanttChartItemDoubleClickEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 项
|
||||
/// </summary>
|
||||
public GanttChartViewItem Item { get; private set; }
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public GanttChartItemDoubleClickEventArgs(GanttChartViewItem item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图属性改变事件参数
|
||||
/// </summary>
|
||||
public class GanttChartPropertyChangeEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
public GanttChartPropertyChangeEventArgs(string name, object value)
|
||||
{
|
||||
PropertyName = name;
|
||||
PropertyValue = value;
|
||||
}
|
||||
/// <summary>
|
||||
/// 属性名
|
||||
/// </summary>
|
||||
public string PropertyName { get; set; }
|
||||
/// <summary>
|
||||
/// 属性值
|
||||
/// </summary>
|
||||
public object PropertyValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图范围选择事件参数
|
||||
/// </summary>
|
||||
public class GanttChartRangeSelectedEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 事件范围
|
||||
/// </summary>
|
||||
public TimeRange Range { get; private set; }
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
/// <param name="range"></param>
|
||||
public GanttChartRangeSelectedEventArgs(TimeRange range)
|
||||
{
|
||||
Range = range;
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
/// <param name="startTime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
public GanttChartRangeSelectedEventArgs(DateTime startTime, DateTime endTime)
|
||||
{
|
||||
Range = new TimeRange { StartTime = startTime, EndTime = endTime };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图行选中事件参数
|
||||
/// </summary>
|
||||
public class GanttChartRowSelectedEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 行
|
||||
/// </summary>
|
||||
public GanttChartViewRow Row { get; private set; }
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
public GanttChartRowSelectedEventArgs(GanttChartViewRow row)
|
||||
{
|
||||
Row = row;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,410 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图控件
|
||||
/// 该部分类主要处理事件
|
||||
/// </summary>
|
||||
public partial class GanttChartView
|
||||
{
|
||||
private bool _IsShiftPress = false;
|
||||
private bool _IsCtrlPress = false;
|
||||
private bool _IsAltPress = false;
|
||||
private bool _IsMouseDown = false;
|
||||
private bool _IsAjustSize = false;
|
||||
private bool _IsDragItem = false;
|
||||
private bool _IsShowTooltip = false;
|
||||
private Point _DragStartLocation = Point.Empty;
|
||||
private Point _DragEndLocation = Point.Empty;
|
||||
private Point _ShowTooltipPoint = Point.Empty;
|
||||
private Rectangle _SelectionRange = Rectangle.Empty;
|
||||
private GanttChartViewItem _DragItem = null;
|
||||
private GanttChartViewItem _ShowTooltipItem = null;
|
||||
public event EventHandler<GanttChartPropertyChangeEventArgs> PropertyChanged;
|
||||
public event EventHandler<GanttChartItemClickEventArgs> ItemClick;
|
||||
public event EventHandler<GanttChartItemDoubleClickEventArgs> ItemDoubleClick;
|
||||
public event EventHandler<GanttChartRowSelectedEventArgs> RowSelected;
|
||||
public event EventHandler<GanttChartRangeSelectedEventArgs> RangeSelected;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化事件
|
||||
/// </summary>
|
||||
protected void InitEvent()
|
||||
{
|
||||
_VScrollBar.Scroll += new ScrollEventHandler(VScrollBar_Scroll);
|
||||
_HScrollBar.Scroll += new ScrollEventHandler(HScrollBar_Scroll);
|
||||
_ContentControl.Paint += OnContentControlPaint;
|
||||
_ContentControl.MouseDown += OnMouseDown;
|
||||
_ContentControl.MouseUp += OnMouseUp;
|
||||
_ContentControl.MouseMove += OnMouseMove;
|
||||
_ContentControl.MouseClick += OnMouseClick;
|
||||
_ContentControl.MouseDoubleClick += OnMouseDoubleClick;
|
||||
}
|
||||
/// <summary>
|
||||
/// 销毁事件
|
||||
/// </summary>
|
||||
protected void DisposeEvent()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 键盘按下事件
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
_IsShiftPress = e.Shift;
|
||||
_IsCtrlPress = e.Control;
|
||||
_IsAltPress = e.Alt;
|
||||
base.OnKeyDown(e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 键盘弹起事件
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnKeyUp(KeyEventArgs e)
|
||||
{
|
||||
_IsShiftPress = e.Shift;
|
||||
_IsCtrlPress = e.Control;
|
||||
_IsAltPress = e.Alt;
|
||||
base.OnKeyUp(e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 鼠标单击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void OnMouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_DragStartLocation != Point.Empty && e.X != _DragStartLocation.X && _DragStartLocation.Y != e.Y)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (IsHoverRowHeader(e.Location) || IsHoverRow(e.Location))
|
||||
{
|
||||
_SelectionRow = GetRow(e.Location);
|
||||
Invalidate();
|
||||
RowSelected?.Invoke(this, new GanttChartRowSelectedEventArgs(_SelectionRow));
|
||||
}
|
||||
if (IsHoverItem(e.Location))
|
||||
{
|
||||
_SelectionItem = GetItem(e.Location);
|
||||
Invalidate();
|
||||
ItemClick?.Invoke(this, new GanttChartItemClickEventArgs(_SelectionItem));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 鼠标双击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void OnMouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (IsHoverItem(e.Location))
|
||||
{
|
||||
_SelectionItem = GetItem(e.Location);
|
||||
Invalidate();
|
||||
if(ItemDoubleClick != null)
|
||||
{
|
||||
if (_IsShowTooltip)
|
||||
{
|
||||
_IsShowTooltip = false;
|
||||
_ShowTooltipItem = null;
|
||||
_ShowTooltipPoint = Point.Empty;
|
||||
}
|
||||
ItemDoubleClick(this, new GanttChartItemDoubleClickEventArgs(_SelectionItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 鼠标滚动事件
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnMouseWheel(MouseEventArgs e)
|
||||
{
|
||||
if (_IsShowTooltip)
|
||||
{
|
||||
_IsShowTooltip = false;
|
||||
_ShowTooltipItem = null;
|
||||
_ShowTooltipPoint = Point.Empty;
|
||||
}
|
||||
//int i = e.Delta > 0 ? -1 : 1;
|
||||
var scrollbar = _IsShiftPress ? _HScrollBar : (ScrollBar)_VScrollBar;
|
||||
var h = scrollbar.Value - (int)(e.Delta * MouseWheelSensitivity);
|
||||
if (h > scrollbar.Maximum)
|
||||
{
|
||||
h = scrollbar.Maximum;
|
||||
}
|
||||
if (h < scrollbar.Minimum)
|
||||
{
|
||||
h = scrollbar.Minimum;
|
||||
}
|
||||
scrollbar.Value = h;
|
||||
Invalidate();
|
||||
base.OnMouseWheel(e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 鼠标按下事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void OnMouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_SelectionRow != null || _SelectionItem != null || _DragItem != null)
|
||||
{
|
||||
_SelectionRow = null;
|
||||
_SelectionItem = null;
|
||||
_DragItem = null;
|
||||
Invalidate();
|
||||
}
|
||||
_IsMouseDown = e.Button == MouseButtons.Left && true;
|
||||
if (_IsMouseDown)
|
||||
{
|
||||
_SelectionRange = Rectangle.Empty;
|
||||
_SelectionTimeRange = null;
|
||||
_DragStartLocation = e.Location;
|
||||
if (IsHoverDateSplitLine(e.Location) && !IsHoverItem(e.Location))
|
||||
{
|
||||
_IsAjustSize = true;
|
||||
}
|
||||
else if (IsHoverItem(e.Location))
|
||||
{
|
||||
_IsDragItem = true;
|
||||
_DragItem = GetItem(e.Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 控件创建事件
|
||||
/// </summary>
|
||||
protected override void OnCreateControl()
|
||||
{
|
||||
this.Brushes = new GanttChartBrushes(this);
|
||||
_HScrollBar.Width = this.Width - VScrollWidth;
|
||||
_VScrollBar.Height = this.Height - HScrollHeight;
|
||||
AdjustScrollbar();
|
||||
base.OnCreateControl();
|
||||
}
|
||||
/// <summary>
|
||||
/// 控件大小变化事件
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
_HScrollBar.Width = this.Width - VScrollWidth;
|
||||
_VScrollBar.Height = this.Height - HScrollHeight;
|
||||
AdjustScrollbar();
|
||||
Invalidate();
|
||||
base.OnSizeChanged(e);
|
||||
}
|
||||
/// <summary>
|
||||
/// 控件绘制事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnContentControlPaint(object sender, PaintEventArgs e)
|
||||
{
|
||||
int bottom = ColumnHeight + ItemHeight + RowSpacing * 2;
|
||||
if (Rows != null && Rows.Any())
|
||||
{
|
||||
var last = Rows.Last();
|
||||
bottom = last.Bottom;
|
||||
}
|
||||
DrawBack(e.Graphics, bottom);
|
||||
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||
DrawHeader(e.Graphics, bottom);
|
||||
DrawColumnHeader(e.Graphics);
|
||||
DrawTimeLine(e.Graphics, bottom);
|
||||
|
||||
DrawSelectingRectangle(e.Graphics);
|
||||
|
||||
DrawSelectionRange(e.Graphics);
|
||||
|
||||
DrawRows(e.Graphics, bottom);
|
||||
|
||||
DrawItemTooltip(e.Graphics);
|
||||
}
|
||||
/// <summary>
|
||||
/// 鼠标弹起事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void OnMouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_IsMouseDown)
|
||||
{
|
||||
if (_IsAjustSize)
|
||||
{
|
||||
_IsAjustSize = false;
|
||||
var w = e.X - _DragStartLocation.X + DateWidth;
|
||||
if (w < MinDateWidth)
|
||||
{
|
||||
DateWidth = MinDateWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
DateWidth = (w / 48 + (w % 48 == 0 ? 0 : 1)) * 48;
|
||||
}
|
||||
if(Rows != null)
|
||||
{
|
||||
Rows.IsChanged = true;
|
||||
}
|
||||
AdjustScrollbar();
|
||||
Invalidate();
|
||||
}
|
||||
else if (_IsDragItem)
|
||||
{
|
||||
_IsDragItem = false;
|
||||
//TODO:触发Drag事件
|
||||
Invalidate();
|
||||
}
|
||||
else if(!_DragStartLocation.IsEmpty && e.X != _DragStartLocation.X && e.Y != _DragStartLocation.Y && _DragStartLocation.X > RowHeaderWidth && _DragStartLocation.Y > ColumnHeight)
|
||||
{
|
||||
_DragEndLocation = e.Location;
|
||||
var row = GetRow(_DragStartLocation);
|
||||
if (row != null)
|
||||
{
|
||||
var width = Math.Abs(_DragEndLocation.X - _DragStartLocation.X);
|
||||
if (_DragEndLocation.X < RowHeaderWidth)
|
||||
{
|
||||
width -= RowHeaderWidth - _DragEndLocation.X;
|
||||
}
|
||||
else if (_DragEndLocation.X > ((int)(EndDate.Date - StartDate.Date).TotalDays + 1) * DateWidth + RowHeaderWidth - _HScrollBar.Value)
|
||||
{
|
||||
width = ((int)(EndDate.Date - StartDate.Date).TotalDays + 1) * DateWidth + RowHeaderWidth - _HScrollBar.Value - _DragStartLocation.X;
|
||||
}
|
||||
var start = new Point(Math.Min(_DragStartLocation.X, Math.Max(_DragEndLocation.X, RowHeaderWidth)), row.Top + 1);
|
||||
_SelectionRange = new Rectangle(start, new Size(width, row.Bottom - row.Top - 2));
|
||||
|
||||
Invalidate();
|
||||
var mw = DateWidth / 24f / 60f;
|
||||
var ts = StartDate.AddMinutes((int)((_DragStartLocation.X - RowHeaderWidth + _HScrollBar.Value) / mw));
|
||||
var te = StartDate.AddMinutes((int)((_DragEndLocation.X - RowHeaderWidth + _HScrollBar.Value) / mw));
|
||||
if (te < ts)
|
||||
{
|
||||
var tt = te;
|
||||
te = ts;
|
||||
ts = tt;
|
||||
}
|
||||
_SelectionTimeRange = new TimeRange { StartTime = ts, EndTime = te };
|
||||
RangeSelected?.Invoke(this, new GanttChartRangeSelectedEventArgs(ts, te));
|
||||
}
|
||||
}
|
||||
}
|
||||
_IsMouseDown = false;
|
||||
_DragStartLocation = Point.Empty;
|
||||
_DragEndLocation = Point.Empty;
|
||||
}
|
||||
/// <summary>
|
||||
/// 鼠标移动事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void OnMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_IsMouseDown)
|
||||
{
|
||||
if (_IsShowTooltip)
|
||||
{
|
||||
_IsShowTooltip = false;
|
||||
_ShowTooltipItem = null;
|
||||
_ShowTooltipPoint = Point.Empty;
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
if (_IsDragItem)
|
||||
{
|
||||
|
||||
}
|
||||
else if (_DragStartLocation.X > RowHeaderWidth && _DragStartLocation.Y > ColumnHeight)
|
||||
{
|
||||
//TODO: 画选择框
|
||||
_DragEndLocation = e.Location;
|
||||
Invalidate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (IsHoverDateSplitLine(e.Location) && !IsHoverItem(e.Location))
|
||||
{
|
||||
Cursor = Cursors.VSplit;
|
||||
}
|
||||
//else if (IsHoverRowHeader(e))
|
||||
//{
|
||||
// Cursor = DefaultCursor;
|
||||
//}
|
||||
else if (IsHoverItem(e.Location))
|
||||
{
|
||||
Cursor = Cursors.Hand;
|
||||
//TODO:显示Tooltip
|
||||
if (!_IsShowTooltip || GetItem(e.Location) != _ShowTooltipItem)
|
||||
{
|
||||
_IsShowTooltip = true;
|
||||
_ShowTooltipItem = GetItem(e.Location);
|
||||
_ShowTooltipPoint = ComputeTooltipLocation(e.Location);
|
||||
|
||||
Invalidate();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor = DefaultCursor;
|
||||
}
|
||||
if (_IsShowTooltip)
|
||||
{
|
||||
_IsShowTooltip = false;
|
||||
_ShowTooltipItem = null;
|
||||
_ShowTooltipPoint = Point.Empty;
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 横向滚动事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void HScrollBar_Scroll(object sender, ScrollEventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
/// <summary>
|
||||
/// 纵向滚动事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void VScrollBar_Scroll(object sender, ScrollEventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
/// <summary>
|
||||
/// 属性改变事件
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
private void OnPropertyChanged(string name, object value)
|
||||
{
|
||||
this.Brushes?.Refresh();
|
||||
var args = new GanttChartPropertyChangeEventArgs(name, value);
|
||||
PropertyChanged?.Invoke(this, args);
|
||||
if(name == nameof(BlockType))
|
||||
{
|
||||
Rows.IsChanged = true;
|
||||
}
|
||||
AdjustScrollbar();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图控件
|
||||
/// 该部分类处理甘特图逻辑
|
||||
/// </summary>
|
||||
public partial class GanttChartView
|
||||
{
|
||||
/// <summary>
|
||||
/// 鼠标是否经过日分割线
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <returns></returns>
|
||||
private bool IsHoverDateSplitLine(Point e)
|
||||
{
|
||||
var t = (e.X + _HScrollBar.Value - RowHeaderWidth + this.DateWidth) % this.DateWidth;
|
||||
return e.X > this.RowHeaderWidth + 3 && e.X < ((EndDate.Date - StartDate.Date).TotalDays + 1) * DateWidth + RowHeaderWidth - _HScrollBar.Value && (this.DateWidth - 2 <= t || t <= 1);
|
||||
}
|
||||
/// <summary>
|
||||
/// 鼠标是否经过行标题
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <returns></returns>
|
||||
private bool IsHoverRowHeader(Point e)
|
||||
{
|
||||
return e.X <= this.RowHeaderWidth && e.Y > this.ColumnHeight;
|
||||
}
|
||||
/// <summary>
|
||||
/// 鼠标是否经过行
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <returns></returns>
|
||||
private bool IsHoverRow(Point e)
|
||||
{
|
||||
var y = e.Y + _VScrollBar.Value;
|
||||
return e.X < ((EndDate.Date - StartDate.Date).TotalDays + 1) * DateWidth + RowHeaderWidth - _HScrollBar.Value && e.Y > this.ColumnHeight && Rows != null ? Rows.Any(r=>r.Top <= y && r.Bottom >= y) : false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 鼠标是否经过项
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <returns></returns>
|
||||
private bool IsHoverItem(Point e)
|
||||
{
|
||||
if(e.X > this.RowHeaderWidth && e.Y > this.ColumnHeight && Rows != null)
|
||||
{
|
||||
var row = GetRow(e);
|
||||
if (row != null && row.Items != null && row.Items.Any())
|
||||
{
|
||||
var x = e.X + _HScrollBar.Value;
|
||||
var y = e.Y + _VScrollBar.Value;
|
||||
return row.Items.Any(r=>r.Left<=x && x <= r.Left + Math.Max(r.Width, r.TextWidth) && r.Top <= y && y <= r.Top + ItemHeight);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取项
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <returns></returns>
|
||||
private GanttChartViewItem GetItem(Point e)
|
||||
{
|
||||
if (e.X > this.RowHeaderWidth && e.X < ((EndDate.Date - StartDate.Date).TotalDays + 1) * DateWidth + RowHeaderWidth - _HScrollBar.Value && e.Y > this.ColumnHeight && Rows != null)
|
||||
{
|
||||
var row = GetRow(e);
|
||||
if (row != null && row.Items != null && row.Items.Any())
|
||||
{
|
||||
var x = e.X + _HScrollBar.Value;
|
||||
var y = e.Y + _VScrollBar.Value;
|
||||
return row.Items.OrderBy(r=>r.Left).LastOrDefault(r => r.Left <= x && x <= r.Left + Math.Max(r.Width, r.TextWidth) && r.Top <= y && y <= r.Top + ItemHeight);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取行
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <returns></returns>
|
||||
private GanttChartViewRow GetRow(Point e)
|
||||
{
|
||||
if (e.X < ((EndDate.Date - StartDate.Date).TotalDays + 1) * DateWidth + RowHeaderWidth - _HScrollBar.Value && e.Y > this.ColumnHeight && e.Y + _VScrollBar.Value < (Rows == null || !Rows.Any() ? 0 : Rows.Max(r=>r.Bottom)) && Rows != null)
|
||||
{
|
||||
var y = e.Y + _VScrollBar.Value;
|
||||
return Rows.FirstOrDefault(r => r.Top <= y && r.Bottom >= y);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算所有行和项的大小
|
||||
/// </summary>
|
||||
private void ComputeRowsAndItemsSize()
|
||||
{
|
||||
var minuteWidth = DateWidth / 24f / 60f;
|
||||
var currentRowY = ColumnHeight;
|
||||
foreach (var row in Rows)
|
||||
{
|
||||
row.Top = currentRowY;
|
||||
var currentItemY = currentRowY + RowSpacing;
|
||||
row.Bottom = currentRowY;
|
||||
if(row.Items != null)
|
||||
{
|
||||
var beforeTop = row.Top + RowSpacing;
|
||||
var beforeRight = 0;
|
||||
var items = row.Items.OrderBy(r => r.StartTime).ToList();
|
||||
for ( int i = 0; i < items.Count; i++)
|
||||
{
|
||||
var item = items[i];
|
||||
if (item.EndTime >= StartTime && item.StartTime <= EndTime && item.EndTime >= item.StartTime)
|
||||
{
|
||||
item.Left = (int)((item.StartTime - StartTime).TotalMinutes * minuteWidth) + RowHeaderWidth;
|
||||
item.Width = (int)((item.EndTime - item.StartTime).TotalMinutes * minuteWidth);
|
||||
item.TextWidth = TextRenderer.MeasureText(item.Title, ItemTextFont, System.Drawing.Size.Empty).Width;
|
||||
if (item.Left < beforeRight || BlockType == GanttChartViewItemBlockType.Block && i > 0)
|
||||
{
|
||||
var its = items.Take(i).GroupBy(r=>r.Top).Select(r=>r.OrderByDescending(p => p.Left + p.TextWidth).First());
|
||||
if(BlockType == GanttChartViewItemBlockType.Return && its.Any(r=>r.Left + r.TextWidth < item.Left))
|
||||
{
|
||||
var it = its.First(r => r.Left + r.TextWidth < item.Left);
|
||||
item.Top = it.Top;
|
||||
beforeTop = it.Top;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(BlockType == GanttChartViewItemBlockType.Return && its.Any())
|
||||
{
|
||||
beforeTop = its.Max(r => r.Top);
|
||||
}
|
||||
item.Top = beforeTop + ItemHeight + ItemSpacing;
|
||||
beforeTop += ItemHeight + ItemSpacing;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
if (BlockType == GanttChartViewItemBlockType.Return && beforeTop != row.Top + RowSpacing)
|
||||
{
|
||||
beforeTop = row.Top + RowSpacing;
|
||||
}
|
||||
}
|
||||
item.Top = beforeTop;
|
||||
}
|
||||
if (BlockType == GanttChartViewItemBlockType.Compact)
|
||||
{
|
||||
beforeRight = item.Left + item.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
beforeRight = item.Left + Math.Max(item.TextWidth, item.Width);
|
||||
}
|
||||
if (item.Ranges != null && item.Ranges.Any())
|
||||
{
|
||||
var subs = item.Ranges.OrderBy(r => r.StartTime);
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
sub.Left = item.Left + (int)((sub.StartTime - item.StartTime).TotalMinutes * minuteWidth);
|
||||
sub.Width = (int)((sub.EndTime - sub.StartTime).TotalMinutes * minuteWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//row.Items.Remove(item);
|
||||
//i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (row.Items == null || !row.Items.Any(r=>r.Left > 0))
|
||||
{
|
||||
row.Bottom = row.Top + ItemHeight + RowSpacing * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Bottom = Math.Max(row.Items.Max(r => r.Top), ColumnHeight + RowSpacing) + ItemHeight + RowSpacing;
|
||||
}
|
||||
currentRowY = row.Bottom;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算提示框的位置
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <returns></returns>
|
||||
private Point ComputeTooltipLocation(Point e)
|
||||
{
|
||||
var size = TooltipOuterSize;
|
||||
var x = e.X;
|
||||
if (e.X + size.Width > _ContentControl.Width)
|
||||
{
|
||||
var t = e.X - size.Width;
|
||||
if (t < 0 && 0 - t < (e.X + size.Width) - _ContentControl.Width || t >= 0)
|
||||
{
|
||||
x = t;
|
||||
}
|
||||
}
|
||||
var y = _ShowTooltipItem.Top - _VScrollBar.Value + ItemHeight + ItemSpacing;
|
||||
if(y + size.Height > _ContentControl.Height)
|
||||
{
|
||||
var t = _ShowTooltipItem.Top - _VScrollBar.Value - ItemSpacing - size.Height;
|
||||
if (t < 0 && 0 - t < (y + size.Height) - _ContentControl.Height || t >= 0)
|
||||
{
|
||||
y = t;
|
||||
}
|
||||
}
|
||||
return new Point(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,756 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图控件
|
||||
/// 该部分类主要是甘特图的属性
|
||||
/// </summary>
|
||||
public partial class GanttChartView
|
||||
{
|
||||
#region Fonts
|
||||
private Font _ColumnDateTextFont = DefaultFont;
|
||||
|
||||
/// <summary>
|
||||
/// 日期字体
|
||||
/// </summary>
|
||||
public Font ColumnDateTextFont
|
||||
{
|
||||
get { return _ColumnDateTextFont; }
|
||||
set { _ColumnDateTextFont = value; OnPropertyChanged(nameof(ColumnDateTextFont), value); }
|
||||
}
|
||||
|
||||
private Font _ColumnHourTextFont = DefaultFont;
|
||||
|
||||
/// <summary>
|
||||
/// 时间字体
|
||||
/// </summary>
|
||||
public Font ColumnHourTextFont
|
||||
{
|
||||
get { return _ColumnHourTextFont; }
|
||||
set { _ColumnHourTextFont = value; OnPropertyChanged(nameof(ColumnHourTextFont), value); }
|
||||
}
|
||||
|
||||
private Font _RowHeaderTextFont = DefaultFont;
|
||||
|
||||
/// <summary>
|
||||
/// 行标题字体
|
||||
/// </summary>
|
||||
public Font RowHeaderTextFont
|
||||
{
|
||||
get { return _RowHeaderTextFont; }
|
||||
set { _RowHeaderTextFont = value; OnPropertyChanged(nameof(RowHeaderTextFont), value); }
|
||||
}
|
||||
|
||||
private Font _ItemTextFont = DefaultFont;
|
||||
|
||||
/// <summary>
|
||||
/// 项字体
|
||||
/// </summary>
|
||||
public Font ItemTextFont
|
||||
{
|
||||
get { return _ItemTextFont; }
|
||||
set { _ItemTextFont = value; OnPropertyChanged(nameof(ItemTextFont), value); }
|
||||
}
|
||||
|
||||
private Font _TooltipTextFont = DefaultFont;
|
||||
|
||||
/// <summary>
|
||||
/// 提示文字字体
|
||||
/// </summary>
|
||||
public Font TooltipTextFont
|
||||
{
|
||||
get { return _TooltipTextFont; }
|
||||
set { _TooltipTextFont = value; OnPropertyChanged(nameof(TooltipTextFont), value); }
|
||||
}
|
||||
#endregion
|
||||
#region Colors
|
||||
private Color _GridColor = Color.FromArgb(210, 210, 210);
|
||||
|
||||
/// <summary>
|
||||
/// 网格颜色
|
||||
/// </summary>
|
||||
public Color GridColor
|
||||
{
|
||||
get { return _GridColor; }
|
||||
set { _GridColor = value; OnPropertyChanged(nameof(GridColor), value); }
|
||||
}
|
||||
|
||||
private Color _ColumnDateTextColor = Color.FromArgb(102, 102, 102);
|
||||
|
||||
/// <summary>
|
||||
/// 日期文字颜色
|
||||
/// </summary>
|
||||
public Color ColumnDateTextColor
|
||||
{
|
||||
get { return _ColumnDateTextColor; }
|
||||
set { _ColumnDateTextColor = value; OnPropertyChanged(nameof(ColumnDateTextColor), value); }
|
||||
}
|
||||
|
||||
private Color _ColumnHourTextColor = Color.FromArgb(102, 102, 102);
|
||||
|
||||
/// <summary>
|
||||
/// 小时文字颜色
|
||||
/// </summary>
|
||||
public Color ColumnHourTextColor
|
||||
{
|
||||
get { return _ColumnHourTextColor; }
|
||||
set { _ColumnHourTextColor = value; OnPropertyChanged(nameof(ColumnHourTextColor), value); }
|
||||
}
|
||||
|
||||
private Color _HeaderBackColor = Color.FromArgb(247, 247, 247);
|
||||
|
||||
/// <summary>
|
||||
/// 标题背景颜色
|
||||
/// </summary>
|
||||
public Color HeaderBackColor
|
||||
{
|
||||
get { return _HeaderBackColor; }
|
||||
set { _HeaderBackColor = value; OnPropertyChanged(nameof(HeaderBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _ContentBackColor = Color.White;
|
||||
|
||||
/// <summary>
|
||||
/// 内容背景颜色
|
||||
/// </summary>
|
||||
public Color ContentBackColor
|
||||
{
|
||||
get { return _ContentBackColor; }
|
||||
set { _ContentBackColor = value; OnPropertyChanged(nameof(ContentBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _CurrentTimeLineColor = Color.Red;
|
||||
|
||||
/// <summary>
|
||||
/// 当前时间线颜色
|
||||
/// </summary>
|
||||
public Color CurrentTimeLineColor
|
||||
{
|
||||
get { return _CurrentTimeLineColor; }
|
||||
set { _CurrentTimeLineColor = value; OnPropertyChanged(nameof(CurrentTimeLineColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemTextColor = Color.FromArgb(51, 51, 51);
|
||||
|
||||
/// <summary>
|
||||
/// 项文字颜色
|
||||
/// </summary>
|
||||
public Color ItemTextColor
|
||||
{
|
||||
get { return _ItemTextColor; }
|
||||
set { _ItemTextColor = value; OnPropertyChanged(nameof(ItemTextColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemBackColor = Color.FromArgb(190, 190, 190);
|
||||
|
||||
/// <summary>
|
||||
/// 项背景颜色
|
||||
/// </summary>
|
||||
public Color ItemBackColor
|
||||
{
|
||||
get { return _ItemBackColor; }
|
||||
set { _ItemBackColor = value; OnPropertyChanged(nameof(ItemBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemBorderColor = Color.FromArgb(18, 170, 11);
|
||||
|
||||
/// <summary>
|
||||
/// 项边框颜色
|
||||
/// </summary>
|
||||
public Color ItemBorderColor
|
||||
{
|
||||
get { return _ItemBorderColor; }
|
||||
set { _ItemBorderColor = value; OnPropertyChanged(nameof(ItemBorderColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemStartFlagColor = Color.Red;
|
||||
|
||||
/// <summary>
|
||||
/// 项首标志颜色
|
||||
/// </summary>
|
||||
public Color ItemStartFlagColor
|
||||
{
|
||||
get { return _ItemStartFlagColor; }
|
||||
set { _ItemStartFlagColor = value; OnPropertyChanged(nameof(ItemStartFlagColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemSubRangeBackColor = Color.FromArgb(153, 201, 255);
|
||||
|
||||
/// <summary>
|
||||
/// 项时间范围背景颜色
|
||||
/// </summary>
|
||||
public Color ItemSubRangeBackColor
|
||||
{
|
||||
get { return _ItemSubRangeBackColor; }
|
||||
set { _ItemSubRangeBackColor = value; OnPropertyChanged(nameof(ItemSubRangeBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemSelectionTextColor = Color.FromArgb(18, 170, 11);
|
||||
|
||||
/// <summary>
|
||||
/// 选中项文字颜色
|
||||
/// </summary>
|
||||
public Color ItemSelectionTextColor
|
||||
{
|
||||
get { return _ItemSelectionTextColor; }
|
||||
set { _ItemSelectionTextColor = value; OnPropertyChanged(nameof(ItemSelectionTextColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemSelectionBackColor = Color.FromArgb(229, 249, 229);
|
||||
|
||||
/// <summary>
|
||||
/// 选中项背景颜色
|
||||
/// </summary>
|
||||
public Color ItemSelectionBackColor
|
||||
{
|
||||
get { return _ItemSelectionBackColor; }
|
||||
set { _ItemSelectionBackColor = value; OnPropertyChanged(nameof(ItemSelectionBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemSelectionBorderColor = Color.FromArgb(18, 170, 11);
|
||||
|
||||
/// <summary>
|
||||
/// 选中项边框颜色
|
||||
/// </summary>
|
||||
public Color ItemSelectionBorderColor
|
||||
{
|
||||
get { return _ItemSelectionBorderColor; }
|
||||
set { _ItemSelectionBorderColor = value; OnPropertyChanged(nameof(ItemSelectionBorderColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemSelectionSubRangeBackColor = Color.FromArgb(153, 201, 255);
|
||||
|
||||
/// <summary>
|
||||
/// 选中项时间范围背景颜色
|
||||
/// </summary>
|
||||
public Color ItemSelectionSubRangeBackColor
|
||||
{
|
||||
get { return _ItemSelectionSubRangeBackColor; }
|
||||
set { _ItemSelectionSubRangeBackColor = value; OnPropertyChanged(nameof(ItemSelectionSubRangeBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _RowHeaderTextColor = Color.FromArgb(102, 102, 102);
|
||||
|
||||
/// <summary>
|
||||
/// 行标题文字颜色
|
||||
/// </summary>
|
||||
public Color RowHeaderTextColor
|
||||
{
|
||||
get { return _RowHeaderTextColor; }
|
||||
set { _RowHeaderTextColor = value; OnPropertyChanged(nameof(RowHeaderTextColor), value); }
|
||||
}
|
||||
|
||||
private Color _RowSelectionHeaderTextColor = Color.FromArgb(102, 102, 102);
|
||||
|
||||
/// <summary>
|
||||
/// 选中行标题文字颜色
|
||||
/// </summary>
|
||||
public Color RowSelectionHeaderTextColor
|
||||
{
|
||||
get { return _RowSelectionHeaderTextColor; }
|
||||
set { _RowSelectionHeaderTextColor = value; OnPropertyChanged(nameof(RowSelectionHeaderTextColor), value); }
|
||||
}
|
||||
|
||||
private Color _RowSelectionBorderColor = Color.FromArgb(247, 247, 247);
|
||||
|
||||
/// <summary>
|
||||
/// 选中行边框颜色
|
||||
/// </summary>
|
||||
public Color RowSelectionBorderColor
|
||||
{
|
||||
get { return _RowSelectionBorderColor; }
|
||||
set { _RowSelectionBorderColor = value; OnPropertyChanged(nameof(RowSelectionBorderColor), value); }
|
||||
}
|
||||
|
||||
private Color _RowSelectionHeaderBackColor = Color.FromArgb(247, 247, 247);
|
||||
|
||||
/// <summary>
|
||||
/// 选中行标题背景颜色
|
||||
/// </summary>
|
||||
public Color RowSelectionHeaderBackColor
|
||||
{
|
||||
get { return _RowSelectionHeaderBackColor; }
|
||||
set { _RowSelectionHeaderBackColor = value; OnPropertyChanged(nameof(RowSelectionHeaderBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _RowSelectionContentBackColor = Color.FromArgb(247, 247, 247);
|
||||
|
||||
/// <summary>
|
||||
/// 选中行内容背景颜色
|
||||
/// </summary>
|
||||
public Color RowSelectionContentBackColor
|
||||
{
|
||||
get { return _RowSelectionContentBackColor; }
|
||||
set { _RowSelectionContentBackColor = value; OnPropertyChanged(nameof(RowSelectionContentBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _TooltipTextColor = Color.FromArgb(237, 237, 237);
|
||||
|
||||
/// <summary>
|
||||
/// 提示文字颜色
|
||||
/// </summary>
|
||||
public Color TooltipTextColor
|
||||
{
|
||||
get { return _TooltipTextColor; }
|
||||
set { _TooltipTextColor = value; OnPropertyChanged(nameof(TooltipTextColor), value); }
|
||||
}
|
||||
|
||||
private Color _TooltipBorderColor = Color.FromArgb(102, 0, 0, 0);
|
||||
|
||||
/// <summary>
|
||||
/// 提示边框颜色
|
||||
/// </summary>
|
||||
public Color TooltipBorderColor
|
||||
{
|
||||
get { return _TooltipBorderColor; }
|
||||
set { _TooltipBorderColor = value; OnPropertyChanged(nameof(TooltipBorderColor), value); }
|
||||
}
|
||||
|
||||
private Color _TooltipBackColor = Color.FromArgb(102, 0, 0, 0);
|
||||
|
||||
/// <summary>
|
||||
/// 提示背景颜色
|
||||
/// </summary>
|
||||
public Color TooltipBackColor
|
||||
{
|
||||
get { return _TooltipBackColor; }
|
||||
set { _TooltipBackColor = value; OnPropertyChanged(nameof(TooltipBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _TimeRangeSelecetionBackColor = Color.FromArgb(153, 201, 255);
|
||||
|
||||
/// <summary>
|
||||
/// 选中时间范围背景颜色
|
||||
/// </summary>
|
||||
public Color TimeRangeSelecetionBackColor
|
||||
{
|
||||
get { return _TimeRangeSelecetionBackColor; }
|
||||
set { _TimeRangeSelecetionBackColor = value; OnPropertyChanged(nameof(TimeRangeSelecetionBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _SelectionRectangleBackColor = Color.FromArgb(80, 210, 210, 210);
|
||||
|
||||
/// <summary>
|
||||
/// 选择框背景颜色
|
||||
/// </summary>
|
||||
public Color SelectionRectangleBackColor
|
||||
{
|
||||
get { return _SelectionRectangleBackColor; }
|
||||
set { _SelectionRectangleBackColor = value; OnPropertyChanged(nameof(SelectionRectangleBackColor), value); }
|
||||
}
|
||||
|
||||
private Color _ItemWarnningTextColor = Color.Red;
|
||||
|
||||
/// <summary>
|
||||
/// 项警告文字颜色
|
||||
/// </summary>
|
||||
public Color ItemWarnningTextColor
|
||||
{
|
||||
get { return _ItemWarnningTextColor; }
|
||||
set { _ItemWarnningTextColor = value; OnPropertyChanged(nameof(ItemWarnningTextColor), value); }
|
||||
}
|
||||
#endregion
|
||||
#region Mouse
|
||||
private float _MouseWheelSensitivity = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标滚轮灵敏度
|
||||
/// </summary>
|
||||
[DefaultValue(0.5f)]
|
||||
public float MouseWheelSensitivity
|
||||
{
|
||||
get { return _MouseWheelSensitivity; }
|
||||
set { _MouseWheelSensitivity = value; OnPropertyChanged(nameof(MouseWheelSensitivity), value); }
|
||||
}
|
||||
#endregion
|
||||
#region Size
|
||||
private int _ItemHeight = 30;
|
||||
|
||||
/// <summary>
|
||||
/// 项高度
|
||||
/// </summary>
|
||||
[DefaultValue(30)]
|
||||
public int ItemHeight
|
||||
{
|
||||
get { return _ItemHeight; }
|
||||
set { _ItemHeight = value; OnPropertyChanged(nameof(ItemHeight), value); }
|
||||
}
|
||||
|
||||
private int _RowHeaderWidth = 150;
|
||||
|
||||
/// <summary>
|
||||
/// 行标题宽度
|
||||
/// </summary>
|
||||
[DefaultValue(150)]
|
||||
public int RowHeaderWidth
|
||||
{
|
||||
get { return _RowHeaderWidth; }
|
||||
set { _RowHeaderWidth = value; OnPropertyChanged(nameof(RowHeaderWidth), value); }
|
||||
}
|
||||
|
||||
private int _RowHeight = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 行高
|
||||
/// </summary>
|
||||
[DefaultValue(100)]
|
||||
public int RowHeight
|
||||
{
|
||||
get { return _RowHeight; }
|
||||
set { _RowHeight = value; OnPropertyChanged(nameof(RowHeight), value); }
|
||||
}
|
||||
|
||||
private int _ColumnDateHeight = 30;
|
||||
|
||||
/// <summary>
|
||||
/// 日期高度
|
||||
/// </summary>
|
||||
[DefaultValue(30)]
|
||||
public int ColumnDateHeight
|
||||
{
|
||||
get { return _ColumnDateHeight; }
|
||||
set { _ColumnDateHeight = value; OnPropertyChanged(nameof(ColumnDateHeight), value); }
|
||||
}
|
||||
|
||||
private int _ColumnHourHeight = 30;
|
||||
|
||||
/// <summary>
|
||||
/// 小时高度
|
||||
/// </summary>
|
||||
[DefaultValue(30)]
|
||||
public int ColumnHourHeight
|
||||
{
|
||||
get { return _ColumnHourHeight; }
|
||||
set { _ColumnHourHeight = value; OnPropertyChanged(nameof(ColumnHourHeight), value); }
|
||||
}
|
||||
|
||||
private int _DateWidth = MinDateWidth;
|
||||
|
||||
/// <summary>
|
||||
/// 日期宽度
|
||||
/// </summary>
|
||||
[DefaultValue(MinDateWidth)]
|
||||
public int DateWidth
|
||||
{
|
||||
get { return _DateWidth; }
|
||||
set { _DateWidth = value; OnPropertyChanged(nameof(DateWidth), value); }
|
||||
}
|
||||
|
||||
private int _HScrollHeight = 15;
|
||||
|
||||
/// <summary>
|
||||
/// 横向滚动条高度
|
||||
/// </summary>
|
||||
[DefaultValue(15)]
|
||||
public int HScrollHeight
|
||||
{
|
||||
get { return _HScrollHeight; }
|
||||
set { _HScrollHeight = value; OnPropertyChanged(nameof(HScrollHeight), value); }
|
||||
}
|
||||
|
||||
private int _VScrollWidth = 15;
|
||||
|
||||
/// <summary>
|
||||
/// 纵向滚动条宽度
|
||||
/// </summary>
|
||||
[DefaultValue(15)]
|
||||
public int VScrollWidth
|
||||
{
|
||||
get { return _VScrollWidth; }
|
||||
set { _VScrollWidth = value; OnPropertyChanged(nameof(VScrollWidth), value); }
|
||||
}
|
||||
|
||||
private int _ItemSpacing = 2;
|
||||
|
||||
/// <summary>
|
||||
/// 项的行间距
|
||||
/// </summary>
|
||||
[DefaultValue(2)]
|
||||
public int ItemSpacing
|
||||
{
|
||||
get { return _ItemSpacing; }
|
||||
set { _ItemSpacing = value; OnPropertyChanged(nameof(ItemSpacing), value); }
|
||||
}
|
||||
|
||||
private int _RowSpacing = 5;
|
||||
|
||||
/// <summary>
|
||||
/// 行间距
|
||||
/// </summary>
|
||||
[DefaultValue(5)]
|
||||
public int RowSpacing
|
||||
{
|
||||
get { return _RowSpacing; }
|
||||
set { _RowSpacing = value; OnPropertyChanged(nameof(RowSpacing), value); }
|
||||
}
|
||||
#endregion
|
||||
#region Control
|
||||
private bool _IsFixedRowHeight = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否固定行高
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
public bool IsFixedRowHeight
|
||||
{
|
||||
get { return _IsFixedRowHeight; }
|
||||
set { _IsFixedRowHeight = value; OnPropertyChanged(nameof(IsFixedRowHeight), value); }
|
||||
}
|
||||
|
||||
private bool _EnableEdit = false;
|
||||
|
||||
/// <summary>
|
||||
/// 启用编辑
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
public bool EnableEdit
|
||||
{
|
||||
get { return _EnableEdit; }
|
||||
set { _EnableEdit = value; OnPropertyChanged(nameof(EnableEdit), value); }
|
||||
}
|
||||
|
||||
private bool _AllowItemNotWrap = true;
|
||||
|
||||
/// <summary>
|
||||
/// 允许项文字换行
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
public bool AllowItemNotWrap
|
||||
{
|
||||
get { return _AllowItemNotWrap; }
|
||||
set { _AllowItemNotWrap = value; OnPropertyChanged(nameof(AllowItemNotWrap), value); }
|
||||
}
|
||||
|
||||
private bool _IsShowItemBorder = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示项边框
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
public bool IsShowItemBorder
|
||||
{
|
||||
get { return _IsShowItemBorder; }
|
||||
set { _IsShowItemBorder = value; OnPropertyChanged(nameof(IsShowItemBorder), value); }
|
||||
}
|
||||
|
||||
private bool _AllowHeaderNotWrap = true;
|
||||
|
||||
/// <summary>
|
||||
/// 允许行标题文字换行
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
public bool AllowHeaderNotWrap
|
||||
{
|
||||
get { return _AllowHeaderNotWrap; }
|
||||
set { _AllowHeaderNotWrap = value; OnPropertyChanged(nameof(AllowHeaderNotWrap), value); }
|
||||
}
|
||||
|
||||
private GanttChartViewItemBlockType _BlockType = GanttChartViewItemBlockType.TextOverBlock;
|
||||
|
||||
/// <summary>
|
||||
/// 项换行模式
|
||||
/// </summary>
|
||||
public GanttChartViewItemBlockType BlockType
|
||||
{
|
||||
get { return _BlockType; }
|
||||
set { _BlockType = value; OnPropertyChanged(nameof(BlockType), value); }
|
||||
}
|
||||
|
||||
private bool _IsShowSelectionBorder = false;
|
||||
|
||||
/// <summary>
|
||||
/// 显示行选中高亮边框
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
public bool IsShowSelectionBorder
|
||||
{
|
||||
get { return _IsShowSelectionBorder; }
|
||||
set { _IsShowSelectionBorder = value; OnPropertyChanged(nameof(IsShowSelectionBorder), value); }
|
||||
}
|
||||
|
||||
private bool _AllowSelectRange = false;
|
||||
|
||||
/// <summary>
|
||||
/// 允许选中时间范围
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
public bool AllowSelectRange
|
||||
{
|
||||
get { return _AllowSelectRange; }
|
||||
set { _AllowSelectRange = value; OnPropertyChanged(nameof(AllowSelectRange), value); }
|
||||
}
|
||||
|
||||
private Func<GanttChartViewItem, GanttChartViewItem, bool> _SelectionItemSameComparator = null;
|
||||
|
||||
/// <summary>
|
||||
/// 选择项的同类项比较器
|
||||
/// </summary>
|
||||
public Func<GanttChartViewItem, GanttChartViewItem, bool> SelectionItemSameComparator
|
||||
{
|
||||
get { return _SelectionItemSameComparator; }
|
||||
set { _SelectionItemSameComparator = value; }
|
||||
}
|
||||
#endregion
|
||||
#region DataSource
|
||||
private DateTime _StartDate = DateTime.Today;
|
||||
|
||||
/// <summary>
|
||||
/// 开始日期
|
||||
/// </summary>
|
||||
public DateTime StartDate
|
||||
{
|
||||
get { return _StartDate; }
|
||||
set { _StartDate = value; OnPropertyChanged(nameof(StartDate), value); }
|
||||
}
|
||||
|
||||
private DateTime _EndDate = DateTime.Today.AddDays(1);
|
||||
|
||||
/// <summary>
|
||||
/// 结束日期
|
||||
/// </summary>
|
||||
public DateTime EndDate
|
||||
{
|
||||
get { return _EndDate; }
|
||||
set { _EndDate = value; OnPropertyChanged(nameof(EndDate), value); }
|
||||
}
|
||||
|
||||
private GanttChartCollection<GanttChartViewRow> _Rows = new GanttChartCollection<GanttChartViewRow>();
|
||||
|
||||
/// <summary>
|
||||
/// 行集合
|
||||
/// </summary>
|
||||
public GanttChartCollection<GanttChartViewRow> Rows
|
||||
{
|
||||
get { return _Rows; }
|
||||
set { _Rows = value; OnPropertyChanged(nameof(Rows), value); }
|
||||
}
|
||||
|
||||
private GanttChartViewRow _SelectionRow = null;
|
||||
|
||||
/// <summary>
|
||||
/// 选中的行
|
||||
/// </summary>
|
||||
public GanttChartViewRow SelectionRow
|
||||
{
|
||||
get { return _SelectionRow; }
|
||||
set { _SelectionRow = value; OnPropertyChanged(nameof(SelectionRow), value); }
|
||||
}
|
||||
|
||||
private GanttChartViewItem _SelectionItem = null;
|
||||
|
||||
/// <summary>
|
||||
/// 选中的项
|
||||
/// </summary>
|
||||
public GanttChartViewItem SelectionItem
|
||||
{
|
||||
get { return _SelectionItem; }
|
||||
set { _SelectionItem = value; OnPropertyChanged(nameof(SelectionItem), value); }
|
||||
}
|
||||
|
||||
private TimeRange _SelectionTimeRange = null;
|
||||
|
||||
/// <summary>
|
||||
/// 选中的时间范围
|
||||
/// </summary>
|
||||
public TimeRange SelectionTimeRange
|
||||
{
|
||||
get { return _SelectionTimeRange; }
|
||||
set { _SelectionTimeRange = value; OnPropertyChanged(nameof(SelectionTimeRange), value); }
|
||||
}
|
||||
|
||||
private DateTime _DateSplitTime = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// 日分割时间
|
||||
/// </summary>
|
||||
public DateTime DateSplitTime
|
||||
{
|
||||
get { return _DateSplitTime; }
|
||||
set { _DateSplitTime = value; OnPropertyChanged(nameof(DateSplitTime), value); }
|
||||
}
|
||||
|
||||
private string _DateTimeShowText = "时间";
|
||||
|
||||
/// <summary>
|
||||
/// 时间显示文本
|
||||
/// </summary>
|
||||
[DefaultValue("时间")]
|
||||
public string DateTimeShowText
|
||||
{
|
||||
get { return _DateTimeShowText; }
|
||||
set { _DateTimeShowText = value; OnPropertyChanged(nameof(DateTimeShowText), value); }
|
||||
}
|
||||
|
||||
private string _RowTitleShowText = "资源";
|
||||
|
||||
/// <summary>
|
||||
/// 行头显示文本
|
||||
/// </summary>
|
||||
[DefaultValue("资源")]
|
||||
public string RowTitleShowText
|
||||
{
|
||||
get { return _RowTitleShowText; }
|
||||
set { _RowTitleShowText = value; OnPropertyChanged(nameof(RowTitleShowText), value); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ReadOnly
|
||||
public int ColumnHeight
|
||||
{
|
||||
get { return ColumnDateHeight + ColumnHourHeight; }
|
||||
}
|
||||
|
||||
public int TotalDays
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)(EndDate.Date - StartDate.Date).TotalDays + 1;
|
||||
}
|
||||
}
|
||||
public DateTime StartTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return StartDate.Date.Add(DateSplitTime - DateSplitTime.Date);
|
||||
}
|
||||
}
|
||||
public DateTime EndTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return EndDate.Date.Add(DateSplitTime - DateSplitTime.Date);
|
||||
}
|
||||
}
|
||||
private Size TooltipSize
|
||||
{
|
||||
get
|
||||
{
|
||||
var size = TextRenderer.MeasureText(_ShowTooltipItem.Tooltip, TooltipTextFont, Size.Empty);
|
||||
size.Height = size.Height + (int)((_ShowTooltipItem.Tooltip.Split(new string[] { Environment.NewLine }, StringSplitOptions.None).Length - 1) * 1.7);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
private Size TooltipOuterSize
|
||||
{
|
||||
get
|
||||
{
|
||||
var size = TooltipSize;
|
||||
size.Width += RowSpacing * 2;
|
||||
size.Height += RowSpacing * 2;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Const
|
||||
private const int MinDateWidth = 3 * 48;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,409 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图控件
|
||||
/// 该部分类用于处理甘特图的绘制渲染
|
||||
/// </summary>
|
||||
public partial class GanttChartView
|
||||
{
|
||||
/// <summary>
|
||||
/// 画背景
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="bottom"></param>
|
||||
protected virtual void DrawBack(Graphics graphics, int bottom)
|
||||
{
|
||||
graphics.FillRectangle(this.Brushes.BackBrush, _ContentControl.DisplayRectangle);
|
||||
var range = new RectangleF(new PointF(0, 0), new SizeF(TotalDays * DateWidth + RowHeaderWidth - _HScrollBar.Value, bottom - _VScrollBar.Value));
|
||||
graphics.SetClip(range);
|
||||
graphics.FillRectangle(this.Brushes.HeaderBackBrush, range);
|
||||
range = new RectangleF(new PointF(0, ColumnHeight), new SizeF(TotalDays * DateWidth + RowHeaderWidth - _HScrollBar.Value, bottom - ColumnHeight - _VScrollBar.Value));
|
||||
graphics.FillRectangle(this.Brushes.ContentBackBrush, range);
|
||||
if (_SelectionRow != null)
|
||||
{
|
||||
var selectionHeader = new Rectangle(1, _SelectionRow.Top + 1 - _VScrollBar.Value, RowHeaderWidth - 2, (int)(_SelectionRow.Bottom - _SelectionRow.Top - 1));
|
||||
var selectionContent = new Rectangle(RowHeaderWidth, _SelectionRow.Top + 1 - _VScrollBar.Value, (int)(TotalDays * DateWidth - _HScrollBar.Value - 1), selectionHeader.Height);
|
||||
graphics.FillRectangle(this.Brushes.RowSelectionHeaderBackBrush, selectionHeader);
|
||||
graphics.FillRectangle(this.Brushes.RowSelectionContentBackBrush, selectionContent);
|
||||
}
|
||||
graphics.ResetClip();
|
||||
}
|
||||
/// <summary>
|
||||
/// 画没有数据
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="bottom"></param>
|
||||
protected virtual void DrawNonData(Graphics graphics, int bottom)
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 画提示框
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
protected virtual void DrawItemTooltip(Graphics graphics)
|
||||
{
|
||||
if (!_IsShowTooltip) return;
|
||||
var size = TooltipSize;
|
||||
var border = new Rectangle(_ShowTooltipPoint, new Size(size.Width + RowSpacing * 2, size.Height + RowSpacing * 2));
|
||||
var content = new Point(_ShowTooltipPoint.X + RowSpacing, _ShowTooltipPoint.Y + RowSpacing);
|
||||
graphics.FillRectangle(this.Brushes.TooltipBackBrush, border);
|
||||
graphics.DrawRectangle(this.Brushes.TooltipBorderPen, border);
|
||||
graphics.DrawString(_ShowTooltipItem.Tooltip, TooltipTextFont, this.Brushes.TooltipTextBrush, content);
|
||||
//TextRenderer.DrawText(graphics, _ShowTooltipItem.Tooltip, TooltipTextFont, content, TooltipTextColor);
|
||||
}
|
||||
/// <summary>
|
||||
/// 画选中范围
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
protected virtual void DrawSelectionRange(Graphics graphics)
|
||||
{
|
||||
if (!AllowSelectRange || _SelectionRange.IsEmpty) return;
|
||||
graphics.FillRectangle(this.Brushes.TimeRangeSelecetionBackBrush, _SelectionRange);
|
||||
}
|
||||
/// <summary>
|
||||
/// 画选中的矩形
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
protected virtual void DrawSelectingRectangle(Graphics graphics)
|
||||
{
|
||||
if (!AllowSelectRange || _DragStartLocation.IsEmpty || _DragEndLocation.IsEmpty || _DragStartLocation == _DragEndLocation || _DragStartLocation.X <= RowHeaderWidth || _DragStartLocation.Y <= ColumnHeight) return;
|
||||
var row = GetRow(_DragStartLocation);
|
||||
if (row == null) return;
|
||||
var start = new Point(Math.Min(_DragStartLocation.X, Math.Max(_DragEndLocation.X, RowHeaderWidth)), Math.Min(_DragStartLocation.Y, Math.Max(_DragEndLocation.Y, row.Top)));
|
||||
var height = Math.Abs(Math.Min(_DragEndLocation.Y, row.Bottom - _VScrollBar.Value) - _DragStartLocation.Y);
|
||||
var width = Math.Abs(_DragEndLocation.X - _DragStartLocation.X);
|
||||
if (_DragEndLocation.Y < row.Top)
|
||||
{
|
||||
height -= row.Top - _DragEndLocation.Y;
|
||||
}
|
||||
if (_DragEndLocation.X < RowHeaderWidth)
|
||||
{
|
||||
width -= RowHeaderWidth - _DragEndLocation.X;
|
||||
}
|
||||
else if(_DragEndLocation.X > TotalDays * DateWidth + RowHeaderWidth - _HScrollBar.Value)
|
||||
{
|
||||
width = TotalDays * DateWidth + RowHeaderWidth - _HScrollBar.Value - _DragStartLocation.X;
|
||||
}
|
||||
var rect = new RectangleF(start, new SizeF(width, height));
|
||||
graphics.FillRectangle(this.Brushes.SelectionRectangleBackBrush, rect);
|
||||
}
|
||||
/// <summary>
|
||||
/// 画项的时间范围
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="sub"></param>
|
||||
protected virtual void DrawItemTimeRange(Graphics graphics, GanttChartViewItem item, TimeRange sub)
|
||||
{
|
||||
var width = sub.Width;
|
||||
var right = sub.Left + sub.Width;
|
||||
if (right == item.Left + item.Width)
|
||||
{
|
||||
width = width - 2;
|
||||
if(width < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (item == _SelectionItem)
|
||||
{
|
||||
graphics.FillRectangle(this.Brushes.ItemSelectionSubRangeBackBrush, sub.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, width, ItemHeight);
|
||||
graphics.DrawRectangle(this.Brushes.ItemSelectionSubRangeBackPen, sub.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, width, ItemHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.FillRectangle(this.Brushes.ItemSubRangeBackBrush, sub.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, width, ItemHeight);
|
||||
graphics.DrawRectangle(this.Brushes.ItemSubRangeBackPen, sub.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, width, ItemHeight);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 画项
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="titleFormat"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="range"></param>
|
||||
protected virtual void DrawItem(Graphics graphics, StringFormat titleFormat, GanttChartViewItem item, RectangleF range)
|
||||
{
|
||||
var clip = new RectangleF(range.X, (range.Y < ColumnHeight ? ColumnHeight : range.Y) + 1, range.Width, (range.Y < ColumnHeight ? (range.Height - (ColumnHeight - range.Y)) : range.Height) - 2);
|
||||
graphics.SetClip(clip);
|
||||
if (item.Ranges != null && item.Ranges.Any())
|
||||
{
|
||||
graphics.FillRectangle(this.Brushes.ItemBackBrush, item.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, Math.Max(item.Width - 2, 2), ItemHeight);
|
||||
graphics.DrawRectangle(this.Brushes.ItemBackPen, item.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, Math.Max(item.Width - 2, 2), ItemHeight);
|
||||
var subs = item.Ranges.OrderBy(r => r.StartTime);
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
DrawItemTimeRange(graphics, item, sub);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.FillRectangle(this.Brushes.ItemSubRangeBackBrush, item.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, Math.Max(item.Width - 2, 2), ItemHeight);
|
||||
graphics.DrawRectangle(this.Brushes.ItemSubRangeBackPen, item.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, Math.Max(item.Width - 2, 2), ItemHeight);
|
||||
}
|
||||
if (item == _SelectionItem)
|
||||
{
|
||||
var textBrush = item.IsWarnning ? this.Brushes.ItemWarnningTextBrush : this.Brushes.ItemSelectionTextBrush;
|
||||
graphics.DrawLine(this.Brushes.ItemStartFlagPen, item.Left - _HScrollBar.Value + 1, item.Top - _VScrollBar.Value + ItemHeight / 2, item.Left - _HScrollBar.Value + 1, item.Top - _VScrollBar.Value + ItemHeight);
|
||||
graphics.DrawRectangle(this.Brushes.ItemSelectionBorderPen, item.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, Math.Max(item.Width - 2, 2), ItemHeight);
|
||||
graphics.DrawString(item.Title, ItemTextFont, textBrush, new RectangleF(item.Left - _HScrollBar.Value + 2, item.Top - _VScrollBar.Value + 1, 0, ItemHeight - 2), titleFormat);
|
||||
}
|
||||
else if(_SelectionItem != null && SelectionItemSameComparator != null && SelectionItemSameComparator(item, _SelectionItem))
|
||||
{
|
||||
var textBrush = item.IsWarnning ? this.Brushes.ItemWarnningTextBrush : this.Brushes.ItemSelectionTextBrush;
|
||||
graphics.DrawLine(this.Brushes.ItemStartFlagPen, item.Left - _HScrollBar.Value + 1, item.Top - _VScrollBar.Value + ItemHeight / 2, item.Left - _HScrollBar.Value + 1, item.Top - _VScrollBar.Value + ItemHeight);
|
||||
if (IsShowItemBorder)
|
||||
graphics.DrawRectangle(this.Brushes.ItemBorderPen, item.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, Math.Max(item.Width - 2, 2), ItemHeight);
|
||||
graphics.DrawString(item.Title, ItemTextFont, textBrush, new RectangleF(item.Left - _HScrollBar.Value + 2, item.Top - _VScrollBar.Value + 1, 0, ItemHeight - 2), titleFormat);
|
||||
}
|
||||
else
|
||||
{
|
||||
var textBrush = item.IsWarnning ? this.Brushes.ItemWarnningTextBrush : this.Brushes.ItemTextBrush;
|
||||
graphics.DrawLine(this.Brushes.ItemStartFlagPen, item.Left - _HScrollBar.Value + 1, item.Top - _VScrollBar.Value + ItemHeight / 2, item.Left - _HScrollBar.Value + 1, item.Top - _VScrollBar.Value + ItemHeight);
|
||||
if (IsShowItemBorder)
|
||||
graphics.DrawRectangle(this.Brushes.ItemBorderPen, item.Left - _HScrollBar.Value, item.Top - _VScrollBar.Value, Math.Max(item.Width - 2, 2), ItemHeight);
|
||||
graphics.DrawString(item.Title, ItemTextFont, textBrush, new RectangleF(item.Left - _HScrollBar.Value + 2, item.Top - _VScrollBar.Value + 1, 0, ItemHeight - 2), titleFormat);
|
||||
}
|
||||
graphics.ResetClip();
|
||||
}
|
||||
/// <summary>
|
||||
/// 画行
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="headerFormat"></param>
|
||||
/// <param name="titleFormat"></param>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="range"></param>
|
||||
/// <param name="rowRect"></param>
|
||||
protected virtual void DrawRow(Graphics graphics, StringFormat headerFormat, StringFormat titleFormat, GanttChartViewRow row, RectangleF range, RectangleF rowRect)
|
||||
{
|
||||
graphics.SetClip(range);
|
||||
var drawY = rowRect.Y + RowSpacing;
|
||||
var drawHeight = rowRect.Height - RowSpacing * 2;
|
||||
if (drawHeight > (_ContentControl.Height - ColumnHeight) / 4)
|
||||
{
|
||||
drawY = Math.Max(rowRect.Y, ColumnHeight);
|
||||
drawHeight = Math.Min(rowRect.Bottom - RowSpacing, _ContentControl.Height) - drawY;
|
||||
}
|
||||
graphics.DrawString(row.Title, RowHeaderTextFont, this.Brushes.RowHeaderTextBrush, new RectangleF(rowRect.X + RowSpacing, drawY, RowHeaderWidth - RowSpacing * 2, drawHeight), headerFormat);
|
||||
graphics.ResetClip();
|
||||
if(row.Items != null)
|
||||
{
|
||||
var items = row.Items.OrderBy(r=>r.StartTime);
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.Left + item.Width - _HScrollBar.Value > RowHeaderWidth)
|
||||
{
|
||||
if (item.Left - _HScrollBar.Value < range.Right)
|
||||
{
|
||||
DrawItem(graphics, titleFormat, item, new RectangleF(RowHeaderWidth + 1, rowRect.Y + 1, rowRect.Width - RowHeaderWidth - 2, rowRect.Height - 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
graphics.SetClip(range);
|
||||
graphics.DrawLine(this.Brushes.GridPen, 0, row.Bottom - _VScrollBar.Value, rowRect.Width, row.Bottom - _VScrollBar.Value);
|
||||
if (_SelectionRow == row && IsShowSelectionBorder)
|
||||
{
|
||||
var selectionRect = new Rectangle(1, row.Top + 1, (int)(range.Width - 3), (int)(row.Bottom - row.Top - 2));
|
||||
graphics.DrawRectangle(this.Brushes.RowSelectionBorderPen, selectionRect);
|
||||
}
|
||||
graphics.ResetClip();
|
||||
}
|
||||
/// <summary>
|
||||
/// 画所有行
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="bottom"></param>
|
||||
protected virtual void DrawRows(Graphics graphics, int bottom)
|
||||
{
|
||||
var range = new RectangleF(0, ColumnHeight, RowHeaderWidth + TotalDays * DateWidth - _HScrollBar.Value, bottom - _VScrollBar.Value + 1);
|
||||
graphics.DrawLine(this.Brushes.GridPen, RowHeaderWidth, ColumnDateHeight, range.Width - 1, ColumnDateHeight);
|
||||
graphics.SetClip(range);
|
||||
graphics.DrawLine(this.Brushes.GridPen, 0, ColumnHeight, range.Width - 1, ColumnHeight);
|
||||
if (Rows == null || !Rows.Any())
|
||||
{
|
||||
DrawNonData(graphics, bottom);
|
||||
graphics.DrawLine(this.Brushes.GridPen, 0, bottom, range.Width - 1, bottom);
|
||||
return;
|
||||
}
|
||||
graphics.ResetClip();
|
||||
var headerFormat = new StringFormat();
|
||||
headerFormat.Alignment = StringAlignment.Near;
|
||||
headerFormat.LineAlignment = StringAlignment.Center;
|
||||
var titleFormat = new StringFormat();
|
||||
titleFormat.Alignment = StringAlignment.Near;
|
||||
titleFormat.LineAlignment = StringAlignment.Center;
|
||||
|
||||
titleFormat.FormatFlags = BlockType == GanttChartViewItemBlockType.Compact ? StringFormatFlags.LineLimit : StringFormatFlags.NoWrap;
|
||||
foreach (var row in Rows)
|
||||
{
|
||||
if (row.Bottom - _VScrollBar.Value > ColumnHeight)
|
||||
{
|
||||
var rowRect = new RectangleF(new PointF(0, row.Top - _VScrollBar.Value), new SizeF(range.Width, row.Bottom - row.Top + 1));
|
||||
if (!range.IntersectsWith(rowRect)) break;
|
||||
DrawRow(graphics, headerFormat, titleFormat, row, range, rowRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 画列
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="range"></param>
|
||||
/// <param name="startX"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="cellHour"></param>
|
||||
protected virtual void DrawColumn(Graphics graphics, StringFormat format, DateTime date, RectangleF range, int startX, int width, int cellHour)
|
||||
{
|
||||
var offsetMinutes = (int)(DateSplitTime - DateSplitTime.Date).TotalMinutes % (60 * cellHour);
|
||||
var offset = (int)(offsetMinutes / 60f * width);
|
||||
startX = startX - offset;
|
||||
var dt = date.AddMinutes(-offsetMinutes);
|
||||
for (DateTime i = dt; i < dt.AddDays(1); i = i.AddHours(cellHour))
|
||||
{
|
||||
var rectangle = new RectangleF(startX, ColumnDateHeight + 1, 0, ColumnHourHeight - 2);
|
||||
if (range.IntersectsWith(rectangle) && (offset != 0 || date.Hour != i.Hour))
|
||||
{
|
||||
graphics.DrawString(i.Hour == 0 ? "0" : i.Hour.ToString("##00"), ColumnDateTextFont, this.Brushes.ColumnHourTextBrush, rectangle, format);
|
||||
//graphics.DrawLine(this.Brushes.GridPen, rectangle.X, ColumnDateHeight, rectangle.X, ColumnDateHeight + ColumnHourHeight / 5);
|
||||
graphics.DrawLine(this.Brushes.GridPen, rectangle.X, ColumnDateHeight + ColumnHourHeight / 5 * 4, rectangle.X, ColumnDateHeight + ColumnHourHeight - 1);
|
||||
}
|
||||
startX += width * cellHour;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 画列头
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
protected virtual void DrawColumnHeader(Graphics graphics)
|
||||
{
|
||||
var range = new RectangleF(new PointF(RowHeaderWidth + 1, 1), new SizeF(TotalDays * DateWidth - 1, _ContentControl.Height - 2));
|
||||
graphics.SetClip(range);
|
||||
int cellHour = GetCellHours();
|
||||
var format = new StringFormat();
|
||||
format.Alignment = StringAlignment.Center;
|
||||
format.LineAlignment = StringAlignment.Center;
|
||||
format.FormatFlags = StringFormatFlags.LineLimit;
|
||||
var x = RowHeaderWidth;
|
||||
for (var i = StartTime; i <= EndTime; i = i.AddDays(1))
|
||||
{
|
||||
var dx = x - _HScrollBar.Value;
|
||||
var rectangle = new RectangleF(dx + 1, 1, DateWidth - 1, ColumnDateHeight - 2);
|
||||
if (rectangle.Right > RowHeaderWidth)
|
||||
{
|
||||
if (!range.IntersectsWith(rectangle))
|
||||
{
|
||||
x += DateWidth;
|
||||
continue;
|
||||
}
|
||||
graphics.DrawString(i.ToString("yyyy-MM-dd") + " 星期" + ("日一二三四五六"[(int)i.DayOfWeek]), ColumnDateTextFont, this.Brushes.ColumnDateTextBrush, rectangle, format);
|
||||
DrawColumn(graphics, format, i, range, (int)rectangle.X - 1, DateWidth / 24, cellHour);
|
||||
}
|
||||
x += DateWidth;
|
||||
}
|
||||
graphics.ResetClip();
|
||||
}
|
||||
/// <summary>
|
||||
/// 画行头
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="bottom"></param>
|
||||
protected virtual void DrawHeader(Graphics graphics, int bottom)
|
||||
{
|
||||
var range = new RectangleF(new PointF(0, 0), new SizeF(RowHeaderWidth + TotalDays * DateWidth, bottom - _VScrollBar.Value));
|
||||
graphics.SetClip(range);
|
||||
graphics.DrawLine(this.Brushes.GridPen, range.X, range.Y, range.X + RowHeaderWidth, range.Y + ColumnHeight);
|
||||
graphics.DrawString(this.DateTimeShowText, this.ColumnDateTextFont, this.Brushes.ColumnDateTextBrush,
|
||||
new Rectangle(0, 0, RowHeaderWidth - RowSpacing, ColumnDateHeight),
|
||||
new StringFormat { Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Center });
|
||||
graphics.DrawString(this.RowTitleShowText, this.RowHeaderTextFont, this.Brushes.RowHeaderTextBrush,
|
||||
new Rectangle(RowSpacing, ColumnDateHeight, RowHeaderWidth - RowSpacing, ColumnHourHeight - RowSpacing),
|
||||
new StringFormat { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Far });
|
||||
graphics.ResetClip();
|
||||
}
|
||||
/// <summary>
|
||||
/// 画时间线
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="bottom"></param>
|
||||
protected virtual void DrawTimeLine(Graphics graphics, int bottom)
|
||||
{
|
||||
var range = new RectangleF(new PointF(0, 0), new SizeF(RowHeaderWidth + TotalDays * DateWidth, bottom - _VScrollBar.Value));
|
||||
graphics.SetClip(range);
|
||||
graphics.DrawRectangle(this.Brushes.GridPen, _ContentControl.DisplayRectangle);
|
||||
var x = RowHeaderWidth - 1;
|
||||
if(StartTime == DateTime.Today.Add(DateSplitTime - DateSplitTime.Date))
|
||||
{
|
||||
graphics.DrawLine(this.Brushes.CurrentTimeLinePen, x, 0, x, _ContentControl.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.DrawLine(this.Brushes.GridPen, x, 0, x, _ContentControl.Height);
|
||||
}
|
||||
for (var i = StartTime; i <= EndTime; i = i.AddDays(1))
|
||||
{
|
||||
x += DateWidth;
|
||||
var dx = x - _HScrollBar.Value;
|
||||
if (dx + 1 > RowHeaderWidth)
|
||||
{
|
||||
if (dx + 1 > _ContentControl.Width) break;
|
||||
if(i.AddDays(1) == DateTime.Today.Add(DateSplitTime - DateSplitTime.Date))
|
||||
{
|
||||
graphics.DrawLine(this.Brushes.CurrentTimeLinePen, dx, 0, dx, _ContentControl.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.DrawLine(this.Brushes.GridPen, dx, 0, dx, _ContentControl.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
graphics.ResetClip();
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算单元格小时
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int GetCellHours()
|
||||
{
|
||||
var halfHourWidth = DateWidth / 48;
|
||||
int cellHour;
|
||||
if (halfHourWidth >= 12)
|
||||
{
|
||||
cellHour = 1;
|
||||
}
|
||||
else if (halfHourWidth >= 6)
|
||||
{
|
||||
cellHour = 2;
|
||||
}
|
||||
else if (halfHourWidth >= 4)
|
||||
{
|
||||
cellHour = 3;
|
||||
}
|
||||
else if (halfHourWidth >= 3)
|
||||
{
|
||||
cellHour = 4;
|
||||
}
|
||||
else if (halfHourWidth >= 2)
|
||||
{
|
||||
cellHour = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
cellHour = 12;
|
||||
}
|
||||
return cellHour;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图控件
|
||||
/// </summary>
|
||||
[ToolboxBitmap(typeof(GanttChartView), "GanttChart.GanttChartView.bmp")]
|
||||
public partial class GanttChartView: Control
|
||||
{
|
||||
#region Private Members
|
||||
private HScrollBar _HScrollBar;
|
||||
private VScrollBar _VScrollBar;
|
||||
|
||||
private TableLayoutPanel _Table;
|
||||
private Control _ContentControl;
|
||||
|
||||
private GanttChartBrushes Brushes;
|
||||
#endregion
|
||||
|
||||
#region ctor
|
||||
public GanttChartView()
|
||||
{
|
||||
_Table = new TableLayoutPanel();
|
||||
_Table.ColumnCount = 2;
|
||||
_Table.RowCount = 2;
|
||||
_Table.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
|
||||
_Table.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, VScrollWidth));
|
||||
_Table.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||
_Table.RowStyles.Add(new RowStyle(SizeType.Absolute, HScrollHeight));
|
||||
|
||||
_ContentControl = new GanttChartCanvas();
|
||||
_ContentControl.Dock = DockStyle.Fill;
|
||||
_ContentControl.Margin = new Padding(0);
|
||||
_Table.Controls.Add(_ContentControl, 0, 0);
|
||||
|
||||
_HScrollBar = new HScrollBar();
|
||||
_HScrollBar.Value = 0;
|
||||
_HScrollBar.Height = HScrollHeight;
|
||||
_HScrollBar.SmallChange = 1;
|
||||
_HScrollBar.LargeChange = 2;
|
||||
//_HScrollBar.Dock = DockStyle.Fill;
|
||||
_HScrollBar.Visible = true;
|
||||
_Table.Controls.Add(_HScrollBar, 0, 1);
|
||||
|
||||
|
||||
_VScrollBar = new VScrollBar();
|
||||
_VScrollBar.Value = 0;
|
||||
_VScrollBar.Width = VScrollWidth;
|
||||
_VScrollBar.SmallChange = 1;
|
||||
_VScrollBar.LargeChange = 2;
|
||||
//_VScrollBar.Dock = DockStyle.Fill;
|
||||
_VScrollBar.Visible = true;
|
||||
_Table.Controls.Add(_VScrollBar, 1, 0);
|
||||
|
||||
_Table.Dock = DockStyle.Fill;
|
||||
Controls.Add(_Table);
|
||||
|
||||
InitEvent();
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 调整滚动条
|
||||
/// </summary>
|
||||
private void AdjustScrollbar()
|
||||
{
|
||||
var bottom = ItemHeight + RowSpacing * 2;
|
||||
if (Rows != null && Rows.Any())
|
||||
{
|
||||
if (StartDate != Rows.StartDate || Rows.IsChanged)
|
||||
{
|
||||
ComputeRowsAndItemsSize();
|
||||
Rows.IsChanged = false;
|
||||
Rows.StartDate = StartDate;
|
||||
}
|
||||
var last = Rows.Last();
|
||||
bottom = last.Bottom;
|
||||
}
|
||||
if (IsFixedRowHeight)
|
||||
{
|
||||
var h = ColumnHeight + (Rows?.Count ?? 0) * RowHeight + 200;
|
||||
if(h > Height - HScrollHeight)
|
||||
{
|
||||
_VScrollBar.Maximum = h - Height + HScrollHeight + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_VScrollBar.Maximum = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_VScrollBar.Maximum = bottom - Height + HScrollHeight + 1 + 200;
|
||||
}
|
||||
_VScrollBar.Minimum = 0;
|
||||
|
||||
_HScrollBar.Maximum = ((int)(EndDate.Date - StartDate.Date).TotalDays + 1) * DateWidth - Width + RowHeaderWidth + VScrollWidth + 1 + 200;
|
||||
_HScrollBar.Minimum = 0;
|
||||
|
||||
_VScrollBar.Enabled = _VScrollBar.Maximum > 0;
|
||||
_HScrollBar.Enabled = _HScrollBar.Maximum > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// 重绘
|
||||
/// </summary>
|
||||
public new void Invalidate()
|
||||
{
|
||||
base.Invalidate();
|
||||
_ContentControl.Invalidate();
|
||||
}
|
||||
/// <summary>
|
||||
/// 销毁
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
this.Brushes?.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
class GanttChartCanvas : Control
|
||||
{
|
||||
public GanttChartCanvas()
|
||||
{
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
SetStyle(ControlStyles.Selectable, true);
|
||||
}
|
||||
protected override void OnPaintBackground(PaintEventArgs pevent) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
public class GanttChartViewColumn
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
public class GanttChartViewColumnGroup
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图项
|
||||
/// </summary>
|
||||
public class GanttChartViewItem : TimeRange
|
||||
{
|
||||
/// <summary>
|
||||
/// 项的时间范围集合
|
||||
/// </summary>
|
||||
public ICollection<TimeRange> Ranges { get; set; }
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// 提示内容
|
||||
/// </summary>
|
||||
public string Tooltip { get; set; }
|
||||
/// <summary>
|
||||
/// 顶部位置
|
||||
/// </summary>
|
||||
internal int Top { get; set; }
|
||||
/// <summary>
|
||||
/// 文本宽度
|
||||
/// </summary>
|
||||
internal int TextWidth { get; set; }
|
||||
/// <summary>
|
||||
/// 数据
|
||||
/// </summary>
|
||||
public object Data { get; set; }
|
||||
/// <summary>
|
||||
/// 是否警告
|
||||
/// </summary>
|
||||
public bool IsWarnning { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图项的换行模式
|
||||
/// </summary>
|
||||
public enum GanttChartViewItemBlockType
|
||||
{
|
||||
/// <summary>
|
||||
/// 紧凑
|
||||
/// </summary>
|
||||
Compact,
|
||||
/// <summary>
|
||||
/// 文字超过换行
|
||||
/// </summary>
|
||||
TextOverBlock,
|
||||
/// <summary>
|
||||
/// 强制换行
|
||||
/// </summary>
|
||||
Block,
|
||||
/// <summary>
|
||||
/// 回归
|
||||
/// </summary>
|
||||
Return
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 甘特图行
|
||||
/// </summary>
|
||||
public class GanttChartViewRow
|
||||
{
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// 顶部
|
||||
/// </summary>
|
||||
internal int Top { get; set; }
|
||||
/// <summary>
|
||||
/// 按钮
|
||||
/// </summary>
|
||||
internal int Bottom { get; set; }
|
||||
/// <summary>
|
||||
/// 项集合
|
||||
/// </summary>
|
||||
public List<GanttChartViewItem> Items { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("GanttChart")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("GanttChart")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("dea91cb9-1011-4ee7-b8e1-72428f731789")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,63 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GanttChart.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GanttChart.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GanttChart.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GanttChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 时间范围
|
||||
/// </summary>
|
||||
public class TimeRange
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
public DateTime StartTime { get; set; }
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
public DateTime EndTime { get; set; }
|
||||
/// <summary>
|
||||
/// 左边
|
||||
/// </summary>
|
||||
internal int Left { get; set; }
|
||||
/// <summary>
|
||||
/// 宽度
|
||||
/// </summary>
|
||||
internal int Width { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 63 KiB |
@@ -0,0 +1,27 @@
|
||||
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.Login"
|
||||
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:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
mc:Ignorable="d" Title="Login"
|
||||
Height="320" Width="248" MaxHeight="320" MaxWidth="248" ResizeMode="NoResize"
|
||||
Loaded="Window_Loaded" WindowStyle="None">
|
||||
<Grid>
|
||||
<Rectangle HorizontalAlignment="Center" Height="118" VerticalAlignment="Top" Width="248">
|
||||
<Rectangle.Fill>
|
||||
<ImageBrush ImageSource="/sunlight_logotext.jpg"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<ComboBox x:Name="User" Height="30" Margin="60,164,10,0" VerticalAlignment="Top" FontSize="14" KeyUp="SearchBox_OnKeyDownd" IsEditable="True"/>
|
||||
<PasswordBox x:Name="Pasword" Height="30" Margin="60,210,10,0" VerticalAlignment="Top" FontSize="14" KeyUp="SearchBox_OnKeyDownd"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="10,163,0,0" TextWrapping="Wrap" Text="账号:" VerticalAlignment="Top" Width="45" FontSize="20" RenderTransformOrigin="0.833,0.478"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="10,208,0,0" TextWrapping="Wrap" Text="密码:" VerticalAlignment="Top" Width="45" FontSize="20" RenderTransformOrigin="0.833,0.478"/>
|
||||
<Button x:Name="logon" Content="登录" HorizontalAlignment="Left" Height="33" Margin="40,264,0,0" VerticalAlignment="Top" Width="64" Click="Button_Click_1" Background="#FFDDDDDD" Foreground="Black" BorderBrush="White"/>
|
||||
<Button Content="退出" HorizontalAlignment="Right" Height="33" Margin="140,264,40,0" VerticalAlignment="Top" Width="64" Click="Button_Click" Background="#FFDDDDDD" Foreground="Black" BorderBrush="White"/>
|
||||
<TextBlock Height="30" Margin="15,115,15,0" TextWrapping="Wrap" Text="中央控制平台" VerticalAlignment="Top" FontSize="20" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,119 @@
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_
|
||||
{
|
||||
/// <summary>
|
||||
/// Login.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class Login : Window
|
||||
{
|
||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"; //配置文件路径
|
||||
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||
DataTable logindataTable = new DataTable(); //建立login缓存
|
||||
DataTable logindataT = new DataTable(); //建立login缓存
|
||||
|
||||
public Login()
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
InitializeComponent();
|
||||
|
||||
UserClass.LogGing.LogGingDATA("SCCM_start");
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e) //退出按钮事件
|
||||
{
|
||||
UserClass.LogGing.LogGingDATA("SCCM_LogStop");
|
||||
Window window = Window.GetWindow(this);
|
||||
window.Close();
|
||||
}
|
||||
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e) //登录按钮事件
|
||||
{
|
||||
string user = User.Text;
|
||||
string pasword = Pasword.Password; ;
|
||||
try
|
||||
{
|
||||
if (User.Text == "") //检查用户名输入
|
||||
{
|
||||
System.Windows.MessageBox.Show(Properties.Resources.NPERR, "SCCM", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((user == "engineer" || user == "ENGINEER") && (pasword == "engineer" || pasword == "ENGINEER")) //确认账号是否是工程师
|
||||
{
|
||||
App.USER_Purview = "ENGINEER";//传入用户名
|
||||
|
||||
Window window = Window.GetWindow(this);
|
||||
MainWindow Main = new MainWindow();
|
||||
window.Close();
|
||||
UserClass.LogGing.LogGingDATA("LOGon = ENGINEER");
|
||||
|
||||
Main.ShowDialog();//实例化并置顶打开窗口
|
||||
}
|
||||
else
|
||||
{
|
||||
string paw = logindataT.Select("Name='" + user + "'").First().Field<string>("Password");
|
||||
if (paw == null) paw = "";
|
||||
|
||||
if (paw == pasword)
|
||||
{
|
||||
App.USER_Purview = User.Text;//传入用户名
|
||||
|
||||
Window window = Window.GetWindow(this);
|
||||
MainWindow Main = new MainWindow();
|
||||
window.Close();
|
||||
|
||||
UserClass.LogGing.LogGingDATA("LOGon = " + user);
|
||||
Main.ShowDialog();//实例化并置顶打开窗口
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show(Properties.Resources.NPERR, "SCCM", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
System.Windows.MessageBox.Show("Unable to start. Check the log for details.", "SCCM", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
//SendKeys.SendWait("{Tab}");
|
||||
UserClass.PressKey.PressKeys(Keys.Tab, false);
|
||||
UserClass.PressKey.PressKeys(Keys.Tab, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
logon.IsEnabled = false;
|
||||
SQLiteHelper db = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
db.Open(); //打开数据库
|
||||
logindataTable = db.ExecuteDataSet("select * from USER where Groups<>'CHIEF'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
logindataT = db.ExecuteDataSet("select * from USER ", null).Tables[0];
|
||||
db.Close();
|
||||
User.ItemsSource = logindataTable.AsEnumerable().Select(rowdata => rowdata.Field<string>("Name"));//转换
|
||||
logon.IsEnabled = true; //允许登录按钮
|
||||
UserClass.PressKey.PressKeys(Keys.Tab, false);
|
||||
UserClass.PressKey.PressKeys(Keys.Tab, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,10 @@
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Loaded="Window_Loaded"
|
||||
Title="SUNLIGHT SCCM b0.0.1 (2024/08/10)"
|
||||
Height="1080" Width="1920" Background="#FF003640"
|
||||
WindowState ="Maximized" WindowStyle="None">
|
||||
WindowStyle="None" ResizeMode="NoResize">
|
||||
<Window.Resources>
|
||||
<Storyboard x:Key="MenuOpen">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="GridMenu">
|
||||
@@ -41,11 +42,21 @@
|
||||
<Grid x:Name="GridTitle" Height="50" VerticalAlignment="Top" Background="#FF006361" MouseDown="GridTitle_MouseDown" Margin="60,0,0,0">
|
||||
<TextBlock Text="Sunlight Centralized Control Management (SCCM)" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Foreground="White"/>
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<ComboBox x:Name="username" VerticalAlignment="Center" FontSize="14" DropDownClosed="username_DropDownClosed" HorizontalAlignment="Right" Margin="0,0,5,0" Width="100" Foreground="White">
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type ComboBoxItem}">
|
||||
<Setter Property="Foreground" Value="Black">
|
||||
</Setter>
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
</ComboBox>
|
||||
<TextBlock Text="{Binding Sys_Time}" VerticalAlignment="Center" FontSize="14" Foreground="White"/>
|
||||
<materialDesign:PopupBox Foreground="White" Margin="10" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
|
||||
<StackPanel Width="150">
|
||||
<Button Content="{x:Static lang:Resources.USER}"/>
|
||||
<Button Content="{x:Static lang:Resources.SysSet}" Click="ButtonSYS_Click"/>
|
||||
<Button Content="{x:Static lang:Resources.USER}" Click="ButtonUSER_Click" x:Name="User_" IsEnabled="{Binding USER_Capacity[1]}"/>
|
||||
<Button Content="{x:Static lang:Resources.SysSet}" Click="ButtonSYS_Click" x:Name="SysSet_" IsEnabled="{Binding USER_Capacity[0]}"/>
|
||||
<Separator/>
|
||||
<Button Content="{x:Static lang:Resources.Permit}" Click="ButtonPermit_Click"/>
|
||||
<Button Content="{x:Static lang:Resources.Help}" Click="Buttonhelp_Click"/>
|
||||
<Separator/>
|
||||
<Button x:Name="ButtonMinimize" Content="{x:Static lang:Resources.Minimize}" Click="ButtonMinimize_Click"/>
|
||||
@@ -85,25 +96,25 @@
|
||||
<TextBlock Text="{x:Static lang:Resources.ProductionPlanning}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||
</StackPanel>
|
||||
</ListViewItem>
|
||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_Curve">
|
||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_Curve" IsEnabled="{Binding USER_Capacity[9]}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Kind="ChartBellCurve" Width="25" Height="25" Margin="10" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.Curve}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||
</StackPanel>
|
||||
</ListViewItem>
|
||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_Machine">
|
||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_Machine" IsEnabled="{Binding USER_Capacity[2]}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Kind="Settings" Width="25" Height="25" Margin="10" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||
</StackPanel>
|
||||
</ListViewItem>
|
||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_Programgroup">
|
||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_Programgroup" IsEnabled="{Binding USER_Capacity[9]}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Kind="Database" Width="25" Height="25" Margin="10" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.Programgroup}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||
</StackPanel>
|
||||
</ListViewItem>
|
||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_ConveyorCenters">
|
||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_ConveyorCenters" IsEnabled="{Binding USER_Capacity[12]}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Kind="Pipe" Width="25" Height="25" Margin="10" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.ConveyorCenters}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||
@@ -115,7 +126,13 @@
|
||||
|
||||
<Grid x:Name="gdMian" Background="White" Margin="60,50,0,0">
|
||||
<ContentControl x:Name="Picture"/>
|
||||
<Grid x:Name="Cdk_page" Visibility="Collapsed" Margin="0,0,0,0" Background="White" Opacity="0.8">
|
||||
<TextBlock Height="150" Margin="0,0,0,300" TextWrapping="Wrap" Text="注册信息到期,为避免影响系统使用请及时提交注册信息!" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="keytext" Height="50" Margin="0,0,0,100" TextWrapping="Wrap" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red"/>
|
||||
<TextBlock Height="50" Margin="0,0,0,0" TextWrapping="Wrap" Text="请联系 SUNLIGHT" Width="300" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Button Content="{x:Static lang:Resources.Permit }" HorizontalAlignment="Center" Height="50" Margin="200,100,0,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="DarkGray" Click="ButtonPermit_Click"/>
|
||||
<Button Content="{x:Static lang:Resources.Help }" HorizontalAlignment="Center" Height="50" Margin="0,100,200,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="DarkGray" Click="Buttonhelp_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,8 +1,11 @@
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -11,10 +14,13 @@ using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_
|
||||
@@ -24,12 +30,68 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public static string user_;
|
||||
public static DataTable InfData = new DataTable();
|
||||
// public static string[] Inf_string ;
|
||||
public UserInformation userInformation;
|
||||
// public UserInf userInf;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
DataContext = new MainWindowViewModel();
|
||||
InitializeComponent();
|
||||
|
||||
CountDown();
|
||||
CDkey_();
|
||||
if (App.USER_Purview != "ENGINEER")
|
||||
{
|
||||
username.ItemsSource = MainWindowViewModel.USER_data.Select(
|
||||
"Groups='" + MainWindowViewModel.USER_data.Select("Name='" + App.USER_Purview + "'").
|
||||
First().Field<string>("Groups").ToString() + "'").
|
||||
AsEnumerable().Select(rowdata => rowdata.Field<string>("Name")).ToList();
|
||||
}
|
||||
user_ = App.USER_Purview;
|
||||
username.Text = user_;
|
||||
|
||||
/**添加提示信息栏**/
|
||||
InfData.Columns.Add("Machine", Type.GetType("System.String"));
|
||||
InfData.Columns.Add("Information", Type.GetType("System.String"));
|
||||
InfData.Columns.Add("Code", Type.GetType("System.String"));
|
||||
InfData.Columns.Add("ID", Type.GetType("System.Int32"));
|
||||
|
||||
InfData.RowChanged += new DataRowChangeEventHandler(InfTable);//
|
||||
}
|
||||
private void InfTable(object sender, DataRowChangeEventArgs e)//触发行改变事件
|
||||
{
|
||||
if (userInformation == null || !userInformation.IsLoaded)//窗口不存在及创建
|
||||
{
|
||||
userInformation = new UserInformation();
|
||||
userInformation.Topmost = true;
|
||||
userInformation.Show();
|
||||
userInformation.Activate();
|
||||
}
|
||||
else
|
||||
{//窗口纯在及置顶
|
||||
userInformation.Activate();
|
||||
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)
|
||||
{
|
||||
@@ -100,9 +162,8 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
}
|
||||
private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
Picture.Content = new View.DispenseView();
|
||||
}
|
||||
|
||||
private void Buttonhelp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowsView.Help help_page = new WindowsView.Help();
|
||||
@@ -112,5 +173,104 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
{
|
||||
Picture.Content = new View.SYSSetView();
|
||||
}
|
||||
private void ButtonUSER_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowsView.User user_ = new WindowsView.User();
|
||||
user_.Show();
|
||||
}
|
||||
private void ButtonPermit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowsView.CDKEY cDKEY = new WindowsView.CDKEY();
|
||||
cDKEY.Show();
|
||||
}
|
||||
|
||||
public void CountDown()
|
||||
{
|
||||
DispatcherTimer timer1s = new DispatcherTimer//初始化循环
|
||||
{
|
||||
Interval = TimeSpan.FromHours(1)
|
||||
};
|
||||
timer1s.Tick += Tick_Event_1H;
|
||||
timer1s.Start();
|
||||
}
|
||||
void Tick_Event_1H(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||
{
|
||||
CDkey_();
|
||||
}
|
||||
|
||||
private static UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||
private void CDkey_()
|
||||
{
|
||||
try
|
||||
{
|
||||
string id_1 = MainWindowViewModel.SN_ID.Substring(5, 1) + MainWindowViewModel.SN_ID.Substring(0, 1) +
|
||||
MainWindowViewModel.SN_ID.Substring(4, 1) + MainWindowViewModel.SN_ID.Substring(1, 1) +
|
||||
MainWindowViewModel.SN_ID.Substring(3, 1) + MainWindowViewModel.SN_ID.Substring(2, 1);
|
||||
if ((id_1 == MainWindowViewModel.SN_KEY.Substring(0, 6)) && (MainWindowViewModel.SN_KEY.Length == 16))
|
||||
{
|
||||
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(MainWindowViewModel.SN_KEY.Substring(0, 12)), true) == MainWindowViewModel.SN_KEY.Substring(12, 4)) //校验key的crc校验值
|
||||
{
|
||||
string Y = (2255 - StrToInt.To16Convert10(MainWindowViewModel.SN_KEY.Substring(6, 2))).ToString();
|
||||
string M = (255 - StrToInt.To16Convert10(MainWindowViewModel.SN_KEY.Substring(8, 2))).ToString();
|
||||
string D = (255 - StrToInt.To16Convert10(MainWindowViewModel.SN_KEY.Substring(10, 2))).ToString();
|
||||
|
||||
string YY = DateTime.Now.ToString("yyyy");
|
||||
string MM = DateTime.Now.ToString("MM");
|
||||
string DD = DateTime.Now.ToString("dd");
|
||||
|
||||
keytext.Text = "注册到期时间: " + Y + "/" + M + "/" + D;
|
||||
|
||||
if (string.Compare(Y, YY) < 0)
|
||||
{
|
||||
if (string.Compare(M, MM) < 0)
|
||||
{
|
||||
if (string.Compare(D, DD) < 0)
|
||||
{
|
||||
Configini.IniWritevalue("SN", " SN1", "0000000000000000");
|
||||
Cdk_page.Visibility = Visibility.Visible; //cdk_pageT_T = -1; //防止触发倒计时
|
||||
}
|
||||
else if ((int.Parse(D) - int.Parse(DD)) <= 10)//提前10天提醒
|
||||
{
|
||||
Cdk_page.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Cdk_page.Visibility = Visibility.Visible;
|
||||
keytext.Text = "许可证安全校验错误请重新激活";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Cdk_page.Visibility = Visibility.Visible;
|
||||
keytext.Text = "计算机信息变更当前许可证失效";
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
keytext.Text = "许可证安全校验错误请重新激活";
|
||||
}
|
||||
}
|
||||
|
||||
private void username_DropDownClosed(object sender, EventArgs e)
|
||||
{
|
||||
MainWindowViewModel.USERCapacity(username.Text);
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)//打开页面
|
||||
{
|
||||
var windowHandle = new WindowInteropHelper(this).Handle;
|
||||
var currentScreen = Screen.FromHandle(windowHandle);
|
||||
|
||||
System.Drawing.Rectangle rectangle = currentScreen.WorkingArea;
|
||||
|
||||
this.Left = rectangle.Left;
|
||||
this.Top=rectangle.Top;
|
||||
this.Width = rectangle.Width;
|
||||
this.Height = rectangle.Height;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -150,21 +150,12 @@
|
||||
<data name="HistoryRecords" xml:space="preserve">
|
||||
<value>History</value>
|
||||
</data>
|
||||
<data name="HistoryRecords1" xml:space="preserve">
|
||||
<value>History</value>
|
||||
</data>
|
||||
<data name="InOut" xml:space="preserve">
|
||||
<value>I/O</value>
|
||||
</data>
|
||||
<data name="InOut1" xml:space="preserve">
|
||||
<value>I/O</value>
|
||||
</data>
|
||||
<data name="lock" xml:space="preserve">
|
||||
<value>Lock/Unlock</value>
|
||||
</data>
|
||||
<data name="lock1" xml:space="preserve">
|
||||
<value>Lock/Unlock</value>
|
||||
</data>
|
||||
<data name="New" xml:space="preserve">
|
||||
<value>New</value>
|
||||
</data>
|
||||
@@ -270,15 +261,9 @@
|
||||
<data name="Abnormal" xml:space="preserve">
|
||||
<value>Abnormal</value>
|
||||
</data>
|
||||
<data name="Abnormal1" xml:space="preserve">
|
||||
<value>Abnormal</value>
|
||||
</data>
|
||||
<data name="Auto" xml:space="preserve">
|
||||
<value>Auto</value>
|
||||
</data>
|
||||
<data name="Auto1" xml:space="preserve">
|
||||
<value>Auto</value>
|
||||
</data>
|
||||
<data name="Await" xml:space="preserve">
|
||||
<value>Await</value>
|
||||
</data>
|
||||
@@ -300,9 +285,6 @@
|
||||
<data name="LineUp" xml:space="preserve">
|
||||
<value>Line Up</value>
|
||||
</data>
|
||||
<data name="LineUp1" xml:space="preserve">
|
||||
<value>Line Up</value>
|
||||
</data>
|
||||
<data name="Notimplementation" xml:space="preserve">
|
||||
<value>Not Implementation</value>
|
||||
</data>
|
||||
@@ -354,15 +336,9 @@
|
||||
<data name="ID" xml:space="preserve">
|
||||
<value>ID</value>
|
||||
</data>
|
||||
<data name="ID1" xml:space="preserve">
|
||||
<value>ID</value>
|
||||
</data>
|
||||
<data name="Insert" xml:space="preserve">
|
||||
<value>Insert</value>
|
||||
</data>
|
||||
<data name="Insert1" xml:space="preserve">
|
||||
<value>Insert</value>
|
||||
</data>
|
||||
<data name="Recover" xml:space="preserve">
|
||||
<value>Recover</value>
|
||||
</data>
|
||||
@@ -384,9 +360,6 @@
|
||||
<data name="AddWater" xml:space="preserve">
|
||||
<value>Add water</value>
|
||||
</data>
|
||||
<data name="AddWater1" xml:space="preserve">
|
||||
<value>Add water</value>
|
||||
</data>
|
||||
<data name="Cooling" xml:space="preserve">
|
||||
<value>Cooling</value>
|
||||
</data>
|
||||
@@ -447,9 +420,6 @@
|
||||
<data name="AddTheMedicine" xml:space="preserve">
|
||||
<value>Add The Medicine</value>
|
||||
</data>
|
||||
<data name="AddTheMedicine1" xml:space="preserve">
|
||||
<value>Add The Medicine</value>
|
||||
</data>
|
||||
<data name="CallDistribution" xml:space="preserve">
|
||||
<value>Call Distribution</value>
|
||||
</data>
|
||||
@@ -549,9 +519,6 @@
|
||||
<data name="Invalidfeatures" xml:space="preserve">
|
||||
<value>Invalid features</value>
|
||||
</data>
|
||||
<data name="Invalidfeatures1" xml:space="preserve">
|
||||
<value>Invalid features</value>
|
||||
</data>
|
||||
<data name="NO" xml:space="preserve">
|
||||
<value>NO</value>
|
||||
</data>
|
||||
@@ -567,9 +534,6 @@
|
||||
<data name="Advance" xml:space="preserve">
|
||||
<value>Advance</value>
|
||||
</data>
|
||||
<data name="Advance1" xml:space="preserve">
|
||||
<value>Advance</value>
|
||||
</data>
|
||||
<data name="Beginning" xml:space="preserve">
|
||||
<value>Beginning</value>
|
||||
</data>
|
||||
@@ -672,9 +636,6 @@
|
||||
<data name="Implementation" xml:space="preserve">
|
||||
<value>Implementation</value>
|
||||
</data>
|
||||
<data name="Implementation1" xml:space="preserve">
|
||||
<value>Implementation</value>
|
||||
</data>
|
||||
<data name="process_not" xml:space="preserve">
|
||||
<value>The process does not exist</value>
|
||||
</data>
|
||||
@@ -702,9 +663,6 @@
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>Language</value>
|
||||
</data>
|
||||
<data name="Language1" xml:space="preserve">
|
||||
<value>Language</value>
|
||||
</data>
|
||||
<data name="Paused" xml:space="preserve">
|
||||
<value>Paused</value>
|
||||
</data>
|
||||
@@ -786,15 +744,9 @@
|
||||
<data name="High-waterlevel" xml:space="preserve">
|
||||
<value>High-water level</value>
|
||||
</data>
|
||||
<data name="High-waterlevel1" xml:space="preserve">
|
||||
<value>High-water level</value>
|
||||
</data>
|
||||
<data name="Low-waterlevel" xml:space="preserve">
|
||||
<value>Low-water level</value>
|
||||
</data>
|
||||
<data name="Low-waterlevel1" xml:space="preserve">
|
||||
<value>Low-water level</value>
|
||||
</data>
|
||||
<data name="ClothWheel" xml:space="preserve">
|
||||
<value>Cloth Wheel</value>
|
||||
</data>
|
||||
@@ -822,9 +774,6 @@
|
||||
<data name="LnsufficientPower" xml:space="preserve">
|
||||
<value>Lnsufficient Power</value>
|
||||
</data>
|
||||
<data name="LnsufficientPower1" xml:space="preserve">
|
||||
<value>Lnsufficient Power</value>
|
||||
</data>
|
||||
<data name="WorkingStatus" xml:space="preserve">
|
||||
<value>Working Status</value>
|
||||
</data>
|
||||
@@ -942,4 +891,205 @@
|
||||
<data name="Jump" xml:space="preserve">
|
||||
<value>Jump</value>
|
||||
</data>
|
||||
<data name="View" xml:space="preserve">
|
||||
<value>View</value>
|
||||
</data>
|
||||
<data name="Delayed" xml:space="preserve">
|
||||
<value>Delayed</value>
|
||||
</data>
|
||||
<data name="Multi" xml:space="preserve">
|
||||
<value>Multi</value>
|
||||
</data>
|
||||
<data name="Color" xml:space="preserve">
|
||||
<value>Color</value>
|
||||
</data>
|
||||
<data name="DoesNotExist" xml:space="preserve">
|
||||
<value>Does Not Exist</value>
|
||||
</data>
|
||||
<data name="EHCIP" xml:space="preserve">
|
||||
<value>Editing historical crafts is prohibited</value>
|
||||
</data>
|
||||
<data name="ENWOIP" xml:space="preserve">
|
||||
<value>Editing non-pending work order is prohibited</value>
|
||||
</data>
|
||||
<data name="log" xml:space="preserve">
|
||||
<value>Log</value>
|
||||
</data>
|
||||
<data name="NPERR" xml:space="preserve">
|
||||
<value>The account number or password is incorrect</value>
|
||||
</data>
|
||||
<data name="Permit" xml:space="preserve">
|
||||
<value>Permit</value>
|
||||
</data>
|
||||
<data name="Validtime" xml:space="preserve">
|
||||
<value>Valid Time</value>
|
||||
</data>
|
||||
<data name="RIS" xml:space="preserve">
|
||||
<value>Registration is successful</value>
|
||||
</data>
|
||||
<data name="TRCE" xml:space="preserve">
|
||||
<value>The registration code has expired</value>
|
||||
</data>
|
||||
<data name="void_" xml:space="preserve">
|
||||
<value>Void</value>
|
||||
</data>
|
||||
<data name="Plan" xml:space="preserve">
|
||||
<value>Plan</value>
|
||||
</data>
|
||||
<data name="attached" xml:space="preserve">
|
||||
<value>Attached</value>
|
||||
</data>
|
||||
<data name="ColorNumber" xml:space="preserve">
|
||||
<value>ColorNumber</value>
|
||||
</data>
|
||||
<data name="Client" xml:space="preserve">
|
||||
<value>Client</value>
|
||||
</data>
|
||||
<data name="ClothSpecies" xml:space="preserve">
|
||||
<value>ClothSpecies</value>
|
||||
</data>
|
||||
<data name="ClothWeight" xml:space="preserve">
|
||||
<value>ClothWeight</value>
|
||||
</data>
|
||||
<data name="BathRatio" xml:space="preserve">
|
||||
<value>BathRatio</value>
|
||||
</data>
|
||||
<data name="Total" xml:space="preserve">
|
||||
<value>Total</value>
|
||||
</data>
|
||||
<data name="ColorName" xml:space="preserve">
|
||||
<value>ColorName</value>
|
||||
</data>
|
||||
<data name="CloseTheConnection" xml:space="preserve">
|
||||
<value>Close the connection</value>
|
||||
</data>
|
||||
<data name="Online" xml:space="preserve">
|
||||
<value>Online</value>
|
||||
</data>
|
||||
<data name="ERR" xml:space="preserve">
|
||||
<value>ERR</value>
|
||||
</data>
|
||||
<data name="Fail" xml:space="preserve">
|
||||
<value>Fail</value>
|
||||
</data>
|
||||
<data name="LtemizedSending" xml:space="preserve">
|
||||
<value>LtemizedSending</value>
|
||||
</data>
|
||||
<data name="NotSent" xml:space="preserve">
|
||||
<value>Not Sent</value>
|
||||
</data>
|
||||
<data name="DNotSent" xml:space="preserve">
|
||||
<value>Details Were Not Sent</value>
|
||||
</data>
|
||||
<data name="LinkDispenser" xml:space="preserve">
|
||||
<value>Link Dispenser</value>
|
||||
</data>
|
||||
<data name="TPLHBU" xml:space="preserve">
|
||||
<value>The picking list has been used</value>
|
||||
</data>
|
||||
<data name="TTAE" xml:space="preserve">
|
||||
<value>The ticket already exists</value>
|
||||
</data>
|
||||
<data name="Details" xml:space="preserve">
|
||||
<value>Details</value>
|
||||
</data>
|
||||
<data name="ProductCode" xml:space="preserve">
|
||||
<value>ProductCode</value>
|
||||
</data>
|
||||
<data name="ProductName" xml:space="preserve">
|
||||
<value>ProductName</value>
|
||||
</data>
|
||||
<data name="ProductType" xml:space="preserve">
|
||||
<value>ProductType</value>
|
||||
</data>
|
||||
<data name="Grams" xml:space="preserve">
|
||||
<value>Grams</value>
|
||||
</data>
|
||||
<data name="DispenseGrams" xml:space="preserve">
|
||||
<value>Actual</value>
|
||||
</data>
|
||||
<data name="DispenseEndTime" xml:space="preserve">
|
||||
<value>EndTime</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="Manual" xml:space="preserve">
|
||||
<value>Manual</value>
|
||||
</data>
|
||||
<data name="Not_a" xml:space="preserve">
|
||||
<value>NOT AVAILABLE</value>
|
||||
</data>
|
||||
<data name="Screen" xml:space="preserve">
|
||||
<value>Screen</value>
|
||||
</data>
|
||||
<data name="Volume" xml:space="preserve">
|
||||
<value>Volume</value>
|
||||
</data>
|
||||
<data name="DispenseModule" xml:space="preserve">
|
||||
<value>DispenseModule</value>
|
||||
</data>
|
||||
<data name="Information" xml:space="preserve">
|
||||
<value>Information</value>
|
||||
</data>
|
||||
<data name="RTRM" xml:space="preserve">
|
||||
<value>Repeat the raw material</value>
|
||||
</data>
|
||||
<data name="Not_M" xml:space="preserve">
|
||||
<value>Machine does not exist</value>
|
||||
</data>
|
||||
<data name="dye" xml:space="preserve">
|
||||
<value>Dye</value>
|
||||
</data>
|
||||
<data name="chemicals" xml:space="preserve">
|
||||
<value>Chemicals</value>
|
||||
</data>
|
||||
<data name="powder" xml:space="preserve">
|
||||
<value>Powder</value>
|
||||
</data>
|
||||
<data name="TMNR" xml:space="preserve">
|
||||
<value>The machine is not ready</value>
|
||||
</data>
|
||||
<data name="user_lock" xml:space="preserve">
|
||||
<value>LOCK</value>
|
||||
</data>
|
||||
<data name="user_unlock" xml:space="preserve">
|
||||
<value>UNLOCK</value>
|
||||
</data>
|
||||
<data name="VOICE" xml:space="preserve">
|
||||
<value>Voice</value>
|
||||
</data>
|
||||
<data name="TESTVOICE" xml:space="preserve">
|
||||
<value>Test Voice</value>
|
||||
</data>
|
||||
<data name="Speed" xml:space="preserve">
|
||||
<value>Speed</value>
|
||||
</data>
|
||||
<data name="Vol" xml:space="preserve">
|
||||
<value>Vol</value>
|
||||
</data>
|
||||
<data name="Pequest" xml:space="preserve">
|
||||
<value>Pequest</value>
|
||||
</data>
|
||||
<data name="Subroutine" xml:space="preserve">
|
||||
<value>Subroutine</value>
|
||||
</data>
|
||||
<data name="DispenseException" xml:space="preserve">
|
||||
<value>Dispense Exception</value>
|
||||
</data>
|
||||
<data name="_Auto" xml:space="preserve">
|
||||
<value>Manual/Automatic</value>
|
||||
</data>
|
||||
<data name="Swing" xml:space="preserve">
|
||||
<value>Swing</value>
|
||||
</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>
|
||||
@@ -150,21 +150,12 @@
|
||||
<data name="HistoryRecords" xml:space="preserve">
|
||||
<value>History</value>
|
||||
</data>
|
||||
<data name="HistoryRecords1" xml:space="preserve">
|
||||
<value>History</value>
|
||||
</data>
|
||||
<data name="InOut" xml:space="preserve">
|
||||
<value>I/O</value>
|
||||
</data>
|
||||
<data name="InOut1" xml:space="preserve">
|
||||
<value>I/O</value>
|
||||
</data>
|
||||
<data name="lock" xml:space="preserve">
|
||||
<value>lock</value>
|
||||
</data>
|
||||
<data name="lock1" xml:space="preserve">
|
||||
<value>lock</value>
|
||||
</data>
|
||||
<data name="New" xml:space="preserve">
|
||||
<value>New</value>
|
||||
</data>
|
||||
@@ -270,15 +261,9 @@
|
||||
<data name="Abnormal" xml:space="preserve">
|
||||
<value>Abnormal</value>
|
||||
</data>
|
||||
<data name="Abnormal1" xml:space="preserve">
|
||||
<value>Abnormal</value>
|
||||
</data>
|
||||
<data name="Auto" xml:space="preserve">
|
||||
<value>Auto</value>
|
||||
</data>
|
||||
<data name="Auto1" xml:space="preserve">
|
||||
<value>Auto</value>
|
||||
</data>
|
||||
<data name="Await" xml:space="preserve">
|
||||
<value>Await</value>
|
||||
</data>
|
||||
@@ -300,9 +285,6 @@
|
||||
<data name="LineUp" xml:space="preserve">
|
||||
<value>LineUp</value>
|
||||
</data>
|
||||
<data name="LineUp1" xml:space="preserve">
|
||||
<value>LineUp</value>
|
||||
</data>
|
||||
<data name="Notimplementation" xml:space="preserve">
|
||||
<value>Notimplementation</value>
|
||||
</data>
|
||||
@@ -354,15 +336,9 @@
|
||||
<data name="ID" xml:space="preserve">
|
||||
<value>ID</value>
|
||||
</data>
|
||||
<data name="ID1" xml:space="preserve">
|
||||
<value>ID</value>
|
||||
</data>
|
||||
<data name="Insert" xml:space="preserve">
|
||||
<value>Insert</value>
|
||||
</data>
|
||||
<data name="Insert1" xml:space="preserve">
|
||||
<value>Insert</value>
|
||||
</data>
|
||||
<data name="Recover" xml:space="preserve">
|
||||
<value>Recover</value>
|
||||
</data>
|
||||
@@ -384,9 +360,6 @@
|
||||
<data name="AddWater" xml:space="preserve">
|
||||
<value>Add water</value>
|
||||
</data>
|
||||
<data name="AddWater1" xml:space="preserve">
|
||||
<value>Add water</value>
|
||||
</data>
|
||||
<data name="Cooling" xml:space="preserve">
|
||||
<value>Cooling</value>
|
||||
</data>
|
||||
@@ -447,9 +420,6 @@
|
||||
<data name="AddTheMedicine" xml:space="preserve">
|
||||
<value>AddTheMedicine</value>
|
||||
</data>
|
||||
<data name="AddTheMedicine1" xml:space="preserve">
|
||||
<value>AddTheMedicine</value>
|
||||
</data>
|
||||
<data name="CallDistribution" xml:space="preserve">
|
||||
<value>CallDistribution</value>
|
||||
</data>
|
||||
@@ -549,9 +519,6 @@
|
||||
<data name="Invalidfeatures" xml:space="preserve">
|
||||
<value>Invalid features</value>
|
||||
</data>
|
||||
<data name="Invalidfeatures1" xml:space="preserve">
|
||||
<value>Invalid features</value>
|
||||
</data>
|
||||
<data name="NO" xml:space="preserve">
|
||||
<value>NO</value>
|
||||
</data>
|
||||
@@ -567,9 +534,6 @@
|
||||
<data name="Advance" xml:space="preserve">
|
||||
<value>Advance</value>
|
||||
</data>
|
||||
<data name="Advance1" xml:space="preserve">
|
||||
<value>Advance</value>
|
||||
</data>
|
||||
<data name="Beginning" xml:space="preserve">
|
||||
<value>Beginning</value>
|
||||
</data>
|
||||
@@ -672,9 +636,6 @@
|
||||
<data name="Implementation" xml:space="preserve">
|
||||
<value>Implementation</value>
|
||||
</data>
|
||||
<data name="Implementation1" xml:space="preserve">
|
||||
<value>Implementation</value>
|
||||
</data>
|
||||
<data name="process_not" xml:space="preserve">
|
||||
<value>The process does not exist</value>
|
||||
</data>
|
||||
@@ -702,9 +663,6 @@
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>Language</value>
|
||||
</data>
|
||||
<data name="Language1" xml:space="preserve">
|
||||
<value>Language</value>
|
||||
</data>
|
||||
<data name="Paused" xml:space="preserve">
|
||||
<value>Paused</value>
|
||||
</data>
|
||||
@@ -786,15 +744,9 @@
|
||||
<data name="High-waterlevel" xml:space="preserve">
|
||||
<value>High-water level</value>
|
||||
</data>
|
||||
<data name="High-waterlevel1" xml:space="preserve">
|
||||
<value>High-water level</value>
|
||||
</data>
|
||||
<data name="Low-waterlevel" xml:space="preserve">
|
||||
<value>Low-water level</value>
|
||||
</data>
|
||||
<data name="Low-waterlevel1" xml:space="preserve">
|
||||
<value>Low-water level</value>
|
||||
</data>
|
||||
<data name="ClothWheel" xml:space="preserve">
|
||||
<value>ClothWheel</value>
|
||||
</data>
|
||||
@@ -822,9 +774,6 @@
|
||||
<data name="LnsufficientPower" xml:space="preserve">
|
||||
<value>LnsufficientPower</value>
|
||||
</data>
|
||||
<data name="LnsufficientPower1" xml:space="preserve">
|
||||
<value>LnsufficientPower</value>
|
||||
</data>
|
||||
<data name="WorkingStatus" xml:space="preserve">
|
||||
<value>WorkingStatus</value>
|
||||
</data>
|
||||
@@ -942,4 +891,205 @@
|
||||
<data name="Jump" xml:space="preserve">
|
||||
<value>Jump</value>
|
||||
</data>
|
||||
<data name="View" xml:space="preserve">
|
||||
<value>View</value>
|
||||
</data>
|
||||
<data name="Delayed" xml:space="preserve">
|
||||
<value>Delayed</value>
|
||||
</data>
|
||||
<data name="Multi" xml:space="preserve">
|
||||
<value>Multi</value>
|
||||
</data>
|
||||
<data name="Color" xml:space="preserve">
|
||||
<value>Color</value>
|
||||
</data>
|
||||
<data name="DoesNotExist" xml:space="preserve">
|
||||
<value>Does Not Exist</value>
|
||||
</data>
|
||||
<data name="EHCIP" xml:space="preserve">
|
||||
<value>Editing historical crafts is prohibited</value>
|
||||
</data>
|
||||
<data name="ENWOIP" xml:space="preserve">
|
||||
<value>Editing non-pending work order is prohibited</value>
|
||||
</data>
|
||||
<data name="log" xml:space="preserve">
|
||||
<value>Log</value>
|
||||
</data>
|
||||
<data name="NPERR" xml:space="preserve">
|
||||
<value>The account number or password is incorrect</value>
|
||||
</data>
|
||||
<data name="Permit" xml:space="preserve">
|
||||
<value>Permit</value>
|
||||
</data>
|
||||
<data name="Validtime" xml:space="preserve">
|
||||
<value>Valid time</value>
|
||||
</data>
|
||||
<data name="RIS" xml:space="preserve">
|
||||
<value>Registration is successful</value>
|
||||
</data>
|
||||
<data name="TRCE" xml:space="preserve">
|
||||
<value>trce</value>
|
||||
</data>
|
||||
<data name="void_" xml:space="preserve">
|
||||
<value>void</value>
|
||||
</data>
|
||||
<data name="Plan" xml:space="preserve">
|
||||
<value>plan</value>
|
||||
</data>
|
||||
<data name="attached" xml:space="preserve">
|
||||
<value>Attached</value>
|
||||
</data>
|
||||
<data name="ColorNumber" xml:space="preserve">
|
||||
<value>ColorNumber</value>
|
||||
</data>
|
||||
<data name="Client" xml:space="preserve">
|
||||
<value>Client</value>
|
||||
</data>
|
||||
<data name="ClothSpecies" xml:space="preserve">
|
||||
<value>ClothSpecies</value>
|
||||
</data>
|
||||
<data name="ClothWeight" xml:space="preserve">
|
||||
<value>ClothWeight</value>
|
||||
</data>
|
||||
<data name="BathRatio" xml:space="preserve">
|
||||
<value>BathRatio</value>
|
||||
</data>
|
||||
<data name="Total" xml:space="preserve">
|
||||
<value>Total</value>
|
||||
</data>
|
||||
<data name="ColorName" xml:space="preserve">
|
||||
<value>ColorName</value>
|
||||
</data>
|
||||
<data name="CloseTheConnection" xml:space="preserve">
|
||||
<value>Close the connection</value>
|
||||
</data>
|
||||
<data name="Online" xml:space="preserve">
|
||||
<value>online</value>
|
||||
</data>
|
||||
<data name="ERR" xml:space="preserve">
|
||||
<value>err</value>
|
||||
</data>
|
||||
<data name="Fail" xml:space="preserve">
|
||||
<value>fail</value>
|
||||
</data>
|
||||
<data name="LtemizedSending" xml:space="preserve">
|
||||
<value>Itemized sending</value>
|
||||
</data>
|
||||
<data name="NotSent" xml:space="preserve">
|
||||
<value>Not sent</value>
|
||||
</data>
|
||||
<data name="DNotSent" xml:space="preserve">
|
||||
<value>Details were not sent</value>
|
||||
</data>
|
||||
<data name="LinkDispenser" xml:space="preserve">
|
||||
<value>LinkDispenser</value>
|
||||
</data>
|
||||
<data name="TPLHBU" xml:space="preserve">
|
||||
<value>The picking list has been used</value>
|
||||
</data>
|
||||
<data name="TTAE" xml:space="preserve">
|
||||
<value>The ticket already exists</value>
|
||||
</data>
|
||||
<data name="Details" xml:space="preserve">
|
||||
<value>Details</value>
|
||||
</data>
|
||||
<data name="ProductCode" xml:space="preserve">
|
||||
<value>ProductCode</value>
|
||||
</data>
|
||||
<data name="ProductName" xml:space="preserve">
|
||||
<value>ProductName</value>
|
||||
</data>
|
||||
<data name="ProductType" xml:space="preserve">
|
||||
<value>ProductType</value>
|
||||
</data>
|
||||
<data name="Grams" xml:space="preserve">
|
||||
<value>Grams</value>
|
||||
</data>
|
||||
<data name="DispenseGrams" xml:space="preserve">
|
||||
<value>DispenseGrams</value>
|
||||
</data>
|
||||
<data name="DispenseEndTime" xml:space="preserve">
|
||||
<value>DispenseEndTime</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="Manual" xml:space="preserve">
|
||||
<value>Manual</value>
|
||||
</data>
|
||||
<data name="Not_a" xml:space="preserve">
|
||||
<value>NOT AVAILABLE</value>
|
||||
</data>
|
||||
<data name="Screen" xml:space="preserve">
|
||||
<value>screen</value>
|
||||
</data>
|
||||
<data name="Volume" xml:space="preserve">
|
||||
<value>Volume</value>
|
||||
</data>
|
||||
<data name="DispenseModule" xml:space="preserve">
|
||||
<value>DispenseModule</value>
|
||||
</data>
|
||||
<data name="Information" xml:space="preserve">
|
||||
<value>Information</value>
|
||||
</data>
|
||||
<data name="RTRM" xml:space="preserve">
|
||||
<value>Repeat the raw material</value>
|
||||
</data>
|
||||
<data name="Not_M" xml:space="preserve">
|
||||
<value>NOT Machine</value>
|
||||
</data>
|
||||
<data name="dye" xml:space="preserve">
|
||||
<value>dye</value>
|
||||
</data>
|
||||
<data name="chemicals" xml:space="preserve">
|
||||
<value>chemicals</value>
|
||||
</data>
|
||||
<data name="powder" xml:space="preserve">
|
||||
<value>powder</value>
|
||||
</data>
|
||||
<data name="TMNR" xml:space="preserve">
|
||||
<value>The machine is not ready</value>
|
||||
</data>
|
||||
<data name="user_lock" xml:space="preserve">
|
||||
<value>user_lock</value>
|
||||
</data>
|
||||
<data name="user_unlock" xml:space="preserve">
|
||||
<value>user_unlock</value>
|
||||
</data>
|
||||
<data name="VOICE" xml:space="preserve">
|
||||
<value>VOICE</value>
|
||||
</data>
|
||||
<data name="TESTVOICE" xml:space="preserve">
|
||||
<value>Test Voice</value>
|
||||
</data>
|
||||
<data name="Speed" xml:space="preserve">
|
||||
<value>Speed</value>
|
||||
</data>
|
||||
<data name="Vol" xml:space="preserve">
|
||||
<value>Vol</value>
|
||||
</data>
|
||||
<data name="Pequest" xml:space="preserve">
|
||||
<value>Pequest</value>
|
||||
</data>
|
||||
<data name="Subroutine" xml:space="preserve">
|
||||
<value>Subroutine</value>
|
||||
</data>
|
||||
<data name="DispenseException" xml:space="preserve">
|
||||
<value>DispenseException</value>
|
||||
</data>
|
||||
<data name="_Auto" xml:space="preserve">
|
||||
<value>Manual/Automatic</value>
|
||||
</data>
|
||||
<data name="Swing" xml:space="preserve">
|
||||
<value>Swing</value>
|
||||
</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>
|
||||
@@ -150,21 +150,12 @@
|
||||
<data name="HistoryRecords" xml:space="preserve">
|
||||
<value>历史</value>
|
||||
</data>
|
||||
<data name="HistoryRecords1" xml:space="preserve">
|
||||
<value>历史</value>
|
||||
</data>
|
||||
<data name="InOut" xml:space="preserve">
|
||||
<value>输入输出</value>
|
||||
</data>
|
||||
<data name="InOut1" xml:space="preserve">
|
||||
<value>输入输出</value>
|
||||
</data>
|
||||
<data name="lock" xml:space="preserve">
|
||||
<value>锁定/解锁</value>
|
||||
</data>
|
||||
<data name="lock1" xml:space="preserve">
|
||||
<value>锁定/解锁</value>
|
||||
</data>
|
||||
<data name="New" xml:space="preserve">
|
||||
<value>新建</value>
|
||||
</data>
|
||||
@@ -270,15 +261,9 @@
|
||||
<data name="Abnormal" xml:space="preserve">
|
||||
<value>异常</value>
|
||||
</data>
|
||||
<data name="Abnormal1" xml:space="preserve">
|
||||
<value>异常</value>
|
||||
</data>
|
||||
<data name="Auto" xml:space="preserve">
|
||||
<value>自动</value>
|
||||
</data>
|
||||
<data name="Auto1" xml:space="preserve">
|
||||
<value>自动</value>
|
||||
</data>
|
||||
<data name="Await" xml:space="preserve">
|
||||
<value>等待命令</value>
|
||||
</data>
|
||||
@@ -300,9 +285,6 @@
|
||||
<data name="LineUp" xml:space="preserve">
|
||||
<value>排队</value>
|
||||
</data>
|
||||
<data name="LineUp1" xml:space="preserve">
|
||||
<value>排队</value>
|
||||
</data>
|
||||
<data name="Notimplementation" xml:space="preserve">
|
||||
<value>未执行</value>
|
||||
</data>
|
||||
@@ -354,15 +336,9 @@
|
||||
<data name="ID" xml:space="preserve">
|
||||
<value>ID</value>
|
||||
</data>
|
||||
<data name="ID1" xml:space="preserve">
|
||||
<value>ID</value>
|
||||
</data>
|
||||
<data name="Insert" xml:space="preserve">
|
||||
<value>插入</value>
|
||||
</data>
|
||||
<data name="Insert1" xml:space="preserve">
|
||||
<value>插入</value>
|
||||
</data>
|
||||
<data name="Recover" xml:space="preserve">
|
||||
<value>恢复</value>
|
||||
</data>
|
||||
@@ -384,9 +360,6 @@
|
||||
<data name="AddWater" xml:space="preserve">
|
||||
<value>入水</value>
|
||||
</data>
|
||||
<data name="AddWater1" xml:space="preserve">
|
||||
<value>入水</value>
|
||||
</data>
|
||||
<data name="Cooling" xml:space="preserve">
|
||||
<value>冷却</value>
|
||||
</data>
|
||||
@@ -447,9 +420,6 @@
|
||||
<data name="AddTheMedicine" xml:space="preserve">
|
||||
<value>加药</value>
|
||||
</data>
|
||||
<data name="AddTheMedicine1" xml:space="preserve">
|
||||
<value>加药</value>
|
||||
</data>
|
||||
<data name="CallDistribution" xml:space="preserve">
|
||||
<value>呼叫输送</value>
|
||||
</data>
|
||||
@@ -549,9 +519,6 @@
|
||||
<data name="Invalidfeatures" xml:space="preserve">
|
||||
<value>功能无效</value>
|
||||
</data>
|
||||
<data name="Invalidfeatures1" xml:space="preserve">
|
||||
<value>功能无效</value>
|
||||
</data>
|
||||
<data name="NO" xml:space="preserve">
|
||||
<value>否</value>
|
||||
</data>
|
||||
@@ -567,9 +534,6 @@
|
||||
<data name="Advance" xml:space="preserve">
|
||||
<value>提前</value>
|
||||
</data>
|
||||
<data name="Advance1" xml:space="preserve">
|
||||
<value>提前</value>
|
||||
</data>
|
||||
<data name="Beginning" xml:space="preserve">
|
||||
<value>开头</value>
|
||||
</data>
|
||||
@@ -622,7 +586,7 @@
|
||||
<value>速率</value>
|
||||
</data>
|
||||
<data name="Tank" xml:space="preserve">
|
||||
<value>缸</value>
|
||||
<value>桶</value>
|
||||
</data>
|
||||
<data name="Tank1" xml:space="preserve">
|
||||
<value>缸</value>
|
||||
@@ -672,9 +636,6 @@
|
||||
<data name="Implementation" xml:space="preserve">
|
||||
<value>执行</value>
|
||||
</data>
|
||||
<data name="Implementation1" xml:space="preserve">
|
||||
<value>执行</value>
|
||||
</data>
|
||||
<data name="process_not" xml:space="preserve">
|
||||
<value>工艺不存在</value>
|
||||
</data>
|
||||
@@ -702,9 +663,6 @@
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>语言</value>
|
||||
</data>
|
||||
<data name="Language1" xml:space="preserve">
|
||||
<value>语言</value>
|
||||
</data>
|
||||
<data name="Paused" xml:space="preserve">
|
||||
<value>暂停</value>
|
||||
</data>
|
||||
@@ -786,15 +744,9 @@
|
||||
<data name="High-waterlevel" xml:space="preserve">
|
||||
<value>高水位</value>
|
||||
</data>
|
||||
<data name="High-waterlevel1" xml:space="preserve">
|
||||
<value>高水位</value>
|
||||
</data>
|
||||
<data name="Low-waterlevel" xml:space="preserve">
|
||||
<value>低水位</value>
|
||||
</data>
|
||||
<data name="Low-waterlevel1" xml:space="preserve">
|
||||
<value>低水位</value>
|
||||
</data>
|
||||
<data name="ClothWheel" xml:space="preserve">
|
||||
<value>布轮</value>
|
||||
</data>
|
||||
@@ -822,9 +774,6 @@
|
||||
<data name="LnsufficientPower" xml:space="preserve">
|
||||
<value>功率不足</value>
|
||||
</data>
|
||||
<data name="LnsufficientPower1" xml:space="preserve">
|
||||
<value>功率不足</value>
|
||||
</data>
|
||||
<data name="WorkingStatus" xml:space="preserve">
|
||||
<value>工作状态</value>
|
||||
</data>
|
||||
@@ -942,4 +891,205 @@
|
||||
<data name="Jump" xml:space="preserve">
|
||||
<value>跳步</value>
|
||||
</data>
|
||||
<data name="View" xml:space="preserve">
|
||||
<value>视图</value>
|
||||
</data>
|
||||
<data name="Delayed" xml:space="preserve">
|
||||
<value>延后</value>
|
||||
</data>
|
||||
<data name="Multi" xml:space="preserve">
|
||||
<value>多机</value>
|
||||
</data>
|
||||
<data name="Color" xml:space="preserve">
|
||||
<value>颜色</value>
|
||||
</data>
|
||||
<data name="DoesNotExist" xml:space="preserve">
|
||||
<value>不存在</value>
|
||||
</data>
|
||||
<data name="EHCIP" xml:space="preserve">
|
||||
<value>禁止编辑历史工艺</value>
|
||||
</data>
|
||||
<data name="ENWOIP" xml:space="preserve">
|
||||
<value>禁止编辑非等待中的工单</value>
|
||||
</data>
|
||||
<data name="log" xml:space="preserve">
|
||||
<value>日志</value>
|
||||
</data>
|
||||
<data name="NPERR" xml:space="preserve">
|
||||
<value>账号或密码错误</value>
|
||||
</data>
|
||||
<data name="Permit" xml:space="preserve">
|
||||
<value>许可证</value>
|
||||
</data>
|
||||
<data name="Validtime" xml:space="preserve">
|
||||
<value>有效时间</value>
|
||||
</data>
|
||||
<data name="RIS" xml:space="preserve">
|
||||
<value>注册成功</value>
|
||||
</data>
|
||||
<data name="TRCE" xml:space="preserve">
|
||||
<value>注册码过期</value>
|
||||
</data>
|
||||
<data name="void_" xml:space="preserve">
|
||||
<value>无效</value>
|
||||
</data>
|
||||
<data name="Plan" xml:space="preserve">
|
||||
<value>计划</value>
|
||||
</data>
|
||||
<data name="attached" xml:space="preserve">
|
||||
<value>附</value>
|
||||
</data>
|
||||
<data name="ColorNumber" xml:space="preserve">
|
||||
<value>色号</value>
|
||||
</data>
|
||||
<data name="Client" xml:space="preserve">
|
||||
<value>客户</value>
|
||||
</data>
|
||||
<data name="ClothSpecies" xml:space="preserve">
|
||||
<value>布种</value>
|
||||
</data>
|
||||
<data name="ClothWeight" xml:space="preserve">
|
||||
<value>布重</value>
|
||||
</data>
|
||||
<data name="BathRatio" xml:space="preserve">
|
||||
<value>浴比</value>
|
||||
</data>
|
||||
<data name="Total" xml:space="preserve">
|
||||
<value>总浴量</value>
|
||||
</data>
|
||||
<data name="ColorName" xml:space="preserve">
|
||||
<value>色名</value>
|
||||
</data>
|
||||
<data name="CloseTheConnection" xml:space="preserve">
|
||||
<value>断开连接</value>
|
||||
</data>
|
||||
<data name="Online" xml:space="preserve">
|
||||
<value>在线</value>
|
||||
</data>
|
||||
<data name="ERR" xml:space="preserve">
|
||||
<value>错误</value>
|
||||
</data>
|
||||
<data name="Fail" xml:space="preserve">
|
||||
<value>失败</value>
|
||||
</data>
|
||||
<data name="LtemizedSending" xml:space="preserve">
|
||||
<value>发送明细</value>
|
||||
</data>
|
||||
<data name="NotSent" xml:space="preserve">
|
||||
<value>未发送</value>
|
||||
</data>
|
||||
<data name="DNotSent" xml:space="preserve">
|
||||
<value>未发送明细</value>
|
||||
</data>
|
||||
<data name="LinkDispenser" xml:space="preserve">
|
||||
<value>连接染料助剂分配器</value>
|
||||
</data>
|
||||
<data name="TPLHBU" xml:space="preserve">
|
||||
<value>领料单已使用</value>
|
||||
</data>
|
||||
<data name="TTAE" xml:space="preserve">
|
||||
<value>工单已经存在</value>
|
||||
</data>
|
||||
<data name="Details" xml:space="preserve">
|
||||
<value>明细</value>
|
||||
</data>
|
||||
<data name="ProductCode" xml:space="preserve">
|
||||
<value>原料代码</value>
|
||||
</data>
|
||||
<data name="ProductName" xml:space="preserve">
|
||||
<value>原料名称</value>
|
||||
</data>
|
||||
<data name="ProductType" xml:space="preserve">
|
||||
<value>原料类型</value>
|
||||
</data>
|
||||
<data name="Grams" xml:space="preserve">
|
||||
<value>克重</value>
|
||||
</data>
|
||||
<data name="DispenseGrams" xml:space="preserve">
|
||||
<value>实际</value>
|
||||
</data>
|
||||
<data name="DispenseEndTime" xml:space="preserve">
|
||||
<value>完成时间</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>取消</value>
|
||||
</data>
|
||||
<data name="Manual" xml:space="preserve">
|
||||
<value>手动</value>
|
||||
</data>
|
||||
<data name="Not_a" xml:space="preserve">
|
||||
<value>当前功能不可用</value>
|
||||
</data>
|
||||
<data name="Screen" xml:space="preserve">
|
||||
<value>远程画面</value>
|
||||
</data>
|
||||
<data name="Volume" xml:space="preserve">
|
||||
<value>容量</value>
|
||||
</data>
|
||||
<data name="DispenseModule" xml:space="preserve">
|
||||
<value>运行模组</value>
|
||||
</data>
|
||||
<data name="Information" xml:space="preserve">
|
||||
<value>信息</value>
|
||||
</data>
|
||||
<data name="RTRM" xml:space="preserve">
|
||||
<value>重复原料</value>
|
||||
</data>
|
||||
<data name="Not_M" xml:space="preserve">
|
||||
<value>机台不存在</value>
|
||||
</data>
|
||||
<data name="dye" xml:space="preserve">
|
||||
<value>染料</value>
|
||||
</data>
|
||||
<data name="chemicals" xml:space="preserve">
|
||||
<value>助剂</value>
|
||||
</data>
|
||||
<data name="powder" xml:space="preserve">
|
||||
<value>粉体</value>
|
||||
</data>
|
||||
<data name="TMNR" xml:space="preserve">
|
||||
<value>机台未就绪</value>
|
||||
</data>
|
||||
<data name="user_lock" xml:space="preserve">
|
||||
<value>锁定</value>
|
||||
</data>
|
||||
<data name="user_unlock" xml:space="preserve">
|
||||
<value>解锁</value>
|
||||
</data>
|
||||
<data name="VOICE" xml:space="preserve">
|
||||
<value>语音</value>
|
||||
</data>
|
||||
<data name="TESTVOICE" xml:space="preserve">
|
||||
<value>测试语音</value>
|
||||
</data>
|
||||
<data name="Speed" xml:space="preserve">
|
||||
<value>语速</value>
|
||||
</data>
|
||||
<data name="Vol" xml:space="preserve">
|
||||
<value>音量</value>
|
||||
</data>
|
||||
<data name="Pequest" xml:space="preserve">
|
||||
<value>请求</value>
|
||||
</data>
|
||||
<data name="Subroutine" xml:space="preserve">
|
||||
<value>副功能</value>
|
||||
</data>
|
||||
<data name="DispenseException" xml:space="preserve">
|
||||
<value>输送异常</value>
|
||||
</data>
|
||||
<data name="_Auto" xml:space="preserve">
|
||||
<value>手/自动</value>
|
||||
</data>
|
||||
<data name="Swing" xml:space="preserve">
|
||||
<value>摆布</value>
|
||||
</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>
|
||||
@@ -150,21 +150,12 @@
|
||||
<data name="HistoryRecords" xml:space="preserve">
|
||||
<value>歷史</value>
|
||||
</data>
|
||||
<data name="HistoryRecords1" xml:space="preserve">
|
||||
<value>歷史</value>
|
||||
</data>
|
||||
<data name="InOut" xml:space="preserve">
|
||||
<value>輸入輸出</value>
|
||||
</data>
|
||||
<data name="InOut1" xml:space="preserve">
|
||||
<value>輸入輸出</value>
|
||||
</data>
|
||||
<data name="lock" xml:space="preserve">
|
||||
<value>鎖定</value>
|
||||
</data>
|
||||
<data name="lock1" xml:space="preserve">
|
||||
<value>鎖定</value>
|
||||
</data>
|
||||
<data name="New" xml:space="preserve">
|
||||
<value>新建</value>
|
||||
</data>
|
||||
@@ -270,15 +261,9 @@
|
||||
<data name="Abnormal" xml:space="preserve">
|
||||
<value>異常</value>
|
||||
</data>
|
||||
<data name="Abnormal1" xml:space="preserve">
|
||||
<value>異常</value>
|
||||
</data>
|
||||
<data name="Auto" xml:space="preserve">
|
||||
<value>自動</value>
|
||||
</data>
|
||||
<data name="Auto1" xml:space="preserve">
|
||||
<value>自動</value>
|
||||
</data>
|
||||
<data name="Await" xml:space="preserve">
|
||||
<value>等待命令</value>
|
||||
</data>
|
||||
@@ -300,9 +285,6 @@
|
||||
<data name="LineUp" xml:space="preserve">
|
||||
<value>轉入</value>
|
||||
</data>
|
||||
<data name="LineUp1" xml:space="preserve">
|
||||
<value>轉入</value>
|
||||
</data>
|
||||
<data name="Notimplementation" xml:space="preserve">
|
||||
<value>未執行</value>
|
||||
</data>
|
||||
@@ -354,15 +336,9 @@
|
||||
<data name="ID" xml:space="preserve">
|
||||
<value>ID</value>
|
||||
</data>
|
||||
<data name="ID1" xml:space="preserve">
|
||||
<value>ID</value>
|
||||
</data>
|
||||
<data name="Insert" xml:space="preserve">
|
||||
<value>插入</value>
|
||||
</data>
|
||||
<data name="Insert1" xml:space="preserve">
|
||||
<value>插入</value>
|
||||
</data>
|
||||
<data name="Recover" xml:space="preserve">
|
||||
<value>恢復</value>
|
||||
</data>
|
||||
@@ -384,9 +360,6 @@
|
||||
<data name="AddWater" xml:space="preserve">
|
||||
<value>入水</value>
|
||||
</data>
|
||||
<data name="AddWater1" xml:space="preserve">
|
||||
<value>入水</value>
|
||||
</data>
|
||||
<data name="Cooling" xml:space="preserve">
|
||||
<value>冷卻</value>
|
||||
</data>
|
||||
@@ -447,9 +420,6 @@
|
||||
<data name="AddTheMedicine" xml:space="preserve">
|
||||
<value>加藥</value>
|
||||
</data>
|
||||
<data name="AddTheMedicine1" xml:space="preserve">
|
||||
<value>加藥</value>
|
||||
</data>
|
||||
<data name="CallDistribution" xml:space="preserve">
|
||||
<value>呼叫輸送</value>
|
||||
</data>
|
||||
@@ -549,9 +519,6 @@
|
||||
<data name="Invalidfeatures" xml:space="preserve">
|
||||
<value>無效的圖徵</value>
|
||||
</data>
|
||||
<data name="Invalidfeatures1" xml:space="preserve">
|
||||
<value>無效的圖徵</value>
|
||||
</data>
|
||||
<data name="NO" xml:space="preserve">
|
||||
<value>否</value>
|
||||
</data>
|
||||
@@ -567,9 +534,6 @@
|
||||
<data name="Advance" xml:space="preserve">
|
||||
<value>提前</value>
|
||||
</data>
|
||||
<data name="Advance1" xml:space="preserve">
|
||||
<value>提前</value>
|
||||
</data>
|
||||
<data name="Beginning" xml:space="preserve">
|
||||
<value>開始</value>
|
||||
</data>
|
||||
@@ -622,7 +586,7 @@
|
||||
<value>速率</value>
|
||||
</data>
|
||||
<data name="Tank" xml:space="preserve">
|
||||
<value>缸</value>
|
||||
<value>桶</value>
|
||||
</data>
|
||||
<data name="Tank1" xml:space="preserve">
|
||||
<value>缸</value>
|
||||
@@ -672,9 +636,6 @@
|
||||
<data name="Implementation" xml:space="preserve">
|
||||
<value>執行</value>
|
||||
</data>
|
||||
<data name="Implementation1" xml:space="preserve">
|
||||
<value>執行</value>
|
||||
</data>
|
||||
<data name="process_not" xml:space="preserve">
|
||||
<value>流程不存在</value>
|
||||
</data>
|
||||
@@ -702,9 +663,6 @@
|
||||
<data name="Language" xml:space="preserve">
|
||||
<value>語言</value>
|
||||
</data>
|
||||
<data name="Language1" xml:space="preserve">
|
||||
<value>語言</value>
|
||||
</data>
|
||||
<data name="Paused" xml:space="preserve">
|
||||
<value>已暫停</value>
|
||||
</data>
|
||||
@@ -786,15 +744,9 @@
|
||||
<data name="High-waterlevel" xml:space="preserve">
|
||||
<value>高水位</value>
|
||||
</data>
|
||||
<data name="High-waterlevel1" xml:space="preserve">
|
||||
<value>高水位</value>
|
||||
</data>
|
||||
<data name="Low-waterlevel" xml:space="preserve">
|
||||
<value>低水位</value>
|
||||
</data>
|
||||
<data name="Low-waterlevel1" xml:space="preserve">
|
||||
<value>低水位</value>
|
||||
</data>
|
||||
<data name="ClothWheel" xml:space="preserve">
|
||||
<value>布輪</value>
|
||||
</data>
|
||||
@@ -822,9 +774,6 @@
|
||||
<data name="LnsufficientPower" xml:space="preserve">
|
||||
<value>功率不足</value>
|
||||
</data>
|
||||
<data name="LnsufficientPower1" xml:space="preserve">
|
||||
<value>功率不足</value>
|
||||
</data>
|
||||
<data name="WorkingStatus" xml:space="preserve">
|
||||
<value>工作狀態</value>
|
||||
</data>
|
||||
@@ -915,31 +864,232 @@
|
||||
<data name="Group" xml:space="preserve">
|
||||
<value>組</value>
|
||||
</data>
|
||||
<data name="DayAfter" xml:space="preserve">
|
||||
<value>後一天</value>
|
||||
</data>
|
||||
<data name="Before" xml:space="preserve">
|
||||
<value>前一天</value>
|
||||
</data>
|
||||
<data name="Today" xml:space="preserve">
|
||||
<value>今天</value>
|
||||
</data>
|
||||
<data name="DayAfter" xml:space="preserve">
|
||||
<value>後一天</value>
|
||||
</data>
|
||||
<data name="Test" xml:space="preserve">
|
||||
<value>測試</value>
|
||||
</data>
|
||||
<data name="Mode" xml:space="preserve">
|
||||
<value>模式</value>
|
||||
</data>
|
||||
<data name="Password" xml:space="preserve">
|
||||
<value>密碼</value>
|
||||
</data>
|
||||
<data name="SQL" xml:space="preserve">
|
||||
<value>資料庫</value>
|
||||
</data>
|
||||
<data name="SERVER" xml:space="preserve">
|
||||
<value>伺服器</value>
|
||||
</data>
|
||||
<data name="Password" xml:space="preserve">
|
||||
<value>密碼</value>
|
||||
</data>
|
||||
<data name="Mode" xml:space="preserve">
|
||||
<value>模式</value>
|
||||
</data>
|
||||
<data name="Jump" xml:space="preserve">
|
||||
<value>跳步</value>
|
||||
</data>
|
||||
<data name="View" xml:space="preserve">
|
||||
<value>考量</value>
|
||||
</data>
|
||||
<data name="Delayed" xml:space="preserve">
|
||||
<value>延遲</value>
|
||||
</data>
|
||||
<data name="Multi" xml:space="preserve">
|
||||
<value>多机</value>
|
||||
</data>
|
||||
<data name="Color" xml:space="preserve">
|
||||
<value>顏色</value>
|
||||
</data>
|
||||
<data name="DoesNotExist" xml:space="preserve">
|
||||
<value>頁面不存在</value>
|
||||
</data>
|
||||
<data name="EHCIP" xml:space="preserve">
|
||||
<value>禁止編輯歷史工單</value>
|
||||
</data>
|
||||
<data name="ENWOIP" xml:space="preserve">
|
||||
<value>禁止編輯非待處理工單</value>
|
||||
</data>
|
||||
<data name="log" xml:space="preserve">
|
||||
<value>日誌</value>
|
||||
</data>
|
||||
<data name="NPERR" xml:space="preserve">
|
||||
<value>帳戶號碼或密碼不正確</value>
|
||||
</data>
|
||||
<data name="Permit" xml:space="preserve">
|
||||
<value>許可</value>
|
||||
</data>
|
||||
<data name="Validtime" xml:space="preserve">
|
||||
<value>有效的</value>
|
||||
</data>
|
||||
<data name="RIS" xml:space="preserve">
|
||||
<value>注冊成功</value>
|
||||
</data>
|
||||
<data name="TRCE" xml:space="preserve">
|
||||
<value>注冊無效</value>
|
||||
</data>
|
||||
<data name="void_" xml:space="preserve">
|
||||
<value>無效</value>
|
||||
</data>
|
||||
<data name="Plan" xml:space="preserve">
|
||||
<value>方案</value>
|
||||
</data>
|
||||
<data name="attached" xml:space="preserve">
|
||||
<value>附</value>
|
||||
</data>
|
||||
<data name="ColorNumber" xml:space="preserve">
|
||||
<value>色號</value>
|
||||
</data>
|
||||
<data name="Client" xml:space="preserve">
|
||||
<value>编辑</value>
|
||||
</data>
|
||||
<data name="ClothSpecies" xml:space="preserve">
|
||||
<value>布種</value>
|
||||
</data>
|
||||
<data name="ClothWeight" xml:space="preserve">
|
||||
<value>布重</value>
|
||||
</data>
|
||||
<data name="BathRatio" xml:space="preserve">
|
||||
<value>浴比</value>
|
||||
</data>
|
||||
<data name="Total" xml:space="preserve">
|
||||
<value>總浴量</value>
|
||||
</data>
|
||||
<data name="ColorName" xml:space="preserve">
|
||||
<value>色名</value>
|
||||
</data>
|
||||
<data name="CloseTheConnection" xml:space="preserve">
|
||||
<value>斷開連線</value>
|
||||
</data>
|
||||
<data name="Online" xml:space="preserve">
|
||||
<value>在線</value>
|
||||
</data>
|
||||
<data name="ERR" xml:space="preserve">
|
||||
<value>錯誤</value>
|
||||
</data>
|
||||
<data name="Fail" xml:space="preserve">
|
||||
<value>失敗</value>
|
||||
</data>
|
||||
<data name="LtemizedSending" xml:space="preserve">
|
||||
<value>發送明細</value>
|
||||
</data>
|
||||
<data name="NotSent" xml:space="preserve">
|
||||
<value>未發送</value>
|
||||
</data>
|
||||
<data name="DNotSent" xml:space="preserve">
|
||||
<value>未發送明細</value>
|
||||
</data>
|
||||
<data name="LinkDispenser" xml:space="preserve">
|
||||
<value>連接染料助劑分配器</value>
|
||||
</data>
|
||||
<data name="TPLHBU" xml:space="preserve">
|
||||
<value>領料單已使用</value>
|
||||
</data>
|
||||
<data name="TTAE" xml:space="preserve">
|
||||
<value>工單已經存在</value>
|
||||
</data>
|
||||
<data name="Details" xml:space="preserve">
|
||||
<value>詳細</value>
|
||||
</data>
|
||||
<data name="ProductCode" xml:space="preserve">
|
||||
<value>原料代碼</value>
|
||||
</data>
|
||||
<data name="ProductName" xml:space="preserve">
|
||||
<value>原料名稱</value>
|
||||
</data>
|
||||
<data name="ProductType" xml:space="preserve">
|
||||
<value>原料類型</value>
|
||||
</data>
|
||||
<data name="Grams" xml:space="preserve">
|
||||
<value>克重</value>
|
||||
</data>
|
||||
<data name="DispenseGrams" xml:space="preserve">
|
||||
<value>實際</value>
|
||||
</data>
|
||||
<data name="DispenseEndTime" xml:space="preserve">
|
||||
<value>完成時間</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>取消</value>
|
||||
</data>
|
||||
<data name="Manual" xml:space="preserve">
|
||||
<value>手動</value>
|
||||
</data>
|
||||
<data name="Not_a" xml:space="preserve">
|
||||
<value>目前功能不可用</value>
|
||||
</data>
|
||||
<data name="Screen" xml:space="preserve">
|
||||
<value>遠端畫面</value>
|
||||
</data>
|
||||
<data name="Volume" xml:space="preserve">
|
||||
<value>容量</value>
|
||||
</data>
|
||||
<data name="DispenseModule" xml:space="preserve">
|
||||
<value>運行模組</value>
|
||||
</data>
|
||||
<data name="Information" xml:space="preserve">
|
||||
<value>訊息</value>
|
||||
</data>
|
||||
<data name="RTRM" xml:space="preserve">
|
||||
<value>重複原料</value>
|
||||
</data>
|
||||
<data name="Not_M" xml:space="preserve">
|
||||
<value>機台不存在</value>
|
||||
</data>
|
||||
<data name="dye" xml:space="preserve">
|
||||
<value>染料</value>
|
||||
</data>
|
||||
<data name="chemicals" xml:space="preserve">
|
||||
<value>助劑</value>
|
||||
</data>
|
||||
<data name="powder" xml:space="preserve">
|
||||
<value>粉體</value>
|
||||
</data>
|
||||
<data name="TMNR" xml:space="preserve">
|
||||
<value>機台未就緒</value>
|
||||
</data>
|
||||
<data name="user_lock" xml:space="preserve">
|
||||
<value>鎖定</value>
|
||||
</data>
|
||||
<data name="user_unlock" xml:space="preserve">
|
||||
<value>解鎖</value>
|
||||
</data>
|
||||
<data name="VOICE" xml:space="preserve">
|
||||
<value>語音</value>
|
||||
</data>
|
||||
<data name="TESTVOICE" xml:space="preserve">
|
||||
<value>測試語音</value>
|
||||
</data>
|
||||
<data name="Speed" xml:space="preserve">
|
||||
<value>語速</value>
|
||||
</data>
|
||||
<data name="Vol" xml:space="preserve">
|
||||
<value>音量</value>
|
||||
</data>
|
||||
<data name="Pequest" xml:space="preserve">
|
||||
<value>請求</value>
|
||||
</data>
|
||||
<data name="Subroutine" xml:space="preserve">
|
||||
<value>副功能</value>
|
||||
</data>
|
||||
<data name="DispenseException" xml:space="preserve">
|
||||
<value>輸送異常</value>
|
||||
</data>
|
||||
<data name="_Auto" xml:space="preserve">
|
||||
<value>手/自動</value>
|
||||
</data>
|
||||
<data name="Swing" xml:space="preserve">
|
||||
<value>擺佈</value>
|
||||
</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>
|
||||
@@ -5,7 +5,9 @@ VisualStudioVersion = 17.11.35312.102
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SunlightCentralizedControlManagement_SCCM_", "SunlightCentralizedControlManagement_SCCM_.csproj", "{2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GanttChart", "GanttChart\GanttChart.csproj", "{DEA91CB9-1011-4EE7-B8E1-72428F731789}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nGantt", "..\nGantt\nGantt.csproj", "{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VncSharpWpf", "..\VncSharpWpf\VncSharpWpf.csproj", "{77B5CB63-E14B-4253-881D-6BE9D7C57076}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -17,10 +19,14 @@ Global
|
||||
{2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DEA91CB9-1011-4EE7-B8E1-72428F731789}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DEA91CB9-1011-4EE7-B8E1-72428F731789}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DEA91CB9-1011-4EE7-B8E1-72428F731789}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DEA91CB9-1011-4EE7-B8E1-72428F731789}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Debug|Any CPU.Build.0 = Debug|x86
|
||||
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Release|Any CPU.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
@@ -39,6 +39,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -55,10 +56,34 @@
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>sunlightlogo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="SkiaSharp">
|
||||
<HintPath>bin\Debug\SkiaSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Speech" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -72,6 +97,7 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
@@ -79,12 +105,37 @@
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="ConvertMoels\BoolRBConvert.cs" />
|
||||
<Compile Include="ConvertMoels\StatenClassConvert.cs" />
|
||||
<Compile Include="ConvertMoels\BoolToVisidilityConvert.cs" />
|
||||
<Compile Include="ConvertMoels\StatenToImageConvert.cs" />
|
||||
<Compile Include="ConvertMoels\StatexmlConvert.cs" />
|
||||
<Compile Include="EX\DispenseState.xaml.cs">
|
||||
<DependentUpon>DispenseState.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<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">
|
||||
<DependentUpon>ManualDyelot.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EX\VNC.xaml.cs">
|
||||
<DependentUpon>VNC.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Login.xaml.cs">
|
||||
<DependentUpon>Login.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserClass\AsyncSerialPortClient.cs" />
|
||||
<Compile Include="UserClass\AsyncTcpClient.cs" />
|
||||
<Compile Include="UserClass\ClsLock.cs" />
|
||||
<Compile Include="UserClass\CRCcheck16.cs" />
|
||||
<Compile Include="UserClass\CSV.cs" />
|
||||
<Compile Include="UserClass\DataGridHelper.cs" />
|
||||
<Compile Include="UserClass\DataTableForToObservableCollection.cs" />
|
||||
<Compile Include="UserClass\DataTableManager .cs" />
|
||||
<Compile Include="UserClass\get_local_ip_address.cs" />
|
||||
<Compile Include="UserClass\HardwareSN.cs" />
|
||||
<Compile Include="UserClass\IniFile.cs" />
|
||||
@@ -93,22 +144,55 @@
|
||||
<Compile Include="UserClass\NetFwManger.cs" />
|
||||
<Compile Include="UserClass\NumericTextColumn .cs" />
|
||||
<Compile Include="UserClass\PID.cs" />
|
||||
<Compile Include="UserClass\RS485MasterStation.cs" />
|
||||
<Compile Include="UserClass\SYSInfo.cs" />
|
||||
<Compile Include="UserClass\PressKey.cs" />
|
||||
<Compile Include="UserClass\SqliteHelper.cs" />
|
||||
<Compile Include="UserClass\StrToInt.cs" />
|
||||
<Compile Include="UserClass\SubItem.cs" />
|
||||
<Compile Include="UserClass\UserControlMenuItem.cs" />
|
||||
<Compile Include="ViewModel\ProductionPlanningModel.cs" />
|
||||
<Compile Include="UserControls\DispenseMacInfo.xaml.cs">
|
||||
<DependentUpon>DispenseMacInfo.xaml</DependentUpon>
|
||||
</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">
|
||||
<DependentUpon>UserInformation.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ViewModel\CurveTempModel.cs" />
|
||||
<Compile Include="ViewModel\CurveDiagramViewModel.cs" />
|
||||
<Compile Include="ViewModel\MainWindowViewModel.cs" />
|
||||
<Compile Include="ViewModel\MonitorViewModel.cs" />
|
||||
<Compile Include="ViewModel\ManualDyelotModel.cs" />
|
||||
<Compile Include="ViewModel\ViewModelLocator.cs" />
|
||||
<Compile Include="View\CurveTemp.xaml.cs">
|
||||
<DependentUpon>CurveTemp.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\CurveDiagram.xaml.cs">
|
||||
<DependentUpon>CurveDiagram.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\LogView.xaml.cs">
|
||||
<DependentUpon>LogView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\DispenseView.xaml.cs">
|
||||
<DependentUpon>DispenseView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\DispenseMachinesSet.xaml.cs">
|
||||
<DependentUpon>DispenseMachinesSet.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\MachinesView.xaml.cs">
|
||||
<DependentUpon>MachinesView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\DyeingPlanView.xaml.cs">
|
||||
<DependentUpon>DyeingPlanView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\ProductionPlanningEdit.xaml.cs">
|
||||
<DependentUpon>ProductionPlanningEdit.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\ProductionPlanningView.xaml.cs">
|
||||
<DependentUpon>ProductionPlanningView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -121,7 +205,7 @@
|
||||
<Compile Include="View\EngineerSetView.xaml.cs">
|
||||
<DependentUpon>EngineerSetView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\info.xaml.cs">
|
||||
<Compile Include="UserControls\info.xaml.cs">
|
||||
<DependentUpon>info.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\MachinesSet.xaml.cs">
|
||||
@@ -136,21 +220,63 @@
|
||||
<Compile Include="View\ProgramstepsView .xaml.cs">
|
||||
<DependentUpon>ProgramstepsView .xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\RoilingTextBlock.xaml.cs">
|
||||
<Compile Include="UserControls\RoilingTextBlock.xaml.cs">
|
||||
<DependentUpon>RoilingTextBlock.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\DyelotView.xaml.cs">
|
||||
<DependentUpon>DyelotView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\Whole.xaml.cs">
|
||||
<DependentUpon>Whole.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\CDKEY.xaml.cs">
|
||||
<DependentUpon>CDKEY.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\Help.xaml.cs">
|
||||
<DependentUpon>Help.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\InputBox.xaml.cs">
|
||||
<DependentUpon>InputBox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\MachineSelection.xaml.cs">
|
||||
<DependentUpon>MachineSelection.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\SchedulingTime.xaml.cs">
|
||||
<DependentUpon>SchedulingTime.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\User.xaml.cs">
|
||||
<DependentUpon>User.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\UserMessage.xaml.cs">
|
||||
<DependentUpon>UserMessage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\ViewStep.xaml.cs">
|
||||
<DependentUpon>ViewStep.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="EX\DispenseState.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</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">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="EX\VNC.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Login.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -169,14 +295,54 @@
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="UserControls\DispenseMacInfo.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</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">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\CurveTemp.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\CurveDiagram.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\LogView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\DispenseView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\DispenseMachinesSet.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\MachinesView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\DyeingPlanView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\ProductionPlanningEdit.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\ProductionPlanningView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -193,7 +359,7 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\info.xaml">
|
||||
<Page Include="UserControls\info.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@@ -213,14 +379,22 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\RoilingTextBlock.xaml">
|
||||
<Page Include="UserControls\RoilingTextBlock.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\DyelotView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\Whole.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WindowsView\CDKEY.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="WindowsView\Help.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>XamlIntelliSenseFileGenerator</Generator>
|
||||
@@ -229,6 +403,22 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="WindowsView\MachineSelection.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WindowsView\SchedulingTime.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WindowsView\User.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="WindowsView\UserMessage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WindowsView\ViewStep.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -256,6 +446,14 @@
|
||||
<EmbeddedResource Include="Properties\Resources.zh-CN.resx" />
|
||||
<EmbeddedResource Include="Properties\Resources.zh-TW.resx" />
|
||||
<Resource Include="Fonts\FontAwesome.otf" />
|
||||
<None Include="bin\Debug\DataBase\800COMPUTER.db" />
|
||||
<None Include="bin\Debug\DataBase\Chart.db" />
|
||||
<None Include="bin\Debug\DataBase\SCCM.db" />
|
||||
<None Include="DATA\800COMPUTER.db" />
|
||||
<None Include="DATA\Chart.db" />
|
||||
<None Include="DATA\nGantt.zip" />
|
||||
<None Include="DATA\SCCM.db" />
|
||||
<None Include="DATA\VncSharpWpf.zip" />
|
||||
<None Include="Fonts\font-awesome-4.7.0.zip" />
|
||||
<None Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.eot" />
|
||||
<Resource Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.ttf" />
|
||||
@@ -312,35 +510,135 @@
|
||||
<Version>2.0.0-rc4.5</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MaterialDesignThemes">
|
||||
<Version>5.1.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Web.WebView2">
|
||||
<Version>1.0.2903.40</Version>
|
||||
<Version>5.2.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NModbus">
|
||||
<Version>3.0.81</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ScottPlot">
|
||||
<Version>5.0.47</Version>
|
||||
<Version>5.0.56</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Data.SQLite">
|
||||
<Version>1.0.119</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Management">
|
||||
<Version>9.0.0</Version>
|
||||
<Version>9.0.8</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.ObjectModel">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="TouchSocket">
|
||||
<Version>3.0.7</Version>
|
||||
<Version>3.1.16</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="TouchSocket.SerialPorts">
|
||||
<Version>3.1.16</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Folder Include="ControlUse\" />
|
||||
<Folder Include="EX\EXModel\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="EX\DLL\VncSharpWpf.dll" />
|
||||
<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\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\1000-1.png" />
|
||||
<Resource Include="lmage\1000-2.png" />
|
||||
<Resource Include="lmage\1000-3.png" />
|
||||
<Resource Include="lmage\10000.png" />
|
||||
<Resource Include="lmage\10001.gif" />
|
||||
<Resource Include="lmage\2000.png" />
|
||||
<Resource Include="lmage\2001.png" />
|
||||
<Resource Include="lmage\ADD.jpg" />
|
||||
<Resource Include="lmage\ADD.png" />
|
||||
<Resource Include="lmage\beng_err.png" />
|
||||
<Resource Include="lmage\beng_run.png" />
|
||||
<Resource Include="lmage\beng_stop.png" />
|
||||
<Resource Include="lmage\ERR.png" />
|
||||
<Resource Include="lmage\fa_bili.png" />
|
||||
<Resource Include="lmage\FlatColorIconsCancel.png" />
|
||||
<Resource Include="lmage\FxemojiBellcancellation.png" />
|
||||
<Resource Include="lmage\FxemojiRingingbell.png" />
|
||||
<Resource Include="lmage\guamaoqi.png" />
|
||||
<Resource Include="lmage\guandao %281%29.png" />
|
||||
<Resource Include="lmage\guandao %2810%29.png" />
|
||||
<Resource Include="lmage\guandao %2811%29.png" />
|
||||
<Resource Include="lmage\guandao %2812%29.png" />
|
||||
<Resource Include="lmage\guandao %2813%29.png" />
|
||||
<Resource Include="lmage\guandao %2814%29.png" />
|
||||
<Resource Include="lmage\guandao %2815%29.png" />
|
||||
<Resource Include="lmage\guandao %2816%29.png" />
|
||||
<Resource Include="lmage\guandao %282%29.png" />
|
||||
<Resource Include="lmage\guandao %283%29.png" />
|
||||
<Resource Include="lmage\guandao %284%29.png" />
|
||||
<Resource Include="lmage\guandao %285%29.png" />
|
||||
<Resource Include="lmage\guandao %286%29.png" />
|
||||
<Resource Include="lmage\guandao %287%29.png" />
|
||||
<Resource Include="lmage\guandao %288%29.png" />
|
||||
<Resource Include="lmage\guandao %289%29.png" />
|
||||
<Resource Include="lmage\Hand.png" />
|
||||
<Resource Include="lmage\IconParkAutoFocus.png" />
|
||||
<Resource Include="lmage\IconParkLock.png" />
|
||||
<Resource Include="lmage\IconParkMessages.png" />
|
||||
<Resource Include="lmage\IconParkPauseOne.png" />
|
||||
<Resource Include="lmage\IconParkPlay.png" />
|
||||
<Resource Include="lmage\IconParkPlayTwo.png" />
|
||||
<Resource Include="lmage\IconParkStopwatch.png" />
|
||||
<Resource Include="lmage\ID001.png" />
|
||||
<Resource Include="lmage\ID007.png" />
|
||||
<Resource Include="lmage\ID008.png" />
|
||||
<Resource Include="lmage\ID013.png" />
|
||||
<Resource Include="lmage\ID015.png" />
|
||||
<Resource Include="lmage\ID017.png" />
|
||||
<Resource Include="lmage\ID020.png" />
|
||||
<Resource Include="lmage\ID022.png" />
|
||||
<Resource Include="lmage\ID031.png" />
|
||||
<Resource Include="lmage\ID035.png" />
|
||||
<Resource Include="lmage\ID036.png" />
|
||||
<Resource Include="lmage\ID039.png" />
|
||||
<Resource Include="lmage\ID040.png" />
|
||||
<Resource Include="lmage\ID041.png" />
|
||||
<Resource Include="lmage\ID049.png" />
|
||||
<Resource Include="lmage\ID050.png" />
|
||||
<Resource Include="lmage\ID051.png" />
|
||||
<Resource Include="lmage\ID054.png" />
|
||||
<Resource Include="lmage\ID055.png" />
|
||||
<Resource Include="lmage\ID056.png" />
|
||||
<Resource Include="lmage\ID064.png" />
|
||||
<Resource Include="lmage\ID065.png" />
|
||||
<Resource Include="lmage\ID066.png" />
|
||||
<Resource Include="lmage\ID067.png" />
|
||||
<Resource Include="lmage\ID090.png" />
|
||||
<Resource Include="lmage\ID091.png" />
|
||||
<Resource Include="lmage\ID093.png" />
|
||||
<Resource Include="lmage\ID094.png" />
|
||||
<Resource Include="lmage\inf.png" />
|
||||
<Resource Include="lmage\link.png" />
|
||||
<Resource Include="lmage\LOCK.png" />
|
||||
<Resource Include="lmage\Manual.png" />
|
||||
<Resource Include="lmage\start.png" />
|
||||
<Resource Include="lmage\start2.png" />
|
||||
<Resource Include="lmage\start3.png" />
|
||||
<Resource Include="lmage\StreamlinePlayList4Solid.png" />
|
||||
<Resource Include="lmage\StreamlinePlayList8.png" />
|
||||
<Resource Include="lmage\StreamlineUltimateColorColorPaletteSample1.png" />
|
||||
<Resource Include="lmage\tong.png" />
|
||||
<Resource Include="LOGO\sunlight_logo.jpg" />
|
||||
<Resource Include="LOGO\303pdw.png" />
|
||||
<Resource Include="LOGO\303.png" />
|
||||
<Resource Include="LOGO\302.png" />
|
||||
<Resource Include="LOGO\252RMRD.png" />
|
||||
<Resource Include="LOGO\252RB.png" />
|
||||
<Resource Include="LOGO\252-2t.png" />
|
||||
<Resource Include="LOGO\242w.png" />
|
||||
<Resource Include="sunlight_logotext.jpg" />
|
||||
<Resource Include="WindowsView\sunlight_logotext.jpg" />
|
||||
<Resource Include="sunlightlogo.jpg" />
|
||||
<Resource Include="sunlightlogo.ico" />
|
||||
@@ -376,6 +674,19 @@
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\nGantt\nGantt.csproj">
|
||||
<Project>{ccc54f28-5d20-4ab3-a1a8-c62cd2da3ae7}</Project>
|
||||
<Name>nGantt</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VncSharpWpf\VncSharpWpf.csproj">
|
||||
<Project>{77b5cb63-e14b-4253-881d-6be9d7c57076}</Project>
|
||||
<Name>VncSharpWpf</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="AfterResolveReferences">
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,522 @@
|
||||
using Newtonsoft.Json;
|
||||
using ScottPlot.Plottables;
|
||||
using SunlightCentralizedControlManagement_SCCM_.View;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.SerialPorts;
|
||||
using TouchSocket.Sockets;
|
||||
using static SkiaSharp.HarfBuzz.SKShaper;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
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 PortCOM2 { get; set; }
|
||||
public static string PortCOM3 { get; set; }
|
||||
public static string PortCOM4 { get; set; }
|
||||
|
||||
public static async Task PortClient(SerialPortClient portclient, string com, int BAUD)
|
||||
{
|
||||
//var client = new SerialPortClient();
|
||||
portclient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到端口
|
||||
portclient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
|
||||
portclient.Closing = (client, e) => { return EasyTask.CompletedTask; };//即将从端口断开连接。此处仅主动断开才有效。
|
||||
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
|
||||
portclient.Received = (client, e) =>
|
||||
{
|
||||
//接受重置事件状态
|
||||
_responseEvent.Set();
|
||||
string[] sArray = Regex.Split(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; ;
|
||||
};
|
||||
await portclient.SetupAsync(new TouchSocketConfig()
|
||||
.SetMaxBufferSize(1024 * 1024 * 10)
|
||||
.SetSerialPortOption(new SerialPortOption()
|
||||
{
|
||||
BaudRate = BAUD,//波特率
|
||||
DataBits = 8,//数据位
|
||||
Parity = System.IO.Ports.Parity.None,//校验位
|
||||
PortName = com,//COM
|
||||
StopBits = System.IO.Ports.StopBits.One,//停止位
|
||||
})
|
||||
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) })
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
//a.Add<MyPlugin>();
|
||||
}
|
||||
));
|
||||
try
|
||||
{
|
||||
await portclient.ConnectAsync();
|
||||
}
|
||||
catch (Exception ex) { LogGing.ERRDATA(ex); }
|
||||
}
|
||||
public static async Task PortClient2(SerialPortClient portclient, string com, int BAUD)
|
||||
{
|
||||
//var client = new SerialPortClient();
|
||||
portclient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到端口
|
||||
portclient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
|
||||
portclient.Closing = (client, e) => { return EasyTask.CompletedTask; };//即将从端口断开连接。此处仅主动断开才有效。
|
||||
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
|
||||
portclient.Received = (client, e) =>
|
||||
{
|
||||
_responseEvent2.Set();
|
||||
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
||||
@"\n", RegexOptions.IgnoreCase);
|
||||
|
||||
|
||||
|
||||
return EasyTask.CompletedTask; ;
|
||||
};
|
||||
await portclient.SetupAsync(new TouchSocketConfig()
|
||||
.SetSerialPortOption(new SerialPortOption()
|
||||
{
|
||||
BaudRate = BAUD,//波特率
|
||||
DataBits = 8,//数据位
|
||||
Parity = System.IO.Ports.Parity.None,//校验位
|
||||
PortName = com,//COM
|
||||
StopBits = System.IO.Ports.StopBits.One,//停止位
|
||||
})
|
||||
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) })
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
//a.Add<MyPlugin>();
|
||||
}));
|
||||
try
|
||||
{
|
||||
await portclient.ConnectAsync();
|
||||
}
|
||||
catch (Exception ex) { LogGing.ERRDATA(ex); }
|
||||
}
|
||||
public static async Task PortClient3(SerialPortClient portclient, string com, int BAUD)
|
||||
{
|
||||
//var client = new SerialPortClient();
|
||||
portclient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到端口
|
||||
portclient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
|
||||
portclient.Closing = (client, e) => { return EasyTask.CompletedTask; };//即将从端口断开连接。此处仅主动断开才有效。
|
||||
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
|
||||
portclient.Received = (client, e) =>
|
||||
{
|
||||
_responseEvent3.Set();
|
||||
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
||||
@"\n", RegexOptions.IgnoreCase);
|
||||
|
||||
|
||||
|
||||
return EasyTask.CompletedTask; ;
|
||||
};
|
||||
await portclient.SetupAsync(new TouchSocketConfig()
|
||||
.SetSerialPortOption(new SerialPortOption()
|
||||
{
|
||||
BaudRate = BAUD,//波特率
|
||||
DataBits = 8,//数据位
|
||||
Parity = System.IO.Ports.Parity.None,//校验位
|
||||
PortName = com,//COM
|
||||
StopBits = System.IO.Ports.StopBits.One,//停止位
|
||||
})
|
||||
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) })
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
//a.Add<MyPlugin>();
|
||||
}));
|
||||
try
|
||||
{
|
||||
await portclient.ConnectAsync();
|
||||
}
|
||||
catch (Exception ex) { LogGing.ERRDATA(ex); }
|
||||
}
|
||||
public static async Task PortClient4(SerialPortClient portclient, string com, int BAUD)
|
||||
{
|
||||
//var client = new SerialPortClient();
|
||||
portclient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到端口
|
||||
portclient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
|
||||
portclient.Closing = (client, e) => { return EasyTask.CompletedTask; };//即将从端口断开连接。此处仅主动断开才有效。
|
||||
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
|
||||
portclient.Received = (client, e) =>
|
||||
{
|
||||
_responseEvent4.Set();
|
||||
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
||||
@"\n", RegexOptions.IgnoreCase);
|
||||
|
||||
return EasyTask.CompletedTask; ;
|
||||
};
|
||||
await portclient.SetupAsync(new TouchSocketConfig()
|
||||
.SetSerialPortOption(new SerialPortOption()
|
||||
{
|
||||
BaudRate = BAUD,//波特率
|
||||
DataBits = 8,//数据位
|
||||
Parity = System.IO.Ports.Parity.None,//校验位
|
||||
PortName = com,//COM
|
||||
StopBits = System.IO.Ports.StopBits.One,//停止位
|
||||
})
|
||||
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(500) })
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
//a.Add<MyPlugin>();
|
||||
}));
|
||||
try
|
||||
{
|
||||
await portclient.ConnectAsync();
|
||||
}
|
||||
catch (Exception ex) { LogGing.ERRDATA(ex); }
|
||||
}
|
||||
|
||||
public static readonly ManualResetEventSlim _responseEvent = new ManualResetEventSlim(false);
|
||||
public static readonly ManualResetEventSlim _responseEvent2 = new ManualResetEventSlim(false);
|
||||
public static readonly ManualResetEventSlim _responseEvent3 = new ManualResetEventSlim(false);
|
||||
public static readonly ManualResetEventSlim _responseEvent4 = new ManualResetEventSlim(false);
|
||||
/// <summary>
|
||||
/// 发送指令并等待响应,超时时间为500ms
|
||||
/// </summary>
|
||||
/// <param name="command">要发送的指令字节数组</param>
|
||||
/// <returns>从机的响应数据,超时则为null</returns>
|
||||
public static void SendCommandAndWait(SerialPortClient serialPortClients, string command)
|
||||
{
|
||||
try
|
||||
{
|
||||
var t = CRCcheck16.ToCRC16(command);
|
||||
_responseEvent.Reset();
|
||||
serialPortClients.Send(command); // 发送指令
|
||||
|
||||
// 等待500毫秒或直到收到响应
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
_responseEvent2.Reset();
|
||||
serialPortClients.Send(command); // 发送指令
|
||||
// 等待500毫秒或直到收到响应
|
||||
_responseEvent2.Wait(TimeSpan.FromMilliseconds(1000));
|
||||
// 重置事件状态
|
||||
_responseEvent2.Set();
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
public static void SendCommandAndWait3(SerialPortClient serialPortClients, string command)
|
||||
{
|
||||
try
|
||||
{
|
||||
_responseEvent3.Reset();
|
||||
serialPortClients.Send(command); // 发送指令
|
||||
// 等待500毫秒或直到收到响应
|
||||
_responseEvent3.Wait(TimeSpan.FromMilliseconds(1000));
|
||||
// 重置事件状态
|
||||
_responseEvent3.Set();
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
public static void SendCommandAndWait4(SerialPortClient serialPortClients, string command)
|
||||
{
|
||||
try
|
||||
{
|
||||
_responseEvent4.Reset();
|
||||
serialPortClients.Send(command); // 发送指令
|
||||
// 等待500毫秒或直到收到响应
|
||||
_responseEvent4.Wait(TimeSpan.FromMilliseconds(1000));
|
||||
// 重置事件状态
|
||||
_responseEvent4.Set();
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,39 @@
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using DyeingComputer.UserClass;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using ScottPlot;
|
||||
using ScottPlot.Colormaps;
|
||||
using SkiaSharp;
|
||||
using SunlightCentralizedControlManagement_SCCM_.View;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using ScottPlot.Colormaps;
|
||||
using static System.Windows.Forms.AxHost;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
using Newtonsoft.Json;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
using SunlightCentralizedControlManagement_SCCM_.View;
|
||||
using TcpClient = TouchSocket.Sockets.TcpClient;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Xml.Linq;
|
||||
using ScottPlot;
|
||||
using System.Collections;
|
||||
using DyeingComputer.UserClass;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.SerialPorts;
|
||||
using TouchSocket.Sockets;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.View.MachinesView;
|
||||
using static System.Windows.Forms.AxHost;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||
using TcpClient = TouchSocket.Sockets.TcpClient;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{/// <summary>
|
||||
@@ -35,61 +41,89 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
/// </summary>
|
||||
public class AsyncTcpClient
|
||||
{
|
||||
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
private static readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
|
||||
public static async Task TcpClient(TcpClient tcpClient, string ip, string port)
|
||||
{
|
||||
//TcpClient tcpClient = new TcpClient();
|
||||
tcpClient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到服务器,此时已经创建socket,但是还未建立tcp
|
||||
tcpClient.Connected = (client, e) =>
|
||||
{
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||
try
|
||||
{
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["State"] = "801";
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
|
||||
}
|
||||
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_OK");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
|
||||
return EasyTask.CompletedTask;
|
||||
};//成功连接到服务器
|
||||
tcpClient.Closing = (client, e) =>
|
||||
{
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||
try
|
||||
{
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["State"] = "899";
|
||||
drEmployee["State"] = "800";
|
||||
drEmployee["WorkOrder"] = "------";
|
||||
drEmployee["Dyelot"] = "";
|
||||
drEmployee["Temperature"] = "---.-";
|
||||
drEmployee["WaterLevel"] = "----";
|
||||
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();
|
||||
drEmployee.ClearErrors();
|
||||
}
|
||||
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
return EasyTask.CompletedTask;
|
||||
};//即将从服务器断开连接。此处仅主动断开才有效。
|
||||
tcpClient.Closed = (client, e) =>
|
||||
{
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||
try
|
||||
{
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["State"] = "899";
|
||||
drEmployee["State"] = "800";
|
||||
drEmployee["WorkOrder"] = "------";
|
||||
drEmployee["Dyelot"] = "";
|
||||
drEmployee["Temperature"] = "---.-";
|
||||
drEmployee["WaterLevel"] = "----";
|
||||
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();
|
||||
drEmployee.ClearErrors();
|
||||
}
|
||||
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
return EasyTask.CompletedTask;
|
||||
};//从服务器断开连接,当连接不成功时不会触发。
|
||||
tcpClient.Received = (client, e) =>
|
||||
@@ -98,43 +132,185 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
string SYSAPI = e.ByteBlock.Span.ToString(Encoding.ASCII).Substring(0, 5);
|
||||
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8);
|
||||
if (SYSAPI == "SC800")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
|
||||
drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
|
||||
// drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
|
||||
drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString();
|
||||
drEmployee["State"] = "802";
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
}
|
||||
else if (SYSAPI == "SC810")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
|
||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||
"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)
|
||||
{
|
||||
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
}
|
||||
else if (SYSAPI == "SC811")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
|
||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||
"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++; }
|
||||
}
|
||||
else if (SYSAPI == "SC812")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
|
||||
"WorkOrder ='" + DAT + "'", null);
|
||||
}
|
||||
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")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
|
||||
foreach (DataRow sourceRow in dataTable.Rows)
|
||||
{
|
||||
lock (MainWindowViewModel.Dyelot_CALL.Rows.SyncRoot)
|
||||
{
|
||||
// 创建新行(基于目标表结构)
|
||||
DataRow newRow = MainWindowViewModel.Dyelot_CALL.NewRow();
|
||||
// 复制源表中存在的列数据
|
||||
foreach (DataColumn column in dataTable.Columns)
|
||||
{
|
||||
if (MainWindowViewModel.Dyelot_CALL.Columns.Contains(column.ColumnName))
|
||||
{
|
||||
newRow[column.ColumnName] = sourceRow[column.ColumnName];
|
||||
}
|
||||
}
|
||||
MainWindowViewModel.Dyelot_CALL.Rows.Add(newRow);
|
||||
|
||||
Dictionary<string, object> Product_ = new Dictionary<string, object>();//缓存函数
|
||||
Product_.Add("State", 202);
|
||||
Product_.Add("Dyelot", newRow.Field<string>("Dyelot"));
|
||||
Product_.Add("Step", newRow.Field<int>("Step"));
|
||||
Product_.Add("ProductCode", newRow.Field<string>("ProductCode"));
|
||||
Product_.Add("Amount", newRow.Field<object>("Amount"));
|
||||
Product_.Add("DispenseEndTime", newRow.Field<object>("DispenseEndTime"));
|
||||
|
||||
newRow.BeginEdit();
|
||||
newRow["State"] = 202;
|
||||
newRow.EndEdit();
|
||||
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("DyelotHistory", MainWindowViewModel.SQLiteHelpers.ToDictionary(newRow));// 执行插入
|
||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||
{
|
||||
ID = Convert.ToInt16(MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines,
|
||||
"ID", "Name='" + newRow.Field<string>("Machine") + "'")),
|
||||
DAT = "SC828" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines,
|
||||
"SYSKEY", "Name='" + newRow.Field<string>("Machine") + "'") + Product_.ToJsonString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//获取呼叫领料单
|
||||
else if (SYSAPI == "SC830")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
||||
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First();
|
||||
string mac;
|
||||
// 首先确保 DataTable 使用线程安全的访问方式
|
||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||
{
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").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("WorkNumder");
|
||||
drEmployee["Temperature"] = _new.GetValue("MTT");
|
||||
drEmployee["WaterLevel"] = _new.GetValue("MTL");
|
||||
drEmployee["Process"] = _new.GetValue("Process");
|
||||
drEmployee["Step"] = _new.GetValue("Step");
|
||||
drEmployee["UserButton"] = _new.GetValue("UserButton");
|
||||
if (_new.GetValue("UserInfoStart").ToString() != "900")
|
||||
{ drEmployee["UserInfoStart"] = _new.GetValue("UserInfoStart"); }
|
||||
drEmployee["UserInfo"] = _new.GetValue("UserInfo");
|
||||
drEmployee["WORK_RUN"] = _new.GetValue("WORK_RUN");
|
||||
drEmployee["RUN_STEPID"] = _new.GetValue("RUN_STEPID");
|
||||
drEmployee["CALL"] = _new.GetValue("CALL");
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
|
||||
}
|
||||
if (_new.GetValue("Status").ToString() != "----------")
|
||||
{
|
||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
|
||||
Chart_new.Add("Machine", _new.GetValue("Machine"));
|
||||
Chart_new.Add("Time", _new.GetValue("Time"));
|
||||
Chart_new.Add("Machine", mac);
|
||||
Chart_new.Add("Time", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||
Chart_new.Add("MST", _new.GetValue("MST"));
|
||||
Chart_new.Add("MTT", _new.GetValue("MTT"));
|
||||
Chart_new.Add("MTL", _new.GetValue("MTL"));
|
||||
@@ -147,94 +323,150 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
Chart_new.Add("STTC", _new.GetValue("STTC"));
|
||||
Chart_new.Add("STLC", _new.GetValue("STLC"));
|
||||
|
||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.InsertData("Chart", Chart_new);// 执行插入
|
||||
SQLiteHelpers.Close();
|
||||
MainWindowViewModel.SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//当前信息
|
||||
else if (SYSAPI == "SC831")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//步骤信息
|
||||
else if (SYSAPI == "SC832")
|
||||
{
|
||||
try
|
||||
{
|
||||
MainWindowViewModel.MachineLOG = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//当前细节信息
|
||||
else if (SYSAPI == "SC833")
|
||||
{
|
||||
MainWindowViewModel.MachineLOG = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MonitorView.Product_DAT = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
|
||||
MonitorView.Product_bool = true;
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//当前领料单信息
|
||||
else if (SYSAPI == "SC851")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_d = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//数字开关表
|
||||
else if (SYSAPI == "SC852")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_a = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//寄存器表
|
||||
else if (SYSAPI == "SC853")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_m = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//缓存表
|
||||
else if (SYSAPI == "SC854")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_ParameterSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//程序设置表
|
||||
else if (SYSAPI == "SC855")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.dt_SysSet = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||
}
|
||||
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")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 109 } },
|
||||
"WorkOrder ='" + DAT + "'", null);
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}//发布失败
|
||||
else if (SYSAPI == "SC911")
|
||||
{
|
||||
try
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 119 } },
|
||||
"WorkOrder ='" + DAT + "'", null);
|
||||
}
|
||||
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")
|
||||
{
|
||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||
MessageBox.Show(DAT, "SCCM", MessageBoxButton.OK, MessageBoxImage.Question);
|
||||
}
|
||||
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
|
||||
//载入配置
|
||||
await tcpClient.SetupAsync(new TouchSocketConfig()
|
||||
.SetMaxBufferSize(1024*1024)
|
||||
.SetMinBufferSize(1024*64)
|
||||
.SetMaxBufferSize(1024* 1024*100)
|
||||
.SetMinBufferSize(1024*1024)
|
||||
.SetRemoteIPHost(ip + ":" + port)
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
a.UseCheckClear()
|
||||
.SetCheckClearType(CheckClearType.All)
|
||||
.SetTick(TimeSpan.FromSeconds(30))
|
||||
.SetOnClose((c, t) =>
|
||||
{
|
||||
c.TryShutdown();
|
||||
});
|
||||
a.UseTcpReconnection();//触发型重连
|
||||
//使用Polling轮询连接插件
|
||||
a.UseTcpReconnection()
|
||||
.UsePolling(TimeSpan.FromSeconds(5));
|
||||
})
|
||||
.ConfigureContainer(a =>
|
||||
{
|
||||
// a.AddConsoleLogger();//添加一个日志注入
|
||||
}));
|
||||
|
||||
// Result result = await
|
||||
_ = tcpClient.TryConnectAsync();
|
||||
// return result.IsSuccess;
|
||||
/* try
|
||||
{
|
||||
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}*/
|
||||
));
|
||||
|
||||
await tcpClient.TryConnectAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace DyeingComputer.UserClass
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
/// <summary>
|
||||
/// CRC校验
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using System.Data;
|
||||
using System.IO;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||
|
||||
namespace DyeingComputer.UserClass
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
public class LogGing
|
||||
{
|
||||
@@ -23,7 +23,6 @@ namespace DyeingComputer.UserClass
|
||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
wr.WriteLine(Log_time + dat);
|
||||
wr.Close();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -43,5 +42,79 @@ namespace DyeingComputer.UserClass
|
||||
directoryInfo.Create();//创建日志路径
|
||||
}
|
||||
}
|
||||
public static void ERRDATA(System.Exception dat)
|
||||
{
|
||||
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录
|
||||
// string logPathtxt = "" + System.Environment.CurrentDirectory + "\\Log\\"+ Log_time + "Log.txt";//日志文件
|
||||
// System.IO.DirectoryInfo log = new System.IO.DirectoryInfo();//生成日志文件目录
|
||||
string log_path = logpath + "\\ERR" + Log_time + ".txt";
|
||||
string Log_timehms = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
if (Directory.Exists(logpath))//检查日志路径
|
||||
{
|
||||
if (!File.Exists(log_path))//检查文件并写入
|
||||
{
|
||||
// FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建文件
|
||||
// StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
// wr.Close();
|
||||
FileStream fil = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wfil = new StreamWriter(fil);//创建文件
|
||||
wfil.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||
wfil.WriteLine("[" + Log_timehms + "];[Error source] ||" + dat.Source.ToString() + Environment.NewLine.ToString());
|
||||
wfil.WriteLine("[" + Log_timehms + "];[Error message] ||" + dat.Message.ToString() + Environment.NewLine.ToString());
|
||||
wfil.WriteLine("[" + Log_timehms + "];[Error area] ||" + dat.StackTrace.ToString());
|
||||
wfil.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + dat.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + dat.Message.ToString() + Environment.NewLine.ToString());
|
||||
wr.WriteLine("[" + Log_timehms + "];[Error area] ||" + dat.ToString());
|
||||
wr.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DirectoryInfo directoryInfo = new DirectoryInfo(logpath);
|
||||
directoryInfo.Create();
|
||||
}
|
||||
}
|
||||
public static void ExchangeDATA(string dat)
|
||||
{
|
||||
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
string logpath = System.Environment.CurrentDirectory + "\\Exchange";//日志文件目录
|
||||
// string logPathtxt = "" + System.Environment.CurrentDirectory + "\\Log\\"+ Log_time + "Log.txt";//日志文件
|
||||
// System.IO.DirectoryInfo log = new System.IO.DirectoryInfo();//生成日志文件目录
|
||||
string log_path = logpath + "\\Exchange" + Log_time + ".txt";
|
||||
string Log_timehms = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
if (Directory.Exists(logpath))//检查日志路径
|
||||
{
|
||||
if (!File.Exists(log_path))//检查文件并写入
|
||||
{
|
||||
// FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建文件
|
||||
// StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
// wr.Close();
|
||||
FileStream fil = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wfil = new StreamWriter(fil);//创建文件
|
||||
wfil.WriteLine("[" + Log_timehms + "];[Exchange] ||" + dat);
|
||||
wfil.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
wr.WriteLine("[" + Log_timehms + "];[Exchange] ||" + dat);
|
||||
wr.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DirectoryInfo directoryInfo = new DirectoryInfo(logpath);
|
||||
directoryInfo.Create();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace DyeingComputer.UserClass
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
/// <summary>
|
||||
/// MD5加密
|
||||
|
||||
@@ -0,0 +1,617 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.SerialPorts;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
#region 基础数据结构
|
||||
/// <summary>
|
||||
/// 485 设备地址
|
||||
/// </summary>
|
||||
public struct DeviceAddress
|
||||
{
|
||||
public byte Value { get; }
|
||||
|
||||
public DeviceAddress(byte address)
|
||||
{
|
||||
if (address == 0) throw new ArgumentException("设备地址不能为0(广播地址)");
|
||||
Value = address;
|
||||
}
|
||||
|
||||
public static implicit operator byte(DeviceAddress address) => address.Value;
|
||||
public static implicit operator DeviceAddress(byte address) => new DeviceAddress(address);
|
||||
|
||||
public override string ToString() => $"0x{Value:X2}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 485 命令帧
|
||||
/// </summary>
|
||||
public class CommandFrame
|
||||
{
|
||||
public DeviceAddress DeviceAddress { get; set; }
|
||||
public byte FunctionCode { get; set; }
|
||||
public byte[] Data { get; set; }
|
||||
public ushort CRC { get; set; }
|
||||
|
||||
public byte[] ToBytes()
|
||||
{
|
||||
// 实现帧序列化逻辑,包括CRC计算
|
||||
var dataLength = Data?.Length ?? 0;
|
||||
var frame = new byte[3 + dataLength + 2]; // 地址+功能码+数据+CRC
|
||||
|
||||
frame[0] = DeviceAddress;
|
||||
frame[1] = FunctionCode;
|
||||
|
||||
if (dataLength > 0)
|
||||
Array.Copy(Data, 0, frame, 2, dataLength);
|
||||
|
||||
// 计算CRC (这里使用Modbus CRC算法示例)
|
||||
CRC = CalculateCRC(frame, 0, frame.Length - 2);
|
||||
frame[frame.Length - 2] = (byte)(CRC & 0xFF);
|
||||
frame[frame.Length - 1] = (byte)(CRC >> 8);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
private ushort CalculateCRC(byte[] data, int offset, int length)
|
||||
{
|
||||
// 简化的CRC计算示例,实际应根据协议实现
|
||||
ushort crc = 0xFFFF;
|
||||
for (int i = offset; i < offset + length; i++)
|
||||
{
|
||||
crc ^= data[i];
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
if ((crc & 0x0001) != 0)
|
||||
{
|
||||
crc >>= 1;
|
||||
crc ^= 0xA001;
|
||||
}
|
||||
else
|
||||
{
|
||||
crc >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 响应帧
|
||||
/// </summary>
|
||||
public class ResponseFrame
|
||||
{
|
||||
public DeviceAddress DeviceAddress { get; set; }
|
||||
public byte FunctionCode { get; set; }
|
||||
public byte[] Data { get; set; }
|
||||
public ushort CRC { get; set; }
|
||||
public bool IsValid { get; set; }
|
||||
public string Error { get; set; }
|
||||
|
||||
public static ResponseFrame FromBytes(byte[] data)
|
||||
{
|
||||
// 实现帧解析逻辑,包括CRC验证
|
||||
var frame = new ResponseFrame();
|
||||
|
||||
if (data.Length < 4) // 最小帧长度
|
||||
{
|
||||
frame.IsValid = false;
|
||||
frame.Error = "帧长度不足";
|
||||
return frame;
|
||||
}
|
||||
|
||||
frame.DeviceAddress = data[0];
|
||||
frame.FunctionCode = data[1];
|
||||
|
||||
// 检查CRC
|
||||
ushort receivedCRC = (ushort)(data[data.Length - 1] << 8 | data[data.Length - 2]);
|
||||
ushort calculatedCRC = CalculateCRC(data, 0, data.Length - 2);
|
||||
|
||||
if (receivedCRC != calculatedCRC)
|
||||
{
|
||||
frame.IsValid = false;
|
||||
frame.Error = "CRC校验失败";
|
||||
return frame;
|
||||
}
|
||||
|
||||
// 提取数据部分
|
||||
if (data.Length > 4)
|
||||
{
|
||||
frame.Data = new byte[data.Length - 4];
|
||||
Array.Copy(data, 2, frame.Data, 0, frame.Data.Length);
|
||||
}
|
||||
|
||||
frame.IsValid = true;
|
||||
return frame;
|
||||
}
|
||||
|
||||
private static ushort CalculateCRC(byte[] data, int offset, int length)
|
||||
{
|
||||
// 与CommandFrame相同的CRC算法
|
||||
ushort crc = 0xFFFF;
|
||||
for (int i = offset; i < offset + length; i++)
|
||||
{
|
||||
crc ^= data[i];
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
if ((crc & 0x0001) != 0)
|
||||
{
|
||||
crc >>= 1;
|
||||
crc ^= 0xA001;
|
||||
}
|
||||
else
|
||||
{
|
||||
crc >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通信任务
|
||||
/// </summary>
|
||||
public class CommunicationTask
|
||||
{
|
||||
public DeviceAddress DeviceAddress { get; set; }
|
||||
public CommandFrame Command { get; set; }
|
||||
public TaskCompletionSource<ResponseFrame> CompletionSource { get; set; }
|
||||
public int TimeoutMs { get; set; } = 1000;
|
||||
public int RetryCount { get; set; } = 3;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 异常类
|
||||
public class RS485CommunicationException : Exception
|
||||
{
|
||||
public DeviceAddress DeviceAddress { get; }
|
||||
public byte FunctionCode { get; }
|
||||
|
||||
public RS485CommunicationException(DeviceAddress address, byte functionCode, string message)
|
||||
: base($"设备 {address} 功能码 0x{functionCode:X2} 通信失败: {message}")
|
||||
{
|
||||
DeviceAddress = address;
|
||||
FunctionCode = functionCode;
|
||||
}
|
||||
}
|
||||
|
||||
public class RS485TimeoutException : RS485CommunicationException
|
||||
{
|
||||
public RS485TimeoutException(DeviceAddress address, byte functionCode)
|
||||
: base(address, functionCode, "响应超时")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class RS485CRCException : RS485CommunicationException
|
||||
{
|
||||
public RS485CRCException(DeviceAddress address, byte functionCode)
|
||||
: base(address, functionCode, "CRC校验失败")
|
||||
{
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 主站实现
|
||||
/// <summary>
|
||||
/// 485 主站实现
|
||||
/// </summary>
|
||||
public class RS485MasterStation : IDisposable
|
||||
{
|
||||
private readonly SerialPortClient _serialPortClient;
|
||||
private readonly ConcurrentDictionary<DeviceAddress, DeviceState> _deviceStates;
|
||||
private readonly ConcurrentQueue<CommunicationTask> _taskQueue;
|
||||
private readonly CancellationTokenSource _cancellationTokenSource;
|
||||
private Task _processingTask;
|
||||
private bool _isDisposed = false;
|
||||
|
||||
// 响应超时时间(毫秒)
|
||||
public int ResponseTimeout { get; set; } = 1000;
|
||||
|
||||
// 帧间延迟(毫秒)
|
||||
public int InterFrameDelay { get; set; } = 10;
|
||||
|
||||
// 最大重试次数
|
||||
public int MaxRetries { get; set; } = 3;
|
||||
|
||||
/// <summary>
|
||||
/// 设备状态
|
||||
/// </summary>
|
||||
private class DeviceState
|
||||
{
|
||||
public DeviceAddress Address { get; set; }
|
||||
public DateTime LastCommunication { get; set; }
|
||||
public bool IsOnline { get; set; }
|
||||
public int TimeoutCount { get; set; }
|
||||
}
|
||||
|
||||
public RS485MasterStation(string portName, int baudRate = 9600)
|
||||
{
|
||||
_serialPortClient = new SerialPortClient();
|
||||
_deviceStates = new ConcurrentDictionary<DeviceAddress, DeviceState>();
|
||||
_taskQueue = new ConcurrentQueue<CommunicationTask>();
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
// 配置串口
|
||||
_serialPortClient.Setup(new TouchSocketConfig()
|
||||
.SetSerialPortOption(new SerialPortOption()
|
||||
{
|
||||
PortName = portName,
|
||||
BaudRate = baudRate,
|
||||
DataBits = 8,
|
||||
Parity = Parity.None,
|
||||
StopBits = StopBits.One
|
||||
}));
|
||||
|
||||
// 注册数据接收事件
|
||||
_serialPortClient.Received = OnDataReceived;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启动主站
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
_serialPortClient.Connect();
|
||||
_processingTask = Task.Run(ProcessQueue, _cancellationTokenSource.Token);
|
||||
Console.WriteLine("485主站已启动");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 停止主站
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
_cancellationTokenSource.Cancel();
|
||||
_serialPortClient.Close();
|
||||
Console.WriteLine("485主站已停止");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加设备到监控列表
|
||||
/// </summary>
|
||||
public void AddDevice(DeviceAddress address)
|
||||
{
|
||||
_deviceStates[address] = new DeviceState
|
||||
{
|
||||
Address = address,
|
||||
LastCommunication = DateTime.MinValue,
|
||||
IsOnline = false,
|
||||
TimeoutCount = 0
|
||||
};
|
||||
Console.WriteLine($"已添加设备: {address}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从监控列表移除设备
|
||||
/// </summary>
|
||||
public void RemoveDevice(DeviceAddress address)
|
||||
{
|
||||
_deviceStates.TryRemove(address, out _);
|
||||
Console.WriteLine($"已移除设备: {address}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送命令到设备
|
||||
/// </summary>
|
||||
public Task<ResponseFrame> SendCommandAsync(DeviceAddress address, byte functionCode, byte[] data = null, int timeoutMs = 1000, int retryCount = 3)
|
||||
{
|
||||
var command = new CommandFrame
|
||||
{
|
||||
DeviceAddress = address,
|
||||
FunctionCode = functionCode,
|
||||
Data = data ?? new byte[0]
|
||||
};
|
||||
|
||||
var task = new CommunicationTask
|
||||
{
|
||||
DeviceAddress = address,
|
||||
Command = command,
|
||||
CompletionSource = new TaskCompletionSource<ResponseFrame>(),
|
||||
TimeoutMs = timeoutMs,
|
||||
RetryCount = retryCount
|
||||
};
|
||||
|
||||
_taskQueue.Enqueue(task);
|
||||
return task.CompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取保持寄存器
|
||||
/// </summary>
|
||||
public async Task<byte[]> ReadHoldingRegistersAsync(DeviceAddress address, ushort startAddress, ushort numberOfRegisters)
|
||||
{
|
||||
var data = new byte[4];
|
||||
data[0] = (byte)(startAddress >> 8); // 起始地址高字节
|
||||
data[1] = (byte)(startAddress & 0xFF); // 起始地址低字节
|
||||
data[2] = (byte)(numberOfRegisters >> 8); // 寄存器数量高字节
|
||||
data[3] = (byte)(numberOfRegisters & 0xFF); // 寄存器数量低字节
|
||||
|
||||
var response = await SendCommandAsync(address, 0x03, data);
|
||||
|
||||
if (!response.IsValid)
|
||||
throw new RS485CommunicationException(address, 0x03, response.Error);
|
||||
|
||||
return response.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入单个寄存器
|
||||
/// </summary>
|
||||
public async Task WriteSingleRegisterAsync(DeviceAddress address, ushort registerAddress, ushort value)
|
||||
{
|
||||
var data = new byte[4];
|
||||
data[0] = (byte)(registerAddress >> 8); // 寄存器地址高字节
|
||||
data[1] = (byte)(registerAddress & 0xFF); // 寄存器地址低字节
|
||||
data[2] = (byte)(value >> 8); // 值高字节
|
||||
data[3] = (byte)(value & 0xFF); // 值低字节
|
||||
|
||||
var response = await SendCommandAsync(address, 0x06, data);
|
||||
|
||||
if (!response.IsValid)
|
||||
throw new RS485CommunicationException(address, 0x06, response.Error);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理任务队列
|
||||
/// </summary>
|
||||
private async Task ProcessQueue()
|
||||
{
|
||||
while (!_cancellationTokenSource.Token.IsCancellationRequested)
|
||||
{
|
||||
if (_taskQueue.TryDequeue(out var task))
|
||||
{
|
||||
await ProcessTask(task);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 队列为空,执行设备轮询
|
||||
await PollDevices();
|
||||
await Task.Delay(100, _cancellationTokenSource.Token); // 短暂休眠
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理单个通信任务
|
||||
/// </summary>
|
||||
private async Task ProcessTask(CommunicationTask task)
|
||||
{
|
||||
int retryCount = 0;
|
||||
ResponseFrame response = null;
|
||||
|
||||
while (retryCount < task.RetryCount && !_cancellationTokenSource.Token.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 发送命令
|
||||
var commandData = task.Command.ToBytes();
|
||||
_serialPortClient.Send(commandData);
|
||||
|
||||
// 等待响应
|
||||
var timeoutTask = Task.Delay(task.TimeoutMs, _cancellationTokenSource.Token);
|
||||
var responseTask = task.CompletionSource.Task;
|
||||
|
||||
var completedTask = await Task.WhenAny(responseTask, timeoutTask);
|
||||
|
||||
if (completedTask == responseTask)
|
||||
{
|
||||
response = await responseTask;
|
||||
if (response.IsValid)
|
||||
{
|
||||
UpdateDeviceState(task.DeviceAddress, true);
|
||||
task.CompletionSource.SetResult(response);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RS485CRCException(task.DeviceAddress, task.Command.FunctionCode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RS485TimeoutException(task.DeviceAddress, task.Command.FunctionCode);
|
||||
}
|
||||
}
|
||||
catch (RS485CommunicationException ex)
|
||||
{
|
||||
retryCount++;
|
||||
UpdateDeviceState(task.DeviceAddress, false);
|
||||
|
||||
if (retryCount >= task.RetryCount)
|
||||
{
|
||||
task.CompletionSource.SetException(ex);
|
||||
return;
|
||||
}
|
||||
|
||||
// 等待一段时间后重试
|
||||
await Task.Delay(InterFrameDelay, _cancellationTokenSource.Token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轮询所有设备状态
|
||||
/// </summary>
|
||||
private async Task PollDevices()
|
||||
{
|
||||
foreach (var deviceState in _deviceStates.Values.ToList())
|
||||
{
|
||||
// 检查设备是否需要轮询(例如,超过一定时间未通信)
|
||||
if ((DateTime.Now - deviceState.LastCommunication).TotalSeconds > 30)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 发送诊断命令(如读取设备状态)
|
||||
await ReadHoldingRegistersAsync(deviceState.Address, 0, 1);
|
||||
Console.WriteLine($"设备 {deviceState.Address} 轮询成功");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"设备 {deviceState.Address} 轮询失败: {ex.Message}");
|
||||
}
|
||||
|
||||
// 添加帧间延迟
|
||||
await Task.Delay(InterFrameDelay, _cancellationTokenSource.Token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据接收处理
|
||||
/// </summary>
|
||||
private Task OnDataReceived(ISerialPortClient client, ReceivedDataEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 解析响应帧
|
||||
var response = ResponseFrame.FromBytes(e.ByteBlock.ReadBytesPackage());
|
||||
|
||||
if (response.IsValid)
|
||||
{
|
||||
// 查找匹配的任务并设置结果
|
||||
foreach (var task in _taskQueue.Where(t => t.DeviceAddress.Value == response.DeviceAddress.Value))
|
||||
{
|
||||
task.CompletionSource.TrySetResult(response);
|
||||
}
|
||||
|
||||
UpdateDeviceState(response.DeviceAddress, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"收到无效响应: {response.Error}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"处理接收数据时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新设备状态
|
||||
/// </summary>
|
||||
private void UpdateDeviceState(DeviceAddress address, bool communicationSuccess)
|
||||
{
|
||||
if (_deviceStates.TryGetValue(address, out var state))
|
||||
{
|
||||
state.LastCommunication = DateTime.Now;
|
||||
|
||||
if (communicationSuccess)
|
||||
{
|
||||
state.IsOnline = true;
|
||||
state.TimeoutCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
state.TimeoutCount++;
|
||||
if (state.TimeoutCount > MaxRetries)
|
||||
{
|
||||
state.IsOnline = false;
|
||||
Console.WriteLine($"设备 {address} 已离线");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有设备状态
|
||||
/// </summary>
|
||||
public Dictionary<DeviceAddress, bool> GetDeviceStatuses()
|
||||
{
|
||||
return _deviceStates.ToDictionary(
|
||||
kvp => kvp.Key,
|
||||
kvp => kvp.Value.IsOnline);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 资源释放
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
_isDisposed = true;
|
||||
_cancellationTokenSource.Cancel();
|
||||
_serialPortClient.SafeDispose();
|
||||
_cancellationTokenSource.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 使用示例
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
// 创建485主站实例
|
||||
using (var master = new RS485MasterStation("COM1", 9600))
|
||||
|
||||
try
|
||||
{
|
||||
// 添加要监控的设备
|
||||
master.AddDevice(0x01);
|
||||
master.AddDevice(0x02);
|
||||
master.AddDevice(0x03);
|
||||
|
||||
// 启动主站
|
||||
master.Start();
|
||||
|
||||
// 等待一段时间让主站初始化
|
||||
await Task.Delay(1000);
|
||||
|
||||
// 示例1: 读取设备1的保持寄存器
|
||||
try
|
||||
{
|
||||
var data = await master.ReadHoldingRegistersAsync(0x01, 0, 10);
|
||||
Console.WriteLine($"成功读取设备1的寄存器数据: {BitConverter.ToString(data)}");
|
||||
}
|
||||
catch (RS485CommunicationException ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
// 示例2: 向设备2写入寄存器值
|
||||
try
|
||||
{
|
||||
await master.WriteSingleRegisterAsync(0x02, 0x1000, 0x1234);
|
||||
Console.WriteLine("成功向设备2写入寄存器值");
|
||||
}
|
||||
catch (RS485CommunicationException ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
// 显示所有设备状态
|
||||
var statuses = master.GetDeviceStatuses();
|
||||
foreach (var status in statuses)
|
||||
{
|
||||
Console.WriteLine($"设备 {status.Key}: {(status.Value ? "在线" : "离线")}");
|
||||
}
|
||||
|
||||
// 保持运行
|
||||
Console.WriteLine("按任意键退出...");
|
||||
Console.ReadKey();
|
||||
}
|
||||
finally
|
||||
{
|
||||
master.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -680,6 +680,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将DataRow转换为Dictionary<string, object>
|
||||
/// </summary>
|
||||
/// <param name="row">DataRow实例</param>
|
||||
/// <returns>键为列名、值为对应数据的字典</returns>
|
||||
public Dictionary<string, object> ToDictionary(DataRow row)
|
||||
{
|
||||
var dictionary = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||
if (row == null) return dictionary;
|
||||
|
||||
foreach (DataColumn column in row.Table.Columns)
|
||||
{
|
||||
object value = row[column] == DBNull.Value ? null : row[column];
|
||||
dictionary[column.ColumnName] = value;
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.UserControls.DispenseMacInfo"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.UserControls"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="400" Background="#FF828282">
|
||||
<Grid Margin="5,5,5,5" Background="White" >
|
||||
<Image x:Name="IMAGE" VerticalAlignment="Top" Height="400" Margin="0,5,0,0" />
|
||||
<Grid Margin="0,400,0,0">
|
||||
<TextBlock TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" Height="30" VerticalAlignment="Top" FontSize="16"
|
||||
HorizontalAlignment="Left" Width="150" Background="#FFE0E0E0"/>
|
||||
<TextBlock TextWrapping="Wrap" Text="{x:Static lang:Resources.State}" Height="30" VerticalAlignment="Top" FontSize="16"
|
||||
Margin="0,30,0,0" HorizontalAlignment="Left" Width="150" Background="#FFE0E0E0"/>
|
||||
<TextBlock TextWrapping="Wrap" Text="{x:Static lang:Resources.WorkingStatus}" Height="30" VerticalAlignment="Top" FontSize="16"
|
||||
Margin="0,60,0,0" HorizontalAlignment="Left" Width="150" Background="#FFE0E0E0"/>
|
||||
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,0,80,0">
|
||||
<TextBlock x:Name="mac" TextWrapping="Wrap" Text="------" FontSize="16" />
|
||||
</Border>
|
||||
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,0,0,0" HorizontalAlignment="Right" Width="80">
|
||||
<TextBlock x:Name="macg" TextWrapping="Wrap" Text="------" FontSize="16" />
|
||||
</Border>
|
||||
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,30,80,0">
|
||||
<TextBlock x:Name="state" TextWrapping="Wrap" Text="------" FontSize="16" />
|
||||
</Border>
|
||||
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,30,0,0" HorizontalAlignment="Right" Width="80">
|
||||
<TextBlock x:Name="type_N" TextWrapping="Wrap" Text="-------" FontSize="16" />
|
||||
</Border>
|
||||
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,60,0,0">
|
||||
<TextBlock x:Name="WorkingStatus" TextWrapping="Wrap" Text="------" FontSize="16" />
|
||||
</Border>
|
||||
<Button x:Name="State" Content="{x:Static lang:Resources.Information}" HorizontalAlignment="Right" Height="35" Margin="0,0,15,10" VerticalAlignment="Bottom" Width="80" Click="State_Click" Padding="0,4,0,4"/>
|
||||
<Button x:Name="Manual" Content="{x:Static lang:Resources.Manual}" HorizontalAlignment="Right" Height="35" Margin="0,0,115,10" VerticalAlignment="Bottom" Width="80" Click="Manual_Click" Padding="0,4,0,4"/>
|
||||
<Button x:Name="Screen" Content="{x:Static lang:Resources.Screen}" HorizontalAlignment="Right" Height="35" Margin="0,0,215,10" VerticalAlignment="Bottom" Width="80" Click="Screen_Click" Padding="0,4,0,4"/>
|
||||
|
||||
<materialDesign:PackIcon x:Name="mlock" Kind="Lock" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="40" Height="40" Foreground="#FFA98C00" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="0,0,0,5"/>
|
||||
<materialDesign:PackIcon x:Name="Disconnect" Kind="LanDisconnect" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="40" Height="40" Foreground="#FFA98C00" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="50,0,0,5"/>
|
||||
|
||||
</Grid>
|
||||
<TextBlock x:Name="IP" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
|
||||
<TextBlock x:Name="PORT" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
|
||||
<TextBlock x:Name="USER" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
|
||||
<TextBlock x:Name="PASSWD" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
|
||||
<TextBlock x:Name="type_" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,73 @@
|
||||
using ScottPlot.Plottables;
|
||||
using SunlightCentralizedControlManagement_SCCM_.EX;
|
||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Media.Media3D;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// info.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DispenseMacInfo : UserControl
|
||||
{
|
||||
public DispenseMacInfo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void State_Click(object sender, RoutedEventArgs e)//状态
|
||||
{
|
||||
if ((mlock.Visibility == Visibility.Visible) || (Disconnect.Visibility == Visibility.Visible))
|
||||
{
|
||||
MessageBox.Show(Properties.Resources.Not_a,"Dispense",MessageBoxButton.OK);
|
||||
return;
|
||||
}
|
||||
UserMessage userMessage = new UserMessage();
|
||||
userMessage.DispenseMacInfo(mac.Text, macg.Text);
|
||||
userMessage.Show();
|
||||
}
|
||||
|
||||
private void Manual_Click(object sender, RoutedEventArgs e)//手动呼叫
|
||||
{
|
||||
if ((mlock.Visibility == Visibility.Visible) || (Disconnect.Visibility == Visibility.Visible))
|
||||
{
|
||||
MessageBox.Show(Properties.Resources.Not_a, "Dispense", MessageBoxButton.OK);
|
||||
return;
|
||||
}
|
||||
ManualDyelot manualDyelot = new ManualDyelot();
|
||||
manualDyelot.MAC(mac.Text,Convert.ToInt16(type_.Text));
|
||||
manualDyelot.Show();
|
||||
}
|
||||
|
||||
private void Screen_Click(object sender, RoutedEventArgs e)//远程画面
|
||||
{
|
||||
if ((mlock.Visibility == Visibility.Visible)||(Disconnect.Visibility == Visibility.Visible))
|
||||
{
|
||||
MessageBox.Show(Properties.Resources.Not_a, "Dispense", MessageBoxButton.OK);
|
||||
return;
|
||||
}
|
||||
VNC screen = new VNC();
|
||||
screen.Parameter(IP.Text,PORT.Text,USER.Text,PASSWD.Text);
|
||||
screen.Show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.RoilingTextBlock"
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.UserControls.RoilingTextBlock"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.UserControls"
|
||||
mc:Ignorable="d"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
d:DesignWidth="300" Height="30" >
|
||||
@@ -14,7 +14,7 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// RoilingTextBlock.xaml 的交互逻辑
|
||||
@@ -26,6 +26,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
private double offset=6;//最大的偏移量
|
||||
private TextBlock currentTextBlock = null;
|
||||
private DispatcherTimer currentTimer = null;
|
||||
|
||||
public RoilingTextBlock()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -0,0 +1,29 @@
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.UserControls.info"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.UserControls"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
||||
mc:Ignorable="d"
|
||||
Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="400" d:DesignWidth="300" Background="White">
|
||||
<Grid Background="#FFBFBFBF">
|
||||
<TextBlock x:Name="name" VerticalAlignment="Top" Height="50" Background="#FF646464" Text="-----" FontWeight="Bold" FontSize="36" />
|
||||
<TextBlock x:Name="temp" VerticalAlignment="Top" Height="50" Text="---.-°C" FontWeight="Bold" FontSize="36" HorizontalAlignment="Right" Padding="5,0,5,0"/>
|
||||
<Grid Margin="2,50,2,2" Background="White">
|
||||
<TextBlock Text="{x:Static lang:Resources.process}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,0,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.Step}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,50,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.message}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,100,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.orders}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,150,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<TextBlock x:Name="time" Text="----------------------------" Height="30" FontWeight="Bold" FontSize="24" Margin="5,180,5,0" VerticalAlignment="Top" Focusable="False"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Process" Text="NO Information" FontSize="21" Height="30" Margin="120,0,0,0" VerticalAlignment="Top"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Step" Text="NO Information" FontSize="21" Height="30" Margin="120,50,0,0" VerticalAlignment="Top"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Message" Text="NO Information" FontSize="21" Height="30" Margin="120,100,0,0" VerticalAlignment="Top"/>
|
||||
<local:RoilingTextBlock Foreground="Black" x:Name="Orders" Text="NO Information" FontSize="21" Height="30" Margin="120,150,0,0" VerticalAlignment="Top"/>
|
||||
<lvc:CartesianChart x:Name="OscChart" Margin="0,200,0,0" EasingFunction="{x:Null}" ZoomMode="PanX"
|
||||
Series="{Binding Series}" YAxes="{Binding YAxes}" XAxes="{Binding XAxes}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,164 @@
|
||||
using LiveChartsCore;
|
||||
using LiveChartsCore.Defaults;
|
||||
using LiveChartsCore.Kernel.Sketches;
|
||||
using LiveChartsCore.SkiaSharpView;
|
||||
using LiveChartsCore.SkiaSharpView.Painting;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using ScottPlot;
|
||||
using ScottPlot.Plottables;
|
||||
using ScottPlot.Statistics;
|
||||
using SkiaSharp;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Media.Media3D;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// info.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class info : UserControl, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
public void RaisePropertyChanged(string propertyName)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
if (propertyName != null)
|
||||
{
|
||||
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
private ObservableCollection<DateTimePoint> MTH_values = new ObservableCollection<DateTimePoint>();
|
||||
|
||||
public ObservableCollection<ISeries> _series { get; set; }
|
||||
public ObservableCollection<ISeries> Series
|
||||
{
|
||||
get => _series;
|
||||
set
|
||||
{
|
||||
_series = value;
|
||||
OnPropertyChanged(nameof(Series));
|
||||
}
|
||||
}
|
||||
//x轴时间格式
|
||||
public Axis[] XAxes { get; set; } =
|
||||
{
|
||||
new DateTimeAxis(TimeSpan.FromSeconds(5) , date => date.ToString("HH:mm"))
|
||||
{
|
||||
MinLimit = DateTime.Now.AddHours(-6).Ticks,
|
||||
MaxLimit = DateTime.Now.AddHours(0.5).Ticks,
|
||||
CrosshairLabelsBackground = SKColors.DarkGray.AsLvcColor(),
|
||||
CrosshairLabelsPaint = new SolidColorPaint(SKColors.DarkSlateBlue, 1),
|
||||
CrosshairPaint = new SolidColorPaint(SKColors.DarkSlateGray, 1),
|
||||
},
|
||||
};
|
||||
//颜色
|
||||
private static readonly SKColor s_blue = new SKColor(25, 118, 210);
|
||||
private static readonly SKColor s_red = new SKColor(229, 57, 53);
|
||||
public ICartesianAxis[] YAxes { get; set; } ={
|
||||
new Axis //y在此轴上缩放
|
||||
{
|
||||
MinLimit =0,
|
||||
MaxLimit =160,
|
||||
NamePadding = new LiveChartsCore.Drawing.Padding(0, 20),
|
||||
Padding = new LiveChartsCore.Drawing.Padding(0, 0, 20, 0),
|
||||
TextSize = 12,
|
||||
LabelsPaint = new SolidColorPaint(s_blue),
|
||||
TicksPaint = new SolidColorPaint(s_blue),
|
||||
SubticksPaint = new SolidColorPaint(s_blue),
|
||||
DrawTicksPath = true,
|
||||
CrosshairSnapEnabled = true,
|
||||
Position = LiveChartsCore.Measure.AxisPosition.Start
|
||||
},//温度轴
|
||||
|
||||
};
|
||||
|
||||
public info()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public void DataAdd(DateTime dateTime, double dat)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
// 添加新数据点
|
||||
MTH_values.Add(new DateTimePoint(dateTime, dat));
|
||||
// 更新X轴范围,始终保持最近6小时
|
||||
XAxes[0].MinLimit = dateTime.AddHours(-6).Ticks;
|
||||
XAxes[0].MaxLimit = dateTime.AddMinutes(1).Ticks;
|
||||
// 移除6小时前的旧数据
|
||||
while (MTH_values.Count > 0 &&
|
||||
MTH_values[0].DateTime < dateTime.AddHours(-6))
|
||||
{
|
||||
MTH_values.RemoveAt(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void DataROW(DataRow[] dataRows)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
foreach (DataRow row in dataRows)
|
||||
{
|
||||
// 添加新数据点
|
||||
MTH_values.Add(new DateTimePoint((DateTime)row["DateTime"], (double)row["DAT"]));
|
||||
}
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
// 更新X轴范围,始终保持最近6小时
|
||||
XAxes[0].MinLimit = dateTime.AddHours(-6).Ticks;
|
||||
XAxes[0].MaxLimit = dateTime.AddMinutes(1).Ticks;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 初始化系列
|
||||
Series = new ObservableCollection<ISeries>
|
||||
{
|
||||
new LineSeries<DateTimePoint>
|
||||
{
|
||||
Name = Properties.Resources.Temperature,
|
||||
Values = MTH_values,
|
||||
Stroke = new SolidColorPaint(s_red, 2),
|
||||
GeometrySize = 0,
|
||||
GeometryStroke = new SolidColorPaint(s_red, 2),
|
||||
Fill = null,
|
||||
LineSmoothness = 0,
|
||||
ScalesYAt = 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
/// </summary>
|
||||
public partial class CurveDiagram : UserControl
|
||||
{
|
||||
public CurveDiagram()
|
||||
public static string Curve;
|
||||
public static string starT;
|
||||
public static string endT;
|
||||
public static string mac;
|
||||
public static bool mode;
|
||||
//搜索方式0时间加机台1工单 ,机台,开始时间,结束时间,工单
|
||||
public CurveDiagram(bool i,string m,string s,string e,string w)
|
||||
{
|
||||
InitializeComponent();
|
||||
mode = i;
|
||||
starT = s;
|
||||
endT = e;
|
||||
mac = m;
|
||||
Curve = w;
|
||||
DataContext = new CurveDiagramViewModel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.CurveTemp"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
|
||||
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
||||
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:CurveTempModel}"
|
||||
d:DesignHeight="300" d:DesignWidth="400">
|
||||
<Grid>
|
||||
<lvc:CartesianChart x:Name="OscChart" EasingFunction="{x:Null}" ZoomMode="X"
|
||||
Series="{Binding Series}" YAxes="{Binding YAxes}" XAxes="{Binding XAxes}" Margin="0,0,0,0"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,35 @@
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
/// <summary>
|
||||
/// CurveDiagram.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CurveTemp : UserControl
|
||||
{
|
||||
public static DataTable dataTable;
|
||||
public CurveTemp(DataTable db)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
dataTable = db;
|
||||
|
||||
DataContext = new CurveTempModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,10 @@
|
||||
Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="900" d:DesignWidth="1800">
|
||||
<UserControl.Resources>
|
||||
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
|
||||
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
|
||||
@@ -21,7 +24,7 @@
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||
Margin="0,0,0,60" HorizontalAlignment="Right" Width="300" MouseDoubleClick="Griddata_MouseDoubleClick">
|
||||
Margin="0,0,0,60" HorizontalAlignment="Right" Width="330" MouseDoubleClick="Griddata_MouseDoubleClick">
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
@@ -52,11 +55,26 @@
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTemplateColumn Width="100" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
<UniformGrid VerticalAlignment="Bottom" HorizontalAlignment="Left">
|
||||
<Border>
|
||||
<Grid>
|
||||
<StackPanel Width="100" Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Width="25" Height="30"
|
||||
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
<materialDesign:PackIcon Width="25" Height="30" Kind="Lock"
|
||||
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}}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UniformGrid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
@@ -68,7 +86,7 @@
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||
VerticalAlignment="Top" Height="500" Margin="0,0,300,0" MouseDoubleClick="GridWorkOrder_MouseDoubleClick" >
|
||||
VerticalAlignment="Top" Height="500" Margin="0,0,330,0" MouseDoubleClick="GridWorkOrder_MouseDoubleClick" >
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
@@ -153,8 +171,19 @@
|
||||
</ListViewItem>
|
||||
</ListView>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="400" HorizontalAlignment="Right">
|
||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||
<ListViewItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Kind="ChatProcessing" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||
<TextBlock Text="{x:Static lang:Resources.Machine}" FontSize="20" VerticalAlignment="Center" Margin="20 10" Foreground="White" />
|
||||
<TextBlock x:Name="mac" FontSize="20" VerticalAlignment="Center" Margin="20 10" Foreground="White" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</ListViewItem>
|
||||
</ListView>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Background="White" Margin="0,500,300,60">
|
||||
<Grid Background="White" Margin="0,500,330,60">
|
||||
<ContentControl x:Name="Picture"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -28,8 +28,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
/// </summary>
|
||||
public partial class CurveView : UserControl
|
||||
{
|
||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||
public static DataTable WorkOrder = new DataTable(); //物料缓存
|
||||
public static string CurveDiagram;
|
||||
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||
@@ -62,35 +60,89 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
||||
|
||||
Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd");
|
||||
|
||||
Picture.Content = new View.CurveDiagram();
|
||||
Picture.Content = new View.CurveDiagram(false,"","","", CurveDiagram);
|
||||
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
||||
}
|
||||
|
||||
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CurveDiagram =Select_WorkOrderNumder.Text;
|
||||
Picture.Content = new View.CurveDiagram();
|
||||
Picture.Content = new View.CurveDiagram(true, "", "", "", CurveDiagram);
|
||||
}
|
||||
|
||||
private void ListViewItem_Before(object sender, MouseButtonEventArgs e)//前一天
|
||||
{
|
||||
Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(-1).ToString("yyyy/MM/dd");
|
||||
if (!string.IsNullOrEmpty(SYS_machines)) { }
|
||||
if (!string.IsNullOrEmpty(SYS_machines))
|
||||
{
|
||||
Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"),
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram);
|
||||
|
||||
WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
|
||||
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" +
|
||||
SYS_machines + "'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
|
||||
}
|
||||
else
|
||||
{
|
||||
WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
|
||||
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
|
||||
}
|
||||
}
|
||||
|
||||
private void ListViewItem_Today(object sender, MouseButtonEventArgs e)//今天
|
||||
{
|
||||
Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd");
|
||||
if (!string.IsNullOrEmpty(SYS_machines)) { }
|
||||
if (!string.IsNullOrEmpty(SYS_machines))
|
||||
{
|
||||
Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"),
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram);//刷新图表
|
||||
|
||||
WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
|
||||
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" +
|
||||
SYS_machines + "'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
GridWorkOrder.ItemsSource = WorkOrder.DefaultView; }
|
||||
else
|
||||
{
|
||||
WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
|
||||
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
|
||||
}
|
||||
}
|
||||
|
||||
private void ListViewItem_DayAfter(object sender, MouseButtonEventArgs e)//后一天
|
||||
{
|
||||
Sdatepicker.Text = DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd");
|
||||
if (!string.IsNullOrEmpty(SYS_machines)) { }
|
||||
if (!string.IsNullOrEmpty(SYS_machines))
|
||||
{
|
||||
Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"),
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram);
|
||||
|
||||
WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
|
||||
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" +
|
||||
SYS_machines + "'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
|
||||
}
|
||||
else
|
||||
{
|
||||
WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
|
||||
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
|
||||
}
|
||||
}
|
||||
|
||||
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)//选择机台
|
||||
@@ -99,6 +151,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
SYS_machines = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
mac.Text = SYS_machines;
|
||||
|
||||
WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
|
||||
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" +
|
||||
SYS_machines + "'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
|
||||
Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"),
|
||||
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +169,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
SYS_machines = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
string Cd = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
Select_WorkOrderNumder.Text = Cd;
|
||||
Picture.Content = new View.CurveDiagram(true, "", "", "", Cd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,10 +180,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
string SysTime = DateTime.Parse(sender.ToString()).ToString("yyyy/MM/dd");
|
||||
string SysTimeDays = DateTime.Parse(sender.ToString()).AddDays(1).ToString("yyyy/MM/dd");
|
||||
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where " + "StartTime>='" + SysTime + "'and StartTime<='" + SysTimeDays + "'", null).Tables[0]; //读取表写入缓存
|
||||
SQLiteHelpers.Close();
|
||||
WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where " + "StartTime>='" + SysTime + "'and StartTime<='" + SysTimeDays + "'", null).Tables[0]; //读取表写入缓存
|
||||
|
||||
GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.DispenseMachinesSet"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||
mc:Ignorable="d"
|
||||
Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="900" d:DesignWidth="1200">
|
||||
<UserControl.Resources>
|
||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
|
||||
Background="#FFC7C7C7" HorizontalGridLinesBrush="{x:Null}" VerticalGridLinesBrush="#FFC9C9C9"
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||
HorizontalAlignment="Right" Width="500" MouseDoubleClick="Griddata_MouseDoubleClick">
|
||||
<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.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="210" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Group}" Binding="{Binding Groups}" Width="210" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Binding="{Binding IP}" Width="0" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Binding="{Binding PORT}" Width="0" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Binding="{Binding User}" Width="0" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Binding="{Binding Passsword}" Width="0" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Binding="{Binding LOCK}" Width="0" IsReadOnly="True"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<Image HorizontalAlignment="Left" x:Name="IMAGE" VerticalAlignment="Bottom" Width="400" Height="400" Margin="10,200,0,100" />
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" FontSize="20" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,150,0,0" x:Name="User" VerticalAlignment="Top" Width="270" FontSize="20" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,150,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,200,0,0" x:Name="Password" VerticalAlignment="Top" Width="270" FontSize="20" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,200,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Password}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<CheckBox x:Name="dLICK" Content="{x:Static lang:Resources._lock}" HorizontalAlignment="Left" Height="35 " Margin="10,250,0,0" VerticalAlignment="Top" Width="200" FontSize="20"/>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="TextMachineGroup" VerticalAlignment="Top" Width="270" FontSize="20"
|
||||
DropDownClosed="TextMachineGroup_DropDownClosed" TextBoxBase.TextChanged="TextMachineGroup_DropDownClosed"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,50,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.MachineGroup}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,100,0,0" x:Name="IP" VerticalAlignment="Top" Width="200" FontSize="20" MaxLines="1"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="350,100,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" Width="20" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="360,100,0,0" x:Name="PORT" VerticalAlignment="Top" Width="60" FontSize="20" MaxLines="1" Text="5901"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,100,0,0" TextWrapping="Wrap" Text="IP/PORT" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,600,0,15" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Bottom" Width="140" FontSize="20"/>
|
||||
<Button Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Left" Height="35" Margin="250,600,0,15" VerticalAlignment="Bottom" Width="80" Click="Save_Click"/>
|
||||
<Button Content="{x:Static lang:Resources.Delete}" HorizontalAlignment="Left" Height="35" Margin="340,600,0,15" VerticalAlignment="Bottom" Width="80" Click="Delete_Click"/>
|
||||
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="160,600,50,15" VerticalAlignment="Bottom" Width="80" Click="Test_Click"/>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,272 @@
|
||||
using SkiaSharp;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
/// <summary>
|
||||
/// MachinesSet.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DispenseMachinesSet : UserControl
|
||||
{
|
||||
int type_;
|
||||
public DispenseMachinesSet()
|
||||
{
|
||||
InitializeComponent();
|
||||
//
|
||||
string[] Machine_ = { "252", "252RB", "252-2T", "252RDRM", "242W", "302", "303", "303PDW" };
|
||||
TextMachineGroup.ItemsSource = Machine_;
|
||||
}
|
||||
|
||||
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||
//private string SYS_machines = null;
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DataTable dataTable = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from MachinesDispense Order by id", null).Tables[0];
|
||||
Griddata.ItemsSource = dataTable.DefaultView;
|
||||
}
|
||||
|
||||
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
comboBoxMachine.Text = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
TextMachineGroup.Text = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
IP.Text = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
PORT.Text = (Griddata.Columns[4].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
User.Text = (Griddata.Columns[5].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
Password.Text = (Griddata.Columns[6].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
||||
string TYR= (Griddata.Columns[7].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;
|
||||
dLICK.IsChecked = Convert.ToBoolean((Griddata.Columns[7].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text);//定位第列,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void Save_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(comboBoxMachine.Text) && !string.IsNullOrEmpty(TextMachineGroup.Text) && !string.IsNullOrEmpty(IP .Text))
|
||||
{
|
||||
WriteableBitmap wb = new WriteableBitmap((BitmapSource)IMAGE.Source);
|
||||
byte[] imageData = SourceToArray(wb);
|
||||
|
||||
Dictionary<string, object> dr_new = new Dictionary<string, object>();//缓存函数
|
||||
dr_new.Add("Name", comboBoxMachine.Text);
|
||||
dr_new.Add("Groups", TextMachineGroup.Text);
|
||||
dr_new.Add("IP", IP.Text);
|
||||
dr_new.Add("PORT", PORT.Text);
|
||||
dr_new.Add("type", type_);
|
||||
dr_new.Add("State", "899");
|
||||
dr_new.Add("User", User.Text);
|
||||
dr_new.Add("Password", Password.Text);
|
||||
dr_new.Add("LOCK", dLICK.IsChecked.ToString());
|
||||
dr_new.Add("DATA",imageData);
|
||||
|
||||
if (MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from MachinesDispense where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
|
||||
{
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("MachinesDispense", dr_new);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindowViewModel.SQLiteHelpers.Update("MachinesDispense", dr_new, "name='" + comboBoxMachine.Text + "'", null);
|
||||
}
|
||||
Griddata.ItemsSource = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select Name,Groups,IP,PORT,DATA from MachinesDispense Order by id", null).Tables[0].DefaultView;
|
||||
MessageBox.Show(Properties.Resources.Save + comboBoxMachine.Text, "SCCM", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(Properties.Resources.ERR , "SCCM", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
private void Delete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
|
||||
{
|
||||
MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
||||
if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码
|
||||
{
|
||||
MainWindowViewModel.SQLiteHelpers.Delete("MachinesDispense", "Name='" + comboBoxMachine.Text + "'", null);
|
||||
Griddata.ItemsSource = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select Name,Groups,IP,PORT,DATA from MachinesDispense Order by id", null).Tables[0].DefaultView;
|
||||
comboBoxMachine.Text = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
textlog.Text = "Invalid";
|
||||
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
||||
}
|
||||
}
|
||||
private void Test_Click(object sender, RoutedEventArgs e)//测试按钮
|
||||
{
|
||||
if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.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)
|
||||
{
|
||||
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
//连接服务器,绑定IP 与 端口
|
||||
IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Parse(IP.Text), int.Parse(PORT.Text));
|
||||
try
|
||||
{
|
||||
socket.Connect(iPEndPoint);
|
||||
socket.Close();//离线
|
||||
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 if (reply.Status == IPStatus.TimedOut)
|
||||
{
|
||||
textlog.Text = "Link timeout";
|
||||
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void TextMachineGroup_DropDownClosed(object sender, EventArgs e)
|
||||
{
|
||||
Uri uri;
|
||||
BitmapImage bitmapImage;
|
||||
switch (TextMachineGroup.Text)//步骤用时计算
|
||||
{
|
||||
case "252":
|
||||
uri = new Uri("pack://application:,,,/LOGO/252-2t.png");
|
||||
bitmapImage = new BitmapImage(uri);
|
||||
IMAGE.Source = bitmapImage;
|
||||
type_ = 1;
|
||||
break;
|
||||
case "252-2T":
|
||||
uri = new Uri("pack://application:,,,/LOGO/252-2t.png");
|
||||
bitmapImage = new BitmapImage(uri);
|
||||
IMAGE.Source = bitmapImage;
|
||||
type_ = 1;
|
||||
break;
|
||||
case "252RB":
|
||||
uri = new Uri("pack://application:,,,/LOGO/252RB.png");
|
||||
bitmapImage = new BitmapImage(uri);
|
||||
IMAGE.Source = bitmapImage;
|
||||
type_ = 1;
|
||||
break;
|
||||
case "252RDRM":
|
||||
uri = new Uri("pack://application:,,,/LOGO/252RMRD.png");
|
||||
bitmapImage = new BitmapImage(uri);
|
||||
IMAGE.Source = bitmapImage;
|
||||
type_ = 1;
|
||||
break;
|
||||
case "242W":
|
||||
uri = new Uri("pack://application:,,,/LOGO/242w.png");
|
||||
bitmapImage = new BitmapImage(uri);
|
||||
IMAGE.Source = bitmapImage;
|
||||
type_ = 1;
|
||||
break;
|
||||
case "302":
|
||||
uri = new Uri("pack://application:,,,/LOGO/302.png");
|
||||
bitmapImage = new BitmapImage(uri);
|
||||
IMAGE.Source = bitmapImage;
|
||||
type_ = 2;
|
||||
break;
|
||||
case "303":
|
||||
uri = new Uri("pack://application:,,,/LOGO/303.png");
|
||||
bitmapImage = new BitmapImage(uri);
|
||||
IMAGE.Source = bitmapImage;
|
||||
type_ = 3;
|
||||
break;
|
||||
case "302PDW":
|
||||
uri = new Uri("pack://application:,,,/LOGO/303pdw.png");
|
||||
bitmapImage = new BitmapImage(uri);
|
||||
IMAGE.Source = bitmapImage;
|
||||
type_ = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] BitmapImageToByteArray(BitmapImage bmp)
|
||||
{
|
||||
byte[] byteArray = null;
|
||||
try
|
||||
{
|
||||
Stream sMarket = bmp.StreamSource;
|
||||
if (sMarket != null && sMarket.Length > 0)
|
||||
{
|
||||
//很重要,因为Position经常位于Stream的末尾,导致下面读取到的长度为0。
|
||||
sMarket.Position = 0;
|
||||
|
||||
using (BinaryReader br = new BinaryReader(sMarket))
|
||||
{
|
||||
byteArray = br.ReadBytes((int)sMarket.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
//other exception handling
|
||||
}
|
||||
return byteArray;
|
||||
}
|
||||
|
||||
public static byte[] SourceToArray(WriteableBitmap source)
|
||||
{
|
||||
byte[] byteArray = null;
|
||||
try
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
JpegBitmapEncoder coder = new JpegBitmapEncoder();
|
||||
coder.QualityLevel = 100;
|
||||
coder.Frames.Add(BitmapFrame.Create(source));
|
||||
coder.Save(ms);
|
||||
byteArray = ms.ToArray();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message.ToString());
|
||||
}
|
||||
return byteArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.DispenseView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||
mc:Ignorable="d"
|
||||
Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="900" d:DesignWidth="1200">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="60"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<ScrollViewer Margin="0" VerticalScrollBarVisibility="Auto">
|
||||
<WrapPanel Orientation="Horizontal" x:Name="DispenseMacView" Background="White">
|
||||
|
||||
</WrapPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="1" Height="60" Background="#FF00204E" Orientation="Horizontal">
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,180 @@
|
||||
using LiveChartsCore.Geo;
|
||||
using SkiaSharp;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserControls;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ConvertMoels;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
using System.Windows.Threading;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Xml.Linq;
|
||||
using static System.Windows.Forms.AxHost;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
/// <summary>
|
||||
/// MachinesSet.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DispenseView : UserControl
|
||||
{
|
||||
public DispenseView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||
DataTable DispenseMac = new DataTable();
|
||||
UserControls.DispenseMacInfo[] dispenseMacInfo = new UserControls.DispenseMacInfo[99]; //定义总览信息卡
|
||||
//private string SYS_machines = null;
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DispenseMac = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from MachinesDispense ", null).Tables[0];//缓存
|
||||
/// <summary>
|
||||
/// 生成总览信息卡
|
||||
/// </summary>
|
||||
for (int i = 0; i < DispenseMac.Rows.Count; i++)
|
||||
{
|
||||
string x = DispenseMac.AsEnumerable().Select(row => row.Field<string>("State")).ElementAt(i);
|
||||
bool y = DispenseMac.AsEnumerable().Select(row => row.Field<bool>("LOCK")).ElementAt(i);
|
||||
|
||||
dispenseMacInfo[i] = new UserControls.DispenseMacInfo();
|
||||
dispenseMacInfo[i].Margin = new Thickness(5, 5, 0, 5);
|
||||
dispenseMacInfo[i].Width = 400;
|
||||
dispenseMacInfo[i].Height = 600;
|
||||
dispenseMacInfo[i].IP.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("IP")).ElementAt(i);
|
||||
dispenseMacInfo[i].USER.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("User")).ElementAt(i);
|
||||
dispenseMacInfo[i].PORT.Text = DispenseMac.AsEnumerable().Select(row => row.Field<int>("PORT")).ElementAt(i).ToString();
|
||||
dispenseMacInfo[i].PASSWD.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("Password")).ElementAt(i);
|
||||
dispenseMacInfo[i].type_.Text = DispenseMac.AsEnumerable().Select(row => row.Field<int>("type")).ElementAt(i).ToString();
|
||||
dispenseMacInfo[i].type_N.Text = StatenClassConvert.Convert(DispenseMac.AsEnumerable().Select(row => row.Field<int>("type")).ElementAt(i));
|
||||
dispenseMacInfo[i].mac.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("name")).ElementAt(i);
|
||||
dispenseMacInfo[i].macg.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("Groups")).ElementAt(i);
|
||||
dispenseMacInfo[i].state.Text = StatenClassConvert.Convert(x);
|
||||
if (x == "899")
|
||||
{
|
||||
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
|
||||
}
|
||||
dispenseMacInfo[i].WorkingStatus.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("WorkingStatus")).ElementAt(i);
|
||||
if (y)
|
||||
{
|
||||
dispenseMacInfo[i].mlock.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
dispenseMacInfo[i].mlock.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
//dispenseMacInfo[i].name.Text = Selet_Machines(MainWindowViewModel.Machines, "name", i).ToString();
|
||||
// dispenseMacInfo[i].IMAGE = ;
|
||||
|
||||
MemoryStream memoryStream = new MemoryStream(DispenseMac.AsEnumerable().Select(row => row.Field<byte[]>("DATA")).ElementAt(i));
|
||||
//数据流生成图片显示
|
||||
BitmapImage bitmapImage = new BitmapImage();
|
||||
bitmapImage.BeginInit();
|
||||
bitmapImage.StreamSource = memoryStream;
|
||||
bitmapImage.EndInit();
|
||||
dispenseMacInfo[i].IMAGE.Source = bitmapImage;
|
||||
DispenseMacView.Children.Add(dispenseMacInfo[i]);
|
||||
|
||||
CountDown();
|
||||
}
|
||||
}
|
||||
|
||||
private void CountDown()
|
||||
{
|
||||
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每10秒调用一次Tick
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(10)//秒
|
||||
};
|
||||
timer1s.Tick += Tick_Event_1S;
|
||||
timer1s.Start();
|
||||
}//时间周期初始化
|
||||
async void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||
{
|
||||
for (int i = 0; i < DispenseMac.Rows.Count; i++)
|
||||
{
|
||||
if (await PingTest(dispenseMacInfo[i].IP.Text))
|
||||
{
|
||||
DataRow drEmployee = DispenseMac.Select("IP='" + dispenseMacInfo[i].IP.Text + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["State"] = "802";
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
drEmployee.ClearErrors();
|
||||
}
|
||||
|
||||
string x = DispenseMac.AsEnumerable().Select(row => row.Field<string>("State")).ElementAt(i);
|
||||
bool y = DispenseMac.AsEnumerable().Select(row => row.Field<bool>("LOCK")).ElementAt(i);
|
||||
|
||||
dispenseMacInfo[i].state.Text = StatenClassConvert.Convert(x);
|
||||
dispenseMacInfo[i].WorkingStatus.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("WorkingStatus")).ElementAt(i);
|
||||
if (x == "899")
|
||||
{
|
||||
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
||||
dispenseMacInfo[i].Disconnect.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
|
||||
dispenseMacInfo[i].Disconnect.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
if (y)
|
||||
{
|
||||
dispenseMacInfo[i].mlock.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
dispenseMacInfo[i].mlock.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async Task<bool> PingTest(string ip)
|
||||
{
|
||||
bool result = false;
|
||||
Ping pingSender = new Ping();
|
||||
|
||||
try
|
||||
{
|
||||
PingReply reply = await pingSender.SendPingAsync(ip, 3000);
|
||||
|
||||
if (reply.Status == IPStatus.Success)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
catch (PingException )
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.DyeingPlanView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||
mc:Ignorable="d" Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="900" d:DesignWidth="1100">
|
||||
<UserControl.Resources>
|
||||
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid Background="White" Cursor="">
|
||||
<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"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<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" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<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" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,180,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ColorNumber}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<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"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,180,10,0" x:Name="TEXTColorNumber" VerticalAlignment="Top" Width="200"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,230,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ColorName}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,230,10,0" x:Name="TEXTColorName" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,280,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Client}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,280,10,0" x:Name="TEXTClient" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,330,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothSpecies}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,330,10,0" x:Name="TEXTClothSpecies" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,380,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWeight}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<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"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,430,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.BathRatio}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<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"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,480,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<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"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,530,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,530,10,0" x:Name="TEXTUSER" VerticalAlignment="Top" Width="270"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
|
||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,80,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Pump}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="40" Margin="140,80,380,0" x:Name="PumpSpeed" VerticalAlignment="Top" Width="100"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,80,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Blower}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="40" Margin="360,80,50,0" x:Name="Blower" VerticalAlignment="Top" Width="100"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,130,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Swing}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="40" Margin="140,130,380,0" x:Name="Swing" VerticalAlignment="Top" Width="100"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,130,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWheel}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="40" Margin="360,130,50,0" x:Name="ClothWheel" VerticalAlignment="Top" Width="100"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,180,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Nozzle}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Right" Height="40" Margin="140,180,380,0" x:Name="Nozzle" VerticalAlignment="Top" Width="100"
|
||||
FontSize="15" BorderBrush="#FF673AB7" />
|
||||
|
||||
<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"
|
||||
TextBoxBase.TextChanged="comboBoxProgram_TextChanged"/>
|
||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,30,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
|
||||
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40" MouseDoubleClick="Grid_data_MouseDoubleClick"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||
Margin="0,250,10,60" Width="600" HorizontalAlignment="Right" BorderBrush="#FFC9C9C9" FontSize="16" BorderThickness="5,5,5,5" >
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="100" />
|
||||
<Setter Property="FontSize" Value="15" />
|
||||
<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.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
|
||||
<MenuItem Header="{x:Static lang:Resources.Insert}" Click="MenuItem_Insert"/>
|
||||
<MenuItem Header="{x:Static lang:Resources.Delete}" Click="MenuItem_Delete"/>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTextColumn Binding="{Binding ProgramID}" 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.ElementStyle>
|
||||
<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 Parameter2}" 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 Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="100" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="{Binding Path=StepID,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="300" 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>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<Button x:Name="Save" Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Right" Height="35" Margin="450,0,50,10" VerticalAlignment="Bottom" Width="80" Click="Button_Click"/>
|
||||
<Button HorizontalAlignment="Left" Height="35" Margin="0,0,50,10" VerticalAlignment="Bottom" Width="60" Click="Button_Quit" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}">
|
||||
<materialDesign:PackIcon Kind="ArrowRight" Foreground="#FF00204E" HorizontalAlignment="Center" VerticalAlignment="Center" Width="50" Height="35" />
|
||||
</Button>
|
||||
|
||||
<Grid Background="White" Margin="10,500,300,45" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="250" Width="400">
|
||||
<ContentControl x:Name="Picture"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,672 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using nGantt.GanttChart;
|
||||
using ScottPlot.Palettes;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using TouchSocket.Core;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
|
||||
using static System.Windows.Forms.AxHost;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
/// <summary>
|
||||
/// ProductionPlanningEdit.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DyeingPlanView : UserControl
|
||||
{
|
||||
DataTable ProgramName = new DataTable();
|
||||
DataTable WorkOrder =new DataTable();
|
||||
DataTable dat = new DataTable();
|
||||
DataTable TEMPTable = new DataTable();
|
||||
DataTable DyelotsBulkedRecipe=new DataTable();
|
||||
public string WorkOrder_n;
|
||||
string Numder = null;
|
||||
string ID = null;
|
||||
string P1, P2, P3, P4, P5;
|
||||
public DyeingPlanView()
|
||||
{
|
||||
InitializeComponent();
|
||||
ProgramName = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from ProgramName order by ProgramID desc", null).Tables[0];//缓存
|
||||
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
|
||||
comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramName")).ToList();//转换工艺代码
|
||||
TEXTUSER.Text = MainWindow.user_;
|
||||
|
||||
TEMPTable.Columns.Add("Time", Type.GetType("System.String"));
|
||||
TEMPTable.Columns.Add("MST", Type.GetType("System.Double"));
|
||||
}
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void comboBoxMachine_DropDownClosed(object sender, EventArgs e)//机台选择
|
||||
{
|
||||
string[] sArray = Regex.Split(comboBoxMachine.Text, @"\+", RegexOptions.IgnoreCase);
|
||||
if (sArray.Length <= 1)
|
||||
{
|
||||
comboBoxDyelot.IsEnabled = true;
|
||||
DataTable DatDyelot = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Machine='" + comboBoxMachine.Text + "' and State='101' order by Dyelot desc", null).Tables[0]; //读取计划表写入缓存
|
||||
comboBoxDyelot.ItemsSource = DatDyelot.AsEnumerable().Select(rowdata => rowdata.Field<string>("Dyelot")).ToList();//转换代码
|
||||
}
|
||||
}
|
||||
private void Button_Click(object sender, RoutedEventArgs e)//保存按钮
|
||||
{
|
||||
if (string.IsNullOrEmpty(comboBoxMachine.Text))
|
||||
{
|
||||
MessageBox.Show("Not Machine", "SCCM", MessageBoxButton.OK, MessageBoxImage.Question);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(comboBoxProgram.Text))
|
||||
{
|
||||
MessageBox.Show("Not Program", "SCCM", MessageBoxButton.OK, MessageBoxImage.Question);
|
||||
return;
|
||||
}
|
||||
string[] pArray = Regex.Split(comboBoxProgram.Text, @"\+", RegexOptions.IgnoreCase);
|
||||
|
||||
//单机器信息写入
|
||||
string sTime;
|
||||
string StartTime_;
|
||||
string WorkOrder_ = comboBoxMachine.Text + "_" + DateTime.Now.ToString("yyMMddHHmmss");
|
||||
if (!string.IsNullOrEmpty(comboBoxWorkOrder.Text)) WorkOrder_ = comboBoxWorkOrder.Text;
|
||||
string ProgramName_ = comboBoxProgram.Text;
|
||||
string ProgramID_ = null;
|
||||
for (int j = 0; j < pArray.Length; j++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (j == 0)
|
||||
{
|
||||
ProgramID_ = ProgramName.Select("ProgramName='" + pArray[j] + "'").
|
||||
First().Field<object>("ProgramID").ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
ProgramID_ = ProgramID_ + "+" + ProgramName.Select("ProgramName='" + pArray[j] + "'").
|
||||
First().Field<object>("ProgramID").ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show("Not Program", "SCCM", MessageBoxButton.OK, MessageBoxImage.Question);
|
||||
return;
|
||||
}
|
||||
}
|
||||
string Machines_ = comboBoxMachine.Text;
|
||||
string State_ = "100";
|
||||
string Dyelot_ = comboBoxDyelot.Text;
|
||||
string color_ = color.Background.ToString();
|
||||
try
|
||||
{
|
||||
sTime = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
|
||||
"select * from WorkOrder where Machines='" + comboBoxMachine.Text + "' order by EndTime desc", null).
|
||||
Tables[0].Select().First().Field<object>("EndTime").ToString(); //读取计划表写入缓存
|
||||
if (DateTime.Now < DateTime.Parse(sTime))
|
||||
{
|
||||
StartTime_ = DateTime.Parse(sTime).AddMinutes(1).ToString("yyyy/MM/dd HH:mm:ss");
|
||||
}
|
||||
else
|
||||
{
|
||||
StartTime_ = DateTime.Now.AddMinutes(1).ToString("yyyy/MM/dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
StartTime_ = DateTime.Now.AddMinutes(1).ToString("yyyy/MM/dd HH:mm:ss");
|
||||
}
|
||||
|
||||
string Time_ = "0:00";
|
||||
for (int k = 0; k < pArray.Length; k++)
|
||||
{
|
||||
string t = ProgramName.Select("ProgramName='" + pArray[k] + "'").
|
||||
First().Field<object>("Time").ToString();
|
||||
Time_ = (DateTime.Parse(Time_) + DateTime.Parse(t).TimeOfDay).ToString("HH:mm:ss");
|
||||
}
|
||||
string EndTime_ = (DateTime.Parse(StartTime_) + DateTime.Parse(Time_).TimeOfDay).ToString("yyyy/MM/dd HH:mm:ss");
|
||||
|
||||
//插入数据信息
|
||||
Dictionary<string, object> WorkOrder_new = new Dictionary<string, object>();//缓存函数
|
||||
WorkOrder_new.Add("StartTime", StartTime_);
|
||||
WorkOrder_new.Add("EndTime", EndTime_);
|
||||
WorkOrder_new.Add("Time", Time_);
|
||||
WorkOrder_new.Add("WorkOrder", WorkOrder_);
|
||||
WorkOrder_new.Add("ProgramName", ProgramName_);
|
||||
WorkOrder_new.Add("ProgramID", ProgramID_);
|
||||
WorkOrder_new.Add("Machines", Machines_);
|
||||
WorkOrder_new.Add("State", State_);
|
||||
WorkOrder_new.Add("Dyelot", Dyelot_);
|
||||
WorkOrder_new.Add("Remark", null);
|
||||
WorkOrder_new.Add("lock", 0);
|
||||
WorkOrder_new.Add("color", color_);
|
||||
WorkOrder_new.Add("ColorNumber", TEXTColorNumber.Text);
|
||||
WorkOrder_new.Add("Client", TEXTClient.Text);
|
||||
WorkOrder_new.Add("ClothWeight", TEXTClothWeight.Text);
|
||||
WorkOrder_new.Add("ClothSpecies", TEXTClothSpecies.Text);
|
||||
WorkOrder_new.Add("BathRatio", TEXTBathRatio.Text);
|
||||
WorkOrder_new.Add("Total", TEXTTotal.Text);
|
||||
WorkOrder_new.Add("USER", TEXTUSER.Text);
|
||||
WorkOrder_new.Add("ColorName", TEXTColorName.Text);
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入
|
||||
|
||||
//插入信息
|
||||
Dictionary<string, object> WorkOrder_set = new Dictionary<string, object>();//缓存函数
|
||||
WorkOrder_set.Add("WorkOrder", WorkOrder_);
|
||||
WorkOrder_set.Add("PumpSpeed", PumpSpeed.Text);
|
||||
WorkOrder_set.Add("Blower", Blower.Text);
|
||||
WorkOrder_set.Add("Swing", Swing.Text);
|
||||
WorkOrder_set.Add("ClothWheel", ClothWheel.Text);
|
||||
WorkOrder_set.Add("Nozzle", Nozzle.Text);
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("WorkOrderSet", WorkOrder_set);// 执行插入
|
||||
|
||||
Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数
|
||||
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("Dyelot", Dyelot_);
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
|
||||
WorkOrder_DAT.Clear();
|
||||
}
|
||||
if (!String.IsNullOrEmpty(comboBoxDyelot.Text))//料单信息
|
||||
{
|
||||
for (int x = 0; x < DyelotsBulkedRecipe.Rows.Count; x++)
|
||||
{
|
||||
WorkOrder_DAT.Add("WorkOrder", comboBoxWorkOrder.Text);
|
||||
WorkOrder_DAT.Add("Dyelot", DyelotsBulkedRecipe.Rows[x]["Dyelot"]);
|
||||
WorkOrder_DAT.Add("Redye", DyelotsBulkedRecipe.Rows[x]["Redye"]);
|
||||
WorkOrder_DAT.Add("Step", DyelotsBulkedRecipe.Rows[x]["StepNumber"]);
|
||||
WorkOrder_DAT.Add("TIME", DyelotsBulkedRecipe.Rows[x]["Created"]);
|
||||
WorkOrder_DAT.Add("Tank", DyelotsBulkedRecipe.Rows[x]["TankNo"]);
|
||||
WorkOrder_DAT.Add("State", DyelotsBulkedRecipe.Rows[x]["DispenseResult"]);
|
||||
WorkOrder_DAT.Add("Machine", comboBoxMachine.Text);
|
||||
WorkOrder_DAT.Add("ProductCode", DyelotsBulkedRecipe.Rows[x]["ProductCode"]);
|
||||
WorkOrder_DAT.Add("ProductName", DyelotsBulkedRecipe.Rows[x]["ProductName"]);
|
||||
WorkOrder_DAT.Add("ProductType", DyelotsBulkedRecipe.Rows[x]["ProductType"]);
|
||||
WorkOrder_DAT.Add("Grams", DyelotsBulkedRecipe.Rows[x]["Grams"]);
|
||||
WorkOrder_DAT.Add("Amount", DyelotsBulkedRecipe.Rows[x]["Amount"]);
|
||||
WorkOrder_DAT.Add("DispenseStartTime", DyelotsBulkedRecipe.Rows[x]["DispenseStartTime"]);
|
||||
WorkOrder_DAT.Add("DispenseEndTime", DyelotsBulkedRecipe.Rows[x]["DispenseEndTime"]);
|
||||
WorkOrder_DAT.Add("DispenseGrams", DyelotsBulkedRecipe.Rows[x]["DispenseGrams"]);
|
||||
WorkOrder_DAT.Add("Dispense", DyelotsBulkedRecipe.Rows[x]["Dispenser"]);
|
||||
WorkOrder_DAT.Add("UserAccount", DyelotsBulkedRecipe.Rows[x]["UserAccount"]);
|
||||
MainWindowViewModel.SQLiteHelpers.InsertData("Dyelot", WorkOrder_DAT);//行插入
|
||||
WorkOrder_DAT.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
LogGing.ExchangeDATA("Dyelot=" + comboBoxWorkOrder.Text + ";Machine=" + comboBoxMachine.Text +
|
||||
";Program=" + comboBoxProgram.Text + ";User=" + TEXTUSER.Text + ";");
|
||||
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
ProductionPlanningView.UI = true;
|
||||
}
|
||||
private void Button_Quit(object sender, RoutedEventArgs e)//退出
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
public void DatSteps(DataTable db)//行号刷新
|
||||
{
|
||||
int a = db.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
DataRow dr = db.Rows[i];
|
||||
dr.BeginEdit();
|
||||
dr["Step"] = i + 1;
|
||||
dr.EndEdit();
|
||||
}
|
||||
}
|
||||
private void comboBoxProgram_DropDownClosed(object sender, EventArgs e)//工艺选择事件
|
||||
{
|
||||
if (!string.IsNullOrEmpty(comboBoxProgram.Text))
|
||||
{
|
||||
dat.Clear();
|
||||
dat = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
|
||||
"select * from ProgramSteps where Program='" + comboBoxProgram.SelectedValue + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
|
||||
DatSteps(dat);
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
}
|
||||
}
|
||||
private void comboBoxProgram_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
dat.Clear();
|
||||
string text = comboBoxProgram.Text;
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase);
|
||||
/* if (!string.IsNullOrEmpty(WorkOrder_n))
|
||||
{
|
||||
dat = SQLiteHelpers.ExecuteDataSet(
|
||||
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_n + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
|
||||
}//插入工单不为空时载入细节信息*/
|
||||
for (int i = 0; i < sArray.Length; i++)
|
||||
{
|
||||
DataTable temp = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
|
||||
"select * from ProgramSteps where Program='" + sArray[i] + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
|
||||
if (dat.Columns.Count == 0) dat = temp.Clone();
|
||||
foreach (DataRow drT in temp.Rows)
|
||||
{
|
||||
dat.Rows.Add(drT.ItemArray);
|
||||
}
|
||||
}//以工艺名组合工艺细节
|
||||
|
||||
DatSteps(dat);
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
|
||||
TEMP();
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
}//工艺修改事件
|
||||
private void MenuItem_edit(object sender, RoutedEventArgs e)
|
||||
{
|
||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
ID = (Grid_data.Columns[2].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
Numder = (Grid_data.Columns[3].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
P1 = (Grid_data.Columns[6].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第6列,
|
||||
P2 = (Grid_data.Columns[7].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第7列,
|
||||
P3 = (Grid_data.Columns[8].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第8列,
|
||||
P4 = (Grid_data.Columns[9].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第9列,
|
||||
P5 = (Grid_data.Columns[10].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第10列,
|
||||
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = dat.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void MenuItem_Insert(object sender, RoutedEventArgs e)//右键插入
|
||||
{
|
||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
ID = (Grid_data.Columns[2].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位列,
|
||||
|
||||
int d = 0;
|
||||
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
||||
string ProgramID = dat.Select().First().Field<string>("ProgramID").ToString();
|
||||
string ProgramNAME = dat.Select().First().Field<string>("Program").ToString();
|
||||
DataRow dr = dat.NewRow();//添加表数据
|
||||
dr["ProgramID"] = ProgramID;
|
||||
dr["Program"] = ProgramNAME;
|
||||
dat.Rows.InsertAt(dr, d - 1);
|
||||
|
||||
DatSteps(dat);
|
||||
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();
|
||||
ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void MenuItem_Delete(object sender, RoutedEventArgs e)//右键删除
|
||||
{
|
||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
ID = (Grid_data.Columns[2].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
dat.Rows.RemoveAt( Convert.ToInt32(ID)-1);
|
||||
|
||||
DatSteps(dat);
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
}
|
||||
}
|
||||
private void Grid_data_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
ID = (Grid_data.Columns[2].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
Numder = (Grid_data.Columns[3].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
P1 = (Grid_data.Columns[6].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第6列,
|
||||
P2 = (Grid_data.Columns[7].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第7列,
|
||||
P3 = (Grid_data.Columns[8].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第8列,
|
||||
P4 = (Grid_data.Columns[9].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第9列,
|
||||
P5 = (Grid_data.Columns[10].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第10列,
|
||||
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = dat.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||
{
|
||||
int n = Convert.ToInt16(ID);
|
||||
ID = null;
|
||||
if (e.PNAME != "")
|
||||
{
|
||||
DataRow dr = dat.Rows[n - 1];
|
||||
dr.BeginEdit();
|
||||
dr["StepID"] = e.StepID;
|
||||
dr["StepName"] = e.StepNAME;
|
||||
dr["ParameterName"] = e.PNAME;
|
||||
dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
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();
|
||||
Grid_data.SelectedIndex = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindowViewModel.dt_TP.Rows.RemoveAt(n - 1);
|
||||
DatSteps(dat);
|
||||
Grid_data.SelectedIndex = -1;
|
||||
}
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
}
|
||||
private void TEMP()
|
||||
{
|
||||
//处理计划温度图表
|
||||
TEMPTable.Clear();
|
||||
|
||||
string TIMET = "00:00:00";
|
||||
Double MSTT = 30.0;
|
||||
Double TT;
|
||||
Double TC;
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
for (int i = 0; i < dat.Rows.Count; i++)
|
||||
{
|
||||
switch (dat.Rows[i].Field<string>("StepID"))//步骤用时计算
|
||||
{
|
||||
case "001":
|
||||
TT = MSTT;
|
||||
TC = dat.Rows[i].Field<double>("Parameter2");
|
||||
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
|
||||
MSTT = dat.Rows[i].Field<double>("Parameter1");
|
||||
TT = Math.Abs(MSTT - TT) / TC * 60;
|
||||
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "007":
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "008":
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "013":
|
||||
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 });
|
||||
break;
|
||||
case "015":
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "017":
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "020":
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "022":
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "031":
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "065":
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "091":
|
||||
TT = MSTT;
|
||||
TC = (Double)dat.Rows[i][7];
|
||||
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
|
||||
MSTT = (Double)dat.Rows[i][6];
|
||||
TT = Math.Abs(MSTT - TT) / TC * 60;
|
||||
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
case "093":
|
||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
|
||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
Picture.Content = new View.CurveTemp(TEMPTable);
|
||||
} //计划温度图表
|
||||
private async void comboBoxWorkOrder_KeyDown(object sender, KeyEventArgs e)//工单输入
|
||||
{
|
||||
if (e.Key == Key.Enter && MainWindowViewModel.DyelotsDispenser)
|
||||
{
|
||||
int dat_c = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where WorkOrder = '" + comboBoxWorkOrder.Text + "'", null).Tables[0].Rows.Count;//缓存
|
||||
|
||||
if (dat_c > 0)//查询料单是否可用
|
||||
{
|
||||
comboBoxWorkOrder.Text = null;
|
||||
MessageBox.Show(Properties.Resources.TTAE, "WorkOrder", MessageBoxButton.OK, MessageBoxImage.Information); //连接成功提示是否保存
|
||||
return;
|
||||
}
|
||||
|
||||
string Connstr_SC;
|
||||
string DYELOTS_sql = "SELECT * FROM [dbo].[DYELOTS] WHERE Dyelot = '" + comboBoxWorkOrder.Text + "'";//单号查询语句
|
||||
string DyelotsBulkedRecipe_sql = "SELECT * FROM [dbo].[DyelotsBulkedRecipe] WHERE Dyelot = '" + comboBoxWorkOrder.Text + "'";
|
||||
try
|
||||
{
|
||||
if (MainWindowViewModel.SQMOD == "Windows Authentication")
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
|
||||
}
|
||||
else
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
|
||||
}
|
||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||
await conn_SC.OpenAsync(); //连接数据库
|
||||
SqlDataAdapter DYELOTS_data = new SqlDataAdapter(DYELOTS_sql, Connstr_SC); //查询
|
||||
SqlDataAdapter DyelotsBulkedRecipe_ = new SqlDataAdapter(DyelotsBulkedRecipe_sql, Connstr_SC);
|
||||
conn_SC.Close();
|
||||
DyelotsBulkedRecipe_.Fill(DyelotsBulkedRecipe);
|
||||
|
||||
DataTable ds = new DataTable();//载入信息
|
||||
DYELOTS_data.Fill(ds);
|
||||
TEXTColorNumber.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorNo")).First();
|
||||
TEXTColorName.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorName")).First();
|
||||
TEXTClient.Text = ds.AsEnumerable().Select(row => row.Field<string>("CustomerName")).First();
|
||||
TEXTClothSpecies.Text = ds.AsEnumerable().Select(row => row.Field<string>("FabricName")).First();
|
||||
TEXTClothWeight.Text = ds.AsEnumerable().Select(row => row.Field<Double>("TotalWeight")).First().ToString();
|
||||
TEXTBathRatio.Text = ds.AsEnumerable().Select(row => row.Field<string>("LiquidRatio")).First();
|
||||
TEXTTotal.Text = ds.AsEnumerable().Select(row => row.Field<string>("TotalVolume")).First();
|
||||
comboBoxDyelot.Text = ds.AsEnumerable().Select(row => row.Field<string>("Dyelot")).First();
|
||||
|
||||
string machine_ = ds.AsEnumerable().Select(row => row.Field<string>("Machine")).First();//机台
|
||||
if (MainWindowViewModel.Machines.Select("Name ='"+machine_+"'").Length == 0)
|
||||
{
|
||||
comboBoxMachine.Text = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBoxMachine.Text = machine_;
|
||||
}
|
||||
string user_ = ds.AsEnumerable().Select(row => row.Field<string>("UserAccount")).First();//用户名
|
||||
if (!String.IsNullOrEmpty(user_)) TEXTUSER.Text = user_;
|
||||
comboBoxProgram.Text = ds.AsEnumerable().Select(row => row.Field<string>("Program")).First();
|
||||
|
||||
if (ds.AsEnumerable().Select(row => row.Field<int>("color")).First() > 0)//颜色
|
||||
{
|
||||
string colorValue = string.Format("{0:X6}", ds.AsEnumerable().Select(row => row.Field<int>("color")).First());//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0”
|
||||
color.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(
|
||||
"#FF" + colorValue.Substring(4, 2) + colorValue.Substring(2, 2) + colorValue.Substring(0, 2)));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async void comboBoxDyelot_KeyDown(object sender, KeyEventArgs e)//料单输入
|
||||
{
|
||||
if (e.Key == Key.Enter && MainWindowViewModel.DyelotsDispenser)
|
||||
{
|
||||
string Connstr_SC;
|
||||
string DYELOTS_sql = "SELECT * FROM [dbo].[DYELOTS] WHERE Dyelot = '" + comboBoxDyelot.Text + "'";//单号查询语句
|
||||
try
|
||||
{
|
||||
int dat_c = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot = '" + comboBoxDyelot.Text + "'", null).Tables[0].Rows.Count;//缓存
|
||||
|
||||
if (dat_c > 0)//查询料单是否可用
|
||||
{
|
||||
comboBoxDyelot.Text = null;
|
||||
MessageBox.Show(Properties.Resources.TPLHBU, "Dyelot", MessageBoxButton.OK, MessageBoxImage.Information); //连接成功提示是否保存
|
||||
return;
|
||||
}
|
||||
|
||||
if (MainWindowViewModel.SQMOD == "Windows Authentication")
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
|
||||
}
|
||||
else
|
||||
{
|
||||
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
|
||||
}
|
||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||
await conn_SC.OpenAsync(); //连接数据库
|
||||
SqlDataAdapter DYELOTS_data = new SqlDataAdapter(DYELOTS_sql, Connstr_SC); //查询
|
||||
conn_SC.Close();
|
||||
|
||||
DataTable ds = new DataTable();//载入信息
|
||||
DYELOTS_data.Fill(ds);
|
||||
TEXTColorNumber.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorNo")).First();
|
||||
TEXTColorName.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorName")).First();
|
||||
TEXTClient.Text = ds.AsEnumerable().Select(row => row.Field<string>("CustomerName")).First();
|
||||
TEXTClothSpecies.Text = ds.AsEnumerable().Select(row => row.Field<string>("FabricName")).First();
|
||||
TEXTClothWeight.Text = ds.AsEnumerable().Select(row => row.Field<Double>("TotalWeight")).First().ToString();
|
||||
TEXTBathRatio.Text = ds.AsEnumerable().Select(row => row.Field<string>("LiquidRatio")).First();
|
||||
TEXTTotal.Text = ds.AsEnumerable().Select(row => row.Field<string>("TotalVolume")).First();
|
||||
// comboBoxDyelot.Text = ds.AsEnumerable().Select(row => row.Field<string>("Dyelot")).First();
|
||||
|
||||
string machine_ = ds.AsEnumerable().Select(row => row.Field<string>("Machine")).First();//机台
|
||||
if (MainWindowViewModel.Machines.Select("Name ='" + machine_ + "'").Length == 0)
|
||||
{
|
||||
comboBoxMachine.Text = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBoxMachine.Text = machine_;
|
||||
}
|
||||
string user_ = ds.AsEnumerable().Select(row => row.Field<string>("UserAccount")).First();//用户名
|
||||
if (!String.IsNullOrEmpty(user_)) TEXTUSER.Text = user_;
|
||||
comboBoxProgram.Text = ds.AsEnumerable().Select(row => row.Field<string>("Program")).First();
|
||||
|
||||
if (ds.AsEnumerable().Select(row => row.Field<int>("color")).First() > 0)//颜色
|
||||
{
|
||||
string colorValue = string.Format("{0:X6}", ds.AsEnumerable().Select(row => row.Field<int>("color")).First());//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0”
|
||||
color.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(
|
||||
"#FF" + colorValue.Substring(4, 2) + colorValue.Substring(2, 2) + colorValue.Substring(0, 2)));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogGing.ERRDATA(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void Tb_KeyTEXTClothWeight(object sender, TextCompositionEventArgs e)//输入事件
|
||||
{
|
||||
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
||||
e.Handled =
|
||||
!numbeRegex.IsMatch(
|
||||
TEXTClothWeight.Text.Insert(
|
||||
TEXTClothWeight.SelectionStart, e.Text));
|
||||
TEXTClothWeight.Text = TEXTClothWeight.Text.Trim();
|
||||
}
|
||||
private void Tb_KeyTEXTBathRatio(object sender, TextCompositionEventArgs e)//输入事件
|
||||
{
|
||||
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
||||
e.Handled =
|
||||
!numbeRegex.IsMatch(
|
||||
TEXTBathRatio.Text.Insert(
|
||||
TEXTBathRatio.SelectionStart, e.Text));
|
||||
TEXTBathRatio.Text = TEXTBathRatio.Text.Trim();
|
||||
}
|
||||
private void Tb_KeyTEXTTotal(object sender, TextCompositionEventArgs e)//输入事件
|
||||
{
|
||||
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
||||
e.Handled =
|
||||
!numbeRegex.IsMatch(
|
||||
TEXTTotal.Text.Insert(
|
||||
TEXTTotal.SelectionStart, e.Text));
|
||||
TEXTTotal.Text = TEXTTotal.Text.Trim();
|
||||
}
|
||||
private void color_color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//颜色
|
||||
{
|
||||
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();//使用调色盘控件ColorDialog
|
||||
if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)//打开调色盘
|
||||
{
|
||||
|
||||
System.Drawing.Color DColor = colorDialog.Color;////获取选中色彩信息
|
||||
//System.Windows.Media.Color MColor = new System.Windows.Media.Color();//转换
|
||||
System.Windows.Media.Color MColor = System.Windows.Media.Color.FromArgb(DColor.A, DColor.R, DColor.G, DColor.B);//转换并配置ARGB参数
|
||||
color.Background = new SolidColorBrush(MColor);//ARGB参数输出至Color的背景色
|
||||
//string colorCode = string.Format("{0:X2}", DColor.B) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.R);//反向十六进制RGB
|
||||
//string colorCode = string.Format("{0:X2}", DColor.R) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.B);//正向十六进制RGB
|
||||
//ColorCode_SQL = Convert.ToInt32(colorCode, 16);//十六进制RGB转存储数值
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.DyelotView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
|
||||
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
||||
mc:Ignorable="d" Loaded="UserControl_Loaded"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<ConvertMoels:StatenConvert x:Key="StatenConvert"/>
|
||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
|
||||
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||
Margin="0,0,0,0" BorderBrush="#FFC9C9C9" FontSize="16" BorderThickness="5,5,5,5" >
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="25" />
|
||||
<Setter Property="FontSize" Value="15" />
|
||||
<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.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="80" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.ProductCode}" Width="150" Binding="{Binding ProductCode}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.ProductName}" Width="150" Binding="{Binding ProductName}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.ProductType}" Width="100" Binding="{Binding ProductType}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.State}" Width="80" Binding="{Binding Path=State,Converter={StaticResource StatenConvert}}" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Grams}" Width="150" Binding="{Binding Grams}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.DispenseGrams}" Width="150" Binding="{Binding Amount}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.DispenseEndTime}" Width="200" Binding="{Binding DispenseEndTime}" IsReadOnly="True"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,51 @@
|
||||
using DyeingComputer.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
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.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Whole.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DyelotView : UserControl
|
||||
{
|
||||
public DyelotView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
public void Dyelot(object dat)
|
||||
{
|
||||
DataTable dat_c = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where WorkOrder = '" + dat + "'", null).Tables[0];//缓存
|
||||
|
||||
Grid_data.ItemsSource = dat_c.DefaultView;
|
||||
}
|
||||
public void DyelotDatatable(DataTable dat)
|
||||
{
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,24 +8,31 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="630" d:DesignWidth="1280" VerticalAlignment="Top">
|
||||
<Grid>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxCOM0" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" />
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxCOM0" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged0" FontSize="16" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Port}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="comboBoxCOM1" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20"/>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,90,0,0" x:Name="comboBoxCOM2" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20"/>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,130,0,0" x:Name="comboBoxLanguage" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxLanguage_SelectionChanged" FontSize="20"/>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="comboBoxCOM1" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged1" FontSize="16"/>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,90,0,0" x:Name="comboBoxCOM2" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged2" FontSize="16"/>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,130,0,0" x:Name="comboBoxLanguage" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxLanguage_SelectionChanged" FontSize="16"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Language}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,170,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.SERVER}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,210,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Mode}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,250,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.SQL}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,290,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,330,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Password}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox x:Name="TEXT_SQLIP" HorizontalAlignment="Left" Height="40" Margin="150,170,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="20"/>
|
||||
<TextBox x:Name="TEXT_SQLIP" HorizontalAlignment="Left" Height="40" Margin="150,170,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
|
||||
<ComboBox x:Name="TEXT_SQMOD" Height="40" Margin="150,210,0,0" VerticalAlignment="Top" Width="200" FontSize="16" HorizontalAlignment="Left"/>
|
||||
<TextBox x:Name="TEXT_SQLNAME" HorizontalAlignment="Left" Height="40" Margin="150,250,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="20"/>
|
||||
<TextBox x:Name="TEXT_SQLUSER" HorizontalAlignment="Left" Height="40" Margin="150,290,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="20"/>
|
||||
<TextBox x:Name="TEXT_SQLPASWORD" HorizontalAlignment="Left" Height="40" Margin="150,330,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="20"/>
|
||||
<TextBox x:Name="TEXT_SQLNAME" HorizontalAlignment="Left" Height="40" Margin="150,250,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
|
||||
<TextBox x:Name="TEXT_SQLUSER" HorizontalAlignment="Left" Height="40" Margin="150,290,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
|
||||
<TextBox x:Name="TEXT_SQLPASWORD" HorizontalAlignment="Left" Height="40" Margin="150,330,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
|
||||
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="270,375,0,0" VerticalAlignment="Top" Width="80" Click="Test_Click"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,375,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/>
|
||||
<CheckBox x:Name="dDispenser" Content="{x:Static lang:Resources.LinkDispenser}" HorizontalAlignment="Left" Height="35 " Margin="410,10,0,0" VerticalAlignment="Top" Width="200"
|
||||
Checked="dDispenser_Checked" Unchecked="dDispenser_Checked" FontSize="20"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,450,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Speed}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox x:Name="VOICE_V1" HorizontalAlignment="Left" Height="40" Margin="150,450,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,490,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Vol}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox x:Name="VOICE_V2" HorizontalAlignment="Left" Height="40" Margin="150,490,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
|
||||
<Button Content="{x:Static lang:Resources.VOICE}" HorizontalAlignment="Left" Height="35" Margin="270,535,0,0" VerticalAlignment="Top" Width="80" Click="VOICE_Click"/>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||