Compare commits
72
Commits
d85d458edb
...
master
| 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 |
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -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
|
||||||
+5
-3
@@ -1,4 +1,5 @@
|
|||||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
@@ -82,9 +83,10 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show(Properties.Resources.NPERR, "SCCM", MessageBoxButton.OK, MessageBoxImage.Error);
|
LogGing.ERRDATA(ex);
|
||||||
|
System.Windows.MessageBox.Show("Unable to start. Check the log for details.", "SCCM", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
|||||||
{
|
{
|
||||||
public static string user_;
|
public static string user_;
|
||||||
public static DataTable InfData = new DataTable();
|
public static DataTable InfData = new DataTable();
|
||||||
|
// public static string[] Inf_string ;
|
||||||
public UserInformation userInformation;
|
public UserInformation userInformation;
|
||||||
|
// public UserInf userInf;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
@@ -74,6 +76,22 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
|||||||
if (userInformation.WindowState == WindowState.Minimized) userInformation.WindowState = WindowState.Normal;
|
if (userInformation.WindowState == WindowState.Minimized) userInformation.WindowState = WindowState.Normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* private void UserInfTable(string dat)//触发行改变事件
|
||||||
|
{
|
||||||
|
userInf.Inf_DAT = dat;
|
||||||
|
if (userInf == null || !userInf.IsLoaded)//窗口不存在及创建
|
||||||
|
{
|
||||||
|
userInf = new UserInf();
|
||||||
|
userInf.Topmost = true;
|
||||||
|
userInf.Show();
|
||||||
|
userInf.Activate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//窗口纯在及置顶
|
||||||
|
userInf.Activate();
|
||||||
|
if (userInf.WindowState == WindowState.Minimized) userInf.WindowState = WindowState.Normal;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e)
|
private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
Generated
+28
-1
@@ -19,7 +19,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
|
|||||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
public class Resources {
|
public class Resources {
|
||||||
@@ -1284,6 +1284,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Machines 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string Machines {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Machines", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Malfunction 的本地化字符串。
|
/// 查找类似 Malfunction 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -2004,6 +2013,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 ProgramName 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string ProgramName {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProgramName", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 ProportionalValves 的本地化字符串。
|
/// 查找类似 ProportionalValves 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -2400,6 +2418,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Start 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string Start {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Start", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 StartDate 的本地化字符串。
|
/// 查找类似 StartDate 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1083,4 +1083,13 @@
|
|||||||
<data name="Swing" xml:space="preserve">
|
<data name="Swing" xml:space="preserve">
|
||||||
<value>Swing</value>
|
<value>Swing</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Start" xml:space="preserve">
|
||||||
|
<value>Start</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProgramName" xml:space="preserve">
|
||||||
|
<value>Program Name</value>
|
||||||
|
</data>
|
||||||
|
<data name="Machines" xml:space="preserve">
|
||||||
|
<value>Machines</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -1083,4 +1083,13 @@
|
|||||||
<data name="Swing" xml:space="preserve">
|
<data name="Swing" xml:space="preserve">
|
||||||
<value>Swing</value>
|
<value>Swing</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Start" xml:space="preserve">
|
||||||
|
<value>Start</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProgramName" xml:space="preserve">
|
||||||
|
<value>ProgramName</value>
|
||||||
|
</data>
|
||||||
|
<data name="Machines" xml:space="preserve">
|
||||||
|
<value>Machines</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -1083,4 +1083,13 @@
|
|||||||
<data name="Swing" xml:space="preserve">
|
<data name="Swing" xml:space="preserve">
|
||||||
<value>摆布</value>
|
<value>摆布</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Start" xml:space="preserve">
|
||||||
|
<value>开始</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProgramName" xml:space="preserve">
|
||||||
|
<value>工艺名</value>
|
||||||
|
</data>
|
||||||
|
<data name="Machines" xml:space="preserve">
|
||||||
|
<value>机台</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -1080,11 +1080,16 @@
|
|||||||
<data name="_Auto" xml:space="preserve">
|
<data name="_Auto" xml:space="preserve">
|
||||||
<value>手/自動</value>
|
<value>手/自動</value>
|
||||||
</data>
|
</data>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="Swing" type="System.Resources.ResXNullRef, System.Windows.Forms">
|
|
||||||
<value />
|
|
||||||
</data>
|
|
||||||
<data name="Swing" xml:space="preserve">
|
<data name="Swing" xml:space="preserve">
|
||||||
<value>擺佈</value>
|
<value>擺佈</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Start" xml:space="preserve">
|
||||||
|
<value>開始</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProgramName" xml:space="preserve">
|
||||||
|
<value>工藝名</value>
|
||||||
|
</data>
|
||||||
|
<data name="Machines" xml:space="preserve">
|
||||||
|
<value>機器</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -77,6 +77,9 @@
|
|||||||
<Prefer32Bit>true</Prefer32Bit>
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="SkiaSharp">
|
||||||
|
<HintPath>bin\Debug\SkiaSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
@@ -132,6 +135,7 @@
|
|||||||
<Compile Include="UserClass\CSV.cs" />
|
<Compile Include="UserClass\CSV.cs" />
|
||||||
<Compile Include="UserClass\DataGridHelper.cs" />
|
<Compile Include="UserClass\DataGridHelper.cs" />
|
||||||
<Compile Include="UserClass\DataTableForToObservableCollection.cs" />
|
<Compile Include="UserClass\DataTableForToObservableCollection.cs" />
|
||||||
|
<Compile Include="UserClass\DataTableManager .cs" />
|
||||||
<Compile Include="UserClass\get_local_ip_address.cs" />
|
<Compile Include="UserClass\get_local_ip_address.cs" />
|
||||||
<Compile Include="UserClass\HardwareSN.cs" />
|
<Compile Include="UserClass\HardwareSN.cs" />
|
||||||
<Compile Include="UserClass\IniFile.cs" />
|
<Compile Include="UserClass\IniFile.cs" />
|
||||||
@@ -150,6 +154,12 @@
|
|||||||
<Compile Include="UserControls\DispenseMacInfo.xaml.cs">
|
<Compile Include="UserControls\DispenseMacInfo.xaml.cs">
|
||||||
<DependentUpon>DispenseMacInfo.xaml</DependentUpon>
|
<DependentUpon>DispenseMacInfo.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="WindowsView\UserWorkOrder.xaml.cs">
|
||||||
|
<DependentUpon>UserWorkOrder.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WindowsView\UserInf.xaml.cs">
|
||||||
|
<DependentUpon>UserInf.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="WindowsView\UserInformation.xaml.cs">
|
<Compile Include="WindowsView\UserInformation.xaml.cs">
|
||||||
<DependentUpon>UserInformation.xaml</DependentUpon>
|
<DependentUpon>UserInformation.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -289,6 +299,14 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="WindowsView\UserWorkOrder.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WindowsView\UserInf.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="WindowsView\UserInformation.xaml">
|
<Page Include="WindowsView\UserInformation.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -525,6 +543,11 @@
|
|||||||
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
|
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
|
||||||
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
|
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
|
||||||
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
||||||
|
<Resource Include="lmage\IconParkExtend.png" />
|
||||||
|
<Resource Include="lmage\IconParkExtendR.png" />
|
||||||
|
<Resource Include="lmage\IconParkExtendY.png" />
|
||||||
|
<Resource Include="lmage\IconParkInfo.png" />
|
||||||
|
<Resource Include="lmage\IconParkUsbOne.png" />
|
||||||
<Resource Include="lmage\00.png" />
|
<Resource Include="lmage\00.png" />
|
||||||
<Resource Include="lmage\1000-1.png" />
|
<Resource Include="lmage\1000-1.png" />
|
||||||
<Resource Include="lmage\1000-2.png" />
|
<Resource Include="lmage\1000-2.png" />
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -59,30 +60,34 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
|
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
|
||||||
portclient.Received = (client, e) =>
|
portclient.Received = (client, e) =>
|
||||||
{
|
{
|
||||||
|
//接受重置事件状态
|
||||||
_responseEvent.Set();
|
_responseEvent.Set();
|
||||||
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
||||||
@"\n", RegexOptions.IgnoreCase);
|
@"\n", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
for (int i = 0; i < sArray.Length; i++)
|
for (int i = 0; i < sArray.Length; i++)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(sArray[i]))
|
if (sArray[i].Length > 5)
|
||||||
{
|
{
|
||||||
string SYSAPI = sArray[i].Substring(0, 5);
|
string SYSAPI = sArray[i].Substring(0, 5);
|
||||||
string Station = ClipBetween(sArray[i], '[', ']');
|
string Station = ClipBetween(sArray[i], '[', ']');
|
||||||
string DAT = sArray[i].Substring(sArray[i].IndexOf("]") + 1);
|
string DAT = sArray[i].Substring(sArray[i].IndexOf("]") + 1);
|
||||||
|
|
||||||
if (SYSAPI == "SC800")
|
if (SYSAPI == "SC800")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
||||||
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
Station + "' AND Serial = 'PORT1'").First();
|
{
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" + Station + "' AND Serial = 'PORT1'").First();
|
||||||
drEmployee.BeginEdit();
|
drEmployee.BeginEdit();
|
||||||
drEmployee["State"] = "802";
|
drEmployee["State"] = "802";
|
||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||||
@@ -92,32 +97,50 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
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 } },
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
|
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
|
||||||
}
|
}
|
||||||
}
|
}//回复的工单记录状态后就位111
|
||||||
else if (SYSAPI == "SC811")
|
else if (SYSAPI == "SC811")
|
||||||
{
|
{
|
||||||
try
|
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 } },
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}//回复的工单明细状态后就位113
|
||||||
else if (SYSAPI == "SC812")
|
else if (SYSAPI == "SC812")
|
||||||
{
|
{
|
||||||
try
|
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 } },
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}//回复的工单设置状态后就位101
|
||||||
else if (SYSAPI == "SC827")
|
else if (SYSAPI == "SC827")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -129,36 +152,39 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// return EasyTask.CompletedTask; ;
|
|
||||||
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
||||||
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
|
string mac;
|
||||||
Station + "' AND Serial = 'PORT1'").First();
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
|
{
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" + Station + "' AND Serial = 'PORT1'").First();
|
||||||
|
mac = drEmployee["Name"].ToString();
|
||||||
drEmployee.BeginEdit();
|
drEmployee.BeginEdit();
|
||||||
drEmployee["ERR"] = _new.GetValue("ERR");
|
drEmployee["ERR"] = _new.GetValue("ERR");
|
||||||
drEmployee["LOCK"] = _new.GetValue("LOCK");
|
drEmployee["LOCK"] = _new.GetValue("LOCK");
|
||||||
drEmployee["Message"] = _new.GetValue("Status");
|
drEmployee["Message"] = _new.GetValue("Status");
|
||||||
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder");
|
drEmployee["WorkOrder"] = _new.GetValue("Work");
|
||||||
drEmployee["Temperature"] = _new.GetValue("MTT");
|
drEmployee["Temperature"] = _new.GetValue("MTT");
|
||||||
drEmployee["WaterLevel"] = _new.GetValue("MTL");
|
drEmployee["WaterLevel"] = _new.GetValue("MTL");
|
||||||
drEmployee["Process"] = _new.GetValue("Process");
|
drEmployee["Process"] = _new.GetValue("Process");
|
||||||
drEmployee["Step"] = _new.GetValue("Step");
|
drEmployee["Step"] = _new.GetValue("Step");
|
||||||
drEmployee["UserButton"] = _new.GetValue("UserButton");
|
drEmployee["UserButton"] = _new.GetValue("UserB");
|
||||||
if (_new.GetValue("UserInfoStart").ToString() != "900")
|
if (_new.GetValue("InfoS").ToString() != "900")
|
||||||
{ drEmployee["UserInfoStart"] = _new.GetValue("UserInfoStart"); }
|
{ drEmployee["UserInfoStart"] = _new.GetValue("InfoS"); }
|
||||||
drEmployee["UserInfo"] = _new.GetValue("UserInfo");
|
drEmployee["UserInfo"] = _new.GetValue("Info");
|
||||||
drEmployee["WORK_RUN"] = _new.GetValue("WORK_RUN");
|
drEmployee["WORK_RUN"] = _new.GetValue("RUN");
|
||||||
drEmployee["RUN_STEPID"] = _new.GetValue("RUN_STEPID");
|
drEmployee["RUN_STEPID"] = _new.GetValue("STEPID");
|
||||||
drEmployee["CALL"] = _new.GetValue("CALL");
|
drEmployee["CALL"] = _new.GetValue("CALL");
|
||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
|
}
|
||||||
|
|
||||||
if (_new.GetValue("Status").ToString() != "----------")
|
if (_new.GetValue("Status").ToString() != "----------")
|
||||||
{
|
{
|
||||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||||
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
|
Chart_new.Add("WorkOrder", _new.GetValue("Work"));
|
||||||
Chart_new.Add("Machine", _new.GetValue("Machine"));
|
//Chart_new.Add("Machine", mac);
|
||||||
Chart_new.Add("Time", _new.GetValue("Time"));
|
//Chart_new.Add("Time", _new.GetValue("Time"));
|
||||||
Chart_new.Add("MST", _new.GetValue("MST"));
|
Chart_new.Add("MST", _new.GetValue("MST"));
|
||||||
Chart_new.Add("MTT", _new.GetValue("MTT"));
|
Chart_new.Add("MTT", _new.GetValue("MTT"));
|
||||||
Chart_new.Add("MTL", _new.GetValue("MTL"));
|
Chart_new.Add("MTL", _new.GetValue("MTL"));
|
||||||
@@ -174,7 +200,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
MainWindowViewModel.SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
|
MainWindowViewModel.SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
|
||||||
|
}
|
||||||
}//当前信息
|
}//当前信息
|
||||||
else if (SYSAPI == "SC831")
|
else if (SYSAPI == "SC831")
|
||||||
{
|
{
|
||||||
@@ -236,6 +265,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//系统设置表
|
}//系统设置表
|
||||||
|
else if (SYSAPI == "SC859")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
|
}//信息
|
||||||
else if (SYSAPI == "SC910")
|
else if (SYSAPI == "SC910")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -262,6 +299,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
return EasyTask.CompletedTask; ;
|
return EasyTask.CompletedTask; ;
|
||||||
};
|
};
|
||||||
await portclient.SetupAsync(new TouchSocketConfig()
|
await portclient.SetupAsync(new TouchSocketConfig()
|
||||||
|
.SetMaxBufferSize(1024 * 1024 * 10)
|
||||||
.SetSerialPortOption(new SerialPortOption()
|
.SetSerialPortOption(new SerialPortOption()
|
||||||
{
|
{
|
||||||
BaudRate = BAUD,//波特率
|
BaudRate = BAUD,//波特率
|
||||||
@@ -274,7 +312,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
//a.Add<MyPlugin>();
|
//a.Add<MyPlugin>();
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await portclient.ConnectAsync();
|
await portclient.ConnectAsync();
|
||||||
@@ -368,8 +407,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
||||||
@"\n", RegexOptions.IgnoreCase);
|
@"\n", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return EasyTask.CompletedTask; ;
|
return EasyTask.CompletedTask; ;
|
||||||
};
|
};
|
||||||
await portclient.SetupAsync(new TouchSocketConfig()
|
await portclient.SetupAsync(new TouchSocketConfig()
|
||||||
@@ -381,7 +418,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
PortName = com,//COM
|
PortName = com,//COM
|
||||||
StopBits = System.IO.Ports.StopBits.One,//停止位
|
StopBits = System.IO.Ports.StopBits.One,//停止位
|
||||||
})
|
})
|
||||||
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) })
|
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(500) })
|
||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
//a.Add<MyPlugin>();
|
//a.Add<MyPlugin>();
|
||||||
@@ -406,12 +443,39 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var t = CRCcheck16.ToCRC16(command);
|
||||||
_responseEvent.Reset();
|
_responseEvent.Reset();
|
||||||
serialPortClients.Send(command); // 发送指令
|
serialPortClients.Send(command); // 发送指令
|
||||||
|
|
||||||
// 等待500毫秒或直到收到响应
|
// 等待500毫秒或直到收到响应
|
||||||
_responseEvent.Wait(TimeSpan.FromMilliseconds(1000));
|
if (!_responseEvent.Wait(TimeSpan.FromMilliseconds(1000)))
|
||||||
// 重置事件状态
|
{
|
||||||
_responseEvent.Set();
|
_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) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
|
|||||||
+90
-29
@@ -6,6 +6,7 @@ using ScottPlot.Colormaps;
|
|||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using SunlightCentralizedControlManagement_SCCM_.View;
|
using SunlightCentralizedControlManagement_SCCM_.View;
|
||||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -22,10 +23,11 @@ using System.Text;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Documents;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
using TouchSocket.Sockets;
|
|
||||||
using TouchSocket.SerialPorts;
|
using TouchSocket.SerialPorts;
|
||||||
|
using TouchSocket.Sockets;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.View.MachinesView;
|
using static SunlightCentralizedControlManagement_SCCM_.View.MachinesView;
|
||||||
using static System.Windows.Forms.AxHost;
|
using static System.Windows.Forms.AxHost;
|
||||||
@@ -46,13 +48,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
tcpClient.Connected = (client, e) =>
|
tcpClient.Connected = (client, e) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||||
drEmployee.BeginEdit();
|
drEmployee.BeginEdit();
|
||||||
drEmployee["State"] = "801";
|
drEmployee["State"] = "801";
|
||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
|
}
|
||||||
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_OK");
|
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_OK");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -65,6 +69,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
tcpClient.Closing = (client, e) =>
|
tcpClient.Closing = (client, e) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||||
drEmployee.BeginEdit();
|
drEmployee.BeginEdit();
|
||||||
@@ -72,7 +78,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
drEmployee["WorkOrder"] = "------";
|
drEmployee["WorkOrder"] = "------";
|
||||||
drEmployee["Dyelot"] = "";
|
drEmployee["Dyelot"] = "";
|
||||||
drEmployee["Temperature"] = 0.0;
|
drEmployee["Temperature"] = 0.0;
|
||||||
drEmployee["WaterLevel"] = "----";
|
drEmployee["WaterLevel"] = 0.0;
|
||||||
drEmployee["Process"] = "";
|
drEmployee["Process"] = "";
|
||||||
drEmployee["Step"] = "";
|
drEmployee["Step"] = "";
|
||||||
drEmployee["Message"] = "";
|
drEmployee["Message"] = "";
|
||||||
@@ -81,6 +87,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
drEmployee["ERR"] = false;
|
drEmployee["ERR"] = false;
|
||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
|
}
|
||||||
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP");
|
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -92,6 +99,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
tcpClient.Closed = (client, e) =>
|
tcpClient.Closed = (client, e) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||||
drEmployee.BeginEdit();
|
drEmployee.BeginEdit();
|
||||||
@@ -99,7 +108,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
drEmployee["WorkOrder"] = "------";
|
drEmployee["WorkOrder"] = "------";
|
||||||
drEmployee["Dyelot"] = "";
|
drEmployee["Dyelot"] = "";
|
||||||
drEmployee["Temperature"] = 0.0;
|
drEmployee["Temperature"] = 0.0;
|
||||||
drEmployee["WaterLevel"] = "----";
|
drEmployee["WaterLevel"] = 0.0;
|
||||||
drEmployee["Process"] = "";
|
drEmployee["Process"] = "";
|
||||||
drEmployee["Step"] = "";
|
drEmployee["Step"] = "";
|
||||||
drEmployee["Message"] = "";
|
drEmployee["Message"] = "";
|
||||||
@@ -108,6 +117,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
drEmployee["ERR"] = false;
|
drEmployee["ERR"] = false;
|
||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
|
}
|
||||||
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT");
|
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -128,6 +138,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||||
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
|
{
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||||
drEmployee.BeginEdit();
|
drEmployee.BeginEdit();
|
||||||
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
|
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
|
||||||
@@ -137,6 +149,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||||
@@ -147,8 +160,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
|
||||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
"WorkOrder ='" + DAT + "'", null);
|
||||||
|
// Dictionary<string, object> _dat;
|
||||||
|
// _dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
|
||||||
|
// MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||||
|
// "WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -160,8 +178,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
|
|
||||||
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
"WorkOrder ='" + DAT + "'", null);
|
||||||
|
// Dictionary<string, object> _dat;
|
||||||
|
// _dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
|
||||||
|
// MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
|
||||||
|
// "WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='"+ _dat.GetValue("ReDye") + "'", null);
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}
|
||||||
@@ -175,6 +198,33 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}
|
||||||
|
else if (SYSAPI == "SC822")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
|
||||||
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
UserWorkOrder userWorkOrder = new UserWorkOrder();
|
||||||
|
userWorkOrder.WorkOrderTable = dataTable;
|
||||||
|
userWorkOrder.Show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
UserInf userInf = new UserInf();
|
||||||
|
userInf.Inf_DAT = "没有等待中的工艺";
|
||||||
|
userInf.Show();
|
||||||
|
userInf.Activate();
|
||||||
|
});
|
||||||
|
|
||||||
|
// LogGing.LogGingDATA("[ERR='" + ex + "']=Exception");
|
||||||
|
MainWindowViewModel.ERR_c++;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (SYSAPI == "SC827")
|
else if (SYSAPI == "SC827")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -183,6 +233,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
|
||||||
foreach (DataRow sourceRow in dataTable.Rows)
|
foreach (DataRow sourceRow in dataTable.Rows)
|
||||||
|
{
|
||||||
|
lock (MainWindowViewModel.Dyelot_CALL.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
// 创建新行(基于目标表结构)
|
// 创建新行(基于目标表结构)
|
||||||
DataRow newRow = MainWindowViewModel.Dyelot_CALL.NewRow();
|
DataRow newRow = MainWindowViewModel.Dyelot_CALL.NewRow();
|
||||||
@@ -218,6 +270,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//获取呼叫领料单
|
}//获取呼叫领料单
|
||||||
else if (SYSAPI == "SC830")
|
else if (SYSAPI == "SC830")
|
||||||
@@ -227,7 +280,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
|
||||||
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||||
|
string mac;
|
||||||
|
// 首先确保 DataTable 使用线程安全的访问方式
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
|
{
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||||
|
mac = drEmployee["Name"].ToString();
|
||||||
drEmployee.BeginEdit();
|
drEmployee.BeginEdit();
|
||||||
drEmployee["ERR"] = _new.GetValue("ERR");
|
drEmployee["ERR"] = _new.GetValue("ERR");
|
||||||
drEmployee["LOCK"] = _new.GetValue("LOCK");
|
drEmployee["LOCK"] = _new.GetValue("LOCK");
|
||||||
@@ -246,13 +304,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
drEmployee["CALL"] = _new.GetValue("CALL");
|
drEmployee["CALL"] = _new.GetValue("CALL");
|
||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
|
}
|
||||||
if (_new.GetValue("Status").ToString() != "----------")
|
if (_new.GetValue("Status").ToString() != "----------")
|
||||||
{
|
{
|
||||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||||
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
|
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
|
||||||
Chart_new.Add("Machine", _new.GetValue("Machine"));
|
Chart_new.Add("Machine", mac);
|
||||||
Chart_new.Add("Time", _new.GetValue("Time"));
|
Chart_new.Add("Time", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||||
Chart_new.Add("MST", _new.GetValue("MST"));
|
Chart_new.Add("MST", _new.GetValue("MST"));
|
||||||
Chart_new.Add("MTT", _new.GetValue("MTT"));
|
Chart_new.Add("MTT", _new.GetValue("MTT"));
|
||||||
Chart_new.Add("MTL", _new.GetValue("MTL"));
|
Chart_new.Add("MTL", _new.GetValue("MTL"));
|
||||||
@@ -279,7 +337,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}//步骤信息
|
||||||
else if (SYSAPI == "SC832")
|
else if (SYSAPI == "SC832")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -343,6 +401,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//系统设置表
|
}//系统设置表
|
||||||
|
else if (SYSAPI == "SC859")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
MachinesView.LOG_dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
|
}//信息
|
||||||
else if (SYSAPI == "SC910")
|
else if (SYSAPI == "SC910")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -363,6 +430,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}//细节错误
|
}//细节错误
|
||||||
|
else if (SYSAPI == "SC921")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
}
|
||||||
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
|
}//错误
|
||||||
else if (SYSAPI == "SC980")
|
else if (SYSAPI == "SC980")
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
@@ -374,38 +449,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
|
|
||||||
//载入配置
|
//载入配置
|
||||||
await tcpClient.SetupAsync(new TouchSocketConfig()
|
await tcpClient.SetupAsync(new TouchSocketConfig()
|
||||||
.SetMaxBufferSize(1024*1024)
|
.SetMaxBufferSize(1024* 1024*100)
|
||||||
.SetMinBufferSize(1024*64)
|
.SetMinBufferSize(1024*1024)
|
||||||
.SetRemoteIPHost(ip + ":" + port)
|
.SetRemoteIPHost(ip + ":" + port)
|
||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
//触发型重连
|
|
||||||
// a.UseTcpReconnection();
|
|
||||||
//使用Polling轮询连接插件
|
//使用Polling轮询连接插件
|
||||||
a.UseTcpReconnection()
|
a.UseTcpReconnection()
|
||||||
.UsePolling(TimeSpan.FromSeconds(5));
|
.UsePolling(TimeSpan.FromSeconds(5));
|
||||||
})
|
})
|
||||||
.ConfigureContainer(a =>
|
.ConfigureContainer(a =>
|
||||||
{
|
{
|
||||||
// a.AddConsoleLogger();//添加一个日志注入
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Result result = await
|
}
|
||||||
|
));
|
||||||
|
|
||||||
await tcpClient.TryConnectAsync();
|
await tcpClient.TryConnectAsync();
|
||||||
// return result.IsSuccess;
|
|
||||||
/* try
|
|
||||||
{
|
|
||||||
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,360 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 线程安全的 DataTable 管理器
|
||||||
|
/// 提供对 DataTable 的安全并发访问
|
||||||
|
/// </summary>
|
||||||
|
public class DataTableManager : IDisposable
|
||||||
|
{
|
||||||
|
private DataTable _dataTable;
|
||||||
|
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
|
||||||
|
private bool _disposed = false;
|
||||||
|
|
||||||
|
#region 构造函数
|
||||||
|
public DataTableManager()
|
||||||
|
{
|
||||||
|
_dataTable = new DataTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataTableManager(DataTable dataTable)
|
||||||
|
{
|
||||||
|
_dataTable = dataTable ?? throw new ArgumentNullException(nameof(dataTable));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataTableManager(string tableName)
|
||||||
|
{
|
||||||
|
_dataTable = new DataTable(tableName);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 基本操作
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地添加列
|
||||||
|
/// </summary>
|
||||||
|
public void AddColumn(string columnName, Type dataType)
|
||||||
|
{
|
||||||
|
ExecuteWriteOperation(table =>
|
||||||
|
{
|
||||||
|
table.Columns.Add(columnName, dataType);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地添加行
|
||||||
|
/// </summary>
|
||||||
|
public void AddRow(params object[] values)
|
||||||
|
{
|
||||||
|
ExecuteWriteOperation(table =>
|
||||||
|
{
|
||||||
|
DataRow newRow = table.NewRow();
|
||||||
|
for (int i = 0; i < Math.Min(values.Length, table.Columns.Count); i++)
|
||||||
|
{
|
||||||
|
newRow[i] = values[i] ?? DBNull.Value;
|
||||||
|
}
|
||||||
|
table.Rows.Add(newRow);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地更新单元格值
|
||||||
|
/// </summary>
|
||||||
|
public bool UpdateCell(int rowIndex, string columnName, object value)
|
||||||
|
{
|
||||||
|
return ExecuteWriteOperation(table =>
|
||||||
|
{
|
||||||
|
if (IsValidRowIndex(table, rowIndex) && table.Columns.Contains(columnName))
|
||||||
|
{
|
||||||
|
table.Rows[rowIndex][columnName] = value ?? DBNull.Value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地删除行
|
||||||
|
/// </summary>
|
||||||
|
public bool DeleteRow(int rowIndex)
|
||||||
|
{
|
||||||
|
return ExecuteWriteOperation(table =>
|
||||||
|
{
|
||||||
|
if (IsValidRowIndex(table, rowIndex))
|
||||||
|
{
|
||||||
|
table.Rows[rowIndex].Delete();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 查询操作
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地获取行
|
||||||
|
/// </summary>
|
||||||
|
public DataRow GetRow(int rowIndex)
|
||||||
|
{
|
||||||
|
return ExecuteReadOperation(table =>
|
||||||
|
{
|
||||||
|
return IsValidRowIndex(table, rowIndex) ? table.Rows[rowIndex] : null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地查找行(使用筛选条件)
|
||||||
|
/// </summary>
|
||||||
|
public DataRow[] FindRows(string filterExpression)
|
||||||
|
{
|
||||||
|
return ExecuteReadOperation(table =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return string.IsNullOrEmpty(filterExpression)
|
||||||
|
? table.Select()
|
||||||
|
: table.Select(filterExpression);
|
||||||
|
}
|
||||||
|
catch (EvaluateException)
|
||||||
|
{
|
||||||
|
return new DataRow[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地获取行数
|
||||||
|
/// </summary>
|
||||||
|
public int GetRowCount()
|
||||||
|
{
|
||||||
|
return ExecuteReadOperation(table => table.Rows.Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地检查行是否存在
|
||||||
|
/// </summary>
|
||||||
|
public bool RowExists(int rowIndex)
|
||||||
|
{
|
||||||
|
return ExecuteReadOperation(table => IsValidRowIndex(table, rowIndex));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 批量操作
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地批量添加行
|
||||||
|
/// </summary>
|
||||||
|
public void BulkAddRows(IEnumerable<object[]> rowsData)
|
||||||
|
{
|
||||||
|
ExecuteWriteOperation(table =>
|
||||||
|
{
|
||||||
|
foreach (var rowData in rowsData)
|
||||||
|
{
|
||||||
|
DataRow newRow = table.NewRow();
|
||||||
|
for (int i = 0; i < Math.Min(rowData.Length, table.Columns.Count); i++)
|
||||||
|
{
|
||||||
|
newRow[i] = rowData[i] ?? DBNull.Value;
|
||||||
|
}
|
||||||
|
table.Rows.Add(newRow);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 安全地清空所有数据
|
||||||
|
/// </summary>
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
ExecuteWriteOperation(table =>
|
||||||
|
{
|
||||||
|
table.Clear();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 数据导出
|
||||||
|
/// <summary>
|
||||||
|
/// 获取数据快照(线程安全的副本)
|
||||||
|
/// </summary>
|
||||||
|
public DataTable GetSnapshot()
|
||||||
|
{
|
||||||
|
return ExecuteReadOperation(table =>
|
||||||
|
{
|
||||||
|
return table.Copy(); // 创建数据的独立副本
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取只读视图
|
||||||
|
/// </summary>
|
||||||
|
public DataView GetReadOnlyView()
|
||||||
|
{
|
||||||
|
return ExecuteReadOperation(table =>
|
||||||
|
{
|
||||||
|
return new DataView(table) { AllowEdit = false };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导出到新 DataTable(包含结构)
|
||||||
|
/// </summary>
|
||||||
|
public DataTable ExportToDataTable()
|
||||||
|
{
|
||||||
|
return ExecuteReadOperation(table =>
|
||||||
|
{
|
||||||
|
DataTable exported = table.Clone();
|
||||||
|
exported.Merge(table, false, MissingSchemaAction.Add);
|
||||||
|
return exported;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 锁操作核心
|
||||||
|
/// <summary>
|
||||||
|
/// 执行读取操作(共享锁)
|
||||||
|
/// </summary>
|
||||||
|
private T ExecuteReadOperation<T>(Func<DataTable, T> operation)
|
||||||
|
{
|
||||||
|
_lock.EnterReadLock();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return operation(_dataTable);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_lock.ExitReadLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行写入操作(独占锁)
|
||||||
|
/// </summary>
|
||||||
|
private void ExecuteWriteOperation(Action<DataTable> operation)
|
||||||
|
{
|
||||||
|
_lock.EnterWriteLock();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
operation(_dataTable);
|
||||||
|
_dataTable.AcceptChanges();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_lock.ExitWriteLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private T ExecuteWriteOperation<T>(Func<DataTable, T> operation)
|
||||||
|
{
|
||||||
|
_lock.EnterWriteLock();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = operation(_dataTable);
|
||||||
|
_dataTable.AcceptChanges();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_lock.ExitWriteLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsValidRowIndex(DataTable table, int rowIndex)
|
||||||
|
{
|
||||||
|
return rowIndex >= 0 && rowIndex < table.Rows.Count;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 高级功能
|
||||||
|
/// <summary>
|
||||||
|
/// 带超时的安全操作
|
||||||
|
/// </summary>
|
||||||
|
public bool TryUpdateCell(int rowIndex, string columnName, object value, int timeoutMs = 5000)
|
||||||
|
{
|
||||||
|
if (_lock.TryEnterWriteLock(timeoutMs))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (IsValidRowIndex(_dataTable, rowIndex) && _dataTable.Columns.Contains(columnName))
|
||||||
|
{
|
||||||
|
_dataTable.Rows[rowIndex][columnName] = value ?? DBNull.Value;
|
||||||
|
_dataTable.AcceptChanges();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_lock.ExitWriteLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行事务性操作
|
||||||
|
/// </summary>
|
||||||
|
public void ExecuteTransaction(Action<DataTable> transaction)
|
||||||
|
{
|
||||||
|
_lock.EnterWriteLock();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 开始事务
|
||||||
|
_dataTable.BeginLoadData();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
transaction(_dataTable);
|
||||||
|
_dataTable.AcceptChanges();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
_dataTable.RejectChanges();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_dataTable.EndLoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_lock.ExitWriteLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 属性和清理
|
||||||
|
public string TableName
|
||||||
|
{
|
||||||
|
get => ExecuteReadOperation(table => table.TableName);
|
||||||
|
set => ExecuteWriteOperation(table => table.TableName = value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataColumnCollection Columns
|
||||||
|
{
|
||||||
|
get => ExecuteReadOperation(table => table.Columns);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (!_disposed)
|
||||||
|
{
|
||||||
|
_lock?.Dispose();
|
||||||
|
_dataTable?.Dispose();
|
||||||
|
_disposed = true;
|
||||||
|
}
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
~DataTableManager()
|
||||||
|
{
|
||||||
|
Dispose();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
-2
@@ -15,6 +15,8 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
||||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||||
|
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
|
||||||
|
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
|
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
|
||||||
@@ -63,8 +65,11 @@
|
|||||||
<materialDesign:PackIcon Width="25" Height="30"
|
<materialDesign:PackIcon Width="25" Height="30"
|
||||||
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
|
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
|
||||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||||
<materialDesign:PackIcon Width="25" Height="30"
|
<materialDesign:PackIcon Width="25" Height="30" Kind="Lock"
|
||||||
Kind="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
|
Visibility="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
|
||||||
|
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||||
|
<materialDesign:PackIcon Width="25" Height="30" Kind="HandBackRight"
|
||||||
|
Visibility="{Binding Path=AUTO,Converter={StaticResource StatexmlConvert}}"
|
||||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
+17
-17
@@ -15,15 +15,15 @@
|
|||||||
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
|
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid Background="White" Cursor="">
|
<Grid Background="White" Cursor="">
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,30,10,0" x:Name="comboBoxWorkOrder" VerticalAlignment="Top" Width="270"
|
<ComboBox HorizontalAlignment="Left" Height="40" Margin="140,30,10,0" x:Name="comboBoxWorkOrder" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxWorkOrder_KeyDown"/>
|
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxWorkOrder_KeyDown"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270"
|
<ComboBox HorizontalAlignment="Left" Height="40" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxDyelot_KeyDown" />
|
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxDyelot_KeyDown" />
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,130,10,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270"
|
<ComboBox HorizontalAlignment="Left" Height="40" Margin="140,130,10,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" IsReadOnly="True" />
|
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" IsReadOnly="True" />
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
@@ -31,59 +31,59 @@
|
|||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="360,180,280,0" x:Name="color" TextWrapping="Wrap"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="360,180,280,0" x:Name="color" TextWrapping="Wrap"
|
||||||
VerticalAlignment="Top" Width="50" Background="#FF336FA8" MouseDown="color_color_MouseDoubleClick"/>
|
VerticalAlignment="Top" Width="50" Background="#FF336FA8" MouseDown="color_color_MouseDoubleClick"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,180,10,0" x:Name="TEXTColorNumber" VerticalAlignment="Top" Width="200"
|
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,180,10,0" x:Name="TEXTColorNumber" VerticalAlignment="Top" Width="200"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,230,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ColorName}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,230,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ColorName}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,230,10,0" x:Name="TEXTColorName" VerticalAlignment="Top" Width="270"
|
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,230,10,0" x:Name="TEXTColorName" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,280,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Client}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,280,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Client}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,280,10,0" x:Name="TEXTClient" VerticalAlignment="Top" Width="270"
|
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,280,10,0" x:Name="TEXTClient" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,330,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothSpecies}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,330,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothSpecies}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,330,10,0" x:Name="TEXTClothSpecies" VerticalAlignment="Top" Width="270"
|
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,330,10,0" x:Name="TEXTClothSpecies" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,380,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWeight}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,380,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWeight}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,380,10,0" x:Name="TEXTClothWeight" VerticalAlignment="Top" Width="270"
|
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,380,10,0" x:Name="TEXTClothWeight" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTClothWeight" InputMethod.IsInputMethodEnabled="False"/>
|
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTClothWeight" InputMethod.IsInputMethodEnabled="False"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,430,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.BathRatio}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,430,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.BathRatio}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,430,10,0" x:Name="TEXTBathRatio" VerticalAlignment="Top" Width="270"
|
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,430,10,0" x:Name="TEXTBathRatio" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTBathRatio" InputMethod.IsInputMethodEnabled="False"/>
|
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTBathRatio" InputMethod.IsInputMethodEnabled="False"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,480,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,480,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,480,10,0" x:Name="TEXTTotal" VerticalAlignment="Top" Width="270"
|
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,480,10,0" x:Name="TEXTTotal" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTTotal" InputMethod.IsInputMethodEnabled="False"/>
|
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTTotal" InputMethod.IsInputMethodEnabled="False"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,530,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,530,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,530,10,0" x:Name="TEXTUSER" VerticalAlignment="Top" Width="270"
|
<TextBox HorizontalAlignment="Left" Height="40" Margin="140,530,10,0" x:Name="TEXTUSER" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
|
|
||||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,80,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Pump}"
|
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,80,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Pump}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Right" Height="30" Margin="140,80,380,0" x:Name="PumpSpeed" VerticalAlignment="Top" Width="100"
|
<TextBox HorizontalAlignment="Right" Height="40" Margin="140,80,380,0" x:Name="PumpSpeed" VerticalAlignment="Top" Width="100"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,80,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Blower}"
|
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,80,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Blower}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Right" Height="30" Margin="360,80,50,0" x:Name="Blower" VerticalAlignment="Top" Width="100"
|
<TextBox HorizontalAlignment="Right" Height="40" Margin="360,80,50,0" x:Name="Blower" VerticalAlignment="Top" Width="100"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,130,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Swing}"
|
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,130,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Swing}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Right" Height="30" Margin="140,130,380,0" x:Name="Swing" VerticalAlignment="Top" Width="100"
|
<TextBox HorizontalAlignment="Right" Height="40" Margin="140,130,380,0" x:Name="Swing" VerticalAlignment="Top" Width="100"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,130,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWheel}"
|
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,130,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWheel}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Right" Height="30" Margin="360,130,50,0" x:Name="ClothWheel" VerticalAlignment="Top" Width="100"
|
<TextBox HorizontalAlignment="Right" Height="40" Margin="360,130,50,0" x:Name="ClothWheel" VerticalAlignment="Top" Width="100"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,180,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Nozzle}"
|
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,180,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Nozzle}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<TextBox HorizontalAlignment="Right" Height="30" Margin="140,180,380,0" x:Name="Nozzle" VerticalAlignment="Top" Width="100"
|
<TextBox HorizontalAlignment="Right" Height="40" Margin="140,180,380,0" x:Name="Nozzle" VerticalAlignment="Top" Width="100"
|
||||||
FontSize="15" BorderBrush="#FF673AB7" />
|
FontSize="15" BorderBrush="#FF673AB7" />
|
||||||
|
|
||||||
<ComboBox HorizontalAlignment="Right" Height="30" Margin="150,30,50,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="470"
|
<ComboBox HorizontalAlignment="Right" Height="40" Margin="150,30,50,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="470"
|
||||||
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxProgram_DropDownClosed"
|
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxProgram_DropDownClosed"
|
||||||
TextBoxBase.TextChanged="comboBoxProgram_TextChanged"/>
|
TextBoxBase.TextChanged="comboBoxProgram_TextChanged"/>
|
||||||
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,30,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}"
|
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,30,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}"
|
||||||
|
|||||||
+14
-31
@@ -40,6 +40,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
DataTable TEMPTable = new DataTable();
|
DataTable TEMPTable = new DataTable();
|
||||||
DataTable DyelotsBulkedRecipe=new DataTable();
|
DataTable DyelotsBulkedRecipe=new DataTable();
|
||||||
public string WorkOrder_n;
|
public string WorkOrder_n;
|
||||||
|
string Numder = null;
|
||||||
|
string ID = null;
|
||||||
|
string P1, P2, P3, P4, P5;
|
||||||
public DyeingPlanView()
|
public DyeingPlanView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -176,24 +179,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数
|
||||||
for (int x = 0; x < dat.Rows.Count; x++)
|
for (int x = 0; x < dat.Rows.Count; x++)
|
||||||
{
|
{
|
||||||
|
WorkOrder_DAT = MainWindowViewModel.SQLiteHelpers.ToDictionary(dat.Rows[x]);
|
||||||
WorkOrder_DAT.Add("WorkOrder", WorkOrder_);
|
WorkOrder_DAT.Add("WorkOrder", WorkOrder_);
|
||||||
WorkOrder_DAT.Add("Dyelot", Dyelot_);
|
WorkOrder_DAT.Add("Dyelot", Dyelot_);
|
||||||
WorkOrder_DAT.Add("ProgramID", dat.Rows[x]["ProgramID"]);
|
|
||||||
WorkOrder_DAT.Add("Program", dat.Rows[x]["Program"]);
|
|
||||||
WorkOrder_DAT.Add("Step", dat.Rows[x]["Step"]);
|
|
||||||
WorkOrder_DAT.Add("StepID", dat.Rows[x]["StepID"]);
|
|
||||||
WorkOrder_DAT.Add("StepName", dat.Rows[x]["StepName"]);
|
|
||||||
WorkOrder_DAT.Add("ParameterName", dat.Rows[x]["ParameterName"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter1", dat.Rows[x]["Parameter1"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter2", dat.Rows[x]["Parameter2"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter3", dat.Rows[x]["Parameter3"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter4", dat.Rows[x]["Parameter4"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter5", dat.Rows[x]["Parameter5"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter6", dat.Rows[x]["Parameter6"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter7", dat.Rows[x]["Parameter7"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter8", dat.Rows[x]["Parameter8"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter9", dat.Rows[x]["Parameter9"]);
|
|
||||||
WorkOrder_DAT.Add("Parameter10", dat.Rows[x]["Parameter10"]);
|
|
||||||
MainWindowViewModel.SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
|
MainWindowViewModel.SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
|
||||||
WorkOrder_DAT.Clear();
|
WorkOrder_DAT.Clear();
|
||||||
}
|
}
|
||||||
@@ -290,11 +278,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
|
|
||||||
}//工艺修改事件
|
}//工艺修改事件
|
||||||
|
|
||||||
string Numder = null;
|
|
||||||
string ID = null;
|
|
||||||
string P1, P2, P3, P4, P5;
|
|
||||||
|
|
||||||
private void MenuItem_edit(object sender, RoutedEventArgs e)
|
private void MenuItem_edit(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
@@ -436,17 +419,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
for (int i = 0; i < dat.Rows.Count; i++)
|
for (int i = 0; i < dat.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
switch (dat.Rows[i][3].ToString())//步骤用时计算
|
switch (dat.Rows[i].Field<string>("StepID"))//步骤用时计算
|
||||||
{
|
{
|
||||||
case "001":
|
case "001":
|
||||||
TT = MSTT;
|
TT = MSTT;
|
||||||
TC = (Double)dat.Rows[i][7];
|
TC = dat.Rows[i].Field<double>("Parameter2");
|
||||||
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
|
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
|
||||||
MSTT = (Double)dat.Rows[i][6];
|
MSTT = dat.Rows[i].Field<double>("Parameter1");
|
||||||
TT = Math.Abs(MSTT - TT) / TC * 60;
|
TT = Math.Abs(MSTT - TT) / TC * 60;
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "007":
|
case "007":
|
||||||
@@ -458,15 +441,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "013":
|
case "013":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]* (Double)dat.Rows[i][9]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3") * dat.Rows[i].Field<double>("Parameter4")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "015":
|
case "015":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "017":
|
case "017":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "020":
|
case "020":
|
||||||
@@ -478,11 +461,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "031":
|
case "031":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][6]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "065":
|
case "065":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][8]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "091":
|
case "091":
|
||||||
@@ -495,7 +478,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "093":
|
case "093":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][6]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
<DataGridTextColumn Binding="{Binding Serial}" Width="0" IsReadOnly="True"/>
|
<DataGridTextColumn Binding="{Binding Serial}" Width="0" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Binding="{Binding Station}" Width="0" IsReadOnly="True"/>
|
<DataGridTextColumn Binding="{Binding Station}" Width="0" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Binding="{Binding ID}" Width="0" IsReadOnly="True"/>
|
<DataGridTextColumn Binding="{Binding ID}" Width="0" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Binding="{Binding Model}" Width="0" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Binding="{Binding Type}" Width="0" IsReadOnly="True"/>
|
<DataGridTextColumn Binding="{Binding Type}" Width="0" IsReadOnly="True"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|||||||
+76
-56
@@ -36,14 +36,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
// 获取所有可用串口端口,并添加到comboBoxCOM
|
// 获取所有可用串口端口,并添加到comboBoxCOM
|
||||||
// string[] ports = System.IO.Ports.SerialPort.GetPortNames();
|
// string[] ports = System.IO.Ports.SerialPort.GetPortNames();
|
||||||
string[] ports = { "PORT1", "PORT2", "PORT3", "PORT4" };
|
|
||||||
comboBoxCOM0.ItemsSource = ports;
|
comboBoxCOM0.ItemsSource = ports;
|
||||||
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM");
|
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM");
|
||||||
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
|
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
|
||||||
string[] type_ = { "828", "838" };
|
|
||||||
comboBoxtype.ItemsSource = type_;
|
comboBoxtype.ItemsSource = type_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string[] ports = { "PORT1", "PORT2", "PORT3", "PORT4" };
|
||||||
|
string[] type_ = { "828", "838" };
|
||||||
|
string link_model = "838" ;
|
||||||
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||||
//private string SYS_machines = null;
|
//private string SYS_machines = null;
|
||||||
int ID_;
|
int ID_;
|
||||||
@@ -70,10 +71,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void Save_Click(object sender, RoutedEventArgs e)
|
private void Save_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(Station.Text)) Station.Text = "255";
|
||||||
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
|
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
|
||||||
{
|
{
|
||||||
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
|
||||||
if (MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Machines where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
|
if (MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Machines where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
|
||||||
|
{
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
DataRow dat_ = MainWindowViewModel.Machines.NewRow();
|
DataRow dat_ = MainWindowViewModel.Machines.NewRow();
|
||||||
dat_.BeginEdit();
|
dat_.BeginEdit();
|
||||||
@@ -82,7 +86,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dat_["IP"] = IP.Text;
|
dat_["IP"] = IP.Text;
|
||||||
dat_["PORT"] = PORT.Text;
|
dat_["PORT"] = PORT.Text;
|
||||||
dat_["Serial"] = comboBoxCOM0.Text;
|
dat_["Serial"] = comboBoxCOM0.Text;
|
||||||
dat_["Type"] = comboBoxtype.Text;
|
dat_["Model"] = comboBoxtype.Text;
|
||||||
dat_["Station"] = Station.Text;
|
dat_["Station"] = Station.Text;
|
||||||
dat_["ID"] = 999;
|
dat_["ID"] = 999;
|
||||||
dat_["ERR"] = false;
|
dat_["ERR"] = false;
|
||||||
@@ -94,9 +98,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dat_["WaterLevel"] = 0;
|
dat_["WaterLevel"] = 0;
|
||||||
dat_["WORK_RUN"] = -1;
|
dat_["WORK_RUN"] = -1;
|
||||||
dat_["UserInfoStart"] = 900;
|
dat_["UserInfoStart"] = 900;
|
||||||
if (comboBoxtype.Text == "838")
|
if (comboBoxtype.Text.Contains(link_model))
|
||||||
{ dat_["Desktop"] = true; }
|
{
|
||||||
else { dat_["Desktop"] = false; }
|
dat_["Desktop"] = true;
|
||||||
|
dat_["Type"] = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dat_["Desktop"] = false;
|
||||||
|
dat_["Type"] = false;
|
||||||
|
}
|
||||||
dat_.EndEdit();
|
dat_.EndEdit();
|
||||||
MainWindowViewModel.Machines.Rows.Add(dat_);
|
MainWindowViewModel.Machines.Rows.Add(dat_);
|
||||||
DatSteps(MainWindowViewModel.Machines);
|
DatSteps(MainWindowViewModel.Machines);
|
||||||
@@ -113,11 +124,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
|
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
|
||||||
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
|
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
|
||||||
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
|
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
|
||||||
|
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
|
||||||
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
|
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
|
||||||
Machines_DAT.Clear();
|
Machines_DAT.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
DataRow dr = MainWindowViewModel.Machines.Rows[ID_];
|
DataRow dr = MainWindowViewModel.Machines.Rows[ID_];
|
||||||
dr.BeginEdit();
|
dr.BeginEdit();
|
||||||
@@ -126,18 +141,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dr["IP"] = IP.Text;
|
dr["IP"] = IP.Text;
|
||||||
dr["PORT"] = PORT.Text;
|
dr["PORT"] = PORT.Text;
|
||||||
dr["Serial"] = comboBoxCOM0.Text;
|
dr["Serial"] = comboBoxCOM0.Text;
|
||||||
dr["Type"] = comboBoxtype.Text;
|
dr["Model"] = comboBoxtype.Text;
|
||||||
dr["Station"] = Station.Text;
|
dr["Station"] = Station.Text;
|
||||||
dr["ID"] = 999;
|
if (comboBoxtype.Text.Contains(link_model))
|
||||||
dr["ERR"] = false;
|
{
|
||||||
dr["AUTO"] = false;
|
dr["Desktop"] = true;
|
||||||
dr["CALL"] = false;
|
dr["Type"] = true;
|
||||||
dr["LOCK"] = false;
|
}
|
||||||
dr["State"] = 800;
|
else
|
||||||
dr["Temperature"] = 0;
|
{
|
||||||
dr["WaterLevel"] = 0;
|
dr["Desktop"] = false;
|
||||||
dr["WORK_RUN"] = -1;
|
dr["Type"] = false;
|
||||||
dr["UserInfoStart"] = 900;
|
}
|
||||||
dr.EndEdit();
|
dr.EndEdit();
|
||||||
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
|
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
|
||||||
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
|
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
|
||||||
@@ -152,11 +167,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
|
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
|
||||||
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
|
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
|
||||||
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
|
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
|
||||||
|
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
|
||||||
Machines_DAT.Add("LOCK", "FALSE");
|
Machines_DAT.Add("LOCK", "FALSE");
|
||||||
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
|
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
|
||||||
Machines_DAT.Clear();
|
Machines_DAT.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
||||||
comboBoxMachine.Text = null;
|
comboBoxMachine.Text = null;
|
||||||
TextMachineGroup.Text = null;
|
TextMachineGroup.Text = null;
|
||||||
@@ -177,10 +194,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
{
|
{
|
||||||
MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
||||||
if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码
|
if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码
|
||||||
|
{
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
MainWindowViewModel.Machines.Rows.RemoveAt(ID_ - 1);
|
MainWindowViewModel.Machines.Rows.RemoveAt(ID_ - 1);
|
||||||
DatSteps(MainWindowViewModel.Machines);
|
DatSteps(MainWindowViewModel.Machines);
|
||||||
|
}
|
||||||
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
|
||||||
|
|
||||||
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
|
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
|
||||||
@@ -224,45 +243,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
private void Test_Click(object sender, RoutedEventArgs e)//测试按钮
|
private void Test_Click(object sender, RoutedEventArgs e)//测试按钮
|
||||||
{
|
{
|
||||||
if (comboBoxtype.Text == "828")
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(comboBoxCOM0.Text) && !string.IsNullOrEmpty(Station.Text))
|
|
||||||
{
|
|
||||||
textlog.Text = "TEST";
|
|
||||||
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
|
|
||||||
//------------使用ping类------
|
|
||||||
string host = IP.Text;
|
|
||||||
Ping p1 = new Ping();
|
|
||||||
PingReply reply = p1.Send(host); //发送主机名或Ip地址
|
|
||||||
//StringBuilder sbuilder;
|
|
||||||
if (reply.Status == IPStatus.Success)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
textlog.Text = "Link succeed";
|
|
||||||
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
textlog.Text = "Link failed";
|
|
||||||
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
textlog.Text = "No links";
|
|
||||||
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
textlog.Text = "Invalid";
|
|
||||||
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
if (comboBoxtype.Text.Contains(link_model))
|
||||||
else if (comboBoxtype.Text == "838")
|
{//网络
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text))
|
if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text))
|
||||||
{
|
{
|
||||||
textlog.Text = "TEST";
|
textlog.Text = "TEST";
|
||||||
@@ -320,6 +303,43 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (!string.IsNullOrEmpty(comboBoxCOM0.Text) && !string.IsNullOrEmpty(Station.Text))
|
||||||
|
{
|
||||||
|
textlog.Text = "TEST";
|
||||||
|
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
|
||||||
|
//------------使用ping类------
|
||||||
|
string host = IP.Text;
|
||||||
|
Ping p1 = new Ping();
|
||||||
|
PingReply reply = p1.Send(host); //发送主机名或Ip地址
|
||||||
|
//StringBuilder sbuilder;
|
||||||
|
if (reply.Status == IPStatus.Success)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
textlog.Text = "Link succeed";
|
||||||
|
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
textlog.Text = "Link failed";
|
||||||
|
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textlog.Text = "No links";
|
||||||
|
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textlog.Text = "Invalid";
|
||||||
|
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+51
-6
@@ -16,6 +16,8 @@
|
|||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
||||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||||
|
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
|
||||||
|
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
|
||||||
<ConvertMoels:BoolRBConvert x:Key="BoolRBConvert"/>
|
<ConvertMoels:BoolRBConvert x:Key="BoolRBConvert"/>
|
||||||
<ConvertMoels:IORBConvert x:Key="IORBConvert"/>
|
<ConvertMoels:IORBConvert x:Key="IORBConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
@@ -30,7 +32,7 @@
|
|||||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||||
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True"
|
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True"
|
||||||
AutoGenerateColumns="False" MinColumnWidth="30"
|
AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
HorizontalAlignment="Left" Width="310" MouseDoubleClick="Griddata_MouseDoubleClick">
|
HorizontalAlignment="Left" Width="250" MouseDoubleClick="Griddata_MouseDoubleClick">
|
||||||
<DataGrid.RowStyle >
|
<DataGrid.RowStyle >
|
||||||
<Style TargetType="{x:Type DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
<Setter Property="Height" Value="30" />
|
<Setter Property="Height" Value="30" />
|
||||||
@@ -79,8 +81,8 @@
|
|||||||
<materialDesign:PackIcon Width="25" Height="30"
|
<materialDesign:PackIcon Width="25" Height="30"
|
||||||
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
|
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
|
||||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||||
<materialDesign:PackIcon Width="25" Height="30"
|
<materialDesign:PackIcon Width="25" Height="30" Kind="Lock"
|
||||||
Kind="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
|
Visibility="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
|
||||||
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -89,17 +91,52 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="210" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="150" IsReadOnly="True"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<Grid Grid.Row="0" Margin="310,0,0,0">
|
<Grid Grid.Row="0" Margin="250,0,0,0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition Height="0"/>
|
||||||
<RowDefinition Height="5"/>
|
<RowDefinition Height="5"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<ContentControl Grid.Row="0" x:Name="machineView"/>
|
<ContentControl Grid.Row="0" x:Name="machineView"/>
|
||||||
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/>
|
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/>
|
||||||
|
<Grid Grid.Row="2" x:Name="LOG_GRID" Visibility="Collapsed">
|
||||||
|
<DataGrid x:Name="LOG_Grid" AlternationCount="2" Margin="0,0,0,0"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
|
||||||
|
Background="White" SelectionMode="Single" FontSize="15" >
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<Setter Property="Height" Value="30" />
|
||||||
|
<Setter Property="FontSize" Value="25" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||||
|
<Setter Property="Background" Value="#FFF0F0F0" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="False"/>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.CellStyle>
|
||||||
|
<Style TargetType="DataGridCell">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="MinWidth" Value="20"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
<Grid Grid.Row="2" x:Name="SET_GRID" Visibility="Collapsed">
|
<Grid Grid.Row="2" x:Name="SET_GRID" Visibility="Collapsed">
|
||||||
<DataGrid x:Name="SET_Grid" AlternationCount="2" Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False"
|
<DataGrid x:Name="SET_Grid" AlternationCount="2" Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False"
|
||||||
ItemsSource="{Binding Path=Paramete_Set,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
ItemsSource="{Binding Path=Paramete_Set,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
@@ -389,6 +426,14 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_LOG">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<materialDesign:PackIcon Kind="MathLog" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
|
<TextBlock Text="{x:Static lang:Resources.log}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ListViewItem>
|
||||||
|
</ListView>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="2" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="400" HorizontalAlignment="Right">
|
<StackPanel Grid.Row="2" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="400" HorizontalAlignment="Right">
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
|
|||||||
+115
-1
@@ -63,6 +63,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
}
|
}
|
||||||
string machine;
|
string machine;
|
||||||
|
int LOG_ = 0;
|
||||||
|
public static DataTable LOG_dataTable = new DataTable();
|
||||||
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
@@ -81,6 +83,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void ListViewItem_ArrowLeftRight(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_ArrowLeftRight(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
LOG_GRID.Visibility = Visibility.Collapsed;
|
||||||
IO_GRID.Visibility = Visibility.Visible;
|
IO_GRID.Visibility = Visibility.Visible;
|
||||||
SYS_GRID.Visibility = Visibility.Collapsed;
|
SYS_GRID.Visibility = Visibility.Collapsed;
|
||||||
SET_GRID.Visibility = Visibility.Collapsed;
|
SET_GRID.Visibility = Visibility.Collapsed;
|
||||||
@@ -88,13 +91,81 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
private void ListViewItem_VideoHomeSystem(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_VideoHomeSystem(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
LOG_GRID.Visibility = Visibility.Collapsed;
|
||||||
IO_GRID.Visibility = Visibility.Collapsed;
|
IO_GRID.Visibility = Visibility.Collapsed;
|
||||||
SYS_GRID.Visibility = Visibility.Visible;
|
SYS_GRID.Visibility = Visibility.Visible;
|
||||||
SET_GRID.Visibility = Visibility.Collapsed;
|
SET_GRID.Visibility = Visibility.Collapsed;
|
||||||
view = 2;
|
view = 2;
|
||||||
}
|
}
|
||||||
|
private void ListViewItem_LOG(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (LOG_ >= 3) { LOG_ = 0; }
|
||||||
|
else
|
||||||
|
{ LOG_++; }
|
||||||
|
|
||||||
|
LOG_GRID.Visibility = Visibility.Visible;
|
||||||
|
IO_GRID.Visibility = Visibility.Collapsed;
|
||||||
|
SYS_GRID.Visibility = Visibility.Collapsed;
|
||||||
|
SET_GRID.Visibility = Visibility.Collapsed;
|
||||||
|
view = 3;
|
||||||
|
LOG_dataTable.Clear();
|
||||||
|
Dictionary<string, object> dat_859 =new Dictionary<string, object>();
|
||||||
|
|
||||||
|
if (LOG_ == 0)
|
||||||
|
{
|
||||||
|
MAC_name.Text = machine+ "(SERVER)";
|
||||||
|
dat_859.Add("INSTRUCTION", "SERVER");
|
||||||
|
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
|
||||||
|
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
else if (LOG_ == 1)
|
||||||
|
{
|
||||||
|
MAC_name.Text = machine + "(OperationLog)";
|
||||||
|
dat_859.Add("INSTRUCTION", "OperationLog");
|
||||||
|
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
|
||||||
|
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
else if (LOG_ == 2)
|
||||||
|
{
|
||||||
|
MAC_name.Text = machine + "(IOLog)";
|
||||||
|
dat_859.Add("INSTRUCTION", "IOLog");
|
||||||
|
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
|
||||||
|
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MAC_name.Text = machine + "(ERRLog)";
|
||||||
|
dat_859.Add("INSTRUCTION", "ERRLog");
|
||||||
|
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
|
||||||
|
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(machine))
|
||||||
|
{
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
|
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
|
||||||
|
{
|
||||||
|
if (drEmployee.Field<bool>("Type"))//
|
||||||
|
{//网络
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC859" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
|
||||||
|
+ dat_859.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
private void ListViewItem_Dharmachakra(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Dharmachakra(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
LOG_GRID.Visibility = Visibility.Collapsed;
|
||||||
IO_GRID.Visibility = Visibility.Collapsed;
|
IO_GRID.Visibility = Visibility.Collapsed;
|
||||||
SYS_GRID.Visibility = Visibility.Collapsed;
|
SYS_GRID.Visibility = Visibility.Collapsed;
|
||||||
SET_GRID.Visibility = Visibility.Visible;
|
SET_GRID.Visibility = Visibility.Visible;
|
||||||
@@ -174,12 +245,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))//
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC862" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString()
|
DAT = "SC862" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString()
|
||||||
});//发送862指令修改系统设置
|
});//发送862指令修改系统设置
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
SysSet_view = true;
|
SysSet_view = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,12 +275,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))//
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC861" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString()
|
DAT = "SC861" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString()
|
||||||
});//发送861指令修改程序设置
|
});//发送861指令修改程序设置
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
ParameterSet_view = true;
|
ParameterSet_view = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,6 +307,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
if (!string.IsNullOrEmpty(machine))
|
if (!string.IsNullOrEmpty(machine))
|
||||||
{
|
{
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
|
|
||||||
|
if (drEmployee.Field<bool>("Type"))//
|
||||||
|
{//网络
|
||||||
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
|
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
|
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
|
||||||
@@ -243,7 +331,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC853" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
|
DAT = "SC853" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
|
||||||
});
|
});
|
||||||
} else if (view==1)
|
}
|
||||||
|
else if (view == 1)
|
||||||
{
|
{
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
@@ -261,6 +350,27 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
|
||||||
|
{
|
||||||
|
if (view == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (view == 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (view == 2)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CountDown()
|
public void CountDown()
|
||||||
@@ -276,6 +386,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
{
|
{
|
||||||
IO_data();
|
IO_data();
|
||||||
DATA_view();
|
DATA_view();
|
||||||
|
if (LOG_dataTable.Rows.Count > 0) {
|
||||||
|
LOG_Grid.ItemsSource = LOG_dataTable.DefaultView;
|
||||||
|
// LOG_dataTable.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private async void DATA_view()//IO显示
|
private async void DATA_view()//IO显示
|
||||||
{
|
{
|
||||||
|
|||||||
+44
-18
@@ -20,6 +20,8 @@
|
|||||||
<ContextMenu x:Key="PersoncontextMenu">
|
<ContextMenu x:Key="PersoncontextMenu">
|
||||||
<MenuItem Header="{x:Static lang:Resources._lock}" Click="MenuItem_LOCK_XML"/>
|
<MenuItem Header="{x:Static lang:Resources._lock}" Click="MenuItem_LOCK_XML"/>
|
||||||
<MenuItem Header="{x:Static lang:Resources._Auto}" Click="MenuItem_AUTO_XML"/>
|
<MenuItem Header="{x:Static lang:Resources._Auto}" Click="MenuItem_AUTO_XML"/>
|
||||||
|
<MenuItem Header="{x:Static lang:Resources.Stop}" Click="MenuItem_Stop_XML"/>
|
||||||
|
<MenuItem Header="{x:Static lang:Resources.Start}" Click="MenuItem_Start_XML"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
<ContextMenu x:Key="PersoncontextMenuStep">
|
<ContextMenu x:Key="PersoncontextMenuStep">
|
||||||
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
|
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
|
||||||
@@ -35,11 +37,12 @@
|
|||||||
<RowDefinition Height="60"/>
|
<RowDefinition Height="60"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True"
|
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True"
|
||||||
SelectionChanged="Griddata_SelectionChanged"
|
SelectionChanged="Griddata_SelectionChanged" EnableRowVirtualization="True" EnableColumnVirtualization="True"
|
||||||
|
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
|
d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
|
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
|
||||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="True"
|
||||||
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" >
|
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" >
|
||||||
<DataGrid.RowStyle >
|
<DataGrid.RowStyle >
|
||||||
<Style TargetType="{x:Type DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
@@ -126,19 +129,40 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="150" IsReadOnly="True">
|
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="80" IsReadOnly="True">
|
||||||
<DataGridTextColumn.ElementStyle>
|
<DataGridTextColumn.ElementStyle>
|
||||||
<Style TargetType="{x:Type TextBlock}">
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
<Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
<Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</DataGridTextColumn.ElementStyle>
|
</DataGridTextColumn.ElementStyle>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
|
||||||
|
<Setter Property="ToolTip" Value="{Binding WorkOrder}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="0" MaxWidth="0" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="0" MaxWidth="0" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Temperature}" Binding="{Binding Temperature}" Width="100" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.Temperature}" Binding="{Binding Temperature}" Width="100" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.WaterLevel}" Binding="{Binding WaterLevel}" Width="100" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.WaterLevel}" Binding="{Binding WaterLevel}" Width="100" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.process}" Binding="{Binding Process}" Width="300" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.process}" Binding="{Binding Process}" Width="300" IsReadOnly="True">
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="300" IsReadOnly="True"/>
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
|
||||||
|
<Setter Property="ToolTip" Value="{Binding Process}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="300" IsReadOnly="True">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
|
||||||
|
<Setter Property="ToolTip" Value="{Binding Step}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.message}" Binding="{Binding Message}" Width="*" IsReadOnly="True"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.message}" Binding="{Binding Message}" Width="*" IsReadOnly="True"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
@@ -150,6 +174,8 @@
|
|||||||
<ColumnDefinition MinWidth="1200"/>
|
<ColumnDefinition MinWidth="1200"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" SelectionChanged="Gridstep_SelectionChanged"
|
<DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" SelectionChanged="Gridstep_SelectionChanged"
|
||||||
|
EnableRowVirtualization="True" EnableColumnVirtualization="True"
|
||||||
|
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
|
d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White"
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White"
|
||||||
@@ -288,16 +314,16 @@
|
|||||||
<TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/>
|
<TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/>
|
||||||
<Grid Margin="0,40,0,0" Grid.ColumnSpan="2" Grid.Column="0" >
|
<Grid Margin="0,40,0,0" Grid.ColumnSpan="2" Grid.Column="0" >
|
||||||
<rdp:RemoteDesktopWpf x:Name="rdp" Visibility="Collapsed" />
|
<rdp:RemoteDesktopWpf x:Name="rdp" Visibility="Collapsed" />
|
||||||
<ContentControl x:Name="Picture" Background="White"/>
|
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="VerticalOnly">
|
<ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="VerticalOnly">
|
||||||
<TextBlock x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White"/>
|
<TextBlock x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White"/>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
<ContentControl x:Name="Picture" Background="White"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/>
|
<GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<StackPanel Grid.Row="3" x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Width="800" HorizontalAlignment="Left">
|
<StackPanel Grid.Row="3" x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Width="800" HorizontalAlignment="Left">
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_DyeingMachine" IsEnabled="False" x:Name="DyeingMachine">
|
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_DyeingMachine" IsHitTestVisible="False" x:Name="DyeingMachine">
|
||||||
<StackPanel Orientation="Horizontal" >
|
<StackPanel Orientation="Horizontal" >
|
||||||
<materialDesign:PackIcon Kind="CoffeeMachine" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="CoffeeMachine" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.DyeingMachine}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.DyeingMachine}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -305,7 +331,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Curve" IsEnabled="False" x:Name="Curve">
|
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Curve" IsHitTestVisible="False" x:Name="Curve">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="ChartBellCurve" Width="40" Height="30" Margin="10" VerticalAlignment="Center"/>
|
<materialDesign:PackIcon Kind="ChartBellCurve" Width="40" Height="30" Margin="10" VerticalAlignment="Center"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Curve}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Curve}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -313,7 +339,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Screen" IsEnabled="False" x:Name="Screen">
|
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Screen" IsHitTestVisible="False" x:Name="Screen">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Monitor" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Monitor" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Screen}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Screen}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -321,7 +347,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Receipt" IsEnabled="False" x:Name="Receipt">
|
<ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Receipt" IsHitTestVisible="False" x:Name="Receipt">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="ReceiptText" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="ReceiptText" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Receipt}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Receipt}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -331,7 +357,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="3" x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="800,0,0,0">
|
<StackPanel Grid.Row="3" x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="800,0,0,0">
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Resume" IsEnabled="False" x:Name="Resume">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Resume" IsHitTestVisible="False" x:Name="Resume">
|
||||||
<StackPanel Orientation="Horizontal" >
|
<StackPanel Orientation="Horizontal" >
|
||||||
<materialDesign:PackIcon Kind="Resume" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Resume" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Resume}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Resume}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -339,7 +365,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Paused" IsEnabled="False" x:Name="Paused">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Paused" IsHitTestVisible="False" x:Name="Paused">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Pause" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Pause" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Paused}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Paused}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -347,7 +373,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Stop" IsEnabled="False" x:Name="Stop">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Stop" IsHitTestVisible="False" x:Name="Stop">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Stop" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Stop" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Stop}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Stop}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -355,7 +381,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsHitTestVisible="False" x:Name="edit">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -363,7 +389,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Jump" IsEnabled="False" x:Name="Jump">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Jump" IsHitTestVisible="False" x:Name="Jump">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Jump" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Jump" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Jump}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Jump}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -371,7 +397,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsEnabled="False" x:Name="Insert">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsHitTestVisible="False" x:Name="Insert">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="InsertInvitation" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="InsertInvitation" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -379,7 +405,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsHitTestVisible="False" x:Name="Delete">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
|
|||||||
+648
-105
@@ -28,6 +28,8 @@ using System.Xml.Linq;
|
|||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
using TouchSocket.Sockets;
|
using TouchSocket.Sockets;
|
||||||
using VncSharpWpf;
|
using VncSharpWpf;
|
||||||
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
|
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
|
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
|
||||||
using static System.Net.WebRequestMethods;
|
using static System.Net.WebRequestMethods;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
|
||||||
@@ -80,6 +82,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)//设备列表
|
private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)//设备列表
|
||||||
{
|
{
|
||||||
|
if (rdp.IsConnected) rdp.Disconnect();
|
||||||
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
string mac_s = "800";
|
string mac_s = "800";
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
@@ -90,17 +93,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
if ((mac_s != "800") && (mac_s != "801") && (mac_s != "802"))
|
if ((mac_s != "800") && (mac_s != "801") && (mac_s != "802"))
|
||||||
{
|
{
|
||||||
Stop.IsEnabled = true;
|
Stop.IsHitTestVisible = true;
|
||||||
Paused.IsEnabled = true;
|
Paused.IsHitTestVisible = true;
|
||||||
Insert.IsEnabled = false;
|
Insert.IsHitTestVisible = false;
|
||||||
edit.IsEnabled = false;
|
edit.IsHitTestVisible = false;
|
||||||
Resume.IsEnabled = false;
|
Resume.IsHitTestVisible = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsHitTestVisible = false;
|
||||||
Jump.IsEnabled = false;
|
Jump.IsHitTestVisible = false;
|
||||||
DyeingMachine.IsEnabled = true;
|
DyeingMachine.IsHitTestVisible = true;
|
||||||
Curve.IsEnabled = true;
|
Curve.IsHitTestVisible = true;
|
||||||
Screen.IsEnabled = true;
|
Screen.IsHitTestVisible = true;
|
||||||
Receipt.IsEnabled = true;
|
Receipt.IsHitTestVisible = true;
|
||||||
TechnologicalProcess_bool = true;
|
TechnologicalProcess_bool = true;
|
||||||
IsInteractive = false;
|
IsInteractive = false;
|
||||||
|
|
||||||
@@ -119,7 +122,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show(Properties.Resources.TMNR, "800", MessageBoxButton.OK, MessageBoxImage.Information); //
|
// MessageBox.Show(Properties.Resources.TMNR, "800", MessageBoxButton.OK, MessageBoxImage.Information); //
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,8 +142,270 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MenuItem_LOCK_XML(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(machine))
|
||||||
|
{
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
|
{
|
||||||
|
bool mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<bool>("LOCK");
|
||||||
|
|
||||||
|
Dictionary<string, object> dat_ = new Dictionary<string, object>();
|
||||||
|
dat_.Clear();
|
||||||
|
|
||||||
|
if (!mode)
|
||||||
|
{
|
||||||
|
dat_.Add("NAME", "LOCK");
|
||||||
|
dat_.Add("VALUE", "True");
|
||||||
|
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "True");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dat_.Add("NAME", "LOCK");
|
||||||
|
dat_.Add("VALUE", "False");
|
||||||
|
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "False");
|
||||||
|
}
|
||||||
|
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + drEmployee.Field<string>("SYSKEY") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!mode)
|
||||||
|
{
|
||||||
|
MessageBox.Show(machine + Properties.Resources.user_lock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show(machine + Properties.Resources.user_unlock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//锁定
|
||||||
|
private void MenuItem_AUTO_XML(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(machine))
|
||||||
|
{
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
|
{
|
||||||
|
bool mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<bool>("AUTO");
|
||||||
|
|
||||||
|
Dictionary<string, object> dat_ = new Dictionary<string, object>();
|
||||||
|
dat_.Clear();
|
||||||
|
|
||||||
|
if (!mode)
|
||||||
|
{
|
||||||
|
dat_.Add("NAME", "AUTO");
|
||||||
|
dat_.Add("VALUE", "True");
|
||||||
|
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "AUTO", "Name='" + machine + "'", "True");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dat_.Add("NAME", "AUTO");
|
||||||
|
dat_.Add("VALUE", "FALSE");
|
||||||
|
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "AUTO", "Name='" + machine + "'", "False");
|
||||||
|
}
|
||||||
|
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + drEmployee.Field<string>("SYSKEY") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC829" + drEmployee.Field<string>("Station") + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//手自动
|
||||||
|
private void MenuItem_Stop_XML(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(machine))
|
||||||
|
{
|
||||||
|
Dictionary<string, object> dat_821 = new Dictionary<string, object>();
|
||||||
|
dat_821.Clear();
|
||||||
|
dat_821.Add("INSTRUCTION", "STOP");
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
|
{
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//停止
|
||||||
|
private void MenuItem_Start_XML(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(machine))
|
||||||
|
{
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC822" + drEmployee.Field<string>("SYSKEY")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC822" + drEmployee.Field<string>("Station")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC822" + drEmployee.Field<string>("Station")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC822" + drEmployee.Field<string>("Station")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC822" + drEmployee.Field<string>("Station")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//开始
|
||||||
private void ListViewItem_DyeingMachine(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_DyeingMachine(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (rdp.IsConnected)rdp.Disconnect();
|
||||||
machines_info = 0;
|
machines_info = 0;
|
||||||
log.Visibility = Visibility.Visible;
|
log.Visibility = Visibility.Visible;
|
||||||
rdp.Visibility = Visibility.Collapsed;
|
rdp.Visibility = Visibility.Collapsed;
|
||||||
@@ -166,7 +431,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
private async void ListViewItem_Screen(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Screen(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
string host = drEmployee.Field<string>("IP");
|
string host = drEmployee.Field<string>("IP");
|
||||||
@@ -184,8 +449,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
rdp.Visibility = Visibility.Visible;
|
rdp.Visibility = Visibility.Visible;
|
||||||
// RemoteDesktopWpf remoteDesktopWpf = new RemoteDesktopWpf();
|
// RemoteDesktopWpf remoteDesktopWpf = new RemoteDesktopWpf();
|
||||||
// Picture.Content = remoteDesktopWpf;
|
// Picture.Content = remoteDesktopWpf;
|
||||||
if (await PingTest(host))
|
|
||||||
{
|
|
||||||
if (!rdp.IsConnected)
|
if (!rdp.IsConnected)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -199,10 +462,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
LogGing.ERRDATA(ex);
|
LogGing.ERRDATA(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}//远程
|
}//远程
|
||||||
private void ListViewItem_Receipt(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Receipt(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (rdp.IsConnected) rdp.Disconnect();
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
if (!drEmployee.Field<bool>("Dispense"))
|
if (!drEmployee.Field<bool>("Dispense"))
|
||||||
{
|
{
|
||||||
@@ -211,12 +474,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
|
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC833" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
|
DAT = "SC833" + drEmployee.Field<string>("SYSKEY")
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC833" + drEmployee.Field<string>("Station")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC833" + drEmployee.Field<string>("Station")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC833" + drEmployee.Field<string>("Station")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC833" + drEmployee.Field<string>("Station")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
machines_info = 2;
|
machines_info = 2;
|
||||||
log.Visibility = Visibility.Collapsed;
|
log.Visibility = Visibility.Collapsed;
|
||||||
rdp.Visibility = Visibility.Collapsed;
|
rdp.Visibility = Visibility.Collapsed;
|
||||||
@@ -225,77 +525,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dyelotView.DyelotDatatable(Product_DAT);
|
dyelotView.DyelotDatatable(Product_DAT);
|
||||||
Picture.Content = dyelotView;
|
Picture.Content = dyelotView;
|
||||||
}//单据
|
}//单据
|
||||||
private void MenuItem_LOCK_XML(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
bool mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<bool>("LOCK");
|
|
||||||
|
|
||||||
Dictionary<string, object> dat_ = new Dictionary<string, object>();
|
|
||||||
dat_.Clear();
|
|
||||||
|
|
||||||
if (!mode)
|
|
||||||
{
|
|
||||||
dat_.Add("NAME", "LOCK");
|
|
||||||
dat_.Add("VALUE", "True");
|
|
||||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "True");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dat_.Add("NAME", "LOCK");
|
|
||||||
dat_.Add("VALUE", "False");
|
|
||||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "False");
|
|
||||||
}
|
|
||||||
|
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
|
||||||
{
|
|
||||||
ID = index,
|
|
||||||
DAT = "SC829" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_.ToJsonString()
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!mode) { MessageBox.Show(machine + Properties.Resources.user_lock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
} else {
|
|
||||||
MessageBox.Show(machine + Properties.Resources.user_unlock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}//锁定
|
|
||||||
private void MenuItem_AUTO_XML(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
bool mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field<bool>("AUTO");
|
|
||||||
|
|
||||||
Dictionary<string, object> dat_ = new Dictionary<string, object>();
|
|
||||||
dat_.Clear();
|
|
||||||
|
|
||||||
if (!mode)
|
|
||||||
{
|
|
||||||
dat_.Add("NAME", "AUTO");
|
|
||||||
dat_.Add("VALUE", "True");
|
|
||||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "AUTO", "Name='" + machine + "'", "True");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dat_.Add("NAME", "AUTO");
|
|
||||||
dat_.Add("VALUE", "FALSE");
|
|
||||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "AUTO", "Name='" + machine + "'", "False");
|
|
||||||
}
|
|
||||||
|
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
|
||||||
{
|
|
||||||
ID = index,
|
|
||||||
DAT = "SC829" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_.ToJsonString()
|
|
||||||
});
|
|
||||||
|
|
||||||
}//手自动
|
|
||||||
private void ListViewItem_Curve(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Curve(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (rdp.IsConnected) rdp.Disconnect();
|
||||||
log.Visibility = Visibility.Collapsed;
|
log.Visibility = Visibility.Collapsed;
|
||||||
rdp.Visibility = Visibility.Collapsed;
|
rdp.Visibility = Visibility.Collapsed;
|
||||||
Picture.Visibility = Visibility.Visible;
|
Picture.Visibility = Visibility.Visible;
|
||||||
Picture.Content = new View.CurveDiagram(true, "", "", "", workOrder);
|
Picture.Content = new View.CurveDiagram(false, machine, DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss"), DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), workOrder);
|
||||||
machines_info = 3;
|
machines_info = 3;
|
||||||
}//曲线
|
}//曲线
|
||||||
|
|
||||||
private void ListViewItem_Resume(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Resume(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
IsInteractive = false;
|
IsInteractive = false;
|
||||||
@@ -306,17 +544,55 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dat_821.Add("INSTRUCTION", "CONTINUE");
|
dat_821.Add("INSTRUCTION", "CONTINUE");
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Insert.IsEnabled = false;
|
else
|
||||||
edit.IsEnabled = false;
|
{//串口
|
||||||
Resume.IsEnabled = false;
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
Delete.IsEnabled = false;
|
{
|
||||||
Jump.IsEnabled = false;
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Insert.IsHitTestVisible = false;
|
||||||
|
edit.IsHitTestVisible = false;
|
||||||
|
Resume.IsHitTestVisible = false;
|
||||||
|
Delete.IsHitTestVisible = false;
|
||||||
|
Jump.IsHitTestVisible = false;
|
||||||
TechnologicalProcess_bool = true;
|
TechnologicalProcess_bool = true;
|
||||||
}//恢复
|
}//恢复
|
||||||
private void ListViewItem_Paused(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Paused(object sender, MouseButtonEventArgs e)
|
||||||
@@ -329,18 +605,56 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dat_821.Add("INSTRUCTION", "PAUSE");
|
dat_821.Add("INSTRUCTION", "PAUSE");
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Insert.IsEnabled = true;
|
else
|
||||||
edit.IsEnabled = true;
|
{//串口
|
||||||
Paused.IsEnabled = true;
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
Resume.IsEnabled = true;
|
{
|
||||||
Delete.IsEnabled = true;
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
Jump.IsEnabled = true;
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Insert.IsHitTestVisible = true;
|
||||||
|
edit.IsHitTestVisible = true;
|
||||||
|
Paused.IsHitTestVisible = true;
|
||||||
|
Resume.IsHitTestVisible = true;
|
||||||
|
Delete.IsHitTestVisible = true;
|
||||||
|
Jump.IsHitTestVisible = true;
|
||||||
|
|
||||||
}//暂停
|
}//暂停
|
||||||
private void ListViewItem_Stop(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Stop(object sender, MouseButtonEventArgs e)
|
||||||
@@ -353,12 +667,50 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dat_821.Add("INSTRUCTION", "STOP");
|
dat_821.Add("INSTRUCTION", "STOP");
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}//停止
|
}//停止
|
||||||
private void ListViewItem_edit(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_edit(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -415,11 +767,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
TechnologicalProcess_bool = true;
|
TechnologicalProcess_bool = true;
|
||||||
}
|
}
|
||||||
private void ListViewItem_Jump(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Jump(object sender, MouseButtonEventArgs e)
|
||||||
@@ -443,11 +833,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TechnologicalProcess_bool = true;
|
TechnologicalProcess_bool = true;
|
||||||
}//跳步
|
}//跳步
|
||||||
@@ -506,11 +934,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void ListViewItem_Delete(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_Delete(object sender, MouseButtonEventArgs e)
|
||||||
@@ -523,11 +989,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dat_821.Add("ID", ID);
|
dat_821.Add("ID", ID);
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MainWindowViewModel.dt_TP.Select("Step="+ID).First().Delete();
|
MainWindowViewModel.dt_TP.Select("Step="+ID).First().Delete();
|
||||||
MainWindowViewModel.dt_TP.AcceptChanges();
|
MainWindowViewModel.dt_TP.AcceptChanges();
|
||||||
@@ -570,6 +1074,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void MenuItem_Delete(object sender, RoutedEventArgs e)//右键删除
|
private void MenuItem_Delete(object sender, RoutedEventArgs e)//右键删除
|
||||||
|
|
||||||
{
|
{
|
||||||
int rownum = Gridstep.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Gridstep.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
@@ -583,11 +1088,49 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dat_821.Add("ID", ID);
|
dat_821.Add("ID", ID);
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
DAT = "SC821" + drEmployee.Field<string>("SYSKEY") + dat_821.ToJsonString()
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC821" + drEmployee.Field<string>("Station") + dat_821.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MainWindowViewModel.dt_TP.Select("Step=" + ID).First().Delete();
|
MainWindowViewModel.dt_TP.Select("Step=" + ID).First().Delete();
|
||||||
MainWindowViewModel.dt_TP.AcceptChanges();
|
MainWindowViewModel.dt_TP.AcceptChanges();
|
||||||
@@ -610,9 +1153,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||||
{
|
{
|
||||||
DATA_view();
|
DATA_view();
|
||||||
if (Paused.IsEnabled)
|
if (Paused.IsHitTestVisible)
|
||||||
{
|
{
|
||||||
if (!Resume.IsEnabled)
|
if (!Resume.IsHitTestVisible)
|
||||||
{
|
{
|
||||||
Time_D++;
|
Time_D++;
|
||||||
if (Time_D > 10)
|
if (Time_D > 10)
|
||||||
@@ -640,7 +1183,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC832" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
|
DAT = "SC832" + drEmployee.Field<string>("SYSKEY")
|
||||||
});
|
});
|
||||||
}//信息
|
}//信息
|
||||||
else if (machines_info == 1)
|
else if (machines_info == 1)
|
||||||
@@ -658,7 +1201,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC831" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
|
DAT = "SC831" + drEmployee.Field<string>("SYSKEY")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
{
|
{
|
||||||
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
||||||
{
|
{
|
||||||
Interval = TimeSpan.FromSeconds(1)//秒
|
Interval = TimeSpan.FromSeconds(5)//秒
|
||||||
};
|
};
|
||||||
timer1s.Tick += Tick_Event_1S;
|
timer1s.Tick += Tick_Event_1S;
|
||||||
timer1s.Start();
|
timer1s.Start();
|
||||||
@@ -288,11 +288,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
public static bool UI;
|
public static bool UI;
|
||||||
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||||
{
|
{
|
||||||
if (UI)
|
// if (UI)
|
||||||
{
|
// {
|
||||||
GanttChartNEW();
|
GanttChartNEW();
|
||||||
UI= false;
|
// UI= false;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsHitTestVisible="False" x:Name="edit">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Rename" IsEnabled="False" x:Name="Rename">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Rename" IsHitTestVisible="False" x:Name="Rename">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Rename" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Rename" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Rename}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Rename}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Remark" IsEnabled="False" x:Name="Remark">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Remark" IsHitTestVisible="False" x:Name="Remark">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Note" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Note" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Remark}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Remark}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsHitTestVisible="False" x:Name="Delete">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
Programgroup_ID = (Grid.Columns[0].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
Programgroup_ID = (Grid.Columns[0].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
Programgroup_Numder = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
Programgroup_Numder = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||||
}
|
}
|
||||||
edit.IsEnabled = true;
|
edit.IsHitTestVisible = true;
|
||||||
Rename.IsEnabled = true;
|
Rename.IsHitTestVisible = true;
|
||||||
Remark.IsEnabled = true;
|
Remark.IsHitTestVisible = true;
|
||||||
Delete.IsEnabled = true;
|
Delete.IsHitTestVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件
|
private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件
|
||||||
@@ -102,20 +102,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件
|
private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件
|
||||||
{
|
{
|
||||||
edit.IsEnabled = false;
|
edit.IsHitTestVisible = false;
|
||||||
Rename.IsEnabled = false;
|
Rename.IsHitTestVisible = false;
|
||||||
Remark.IsEnabled = false;
|
Remark.IsHitTestVisible = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsHitTestVisible = false;
|
||||||
if (Programgroup_ID == null) return;
|
if (Programgroup_ID == null) return;
|
||||||
container.Content = new ProgramstepsView();
|
container.Content = new ProgramstepsView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListViewItem_Rename(object sender, System.Windows.Input.MouseButtonEventArgs e)//重命名
|
private void ListViewItem_Rename(object sender, System.Windows.Input.MouseButtonEventArgs e)//重命名
|
||||||
{
|
{
|
||||||
edit.IsEnabled = false;
|
edit.IsHitTestVisible = false;
|
||||||
Rename.IsEnabled = false;
|
Rename.IsHitTestVisible = false;
|
||||||
Remark.IsEnabled = false;
|
Remark.IsHitTestVisible = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsHitTestVisible = false;
|
||||||
if (Programgroup_ID == null) return;
|
if (Programgroup_ID == null) return;
|
||||||
InputBox frm = new InputBox();
|
InputBox frm = new InputBox();
|
||||||
frm.Accept += new EventHandler(InputBox_Rename_accept);
|
frm.Accept += new EventHandler(InputBox_Rename_accept);
|
||||||
@@ -130,9 +130,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
Dictionary<string, object> Program_Rename = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Program_Rename = new Dictionary<string, object>();//缓存函数
|
||||||
Program_Rename.Add("ProgramName", VALUE);
|
Program_Rename.Add("ProgramName", VALUE);
|
||||||
Program_Rename.Add("Groups", Group.Text);
|
Program_Rename.Add("Groups", Group.Text);
|
||||||
|
|
||||||
MainWindowViewModel.SQLiteHelpers.Update("ProgramName", Program_Rename, "ProgramID='" + Programgroup_ID + "'", null);
|
MainWindowViewModel.SQLiteHelpers.Update("ProgramName", Program_Rename, "ProgramID='" + Programgroup_ID + "'", null);
|
||||||
|
|
||||||
|
|
||||||
|
Dictionary<string, object> Program_Steps = new Dictionary<string, object>();//缓存函数
|
||||||
|
Program_Steps.Add("Program", VALUE);
|
||||||
|
MainWindowViewModel.SQLiteHelpers.Update("ProgramSteps", Program_Steps, "ProgramID='" + Programgroup_ID + "'", null);
|
||||||
|
|
||||||
Programgroup_sql();
|
Programgroup_sql();
|
||||||
Programgroup_Numder = null;
|
Programgroup_Numder = null;
|
||||||
Programgroup_ID = null;
|
Programgroup_ID = null;
|
||||||
@@ -140,10 +144,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void ListViewItem_Remark(object sender, System.Windows.Input.MouseButtonEventArgs e)//备注
|
private void ListViewItem_Remark(object sender, System.Windows.Input.MouseButtonEventArgs e)//备注
|
||||||
{
|
{
|
||||||
edit.IsEnabled = false;
|
edit.IsHitTestVisible = false;
|
||||||
Rename.IsEnabled = false;
|
Rename.IsHitTestVisible = false;
|
||||||
Remark.IsEnabled = false;
|
Remark.IsHitTestVisible = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsHitTestVisible = false;
|
||||||
if (Programgroup_ID == null) return;
|
if (Programgroup_ID == null) return;
|
||||||
InputBox frm = new InputBox();
|
InputBox frm = new InputBox();
|
||||||
frm.Accept += new EventHandler(InputBox_Remark_accept);
|
frm.Accept += new EventHandler(InputBox_Remark_accept);
|
||||||
@@ -167,10 +171,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除
|
private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除
|
||||||
{
|
{
|
||||||
edit.IsEnabled = false;
|
edit.IsHitTestVisible = false;
|
||||||
Rename.IsEnabled = false;
|
Rename.IsHitTestVisible = false;
|
||||||
Remark.IsEnabled = false;
|
Remark.IsHitTestVisible = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsHitTestVisible = false;
|
||||||
if (Programgroup_Numder == null) return;
|
if (Programgroup_Numder == null) return;
|
||||||
///弹窗提示确认删除
|
///弹窗提示确认删除
|
||||||
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + Programgroup_Numder, "Delete ",
|
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + Programgroup_Numder, "Delete ",
|
||||||
|
|||||||
@@ -159,7 +159,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsHitTestVisible="False" x:Name="edit">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsEnabled="False" x:Name="Insert">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsHitTestVisible="False" x:Name="Insert">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="InsertComment" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="InsertComment" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</ListView>
|
</ListView>
|
||||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||||
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete">
|
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsHitTestVisible="False" x:Name="Delete">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
|
|||||||
+141
-37
@@ -1,4 +1,6 @@
|
|||||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
|
||||||
|
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||||
using System;
|
using System;
|
||||||
@@ -25,6 +27,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using TouchSocket.Core;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
|
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||||
@@ -100,9 +103,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void Grid_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)//表格选择事件
|
private void Grid_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)//表格选择事件
|
||||||
{
|
{
|
||||||
edit.IsEnabled = true;
|
edit.IsHitTestVisible = true;
|
||||||
Insert.IsEnabled = true;
|
Insert.IsHitTestVisible = true;
|
||||||
Delete.IsEnabled = true;
|
Delete.IsHitTestVisible = true;
|
||||||
int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
@@ -119,9 +122,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件
|
private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件
|
||||||
{
|
{
|
||||||
edit.IsEnabled = true;
|
edit.IsHitTestVisible = true;
|
||||||
Insert.IsEnabled = true;
|
Insert.IsHitTestVisible = true;
|
||||||
Delete.IsEnabled = true;
|
Delete.IsHitTestVisible = true;
|
||||||
int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
@@ -135,7 +138,47 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
|
StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||||
if (ID == null) ID = Step.Rows.Count.ToString();
|
if (string.IsNullOrEmpty(ID))
|
||||||
|
{
|
||||||
|
DataRow dr = Step.NewRow();//添加表数据
|
||||||
|
dr["ProgramID"] = ProgramID;
|
||||||
|
dr["Program"] = ProgramNAME;
|
||||||
|
dr["Parameter1"] = 0;
|
||||||
|
dr["Parameter2"] = 0;
|
||||||
|
dr["Parameter3"] = 0;
|
||||||
|
dr["Parameter4"] = 0;
|
||||||
|
dr["Parameter5"] = 0;
|
||||||
|
dr["Parameter6"] = 0;
|
||||||
|
dr["Parameter7"] = 0;
|
||||||
|
dr["Parameter8"] = 0;
|
||||||
|
dr["Parameter9"] = 0;
|
||||||
|
dr["Parameter10"] = 0;
|
||||||
|
dr["Parameter1_S1"] = 0;
|
||||||
|
dr["Parameter2_S1"] = 0;
|
||||||
|
dr["Parameter3_S1"] = 0;
|
||||||
|
dr["Parameter4_S1"] = 0;
|
||||||
|
dr["Parameter5_S1"] = 0;
|
||||||
|
dr["Parameter1_S2"] = 0;
|
||||||
|
dr["Parameter2_S2"] = 0;
|
||||||
|
dr["Parameter3_S2"] = 0;
|
||||||
|
dr["Parameter4_S2"] = 0;
|
||||||
|
dr["Parameter5_S2"] = 0;
|
||||||
|
dr["Parameter1_S3"] = 0;
|
||||||
|
dr["Parameter2_S3"] = 0;
|
||||||
|
dr["Parameter3_S3"] = 0;
|
||||||
|
dr["Parameter4_S3"] = 0;
|
||||||
|
dr["Parameter5_S3"] = 0;
|
||||||
|
dr["StepName_S1"] = " ";
|
||||||
|
dr["StepName_S2"] = " ";
|
||||||
|
dr["StepName_S3"] = " ";
|
||||||
|
dr["StepID_S1"] = "000";
|
||||||
|
dr["StepID_S2"] = "000";
|
||||||
|
dr["StepID_S3"] = "000";
|
||||||
|
Step.Rows.InsertAt(dr, Step.Rows.Count);
|
||||||
|
Dat(Step);
|
||||||
|
ID = (Step.Rows.Count).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
||||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||||
viewstop.data = ID;
|
viewstop.data = ID;
|
||||||
@@ -150,11 +193,50 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件
|
private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件
|
||||||
{
|
{
|
||||||
edit.IsEnabled = false;
|
edit.IsHitTestVisible = false;
|
||||||
Insert.IsEnabled = false;
|
Insert.IsHitTestVisible = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsHitTestVisible = false;
|
||||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||||
if (ID == null) ID = Step.Rows.Count.ToString();
|
if (string.IsNullOrEmpty(ID))
|
||||||
|
{
|
||||||
|
DataRow dr = Step.NewRow();//添加表数据
|
||||||
|
dr["ProgramID"] = ProgramID;
|
||||||
|
dr["Program"] = ProgramNAME;
|
||||||
|
dr["Parameter1"] = 0;
|
||||||
|
dr["Parameter2"] = 0;
|
||||||
|
dr["Parameter3"] = 0;
|
||||||
|
dr["Parameter4"] = 0;
|
||||||
|
dr["Parameter5"] = 0;
|
||||||
|
dr["Parameter6"] = 0;
|
||||||
|
dr["Parameter7"] = 0;
|
||||||
|
dr["Parameter8"] = 0;
|
||||||
|
dr["Parameter9"] = 0;
|
||||||
|
dr["Parameter10"] = 0;
|
||||||
|
dr["Parameter1_S1"] = 0;
|
||||||
|
dr["Parameter2_S1"] = 0;
|
||||||
|
dr["Parameter3_S1"] = 0;
|
||||||
|
dr["Parameter4_S1"] = 0;
|
||||||
|
dr["Parameter5_S1"] = 0;
|
||||||
|
dr["Parameter1_S2"] = 0;
|
||||||
|
dr["Parameter2_S2"] = 0;
|
||||||
|
dr["Parameter3_S2"] = 0;
|
||||||
|
dr["Parameter4_S2"] = 0;
|
||||||
|
dr["Parameter5_S2"] = 0;
|
||||||
|
dr["Parameter1_S3"] = 0;
|
||||||
|
dr["Parameter2_S3"] = 0;
|
||||||
|
dr["Parameter3_S3"] = 0;
|
||||||
|
dr["Parameter4_S3"] = 0;
|
||||||
|
dr["Parameter5_S3"] = 0;
|
||||||
|
dr["StepName_S1"] = " ";
|
||||||
|
dr["StepName_S2"] = " ";
|
||||||
|
dr["StepName_S3"] = " ";
|
||||||
|
dr["StepID_S1"] = "000";
|
||||||
|
dr["StepID_S2"] = "000";
|
||||||
|
dr["StepID_S3"] = "000";
|
||||||
|
Step.Rows.InsertAt(dr, Step.Rows.Count);
|
||||||
|
Dat(Step);
|
||||||
|
ID = Step.Rows.Count.ToString();
|
||||||
|
}
|
||||||
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
||||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||||
viewstop.data = ID;
|
viewstop.data = ID;
|
||||||
@@ -163,16 +245,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||||
{
|
{
|
||||||
int i = Step.Rows.Count;
|
int i = Step.Rows.Count;
|
||||||
int n = StrToInt.To16Convert10(ID);
|
int n = Convert.ToInt16(ID);
|
||||||
if (i == n)
|
|
||||||
{
|
|
||||||
DataRow dr_ = Step.NewRow();//添加表数据
|
|
||||||
dr_["ProgramID"] = ProgramID;
|
|
||||||
dr_["Program"] = ProgramNAME;
|
|
||||||
Step.Rows.Add(dr_);
|
|
||||||
Dat(Step);
|
|
||||||
ID = (n + 1).ToString();
|
|
||||||
}
|
|
||||||
int steptime = 0;//时间秒
|
int steptime = 0;//时间秒
|
||||||
string[] time_D = { "001", "013", "015", "017", "065" };
|
string[] time_D = { "001", "013", "015", "017", "065" };
|
||||||
string[] time_J = { "031", "093" };
|
string[] time_J = { "031", "093" };
|
||||||
@@ -242,13 +316,45 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void ListViewItem_Insert(object sender, System.Windows.Input.MouseButtonEventArgs e)//插入事件
|
private void ListViewItem_Insert(object sender, System.Windows.Input.MouseButtonEventArgs e)//插入事件
|
||||||
{
|
{
|
||||||
edit.IsEnabled = false;
|
edit.IsHitTestVisible = false;
|
||||||
Insert.IsEnabled = false;
|
Insert.IsHitTestVisible = false;
|
||||||
Delete.IsEnabled = false; int d = 0;
|
Delete.IsHitTestVisible = false;
|
||||||
|
int d = 0;
|
||||||
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
||||||
DataRow dr = Step.NewRow();//添加表数据
|
DataRow dr = Step.NewRow();//添加表数据
|
||||||
dr["ProgramID"] = ProgramID;
|
dr["ProgramID"] = ProgramID;
|
||||||
dr["Program"] = ProgramNAME;
|
dr["Program"] = ProgramNAME;
|
||||||
|
dr["Parameter1"] = 0;
|
||||||
|
dr["Parameter2"] = 0;
|
||||||
|
dr["Parameter3"] = 0;
|
||||||
|
dr["Parameter4"] = 0;
|
||||||
|
dr["Parameter5"] = 0;
|
||||||
|
dr["Parameter6"] = 0;
|
||||||
|
dr["Parameter7"] = 0;
|
||||||
|
dr["Parameter8"] = 0;
|
||||||
|
dr["Parameter9"] = 0;
|
||||||
|
dr["Parameter10"] = 0;
|
||||||
|
dr["Parameter1_S1"] = 0;
|
||||||
|
dr["Parameter2_S1"] = 0;
|
||||||
|
dr["Parameter3_S1"] = 0;
|
||||||
|
dr["Parameter4_S1"] = 0;
|
||||||
|
dr["Parameter5_S1"] = 0;
|
||||||
|
dr["Parameter1_S2"] = 0;
|
||||||
|
dr["Parameter2_S2"] = 0;
|
||||||
|
dr["Parameter3_S2"] = 0;
|
||||||
|
dr["Parameter4_S2"] = 0;
|
||||||
|
dr["Parameter5_S2"] = 0;
|
||||||
|
dr["Parameter1_S3"] = 0;
|
||||||
|
dr["Parameter2_S3"] = 0;
|
||||||
|
dr["Parameter3_S3"] = 0;
|
||||||
|
dr["Parameter4_S3"] = 0;
|
||||||
|
dr["Parameter5_S3"] = 0;
|
||||||
|
dr["StepName_S1"] = " ";
|
||||||
|
dr["StepName_S2"] = " ";
|
||||||
|
dr["StepName_S3"] = " ";
|
||||||
|
dr["StepID_S1"] = "000";
|
||||||
|
dr["StepID_S2"] = "000";
|
||||||
|
dr["StepID_S3"] = "000";
|
||||||
Step.Rows.InsertAt(dr, d - 1);
|
Step.Rows.InsertAt(dr, d - 1);
|
||||||
ID = null;
|
ID = null;
|
||||||
|
|
||||||
@@ -258,16 +364,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void ListViewItem_Save(object sender, System.Windows.Input.MouseButtonEventArgs e)//保存事件
|
private void ListViewItem_Save(object sender, System.Windows.Input.MouseButtonEventArgs e)//保存事件
|
||||||
{
|
{
|
||||||
edit.IsEnabled = false;
|
edit.IsHitTestVisible = false;
|
||||||
Insert.IsEnabled = false;
|
Insert.IsHitTestVisible = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsHitTestVisible = false;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
MainWindowViewModel.SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '" + ProgramID + "'", null);
|
MainWindowViewModel.SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '" + ProgramID + "'", null);
|
||||||
DataTable data_t = new DataTable();
|
DataTable data_t = new DataTable();
|
||||||
data_t = Step.Clone();
|
data_t = Step.Clone();
|
||||||
|
|
||||||
int a = Step.Rows.Count;
|
int a = Step.Rows.Count;
|
||||||
for (int i = 0; i < a - 1; i++)
|
for (int i = 0; i < a ; i++)
|
||||||
{
|
{
|
||||||
data_t.Clear();//清空
|
data_t.Clear();//清空
|
||||||
|
|
||||||
@@ -295,17 +401,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
|
|
||||||
private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除事件
|
private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除事件
|
||||||
{
|
{
|
||||||
edit.IsEnabled = false;
|
edit.IsHitTestVisible = false;
|
||||||
Insert.IsEnabled = false;
|
Insert.IsHitTestVisible = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsHitTestVisible = false;
|
||||||
|
|
||||||
int d = 0;
|
|
||||||
int a = Step.Rows.Count;
|
int a = Step.Rows.Count;
|
||||||
|
int rownum = Grid_step.SelectedIndex;
|
||||||
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
if (rownum >= 0 && rownum<a)
|
||||||
if (a != d)//如果删除不是最后一行执行
|
|
||||||
{
|
{
|
||||||
Step.Rows.RemoveAt(d - 1);
|
Step.Rows.RemoveAt(rownum);
|
||||||
Dat(Step);
|
Dat(Step);
|
||||||
Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
|
Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
CrosshairSnapEnabled = true,
|
CrosshairSnapEnabled = true,
|
||||||
Position = LiveChartsCore.Measure.AxisPosition.End
|
Position = LiveChartsCore.Measure.AxisPosition.End
|
||||||
}, //液位轴
|
}, //液位轴
|
||||||
new Axis //
|
/* new Axis //
|
||||||
{
|
{
|
||||||
MinLimit =0,
|
MinLimit =0,
|
||||||
MaxLimit =14,
|
MaxLimit =14,
|
||||||
@@ -106,10 +106,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
DrawTicksPath = true,
|
DrawTicksPath = true,
|
||||||
CrosshairSnapEnabled = true,
|
CrosshairSnapEnabled = true,
|
||||||
Position = LiveChartsCore.Measure.AxisPosition.End
|
Position = LiveChartsCore.Measure.AxisPosition.End
|
||||||
}, //PH轴
|
},*/ //PH轴
|
||||||
};
|
};
|
||||||
|
|
||||||
private static Random _r = new Random();
|
|
||||||
private static ObservableCollection<DateTimePoint> MTT_values;
|
private static ObservableCollection<DateTimePoint> MTT_values;
|
||||||
private static ObservableCollection<DateTimePoint> MTL_values;
|
private static ObservableCollection<DateTimePoint> MTL_values;
|
||||||
private static ObservableCollection<DateTimePoint> MTH_values;
|
private static ObservableCollection<DateTimePoint> MTH_values;
|
||||||
@@ -121,9 +120,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
private static ObservableCollection<DateTimePoint> STLB_values;
|
private static ObservableCollection<DateTimePoint> STLB_values;
|
||||||
private static ObservableCollection<DateTimePoint> STTC_values;
|
private static ObservableCollection<DateTimePoint> STTC_values;
|
||||||
private static ObservableCollection<DateTimePoint> STLC_values;
|
private static ObservableCollection<DateTimePoint> STLC_values;
|
||||||
|
|
||||||
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
|
||||||
private static string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
|
|
||||||
static DataTable CDB = new DataTable();
|
static DataTable CDB = new DataTable();
|
||||||
private static int CDB_Count;//长度
|
private static int CDB_Count;//长度
|
||||||
|
|
||||||
@@ -136,10 +132,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
if (mode)
|
if (mode)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(w)) return;
|
if (string.IsNullOrEmpty(w)) return;
|
||||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
CDB = MainWindowViewModel.SQLiteChartAdress.ExecuteDataSet("select * from Chart where WorkOrder = '" + w + "'order by Time", null).Tables[0];
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
|
||||||
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where WorkOrder = '" + w + "'order by Time", null).Tables[0];
|
|
||||||
SQLiteHelpers.Close();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -147,18 +140,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
if (string.IsNullOrEmpty(m)) return;
|
if (string.IsNullOrEmpty(m)) return;
|
||||||
if (string.IsNullOrEmpty(s)) return;
|
if (string.IsNullOrEmpty(s)) return;
|
||||||
if (string.IsNullOrEmpty(e)) return;
|
if (string.IsNullOrEmpty(e)) return;
|
||||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where Machine = '" + m + "'" +
|
CDB = MainWindowViewModel.SQLiteChartAdress.ExecuteDataSet("select * from Chart where Machine = '" + m + "'" +
|
||||||
" and Time > '" + s + "' and Time < '" + e + "' order by Time", null).Tables[0];
|
" and Time > '" + s + "' and Time < '" + e + "' order by Time", null).Tables[0];
|
||||||
SQLiteHelpers.Close();
|
// SQLiteHelpers.Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CDB_Count = CDB.Rows.Count;
|
CDB_Count = CDB.Rows.Count;
|
||||||
var MTT_items = new List<DateTimePoint>();
|
var MTT_items = new List<DateTimePoint>();
|
||||||
var MTL_items = new List<DateTimePoint>();
|
var MTL_items = new List<DateTimePoint>();
|
||||||
var MTH_items = new List<DateTimePoint>();
|
// var MTH_items = new List<DateTimePoint>();
|
||||||
var MST_items = new List<DateTimePoint>();
|
var MST_items = new List<DateTimePoint>();
|
||||||
var MUT_items = new List<DateTimePoint>();
|
var MUT_items = new List<DateTimePoint>();
|
||||||
var STTA_items = new List<DateTimePoint>();
|
var STTA_items = new List<DateTimePoint>();
|
||||||
@@ -167,12 +160,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
var STLB_items = new List<DateTimePoint>();
|
var STLB_items = new List<DateTimePoint>();
|
||||||
var STTC_items = new List<DateTimePoint>();
|
var STTC_items = new List<DateTimePoint>();
|
||||||
var STLC_items = new List<DateTimePoint>();
|
var STLC_items = new List<DateTimePoint>();
|
||||||
for (var i = 0; i < CDB_Count; i++)
|
for (var i = 0; i < CDB_Count; i=i+4)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
|
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
|
||||||
MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT")));
|
MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT")));
|
||||||
MTL_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTL")));
|
MTL_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTL")));
|
||||||
MTH_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTH")));
|
// MTH_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTH")));
|
||||||
MST_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MST")));
|
MST_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MST")));
|
||||||
MUT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MUT")));
|
MUT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MUT")));
|
||||||
STTA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTA")));
|
STTA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTA")));
|
||||||
@@ -181,12 +176,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
STLB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLB")));
|
STLB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLB")));
|
||||||
STTC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTC")));
|
STTC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTC")));
|
||||||
STLC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLC")));
|
STLC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLC")));
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
MTT_values = new ObservableCollection<DateTimePoint>(MTT_items);
|
MTT_values = new ObservableCollection<DateTimePoint>(MTT_items);
|
||||||
MTL_values = new ObservableCollection<DateTimePoint>(MTL_items);
|
MTL_values = new ObservableCollection<DateTimePoint>(MTL_items);
|
||||||
MTH_values = new ObservableCollection<DateTimePoint>(MTH_items);
|
// MTH_values = new ObservableCollection<DateTimePoint>(MTH_items);
|
||||||
MST_values = new ObservableCollection<DateTimePoint>(MST_items);
|
MST_values = new ObservableCollection<DateTimePoint>(MST_items);
|
||||||
MUT_values = new ObservableCollection<DateTimePoint>(MUT_items);
|
MUT_values = new ObservableCollection<DateTimePoint>(MUT_items);
|
||||||
STTA_values = new ObservableCollection<DateTimePoint>(STTA_items);
|
STTA_values = new ObservableCollection<DateTimePoint>(STTA_items);
|
||||||
@@ -198,7 +194,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
|
|
||||||
Series = new ISeries[]
|
Series = new ISeries[]
|
||||||
{
|
{
|
||||||
new LineSeries<DateTimePoint>
|
/* new LineSeries<DateTimePoint>
|
||||||
{
|
{
|
||||||
Name = Properties.Resources.MasterCylinder +"PH",
|
Name = Properties.Resources.MasterCylinder +"PH",
|
||||||
Values = MTH_values,
|
Values = MTH_values,
|
||||||
@@ -208,7 +204,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
Fill = null,
|
Fill = null,
|
||||||
LineSmoothness = 0,
|
LineSmoothness = 0,
|
||||||
ScalesYAt = 2,
|
ScalesYAt = 2,
|
||||||
}, //PH
|
}, *///PH
|
||||||
new LineSeries<DateTimePoint>
|
new LineSeries<DateTimePoint>
|
||||||
{
|
{
|
||||||
Name = Resources.Target + Resources.Temperature,
|
Name = Resources.Target + Resources.Temperature,
|
||||||
|
|||||||
+501
-227
File diff suppressed because it is too large.
Load diff
@@ -11,7 +11,7 @@
|
|||||||
Title="SUNLIGHT"
|
Title="SUNLIGHT"
|
||||||
Height="150" Width="400">
|
Height="150" Width="400">
|
||||||
<Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}">
|
<Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}">
|
||||||
<TextBox x:Name="Boxx" Height="40" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26"
|
<TextBox x:Name="Boxx" Height="50" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26"
|
||||||
MaxLines="1" BorderThickness="3,3,3,3" ClipToBounds="True"/>
|
MaxLines="1" BorderThickness="3,3,3,3" ClipToBounds="True"/>
|
||||||
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
|
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
|
||||||
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
|
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.UserInf"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
|
||||||
|
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Loaded ="Window_Loaded"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="SUNLIGHT 800" Height="400" Width="800">
|
||||||
|
<Grid>
|
||||||
|
<Grid Margin="0,0,0,100">
|
||||||
|
<TextBox x:Name="INF_DATA" Margin="140,20,20,20" TextWrapping="Wrap" FontSize="30" IsReadOnly="True" BorderBrush="#FF673AB7" BorderThickness="2,2,2,2" Cursor="Hand" />
|
||||||
|
<Image Height="100" Width="100" FlowDirection="LeftToRight" HorizontalAlignment="Left" Margin="20,0,0,0" Source="/Lmage/IconParkInfo.png" VerticalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="45" Margin="50,70,20,20"
|
||||||
|
VerticalAlignment="Bottom" Width="100" Click="YES_Click" HorizontalContentAlignment="Center"/>
|
||||||
|
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="45" Margin="50,70,20,20"
|
||||||
|
VerticalAlignment="Bottom" Width="100" Click="YES_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
|
|
||||||
|
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ViewProgram.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class UserInf : Window
|
||||||
|
{
|
||||||
|
public string Inf_DAT;//信息
|
||||||
|
public UserInf()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
INF_DATA.Text = Inf_DAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void YES_Click(object sender, RoutedEventArgs e)//确认
|
||||||
|
{
|
||||||
|
this.Close(); //关闭窗口
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.UserWorkOrder"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
|
||||||
|
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Loaded ="Window_Loaded"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="SUNLIGHT 800" Height="400" Width="800">
|
||||||
|
<Grid>
|
||||||
|
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="WorkOrder" AlternationCount="2" IsReadOnly="True"
|
||||||
|
SelectedCellsChanged="WorkOrder_SelectedCellsChanged" EnableRowVirtualization="True" EnableColumnVirtualization="True"
|
||||||
|
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
|
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
|
||||||
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="True"
|
||||||
|
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" Margin="0,0,0,132" >
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<Setter Property="Height" Value="30" />
|
||||||
|
<Setter Property="FontSize" Value="25" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||||
|
<Setter Property="Background" Value="#FFF0F0F0" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="False"/>
|
||||||
|
<DataTrigger Binding="{Binding lock}" Value="True">
|
||||||
|
<Setter Property="Background" Value="Red"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding State}" Value="309">
|
||||||
|
<Setter Property="Background" Value="Red"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding State}" Value="308">
|
||||||
|
<Setter Property="Background" Value="Yellow"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding State}" Value="800">
|
||||||
|
<Setter Property="IsHitTestVisible" Value="False"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.CellStyle>
|
||||||
|
<Style TargetType="DataGridCell">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="MinWidth" Value="20"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Resources>
|
||||||
|
<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
|
||||||
|
<Setter Property="Focusable" Value="False"/>
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
|
||||||
|
<Setter Property="Foreground" Value="#000000"/>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.Resources>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!--列信息绑定-->
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.ProgramName}" Binding="{Binding ProgramName}" Width="200" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.StartTime}" Binding="{Binding StartTime}" Width="250" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Machines}" Binding="{Binding Machines}" Width="100" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.ColorNumber}" Binding="{Binding ColorNumber}" Width="200" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Client}" Binding="{Binding Client}" Width="200" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.ClothWeight}" Binding="{Binding ClothWeight}" Width="200" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.ClothSpecies}" Binding="{Binding ClothSpecies}" Width="200" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.BathRatio}" Binding="{Binding BathRatio}" Width="200" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Total}" Binding="{Binding Total}" Width="200" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.USER}" Binding="{Binding USER}" Width="150" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.ColorName}" Binding="{Binding ColorName}" Width="200" IsReadOnly="True"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<Image Height="100" Width="100" FlowDirection="LeftToRight" HorizontalAlignment="Left" Margin="20,0,0,20" Source="/Lmage/IconParkInfo.png" VerticalAlignment="Bottom"/>
|
||||||
|
|
||||||
|
<Button Content="{x:Static lang:Resources.Start}" HorizontalAlignment="Right" Height="45" Margin="50,70,200,20" IsEnabled="False" x:Name="Start"
|
||||||
|
VerticalAlignment="Bottom" Width="100" Click="Start_Click" HorizontalContentAlignment="Center"/>
|
||||||
|
<Button Content="{x:Static lang:Resources.Quit}" HorizontalAlignment="Right" Height="45" Margin="50,70,20,20"
|
||||||
|
VerticalAlignment="Bottom" Width="100" Click="Quit_Click" HorizontalContentAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
using ScottPlot.TickGenerators.TimeUnits;
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using TouchSocket.Core;
|
||||||
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
|
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
|
||||||
|
|
||||||
|
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ViewProgram.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class UserWorkOrder : Window
|
||||||
|
{
|
||||||
|
|
||||||
|
public DataTable WorkOrderTable = new DataTable();//信息
|
||||||
|
private string WorkOrder_=null;
|
||||||
|
private string machine_ = null;
|
||||||
|
public UserWorkOrder()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
WorkOrder.ItemsSource = WorkOrderTable.DefaultView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start_Click(object sender, RoutedEventArgs e)//确认
|
||||||
|
{
|
||||||
|
Dictionary<string, object> dat_821 = new Dictionary<string, object>();
|
||||||
|
dat_821.Clear();
|
||||||
|
dat_821.Add("INSTRUCTION", "START");
|
||||||
|
dat_821.Add("WorkOrder", WorkOrder_);
|
||||||
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine_ + "'").First();
|
||||||
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
|
string dat = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString();
|
||||||
|
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
|
{
|
||||||
|
if (drEmployee.Field<bool>("Type"))
|
||||||
|
{//网络
|
||||||
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
bool exists = stringQueueSerial_2.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
bool exists = stringQueueSerial_4.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
private void Quit_Click(object sender, RoutedEventArgs e)//退出
|
||||||
|
{
|
||||||
|
this.Close(); //关闭窗口
|
||||||
|
}
|
||||||
|
private void WorkOrder_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||||
|
{
|
||||||
|
int rownum = WorkOrder.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
WorkOrder_ = (WorkOrder.Columns[0].GetCellContent(WorkOrder.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
machine_ = (WorkOrder.Columns[3].GetCellContent(WorkOrder.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
|
||||||
|
Start.IsEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -500,8 +500,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
}
|
}
|
||||||
private void NO_Click(object sender, RoutedEventArgs e)//关闭
|
private void NO_Click(object sender, RoutedEventArgs e)//关闭
|
||||||
{
|
{
|
||||||
var args = new AddressUpdateEventArgs(data, "", "", "", dat_D);
|
|
||||||
AddressUpdated(this, args);
|
|
||||||
this.Close(); //关闭窗口
|
this.Close(); //关闭窗口
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Reference in new issue
Block a user