Compare commits

..
118 Commits
Author SHA1 Message Date
sc ed61970ffa Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-07-03 23:48:58 +08:00
sc 192d8c7841 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-07-03 23:48:56 +08:00
sc 529aa29677 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-07-01 00:27:52 +08:00
sc 8a383bf4d1 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-07-01 00:27:49 +08:00
sc fb65c392c8 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-30 13:36:42 +08:00
sc bbf2871230 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-30 13:36:40 +08:00
sc 37bcbd8aea Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-30 10:58:14 +08:00
sc ce0f43a583 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-30 10:58:10 +08:00
sc 1c925c5c95 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 23:29:12 +08:00
sc c49ac6c885 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 23:29:10 +08:00
sc de56564372 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 23:20:38 +08:00
sc 83a38deaa6 mvvm模式升级从 packages.config 迁移到 PackageReference 2024-06-29 23:20:36 +08:00
sc 9ff4a7d035 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 23:10:54 +08:00
sc ec9eaedc64 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 23:10:53 +08:00
sc 6adc2ae527 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 23:05:55 +08:00
sc cb6facf0d4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 23:05:53 +08:00
sc 827e9cc387 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 22:56:13 +08:00
sc f57cb897fb Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 22:56:11 +08:00
sc 9fcb61fa52 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 22:46:37 +08:00
sc 0f0f2bfb30 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 22:46:35 +08:00
sc 8515d2b100 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 21:56:29 +08:00
sc 86ae16fa94 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 21:56:26 +08:00
sc f58bd85164 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-29 00:00:35 +08:00
sc 85bcc41e58 注册码显示逻辑修改 2024-06-29 00:00:33 +08:00
sc 9580a0f60c Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-28 22:07:43 +08:00
sc 280062d86c 修改tcp的ip选择逻辑 2024-06-28 22:07:41 +08:00
sc 959392786e Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-27 23:19:58 +08:00
sc df7bc3bae6 修改网络信息获取方式 2024-06-27 23:19:57 +08:00
sc edd40f136d Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-27 23:15:46 +08:00
sc dc4dfecf15 去除无效变量 2024-06-27 23:15:45 +08:00
sc 03f77e45c9 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-27 23:13:38 +08:00
sc bc0c921d85 去除无效变量 2024-06-27 23:13:35 +08:00
sc 36af454eff Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-27 23:09:30 +08:00
sc 5474b42e7e 关闭程序逻辑bug处理 2024-06-27 23:09:28 +08:00
sc 3ea5a91776 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-27 23:01:24 +08:00
sc 6a706ea804 修改日志文件函数调用逻辑 2024-06-27 23:01:22 +08:00
sc e96e537d5e Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-27 00:14:14 +08:00
sc 53fd4909ee Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-27 00:14:13 +08:00
sc 31ba1bad4c Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-26 22:49:49 +08:00
sc adb98a0f46 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-26 22:49:46 +08:00
sc c1712f1368 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-25 22:42:23 +08:00
sc deb1e1bbe9 tcp 2024-06-25 22:42:21 +08:00
sc b6f3533709 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-25 21:01:34 +08:00
sc 785bacc182 添加tcp&udp 2024-06-25 21:01:31 +08:00
sc 263bb90b3d Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-25 11:27:53 +08:00
sc 2c1d2c0e5f Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-25 11:27:38 +08:00
sc 0328ddfcd6 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-24 15:32:55 +08:00
sc 81e335fc62 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-24 15:32:52 +08:00
sc 1b6777f8ad Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-19 23:34:51 +08:00
sc d3a021dcf0 许可证安全检查逻辑调整 2024-06-19 23:34:48 +08:00
sc 5c929d8cc9 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-06-12 09:26:38 +08:00
sc 8530d3d750 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-06-12 09:26:35 +08:00
sc 6c18a79a7b Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-20 23:24:45 +08:00
sc 3bffc936be Exchange页面完成 2024-05-20 23:24:44 +08:00
sc fc217d6448 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-20 20:49:24 +08:00
sc dd6bb40912 LOG日志修改 2024-05-20 20:49:22 +08:00
sc 85028a60bc Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-05-20 17:37:26 +08:00
sc 9f89693f97 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-05-20 17:37:25 +08:00
sc d8c9c8111c Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-05-20 16:27:52 +08:00
sc 0c3fa8fd24 添加转换日志查询 2024-05-20 16:27:49 +08:00
sc f39cfd5cbd Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-05-20 15:45:38 +08:00
sc aa1b08f6c4 EX添加日志记录 2024-05-20 15:45:35 +08:00
sc fda9b5210a Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-05-20 14:25:38 +08:00
sc 1ef3b73f5a 添加登录页面工作日志 2024-05-20 14:25:37 +08:00
sc abc214763c Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-05-20 14:24:31 +08:00
sc efb99dcf3f 添加登录页面工作日志 2024-05-20 14:24:27 +08:00
sc baee6c4a5f Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-05-20 14:04:44 +08:00
sc 2b50338365 添加报错记录 2024-05-20 14:04:41 +08:00
sc 57549329fe Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-05-18 17:31:33 +08:00
sc d59701122e 打印设置页面完成 2024-05-18 17:31:31 +08:00
sc cd1b5f6fb4 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-06 23:28:31 +08:00
sc ce4835ad11 添加表单选择 2024-05-06 23:28:29 +08:00
sc f2e356f8a2 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-06 19:21:48 +08:00
sc e70c0d3da2 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-06 19:21:45 +08:00
sc de1f6970e7 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-05-06 14:20:51 +08:00
sc 457eb5121a Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-06 14:20:49 +08:00
sc e12a692dce Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-05 00:04:38 +08:00
sc 7b5fed19c0 添加模板增减 2024-05-05 00:04:36 +08:00
sc 9ff4b10ed9 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-04 15:02:10 +08:00
sc 07e660a317 填加打印模板预览 2024-05-04 15:02:08 +08:00
sc 9551a3145e Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-04 14:07:22 +08:00
sc 502d657a0f Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-04 14:07:20 +08:00
sc d1921ced6c Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-03 23:19:14 +08:00
sc 1754131d54 打印模板选择修改 2024-05-03 23:19:12 +08:00
sc 5a7dee6b48 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-03 23:04:44 +08:00
sc 926b15bd4d Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-03 23:04:42 +08:00
sc 14bd70ce48 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-03 19:09:41 +08:00
sc 30e742f33a FASTREPORT语言包 2024-05-03 19:09:39 +08:00
sc 872e179104 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-03 19:00:36 +08:00
sc 4e0e102381 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-03 19:00:34 +08:00
sc c21d5df123 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-03 14:25:33 +08:00
sc 98ca46db07 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-05-03 14:25:25 +08:00
sc 2b274a6502 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-27 23:56:16 +08:00
sc d8276da446 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-27 23:56:14 +08:00
sc c8f7f01340 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-27 23:51:06 +08:00
sc 5a1df6c8c6 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-27 23:51:00 +08:00
sc cd632545bd Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-26 21:33:07 +08:00
sc fe5566f730 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-26 21:33:05 +08:00
sc d580eed74e Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-25 23:24:02 +08:00
sc 7567cce849 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-25 23:24:00 +08:00
sc 89cd7d3e6b Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-22 22:01:43 +08:00
sc ff58075e7b Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-22 22:01:41 +08:00
sc e0bdc68e8e Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-18 17:09:58 +08:00
sc 8fc4999ccc 添加新单号清屏 2024-04-18 17:09:57 +08:00
sc 701c3abf26 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-18 16:13:17 +08:00
sc be7cfcdcaf 原料代码输入判定 2024-04-18 16:13:14 +08:00
sc 3b65c73608 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-18 15:39:38 +08:00
sc 3e7638a199 清楚后部输入空格 2024-04-18 15:39:37 +08:00
sc 57b2d5b356 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-18 15:30:36 +08:00
sc 6471eec033 目标重量换算问题修复 2024-04-18 15:30:34 +08:00
sc 3c41c2f150 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-18 14:47:23 +08:00
sc 7c3d3ecf3a 修改重复原料判断逻辑 2024-04-18 14:47:22 +08:00
sc ca2d99f28b Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-18 13:28:23 +08:00
sc 7ccfe7ba81 添加ex生效状态判断 2024-04-18 13:28:21 +08:00
sc 97c12e373b Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-15 21:59:20 +08:00
sc ca3156e314 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-15 21:59:18 +08:00
sc 41f15e168d Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-15 20:48:13 +08:00
sc 84ef66268e Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-15 20:48:11 +08:00
94 changed files with 50952 additions and 1166 deletions

No files matched your search

+78 -2
View File
@@ -1,18 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</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.5.0.0" newVersion="4.5.0.0" />
<bindingRedirect oldVersion="0.0.0.0-4.6.0.0" newVersion="4.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FastReport.Compat" publicKeyToken="406e1f4c3c8ef97e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2024.1.0.0" newVersion="2024.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FastReport.Compat" publicKeyToken="5ceb240df42bf6e8" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2024.2.2.0" newVersion="2024.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.7.0" newVersion="2.0.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetty.Transport" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetty.Buffers" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetty.Codecs.Http" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetty.Common" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetty.Codecs" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.7.6.0" newVersion="0.7.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.17.0" newVersion="2.0.17.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+50 -15
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using System.Windows;
namespace formula_manage
@@ -44,25 +40,64 @@ namespace formula_manage
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
if (e.Exception.InnerException == null)
{
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" + Environment.NewLine
// + "(2)错误源:" + e.Exception.Source + Environment.NewLine
+ "详细信息:" + e.Exception.Message + Environment.NewLine
// + "(4)报错区域:" + e.Exception.StackTrace
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!"
+ "(1)错误" + Environment.NewLine
+ "(2)错误源:" + e.Exception.Source + Environment.NewLine
// + (3)详细信息:" + e.Exception.Message + Environment.NewLine
// + "(4)报错区域:" + e.Exception.StackTrace
);
}
else
{
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" + Environment.NewLine
// + "(2)错误源:" + e.Exception.InnerException.Source + Environment.NewLine
+ "错误信息:" + e.Exception.Message + Environment.NewLine
// + "(4)详细信息:" + e.Exception.InnerException.Message + Environment.NewLine
// + "(5)报错区域:" + e.Exception.InnerException.StackTrace
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!"
+ "(1)错误" + Environment.NewLine
// + "(2)错误源:" + e.Exception.InnerException.Source + Environment.NewLine
+ "(3)错误信息:" + e.Exception.Message + Environment.NewLine
// + "(4)详细信息:" + e.Exception.InnerException.Message + Environment.NewLine
// + "(5)报错区域:" + e.Exception.InnerException.StackTrace
);
}
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>
-4
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace formula_manage.ConvertMoels
+4 -8
View File
@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace formula_manage.ConvertMoels
{
/// <summary>
/// <summary>
/// RGB色彩数值转换器
/// 将色彩数值转换为ARGB代码返回
/// </summary>
@@ -19,7 +15,7 @@ namespace formula_manage.ConvertMoels
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
{
string colorValue = string.Format("{0:X6}", value);//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0”
/*string StuffColor = "#FF" + colorValue;//RGB数值拼接为ARGB数值(正向)*/
string StuffColor_B = colorValue.Substring(0, 2);//获取蓝色参数
@@ -33,8 +29,8 @@ namespace formula_manage.ConvertMoels
return null;//返回空
}
}
/// <summary>
/// </summary>
/// <summary>
/// </summary>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
-4
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Audit.ConvertMoels
-4
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Audit.ConvertMoels
+2 -6
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace formula_manage.ConvertMoels
@@ -40,8 +36,8 @@ namespace formula_manage.ConvertMoels
}
}
}
/// <summary>
/// </summary>
/// <summary>
/// </summary>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
-4
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace formula_manage.ConvertMoels
-4
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace formula_manage.ConvertMoels
+1 -8
View File
@@ -1,12 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Controls;
/// <summary>
/// 运行状态变换器
@@ -40,7 +33,7 @@ namespace Audit.ConvertMoels
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
-7
View File
@@ -1,12 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Controls;
namespace Audit.ConvertMoels
{
+1 -5
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace formula_manage.ConvertMoels
@@ -37,7 +33,7 @@ namespace formula_manage.ConvertMoels
}
}
}
/// <summary>
/// </summary>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+6 -9
View File
@@ -5,18 +5,15 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.EX"
mc:Ignorable="d"
Title="ExProgram" Height="450" Width="800">
Title="ExProgram" Height="720" Width="1280" MinHeight="720" MinWidth="1280" Background="#FFE0E0E0">
<Grid>
<StackPanel HorizontalAlignment="Left" Height="145" Margin="132,124,0,0" VerticalAlignment="Top" Width="142">
<StackPanel Height="100" Width="131"/>
</StackPanel>
<RichTextBox Margin="0,300,0,0" IsReadOnly="True">
<RichTextBox x:Name="textLog" Margin="0,300,0,0" IsReadOnly="True" VerticalScrollBarVisibility="Visible" Background="White">
<FlowDocument>
<Paragraph>
<Run Text="LOG"/>
<Run Text="TEXTLOG"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
+2 -12
View File
@@ -1,16 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using formula_manage.UserClass;
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.EX
{
@@ -22,6 +11,7 @@ namespace formula_manage.EX
public ExProgram()
{
InitializeComponent();
LogDataRead.SetTextControl(textLog);
}
}
}
+34
View File
@@ -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>
+88
View File
@@ -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);
}
}
}
}
+12
View File
@@ -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>
+11
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
Want to create localization for your language? Please drop an email to tz@fast-report.com.
-7
View File
@@ -1,7 +0,0 @@
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="clr-namespace:formula_manage.Flow_Document"
ColumnWidth="400" FontSize="14" FontFamily="Georgia">
<Paragraph>
</Paragraph>
</FlowDocument>
+1 -13
View File
@@ -1,16 +1,4 @@
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.Windows;
namespace formula_manage
{
+2 -8
View File
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace formula_manage
namespace formula_manage
{
/// <summary>
/// 查询接口
@@ -12,6 +6,6 @@ namespace formula_manage
/// <typeparam name="T"></typeparam>
public interface IProvider<T> where T : class
{
}
}
+53 -65
View File
@@ -1,24 +1,11 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Runtime.InteropServices;
using System.Data.SqlClient;
using System.Data;
using System.Security.Policy;
using System.IO;
using formula_manage.Windows;
namespace formula_manage
{
@@ -27,41 +14,23 @@ namespace formula_manage
/// </summary>
public partial class Login : Window
{
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
DataTable logindataTable = new DataTable(); //建立login缓存
public Login()
public Login()
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
if (!File.Exists(logPath))//检查日志文件并写入启动日志
{
FileStream fs = new FileStream(logPath, FileMode.CreateNew, FileAccess.Write);//创建写入文件
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine(Log_time + "FORMULA_start");
wr.Close();
}
else
{
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine(Log_time + "FORMULA_start");
wr.Close();
}
UserClass.LogGing.LogGingDATA("FORMULA_start");
}
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) //登录按钮事件
@@ -83,18 +52,15 @@ namespace formula_manage
MainWindow Main = new MainWindow();
window.Close();
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine(Log_time + "LOGon_ENGINEER");
wr.Close();
UserClass.LogGing.LogGingDATA("LOGon = ENGINEER");
Main.ShowDialog();//实例化并置顶打开窗口
}
}
else
{
string var_sql;
string var_sql;
if (pasword =="") var_sql = "[UserCode]='" + user + "' and [PassWord] is null"; //查询字符
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
@@ -107,15 +73,12 @@ namespace formula_manage
MainWindow Main = new MainWindow();
window.Close();
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine(Log_time + "LOGon_" + user);
wr.Close();
UserClass.LogGing.LogGingDATA("LOGon = " + user);
Main.ShowDialog();//实例化并置顶打开窗口
}
else
System.Windows.MessageBox.Show("账号或密码错误");
System.Windows.MessageBox.Show("账号或密码错误");
}
}
@@ -150,26 +113,41 @@ namespace formula_manage
DBCLINK.Visibility = Visibility.Hidden;
EXLINK.Visibility = Visibility.Hidden;
USERLINK.Visibility = Visibility.Hidden;
DISPENLINK.Background = Brushes.Red;
DISPENLINK.Background = Brushes.Red;
}
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")))
{
EXLINK.Background = Brushes.Red;
System.Windows.MessageBox.Show("扩展程序未启动");
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_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");
SQL2 = Boolean.Parse(Configini.IniReadvalue("SQL_SERVER", "SQL6")); //数据库对象2是否生效
}
catch (Exception)
{
System.Windows.MessageBox.Show("配置信息丢失");
}
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");
SQL2 = Boolean.Parse(Configini.IniReadvalue("SQL_SERVER", "SQL6")); //数据库对象2是否生效
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
}
else
else
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
@@ -178,16 +156,20 @@ namespace formula_manage
try
{
await conn_SC.OpenAsync();
}catch (Exception)
await conn_SC.OpenAsync();
}
catch (Exception)
{
DISPENLINK.Background = Brushes.Red; //连接失败红色
DBCLINK.Background = Brushes.Red;
System.Windows.MessageBox.Show("连接数据库失败");
//Windows.Sql sql = new Windows.Sql();
//sql.ShowDialog();//实例化并置顶打开数据库设置窗口
UserClass.LogGing.LogGingDATA("DISPENLINK = ConnectFailed");
return;
}
}
conn_SC.Close(); //关闭连接
DISPENLINK.Background = Brushes.Green; //连接成功绿色
@@ -208,15 +190,19 @@ namespace formula_manage
}
SqlConnection conn_DBC = new SqlConnection(Connstr_DBC);
try
try
{
await conn_DBC.OpenAsync();
}catch (Exception)
}
catch (Exception)
{
DBCLINK.Background = Brushes.Red; //连接失败红色
System.Windows.MessageBox.Show("连接数据库失败");
//Windows.Sql sql = new Windows.Sql();
//sql.ShowDialog();//实例化并置顶打开数据库设置窗口
UserClass.LogGing.LogGingDATA("DBCLINK = ConnectFailed");
return;
}
DBCLINK.Background = Brushes.Green; //连接成功绿色
@@ -243,11 +229,13 @@ namespace formula_manage
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
UserClass.LogGing.LogGingDATA("USER = NoData");
return;
}
}
}
}
}
+14 -10
View File
@@ -24,9 +24,7 @@
<MenuItem Header="_备份/还原" FontSize="16" Name="_SQLBAK" Click="SQLBAK" IsEnabled="False"/>
<Separator/>
<MenuItem Header="_软件设置" FontSize="16" Name="_SOFTWARE_SET" Click="SOFTWARE_SET" IsEnabled="False"/>
<MenuItem Header="_转换设置" FontSize="16" Name="_EXCHANGE_SET" IsEnabled="False"/>
<MenuItem Header="_打印设置" FontSize="16" Name="_PRINT_SET" Click="PRINT_SET" IsEnabled="False"/>
<MenuItem Header="_用户设置" FontSize="16" Name="_USER_SET" Click="USER_SET" IsEnabled="False"/>
<MenuItem Header="_登录限制" FontSize="16" Name="_USER_log" IsEnabled="False"/>
</MenuItem>
<MenuItem Header="_管理" FontSize="16" Focusable ="False">
@@ -42,12 +40,18 @@
<MenuItem Header="_布种" FontSize="16" Name="_fabric" Click="fabric" IsEnabled="False"/>
<MenuItem Header="_颜色名" FontSize="16" Name="_color" Click="color" IsEnabled="False"/>
<MenuItem Header="_客户" FontSize="16" Name="_client" Click="client" IsEnabled="False"/>
<Separator />
<MenuItem Header="_用户设置" FontSize="16" Name="_USER_SET" Click="USER_SET" IsEnabled="False"/>
</MenuItem>
<MenuItem Header="_查询" FontSize="16" Focusable ="False">
<MenuItem Header="_领料单据" FontSize="16"/>
<MenuItem Header="_转换历史" FontSize="16"/>
<MenuItem Header="_统计" FontSize="16" Name="_statistics" IsEnabled="False"/>
</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>
@@ -67,7 +71,7 @@
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,175,0,0" TextWrapping="Wrap" Text="类型:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,140,0,0" TextWrapping="Wrap" Text="总步数:" VerticalAlignment="Top" Width="70" FontSize="20" Grid.ColumnSpan="2"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,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" IsTabStop="True" Grid.Column="1"/>
<ComboBox x:Name="Forms_" HorizontalAlignment="Left" Height="30" Margin="300,175,0,0" VerticalAlignment="Top" Width="105" FontSize="20"/>
<TextBox x:Name="Number" HorizontalAlignment="Left" 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"
@@ -216,12 +220,12 @@
<ContentControl x:Name="Deputy"/>
</Grid>
<Grid Grid.Column="1" Margin="0,0,0,0" Background="White" Opacity="0.8" Visibility="{Binding Cdk_page}">
<TextBlock Height="50" Margin="0,0,0,300" TextWrapping="Wrap" Text="The registration code expires" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Height="50" Margin="0,0,0,200" TextWrapping="Wrap" Text="{Binding Cdk_time}" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Height="50" Margin="0,0,0,100" TextWrapping="Wrap" Text="Contact SUNLIGHT Reactivate" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button Content="Reactivate" HorizontalAlignment="Center" Height="50" Margin="200,100,0,0" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="#FFDFDFDF" Click="CDKEY_SET"/>
<Button Content="Contact" HorizontalAlignment="Center" Height="50" Margin="0,100,200,0" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="#FFDFDFDF" Click="HELP"/>
<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>
+161 -93
View File
@@ -1,40 +1,18 @@
using formula_manage.Windows;
using formula_manage.UserClass;
using formula_manage.View;
using formula_manage.ViewModel;
using formula_manage.Windows;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using formula_manage.ViewModel;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using static System.Net.Mime.MediaTypeNames;
using formula_manage.UserClass;
using System.Drawing;
using System.Diagnostics;
using System.Printing;
using System.Drawing.Printing;
using static System.Drawing.Printing.PrinterSettings;
using formula_manage.View;
namespace formula_manage
{
@@ -43,16 +21,18 @@ namespace formula_manage
/// </summary>
public partial class MainWindow : Window
{
Font font = new Font("Microsoft YaHei", 20);
Font font = new Font("Microsoft YaHei", 20);
bool quit = false;
// DataTable DissolvedataTable = new DataTable(); //建立Dissolve缓存
// DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存
// DataTable MACHINEdataTable = new DataTable(); //建立Machine缓存
// 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缓存
// DataTable RecipedataTable = new DataTable(); //建立Recipe缓存
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
private readonly string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
//调用配置文件
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini");
string TEXT_SQLIP;
string TEXT_SQLNAME;
@@ -61,7 +41,9 @@ namespace formula_manage
string TEXT_SQLPASWOR;
string Connstr_SC;
int ID_N = 1;
string DYELOT_;
string Tlist_Weight;
string Tlist_Proportion;
public MainWindow()
{
@@ -71,6 +53,16 @@ namespace formula_manage
InitializeComponent();
this.Closing += Window_Closing; //添加窗口关闭事件
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")))
{
UserClass.TCPServer.Start(); //开启网路通讯
_WorkingMode.Header = "服务端";
}
else
{
_WorkingMode.Header = "客户端";
}
USER.Text = App.USER_Purview;
RRODUCTdataTable.Columns.Add("ID", typeof(int));
RRODUCTdataTable.Columns.Add("DYELOT", typeof(string));
@@ -90,7 +82,7 @@ namespace formula_manage
_SQL.IsEnabled = true;
_SQLBAK.IsEnabled = true;
_SOFTWARE_SET.IsEnabled = true;
_EXCHANGE_SET.IsEnabled = true;
_EX_SET.IsEnabled = true;
_PRINT_SET.IsEnabled = true;
_USER_SET.IsEnabled = true;
_USER_log.IsEnabled = true;
@@ -104,9 +96,11 @@ namespace formula_manage
_client.IsEnabled = true;
_color.IsEnabled = true;
_statistics.IsEnabled = true;
_exchange.IsEnabled = true;
}
sql_();
PrintForms();
Permissions_(); //权限管理
DataRow row = RRODUCTdataTable.NewRow(); //ID列
@@ -118,9 +112,38 @@ namespace formula_manage
Grid_RRODUCT.ItemsSource = RRODUCTdataTable.DefaultView;
}
private void PrintForms()//传入可用打印模板
{
int dirID = 0;
DataTable Report = new DataTable();
Report.Columns.Add("NAME", typeof(string));
string Print_path = Configini.IniReadvalue("PRINTER", "P3");
string Print_path2 = Configini.IniReadvalue("PRINTER", "P12");
string Temp_m = Configini.IniReadvalue("PRINTER", "P13");
string Temp_s = Configini.IniReadvalue("PRINTER", "P14");
DirectoryInfo di = new DirectoryInfo(Print_path); //new文件夹
FileInfo[] files = di.GetFiles("*.frx");//生成文件夹中的文件名合集
foreach (FileInfo file in files)
{
DataRow reportDATA = Report.NewRow();//插件新行
Report.Rows.Add(reportDATA);//保存修改
reportDATA = Report.Rows[dirID++];//选择行
reportDATA.BeginEdit();//开始编辑
reportDATA["NAME"] = System.IO.Path.GetFileNameWithoutExtension(file.Name);//传入字符
reportDATA.EndEdit();//结束编辑
}
Forms_.ItemsSource = Report.DefaultView;//加载合集
Forms_.DisplayMemberPath = "NAME"; // 显示文件名
Forms_.Text = Temp_m;
}
private void sql_()
{
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");
@@ -135,9 +158,11 @@ namespace formula_manage
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
list_Weight.Text = Configini.IniReadvalue("SOFTWARE_SET", "T4"); //自定义
list_Proportion.Text = Configini.IniReadvalue("SOFTWARE_SET", "T5"); //自定义
list_Total.Text = (double.Parse(list_Proportion.Text) * double.Parse(list_Weight.Text)).ToString();
Tlist_Weight = Configini.IniReadvalue("SOFTWARE_SET", "T4"); //自定义
Tlist_Proportion = Configini.IniReadvalue("SOFTWARE_SET", "T5"); //自定义
list_Weight.Text = Tlist_Weight;
list_Proportion.Text = Tlist_Proportion;
list_Total.Text = (double.Parse(Tlist_Proportion) * double.Parse(Tlist_Weight)).ToString();
}
private async void Permissions_()
@@ -157,6 +182,7 @@ namespace formula_manage
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
UserClass.LogGing.LogGingDATA("DatabaseConnectionFailed");
return;
}
@@ -170,7 +196,7 @@ namespace formula_manage
_SQL.IsEnabled = true;
_SQLBAK.IsEnabled = true;
_SOFTWARE_SET.IsEnabled = true;
_EXCHANGE_SET.IsEnabled = true;
_EX_SET.IsEnabled = true;
_PRINT_SET.IsEnabled = true;
_USER_SET.IsEnabled = true;
_RECIPE.IsEnabled = true;
@@ -183,6 +209,7 @@ namespace formula_manage
_client.IsEnabled = true;
_color.IsEnabled = true;
_statistics.IsEnabled = true;
_exchange.IsEnabled = true;
}
else
{
@@ -200,16 +227,12 @@ namespace formula_manage
_client.IsEnabled = true;
_color.IsEnabled = true;
_statistics.IsEnabled = true;
_exchange.IsEnabled = true;
}
}
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
{
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
if (!quit)
{
MessageBoxResult result = System.Windows.MessageBox.Show("您确定要退出吗?", "SUNLIGHT", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel);
@@ -217,14 +240,17 @@ namespace formula_manage
if (result == MessageBoxResult.Cancel) //判断是否确认
{
e.Cancel = true; // 中断点击事件
return;
}
}
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_STOP");
wr.Close();
// UserClass.LogGing.LogGingDATA(Log_time + "HttpSERVER_STOP");
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")))
{
UserClass.TCPServer.Btn_SendAll("SERVER_STOP");
}
UserClass.LogGing.LogGingDATA("FORMULA_STOP");
}
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
{
@@ -266,13 +292,33 @@ namespace formula_manage
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
string PreposeT4 = Configini.IniReadvalue("SOFTWARE_SET", "T6"); //
string time = System.DateTime.Now.ToString(PreposeT); //获取系统时
string time = System.DateTime.Now.ToString(PreposeT); //获取系统时
if (PreposeT4 != time) PreposeSl = 0;
PreposeSl = PreposeSl + 1;
str_Prepose = String.Format("{0:D" + preposeL + "}", PreposeSl);
Number.Text = Prepose + time + str_Prepose; //生成料单号
ReDye.Text = "0";
Configini.IniWritevalue("SOFTWARE_SET", " T6", time); //保存当前时
order.Text = "";
ReDye.Text += "";
Technology.Text = "";
Machine.Text = "";
Procedures_N.Text = "1";
Procedures_P.Text = "1";
Workflow.Text = "";
list_Weight.Text = Tlist_Weight;
list_Proportion.Text = Tlist_Proportion;
list_Total.Text = (double.Parse(Tlist_Proportion) * double.Parse(Tlist_Weight)).ToString();
RRODUCTdataTable.Clear(); //清楚缓存表
DataRow row = RRODUCTdataTable.NewRow(); //ID列
row["ID"] = ID_N;
row["STEP"] = Procedures_P.Text;
row["UNIT"] = "g";
RRODUCTdataTable.Rows.Add(row);
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
}
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
{
@@ -325,10 +371,15 @@ namespace formula_manage
Windows.User user_set = new Windows.User();
user_set.ShowDialog();//实例化并置顶打开用户窗口
}
private void PRINT_SET(object sender, RoutedEventArgs e)
private void EX_SET(object sender, RoutedEventArgs e)//扩展程序
{
EX.ExProgram ex = new EX.ExProgram();
ex.ShowDialog();
}
private void PRINT_SET(object sender, RoutedEventArgs e)//打印设置
{
Windows.Print print = new Windows.Print();
print.ShowDialog();//实例化并置顶打开打印窗口
print.ShowDialog();
}
private void HELP(object sender, RoutedEventArgs e)
{
@@ -350,11 +401,9 @@ namespace formula_manage
Windows.RECIPE rECIPE = new Windows.RECIPE();
rECIPE.ShowDialog();//实例化并置顶打开设置窗口
}
private void PROCESS(object sender, RoutedEventArgs e)
{
}
private void WORKFLOW(object sender, RoutedEventArgs e)
{
Windows.Dissolve dissolve = new Windows.Dissolve();
@@ -365,6 +414,11 @@ namespace formula_manage
Windows.Dissolve dissolve = new Windows.Dissolve();
dissolve.ShowDialog();//实例化并置顶打开设置窗口
}
private void EXCHANGE(object sender, RoutedEventArgs e)//交换日志
{
EX.Exchange exchange = new EX.Exchange();
exchange.ShowDialog();
}
private void print(object sender, RoutedEventArgs e)
{
@@ -378,24 +432,21 @@ namespace formula_manage
if (dialog.ShowDialog() == true)
{
// dialog.PrintVisual(printArea, "Print Test");
// dialog.PrintVisual(richText, "测试");
// dialog.PrintVisual(richText, "测试");
}
Print.IsEnabled = true;
}
private void fabric(object sender, RoutedEventArgs e)
{
fabric fabric_page = new fabric();
fabric_page.ShowDialog();//实例化并置顶打开窗口
}
private void color(object sender, RoutedEventArgs e)
{
color color_page = new color();
color_page.ShowDialog();//实例化并置顶打开窗口
}
private void client(object sender, RoutedEventArgs e)
{
client client_page = new client();
@@ -405,12 +456,10 @@ namespace formula_manage
{
Confirm.IsEnabled = false;
}
private void delete(object sender, RoutedEventArgs e)
{
Delete.IsEnabled = false;
}
private async void save(object sender, RoutedEventArgs e) //保存按钮
{
@@ -443,6 +492,7 @@ namespace formula_manage
catch (Exception)
{
System.Windows.MessageBox.Show("数据访问失败,重试");
UserClass.LogGing.LogGingDATA("DatabaseConnectionFailed");
return;
} //单号重复检查
if (Machine.Text == "")
@@ -475,7 +525,15 @@ namespace formula_manage
RRODUCTdataTable.AcceptChanges();
SqlConnection destinationConnection = new SqlConnection(Connstr_SC); //创建一个数据库连接;
destinationConnection.Open(); //打开连接
await destinationConnection.OpenAsync(); //打开连接
//写总览
string dyelots_sql = string.Format("INSERT INTO [dbo].[DYELOTS]([Dyelot] ,[ReDye] , [OrderNo] , [Program] ,[Machine] ,[DispenseMachine] ,[UserAccount] ,[SheetNo] ) " +
"VALUES ('" + Number.Text + "','" + ReDye.Text + "','" + order.Text + "','" + Technology.Text + "','" + Machine.Text + "','" + Machine.Text + "','" + USER.Text + "','" + Forms_.Text + "')");
SqlCommand INSERT_cmd = new SqlCommand(dyelots_sql, destinationConnection);
int dyelots_sqlIN = INSERT_cmd.ExecuteNonQuery(); //执行语句
//写明细
SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection);// 实例化 sqlbulkcopy;
bulkCopy.DestinationTableName = "dbo.DYELOTS_RECIPE";// 目标表名称/
bulkCopy.ColumnMappings.Add("DYELOT", "Dyelot");
@@ -502,16 +560,16 @@ namespace formula_manage
Procedures_N.Text = "1";
Procedures_P.Text = "1";
System.Windows.MessageBox.Show(Number.Text + "-" + ReDye.Text + "已保存");
Number_Event();
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); //记录当前单序号
Configini.IniWritevalue("SOFTWARE_SET", " T3", str_Prepose);
}
private void Button_NewOrder(object sender, RoutedEventArgs e) //新料单按钮
{
Number_Event();
}
private void Machine_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //机台回车跳转功能
{
if (e.Key == Key.Enter)
@@ -563,7 +621,7 @@ namespace formula_manage
public void Recevie_order(string[] value)//订单选择信息传递
{
order.Text = value[0];
Technology.Text = value[1]+"@" + value[2];
Technology.Text = value[1] + "@" + value[2];
}
private void Button_Order(object sender, RoutedEventArgs e)
@@ -581,7 +639,7 @@ namespace formula_manage
private void Button_Technology(object sender, RoutedEventArgs e)
{
ViewProcess viewProcess = new ViewProcess();
viewProcess.sendMessage = Recevie_Technology;
viewProcess.sendMessage = Recevie_Technology;
Deputy.Content = viewProcess; //打开工艺选择
}
@@ -609,7 +667,7 @@ namespace formula_manage
if (!r.Any()) return; //检查信息
if (double.Parse(r[0].ItemArray[1].ToString()) < a)
{
System.Windows.MessageBox.Show("超载,确定重量","错误",MessageBoxButton.OK,MessageBoxImage.Error);
System.Windows.MessageBox.Show("超载,确定重量", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
list_Weight.Text = "0";
list_Total.Text = "0";
return;
@@ -617,7 +675,7 @@ namespace formula_manage
}
private void Proportion(object sender, TextChangedEventArgs e) //浴比输入
{
float a, b, c=0;
float a, b, c = 0;
b = float.Parse(list_Proportion.Text);
if (list_Weight.Text != "") //判断比例是否有效
{
@@ -641,7 +699,7 @@ namespace formula_manage
string Name_;
string Type_;
string Conc_;
double Weight_=0;
double Weight_ = 0;
private void CP_PRODUCT_CODE_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//原料代码输入事件
{
@@ -650,15 +708,17 @@ namespace formula_manage
{
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
if (grid_row == -1) grid_row = 0;
Code_ = curComboBox.Text;
if (Code_ == "")
Code_ = curComboBox.Text.TrimEnd();
if ((Code_ == "") && (grid_row != 0))
{
if (Procedures_N.Text == Procedures_P.Text)
{
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
if (P == MessageBoxResult.Cancel) { }
return;
if (P == MessageBoxResult.Cancel) return;
if (P == MessageBoxResult.OK) Save.Focus();
}
else
{
@@ -669,7 +729,6 @@ namespace formula_manage
PressKey.PressKeys(Keys.Tab, false);
PressKey.PressKeys(Keys.Tab, true);
return;
}
}
@@ -680,8 +739,8 @@ namespace formula_manage
curComboBox.Text = "";
return;
}
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
int ID_ = grid_row + 1;
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'and ID <> '" + ID_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
System.Windows.MessageBox.Show("重复原料");
@@ -691,11 +750,7 @@ namespace formula_manage
Name_ = r[0].ItemArray[1].ToString();
Type_ = r[0].ItemArray[2].ToString();
Conc_ = r[0].ItemArray[3].ToString();
if (double.TryParse(list_Weight.Text, out ang))
{
Weight_ = double.Parse(list_Weight.Text) * double.Parse(Conc_) / 100;
}
Conc_ = (double.Parse(Conc_) / 100).ToString();
if ((Type_ == "0") || (Type_ == "3"))
{
@@ -725,7 +780,6 @@ namespace formula_manage
}
}
if (grid_row == -1) grid_row = 0;
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
row.BeginEdit();
row["PRODUCT_CODE"] = Code_;
@@ -748,18 +802,29 @@ namespace formula_manage
PressKey.PressKeys(Keys.Tab, false);
PressKey.PressKeys(Keys.Tab, true);
}
Save.IsEnabled = false;
Confirm.IsEnabled = false;
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
}
Save.IsEnabled = false;
Confirm.IsEnabled = false;
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
list_Weight.Text = list_Weight.Text.TrimEnd();//清楚输入字符空格
}
private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件
{
double ang;
double conc=0;
double conc = 0;
System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox;
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
int ID_ = grid_row + 1;
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE is null and ID = '" + ID_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
System.Windows.MessageBox.Show("先选择原料");
return;
}
if (e.Key == Key.Enter)
{
@@ -810,6 +875,7 @@ namespace formula_manage
}
}
}
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//原料代码选择事件
{
double ang;
@@ -817,14 +883,14 @@ namespace formula_manage
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
Code_ = curComboBox.Text;
Code_ = curComboBox.Text.TrimEnd();
if (Code_ == "")
{
if (Procedures_N.Text == Procedures_P.Text)
{
MessageBoxResult P = System.Windows.MessageBox.Show("是否保存", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation); //提示
if (P == MessageBoxResult.Cancel) { }
return;
if (P == MessageBoxResult.Cancel) return;
if (P == MessageBoxResult.OK) Save.Focus(); //聚焦到保存按钮
}
else
{
@@ -847,7 +913,8 @@ namespace formula_manage
return;
}
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
int ID_ = grid_row + 1;
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'and ID <> '" + ID_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
System.Windows.MessageBox.Show("重复原料");
@@ -857,6 +924,7 @@ namespace formula_manage
Name_ = r[0].ItemArray[1].ToString();
Type_ = r[0].ItemArray[2].ToString();
Conc_ = r[0].ItemArray[3].ToString();
Conc_ = (double.Parse(Conc_) / 100).ToString();
if (double.TryParse(list_Weight.Text, out ang))
{
@@ -897,7 +965,7 @@ namespace formula_manage
row["PRODUCT_CODE"] = Code_;
row["PRODUCT_NAME"] = Name_;
row["SHIFT"] = Type_;
row.EndEdit();
row.EndEdit();
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
Save.IsEnabled = false;
Confirm.IsEnabled = false;
@@ -911,7 +979,7 @@ namespace formula_manage
if (curComboBox.Text != "")
{
Name_ = curComboBox.Text;
Name_ = curComboBox.Text.TrimEnd();
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
@@ -924,6 +992,7 @@ namespace formula_manage
Code_ = r[0].ItemArray[0].ToString();
Type_ = r[0].ItemArray[2].ToString();
Conc_ = r[0].ItemArray[3].ToString();
Conc_ = (double.Parse(Conc_) / 100).ToString();
if (double.TryParse(list_Weight.Text, out ang))
{
@@ -968,6 +1037,5 @@ namespace formula_manage
Save.IsEnabled = false;
Confirm.IsEnabled = false;
}
}
}
-2
View File
@@ -1,6 +1,4 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
+1 -1
View File
@@ -12,7 +12,7 @@ namespace formula_manage.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.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 {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+2 -6
View File
@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace formula_manage.SQLModels
{
// internal class STUFF_Product
// internal class STUFF_Product
//{
// }
// }
public partial class Product
{
-3
View File
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace formula_manage.UserClass
{
-3
View File
@@ -2,9 +2,6 @@
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace formula_manage.UserClass
{
+1 -5
View File
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Controls;
namespace formula_manage.UserClass
{
@@ -1,15 +1,11 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace formula_manage.UserClass
{
internal class DataTableToObservableCollection
internal class DataTableToObservableCollection //数据表到可观察集合
{
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
{
+1 -6
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;
using System.Management;
namespace formula_manage.UserClass
{
+1 -5
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace formula_manage.UserClass
{
+76
View File
@@ -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();
}
}
}
+37
View File
@@ -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();//创建日志路径
}
}
}
}
-3
View File
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace formula_manage.UserClass
{
-4
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace formula_manage.UserClass
+42 -6
View File
@@ -3,9 +3,6 @@ using FastReport.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace formula_manage.UserClass
{
@@ -53,7 +50,7 @@ namespace formula_manage.UserClass
for (int i = 0; i < printNum; i++)
{
report.Print();
}
}
flag = true;
msg = "打印成功";
}
@@ -69,6 +66,45 @@ namespace formula_manage.UserClass
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>
@@ -76,7 +112,7 @@ namespace formula_manage.UserClass
/// <param name="dicParam">字典参数</param>
/// <param name="dsDataSource">数据源</param>
/// <returns></returns>
public static Tuple<bool, string> Design(string frxPath, Dictionary<string, object> dicParam, DataSet dsDataSource)
public static Tuple<bool, string> Designs(string frxPath, Dictionary<string, object> dicParam, DataSet dsDataSource)
{
bool flag = false;
string msg = "";
@@ -103,7 +139,7 @@ namespace formula_manage.UserClass
report.Design();
flag = true;
msg = "设计器打开成功";
msg = "Designer Open";
}
catch (Exception ex)
{
+2 -6
View File
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace formula_manage.UserClass
{
@@ -30,8 +26,8 @@ namespace formula_manage.UserClass
//方法3
//int r3 = Convert.ToInt32(str, 16);
//Console.WriteLine(r3);
}
catch (Exception e)
}
catch (Exception)
{
res = 0;
}
+186
View File
@@ -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));
}
}
}
}
}
+2 -6
View File
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq;
using System.Management;
using System.Printing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace formula_manage.UserClass
@@ -192,11 +188,11 @@ namespace formula_manage.UserClass
MessageBox.Show("网络打印机不可用", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
// WriteLog.SetString(ex.Message);
// WriteLog.SetString(ex.Message);
}
else
{
// WriteLog.SetException(ex);
// WriteLog.SetException(ex);
}
}
}
+46
View File
@@ -0,0 +1,46 @@
using System.Net.NetworkInformation;
using System.Net.Sockets;
namespace formula_manage.UserClass
{
public class get_local_ip_address
{
public static string getLocalIPAddressWithNetworkInterface(NetworkInterfaceType _type)//获取本机ip并以字符串方式返回
{
string output = "";
foreach (NetworkInterface item in NetworkInterface.GetAllNetworkInterfaces())
{
if (item.NetworkInterfaceType == _type && item.OperationalStatus == OperationalStatus.Up)
{
foreach (UnicastIPAddressInformation ip in item.GetIPProperties().UnicastAddresses)
{
if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
{
output = ip.Address.ToString();
}
}
}
}
return output;
}
public static string IP_Address()
{
string ip;
ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Ethernet);
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wireless80211);
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Ppp);
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Wwanpp);
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.TokenRing);
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Fddi);
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.GenericModem);
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.IPOverAtm);
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Tunnel);
if (ip == "") ip = getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Unknown);
if (ip == "") ip = "127.0.0.1";
return ip;
}
}
}
+1 -14
View File
@@ -1,17 +1,4 @@
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.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;
namespace formula_manage.View
{
+6 -18
View File
@@ -1,28 +1,16 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FastReport.Editor;
using FastReport.DevComponents.DotNetBar;
namespace formula_manage.View
{
/// <summary>
/// ViewProcess.xaml 的交互逻辑
/// </summary>
public partial class ViewOrder: UserControl
public partial class ViewOrder : UserControl
{
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
@@ -89,11 +77,11 @@ namespace formula_manage.View
{
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";//查询语句
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";//查询语句
@@ -135,7 +123,7 @@ namespace formula_manage.View
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); //传入数组
}
}
-11
View File
@@ -1,19 +1,8 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace formula_manage.View
{
+33
View File
@@ -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周期执行事件
{
}
}
}
+51 -45
View File
@@ -1,24 +1,11 @@
using formula_manage.SQLModels;
using formula_manage.UserClass;
using formula_manage.ViewModel;
using formula_manage.Windows;
using GalaSoft.MvvmLight;
using formula_manage.UserClass;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Threading;
using System.Xml.Linq;
namespace formula_manage.ViewModel
{
@@ -43,8 +30,8 @@ namespace formula_manage.ViewModel
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
// DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT
// DataTable RecipedataTable = new DataTable(); //建立Recipe
public static DataTable STUFFdatatemp = new DataTable(); //建立STUFF缓存
public static DataTable MACHINEdatatemp = new DataTable(); //建立Machine缓存
@@ -54,7 +41,7 @@ namespace formula_manage.ViewModel
public string cdk_time; //注册到期时间
public string cdk_page = "Hidden"; //注册到期页面状态
public string cdk_pageT; //注册到期页面关闭时间
int cdk_pageT_T=-1;////注册到期页面关闭时间计算
int cdk_pageT_T = -1;////注册到期页面关闭时间计算
public string Sys_Time //通知UI控件参数改变
{
@@ -88,40 +75,58 @@ namespace formula_manage.ViewModel
string SN_KEY;
private void CDkey_()
{
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))
{
try
{
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(SN_KEY.Substring(0, 12)), true) == SN_KEY.Substring(12, 4)) //校验key的crc校验值
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))
{
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 = "Expires time: " + Y +"/"+ M +"/"+ D;
if (string.Compare(Y, YY) < 0)
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(SN_KEY.Substring(0, 12)), true) == SN_KEY.Substring(12, 4)) //校验key的crc校验值
{
if (string.Compare(M, MM) < 0)
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(D, DD) < 0)
if (string.Compare(M, MM) < 0)
{
Cdk_page = "Visible";
//cdk_pageT_T = -1; //防止触发倒计时
}
else if ((int.Parse(D) - int.Parse(DD)) <= 3)//提前三天提醒
{
Cdk_page = "Visible";
cdk_pageT_T = 60; //页面关闭倒计时30秒
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 = "许可证安全校验错误请重新激活";
}
}
@@ -134,7 +139,7 @@ namespace formula_manage.ViewModel
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");
SN_KEY = Configini.IniReadvalue("SN", "SN1");
if (TEXT_SQMOD == "0") //判断连接方式
{
@@ -165,7 +170,8 @@ namespace formula_manage.ViewModel
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求原料信息失败,检查连接");
System.Windows.MessageBox.Show("请求信息失败");
UserClass.LogGing.LogGingDATA("DISPENLINK = ConnectFailed");
return;
}
}
@@ -268,7 +274,7 @@ namespace formula_manage.ViewModel
{
cdk_pageT_T--;
Cdk_pageT = cdk_pageT_T.ToString();
if(cdk_pageT_T == 1) Cdk_page = "Hidden";
if (cdk_pageT_T == 1) Cdk_page = "Hidden";
}
}
+42 -55
View File
@@ -1,36 +1,23 @@
using formula_manage.SQLModels;
using formula_manage.ViewModel;
using formula_manage.Windows;
using GalaSoft.MvvmLight;
using System;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Threading;
using System.Xml.Linq;
namespace formula_manage.ViewModel
{
/* public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
/* public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}*/
protected virtual void OnPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}*/
///<Summary>
///
///
@@ -191,40 +178,40 @@ namespace formula_manage.ViewModel
}
}
/* 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 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 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 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;
}
}*/
public override string ToString()
{
return DissolveName;
}
}*/
}
+10 -7
View File
@@ -1,10 +1,4 @@
using CommonServiceLocator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
namespace formula_manage.ViewModel
@@ -28,8 +22,9 @@ namespace formula_manage.ViewModel
SimpleIoc.Default.Register<MainWindowViewModel>();
SimpleIoc.Default.Register<RECIPEViewModel>();
SimpleIoc.Default.Register<ExchangeViewModel>();
}
public MainWindowViewModel Main
{
get
@@ -46,5 +41,13 @@ namespace formula_manage.ViewModel
}
}
public ExchangeViewModel Exchange
{
get
{
return ServiceLocator.Current.GetInstance<ExchangeViewModel>();
}
}
}
}
+2 -14
View File
@@ -1,17 +1,6 @@
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.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
{
@@ -33,7 +22,7 @@ namespace formula_manage.Windows
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
{
MessageBoxResult result = System.Windows.MessageBox.Show("设置完成后请重启程序","提示", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel);
MessageBoxResult result = System.Windows.MessageBox.Show("设置完成后请重启程序", "提示", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel);
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
Configini.IniWritevalue("SOFTWARE_SET", " L1", Loginlink.ToString());
@@ -53,7 +42,7 @@ namespace formula_manage.Windows
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine(Log_time + "FORMULA_SET:INIFile_Write");
wr.Close();
wr.Close();
}
bool Loginlink;
@@ -63,7 +52,6 @@ namespace formula_manage.Windows
bool EXlink;
private void Window_SET(object sender, RoutedEventArgs e)
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
Login_LINK.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L1")); //连接状态显示是否生效
+48 -38
View File
@@ -1,23 +1,6 @@
using formula_manage.UserClass;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Management;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace formula_manage.Windows
@@ -41,12 +24,33 @@ namespace formula_manage.Windows
private void Window_CDKEY(object sender, RoutedEventArgs e) //打开页面
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
cdk.Text = Configini.IniReadvalue("SN", "SN1"); //读配置文件
string cdk = Configini.IniReadvalue("SN", "SN1"); //读配置文件
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();
sn_time.Text = "CDkeyDueTime: " + Y + "-" + M + "-" + D;
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();
@@ -56,16 +60,22 @@ namespace formula_manage.Windows
//string hardDiskSerialNumber = HardwareSN.GetHardDiskSerialNumber();
// 获取网卡地址
//string netCardMACAddress = HardwareSN.GetNetCardMACAddress();
sn_id.Text = MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber);//生成id基于硬件值的md5校验
}
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 ((id_1 == cdk.Text.Substring(0, 6)) && (cdk.Text.Length == 16))
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校验值
{
@@ -83,8 +93,8 @@ namespace formula_manage.Windows
{
if (string.Compare(D, DD) >= 0)
{
System.Windows.MessageBox.Show("CDKEY: OK","KEY",MessageBoxButton.OK,MessageBoxImage.Asterisk);
sn_time.Text = "CDkeyDueTime: " + Y + "-" + M + "-" + D;
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);
@@ -92,8 +102,8 @@ namespace formula_manage.Windows
}
else if (string.Compare(M, MM) > 0)
{
System.Windows.MessageBox.Show("CDKEY: OK", "KEY", MessageBoxButton.OK, MessageBoxImage.Asterisk);
sn_time.Text = "CDkeyDueTime: " + Y + "-" + M + "-" + D;
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);
@@ -101,18 +111,18 @@ namespace formula_manage.Windows
}
else
{
System.Windows.MessageBox.Show("CDKEY: Overdue", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
else
{
System.Windows.MessageBox.Show("CDKEY: Overdue", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
else if (string.Compare(Y, YY) > 0)
{
System.Windows.MessageBox.Show("CDKEY: OK", "KEY", MessageBoxButton.OK, MessageBoxImage.Asterisk);
sn_time.Text = "CDkeyDueTime: " + Y + "-" + M + "-" + D;
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);
@@ -120,17 +130,17 @@ namespace formula_manage.Windows
}
else
{
System.Windows.MessageBox.Show("CDKEY: Overdue","WARNING",MessageBoxButton.OK,MessageBoxImage.Warning);
System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
else
{
System.Windows.MessageBox.Show("CDKEY: Linvalid", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
else
else
{
System.Windows.MessageBox.Show("CDKEY: Linvalid","ERR" , MessageBoxButton.OK,MessageBoxImage.Error);
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
+17 -31
View File
@@ -1,24 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight;
using formula_manage.SQLModels;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using Xceed.Wpf.AvalonDock.Themes;
namespace formula_manage.Windows
{
@@ -127,7 +113,7 @@ namespace formula_manage.Windows
string Dissolve_sql;
int int_ion = 0;
if ((name.Text == "") ||(Code.Text == ""))
if ((name.Text == "") || (Code.Text == ""))
{
System.Windows.MessageBox.Show("请输入代码或名称");
return;
@@ -171,33 +157,33 @@ namespace formula_manage.Windows
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 + "')");
"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
}
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 + "'");
}
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);
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
if (sql_in == 0)
{
System.Windows.MessageBox.Show("修改失败");
}
else
@@ -213,7 +199,7 @@ namespace formula_manage.Windows
return;
}
}
}
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
+16 -30
View File
@@ -1,24 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight;
using formula_manage.SQLModels;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using Xceed.Wpf.AvalonDock.Themes;
namespace formula_manage.Windows
{
@@ -132,7 +118,7 @@ namespace formula_manage.Windows
/*定位选中行及指定列单元格文本信息*/
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_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();//
@@ -182,7 +168,7 @@ namespace formula_manage.Windows
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(); //打开数据连接
@@ -190,25 +176,25 @@ namespace formula_manage.Windows
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
{
System.Windows.MessageBox.Show("添加失败");
}
else
}
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 + "'");
}
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);
SqlCommand INSERT_cmd = new SqlCommand(MAC_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
if (sql_in == 0)
{
System.Windows.MessageBox.Show("修改失败");
}
else
@@ -224,7 +210,7 @@ namespace formula_manage.Windows
return;
}
}
}
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
+27 -24
View File
@@ -5,40 +5,43 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.Windows"
mc:Ignorable="d" Loaded="Window_Print"
Title="打印设置" Height="500" Width="500" MaxWidth="500">
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" TextWrapping="Wrap" VerticalAlignment="Top" Width="285"/>
<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"/>
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,70,0,0" Content="默认打印机:" VerticalAlignment="Top" Width="90"
<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,65,0,0" VerticalAlignment="Top" Width="180"
<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,105,0,0" TextWrapping="Wrap" Text="发布至其它目标打印机" VerticalAlignment="Top" Width="200" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,135,0,0" TextWrapping="Wrap" Text="打印模板:" VerticalAlignment="Top" Width="70" FontSize="16"/>
<TextBox x:Name="Print_path2" HorizontalAlignment="Left" Height="20" Margin="90,135,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="285"/>
<Button Content="浏览路径" HorizontalAlignment="Left" Height="20" Margin="375,135,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click1"/>
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,170,0,0" Content="同步推送:" VerticalAlignment="Top" Width="90"
<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,165,0,0" VerticalAlignment="Top" Width="180"
<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,195,0,0" Content="同步推送:" VerticalAlignment="Top" Width="90"
<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,190,0,0" VerticalAlignment="Top" Width="180"
<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"/>
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,220,0,0" Content="同步推送:" VerticalAlignment="Top" Width="90"
x:Name="TEXT_Print4" Checked="Print_Checked4" Unchecked="Print_Checked4"/>
<ComboBox HorizontalAlignment="Left" Height="20" Margin="110,215,0,0" VerticalAlignment="Top" Width="180"
x:Name="cbxPrinter4" SelectedValuePath="Element[OPTIONCODE].Value" DisplayMemberPath="Element[OPTIONNAME].Value"/>
<CheckBox HorizontalAlignment="Left" Height="15" Margin="20,245,0,0" Content="同步推送:" VerticalAlignment="Top" Width="90"
x:Name="TEXT_Print5" Checked="Print_Checked5" Unchecked="Print_Checked5"/>
<ComboBox HorizontalAlignment="Left" Height="20" Margin="110,240,0,0" VerticalAlignment="Top" Width="180"
x:Name="cbxPrinter5" SelectedValuePath="Element[OPTIONCODE].Value" DisplayMemberPath="Element[OPTIONNAME].Value"/>
<Button Content="预览模板" HorizontalAlignment="Left" Height="20" Margin="375,165,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_22"/>
<Button Content="编辑模板" HorizontalAlignment="Left" Height="20" Margin="295,165,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_12"/>
<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>
+110 -100
View File
@@ -1,28 +1,12 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ThoughtWorks.QRCode.Codec;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using FastReport;
using formula_manage.UserClass;
using System.Xml.Linq;
using FastReport.Format;
using Svg;
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.IO;
using System.Windows.Media.Media3D;
using System.Windows;
using System.Windows.Forms;
using System.Xml.Linq;
namespace formula_manage.Windows
{
@@ -38,8 +22,7 @@ namespace formula_manage.Windows
cbxPrinter.ItemsSource = this.GetLocalPrinters(); //打印机搜索
cbxPrinter2.ItemsSource = this.GetLocalPrinters();
cbxPrinter3.ItemsSource = this.GetLocalPrinters();
cbxPrinter4.ItemsSource = this.GetLocalPrinters();
cbxPrinter5.ItemsSource = this.GetLocalPrinters();
this.Closing += Window_Closing; //添加窗口关闭事件
}
@@ -51,11 +34,12 @@ namespace formula_manage.Windows
bool Printer;
bool Printer2;
bool Printer3;
bool Printer4;
bool Printer5;
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"));
@@ -63,13 +47,11 @@ namespace formula_manage.Windows
Print_path.Text = Configini.IniReadvalue("PRINTER", "P3");
Printer2 = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P4"));
Printer3 = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P5"));
Printer4 = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P6"));
Printer5 = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P7"));
cbxPrinter2.SelectedValue = Configini.IniReadvalue("PRINTER", "P8"); //读配置文件
cbxPrinter3.SelectedValue = Configini.IniReadvalue("PRINTER", "P9"); //读配置文件
cbxPrinter4.SelectedValue = Configini.IniReadvalue("PRINTER", "P10"); //读配置文件
cbxPrinter5.SelectedValue = Configini.IniReadvalue("PRINTER", "P11"); //读配置文件
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;
@@ -80,16 +62,33 @@ namespace formula_manage.Windows
TEXT_Print3.IsChecked = Printer3;
cbxPrinter3.IsEnabled = Printer3;
TEXT_Print4.IsChecked = Printer4;
cbxPrinter4.IsEnabled = Printer4;
PRINT_file();
}
TEXT_Print5.IsChecked = Printer5;
cbxPrinter5.IsEnabled = Printer5;
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());
@@ -97,13 +96,11 @@ namespace formula_manage.Windows
Configini.IniWritevalue("PRINTER", " P3", Print_path.Text.ToString());
Configini.IniWritevalue("PRINTER", " P4", Printer2.ToString());
Configini.IniWritevalue("PRINTER", " P5", Printer3.ToString());
Configini.IniWritevalue("PRINTER", " P6", Printer4.ToString());
Configini.IniWritevalue("PRINTER", " P7", Printer5.ToString());
Configini.IniWritevalue("PRINTER", " P8", cbxPrinter2.SelectedValue.ToString());
Configini.IniWritevalue("PRINTER", " P9", cbxPrinter3.SelectedValue.ToString());
Configini.IniWritevalue("PRINTER", " P10", cbxPrinter4.SelectedValue.ToString());
Configini.IniWritevalue("PRINTER", " P11", cbxPrinter5.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);
@@ -137,82 +134,50 @@ namespace formula_manage.Windows
private void Button_Click_1(object sender, RoutedEventArgs e) //编辑模板
{
/* if (string.IsNullOrEmpty(Print_path.Text))
if (string.IsNullOrEmpty(Template_M.Text))
{
System.Windows.MessageBox.Show("模板不能为空");
return;
}*/
var data = this.CreateBillData();
if (!data.Item1)
{
System.Windows.MessageBox.Show("模拟数据生成错误");
return;
}
var tuple = PrintHelper.Design(Print_path.Text, data.Item2, data.Item3);
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(Print_path.Text))
{
System.Windows.MessageBox.Show("模板不能为空");
return;
}*/
var data = this.CreateBillData();
if (!data.Item1)
if (string.IsNullOrEmpty(Template_S.Text))
{
System.Windows.MessageBox.Show("模拟数据生成错误");
System.Windows.MessageBox.Show("模板不能为空");
return;
}
var tuple = PrintHelper.Design(Print_path2.Text, data.Item2, data.Item3);
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) //预览模板
{
}
private Tuple<bool, Dictionary<string, object>, DataSet> CreateBillData()
{
//注意事项
//小票动态数据会变化,小票的长度也会动态改变
//这里主要演示下 动态数据源 为了动态拉伸,除了传入数据源,在模板上面code部分需要加代码
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("billNo", "2018111100002222");
dic.Add("optorName", "管理员");
//组装dataset数据源
DataTable dtDetail = new DataTable("dtDetail");
dtDetail.Columns.Add("GOODSCODE");
dtDetail.Columns.Add("GOODSNAME");
dtDetail.Columns.Add("GOODSPRICE");
dtDetail.Columns.Add("GOODSCOUNT");
dtDetail.Columns.Add("PAYSUM");
//加10种商品
for (int i = 1; i <= 10; i++)
{
dtDetail.Rows.Add("10000" + 1, "测试商品" + i, 10.00m, 5, 50.00m);
}
DataSet dsFrx = new DataSet();
dsFrx.Tables.Add(dtDetail);
return new Tuple<bool, Dictionary<string, object>, DataSet>(true, dic, dsFrx);
Report report = new Report();
//加载标签模版
report.Load(Print_path2.Text + "/" + Template_S.Text);
//打印预览
report.Prepare();//准备
report.ShowPrepared();//预览
}
private void Print_Checked(object sender, RoutedEventArgs e) //打印机是否生效
@@ -230,16 +195,6 @@ namespace formula_manage.Windows
Printer3 = TEXT_Print3.IsChecked.GetValueOrDefault(); //打印机是否生效
cbxPrinter3.IsEnabled = Printer3; //
}
private void Print_Checked4(object sender, RoutedEventArgs e) //打印机是否生效
{
Printer4 = TEXT_Print4.IsChecked.GetValueOrDefault(); //打印机是否生效
cbxPrinter4.IsEnabled = Printer4; //
}
private void Print_Checked5(object sender, RoutedEventArgs e) //打印机是否生效
{
Printer5 = TEXT_Print5.IsChecked.GetValueOrDefault(); //打印机是否生效
cbxPrinter5.IsEnabled = Printer5; //
}
private List<XElement> GetLocalPrinters() //查找打印机
{
@@ -254,11 +209,66 @@ namespace formula_manage.Windows
list.Add(xePrintName);
}
}
catch (Exception ex)
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"; // 显示文件名
}
}
}
+7 -34
View File
@@ -1,41 +1,14 @@
using formula_manage.Windows;
using formula_manage.UserClass;
using formula_manage.ViewModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using formula_manage.ViewModel;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using static System.Net.Mime.MediaTypeNames;
using formula_manage.UserClass;
using System.Drawing;
using System.Diagnostics;
using System.Printing;
using System.Drawing.Printing;
using static System.Drawing.Printing.PrinterSettings;
using formula_manage.View;
using FastReport.DevComponents.AdvTree;
namespace formula_manage.Windows
{
@@ -160,14 +133,14 @@ namespace formula_manage.Windows
e.Handled = !re.IsMatch(e.Text);
}
private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
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;
}
// string Dissolve_sql;
// int int_ion = 0;
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
+16 -27
View File
@@ -1,18 +1,7 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
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.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
@@ -50,7 +39,7 @@ namespace formula_manage.Windows
SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
int.TryParse(Configini.IniReadvalue("SQL_SERVER", "SQL3"), out i); //读数据库状态配置文件
if (i == 0) SQLMOD = false;
else SQLMOD = true;
else SQLMOD = true;
SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
SQLPASS = Configini.IniReadvalue("SQL_SERVER", "SQL5");
@@ -59,7 +48,7 @@ namespace formula_manage.Windows
SQLTIME = Boolean.Parse(Configini.IniReadvalue("SQL_BAK", "S3"));
int.TryParse(Configini.IniReadvalue("SQL_BAK", "S4"), out Time);
if (Time == 0) SQL_TIME.Text = "日";
else if(Time == 1) SQL_TIME.Text = "周";
else if (Time == 1) SQL_TIME.Text = "周";
else if (Time == 2) SQL_TIME.Text = "月";
else if (Time == 3) SQL_TIME.Text = "季";
else if (Time == 4) SQL_TIME.Text = "年";
@@ -77,7 +66,7 @@ namespace formula_manage.Windows
SQL_DISPEN_bak.IsEnabled = SQLBAK;
SQL_DISPEN_BUT.IsEnabled = SQLBAK;
}
private void SQL_bak_time_Checked(object sender, RoutedEventArgs e) //自动保存
{
SQLTIME = SQL_bak_time.IsChecked.GetValueOrDefault();
@@ -90,8 +79,8 @@ namespace formula_manage.Windows
Dilog.SelectedPath = SQL_DISPEN_bak.Text; //打开目录
Dilog.ShowNewFolderButton = false; //不显示新建文件夹按钮
//
if (Dilog.ShowDialog() == System.Windows.Forms.DialogResult.OK )
{
if (Dilog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
SQL_DISPEN_bak.Text = Dilog.SelectedPath; //返回选择的字符串
}
}
@@ -207,23 +196,23 @@ namespace formula_manage.Windows
{
ok = Backup(SQLNAME, SQL_DISPEN_bak.Text + "\\" + SQLNAME + System.DateTime.Now.ToString("yyyy_MM_dd_HHmmss") + ".bak"); //指定地址备份
}
else
else
{
ok = Backup(SQLNAME, "C:\\SUNLIGHT\\" + SQLNAME + System.DateTime.Now.ToString("yyyy_MM_dd_HHmmss") + ".bak"); //默认备份到文档文件夹
}
if (ok)
{
System.Windows.MessageBox.Show("备份成功");
}
else
{
System.Windows.MessageBox.Show("备份失败");
}
if (ok)
{
System.Windows.MessageBox.Show("备份成功");
}
else
{
System.Windows.MessageBox.Show("备份失败");
}
}
private async void Button_Click_2(object sender, RoutedEventArgs e)
{
{
if (!SQLMOD) //连接数据库测试
{
Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";Trusted_Connection=SSPI";
+1 -16
View File
@@ -1,21 +1,6 @@
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.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Data.SqlTypes;
using System.Windows;
namespace formula_manage.Windows
+57 -70
View File
@@ -1,24 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight;
using formula_manage.SQLModels;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using Xceed.Wpf.AvalonDock.Themes;
namespace formula_manage.Windows
{
@@ -88,34 +75,34 @@ namespace formula_manage.Windows
/// </summary>
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
e.Row.Header = e.Row.GetIndex() + 1;
}
private void Radiobutton(object sender, EventArgs e)
{
System.Windows.Controls.RadioButton Radiobutton = (sender as System.Windows.Controls.RadioButton);
string radiobutton = Radiobutton.Content.ToString();
if (radiobutton == "全部原料")
if (radiobutton == "全部原料")
{
GridSql(0);
Button_ID = 0;
GridSql(0);
Button_ID = 0;
}
else if (radiobutton == "染料")
else if (radiobutton == "染料")
{
GridSql(1);
Button_ID = 1;
Button_ID = 1;
}
else if (radiobutton == "助剂")
else if (radiobutton == "助剂")
{
GridSql(2);
GridSql(2);
Button_ID = 2;
}
else if (radiobutton == "粉体助剂")
else if (radiobutton == "粉体助剂")
{
GridSql(3);
Button_ID = 3;
Button_ID = 3;
}
else if (radiobutton == "液体染料")
else if (radiobutton == "液体染料")
{
GridSql(4);
Button_ID = 4;
@@ -125,15 +112,15 @@ namespace formula_manage.Windows
/// <summary>
/// 查询数据库的方法
/// </summary>
private async void GridSql(int e )
private async void GridSql(int e)
{
string Stuff_sql = null;
if (e == 0) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT]";//查询语句
else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '0' ";
else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '0' ";
else if (e == 2) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '1' ";
else if (e == 3) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '2' ";
else if (e == 4) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '3' ";
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
@@ -155,7 +142,7 @@ namespace formula_manage.Windows
}
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个英文字母,空白字符和@()()/+!!_-组成的字符串
int int_stuff_ProductType = 0;
@@ -171,14 +158,14 @@ namespace formula_manage.Windows
if (this.stuff_ProductType.Text == "染料") //原料类型0。染料,1助剂,2粉体
int_stuff_ProductType = 0;
else if (this.stuff_ProductType.Text == "助剂")
int_stuff_ProductType = 1;
else if (this.stuff_ProductType.Text == "粉体助剂")
int_stuff_ProductType = 2;
else if (this.stuff_ProductType.Text == "液体染料")
else if (this.stuff_ProductType.Text == "助剂")
int_stuff_ProductType = 1;
else if (this.stuff_ProductType.Text == "粉体助剂")
int_stuff_ProductType = 2;
else if (this.stuff_ProductType.Text == "液体染料")
int_stuff_ProductType = 3;
if(Stuff_ion.Text == "分散") int_stuff_ion = 0;
if (Stuff_ion.Text == "分散") int_stuff_ion = 0;
else if (Stuff_ion.Text == "酸性") int_stuff_ion = 1;
else if (Stuff_ion.Text == "活性") int_stuff_ion = 2;
else if (Stuff_ion.Text == "中性") int_stuff_ion = 3;
@@ -215,37 +202,37 @@ namespace formula_manage.Windows
if (float.Parse(this.stuff_Concentration.Text) < 0 || float.Parse(this.stuff_Concentration.Text) > 100)
System.Windows.MessageBox.Show("ERR:浓度错误", "错误");//检查浓度输入数值
else
{
{
try
{
{
if (int_stuff_ProductType == 0 || int_stuff_ProductType == 3)//判断是否为染料,非染料写空
{
{
string colorValue = stuff_Color.Background.ToString();//获取色彩框背景色"#FFC1C2C3"
string StuffColor_R = string.Format("{0:X2}", colorValue.Substring(3, 2));//获取红色参数C1
string StuffColor_G = string.Format("{0:X2}", colorValue.Substring(5, 2));//获取绿色参数C2
string StuffColor_B = string.Format("{0:X2}", colorValue.Substring(7, 2));//获取蓝色参数C3
string StuffColor = StuffColor_B + StuffColor_G + StuffColor_R;//合并16进制rgb参数
ColorCode_SQL = Convert.ToInt32(StuffColor, 16);//16进制转10进制
if (ColorCode_SQL < 0) ColorCode_SQL = 16777215;//判断色彩数据是否有效
if (ColorCode_SQL < 0) ColorCode_SQL = 16777215;//判断色彩数据是否有效
}
else
{
ColorCode_SQL = 16777215;
else
{
ColorCode_SQL = 16777215;
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
Stuff_sql = "SELECT count(*) FROM [dbo].[PRODUCT] WHERE ProductCode = '" + Product_Code + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
conn_SC.Close(); //关闭连接
if (count == 0)
{
Stuff_sql = string.Format( "INSERT INTO [dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
"VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')");
if (count == 0)
{
Stuff_sql = string.Format("INSERT INTO [dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
"VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
if (Stuff_ion.Text != "") Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET [ProductIon_Type] =" + int_stuff_ion + " Where ProductCode='" + Product_Code + "'");
@@ -267,10 +254,10 @@ namespace formula_manage.Windows
else if (Button_ID == 4) GridSql(4);
System.Windows.MessageBox.Show("添加完成");
}
}
else
}
else
{
Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET ProductName='" + Product_Name + "',Price='" + _Price + "',SUPPLIER='" + _SUPPLIER + "',ProductType=" + int_stuff_ProductType + ",Color=" + ColorCode_SQL + ",Concentration=" + _Concentration + ",GRAVITY=" + _GRAVITY + " Where ProductCode='"+ Product_Code+"'");
Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET ProductName='" + Product_Name + "',Price='" + _Price + "',SUPPLIER='" + _SUPPLIER + "',ProductType=" + int_stuff_ProductType + ",Color=" + ColorCode_SQL + ",Concentration=" + _Concentration + ",GRAVITY=" + _GRAVITY + " Where ProductCode='" + Product_Code + "'");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
@@ -286,7 +273,7 @@ namespace formula_manage.Windows
System.Windows.MessageBox.Show("修改失败");
}
else
{
{
if (Button_ID == 0) GridSql(0);
else if (Button_ID == 1) GridSql(1);
else if (Button_ID == 2) GridSql(2);
@@ -301,44 +288,44 @@ namespace formula_manage.Windows
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
{
string ShowProductName = "是否删除原料【" + this.stuff_ProductName.Text + "】" + this.stuff_ProductCode.Text;//获取原料信息并拼接提示字符串
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
if (showProductName == MessageBoxResult.Yes)//判断是否删除原料
{
string Stuff_sql = string.Format("DELETE FROM [dbo].[PRODUCT] WHERE ProductCode ='" + stuff_ProductCode.Text.ToString() + "'");
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
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
{
if (Button_ID == 0) GridSql(0);
else if (Button_ID == 1) GridSql(1);
else if (Button_ID == 2) GridSql(2);
else if (Button_ID == 3) GridSql(3);
}
else
{
if (Button_ID == 0) GridSql(0);
else if (Button_ID == 1) GridSql(1);
else if (Button_ID == 2) GridSql(2);
else if (Button_ID == 3) GridSql(3);
else if (Button_ID == 4) GridSql(4);
}
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
}
private void DataGridStuff_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
@@ -388,7 +375,7 @@ namespace formula_manage.Windows
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();//使用调色盘控件ColorDialog
if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)//打开调色盘
{
System.Drawing.Color DColor = colorDialog.Color;////获取选中色彩信息
//System.Windows.Media.Color MColor = new System.Windows.Media.Color();//转换
System.Windows.Media.Color MColor = System.Windows.Media.Color.FromArgb(DColor.A, DColor.R, DColor.G, DColor.B);//转换并配置ARGB参数
@@ -399,5 +386,5 @@ namespace formula_manage.Windows
}
}
}
}
}
+55 -69
View File
@@ -1,24 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight;
using formula_manage.SQLModels;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using Xceed.Wpf.AvalonDock.Themes;
namespace formula_manage.Windows
{
@@ -141,49 +127,49 @@ namespace formula_manage.Windows
string note = Note.Text;
string Stuff_sql;
if(Capacity.Text == "停用") Cap = 0;
if (Capacity.Text == "停用") Cap = 0;
else if (Capacity.Text == "限制") Cap = 1;
else if (Capacity.Text == "启用") Cap = 2;
if (name != "")
if (name != "")
{
try
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
Stuff_sql = "SELECT count(*) FROM [Dispensing].[dbo].[UserAccount] WHERE UserCode = '" + name + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
conn_SC.Close(); //关闭连接
try
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
Stuff_sql = "SELECT count(*) FROM [Dispensing].[dbo].[UserAccount] WHERE UserCode = '" + name + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
conn_SC.Close(); //关闭连接
if (count == 0)
if (count == 0)
{
if (password == "")
{
if (password == "")
{
Stuff_sql = "INSERT INTO[Dispensing].[dbo].[UserAccount](UserCode ,PassWord ,GROUP_CODE ,Capacity ,Note ) " +
"VALUES ('" + name + "',null,'" + Group + "'," + Cap + ",'" + note + "')";
}
else
{
Stuff_sql = "INSERT INTO[Dispensing].[dbo].[UserAccount](UserCode ,PassWord ,GROUP_CODE ,Capacity ,Note ) " +
"VALUES ('" + name + "'," + password + ",'" + Group + "'," + Cap + ",'" + note + "')";
}
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("添加失败");
}
else
{
GridSql();
}
}
else
Stuff_sql = "INSERT INTO[Dispensing].[dbo].[UserAccount](UserCode ,PassWord ,GROUP_CODE ,Capacity ,Note ) " +
"VALUES ('" + name + "',null,'" + Group + "'," + Cap + ",'" + note + "')";
}
else
{
Stuff_sql = "INSERT INTO[Dispensing].[dbo].[UserAccount](UserCode ,PassWord ,GROUP_CODE ,Capacity ,Note ) " +
"VALUES ('" + name + "'," + password + ",'" + Group + "'," + Cap + ",'" + note + "')";
}
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("添加失败");
}
else
{
GridSql();
}
}
else
{
if (password == "")
{
@@ -193,26 +179,26 @@ namespace formula_manage.Windows
{
Stuff_sql = string.Format("UPDATE [dbo].[UserAccount] SET PassWord=" + password + " ,GROUP_CODE='" + Group + "' ,Capacity=" + Cap + " ,Note='" + note + "' Where UserCode ='" + name + "'");
}
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
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("修改失败");
}
else
{
GridSql();
}
if (sql_in == 0)
{
System.Windows.MessageBox.Show("修改失败");
}
else
{
GridSql();
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
+29 -45
View File
@@ -1,25 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight;
using formula_manage.SQLModels;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using Xceed.Wpf.AvalonDock.Themes;
using static System.Net.Mime.MediaTypeNames;
namespace formula_manage.Windows
{
@@ -32,7 +17,6 @@ namespace formula_manage.Windows
DataTable dataTable = new DataTable(); //建立缓存
int Button_ID = 0;
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
@@ -72,7 +56,7 @@ namespace formula_manage.Windows
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter client_data = new SqlDataAdapter(client_sql, Connstr_SC); //查询
client_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
@@ -90,13 +74,13 @@ namespace formula_manage.Windows
/// </summary>
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
e.Row.Header = e.Row.GetIndex() + 1;
}
/// <summary>
/// 查询数据库的方法
/// </summary>
private async void GridSql()
private async void GridSql()
{
string client_sql = "SELECT Code ,Name , Remark FROM [dbo].[Client]";//查询语句
@@ -121,7 +105,7 @@ namespace formula_manage.Windows
}
private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
{
{
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数
string client_sql;
@@ -131,22 +115,22 @@ namespace formula_manage.Windows
if (string.IsNullOrEmpty(this.client_name.Text))
System.Windows.MessageBox.Show("ERR:无效的名称", "错误");//检查原料名
else
{
{
try
{
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
client_sql = "SELECT count(*) FROM [dbo].[Client] WHERE Code = '" + client_code.Text + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(client_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
conn_SC.Close(); //关闭连接
if (count == 0)
if (count == 0)
{
client_sql = string.Format("INSERT INTO [dbo].[Client](Code ,Name , Remark) " +
"VALUES ('" + client_code.Text + "','" + client_name.Text + "','" + client_Remark.Text + "')");
"VALUES ('" + client_code.Text + "','" + client_name.Text + "','" + client_Remark.Text + "')");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC);
SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
@@ -159,10 +143,10 @@ namespace formula_manage.Windows
GridSql();
System.Windows.MessageBox.Show("添加完成");
}
}
else
}
else
{
client_sql = string.Format("UPDATE [dbo].[Client] SET Name='" + client_name.Text + "',Remark='" + client_Remark.Text + "' Where Code='"+ client_code.Text + "'");
client_sql = string.Format("UPDATE [dbo].[Client] SET Name='" + client_name.Text + "',Remark='" + client_Remark.Text + "' Where Code='" + client_code.Text + "'");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
@@ -173,9 +157,9 @@ namespace formula_manage.Windows
System.Windows.MessageBox.Show("C0110-1:修改失败");
}
else
{
{
GridSql();
System.Windows.MessageBox.Show("修改完成");
}
}
@@ -185,40 +169,40 @@ namespace formula_manage.Windows
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
{
string ShowProductName = "是否删除【" + this.client_name.Text + "】" + this.client_code.Text;//获取信息并拼接提示字符串
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
if (showProductName == MessageBoxResult.Yes)//判断是否删除
{
string Stuff_sql = string.Format("DELETE FROM [dbo].[Client] WHERE Code ='" + client_code.Text.ToString() + "'");
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功
}
else
{
GridSql();
}
}
else
{
GridSql();
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
}
private void DataGridclient_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
@@ -233,5 +217,5 @@ namespace formula_manage.Windows
}
}
}
}
}
+28 -43
View File
@@ -1,25 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight;
using formula_manage.SQLModels;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using Xceed.Wpf.AvalonDock.Themes;
using static System.Net.Mime.MediaTypeNames;
namespace formula_manage.Windows
{
@@ -32,7 +18,6 @@ namespace formula_manage.Windows
DataTable dataTable = new DataTable(); //建立缓存
int Button_ID = 0;
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
@@ -72,7 +57,7 @@ namespace formula_manage.Windows
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter color_data = new SqlDataAdapter(color_sql, Connstr_SC); //查询
color_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
@@ -90,13 +75,13 @@ namespace formula_manage.Windows
/// </summary>
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
e.Row.Header = e.Row.GetIndex() + 1;
}
/// <summary>
/// 查询数据库的方法
/// </summary>
private async void GridSql()
private async void GridSql()
{
string color_sql = "SELECT COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark FROM [dbo].[COLOR]";//查询语句
@@ -121,7 +106,7 @@ namespace formula_manage.Windows
}
private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
{
{
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数
string color_sql;
int ColorCode_SQL;
@@ -143,22 +128,22 @@ namespace formula_manage.Windows
if (string.IsNullOrEmpty(this.color_name.Text))
System.Windows.MessageBox.Show("ERR:无效的原料名称", "错误");//检查原料名
else
{
{
try
{
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
color_sql = "SELECT count(*) FROM [dbo].[COLOR] WHERE COLOR_CODE = '" + color_code.Text + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(color_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
conn_SC.Close(); //关闭连接
if (count == 0)
if (count == 0)
{
color_sql = string.Format("INSERT INTO [dbo].[COLOR](COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark) " +
"VALUES ('" + color_code.Text + "','" + color_name.Text + "','" + ColorCode_SQL + "','" + color_Remark.Text + "')");
"VALUES ('" + color_code.Text + "','" + color_name.Text + "','" + ColorCode_SQL + "','" + color_Remark.Text + "')");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(color_sql, conn_SC);
SqlCommand INSERT_cmd = new SqlCommand(color_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
@@ -171,8 +156,8 @@ namespace formula_manage.Windows
GridSql();
System.Windows.MessageBox.Show("添加完成");
}
}
else
}
else
{
color_sql = string.Format("UPDATE [dbo].[COLOR] SET COLOR_NAME='" + color_name.Text + "',COLOR_NO='" + ColorCode_SQL + "',COLOR_Remark='" + color_Remark.Text + "' Where COLOR_CODE='" + color_code.Text + "'");
await conn_SC.OpenAsync(); //打开数据连接
@@ -185,9 +170,9 @@ namespace formula_manage.Windows
System.Windows.MessageBox.Show("C0110-1:修改失败");
}
else
{
{
GridSql();
System.Windows.MessageBox.Show("修改完成");
}
}
@@ -197,40 +182,40 @@ namespace formula_manage.Windows
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
{
string ShowProductName = "是否删除【" + this.color_name.Text + "】" + this.color_code.Text;//获取信息并拼接提示字符串
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
if (showProductName == MessageBoxResult.Yes)//判断是否删除
{
string Stuff_sql = string.Format("DELETE FROM [dbo].[COLOR] WHERE COLOR_CODE ='" + color_code.Text.ToString() + "'");
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功
}
else
{
GridSql();
}
}
else
{
GridSql();
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
}
private void DataGridcolor_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
@@ -269,5 +254,5 @@ namespace formula_manage.Windows
//ColorCode_SQL = Convert.ToInt32(colorCode, 16);//十六进制RGB转存储数值
}
}
}
}
}
+29 -45
View File
@@ -1,25 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight;
using formula_manage.SQLModels;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using Xceed.Wpf.AvalonDock.Themes;
using static System.Net.Mime.MediaTypeNames;
namespace formula_manage.Windows
{
@@ -32,7 +17,6 @@ namespace formula_manage.Windows
DataTable dataTable = new DataTable(); //建立缓存
int Button_ID = 0;
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
@@ -72,7 +56,7 @@ namespace formula_manage.Windows
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter fabric_data = new SqlDataAdapter(fabric_sql, Connstr_SC); //查询
fabric_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
@@ -90,13 +74,13 @@ namespace formula_manage.Windows
/// </summary>
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
e.Row.Header = e.Row.GetIndex() + 1;
}
/// <summary>
/// 查询数据库的方法
/// </summary>
private async void GridSql()
private async void GridSql()
{
string fabric_sql = "SELECT Code ,Name , GYard , Remark FROM [dbo].[PRODUCTION_Material]";//查询语句
@@ -121,7 +105,7 @@ namespace formula_manage.Windows
}
private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
{
{
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数
string fabric_sql;
@@ -134,22 +118,22 @@ namespace formula_manage.Windows
if (string.IsNullOrEmpty(this.fabric_name.Text))
System.Windows.MessageBox.Show("ERR:无效的原料名称", "错误");//检查原料名
else
{
{
try
{
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
fabric_sql = "SELECT count(*) FROM [dbo].[PRODUCTION_Material] WHERE Code = '" + fabric_code.Text + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(fabric_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
conn_SC.Close(); //关闭连接
if (count == 0)
if (count == 0)
{
fabric_sql = string.Format("INSERT INTO [dbo].[PRODUCTION_Material](Code ,Name , GYard , Remark) " +
"VALUES ('" + fabric_code.Text + "','" + fabric_name.Text + "','" + fabric_GYard.Text + "','" + fabric_Remark.Text + "')");
"VALUES ('" + fabric_code.Text + "','" + fabric_name.Text + "','" + fabric_GYard.Text + "','" + fabric_Remark.Text + "')");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC);
SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
@@ -162,10 +146,10 @@ namespace formula_manage.Windows
GridSql();
System.Windows.MessageBox.Show("添加完成");
}
}
else
}
else
{
fabric_sql = string.Format("UPDATE [dbo].[PRODUCTION_Material] SET Name='" + fabric_name.Text + "',GYard='" + fabric_GYard.Text + "',Remark='" + fabric_Remark.Text + "' Where Code='"+ fabric_code.Text + "'");
fabric_sql = string.Format("UPDATE [dbo].[PRODUCTION_Material] SET Name='" + fabric_name.Text + "',GYard='" + fabric_GYard.Text + "',Remark='" + fabric_Remark.Text + "' Where Code='" + fabric_code.Text + "'");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
@@ -176,9 +160,9 @@ namespace formula_manage.Windows
System.Windows.MessageBox.Show("C0110-1:修改失败");
}
else
{
{
GridSql();
System.Windows.MessageBox.Show("修改完成");
}
}
@@ -188,40 +172,40 @@ namespace formula_manage.Windows
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
{
string ShowProductName = "是否删除【" + this.fabric_name.Text + "】" + this.fabric_code.Text;//获取信息并拼接提示字符串
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
if (showProductName == MessageBoxResult.Yes)//判断是否删除
{
string Stuff_sql = string.Format("DELETE FROM [dbo].[PRODUCTION_Material] WHERE Code ='" + fabric_code.Text.ToString() + "'");
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功
}
else
{
GridSql();
}
}
else
{
GridSql();
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
}
private void DataGridfabric_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
@@ -237,5 +221,5 @@ namespace formula_manage.Windows
}
}
}
}
}
+174 -68
View File
@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>formula_manage</RootNamespace>
<AssemblyName>formula_manage</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@@ -31,6 +31,8 @@
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
@@ -112,89 +114,32 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Accessibility" />
<Reference Include="CommonServiceLocator, Version=2.0.2.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>packages\CommonServiceLocator.2.0.2\lib\net45\CommonServiceLocator.dll</HintPath>
</Reference>
<Reference Include="FastReport, Version=2024.1.2.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
<HintPath>packages\FastReport.Net.Demo.2024.1.2\lib\net462\FastReport.dll</HintPath>
</Reference>
<Reference Include="FastReport.Bars, Version=2024.1.2.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
<HintPath>packages\FastReport.Net.Demo.2024.1.2\lib\net462\FastReport.Bars.dll</HintPath>
</Reference>
<Reference Include="FastReport.Compat, Version=2024.1.0.0, Culture=neutral, PublicKeyToken=406e1f4c3c8ef97e, processorArchitecture=MSIL">
<HintPath>packages\FastReport.Compat.2024.1.0\lib\net40\FastReport.Compat.dll</HintPath>
</Reference>
<Reference Include="FastReport.DataVisualization, Version=2024.1.0.0, Culture=neutral, PublicKeyToken=406e1f4c3c8ef97e, processorArchitecture=MSIL">
<HintPath>packages\FastReport.DataVisualization.2024.1.0\lib\net40\FastReport.DataVisualization.dll</HintPath>
</Reference>
<Reference Include="FastReport.Editor, Version=2024.1.2.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
<HintPath>packages\FastReport.Net.Demo.2024.1.2\lib\net462\FastReport.Editor.dll</HintPath>
</Reference>
<Reference Include="FastReport.VSDesign, Version=1.0.0.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
<HintPath>packages\FastReport.Net.Demo.2024.1.2\lib\net462\FastReport.VSDesign.dll</HintPath>
</Reference>
<Reference Include="FastReport.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
<HintPath>packages\FastReport.Net.Demo.2024.1.2\lib\net462\FastReport.Web.dll</HintPath>
</Reference>
<Reference Include="FirstFloor.ModernUI, Version=1.0.9.0, Culture=neutral, PublicKeyToken=bc9b0c37bf06c6a9, processorArchitecture=MSIL">
<HintPath>packages\ModernUI.WPF.1.0.9\lib\net45\FirstFloor.ModernUI.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.4.1.0, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
</Reference>
<Reference Include="ModernUI.Xceed.AvalonDock, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\SamOatesGames.ModernUI.Xceed.Toolkit.1.0.1905191936\lib\net45\ModernUI.Xceed.AvalonDock.dll</HintPath>
</Reference>
<Reference Include="ModernUI.Xceed.Toolkit, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\SamOatesGames.ModernUI.Xceed.Toolkit.1.0.1905191936\lib\net45\ModernUI.Xceed.Toolkit.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.Numerics" />
<Reference Include="System.Printing" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="ThoughtWorks.QRCode, Version=1.0.4778.30637, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\ThoughtWorks.QRCode.1.1.0\lib\ThoughtWorks.QRCode.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Xceed.Wpf.AvalonDock, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.5.1\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.5.1\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.5.1\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.5.1\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.Toolkit, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\Extended.Wpf.Toolkit.4.5.1\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
@@ -211,6 +156,9 @@
<Compile Include="ConvertMoels\StatenConvert.cs" />
<Compile Include="ConvertMoels\StatenERRConvert.cs" />
<Compile Include="ConvertMoels\UserSQLConvert.cs" />
<Compile Include="EX\Exchange.xaml.cs">
<DependentUpon>Exchange.xaml</DependentUpon>
</Compile>
<Compile Include="EX\ExProgram.xaml.cs">
<DependentUpon>ExProgram.xaml</DependentUpon>
</Compile>
@@ -222,14 +170,19 @@
<Compile Include="UserClass\Code128.cs" />
<Compile Include="UserClass\CRCcheck16.cs" />
<Compile Include="UserClass\DataGridHelper.cs" />
<Compile Include="UserClass\get_local_ip_address.cs" />
<Compile Include="UserClass\HardwareSN.cs" />
<Compile Include="UserClass\LogGing.cs" />
<Compile Include="UserClass\TCPServer.cs" />
<Compile Include="UserClass\IniFile.cs" />
<Compile Include="UserClass\LogDataRead.cs" />
<Compile Include="UserClass\MD5check.cs" />
<Compile Include="UserClass\PressKey.cs" />
<Compile Include="UserClass\DataTableForToObservableCollection.cs" />
<Compile Include="UserClass\PrintHelper.cs" />
<Compile Include="UserClass\StrToInt.cs" />
<Compile Include="UserClass\UserPrint.cs" />
<Compile Include="ViewModel\ExchangeViewModel.cs" />
<Compile Include="ViewModel\RECIPEViewModel.cs" />
<Compile Include="ViewModel\MainWindowViewModel.cs" />
<Compile Include="ViewModel\ViewModelLocator.cs" />
@@ -281,11 +234,11 @@
<Compile Include="Windows\Stuff.xaml.cs">
<DependentUpon>Stuff.xaml</DependentUpon>
</Compile>
<Page Include="EX\ExProgram.xaml">
<Page Include="EX\Exchange.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Flow_Document\PRINT_D.xaml">
<Page Include="EX\ExProgram.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -395,8 +348,36 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="FastReport\FRX\test.frx" />
<None Include="FastReport\FRX\test1.frx" />
<None Include="FastReport\Localization\Arabic.frl" />
<None Include="FastReport\Localization\Armenian.frl" />
<None Include="FastReport\Localization\Chinese %28Simplified%29.frl" />
<None Include="FastReport\Localization\Chinese %28Traditional%29.frl" />
<None Include="FastReport\Localization\Croatian.frl" />
<None Include="FastReport\Localization\Czech.frl" />
<None Include="FastReport\Localization\Danish.frl" />
<None Include="FastReport\Localization\Dutch.frl" />
<None Include="FastReport\Localization\French.frl" />
<None Include="FastReport\Localization\German.frl" />
<None Include="FastReport\Localization\Greek.frl" />
<None Include="FastReport\Localization\Hungarian.frl" />
<None Include="FastReport\Localization\Italian.frl" />
<None Include="FastReport\Localization\Persian.frl" />
<None Include="FastReport\Localization\Polish.frl" />
<None Include="FastReport\Localization\Portuguese %28Brazil%29.frl" />
<None Include="FastReport\Localization\Portuguese.frl" />
<None Include="FastReport\Localization\Romanian.frl" />
<None Include="FastReport\Localization\Russian.frl" />
<None Include="FastReport\Localization\Serbian.frl" />
<None Include="FastReport\Localization\Slovak.frl" />
<None Include="FastReport\Localization\Slovenian.frl" />
<None Include="FastReport\Localization\Spanish.frl" />
<None Include="FastReport\Localization\Swedish.frl" />
<None Include="FastReport\Localization\Thai.frl" />
<None Include="FastReport\Localization\Turkish.frl" />
<None Include="FastReport\Localization\Ukrainian.frl" />
<None Include="formula_manage_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -435,5 +416,130 @@
<ItemGroup>
<Resource Include="sunlight_logo.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="FastReport\Localization\readme.txt" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommonServiceLocator">
<Version>2.0.7</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm">
<Version>8.2.2</Version>
</PackageReference>
<PackageReference Include="DotNetty.Buffers">
<Version>0.7.6</Version>
</PackageReference>
<PackageReference Include="DotNetty.Codecs">
<Version>0.7.6</Version>
</PackageReference>
<PackageReference Include="DotNetty.Codecs.Http">
<Version>0.7.6</Version>
</PackageReference>
<PackageReference Include="DotNetty.Common">
<Version>0.7.6</Version>
</PackageReference>
<PackageReference Include="DotNetty.Handlers">
<Version>0.7.6</Version>
</PackageReference>
<PackageReference Include="DotNetty.Transport">
<Version>0.7.6</Version>
</PackageReference>
<PackageReference Include="DotNettySocket">
<Version>1.2.0</Version>
</PackageReference>
<PackageReference Include="Extended.Wpf.Toolkit">
<Version>4.6.0</Version>
</PackageReference>
<PackageReference Include="FastReport.Compat">
<Version>2024.2.11</Version>
</PackageReference>
<PackageReference Include="FastReport.DataVisualization">
<Version>2024.2.11</Version>
</PackageReference>
<PackageReference Include="FastReport.Net.Demo">
<Version>2024.2.11</Version>
</PackageReference>
<PackageReference Include="FastReport.OpenSource">
<Version>2024.2.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces">
<Version>8.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CSharp">
<Version>4.7.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection">
<Version>8.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
<Version>8.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging">
<Version>8.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions">
<Version>8.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Options">
<Version>8.0.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Primitives">
<Version>8.0.0</Version>
</PackageReference>
<PackageReference Include="ModernUI.WPF">
<Version>1.0.9</Version>
</PackageReference>
<PackageReference Include="MvvmLightLibs">
<Version>5.4.1.1</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference>
<PackageReference Include="NModbus">
<Version>3.0.81</Version>
</PackageReference>
<PackageReference Include="Prism.Core">
<Version>8.1.97</Version>
</PackageReference>
<PackageReference Include="Prism.Forms">
<Version>8.1.97</Version>
</PackageReference>
<PackageReference Include="SamOatesGames.ModernUI.Xceed.Toolkit">
<Version>1.0.1905191936</Version>
</PackageReference>
<PackageReference Include="System.Buffers">
<Version>4.5.1</Version>
</PackageReference>
<PackageReference Include="System.Collections.Immutable">
<Version>8.0.0</Version>
</PackageReference>
<PackageReference Include="System.ComponentModel.Annotations">
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="System.Diagnostics.DiagnosticSource">
<Version>8.0.1</Version>
</PackageReference>
<PackageReference Include="System.Memory">
<Version>4.5.5</Version>
</PackageReference>
<PackageReference Include="System.Numerics.Vectors">
<Version>4.5.0</Version>
</PackageReference>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
<Version>6.0.0</Version>
</PackageReference>
<PackageReference Include="System.Threading.Tasks.Extensions">
<Version>4.5.4</Version>
</PackageReference>
<PackageReference Include="System.ValueTuple">
<Version>4.5.0</Version>
</PackageReference>
<PackageReference Include="ThoughtWorks.QRCode">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms">
<Version>5.0.0.2662</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
-13
View File
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="2.0.2" targetFramework="net46" />
<package id="Extended.Wpf.Toolkit" version="4.5.1" targetFramework="net46" />
<package id="FastReport.Compat" version="2024.1.0" targetFramework="net462" />
<package id="FastReport.DataVisualization" version="2024.1.0" targetFramework="net462" />
<package id="FastReport.Net.Demo" version="2024.1.2" targetFramework="net462" />
<package id="ModernUI.WPF" version="1.0.9" targetFramework="net46" />
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net46" />
<package id="SamOatesGames.ModernUI.Xceed.Toolkit" version="1.0.1905191936" targetFramework="net46" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net46" />
<package id="ThoughtWorks.QRCode" version="1.1.0" targetFramework="net46" />
</packages>