Compare commits

..
192 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
sc ec55b35065 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-14 23:32:49 +08:00
sc bf8f9a368a Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-14 23:32:48 +08:00
sc f3e9acf822 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-14 23:15:55 +08:00
sc ee4bc611ea 添加Code128(包含128A,128B,128C)类 2024-04-14 23:15:53 +08:00
sc 958279bd74 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-14 22:38:37 +08:00
sc 4928ff1178 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-14 22:38:32 +08:00
sc a5942b3285 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 23:14:12 +08:00
sc f3b5d1eca2 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 23:14:07 +08:00
sc 1e2bfad5a1 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 23:07:19 +08:00
sc 0af25953b6 添加扩展程序状态显示 2024-04-03 23:07:17 +08:00
sc 505dfebd05 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 22:32:05 +08:00
sc 3c0270843f Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 22:32:04 +08:00
sc c54ccea98c Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 22:19:52 +08:00
sc 3d267018b1 添加ex页面 2024-04-03 22:19:50 +08:00
sc 6903e2264c Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 21:02:32 +08:00
sc 4ba15a8e69 修改引导事件 2024-04-03 21:02:30 +08:00
sc 94ad77a58b Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 13:58:30 +08:00
sc 03810f8e10 提醒页面倒计时60秒Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 13:58:28 +08:00
sc fceb6cdea2 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 13:57:55 +08:00
sc a6c37286f9 注册提示页面提前提醒 2024-04-03 13:57:53 +08:00
sc 900b9e59e9 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 13:46:03 +08:00
sc eab45768e4 注册提醒页面关闭倒计时 2024-04-03 13:46:01 +08:00
sc 6ce7ce1cc2 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-03 13:08:58 +08:00
sc c17474c77f 添加注册到期提示页面 2024-04-03 13:08:56 +08:00
sc de5d7202c2 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-04-02 15:42:20 +08:00
sc 59ba780070 CDKEY提示修改 2024-04-02 15:41:45 +08:00
sc 9dafd3115e Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-04-01 00:15:06 +08:00
sc 8a4d7c6d4f CDKEY保存逻辑修改 2024-04-01 00:15:05 +08:00
sc 3af7ead309 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-31 23:50:34 +08:00
sc 8c38e3e12b 增加注册码功能 2024-03-31 23:50:31 +08:00
sc f7ec9127b6 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-29 21:07:21 +08:00
sc bfa5b59496 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-29 21:07:20 +08:00
sc 4d261383e3 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-29 18:11:28 +08:00
sc 81c98ec936 添加CRC16校验 2024-03-29 18:11:25 +08:00
sc c8ed59e183 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-29 15:36:18 +08:00
sc 169753f266 添加CDKEY界面 2024-03-29 15:36:17 +08:00
sc 17d66e2bf2 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-29 15:26:54 +08:00
sc 3d553d1eed Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-29 15:26:52 +08:00
sc 87980cc2da Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-27 23:32:18 +08:00
sc 424b63f0c5 修改SQL查询语句 2024-03-27 23:32:17 +08:00
sc d0131a2795 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-27 22:58:28 +08:00
sc 16f0c6ecf4 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-27 22:58:27 +08:00
sc 1b60fe900b Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-27 22:57:40 +08:00
sc e6d467057a 添加颜色名称页面 2024-03-27 22:57:39 +08:00
sc 714168f47f Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-27 22:24:35 +08:00
sc f558f56d42 添加客户管理页面 2024-03-27 22:24:33 +08:00
sc f8ec8a6759 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-27 21:52:40 +08:00
sc 4324fdd74b sql语句修改 2024-03-27 21:52:38 +08:00
sc a5efa3ca59 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-26 23:36:46 +08:00
sc e7dd94bb39 添加去除空白字符串代码(TrimEnd()) 2024-03-26 23:36:45 +08:00
sc 714de60f95 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-26 23:30:57 +08:00
sc 861d823ce9 添加布种管理页面 2024-03-26 23:30:56 +08:00
sc 254d5db8ef Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-26 00:01:53 +08:00
sc 2d4314a07f 添加登录者日志 2024-03-26 00:01:52 +08:00
sc a3477a1f1a Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-25 23:23:50 +08:00
sc 9f75476c47 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-25 23:23:49 +08:00
sc 48d8ecd8ca Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-25 23:01:38 +08:00
sc 292e41a5c4 添加RECIPE配方管理页面 2024-03-25 23:01:36 +08:00
sc d8abe646b7 Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage 2024-03-25 20:31:22 +08:00
sc 693f291adc Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-25 20:31:19 +08:00
sc d3527f0f5c Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-25 19:32:07 +08:00
sc 9858f2fcaf Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-25 19:32:04 +08:00
sc b524ca8050 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-24 17:24:18 +08:00
sc 621ea71c97 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-24 17:24:16 +08:00
sc 3a54fe47c5 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-24 13:21:20 +08:00
sc 33f6e28cfa Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-24 13:21:18 +08:00
sc 165f707221 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-24 12:38:11 +08:00
sc b2e0d05648 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-24 12:38:08 +08:00
sc 8e64f6b27d Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-24 11:14:52 +08:00
sc b215016d91 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-24 11:14:50 +08:00
sc b69ee37cbb Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-20 13:49:18 +08:00
sc e7053ceab3 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-20 13:49:16 +08:00
sc 4c2f130667 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-20 13:46:11 +08:00
sc 28c61a4255 Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage 2024-03-20 13:46:09 +08:00
103 changed files with 53824 additions and 716 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>
+1 -1
View File
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:formula_manage"
StartupUri="Login.xaml"
Startup="Application_Startup"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
>
+60 -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,74 @@ 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>
/// 启动初始页面
/// </summary>
private void Application_Startup(object sender, StartupEventArgs e)
{
Application.Current.StartupUri = new Uri("Login.xaml", UriKind.Relative);//和MainWindwo同一目录
//Application.Current.StartupUri = new Uri("EX/ExProgram.xaml", UriKind.Relative);//在目录下
}
}
}
-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
-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
-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
-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
-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;
/// <summary>
/// 运行状态变换器
-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
{
-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
+22
View File
@@ -0,0 +1,22 @@
<Window x:Class="formula_manage.EX.ExProgram"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.EX"
mc:Ignorable="d"
Title="ExProgram" Height="720" Width="1280" MinHeight="720" MinWidth="1280" Background="#FFE0E0E0">
<Grid>
<RichTextBox x:Name="textLog" Margin="0,300,0,0" IsReadOnly="True" VerticalScrollBarVisibility="Visible" Background="White">
<FlowDocument>
<Paragraph>
<Run Text="TEXTLOG"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>
+17
View File
@@ -0,0 +1,17 @@
using formula_manage.UserClass;
using System.Windows;
namespace formula_manage.EX
{
/// <summary>
/// ExProgram.xaml 的交互逻辑
/// </summary>
public partial class ExProgram : Window
{
public ExProgram()
{
InitializeComponent();
LogDataRead.SetTextControl(textLog);
}
}
}
+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
{
+1 -7
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>
/// 查询接口
+53 -46
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,11 +14,6 @@ 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缓存
@@ -41,27 +23,14 @@ namespace formula_manage
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) //登录按钮事件
@@ -82,13 +51,16 @@ namespace formula_manage
Window window = Window.GetWindow(this);
MainWindow Main = new MainWindow();
window.Close();
Main.ShowDialog();//实例化并置顶打开信息窗口
UserClass.LogGing.LogGingDATA("LOGon = ENGINEER");
Main.ShowDialog();//实例化并置顶打开窗口
}
else
{
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
@@ -100,8 +72,10 @@ namespace formula_manage
Window window = Window.GetWindow(this);
MainWindow Main = new MainWindow();
window.Close();
Main.ShowDialog();//实例化并置顶打开窗口
UserClass.LogGing.LogGingDATA("LOGon = " + user);
Main.ShowDialog();//实例化并置顶打开窗口
}
else
System.Windows.MessageBox.Show("账号或密码错误");
@@ -139,14 +113,36 @@ namespace formula_manage
DBCLINK.Visibility = Visibility.Hidden;
EXLINK.Visibility = Visibility.Hidden;
USERLINK.Visibility = Visibility.Hidden;
DISPENLINK.Background = Brushes.Red;
}
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")))
{
try
{
EXLINK.Background = Brushes.Green;
}
catch (Exception)
{
EXLINK.Background = Brushes.Red;
System.Windows.MessageBox.Show("扩展程序未启动");
UserClass.LogGing.LogGingDATA("EX = FALL_TO_START");
}
}
try
{
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
TEXT_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("配置信息丢失");
}
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
@@ -161,12 +157,17 @@ namespace formula_manage
try
{
await conn_SC.OpenAsync();
}catch (Exception)
}
catch (Exception)
{
DISPENLINK.Background = Brushes.Red; //连接失败红色
DBCLINK.Background = Brushes.Red;
System.Windows.MessageBox.Show("连接数据库失败");
Windows.Sql sql = new Windows.Sql();
sql.ShowDialog();//实例化并置顶打开数据库设置窗口
//Windows.Sql sql = new Windows.Sql();
//sql.ShowDialog();//实例化并置顶打开数据库设置窗口
UserClass.LogGing.LogGingDATA("DISPENLINK = ConnectFailed");
return;
}
conn_SC.Close(); //关闭连接
@@ -192,12 +193,16 @@ namespace formula_manage
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();//实例化并置顶打开数据库设置窗口
//Windows.Sql sql = new Windows.Sql();
//sql.ShowDialog();//实例化并置顶打开数据库设置窗口
UserClass.LogGing.LogGingDATA("DBCLINK = ConnectFailed");
return;
}
DBCLINK.Background = Brushes.Green; //连接成功绿色
@@ -224,11 +229,13 @@ namespace formula_manage
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
UserClass.LogGing.LogGingDATA("USER = NoData");
return;
}
}
}
}
}
+31 -26
View File
@@ -13,9 +13,9 @@
<ViewModel:MainWindowViewModel x:Key="MainWindowViewModel"/>
</Window.Resources>
<Grid>
<Menu IsTabStop="False" Grid.ColumnSpan="2">
<Menu IsTabStop="False" Grid.ColumnSpan="1">
<MenuItem x:Name="tab" Header="_文件" FontSize="16" Focusable ="False" >
<MenuItem Header="_许可证" FontSize="16"/>
<MenuItem Header="_许可证" Click="CDKEY_SET" FontSize="16"/>
<Separator/>
<MenuItem Header="_注销" FontSize="16" Click="logout"/>
</MenuItem>
@@ -25,7 +25,7 @@
<Separator/>
<MenuItem Header="_软件设置" FontSize="16" Name="_SOFTWARE_SET" Click="SOFTWARE_SET" IsEnabled="False"/>
<MenuItem Header="_打印设置" FontSize="16" Name="_PRINT_SET" Click="PRINT_SET" IsEnabled="False"/>
<MenuItem Header="_用户设置" FontSize="16" Name="_USER_SET" Click="USER_SET" IsEnabled="False"/>
<MenuItem Header="_登录限制" FontSize="16" Name="_USER_log" IsEnabled="False"/>
</MenuItem>
<MenuItem Header="_管理" FontSize="16" Focusable ="False">
<MenuItem Header="_染色机管理" FontSize="16" Name="_MAC_SET" Click="MAC_SET" IsEnabled="False"/>
@@ -35,17 +35,23 @@
<MenuItem Header="_预设工艺管理" FontSize="16" Name="_PROCESS" Click="PROCESS" IsEnabled="False"/>
<Separator/>
<MenuItem Header="_配送流程管理" FontSize="16" Name="_WORKFLOW" Click="WORKFLOW" IsEnabled="False"/>
<MenuItem Header="_流程选择规则" FontSize="16" Name="_WORKFLOWSET" Click="WORKFLOWSET" IsEnabled="False"/>
<Separator />
<MenuItem Header="_布种" FontSize="16" Name="_fabric" Click="fabric" IsEnabled="False"/>
<MenuItem Header="_品名" FontSize="16" Name="_variety" Click="variety" IsEnabled="False"/>
<MenuItem Header="_色号" FontSize="16" Name="_color" Click="color" IsEnabled="False"/>
<MenuItem Header="_颜色名" FontSize="16" Name="_color" Click="color" IsEnabled="False"/>
<MenuItem Header="_客户" FontSize="16" Name="_client" Click="client" IsEnabled="False"/>
<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"/>
<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>
@@ -56,7 +62,7 @@
<TextBox x:Name="USER" HorizontalAlignment="Right" Height="30" Margin="0,0,155,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="100" FontSize="14"
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False" Grid.Column="1"/>
<Button Content="新工单" HorizontalAlignment="Left" Margin="335,35,0,0" Height="30" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" FontSize="20" Click="Button_NewOrder" Focusable ="False" Grid.Column="1"/>
<Button Content="归属订单" HorizontalAlignment="Left" Margin="300,70,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology" Grid.Column="1"/>
<Button Content="归属订单" HorizontalAlignment="Left" Margin="300,70,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Order" Grid.Column="1"/>
<Button Content="预设工艺" HorizontalAlignment="Left" Margin="300,105,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology" Grid.Column="1"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,35,0,0" TextWrapping="Wrap" Text="领料单号:" VerticalAlignment="Top" Width="90" FontSize="20" Background="WhiteSmoke"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,70,0,0" TextWrapping="Wrap" Text="流转订单:" VerticalAlignment="Top" Width="90" FontSize="20"/>
@@ -65,12 +71,12 @@
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,175,0,0" TextWrapping="Wrap" Text="类型:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="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 HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
<TextBox x:Name="order" HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
<TextBox x:Name="ReDye" HorizontalAlignment="Left" Height="30" Margin="300,35,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="30" FontSize="20"
MaxLines="1" MaxLength="2" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" Focusable ="False" Grid.Column="1"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
MaxLines="1" MaxLength="2" Grid.Column="1" IsReadOnly="True"/>
<TextBox x:Name="Technology" HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
<ComboBox x:Name="Machine" DisplayMemberPath="Name"
ItemsSource="{Binding mac_Machine, Source={StaticResource MainWindowViewModel}}"
HorizontalAlignment="Left" Height="30" Margin="95,140,0,0" VerticalAlignment="Top" Width="120" FontSize="20"
@@ -160,6 +166,7 @@
</DataGrid.Resources>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="序" Width="30" FontSize="15" MaxWidth="30" MinWidth="30" Binding="{Binding ID}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
<DataGridTextColumn Header="步骤" Width="50" FontSize="15" MaxWidth="50" MinWidth="50" Binding="{Binding STEP}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
@@ -185,18 +192,7 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_SHIFT" BorderThickness="0,0,0,0" Text="{Binding SHIFT}"
BorderBrush="{x:Null}" Background="{x:Null}"
IsEditable="True" IsReadOnly="True" Focusable="True" IsTabStop="False">
<ComboBoxItem Content="%"></ComboBoxItem>
<ComboBoxItem Content="g/L"></ComboBoxItem>
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}" Binding="{Binding SHIFT}"/>
<DataGridTemplateColumn Header="原料名称" Width="200" MaxWidth="400" MinWidth="100" CellStyle="{StaticResource CellStyle}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
@@ -211,7 +207,7 @@
</DataGridTemplateColumn>
<DataGridTextColumn Header="目标重量(g)" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" IsReadOnly="True" Binding="{Binding TARGET_WT}" CellStyle="{StaticResource CellStyle}"/>
<DataGridTextColumn Header="单位" Width="80" FontSize="15" MaxWidth="80" MinWidth="80" IsReadOnly="True" Binding="{Binding UNIT}" CellStyle="{StaticResource CellStyle}"/>
<DataGridTextColumn Header="备注" Width="600" FontSize="15" MinWidth="600" Binding="{Binding REMARK}" CellStyle="{StaticResource CellStyle}"/>
<DataGridTextColumn Header="备注" FontSize="15" MinWidth="1000" Binding="{Binding REMARK}" CellStyle="{StaticResource CellStyle}" IsReadOnly="False"/>
</DataGrid.Columns>
</DataGrid>
@@ -220,9 +216,18 @@
<Button x:Name="Save" Content="保存" IsEnabled="False" HorizontalAlignment="Left" Height="40" Width="80" Margin="15,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="save" IsTabStop="False" Focusable ="False"/>
<Button x:Name="Delete" Content="删除" IsEnabled="False" HorizontalAlignment="Left" Height="40" Width="80" Margin="100,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="delete" IsTabStop="False" Focusable ="False"/>
<Grid Grid.Column="1" Height="325" Margin="415,35,5,0" VerticalAlignment="Top" Background="#FFF7F7F7">
<Grid Grid.Column="1" Height="325" Margin="415,35,5,0" VerticalAlignment="Top" Background="White">
<ContentControl x:Name="Deputy"/>
</Grid>
<Grid Grid.Column="1" Margin="0,0,0,0" Background="White" Visibility="{Binding Cdk_page}" Opacity="0.8">
<TextBlock Height="150" Margin="0,0,0,300" TextWrapping="Wrap" Text="注册信息到期,处理注册信息预计需要3个工作日,为避免影响系统使用请及时提交注册信息!" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Height="50" Margin="0,0,0,100" TextWrapping="Wrap" Text="{Binding Cdk_time}" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red"/>
<TextBlock Height="50" Margin="0,0,0,0" TextWrapping="Wrap" Text="请联系 SUNLIGHT" Width="300" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button Content="激活" HorizontalAlignment="Center" Height="50" Margin="200,100,0,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="#FFDFDFDF" Click="CDKEY_SET"/>
<Button Content="帮助" HorizontalAlignment="Center" Height="50" Margin="0,100,200,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="#FFDFDFDF" Click="HELP"/>
<TextBlock Height="50" Margin="0,0,0,0" TextWrapping="Wrap" Text="{Binding Cdk_pageT}" Width="500" FontSize="34" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
</Grid>
</Grid>
</Window>
+196 -90
View File
@@ -1,39 +1,18 @@
using formula_manage.Windows;
using formula_manage.UserClass;
using formula_manage.View;
using formula_manage.ViewModel;
using formula_manage.Windows;
using System;
using System.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;
namespace formula_manage
{
@@ -51,7 +30,9 @@ namespace formula_manage
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
// 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;
@@ -60,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()
{
@@ -70,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));
@@ -89,21 +82,25 @@ namespace formula_manage
_SQL.IsEnabled = true;
_SQLBAK.IsEnabled = true;
_SOFTWARE_SET.IsEnabled = true;
_EX_SET.IsEnabled = true;
_PRINT_SET.IsEnabled = true;
_USER_SET.IsEnabled = true;
_USER_log.IsEnabled = true;
_RECIPE.IsEnabled = true;
_PROCESS.IsEnabled = true;
_WORKFLOW.IsEnabled = true;
_WORKFLOWSET.IsEnabled = true;
_MAC_SET.IsEnabled = true;
_STUFF.IsEnabled = true;
_fabric.IsEnabled = true;
_variety.IsEnabled = true;
_client.IsEnabled = true;
_color.IsEnabled = true;
_statistics.IsEnabled = true;
_exchange.IsEnabled = true;
}
sql_();
PrintForms();
Permissions_(); //权限管理
DataRow row = RRODUCTdataTable.NewRow(); //ID列
@@ -115,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");
@@ -132,16 +158,18 @@ 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_()
{
DataTable logindataTable = new DataTable(); //建立login缓存
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
string user_sql = "SELECT UserCode ,PassWord ,UserSetup ,Capacity ,GROUP_CODE ,Note FROM [Dispensing].[dbo].[UserAccount] WHERE Capacity != 0";//查询语句
string user_sql = "SELECT UserCode ,PassWord ,UserSetup ,Capacity ,GROUP_CODE ,Note FROM [dbo].[UserAccount] WHERE Capacity != 0";//查询语句
try
{
@@ -154,6 +182,7 @@ namespace formula_manage
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
UserClass.LogGing.LogGingDATA("DatabaseConnectionFailed");
return;
}
@@ -167,18 +196,20 @@ namespace formula_manage
_SQL.IsEnabled = true;
_SQLBAK.IsEnabled = true;
_SOFTWARE_SET.IsEnabled = true;
_EX_SET.IsEnabled = true;
_PRINT_SET.IsEnabled = true;
_USER_SET.IsEnabled = true;
_RECIPE.IsEnabled = true;
_PROCESS.IsEnabled = true;
_WORKFLOW.IsEnabled = true;
_WORKFLOWSET.IsEnabled = true;
_MAC_SET.IsEnabled = true;
_STUFF.IsEnabled = true;
_fabric.IsEnabled = true;
_variety.IsEnabled = true;
_client.IsEnabled = true;
_color.IsEnabled = true;
_statistics.IsEnabled = true;
_exchange.IsEnabled = true;
}
else
{
@@ -189,23 +220,19 @@ namespace formula_manage
_RECIPE.IsEnabled = true;
_PROCESS.IsEnabled = true;
_WORKFLOW.IsEnabled = true;
_WORKFLOWSET.IsEnabled = true;
_MAC_SET.IsEnabled = true;
_STUFF.IsEnabled = true;
_fabric.IsEnabled = true;
_variety.IsEnabled = true;
_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);
@@ -213,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) //回车跳转功能
{
@@ -234,6 +264,7 @@ namespace formula_manage
string Prepose; //料单前置
string PreposeT; //料单时间
string PreposeS; //料单序列格式
string PreposeGKG; //料单单位
int PreposeSl;
string str_Prepose;
bool Loginprint;
@@ -245,6 +276,7 @@ namespace formula_manage
Loginprint = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L2")); //是否立即打印料单
Loginanew = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L3")); //是否立即打印料单
Machine.IsEditable = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L4")); //允许自定义机台
PreposeGKG = Configini.IniReadvalue("SOFTWARE_SET", "L5");//计算单位
Prepose = Configini.IniReadvalue("SOFTWARE_SET", "T1"); //自定义料单前缀
PreposeT = Configini.IniReadvalue("SOFTWARE_SET", "T2"); //自定义料单时间
@@ -267,6 +299,26 @@ namespace formula_manage
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)//输入事件
{
@@ -289,6 +341,11 @@ namespace formula_manage
window.Close();
login.ShowDialog();//实例化并置顶打开登录窗口
}
private void CDKEY_SET(object sender, RoutedEventArgs e)
{
CDKEY cDKEY = new CDKEY();
cDKEY.ShowDialog();//实例化并置顶打开窗口
}
private void SQL(object sender, RoutedEventArgs e)
{
System.Windows.MessageBox.Show("进入数据库设置请您明确操作目的及可能需承担的后果", "警告");
@@ -314,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)
{
@@ -336,17 +398,27 @@ namespace formula_manage
}
private void RECIPE(object sender, RoutedEventArgs e)
{
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();
dissolve.ShowDialog();//实例化并置顶打开设置窗口
}
private void WORKFLOWSET(object sender, RoutedEventArgs e)
{
Windows.Dissolve dissolve = new Windows.Dissolve();
dissolve.ShowDialog();//实例化并置顶打开设置窗口
}
private void EXCHANGE(object sender, RoutedEventArgs e)//交换日志
{
EX.Exchange exchange = new EX.Exchange();
exchange.ShowDialog();
}
private void print(object sender, RoutedEventArgs e)
{
@@ -363,40 +435,36 @@ namespace formula_manage
// dialog.PrintVisual(richText, "测试");
}
Print.IsEnabled = true;
}
private void fabric(object sender, RoutedEventArgs e)
{
fabric fabric_page = new fabric();
fabric_page.ShowDialog();//实例化并置顶打开窗口
}
private void variety(object sender, RoutedEventArgs e)
{
}
private void color(object sender, RoutedEventArgs e)
{
color color_page = new color();
color_page.ShowDialog();//实例化并置顶打开窗口
}
private void client(object sender, RoutedEventArgs e)
{
client client_page = new client();
client_page.ShowDialog();//实例化并置顶打开窗口
}
private void confirm(object sender, RoutedEventArgs e)
{
Confirm.IsEnabled = false;
}
private void delete(object sender, RoutedEventArgs e)
{
Delete.IsEnabled = false;
}
private async void save(object sender, RoutedEventArgs e) //保存按钮
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
string DYELOTS_sql = "SELECT count(*) FROM [Dispensing].[dbo].[DYELOTS_RECIPE] WHERE Dyelot = '" + Number.Text + "' and ReDye = '" + ReDye.Text + "'";//单号查询语句
string DYELOTS_sql = "SELECT count(*) FROM [dbo].[DYELOTS_RECIPE] WHERE Dyelot = '" + Number.Text + "' and ReDye = '" + ReDye.Text + "'";//单号查询语句
try
{
await conn_SC.OpenAsync(); //打开数据连接
@@ -424,6 +492,7 @@ namespace formula_manage
catch (Exception)
{
System.Windows.MessageBox.Show("数据访问失败,重试");
UserClass.LogGing.LogGingDATA("DatabaseConnectionFailed");
return;
} //单号重复检查
if (Machine.Text == "")
@@ -456,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");
@@ -483,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)
@@ -541,9 +618,29 @@ namespace formula_manage
if (P > 1) Procedures_P.Text = (P - 1).ToString();
}
public void Recevie_order(string[] value)//订单选择信息传递
{
order.Text = value[0];
Technology.Text = value[1] + "@" + value[2];
}
private void Button_Order(object sender, RoutedEventArgs e)
{
ViewOrder viewOrder = new ViewOrder();
viewOrder.sendMessage = Recevie_order;
Deputy.Content = viewOrder; //打开订单选择
}
public void Recevie_Technology(string[] value)//订单选择信息传递
{
Technology.Text = value[1] + "@" + value[0];
Procedures_N.Text = value[2];
}
private void Button_Technology(object sender, RoutedEventArgs e)
{
Deputy.Content = new View.ViewProcess(); //打开工艺选择
ViewProcess viewProcess = new ViewProcess();
viewProcess.sendMessage = Recevie_Technology;
Deputy.Content = viewProcess; //打开工艺选择
}
private void Button_Formula(object sender, RoutedEventArgs e)
@@ -570,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;
@@ -578,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 != "") //判断比例是否有效
{
@@ -602,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)//原料代码输入事件
{
@@ -611,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
{
@@ -630,7 +729,6 @@ namespace formula_manage
PressKey.PressKeys(Keys.Tab, false);
PressKey.PressKeys(Keys.Tab, true);
return;
}
}
@@ -641,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("重复原料");
@@ -652,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"))
{
@@ -686,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_;
@@ -709,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
}
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)
{
@@ -771,6 +875,7 @@ namespace formula_manage
}
}
}
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//原料代码选择事件
{
double ang;
@@ -778,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
{
@@ -808,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("重复原料");
@@ -818,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))
{
@@ -872,7 +979,7 @@ namespace formula_manage
if (curComboBox.Text != "")
{
Name_ = curComboBox.Text;
Name_ = curComboBox.Text.TrimEnd();
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
@@ -885,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))
{
@@ -929,7 +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())));
-4
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.SQLModels
{
+190
View File
@@ -0,0 +1,190 @@
using System;
using System.Text;
namespace formula_manage.UserClass
{
/// <summary>
/// CRC校验
/// </summary>
public class CRCcheck16
{
#region CRC16
public static byte[] CRC16(byte[] data)
{
int len = data.Length;
if (len > 0)
{
ushort crc = 0xFFFF;
for (int i = 0; i < len; i++)
{
crc = (ushort)(crc ^ (data[i]));
for (int j = 0; j < 8; j++)
{
crc = (crc & 1) != 0 ? (ushort)((crc >> 1) ^ 0xA001) : (ushort)(crc >> 1);
}
}
byte hi = (byte)((crc & 0xFF00) >> 8); //高位置
byte lo = (byte)(crc & 0x00FF); //低位置
return new byte[] { hi, lo };
}
return new byte[] { 0, 0 };
}
#endregion
#region ToCRC16
public static string ToCRC16(string content)
{
return ToCRC16(content, Encoding.UTF8);
}
public static string ToCRC16(string content, bool isReverse)
{
return ToCRC16(content, Encoding.UTF8, isReverse);
}
public static string ToCRC16(string content, Encoding encoding)
{
return ByteToString(CRC16(encoding.GetBytes(content)), true);
}
public static string ToCRC16(string content, Encoding encoding, bool isReverse)
{
return ByteToString(CRC16(encoding.GetBytes(content)), isReverse);
}
public static string ToCRC16(byte[] data)
{
return ByteToString(CRC16(data), true);
}
public static string ToCRC16(byte[] data, bool isReverse)
{
return ByteToString(CRC16(data), isReverse);
}
#endregion
#region ToModbusCRC16
public static string ToModbusCRC16(string s)
{
return ToModbusCRC16(s, true);
}
public static string ToModbusCRC16(string s, bool isReverse)
{
return ByteToString(CRC16(StringToHexByte(s)), isReverse);
}
public static string ToModbusCRC16(byte[] data)
{
return ToModbusCRC16(data, true);
}
public static string ToModbusCRC16(byte[] data, bool isReverse)
{
return ByteToString(CRC16(data), isReverse);
}
#endregion
#region ByteToString
public static string ByteToString(byte[] arr, bool isReverse)
{
try
{
byte hi = arr[0], lo = arr[1];
return Convert.ToString(isReverse ? hi + lo * 0x100 : hi * 0x100 + lo, 16).ToUpper().PadLeft(4, '0');
}
catch (Exception ex) { throw (ex); }
}
public static string ByteToString(byte[] arr)
{
try
{
return ByteToString(arr, true);
}
catch (Exception ex) { throw (ex); }
}
#endregion
#region StringToHexString
public static string StringToHexString(string str)
{
StringBuilder s = new StringBuilder();
foreach (short c in str.ToCharArray())
{
s.Append(c.ToString("X4"));
}
return s.ToString();
}
#endregion
#region StringToHexByte
private static string ConvertChinese(string str)
{
StringBuilder s = new StringBuilder();
foreach (short c in str.ToCharArray())
{
if (c <= 0 || c >= 127)
{
s.Append(c.ToString("X4"));
}
else
{
s.Append((char)c);
}
}
return s.ToString();
}
private static string FilterChinese(string str)
{
StringBuilder s = new StringBuilder();
foreach (short c in str.ToCharArray())
{
if (c > 0 && c < 127)
{
s.Append((char)c);
}
}
return s.ToString();
}
/// <summary>
/// 字符串转16进制字符数组
/// </summary>
/// <param name="hex"></param>
/// <returns></returns>
public static byte[] StringToHexByte(string str)
{
return StringToHexByte(str, false);
}
/// <summary>
/// 字符串转16进制字符数组
/// </summary>
/// <param name="str"></param>
/// <param name="isFilterChinese">是否过滤掉中文字符</param>
/// <returns></returns>
public static byte[] StringToHexByte(string str, bool isFilterChinese)
{
string hex = isFilterChinese ? FilterChinese(str) : ConvertChinese(str);
//清除所有空格
hex = hex.Replace(" ", "");
//若字符个数为奇数,补一个0
hex += hex.Length % 2 != 0 ? "0" : "";
byte[] result = new byte[hex.Length / 2];
for (int i = 0, c = result.Length; i < c; i++)
{
result[i] = Convert.ToByte(hex.Substring(i * 2, 2), 16);
}
return result;
}
#endregion
}
}
+334
View File
@@ -0,0 +1,334 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
namespace formula_manage.UserClass
{
public class Code128
{
private DataTable m_Code128 = new DataTable();
private uint m_Height = 40;
/// <summary>
/// 高度
/// </summary>
public uint Height { get { return m_Height; } set { m_Height = value; } }
private Font m_ValueFont = null;
/// <summary>
/// 是否显示可见号码 如果为NULL不显示号码
/// </summary>
public Font ValueFont { get { return m_ValueFont; } set { m_ValueFont = value; } }
private byte m_Magnify = 0;
/// <summary>
/// 放大倍数
/// </summary>
public byte Magnify { get { return m_Magnify; } set { m_Magnify = value; } }
/// <summary>
/// 条码类别
/// </summary>
public enum Encode
{
Code128A,
Code128B,
Code128C,
EAN128
}
public Code128()
{
m_Code128.Columns.Add("ID");
m_Code128.Columns.Add("Code128A");
m_Code128.Columns.Add("Code128B");
m_Code128.Columns.Add("Code128C");
m_Code128.Columns.Add("BandCode");
m_Code128.CaseSensitive = true;
#region 数据表
m_Code128.Rows.Add("0", " ", " ", "00", "212222");
m_Code128.Rows.Add("1", "!", "!", "01", "222122");
m_Code128.Rows.Add("2", "\"", "\"", "02", "222221");
m_Code128.Rows.Add("3", "#", "#", "03", "121223");
m_Code128.Rows.Add("4", "$", "$", "04", "121322");
m_Code128.Rows.Add("5", "%", "%", "05", "131222");
m_Code128.Rows.Add("6", "&", "&", "06", "122213");
m_Code128.Rows.Add("7", "'", "'", "07", "122312");
m_Code128.Rows.Add("8", "(", "(", "08", "132212");
m_Code128.Rows.Add("9", ")", ")", "09", "221213");
m_Code128.Rows.Add("10", "*", "*", "10", "221312");
m_Code128.Rows.Add("11", "+", "+", "11", "231212");
m_Code128.Rows.Add("12", ",", ",", "12", "112232");
m_Code128.Rows.Add("13", "-", "-", "13", "122132");
m_Code128.Rows.Add("14", ".", ".", "14", "122231");
m_Code128.Rows.Add("15", "/", "/", "15", "113222");
m_Code128.Rows.Add("16", "0", "0", "16", "123122");
m_Code128.Rows.Add("17", "1", "1", "17", "123221");
m_Code128.Rows.Add("18", "2", "2", "18", "223211");
m_Code128.Rows.Add("19", "3", "3", "19", "221132");
m_Code128.Rows.Add("20", "4", "4", "20", "221231");
m_Code128.Rows.Add("21", "5", "5", "21", "213212");
m_Code128.Rows.Add("22", "6", "6", "22", "223112");
m_Code128.Rows.Add("23", "7", "7", "23", "312131");
m_Code128.Rows.Add("24", "8", "8", "24", "311222");
m_Code128.Rows.Add("25", "9", "9", "25", "321122");
m_Code128.Rows.Add("26", ":", ":", "26", "321221");
m_Code128.Rows.Add("27", ";", ";", "27", "312212");
m_Code128.Rows.Add("28", "<", "<", "28", "322112");
m_Code128.Rows.Add("29", "=", "=", "29", "322211");
m_Code128.Rows.Add("30", ">", ">", "30", "212123");
m_Code128.Rows.Add("31", "?", "?", "31", "212321");
m_Code128.Rows.Add("32", "@", "@", "32", "232121");
m_Code128.Rows.Add("33", "A", "A", "33", "111323");
m_Code128.Rows.Add("34", "B", "B", "34", "131123");
m_Code128.Rows.Add("35", "C", "C", "35", "131321");
m_Code128.Rows.Add("36", "D", "D", "36", "112313");
m_Code128.Rows.Add("37", "E", "E", "37", "132113");
m_Code128.Rows.Add("38", "F", "F", "38", "132311");
m_Code128.Rows.Add("39", "G", "G", "39", "211313");
m_Code128.Rows.Add("40", "H", "H", "40", "231113");
m_Code128.Rows.Add("41", "I", "I", "41", "231311");
m_Code128.Rows.Add("42", "J", "J", "42", "112133");
m_Code128.Rows.Add("43", "K", "K", "43", "112331");
m_Code128.Rows.Add("44", "L", "L", "44", "132131");
m_Code128.Rows.Add("45", "M", "M", "45", "113123");
m_Code128.Rows.Add("46", "N", "N", "46", "113321");
m_Code128.Rows.Add("47", "O", "O", "47", "133121");
m_Code128.Rows.Add("48", "P", "P", "48", "313121");
m_Code128.Rows.Add("49", "Q", "Q", "49", "211331");
m_Code128.Rows.Add("50", "R", "R", "50", "231131");
m_Code128.Rows.Add("51", "S", "S", "51", "213113");
m_Code128.Rows.Add("52", "T", "T", "52", "213311");
m_Code128.Rows.Add("53", "U", "U", "53", "213131");
m_Code128.Rows.Add("54", "V", "V", "54", "311123");
m_Code128.Rows.Add("55", "W", "W", "55", "311321");
m_Code128.Rows.Add("56", "X", "X", "56", "331121");
m_Code128.Rows.Add("57", "Y", "Y", "57", "312113");
m_Code128.Rows.Add("58", "Z", "Z", "58", "312311");
m_Code128.Rows.Add("59", "[", "[", "59", "332111");
m_Code128.Rows.Add("60", "\\", "\\", "60", "314111");
m_Code128.Rows.Add("61", "]", "]", "61", "221411");
m_Code128.Rows.Add("62", "^", "^", "62", "431111");
m_Code128.Rows.Add("63", "_", "_", "63", "111224");
m_Code128.Rows.Add("64", "NUL", "`", "64", "111422");
m_Code128.Rows.Add("65", "SOH", "a", "65", "121124");
m_Code128.Rows.Add("66", "STX", "b", "66", "121421");
m_Code128.Rows.Add("67", "ETX", "c", "67", "141122");
m_Code128.Rows.Add("68", "EOT", "d", "68", "141221");
m_Code128.Rows.Add("69", "ENQ", "e", "69", "112214");
m_Code128.Rows.Add("70", "ACK", "f", "70", "112412");
m_Code128.Rows.Add("71", "BEL", "g", "71", "122114");
m_Code128.Rows.Add("72", "BS", "h", "72", "122411");
m_Code128.Rows.Add("73", "HT", "i", "73", "142112");
m_Code128.Rows.Add("74", "LF", "j", "74", "142211");
m_Code128.Rows.Add("75", "VT", "k", "75", "241211");
m_Code128.Rows.Add("76", "FF", "I", "76", "221114");
m_Code128.Rows.Add("77", "CR", "m", "77", "413111");
m_Code128.Rows.Add("78", "SO", "n", "78", "241112");
m_Code128.Rows.Add("79", "SI", "o", "79", "134111");
m_Code128.Rows.Add("80", "DLE", "p", "80", "111242");
m_Code128.Rows.Add("81", "DC1", "q", "81", "121142");
m_Code128.Rows.Add("82", "DC2", "r", "82", "121241");
m_Code128.Rows.Add("83", "DC3", "s", "83", "114212");
m_Code128.Rows.Add("84", "DC4", "t", "84", "124112");
m_Code128.Rows.Add("85", "NAK", "u", "85", "124211");
m_Code128.Rows.Add("86", "SYN", "v", "86", "411212");
m_Code128.Rows.Add("87", "ETB", "w", "87", "421112");
m_Code128.Rows.Add("88", "CAN", "x", "88", "421211");
m_Code128.Rows.Add("89", "EM", "y", "89", "212141");
m_Code128.Rows.Add("90", "SUB", "z", "90", "214121");
m_Code128.Rows.Add("91", "ESC", "{", "91", "412121");
m_Code128.Rows.Add("92", "FS", "|", "92", "111143");
m_Code128.Rows.Add("93", "GS", "}", "93", "111341");
m_Code128.Rows.Add("94", "RS", "~", "94", "131141");
m_Code128.Rows.Add("95", "US", "DEL", "95", "114113");
m_Code128.Rows.Add("96", "FNC3", "FNC3", "96", "114311");
m_Code128.Rows.Add("97", "FNC2", "FNC2", "97", "411113");
m_Code128.Rows.Add("98", "SHIFT", "SHIFT", "98", "411311");
m_Code128.Rows.Add("99", "CODEC", "CODEC", "99", "113141");
m_Code128.Rows.Add("100", "CODEB", "FNC4", "CODEB", "114131");
m_Code128.Rows.Add("101", "FNC4", "CODEA", "CODEA", "311141");
m_Code128.Rows.Add("102", "FNC1", "FNC1", "FNC1", "411131");
m_Code128.Rows.Add("103", "StartA", "StartA", "StartA", "211412");
m_Code128.Rows.Add("104", "StartB", "StartB", "StartB", "211214");
m_Code128.Rows.Add("105", "StartC", "StartC", "StartC", "211232");
m_Code128.Rows.Add("106", "Stop", "Stop", "Stop", "2331112");
#endregion
}
/// <summary>
/// 获取128图形
/// </summary>
/// <param name="p_Text">文字</param>
/// <param name="flag">是否显示文字</param>
/// <param name="p_Code">编码</param>
/// <returns>图形</returns>
public Bitmap GetCodeImage(string p_Text, bool flag, Encode p_Code)
{
string _ViewText = p_Text;
string _Text = "";
IList<int> _TextNumb = new List<int>();
int _Examine = 0; //首位
switch (p_Code)
{
case Encode.Code128C:
_Examine = 105;
if (!((p_Text.Length & 1) == 0)) throw new Exception("128C长度必须是偶数");
while (p_Text.Length != 0)
{
int _Temp = 0;
try
{
int _CodeNumb128 = Int32.Parse(p_Text.Substring(0, 2));
}
catch
{
throw new Exception("128C必须是数字!");
}
_Text += GetValue(p_Code, p_Text.Substring(0, 2), ref _Temp);
_TextNumb.Add(_Temp);
p_Text = p_Text.Remove(0, 2);
}
break;
case Encode.EAN128:
_Examine = 105;
if (!((p_Text.Length & 1) == 0)) throw new Exception("EAN128长度必须是偶数");
_TextNumb.Add(102);
_Text += "411131";
while (p_Text.Length != 0)
{
int _Temp = 0;
try
{
int _CodeNumb128 = Int32.Parse(p_Text.Substring(0, 2));
}
catch
{
throw new Exception("128C必须是数字!");
}
_Text += GetValue(Encode.Code128C, p_Text.Substring(0, 2), ref _Temp);
_TextNumb.Add(_Temp);
p_Text = p_Text.Remove(0, 2);
}
break;
default:
if (p_Code == Encode.Code128A)
{
_Examine = 103;
}
else
{
_Examine = 104;
}
while (p_Text.Length != 0)
{
int _Temp = 0;
string _ValueCode = GetValue(p_Code, p_Text.Substring(0, 1), ref _Temp);
if (_ValueCode.Length == 0) throw new Exception("无效的字符集!" + p_Text.Substring(0, 1).ToString());
_Text += _ValueCode;
_TextNumb.Add(_Temp);
p_Text = p_Text.Remove(0, 1);
}
break;
}
if (_TextNumb.Count == 0) throw new Exception("错误的编码,无数据");
_Text = _Text.Insert(0, GetValue(_Examine)); //获取开始位
for (int i = 0; i != _TextNumb.Count; i++)
{
_Examine += _TextNumb[i] * (i + 1);
}
_Examine = _Examine % 103; //获得严效位
_Text += GetValue(_Examine); //获取严效位
_Text += "2331112"; //结束位
Bitmap _CodeImage = GetImage(_Text);
if (flag)
{
GetViewText(_CodeImage, _ViewText);
}
return _CodeImage;
}
/// <summary>
/// 获取目标对应的数据
/// </summary>
/// <param name="p_Code">编码</param>
/// <param name="p_Value">数值 A b 30</param>
/// <param name="p_SetID">返回编号</param>
/// <returns>编码</returns>
private string GetValue(Encode p_Code, string p_Value, ref int p_SetID)
{
if (m_Code128 == null) return "";
DataRow[] _Row = m_Code128.Select(p_Code.ToString() + "='" + p_Value + "'");
if (_Row.Length != 1) throw new Exception("错误的编码" + p_Value.ToString());
p_SetID = Int32.Parse(_Row[0]["ID"].ToString());
return _Row[0]["BandCode"].ToString();
}
/// <summary>
/// 根据编号获得条纹
/// </summary>
/// <param name="p_CodeId"></param>
/// <returns></returns>
private string GetValue(int p_CodeId)
{
DataRow[] _Row = m_Code128.Select("ID='" + p_CodeId.ToString() + "'");
if (_Row.Length != 1) throw new Exception("验效位的编码错误" + p_CodeId.ToString());
return _Row[0]["BandCode"].ToString();
}
/// <summary>
/// 获得条码图形
/// </summary>
/// <param name="p_Text">文字</param>
/// <returns>图形</returns>
private Bitmap GetImage(string p_Text)
{
char[] _Value = p_Text.ToCharArray();
int _Width = 0;
for (int i = 0; i != _Value.Length; i++)
{
_Width += Int32.Parse(_Value[i].ToString()) * (m_Magnify + 1);
}
Bitmap _CodeImage = new Bitmap(_Width, (int)m_Height);
Graphics _Garphics = Graphics.FromImage(_CodeImage);
//Pen _Pen;
int _LenEx = 0;
for (int i = 0; i != _Value.Length; i++)
{
int _ValueNumb = Int32.Parse(_Value[i].ToString()) * (m_Magnify + 1); //获取宽和放大系数
if (!((i & 1) == 0))
{
//_Pen = new Pen(Brushes.White, _ValueNumb);
_Garphics.FillRectangle(Brushes.White, new Rectangle(_LenEx, 0, _ValueNumb, (int)m_Height));
}
else
{
//_Pen = new Pen(Brushes.Black, _ValueNumb);
_Garphics.FillRectangle(Brushes.Black, new Rectangle(_LenEx, 0, _ValueNumb, (int)m_Height));
}
//_Garphics.(_Pen, new Point(_LenEx, 0), new Point(_LenEx, m_Height));
_LenEx += _ValueNumb;
}
_Garphics.Dispose();
return _CodeImage;
}
/// <summary>
/// 显示可见条码文字 如果小于40 不显示文字
/// </summary>
/// <param name="p_Bitmap">图形</param>
private void GetViewText(Bitmap p_Bitmap, string p_ViewText)
{
if (m_ValueFont == null) return;
Graphics _Graphics = Graphics.FromImage(p_Bitmap);
SizeF _DrawSize = _Graphics.MeasureString(p_ViewText, m_ValueFont);
if (_DrawSize.Height > p_Bitmap.Height - 10 || _DrawSize.Width > p_Bitmap.Width)
{
_Graphics.Dispose();
return;
}
int _StarY = p_Bitmap.Height - (int)_DrawSize.Height;
_Graphics.FillRectangle(Brushes.White, new Rectangle(0, _StarY, p_Bitmap.Width, (int)_DrawSize.Height));
_Graphics.DrawString(p_ViewText, m_ValueFont, Brushes.Black, 0, _StarY);
}
//12345678
//(105 + (1 * 12 + 2 * 34 + 3 * 56 + 4 *78)) % 103 = 47
//结果为starc +12 +34 +56 +78 +47 +end
internal Image GetCodeImage(string p)
{
throw new NotImplementedException();
}
}
}
+1 -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()
{
+95
View File
@@ -0,0 +1,95 @@
using System.Management;
namespace formula_manage.UserClass
{
/// <summary>
/// 获取硬件SN
/// </summary>
internal class HardwareSN
{
/// <summary>
/// 获取cpuid
/// </summary>
public static string GetCPUSerialNumber()
{
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");
string cpuSerialNumber = "";
foreach (ManagementObject mo in searcher.Get())
{
cpuSerialNumber = mo["ProcessorId"].ToString().Trim();
break;
}
return cpuSerialNumber;
}
catch
{
return "";
}
}
/// <summary>
/// 获取主板id
/// </summary>
public static string GetBIOSSerialNumber()
{
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_BIOS");
string biosSerialNumber = "";
foreach (ManagementObject mo in searcher.Get())
{
biosSerialNumber = mo.GetPropertyValue("SerialNumber").ToString().Trim();
break;
}
return biosSerialNumber;
}
catch
{
return "";
}
}
/// <summary>
/// 获取硬盘id
/// </summary>
public static string GetHardDiskSerialNumber()
{
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
string hardDiskSerialNumber = "";
foreach (ManagementObject mo in searcher.Get())
{
hardDiskSerialNumber = mo["SerialNumber"].ToString().Trim();
break;
}
return hardDiskSerialNumber;
}
catch
{
return "";
}
}
/// <summary>
/// 获取网卡id
/// </summary>
public static string GetNetCardMACAddress()
{
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapter WHERE ((MACAddress Is Not NULL) AND (Manufacturer <> 'Microsoft'))");
string netCardMACAddress = "";
foreach (ManagementObject mo in searcher.Get())
{
netCardMACAddress = mo["MACAddress"].ToString().Trim();
break;
}
return netCardMACAddress;
}
catch
{
return "";
}
}
}
}
+1 -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();//创建日志路径
}
}
}
}
+59
View File
@@ -0,0 +1,59 @@
using System;
using System.Security.Cryptography;
using System.Text;
namespace formula_manage.UserClass
{
/// <summary>
/// MD5加密
/// </summary>
internal class MD5check
{
/// <summary>
/// 16位MD5加密
/// </summary>
/// <param name="password"></param>
/// <returns></returns>
public static string MD5Encrypt16(string password)
{
var md5 = new MD5CryptoServiceProvider();
string t2 = BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(password)), 4, 8);
t2 = t2.Replace("-", "");
return t2;
}
/// <summary>
/// 32位MD5加密
/// </summary>
/// <param name="password"></param>
/// <returns></returns>
public static string MD5Encrypt32(string password)
{
string cl = password;
string pwd = "";
MD5 md5 = MD5.Create(); //实例化一个md5对像
// 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择 
byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(cl));
// 通过使用循环,将字节类型的数组转换为字符串,此字符串是常规字符格式化所得
for (int i = 0; i < s.Length; i++)
{
// 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符
pwd = pwd + s[i].ToString("X");
}
return pwd;
}
/// <summary>
/// 64位MD5加密
/// </summary>
/// <param name="password"></param>
/// <returns></returns>
public static string MD5Encrypt64(string password)
{
string cl = password;
//string pwd = "";
MD5 md5 = MD5.Create(); //实例化一个md5对像
// 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择 
byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(cl));
return Convert.ToBase64String(s);
}
}
}
-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
+41 -5
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
{
@@ -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)
{
+37
View File
@@ -0,0 +1,37 @@
using System;
namespace formula_manage.UserClass
{
/// <summary>
/// 字符串转数字
/// </summary>
internal class StrToInt
{
/// <summary>
/// 十六进制字符串转十进制
/// </summary>
/// <param name="str">十六进制字符</param>
/// <returns></returns>
public static int To16Convert10(string str)
{
int res = 0;
try
{
str = str.Trim().Replace(" ", ""); //移除空字符
//方法1
res = int.Parse(str, System.Globalization.NumberStyles.AllowHexSpecifier);
//方法2
//int r2 = System.Int32.Parse(str, System.Globalization.NumberStyles.HexNumber);
//Console.WriteLine(r2);
//方法3
//int r3 = Convert.ToInt32(str, 16);
//Console.WriteLine(r3);
}
catch (Exception)
{
res = 0;
}
return res;
}
}
}
+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));
}
}
}
}
}
-4
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
+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
{
+58
View File
@@ -0,0 +1,58 @@
<UserControl x:Class="formula_manage.View.ViewOrder"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:formula_manage.View"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="405" Background="#FFE0E0E0">
<Grid>
<DataGrid x:Name="Order" AlternationCount="2" IsReadOnly="True" MouseDoubleClick="DataGridOrder_MouseDoubleClick"
HeadersVisibility ="Column" Margin="0,0,0,40" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" CanUserReorderColumns="False"
CanUserSortColumns="False" Background="White" SelectionMode="Single">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF5F5F5" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="#000000"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="订单号" Binding="{Binding OrdeNO}" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False" IsReadOnly="True"/>
<DataGridTextColumn Header="工艺名称" Binding="{Binding ProcessNAME}" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False" IsReadOnly="True"/>
<DataGridTextColumn Header="工艺代码" Binding="{Binding ProcessCODE}" Width="0" FontSize="15" MaxWidth="400" MinWidth="0" CanUserReorder="False" IsReadOnly="True"/>
<DataGridTextColumn Header="品名" Binding="{Binding colour}" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False" IsReadOnly="True"/>
<DataGridTextColumn Header="客户" Binding="{Binding customer}" Width="200" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False" IsReadOnly="True"/>
<DataGridTextColumn Header="下单时间" Binding="{Binding OrdeTime}" Width="200" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False" IsReadOnly="True"/>
<DataGridTextColumn Header="备注" Binding="{Binding REMARK}" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
<ComboBox x:Name="condition" HorizontalAlignment="Left" Height="30" Width="100" VerticalAlignment="Bottom" FontSize="20" Margin="5,0,0,5"/>
<TextBox x:Name="search" HorizontalAlignment="Left" Height="30" Margin="110,0,0,5" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="200" FontSize="20"/>
<Button Content="搜索" Click="Button_search" Height="30" Margin="315,0,0,5" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="50" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" />
</Grid>
</UserControl>
+132
View File
@@ -0,0 +1,132 @@
using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace formula_manage.View
{
/// <summary>
/// ViewProcess.xaml 的交互逻辑
/// </summary>
public partial class ViewOrder : UserControl
{
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
string TEXT_SQLUSER;
string TEXT_SQLPASWOR;
string Connstr_SC;
DataTable dataTable = new DataTable(); //建立缓存
public ViewOrder()
{
InitializeComponent();
condition.Items.Add("");
condition.Items.Add("工艺");
condition.Items.Add("客户");
condition.Items.Add("品名");
sql_();
}
private async void sql_()
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
string order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] order by OrdeTime desc";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter Stuff_data = new SqlDataAdapter(order_sql, Connstr_SC); //查询
dataTable.Clear();
Stuff_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
Order.ItemsSource = dataTable.DefaultView; //数据加入表格
//Order.DisplayMemberPath = "Name";
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
return;
}
}
private async void Button_search(object sender, RoutedEventArgs e)//搜索按钮
{
int a;
string order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] order by OrdeTime desc";//查询语句
a = condition.SelectedIndex; //获取选择条件
if (a == 1) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where ProcessNAME = '" + search.Text + "' order by OrdeTime desc";//查询语句
else if (a == 2) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where customer = '" + search.Text + "' order by OrdeTime desc";//查询语句
else if (a == 3) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] where colour = '" + search.Text + "' order by OrdeTime desc";//查询语句
else if (a == 0) order_sql = "SELECT OrdeNO ,ProcessNAME ,ProcessCODE ,colour ,customer ,OrdeTime ,REMARK FROM [Dispensing].[dbo].[ORDER] order by OrdeTime desc";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter Stuff_data = new SqlDataAdapter(order_sql, Connstr_SC); //查询
dataTable.Clear();
Stuff_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
Order.ItemsSource = dataTable.DefaultView; //数据加入表格
//Order.DisplayMemberPath = "Name";
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败");
return;
}
}
public delegate void SendMessage(string[] value);
public SendMessage sendMessage;
string[] OrderData = new string[7];
private void DataGridOrder_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
{
int rownum = Order.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
/*定位选中行及指定列单元格文本信息*/
OrderData[0] = (Order.Columns[0].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[1] = (Order.Columns[1].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[2] = (Order.Columns[2].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[3] = (Order.Columns[3].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[4] = (Order.Columns[4].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[5] = (Order.Columns[5].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[6] = (Order.Columns[6].GetCellContent(Order.Items[rownum]) as TextBlock).Text.Trim();//定位第列
sendMessage(OrderData); //传入数组
}
}
}
}
+8 -9
View File
@@ -7,8 +7,8 @@
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="405">
<Grid>
<DataGrid x:Name="edit" AlternationCount="2" IsReadOnly="False"
Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=30}" AutoGenerateColumns="False" MinColumnWidth="30"
<DataGrid x:Name="Technology" AlternationCount="2" IsReadOnly="True" MouseDoubleClick="DataGrid_Technology"
HeadersVisibility ="Column" Margin="0,0,0,0" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" CanUserReorderColumns="False"
CanUserSortColumns="False"
@@ -42,13 +42,12 @@
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="工艺代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="工艺名称" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="步数" Width="50" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="布种" Width="100" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False"/>
<DataGridTextColumn Header="品名" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="客户" Width="200" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False"/>
<DataGridTextColumn Header="备注" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False"/>
<DataGridTextColumn Binding="{Binding PROC_CODE}" Header="工艺代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Binding="{Binding PROC_NAME}" Header="工艺名称" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Binding="{Binding PROC_STEP}" Header="步数" Width="50" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Binding="{Binding PROC_FABRIC}" Header="布种" Width="100" FontSize="15" MaxWidth="200" MinWidth="80" CanUserReorder="False"/>
<DataGridTextColumn Binding="{Binding PROC_PRODUCT}" Header="品名" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Binding="{Binding REMARK}" Header="备注" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
+75 -11
View File
@@ -1,17 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Data;
using System.Data.SqlClient;
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
{
@@ -20,9 +11,82 @@ namespace formula_manage.View
/// </summary>
public partial class ViewProcess : UserControl
{
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
string TEXT_SQLUSER;
string TEXT_SQLPASWOR;
string Connstr_SC;
DataTable dataTable = new DataTable(); //建立缓存
public ViewProcess()
{
InitializeComponent();
sql_();
}
private async void sql_()
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
string order_sql = "SELECT PROC_CODE,PROC_NAME,PROC_TEST,PROC_STEP,MODIFY_TIME,PROC_FABRIC,PROC_PRODUCT,REMARK FROM [Dispensing].[dbo].[PROCEDUR_TITLE]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter Stuff_data = new SqlDataAdapter(order_sql, Connstr_SC); //查询
dataTable.Clear();
Stuff_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
Technology.ItemsSource = dataTable.DefaultView; //数据加入表格
//Order.DisplayMemberPath = "Name";
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败");
return;
}
}
public delegate void SendMessage(string[] value);
public SendMessage sendMessage;
string[] OrderData = new string[6];
private void DataGrid_Technology(object sender, MouseButtonEventArgs e)//数据表双击事件
{
int rownum = Technology.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
/*定位选中行及指定列单元格文本信息*/
OrderData[0] = (Technology.Columns[0].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[1] = (Technology.Columns[1].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[2] = (Technology.Columns[2].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[3] = (Technology.Columns[3].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[4] = (Technology.Columns[4].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
OrderData[5] = (Technology.Columns[5].GetCellContent(Technology.Items[rownum]) as TextBlock).Text.Trim();//定位第列
sendMessage(OrderData); //传入数组
}
}
}
}
+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周期执行事件
{
}
}
}
+116 -23
View File
@@ -1,22 +1,11 @@
using formula_manage.SQLModels;
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.Forms;
using System.Windows.Threading;
using System.Xml.Linq;
namespace formula_manage.ViewModel
{
@@ -41,26 +30,105 @@ 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缓存
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
public string sys_Time; //显示系统时间
public string cdk_time; //注册到期时间
public string cdk_page = "Hidden"; //注册到期页面状态
public string cdk_pageT; //注册到期页面关闭时间
int cdk_pageT_T = -1;////注册到期页面关闭时间计算
public string Sys_Time //通知UI控件参数改变
{
get { return sys_Time; }
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
}
public string Cdk_time //通知UI控件参数改变
{
get { return cdk_time; }
set { cdk_time = value; OnPropertyChanged("Cdk_time"); }
}
public string Cdk_page //通知UI控件参数改变
{
get { return cdk_page; }
set { cdk_page = value; OnPropertyChanged("Cdk_page"); }
}
public string Cdk_pageT //通知UI控件参数改变
{
get { return cdk_pageT; }
set { cdk_pageT = value; OnPropertyChanged("Cdk_pageT"); }
}
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
string TEXT_SQLUSER;
string TEXT_SQLPASWOR;
string Connstr_SC;
string SN_ID;
string SN_KEY;
private void CDkey_()
{
try
{
string id_1 = SN_ID.Substring(5, 1) + SN_ID.Substring(0, 1) + SN_ID.Substring(4, 1) + SN_ID.Substring(1, 1) + SN_ID.Substring(3, 1) + SN_ID.Substring(2, 1);
if ((id_1 == SN_KEY.Substring(0, 6)) && (SN_KEY.Length == 16))
{
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(SN_KEY.Substring(0, 12)), true) == SN_KEY.Substring(12, 4)) //校验key的crc校验值
{
string Y = (2255 - StrToInt.To16Convert10(SN_KEY.Substring(6, 2))).ToString();
string M = (255 - StrToInt.To16Convert10(SN_KEY.Substring(8, 2))).ToString();
string D = (255 - StrToInt.To16Convert10(SN_KEY.Substring(10, 2))).ToString();
string YY = DateTime.Now.ToString("yyyy");
string MM = DateTime.Now.ToString("MM");
string DD = DateTime.Now.ToString("dd");
Cdk_time = "注册到期时间: " + Y + "/" + M + "/" + D;
if (string.Compare(Y, YY) < 0)
{
if (string.Compare(M, MM) < 0)
{
if (string.Compare(D, DD) < 0)
{
Cdk_page = "Visible";
//cdk_pageT_T = -1; //防止触发倒计时
}
else if ((int.Parse(D) - int.Parse(DD)) <= 10)//提前三天提醒
{
Cdk_page = "Visible";
cdk_pageT_T = 180; //页面关闭倒计时30秒
}
}
}
}
else
{
Cdk_page = "Visible";
Cdk_time = "许可证安全校验错误请重新激活";
}
}
else
{
Cdk_page = "Visible";
Cdk_time = "计算机信息变更当前许可证失效";
}
}
catch (Exception)
{
Cdk_page = "Visible";
Cdk_time = "许可证安全校验错误请重新激活";
}
}
private async void Sql_()
{
@@ -70,6 +138,9 @@ namespace formula_manage.ViewModel
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
SN_ID = Configini.IniReadvalue("SN", "SN2");
SN_KEY = Configini.IniReadvalue("SN", "SN1");
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
@@ -79,9 +150,9 @@ namespace formula_manage.ViewModel
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
string Stuff_sql = "SELECT ProductCode ,ProductName ,ProductType ,Concentration FROM [Dispensing].[dbo].[PRODUCT] order by ProductCode asc";//查询STUFF语句
string MAC_sql = "SELECT Name ,Capacity ,Volume FROM [Dispensing].[dbo].[MACHINE] order by Name asc";//查询machine语句
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,MaterialType ,WeightMIN ,WeightMAX REMARK FROM [Dispensing].[dbo].[Dissolve]";//查询语句
string Stuff_sql = "SELECT ProductCode ,ProductName ,ProductType ,Concentration FROM [dbo].[PRODUCT] order by ProductCode asc";//查询STUFF语句
string MAC_sql = "SELECT Name ,Capacity ,Volume FROM [dbo].[MACHINE] order by Name asc";//查询machine语句
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,MaterialType ,WeightMIN ,WeightMAX REMARK FROM [dbo].[Dissolve]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
@@ -99,7 +170,8 @@ namespace formula_manage.ViewModel
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求原料信息失败,检查连接");
System.Windows.MessageBox.Show("请求信息失败");
UserClass.LogGing.LogGingDATA("DISPENLINK = ConnectFailed");
return;
}
}
@@ -109,6 +181,8 @@ namespace formula_manage.ViewModel
CountDown();
Sql_();
CDkey_();
stuff_Product = ToObservableCollection<Product>(STUFFdataTable); //stuff_Product表转换
mac_Machine = ToObservableCollection<Machine>(MACHINEdataTable);
flow_Workflow = ToObservableCollection<Workflow>(DissolvedataTable);
@@ -168,26 +242,45 @@ namespace formula_manage.ViewModel
}
return lst;
} //DataTable FOR ObservableCollection转换器
/// <summary>
/// 循环事件设定
/// </summary>
public void CountDown()
{
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick
{
Interval = TimeSpan.FromSeconds(0.5)
Interval = TimeSpan.FromSeconds(1)
};
timer.Tick += Tick_Event;
timer.Start();
timer1s.Tick += Tick_Event_1S;
timer1s.Start();
DispatcherTimer timer1h = new DispatcherTimer//初始化循环,每1h调用一次Tick
{
Interval = TimeSpan.FromSeconds(3600)
};
timer1h.Tick += Tick_Event_1h;
timer1h.Start();
//设置定时器
// disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
// disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
// disTimer.Start();//计时开始
}
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件
{
Sys_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
if (cdk_pageT_T > 0) //提示注册画面关闭倒计时
{
cdk_pageT_T--;
Cdk_pageT = cdk_pageT_T.ToString();
if (cdk_pageT_T == 1) Cdk_page = "Hidden";
}
}
void Tick_Event_1h(object sender, EventArgs e)//Tick_Event周期执行事件
{
CDkey_();
}
}
+217
View File
@@ -0,0 +1,217 @@
using System;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Windows.Threading;
namespace formula_manage.ViewModel
{
/* public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}*/
///<Summary>
///
///
///</Summary>
///
public class RECIPEViewModel : ViewModelBase
{
DataTable DissolvedataTable = new DataTable(); //建立Dissolve
DataTable STUFFdataTable = new DataTable(); //建立STUFF
DataTable MACHINEdataTable = new DataTable(); //建立Machine
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT
DataTable RecipedataTable = new DataTable(); //建立Recipe
public static DataTable STUFFdatatemp = new DataTable(); //建立STUFF缓存
public static DataTable MACHINEdatatemp = new DataTable(); //建立Machine缓存
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
public string sys_Time; //显示系统时间
public string Sys_Time //通知UI控件参数改变
{
get { return sys_Time; }
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
}
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
string TEXT_SQLUSER;
string TEXT_SQLPASWOR;
string Connstr_SC;
private async void Sql_()
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
string Stuff_sql = "SELECT ProductCode ,ProductName ,ProductType ,Concentration FROM [Dispensing].[dbo].[PRODUCT] order by ProductCode asc";//查询STUFF语句
string MAC_sql = "SELECT Name ,Capacity ,Volume FROM [Dispensing].[dbo].[MACHINE] order by Name asc";//查询machine语句
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,MaterialType ,WeightMIN ,WeightMAX REMARK FROM [Dispensing].[dbo].[Dissolve]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter Stuff_data = new SqlDataAdapter(Stuff_sql, Connstr_SC); //查询stuff
SqlDataAdapter Mac_data = new SqlDataAdapter(MAC_sql, Connstr_SC); //查询machine
SqlDataAdapter Dissolve_data = new SqlDataAdapter(Dissolve_sql, Connstr_SC); //查询Dissolve
Stuff_data.Fill(STUFFdataTable); //stuff查询结果存入缓存
Mac_data.Fill(MACHINEdataTable); //machine查询结果存入缓存
Dissolve_data.Fill(DissolvedataTable); //Dissolve_data查询结果存入缓存
conn_SC.Close(); //关闭连接
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求原料信息失败,检查连接");
return;
}
}
public RECIPEViewModel()
{
CountDown();
Sql_();
stuff_Product = ToObservableCollection<Product>(STUFFdataTable); //stuff_Product表转换
mac_Machine = ToObservableCollection<Machine>(MACHINEdataTable);
flow_Workflow = ToObservableCollection<Workflow>(DissolvedataTable);
STUFFdatatemp = STUFFdataTable;
MACHINEdatatemp = MACHINEdataTable;
}
public ObservableCollection<Product> stuff_Product { get; set; } //stuff_Product动态表实力化
public ObservableCollection<Machine> mac_Machine { get; set; } //mac_Machine动态表实力化
public ObservableCollection<Workflow> flow_Workflow { get; set; } //Dissolve动态表实力化
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new() //DataTable FOR ObservableCollection转换器
{
Type t = typeof(T);
PropertyInfo[] propertys = t.GetProperties();
ObservableCollection<T> lst = new ObservableCollection<T>();
string typeName = string.Empty;
foreach (DataRow dr in dt.Rows)
{
T entity = new T();
foreach (PropertyInfo pi in propertys)
{
typeName = pi.Name;
if (dt.Columns.Contains(typeName))
{
if (!pi.CanWrite) continue;
object value = dr[typeName];
if (value == DBNull.Value) continue;
if (pi.PropertyType == typeof(string))
{
pi.SetValue(entity, value.ToString(), null);
}
else if (pi.PropertyType == typeof(int) || pi.PropertyType == typeof(int?))
{
pi.SetValue(entity, int.Parse(value.ToString()), null);
}
else if (pi.PropertyType == typeof(DateTime?) || pi.PropertyType == typeof(DateTime))
{
pi.SetValue(entity, DateTime.Parse(value.ToString()), null);
}
else if (pi.PropertyType == typeof(float))
{
pi.SetValue(entity, float.Parse(value.ToString()), null);
}
else if (pi.PropertyType == typeof(double))
{
pi.SetValue(entity, double.Parse(value.ToString()), null);
}
else
{
pi.SetValue(entity, value, null);
}
}
}
lst.Add(entity);
}
return lst;
} //DataTable FOR ObservableCollection转换器
/// <summary>
/// 循环事件设定
/// </summary>
public void CountDown()
{
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{
Interval = TimeSpan.FromSeconds(0.5)
};
timer.Tick += Tick_Event;
timer.Start();
//设置定时器
// disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
// disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
// disTimer.Start();//计时开始
}
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
Sys_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
}
/* public class Product //stuff_Product
{
public string ProductCode { get; set; }
public string ProductName { get; set; }
public int ProductType { get; set; }
public int Concentration { get; set; }
public override string ToString()
{
return ProductCode;
}
}
public class Machine //mac
{
public string Name { get; set; }
public float Volume { get; set; }
public float Capacity { get; set; }
public override string ToString()
{
return Name;
}
}
public class Workflow //Dissolve
{
public string DissolveName { get; set; }
public int MaterialType { get; set; }
public int WeightMIN { get; set; }
public int WeightMAX { get; set; }
public override string ToString()
{
return DissolveName;
}
}*/
}
+17 -6
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
@@ -27,6 +21,8 @@ namespace formula_manage.ViewModel
////}
SimpleIoc.Default.Register<MainWindowViewModel>();
SimpleIoc.Default.Register<RECIPEViewModel>();
SimpleIoc.Default.Register<ExchangeViewModel>();
}
public MainWindowViewModel Main
@@ -37,6 +33,21 @@ namespace formula_manage.ViewModel
}
}
public RECIPEViewModel Recipev
{
get
{
return ServiceLocator.Current.GetInstance<RECIPEViewModel>();
}
}
public ExchangeViewModel Exchange
{
get
{
return ServiceLocator.Current.GetInstance<ExchangeViewModel>();
}
}
}
}
+12 -9
View File
@@ -9,17 +9,20 @@
<Grid>
<CheckBox x:Name="Login_LINK" HorizontalAlignment="Left" Height="19" Margin="15,15,0,0" VerticalAlignment="Top" Width="150" Content="登录页面显示连接状态" IsTabStop="False" Checked="Login_LINK_Checked" Unchecked="Login_LINK_Checked"/>
<CheckBox x:Name="Login_PRINT" HorizontalAlignment="Left" Height="19" Margin="15,35,0,0" VerticalAlignment="Top" Width="150" Content="确认立即打印料单" IsTabStop="False" Checked="Login_PRINT_Checked" Unchecked="Login_PRINT_Checked"/>
<CheckBox x:Name="Login_MACHINE" HorizontalAlignment="Left" Height="19" Margin="15,55,0,0" VerticalAlignment="Top" Width="150" Content="允许输入机台号" IsTabStop="False" Checked="Login_MAC_Checked" Unchecked="Login_MAC_Checked"/>
<CheckBox x:Name="Login_anew" HorizontalAlignment="Left" Height="19" Margin="15,75,0,0" VerticalAlignment="Top" Width="150" Content="单号相同时重染号修改" IsTabStop="False" Checked="Login_anew_Checked" Unchecked="Login_anew_Checked"/>
<ComboBox x:Name="Login_Gkg" HorizontalAlignment="Left" Height="19" Margin="300,15,0,0" VerticalAlignment="Top" Width="150">
<ComboBoxItem Content="AUTO"></ComboBoxItem>
<ComboBoxItem Content="G"></ComboBoxItem>
<ComboBoxItem Content="Kg"></ComboBoxItem>
<CheckBox x:Name="EXLINK" HorizontalAlignment="Left" Height="19" Margin="15,35,0,0" VerticalAlignment="Top" Width="150" Content="启用外挂程序" IsTabStop="False" Checked="Login_ex_Checked" Unchecked="Login_ex_Checked"/>
<CheckBox x:Name="Login_PRINT" HorizontalAlignment="Left" Height="19" Margin="15,55,0,0" VerticalAlignment="Top" Width="150" Content="确认立即打印料单" IsTabStop="False" Checked="Login_PRINT_Checked" Unchecked="Login_PRINT_Checked"/>
<CheckBox x:Name="Login_MACHINE" HorizontalAlignment="Left" Height="19" Margin="15,75,0,0" VerticalAlignment="Top" Width="150" Content="允许输入机台号" IsTabStop="False" Checked="Login_MAC_Checked" Unchecked="Login_MAC_Checked"/>
<CheckBox x:Name="Login_anew" HorizontalAlignment="Left" Height="19" Margin="15,95,0,0" VerticalAlignment="Top" Width="150" Content="单号相同时重染号修改" IsTabStop="False" Checked="Login_anew_Checked" Unchecked="Login_anew_Checked"/>
<TextBlock HorizontalAlignment="Left" Height="19" Margin="245,15,0,0" TextWrapping="Wrap" Text="显示单位" VerticalAlignment="Top" Width="55"/>
<ComboBox x:Name="Login_Gkg" HorizontalAlignment="Left" Height="19" Margin="300,15,0,0" VerticalAlignment="Top" Width="100">
<ComboBoxItem Content="AUTO" FontSize="10"></ComboBoxItem>
<ComboBoxItem Content="G" FontSize="10"></ComboBoxItem>
<ComboBoxItem Content="KG" FontSize="10"></ComboBoxItem>
<ComboBoxItem Content="KG/L" FontSize="10"></ComboBoxItem>
</ComboBox>
<TextBlock HorizontalAlignment="Left" Height="20" Margin="10,220,0,0" TextWrapping="Wrap" Text="前缀名称" VerticalAlignment="Top" Width="75" FontSize="14"/>
<TextBox x:Name="Prepose" HorizontalAlignment="Left" Height="20" Margin="85,220,0,0" TextWrapping="Wrap" Text="D" VerticalAlignment="Top" Width="125"/>
<TextBlock HorizontalAlignment="Left" Height="20" Margin="10,250,0,0" TextWrapping="Wrap" Text="日期格式" VerticalAlignment="Top" Width="75" FontSize="14"/>
+12 -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,14 +22,15 @@ 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());
Configini.IniWritevalue("SOFTWARE_SET", " L2", Loginprint.ToString());
Configini.IniWritevalue("SOFTWARE_SET", " L3", Loginanew.ToString());
Configini.IniWritevalue("SOFTWARE_SET", " L4", LoginMAC.ToString());
Configini.IniWritevalue("SOFTWARE_SET", " L5", Login_Gkg.Text);
Configini.IniWritevalue("SOFTWARE_SET", " L6", EXlink.ToString());
Configini.IniWritevalue("SOFTWARE_SET", " T1", Prepose.Text);
Configini.IniWritevalue("SOFTWARE_SET", " T2", TimeFormat.Text);
@@ -59,15 +49,18 @@ namespace formula_manage.Windows
bool Loginprint;
bool Loginanew;
bool LoginMAC;
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")); //连接状态显示是否生效
Login_PRINT.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L2")); //是否立即打印料单
Login_anew.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L3")); //是否立即打印料单
Login_MACHINE.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L4")); //允许自定义机台
EXLINK.IsChecked = Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")); //ex
Login_Gkg.Text = Configini.IniReadvalue("SOFTWARE_SET", "L5"); //单位识别
Prepose.Text = Configini.IniReadvalue("SOFTWARE_SET", "T1"); //自定义料单前缀
TimeFormat.Text = Configini.IniReadvalue("SOFTWARE_SET", "T2"); //自定义料单时间格式
@@ -80,6 +73,11 @@ namespace formula_manage.Windows
Loginlink = Login_LINK.IsChecked.GetValueOrDefault(); //显示是否生效
}
private void Login_ex_Checked(object sender, RoutedEventArgs e)
{
EXlink = EXLINK.IsChecked.GetValueOrDefault(); //是否
}
private void Login_MAC_Checked(object sender, RoutedEventArgs e)
{
LoginMAC = Login_MACHINE.IsChecked.GetValueOrDefault(); //是否
+18
View File
@@ -0,0 +1,18 @@
<Window x:Class="formula_manage.Windows.CDKEY"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.Windows"
mc:Ignorable="d" Loaded="Window_CDKEY" BorderBrush="White" Background="#FFEFEFEF"
Title="CDKEY" Height="140" Width="500" MaxHeight="140" MaxWidth="500" ResizeMode="NoResize">
<Grid>
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,35,0,0" TextWrapping="Wrap" Text="CDKEY:" VerticalAlignment="Top" Width="70" FontSize="16"/>
<TextBlock HorizontalAlignment="Left" Height="20" Margin="20,10,0,0" TextWrapping="Wrap" Text="SN:" VerticalAlignment="Top" Width="70" FontSize="16"/>
<TextBox x:Name="sn_id" HorizontalAlignment="Left" Height="20" Margin="90,10,0,0" VerticalAlignment="Top" Width="360" Background="#FFE6E6E6" IsReadOnly="True" IsTabStop="False" Focusable="False"/>
<TextBox x:Name="cdk" HorizontalAlignment="Left" Height="20" Margin="90,35,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="360"/>
<Button Content="OK" HorizontalAlignment="Right" Height="20" Margin="0,60,50,0" VerticalAlignment="Top" Width="85" Background="#FFE6E6E6" Click="Button_Click_2"/>
<TextBox x:Name="sn_time" HorizontalAlignment="Left" Height="20" Margin="90,60,0,0" VerticalAlignment="Top" Width="250" Background="{x:Null}" IsReadOnly="True" IsTabStop="False" Focusable="False" BorderBrush="{x:Null}"/>
</Grid>
</Window>
+148
View File
@@ -0,0 +1,148 @@
using formula_manage.UserClass;
using System;
using System.Windows;
namespace formula_manage.Windows
{
/// <summary>
/// CDKEY.xaml 的交互逻辑
/// </summary>
public partial class CDKEY : Window
{
public CDKEY()
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
}
string cpuSerialNumber;
string biosSerialNumber;
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
private void Window_CDKEY(object sender, RoutedEventArgs e) //打开页面
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
string cdk = Configini.IniReadvalue("SN", "SN1"); //读配置文件
if (cdk.Length == 16)
{
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(cdk.Substring(0, 12)), true) == cdk.Substring(12, 4)) //校验key的crc校验值
{
try
{
string Y = (2255 - StrToInt.To16Convert10(cdk.Substring(6, 2))).ToString();
string M = (255 - StrToInt.To16Convert10(cdk.Substring(8, 2))).ToString();
string D = (255 - StrToInt.To16Convert10(cdk.Substring(10, 2))).ToString();
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
}
catch (Exception)
{
sn_time.Text = "注册有效时间: --------";
}
}
else
{
sn_time.Text = "注册有效时间: --------";
}
}
else
{
sn_time.Text = "注册有效时间: --------";
}
// 获取CPU序列号
cpuSerialNumber = HardwareSN.GetCPUSerialNumber();
// 获取主板序列号
biosSerialNumber = HardwareSN.GetBIOSSerialNumber();
// 获取硬盘序列号
//string hardDiskSerialNumber = HardwareSN.GetHardDiskSerialNumber();
// 获取网卡地址
//string netCardMACAddress = HardwareSN.GetNetCardMACAddress();
sn_id.Text = MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber);//生成id基于硬件值的md5校验
}
private void Button_Click_2(object sender, RoutedEventArgs e) //cdk确认按钮
{
string id_1;
id_1 = sn_id.Text.Substring(5, 1) + sn_id.Text.Substring(0, 1) + sn_id.Text.Substring(4, 1) + sn_id.Text.Substring(1, 1) + sn_id.Text.Substring(3, 1) + sn_id.Text.Substring(2, 1);
if (cdk.Text.Length != 16)
{
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
if (id_1 == cdk.Text.Substring(0, 6))
{
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(cdk.Text.Substring(0, 12)), true) == cdk.Text.Substring(12, 4)) //校验key的crc校验值
{
string Y = (2255 - StrToInt.To16Convert10(cdk.Text.Substring(6, 2))).ToString();
string M = (255 - StrToInt.To16Convert10(cdk.Text.Substring(8, 2))).ToString();
string D = (255 - StrToInt.To16Convert10(cdk.Text.Substring(10, 2))).ToString();
string YY = DateTime.Now.ToString("yyyy");
string MM = DateTime.Now.ToString("MM");
string DD = DateTime.Now.ToString("dd");
if (string.Compare(Y, YY) == 0)
{
if (string.Compare(M, MM) == 0)
{
if (string.Compare(D, DD) >= 0)
{
System.Windows.MessageBox.Show("CDKEY: 注册成功,请重启软件", "KEY", MessageBoxButton.OK, MessageBoxImage.Asterisk);
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
Configini.IniWritevalue("SN", " SN1", cdk.Text);
Configini.IniWritevalue("SN", " SN2", MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber));
}
else if (string.Compare(M, MM) > 0)
{
System.Windows.MessageBox.Show("CDKEY: 注册成功,请重启软件", "KEY", MessageBoxButton.OK, MessageBoxImage.Asterisk);
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
Configini.IniWritevalue("SN", " SN1", cdk.Text);
Configini.IniWritevalue("SN", " SN2", MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber));
}
else
{
System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
else
{
System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
else if (string.Compare(Y, YY) > 0)
{
System.Windows.MessageBox.Show("CDKEY: 注册成功,请重启软件", "KEY", MessageBoxButton.OK, MessageBoxImage.Asterisk);
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
Configini.IniWritevalue("SN", " SN1", cdk.Text);
Configini.IniWritevalue("SN", " SN2", MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber));
}
else
{
System.Windows.MessageBox.Show("CDKEY: 注册码过期", "WARNING", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
else
{
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
else
{
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
}
+13 -27
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
{
@@ -76,7 +62,7 @@ namespace formula_manage.Windows
/// </summary>
private async void GridSql()
{
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [Dispensing].[dbo].[Dissolve]";//查询语句
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [dbo].[Dissolve]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
@@ -104,12 +90,12 @@ namespace formula_manage.Windows
if (rownum != -1)//判断鼠标定位是否有效
{
/*定位选中行及指定列单元格文本信息*/
Code.Text = (DatagridDissolve.Columns[1].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//定位第列
name.Text = (DatagridDissolve.Columns[2].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
ion.Text = (DatagridDissolve.Columns[3].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
min.Text = (DatagridDissolve.Columns[4].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
max.Text = (DatagridDissolve.Columns[5].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
Remark.Text = (DatagridDissolve.Columns[6].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
Code.Text = (DatagridDissolve.Columns[1].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第列
name.Text = (DatagridDissolve.Columns[2].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
ion.Text = (DatagridDissolve.Columns[3].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
min.Text = (DatagridDissolve.Columns[4].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
max.Text = (DatagridDissolve.Columns[5].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
Remark.Text = (DatagridDissolve.Columns[6].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.TrimEnd();//
}
}
@@ -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;
@@ -164,7 +150,7 @@ namespace formula_manage.Windows
try
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
Dissolve_sql = "SELECT count(*) FROM [Dispensing].[dbo].[Dissolve] WHERE DissolveCode = '" + Code.Text + " '";//查询语句
Dissolve_sql = "SELECT count(*) FROM [dbo].[Dissolve] WHERE DissolveCode = '" + Code.Text + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(Dissolve_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
@@ -172,8 +158,8 @@ namespace formula_manage.Windows
if (count == 0)
{
Dissolve_sql = string.Format("INSERT INTO[Dispensing].[dbo].[Dissolve](DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX) " +
"VALUES ('" + Code.Text + "','" + name.Text + "','" + Remark.Text + "','" + int_ion + "','"+ min.Text + "','" + max.Text + "')");
Dissolve_sql = string.Format("INSERT INTO[dbo].[Dissolve](DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX) " +
"VALUES ('" + Code.Text + "','" + name.Text + "','" + Remark.Text + "','" + int_ion + "','" + min.Text + "','" + max.Text + "')");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
+13 -27
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
{
@@ -60,7 +46,7 @@ namespace formula_manage.Windows
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [Dispensing].[dbo].[MACHINE]";//查询语句
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [dbo].[MACHINE]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
@@ -95,7 +81,7 @@ namespace formula_manage.Windows
/// </summary>
private async void GridSql()
{
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [Dispensing].[dbo].[MACHINE]";//查询语句
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [dbo].[MACHINE]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
@@ -130,13 +116,13 @@ namespace formula_manage.Windows
if (rownum != -1)//判断鼠标定位是否有效
{
/*定位选中行及指定列单元格文本信息*/
mac_Name.Text = (DataGridMac.Columns[1].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//定位第列
mac_MacGroup.Text = (DataGridMac.Columns[2].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
mac_Capacity.Text = (DataGridMac.Columns[3].GetCellContent(DataGridMac .Items[rownum]) as TextBlock).Text.Trim();//
mac_Volume.Text = (DataGridMac.Columns[4].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
mac_Industry.Text = (DataGridMac.Columns[5].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
mac_Categories.Text = (DataGridMac.Columns[6].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
mac_Note.Text = (DataGridMac.Columns[7].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.Trim();//
mac_Name.Text = (DataGridMac.Columns[1].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第列
mac_MacGroup.Text = (DataGridMac.Columns[2].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
mac_Capacity.Text = (DataGridMac.Columns[3].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
mac_Volume.Text = (DataGridMac.Columns[4].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
mac_Industry.Text = (DataGridMac.Columns[5].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
mac_Categories.Text = (DataGridMac.Columns[6].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
mac_Note.Text = (DataGridMac.Columns[7].GetCellContent(DataGridMac.Items[rownum]) as TextBlock).Text.TrimEnd();//
}
}
@@ -175,7 +161,7 @@ namespace formula_manage.Windows
try
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
MAC_sql = "SELECT count(*) FROM [Dispensing].[dbo].[MACHINE] WHERE Name = '" + Mac_name + " '";//查询语句
MAC_sql = "SELECT count(*) FROM [dbo].[MACHINE] WHERE Name = '" + Mac_name + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(MAC_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
@@ -183,7 +169,7 @@ namespace formula_manage.Windows
if (count == 0)
{
MAC_sql = string.Format("INSERT INTO[Dispensing].[dbo].[MACHINE](Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note ) " +
MAC_sql = string.Format("INSERT INTO [dbo].[MACHINE](Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note ) " +
"VALUES ('" + Mac_name + "','" + Mac_group + "'," + Mac_capacity + "," + Mac_volume + "," + Mac_industry + "," + Mac_categories + ",'" + Mac_note + "')");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(MAC_sql, conn_SC);
+26 -23
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>
+109 -98
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,19 +134,13 @@ 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}");
@@ -157,61 +148,36 @@ namespace formula_manage.Windows
}
private void Button_Click_12(object sender, RoutedEventArgs e) //编辑模板
{
/* if (string.IsNullOrEmpty(Print_path.Text))
if (string.IsNullOrEmpty(Template_S.Text))
{
System.Windows.MessageBox.Show("模板不能为空");
return;
}*/
var data = this.CreateBillData();
if (!data.Item1)
{
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) //打印机是否生效
@@ -229,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() //查找打印机
{
@@ -253,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"; // 显示文件名
}
}
}
+175
View File
@@ -0,0 +1,175 @@
<Window x:Class="formula_manage.Windows.RECIPE"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.Windows"
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
xmlns:ViewModel="clr-namespace:formula_manage.ViewModel"
mc:Ignorable="d" Loaded="RECIPE_Loaded"
Title="RECIPE_SET" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
DataContext="{Binding Source={StaticResource Locator}, Path=Recipev}"
BorderBrush="White" Background="#FFE0E0E0">
<Window.Resources>
<ViewModel:RECIPEViewModel x:Key="RECIPEViewModel"/>
</Window.Resources>
<Grid>
<!--表-->
<DataGrid x:Name="DatagridRECIPE" MouseDoubleClick="RECIPE_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True"
Margin="15,0,15,150" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility ="Column" VerticalAlignment="Bottom" Height="250">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="#000000"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="配方代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="配方名称" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="颜色名" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="颜色代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="客户代码" Width="100" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="客户名称" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="备注" Width="800" FontSize="15" MinWidth="80" CanUserReorder="False"/>
</DataGrid.Columns>
</DataGrid>
<!--代码-->
<TextBox x:Name="Code" HorizontalAlignment="Left" Height="30" Margin="65,0,0,100" Text=""
VerticalAlignment="Bottom" Width="120" FontSize="22" MaxLines="1" MaxLength="25"
InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="代码"
VerticalAlignment="Bottom" Width="40" FontSize="20"/>
<!--名称-->
<TextBox x:Name="name" HorizontalAlignment="Left" Height="30" Margin="255,0,0,100" Text=""
VerticalAlignment="Bottom" Width="120" FontSize="22" MaxLines="1" MaxLength="25"
InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="205,0,0,100" TextWrapping="Wrap" Text="名称"
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
<!--备注-->
<TextBox x:Name="Remark" HorizontalAlignment="Left" Height="30" Margin="255,0,0,50"
VerticalAlignment="Bottom" Width="305" FontSize="22" MaxLines="1"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="205,0,0,50" TextWrapping="Wrap" Text="备注"
VerticalAlignment="Bottom" Width="40" FontSize="20"/>
<!--存储按钮-->
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="795,0,0,60"
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
Click="Button_Preservation">
</Button>
<!--删除按钮-->
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="935,0,0,60"
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
Click="Button_Delete">
</Button>
<DataGrid x:Name="Grid_RRODUCT" AlternationCount="2" IsReadOnly="False"
Margin="15,15,15,405" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column"
Background="White" SelectionMode="Single" FontSize="15" >
<DataGrid.Resources>
<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/>
<Setter Property="DataContext" Value="{Binding Main, Source={StaticResource Locator}}"/>
</Style>
</DataGrid.Resources>
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="序" Width="30" FontSize="15" MaxWidth="30" MinWidth="30" Binding="{Binding ID}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0"
ItemsSource="{Binding stuff_Product, Source={StaticResource RECIPEViewModel}}"
DisplayMemberPath="ProductCode"
Text="{Binding PRODUCT_CODE}" IsTextSearchEnabled="True" StaysOpenOnEdit="True"
BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True"
KeyDown="CP_PRODUCT_CODE_KeyUp"
DropDownClosed="CP_PRODUCT_CODE_DropDownClosed"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="目标饱和度(%)" Width="200" MaxWidth="400" MinWidth="100" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox x:Name="CP_CONC" BorderThickness="0,0,0,0" Text="{Binding CONC}"
BorderBrush="{x:Null}" Background="{x:Null}"
KeyDown="CP_CONC_KeyUp"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}" Binding="{Binding SHIFT}"/>
<DataGridTemplateColumn Header="原料名称" Width="200" MaxWidth="400" MinWidth="100" CellStyle="{StaticResource CellStyle}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_PRODUCT_NAME" BorderThickness="0,0,0,0"
ItemsSource="{Binding stuff_Product, Source={StaticResource RECIPEViewModel}}"
DisplayMemberPath="ProductName"
Text="{Binding PRODUCT_NAME}"
DropDownClosed="CP_PRODUCT_NAME_DropDownClosed"
BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True" IsReadOnly="True" Focusable="True" IsTabStop="False"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="单位" Width="80" FontSize="15" MaxWidth="80" MinWidth="80" IsReadOnly="True" Binding="{Binding UNIT}" CellStyle="{StaticResource CellStyle}"/>
<DataGridTextColumn Header="备注" Width="600" FontSize="15" MinWidth="600" Binding="{Binding REMARK}" CellStyle="{StaticResource CellStyle}" IsReadOnly="False"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
+391
View File
@@ -0,0 +1,391 @@
using formula_manage.UserClass;
using formula_manage.ViewModel;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Input;
namespace formula_manage.Windows
{
/// <summary>
/// Machine.xaml 的交互逻辑
/// </summary>
public partial class RECIPE : Window
{
// DataTable DissolvedataTable = new DataTable(); //建立Dissolve缓存
// DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存
// DataTable MACHINEdataTable = new DataTable(); //建立Machine缓存
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
// DataTable RecipedataTable = new DataTable(); //建立Recipe缓存
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
string TEXT_SQLUSER;
string TEXT_SQLPASWOR;
string Connstr_SC;
int ID_N = 1;
public RECIPE()
{
DataContext = new RECIPEViewModel();
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
RRODUCTdataTable.Columns.Add("ID", typeof(int));
RRODUCTdataTable.Columns.Add("DYELOT", typeof(string));
RRODUCTdataTable.Columns.Add("ReDye", typeof(int));
RRODUCTdataTable.Columns.Add("STEP", typeof(int));
RRODUCTdataTable.Columns.Add("PRODUCT_CODE", typeof(string));
RRODUCTdataTable.Columns.Add("CONC", typeof(float));
RRODUCTdataTable.Columns.Add("SHIFT", typeof(string));
RRODUCTdataTable.Columns.Add("PRODUCT_NAME", typeof(string));
RRODUCTdataTable.Columns.Add("TARGET_WT", typeof(float));
RRODUCTdataTable.Columns.Add("UNIT", typeof(string));
RRODUCTdataTable.Columns.Add("Process", typeof(string));
RRODUCTdataTable.Columns.Add("REMARK", typeof(string));
DataRow row = RRODUCTdataTable.NewRow(); //ID列
row["ID"] = ID_N;
row["UNIT"] = "g";
RRODUCTdataTable.Rows.Add(row);
Grid_RRODUCT.ItemsSource = RRODUCTdataTable.DefaultView;
}
private void RECIPE_Loaded(object sender, RoutedEventArgs e)//打开页面执行
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
this.DatagridRECIPE.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.DataGridEquipment_LoadingRow);//生成序列号
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
GridSql();
}
/// <summary>
/// 生成序列号的方法
/// </summary>
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
/// <summary>
/// 查询数据库的方法
/// </summary>
private async void GridSql()
{
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [dbo].[Dissolve]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter Stuff_data = new SqlDataAdapter(Dissolve_sql, Connstr_SC); //查询
DataTable dataTable = new DataTable(); //建立缓存
Stuff_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
DatagridRECIPE.ItemsSource = dataTable.DefaultView; //数据加入表格
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
return;
}
}
private void RECIPE_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
{
int rownum = DatagridRECIPE.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
}
}
private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件
{
//Regex re = new Regex("[^0-9.-]+");
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
e.Handled = !re.IsMatch(e.Text);
}
private void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
{
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数
Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串
// string Dissolve_sql;
// int int_ion = 0;
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
string Mac_name = "是否删除【" + this.Code.Text + "】";//获取信息并拼接提示字符串
MessageBoxResult mac_name = System.Windows.MessageBox.Show(Mac_name, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标
if (mac_name == MessageBoxResult.Yes)//判断是否删除原料
{
string Stuff_sql = string.Format("DELETE FROM [dbo].[Dissolve] WHERE Name ='" + Code.Text.ToString() + "'");
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("ERR.C0110-2:删除失败", "错误");//判断执行是否成功
}
else
{
GridSql();
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
string Code_;
string Name_;
string Type_;
string Conc_;
double Weight_ = 0;
private void CP_PRODUCT_CODE_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//原料代码输入事件
{
//double ang;
if (e.Key == Key.Enter)
{
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
Code_ = curComboBox.Text;
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + Code_ + "'"); //查询判断原料代码是否有效
if (!r.Any()) //检查原料信息
{
System.Windows.MessageBox.Show("原料不存在");
curComboBox.Text = "";
return;
}
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
System.Windows.MessageBox.Show("重复原料");
return;
}
Name_ = r[0].ItemArray[1].ToString();
Type_ = r[0].ItemArray[2].ToString();
Conc_ = r[0].ItemArray[3].ToString();
if ((Type_ == "0") || (Type_ == "3"))
{
Type_ = "%";
}
if ((Type_ == "1") || (Type_ == "2"))
{
Type_ = "g/L";
}
if (grid_row == -1) grid_row = 0;
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
row.BeginEdit();
row["PRODUCT_CODE"] = Code_;
row["PRODUCT_NAME"] = Name_;
row["SHIFT"] = Type_;
row.EndEdit();
if (grid_row == (ID_N - 1))
{
PressKey.PressKeys(Keys.Right, false);
PressKey.PressKeys(Keys.Right, true);
PressKey.PressKeys(Keys.Tab, false);
PressKey.PressKeys(Keys.Tab, true);
}
else
{
PressKey.PressKeys(Keys.Right, false);
PressKey.PressKeys(Keys.Right, true);
PressKey.PressKeys(Keys.Up, false);
PressKey.PressKeys(Keys.Up, true);
PressKey.PressKeys(Keys.Tab, false);
PressKey.PressKeys(Keys.Tab, true);
}
}
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
}
private void CP_CONC_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)//目标饱和度输入事件
{
double ang;
double conc = 0;
System.Windows.Controls.TextBox curTextBox = sender as System.Windows.Controls.TextBox;
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
if (e.Key == Key.Enter)
{
if (!double.TryParse(curTextBox.Text, out ang))
{
System.Windows.MessageBox.Show("错误,重新输入");
curTextBox.Text = "";
return;
}
else
{
if (curTextBox.Text != "") conc = double.Parse(curTextBox.Text); //转换后判断数值输入是否异常
if (conc > 100)
{
System.Windows.MessageBox.Show("比例错误");
curTextBox.Text = "";
return;
}
else
{
double Weight_t = Weight_ * conc;
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
row.BeginEdit();
row["CONC"] = string.Format("{0:N6}", conc);
row["TARGET_WT"] = string.Format("{0:N3}", Weight_t);
row.EndEdit();
if (grid_row == (ID_N - 1))
{
PressKey.PressKeys(Keys.Left, false);
PressKey.PressKeys(Keys.Left, true);
PressKey.PressKeys(Keys.Tab, false);
PressKey.PressKeys(Keys.Tab, true);
DataRow rowadd = RRODUCTdataTable.NewRow(); //ID列
//rowadd = RRODUCTdataTable.NewRow();
ID_N++;
rowadd["ID"] = ID_N;
rowadd["UNIT"] = "g";
RRODUCTdataTable.Rows.Add(rowadd);
}
}
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
}
}
}
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//原料代码选择事件
{
//double ang;
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
Code_ = curComboBox.Text;
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductCode ='" + Code_ + "'"); //查询判断原料代码是否有效
if (!r.Any()) //检查原料信息
{
System.Windows.MessageBox.Show("原料不存在");
curComboBox.Text = "";
return;
}
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
System.Windows.MessageBox.Show("重复原料");
return;
}
Name_ = r[0].ItemArray[1].ToString();
Type_ = r[0].ItemArray[2].ToString();
Conc_ = r[0].ItemArray[3].ToString();
if ((Type_ == "0") || (Type_ == "3"))
{
Type_ = "%";
}
if ((Type_ == "1") || (Type_ == "2"))
{
Type_ = "g/L";
}
if (grid_row == -1) grid_row = 0;
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
row.BeginEdit();
row["PRODUCT_CODE"] = Code_;
row["PRODUCT_NAME"] = Name_;
row["SHIFT"] = Type_;
row.EndEdit();
DataGridHelper.SetRealTimeCommit(Grid_RRODUCT, true); //实时更新datagrid
}
private void CP_PRODUCT_NAME_DropDownClosed(object sender, EventArgs e)//原料名选择事件
{
//double ang;
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
int grid_row = Grid_RRODUCT.SelectedIndex; //获取当前行
if (curComboBox.Text != "")
{
Name_ = curComboBox.Text;
DataRow[] r = MainWindowViewModel.STUFFdatatemp.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_NAME ='" + Name_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
System.Windows.MessageBox.Show("重复原料");
return;
}
Code_ = r[0].ItemArray[0].ToString();
Type_ = r[0].ItemArray[2].ToString();
Conc_ = r[0].ItemArray[3].ToString();
if ((Type_ == "0") || (Type_ == "3"))
{
Type_ = "%";
}
if ((Type_ == "1") || (Type_ == "2"))
{
Type_ = "g/L";
}
if (grid_row == -1) grid_row = 0;
DataRow row = RRODUCTdataTable.Rows[grid_row]; //ID列
row.BeginEdit();
row["PRODUCT_CODE"] = Code_;
row["PRODUCT_NAME"] = Name_;
row["SHIFT"] = Type_;
row.EndEdit();
}
}
}
}
+2 -13
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;
@@ -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 = "年";
@@ -90,7 +79,7 @@ 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; //返回选择的字符串
}
+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
+21 -34
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
{
@@ -62,7 +49,7 @@ namespace formula_manage.Windows
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
string Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT]";//查询语句
string Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
@@ -125,14 +112,14 @@ 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 [Dispensing].[dbo].[PRODUCT]";//查询语句
else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '0' ";
else if (e == 2) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '1' ";
else if (e == 3) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '2' ";
else if (e == 4) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '3' ";
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 == 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); //实例化
@@ -178,7 +165,7 @@ namespace formula_manage.Windows
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;
@@ -234,7 +221,7 @@ namespace formula_manage.Windows
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
Stuff_sql = "SELECT count(*) FROM [Dispensing].[dbo].[PRODUCT] WHERE ProductCode = '" + Product_Code + " '";//查询语句
Stuff_sql = "SELECT count(*) FROM [dbo].[PRODUCT] WHERE ProductCode = '" + Product_Code + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
@@ -242,7 +229,7 @@ namespace formula_manage.Windows
if (count == 0)
{
Stuff_sql = string.Format( "INSERT INTO[Dispensing].[dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
Stuff_sql = string.Format("INSERT INTO [dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
"VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
@@ -270,7 +257,7 @@ namespace formula_manage.Windows
}
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(); //执行语句
@@ -347,14 +334,14 @@ namespace formula_manage.Windows
if (rownum != -1)//判断鼠标定位是否有效
{
/*定位选中行及指定列单元格文本信息*/
string DataGridStuff_ProductCode = (DataGridStuff.Columns[1].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第0列,原料代码
string DataGridStuff_ProductName = (DataGridStuff.Columns[2].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第1列,原料名称
string DataGridStuff_Price = (DataGridStuff.Columns[8].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,价格
string DataGridstuff_SUPPLIER = (DataGridStuff.Columns[9].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,供应商
string DataGridStuff_ProductType = (DataGridStuff.Columns[3].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,类型 //string DataGridStuff_Color = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum])as TextBlock).Text;//定位,色彩
string DataGridStuff_Concentration = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位选中行单元格文本信息
string DataGridStuff_stuff_ion = (DataGridStuff.Columns[4].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位选中行单元格文本信息并去除空白字符,浓度
string DataGridStuff_GRAVITY = (DataGridStuff.Columns[7].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,比重
string DataGridStuff_ProductCode = (DataGridStuff.Columns[1].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第0列,原料代码
string DataGridStuff_ProductName = (DataGridStuff.Columns[2].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第1列,原料名称
string DataGridStuff_Price = (DataGridStuff.Columns[8].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,价格
string DataGridstuff_SUPPLIER = (DataGridStuff.Columns[9].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,供应商
string DataGridStuff_ProductType = (DataGridStuff.Columns[3].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,类型 //string DataGridStuff_Color = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum])as TextBlock).Text;//定位,色彩
string DataGridStuff_Concentration = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位选中行单元格文本信息
string DataGridStuff_stuff_ion = (DataGridStuff.Columns[4].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位选中行单元格文本信息并去除空白字符,浓度
string DataGridStuff_GRAVITY = (DataGridStuff.Columns[7].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,比重
/*stuff_Color.Background = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background;//定位,色彩,背景色传递至色彩框背景色*/
/*填写信息至指定文本框*/
//product_temp.ProductCode = DataGridStuff_ProductCode;//写入sql实体缓存
+3 -17
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,7 +127,7 @@ 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;
+87
View File
@@ -0,0 +1,87 @@
<Window x:Class="formula_manage.Windows.client"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.Windows"
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
xmlns:viewmodel="clr-namespace:formula_manage.ViewModel"
mc:Ignorable="d" Loaded="client_Loaded"
Title="client" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
BorderBrush="White" Background="#FFE0E0E0">
<Grid>
<!--原料表-->
<DataGrid x:Name="DataGridclient" MouseDoubleClick="DataGridclient_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True" Margin="15,15,15,150" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility ="Column">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="#000000"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTemplateColumn Header=" 序号" Width="50" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock FontSize="15" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="客户代码" Binding="{Binding Code}" Width="250" FontSize="15" MaxWidth="500" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="客户名称" Binding="{Binding Name}" Width="250" FontSize="15" MaxWidth="500" MinWidth="200" CanUserReorder="False"/>
<DataGridTextColumn Header="备注" Binding="{Binding Remark}" Width="500" FontSize="15" MaxWidth="1500" MinWidth="150" CanUserReorder="False"/>
</DataGrid.Columns>
</DataGrid>
<!--客户代码-->
<TextBox x:Name="client_code" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="25"
InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="客户代码"
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
<!--客户名称-->
<TextBox x:Name="client_name" HorizontalAlignment="Left" Height="30" Margin="465,0,0,100" Text=""
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="50"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="375,0,0,100" TextWrapping="Wrap" Text="客户名称"
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
<!--备注-->
<TextBox x:Name="client_Remark" HorizontalAlignment="Left" Height="30" Margin="105,0,0,50" Text=""
VerticalAlignment="Bottom" Width="610" FontSize="22" MaxLines="1" MaxLength="25"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="备注"
VerticalAlignment="Bottom" Width="120" FontSize="20"/>
<!--存储按钮-->
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="795,0,0,60"
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
Click="Button_Preservation">
</Button>
<!--删除按钮-->
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="935,0,0,60"
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
Click="Button_Delete">
</Button>
</Grid>
</Window>
+221
View File
@@ -0,0 +1,221 @@
using System;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace formula_manage.Windows
{
/// <summary>
/// client.xaml 的交互逻辑
/// </summary>
public partial class client : Window
{
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
DataTable dataTable = new DataTable(); //建立缓存
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
string TEXT_SQLUSER;
string TEXT_SQLPASWOR;
string Connstr_SC;
public client()
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
}
private async void client_Loaded(object sender, RoutedEventArgs e)//打开页面执行
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
this.DataGridclient.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.DataGridEquipment_LoadingRow);//生成序列号
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
string client_sql = "SELECT Code ,Name , Remark FROM [dbo].[Client]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter client_data = new SqlDataAdapter(client_sql, Connstr_SC); //查询
client_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
DataGridclient.ItemsSource = dataTable.DefaultView; //数据加入表格
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
return;
}
}
/// <summary>
/// 生成序列号的方法
/// </summary>
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
/// <summary>
/// 查询数据库的方法
/// </summary>
private async void GridSql()
{
string client_sql = "SELECT Code ,Name , Remark FROM [dbo].[Client]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter client_data = new SqlDataAdapter(client_sql, Connstr_SC); //查询
dataTable.Clear();
client_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
DataGridclient.ItemsSource = dataTable.DefaultView; //数据加入表格
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
return;
}
}
private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
{
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数
string client_sql;
if (string.IsNullOrEmpty(this.client_code.Text))
System.Windows.MessageBox.Show("ERR:无效的信息", "错误");//检查原料代码
else
if (string.IsNullOrEmpty(this.client_name.Text))
System.Windows.MessageBox.Show("ERR:无效的名称", "错误");//检查原料名
else
{
try
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
client_sql = "SELECT count(*) FROM [dbo].[Client] WHERE Code = '" + client_code.Text + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(client_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
conn_SC.Close(); //关闭连接
if (count == 0)
{
client_sql = string.Format("INSERT INTO [dbo].[Client](Code ,Name , Remark) " +
"VALUES ('" + client_code.Text + "','" + client_name.Text + "','" + client_Remark.Text + "')");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("添加失败");
}
else
{
GridSql();
System.Windows.MessageBox.Show("添加完成");
}
}
else
{
client_sql = string.Format("UPDATE [dbo].[Client] SET Name='" + client_name.Text + "',Remark='" + client_Remark.Text + "' Where Code='" + client_code.Text + "'");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(client_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("C0110-1:修改失败");
}
else
{
GridSql();
System.Windows.MessageBox.Show("修改完成");
}
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
string ShowProductName = "是否删除【" + this.client_name.Text + "】" + this.client_code.Text;//获取信息并拼接提示字符串
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
if (showProductName == MessageBoxResult.Yes)//判断是否删除
{
string Stuff_sql = string.Format("DELETE FROM [dbo].[Client] WHERE Code ='" + client_code.Text.ToString() + "'");
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功
}
else
{
GridSql();
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
private void DataGridclient_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
{
int rownum = DataGridclient.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
/*定位选中行及指定列单元格文本信息*/
client_code.Text = (DataGridclient.Columns[1].GetCellContent(DataGridclient.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第0列,代码
client_name.Text = (DataGridclient.Columns[2].GetCellContent(DataGridclient.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第1列,名称
client_Remark.Text = (DataGridclient.Columns[3].GetCellContent(DataGridclient.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,
}
}
}
}
+106
View File
@@ -0,0 +1,106 @@
<Window x:Class="formula_manage.Windows.color"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.Windows"
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
xmlns:viewmodel="clr-namespace:formula_manage.ViewModel"
mc:Ignorable="d" Loaded="color_Loaded"
Title="color" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
BorderBrush="White" Background="#FFE0E0E0">
<Window.Resources>
<!--引入转换器-->
<ConvertMoels:ColorSQLConvert x:Key="ColorSQLConvert"/>
</Window.Resources>
<Grid>
<!--原料表-->
<DataGrid x:Name="DataGridcolor" MouseDoubleClick="DataGridcolor_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True" Margin="15,15,15,150" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility ="Column">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="#000000"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTemplateColumn Header=" 序号" Width="50" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock FontSize="15" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="颜色代码" Binding="{Binding COLOR_CODE}" Width="250" FontSize="15" MaxWidth="500" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="颜色名称" Binding="{Binding COLOR_NAME}" Width="250" FontSize="15" MaxWidth="500" MinWidth="200" CanUserReorder="False"/>
<DataGridTextColumn Header="色彩" Width="100" FontSize="15" MaxWidth="200" MinWidth="20" CanUserReorder="False">
<!--事件名称:色彩数字转色彩显示,转换器ColorSQLConvert-->
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Background" Value="{Binding COLOR_NO, Converter={StaticResource ColorSQLConvert}}"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="备注" Binding="{Binding COLOR_Remark}" Width="500" FontSize="15" MaxWidth="1500" MinWidth="150" CanUserReorder="False"/>
</DataGrid.Columns>
</DataGrid>
<!--颜色代码-->
<TextBox x:Name="color_code" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="25"
InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="颜色代码"
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
<!--颜色名称-->
<TextBox x:Name="color_name" HorizontalAlignment="Left" Height="30" Margin="465,0,0,100" Text=""
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="50"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="375,0,0,100" TextWrapping="Wrap" Text="颜色名称"
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
<!--备注-->
<TextBox x:Name="color_Remark" HorizontalAlignment="Left" Height="30" Margin="105,0,0,50" Text=""
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="25"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="备注"
VerticalAlignment="Bottom" Width="120" FontSize="20"/>
<!---->
<TextBox x:Name="color_color" HorizontalAlignment="Left" Height="30" Margin="465,0,0,50" Text=""
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="25"
MouseDoubleClick="Color_MouseDoubleClick" IsReadOnly="True" Cursor="Arrow"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="375,0,0,50" TextWrapping="Wrap" Text="颜色"
VerticalAlignment="Bottom" Width="40" FontSize="20"/>
<!--存储按钮-->
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="795,0,0,60"
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
Click="Button_Preservation">
</Button>
<!--删除按钮-->
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="935,0,0,60"
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
Click="Button_Delete">
</Button>
</Grid>
</Window>
+258
View File
@@ -0,0 +1,258 @@
using System;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace formula_manage.Windows
{
/// <summary>
/// color.xaml 的交互逻辑
/// </summary>
public partial class color : Window
{
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
DataTable dataTable = new DataTable(); //建立缓存
string TEXT_SQLIP;
string TEXT_SQLNAME;
string TEXT_SQMOD;
string TEXT_SQLUSER;
string TEXT_SQLPASWOR;
string Connstr_SC;
public color()
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
}
private async void color_Loaded(object sender, RoutedEventArgs e)//打开页面执行
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
this.DataGridcolor.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.DataGridEquipment_LoadingRow);//生成序列号
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
string color_sql = "SELECT COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark FROM [dbo].[COLOR]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter color_data = new SqlDataAdapter(color_sql, Connstr_SC); //查询
color_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
DataGridcolor.ItemsSource = dataTable.DefaultView; //数据加入表格
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
return;
}
}
/// <summary>
/// 生成序列号的方法
/// </summary>
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
/// <summary>
/// 查询数据库的方法
/// </summary>
private async void GridSql()
{
string color_sql = "SELECT COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark FROM [dbo].[COLOR]";//查询语句
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlDataAdapter color_data = new SqlDataAdapter(color_sql, Connstr_SC); //查询
dataTable.Clear();
color_data.Fill(dataTable); //查询结果存入缓存
conn_SC.Close(); //关闭连接
DataGridcolor.ItemsSource = dataTable.DefaultView; //数据加入表格
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
return;
}
}
private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
{
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,4})?$");//校验用正则表达式有1~2位小数的正实数
string color_sql;
int ColorCode_SQL;
string colorValue = color_color.Background.ToString();//获取色彩框背景色"#FFC1C2C3"
string StuffColor_R = string.Format("{0:X2}", colorValue.Substring(3, 2));//获取红色参数C1
string StuffColor_G = string.Format("{0:X2}", colorValue.Substring(5, 2));//获取绿色参数C2
string StuffColor_B = string.Format("{0:X2}", colorValue.Substring(7, 2));//获取蓝色参数C3
string StuffColor = StuffColor_B + StuffColor_G + StuffColor_R;//合并16进制rgb参数
ColorCode_SQL = Convert.ToInt32(StuffColor, 16);//16进制转10进制
if (ColorCode_SQL < 0) ColorCode_SQL = 16777215;//判断色彩数据是否有效
if ((re_number.IsMatch(this.color_color.Text) == false) && (color_color.Text != ""))
System.Windows.MessageBox.Show("ERR:单位码重错误", "错误");//检查价格输入信息
else
if (string.IsNullOrEmpty(this.color_code.Text))
System.Windows.MessageBox.Show("ERR:无效的原料信息", "错误");//检查原料代码
else
if (string.IsNullOrEmpty(this.color_name.Text))
System.Windows.MessageBox.Show("ERR:无效的原料名称", "错误");//检查原料名
else
{
try
{
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
color_sql = "SELECT count(*) FROM [dbo].[COLOR] WHERE COLOR_CODE = '" + color_code.Text + " '";//查询语句
await conn_SC.OpenAsync(); //打开数据连
SqlCommand cmd = new SqlCommand(color_sql, conn_SC); //查询记录数
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
conn_SC.Close(); //关闭连接
if (count == 0)
{
color_sql = string.Format("INSERT INTO [dbo].[COLOR](COLOR_CODE ,COLOR_NAME , COLOR_NO , COLOR_Remark) " +
"VALUES ('" + color_code.Text + "','" + color_name.Text + "','" + ColorCode_SQL + "','" + color_Remark.Text + "')");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(color_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("添加失败");
}
else
{
GridSql();
System.Windows.MessageBox.Show("添加完成");
}
}
else
{
color_sql = string.Format("UPDATE [dbo].[COLOR] SET COLOR_NAME='" + color_name.Text + "',COLOR_NO='" + ColorCode_SQL + "',COLOR_Remark='" + color_Remark.Text + "' Where COLOR_CODE='" + color_code.Text + "'");
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(color_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("C0110-1:修改失败");
}
else
{
GridSql();
System.Windows.MessageBox.Show("修改完成");
}
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
string ShowProductName = "是否删除【" + this.color_name.Text + "】" + this.color_code.Text;//获取信息并拼接提示字符串
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
if (showProductName == MessageBoxResult.Yes)//判断是否删除
{
string Stuff_sql = string.Format("DELETE FROM [dbo].[COLOR] WHERE COLOR_CODE ='" + color_code.Text.ToString() + "'");
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
try
{
await conn_SC.OpenAsync(); //打开数据连接
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
conn_SC.Close(); //关闭连接
if (sql_in == 0)
{
System.Windows.MessageBox.Show("C0110-2:删除失败", "错误");//判断执行是否成功
}
else
{
GridSql();
}
}
catch (Exception)
{
System.Windows.MessageBox.Show("请求失败,检查连接");
return;
}
}
}
private void DataGridcolor_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
{
int rownum = DataGridcolor.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
/*定位选中行及指定列单元格文本信息*/
color_code.Text = (DataGridcolor.Columns[1].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第0列,代码
color_name.Text = (DataGridcolor.Columns[2].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Text.TrimEnd();//定位第1列,名称
color_Remark.Text = (DataGridcolor.Columns[4].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Text.TrimEnd();//定位,
if ((DataGridcolor.Columns[3].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Background != null) //定位选中行单元格,色彩,判断参数是否有效
{
color_color.Background = (DataGridcolor.Columns[3].GetCellContent(DataGridcolor.Items[rownum]) as TextBlock).Background; //定位选中行单元格,色彩,有效背景色传递至色彩框背景色
}
else
{
color_color.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));//白色传递至色彩框背景色
}
}
}
private void Color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//色彩框双击事件
{
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();//使用调色盘控件ColorDialog
if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)//打开调色盘
{
System.Drawing.Color DColor = colorDialog.Color;////获取选中色彩信息
//System.Windows.Media.Color MColor = new System.Windows.Media.Color();//转换
System.Windows.Media.Color MColor = System.Windows.Media.Color.FromArgb(DColor.A, DColor.R, DColor.G, DColor.B);//转换并配置ARGB参数
color_color.Background = new SolidColorBrush(MColor);//ARGB参数输出至Color的背景色
//string colorCode = string.Format("{0:X2}", DColor.B) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.R);//反向十六进制RGB
//string colorCode = string.Format("{0:X2}", DColor.R) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.B);//正向十六进制RGB
//ColorCode_SQL = Convert.ToInt32(colorCode, 16);//十六进制RGB转存储数值
}
}
}
}
+94
View File
@@ -0,0 +1,94 @@
<Window x:Class="formula_manage.Windows.fabric"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.Windows"
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
xmlns:viewmodel="clr-namespace:formula_manage.ViewModel"
mc:Ignorable="d" Loaded="fabric_Loaded"
Title="fabric" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
BorderBrush="White" Background="#FFE0E0E0">
<Grid>
<!--原料表-->
<DataGrid x:Name="DataGridfabric" MouseDoubleClick="DataGridfabric_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True" Margin="15,15,15,150" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility ="Column">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="#000000"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTemplateColumn Header=" 序号" Width="50" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock FontSize="15" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="布种代码" Binding="{Binding Code}" Width="250" FontSize="15" MaxWidth="500" MinWidth="100" CanUserReorder="False"/>
<DataGridTextColumn Header="布种名称" Binding="{Binding Name}" Width="250" FontSize="15" MaxWidth="500" MinWidth="200" CanUserReorder="False"/>
<DataGridTextColumn Header="码重(g/Yard)" Binding="{Binding GYard}" Width="100" FontSize="15" MaxWidth="200" MinWidth="20" CanUserReorder="False"/>
<DataGridTextColumn Header="备注" Binding="{Binding Remark}" Width="500" FontSize="15" MaxWidth="1500" MinWidth="150" CanUserReorder="False"/>
</DataGrid.Columns>
</DataGrid>
<!--布种代码-->
<TextBox x:Name="fabric_code" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="25"
InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="布种代码"
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
<!--布种名称-->
<TextBox x:Name="fabric_name" HorizontalAlignment="Left" Height="30" Margin="465,0,0,100" Text=""
VerticalAlignment="Bottom" Width="250" FontSize="22" MaxLines="1" MaxLength="50"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="375,0,0,100" TextWrapping="Wrap" Text="布种名称"
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
<!--备注-->
<TextBox x:Name="fabric_Remark" HorizontalAlignment="Left" Height="30" Margin="105,0,0,50" Text=""
VerticalAlignment="Bottom" Width="340" FontSize="22" MaxLines="1" MaxLength="25"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="备注"
VerticalAlignment="Bottom" Width="120" FontSize="20"/>
<!--码重-->
<TextBox x:Name="fabric_GYard" HorizontalAlignment="Left" Height="30" Margin="585,0,0,50" Text="500"
VerticalAlignment="Bottom" Width="130" FontSize="22" MaxLines="1" MaxLength="25"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="465,0,0,50" TextWrapping="Wrap" Text="码重(g/Yard)"
VerticalAlignment="Bottom" Width="120" FontSize="20"/>
<!--存储按钮-->
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="795,0,0,60"
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
Click="Button_Preservation">
</Button>
<!--删除按钮-->
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="935,0,0,60"
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
Click="Button_Delete">
</Button>
</Grid>
</Window>
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff. Show more