Compare commits
431
Commits
9eded69ecf
..
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 | ||
|
|
4b08942fc0 | ||
|
|
163f3e650a | ||
|
|
cfaf6431c7 | ||
|
|
f660b695f0 | ||
|
|
55a30f9514 | ||
|
|
2726aa01ac | ||
|
|
5618024f94 | ||
|
|
a63feef32f | ||
|
|
b0dadf8bf8 | ||
|
|
f430282fc4 | ||
|
|
0b8658dec7 | ||
|
|
6a902ef19c | ||
|
|
8432928b6c | ||
|
|
7303741ea4 | ||
|
|
d1ddd96758 | ||
|
|
695f724c14 | ||
|
|
1494b59a3a | ||
|
|
9301771bf9 | ||
|
|
65498580be | ||
|
|
21ccf736d7 | ||
|
|
a110d93acc | ||
|
|
e816a7d56c | ||
|
|
86f7958ed3 | ||
|
|
ae7ff52abf | ||
|
|
3796012bcf | ||
|
|
741704c8aa | ||
|
|
a0aa6ccbf5 | ||
|
|
bc9ec7d4bb | ||
|
|
75e646e193 | ||
|
|
8aee8752ff | ||
|
|
0445103ac0 | ||
|
|
acebf38128 | ||
|
|
6b58182ae9 | ||
|
|
7e7987e8f4 | ||
|
|
9175f12802 | ||
|
|
02582f4c90 | ||
|
|
a5826b80e8 | ||
|
|
d6e4e0dd60 | ||
|
|
0df634ed6e | ||
|
|
c120a2164f | ||
|
|
cf69c71d3e | ||
|
|
a3fdfef542 | ||
|
|
e290681cee | ||
|
|
fa7882c34a | ||
|
|
e324cd18ff | ||
|
|
3cdcbed934 | ||
|
|
fa77666ffb | ||
|
|
1d6e6816f3 | ||
|
|
c8b271de12 | ||
|
|
656f120984 | ||
|
|
ab557a192f | ||
|
|
8432d6391a | ||
|
|
f64e213305 | ||
|
|
022876ce01 | ||
|
|
1b4c17bc7c | ||
|
|
92e5e0e268 | ||
|
|
2d92d624d0 | ||
|
|
49376cdf02 | ||
|
|
cbe00f5d93 | ||
|
|
fedcf6abdc | ||
|
|
9ff7988cce | ||
|
|
5d2e2140b3 | ||
|
|
1e84406190 | ||
|
|
ae559b8082 | ||
|
|
bd64153d83 | ||
|
|
23f5f5e5ca | ||
|
|
25a5a4836e | ||
|
|
dab2f14ce3 | ||
|
|
d8f1c487d5 | ||
|
|
8d75eeb92c | ||
|
|
c494f25c85 | ||
|
|
d4b9a8b295 | ||
|
|
f5bf396be5 | ||
|
|
0bad135850 | ||
|
|
ae35c93165 | ||
|
|
de98aeeebb | ||
|
|
020fdc37c8 | ||
|
|
eeea77ec27 | ||
|
|
c6a3e931d9 | ||
|
|
41e0c801a2 | ||
|
|
50197a0a89 | ||
|
|
1827407b1f | ||
|
|
c884ef0c34 | ||
|
|
5def852456 | ||
|
|
13b13e817a | ||
|
|
f0c8a79abd | ||
|
|
64e43048a2 | ||
|
|
8721f77c24 | ||
|
|
057a9dde63 | ||
|
|
708d54ac0c | ||
|
|
3f3aa0c817 | ||
|
|
15a43d59df | ||
|
|
c300cad9de | ||
|
|
b8839af3fa | ||
|
|
a3c807f02e | ||
|
|
4a4740ab44 | ||
|
|
589a453438 | ||
|
|
aee1102b44 | ||
|
|
2679b72009 | ||
|
|
aed2d7e654 | ||
|
|
75cc5dc5c3 | ||
|
|
d1f72ca351 | ||
|
|
8c922d5cc0 | ||
|
|
aba38a4e3b | ||
|
|
5bad675f46 | ||
|
|
5ac90e6e7f | ||
|
|
7833f7c34b | ||
|
|
2ebe614f43 | ||
|
|
a1d6e62944 | ||
|
|
44ac7618f3 | ||
|
|
d6150ae461 | ||
|
|
44de55a6b6 | ||
|
|
06d048ad85 | ||
|
|
9b679dc162 | ||
|
|
55deb51005 | ||
|
|
16442b5ec0 | ||
|
|
47b35b5afc | ||
|
|
26b8ac1be4 | ||
|
|
778b231542 | ||
|
|
eef6960d7a | ||
|
|
9407221589 | ||
|
|
847437fc2e | ||
|
|
e2e5e66ac5 | ||
|
|
b8364c82a8 | ||
|
|
9e4d938ef8 | ||
|
|
f4355aad6e | ||
|
|
380165b4d6 | ||
|
|
6f7a4de477 | ||
|
|
c5732e0603 | ||
|
|
99de404e7a | ||
|
|
9cc6f92ae2 | ||
|
|
c338f2450a | ||
|
|
97bef42947 | ||
|
|
bef1833f70 | ||
|
|
e4ea1d3d51 | ||
|
|
4dce33bf3e | ||
|
|
1e5fa12a7d | ||
|
|
2e3d2edcbc | ||
|
|
c16e2e6f8d | ||
|
|
d9a02ed561 | ||
|
|
59e729b7e8 | ||
|
|
6563a8dcb9 | ||
|
|
1f667114a2 | ||
|
|
5bd17e4885 | ||
|
|
8944a781d0 | ||
|
|
15fb366f45 | ||
|
|
3f43ee4713 | ||
|
|
cd81d4b29a | ||
|
|
2c46319d3c | ||
|
|
aa652ada77 | ||
|
|
6327dd3e96 | ||
|
|
8f8c7e057d | ||
|
|
cc85c54dc3 | ||
|
|
0ffe2c89b4 | ||
|
|
e8eedd0b1e | ||
|
|
f66738f6dc | ||
|
|
4dc2a56f13 | ||
|
|
27577fe321 | ||
|
|
ff2d884109 | ||
|
|
7cc9d3ce94 | ||
|
|
d072c0bc4d | ||
|
|
27e851c242 | ||
|
|
ab88512990 | ||
|
|
81f0f2c75f | ||
|
|
a2ead4ec4d | ||
|
|
29eab2294a | ||
|
|
87f724dfb7 | ||
|
|
84803ef813 | ||
|
|
e628bc2575 | ||
|
|
42a47d299d | ||
|
|
933db8739a | ||
|
|
eb1c07a908 | ||
|
|
fd5df0a376 | ||
|
|
5b7912c4c9 | ||
|
|
40132a66cd | ||
|
|
1b3a89df61 | ||
|
|
2df829ae72 | ||
|
|
34eec896fb | ||
|
|
a6fe8b2115 | ||
|
|
09c274d837 | ||
|
|
3bdeeb028d | ||
|
|
0f07f926d6 | ||
|
|
ea50ab692f | ||
|
|
11ad65de8f | ||
|
|
6613ff1b2e | ||
|
|
8959e752de | ||
|
|
de559186a4 | ||
|
|
9090170cc3 | ||
|
|
7fae8d82be | ||
|
|
de7527ae5a | ||
|
|
e4e9ffa99f | ||
|
|
aefde8c66a | ||
|
|
8759072722 | ||
|
|
348e02613f | ||
|
|
717e23fe3f | ||
|
|
98f459c14d | ||
|
|
538ef707db | ||
|
|
a8b0f34d0e | ||
|
|
a90d2ff03e | ||
|
|
7c4826761a | ||
|
|
7e16bed67b | ||
|
|
a91f6213e0 | ||
|
|
bcf132dd6c | ||
|
|
19c276db37 | ||
|
|
223a40ce5f | ||
|
|
7430bfb3f5 | ||
|
|
681f25ab5f | ||
|
|
60d9ec6cc6 | ||
|
|
75d5fb5ec3 | ||
|
|
2d673f9109 | ||
|
|
14c659f7a9 | ||
|
|
83a52afca7 | ||
|
|
e68dda7e00 |
No files matched your search
+89
-1
@@ -1,6 +1,94 @@
|
|||||||
<?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>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Xceed.Wpf.AvalonDock" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
|
||||||
|
<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>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -2,8 +2,13 @@
|
|||||||
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"
|
||||||
|
d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
>
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:formula_manage.ViewModel" />
|
||||||
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
+65
-16
@@ -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
|
||||||
@@ -12,7 +8,11 @@ namespace formula_manage
|
|||||||
/// App.xaml 的交互逻辑
|
/// App.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{ /// <summary>
|
||||||
|
///公共变量来自Login的用户名
|
||||||
|
/// </summary>
|
||||||
|
public static string USER_Purview { get; set; }
|
||||||
|
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
this.Startup += new StartupEventHandler(App_Startup);
|
this.Startup += new StartupEventHandler(App_Startup);
|
||||||
@@ -40,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);//在目录下
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace formula_manage.ConvertMoels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备类型数值转换器
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
internal class CategoriesSQLConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string Categories = System.Convert.ToString(value);
|
||||||
|
if (Categories == "0")//类型
|
||||||
|
{
|
||||||
|
return "溢流";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Categories == "1")
|
||||||
|
{
|
||||||
|
return "气流";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Categories == "2")
|
||||||
|
{
|
||||||
|
return "轧染";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Categories == "3")
|
||||||
|
{
|
||||||
|
return "卷染";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Categories == "4")
|
||||||
|
{
|
||||||
|
return "喷染";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Categories == "5")
|
||||||
|
{
|
||||||
|
return "筒纱";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Categories == "7")
|
||||||
|
{
|
||||||
|
return "成衣";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "未知类型";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,17 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Windows.Data;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace formula_manage.ConvertMoels
|
namespace formula_manage.ConvertMoels
|
||||||
{
|
{
|
||||||
internal class ColorSQLConvert
|
/// <summary>
|
||||||
|
/// RGB色彩数值转换器
|
||||||
|
/// 将色彩数值转换为ARGB代码返回
|
||||||
|
/// </summary>
|
||||||
|
public class ColorSQLConvert : IValueConverter
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if (value != null)
|
if (value != null)
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Audit.ConvertMoels
|
||||||
|
{
|
||||||
|
internal class DeviationConvert : IMultiValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string a = System.Convert.ToString(values[0]);//转换数组1的信息
|
||||||
|
string b = System.Convert.ToString(values[1]);//转换数组2的信息
|
||||||
|
if (a != "" && b != "")
|
||||||
|
{
|
||||||
|
string c = (System.Convert.ToSingle(b) - System.Convert.ToSingle(a)).ToString("0.0");//计算值1和2的差值并返回字符串
|
||||||
|
//string c = "0";
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Audit.ConvertMoels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 零值标红转换器
|
||||||
|
/// DispenseGrams为零的单元格文本标红返回
|
||||||
|
/// </summary>
|
||||||
|
internal class GramsSQLConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string G = System.Convert.ToString(value);
|
||||||
|
if (G == "0")//判断单元格值是否为零
|
||||||
|
{
|
||||||
|
return "red";//零返回红色
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "black";//非零返回黑色
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace formula_manage.ConvertMoels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备数值转换器
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
internal class IndustrySQLConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string Industry = System.Convert.ToString(value);
|
||||||
|
if (Industry == "0")//类型
|
||||||
|
{
|
||||||
|
return "浸染";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Industry == "1")
|
||||||
|
{
|
||||||
|
return "连染";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Industry == "2")
|
||||||
|
{
|
||||||
|
return "印染";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "未知类型";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace formula_manage.ConvertMoels
|
||||||
|
{
|
||||||
|
internal class IonSQLConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string stuff_ion = System.Convert.ToString(value);
|
||||||
|
if (stuff_ion == "0")//类型
|
||||||
|
{
|
||||||
|
return "分散";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "1")
|
||||||
|
{
|
||||||
|
return "酸性";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "2")
|
||||||
|
{
|
||||||
|
return "活性";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "3")
|
||||||
|
{
|
||||||
|
return "中性";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "4")
|
||||||
|
{
|
||||||
|
return "硫化";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "5")
|
||||||
|
{
|
||||||
|
return "阳离子";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "6")
|
||||||
|
{
|
||||||
|
return "阴离子";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "7")
|
||||||
|
{
|
||||||
|
return "非离子";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "8")
|
||||||
|
{
|
||||||
|
return "酞菁";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "9")
|
||||||
|
{
|
||||||
|
return "直接";
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "未知类型";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Windows.Data;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace formula_manage.ConvertMoels
|
namespace formula_manage.ConvertMoels
|
||||||
{
|
{
|
||||||
internal class ProductTypeSQLConvert
|
internal class ProductTypeSQLConvert : IValueConverter
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 运行状态变换器
|
||||||
|
/// 输入:状态码
|
||||||
|
/// 输出:状态文字
|
||||||
|
/// </summary>
|
||||||
|
namespace Audit.ConvertMoels
|
||||||
|
{
|
||||||
|
internal class StatenConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string Staten = null;
|
||||||
|
string i = value.ToString();
|
||||||
|
|
||||||
|
if (i == "101") Staten = "准备就绪";
|
||||||
|
if (i == "102") Staten = "计量输送";
|
||||||
|
if (i == "201") Staten = "自动状态";
|
||||||
|
if (i == "202") Staten = "转入排队";
|
||||||
|
if (i == "203") Staten = "等待命令";
|
||||||
|
if (i == "301") Staten = "工单完成";
|
||||||
|
if (i == "309") Staten = "输送异常";
|
||||||
|
|
||||||
|
return Staten;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Audit.ConvertMoels
|
||||||
|
{
|
||||||
|
internal class StatenERRConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (value.ToString() == "309")
|
||||||
|
{
|
||||||
|
return "red";//零返回红色
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "black";//非零返回黑色
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace formula_manage.ConvertMoels
|
||||||
|
{
|
||||||
|
internal class UserSQLConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string Capacity = System.Convert.ToString(value);
|
||||||
|
if (Capacity == "0")//类型
|
||||||
|
{
|
||||||
|
return "停用";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Capacity == "1")
|
||||||
|
{
|
||||||
|
return "限制";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Capacity == "2")
|
||||||
|
{
|
||||||
|
return "启用";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
return "未知类型";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
-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
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace formula_manage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询接口
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public interface IProvider<T> where T : class
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-5
@@ -14,16 +14,16 @@
|
|||||||
<ImageBrush ImageSource="/sunlight_logotext.jpg"/>
|
<ImageBrush ImageSource="/sunlight_logotext.jpg"/>
|
||||||
</Rectangle.Fill>
|
</Rectangle.Fill>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
<ComboBox x:Name="User" Height="24" Margin="60,164,10,0" VerticalAlignment="Top" FontSize="14" IsEditable="True" KeyUp="SearchBox_OnKeyDownd"/>
|
<ComboBox x:Name="User" DisplayMemberPath="UserCode" IsTextSearchEnabled ="False" Height="24" Margin="60,164,10,0" VerticalAlignment="Top" FontSize="14" IsEditable="True" KeyUp="SearchBox_OnKeyDownd"/>
|
||||||
<PasswordBox x:Name="Pasword" Height="24" Margin="60,210,10,0" VerticalAlignment="Top" FontSize="14" KeyUp="SearchBox_OnKeyDownd"/>
|
<PasswordBox x:Name="Pasword" Height="24" Margin="60,210,10,0" VerticalAlignment="Top" FontSize="14" KeyUp="SearchBox_OnKeyDownd"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="26" Margin="10,163,0,0" TextWrapping="Wrap" Text="账号:" VerticalAlignment="Top" Width="45" FontSize="20" RenderTransformOrigin="0.833,0.478"/>
|
<TextBlock HorizontalAlignment="Left" Height="26" Margin="10,163,0,0" TextWrapping="Wrap" Text="账号:" VerticalAlignment="Top" Width="45" FontSize="20" RenderTransformOrigin="0.833,0.478"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="26" Margin="10,208,0,0" TextWrapping="Wrap" Text="密码:" VerticalAlignment="Top" Width="45" FontSize="20" RenderTransformOrigin="0.833,0.478"/>
|
<TextBlock HorizontalAlignment="Left" Height="26" Margin="10,208,0,0" TextWrapping="Wrap" Text="密码:" VerticalAlignment="Top" Width="45" FontSize="20" RenderTransformOrigin="0.833,0.478"/>
|
||||||
<Button x:Name="logon" Content="登录" HorizontalAlignment="Left" Height="33" Margin="40,264,0,0" VerticalAlignment="Top" Width="64" Click="Button_Click_1" Background="#FFDDDDDD" Foreground="Black" BorderBrush="White"/>
|
<Button x:Name="logon" Content="登录" HorizontalAlignment="Left" Height="33" Margin="40,264,0,0" VerticalAlignment="Top" Width="64" Click="Button_Click_1" Background="#FFDDDDDD" Foreground="Black" BorderBrush="White"/>
|
||||||
<Button Content="退出" HorizontalAlignment="Right" Height="33" Margin="140,264,40,0" VerticalAlignment="Top" Width="64" Click="Button_Click" Background="#FFDDDDDD" Foreground="Black" BorderBrush="White"/>
|
<Button Content="退出" HorizontalAlignment="Right" Height="33" Margin="140,264,40,0" VerticalAlignment="Top" Width="64" Click="Button_Click" Background="#FFDDDDDD" Foreground="Black" BorderBrush="White"/>
|
||||||
<TextBlock Height="30" Margin="15,115,15,0" TextWrapping="Wrap" Text="尚彩科技单据管理系统" VerticalAlignment="Top" FontSize="20"/>
|
<TextBlock Height="30" Margin="15,115,15,0" TextWrapping="Wrap" Text="尚彩科技单据管理系统" VerticalAlignment="Top" FontSize="20"/>
|
||||||
<TextBox x:Name="DISPENLINK" HorizontalAlignment="Left" Height="15" Margin="0,0,0,0" TextWrapping="Wrap" Text="DISPEN" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898"/>
|
<TextBox x:Name="DISPENLINK" HorizontalAlignment="Left" Height="15" Margin="0,0,0,0" TextWrapping="Wrap" Text="DISPEN" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898" Focusable="False" MaxLines="1" FontSize="11"/>
|
||||||
<TextBox x:Name="DBCLINK" HorizontalAlignment="Left" Height="15" Margin="50,0,0,0" TextWrapping="Wrap" Text="DBC" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898"/>
|
<TextBox x:Name="DBCLINK" HorizontalAlignment="Left" Height="15" Margin="50,0,0,0" TextWrapping="Wrap" Text="DBC" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898" FontSize="11" MaxLines="1"/>
|
||||||
<TextBox x:Name="EXLINK" HorizontalAlignment="Left" Height="15" Margin="100,0,0,0" TextWrapping="Wrap" Text="EX" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898"/>
|
<TextBox x:Name="EXLINK" HorizontalAlignment="Left" Height="15" Margin="100,0,0,0" TextWrapping="Wrap" Text="EX" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898" FontSize="11" MaxLines="1"/>
|
||||||
<TextBox x:Name="USERLINK" HorizontalAlignment="Left" Height="15" Margin="150,0,0,0" TextWrapping="Wrap" Text="USER" VerticalAlignment="Bottom" Width="98" Background="#FFF1F1F1" BorderBrush="#FF989898"/>
|
<TextBox x:Name="USERLINK" HorizontalAlignment="Left" Height="15" Margin="150,0,0,0" TextWrapping="Wrap" Text="USER" VerticalAlignment="Bottom" Width="98" Background="#FFF1F1F1" BorderBrush="#FF989898" MaxLines="1" FontSize="11"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
+112
-26
@@ -1,22 +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;
|
|
||||||
|
|
||||||
namespace formula_manage
|
namespace formula_manage
|
||||||
{
|
{
|
||||||
@@ -25,30 +14,72 @@ namespace formula_manage
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Login : Window
|
public partial class Login : Window
|
||||||
{
|
{
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
|
||||||
|
DataTable logindataTable = new DataTable(); //建立login缓存
|
||||||
|
|
||||||
public Login()
|
public Login()
|
||||||
{
|
{
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
UserClass.LogGing.LogGingDATA("FORMULA_start");
|
||||||
}
|
}
|
||||||
|
|
||||||
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) //登录按钮事件
|
||||||
{
|
{
|
||||||
// if ((User.Text == "engineer" || User.Text == "ENGINEER") && (Pasword.Password == "engineer" || Pasword.Password == "ENGINEER"))
|
string user = User.Text;
|
||||||
|
string pasword = Pasword.Password; ;
|
||||||
|
|
||||||
|
if (User.Text == "") //检查用户名输入
|
||||||
{
|
{
|
||||||
|
System.Windows.MessageBox.Show("请输入用户名");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((user == "engineer" || user == "ENGINEER") && (pasword == "engineer" || pasword == "ENGINEER")) //确认账号是否是工程师
|
||||||
|
{
|
||||||
|
App.USER_Purview = "ENGINEER";//传入用户名
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
|
string var_sql;
|
||||||
|
|
||||||
|
if (pasword == "") var_sql = "[UserCode]='" + user + "' and [PassWord] is null"; //查询字符
|
||||||
|
else var_sql = "[UserCode]='" + user + "' and [PassWord]='" + pasword + "'";
|
||||||
|
|
||||||
|
var loginOK = this.logindataTable.Select(var_sql).FirstOrDefault(); //查询账号信息是否正确,不正确返回null
|
||||||
|
|
||||||
|
if (loginOK != null)
|
||||||
|
{
|
||||||
|
App.USER_Purview = User.Text;//传入用户名
|
||||||
|
|
||||||
|
Window window = Window.GetWindow(this);
|
||||||
|
MainWindow Main = new MainWindow();
|
||||||
|
window.Close();
|
||||||
|
|
||||||
|
UserClass.LogGing.LogGingDATA("LOGon = " + user);
|
||||||
|
|
||||||
|
Main.ShowDialog();//实例化并置顶打开窗口
|
||||||
|
}
|
||||||
|
else
|
||||||
System.Windows.MessageBox.Show("账号或密码错误");
|
System.Windows.MessageBox.Show("账号或密码错误");
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
||||||
@@ -61,8 +92,6 @@ namespace formula_manage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
|
|
||||||
|
|
||||||
string TEXT_SQLIP;
|
string TEXT_SQLIP;
|
||||||
string TEXT_SQLNAME;
|
string TEXT_SQLNAME;
|
||||||
string TEXT_SQMOD;
|
string TEXT_SQMOD;
|
||||||
@@ -84,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";
|
||||||
@@ -100,17 +151,23 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||||
|
|
||||||
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(); //关闭连接
|
||||||
@@ -136,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; //连接成功绿色
|
||||||
@@ -150,6 +211,31 @@ namespace formula_manage
|
|||||||
logon.IsEnabled = true; //允许登录按钮
|
logon.IsEnabled = true; //允许登录按钮
|
||||||
UserClass.PressKey.PressKeys(Keys.Tab, false);
|
UserClass.PressKey.PressKeys(Keys.Tab, false);
|
||||||
UserClass.PressKey.PressKeys(Keys.Tab, true);
|
UserClass.PressKey.PressKeys(Keys.Tab, true);
|
||||||
|
|
||||||
|
if (DISPENLINK.Background == Brushes.Green)
|
||||||
|
{
|
||||||
|
string user_sql = "SELECT UserCode ,PassWord ,UserSetup ,Capacity ,GROUP_CODE ,Note FROM [Dispensing].[dbo].[UserAccount] WHERE Capacity != 0";//查询语句
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter user_data = new SqlDataAdapter(user_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
user_data.Fill(logindataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
User.ItemsSource = logindataTable.DefaultView; //数据加入表格
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
UserClass.LogGing.LogGingDATA("USER = NoData");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 231 KiB |
+174
-68
@@ -4,77 +4,130 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:formula_manage"
|
xmlns:local="clr-namespace:formula_manage"
|
||||||
|
xmlns:ViewModel="clr-namespace:formula_manage.ViewModel"
|
||||||
mc:Ignorable="d" Loaded="Window_MIN"
|
mc:Ignorable="d" Loaded="Window_MIN"
|
||||||
Title="SUNLIGHT" Height="720" Width="1280" BorderBrush="White" Background="#FFE0E0E0">
|
Title="SUNLIGHT" Height="720" Width="1280" MinHeight="720" MinWidth="1280"
|
||||||
|
DataContext="{Binding Source={StaticResource Locator}, Path=Main}"
|
||||||
|
BorderBrush="White" Background="#FFE0E0E0">
|
||||||
|
<Window.Resources>
|
||||||
|
<ViewModel:MainWindowViewModel x:Key="MainWindowViewModel"/>
|
||||||
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Menu IsTabStop="False">
|
<Menu IsTabStop="False" Grid.ColumnSpan="1">
|
||||||
<MenuItem x:Name="tab" Header="_设置" FontSize="16" Focusable ="False" >
|
<MenuItem x:Name="tab" Header="_文件" FontSize="16" Focusable ="False" >
|
||||||
<MenuItem Header="_数据库设置" FontSize="16" Click="SQL"/>
|
<MenuItem Header="_许可证" Click="CDKEY_SET" FontSize="16"/>
|
||||||
<MenuItem Header="_备份/还原" FontSize="16" Click="SQLBAK"/>
|
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="_软件设置" FontSize="16" Click="SOFTWARE_SET"/>
|
<MenuItem Header="_注销" FontSize="16" Click="logout"/>
|
||||||
<MenuItem Header="_用户设置" FontSize="16" Click="USER_SET"/>
|
</MenuItem>
|
||||||
|
<MenuItem Header="_设置" FontSize="16" Focusable ="False" >
|
||||||
|
<MenuItem Header="_数据库设置" FontSize="16" Name="_SQL" Click="SQL" IsEnabled="False"/>
|
||||||
|
<MenuItem Header="_备份/还原" FontSize="16" Name="_SQLBAK" Click="SQLBAK" IsEnabled="False"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="_帮助" FontSize="16" Click="HELP"/>
|
<MenuItem Header="_软件设置" FontSize="16" Name="_SOFTWARE_SET" Click="SOFTWARE_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" Click="MAC_SET"/>
|
<MenuItem Header="_染色机管理" FontSize="16" Name="_MAC_SET" Click="MAC_SET" IsEnabled="False"/>
|
||||||
<MenuItem Header="_原料信息管理" FontSize="16" Click="STUFF"/>
|
<MenuItem Header="_原料信息管理" FontSize="16" Name="_STUFF" Click="STUFF" IsEnabled="False"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="_预设配方管理" FontSize="16"/>
|
<MenuItem Header="_预设配方管理" FontSize="16" Name="_RECIPE" Click="RECIPE" IsEnabled="False"/>
|
||||||
<MenuItem Header="_预设工艺管理" FontSize="16"/>
|
<MenuItem Header="_预设工艺管理" FontSize="16" Name="_PROCESS" Click="PROCESS" IsEnabled="False"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="_配送流程管理" FontSize="16"/>
|
<MenuItem Header="_配送流程管理" FontSize="16" Name="_WORKFLOW" Click="WORKFLOW" IsEnabled="False"/>
|
||||||
|
<MenuItem Header="_流程选择规则" FontSize="16" Name="_WORKFLOWSET" Click="WORKFLOWSET" IsEnabled="False"/>
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem Header="其它...">
|
<MenuItem Header="_布种" FontSize="16" Name="_fabric" Click="fabric" IsEnabled="False"/>
|
||||||
<MenuItem Header="_布种" FontSize="16"/>
|
<MenuItem Header="_颜色名" FontSize="16" Name="_color" Click="color" IsEnabled="False"/>
|
||||||
<MenuItem Header="_品名" FontSize="16"/>
|
<MenuItem Header="_客户" FontSize="16" Name="_client" Click="client" IsEnabled="False"/>
|
||||||
<MenuItem Header="_色名" FontSize="16"/>
|
<Separator />
|
||||||
<MenuItem Header="_客户" FontSize="16"/>
|
<MenuItem Header="_用户设置" FontSize="16" Name="_USER_SET" Click="USER_SET" IsEnabled="False"/>
|
||||||
</MenuItem>
|
|
||||||
</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"/>
|
</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" Click="HELP"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Button Content="新工单" HorizontalAlignment="Left" Margin="335,35,0,0" Height="30" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" FontSize="20" Click="Button_Click" Focusable ="False"/>
|
|
||||||
<Button Content="预设工艺" HorizontalAlignment="Left" Margin="300,70,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False"/>
|
<TextBox x:Name="USERTIME" Text="{Binding Sys_Time}" HorizontalAlignment="Right" Height="30" Margin="0,0,5,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="14"
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,35,0,0" TextWrapping="Wrap" Text="物料单号:" VerticalAlignment="Top" Width="90" FontSize="20" Background="WhiteSmoke"/>
|
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False" Grid.Column="1"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,70,0,0" TextWrapping="Wrap" Text="执行工艺:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
<TextBox x:Name="USER" HorizontalAlignment="Right" Height="30" Margin="0,0,155,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="100" FontSize="14"
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,105,0,0" TextWrapping="Wrap" Text="机台:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False" Grid.Column="1"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,105,0,0" TextWrapping="Wrap" Text="总步数:" VerticalAlignment="Top" Width="70" FontSize="20"/>
|
<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"/>
|
||||||
<TextBox x:Name="Number" HorizontalAlignment="Left" Height="30" Margin="95,35,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20"/>
|
<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"/>
|
||||||
<TextBox x:Name="Anew" 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"/>
|
<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"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" Focusable ="False"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,35,0,0" TextWrapping="Wrap" Text="领料单号:" VerticalAlignment="Top" Width="90" FontSize="20" Background="WhiteSmoke"/>
|
||||||
<ComboBox x:Name="Machine" HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" Text="" VerticalAlignment="Top" Width="130" FontSize="20" IsEditable="True"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,70,0,0" TextWrapping="Wrap" Text="流转订单:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
<TextBox x:Name="Procedures_N" HorizontalAlignment="Left" Height="30" Margin="305,105,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="80" FontSize="20" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,105,0,0" TextWrapping="Wrap" Text="执行工艺:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,105,0,0" VerticalAlignment="Top" FontSize="10" Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_up" IsTabStop="False" Focusable ="False"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,140,0,0" TextWrapping="Wrap" Text="机台:" VerticalAlignment="Top" Width="80" FontSize="20"/>
|
||||||
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,120,0,0" VerticalAlignment="Top" FontSize="10" Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_dow" IsTabStop="False" Focusable ="False"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,175,0,0" TextWrapping="Wrap" Text="类型:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
<Grid Height="150" Width="405" Margin="5,140,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Background="#FFF7F7F7">
|
<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"/>
|
||||||
|
<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" ToolTip="当前配方的物料单" 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="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="300,35,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="30" FontSize="20"
|
||||||
|
MaxLines="1" MaxLength="2" Grid.Column="1" IsReadOnly="True"/>
|
||||||
|
<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"
|
||||||
|
ItemsSource="{Binding mac_Machine, Source={StaticResource MainWindowViewModel}}"
|
||||||
|
HorizontalAlignment="Left" Height="30" Margin="95,140,0,0" VerticalAlignment="Top" Width="120" FontSize="20"
|
||||||
|
KeyUp="Machine_OnKeyDownd" DropDownClosed="Machine_DropDownClosed" InputMethod.IsInputMethodEnabled="False"/>
|
||||||
|
<ComboBox x:Name="OrderType" Text="正常单"
|
||||||
|
HorizontalAlignment="Left" Height="30" Margin="95,175,0,0" VerticalAlignment="Top" Width="120" FontSize="20"
|
||||||
|
IsTabStop="True" KeyUp="SearchBox_OnKeyDownd" IsEditable="True" IsReadOnly="True">
|
||||||
|
<ComboBoxItem Content="正常单"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="追加单"></ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
<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"/>
|
||||||
|
<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"/>
|
||||||
|
<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"/>
|
||||||
|
|
||||||
|
<Grid Height="150" Width="405" Margin="5,210,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Background="#FFF7F7F7" Grid.ColumnSpan="2">
|
||||||
|
<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"/>
|
||||||
<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" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
|
<TextBox x:Name="Procedures_P" HorizontalAlignment="Left" Height="30" Margin="90,5,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="50" FontSize="20"
|
||||||
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="140,5,0,0" VerticalAlignment="Top" FontSize="10" Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" IsTabStop="False" Click="Button_Click_1" Focusable ="False"/>
|
KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
|
||||||
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="140,20,0,0" VerticalAlignment="Top" FontSize="10" Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" IsTabStop="False" Click="Button_Click_2" Focusable ="False"/>
|
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="140,5,0,0" VerticalAlignment="Top" FontSize="10"
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="170,5,0,0" TextWrapping="Wrap" Text="流程:" VerticalAlignment="Top" Width="70" FontSize="20"/>
|
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" IsTabStop="False" Click="Button_StepUp" Focusable ="False"/>
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="220,5,0,0" Text="" VerticalAlignment="Top" Width="180" FontSize="20" IsEditable="True" Focusable ="False"/>
|
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="140,20,0,0" VerticalAlignment="Top" FontSize="10"
|
||||||
|
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" IsTabStop="False" Click="Button_StepDow" Focusable ="False"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="170,5,0,0" TextWrapping="Wrap" Text="流程:" VerticalAlignment="Top" Width="45" FontSize="20"/>
|
||||||
|
<ComboBox Name="Workflow" DisplayMemberPath="DissolveName" ItemsSource="{Binding flow_Workflow, Source={StaticResource MainWindowViewModel}}" StaysOpenOnEdit="True"
|
||||||
|
HorizontalAlignment="Left" Height="30" Margin="225,5,0,0" Text="" VerticalAlignment="Top" Width="175" FontSize="20" IsEditable="True" Grid.ColumnSpan="2"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,40,0,0" TextWrapping="Wrap" Text="配方代码:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,40,0,0" TextWrapping="Wrap" Text="配方代码:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="90,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20"/>
|
<TextBox HorizontalAlignment="Left" Height="30" Margin="90,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20" KeyUp="SearchBox_OnKeyDownd"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="220,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="180" FontSize="20" Focusable ="False"/>
|
<TextBox HorizontalAlignment="Left" Height="30" Margin="225,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="140" FontSize="20" Focusable ="False" Grid.ColumnSpan="2"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,75,0,0" TextWrapping="Wrap" Text="重量(KG):" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,75,0,0" TextWrapping="Wrap" Text="重量(KG):" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
<TextBox 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"
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,75,0,0" TextWrapping="Wrap" Text="浴比:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
KeyUp="SearchBox_OnKeyDownd" TextChanged="Weight" PreviewTextInput="Tb_KeyFloating" InputMethod.IsInputMethodEnabled="False"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="270,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="130" FontSize="20"/>
|
<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="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"/>
|
||||||
<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 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"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,110,0,0" TextWrapping="Wrap" Text="修正:" VerticalAlignment="Top" Width="90" FontSize="20" Grid.ColumnSpan="2"/>
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="270,110,0,0" Text="" VerticalAlignment="Top" Width="130" FontSize="20" Focusable ="False" IsEditable="True"/>
|
<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="Selectio" AlternationCount="2" IsReadOnly="False"
|
|
||||||
Margin="5,300,5,100" d:ItemsSource="{d:SampleData ItemCount=200}" AutoGenerateColumns="False" MinColumnWidth="30"
|
<DataGrid x:Name="Grid_RRODUCT" AlternationCount="2" IsReadOnly="False" InitializingNewItem="DataGrid_InitializingNewItem"
|
||||||
|
Margin="5,365,5,80" d:ItemsSource="{d:SampleData ItemCount=99}" 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" Background="White" SelectionMode="Single">
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
|
||||||
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False"
|
||||||
|
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column"
|
||||||
|
Background="White" SelectionMode="Single" FontSize="15" >
|
||||||
<DataGrid.RowStyle >
|
<DataGrid.RowStyle >
|
||||||
<Style TargetType="{x:Type DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
@@ -82,7 +135,7 @@
|
|||||||
<Setter Property="Background" Value="#FFFFFFFF" />
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||||
<Setter Property="Background" Value="#FFF5F5F5" />
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsMouseOver" Value="False">
|
<Trigger Property="IsMouseOver" Value="False">
|
||||||
</Trigger>
|
</Trigger>
|
||||||
@@ -95,32 +148,85 @@
|
|||||||
<Setter Property="MinWidth" Value="20"/>
|
<Setter Property="MinWidth" Value="20"/>
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<Trigger Property="IsSelected" Value="True">
|
<Trigger Property="IsSelected" Value="True">
|
||||||
<Setter Property="Background" Value="#FFC0C0C0"/>
|
<Setter Property="Background" Value="#FFFFFFFF"/>
|
||||||
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
|
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
|
||||||
<Setter Property="Foreground" Value="#000000"/>
|
<Setter Property="Foreground" Value="#000000"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</DataGrid.CellStyle>
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Resources>
|
||||||
|
<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
|
||||||
|
<Setter Property="Focusable" Value="False"/>
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
|
||||||
|
<Setter Property="Foreground" Value="#000000"/>
|
||||||
|
<Setter Property="DataContext" Value="{Binding Source={StaticResource Locator}, Path=Main}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.Resources>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<!--列信息绑定-->
|
<!--列信息绑定-->
|
||||||
<DataGridTextColumn Header="步序" Width="50" FontSize="15" MaxWidth="50" MinWidth="50" CanUserReorder="False" />
|
|
||||||
<DataGridTextColumn Header="原料代码" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTextColumn Header="序" Width="30" FontSize="15" MaxWidth="30" MinWidth="30" Binding="{Binding ID}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
||||||
<DataGridTextColumn Header="目标饱和度(%)" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTextColumn Header="步骤" Width="50" FontSize="15" MaxWidth="50" MinWidth="50" Binding="{Binding STEP}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
||||||
<DataGridTextColumn Header="计算单位" Width="80" FontSize="15" MaxWidth="80" MinWidth="80" CanUserReorder="False"/>
|
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
||||||
<DataGridTextColumn Header="原料名称" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataGridTextColumn Header="目标重量(g)" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
<DataTemplate>
|
||||||
<DataGridTextColumn Header="单位" Width="80" FontSize="15" MaxWidth="80" MinWidth="80" CanUserReorder="False"/>
|
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0"
|
||||||
<DataGridTextColumn Header="备注" Width="400" FontSize="15" MinWidth="100" CanUserReorder="False"/>
|
ItemsSource="{Binding stuff_Product, Source={StaticResource MainWindowViewModel}}"
|
||||||
|
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">
|
||||||
|
</ComboBox>
|
||||||
|
</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 MainWindowViewModel}}"
|
||||||
|
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="目标重量(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="备注" FontSize="15" MinWidth="1000" Binding="{Binding REMARK}" CellStyle="{StaticResource CellStyle}" IsReadOnly="False"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<Button Content="确认" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,140,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="confirm"/>
|
|
||||||
<Button Content="打印" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,55,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="print" IsTabStop="False" Focusable ="False"/>
|
|
||||||
<Button Content="保存" 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 Content="删除" 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 Height="255" Margin="410,35,5,0" VerticalAlignment="Top" Background="#FFF7F7F7">
|
|
||||||
|
|
||||||
|
<Button x:Name="Confirm" Content="确认" IsEnabled="False" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,140,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="confirm" Grid.Column="1"/>
|
||||||
|
<Button x:Name="Print" Content="打印" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,55,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="print" IsTabStop="False" Focusable ="False" Grid.Column="1"/>
|
||||||
|
<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"/>
|
||||||
|
|
||||||
|
<Grid Grid.Column="1" Height="325" Margin="415,35,5,0" VerticalAlignment="Top" Background="White">
|
||||||
|
<ContentControl x:Name="Deputy"/>
|
||||||
|
</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>
|
</Grid>
|
||||||
|
|||||||
+939
-43
File diff suppressed because it is too large.
Load diff
@@ -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;
|
||||||
|
|
||||||
@@ -10,9 +8,9 @@ using System.Windows;
|
|||||||
[assembly: AssemblyTitle("formula_manage")]
|
[assembly: AssemblyTitle("formula_manage")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("SUNLIGHT")]
|
||||||
[assembly: AssemblyProduct("formula_manage")]
|
[assembly: AssemblyProduct("formula_manage")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
[assembly: AssemblyCopyright("SUNLIGHT © 2023")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
|||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace formula_manage.SQLModels
|
||||||
|
{
|
||||||
|
// internal class STUFF_Product
|
||||||
|
//{
|
||||||
|
// }
|
||||||
|
|
||||||
|
public partial class Product
|
||||||
|
{
|
||||||
|
public string ProductCode { get; set; }
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
public Nullable<int> ProductType { get; set; }
|
||||||
|
public Nullable<int> ProductClass { get; set; }
|
||||||
|
public Nullable<int> Color { get; set; }
|
||||||
|
public string ProductLot { get; set; }
|
||||||
|
public Nullable<double> FullWeight { get; set; }
|
||||||
|
public Nullable<int> ProductUnit { get; set; }
|
||||||
|
public Nullable<double> SafetyStock { get; set; }
|
||||||
|
public Nullable<double> Price { get; set; }
|
||||||
|
public Nullable<double> CurrentStock { get; set; }
|
||||||
|
public Nullable<double> Deduct { get; set; }
|
||||||
|
public Nullable<System.DateTime> RplDate { get; set; }
|
||||||
|
public Nullable<System.DateTime> UsedDate { get; set; }
|
||||||
|
public string CuMonth { get; set; }
|
||||||
|
public Nullable<double> LaStock { get; set; }
|
||||||
|
public Nullable<double> ThStock { get; set; }
|
||||||
|
public Nullable<double> ThUsed { get; set; }
|
||||||
|
public Nullable<int> LampPosition { get; set; }
|
||||||
|
public string TablePosition { get; set; }
|
||||||
|
public string Area { get; set; }
|
||||||
|
public Nullable<double> Concentration { get; set; }
|
||||||
|
public string Batch_NO { get; set; }
|
||||||
|
public string SUPPLIER { get; set; }
|
||||||
|
public double GRAVITY { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 实时更新datagrid
|
||||||
|
/// 调用示例:DataGridHelper.SetRealTimeCommit(Grid, true); Grid为对象控件名
|
||||||
|
/// </summary>
|
||||||
|
public static class DataGridHelper
|
||||||
|
{
|
||||||
|
public static void SetRealTimeCommit(DataGrid dataGrid, bool isRealTime)
|
||||||
|
{
|
||||||
|
dataGrid.SetValue(RealTimeCommitProperty, isRealTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetRealTimeCommit(DataGrid dataGrid)
|
||||||
|
{
|
||||||
|
return (bool)dataGrid.GetValue(RealTimeCommitProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty RealTimeCommitProperty =
|
||||||
|
DependencyProperty.RegisterAttached("RealTimeCommit", typeof(bool),
|
||||||
|
typeof(DataGridHelper),
|
||||||
|
new PropertyMetadata(false, RealTimeCommitCallBack));
|
||||||
|
|
||||||
|
private static void RealTimeCommitCallBack(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var dg = d as DataGrid;
|
||||||
|
if (dg == null)
|
||||||
|
return;
|
||||||
|
EventHandler<DataGridCellEditEndingEventArgs> ceHandler = delegate (object xx, DataGridCellEditEndingEventArgs yy)
|
||||||
|
{
|
||||||
|
var flag = GetRealTimeCommit(dg);
|
||||||
|
if (!flag)
|
||||||
|
return;
|
||||||
|
var cellContent = yy.Column.GetCellContent(yy.Row);
|
||||||
|
if (cellContent != null && cellContent.BindingGroup != null)
|
||||||
|
cellContent.BindingGroup.CommitEdit();
|
||||||
|
};
|
||||||
|
dg.CellEditEnding += ceHandler;
|
||||||
|
RoutedEventHandler eh = null;
|
||||||
|
eh = (xx, yy) =>
|
||||||
|
{
|
||||||
|
dg.Unloaded -= eh;
|
||||||
|
dg.CellEditEnding -= ceHandler;
|
||||||
|
};
|
||||||
|
dg.Unloaded += eh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
internal class DataTableToObservableCollection //数据表到可观察集合
|
||||||
|
{
|
||||||
|
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing.Printing;
|
||||||
|
using System.Management;
|
||||||
|
using System.Printing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace formula_manage.UserClass
|
||||||
|
{
|
||||||
|
internal class UserPrint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 判断是否连接打印机
|
||||||
|
/// </summary>
|
||||||
|
public bool CheckPrinter()
|
||||||
|
{
|
||||||
|
//取得默认打印机名
|
||||||
|
PrintDocument pdoc = new PrintDocument();
|
||||||
|
string printerName1 = pdoc.PrinterSettings.PrinterName;
|
||||||
|
|
||||||
|
//ManagementScope scope = new ManagementScope(@"\root\cimv2");
|
||||||
|
//scope.Connect();
|
||||||
|
|
||||||
|
// Select Printers from WMI Object Collections
|
||||||
|
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Printer");
|
||||||
|
|
||||||
|
string printerName = "";
|
||||||
|
foreach (ManagementObject printer in searcher.Get())
|
||||||
|
{
|
||||||
|
printerName = printer["Name"].ToString().ToLower();
|
||||||
|
if (printerName.IndexOf(printerName1.ToLower()) > -1)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (printer["WorkOffline"].ToString().ToLower().Equals("true"))
|
||||||
|
{
|
||||||
|
switch (MessageBox.Show("默认打印机未连接或出错", "警告", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error))
|
||||||
|
{
|
||||||
|
case DialogResult.Retry:
|
||||||
|
CheckPrinter();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
// printer is offline by user
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// printer is not offline
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (MessageBox.Show("默认打印机未连接或出错", "警告", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error))
|
||||||
|
{
|
||||||
|
case DialogResult.Retry:
|
||||||
|
CheckPrinter();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断打印机状态,传Exception
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ex">Exception</param>
|
||||||
|
public void ErrerPrint(Exception ex)
|
||||||
|
{
|
||||||
|
PrintQueue pq = LocalPrintServer.GetDefaultPrintQueue();
|
||||||
|
string PrintStaticText = "";
|
||||||
|
bool isPrintErrer = false;
|
||||||
|
|
||||||
|
|
||||||
|
switch (pq.QueueStatus)
|
||||||
|
{
|
||||||
|
case PrintQueueStatus.Busy:
|
||||||
|
PrintStaticText = "打印机正忙";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.DoorOpen:
|
||||||
|
PrintStaticText = "打印机上的门已打开";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.Error:
|
||||||
|
PrintStaticText = "由于错误情况,打印机无法打印。";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.IOActive:
|
||||||
|
PrintStaticText = "打印机正在与打印服务器交换数据";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.Initializing:
|
||||||
|
PrintStaticText = "打印机正在初始化";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.ManualFeed:
|
||||||
|
PrintStaticText = "打印机正在等待用户将打印介质放入手动送纸盒";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.NoToner:
|
||||||
|
PrintStaticText = "打印机墨粉用完";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.None:
|
||||||
|
PrintStaticText = "未指定状态。";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.NotAvailable:
|
||||||
|
PrintStaticText = "状态信息不可用";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.Offline:
|
||||||
|
PrintStaticText = "打印机处于脱机状态。";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.OutOfMemory:
|
||||||
|
PrintStaticText = "打印机无可用内存";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.OutputBinFull:
|
||||||
|
PrintStaticText = "打印机的输出纸盒已满";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.PagePunt:
|
||||||
|
PrintStaticText = "打印机不能打印当前页";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.PaperJam:
|
||||||
|
PrintStaticText = "打印机卡纸";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.PaperOut:
|
||||||
|
PrintStaticText = "打印机中没有或已用完当前打印作业所需的纸张类型";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.PaperProblem:
|
||||||
|
PrintStaticText = "打印机中的纸张导致未指定的错误情况";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.Paused:
|
||||||
|
PrintStaticText = "打印队列已暂停";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.PendingDeletion:
|
||||||
|
PrintStaticText = "打印队列正在删除打印作业";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.PowerSave:
|
||||||
|
PrintStaticText = "打印机处于节能模式";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.Printing:
|
||||||
|
PrintStaticText = "设备正在打印";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.Processing:
|
||||||
|
PrintStaticText = "设备正在执行某种工作,如果此设备是集打印机、传真机和扫描仪于一体的多功能设备,则不需要打印";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.ServerUnknown:
|
||||||
|
PrintStaticText = "打印机处于错误状态";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.TonerLow:
|
||||||
|
PrintStaticText = "打印机中只剩下少量墨粉";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.UserIntervention:
|
||||||
|
PrintStaticText = "打印机要求通过用户操作来更正错误情况";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.Waiting:
|
||||||
|
PrintStaticText = "打印机正在等待打印作业";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
case PrintQueueStatus.WarmingUp:
|
||||||
|
PrintStaticText = "打印机正在预热";
|
||||||
|
isPrintErrer = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPrintErrer)
|
||||||
|
{
|
||||||
|
//WriteLog.SetString(PrintStaticText);
|
||||||
|
MessageBox.Show(PrintStaticText, "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
if (ex.Message == "The net printer is unavailable.")
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
MessageBox.Show("网络打印机不可用", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
// WriteLog.SetString(ex.Message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// WriteLog.SetException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<UserControl x:Class="formula_manage.View.Formula"
|
||||||
|
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">
|
||||||
|
<Grid>
|
||||||
|
<DataGrid x:Name="edit" AlternationCount="2" IsReadOnly="False"
|
||||||
|
Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=30}" 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="配方代码" 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="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="备注" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace formula_manage.View
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Formula.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class Formula : UserControl
|
||||||
|
{
|
||||||
|
public Formula()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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); //传入数组
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<UserControl x:Class="formula_manage.View.ViewProcess"
|
||||||
|
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">
|
||||||
|
<Grid>
|
||||||
|
<DataGrid x:Name="Technology" AlternationCount="2" IsReadOnly="True" MouseDoubleClick="DataGrid_Technology"
|
||||||
|
HeadersVisibility ="Column" Margin="0,0,0,0" 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 Binding="{Binding PROC_CODE}" Header="工艺代码" Width="100" 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 Binding="{Binding PROC_STEP}" Header="步数" Width="50" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Binding="{Binding PROC_FABRIC}" Header="布种" Width="100" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Binding="{Binding PROC_PRODUCT}" Header="品名" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Binding="{Binding REMARK}" Header="备注" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace formula_manage.View
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ViewProcess.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
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周期执行事件
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,323 @@
|
|||||||
|
using formula_manage.UserClass;
|
||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
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 MainWindowViewModel : 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 cdk_time; //注册到期时间
|
||||||
|
public string cdk_page = "Hidden"; //注册到期页面状态
|
||||||
|
public string cdk_pageT; //注册到期页面关闭时间
|
||||||
|
int cdk_pageT_T = -1;////注册到期页面关闭时间计算
|
||||||
|
|
||||||
|
public string Sys_Time //通知UI控件参数改变
|
||||||
|
{
|
||||||
|
get { return 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_SQLNAME;
|
||||||
|
string TEXT_SQMOD;
|
||||||
|
string TEXT_SQLUSER;
|
||||||
|
string TEXT_SQLPASWOR;
|
||||||
|
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_()
|
||||||
|
{
|
||||||
|
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");
|
||||||
|
SN_ID = Configini.IniReadvalue("SN", "SN2");
|
||||||
|
SN_KEY = Configini.IniReadvalue("SN", "SN1");
|
||||||
|
|
||||||
|
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 [dbo].[PRODUCT] order by ProductCode asc";//查询STUFF语句
|
||||||
|
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 [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("请求信息失败");
|
||||||
|
UserClass.LogGing.LogGingDATA("DISPENLINK = ConnectFailed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainWindowViewModel()
|
||||||
|
{
|
||||||
|
CountDown();
|
||||||
|
Sql_();
|
||||||
|
|
||||||
|
CDkey_();
|
||||||
|
|
||||||
|
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 timer1s = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromSeconds(1)
|
||||||
|
};
|
||||||
|
timer1s.Tick += Tick_Event_1S;
|
||||||
|
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.Interval = new TimeSpan(10000000); //时间间隔为一秒。
|
||||||
|
// disTimer.Start();//计时开始
|
||||||
|
}
|
||||||
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||||
|
{
|
||||||
|
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_();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using CommonServiceLocator;
|
||||||
|
using GalaSoft.MvvmLight.Ioc;
|
||||||
|
|
||||||
|
namespace formula_manage.ViewModel
|
||||||
|
{
|
||||||
|
public class ViewModelLocator
|
||||||
|
{
|
||||||
|
public ViewModelLocator()
|
||||||
|
{
|
||||||
|
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
||||||
|
|
||||||
|
////if (ViewModelBase.IsInDesignModeStatic)
|
||||||
|
////{
|
||||||
|
//// // Create design time view services and models
|
||||||
|
//// SimpleIoc.Default.Register<IDataService, DesignDataService>();
|
||||||
|
////}
|
||||||
|
////else
|
||||||
|
////{
|
||||||
|
//// // Create run time view services and models
|
||||||
|
//// SimpleIoc.Default.Register<IDataService, DataService>();
|
||||||
|
////}
|
||||||
|
|
||||||
|
SimpleIoc.Default.Register<MainWindowViewModel>();
|
||||||
|
SimpleIoc.Default.Register<RECIPEViewModel>();
|
||||||
|
SimpleIoc.Default.Register<ExchangeViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainWindowViewModel Main
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ServiceLocator.Current.GetInstance<MainWindowViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RECIPEViewModel Recipev
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ServiceLocator.Current.GetInstance<RECIPEViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ExchangeViewModel Exchange
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ServiceLocator.Current.GetInstance<ExchangeViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
-4
@@ -7,13 +7,32 @@
|
|||||||
mc:Ignorable="d" Loaded="Window_SET" BorderBrush="White" Background="#FFEFEFEF"
|
mc:Ignorable="d" Loaded="Window_SET" BorderBrush="White" Background="#FFEFEFEF"
|
||||||
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_PRINT" Height="19" Margin="15,35,605,0" VerticalAlignment="Top" Content="确认立即打印料单" IsTabStop="False" Checked="Login_PRINT_Checked" Unchecked="Login_PRINT_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_anew" Height="19" Margin="15,55,605,0" VerticalAlignment="Top" Content="单号相同时重染号修改" IsTabStop="False" Checked="Login_anew_Checked" Unchecked="Login_anew_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_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_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="20" Margin="10,220,0,0" TextWrapping="Wrap" Text="料单号前缀" VerticalAlignment="Top" Width="75" FontSize="14"/>
|
<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"/>
|
||||||
<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"/>
|
||||||
|
<TextBox x:Name="TimeFormat" HorizontalAlignment="Left" Height="20" Margin="85,250,0,0" TextWrapping="Wrap" Text="yyyyMMddHHmmss" VerticalAlignment="Top" Width="125"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="10,280,0,0" TextWrapping="Wrap" Text="排序格式" VerticalAlignment="Top" Width="75" FontSize="14"/>
|
||||||
|
<TextBox x:Name="Order" HorizontalAlignment="Left" Height="20" Margin="85,280,0,0" TextWrapping="Wrap" Text="0001" VerticalAlignment="Top" Width="125"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="10,310,0,0" TextWrapping="Wrap" Text="常用重量" VerticalAlignment="Top" Width="75" FontSize="14"/>
|
||||||
|
<TextBox x:Name="Weight" HorizontalAlignment="Left" Height="20" Margin="85,310,0,0" TextWrapping="Wrap" Text="0000" VerticalAlignment="Top" Width="125"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="20" Margin="10,340,0,0" TextWrapping="Wrap" Text="常用浴比" VerticalAlignment="Top" Width="75" FontSize="14"/>
|
||||||
|
<TextBox x:Name="Proportion" HorizontalAlignment="Left" Height="20" Margin="85,340,0,0" TextWrapping="Wrap" Text="0000" VerticalAlignment="Top" Width="125"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
+44
-16
@@ -1,16 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
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
|
||||||
{
|
{
|
||||||
@@ -27,34 +17,72 @@ namespace formula_manage.Windows
|
|||||||
}
|
}
|
||||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
|
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") + "]:";
|
||||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
||||||
{
|
{
|
||||||
|
MessageBoxResult result = System.Windows.MessageBox.Show("设置完成后请重启程序", "提示", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel);
|
||||||
|
|
||||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " L1", Loginlink.ToString());
|
Configini.IniWritevalue("SOFTWARE_SET", " L1", Loginlink.ToString());
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " L2", Loginprint.ToString());
|
Configini.IniWritevalue("SOFTWARE_SET", " L2", Loginprint.ToString());
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " L3",Prepose.Text);
|
Configini.IniWritevalue("SOFTWARE_SET", " L3", Loginanew.ToString());
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " L4", Loginanew.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", " T2", TimeFormat.Text);
|
||||||
|
Configini.IniWritevalue("SOFTWARE_SET", " T3", Order.Text);
|
||||||
|
Configini.IniWritevalue("SOFTWARE_SET", " T4", Weight.Text);
|
||||||
|
Configini.IniWritevalue("SOFTWARE_SET", " T5", Proportion.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 + "FORMULA_SET:INIFile_Write");
|
||||||
|
wr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Loginlink;
|
bool Loginlink;
|
||||||
bool Loginprint;
|
bool Loginprint;
|
||||||
bool Loginanew;
|
bool Loginanew;
|
||||||
|
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")); //是否立即打印料单
|
||||||
Prepose.Text = Configini.IniReadvalue("SOFTWARE_SET", "L3"); //自定义料单前缀
|
Login_anew.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L3")); //是否立即打印料单
|
||||||
Login_anew.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"); //自定义料单前缀
|
||||||
|
TimeFormat.Text = Configini.IniReadvalue("SOFTWARE_SET", "T2"); //自定义料单时间格式
|
||||||
|
Order.Text = Configini.IniReadvalue("SOFTWARE_SET", "T3"); //自定义料单排序
|
||||||
|
Weight.Text = Configini.IniReadvalue("SOFTWARE_SET", "T4"); //自定义
|
||||||
|
Proportion.Text = Configini.IniReadvalue("SOFTWARE_SET", "T5"); //自定义
|
||||||
}
|
}
|
||||||
private void Login_LINK_Checked(object sender, RoutedEventArgs e)
|
private void Login_LINK_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
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)
|
||||||
|
{
|
||||||
|
LoginMAC = Login_MACHINE.IsChecked.GetValueOrDefault(); //是否
|
||||||
|
}
|
||||||
|
|
||||||
private void Login_PRINT_Checked(object sender, RoutedEventArgs e)
|
private void Login_PRINT_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Loginprint = Login_PRINT.IsChecked.GetValueOrDefault(); //是否立即打印料单
|
Loginprint = Login_PRINT.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
<Window x:Class="formula_manage.Windows.Dissolve"
|
||||||
|
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="Dissolve_Loaded"
|
||||||
|
Title="Dissolve_SET" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
|
||||||
|
BorderBrush="White" Background="#FFE0E0E0">
|
||||||
|
<Window.Resources>
|
||||||
|
<!--引入转换器-->
|
||||||
|
<ConvertMoels:IonSQLConvert x:Key="IonSQLConvert"/>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<!--设备表-->
|
||||||
|
<DataGrid x:Name="DatagridDissolve" MouseDoubleClick="Dissolve_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 DissolveCode}" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="溶解流程名称" Binding="{Binding DissolveName}" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="用途" Width="130" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="Text" Value="{Binding MaterialType, Converter={StaticResource IonSQLConvert}}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="最小量(g)" Binding="{Binding WeightMIN}" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="最大量(g)" Binding="{Binding WeightMAX}" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="备注" Binding="{Binding REMARK}" Width="600" FontSize="15" 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="min" HorizontalAlignment="Left" Height="30" Margin="460,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="390,0,0,100" TextWrapping="Wrap" Text="最小(g)"
|
||||||
|
VerticalAlignment="Bottom" Width="80" FontSize="20"/>
|
||||||
|
<!--最大-->
|
||||||
|
<TextBox x:Name="max" HorizontalAlignment="Left" Height="30" Margin="640,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="565,0,0,100" TextWrapping="Wrap" Text="最大(g)"
|
||||||
|
VerticalAlignment="Bottom" Width="80" FontSize="20"/>
|
||||||
|
<!--离子类型-->
|
||||||
|
<ComboBox x:Name="ion" HorizontalAlignment="Left" Height="30" Margin="65,0,0,50" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="120" FontSize="20" IsReadOnly="True" IsEditable="True">
|
||||||
|
<ComboBoxItem Content="分散"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="酸性"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="活性"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="中性"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="硫化"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="阳离子"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="阴离子"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="非离子"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="酞菁"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="直接"></ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="用途"
|
||||||
|
VerticalAlignment="Bottom" Width="50" 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>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
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>
|
||||||
|
/// Machine.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class Dissolve : Window
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
public Dissolve()
|
||||||
|
{
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Dissolve_Loaded(object sender, RoutedEventArgs e)//打开页面执行
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
this.DatagridDissolve.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(); //关闭连接
|
||||||
|
|
||||||
|
DatagridDissolve.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Dissolve_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
|
{
|
||||||
|
int rownum = DatagridDissolve.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
|
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.TrimEnd();//
|
||||||
|
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.TrimEnd();//
|
||||||
|
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.TrimEnd();//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 async 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;
|
||||||
|
|
||||||
|
if ((name.Text == "") || (Code.Text == ""))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请输入代码或名称");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((min.Text == "") || (max.Text == ""))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请确认最用量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (int.Parse(min.Text) > int.Parse(max.Text))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("用量错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ion.Text == "")
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请确认用途");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (ion.Text == "分散") int_ion = 0;
|
||||||
|
else if (ion.Text == "酸性") int_ion = 1;
|
||||||
|
else if (ion.Text == "活性") int_ion = 2;
|
||||||
|
else if (ion.Text == "中性") int_ion = 3;
|
||||||
|
else if (ion.Text == "硫化") int_ion = 4;
|
||||||
|
else if (ion.Text == "阳离子") int_ion = 5;
|
||||||
|
else if (ion.Text == "阴离子") int_ion = 6;
|
||||||
|
else if (ion.Text == "非离子") int_ion = 7;
|
||||||
|
else if (ion.Text == "酞菁") int_ion = 8;
|
||||||
|
else if (ion.Text == "直接") int_ion = 9;
|
||||||
|
|
||||||
|
if (Code.Text != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
Dissolve_sql = "SELECT count(*) FROM [dbo].[Dissolve] WHERE DissolveCode = '" + Code.Text + " '";//查询语句
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
|
SqlCommand cmd = new SqlCommand(Dissolve_sql, conn_SC); //查询记录数
|
||||||
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
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 + "')");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_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
|
||||||
|
{
|
||||||
|
Dissolve_sql = string.Format("UPDATE [dbo].[Dissolve] SET DissolveName ='" + name.Text + "',REMARK='" + Remark.Text + "',MaterialType='" + int_ion + "',WeightMIN='" + min.Text + "',WeightMAX='" + max.Text + "' Where DissolveCode ='" + Code.Text + "'");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_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("修改完成");//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
<Window x:Class="formula_manage.Windows.Machine"
|
||||||
|
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="MAC_Loaded"
|
||||||
|
Title="MAC_SET" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
|
||||||
|
BorderBrush="White" Background="#FFE0E0E0">
|
||||||
|
<Window.Resources>
|
||||||
|
<!--引入转换器-->
|
||||||
|
<ConvertMoels:CategoriesSQLConvert x:Key="CategoriesSQLConvert"/>
|
||||||
|
<ConvertMoels:IndustrySQLConvert x:Key="IndustrySQLConvert"/>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<!--设备表-->
|
||||||
|
<DataGrid x:Name="DataGridMac" MouseDoubleClick="DataGridMac_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 Name}" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="机组" Binding="{Binding MacGroup}" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="载量(KG)" Binding="{Binding Capacity}" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="容量(L)" Binding="{Binding Volume}" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="染色方式" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False">
|
||||||
|
<!--事件名称:方式类型数字转文字显示,转换器IndustrySQLConvert-->
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="Text" Value="{Binding Industry, Converter={StaticResource IndustrySQLConvert}}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="类型" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False">
|
||||||
|
<!--事件名称:类型类型数字转文字显示,转换器IndustrySQLConvert-->
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="Text" Value="{Binding Categories, Converter={StaticResource CategoriesSQLConvert}}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="备注" Binding="{Binding Note}" Width="600" FontSize="15" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<!--机台名-->
|
||||||
|
<TextBox x:Name="mac_Name" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="22" MaxLines="1" MaxLength="50" />
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="机台名称"
|
||||||
|
VerticalAlignment="Bottom" Width="85" FontSize="20"/>
|
||||||
|
<!--机组-->
|
||||||
|
<TextBox x:Name="mac_MacGroup" HorizontalAlignment="Left" Height="30" Margin="275,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="22" MaxLines="1" MaxLength="50"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="225,0,0,100" TextWrapping="Wrap" Text="机组"
|
||||||
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
|
<!--染色方式-->
|
||||||
|
<ComboBox x:Name="mac_Industry" HorizontalAlignment="Left" Height="30" Margin="435,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20" IsReadOnly="True" IsEditable="True">
|
||||||
|
<ComboBoxItem Content="浸染"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="连染"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="印染"></ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="390,0,0,100" TextWrapping="Wrap" Text="方式"
|
||||||
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
|
<!--类型-->
|
||||||
|
<ComboBox x:Name="mac_Categories" HorizontalAlignment="Left" Height="30" Margin="600,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20" IsReadOnly="True" IsEditable="True">
|
||||||
|
<ComboBoxItem Content="溢流"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="气流"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="轧染"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="卷染"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="喷染"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="筒纱"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="成衣"></ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="550,0,0,100" TextWrapping="Wrap" Text="类型"
|
||||||
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
|
<!--载量-->
|
||||||
|
<TextBox x:Name="mac_Capacity" HorizontalAlignment="Left" Height="30" Margin="105,0,0,50" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="载量"
|
||||||
|
VerticalAlignment="Bottom" Width="80" FontSize="20"/>
|
||||||
|
<!--容量-->
|
||||||
|
<TextBox x:Name="mac_Volume" HorizontalAlignment="Left" Height="30" Margin="275,0,0,50" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="225,0,0,50" TextWrapping="Wrap" Text="容量"
|
||||||
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
|
<!--备注-->
|
||||||
|
<TextBox x:Name="mac_Note" HorizontalAlignment="Left" Height="30" Margin="435,0,0,50"
|
||||||
|
VerticalAlignment="Bottom" Width="265" FontSize="22" MaxLines="1"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="390,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,246 @@
|
|||||||
|
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>
|
||||||
|
/// Machine.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class Machine : Window
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
public Machine()
|
||||||
|
{
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void MAC_Loaded(object sender, RoutedEventArgs e)//打开页面执行
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
this.DataGridMac.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 MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [dbo].[MACHINE]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter Stuff_data = new SqlDataAdapter(MAC_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
DataTable dataTable = new DataTable(); //建立缓存
|
||||||
|
Stuff_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
DataGridMac.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
DataGridMac.DisplayMemberPath = "Name";
|
||||||
|
}
|
||||||
|
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 MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [dbo].[MACHINE]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter Stuff_data = new SqlDataAdapter(MAC_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
DataTable dataTable = new DataTable(); //建立缓存
|
||||||
|
Stuff_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
DataGridMac.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 DataGridMac_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
|
{
|
||||||
|
int rownum = DataGridMac.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
|
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.TrimEnd();//
|
||||||
|
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.TrimEnd();//
|
||||||
|
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.TrimEnd();//
|
||||||
|
mac_Note.Text = (DataGridMac.Columns[7].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async 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 Mac_name = mac_Name.Text;
|
||||||
|
string Mac_group = mac_MacGroup.Text;
|
||||||
|
string Mac_capacity = mac_Capacity.Text;
|
||||||
|
string Mac_volume = mac_Volume.Text;
|
||||||
|
string Mac_industry = mac_Industry.Text;
|
||||||
|
string Mac_categories = mac_Categories.Text;
|
||||||
|
string Mac_note = mac_Note.Text;
|
||||||
|
string MAC_sql;
|
||||||
|
|
||||||
|
if (Mac_industry == "浸染") Mac_industry = "0";
|
||||||
|
else if (Mac_industry == "连染") Mac_industry = "1";
|
||||||
|
else if (Mac_industry == "印染") Mac_industry = "2";
|
||||||
|
|
||||||
|
if (Mac_categories == "溢流") Mac_categories = "0";
|
||||||
|
else if (Mac_categories == "气流") Mac_categories = "1";
|
||||||
|
else if (Mac_categories == "轧染") Mac_categories = "2";
|
||||||
|
else if (Mac_categories == "卷染") Mac_categories = "3";
|
||||||
|
else if (Mac_categories == "喷染") Mac_categories = "4";
|
||||||
|
else if (Mac_categories == "筒纱") Mac_categories = "5";
|
||||||
|
else if (Mac_categories == "成衣") Mac_categories = "6";
|
||||||
|
|
||||||
|
if (Mac_capacity == "") Mac_capacity = "NULL";
|
||||||
|
if (Mac_volume == "") Mac_volume = "NULL";
|
||||||
|
if (Mac_industry == "") Mac_industry = "NULL";
|
||||||
|
if (Mac_categories == "") Mac_categories = "NULL";
|
||||||
|
|
||||||
|
if (mac_Name.Text != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
MAC_sql = "SELECT count(*) FROM [dbo].[MACHINE] WHERE Name = '" + Mac_name + " '";//查询语句
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
|
SqlCommand cmd = new SqlCommand(MAC_sql, conn_SC); //查询记录数
|
||||||
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
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 + "')");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(MAC_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
|
||||||
|
{
|
||||||
|
MAC_sql = string.Format("UPDATE [dbo].[MACHINE] SET MacGroup ='" + Mac_group + "',Capacity=" + Mac_capacity + " ,Volume=" + Mac_volume + " ,Industry=" + Mac_industry + " ,Categories=" + Mac_categories + " ,Note='" + Mac_note + "' Where Name ='" + Mac_name + "'");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(MAC_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("修改完成");//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
||||||
|
{
|
||||||
|
string Mac_name = "是否删除【" + this.mac_Name.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].[MACHINE] WHERE Name ='" + mac_Name.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
Loaded 100 of 113 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user