Compare commits
218
Commits
4b08942fc0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed61970ffa | ||
|
|
192d8c7841 | ||
|
|
529aa29677 | ||
|
|
8a383bf4d1 | ||
|
|
fb65c392c8 | ||
|
|
bbf2871230 | ||
|
|
37bcbd8aea | ||
|
|
ce0f43a583 | ||
|
|
1c925c5c95 | ||
|
|
c49ac6c885 | ||
|
|
de56564372 | ||
|
|
83a38deaa6 | ||
|
|
9ff4a7d035 | ||
|
|
ec9eaedc64 | ||
|
|
6adc2ae527 | ||
|
|
cb6facf0d4 | ||
|
|
827e9cc387 | ||
|
|
f57cb897fb | ||
|
|
9fcb61fa52 | ||
|
|
0f0f2bfb30 | ||
|
|
8515d2b100 | ||
|
|
86ae16fa94 | ||
|
|
f58bd85164 | ||
|
|
85bcc41e58 | ||
|
|
9580a0f60c | ||
|
|
280062d86c | ||
|
|
959392786e | ||
|
|
df7bc3bae6 | ||
|
|
edd40f136d | ||
|
|
dc4dfecf15 | ||
|
|
03f77e45c9 | ||
|
|
bc0c921d85 | ||
|
|
36af454eff | ||
|
|
5474b42e7e | ||
|
|
3ea5a91776 | ||
|
|
6a706ea804 | ||
|
|
e96e537d5e | ||
|
|
53fd4909ee | ||
|
|
31ba1bad4c | ||
|
|
adb98a0f46 | ||
|
|
c1712f1368 | ||
|
|
deb1e1bbe9 | ||
|
|
b6f3533709 | ||
|
|
785bacc182 | ||
|
|
263bb90b3d | ||
|
|
2c1d2c0e5f | ||
|
|
0328ddfcd6 | ||
|
|
81e335fc62 | ||
|
|
1b6777f8ad | ||
|
|
d3a021dcf0 | ||
|
|
5c929d8cc9 | ||
|
|
8530d3d750 | ||
|
|
6c18a79a7b | ||
|
|
3bffc936be | ||
|
|
fc217d6448 | ||
|
|
dd6bb40912 | ||
|
|
85028a60bc | ||
|
|
9f89693f97 | ||
|
|
d8c9c8111c | ||
|
|
0c3fa8fd24 | ||
|
|
f39cfd5cbd | ||
|
|
aa1b08f6c4 | ||
|
|
fda9b5210a | ||
|
|
1ef3b73f5a | ||
|
|
abc214763c | ||
|
|
efb99dcf3f | ||
|
|
baee6c4a5f | ||
|
|
2b50338365 | ||
|
|
57549329fe | ||
|
|
d59701122e | ||
|
|
cd1b5f6fb4 | ||
|
|
ce4835ad11 | ||
|
|
f2e356f8a2 | ||
|
|
e70c0d3da2 | ||
|
|
de1f6970e7 | ||
|
|
457eb5121a | ||
|
|
e12a692dce | ||
|
|
7b5fed19c0 | ||
|
|
9ff4b10ed9 | ||
|
|
07e660a317 | ||
|
|
9551a3145e | ||
|
|
502d657a0f | ||
|
|
d1921ced6c | ||
|
|
1754131d54 | ||
|
|
5a7dee6b48 | ||
|
|
926b15bd4d | ||
|
|
14bd70ce48 | ||
|
|
30e742f33a | ||
|
|
872e179104 | ||
|
|
4e0e102381 | ||
|
|
c21d5df123 | ||
|
|
98ca46db07 | ||
|
|
2b274a6502 | ||
|
|
d8276da446 | ||
|
|
c8f7f01340 | ||
|
|
5a1df6c8c6 | ||
|
|
cd632545bd | ||
|
|
fe5566f730 | ||
|
|
d580eed74e | ||
|
|
7567cce849 | ||
|
|
89cd7d3e6b | ||
|
|
ff58075e7b | ||
|
|
e0bdc68e8e | ||
|
|
8fc4999ccc | ||
|
|
701c3abf26 | ||
|
|
be7cfcdcaf | ||
|
|
3b65c73608 | ||
|
|
3e7638a199 | ||
|
|
57b2d5b356 | ||
|
|
6471eec033 | ||
|
|
3c41c2f150 | ||
|
|
7c3d3ecf3a | ||
|
|
ca2d99f28b | ||
|
|
7ccfe7ba81 | ||
|
|
97c12e373b | ||
|
|
ca3156e314 | ||
|
|
41f15e168d | ||
|
|
84ef66268e | ||
|
|
ec55b35065 | ||
|
|
bf8f9a368a | ||
|
|
f3e9acf822 | ||
|
|
ee4bc611ea | ||
|
|
958279bd74 | ||
|
|
4928ff1178 | ||
|
|
a5942b3285 | ||
|
|
f3b5d1eca2 | ||
|
|
1e2bfad5a1 | ||
|
|
0af25953b6 | ||
|
|
505dfebd05 | ||
|
|
3c0270843f | ||
|
|
c54ccea98c | ||
|
|
3d267018b1 | ||
|
|
6903e2264c | ||
|
|
4ba15a8e69 | ||
|
|
94ad77a58b | ||
|
|
03810f8e10 | ||
|
|
fceb6cdea2 | ||
|
|
a6c37286f9 | ||
|
|
900b9e59e9 | ||
|
|
eab45768e4 | ||
|
|
6ce7ce1cc2 | ||
|
|
c17474c77f | ||
|
|
de5d7202c2 | ||
|
|
59ba780070 | ||
|
|
9dafd3115e | ||
|
|
8a4d7c6d4f | ||
|
|
3af7ead309 | ||
|
|
8c38e3e12b | ||
|
|
f7ec9127b6 | ||
|
|
bfa5b59496 | ||
|
|
4d261383e3 | ||
|
|
81c98ec936 | ||
|
|
c8ed59e183 | ||
|
|
169753f266 | ||
|
|
17d66e2bf2 | ||
|
|
3d553d1eed | ||
|
|
87980cc2da | ||
|
|
424b63f0c5 | ||
|
|
d0131a2795 | ||
|
|
16f0c6ecf4 | ||
|
|
1b60fe900b | ||
|
|
e6d467057a | ||
|
|
714168f47f | ||
|
|
f558f56d42 | ||
|
|
f8ec8a6759 | ||
|
|
4324fdd74b | ||
|
|
a5efa3ca59 | ||
|
|
e7dd94bb39 | ||
|
|
714de60f95 | ||
|
|
861d823ce9 | ||
|
|
254d5db8ef | ||
|
|
2d4314a07f | ||
|
|
a3477a1f1a | ||
|
|
9f75476c47 | ||
|
|
48d8ecd8ca | ||
|
|
292e41a5c4 | ||
|
|
d8abe646b7 | ||
|
|
693f291adc | ||
|
|
d3527f0f5c | ||
|
|
9858f2fcaf | ||
|
|
b524ca8050 | ||
|
|
621ea71c97 | ||
|
|
3a54fe47c5 | ||
|
|
33f6e28cfa | ||
|
|
165f707221 | ||
|
|
b2e0d05648 | ||
|
|
8e64f6b27d | ||
|
|
b215016d91 | ||
|
|
b69ee37cbb | ||
|
|
e7053ceab3 | ||
|
|
4c2f130667 | ||
|
|
28c61a4255 | ||
|
|
5b3c4bd41a | ||
|
|
ef749b4aab | ||
|
|
a708429adf | ||
|
|
d68355c547 | ||
|
|
3edea50871 | ||
|
|
d02f6ebc0a | ||
|
|
9f5ec7cb82 | ||
|
|
2e3daa042f | ||
|
|
691055f487 | ||
|
|
e35c278cb2 | ||
|
|
0ea58e23c1 | ||
|
|
b4e7e04a9e | ||
|
|
3e0a2616b9 | ||
|
|
a9675ed171 | ||
|
|
de9487e1eb | ||
|
|
25540082cf | ||
|
|
ec9380df5f | ||
|
|
fb76ba2bf1 | ||
|
|
a1a993f7f1 | ||
|
|
d2ecf44013 | ||
|
|
097c04f0a8 | ||
|
|
5526e61fee | ||
|
|
e9bc3d2e3b | ||
|
|
d070d8b712 | ||
|
|
8c9743851f | ||
|
|
f5ca4ba3d4 |
No files matched your search
+82
-2
@@ -1,13 +1,93 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
</startup>
|
</startup>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Xceed.Wpf.AvalonDock" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
|
<assemblyIdentity name="Xceed.Wpf.AvalonDock" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.6.0.0" newVersion="4.6.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="FastReport.Compat" publicKeyToken="406e1f4c3c8ef97e" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2024.1.0.0" newVersion="2024.1.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="FastReport.Compat" publicKeyToken="5ceb240df42bf6e8" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2024.2.2.0" newVersion="2024.2.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.7.0" newVersion="2.0.7.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="DotNetty.Transport" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="DotNetty.Buffers" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="DotNetty.Codecs.Http" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="DotNetty.Common" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="DotNetty.Codecs" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.17.0" newVersion="2.0.17.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:formula_manage"
|
xmlns:local="clr-namespace:formula_manage"
|
||||||
StartupUri="Login.xaml"
|
Startup="Application_Startup"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
>
|
>
|
||||||
|
|||||||
+60
-15
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.IO;
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace formula_manage
|
namespace formula_manage
|
||||||
@@ -44,25 +40,74 @@ namespace formula_manage
|
|||||||
|
|
||||||
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
if (e.Exception.InnerException == null)
|
if (e.Exception.InnerException == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" + Environment.NewLine
|
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!"
|
||||||
// + "(2)错误源:" + e.Exception.Source + Environment.NewLine
|
+ "(1)错误" + Environment.NewLine
|
||||||
+ "详细信息:" + e.Exception.Message + Environment.NewLine
|
+ "(2)错误源:" + e.Exception.Source + Environment.NewLine
|
||||||
// + "(4)报错区域:" + e.Exception.StackTrace
|
// + (3)详细信息:" + e.Exception.Message + Environment.NewLine
|
||||||
|
// + "(4)报错区域:" + e.Exception.StackTrace
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" + Environment.NewLine
|
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!"
|
||||||
// + "(2)错误源:" + e.Exception.InnerException.Source + Environment.NewLine
|
+ "(1)错误" + Environment.NewLine
|
||||||
+ "错误信息:" + e.Exception.Message + Environment.NewLine
|
// + "(2)错误源:" + e.Exception.InnerException.Source + Environment.NewLine
|
||||||
// + "(4)详细信息:" + e.Exception.InnerException.Message + Environment.NewLine
|
+ "(3)错误信息:" + e.Exception.Message + Environment.NewLine
|
||||||
// + "(5)报错区域:" + e.Exception.InnerException.StackTrace
|
// + "(4)详细信息:" + e.Exception.InnerException.Message + Environment.NewLine
|
||||||
|
// + "(5)报错区域:" + e.Exception.InnerException.StackTrace
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||||
|
string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录
|
||||||
|
//string logPathtxt = "" + System.Environment.CurrentDirectory + "\\Log\\"+ Log_time + "Log.txt";//日志文件
|
||||||
|
// System.IO.DirectoryInfo log = new System.IO.DirectoryInfo();//生成日志文件目录
|
||||||
|
string log_path = logpath + "\\ERR" + Log_time + ".txt";
|
||||||
|
string Log_timehms = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
if (Directory.Exists(logpath))//检查日志路径
|
||||||
|
{
|
||||||
|
if (!File.Exists(log_path))//检查文件并写入
|
||||||
|
{
|
||||||
|
FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建文件
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.Close();
|
||||||
|
FileStream fil = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||||
|
StreamWriter wfil = new StreamWriter(fil);//创建文件
|
||||||
|
wfil.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||||
|
wfil.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
|
||||||
|
wfil.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
||||||
|
wfil.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
|
||||||
|
wfil.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||||
|
wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
|
||||||
|
wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
||||||
|
wr.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
|
||||||
|
wr.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DirectoryInfo directoryInfo = new DirectoryInfo(logpath);
|
||||||
|
directoryInfo.Create();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启动初始页面
|
||||||
|
/// </summary>
|
||||||
|
private void Application_Startup(object sender, StartupEventArgs e)
|
||||||
|
{
|
||||||
|
Application.Current.StartupUri = new Uri("Login.xaml", UriKind.Relative);//和MainWindwo同一目录
|
||||||
|
//Application.Current.StartupUri = new Uri("EX/ExProgram.xaml", UriKind.Relative);//在目录下
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace formula_manage.ConvertMoels
|
namespace formula_manage.ConvertMoels
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace formula_manage.ConvertMoels
|
namespace formula_manage.ConvertMoels
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace Audit.ConvertMoels
|
namespace Audit.ConvertMoels
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace Audit.ConvertMoels
|
namespace Audit.ConvertMoels
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace formula_manage.ConvertMoels
|
namespace formula_manage.ConvertMoels
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace formula_manage.ConvertMoels
|
namespace formula_manage.ConvertMoels
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace formula_manage.ConvertMoels
|
namespace formula_manage.ConvertMoels
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 运行状态变换器
|
/// 运行状态变换器
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace Audit.ConvertMoels
|
namespace Audit.ConvertMoels
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace formula_manage.ConvertMoels
|
namespace formula_manage.ConvertMoels
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<Window x:Class="formula_manage.EX.ExProgram"
|
||||||
|
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:formula_manage.EX"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="ExProgram" Height="720" Width="1280" MinHeight="720" MinWidth="1280" Background="#FFE0E0E0">
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<RichTextBox x:Name="textLog" Margin="0,300,0,0" IsReadOnly="True" VerticalScrollBarVisibility="Visible" Background="White">
|
||||||
|
<FlowDocument>
|
||||||
|
<Paragraph>
|
||||||
|
<Run Text="TEXTLOG"/>
|
||||||
|
</Paragraph>
|
||||||
|
</FlowDocument>
|
||||||
|
</RichTextBox>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using formula_manage.UserClass;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace formula_manage.EX
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ExProgram.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ExProgram : Window
|
||||||
|
{
|
||||||
|
public ExProgram()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
LogDataRead.SetTextControl(textLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<Window x:Class="formula_manage.EX.Exchange"
|
||||||
|
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:formula_manage.EX"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
DataContext="{Binding Source={StaticResource Locator}, Path=Exchange}"
|
||||||
|
Title="Exchange" Height="720" Width="1280" MinHeight="720" MinWidth="1280" Background="#FFE0E0E0">
|
||||||
|
<Grid>
|
||||||
|
<DataGrid x:Name="gridLog" Margin="5,5,0,5" HorizontalAlignment="Left" Width="245" HeadersVisibility ="Column" Background="White" BorderBrush="White"
|
||||||
|
IsReadOnly="True" AutoGenerateColumns="False" MouseDoubleClick="DataGrid_gridLogClick" >
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!--列信息绑定-->
|
||||||
|
<DataGridTextColumn Binding="{Binding Name}" Header="文件" Width="195" MaxWidth="195" MinWidth="195" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Binding="{Binding Length}" Header="大小" Width="50" MaxWidth="50" MinWidth="50" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Binding="{Binding CreationTimeUtc}" Header="创建时间" Width="150" MaxWidth="150" MinWidth="150" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Binding="{Binding LastWriteTimeUtc}" Header="最后修改时间" Width="150" MaxWidth="150" MinWidth="150" CanUserReorder="False"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<RichTextBox x:Name="Logtext" Margin="255,5,5,5" IsReadOnly="True" VerticalScrollBarVisibility="Visible" Background="White" SelectionBrush="White">
|
||||||
|
<FlowDocument>
|
||||||
|
<Paragraph>
|
||||||
|
<Run Text="LOG"/>
|
||||||
|
</Paragraph>
|
||||||
|
</FlowDocument>
|
||||||
|
</RichTextBox>
|
||||||
|
<!--遮罩-->
|
||||||
|
<Grid Grid.Column="1" x:Name="logR" Margin="0,0,0,0" Background="White" Opacity="0.8" Visibility="Hidden">
|
||||||
|
<TextBlock Height="50" Margin="0,0,0,150" TextWrapping="Wrap" Text="文件读取中请稍后..." Width="300" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace formula_manage.EX
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Exchange.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class Exchange : Window
|
||||||
|
{
|
||||||
|
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||||
|
|
||||||
|
DataTable logdataTable = new DataTable(); //建立RRODUCT缓存
|
||||||
|
|
||||||
|
public Exchange()
|
||||||
|
{
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
logdataTable.Columns.Add("Name", typeof(string));
|
||||||
|
logdataTable.Columns.Add("Length", typeof(int));
|
||||||
|
logdataTable.Columns.Add("CreationTimeUtc", typeof(string));
|
||||||
|
logdataTable.Columns.Add("LastWriteTimeUtc", typeof(string));
|
||||||
|
|
||||||
|
LOG_file();
|
||||||
|
}
|
||||||
|
private void LOG_file()//建立列表
|
||||||
|
{
|
||||||
|
DirectoryInfo loginfo = new DirectoryInfo(System.Environment.CurrentDirectory + "\\Exchange"); //new文件夹
|
||||||
|
|
||||||
|
foreach (var item in loginfo.GetFiles())
|
||||||
|
{
|
||||||
|
DataRow FileRow = logdataTable.NewRow();
|
||||||
|
|
||||||
|
FileRow["Name"] = item.Name;
|
||||||
|
FileRow["Length"] = item.Length / 1024;
|
||||||
|
FileRow["CreationTimeUtc"] = item.CreationTimeUtc;
|
||||||
|
FileRow["LastWriteTimeUtc"] = item.LastWriteTimeUtc;
|
||||||
|
logdataTable.Rows.Add(FileRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
gridLog.ItemsSource = logdataTable.DefaultView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGrid_gridLogClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
|
{
|
||||||
|
int rownum = gridLog.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
logR.Visibility = Visibility.Visible; //开启页面遮罩
|
||||||
|
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
|
LOGDATA_file((gridLog.Columns[0].GetCellContent(gridLog.Items[rownum]) as TextBlock).Text.TrimEnd());//
|
||||||
|
}
|
||||||
|
|
||||||
|
logR.Visibility = Visibility.Hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LOGDATA_file(string dat) //读取文件显示到前端
|
||||||
|
{
|
||||||
|
Logtext.Document = new FlowDocument();
|
||||||
|
string filePath = System.Environment.CurrentDirectory + "\\Exchange\\";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 使用StreamReader读取文件
|
||||||
|
using (StreamReader reader = new StreamReader(filePath + dat))
|
||||||
|
{
|
||||||
|
// 读取文件直到文件的末尾
|
||||||
|
while (!reader.EndOfStream)
|
||||||
|
{
|
||||||
|
// 添加文件的每一行到RichTextBox
|
||||||
|
Logtext.AppendText(reader.ReadLine() + "\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 处理可能发生的任何异常
|
||||||
|
MessageBox.Show("Error reading file: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Report ScriptLanguage="CSharp" DoublePass="true" ReportInfo.Created="05/03/2024 18:43:19" ReportInfo.Modified="05/04/2024 14:44:19" ReportInfo.CreatorVersion="2024.2.2.0">
|
||||||
|
<Dictionary/>
|
||||||
|
<ReportPage Name="Page1" Watermark.Font="宋体, 60pt">
|
||||||
|
<ReportTitleBand Name="ReportTitle1" Width="718.2" Height="37.8">
|
||||||
|
<TextObject Name="Text1" Left="283.5" Top="9.45" Width="94.5" Height="18.9" Text="领料单" Font="宋体, 15.75pt"/>
|
||||||
|
</ReportTitleBand>
|
||||||
|
<PageHeaderBand Name="PageHeader1" Top="41.8" Width="718.2" Height="28.35"/>
|
||||||
|
<DataBand Name="Data1" Top="74.15" Width="718.2" Height="75.6"/>
|
||||||
|
<PageFooterBand Name="PageFooter1" Top="153.75" Width="718.2" Height="18.9"/>
|
||||||
|
</ReportPage>
|
||||||
|
</Report>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Report ScriptLanguage="CSharp" DoublePass="true" ReportInfo.Created="05/03/2024 18:43:19" ReportInfo.Modified="05/04/2024 15:07:10" ReportInfo.CreatorVersion="2024.2.2.0">
|
||||||
|
<Dictionary/>
|
||||||
|
<ReportPage Name="Page1" PaperWidth="80" Guides="472.5" Watermark.Font="宋体, 60pt">
|
||||||
|
<ReportTitleBand Name="ReportTitle1" Width="226.8" Height="37.8"/>
|
||||||
|
<DataBand Name="Data1" Top="41.8" Width="226.8" Height="302.4">
|
||||||
|
<BarcodeObject Name="Barcode1" Left="529.2" Top="9.45" Width="172" Height="122" Barcode="PDF417" Barcode.AspectRatio="0.5" Barcode.Columns="0" Barcode.Rows="0" Barcode.CodePage="437" Barcode.CompactionMode="Auto" Barcode.ErrorCorrection="Auto" Barcode.PixelSize="2, 8"/>
|
||||||
|
<BarcodeObject Name="Barcode2" Left="47.25" Top="9.45" Width="126.25" Height="94.5" Barcode="GS1-128 (UCC/EAN-128)" Barcode.AutoEncode="true"/>
|
||||||
|
</DataBand>
|
||||||
|
</ReportPage>
|
||||||
|
</Report>
|
||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
|||||||
|
Want to create localization for your language? Please drop an email to tz@fast-report.com.
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:local="clr-namespace:formula_manage.Flow_Document"
|
|
||||||
ColumnWidth="400" FontSize="14" FontFamily="Georgia">
|
|
||||||
<Paragraph>
|
|
||||||
|
|
||||||
</Paragraph>
|
|
||||||
</FlowDocument>
|
|
||||||
+1
-13
@@ -1,16 +1,4 @@
|
|||||||
using System;
|
using System.Windows;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace formula_manage
|
namespace formula_manage
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-7
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace formula_manage
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace formula_manage
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询接口
|
/// 查询接口
|
||||||
|
|||||||
+52
-45
@@ -1,24 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Data;
|
|
||||||
using System.Security.Policy;
|
|
||||||
using System.IO;
|
|
||||||
using formula_manage.Windows;
|
|
||||||
|
|
||||||
namespace formula_manage
|
namespace formula_manage
|
||||||
{
|
{
|
||||||
@@ -27,11 +14,6 @@ namespace formula_manage
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Login : Window
|
public partial class Login : Window
|
||||||
{
|
{
|
||||||
|
|
||||||
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
|
||||||
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
|
|
||||||
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
|
||||||
|
|
||||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
|
||||||
DataTable logindataTable = new DataTable(); //建立login缓存
|
DataTable logindataTable = new DataTable(); //建立login缓存
|
||||||
@@ -41,27 +23,14 @@ namespace formula_manage
|
|||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
UserClass.LogGing.LogGingDATA("FORMULA_start");
|
||||||
if (!File.Exists(logPath))//检查日志文件并写入启动日志
|
|
||||||
{
|
|
||||||
FileStream fs = new FileStream(logPath, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
|
||||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
|
||||||
wr.WriteLine(Log_time + "FORMULA_start");
|
|
||||||
wr.Close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
|
||||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
|
||||||
wr.WriteLine(Log_time + "FORMULA_start");
|
|
||||||
wr.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e) //退出按钮事件
|
private void Button_Click(object sender, RoutedEventArgs e) //退出按钮事件
|
||||||
{
|
{
|
||||||
this.Close();
|
UserClass.LogGing.LogGingDATA("FORMULA_LogStop");
|
||||||
|
Window window = Window.GetWindow(this);
|
||||||
|
window.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click_1(object sender, RoutedEventArgs e) //登录按钮事件
|
private void Button_Click_1(object sender, RoutedEventArgs e) //登录按钮事件
|
||||||
@@ -82,7 +51,10 @@ namespace formula_manage
|
|||||||
Window window = Window.GetWindow(this);
|
Window window = Window.GetWindow(this);
|
||||||
MainWindow Main = new MainWindow();
|
MainWindow Main = new MainWindow();
|
||||||
window.Close();
|
window.Close();
|
||||||
Main.ShowDialog();//实例化并置顶打开信息窗口
|
|
||||||
|
UserClass.LogGing.LogGingDATA("LOGon = ENGINEER");
|
||||||
|
|
||||||
|
Main.ShowDialog();//实例化并置顶打开窗口
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -100,8 +72,10 @@ namespace formula_manage
|
|||||||
Window window = Window.GetWindow(this);
|
Window window = Window.GetWindow(this);
|
||||||
MainWindow Main = new MainWindow();
|
MainWindow Main = new MainWindow();
|
||||||
window.Close();
|
window.Close();
|
||||||
Main.ShowDialog();//实例化并置顶打开窗口
|
|
||||||
|
|
||||||
|
UserClass.LogGing.LogGingDATA("LOGon = " + user);
|
||||||
|
|
||||||
|
Main.ShowDialog();//实例化并置顶打开窗口
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
System.Windows.MessageBox.Show("账号或密码错误");
|
System.Windows.MessageBox.Show("账号或密码错误");
|
||||||
@@ -139,14 +113,36 @@ namespace formula_manage
|
|||||||
DBCLINK.Visibility = Visibility.Hidden;
|
DBCLINK.Visibility = Visibility.Hidden;
|
||||||
EXLINK.Visibility = Visibility.Hidden;
|
EXLINK.Visibility = Visibility.Hidden;
|
||||||
USERLINK.Visibility = Visibility.Hidden;
|
USERLINK.Visibility = Visibility.Hidden;
|
||||||
|
DISPENLINK.Background = Brushes.Red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EXLINK.Background = Brushes.Green;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
EXLINK.Background = Brushes.Red;
|
||||||
|
System.Windows.MessageBox.Show("扩展程序未启动");
|
||||||
|
UserClass.LogGing.LogGingDATA("EX = FALL_TO_START");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
SQL2 = Boolean.Parse(Configini.IniReadvalue("SQL_SERVER", "SQL6")); //数据库对象2是否生效
|
SQL2 = Boolean.Parse(Configini.IniReadvalue("SQL_SERVER", "SQL6")); //数据库对象2是否生效
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("配置信息丢失");
|
||||||
|
}
|
||||||
|
|
||||||
if (TEXT_SQMOD == "0") //判断连接方式
|
if (TEXT_SQMOD == "0") //判断连接方式
|
||||||
{
|
{
|
||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
@@ -161,12 +157,17 @@ namespace formula_manage
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await conn_SC.OpenAsync();
|
await conn_SC.OpenAsync();
|
||||||
}catch (Exception)
|
}
|
||||||
|
catch (Exception)
|
||||||
{
|
{
|
||||||
DISPENLINK.Background = Brushes.Red; //连接失败红色
|
DISPENLINK.Background = Brushes.Red; //连接失败红色
|
||||||
|
DBCLINK.Background = Brushes.Red;
|
||||||
System.Windows.MessageBox.Show("连接数据库失败");
|
System.Windows.MessageBox.Show("连接数据库失败");
|
||||||
Windows.Sql sql = new Windows.Sql();
|
//Windows.Sql sql = new Windows.Sql();
|
||||||
sql.ShowDialog();//实例化并置顶打开数据库设置窗口
|
//sql.ShowDialog();//实例化并置顶打开数据库设置窗口
|
||||||
|
|
||||||
|
UserClass.LogGing.LogGingDATA("DISPENLINK = ConnectFailed");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
conn_SC.Close(); //关闭连接
|
conn_SC.Close(); //关闭连接
|
||||||
@@ -192,12 +193,16 @@ namespace formula_manage
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await conn_DBC.OpenAsync();
|
await conn_DBC.OpenAsync();
|
||||||
}catch (Exception)
|
}
|
||||||
|
catch (Exception)
|
||||||
{
|
{
|
||||||
DBCLINK.Background = Brushes.Red; //连接失败红色
|
DBCLINK.Background = Brushes.Red; //连接失败红色
|
||||||
System.Windows.MessageBox.Show("连接数据库失败");
|
System.Windows.MessageBox.Show("连接数据库失败");
|
||||||
Windows.Sql sql = new Windows.Sql();
|
//Windows.Sql sql = new Windows.Sql();
|
||||||
sql.ShowDialog();//实例化并置顶打开数据库设置窗口
|
//sql.ShowDialog();//实例化并置顶打开数据库设置窗口
|
||||||
|
|
||||||
|
UserClass.LogGing.LogGingDATA("DBCLINK = ConnectFailed");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DBCLINK.Background = Brushes.Green; //连接成功绿色
|
DBCLINK.Background = Brushes.Green; //连接成功绿色
|
||||||
@@ -224,11 +229,13 @@ namespace formula_manage
|
|||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
UserClass.LogGing.LogGingDATA("USER = NoData");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+42
-45
@@ -13,13 +13,9 @@
|
|||||||
<ViewModel:MainWindowViewModel x:Key="MainWindowViewModel"/>
|
<ViewModel:MainWindowViewModel x:Key="MainWindowViewModel"/>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Menu IsTabStop="False" Grid.ColumnSpan="1">
|
||||||
<ColumnDefinition Width="131*"/>
|
|
||||||
<ColumnDefinition Width="509*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Menu IsTabStop="False" Grid.ColumnSpan="2">
|
|
||||||
<MenuItem x:Name="tab" Header="_文件" FontSize="16" Focusable ="False" >
|
<MenuItem x:Name="tab" Header="_文件" FontSize="16" Focusable ="False" >
|
||||||
<MenuItem Header="_许可证" FontSize="16"/>
|
<MenuItem Header="_许可证" Click="CDKEY_SET" FontSize="16"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="_注销" FontSize="16" Click="logout"/>
|
<MenuItem Header="_注销" FontSize="16" Click="logout"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@@ -28,7 +24,8 @@
|
|||||||
<MenuItem Header="_备份/还原" FontSize="16" Name="_SQLBAK" Click="SQLBAK" IsEnabled="False"/>
|
<MenuItem Header="_备份/还原" FontSize="16" Name="_SQLBAK" Click="SQLBAK" IsEnabled="False"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="_软件设置" FontSize="16" Name="_SOFTWARE_SET" Click="SOFTWARE_SET" IsEnabled="False"/>
|
<MenuItem Header="_软件设置" FontSize="16" Name="_SOFTWARE_SET" Click="SOFTWARE_SET" IsEnabled="False"/>
|
||||||
<MenuItem Header="_用户设置" FontSize="16" Name="_USER_SET" Click="USER_SET" IsEnabled="False"/>
|
<MenuItem Header="_打印设置" FontSize="16" Name="_PRINT_SET" Click="PRINT_SET" IsEnabled="False"/>
|
||||||
|
<MenuItem Header="_登录限制" FontSize="16" Name="_USER_log" IsEnabled="False"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="_管理" FontSize="16" Focusable ="False">
|
<MenuItem Header="_管理" FontSize="16" Focusable ="False">
|
||||||
<MenuItem Header="_染色机管理" FontSize="16" Name="_MAC_SET" Click="MAC_SET" IsEnabled="False"/>
|
<MenuItem Header="_染色机管理" FontSize="16" Name="_MAC_SET" Click="MAC_SET" IsEnabled="False"/>
|
||||||
@@ -38,17 +35,23 @@
|
|||||||
<MenuItem Header="_预设工艺管理" FontSize="16" Name="_PROCESS" Click="PROCESS" IsEnabled="False"/>
|
<MenuItem Header="_预设工艺管理" FontSize="16" Name="_PROCESS" Click="PROCESS" IsEnabled="False"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="_配送流程管理" FontSize="16" Name="_WORKFLOW" Click="WORKFLOW" IsEnabled="False"/>
|
<MenuItem Header="_配送流程管理" FontSize="16" Name="_WORKFLOW" Click="WORKFLOW" IsEnabled="False"/>
|
||||||
|
<MenuItem Header="_流程选择规则" FontSize="16" Name="_WORKFLOWSET" Click="WORKFLOWSET" IsEnabled="False"/>
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem Header="_布种" FontSize="16" Name="_fabric" Click="fabric" IsEnabled="False"/>
|
<MenuItem Header="_布种" FontSize="16" Name="_fabric" Click="fabric" IsEnabled="False"/>
|
||||||
<MenuItem Header="_品名" FontSize="16" Name="_variety" Click="variety" IsEnabled="False"/>
|
<MenuItem Header="_颜色名" FontSize="16" Name="_color" Click="color" IsEnabled="False"/>
|
||||||
<MenuItem Header="_色号" FontSize="16" Name="_color" Click="color" IsEnabled="False"/>
|
|
||||||
<MenuItem Header="_客户" FontSize="16" Name="_client" Click="client" IsEnabled="False"/>
|
<MenuItem Header="_客户" FontSize="16" Name="_client" Click="client" IsEnabled="False"/>
|
||||||
|
<Separator />
|
||||||
|
<MenuItem Header="_用户设置" FontSize="16" Name="_USER_SET" Click="USER_SET" IsEnabled="False"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="_查询" FontSize="16" Focusable ="False">
|
<MenuItem Header="_查询" FontSize="16" Focusable ="False">
|
||||||
<MenuItem Header="_料单查询" FontSize="16"/>
|
<MenuItem Header="_领料单据" FontSize="16"/>
|
||||||
<MenuItem Header="_历史查询" FontSize="16"/>
|
|
||||||
<MenuItem Header="_统计" FontSize="16" Name="_statistics" IsEnabled="False"/>
|
<MenuItem Header="_统计" FontSize="16" Name="_statistics" IsEnabled="False"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem Header="_扩展" FontSize="16" Focusable ="False">
|
||||||
|
<MenuItem Header="_模式" FontSize="16" Name="_WorkingMode" IsEnabled="False"/>
|
||||||
|
<MenuItem Header="_转换设置" FontSize="16" Name="_EX_SET" Click="EX_SET" IsEnabled="False"/>
|
||||||
|
<MenuItem Header="_转换历史" FontSize="16" Name="_exchange" Click="EXCHANGE" IsEnabled="False"/>
|
||||||
|
</MenuItem>
|
||||||
<MenuItem Header="_帮助" FontSize="16" Focusable ="False">
|
<MenuItem Header="_帮助" FontSize="16" Focusable ="False">
|
||||||
<MenuItem Header="_帮助" FontSize="16" Click="HELP"/>
|
<MenuItem Header="_帮助" FontSize="16" Click="HELP"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@@ -58,10 +61,9 @@
|
|||||||
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False" Grid.Column="1"/>
|
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False" Grid.Column="1"/>
|
||||||
<TextBox x:Name="USER" HorizontalAlignment="Right" Height="30" Margin="0,0,155,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="100" FontSize="14"
|
<TextBox x:Name="USER" HorizontalAlignment="Right" Height="30" Margin="0,0,155,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="100" FontSize="14"
|
||||||
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False" Grid.Column="1"/>
|
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False" Grid.Column="1"/>
|
||||||
|
<Button Content="新工单" HorizontalAlignment="Left" Margin="335,35,0,0" Height="30" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" FontSize="20" Click="Button_NewOrder" Focusable ="False" Grid.Column="1"/>
|
||||||
<Button Content="新工单" HorizontalAlignment="Left" Margin="73,35,0,0" Height="30" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" FontSize="20" Click="Button_NewOrder" Focusable ="False" Grid.Column="1"/>
|
<Button Content="归属订单" HorizontalAlignment="Left" Margin="300,70,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Order" Grid.Column="1"/>
|
||||||
<Button Content="归属订单" HorizontalAlignment="Left" Margin="38,70,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology" Grid.Column="1"/>
|
<Button Content="预设工艺" HorizontalAlignment="Left" Margin="300,105,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology" Grid.Column="1"/>
|
||||||
<Button Content="预设工艺" HorizontalAlignment="Left" Margin="38,105,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology" Grid.Column="1"/>
|
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,35,0,0" TextWrapping="Wrap" Text="领料单号:" VerticalAlignment="Top" Width="90" FontSize="20" Background="WhiteSmoke"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,35,0,0" TextWrapping="Wrap" Text="领料单号:" VerticalAlignment="Top" Width="90" FontSize="20" Background="WhiteSmoke"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,70,0,0" TextWrapping="Wrap" Text="流转订单:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,70,0,0" TextWrapping="Wrap" Text="流转订单:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,105,0,0" TextWrapping="Wrap" Text="执行工艺:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,105,0,0" TextWrapping="Wrap" Text="执行工艺:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
@@ -69,12 +71,12 @@
|
|||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,175,0,0" TextWrapping="Wrap" Text="类型:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,175,0,0" TextWrapping="Wrap" Text="类型:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,140,0,0" TextWrapping="Wrap" Text="总步数:" VerticalAlignment="Top" Width="70" FontSize="20" Grid.ColumnSpan="2"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,140,0,0" TextWrapping="Wrap" Text="总步数:" VerticalAlignment="Top" Width="70" FontSize="20" Grid.ColumnSpan="2"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,175,0,0" TextWrapping="Wrap" Text="表单:" VerticalAlignment="Top" Width="70" FontSize="20" Grid.ColumnSpan="2"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,175,0,0" TextWrapping="Wrap" Text="表单:" VerticalAlignment="Top" Width="70" FontSize="20" Grid.ColumnSpan="2"/>
|
||||||
<ComboBox x:Name="Forms_" HorizontalAlignment="Left" Height="30" Margin="38,175,0,0" VerticalAlignment="Top" Width="105" FontSize="20" IsTabStop="True" Grid.Column="1"/>
|
<ComboBox x:Name="Forms_" HorizontalAlignment="Left" Height="30" Margin="300,175,0,0" VerticalAlignment="Top" Width="105" FontSize="20"/>
|
||||||
<TextBox x:Name="Number" HorizontalAlignment="Left" Height="30" Margin="95,35,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" Grid.ColumnSpan="2"/>
|
<TextBox x:Name="Number" HorizontalAlignment="Left" ToolTip="当前配方的物料单" Height="30" Margin="95,35,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" Grid.ColumnSpan="2"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
|
<TextBox x:Name="order" HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
|
||||||
<TextBox x:Name="ReDye" HorizontalAlignment="Left" Height="30" Margin="38,35,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="30" FontSize="20"
|
<TextBox x:Name="ReDye" HorizontalAlignment="Left" Height="30" Margin="300,35,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="30" FontSize="20"
|
||||||
MaxLines="1" MaxLength="2" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" Focusable ="False" Grid.Column="1"/>
|
MaxLines="1" MaxLength="2" Grid.Column="1" IsReadOnly="True"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
|
<TextBox x:Name="Technology" HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
|
||||||
<ComboBox x:Name="Machine" DisplayMemberPath="Name"
|
<ComboBox x:Name="Machine" DisplayMemberPath="Name"
|
||||||
ItemsSource="{Binding mac_Machine, Source={StaticResource MainWindowViewModel}}"
|
ItemsSource="{Binding mac_Machine, Source={StaticResource MainWindowViewModel}}"
|
||||||
HorizontalAlignment="Left" Height="30" Margin="95,140,0,0" VerticalAlignment="Top" Width="120" FontSize="20"
|
HorizontalAlignment="Left" Height="30" Margin="95,140,0,0" VerticalAlignment="Top" Width="120" FontSize="20"
|
||||||
@@ -85,19 +87,15 @@
|
|||||||
<ComboBoxItem Content="正常单"></ComboBoxItem>
|
<ComboBoxItem Content="正常单"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="追加单"></ComboBoxItem>
|
<ComboBoxItem Content="追加单"></ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<TextBox x:Name="Procedures_N" HorizontalAlignment="Left" Height="30" Margin="38,140,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="85" FontSize="20"
|
<TextBox x:Name="Procedures_N" HorizontalAlignment="Left" Height="30" Margin="300,140,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="85" FontSize="20"
|
||||||
KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" Grid.Column="1"/>
|
KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" Grid.Column="1"/>
|
||||||
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="123,140,0,0" VerticalAlignment="Top" FontSize="10"
|
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,140,0,0" VerticalAlignment="Top" FontSize="10"
|
||||||
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_up" IsTabStop="False" Focusable ="False" Grid.Column="1"/>
|
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_up" IsTabStop="False" Focusable ="False" Grid.Column="1"/>
|
||||||
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="123,155,0,0" VerticalAlignment="Top" FontSize="10"
|
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,155,0,0" VerticalAlignment="Top" FontSize="10"
|
||||||
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_dow" IsTabStop="False" Focusable ="False" Grid.Column="1"/>
|
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_dow" IsTabStop="False" Focusable ="False" Grid.Column="1"/>
|
||||||
|
|
||||||
<Grid Height="150" Width="405" Margin="5,210,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Background="#FFF7F7F7" Grid.ColumnSpan="2">
|
<Grid Height="150" Width="405" Margin="5,210,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Background="#FFF7F7F7" Grid.ColumnSpan="2">
|
||||||
<Grid.ColumnDefinitions>
|
<Button Content="..." HorizontalAlignment="Left" Margin="370,40,0,0" Height="30" VerticalAlignment="Top" Width="30" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Formula" Grid.Column="1"/>
|
||||||
<ColumnDefinition Width="254"/>
|
|
||||||
<ColumnDefinition Width="151"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Button Content="..." HorizontalAlignment="Left" Margin="116,40,0,0" Height="30" VerticalAlignment="Top" Width="30" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Formula" Grid.Column="1"/>
|
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,5,0,0" TextWrapping="Wrap" Text="步序:" VerticalAlignment="Top" Width="70" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,5,0,0" TextWrapping="Wrap" Text="步序:" VerticalAlignment="Top" Width="70" FontSize="20"/>
|
||||||
<TextBox x:Name="Procedures_P" HorizontalAlignment="Left" Height="30" Margin="90,5,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="50" FontSize="20"
|
<TextBox x:Name="Procedures_P" HorizontalAlignment="Left" Height="30" Margin="90,5,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="50" FontSize="20"
|
||||||
KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
|
KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
|
||||||
@@ -115,12 +113,12 @@
|
|||||||
<TextBox x:Name="list_Weight" HorizontalAlignment="Left" Height="30" Margin="90,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20"
|
<TextBox x:Name="list_Weight" HorizontalAlignment="Left" Height="30" Margin="90,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20"
|
||||||
KeyUp="SearchBox_OnKeyDownd" TextChanged="Weight" PreviewTextInput="Tb_KeyFloating" InputMethod.IsInputMethodEnabled="False"/>
|
KeyUp="SearchBox_OnKeyDownd" TextChanged="Weight" PreviewTextInput="Tb_KeyFloating" InputMethod.IsInputMethodEnabled="False"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,75,0,0" TextWrapping="Wrap" Text="浴比:" VerticalAlignment="Top" Width="90" FontSize="20" Grid.ColumnSpan="2"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,75,0,0" TextWrapping="Wrap" Text="浴比:" VerticalAlignment="Top" Width="90" FontSize="20" Grid.ColumnSpan="2"/>
|
||||||
<TextBox x:Name="list_Proportion" HorizontalAlignment="Left" Height="30" Margin="16,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="130" FontSize="20"
|
<TextBox x:Name="list_Proportion" HorizontalAlignment="Left" Height="30" Margin="270,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="130" FontSize="20"
|
||||||
KeyUp="SearchBox_OnKeyDownd" TextChanged="Proportion" PreviewTextInput="Tb_KeyFloating" InputMethod.IsInputMethodEnabled="False" Grid.Column="1"/>
|
KeyUp="SearchBox_OnKeyDownd" TextChanged="Proportion" PreviewTextInput="Tb_KeyFloating" InputMethod.IsInputMethodEnabled="False" Grid.Column="1"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,110,0,0" TextWrapping="Wrap" Text="浴量(L):" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,110,0,0" TextWrapping="Wrap" Text="浴量(L):" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
<TextBox x:Name="list_Total" HorizontalAlignment="Left" Height="30" Margin="90,110,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20" />
|
<TextBox x:Name="list_Total" HorizontalAlignment="Left" Height="30" Margin="90,110,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20" />
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,110,0,0" TextWrapping="Wrap" Text="修正:" VerticalAlignment="Top" Width="90" FontSize="20" Grid.ColumnSpan="2"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,110,0,0" TextWrapping="Wrap" Text="修正:" VerticalAlignment="Top" Width="90" FontSize="20" Grid.ColumnSpan="2"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="16,110,0,0" Text="" VerticalAlignment="Top" Width="130" FontSize="20" Focusable ="False" Grid.Column="1"/>
|
<TextBox HorizontalAlignment="Left" Height="30" Margin="270,110,0,0" Text="" VerticalAlignment="Top" Width="130" FontSize="20" Focusable ="False" Grid.Column="1"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<DataGrid x:Name="Grid_RRODUCT" AlternationCount="2" IsReadOnly="False" InitializingNewItem="DataGrid_InitializingNewItem"
|
<DataGrid x:Name="Grid_RRODUCT" AlternationCount="2" IsReadOnly="False" InitializingNewItem="DataGrid_InitializingNewItem"
|
||||||
@@ -168,6 +166,7 @@
|
|||||||
</DataGrid.Resources>
|
</DataGrid.Resources>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<!--列信息绑定-->
|
<!--列信息绑定-->
|
||||||
|
|
||||||
<DataGridTextColumn Header="序" Width="30" FontSize="15" MaxWidth="30" MinWidth="30" Binding="{Binding ID}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
<DataGridTextColumn Header="序" Width="30" FontSize="15" MaxWidth="30" MinWidth="30" Binding="{Binding ID}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
||||||
<DataGridTextColumn Header="步骤" Width="50" FontSize="15" MaxWidth="50" MinWidth="50" Binding="{Binding STEP}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
<DataGridTextColumn Header="步骤" Width="50" FontSize="15" MaxWidth="50" MinWidth="50" Binding="{Binding STEP}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
||||||
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
||||||
@@ -193,18 +192,7 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}">
|
<DataGridTextColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}" Binding="{Binding SHIFT}"/>
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<ComboBox x:Name="CP_SHIFT" BorderThickness="0,0,0,0" Text="{Binding SHIFT}"
|
|
||||||
BorderBrush="{x:Null}" Background="{x:Null}"
|
|
||||||
IsEditable="True" IsReadOnly="True" Focusable="True" IsTabStop="False">
|
|
||||||
<ComboBoxItem Content="%"></ComboBoxItem>
|
|
||||||
<ComboBoxItem Content="g/L"></ComboBoxItem>
|
|
||||||
</ComboBox>
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
<DataGridTemplateColumn Header="原料名称" Width="200" MaxWidth="400" MinWidth="100" CellStyle="{StaticResource CellStyle}">
|
<DataGridTemplateColumn Header="原料名称" Width="200" MaxWidth="400" MinWidth="100" CellStyle="{StaticResource CellStyle}">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@@ -219,7 +207,7 @@
|
|||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTextColumn Header="目标重量(g)" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" IsReadOnly="True" Binding="{Binding TARGET_WT}" CellStyle="{StaticResource CellStyle}"/>
|
<DataGridTextColumn Header="目标重量(g)" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" IsReadOnly="True" Binding="{Binding TARGET_WT}" CellStyle="{StaticResource CellStyle}"/>
|
||||||
<DataGridTextColumn Header="单位" Width="80" FontSize="15" MaxWidth="80" MinWidth="80" IsReadOnly="True" Binding="{Binding UNIT}" CellStyle="{StaticResource CellStyle}"/>
|
<DataGridTextColumn Header="单位" Width="80" FontSize="15" MaxWidth="80" MinWidth="80" IsReadOnly="True" Binding="{Binding UNIT}" CellStyle="{StaticResource CellStyle}"/>
|
||||||
<DataGridTextColumn Header="备注" Width="600" FontSize="15" MinWidth="600" Binding="{Binding REMARK}" CellStyle="{StaticResource CellStyle}"/>
|
<DataGridTextColumn Header="备注" FontSize="15" MinWidth="1000" Binding="{Binding REMARK}" CellStyle="{StaticResource CellStyle}" IsReadOnly="False"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
||||||
@@ -228,9 +216,18 @@
|
|||||||
<Button x:Name="Save" Content="保存" IsEnabled="False" HorizontalAlignment="Left" Height="40" Width="80" Margin="15,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="save" IsTabStop="False" Focusable ="False"/>
|
<Button x:Name="Save" Content="保存" IsEnabled="False" HorizontalAlignment="Left" Height="40" Width="80" Margin="15,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="save" IsTabStop="False" Focusable ="False"/>
|
||||||
<Button x:Name="Delete" Content="删除" IsEnabled="False" HorizontalAlignment="Left" Height="40" Width="80" Margin="100,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="delete" IsTabStop="False" Focusable ="False"/>
|
<Button x:Name="Delete" Content="删除" IsEnabled="False" HorizontalAlignment="Left" Height="40" Width="80" Margin="100,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="delete" IsTabStop="False" Focusable ="False"/>
|
||||||
|
|
||||||
<Grid Grid.Column="1" Height="325" Margin="148,35,5,0" VerticalAlignment="Top" Background="#FFF7F7F7">
|
<Grid Grid.Column="1" Height="325" Margin="415,35,5,0" VerticalAlignment="Top" Background="White">
|
||||||
<ContentControl x:Name="Deputy"/>
|
<ContentControl x:Name="Deputy"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Column="1" Margin="0,0,0,0" Background="White" Visibility="{Binding Cdk_page}" Opacity="0.8">
|
||||||
|
<TextBlock Height="150" Margin="0,0,0,300" TextWrapping="Wrap" Text="注册信息到期,处理注册信息预计需要3个工作日,为避免影响系统使用请及时提交注册信息!" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Height="50" Margin="0,0,0,100" TextWrapping="Wrap" Text="{Binding Cdk_time}" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red"/>
|
||||||
|
<TextBlock Height="50" Margin="0,0,0,0" TextWrapping="Wrap" Text="请联系 SUNLIGHT" Width="300" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
<Button Content="激活" HorizontalAlignment="Center" Height="50" Margin="200,100,0,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="#FFDFDFDF" Click="CDKEY_SET"/>
|
||||||
|
<Button Content="帮助" HorizontalAlignment="Center" Height="50" Margin="0,100,200,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="#FFDFDFDF" Click="HELP"/>
|
||||||
|
<TextBlock Height="50" Margin="0,0,0,0" TextWrapping="Wrap" Text="{Binding Cdk_pageT}" Width="500" FontSize="34" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
+197
-85
@@ -1,39 +1,18 @@
|
|||||||
using formula_manage.Windows;
|
using formula_manage.UserClass;
|
||||||
|
using formula_manage.View;
|
||||||
|
using formula_manage.ViewModel;
|
||||||
|
using formula_manage.Windows;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Globalization;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Windows.Threading;
|
|
||||||
using formula_manage.ViewModel;
|
|
||||||
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
|
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
|
||||||
using formula_manage.UserClass;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Printing;
|
|
||||||
using System.Drawing.Printing;
|
|
||||||
using static System.Drawing.Printing.PrinterSettings;
|
|
||||||
|
|
||||||
namespace formula_manage
|
namespace formula_manage
|
||||||
{
|
{
|
||||||
@@ -44,7 +23,6 @@ namespace formula_manage
|
|||||||
{
|
{
|
||||||
Font font = new Font("Microsoft YaHei", 20);
|
Font font = new Font("Microsoft YaHei", 20);
|
||||||
|
|
||||||
|
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
// DataTable DissolvedataTable = new DataTable(); //建立Dissolve缓存
|
// DataTable DissolvedataTable = new DataTable(); //建立Dissolve缓存
|
||||||
// DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存
|
// DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存
|
||||||
@@ -52,7 +30,9 @@ namespace formula_manage
|
|||||||
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
|
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
|
||||||
// DataTable RecipedataTable = new DataTable(); //建立Recipe缓存
|
// DataTable RecipedataTable = new DataTable(); //建立Recipe缓存
|
||||||
|
|
||||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
private readonly string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
//调用配置文件
|
||||||
|
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini");
|
||||||
|
|
||||||
string TEXT_SQLIP;
|
string TEXT_SQLIP;
|
||||||
string TEXT_SQLNAME;
|
string TEXT_SQLNAME;
|
||||||
@@ -61,7 +41,9 @@ namespace formula_manage
|
|||||||
string TEXT_SQLPASWOR;
|
string TEXT_SQLPASWOR;
|
||||||
string Connstr_SC;
|
string Connstr_SC;
|
||||||
int ID_N = 1;
|
int ID_N = 1;
|
||||||
string DYELOT_;
|
|
||||||
|
string Tlist_Weight;
|
||||||
|
string Tlist_Proportion;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
@@ -71,6 +53,16 @@ namespace formula_manage
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Closing += Window_Closing; //添加窗口关闭事件
|
this.Closing += Window_Closing; //添加窗口关闭事件
|
||||||
|
|
||||||
|
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")))
|
||||||
|
{
|
||||||
|
UserClass.TCPServer.Start(); //开启网路通讯
|
||||||
|
_WorkingMode.Header = "服务端";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_WorkingMode.Header = "客户端";
|
||||||
|
}
|
||||||
|
|
||||||
USER.Text = App.USER_Purview;
|
USER.Text = App.USER_Purview;
|
||||||
RRODUCTdataTable.Columns.Add("ID", typeof(int));
|
RRODUCTdataTable.Columns.Add("ID", typeof(int));
|
||||||
RRODUCTdataTable.Columns.Add("DYELOT", typeof(string));
|
RRODUCTdataTable.Columns.Add("DYELOT", typeof(string));
|
||||||
@@ -90,20 +82,25 @@ namespace formula_manage
|
|||||||
_SQL.IsEnabled = true;
|
_SQL.IsEnabled = true;
|
||||||
_SQLBAK.IsEnabled = true;
|
_SQLBAK.IsEnabled = true;
|
||||||
_SOFTWARE_SET.IsEnabled = true;
|
_SOFTWARE_SET.IsEnabled = true;
|
||||||
|
_EX_SET.IsEnabled = true;
|
||||||
|
_PRINT_SET.IsEnabled = true;
|
||||||
_USER_SET.IsEnabled = true;
|
_USER_SET.IsEnabled = true;
|
||||||
|
_USER_log.IsEnabled = true;
|
||||||
_RECIPE.IsEnabled = true;
|
_RECIPE.IsEnabled = true;
|
||||||
_PROCESS.IsEnabled = true;
|
_PROCESS.IsEnabled = true;
|
||||||
_WORKFLOW.IsEnabled = true;
|
_WORKFLOW.IsEnabled = true;
|
||||||
|
_WORKFLOWSET.IsEnabled = true;
|
||||||
_MAC_SET.IsEnabled = true;
|
_MAC_SET.IsEnabled = true;
|
||||||
_STUFF.IsEnabled = true;
|
_STUFF.IsEnabled = true;
|
||||||
_fabric.IsEnabled = true;
|
_fabric.IsEnabled = true;
|
||||||
_variety.IsEnabled = true;
|
|
||||||
_client.IsEnabled = true;
|
_client.IsEnabled = true;
|
||||||
_color.IsEnabled = true;
|
_color.IsEnabled = true;
|
||||||
_statistics.IsEnabled = true;
|
_statistics.IsEnabled = true;
|
||||||
|
_exchange.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sql_();
|
sql_();
|
||||||
|
PrintForms();
|
||||||
Permissions_(); //权限管理
|
Permissions_(); //权限管理
|
||||||
|
|
||||||
DataRow row = RRODUCTdataTable.NewRow(); //ID列
|
DataRow row = RRODUCTdataTable.NewRow(); //ID列
|
||||||
@@ -115,9 +112,38 @@ namespace formula_manage
|
|||||||
Grid_RRODUCT.ItemsSource = RRODUCTdataTable.DefaultView;
|
Grid_RRODUCT.ItemsSource = RRODUCTdataTable.DefaultView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PrintForms()//传入可用打印模板
|
||||||
|
{
|
||||||
|
int dirID = 0;
|
||||||
|
|
||||||
|
DataTable Report = new DataTable();
|
||||||
|
Report.Columns.Add("NAME", typeof(string));
|
||||||
|
|
||||||
|
string Print_path = Configini.IniReadvalue("PRINTER", "P3");
|
||||||
|
string Print_path2 = Configini.IniReadvalue("PRINTER", "P12");
|
||||||
|
string Temp_m = Configini.IniReadvalue("PRINTER", "P13");
|
||||||
|
string Temp_s = Configini.IniReadvalue("PRINTER", "P14");
|
||||||
|
|
||||||
|
DirectoryInfo di = new DirectoryInfo(Print_path); //new文件夹
|
||||||
|
FileInfo[] files = di.GetFiles("*.frx");//生成文件夹中的文件名合集
|
||||||
|
|
||||||
|
foreach (FileInfo file in files)
|
||||||
|
{
|
||||||
|
DataRow reportDATA = Report.NewRow();//插件新行
|
||||||
|
Report.Rows.Add(reportDATA);//保存修改
|
||||||
|
reportDATA = Report.Rows[dirID++];//选择行
|
||||||
|
reportDATA.BeginEdit();//开始编辑
|
||||||
|
reportDATA["NAME"] = System.IO.Path.GetFileNameWithoutExtension(file.Name);//传入字符
|
||||||
|
reportDATA.EndEdit();//结束编辑
|
||||||
|
}
|
||||||
|
|
||||||
|
Forms_.ItemsSource = Report.DefaultView;//加载合集
|
||||||
|
Forms_.DisplayMemberPath = "NAME"; // 显示文件名
|
||||||
|
Forms_.Text = Temp_m;
|
||||||
|
}
|
||||||
|
|
||||||
private void sql_()
|
private void sql_()
|
||||||
{
|
{
|
||||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
|
||||||
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
@@ -132,16 +158,18 @@ namespace formula_manage
|
|||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_Weight.Text = Configini.IniReadvalue("SOFTWARE_SET", "T4"); //自定义
|
Tlist_Weight = Configini.IniReadvalue("SOFTWARE_SET", "T4"); //自定义
|
||||||
list_Proportion.Text = Configini.IniReadvalue("SOFTWARE_SET", "T5"); //自定义
|
Tlist_Proportion = Configini.IniReadvalue("SOFTWARE_SET", "T5"); //自定义
|
||||||
list_Total.Text = (double.Parse(list_Proportion.Text) * double.Parse(list_Weight.Text)).ToString();
|
list_Weight.Text = Tlist_Weight;
|
||||||
|
list_Proportion.Text = Tlist_Proportion;
|
||||||
|
list_Total.Text = (double.Parse(Tlist_Proportion) * double.Parse(Tlist_Weight)).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Permissions_()
|
private async void Permissions_()
|
||||||
{
|
{
|
||||||
DataTable logindataTable = new DataTable(); //建立login缓存
|
DataTable logindataTable = new DataTable(); //建立login缓存
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||||
string user_sql = "SELECT UserCode ,PassWord ,UserSetup ,Capacity ,GROUP_CODE ,Note FROM [Dispensing].[dbo].[UserAccount] WHERE Capacity != 0";//查询语句
|
string user_sql = "SELECT UserCode ,PassWord ,UserSetup ,Capacity ,GROUP_CODE ,Note FROM [dbo].[UserAccount] WHERE Capacity != 0";//查询语句
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -154,6 +182,7 @@ namespace formula_manage
|
|||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
UserClass.LogGing.LogGingDATA("DatabaseConnectionFailed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,17 +196,20 @@ namespace formula_manage
|
|||||||
_SQL.IsEnabled = true;
|
_SQL.IsEnabled = true;
|
||||||
_SQLBAK.IsEnabled = true;
|
_SQLBAK.IsEnabled = true;
|
||||||
_SOFTWARE_SET.IsEnabled = true;
|
_SOFTWARE_SET.IsEnabled = true;
|
||||||
|
_EX_SET.IsEnabled = true;
|
||||||
|
_PRINT_SET.IsEnabled = true;
|
||||||
_USER_SET.IsEnabled = true;
|
_USER_SET.IsEnabled = true;
|
||||||
_RECIPE.IsEnabled = true;
|
_RECIPE.IsEnabled = true;
|
||||||
_PROCESS.IsEnabled = true;
|
_PROCESS.IsEnabled = true;
|
||||||
_WORKFLOW.IsEnabled = true;
|
_WORKFLOW.IsEnabled = true;
|
||||||
|
_WORKFLOWSET.IsEnabled = true;
|
||||||
_MAC_SET.IsEnabled = true;
|
_MAC_SET.IsEnabled = true;
|
||||||
_STUFF.IsEnabled = true;
|
_STUFF.IsEnabled = true;
|
||||||
_fabric.IsEnabled = true;
|
_fabric.IsEnabled = true;
|
||||||
_variety.IsEnabled = true;
|
|
||||||
_client.IsEnabled = true;
|
_client.IsEnabled = true;
|
||||||
_color.IsEnabled = true;
|
_color.IsEnabled = true;
|
||||||
_statistics.IsEnabled = true;
|
_statistics.IsEnabled = true;
|
||||||
|
_exchange.IsEnabled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -188,23 +220,19 @@ namespace formula_manage
|
|||||||
_RECIPE.IsEnabled = true;
|
_RECIPE.IsEnabled = true;
|
||||||
_PROCESS.IsEnabled = true;
|
_PROCESS.IsEnabled = true;
|
||||||
_WORKFLOW.IsEnabled = true;
|
_WORKFLOW.IsEnabled = true;
|
||||||
|
_WORKFLOWSET.IsEnabled = true;
|
||||||
_MAC_SET.IsEnabled = true;
|
_MAC_SET.IsEnabled = true;
|
||||||
_STUFF.IsEnabled = true;
|
_STUFF.IsEnabled = true;
|
||||||
_fabric.IsEnabled = true;
|
_fabric.IsEnabled = true;
|
||||||
_variety.IsEnabled = true;
|
|
||||||
_client.IsEnabled = true;
|
_client.IsEnabled = true;
|
||||||
_color.IsEnabled = true;
|
_color.IsEnabled = true;
|
||||||
_statistics.IsEnabled = true;
|
_statistics.IsEnabled = true;
|
||||||
|
_exchange.IsEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
||||||
{
|
{
|
||||||
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
|
||||||
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
|
|
||||||
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
|
||||||
|
|
||||||
if (!quit)
|
if (!quit)
|
||||||
{
|
{
|
||||||
MessageBoxResult result = System.Windows.MessageBox.Show("您确定要退出吗?", "SUNLIGHT", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel);
|
MessageBoxResult result = System.Windows.MessageBox.Show("您确定要退出吗?", "SUNLIGHT", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel);
|
||||||
@@ -212,14 +240,17 @@ namespace formula_manage
|
|||||||
if (result == MessageBoxResult.Cancel) //判断是否确认
|
if (result == MessageBoxResult.Cancel) //判断是否确认
|
||||||
{
|
{
|
||||||
e.Cancel = true; // 中断点击事件
|
e.Cancel = true; // 中断点击事件
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
// UserClass.LogGing.LogGingDATA(Log_time + "HttpSERVER_STOP");
|
||||||
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")))
|
||||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
{
|
||||||
wr.WriteLine(Log_time + "FORMULA_STOP");
|
UserClass.TCPServer.Btn_SendAll("SERVER_STOP");
|
||||||
wr.Close();
|
}
|
||||||
|
|
||||||
|
UserClass.LogGing.LogGingDATA("FORMULA_STOP");
|
||||||
}
|
}
|
||||||
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
||||||
{
|
{
|
||||||
@@ -233,6 +264,7 @@ namespace formula_manage
|
|||||||
string Prepose; //料单前置
|
string Prepose; //料单前置
|
||||||
string PreposeT; //料单时间
|
string PreposeT; //料单时间
|
||||||
string PreposeS; //料单序列格式
|
string PreposeS; //料单序列格式
|
||||||
|
string PreposeGKG; //料单单位
|
||||||
int PreposeSl;
|
int PreposeSl;
|
||||||
string str_Prepose;
|
string str_Prepose;
|
||||||
bool Loginprint;
|
bool Loginprint;
|
||||||
@@ -244,6 +276,7 @@ namespace formula_manage
|
|||||||
Loginprint = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L2")); //是否立即打印料单
|
Loginprint = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L2")); //是否立即打印料单
|
||||||
Loginanew = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L3")); //是否立即打印料单
|
Loginanew = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L3")); //是否立即打印料单
|
||||||
Machine.IsEditable = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L4")); //允许自定义机台
|
Machine.IsEditable = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L4")); //允许自定义机台
|
||||||
|
PreposeGKG = Configini.IniReadvalue("SOFTWARE_SET", "L5");//计算单位
|
||||||
|
|
||||||
Prepose = Configini.IniReadvalue("SOFTWARE_SET", "T1"); //自定义料单前缀
|
Prepose = Configini.IniReadvalue("SOFTWARE_SET", "T1"); //自定义料单前缀
|
||||||
PreposeT = Configini.IniReadvalue("SOFTWARE_SET", "T2"); //自定义料单时间
|
PreposeT = Configini.IniReadvalue("SOFTWARE_SET", "T2"); //自定义料单时间
|
||||||
@@ -266,6 +299,26 @@ namespace formula_manage
|
|||||||
Number.Text = Prepose + time + str_Prepose; //生成料单号
|
Number.Text = Prepose + time + str_Prepose; //生成料单号
|
||||||
ReDye.Text = "0";
|
ReDye.Text = "0";
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " T6", time); //保存当前时
|
Configini.IniWritevalue("SOFTWARE_SET", " T6", time); //保存当前时
|
||||||
|
|
||||||
|
order.Text = "";
|
||||||
|
ReDye.Text += "";
|
||||||
|
Technology.Text = "";
|
||||||
|
Machine.Text = "";
|
||||||
|
Procedures_N.Text = "1";
|
||||||
|
Procedures_P.Text = "1";
|
||||||
|
Workflow.Text = "";
|
||||||
|
|
||||||
|
list_Weight.Text = Tlist_Weight;
|
||||||
|
list_Proportion.Text = Tlist_Proportion;
|
||||||
|
list_Total.Text = (double.Parse(Tlist_Proportion) * double.Parse(Tlist_Weight)).ToString();
|
||||||
|
|
||||||
|
RRODUCTdataTable.Clear(); //清楚缓存表
|
||||||
|
DataRow row = RRODUCTdataTable.NewRow(); //ID列
|
||||||
|
row["ID"] = ID_N;
|
||||||
|
row["STEP"] = Procedures_P.Text;
|
||||||
|
row["UNIT"] = "g";
|
||||||
|
RRODUCTdataTable.Rows.Add(row);
|
||||||
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
||||||
}
|
}
|
||||||
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
|
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
|
||||||
{
|
{
|
||||||
@@ -288,6 +341,11 @@ namespace formula_manage
|
|||||||
window.Close();
|
window.Close();
|
||||||
login.ShowDialog();//实例化并置顶打开登录窗口
|
login.ShowDialog();//实例化并置顶打开登录窗口
|
||||||
}
|
}
|
||||||
|
private void CDKEY_SET(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CDKEY cDKEY = new CDKEY();
|
||||||
|
cDKEY.ShowDialog();//实例化并置顶打开窗口
|
||||||
|
}
|
||||||
private void SQL(object sender, RoutedEventArgs e)
|
private void SQL(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show("进入数据库设置请您明确操作目的及可能需承担的后果", "警告");
|
System.Windows.MessageBox.Show("进入数据库设置请您明确操作目的及可能需承担的后果", "警告");
|
||||||
@@ -313,6 +371,16 @@ namespace formula_manage
|
|||||||
Windows.User user_set = new Windows.User();
|
Windows.User user_set = new Windows.User();
|
||||||
user_set.ShowDialog();//实例化并置顶打开用户窗口
|
user_set.ShowDialog();//实例化并置顶打开用户窗口
|
||||||
}
|
}
|
||||||
|
private void EX_SET(object sender, RoutedEventArgs e)//扩展程序
|
||||||
|
{
|
||||||
|
EX.ExProgram ex = new EX.ExProgram();
|
||||||
|
ex.ShowDialog();
|
||||||
|
}
|
||||||
|
private void PRINT_SET(object sender, RoutedEventArgs e)//打印设置
|
||||||
|
{
|
||||||
|
Windows.Print print = new Windows.Print();
|
||||||
|
print.ShowDialog();
|
||||||
|
}
|
||||||
private void HELP(object sender, RoutedEventArgs e)
|
private void HELP(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Help help_page = new Help();
|
Help help_page = new Help();
|
||||||
@@ -330,17 +398,27 @@ namespace formula_manage
|
|||||||
}
|
}
|
||||||
private void RECIPE(object sender, RoutedEventArgs e)
|
private void RECIPE(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Windows.RECIPE rECIPE = new Windows.RECIPE();
|
||||||
|
rECIPE.ShowDialog();//实例化并置顶打开设置窗口
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PROCESS(object sender, RoutedEventArgs e)
|
private void PROCESS(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WORKFLOW(object sender, RoutedEventArgs e)
|
private void WORKFLOW(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Windows.Dissolve dissolve = new Windows.Dissolve();
|
Windows.Dissolve dissolve = new Windows.Dissolve();
|
||||||
dissolve.ShowDialog();//实例化并置顶打开设置窗口
|
dissolve.ShowDialog();//实例化并置顶打开设置窗口
|
||||||
}
|
}
|
||||||
|
private void WORKFLOWSET(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Windows.Dissolve dissolve = new Windows.Dissolve();
|
||||||
|
dissolve.ShowDialog();//实例化并置顶打开设置窗口
|
||||||
|
}
|
||||||
|
private void EXCHANGE(object sender, RoutedEventArgs e)//交换日志
|
||||||
|
{
|
||||||
|
EX.Exchange exchange = new EX.Exchange();
|
||||||
|
exchange.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
private void print(object sender, RoutedEventArgs e)
|
private void print(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -357,40 +435,36 @@ namespace formula_manage
|
|||||||
// dialog.PrintVisual(richText, "测试");
|
// dialog.PrintVisual(richText, "测试");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Print.IsEnabled = true;
|
Print.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fabric(object sender, RoutedEventArgs e)
|
private void fabric(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
fabric fabric_page = new fabric();
|
||||||
|
fabric_page.ShowDialog();//实例化并置顶打开窗口
|
||||||
}
|
}
|
||||||
|
|
||||||
private void variety(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private void color(object sender, RoutedEventArgs e)
|
private void color(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
color color_page = new color();
|
||||||
|
color_page.ShowDialog();//实例化并置顶打开窗口
|
||||||
}
|
}
|
||||||
|
|
||||||
private void client(object sender, RoutedEventArgs e)
|
private void client(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
client client_page = new client();
|
||||||
|
client_page.ShowDialog();//实例化并置顶打开窗口
|
||||||
}
|
}
|
||||||
private void confirm(object sender, RoutedEventArgs e)
|
private void confirm(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Confirm.IsEnabled = false;
|
Confirm.IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void delete(object sender, RoutedEventArgs e)
|
private void delete(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Delete.IsEnabled = false;
|
Delete.IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void save(object sender, RoutedEventArgs e) //保存按钮
|
private async void save(object sender, RoutedEventArgs e) //保存按钮
|
||||||
{
|
{
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||||
string DYELOTS_sql = "SELECT count(*) FROM [Dispensing].[dbo].[DYELOTS_RECIPE] WHERE Dyelot = '" + Number.Text + "' and ReDye = '" + ReDye.Text + "'";//单号查询语句
|
string DYELOTS_sql = "SELECT count(*) FROM [dbo].[DYELOTS_RECIPE] WHERE Dyelot = '" + Number.Text + "' and ReDye = '" + ReDye.Text + "'";//单号查询语句
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
@@ -418,6 +492,7 @@ namespace formula_manage
|
|||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show("数据访问失败,重试");
|
System.Windows.MessageBox.Show("数据访问失败,重试");
|
||||||
|
UserClass.LogGing.LogGingDATA("DatabaseConnectionFailed");
|
||||||
return;
|
return;
|
||||||
} //单号重复检查
|
} //单号重复检查
|
||||||
if (Machine.Text == "")
|
if (Machine.Text == "")
|
||||||
@@ -450,7 +525,15 @@ namespace formula_manage
|
|||||||
RRODUCTdataTable.AcceptChanges();
|
RRODUCTdataTable.AcceptChanges();
|
||||||
|
|
||||||
SqlConnection destinationConnection = new SqlConnection(Connstr_SC); //创建一个数据库连接;
|
SqlConnection destinationConnection = new SqlConnection(Connstr_SC); //创建一个数据库连接;
|
||||||
destinationConnection.Open(); //打开连接
|
await destinationConnection.OpenAsync(); //打开连接
|
||||||
|
|
||||||
|
//写总览
|
||||||
|
string dyelots_sql = string.Format("INSERT INTO [dbo].[DYELOTS]([Dyelot] ,[ReDye] , [OrderNo] , [Program] ,[Machine] ,[DispenseMachine] ,[UserAccount] ,[SheetNo] ) " +
|
||||||
|
"VALUES ('" + Number.Text + "','" + ReDye.Text + "','" + order.Text + "','" + Technology.Text + "','" + Machine.Text + "','" + Machine.Text + "','" + USER.Text + "','" + Forms_.Text + "')");
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(dyelots_sql, destinationConnection);
|
||||||
|
int dyelots_sqlIN = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
|
||||||
|
//写明细
|
||||||
SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection);// 实例化 sqlbulkcopy;
|
SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection);// 实例化 sqlbulkcopy;
|
||||||
bulkCopy.DestinationTableName = "dbo.DYELOTS_RECIPE";// 目标表名称/
|
bulkCopy.DestinationTableName = "dbo.DYELOTS_RECIPE";// 目标表名称/
|
||||||
bulkCopy.ColumnMappings.Add("DYELOT", "Dyelot");
|
bulkCopy.ColumnMappings.Add("DYELOT", "Dyelot");
|
||||||
@@ -477,16 +560,16 @@ namespace formula_manage
|
|||||||
Procedures_N.Text = "1";
|
Procedures_N.Text = "1";
|
||||||
Procedures_P.Text = "1";
|
Procedures_P.Text = "1";
|
||||||
|
|
||||||
|
System.Windows.MessageBox.Show(Number.Text + "-" + ReDye.Text + "已保存");
|
||||||
|
|
||||||
Number_Event();
|
Number_Event();
|
||||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); //记录当前单序号
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); //记录当前单序号
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " T3", str_Prepose);
|
Configini.IniWritevalue("SOFTWARE_SET", " T3", str_Prepose);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_NewOrder(object sender, RoutedEventArgs e) //新料单按钮
|
private void Button_NewOrder(object sender, RoutedEventArgs e) //新料单按钮
|
||||||
{
|
{
|
||||||
Number_Event();
|
Number_Event();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Machine_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //机台回车跳转功能
|
private void Machine_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //机台回车跳转功能
|
||||||
{
|
{
|
||||||
if (e.Key == Key.Enter)
|
if (e.Key == Key.Enter)
|
||||||
@@ -535,9 +618,29 @@ namespace formula_manage
|
|||||||
if (P > 1) Procedures_P.Text = (P - 1).ToString();
|
if (P > 1) Procedures_P.Text = (P - 1).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Recevie_order(string[] value)//订单选择信息传递
|
||||||
|
{
|
||||||
|
order.Text = value[0];
|
||||||
|
Technology.Text = value[1] + "@" + value[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Order(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ViewOrder viewOrder = new ViewOrder();
|
||||||
|
viewOrder.sendMessage = Recevie_order;
|
||||||
|
Deputy.Content = viewOrder; //打开订单选择
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Recevie_Technology(string[] value)//订单选择信息传递
|
||||||
|
{
|
||||||
|
Technology.Text = value[1] + "@" + value[0];
|
||||||
|
Procedures_N.Text = value[2];
|
||||||
|
}
|
||||||
private void Button_Technology(object sender, RoutedEventArgs e)
|
private void Button_Technology(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Deputy.Content = new View.ViewProcess(); //打开工艺选择
|
ViewProcess viewProcess = new ViewProcess();
|
||||||
|
viewProcess.sendMessage = Recevie_Technology;
|
||||||
|
Deputy.Content = viewProcess; //打开工艺选择
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Formula(object sender, RoutedEventArgs e)
|
private void Button_Formula(object sender, RoutedEventArgs e)
|
||||||
@@ -605,15 +708,17 @@ namespace formula_manage
|
|||||||
{
|
{
|
||||||
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
||||||
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
||||||
|
if (grid_row == -1) grid_row = 0;
|
||||||
|
|
||||||
Code_ = curComboBox.Text;
|
Code_ = curComboBox.Text.TrimEnd();
|
||||||
if (Code_ == "")
|
if ((Code_ == "") && (grid_row != 0))
|
||||||
{
|
{
|
||||||
if (Procedures_N.Text == Procedures_P.Text)
|
if (Procedures_N.Text == Procedures_P.Text)
|
||||||
{
|
{
|
||||||
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
||||||
if (P == MessageBoxResult.Cancel) { }
|
if (P == MessageBoxResult.Cancel) return;
|
||||||
return;
|
if (P == MessageBoxResult.OK) Save.Focus();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -624,7 +729,6 @@ namespace formula_manage
|
|||||||
PressKey.PressKeys(Keys.Tab, false);
|
PressKey.PressKeys(Keys.Tab, false);
|
||||||
PressKey.PressKeys(Keys.Tab, true);
|
PressKey.PressKeys(Keys.Tab, true);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,8 +739,8 @@ namespace formula_manage
|
|||||||
curComboBox.Text = "";
|
curComboBox.Text = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int ID_ = grid_row + 1;
|
||||||
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
|
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'and ID <> '" + ID_ + "'");//查询判断原料代码是否重复
|
||||||
if (c.Any())
|
if (c.Any())
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show("重复原料");
|
System.Windows.MessageBox.Show("重复原料");
|
||||||
@@ -646,11 +750,7 @@ namespace formula_manage
|
|||||||
Name_ = r[0].ItemArray[1].ToString();
|
Name_ = r[0].ItemArray[1].ToString();
|
||||||
Type_ = r[0].ItemArray[2].ToString();
|
Type_ = r[0].ItemArray[2].ToString();
|
||||||
Conc_ = r[0].ItemArray[3].ToString();
|
Conc_ = r[0].ItemArray[3].ToString();
|
||||||
|
Conc_ = (double.Parse(Conc_) / 100).ToString();
|
||||||
if (double.TryParse(list_Weight.Text, out ang))
|
|
||||||
{
|
|
||||||
Weight_ = double.Parse(list_Weight.Text) * double.Parse(Conc_) / 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((Type_ == "0") || (Type_ == "3"))
|
if ((Type_ == "0") || (Type_ == "3"))
|
||||||
{
|
{
|
||||||
@@ -680,7 +780,6 @@ namespace formula_manage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grid_row == -1) grid_row = 0;
|
|
||||||
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
||||||
row.BeginEdit();
|
row.BeginEdit();
|
||||||
row["PRODUCT_CODE"] = Code_;
|
row["PRODUCT_CODE"] = Code_;
|
||||||
@@ -703,11 +802,14 @@ namespace formula_manage
|
|||||||
PressKey.PressKeys(Keys.Tab, false);
|
PressKey.PressKeys(Keys.Tab, false);
|
||||||
PressKey.PressKeys(Keys.Tab, true);
|
PressKey.PressKeys(Keys.Tab, true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Save.IsEnabled = false;
|
Save.IsEnabled = false;
|
||||||
Confirm.IsEnabled = false;
|
Confirm.IsEnabled = false;
|
||||||
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_Weight.Text = list_Weight.Text.TrimEnd();//清楚输入字符空格
|
||||||
|
}
|
||||||
private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件
|
private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件
|
||||||
{
|
{
|
||||||
double ang;
|
double ang;
|
||||||
@@ -715,6 +817,14 @@ namespace formula_manage
|
|||||||
|
|
||||||
System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox;
|
System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox;
|
||||||
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
||||||
|
int ID_ = grid_row + 1;
|
||||||
|
|
||||||
|
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE is null and ID = '" + ID_ + "'");//查询判断原料代码是否重复
|
||||||
|
if (c.Any())
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("先选择原料");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.Key == Key.Enter)
|
if (e.Key == Key.Enter)
|
||||||
{
|
{
|
||||||
@@ -765,6 +875,7 @@ namespace formula_manage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//原料代码选择事件
|
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//原料代码选择事件
|
||||||
{
|
{
|
||||||
double ang;
|
double ang;
|
||||||
@@ -772,14 +883,14 @@ namespace formula_manage
|
|||||||
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
||||||
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
||||||
|
|
||||||
Code_ = curComboBox.Text;
|
Code_ = curComboBox.Text.TrimEnd();
|
||||||
if (Code_ == "")
|
if (Code_ == "")
|
||||||
{
|
{
|
||||||
if (Procedures_N.Text == Procedures_P.Text)
|
if (Procedures_N.Text == Procedures_P.Text)
|
||||||
{
|
{
|
||||||
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
|
||||||
if (P == MessageBoxResult.Cancel) { }
|
if (P == MessageBoxResult.Cancel) return;
|
||||||
return;
|
if (P == MessageBoxResult.OK) Save.Focus(); //聚焦到保存按钮
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -802,7 +913,8 @@ namespace formula_manage
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
|
int ID_ = grid_row + 1;
|
||||||
|
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'and ID <> '" + ID_ + "'");//查询判断原料代码是否重复
|
||||||
if (c.Any())
|
if (c.Any())
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show("重复原料");
|
System.Windows.MessageBox.Show("重复原料");
|
||||||
@@ -812,6 +924,7 @@ namespace formula_manage
|
|||||||
Name_ = r[0].ItemArray[1].ToString();
|
Name_ = r[0].ItemArray[1].ToString();
|
||||||
Type_ = r[0].ItemArray[2].ToString();
|
Type_ = r[0].ItemArray[2].ToString();
|
||||||
Conc_ = r[0].ItemArray[3].ToString();
|
Conc_ = r[0].ItemArray[3].ToString();
|
||||||
|
Conc_ = (double.Parse(Conc_) / 100).ToString();
|
||||||
|
|
||||||
if (double.TryParse(list_Weight.Text, out ang))
|
if (double.TryParse(list_Weight.Text, out ang))
|
||||||
{
|
{
|
||||||
@@ -866,7 +979,7 @@ namespace formula_manage
|
|||||||
|
|
||||||
if (curComboBox.Text != "")
|
if (curComboBox.Text != "")
|
||||||
{
|
{
|
||||||
Name_ = curComboBox.Text;
|
Name_ = curComboBox.Text.TrimEnd();
|
||||||
|
|
||||||
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
|
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
|
||||||
|
|
||||||
@@ -879,6 +992,7 @@ namespace formula_manage
|
|||||||
Code_ = r[0].ItemArray[0].ToString();
|
Code_ = r[0].ItemArray[0].ToString();
|
||||||
Type_ = r[0].ItemArray[2].ToString();
|
Type_ = r[0].ItemArray[2].ToString();
|
||||||
Conc_ = r[0].ItemArray[3].ToString();
|
Conc_ = r[0].ItemArray[3].ToString();
|
||||||
|
Conc_ = (double.Parse(Conc_) / 100).ToString();
|
||||||
|
|
||||||
if (double.TryParse(list_Weight.Text, out ang))
|
if (double.TryParse(list_Weight.Text, out ang))
|
||||||
{
|
{
|
||||||
@@ -923,7 +1037,5 @@ namespace formula_manage
|
|||||||
Save.IsEnabled = false;
|
Save.IsEnabled = false;
|
||||||
Confirm.IsEnabled = false;
|
Confirm.IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Resources;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
|
|||||||
Generated
+15
-23
@@ -3,47 +3,42 @@
|
|||||||
// 此代码由工具生成。
|
// 此代码由工具生成。
|
||||||
// 运行时版本:4.0.30319.42000
|
// 运行时版本:4.0.30319.42000
|
||||||
//
|
//
|
||||||
// 对此文件的更改可能导致不正确的行为,如果
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
// 重新生成代码,则所做更改将丢失。
|
// 重新生成代码,这些更改将会丢失。
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace formula_manage.Properties
|
namespace formula_manage.Properties {
|
||||||
{
|
using System;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 强类型资源类,用于查找本地化字符串等。
|
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// 此类是由 StronglyTypedResourceBuilder
|
// 此类是由 StronglyTypedResourceBuilder
|
||||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class Resources
|
internal class Resources {
|
||||||
{
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
internal Resources()
|
internal Resources() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 返回此类使用的缓存 ResourceManager 实例。
|
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
{
|
get {
|
||||||
get
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
{
|
|
||||||
if ((resourceMan == null))
|
|
||||||
{
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("formula_manage.Properties.Resources", typeof(Resources).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("formula_manage.Properties.Resources", typeof(Resources).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
@@ -56,14 +51,11 @@ namespace formula_manage.Properties
|
|||||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
internal static global::System.Globalization.CultureInfo Culture
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return resourceCulture;
|
return resourceCulture;
|
||||||
}
|
}
|
||||||
set
|
set {
|
||||||
{
|
|
||||||
resourceCulture = value;
|
resourceCulture = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+9
-13
@@ -1,28 +1,24 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// 此代码由工具生成。
|
||||||
// Runtime Version:4.0.30319.42000
|
// 运行时版本:4.0.30319.42000
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
// the code is regenerated.
|
// 重新生成代码,这些更改将会丢失。
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace formula_manage.Properties
|
namespace formula_manage.Properties {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
{
|
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
public static Settings Default
|
public static Settings Default {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return defaultInstance;
|
return defaultInstance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace formula_manage.SQLModels
|
namespace formula_manage.SQLModels
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,190 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CRC校验
|
||||||
|
/// </summary>
|
||||||
|
public class CRCcheck16
|
||||||
|
{
|
||||||
|
|
||||||
|
#region CRC16
|
||||||
|
public static byte[] CRC16(byte[] data)
|
||||||
|
{
|
||||||
|
int len = data.Length;
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
ushort crc = 0xFFFF;
|
||||||
|
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
crc = (ushort)(crc ^ (data[i]));
|
||||||
|
for (int j = 0; j < 8; j++)
|
||||||
|
{
|
||||||
|
crc = (crc & 1) != 0 ? (ushort)((crc >> 1) ^ 0xA001) : (ushort)(crc >> 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
byte hi = (byte)((crc & 0xFF00) >> 8); //高位置
|
||||||
|
byte lo = (byte)(crc & 0x00FF); //低位置
|
||||||
|
|
||||||
|
return new byte[] { hi, lo };
|
||||||
|
}
|
||||||
|
return new byte[] { 0, 0 };
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ToCRC16
|
||||||
|
public static string ToCRC16(string content)
|
||||||
|
{
|
||||||
|
return ToCRC16(content, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToCRC16(string content, bool isReverse)
|
||||||
|
{
|
||||||
|
return ToCRC16(content, Encoding.UTF8, isReverse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToCRC16(string content, Encoding encoding)
|
||||||
|
{
|
||||||
|
return ByteToString(CRC16(encoding.GetBytes(content)), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToCRC16(string content, Encoding encoding, bool isReverse)
|
||||||
|
{
|
||||||
|
return ByteToString(CRC16(encoding.GetBytes(content)), isReverse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToCRC16(byte[] data)
|
||||||
|
{
|
||||||
|
return ByteToString(CRC16(data), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToCRC16(byte[] data, bool isReverse)
|
||||||
|
{
|
||||||
|
return ByteToString(CRC16(data), isReverse);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ToModbusCRC16
|
||||||
|
public static string ToModbusCRC16(string s)
|
||||||
|
{
|
||||||
|
return ToModbusCRC16(s, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToModbusCRC16(string s, bool isReverse)
|
||||||
|
{
|
||||||
|
return ByteToString(CRC16(StringToHexByte(s)), isReverse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToModbusCRC16(byte[] data)
|
||||||
|
{
|
||||||
|
return ToModbusCRC16(data, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToModbusCRC16(byte[] data, bool isReverse)
|
||||||
|
{
|
||||||
|
return ByteToString(CRC16(data), isReverse);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ByteToString
|
||||||
|
public static string ByteToString(byte[] arr, bool isReverse)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte hi = arr[0], lo = arr[1];
|
||||||
|
return Convert.ToString(isReverse ? hi + lo * 0x100 : hi * 0x100 + lo, 16).ToUpper().PadLeft(4, '0');
|
||||||
|
}
|
||||||
|
catch (Exception ex) { throw (ex); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ByteToString(byte[] arr)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ByteToString(arr, true);
|
||||||
|
}
|
||||||
|
catch (Exception ex) { throw (ex); }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region StringToHexString
|
||||||
|
public static string StringToHexString(string str)
|
||||||
|
{
|
||||||
|
StringBuilder s = new StringBuilder();
|
||||||
|
foreach (short c in str.ToCharArray())
|
||||||
|
{
|
||||||
|
s.Append(c.ToString("X4"));
|
||||||
|
}
|
||||||
|
return s.ToString();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region StringToHexByte
|
||||||
|
private static string ConvertChinese(string str)
|
||||||
|
{
|
||||||
|
StringBuilder s = new StringBuilder();
|
||||||
|
foreach (short c in str.ToCharArray())
|
||||||
|
{
|
||||||
|
if (c <= 0 || c >= 127)
|
||||||
|
{
|
||||||
|
s.Append(c.ToString("X4"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s.Append((char)c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string FilterChinese(string str)
|
||||||
|
{
|
||||||
|
StringBuilder s = new StringBuilder();
|
||||||
|
foreach (short c in str.ToCharArray())
|
||||||
|
{
|
||||||
|
if (c > 0 && c < 127)
|
||||||
|
{
|
||||||
|
s.Append((char)c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字符串转16进制字符数组
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hex"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static byte[] StringToHexByte(string str)
|
||||||
|
{
|
||||||
|
return StringToHexByte(str, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字符串转16进制字符数组
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <param name="isFilterChinese">是否过滤掉中文字符</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static byte[] StringToHexByte(string str, bool isFilterChinese)
|
||||||
|
{
|
||||||
|
string hex = isFilterChinese ? FilterChinese(str) : ConvertChinese(str);
|
||||||
|
|
||||||
|
//清除所有空格
|
||||||
|
hex = hex.Replace(" ", "");
|
||||||
|
//若字符个数为奇数,补一个0
|
||||||
|
hex += hex.Length % 2 != 0 ? "0" : "";
|
||||||
|
|
||||||
|
byte[] result = new byte[hex.Length / 2];
|
||||||
|
for (int i = 0, c = result.Length; i < c; i++)
|
||||||
|
{
|
||||||
|
result[i] = Convert.ToByte(hex.Substring(i * 2, 2), 16);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,334 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
public class Code128
|
||||||
|
{
|
||||||
|
private DataTable m_Code128 = new DataTable();
|
||||||
|
private uint m_Height = 40;
|
||||||
|
/// <summary>
|
||||||
|
/// 高度
|
||||||
|
/// </summary>
|
||||||
|
public uint Height { get { return m_Height; } set { m_Height = value; } }
|
||||||
|
private Font m_ValueFont = null;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示可见号码 如果为NULL不显示号码
|
||||||
|
/// </summary>
|
||||||
|
public Font ValueFont { get { return m_ValueFont; } set { m_ValueFont = value; } }
|
||||||
|
private byte m_Magnify = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 放大倍数
|
||||||
|
/// </summary>
|
||||||
|
public byte Magnify { get { return m_Magnify; } set { m_Magnify = value; } }
|
||||||
|
/// <summary>
|
||||||
|
/// 条码类别
|
||||||
|
/// </summary>
|
||||||
|
public enum Encode
|
||||||
|
{
|
||||||
|
Code128A,
|
||||||
|
Code128B,
|
||||||
|
Code128C,
|
||||||
|
EAN128
|
||||||
|
}
|
||||||
|
public Code128()
|
||||||
|
{
|
||||||
|
m_Code128.Columns.Add("ID");
|
||||||
|
m_Code128.Columns.Add("Code128A");
|
||||||
|
m_Code128.Columns.Add("Code128B");
|
||||||
|
m_Code128.Columns.Add("Code128C");
|
||||||
|
m_Code128.Columns.Add("BandCode");
|
||||||
|
m_Code128.CaseSensitive = true;
|
||||||
|
#region 数据表
|
||||||
|
m_Code128.Rows.Add("0", " ", " ", "00", "212222");
|
||||||
|
m_Code128.Rows.Add("1", "!", "!", "01", "222122");
|
||||||
|
m_Code128.Rows.Add("2", "\"", "\"", "02", "222221");
|
||||||
|
m_Code128.Rows.Add("3", "#", "#", "03", "121223");
|
||||||
|
m_Code128.Rows.Add("4", "$", "$", "04", "121322");
|
||||||
|
m_Code128.Rows.Add("5", "%", "%", "05", "131222");
|
||||||
|
m_Code128.Rows.Add("6", "&", "&", "06", "122213");
|
||||||
|
m_Code128.Rows.Add("7", "'", "'", "07", "122312");
|
||||||
|
m_Code128.Rows.Add("8", "(", "(", "08", "132212");
|
||||||
|
m_Code128.Rows.Add("9", ")", ")", "09", "221213");
|
||||||
|
m_Code128.Rows.Add("10", "*", "*", "10", "221312");
|
||||||
|
m_Code128.Rows.Add("11", "+", "+", "11", "231212");
|
||||||
|
m_Code128.Rows.Add("12", ",", ",", "12", "112232");
|
||||||
|
m_Code128.Rows.Add("13", "-", "-", "13", "122132");
|
||||||
|
m_Code128.Rows.Add("14", ".", ".", "14", "122231");
|
||||||
|
m_Code128.Rows.Add("15", "/", "/", "15", "113222");
|
||||||
|
m_Code128.Rows.Add("16", "0", "0", "16", "123122");
|
||||||
|
m_Code128.Rows.Add("17", "1", "1", "17", "123221");
|
||||||
|
m_Code128.Rows.Add("18", "2", "2", "18", "223211");
|
||||||
|
m_Code128.Rows.Add("19", "3", "3", "19", "221132");
|
||||||
|
m_Code128.Rows.Add("20", "4", "4", "20", "221231");
|
||||||
|
m_Code128.Rows.Add("21", "5", "5", "21", "213212");
|
||||||
|
m_Code128.Rows.Add("22", "6", "6", "22", "223112");
|
||||||
|
m_Code128.Rows.Add("23", "7", "7", "23", "312131");
|
||||||
|
m_Code128.Rows.Add("24", "8", "8", "24", "311222");
|
||||||
|
m_Code128.Rows.Add("25", "9", "9", "25", "321122");
|
||||||
|
m_Code128.Rows.Add("26", ":", ":", "26", "321221");
|
||||||
|
m_Code128.Rows.Add("27", ";", ";", "27", "312212");
|
||||||
|
m_Code128.Rows.Add("28", "<", "<", "28", "322112");
|
||||||
|
m_Code128.Rows.Add("29", "=", "=", "29", "322211");
|
||||||
|
m_Code128.Rows.Add("30", ">", ">", "30", "212123");
|
||||||
|
m_Code128.Rows.Add("31", "?", "?", "31", "212321");
|
||||||
|
m_Code128.Rows.Add("32", "@", "@", "32", "232121");
|
||||||
|
m_Code128.Rows.Add("33", "A", "A", "33", "111323");
|
||||||
|
m_Code128.Rows.Add("34", "B", "B", "34", "131123");
|
||||||
|
m_Code128.Rows.Add("35", "C", "C", "35", "131321");
|
||||||
|
m_Code128.Rows.Add("36", "D", "D", "36", "112313");
|
||||||
|
m_Code128.Rows.Add("37", "E", "E", "37", "132113");
|
||||||
|
m_Code128.Rows.Add("38", "F", "F", "38", "132311");
|
||||||
|
m_Code128.Rows.Add("39", "G", "G", "39", "211313");
|
||||||
|
m_Code128.Rows.Add("40", "H", "H", "40", "231113");
|
||||||
|
m_Code128.Rows.Add("41", "I", "I", "41", "231311");
|
||||||
|
m_Code128.Rows.Add("42", "J", "J", "42", "112133");
|
||||||
|
m_Code128.Rows.Add("43", "K", "K", "43", "112331");
|
||||||
|
m_Code128.Rows.Add("44", "L", "L", "44", "132131");
|
||||||
|
m_Code128.Rows.Add("45", "M", "M", "45", "113123");
|
||||||
|
m_Code128.Rows.Add("46", "N", "N", "46", "113321");
|
||||||
|
m_Code128.Rows.Add("47", "O", "O", "47", "133121");
|
||||||
|
m_Code128.Rows.Add("48", "P", "P", "48", "313121");
|
||||||
|
m_Code128.Rows.Add("49", "Q", "Q", "49", "211331");
|
||||||
|
m_Code128.Rows.Add("50", "R", "R", "50", "231131");
|
||||||
|
m_Code128.Rows.Add("51", "S", "S", "51", "213113");
|
||||||
|
m_Code128.Rows.Add("52", "T", "T", "52", "213311");
|
||||||
|
m_Code128.Rows.Add("53", "U", "U", "53", "213131");
|
||||||
|
m_Code128.Rows.Add("54", "V", "V", "54", "311123");
|
||||||
|
m_Code128.Rows.Add("55", "W", "W", "55", "311321");
|
||||||
|
m_Code128.Rows.Add("56", "X", "X", "56", "331121");
|
||||||
|
m_Code128.Rows.Add("57", "Y", "Y", "57", "312113");
|
||||||
|
m_Code128.Rows.Add("58", "Z", "Z", "58", "312311");
|
||||||
|
m_Code128.Rows.Add("59", "[", "[", "59", "332111");
|
||||||
|
m_Code128.Rows.Add("60", "\\", "\\", "60", "314111");
|
||||||
|
m_Code128.Rows.Add("61", "]", "]", "61", "221411");
|
||||||
|
m_Code128.Rows.Add("62", "^", "^", "62", "431111");
|
||||||
|
m_Code128.Rows.Add("63", "_", "_", "63", "111224");
|
||||||
|
m_Code128.Rows.Add("64", "NUL", "`", "64", "111422");
|
||||||
|
m_Code128.Rows.Add("65", "SOH", "a", "65", "121124");
|
||||||
|
m_Code128.Rows.Add("66", "STX", "b", "66", "121421");
|
||||||
|
m_Code128.Rows.Add("67", "ETX", "c", "67", "141122");
|
||||||
|
m_Code128.Rows.Add("68", "EOT", "d", "68", "141221");
|
||||||
|
m_Code128.Rows.Add("69", "ENQ", "e", "69", "112214");
|
||||||
|
m_Code128.Rows.Add("70", "ACK", "f", "70", "112412");
|
||||||
|
m_Code128.Rows.Add("71", "BEL", "g", "71", "122114");
|
||||||
|
m_Code128.Rows.Add("72", "BS", "h", "72", "122411");
|
||||||
|
m_Code128.Rows.Add("73", "HT", "i", "73", "142112");
|
||||||
|
m_Code128.Rows.Add("74", "LF", "j", "74", "142211");
|
||||||
|
m_Code128.Rows.Add("75", "VT", "k", "75", "241211");
|
||||||
|
m_Code128.Rows.Add("76", "FF", "I", "76", "221114");
|
||||||
|
m_Code128.Rows.Add("77", "CR", "m", "77", "413111");
|
||||||
|
m_Code128.Rows.Add("78", "SO", "n", "78", "241112");
|
||||||
|
m_Code128.Rows.Add("79", "SI", "o", "79", "134111");
|
||||||
|
m_Code128.Rows.Add("80", "DLE", "p", "80", "111242");
|
||||||
|
m_Code128.Rows.Add("81", "DC1", "q", "81", "121142");
|
||||||
|
m_Code128.Rows.Add("82", "DC2", "r", "82", "121241");
|
||||||
|
m_Code128.Rows.Add("83", "DC3", "s", "83", "114212");
|
||||||
|
m_Code128.Rows.Add("84", "DC4", "t", "84", "124112");
|
||||||
|
m_Code128.Rows.Add("85", "NAK", "u", "85", "124211");
|
||||||
|
m_Code128.Rows.Add("86", "SYN", "v", "86", "411212");
|
||||||
|
m_Code128.Rows.Add("87", "ETB", "w", "87", "421112");
|
||||||
|
m_Code128.Rows.Add("88", "CAN", "x", "88", "421211");
|
||||||
|
m_Code128.Rows.Add("89", "EM", "y", "89", "212141");
|
||||||
|
m_Code128.Rows.Add("90", "SUB", "z", "90", "214121");
|
||||||
|
m_Code128.Rows.Add("91", "ESC", "{", "91", "412121");
|
||||||
|
m_Code128.Rows.Add("92", "FS", "|", "92", "111143");
|
||||||
|
m_Code128.Rows.Add("93", "GS", "}", "93", "111341");
|
||||||
|
m_Code128.Rows.Add("94", "RS", "~", "94", "131141");
|
||||||
|
m_Code128.Rows.Add("95", "US", "DEL", "95", "114113");
|
||||||
|
m_Code128.Rows.Add("96", "FNC3", "FNC3", "96", "114311");
|
||||||
|
m_Code128.Rows.Add("97", "FNC2", "FNC2", "97", "411113");
|
||||||
|
m_Code128.Rows.Add("98", "SHIFT", "SHIFT", "98", "411311");
|
||||||
|
m_Code128.Rows.Add("99", "CODEC", "CODEC", "99", "113141");
|
||||||
|
m_Code128.Rows.Add("100", "CODEB", "FNC4", "CODEB", "114131");
|
||||||
|
m_Code128.Rows.Add("101", "FNC4", "CODEA", "CODEA", "311141");
|
||||||
|
m_Code128.Rows.Add("102", "FNC1", "FNC1", "FNC1", "411131");
|
||||||
|
m_Code128.Rows.Add("103", "StartA", "StartA", "StartA", "211412");
|
||||||
|
m_Code128.Rows.Add("104", "StartB", "StartB", "StartB", "211214");
|
||||||
|
m_Code128.Rows.Add("105", "StartC", "StartC", "StartC", "211232");
|
||||||
|
m_Code128.Rows.Add("106", "Stop", "Stop", "Stop", "2331112");
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取128图形
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="p_Text">文字</param>
|
||||||
|
/// <param name="flag">是否显示文字</param>
|
||||||
|
/// <param name="p_Code">编码</param>
|
||||||
|
/// <returns>图形</returns>
|
||||||
|
public Bitmap GetCodeImage(string p_Text, bool flag, Encode p_Code)
|
||||||
|
{
|
||||||
|
string _ViewText = p_Text;
|
||||||
|
string _Text = "";
|
||||||
|
IList<int> _TextNumb = new List<int>();
|
||||||
|
int _Examine = 0; //首位
|
||||||
|
switch (p_Code)
|
||||||
|
{
|
||||||
|
case Encode.Code128C:
|
||||||
|
_Examine = 105;
|
||||||
|
if (!((p_Text.Length & 1) == 0)) throw new Exception("128C长度必须是偶数");
|
||||||
|
while (p_Text.Length != 0)
|
||||||
|
{
|
||||||
|
int _Temp = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int _CodeNumb128 = Int32.Parse(p_Text.Substring(0, 2));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw new Exception("128C必须是数字!");
|
||||||
|
}
|
||||||
|
_Text += GetValue(p_Code, p_Text.Substring(0, 2), ref _Temp);
|
||||||
|
_TextNumb.Add(_Temp);
|
||||||
|
p_Text = p_Text.Remove(0, 2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Encode.EAN128:
|
||||||
|
_Examine = 105;
|
||||||
|
if (!((p_Text.Length & 1) == 0)) throw new Exception("EAN128长度必须是偶数");
|
||||||
|
_TextNumb.Add(102);
|
||||||
|
_Text += "411131";
|
||||||
|
while (p_Text.Length != 0)
|
||||||
|
{
|
||||||
|
int _Temp = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int _CodeNumb128 = Int32.Parse(p_Text.Substring(0, 2));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw new Exception("128C必须是数字!");
|
||||||
|
}
|
||||||
|
_Text += GetValue(Encode.Code128C, p_Text.Substring(0, 2), ref _Temp);
|
||||||
|
_TextNumb.Add(_Temp);
|
||||||
|
p_Text = p_Text.Remove(0, 2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (p_Code == Encode.Code128A)
|
||||||
|
{
|
||||||
|
_Examine = 103;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_Examine = 104;
|
||||||
|
}
|
||||||
|
while (p_Text.Length != 0)
|
||||||
|
{
|
||||||
|
int _Temp = 0;
|
||||||
|
string _ValueCode = GetValue(p_Code, p_Text.Substring(0, 1), ref _Temp);
|
||||||
|
if (_ValueCode.Length == 0) throw new Exception("无效的字符集!" + p_Text.Substring(0, 1).ToString());
|
||||||
|
_Text += _ValueCode;
|
||||||
|
_TextNumb.Add(_Temp);
|
||||||
|
p_Text = p_Text.Remove(0, 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (_TextNumb.Count == 0) throw new Exception("错误的编码,无数据");
|
||||||
|
_Text = _Text.Insert(0, GetValue(_Examine)); //获取开始位
|
||||||
|
|
||||||
|
for (int i = 0; i != _TextNumb.Count; i++)
|
||||||
|
{
|
||||||
|
_Examine += _TextNumb[i] * (i + 1);
|
||||||
|
}
|
||||||
|
_Examine = _Examine % 103; //获得严效位
|
||||||
|
_Text += GetValue(_Examine); //获取严效位
|
||||||
|
_Text += "2331112"; //结束位
|
||||||
|
Bitmap _CodeImage = GetImage(_Text);
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
GetViewText(_CodeImage, _ViewText);
|
||||||
|
}
|
||||||
|
return _CodeImage;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取目标对应的数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="p_Code">编码</param>
|
||||||
|
/// <param name="p_Value">数值 A b 30</param>
|
||||||
|
/// <param name="p_SetID">返回编号</param>
|
||||||
|
/// <returns>编码</returns>
|
||||||
|
private string GetValue(Encode p_Code, string p_Value, ref int p_SetID)
|
||||||
|
{
|
||||||
|
if (m_Code128 == null) return "";
|
||||||
|
DataRow[] _Row = m_Code128.Select(p_Code.ToString() + "='" + p_Value + "'");
|
||||||
|
if (_Row.Length != 1) throw new Exception("错误的编码" + p_Value.ToString());
|
||||||
|
p_SetID = Int32.Parse(_Row[0]["ID"].ToString());
|
||||||
|
return _Row[0]["BandCode"].ToString();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 根据编号获得条纹
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="p_CodeId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string GetValue(int p_CodeId)
|
||||||
|
{
|
||||||
|
DataRow[] _Row = m_Code128.Select("ID='" + p_CodeId.ToString() + "'");
|
||||||
|
if (_Row.Length != 1) throw new Exception("验效位的编码错误" + p_CodeId.ToString());
|
||||||
|
return _Row[0]["BandCode"].ToString();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获得条码图形
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="p_Text">文字</param>
|
||||||
|
/// <returns>图形</returns>
|
||||||
|
private Bitmap GetImage(string p_Text)
|
||||||
|
{
|
||||||
|
char[] _Value = p_Text.ToCharArray();
|
||||||
|
int _Width = 0;
|
||||||
|
for (int i = 0; i != _Value.Length; i++)
|
||||||
|
{
|
||||||
|
_Width += Int32.Parse(_Value[i].ToString()) * (m_Magnify + 1);
|
||||||
|
}
|
||||||
|
Bitmap _CodeImage = new Bitmap(_Width, (int)m_Height);
|
||||||
|
Graphics _Garphics = Graphics.FromImage(_CodeImage);
|
||||||
|
//Pen _Pen;
|
||||||
|
int _LenEx = 0;
|
||||||
|
for (int i = 0; i != _Value.Length; i++)
|
||||||
|
{
|
||||||
|
int _ValueNumb = Int32.Parse(_Value[i].ToString()) * (m_Magnify + 1); //获取宽和放大系数
|
||||||
|
if (!((i & 1) == 0))
|
||||||
|
{
|
||||||
|
//_Pen = new Pen(Brushes.White, _ValueNumb);
|
||||||
|
_Garphics.FillRectangle(Brushes.White, new Rectangle(_LenEx, 0, _ValueNumb, (int)m_Height));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//_Pen = new Pen(Brushes.Black, _ValueNumb);
|
||||||
|
_Garphics.FillRectangle(Brushes.Black, new Rectangle(_LenEx, 0, _ValueNumb, (int)m_Height));
|
||||||
|
}
|
||||||
|
//_Garphics.(_Pen, new Point(_LenEx, 0), new Point(_LenEx, m_Height));
|
||||||
|
_LenEx += _ValueNumb;
|
||||||
|
}
|
||||||
|
_Garphics.Dispose();
|
||||||
|
return _CodeImage;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 显示可见条码文字 如果小于40 不显示文字
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="p_Bitmap">图形</param>
|
||||||
|
private void GetViewText(Bitmap p_Bitmap, string p_ViewText)
|
||||||
|
{
|
||||||
|
if (m_ValueFont == null) return;
|
||||||
|
Graphics _Graphics = Graphics.FromImage(p_Bitmap);
|
||||||
|
SizeF _DrawSize = _Graphics.MeasureString(p_ViewText, m_ValueFont);
|
||||||
|
if (_DrawSize.Height > p_Bitmap.Height - 10 || _DrawSize.Width > p_Bitmap.Width)
|
||||||
|
{
|
||||||
|
_Graphics.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int _StarY = p_Bitmap.Height - (int)_DrawSize.Height;
|
||||||
|
_Graphics.FillRectangle(Brushes.White, new Rectangle(0, _StarY, p_Bitmap.Width, (int)_DrawSize.Height));
|
||||||
|
_Graphics.DrawString(p_ViewText, m_ValueFont, Brushes.Black, 0, _StarY);
|
||||||
|
}
|
||||||
|
//12345678
|
||||||
|
//(105 + (1 * 12 + 2 * 34 + 3 * 56 + 4 *78)) % 103 = 47
|
||||||
|
//结果为starc +12 +34 +56 +78 +47 +end
|
||||||
|
internal Image GetCodeImage(string p)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace formula_manage.UserClass
|
namespace formula_manage.UserClass
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace formula_manage.UserClass
|
namespace formula_manage.UserClass
|
||||||
{
|
{
|
||||||
internal class DataTableToObservableCollection
|
internal class DataTableToObservableCollection //数据表到可观察集合
|
||||||
{
|
{
|
||||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
using System.Management;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取硬件SN
|
||||||
|
/// </summary>
|
||||||
|
internal class HardwareSN
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取cpuid
|
||||||
|
/// </summary>
|
||||||
|
public static string GetCPUSerialNumber()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
|
||||||
|
string cpuSerialNumber = "";
|
||||||
|
foreach (ManagementObject mo in searcher.Get())
|
||||||
|
{
|
||||||
|
cpuSerialNumber = mo["ProcessorId"].ToString().Trim();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return cpuSerialNumber;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取主板id
|
||||||
|
/// </summary>
|
||||||
|
public static string GetBIOSSerialNumber()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_BIOS");
|
||||||
|
string biosSerialNumber = "";
|
||||||
|
foreach (ManagementObject mo in searcher.Get())
|
||||||
|
{
|
||||||
|
biosSerialNumber = mo.GetPropertyValue("SerialNumber").ToString().Trim();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return biosSerialNumber;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取硬盘id
|
||||||
|
/// </summary>
|
||||||
|
public static string GetHardDiskSerialNumber()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
|
||||||
|
string hardDiskSerialNumber = "";
|
||||||
|
foreach (ManagementObject mo in searcher.Get())
|
||||||
|
{
|
||||||
|
hardDiskSerialNumber = mo["SerialNumber"].ToString().Trim();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return hardDiskSerialNumber;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取网卡id
|
||||||
|
/// </summary>
|
||||||
|
public static string GetNetCardMACAddress()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapter WHERE ((MACAddress Is Not NULL) AND (Manufacturer <> 'Microsoft'))");
|
||||||
|
string netCardMACAddress = "";
|
||||||
|
foreach (ManagementObject mo in searcher.Get())
|
||||||
|
{
|
||||||
|
netCardMACAddress = mo["MACAddress"].ToString().Trim();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return netCardMACAddress;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System.Runtime.InteropServices;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace formula_manage.UserClass
|
namespace formula_manage.UserClass
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
using System.Text;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
public static class LogDataRead
|
||||||
|
{
|
||||||
|
private const int MaxCount = 1000;
|
||||||
|
private static int Count = 0;
|
||||||
|
private static RichTextBox textControl;
|
||||||
|
private static InlineCollection inlines;
|
||||||
|
|
||||||
|
//设置主控件
|
||||||
|
public static void SetTextControl(RichTextBox _textBox)
|
||||||
|
{
|
||||||
|
textControl = _textBox;
|
||||||
|
Paragraph graph = new Paragraph();
|
||||||
|
inlines = graph.Inlines;
|
||||||
|
textControl.Document.Blocks.Add(graph);
|
||||||
|
}
|
||||||
|
|
||||||
|
//输出黑色消息
|
||||||
|
public static void Info(string format, params object[] args)
|
||||||
|
{
|
||||||
|
AppendText(Brushes.Black, format, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
//输出绿色消息
|
||||||
|
public static void Suc(string format, params object[] args)
|
||||||
|
{
|
||||||
|
AppendText(Brushes.DarkGreen, format, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
//输出黄色消息
|
||||||
|
public static void Warning(string format, params object[] args)
|
||||||
|
{
|
||||||
|
AppendText(Brushes.DarkOrange, format, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
//输出红色消息
|
||||||
|
public static void Error(string format, params object[] args)
|
||||||
|
{
|
||||||
|
AppendText(Brushes.Red, format, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
//清除日志
|
||||||
|
public static void Clear()
|
||||||
|
{
|
||||||
|
Count = 0;
|
||||||
|
inlines.Clear();
|
||||||
|
textControl.ScrollToEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AppendText(Brush color, string format, params object[] args)
|
||||||
|
{
|
||||||
|
textControl.BeginChange();
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.Append("[");
|
||||||
|
builder.Append(Count++);
|
||||||
|
builder.Append("] : ");
|
||||||
|
builder.Append(string.Format(format, (object[])args));
|
||||||
|
builder.Append("\n");
|
||||||
|
string str = builder.ToString();
|
||||||
|
inlines.Add(new Run(str) { Foreground = color });
|
||||||
|
if (inlines.Count > MaxCount)
|
||||||
|
{
|
||||||
|
inlines.Remove(inlines.FirstInline);
|
||||||
|
}
|
||||||
|
textControl.ScrollToEnd();
|
||||||
|
textControl.EndChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
public class LogGing
|
||||||
|
{
|
||||||
|
public static void LogGingDATA(string dat)
|
||||||
|
{
|
||||||
|
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
||||||
|
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";//日志文件
|
||||||
|
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
||||||
|
|
||||||
|
if (Directory.Exists(logpath))//检查日志路径
|
||||||
|
{
|
||||||
|
if (!File.Exists(logPath))//检查日志文件并写入启动日志
|
||||||
|
{
|
||||||
|
FileStream fs = new FileStream(logPath, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine(Log_time + dat);
|
||||||
|
wr.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine(Log_time + dat);
|
||||||
|
wr.Close(); }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DirectoryInfo directoryInfo = new DirectoryInfo(logpath);
|
||||||
|
directoryInfo.Create();//创建日志路径
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// MD5加密
|
||||||
|
/// </summary>
|
||||||
|
internal class MD5check
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 16位MD5加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="password"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string MD5Encrypt16(string password)
|
||||||
|
{
|
||||||
|
var md5 = new MD5CryptoServiceProvider();
|
||||||
|
string t2 = BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(password)), 4, 8);
|
||||||
|
t2 = t2.Replace("-", "");
|
||||||
|
return t2;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 32位MD5加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="password"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string MD5Encrypt32(string password)
|
||||||
|
{
|
||||||
|
string cl = password;
|
||||||
|
string pwd = "";
|
||||||
|
MD5 md5 = MD5.Create(); //实例化一个md5对像
|
||||||
|
// 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择
|
||||||
|
byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(cl));
|
||||||
|
// 通过使用循环,将字节类型的数组转换为字符串,此字符串是常规字符格式化所得
|
||||||
|
for (int i = 0; i < s.Length; i++)
|
||||||
|
{
|
||||||
|
// 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符
|
||||||
|
pwd = pwd + s[i].ToString("X");
|
||||||
|
}
|
||||||
|
return pwd;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 64位MD5加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="password"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string MD5Encrypt64(string password)
|
||||||
|
{
|
||||||
|
string cl = password;
|
||||||
|
//string pwd = "";
|
||||||
|
MD5 md5 = MD5.Create(); //实例化一个md5对像
|
||||||
|
// 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择
|
||||||
|
byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(cl));
|
||||||
|
return Convert.ToBase64String(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace formula_manage.UserClass
|
namespace formula_manage.UserClass
|
||||||
{
|
{
|
||||||
internal class PressKey
|
internal class PressKey
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 键盘模拟
|
||||||
|
/// </summary>
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
|
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
|
||||||
public static void PressKeys(Keys key, bool up)
|
public static void PressKeys(Keys key, bool up)
|
||||||
|
|||||||
@@ -0,0 +1,156 @@
|
|||||||
|
using FastReport;
|
||||||
|
using FastReport.Data;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
public class PrintHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 打印
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="printerName">打印机</param>
|
||||||
|
/// <param name="frxPath">模板</param>
|
||||||
|
/// <param name="dicParam">字典参数</param>
|
||||||
|
/// <param name="dsDataSource">数据源</param>
|
||||||
|
/// <param name="printNum">打印数量</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Tuple<bool, string> Print(string printerName, string frxPath, Dictionary<string, object> dicParam, DataSet dsDataSource, int printNum = 1)
|
||||||
|
{
|
||||||
|
bool flag = false;
|
||||||
|
string msg = "";
|
||||||
|
FastReport.Report report = new FastReport.Report();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
report.Load(frxPath);
|
||||||
|
report.DoublePass = true;
|
||||||
|
if (dicParam != null && dicParam.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in dicParam)
|
||||||
|
{
|
||||||
|
report.SetParameterValue(item.Key, item.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dsDataSource != null && dsDataSource.Tables.Count > 0)
|
||||||
|
{
|
||||||
|
report.RegisterData(dsDataSource);
|
||||||
|
foreach (DataSourceBase dataSourceBase in report.Dictionary.DataSources)
|
||||||
|
{
|
||||||
|
dataSourceBase.Enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
report.PrintSettings.ShowDialog = false;
|
||||||
|
report.PrintSettings.Printer = printerName;
|
||||||
|
report.PrintSettings.PrintMode = PrintMode.Split;
|
||||||
|
EnvironmentSettings envSet = new EnvironmentSettings();
|
||||||
|
envSet.ReportSettings.ShowProgress = false;
|
||||||
|
for (int i = 0; i < printNum; i++)
|
||||||
|
{
|
||||||
|
report.Print();
|
||||||
|
}
|
||||||
|
flag = true;
|
||||||
|
msg = "打印成功";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
msg = ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
report.Dispose();
|
||||||
|
}
|
||||||
|
return new Tuple<bool, string>(flag, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设计
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="frxPath">模板</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Tuple<bool, string> Design(string frxPath)
|
||||||
|
{
|
||||||
|
bool flag = false;
|
||||||
|
string msg = "";
|
||||||
|
FastReport.Report report = new FastReport.Report();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string chineseSimpleFrl = AppDomain.CurrentDomain.BaseDirectory + @"FastReport\Localization\language.frl";
|
||||||
|
FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
report.Load(frxPath);
|
||||||
|
report.DoublePass = true;
|
||||||
|
|
||||||
|
report.Design();
|
||||||
|
flag = true;
|
||||||
|
msg = "Designer Open";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
msg = ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
report.Dispose();
|
||||||
|
}
|
||||||
|
return new Tuple<bool, string>(flag, msg);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设计
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="frxPath">模板</param>
|
||||||
|
/// <param name="dicParam">字典参数</param>
|
||||||
|
/// <param name="dsDataSource">数据源</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Tuple<bool, string> Designs(string frxPath, Dictionary<string, object> dicParam, DataSet dsDataSource)
|
||||||
|
{
|
||||||
|
bool flag = false;
|
||||||
|
string msg = "";
|
||||||
|
FastReport.Report report = new FastReport.Report();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
report.Load(frxPath);
|
||||||
|
report.DoublePass = true;
|
||||||
|
if (dicParam != null && dicParam.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in dicParam)
|
||||||
|
{
|
||||||
|
report.SetParameterValue(item.Key, item.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dsDataSource != null && dsDataSource.Tables.Count > 0)
|
||||||
|
{
|
||||||
|
report.RegisterData(dsDataSource);
|
||||||
|
foreach (DataSourceBase dataSourceBase in report.Dictionary.DataSources)
|
||||||
|
{
|
||||||
|
dataSourceBase.Enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
report.Design();
|
||||||
|
flag = true;
|
||||||
|
msg = "Designer Open";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
msg = ex.Message;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
report.Dispose();
|
||||||
|
}
|
||||||
|
return new Tuple<bool, string>(flag, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 字符串转数字
|
||||||
|
/// </summary>
|
||||||
|
internal class StrToInt
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 十六进制字符串转十进制
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str">十六进制字符</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int To16Convert10(string str)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
str = str.Trim().Replace(" ", ""); //移除空字符
|
||||||
|
//方法1
|
||||||
|
res = int.Parse(str, System.Globalization.NumberStyles.AllowHexSpecifier);
|
||||||
|
//方法2
|
||||||
|
//int r2 = System.Int32.Parse(str, System.Globalization.NumberStyles.HexNumber);
|
||||||
|
//Console.WriteLine(r2);
|
||||||
|
//方法3
|
||||||
|
//int r3 = Convert.ToInt32(str, 16);
|
||||||
|
//Console.WriteLine(r3);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
public class TCPServer
|
||||||
|
{
|
||||||
|
public static string infoR;
|
||||||
|
//第一步:调用socket()函数创建一个用于通信的套接字
|
||||||
|
public static Socket listenSocket;
|
||||||
|
|
||||||
|
//字典集合:存储IP和Socket的集合
|
||||||
|
public static Dictionary<string, Socket> OnLineList = new Dictionary<string, Socket>();
|
||||||
|
|
||||||
|
|
||||||
|
//当前时间
|
||||||
|
private string CurrentTime
|
||||||
|
{
|
||||||
|
get { return DateTime.Now.ToString("HH:mm:ss") + Environment.NewLine; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//编码格式
|
||||||
|
public static Encoding econding = Encoding.UTF8;
|
||||||
|
|
||||||
|
public static void Start()
|
||||||
|
{
|
||||||
|
//第一步:调用socket()函数创建一个用于通信的套接字
|
||||||
|
listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
//第二步:给已经创建的套接字绑定一个端口号,这一般通过设置网络套接口地址和调用Bind()函数来实现
|
||||||
|
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(UserClass.get_local_ip_address.IP_Address()), int.Parse("11080"));
|
||||||
|
UserClass.LogGing.LogGingDATA("NativeIP = " + UserClass.get_local_ip_address.IP_Address());
|
||||||
|
UserClass.LogGing.LogGingDATA("NativePORT = 11080");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
listenSocket.Bind(endPoint);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
UserClass.LogGing.LogGingDATA("TCP_NotStart");
|
||||||
|
UserClass.LogGing.LogGingDATA(ex.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//第三步:调用listen()函数使套接字成为一个监听套接字
|
||||||
|
listenSocket.Listen(10);
|
||||||
|
//ShowMessage("服务器开启成功");
|
||||||
|
|
||||||
|
//开启一个线程监听
|
||||||
|
Task.Run(new Action(() => { ListenConnection(); }));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ListenConnection()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
Socket clientSocket = listenSocket.Accept();
|
||||||
|
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||||
|
//更新在线列表
|
||||||
|
// AddOnLine(ip, true);
|
||||||
|
//更新在线列表集合
|
||||||
|
OnLineList.Add(ip, clientSocket);
|
||||||
|
UserClass.LogGing.LogGingDATA("IP_Online = " + ip);
|
||||||
|
// ShowMessage(ip + "上线了");
|
||||||
|
Task.Run(() => ReceiveMsg(clientSocket));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="clientSocket"></param>
|
||||||
|
public static void ReceiveMsg(Socket clientSocket)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
//定义一个2M的缓冲区
|
||||||
|
byte[] buffer = new byte[1024 * 1024 * 10];
|
||||||
|
|
||||||
|
int length = -1;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
length = clientSocket.Receive(buffer);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
//客户端下线了
|
||||||
|
//更新在线列表
|
||||||
|
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||||
|
UserClass.LogGing.LogGingDATA("IP_Line = " + ip);
|
||||||
|
// AddOnLine(ip, false);
|
||||||
|
OnLineList.Remove(ip); //移除ip
|
||||||
|
break; //退出循环
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length == 0)
|
||||||
|
{
|
||||||
|
//客户端下线了
|
||||||
|
//更新在线列表
|
||||||
|
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||||
|
UserClass.LogGing.LogGingDATA("IP_Line = " + ip);
|
||||||
|
// AddOnLine(ip, false);
|
||||||
|
OnLineList.Remove(ip);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
infoR = econding.GetString(buffer, 0, length);
|
||||||
|
//ShowMessage(info);
|
||||||
|
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
/// <summary>
|
||||||
|
/// 在线列表更新
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="clientIp"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
private void AddOnLine(string clientIp, bool value)
|
||||||
|
{
|
||||||
|
Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
this.lst_Online.Items.Add(clientIp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.lst_Online.Items.Remove(clientIp);
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新接收区
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
private void ShowMessage(string info)
|
||||||
|
{
|
||||||
|
Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
this.txt_Rcv.AppendText(CurrentTime + info + Environment.NewLine);
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
/// <summary>
|
||||||
|
/// 消息发送
|
||||||
|
/// </summary>
|
||||||
|
public static void Bn_Send(string IP, string DAT)
|
||||||
|
{
|
||||||
|
if (OnLineList.ContainsKey(IP))
|
||||||
|
{
|
||||||
|
OnLineList[IP].Send(econding.GetBytes(DAT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 群发功能
|
||||||
|
/// </summary>
|
||||||
|
public static void Btn_SendAll(string DAT)
|
||||||
|
{
|
||||||
|
foreach (string item in OnLineList.Keys.ToArray())
|
||||||
|
{
|
||||||
|
if (OnLineList.ContainsKey(item))
|
||||||
|
{
|
||||||
|
OnLineList[item].Send(econding.GetBytes(DAT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing.Printing;
|
using System.Drawing.Printing;
|
||||||
using System.Linq;
|
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Printing;
|
using System.Printing;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace formula_manage.UserClass
|
namespace formula_manage.UserClass
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
public class get_local_ip_address
|
||||||
|
{
|
||||||
|
public static string getLocalIPAddressWithNetworkInterface(NetworkInterfaceType _type)//获取本机ip并以字符串方式返回
|
||||||
|
{
|
||||||
|
string output = "";
|
||||||
|
foreach (NetworkInterface item in NetworkInterface.GetAllNetworkInterfaces())
|
||||||
|
{
|
||||||
|
if (item.NetworkInterfaceType == _type && item.OperationalStatus == OperationalStatus.Up)
|
||||||
|
{
|
||||||
|
foreach (UnicastIPAddressInformation ip in item.GetIPProperties().UnicastAddresses)
|
||||||
|
{
|
||||||
|
if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
|
||||||
|
{
|
||||||
|
output = ip.Address.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string IP_Address()
|
||||||
|
{
|
||||||
|
string ip;
|
||||||
|
|
||||||
|
ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Ethernet);
|
||||||
|
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wireless80211);
|
||||||
|
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Ppp);
|
||||||
|
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wwanpp);
|
||||||
|
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.TokenRing);
|
||||||
|
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Fddi);
|
||||||
|
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.GenericModem);
|
||||||
|
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.IPOverAtm);
|
||||||
|
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Tunnel);
|
||||||
|
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Unknown);
|
||||||
|
|
||||||
|
if (ip == "") ip = "127.0.0.1";
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-14
@@ -1,17 +1,4 @@
|
|||||||
using System;
|
using System.Windows.Controls;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace formula_manage.View
|
namespace formula_manage.View
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<UserControl x:Class="formula_manage.View.ViewOrder"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:formula_manage.View"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="150" d:DesignWidth="405" Background="#FFE0E0E0">
|
||||||
|
<Grid>
|
||||||
|
<DataGrid x:Name="Order" AlternationCount="2" IsReadOnly="True" MouseDoubleClick="DataGridOrder_MouseDoubleClick"
|
||||||
|
HeadersVisibility ="Column" Margin="0,0,0,40" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" CanUserReorderColumns="False"
|
||||||
|
CanUserSortColumns="False" Background="White" SelectionMode="Single">
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||||
|
<Setter Property="Background" Value="#FFF5F5F5" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="False">
|
||||||
|
</Trigger>
|
||||||
|
</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="#000000"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!--列信息绑定-->
|
||||||
|
<DataGridTextColumn Header="订单号" Binding="{Binding OrdeNO}" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="工艺名称" Binding="{Binding ProcessNAME}" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="工艺代码" Binding="{Binding ProcessCODE}" Width="0" FontSize="15" MaxWidth="400" MinWidth="0" CanUserReorder="False" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="品名" Binding="{Binding colour}" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="客户" Binding="{Binding customer}" Width="200" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="下单时间" Binding="{Binding OrdeTime}" Width="200" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="备注" Binding="{Binding REMARK}" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False" IsReadOnly="True"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<ComboBox x:Name="condition" HorizontalAlignment="Left" Height="30" Width="100" VerticalAlignment="Bottom" FontSize="20" Margin="5,0,0,5"/>
|
||||||
|
<TextBox x:Name="search" HorizontalAlignment="Left" Height="30" Margin="110,0,0,5" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="200" FontSize="20"/>
|
||||||
|
<Button Content="搜索" Click="Button_search" Height="30" Margin="315,0,0,5" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="50" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace formula_manage.View
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ViewProcess.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ViewOrder : UserControl
|
||||||
|
{
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
|
||||||
|
string TEXT_SQLIP;
|
||||||
|
string TEXT_SQLNAME;
|
||||||
|
string TEXT_SQMOD;
|
||||||
|
string TEXT_SQLUSER;
|
||||||
|
string TEXT_SQLPASWOR;
|
||||||
|
string Connstr_SC;
|
||||||
|
|
||||||
|
DataTable dataTable = new DataTable(); //建立缓存
|
||||||
|
|
||||||
|
public ViewOrder()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
condition.Items.Add("");
|
||||||
|
condition.Items.Add("工艺");
|
||||||
|
condition.Items.Add("客户");
|
||||||
|
condition.Items.Add("品名");
|
||||||
|
|
||||||
|
sql_();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void sql_()
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
|
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
|
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
|
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
if (TEXT_SQMOD == "0") //判断连接方式
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
|
}
|
||||||
|
string order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] order by OrdeTime desc";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter Stuff_data = new SqlDataAdapter(order_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
dataTable.Clear();
|
||||||
|
Stuff_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
Order.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
//Order.DisplayMemberPath = "Name";
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_search(object sender, RoutedEventArgs e)//搜索按钮
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
string order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] order by OrdeTime desc";//查询语句
|
||||||
|
|
||||||
|
a = condition.SelectedIndex; //获取选择条件
|
||||||
|
|
||||||
|
if (a == 1) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where ProcessNAME = '" + search.Text + "' order by OrdeTime desc";//查询语句
|
||||||
|
else if (a == 2) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where customer = '" + search.Text + "' order by OrdeTime desc";//查询语句
|
||||||
|
else if (a == 3) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where colour = '" + search.Text + "' order by OrdeTime desc";//查询语句
|
||||||
|
else if (a == 0) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] order by OrdeTime desc";//查询语句
|
||||||
|
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter Stuff_data = new SqlDataAdapter(order_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
dataTable.Clear();
|
||||||
|
Stuff_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
Order.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
//Order.DisplayMemberPath = "Name";
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public delegate void SendMessage(string[] value);
|
||||||
|
public SendMessage sendMessage;
|
||||||
|
|
||||||
|
string[] OrderData = new string[7];
|
||||||
|
private void DataGridOrder_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
|
{
|
||||||
|
int rownum = Order.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
|
OrderData[0] = (Order.Columns[0].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[1] = (Order.Columns[1].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[2] = (Order.Columns[2].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[3] = (Order.Columns[3].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[4] = (Order.Columns[4].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[5] = (Order.Columns[5].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[6] = (Order.Columns[6].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
|
||||||
|
sendMessage(OrderData); //传入数组
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="150" d:DesignWidth="405">
|
d:DesignHeight="150" d:DesignWidth="405">
|
||||||
<Grid>
|
<Grid>
|
||||||
<DataGrid x:Name="edit" AlternationCount="2" IsReadOnly="False"
|
<DataGrid x:Name="Technology" AlternationCount="2" IsReadOnly="True" MouseDoubleClick="DataGrid_Technology"
|
||||||
Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=30}" AutoGenerateColumns="False" MinColumnWidth="30"
|
HeadersVisibility ="Column" Margin="0,0,0,0" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" CanUserReorderColumns="False"
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" CanUserReorderColumns="False"
|
||||||
CanUserSortColumns="False"
|
CanUserSortColumns="False"
|
||||||
@@ -42,13 +42,12 @@
|
|||||||
</DataGrid.CellStyle>
|
</DataGrid.CellStyle>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<!--列信息绑定-->
|
<!--列信息绑定-->
|
||||||
<DataGridTextColumn Header="工艺代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTextColumn Binding="{Binding PROC_CODE}" Header="工艺代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="工艺名称" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTextColumn Binding="{Binding PROC_NAME}" Header="工艺名称" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="步数" Width="50" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTextColumn Binding="{Binding PROC_STEP}" Header="步数" Width="50" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="布种" Width="100" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False"/>
|
<DataGridTextColumn Binding="{Binding PROC_FABRIC}" Header="布种" Width="100" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="品名" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTextColumn Binding="{Binding PROC_PRODUCT}" Header="品名" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="客户" Width="200" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False"/>
|
<DataGridTextColumn Binding="{Binding REMARK}" Header="备注" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="备注" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False"/>
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
+75
-11
@@ -1,17 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Data.SqlClient;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace formula_manage.View
|
namespace formula_manage.View
|
||||||
{
|
{
|
||||||
@@ -20,9 +11,82 @@ namespace formula_manage.View
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ViewProcess : UserControl
|
public partial class ViewProcess : UserControl
|
||||||
{
|
{
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
|
||||||
|
string TEXT_SQLIP;
|
||||||
|
string TEXT_SQLNAME;
|
||||||
|
string TEXT_SQMOD;
|
||||||
|
string TEXT_SQLUSER;
|
||||||
|
string TEXT_SQLPASWOR;
|
||||||
|
string Connstr_SC;
|
||||||
|
|
||||||
|
DataTable dataTable = new DataTable(); //建立缓存
|
||||||
|
|
||||||
public ViewProcess()
|
public ViewProcess()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
sql_();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void sql_()
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
|
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
|
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
|
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
if (TEXT_SQMOD == "0") //判断连接方式
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
|
}
|
||||||
|
string order_sql = "SELECT PROC_CODE,PROC_NAME,PROC_TEST,PROC_STEP,MODIFY_TIME,PROC_FABRIC,PROC_PRODUCT,REMARK FROM [Dispensing].[dbo].[PROCEDUR_TITLE]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter Stuff_data = new SqlDataAdapter(order_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
dataTable.Clear();
|
||||||
|
Stuff_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
Technology.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
//Order.DisplayMemberPath = "Name";
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public delegate void SendMessage(string[] value);
|
||||||
|
public SendMessage sendMessage;
|
||||||
|
|
||||||
|
string[] OrderData = new string[6];
|
||||||
|
|
||||||
|
private void DataGrid_Technology(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
|
{
|
||||||
|
int rownum = Technology.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
|
OrderData[0] = (Technology.Columns[0].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[1] = (Technology.Columns[1].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[2] = (Technology.Columns[2].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[3] = (Technology.Columns[3].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[4] = (Technology.Columns[4].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
OrderData[5] = (Technology.Columns[5].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
|
||||||
|
sendMessage(OrderData); //传入数组
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace formula_manage.ViewModel
|
||||||
|
{
|
||||||
|
public class ExchangeViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
public ExchangeViewModel()
|
||||||
|
{
|
||||||
|
CountDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CountDown()
|
||||||
|
{
|
||||||
|
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromSeconds(0.5)
|
||||||
|
};
|
||||||
|
timer.Tick += Tick_Event;
|
||||||
|
timer.Start();
|
||||||
|
|
||||||
|
//设置定时器
|
||||||
|
// disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
|
||||||
|
// disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
|
||||||
|
// disTimer.Start();//计时开始
|
||||||
|
}
|
||||||
|
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,22 +1,11 @@
|
|||||||
using formula_manage.SQLModels;
|
using formula_manage.UserClass;
|
||||||
using formula_manage.ViewModel;
|
|
||||||
using formula_manage.Windows;
|
|
||||||
using GalaSoft.MvvmLight;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace formula_manage.ViewModel
|
namespace formula_manage.ViewModel
|
||||||
{
|
{
|
||||||
@@ -41,26 +30,105 @@ namespace formula_manage.ViewModel
|
|||||||
DataTable DissolvedataTable = new DataTable(); //建立Dissolve
|
DataTable DissolvedataTable = new DataTable(); //建立Dissolve
|
||||||
DataTable STUFFdataTable = new DataTable(); //建立STUFF
|
DataTable STUFFdataTable = new DataTable(); //建立STUFF
|
||||||
DataTable MACHINEdataTable = new DataTable(); //建立Machine
|
DataTable MACHINEdataTable = new DataTable(); //建立Machine
|
||||||
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT
|
// DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT
|
||||||
DataTable RecipedataTable = new DataTable(); //建立Recipe
|
// DataTable RecipedataTable = new DataTable(); //建立Recipe
|
||||||
|
|
||||||
public static DataTable STUFFdatatemp = new DataTable(); //建立STUFF缓存
|
public static DataTable STUFFdatatemp = new DataTable(); //建立STUFF缓存
|
||||||
public static DataTable MACHINEdatatemp = new DataTable(); //建立Machine缓存
|
public static DataTable MACHINEdatatemp = new DataTable(); //建立Machine缓存
|
||||||
|
|
||||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
public string sys_Time; //显示系统时间
|
public string sys_Time; //显示系统时间
|
||||||
|
public string cdk_time; //注册到期时间
|
||||||
|
public string cdk_page = "Hidden"; //注册到期页面状态
|
||||||
|
public string cdk_pageT; //注册到期页面关闭时间
|
||||||
|
int cdk_pageT_T = -1;////注册到期页面关闭时间计算
|
||||||
|
|
||||||
public string Sys_Time //通知UI控件参数改变
|
public string Sys_Time //通知UI控件参数改变
|
||||||
{
|
{
|
||||||
get { return sys_Time; }
|
get { return sys_Time; }
|
||||||
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
|
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Cdk_time //通知UI控件参数改变
|
||||||
|
{
|
||||||
|
get { return cdk_time; }
|
||||||
|
set { cdk_time = value; OnPropertyChanged("Cdk_time"); }
|
||||||
|
}
|
||||||
|
public string Cdk_page //通知UI控件参数改变
|
||||||
|
{
|
||||||
|
get { return cdk_page; }
|
||||||
|
set { cdk_page = value; OnPropertyChanged("Cdk_page"); }
|
||||||
|
}
|
||||||
|
public string Cdk_pageT //通知UI控件参数改变
|
||||||
|
{
|
||||||
|
get { return cdk_pageT; }
|
||||||
|
set { cdk_pageT = value; OnPropertyChanged("Cdk_pageT"); }
|
||||||
|
}
|
||||||
|
|
||||||
string TEXT_SQLIP;
|
string TEXT_SQLIP;
|
||||||
string TEXT_SQLNAME;
|
string TEXT_SQLNAME;
|
||||||
string TEXT_SQMOD;
|
string TEXT_SQMOD;
|
||||||
string TEXT_SQLUSER;
|
string TEXT_SQLUSER;
|
||||||
string TEXT_SQLPASWOR;
|
string TEXT_SQLPASWOR;
|
||||||
string Connstr_SC;
|
string Connstr_SC;
|
||||||
|
string SN_ID;
|
||||||
|
string SN_KEY;
|
||||||
|
|
||||||
|
private void CDkey_()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string id_1 = SN_ID.Substring(5, 1) + SN_ID.Substring(0, 1) + SN_ID.Substring(4, 1) + SN_ID.Substring(1, 1) + SN_ID.Substring(3, 1) + SN_ID.Substring(2, 1);
|
||||||
|
if ((id_1 == SN_KEY.Substring(0, 6)) && (SN_KEY.Length == 16))
|
||||||
|
{
|
||||||
|
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(SN_KEY.Substring(0, 12)), true) == SN_KEY.Substring(12, 4)) //校验key的crc校验值
|
||||||
|
{
|
||||||
|
string Y = (2255 - StrToInt.To16Convert10(SN_KEY.Substring(6, 2))).ToString();
|
||||||
|
string M = (255 - StrToInt.To16Convert10(SN_KEY.Substring(8, 2))).ToString();
|
||||||
|
string D = (255 - StrToInt.To16Convert10(SN_KEY.Substring(10, 2))).ToString();
|
||||||
|
|
||||||
|
string YY = DateTime.Now.ToString("yyyy");
|
||||||
|
string MM = DateTime.Now.ToString("MM");
|
||||||
|
string DD = DateTime.Now.ToString("dd");
|
||||||
|
|
||||||
|
Cdk_time = "注册到期时间: " + Y + "/" + M + "/" + D;
|
||||||
|
|
||||||
|
if (string.Compare(Y, YY) < 0)
|
||||||
|
{
|
||||||
|
if (string.Compare(M, MM) < 0)
|
||||||
|
{
|
||||||
|
if (string.Compare(D, DD) < 0)
|
||||||
|
{
|
||||||
|
Cdk_page = "Visible";
|
||||||
|
//cdk_pageT_T = -1; //防止触发倒计时
|
||||||
|
}
|
||||||
|
else if ((int.Parse(D) - int.Parse(DD)) <= 10)//提前三天提醒
|
||||||
|
{
|
||||||
|
Cdk_page = "Visible";
|
||||||
|
cdk_pageT_T = 180; //页面关闭倒计时30秒
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Cdk_page = "Visible";
|
||||||
|
Cdk_time = "许可证安全校验错误请重新激活";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
|
||||||
|
{
|
||||||
|
Cdk_page = "Visible";
|
||||||
|
Cdk_time = "计算机信息变更当前许可证失效";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Cdk_page = "Visible";
|
||||||
|
Cdk_time = "许可证安全校验错误请重新激活";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void Sql_()
|
private async void Sql_()
|
||||||
{
|
{
|
||||||
@@ -70,6 +138,9 @@ namespace formula_manage.ViewModel
|
|||||||
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
SN_ID = Configini.IniReadvalue("SN", "SN2");
|
||||||
|
SN_KEY = Configini.IniReadvalue("SN", "SN1");
|
||||||
|
|
||||||
if (TEXT_SQMOD == "0") //判断连接方式
|
if (TEXT_SQMOD == "0") //判断连接方式
|
||||||
{
|
{
|
||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
@@ -79,9 +150,9 @@ namespace formula_manage.ViewModel
|
|||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Stuff_sql = "SELECT ProductCode ,ProductName ,ProductType ,Concentration FROM [Dispensing].[dbo].[PRODUCT] order by ProductCode asc";//查询STUFF语句
|
string Stuff_sql = "SELECT ProductCode ,ProductName ,ProductType ,Concentration FROM [dbo].[PRODUCT] order by ProductCode asc";//查询STUFF语句
|
||||||
string MAC_sql = "SELECT Name ,Capacity ,Volume FROM [Dispensing].[dbo].[MACHINE] order by Name asc";//查询machine语句
|
string MAC_sql = "SELECT Name ,Capacity ,Volume FROM [dbo].[MACHINE] order by Name asc";//查询machine语句
|
||||||
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,MaterialType ,WeightMIN ,WeightMAX REMARK FROM [Dispensing].[dbo].[Dissolve]";//查询语句
|
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,MaterialType ,WeightMIN ,WeightMAX REMARK FROM [dbo].[Dissolve]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
try
|
try
|
||||||
@@ -99,7 +170,8 @@ namespace formula_manage.ViewModel
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show("请求原料信息失败,检查连接");
|
System.Windows.MessageBox.Show("请求信息失败");
|
||||||
|
UserClass.LogGing.LogGingDATA("DISPENLINK = ConnectFailed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,6 +181,8 @@ namespace formula_manage.ViewModel
|
|||||||
CountDown();
|
CountDown();
|
||||||
Sql_();
|
Sql_();
|
||||||
|
|
||||||
|
CDkey_();
|
||||||
|
|
||||||
stuff_Product = ToObservableCollection<Product>(STUFFdataTable); //stuff_Product表转换
|
stuff_Product = ToObservableCollection<Product>(STUFFdataTable); //stuff_Product表转换
|
||||||
mac_Machine = ToObservableCollection<Machine>(MACHINEdataTable);
|
mac_Machine = ToObservableCollection<Machine>(MACHINEdataTable);
|
||||||
flow_Workflow = ToObservableCollection<Workflow>(DissolvedataTable);
|
flow_Workflow = ToObservableCollection<Workflow>(DissolvedataTable);
|
||||||
@@ -168,26 +242,45 @@ namespace formula_manage.ViewModel
|
|||||||
}
|
}
|
||||||
return lst;
|
return lst;
|
||||||
} //DataTable FOR ObservableCollection转换器
|
} //DataTable FOR ObservableCollection转换器
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 循环事件设定
|
/// 循环事件设定
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CountDown()
|
public void CountDown()
|
||||||
{
|
{
|
||||||
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
|
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick
|
||||||
{
|
{
|
||||||
Interval = TimeSpan.FromSeconds(0.5)
|
Interval = TimeSpan.FromSeconds(1)
|
||||||
};
|
};
|
||||||
timer.Tick += Tick_Event;
|
timer1s.Tick += Tick_Event_1S;
|
||||||
timer.Start();
|
timer1s.Start();
|
||||||
|
|
||||||
|
DispatcherTimer timer1h = new DispatcherTimer//初始化循环,每1h调用一次Tick
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromSeconds(3600)
|
||||||
|
};
|
||||||
|
timer1h.Tick += Tick_Event_1h;
|
||||||
|
timer1h.Start();
|
||||||
//设置定时器
|
//设置定时器
|
||||||
// disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
|
// disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
|
||||||
// disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
|
// disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
|
||||||
// disTimer.Start();//计时开始
|
// disTimer.Start();//计时开始
|
||||||
}
|
}
|
||||||
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||||
{
|
{
|
||||||
Sys_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
Sys_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
if (cdk_pageT_T > 0) //提示注册画面关闭倒计时
|
||||||
|
{
|
||||||
|
cdk_pageT_T--;
|
||||||
|
Cdk_pageT = cdk_pageT_T.ToString();
|
||||||
|
if (cdk_pageT_T == 1) Cdk_page = "Hidden";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
void Tick_Event_1h(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||||
|
{
|
||||||
|
CDkey_();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,217 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace formula_manage.ViewModel
|
||||||
|
{
|
||||||
|
|
||||||
|
/* public class ViewModelBase : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
if (this.PropertyChanged != null)
|
||||||
|
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
///<Summary>
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///</Summary>
|
||||||
|
///
|
||||||
|
public class RECIPEViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
DataTable DissolvedataTable = new DataTable(); //建立Dissolve
|
||||||
|
DataTable STUFFdataTable = new DataTable(); //建立STUFF
|
||||||
|
DataTable MACHINEdataTable = new DataTable(); //建立Machine
|
||||||
|
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT
|
||||||
|
DataTable RecipedataTable = new DataTable(); //建立Recipe
|
||||||
|
|
||||||
|
public static DataTable STUFFdatatemp = new DataTable(); //建立STUFF缓存
|
||||||
|
public static DataTable MACHINEdatatemp = new DataTable(); //建立Machine缓存
|
||||||
|
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
public string sys_Time; //显示系统时间
|
||||||
|
public string Sys_Time //通知UI控件参数改变
|
||||||
|
{
|
||||||
|
get { return sys_Time; }
|
||||||
|
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
string TEXT_SQLIP;
|
||||||
|
string TEXT_SQLNAME;
|
||||||
|
string TEXT_SQMOD;
|
||||||
|
string TEXT_SQLUSER;
|
||||||
|
string TEXT_SQLPASWOR;
|
||||||
|
string Connstr_SC;
|
||||||
|
|
||||||
|
private async void Sql_()
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
|
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
|
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
|
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
if (TEXT_SQMOD == "0") //判断连接方式
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
string Stuff_sql = "SELECT ProductCode ,ProductName ,ProductType ,Concentration FROM [Dispensing].[dbo].[PRODUCT] order by ProductCode asc";//查询STUFF语句
|
||||||
|
string MAC_sql = "SELECT Name ,Capacity ,Volume FROM [Dispensing].[dbo].[MACHINE] order by Name asc";//查询machine语句
|
||||||
|
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,MaterialType ,WeightMIN ,WeightMAX REMARK FROM [Dispensing].[dbo].[Dissolve]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter Stuff_data = new SqlDataAdapter(Stuff_sql, Connstr_SC); //查询stuff
|
||||||
|
SqlDataAdapter Mac_data = new SqlDataAdapter(MAC_sql, Connstr_SC); //查询machine
|
||||||
|
SqlDataAdapter Dissolve_data = new SqlDataAdapter(Dissolve_sql, Connstr_SC); //查询Dissolve
|
||||||
|
|
||||||
|
Stuff_data.Fill(STUFFdataTable); //stuff查询结果存入缓存
|
||||||
|
Mac_data.Fill(MACHINEdataTable); //machine查询结果存入缓存
|
||||||
|
Dissolve_data.Fill(DissolvedataTable); //Dissolve_data查询结果存入缓存
|
||||||
|
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求原料信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RECIPEViewModel()
|
||||||
|
{
|
||||||
|
CountDown();
|
||||||
|
Sql_();
|
||||||
|
|
||||||
|
stuff_Product = ToObservableCollection<Product>(STUFFdataTable); //stuff_Product表转换
|
||||||
|
mac_Machine = ToObservableCollection<Machine>(MACHINEdataTable);
|
||||||
|
flow_Workflow = ToObservableCollection<Workflow>(DissolvedataTable);
|
||||||
|
|
||||||
|
STUFFdatatemp = STUFFdataTable;
|
||||||
|
MACHINEdatatemp = MACHINEdataTable;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<Product> stuff_Product { get; set; } //stuff_Product动态表实力化
|
||||||
|
public ObservableCollection<Machine> mac_Machine { get; set; } //mac_Machine动态表实力化
|
||||||
|
public ObservableCollection<Workflow> flow_Workflow { get; set; } //Dissolve动态表实力化
|
||||||
|
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new() //DataTable FOR ObservableCollection转换器
|
||||||
|
{
|
||||||
|
Type t = typeof(T);
|
||||||
|
PropertyInfo[] propertys = t.GetProperties();
|
||||||
|
ObservableCollection<T> lst = new ObservableCollection<T>();
|
||||||
|
string typeName = string.Empty;
|
||||||
|
foreach (DataRow dr in dt.Rows)
|
||||||
|
{
|
||||||
|
T entity = new T();
|
||||||
|
foreach (PropertyInfo pi in propertys)
|
||||||
|
{
|
||||||
|
typeName = pi.Name;
|
||||||
|
if (dt.Columns.Contains(typeName))
|
||||||
|
{
|
||||||
|
if (!pi.CanWrite) continue;
|
||||||
|
object value = dr[typeName];
|
||||||
|
if (value == DBNull.Value) continue;
|
||||||
|
if (pi.PropertyType == typeof(string))
|
||||||
|
{
|
||||||
|
pi.SetValue(entity, value.ToString(), null);
|
||||||
|
}
|
||||||
|
else if (pi.PropertyType == typeof(int) || pi.PropertyType == typeof(int?))
|
||||||
|
{
|
||||||
|
pi.SetValue(entity, int.Parse(value.ToString()), null);
|
||||||
|
}
|
||||||
|
else if (pi.PropertyType == typeof(DateTime?) || pi.PropertyType == typeof(DateTime))
|
||||||
|
{
|
||||||
|
pi.SetValue(entity, DateTime.Parse(value.ToString()), null);
|
||||||
|
}
|
||||||
|
else if (pi.PropertyType == typeof(float))
|
||||||
|
{
|
||||||
|
pi.SetValue(entity, float.Parse(value.ToString()), null);
|
||||||
|
}
|
||||||
|
else if (pi.PropertyType == typeof(double))
|
||||||
|
{
|
||||||
|
pi.SetValue(entity, double.Parse(value.ToString()), null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pi.SetValue(entity, value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lst.Add(entity);
|
||||||
|
}
|
||||||
|
return lst;
|
||||||
|
} //DataTable FOR ObservableCollection转换器
|
||||||
|
/// <summary>
|
||||||
|
/// 循环事件设定
|
||||||
|
/// </summary>
|
||||||
|
public void CountDown()
|
||||||
|
{
|
||||||
|
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromSeconds(0.5)
|
||||||
|
};
|
||||||
|
timer.Tick += Tick_Event;
|
||||||
|
timer.Start();
|
||||||
|
|
||||||
|
//设置定时器
|
||||||
|
// disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
|
||||||
|
// disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
|
||||||
|
// disTimer.Start();//计时开始
|
||||||
|
}
|
||||||
|
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||||
|
{
|
||||||
|
Sys_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public class Product //stuff_Product
|
||||||
|
{
|
||||||
|
public string ProductCode { get; set; }
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
public int ProductType { get; set; }
|
||||||
|
public int Concentration { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return ProductCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Machine //mac
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public float Volume { get; set; }
|
||||||
|
public float Capacity { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Workflow //Dissolve
|
||||||
|
{
|
||||||
|
public string DissolveName { get; set; }
|
||||||
|
public int MaterialType { get; set; }
|
||||||
|
public int WeightMIN { get; set; }
|
||||||
|
public int WeightMAX { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return DissolveName;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
using CommonServiceLocator;
|
using CommonServiceLocator;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using GalaSoft.MvvmLight;
|
|
||||||
using GalaSoft.MvvmLight.Ioc;
|
using GalaSoft.MvvmLight.Ioc;
|
||||||
|
|
||||||
namespace formula_manage.ViewModel
|
namespace formula_manage.ViewModel
|
||||||
@@ -27,6 +21,8 @@ namespace formula_manage.ViewModel
|
|||||||
////}
|
////}
|
||||||
|
|
||||||
SimpleIoc.Default.Register<MainWindowViewModel>();
|
SimpleIoc.Default.Register<MainWindowViewModel>();
|
||||||
|
SimpleIoc.Default.Register<RECIPEViewModel>();
|
||||||
|
SimpleIoc.Default.Register<ExchangeViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainWindowViewModel Main
|
public MainWindowViewModel Main
|
||||||
@@ -37,6 +33,21 @@ namespace formula_manage.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RECIPEViewModel Recipev
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ServiceLocator.Current.GetInstance<RECIPEViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ExchangeViewModel Exchange
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ServiceLocator.Current.GetInstance<ExchangeViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+13
-4
@@ -8,12 +8,21 @@
|
|||||||
Title="APP_set" Height="450" Width="800" MaxHeight="450" MaxWidth="800" ResizeMode="NoResize">
|
Title="APP_set" Height="450" Width="800" MaxHeight="450" MaxWidth="800" ResizeMode="NoResize">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|
||||||
<CheckBox x:Name="Login_LINK" Height="19" Margin="15,15,605,0" VerticalAlignment="Top" Content="登录页面显示连接状态" IsTabStop="False" Checked="Login_LINK_Checked" Unchecked="Login_LINK_Checked"/>
|
<CheckBox x:Name="Login_LINK" HorizontalAlignment="Left" Height="19" Margin="15,15,0,0" VerticalAlignment="Top" Width="150" Content="登录页面显示连接状态" IsTabStop="False" Checked="Login_LINK_Checked" Unchecked="Login_LINK_Checked"/>
|
||||||
<CheckBox x:Name="Login_PRINT" Height="19" Margin="15,35,605,0" VerticalAlignment="Top" Content="确认立即打印料单" IsTabStop="False" Checked="Login_PRINT_Checked" Unchecked="Login_PRINT_Checked"/>
|
<CheckBox x:Name="EXLINK" HorizontalAlignment="Left" Height="19" Margin="15,35,0,0" VerticalAlignment="Top" Width="150" Content="启用外挂程序" IsTabStop="False" Checked="Login_ex_Checked" Unchecked="Login_ex_Checked"/>
|
||||||
<CheckBox x:Name="Login_MACHINE" Height="19" Margin="15,55,605,0" VerticalAlignment="Top" Content="允许输入机台号" IsTabStop="False" Checked="Login_MAC_Checked" Unchecked="Login_MAC_Checked"/>
|
<CheckBox x:Name="Login_PRINT" HorizontalAlignment="Left" Height="19" Margin="15,55,0,0" VerticalAlignment="Top" Width="150" Content="确认立即打印料单" IsTabStop="False" Checked="Login_PRINT_Checked" Unchecked="Login_PRINT_Checked"/>
|
||||||
<CheckBox x:Name="Login_anew" Height="19" Margin="15,75,605,0" VerticalAlignment="Top" Content="单号相同时重染号修改" IsTabStop="False" Checked="Login_anew_Checked" Unchecked="Login_anew_Checked"/>
|
<CheckBox x:Name="Login_MACHINE" HorizontalAlignment="Left" Height="19" Margin="15,75,0,0" VerticalAlignment="Top" Width="150" Content="允许输入机台号" IsTabStop="False" Checked="Login_MAC_Checked" Unchecked="Login_MAC_Checked"/>
|
||||||
|
<CheckBox x:Name="Login_anew" HorizontalAlignment="Left" Height="19" Margin="15,95,0,0" VerticalAlignment="Top" Width="150" Content="单号相同时重染号修改" IsTabStop="False" Checked="Login_anew_Checked" Unchecked="Login_anew_Checked"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="19" Margin="245,15,0,0" TextWrapping="Wrap" Text="显示单位" VerticalAlignment="Top" Width="55"/>
|
||||||
|
<ComboBox x:Name="Login_Gkg" HorizontalAlignment="Left" Height="19" Margin="300,15,0,0" VerticalAlignment="Top" Width="100">
|
||||||
|
<ComboBoxItem Content="AUTO" FontSize="10"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="G" FontSize="10"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="KG" FontSize="10"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="KG/L" FontSize="10"></ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<TextBlock HorizontalAlignment="Left" Height="20" Margin="10,220,0,0" TextWrapping="Wrap" Text="前缀名称" VerticalAlignment="Top" Width="75" FontSize="14"/>
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="10,220,0,0" TextWrapping="Wrap" Text="前缀名称" VerticalAlignment="Top" Width="75" FontSize="14"/>
|
||||||
<TextBox x:Name="Prepose" HorizontalAlignment="Left" Height="20" Margin="85,220,0,0" TextWrapping="Wrap" Text="D" VerticalAlignment="Top" Width="125"/>
|
<TextBox x:Name="Prepose" HorizontalAlignment="Left" Height="20" Margin="85,220,0,0" TextWrapping="Wrap" Text="D" VerticalAlignment="Top" Width="125"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="20" Margin="10,250,0,0" TextWrapping="Wrap" Text="日期格式" VerticalAlignment="Top" Width="75" FontSize="14"/>
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="10,250,0,0" TextWrapping="Wrap" Text="日期格式" VerticalAlignment="Top" Width="75" FontSize="14"/>
|
||||||
|
|||||||
+11
-13
@@ -1,17 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace formula_manage.Windows
|
namespace formula_manage.Windows
|
||||||
{
|
{
|
||||||
@@ -40,7 +29,8 @@ namespace formula_manage.Windows
|
|||||||
Configini.IniWritevalue("SOFTWARE_SET", " L2", Loginprint.ToString());
|
Configini.IniWritevalue("SOFTWARE_SET", " L2", Loginprint.ToString());
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " L3", Loginanew.ToString());
|
Configini.IniWritevalue("SOFTWARE_SET", " L3", Loginanew.ToString());
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " L4", LoginMAC.ToString());
|
Configini.IniWritevalue("SOFTWARE_SET", " L4", LoginMAC.ToString());
|
||||||
|
Configini.IniWritevalue("SOFTWARE_SET", " L5", Login_Gkg.Text);
|
||||||
|
Configini.IniWritevalue("SOFTWARE_SET", " L6", EXlink.ToString());
|
||||||
|
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " T1", Prepose.Text);
|
Configini.IniWritevalue("SOFTWARE_SET", " T1", Prepose.Text);
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " T2", TimeFormat.Text);
|
Configini.IniWritevalue("SOFTWARE_SET", " T2", TimeFormat.Text);
|
||||||
@@ -59,15 +49,18 @@ namespace formula_manage.Windows
|
|||||||
bool Loginprint;
|
bool Loginprint;
|
||||||
bool Loginanew;
|
bool Loginanew;
|
||||||
bool LoginMAC;
|
bool LoginMAC;
|
||||||
|
bool EXlink;
|
||||||
private void Window_SET(object sender, RoutedEventArgs e)
|
private void Window_SET(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||||
|
|
||||||
Login_LINK.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L1")); //连接状态显示是否生效
|
Login_LINK.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L1")); //连接状态显示是否生效
|
||||||
Login_PRINT.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L2")); //是否立即打印料单
|
Login_PRINT.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L2")); //是否立即打印料单
|
||||||
Login_anew.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L3")); //是否立即打印料单
|
Login_anew.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L3")); //是否立即打印料单
|
||||||
Login_MACHINE.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L4")); //允许自定义机台
|
Login_MACHINE.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L4")); //允许自定义机台
|
||||||
|
EXLINK.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")); //ex
|
||||||
|
|
||||||
|
Login_Gkg.Text = Configini.IniReadvalue("SOFTWARE_SET", "L5"); //单位识别
|
||||||
|
|
||||||
Prepose.Text = Configini.IniReadvalue("SOFTWARE_SET", "T1"); //自定义料单前缀
|
Prepose.Text = Configini.IniReadvalue("SOFTWARE_SET", "T1"); //自定义料单前缀
|
||||||
TimeFormat.Text = Configini.IniReadvalue("SOFTWARE_SET", "T2"); //自定义料单时间格式
|
TimeFormat.Text = Configini.IniReadvalue("SOFTWARE_SET", "T2"); //自定义料单时间格式
|
||||||
@@ -80,6 +73,11 @@ namespace formula_manage.Windows
|
|||||||
Loginlink = Login_LINK.IsChecked.GetValueOrDefault(); //显示是否生效
|
Loginlink = Login_LINK.IsChecked.GetValueOrDefault(); //显示是否生效
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Login_ex_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
EXlink = EXLINK.IsChecked.GetValueOrDefault(); //是否
|
||||||
|
}
|
||||||
|
|
||||||
private void Login_MAC_Checked(object sender, RoutedEventArgs e)
|
private void Login_MAC_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
LoginMAC = Login_MACHINE.IsChecked.GetValueOrDefault(); //是否
|
LoginMAC = Login_MACHINE.IsChecked.GetValueOrDefault(); //是否
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<Window x:Class="formula_manage.Windows.CDKEY"
|
||||||
|
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:formula_manage.Windows"
|
||||||
|
mc:Ignorable="d" Loaded="Window_CDKEY" BorderBrush="White" Background="#FFEFEFEF"
|
||||||
|
Title="CDKEY" Height="140" Width="500" MaxHeight="140" MaxWidth="500" ResizeMode="NoResize">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,35,0,0" TextWrapping="Wrap" Text="CDKEY:" VerticalAlignment="Top" Width="70" FontSize="16"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,10,0,0" TextWrapping="Wrap" Text="SN:" VerticalAlignment="Top" Width="70" FontSize="16"/>
|
||||||
|
<TextBox x:Name="sn_id" HorizontalAlignment="Left" Height="20" Margin="90,10,0,0" VerticalAlignment="Top" Width="360" Background="#FFE6E6E6" IsReadOnly="True" IsTabStop="False" Focusable="False"/>
|
||||||
|
<TextBox x:Name="cdk" HorizontalAlignment="Left" Height="20" Margin="90,35,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="360"/>
|
||||||
|
<Button Content="OK" HorizontalAlignment="Right" Height="20" Margin="0,60,50,0" VerticalAlignment="Top" Width="85" Background="#FFE6E6E6" Click="Button_Click_2"/>
|
||||||
|
<TextBox x:Name="sn_time" HorizontalAlignment="Left" Height="20" Margin="90,60,0,0" VerticalAlignment="Top" Width="250" Background="{x:Null}" IsReadOnly="True" IsTabStop="False" Focusable="False" BorderBrush="{x:Null}"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
using formula_manage.UserClass;
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
|
||||||
|
namespace formula_manage.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CDKEY.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class CDKEY : Window
|
||||||
|
{
|
||||||
|
public CDKEY()
|
||||||
|
{
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
string cpuSerialNumber;
|
||||||
|
string biosSerialNumber;
|
||||||
|
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
|
||||||
|
|
||||||
|
private void Window_CDKEY(object sender, RoutedEventArgs e) //打开页面
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
string cdk = Configini.IniReadvalue("SN", "SN1"); //读配置文件
|
||||||
|
|
||||||
|
if (cdk.Length == 16)
|
||||||
|
{
|
||||||
|
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(cdk.Substring(0, 12)), true) == cdk.Substring(12, 4)) //校验key的crc校验值
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string Y = (2255 - StrToInt.To16Convert10(cdk.Substring(6, 2))).ToString();
|
||||||
|
string M = (255 - StrToInt.To16Convert10(cdk.Substring(8, 2))).ToString();
|
||||||
|
string D = (255 - StrToInt.To16Convert10(cdk.Substring(10, 2))).ToString();
|
||||||
|
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
sn_time.Text = "注册有效时间: --------";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sn_time.Text = "注册有效时间: --------";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sn_time.Text = "注册有效时间: --------";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取CPU序列号
|
||||||
|
cpuSerialNumber = HardwareSN.GetCPUSerialNumber();
|
||||||
|
// 获取主板序列号
|
||||||
|
biosSerialNumber = HardwareSN.GetBIOSSerialNumber();
|
||||||
|
// 获取硬盘序列号
|
||||||
|
//string hardDiskSerialNumber = HardwareSN.GetHardDiskSerialNumber();
|
||||||
|
// 获取网卡地址
|
||||||
|
//string netCardMACAddress = HardwareSN.GetNetCardMACAddress();
|
||||||
|
sn_id.Text = MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber);//生成id基于硬件值的md5校验
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_2(object sender, RoutedEventArgs e) //cdk确认按钮
|
||||||
|
{
|
||||||
|
string id_1;
|
||||||
|
id_1 = sn_id.Text.Substring(5, 1) + sn_id.Text.Substring(0, 1) + sn_id.Text.Substring(4, 1) + sn_id.Text.Substring(1, 1) + sn_id.Text.Substring(3, 1) + sn_id.Text.Substring(2, 1);
|
||||||
|
|
||||||
|
if (cdk.Text.Length != 16)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id_1 == cdk.Text.Substring(0, 6))
|
||||||
|
{
|
||||||
|
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(cdk.Text.Substring(0, 12)), true) == cdk.Text.Substring(12, 4)) //校验key的crc校验值
|
||||||
|
{
|
||||||
|
string Y = (2255 - StrToInt.To16Convert10(cdk.Text.Substring(6, 2))).ToString();
|
||||||
|
string M = (255 - StrToInt.To16Convert10(cdk.Text.Substring(8, 2))).ToString();
|
||||||
|
string D = (255 - StrToInt.To16Convert10(cdk.Text.Substring(10, 2))).ToString();
|
||||||
|
|
||||||
|
string YY = DateTime.Now.ToString("yyyy");
|
||||||
|
string MM = DateTime.Now.ToString("MM");
|
||||||
|
string DD = DateTime.Now.ToString("dd");
|
||||||
|
|
||||||
|
if (string.Compare(Y, YY) == 0)
|
||||||
|
{
|
||||||
|
if (string.Compare(M, MM) == 0)
|
||||||
|
{
|
||||||
|
if (string.Compare(D, DD) >= 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("CDKEY: 注册成功,请重启软件", "KEY", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||||
|
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
|
||||||
|
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||||
|
Configini.IniWritevalue("SN", " SN1", cdk.Text);
|
||||||
|
Configini.IniWritevalue("SN", " SN2", MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber));
|
||||||
|
}
|
||||||
|
else if (string.Compare(M, MM) > 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("CDKEY: 注册成功,请重启软件", "KEY", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||||
|
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
|
||||||
|
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||||
|
Configini.IniWritevalue("SN", " SN1", cdk.Text);
|
||||||
|
Configini.IniWritevalue("SN", " SN2", MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (string.Compare(Y, YY) > 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("CDKEY: 注册成功,请重启软件", "KEY", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||||
|
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
|
||||||
|
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||||
|
Configini.IniWritevalue("SN", " SN1", cdk.Text);
|
||||||
|
Configini.IniWritevalue("SN", " SN2", MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-25
@@ -1,24 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Data.SqlClient;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using GalaSoft.MvvmLight;
|
|
||||||
using formula_manage.SQLModels;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Data;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
|
||||||
using Xceed.Wpf.AvalonDock.Themes;
|
|
||||||
|
|
||||||
namespace formula_manage.Windows
|
namespace formula_manage.Windows
|
||||||
{
|
{
|
||||||
@@ -76,7 +62,7 @@ namespace formula_manage.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async void GridSql()
|
private async void GridSql()
|
||||||
{
|
{
|
||||||
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [Dispensing].[dbo].[Dissolve]";//查询语句
|
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [dbo].[Dissolve]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
@@ -104,12 +90,12 @@ namespace formula_manage.Windows
|
|||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
/*定位选中行及指定列单元格文本信息*/
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
Code.Text = (DatagridDissolve.Columns[1].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
Code.Text = (DatagridDissolve.Columns[1].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第列
|
||||||
name.Text = (DatagridDissolve.Columns[2].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
name.Text = (DatagridDissolve.Columns[2].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
ion.Text = (DatagridDissolve.Columns[3].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
ion.Text = (DatagridDissolve.Columns[3].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
min.Text = (DatagridDissolve.Columns[4].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
min.Text = (DatagridDissolve.Columns[4].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
max.Text = (DatagridDissolve.Columns[5].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
max.Text = (DatagridDissolve.Columns[5].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
Remark.Text = (DatagridDissolve.Columns[6].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
Remark.Text = (DatagridDissolve.Columns[6].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +150,7 @@ namespace formula_manage.Windows
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
Dissolve_sql = "SELECT count(*) FROM [Dispensing].[dbo].[Dissolve] WHERE DissolveCode = '" + Code.Text + " '";//查询语句
|
Dissolve_sql = "SELECT count(*) FROM [dbo].[Dissolve] WHERE DissolveCode = '" + Code.Text + " '";//查询语句
|
||||||
await conn_SC.OpenAsync(); //打开数据连
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
SqlCommand cmd = new SqlCommand(Dissolve_sql, conn_SC); //查询记录数
|
SqlCommand cmd = new SqlCommand(Dissolve_sql, conn_SC); //查询记录数
|
||||||
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
@@ -172,7 +158,7 @@ namespace formula_manage.Windows
|
|||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
Dissolve_sql = string.Format("INSERT INTO[Dispensing].[dbo].[Dissolve](DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX) " +
|
Dissolve_sql = string.Format("INSERT INTO[dbo].[Dissolve](DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX) " +
|
||||||
"VALUES ('" + Code.Text + "','" + name.Text + "','" + Remark.Text + "','" + int_ion + "','" + min.Text + "','" + max.Text + "')");
|
"VALUES ('" + Code.Text + "','" + name.Text + "','" + Remark.Text + "','" + int_ion + "','" + min.Text + "','" + max.Text + "')");
|
||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC);
|
||||||
|
|||||||
+13
-27
@@ -1,24 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Data.SqlClient;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using GalaSoft.MvvmLight;
|
|
||||||
using formula_manage.SQLModels;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Data;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
|
||||||
using Xceed.Wpf.AvalonDock.Themes;
|
|
||||||
|
|
||||||
namespace formula_manage.Windows
|
namespace formula_manage.Windows
|
||||||
{
|
{
|
||||||
@@ -60,7 +46,7 @@ namespace formula_manage.Windows
|
|||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [Dispensing].[dbo].[MACHINE]";//查询语句
|
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [dbo].[MACHINE]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
try
|
try
|
||||||
@@ -95,7 +81,7 @@ namespace formula_manage.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async void GridSql()
|
private async void GridSql()
|
||||||
{
|
{
|
||||||
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [Dispensing].[dbo].[MACHINE]";//查询语句
|
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [dbo].[MACHINE]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
@@ -130,13 +116,13 @@ namespace formula_manage.Windows
|
|||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
/*定位选中行及指定列单元格文本信息*/
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
mac_Name.Text = (DataGridMac.Columns[1].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
mac_Name.Text = (DataGridMac.Columns[1].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第列
|
||||||
mac_MacGroup.Text = (DataGridMac.Columns[2].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
|
mac_MacGroup.Text = (DataGridMac.Columns[2].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
mac_Capacity.Text = (DataGridMac.Columns[3].GetCellContent(DataGridMac .Items[rownum]) as TextBlock).Text.Trim();//
|
mac_Capacity.Text = (DataGridMac.Columns[3].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
mac_Volume.Text = (DataGridMac.Columns[4].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
|
mac_Volume.Text = (DataGridMac.Columns[4].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
mac_Industry.Text = (DataGridMac.Columns[5].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
|
mac_Industry.Text = (DataGridMac.Columns[5].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
mac_Categories.Text = (DataGridMac.Columns[6].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
|
mac_Categories.Text = (DataGridMac.Columns[6].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
mac_Note.Text = (DataGridMac.Columns[7].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
|
mac_Note.Text = (DataGridMac.Columns[7].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +161,7 @@ namespace formula_manage.Windows
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
MAC_sql = "SELECT count(*) FROM [Dispensing].[dbo].[MACHINE] WHERE Name = '" + Mac_name + " '";//查询语句
|
MAC_sql = "SELECT count(*) FROM [dbo].[MACHINE] WHERE Name = '" + Mac_name + " '";//查询语句
|
||||||
await conn_SC.OpenAsync(); //打开数据连
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
SqlCommand cmd = new SqlCommand(MAC_sql, conn_SC); //查询记录数
|
SqlCommand cmd = new SqlCommand(MAC_sql, conn_SC); //查询记录数
|
||||||
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
@@ -183,7 +169,7 @@ namespace formula_manage.Windows
|
|||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
MAC_sql = string.Format("INSERT INTO[Dispensing].[dbo].[MACHINE](Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note ) " +
|
MAC_sql = string.Format("INSERT INTO [dbo].[MACHINE](Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note ) " +
|
||||||
"VALUES ('" + Mac_name + "','" + Mac_group + "'," + Mac_capacity + "," + Mac_volume + "," + Mac_industry + "," + Mac_categories + ",'" + Mac_note + "')");
|
"VALUES ('" + Mac_name + "','" + Mac_group + "'," + Mac_capacity + "," + Mac_volume + "," + Mac_industry + "," + Mac_categories + ",'" + Mac_note + "')");
|
||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(MAC_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(MAC_sql, conn_SC);
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<Window x:Class="formula_manage.Windows.Print"
|
||||||
|
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:formula_manage.Windows"
|
||||||
|
mc:Ignorable="d" Loaded="Window_Print"
|
||||||
|
Title="打印设置" Height="400" Width="500" MaxWidth="500">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,35,0,0" TextWrapping="Wrap" Text="模板路径:" VerticalAlignment="Top" Width="70" FontSize="16"/>
|
||||||
|
<TextBox x:Name="Print_path" HorizontalAlignment="Left" Height="20" Margin="90,35,0,0" VerticalAlignment="Top" Width="285" MaxLines="1" IsReadOnly="True"/>
|
||||||
|
<Button Content="浏览路径" HorizontalAlignment="Left" Height="20" Margin="375,35,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="15" Margin="20,65,0,0" TextWrapping="Wrap" Text="默认打印模板:" VerticalAlignment="Top" Width="90"/>
|
||||||
|
<ComboBox HorizontalAlignment="Left" Height="20" Margin="110,65,0,0" VerticalAlignment="Top" Width="180" x:Name="Template_M"/>
|
||||||
|
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,95,0,0" Content="默认打印机:" VerticalAlignment="Top" Width="90"
|
||||||
|
x:Name="TEXT_Print" Checked="Print_Checked" Unchecked="Print_Checked"/>
|
||||||
|
<ComboBox HorizontalAlignment="Left" Height="20" Margin="110,90,0,0" VerticalAlignment="Top" Width="180"
|
||||||
|
x:Name="cbxPrinter" SelectedValuePath="Element[OPTIONCODE].Value" DisplayMemberPath="Element[OPTIONNAME].Value"/>
|
||||||
|
<Button Content="预览模板" HorizontalAlignment="Left" Height="20" Margin="375,65,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_2"/>
|
||||||
|
<Button Content="编辑模板" HorizontalAlignment="Left" Height="20" Margin="295,65,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_1"/>
|
||||||
|
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="20,145,0,0" TextWrapping="Wrap" Text="发布至其它目标打印机" VerticalAlignment="Top" Width="200" FontSize="20"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,175,0,0" TextWrapping="Wrap" Text="模板路径:" VerticalAlignment="Top" Width="70" FontSize="16"/>
|
||||||
|
<TextBox x:Name="Print_path2" HorizontalAlignment="Left" Height="20" Margin="90,175,0,0" VerticalAlignment="Top" Width="285" MaxLines="1"/>
|
||||||
|
<Button Content="浏览路径" HorizontalAlignment="Left" Height="20" Margin="375,175,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click1"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="15" Margin="20,205,0,0" TextWrapping="Wrap" Text="默认打印模板:" VerticalAlignment="Top" Width="90"/>
|
||||||
|
<ComboBox HorizontalAlignment="Left" Height="20" Margin="110,205,0,0" VerticalAlignment="Top" Width="180" x:Name="Template_S"/>
|
||||||
|
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,235,0,0" Content="同步推送:" VerticalAlignment="Top" Width="90"
|
||||||
|
x:Name="TEXT_Print2" Checked="Print_Checked2" Unchecked="Print_Checked2"/>
|
||||||
|
<ComboBox HorizontalAlignment="Left" Height="20" Margin="110,230,0,0" VerticalAlignment="Top" Width="180"
|
||||||
|
x:Name="cbxPrinter2" SelectedValuePath="Element[OPTIONCODE].Value" DisplayMemberPath="Element[OPTIONNAME].Value"/>
|
||||||
|
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,260,0,0" Content="同步推送:" VerticalAlignment="Top" Width="90"
|
||||||
|
x:Name="TEXT_Print3" Checked="Print_Checked3" Unchecked="Print_Checked3"/>
|
||||||
|
<ComboBox HorizontalAlignment="Left" Height="20" Margin="110,255,0,0" VerticalAlignment="Top" Width="180"
|
||||||
|
x:Name="cbxPrinter3" SelectedValuePath="Element[OPTIONCODE].Value" DisplayMemberPath="Element[OPTIONNAME].Value"/>
|
||||||
|
<Button Content="预览模板" HorizontalAlignment="Left" Height="20" Margin="375,205,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_22"/>
|
||||||
|
<Button Content="编辑模板" HorizontalAlignment="Left" Height="20" Margin="295,205,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_12"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="15" Margin="20,305,0,0" TextWrapping="Wrap" Text="管理打印模板:" VerticalAlignment="Top" Width="90"/>
|
||||||
|
<ComboBox HorizontalAlignment="Left" Height="20" Margin="110,305,0,0" VerticalAlignment="Top" Width="180" x:Name="PrintTemplate" IsEditable="True"/>
|
||||||
|
<Button Content="删除模板" HorizontalAlignment="Left" Height="20" Margin="375,305,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_4"/>
|
||||||
|
<Button Content="添加模板" HorizontalAlignment="Left" Height="20" Margin="295,305,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_3"/>
|
||||||
|
|
||||||
|
<Grid Grid.Column="1" x:Name="Prompt" Margin="0,0,0,0" Background="White" Opacity="0.8" Visibility="Hidden">
|
||||||
|
<TextBlock Height="50" Margin="0,0,0,150" TextWrapping="Wrap" Text="Processing,Pleasewait..." Width="400" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,274 @@
|
|||||||
|
using FastReport;
|
||||||
|
using formula_manage.UserClass;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing.Printing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace formula_manage.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Print.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class Print : Window
|
||||||
|
{
|
||||||
|
public Print()
|
||||||
|
{
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
cbxPrinter.ItemsSource = this.GetLocalPrinters(); //打印机搜索
|
||||||
|
cbxPrinter2.ItemsSource = this.GetLocalPrinters();
|
||||||
|
cbxPrinter3.ItemsSource = this.GetLocalPrinters();
|
||||||
|
|
||||||
|
this.Closing += Window_Closing; //添加窗口关闭事件
|
||||||
|
}
|
||||||
|
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
|
||||||
|
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
||||||
|
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
|
||||||
|
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
||||||
|
|
||||||
|
bool Printer;
|
||||||
|
bool Printer2;
|
||||||
|
bool Printer3;
|
||||||
|
|
||||||
|
|
||||||
|
string Temp_M, Temp_S;
|
||||||
|
private void Window_Print(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||||
|
|
||||||
|
Printer = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P1"));
|
||||||
|
cbxPrinter.SelectedValue = Configini.IniReadvalue("PRINTER", "P2"); //读配置文件
|
||||||
|
Print_path.Text = Configini.IniReadvalue("PRINTER", "P3");
|
||||||
|
Printer2 = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P4"));
|
||||||
|
Printer3 = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P5"));
|
||||||
|
cbxPrinter2.SelectedValue = Configini.IniReadvalue("PRINTER", "P8"); //读配置文件
|
||||||
|
cbxPrinter3.SelectedValue = Configini.IniReadvalue("PRINTER", "P9"); //读配置文件
|
||||||
|
Print_path2.Text = Configini.IniReadvalue("PRINTER", "P12");
|
||||||
|
Temp_M = Configini.IniReadvalue("PRINTER", "P13");
|
||||||
|
Temp_S = Configini.IniReadvalue("PRINTER", "P14");
|
||||||
|
|
||||||
|
TEXT_Print.IsChecked = Printer;
|
||||||
|
cbxPrinter.IsEnabled = Printer;
|
||||||
|
|
||||||
|
TEXT_Print2.IsChecked = Printer2;
|
||||||
|
cbxPrinter2.IsEnabled = Printer2;
|
||||||
|
|
||||||
|
TEXT_Print3.IsChecked = Printer3;
|
||||||
|
cbxPrinter3.IsEnabled = Printer3;
|
||||||
|
|
||||||
|
PRINT_file();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PRINT_file()//建立模板列表
|
||||||
|
{
|
||||||
|
DirectoryInfo di_M = new DirectoryInfo(Print_path.Text); //new文件夹
|
||||||
|
FileInfo[] files_M = di_M.GetFiles("*.frx");//生成文件夹中的文件名合集
|
||||||
|
Template_M.ItemsSource = files_M;//加载合集
|
||||||
|
Template_M.DisplayMemberPath = "Name"; // 显示文件名
|
||||||
|
DirectoryInfo di_S = new DirectoryInfo(Print_path2.Text);
|
||||||
|
FileInfo[] files_S = di_S.GetFiles("*.frx");
|
||||||
|
Template_S.ItemsSource = files_S;
|
||||||
|
Template_S.DisplayMemberPath = "Name";
|
||||||
|
Template_M.Text = Temp_M;//传入保存的默认模板
|
||||||
|
Template_S.Text = Temp_S;//
|
||||||
|
|
||||||
|
PrintTemplate.ItemsSource = files_M;
|
||||||
|
PrintTemplate.DisplayMemberPath = "Name";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
||||||
|
{
|
||||||
|
MessageBoxResult result = System.Windows.MessageBox.Show("设置完成后请重启程序", "提示", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel);
|
||||||
|
if (result == MessageBoxResult.Cancel) //判断是否确认
|
||||||
|
{
|
||||||
|
e.Cancel = true; // 中断点击事件
|
||||||
|
}
|
||||||
|
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||||
|
Configini.IniWritevalue("PRINTER", " P1", Printer.ToString());
|
||||||
|
Configini.IniWritevalue("PRINTER", " P2", cbxPrinter.SelectedValue.ToString());
|
||||||
|
Configini.IniWritevalue("PRINTER", " P3", Print_path.Text.ToString());
|
||||||
|
Configini.IniWritevalue("PRINTER", " P4", Printer2.ToString());
|
||||||
|
Configini.IniWritevalue("PRINTER", " P5", Printer3.ToString());
|
||||||
|
Configini.IniWritevalue("PRINTER", " P8", cbxPrinter2.SelectedValue.ToString());
|
||||||
|
Configini.IniWritevalue("PRINTER", " P9", cbxPrinter3.SelectedValue.ToString());
|
||||||
|
Configini.IniWritevalue("PRINTER", " P12", Print_path2.Text.ToString());
|
||||||
|
Configini.IniWritevalue("PRINTER", " P13", Template_M.Text);
|
||||||
|
Configini.IniWritevalue("PRINTER", " P14", Template_S.Text);
|
||||||
|
|
||||||
|
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
||||||
|
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine(Log_time + "Print:Print_SET");
|
||||||
|
wr.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e) //路径选择按钮
|
||||||
|
{
|
||||||
|
FolderBrowserDialog Dilog = new FolderBrowserDialog();
|
||||||
|
Dilog.SelectedPath = Print_path.Text; //打开目录
|
||||||
|
Dilog.ShowNewFolderButton = false; //不显示新建文件夹按钮
|
||||||
|
//
|
||||||
|
if (Dilog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
Print_path.Text = Dilog.SelectedPath; //返回选择的字符串
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Button_Click1(object sender, RoutedEventArgs e) //路径选择按钮
|
||||||
|
{
|
||||||
|
FolderBrowserDialog Dilog = new FolderBrowserDialog();
|
||||||
|
Dilog.SelectedPath = Print_path2.Text; //打开目录
|
||||||
|
Dilog.ShowNewFolderButton = false; //不显示新建文件夹按钮
|
||||||
|
//
|
||||||
|
if (Dilog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
Print_path2.Text = Dilog.SelectedPath; //返回选择的字符串
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_1(object sender, RoutedEventArgs e) //编辑模板
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Template_M.Text))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("模板不能为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tuple = PrintHelper.Design(Print_path.Text + "/" + Template_M.Text);
|
||||||
|
if (!tuple.Item1)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Button_Click_12(object sender, RoutedEventArgs e) //编辑模板
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Template_S.Text))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("模板不能为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tuple = PrintHelper.Design(Print_path2.Text + "/" + Template_S.Text);
|
||||||
|
if (!tuple.Item1)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_2(object sender, RoutedEventArgs e) //预览模板
|
||||||
|
{
|
||||||
|
Report report = new Report();
|
||||||
|
//加载标签模版
|
||||||
|
report.Load(Print_path.Text + "/" + Template_M.Text);
|
||||||
|
//打印预览
|
||||||
|
report.Prepare();//准备
|
||||||
|
report.ShowPrepared();//预览
|
||||||
|
}
|
||||||
|
private void Button_Click_22(object sender, RoutedEventArgs e) //预览模板
|
||||||
|
{
|
||||||
|
Report report = new Report();
|
||||||
|
//加载标签模版
|
||||||
|
report.Load(Print_path2.Text + "/" + Template_S.Text);
|
||||||
|
//打印预览
|
||||||
|
report.Prepare();//准备
|
||||||
|
report.ShowPrepared();//预览
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Print_Checked(object sender, RoutedEventArgs e) //打印机是否生效
|
||||||
|
{
|
||||||
|
Printer = TEXT_Print.IsChecked.GetValueOrDefault(); //打印机是否生效
|
||||||
|
cbxPrinter.IsEnabled = Printer; //
|
||||||
|
}
|
||||||
|
private void Print_Checked2(object sender, RoutedEventArgs e) //打印机是否生效
|
||||||
|
{
|
||||||
|
Printer2 = TEXT_Print2.IsChecked.GetValueOrDefault(); //打印机是否生效
|
||||||
|
cbxPrinter2.IsEnabled = Printer2; //
|
||||||
|
}
|
||||||
|
private void Print_Checked3(object sender, RoutedEventArgs e) //打印机是否生效
|
||||||
|
{
|
||||||
|
Printer3 = TEXT_Print3.IsChecked.GetValueOrDefault(); //打印机是否生效
|
||||||
|
cbxPrinter3.IsEnabled = Printer3; //
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<XElement> GetLocalPrinters() //查找打印机
|
||||||
|
{
|
||||||
|
List<XElement> list = new List<XElement>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (string fPrinterName in PrinterSettings.InstalledPrinters)
|
||||||
|
{
|
||||||
|
var xePrintName = new XElement("Item", new XElement("OPTIONNAME", fPrinterName.Trim()), new XElement("OPTIONCODE", fPrinterName.Trim()));
|
||||||
|
|
||||||
|
if (!list.Contains(xePrintName))
|
||||||
|
list.Add(xePrintName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_3(object sender, RoutedEventArgs e)//新建模板文件
|
||||||
|
{
|
||||||
|
|
||||||
|
Prompt.Visibility = Visibility.Visible; //开启页面遮罩
|
||||||
|
|
||||||
|
string Template_path = Print_path.Text + "/" + PrintTemplate.Text;
|
||||||
|
string Template_DATA = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"12/12/2023 23:59:59\" ReportInfo.Modified=\"12/12/2023 23:59:59\" ReportInfo.CreatorVersion=\"2023.12.12.0\">\r\n <Dictionary/>\r\n <ReportPage Name=\"Page1\" Watermark.Font=\"宋体, 60pt\">\r\n <ReportTitleBand Name=\"ReportTitle1\" Width=\"718.2\" Height=\"37.8\"/>\r\n <PageHeaderBand Name=\"PageHeader1\" Top=\"41.8\" Width=\"718.2\" Height=\"28.35\"/>\r\n <DataBand Name=\"Data1\" Top=\"74.15\" Width=\"718.2\" Height=\"75.6\"/>\r\n <PageFooterBand Name=\"PageFooter1\" Top=\"153.75\" Width=\"718.2\" Height=\"18.9\"/>\r\n </ReportPage>\r\n</Report>";
|
||||||
|
|
||||||
|
if (File.Exists(Template_path)) //判断文件是否存在
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("模板已存在");
|
||||||
|
Prompt.Visibility = Visibility.Hidden;//去页面遮罩
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(PrintTemplate.Text))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("模板名不能为空");
|
||||||
|
Prompt.Visibility = Visibility.Hidden;//去页面遮罩
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllText(Template_path + ".frx", Template_DATA);
|
||||||
|
var tuple = PrintHelper.Design(Template_path + ".frx");
|
||||||
|
if (!tuple.Item1)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}");
|
||||||
|
Prompt.Visibility = Visibility.Hidden;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRINT_file(); ;//刷新模板列表
|
||||||
|
PrintTemplate.Text = null;//清空输入
|
||||||
|
|
||||||
|
Prompt.Visibility = Visibility.Hidden;//去页面遮罩
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_4(object sender, RoutedEventArgs e)//删除指定模板
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string Template_path = Print_path.Text + "/" + PrintTemplate.Text;
|
||||||
|
File.Delete(Template_path);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintTemplate.Text = null;
|
||||||
|
DirectoryInfo di_M = new DirectoryInfo(Print_path.Text); //new文件夹
|
||||||
|
FileInfo[] files_M = di_M.GetFiles("*.frx");//生成文件夹中的文件名合集
|
||||||
|
PrintTemplate.ItemsSource = files_M;//加载合集
|
||||||
|
PrintTemplate.DisplayMemberPath = "Name"; // 显示文件名
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
<Window x:Class="formula_manage.Windows.RECIPE"
|
||||||
|
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:formula_manage.Windows"
|
||||||
|
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
|
||||||
|
xmlns:ViewModel="clr-namespace:formula_manage.ViewModel"
|
||||||
|
mc:Ignorable="d" Loaded="RECIPE_Loaded"
|
||||||
|
Title="RECIPE_SET" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
|
||||||
|
DataContext="{Binding Source={StaticResource Locator}, Path=Recipev}"
|
||||||
|
BorderBrush="White" Background="#FFE0E0E0">
|
||||||
|
<Window.Resources>
|
||||||
|
<ViewModel:RECIPEViewModel x:Key="RECIPEViewModel"/>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<!--表-->
|
||||||
|
<DataGrid x:Name="DatagridRECIPE" MouseDoubleClick="RECIPE_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True"
|
||||||
|
Margin="15,0,15,150" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
|
||||||
|
CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
|
||||||
|
CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility ="Column" VerticalAlignment="Bottom" Height="250">
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<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">
|
||||||
|
</Trigger>
|
||||||
|
</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="#000000"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!--列信息绑定-->
|
||||||
|
<DataGridTextColumn Header="配方代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="配方名称" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="颜色名" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="颜色代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="客户代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="客户名称" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="备注" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<!--代码-->
|
||||||
|
<TextBox x:Name="Code" HorizontalAlignment="Left" Height="30" Margin="65,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="120" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="代码"
|
||||||
|
VerticalAlignment="Bottom" Width="40" FontSize="20"/>
|
||||||
|
<!--名称-->
|
||||||
|
<TextBox x:Name="name" HorizontalAlignment="Left" Height="30" Margin="255,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="120" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="205,0,0,100" TextWrapping="Wrap" Text="名称"
|
||||||
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
|
<!--备注-->
|
||||||
|
<TextBox x:Name="Remark" HorizontalAlignment="Left" Height="30" Margin="255,0,0,50"
|
||||||
|
VerticalAlignment="Bottom" Width="305" FontSize="22" MaxLines="1"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="205,0,0,50" TextWrapping="Wrap" Text="备注"
|
||||||
|
VerticalAlignment="Bottom" Width="40" FontSize="20"/>
|
||||||
|
|
||||||
|
<!--存储按钮-->
|
||||||
|
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="795,0,0,60"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
|
Click="Button_Preservation">
|
||||||
|
</Button>
|
||||||
|
<!--删除按钮-->
|
||||||
|
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="935,0,0,60"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
|
Click="Button_Delete">
|
||||||
|
</Button>
|
||||||
|
<DataGrid x:Name="Grid_RRODUCT" AlternationCount="2" IsReadOnly="False"
|
||||||
|
Margin="15,15,15,405" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
|
||||||
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False"
|
||||||
|
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column"
|
||||||
|
Background="White" SelectionMode="Single" FontSize="15" >
|
||||||
|
<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"/>
|
||||||
|
<Setter Property="DataContext" Value="{Binding Main, Source={StaticResource Locator}}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.Resources>
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="False"/>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.CellStyle>
|
||||||
|
<Style TargetType="{x:Type DataGridCell}">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="MinWidth" Value="20"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
|
||||||
|
<Setter Property="Foreground" Value="#000000"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!--列信息绑定-->
|
||||||
|
<DataGridTextColumn Header="序" Width="30" FontSize="15" MaxWidth="30" MinWidth="30" Binding="{Binding ID}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
||||||
|
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0"
|
||||||
|
ItemsSource="{Binding stuff_Product, Source={StaticResource RECIPEViewModel}}"
|
||||||
|
DisplayMemberPath="ProductCode"
|
||||||
|
Text="{Binding PRODUCT_CODE}" IsTextSearchEnabled="True" StaysOpenOnEdit="True"
|
||||||
|
BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True"
|
||||||
|
KeyDown="CP_PRODUCT_CODE_KeyUp"
|
||||||
|
DropDownClosed="CP_PRODUCT_CODE_DropDownClosed"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Header="目标饱和度(%)" Width="200" MaxWidth="400" MinWidth="100" >
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBox x:Name="CP_CONC" BorderThickness="0,0,0,0" Text="{Binding CONC}"
|
||||||
|
BorderBrush="{x:Null}" Background="{x:Null}"
|
||||||
|
KeyDown="CP_CONC_KeyUp"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTextColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}" Binding="{Binding SHIFT}"/>
|
||||||
|
<DataGridTemplateColumn Header="原料名称" Width="200" MaxWidth="400" MinWidth="100" CellStyle="{StaticResource CellStyle}">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ComboBox x:Name="CP_PRODUCT_NAME" BorderThickness="0,0,0,0"
|
||||||
|
ItemsSource="{Binding stuff_Product, Source={StaticResource RECIPEViewModel}}"
|
||||||
|
DisplayMemberPath="ProductName"
|
||||||
|
Text="{Binding PRODUCT_NAME}"
|
||||||
|
DropDownClosed="CP_PRODUCT_NAME_DropDownClosed"
|
||||||
|
BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True" IsReadOnly="True" Focusable="True" IsTabStop="False"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTextColumn Header="单位" Width="80" FontSize="15" MaxWidth="80" MinWidth="80" IsReadOnly="True" Binding="{Binding UNIT}" CellStyle="{StaticResource CellStyle}"/>
|
||||||
|
<DataGridTextColumn Header="备注" Width="600" FontSize="15" MinWidth="600" Binding="{Binding REMARK}" CellStyle="{StaticResource CellStyle}" IsReadOnly="False"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,391 @@
|
|||||||
|
using formula_manage.UserClass;
|
||||||
|
using formula_manage.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace formula_manage.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Machine.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class RECIPE : Window
|
||||||
|
{
|
||||||
|
// DataTable DissolvedataTable = new DataTable(); //建立Dissolve缓存
|
||||||
|
// DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存
|
||||||
|
// DataTable MACHINEdataTable = new DataTable(); //建立Machine缓存
|
||||||
|
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
|
||||||
|
// DataTable RecipedataTable = new DataTable(); //建立Recipe缓存
|
||||||
|
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
|
||||||
|
string TEXT_SQLIP;
|
||||||
|
string TEXT_SQLNAME;
|
||||||
|
string TEXT_SQMOD;
|
||||||
|
string TEXT_SQLUSER;
|
||||||
|
string TEXT_SQLPASWOR;
|
||||||
|
string Connstr_SC;
|
||||||
|
int ID_N = 1;
|
||||||
|
|
||||||
|
public RECIPE()
|
||||||
|
{
|
||||||
|
DataContext = new RECIPEViewModel();
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
RRODUCTdataTable.Columns.Add("ID", typeof(int));
|
||||||
|
RRODUCTdataTable.Columns.Add("DYELOT", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("ReDye", typeof(int));
|
||||||
|
RRODUCTdataTable.Columns.Add("STEP", typeof(int));
|
||||||
|
RRODUCTdataTable.Columns.Add("PRODUCT_CODE", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("CONC", typeof(float));
|
||||||
|
RRODUCTdataTable.Columns.Add("SHIFT", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("PRODUCT_NAME", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("TARGET_WT", typeof(float));
|
||||||
|
RRODUCTdataTable.Columns.Add("UNIT", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("Process", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("REMARK", typeof(string));
|
||||||
|
|
||||||
|
DataRow row = RRODUCTdataTable.NewRow(); //ID列
|
||||||
|
row["ID"] = ID_N;
|
||||||
|
row["UNIT"] = "g";
|
||||||
|
RRODUCTdataTable.Rows.Add(row);
|
||||||
|
|
||||||
|
Grid_RRODUCT.ItemsSource = RRODUCTdataTable.DefaultView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RECIPE_Loaded(object sender, RoutedEventArgs e)//打开页面执行
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
this.DatagridRECIPE.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.DataGridEquipment_LoadingRow);//生成序列号
|
||||||
|
|
||||||
|
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
|
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
|
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
|
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
if (TEXT_SQMOD == "0") //判断连接方式
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
GridSql();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成序列号的方法
|
||||||
|
/// </summary>
|
||||||
|
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
|
||||||
|
{
|
||||||
|
e.Row.Header = e.Row.GetIndex() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询数据库的方法
|
||||||
|
/// </summary>
|
||||||
|
private async void GridSql()
|
||||||
|
{
|
||||||
|
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [dbo].[Dissolve]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter Stuff_data = new SqlDataAdapter(Dissolve_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
DataTable dataTable = new DataTable(); //建立缓存
|
||||||
|
Stuff_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
DatagridRECIPE.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RECIPE_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
|
{
|
||||||
|
int rownum = DatagridRECIPE.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件
|
||||||
|
{
|
||||||
|
//Regex re = new Regex("[^0-9.-]+");
|
||||||
|
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
|
||||||
|
e.Handled = !re.IsMatch(e.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
|
||||||
|
{
|
||||||
|
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数
|
||||||
|
Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串
|
||||||
|
// string Dissolve_sql;
|
||||||
|
// int int_ion = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
||||||
|
{
|
||||||
|
string Mac_name = "是否删除【" + this.Code.Text + "】";//获取信息并拼接提示字符串
|
||||||
|
MessageBoxResult mac_name = System.Windows.MessageBox.Show(Mac_name, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标
|
||||||
|
if (mac_name == MessageBoxResult.Yes)//判断是否删除原料
|
||||||
|
{
|
||||||
|
string Stuff_sql = string.Format("DELETE FROM [dbo].[Dissolve] WHERE Name ='" + Code.Text.ToString() + "'");
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("ERR.C0110-2:删除失败", "错误");//判断执行是否成功
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string Code_;
|
||||||
|
string Name_;
|
||||||
|
string Type_;
|
||||||
|
string Conc_;
|
||||||
|
double Weight_ = 0;
|
||||||
|
|
||||||
|
private void CP_PRODUCT_CODE_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//原料代码输入事件
|
||||||
|
{
|
||||||
|
//double ang;
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
||||||
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
||||||
|
|
||||||
|
Code_ = curComboBox.Text;
|
||||||
|
|
||||||
|
|
||||||
|
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + Code_ + "'"); //查询判断原料代码是否有效
|
||||||
|
if (!r.Any()) //检查原料信息
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("原料不存在");
|
||||||
|
curComboBox.Text = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
|
||||||
|
if (c.Any())
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("重复原料");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Name_ = r[0].ItemArray[1].ToString();
|
||||||
|
Type_ = r[0].ItemArray[2].ToString();
|
||||||
|
Conc_ = r[0].ItemArray[3].ToString();
|
||||||
|
|
||||||
|
if ((Type_ == "0") || (Type_ == "3"))
|
||||||
|
{
|
||||||
|
Type_ = "%";
|
||||||
|
}
|
||||||
|
if ((Type_ == "1") || (Type_ == "2"))
|
||||||
|
{
|
||||||
|
Type_ = "g/L";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grid_row == -1) grid_row = 0;
|
||||||
|
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
||||||
|
row.BeginEdit();
|
||||||
|
row["PRODUCT_CODE"] = Code_;
|
||||||
|
row["PRODUCT_NAME"] = Name_;
|
||||||
|
row["SHIFT"] = Type_;
|
||||||
|
row.EndEdit();
|
||||||
|
if (grid_row == (ID_N - 1))
|
||||||
|
{
|
||||||
|
PressKey.PressKeys(Keys.Right, false);
|
||||||
|
PressKey.PressKeys(Keys.Right, true);
|
||||||
|
PressKey.PressKeys(Keys.Tab, false);
|
||||||
|
PressKey.PressKeys(Keys.Tab, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PressKey.PressKeys(Keys.Right, false);
|
||||||
|
PressKey.PressKeys(Keys.Right, true);
|
||||||
|
PressKey.PressKeys(Keys.Up, false);
|
||||||
|
PressKey.PressKeys(Keys.Up, true);
|
||||||
|
PressKey.PressKeys(Keys.Tab, false);
|
||||||
|
PressKey.PressKeys(Keys.Tab, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
||||||
|
}
|
||||||
|
private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件
|
||||||
|
{
|
||||||
|
double ang;
|
||||||
|
double conc = 0;
|
||||||
|
|
||||||
|
System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox;
|
||||||
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
||||||
|
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
if (!double.TryParse(curTextBox.Text, out ang))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("错误,重新输入");
|
||||||
|
curTextBox.Text = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (curTextBox.Text != "") conc = double.Parse(curTextBox.Text); //转换后判断数值输入是否异常
|
||||||
|
if (conc > 100)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("比例错误");
|
||||||
|
curTextBox.Text = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double Weight_t = Weight_ * conc;
|
||||||
|
|
||||||
|
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
||||||
|
row.BeginEdit();
|
||||||
|
row["CONC"] = string.Format("{0:N6}", conc);
|
||||||
|
row["TARGET_WT"] = string.Format("{0:N3}", Weight_t);
|
||||||
|
row.EndEdit();
|
||||||
|
|
||||||
|
if (grid_row == (ID_N - 1))
|
||||||
|
{
|
||||||
|
PressKey.PressKeys(Keys.Left, false);
|
||||||
|
PressKey.PressKeys(Keys.Left, true);
|
||||||
|
PressKey.PressKeys(Keys.Tab, false);
|
||||||
|
PressKey.PressKeys(Keys.Tab, true);
|
||||||
|
|
||||||
|
DataRow rowadd = RRODUCTdataTable.NewRow(); //ID列
|
||||||
|
//rowadd = RRODUCTdataTable.NewRow();
|
||||||
|
ID_N++;
|
||||||
|
rowadd["ID"] = ID_N;
|
||||||
|
rowadd["UNIT"] = "g";
|
||||||
|
RRODUCTdataTable.Rows.Add(rowadd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//原料代码选择事件
|
||||||
|
{
|
||||||
|
//double ang;
|
||||||
|
|
||||||
|
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
||||||
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
||||||
|
|
||||||
|
Code_ = curComboBox.Text;
|
||||||
|
|
||||||
|
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + Code_ + "'"); //查询判断原料代码是否有效
|
||||||
|
if (!r.Any()) //检查原料信息
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("原料不存在");
|
||||||
|
curComboBox.Text = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
|
||||||
|
if (c.Any())
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("重复原料");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Name_ = r[0].ItemArray[1].ToString();
|
||||||
|
Type_ = r[0].ItemArray[2].ToString();
|
||||||
|
Conc_ = r[0].ItemArray[3].ToString();
|
||||||
|
|
||||||
|
if ((Type_ == "0") || (Type_ == "3"))
|
||||||
|
{
|
||||||
|
Type_ = "%";
|
||||||
|
}
|
||||||
|
if ((Type_ == "1") || (Type_ == "2"))
|
||||||
|
{
|
||||||
|
Type_ = "g/L";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grid_row == -1) grid_row = 0;
|
||||||
|
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
||||||
|
row.BeginEdit();
|
||||||
|
row["PRODUCT_CODE"] = Code_;
|
||||||
|
row["PRODUCT_NAME"] = Name_;
|
||||||
|
row["SHIFT"] = Type_;
|
||||||
|
row.EndEdit();
|
||||||
|
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
|
||||||
|
|
||||||
|
}
|
||||||
|
private void CP_PRODUCT_NAME_DropDownClosed(object sender, EventArgs e)//原料名选择事件
|
||||||
|
{
|
||||||
|
//double ang;
|
||||||
|
|
||||||
|
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
|
||||||
|
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
|
||||||
|
|
||||||
|
if (curComboBox.Text != "")
|
||||||
|
{
|
||||||
|
Name_ = curComboBox.Text;
|
||||||
|
|
||||||
|
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
|
||||||
|
|
||||||
|
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_NAME ='" + Name_ + "'");//查询判断原料代码是否重复
|
||||||
|
if (c.Any())
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("重复原料");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Code_ = r[0].ItemArray[0].ToString();
|
||||||
|
Type_ = r[0].ItemArray[2].ToString();
|
||||||
|
Conc_ = r[0].ItemArray[3].ToString();
|
||||||
|
|
||||||
|
if ((Type_ == "0") || (Type_ == "3"))
|
||||||
|
{
|
||||||
|
Type_ = "%";
|
||||||
|
}
|
||||||
|
if ((Type_ == "1") || (Type_ == "2"))
|
||||||
|
{
|
||||||
|
Type_ = "g/L";
|
||||||
|
}
|
||||||
|
if (grid_row == -1) grid_row = 0;
|
||||||
|
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
|
||||||
|
row.BeginEdit();
|
||||||
|
row["PRODUCT_CODE"] = Code_;
|
||||||
|
row["PRODUCT_NAME"] = Name_;
|
||||||
|
row["SHIFT"] = Type_;
|
||||||
|
row.EndEdit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-16
@@ -1,21 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Net.NetworkInformation;
|
using System.Windows;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data.SqlTypes;
|
|
||||||
|
|
||||||
|
|
||||||
namespace formula_manage.Windows
|
namespace formula_manage.Windows
|
||||||
|
|||||||
+18
-31
@@ -1,24 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Data.SqlClient;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using GalaSoft.MvvmLight;
|
|
||||||
using formula_manage.SQLModels;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Data;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
|
||||||
using Xceed.Wpf.AvalonDock.Themes;
|
|
||||||
|
|
||||||
namespace formula_manage.Windows
|
namespace formula_manage.Windows
|
||||||
{
|
{
|
||||||
@@ -62,7 +49,7 @@ namespace formula_manage.Windows
|
|||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT]";//查询语句
|
string Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
try
|
try
|
||||||
@@ -128,11 +115,11 @@ namespace formula_manage.Windows
|
|||||||
private async void GridSql(int e)
|
private async void GridSql(int e)
|
||||||
{
|
{
|
||||||
string Stuff_sql = null;
|
string Stuff_sql = null;
|
||||||
if (e == 0) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT]";//查询语句
|
if (e == 0) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT]";//查询语句
|
||||||
else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '0' ";
|
else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '0' ";
|
||||||
else if (e == 2) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '1' ";
|
else if (e == 2) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '1' ";
|
||||||
else if (e == 3) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '2' ";
|
else if (e == 3) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '2' ";
|
||||||
else if (e == 4) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '3' ";
|
else if (e == 4) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '3' ";
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
@@ -234,7 +221,7 @@ namespace formula_manage.Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
Stuff_sql = "SELECT count(*) FROM [Dispensing].[dbo].[PRODUCT] WHERE ProductCode = '" + Product_Code + " '";//查询语句
|
Stuff_sql = "SELECT count(*) FROM [dbo].[PRODUCT] WHERE ProductCode = '" + Product_Code + " '";//查询语句
|
||||||
await conn_SC.OpenAsync(); //打开数据连
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
|
SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
|
||||||
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
@@ -242,7 +229,7 @@ namespace formula_manage.Windows
|
|||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
Stuff_sql = string.Format( "INSERT INTO[Dispensing].[dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
|
Stuff_sql = string.Format("INSERT INTO [dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
|
||||||
"VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')");
|
"VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')");
|
||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
@@ -347,14 +334,14 @@ namespace formula_manage.Windows
|
|||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
/*定位选中行及指定列单元格文本信息*/
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
string DataGridStuff_ProductCode = (DataGridStuff.Columns[1].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第0列,原料代码
|
string DataGridStuff_ProductCode = (DataGridStuff.Columns[1].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第0列,原料代码
|
||||||
string DataGridStuff_ProductName = (DataGridStuff.Columns[2].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第1列,原料名称
|
string DataGridStuff_ProductName = (DataGridStuff.Columns[2].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第1列,原料名称
|
||||||
string DataGridStuff_Price = (DataGridStuff.Columns[8].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,价格
|
string DataGridStuff_Price = (DataGridStuff.Columns[8].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,价格
|
||||||
string DataGridstuff_SUPPLIER = (DataGridStuff.Columns[9].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,供应商
|
string DataGridstuff_SUPPLIER = (DataGridStuff.Columns[9].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,供应商
|
||||||
string DataGridStuff_ProductType = (DataGridStuff.Columns[3].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,类型 //string DataGridStuff_Color = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum])as TextBlock).Text;//定位,色彩
|
string DataGridStuff_ProductType = (DataGridStuff.Columns[3].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,类型 //string DataGridStuff_Color = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum])as TextBlock).Text;//定位,色彩
|
||||||
string DataGridStuff_Concentration = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位选中行单元格文本信息
|
string DataGridStuff_Concentration = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位选中行单元格文本信息
|
||||||
string DataGridStuff_stuff_ion = (DataGridStuff.Columns[4].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位选中行单元格文本信息并去除空白字符,浓度
|
string DataGridStuff_stuff_ion = (DataGridStuff.Columns[4].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位选中行单元格文本信息并去除空白字符,浓度
|
||||||
string DataGridStuff_GRAVITY = (DataGridStuff.Columns[7].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,比重
|
string DataGridStuff_GRAVITY = (DataGridStuff.Columns[7].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,比重
|
||||||
/*stuff_Color.Background = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background;//定位,色彩,背景色传递至色彩框背景色*/
|
/*stuff_Color.Background = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background;//定位,色彩,背景色传递至色彩框背景色*/
|
||||||
/*填写信息至指定文本框*/
|
/*填写信息至指定文本框*/
|
||||||
//product_temp.ProductCode = DataGridStuff_ProductCode;//写入sql实体缓存
|
//product_temp.ProductCode = DataGridStuff_ProductCode;//写入sql实体缓存
|
||||||
|
|||||||
+2
-16
@@ -1,24 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Data.SqlClient;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using GalaSoft.MvvmLight;
|
|
||||||
using formula_manage.SQLModels;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Data;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
|
||||||
using Xceed.Wpf.AvalonDock.Themes;
|
|
||||||
|
|
||||||
namespace formula_manage.Windows
|
namespace formula_manage.Windows
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<Window x:Class="formula_manage.Windows.client"
|
||||||
|
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:formula_manage.Windows"
|
||||||
|
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
|
||||||
|
xmlns:viewmodel="clr-namespace:formula_manage.ViewModel"
|
||||||
|
mc:Ignorable="d" Loaded="client_Loaded"
|
||||||
|
Title="client" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
|
||||||
|
BorderBrush="White" Background="#FFE0E0E0">
|
||||||
|
<Grid>
|
||||||
|
<!--原料表-->
|
||||||
|
<DataGrid x:Name="DataGridclient" MouseDoubleClick="DataGridclient_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True" Margin="15,15,15,150" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
|
||||||
|
CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
|
||||||
|
CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility ="Column">
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<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">
|
||||||
|
</Trigger>
|
||||||
|
</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="#000000"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!--列信息绑定-->
|
||||||
|
<DataGridTemplateColumn Header=" 序号" Width="50" MinWidth="10" IsReadOnly="True">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock FontSize="15" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTextColumn Header="客户代码" Binding="{Binding Code}" Width="250" FontSize="15" MaxWidth="500" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="客户名称" Binding="{Binding Name}" Width="250" FontSize="15" MaxWidth="500" MinWidth="200" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="备注" Binding="{Binding Remark}" Width="500" FontSize="15" MaxWidth="1500" MinWidth="150" CanUserReorder="False"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<!--客户代码-->
|
||||||
|
<TextBox x:Name="client_code" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="客户代码"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
||||||
|
<!--客户名称-->
|
||||||
|
<TextBox x:Name="client_name" HorizontalAlignment="Left" Height="30" Margin="465,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="50"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="375,0,0,100" TextWrapping="Wrap" Text="客户名称"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
||||||
|
<!--备注-->
|
||||||
|
<TextBox x:Name="client_Remark" HorizontalAlignment="Left" Height="30" Margin="105,0,0,50" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="610" FontSize="22" MaxLines="1" MaxLength="25"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="备注"
|
||||||
|
VerticalAlignment="Bottom" Width="120" FontSize="20"/>
|
||||||
|
<!--存储按钮-->
|
||||||
|
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="795,0,0,60"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
|
Click="Button_Preservation">
|
||||||
|
</Button>
|
||||||
|
<!--删除按钮-->
|
||||||
|
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="935,0,0,60"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
|
Click="Button_Delete">
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,221 @@
|
|||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace formula_manage.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// client.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class client : Window
|
||||||
|
{
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
|
||||||
|
DataTable dataTable = new DataTable(); //建立缓存
|
||||||
|
|
||||||
|
string TEXT_SQLIP;
|
||||||
|
string TEXT_SQLNAME;
|
||||||
|
string TEXT_SQMOD;
|
||||||
|
string TEXT_SQLUSER;
|
||||||
|
string TEXT_SQLPASWOR;
|
||||||
|
string Connstr_SC;
|
||||||
|
|
||||||
|
public client()
|
||||||
|
{
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void client_Loaded(object sender, RoutedEventArgs e)//打开页面执行
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
this.DataGridclient.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.DataGridEquipment_LoadingRow);//生成序列号
|
||||||
|
|
||||||
|
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
|
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
|
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
|
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
if (TEXT_SQMOD == "0") //判断连接方式
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
string client_sql = "SELECT Code ,Name , Remark FROM [dbo].[Client]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter client_data = new SqlDataAdapter(client_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
client_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
DataGridclient.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成序列号的方法
|
||||||
|
/// </summary>
|
||||||
|
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
|
||||||
|
{
|
||||||
|
e.Row.Header = e.Row.GetIndex() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询数据库的方法
|
||||||
|
/// </summary>
|
||||||
|
private async void GridSql()
|
||||||
|
{
|
||||||
|
string client_sql = "SELECT Code ,Name , Remark FROM [dbo].[Client]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter client_data = new SqlDataAdapter(client_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
dataTable.Clear();
|
||||||
|
client_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
DataGridclient.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
|
||||||
|
{
|
||||||
|
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数
|
||||||
|
string client_sql;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(this.client_code.Text))
|
||||||
|
System.Windows.MessageBox.Show("ERR:无效的信息", "错误");//检查原料代码
|
||||||
|
else
|
||||||
|
if (string.IsNullOrEmpty(this.client_name.Text))
|
||||||
|
System.Windows.MessageBox.Show("ERR:无效的名称", "错误");//检查原料名
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
client_sql = "SELECT count(*) FROM [dbo].[Client] WHERE Code = '" + client_code.Text + " '";//查询语句
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
|
SqlCommand cmd = new SqlCommand(client_sql, conn_SC); //查询记录数
|
||||||
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
client_sql = string.Format("INSERT INTO [dbo].[Client](Code ,Name , Remark) " +
|
||||||
|
"VALUES ('" + client_code.Text + "','" + client_name.Text + "','" + client_Remark.Text + "')");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("添加失败");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
System.Windows.MessageBox.Show("添加完成");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
client_sql = string.Format("UPDATE [dbo].[Client] SET Name='" + client_name.Text + "',Remark='" + client_Remark.Text + "' Where Code='" + client_code.Text + "'");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("C0110-1:修改失败");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
|
||||||
|
System.Windows.MessageBox.Show("修改完成");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
||||||
|
{
|
||||||
|
string ShowProductName = "是否删除【" + this.client_name.Text + "】" + this.client_code.Text;//获取信息并拼接提示字符串
|
||||||
|
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
|
||||||
|
if (showProductName == MessageBoxResult.Yes)//判断是否删除
|
||||||
|
{
|
||||||
|
|
||||||
|
string Stuff_sql = string.Format("DELETE FROM [dbo].[Client] WHERE Code ='" + client_code.Text.ToString() + "'");
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridclient_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
|
{
|
||||||
|
int rownum = DataGridclient.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
|
client_code.Text = (DataGridclient.Columns[1].GetCellContent(DataGridclient.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第0列,代码
|
||||||
|
client_name.Text = (DataGridclient.Columns[2].GetCellContent(DataGridclient.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第1列,名称
|
||||||
|
client_Remark.Text = (DataGridclient.Columns[3].GetCellContent(DataGridclient.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<Window x:Class="formula_manage.Windows.color"
|
||||||
|
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:formula_manage.Windows"
|
||||||
|
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
|
||||||
|
xmlns:viewmodel="clr-namespace:formula_manage.ViewModel"
|
||||||
|
mc:Ignorable="d" Loaded="color_Loaded"
|
||||||
|
Title="color" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
|
||||||
|
BorderBrush="White" Background="#FFE0E0E0">
|
||||||
|
<Window.Resources>
|
||||||
|
<!--引入转换器-->
|
||||||
|
<ConvertMoels:ColorSQLConvert x:Key="ColorSQLConvert"/>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<!--原料表-->
|
||||||
|
<DataGrid x:Name="DataGridcolor" MouseDoubleClick="DataGridcolor_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True" Margin="15,15,15,150" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
|
||||||
|
CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
|
||||||
|
CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility ="Column">
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<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">
|
||||||
|
</Trigger>
|
||||||
|
</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="#000000"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<!--列信息绑定-->
|
||||||
|
<DataGridTemplateColumn Header=" 序号" Width="50" MinWidth="10" IsReadOnly="True">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock FontSize="15" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTextColumn Header="颜色代码" Binding="{Binding COLOR_CODE}" Width="250" FontSize="15" MaxWidth="500" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="颜色名称" Binding="{Binding COLOR_NAME}" Width="250" FontSize="15" MaxWidth="500" MinWidth="200" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="色彩" Width="100" FontSize="15" MaxWidth="200" MinWidth="20" CanUserReorder="False">
|
||||||
|
<!--事件名称:色彩数字转色彩显示,转换器ColorSQLConvert-->
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="Background" Value="{Binding COLOR_NO, Converter={StaticResource ColorSQLConvert}}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="备注" Binding="{Binding COLOR_Remark}" Width="500" FontSize="15" MaxWidth="1500" MinWidth="150" CanUserReorder="False"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<!--颜色代码-->
|
||||||
|
<TextBox x:Name="color_code" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="颜色代码"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
||||||
|
<!--颜色名称-->
|
||||||
|
<TextBox x:Name="color_name" HorizontalAlignment="Left" Height="30" Margin="465,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="50"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="375,0,0,100" TextWrapping="Wrap" Text="颜色名称"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
||||||
|
<!--备注-->
|
||||||
|
<TextBox x:Name="color_Remark" HorizontalAlignment="Left" Height="30" Margin="105,0,0,50" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="25"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="备注"
|
||||||
|
VerticalAlignment="Bottom" Width="120" FontSize="20"/>
|
||||||
|
<!---->
|
||||||
|
<TextBox x:Name="color_color" HorizontalAlignment="Left" Height="30" Margin="465,0,0,50" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
MouseDoubleClick="Color_MouseDoubleClick" IsReadOnly="True" Cursor="Arrow"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="375,0,0,50" TextWrapping="Wrap" Text="颜色"
|
||||||
|
VerticalAlignment="Bottom" Width="40" FontSize="20"/>
|
||||||
|
|
||||||
|
<!--存储按钮-->
|
||||||
|
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="795,0,0,60"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
|
Click="Button_Preservation">
|
||||||
|
</Button>
|
||||||
|
<!--删除按钮-->
|
||||||
|
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="935,0,0,60"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
|
Click="Button_Delete">
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,258 @@
|
|||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace formula_manage.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// color.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class color : Window
|
||||||
|
{
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
|
||||||
|
DataTable dataTable = new DataTable(); //建立缓存
|
||||||
|
|
||||||
|
string TEXT_SQLIP;
|
||||||
|
string TEXT_SQLNAME;
|
||||||
|
string TEXT_SQMOD;
|
||||||
|
string TEXT_SQLUSER;
|
||||||
|
string TEXT_SQLPASWOR;
|
||||||
|
string Connstr_SC;
|
||||||
|
|
||||||
|
public color()
|
||||||
|
{
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void color_Loaded(object sender, RoutedEventArgs e)//打开页面执行
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
this.DataGridcolor.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.DataGridEquipment_LoadingRow);//生成序列号
|
||||||
|
|
||||||
|
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
|
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
|
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
|
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
if (TEXT_SQMOD == "0") //判断连接方式
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
string color_sql = "SELECT COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark FROM [dbo].[COLOR]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter color_data = new SqlDataAdapter(color_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
color_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
DataGridcolor.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成序列号的方法
|
||||||
|
/// </summary>
|
||||||
|
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
|
||||||
|
{
|
||||||
|
e.Row.Header = e.Row.GetIndex() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询数据库的方法
|
||||||
|
/// </summary>
|
||||||
|
private async void GridSql()
|
||||||
|
{
|
||||||
|
string color_sql = "SELECT COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark FROM [dbo].[COLOR]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter color_data = new SqlDataAdapter(color_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
dataTable.Clear();
|
||||||
|
color_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
DataGridcolor.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
|
||||||
|
{
|
||||||
|
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数
|
||||||
|
string color_sql;
|
||||||
|
int ColorCode_SQL;
|
||||||
|
|
||||||
|
string colorValue = color_color.Background.ToString();//获取色彩框背景色"#FFC1C2C3"
|
||||||
|
string StuffColor_R = string.Format("{0:X2}", colorValue.Substring(3, 2));//获取红色参数C1
|
||||||
|
string StuffColor_G = string.Format("{0:X2}", colorValue.Substring(5, 2));//获取绿色参数C2
|
||||||
|
string StuffColor_B = string.Format("{0:X2}", colorValue.Substring(7, 2));//获取蓝色参数C3
|
||||||
|
string StuffColor = StuffColor_B + StuffColor_G + StuffColor_R;//合并16进制rgb参数
|
||||||
|
ColorCode_SQL = Convert.ToInt32(StuffColor, 16);//16进制转10进制
|
||||||
|
if (ColorCode_SQL < 0) ColorCode_SQL = 16777215;//判断色彩数据是否有效
|
||||||
|
|
||||||
|
if ((re_number.IsMatch(this.color_color.Text) == false) && (color_color.Text != ""))
|
||||||
|
System.Windows.MessageBox.Show("ERR:单位码重错误", "错误");//检查价格输入信息
|
||||||
|
else
|
||||||
|
if (string.IsNullOrEmpty(this.color_code.Text))
|
||||||
|
System.Windows.MessageBox.Show("ERR:无效的原料信息", "错误");//检查原料代码
|
||||||
|
else
|
||||||
|
if (string.IsNullOrEmpty(this.color_name.Text))
|
||||||
|
System.Windows.MessageBox.Show("ERR:无效的原料名称", "错误");//检查原料名
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
color_sql = "SELECT count(*) FROM [dbo].[COLOR] WHERE COLOR_CODE = '" + color_code.Text + " '";//查询语句
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
|
SqlCommand cmd = new SqlCommand(color_sql, conn_SC); //查询记录数
|
||||||
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
color_sql = string.Format("INSERT INTO [dbo].[COLOR](COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark) " +
|
||||||
|
"VALUES ('" + color_code.Text + "','" + color_name.Text + "','" + ColorCode_SQL + "','" + color_Remark.Text + "')");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(color_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("添加失败");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
System.Windows.MessageBox.Show("添加完成");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color_sql = string.Format("UPDATE [dbo].[COLOR] SET COLOR_NAME='" + color_name.Text + "',COLOR_NO='" + ColorCode_SQL + "',COLOR_Remark='" + color_Remark.Text + "' Where COLOR_CODE='" + color_code.Text + "'");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(color_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("C0110-1:修改失败");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
|
||||||
|
System.Windows.MessageBox.Show("修改完成");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
||||||
|
{
|
||||||
|
string ShowProductName = "是否删除【" + this.color_name.Text + "】" + this.color_code.Text;//获取信息并拼接提示字符串
|
||||||
|
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
|
||||||
|
if (showProductName == MessageBoxResult.Yes)//判断是否删除
|
||||||
|
{
|
||||||
|
|
||||||
|
string Stuff_sql = string.Format("DELETE FROM [dbo].[COLOR] WHERE COLOR_CODE ='" + color_code.Text.ToString() + "'");
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridcolor_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
|
{
|
||||||
|
int rownum = DataGridcolor.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
|
color_code.Text = (DataGridcolor.Columns[1].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第0列,代码
|
||||||
|
color_name.Text = (DataGridcolor.Columns[2].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第1列,名称
|
||||||
|
color_Remark.Text = (DataGridcolor.Columns[4].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,
|
||||||
|
|
||||||
|
if ((DataGridcolor.Columns[3].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Background != null) //定位选中行单元格,色彩,判断参数是否有效
|
||||||
|
{
|
||||||
|
color_color.Background = (DataGridcolor.Columns[3].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Background; //定位选中行单元格,色彩,有效背景色传递至色彩框背景色
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color_color.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));//白色传递至色彩框背景色
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//色彩框双击事件
|
||||||
|
{
|
||||||
|
|
||||||
|
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();//使用调色盘控件ColorDialog
|
||||||
|
if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)//打开调色盘
|
||||||
|
{
|
||||||
|
|
||||||
|
System.Drawing.Color DColor = colorDialog.Color;////获取选中色彩信息
|
||||||
|
//System.Windows.Media.Color MColor = new System.Windows.Media.Color();//转换
|
||||||
|
System.Windows.Media.Color MColor = System.Windows.Media.Color.FromArgb(DColor.A, DColor.R, DColor.G, DColor.B);//转换并配置ARGB参数
|
||||||
|
color_color.Background = new SolidColorBrush(MColor);//ARGB参数输出至Color的背景色
|
||||||
|
//string colorCode = string.Format("{0:X2}", DColor.B) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.R);//反向十六进制RGB
|
||||||
|
//string colorCode = string.Format("{0:X2}", DColor.R) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.B);//正向十六进制RGB
|
||||||
|
//ColorCode_SQL = Convert.ToInt32(colorCode, 16);//十六进制RGB转存储数值
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loaded 100 of 104 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user