Compare commits

...
241 Commits
Author SHA1 Message Date
sc eb2828aab0 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:26:01 +08:00
sc 33b970eff9 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:26:00 +08:00
sc 5caf92be59 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:24:46 +08:00
sc 437b8957ce Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:24:44 +08:00
sc a68fb9ae01 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-27 22:10:41 +08:00
sc 68b98ac7e4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-27 22:10:39 +08:00
sc 2329ac9abc Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-26 01:35:33 +08:00
sc b062420be1 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-26 01:35:30 +08:00
sc a248c41163 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-25 20:18:34 +08:00
sc 2b676adbba 修正错误 2025-10-25 20:18:31 +08:00
sc 00a5cd3ec7 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 22:14:27 +08:00
sc abfcf6e36a Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 22:14:26 +08:00
sc 1df7212414 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 20:49:37 +08:00
sc 751a2b092f Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 20:49:34 +08:00
sc 8a5e0ecfd9 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 00:09:05 +08:00
sc ebcd5b7182 串口通讯部分修改 2025-10-15 00:09:03 +08:00
sc 7f905617fa Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-10 02:02:24 +08:00
sc 54d8cc7266 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-10 02:02:21 +08:00
sc 33e83fa5d6 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-10 00:56:15 +08:00
sc 927c38853d 添加485串口线路指令 2025-10-10 00:56:14 +08:00
sc 552d45485d Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 23:35:40 +08:00
sc 17a5d6b718 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 23:35:38 +08:00
sc 34d3e6c292 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 23:19:40 +08:00
sc 5b60ea4765 添加数据库 2025-10-08 23:19:39 +08:00
sc b2817d1b01 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 23:18:50 +08:00
sc 7403914ba5 串口功能逻辑,810,811,812指令修改 2025-10-08 23:18:48 +08:00
sc 878d49c4a0 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-08 00:04:22 +08:00
sc e457b0ab21 添加去重逻辑 2025-10-08 00:04:20 +08:00
sc b0ce5bc8f9 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-07 19:52:43 +08:00
sc d3375fd6ac 处理lock (Machines.Rows.SyncRoot)并发写datatable问题 2025-10-07 19:52:42 +08:00
sc 7671f0ef08 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-07 00:24:31 +08:00
sc 25e6ae1563 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-07 00:24:29 +08:00
sc e020333b82 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-07 00:03:53 +08:00
sc 8914ea3660 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-07 00:03:51 +08:00
sc c1da97611d Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-06 22:06:10 +08:00
sc daaa2b5514 添加资源,修改机台设置页面,添加任务开始页面,修改网络连接错误 2025-10-06 22:06:08 +08:00
sc 2c40ac5be0 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-06 00:52:17 +08:00
sc 21500886f0 修复引用添加822指令 2025-10-06 00:52:16 +08:00
sc c5e1978f6a Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-05 21:21:05 +08:00
sc 9a374a0a87 添加 2025-10-05 21:21:04 +08:00
sc f9949c5ec5 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-05 21:05:12 +08:00
sc 91212f03d2 添加资源 2025-10-05 21:05:08 +08:00
sc 31a84a640d Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-05 00:26:27 +08:00
sc 9bdf575674 添加资源 2025-10-05 00:26:26 +08:00
sc 8adea70012 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-03 22:50:28 +08:00
sc 3f9730507e Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-03 22:50:19 +08:00
sc 7fad98f58b Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-02 23:40:29 +08:00
sc 61dbaa3c33 设备连线逻辑修改 2025-10-02 23:40:21 +08:00
sc 5e063092cf Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-10-01 17:04:54 +08:00
sc 574f468a5e 工艺排程与工艺传输问题错误修正 2025-10-01 17:04:52 +08:00
sc e9f83ea182 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2025-09-30 21:23:53 +08:00
sc ab5dfa85e1 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 21:23:45 +08:00
sc 8512e720dd Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 20:06:39 +08:00
sc 81ab1623ba Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 20:06:33 +08:00
sc 6cbed8fa62 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 00:54:04 +08:00
sc 60baf3554a Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 00:53:59 +08:00
sc 1ef9b8517c Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 00:47:24 +08:00
sc d5042d92ff Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-30 00:47:20 +08:00
sc 4a1c5b7eac Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-29 01:05:07 +08:00
sc 896c2bdf9c 数据库 2025-09-29 01:05:03 +08:00
sc 99217977ec Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-29 01:02:35 +08:00
sc 8d0b37f0e2 日志显示,修改缓冲区 2025-09-29 01:02:28 +08:00
sc 898cde7329 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-28 00:58:29 +08:00
sc 4cf411dc10 信息修改,字体大小 2025-09-28 00:58:20 +08:00
sc 3c5e8cd129 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-27 23:36:44 +08:00
sc 818d0e5a3a 网络机台日志 2025-09-27 23:36:35 +08:00
sc e2b48ecc84 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-26 23:50:29 +08:00
sc 2c0f06a83a 修改按钮状态 2025-09-26 23:50:25 +08:00
sc a1b128757d Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-26 01:18:29 +08:00
sc 7c744f72f6 错误修正 2025-09-26 01:18:25 +08:00
sc 7177673a4c Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-25 17:03:25 +08:00
sc a0ac4e094c 程序页面选择异常问题 2025-09-25 17:03:22 +08:00
sc d85d458edb Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-25 00:17:34 +08:00
sc 4f9195c552 步骤编辑相关修改 2025-09-25 00:17:29 +08:00
sc ec6bab3b56 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-14 00:57:54 +08:00
sc 11b9b99d3e 曲线图记录修改 2025-09-14 00:57:51 +08:00
sc 13c64092a0 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-13 01:45:39 +08:00
sc 48eb8a0ad1 部分数据库及串口逻辑修改 2025-09-13 01:45:28 +08:00
sc 9c10e1c2cc Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-12 01:24:22 +08:00
sc baa921ea20 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-12 01:24:13 +08:00
sc 0c5666ddd4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-12 01:21:21 +08:00
sc 157666d836 串口通讯队列 2025-09-12 00:52:55 +08:00
sc ab655a94e0 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-10 21:43:39 +08:00
sc 4af9042d5f 串口逻辑,数据库读写逻辑修改 2025-09-10 21:42:52 +08:00
sc fc799a2510 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-09 22:10:10 +08:00
sc 22c061db9e Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-09 22:08:40 +08:00
sc 737c5e7e71 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-09 02:11:32 +08:00
sc 6120fe283a 修复逻辑错误 2025-09-09 02:11:31 +08:00
sc cedd2c189b Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-09 00:56:43 +08:00
sc 379db4b738 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-09 00:56:37 +08:00
sc 908a7ce56e Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 01:01:23 +08:00
sc 243cb6126b Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 01:01:17 +08:00
sc 963f514bac Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 00:54:32 +08:00
sc 2120a1e1ea Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 00:54:25 +08:00
sc 5b8aa656e4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 00:53:26 +08:00
sc 0311582679 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 00:53:23 +08:00
sc 951765de9a Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 00:50:11 +08:00
sc 70b04e0892 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 00:50:04 +08:00
sc 151251586c Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 00:10:27 +08:00
sc 8ade983214 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-08 00:10:21 +08:00
sc e3370c0b63 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-07 14:35:43 +08:00
sc 8091b3dcc4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-07 14:35:09 +08:00
sc ff4ab5b349 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-07 12:29:55 +08:00
sc 206204711b 添加资源,新建页面添加信息,收发逻辑调整 2025-09-07 01:19:40 +08:00
sc aeaba92942 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-01 01:12:45 +08:00
sc 6e690b78b7 修改实时曲线缓存逻辑 2025-09-01 01:12:38 +08:00
sc 4d6619944c Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-09-01 00:55:21 +08:00
sc acdfc68def 总览卡曲线 2025-09-01 00:54:43 +08:00
sc b307aa433c Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-30 22:02:57 +08:00
sc c235d91a8b 连接时锁状态错误问题修正 2025-08-30 22:02:53 +08:00
sc 72d513fdfe Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-30 01:25:43 +08:00
sc 7ba38facc2 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-30 01:25:39 +08:00
sc d3583311e2 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-30 01:24:43 +08:00
sc 8b7593dceb 总览信息页面曲线图 2025-08-30 01:24:39 +08:00
sc 3ba1a7e6c4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-29 00:18:57 +08:00
sc 4449530bb7 添加资源,总览页面添加图表,其它逻辑修正 2025-08-29 00:18:52 +08:00
sc 6bfef306be Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-28 01:36:55 +08:00
sc e4e7853624 通讯逻辑修改 2025-08-28 01:36:51 +08:00
sc 7416bc332b Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-27 01:21:36 +08:00
sc 435a54a61a 细节页面的右键逻辑,添加语言 2025-08-27 01:21:32 +08:00
sc 54d6ddd918 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-26 21:46:21 +08:00
sc 2659b01329 更改主窗口显示方式 2025-08-26 21:46:11 +08:00
sc 2866dddbd9 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-26 01:44:07 +08:00
sc 1fff37ad63 输送呼叫基础功能 2025-08-26 01:44:02 +08:00
sc 2e6d18b719 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-26 00:39:06 +08:00
sc bfba0f15d3 301状态判断 2025-08-26 00:39:00 +08:00
sc 539d2763ee Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-25 21:52:30 +08:00
sc ce84169794 步骤页面变更 2025-08-25 21:52:03 +08:00
sc 1d2c749642 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-25 00:25:57 +08:00
sc d13edd4070 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-25 00:25:50 +08:00
sc 52b09f4a8f Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-24 13:46:54 +08:00
sc c32e34df73 读写逻辑修改 2025-08-24 13:46:51 +08:00
sc dc4161337b Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-24 01:04:17 +08:00
sc ce603a9afd 呼叫功能通讯 2025-08-24 01:04:13 +08:00
sc a1c16815d1 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-23 01:18:22 +08:00
sc 3d501babf9 呼叫相关功能 2025-08-23 01:18:18 +08:00
sc f29817be05 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-08-23 00:13:56 +08:00
sc 1d2d97bd65 添加资源 2025-08-23 00:13:52 +08:00
sc b14643bc31 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-27 13:02:58 +08:00
sc 9a0a60793e 请求解锁呼叫 2025-07-27 13:02:54 +08:00
sc 6556e469cd Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-27 01:52:34 +08:00
sc 9ce3d975b4 添加用户信息相关 2025-07-27 01:52:30 +08:00
sc 76c0f41fde Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-27 01:34:28 +08:00
sc 993d43951e 添加用户信息插入逻辑 2025-07-27 01:34:20 +08:00
sc b08e53ee04 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-27 01:19:52 +08:00
sc cd74fb8103 db 2025-07-27 01:19:49 +08:00
sc 4ac748f002 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-27 00:48:35 +08:00
sc cdc7b896d9 信息播报页面添加 2025-07-27 00:48:28 +08:00
sc 7e61d7bd9d Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-26 17:30:42 +08:00
sc ac86200576 信息页面 2025-07-26 17:30:33 +08:00
sc c9d576bf99 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-25 17:23:13 +08:00
sc 9bcffdc6df 播报信息页面逻辑 2025-07-25 17:23:03 +08:00
sc c30a2e7a01 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-25 00:49:55 +08:00
sc 8d5631a651 添加信息播报页面 2025-07-25 00:49:50 +08:00
sc ab324d65bb Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-24 21:41:08 +08:00
sc 3d64a4474d 添加语言功能及相关设置 2025-07-24 21:40:56 +08:00
sc 6d18349fc7 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-24 01:12:14 +08:00
sc d047a4f23e 单据信息显示 2025-07-24 01:12:09 +08:00
sc 91584c0d8c Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-23 00:12:10 +08:00
sc 7d7ed08f96 添加机台故障信息状态 2025-07-23 00:12:03 +08:00
sc ea3073eae0 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-22 00:20:09 +08:00
sc 586e5cb69e db 2025-07-22 00:20:06 +08:00
sc 5b09426c59 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-21 23:02:19 +08:00
sc 37435ca60c 830指令添加信息项目 2025-07-21 23:02:14 +08:00
sc bb736e2c0d Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-09 01:27:07 +08:00
sc 85ec4fdbc4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-09 01:27:02 +08:00
sc a5e46708b6 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-08 21:39:56 +08:00
sc 60e8a5699b 数据库修改 2025-07-08 21:39:54 +08:00
sc dd58e05c35 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-08 21:37:56 +08:00
sc 3c4761aed4 日子查看读取逻辑修改,总览选项卡显示更改 2025-07-08 21:37:50 +08:00
sc 707850a551 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-08 01:36:44 +08:00
sc 7242195f45 下传工单逻辑调整 2025-07-08 01:36:34 +08:00
sc 4442397069 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-08 01:09:54 +08:00
sc ce2a80c50b Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-08 01:04:54 +08:00
sc 734649fa57 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-07 00:15:02 +08:00
sc 3c3b608bfb Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-07 00:14:27 +08:00
sc 6b82f3b3ce Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-06 15:46:06 +08:00
sc 6eae137bd1 页面显示设备状态逻辑修改 2025-07-06 15:45:58 +08:00
sc 74225cea5f Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-07-06 01:00:59 +08:00
sc 54addaff17 锁定功能 2025-07-06 01:00:54 +08:00
sc 35ca13ded3 页面修改 2025-04-27 17:05:36 +08:00
sc 5f7c6bee47 修改信息页面MonitorView的显示逻辑,添加当前步骤高亮显示 2025-04-27 16:59:27 +08:00
sc 0345229416 修改信息页面MonitorView的显示逻辑,添加步骤表选择和右键的限制 2025-04-25 23:44:36 +08:00
sc de843f4e90 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-25 00:15:23 +08:00
sc 98afe7a263 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-25 00:15:20 +08:00
sc 76178b40b4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-24 22:48:54 +08:00
sc 115449a736 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-24 22:48:50 +08:00
sc 7fa6f2c53b Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-23 22:45:39 +08:00
sc 14ae9d34a7 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-23 22:45:38 +08:00
sc b7df741f08 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-23 22:32:57 +08:00
sc 79833989b5 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-23 22:32:52 +08:00
sc db1ac43edb Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-23 22:04:20 +08:00
sc bfc15cca8b 显示逻辑修改 2025-04-23 22:04:16 +08:00
sc 224a97cba4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-22 23:18:23 +08:00
sc 51510fd83a Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-22 23:18:21 +08:00
sc b3d2884ffa Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-22 23:01:25 +08:00
sc 30de321875 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-22 23:01:23 +08:00
sc 4d2a10a870 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-22 22:59:05 +08:00
sc cfc64511f8 添加详情页面远程 2025-04-22 22:59:00 +08:00
sc 4d7fccc878 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-21 21:37:50 +08:00
sc 786c770914 添加输送设备连接状态 2025-04-21 21:37:46 +08:00
sc 49a3da7967 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-10 22:58:23 +08:00
sc 26c41a0c10 修改连线逻辑 2025-04-10 22:58:20 +08:00
sc 7f0b030f13 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-07 23:12:23 +08:00
sc 3b6ab69a71 连线逻辑修改 2025-04-07 23:12:21 +08:00
sc 195389db98 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-06 23:09:19 +08:00
sc a9f505e960 MainWindowViewModel.Machines读写逻辑修改 2025-04-06 23:09:16 +08:00
sc f253d11902 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-05 21:16:32 +08:00
sc 41350cbd12 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-05 21:16:24 +08:00
sc 122f548e9c Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-02 21:03:26 +08:00
sc 0a80ae9db4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-02 21:03:24 +08:00
sc 144cb73d26 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-04-02 00:08:58 +08:00
sc 2cf6b0ab6a vnc功能实现 2025-04-02 00:03:48 +08:00
sc 23e461b85d Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-31 23:14:40 +08:00
sc 24c4daf4f7 vnc添加全屏 2025-03-31 23:14:38 +08:00
sc 7cc54d8e33 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-31 23:03:01 +08:00
sc 18d6aa3e87 添加vnc功能 2025-03-31 23:03:00 +08:00
sc feaaa47e86 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-30 23:38:26 +08:00
sc e11373d5f8 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-30 23:38:22 +08:00
sc fd669617d8 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-30 20:52:01 +08:00
sc 289a9fbf81 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-30 20:51:57 +08:00
sc 1fb7986213 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-29 23:47:45 +08:00
sc 982b9a8f28 修改vnc相关部分 2025-03-29 23:47:43 +08:00
sc 5f73676b92 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-29 21:39:48 +08:00
sc 2d4cba6cc4 添加VncSharp库 2025-03-29 21:39:46 +08:00
sc 0297cd7136 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-29 18:47:34 +08:00
sc 35852e08a9 ex文件路径 2025-03-29 18:47:32 +08:00
sc 7fbc98f832 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-29 18:13:06 +08:00
sc 65d0504c68 ex-vnc 2025-03-29 18:13:02 +08:00
sc 17ae98aa02 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-28 11:23:59 +08:00
sc 9001efee9c 助剂手动输送页面 2025-03-28 11:23:46 +08:00
sc fbf01a04fe Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-25 23:26:51 +08:00
sc acd37a8245 输送中心添加手动页面状态信息页面设备信息卡 2025-03-25 23:26:47 +08:00
sc c375c05d6b Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-24 01:05:59 +08:00
sc ea95535612 输送设备连接设置页面 2025-03-24 01:05:56 +08:00
sc 33a92747ed Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-23 23:38:48 +08:00
sc ed94ddb180 添加图片资源 2025-03-23 23:38:42 +08:00
sc 63ee0e68af Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-23 00:52:40 +08:00
sc f9ba766711 领料单页面状态文章转换器和状态颜色转换器 2025-03-23 00:52:37 +08:00
sc e477d6de59 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-03-22 23:57:39 +08:00
sc a2bb445e1d 添加自定义通知页面,添加领料单查看,修改温度图表逻辑 2025-03-22 23:57:36 +08:00
188 changed files with 11967 additions and 1627 deletions

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
{
internal class BoolToVisidilityConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return (value is bool boolvalue && boolvalue) ?
Visibility.Visible:
Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
+6 -5
View File
@@ -21,16 +21,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
{ {
string i = value.ToString(); string i = value.ToString();
if (i == "101") return "Gray"; if (i == "201") return "#FF00FF00";
else if (i == "201") return "green"; else if (i == "202") return "Green";
else if (i == "202") return "yellow"; else if (i == "309") return "#FF000000";
else return "Red"; else if (i == "800") return "Red";
else return "#FF000000";
} }
} }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{ {
return "Gray"; return "#FFF0F0F0";
} }
} }
} }
+4 -1
View File
@@ -35,8 +35,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
else if (i == "309") Staten = Properties.Resources.Abnormal;//错误 else if (i == "309") Staten = Properties.Resources.Abnormal;//错误
else if (i == "800") Staten = Properties.Resources.Notimplementation;//未连接 else if (i == "800") Staten = Properties.Resources.Notimplementation;//未连接
else if (i == "801") Staten = Properties.Resources.Implementation;//连接成功 else if (i == "801") Staten = Properties.Resources.Implementation;//连接成功
else if (i == "801") Staten = Properties.Resources.Online;//在线 else if (i == "802") Staten = Properties.Resources.Online;//在线
else if (i == "899") Staten = Properties.Resources.CloseTheConnection;//关闭连接 else if (i == "899") Staten = Properties.Resources.CloseTheConnection;//关闭连接
else if (i == "1") Staten = Properties.Resources.dye;//染料
else if (i == "2") Staten = Properties.Resources.chemicals;//助剂
else if (i == "3") Staten = Properties.Resources.powder;//粉体
else Staten = "null"; else Staten = "null";
return Staten; return Staten;
+4 -1
View File
@@ -38,7 +38,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
else if (i == "801") Staten = Properties.Resources.Implementation;//连接成功 else if (i == "801") Staten = Properties.Resources.Implementation;//连接成功
else if (i == "801") Staten = Properties.Resources.Online;//在线 else if (i == "801") Staten = Properties.Resources.Online;//在线
else if (i == "899") Staten = Properties.Resources.CloseTheConnection;//关闭连接 else if (i == "899") Staten = Properties.Resources.CloseTheConnection;//关闭连接
else Staten = "null"; else if (i == "1") Staten = Properties.Resources.dye;//染料
else if (i == "2") Staten = Properties.Resources.chemicals;//助剂
else if (i == "3") Staten = Properties.Resources.powder;//粉体
else Staten = "";
return Staten; return Staten;
} }
+85
View File
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media.Imaging;
namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
{
internal class StatenToImageConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
switch (value)
{
case "001":
return new BitmapImage(new Uri("/Lmage/ID001.png", UriKind.Relative));//功能模块001温度控制
case "007":
return new BitmapImage(new Uri("/Lmage/ID007.png", UriKind.Relative));//液位入水
case "008":
return new BitmapImage(new Uri("/Lmage/ID008.png", UriKind.Relative));//流量入水
case "013":
return new BitmapImage(new Uri("/Lmage/ID013.png", UriKind.Relative));//批次水位水洗
case "015":
return new BitmapImage(new Uri("/Lmage/ID015.png", UriKind.Relative));//溢流水洗
case "017":
return new BitmapImage(new Uri("/Lmage/ID017.png", UriKind.Relative));//降温水洗
case "020":
return new BitmapImage(new Uri("/Lmage/ID020.png", UriKind.Relative));//排水
case "022":
return new BitmapImage(new Uri("/Lmage/ID022.png", UriKind.Relative));//动力排水
case "031":
return new BitmapImage(new Uri("/Lmage/ID031.png", UriKind.Relative));//运转时间
case "035":
return new BitmapImage(new Uri("/Lmage/ID035.png", UriKind.Relative));//准备入布
case "036":
return new BitmapImage(new Uri("/Lmage/ID036.png", UriKind.Relative));//准备出布
case "039":
return new BitmapImage(new Uri("/Lmage/ID039.png", UriKind.Relative));//呼叫人工
case "040":
return new BitmapImage(new Uri("/Lmage/ID040.png", UriKind.Relative));//取样
case "041":
return new BitmapImage(new Uri("/Lmage/ID041.png", UriKind.Relative));//结束
case "049":
return new BitmapImage(new Uri("/Lmage/ID049.png", UriKind.Relative));//等待
case "050":
return new BitmapImage(new Uri("/Lmage/ID050.png", UriKind.Relative));//主缸加压
case "051":
return new BitmapImage(new Uri("/Lmage/ID051.png", UriKind.Relative));//主缸减压
case "054":
return new BitmapImage(new Uri("/Lmage/ID054.png", UriKind.Relative));//主泵/风机速度
case "055":
return new BitmapImage(new Uri("/Lmage/ID055.png", UriKind.Relative));//主泵启动
case "056":
return new BitmapImage(new Uri("/Lmage/ID056.png", UriKind.Relative));//
case "064":
return new BitmapImage(new Uri("/Lmage/ID064.png", UriKind.Relative));//
case "065":
return new BitmapImage(new Uri("/Lmage/ID065.png", UriKind.Relative));//
case "066":
return new BitmapImage(new Uri("/Lmage/ID066.png", UriKind.Relative));//
case "067":
return new BitmapImage(new Uri("/Lmage/ID067.png", UriKind.Relative));//
case "090":
return new BitmapImage(new Uri("/Lmage/ID090.png", UriKind.Relative));//
case "091":
return new BitmapImage(new Uri("/Lmage/ID091.png", UriKind.Relative));//
case "093":
return new BitmapImage(new Uri("/Lmage/ID093.png", UriKind.Relative));//
case "094":
return new BitmapImage(new Uri("/Lmage/ID094.png", UriKind.Relative));//
default:
return new BitmapImage(new Uri("", UriKind.Relative));
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
+44
View File
@@ -0,0 +1,44 @@
using ScottPlot.TickGenerators.Financial;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
{
internal class StatexmlConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return null;
}
else
{
string Staten = "None";
string i = value.ToString();
if (i == "101") Staten = "Walk";//运行
else if (i == "202") Staten = "RunFast";//运行
else if (i == "301") Staten = "Stop";//完成
else if (i == "309") Staten = "ErrorOutline";//错误
else if (i == "800") Staten = "LinkOff";//未连接
else if (i == "801") Staten = "Link";//连接成功
else if (i == "899") Staten = "LinkOff";//关闭连接
else if (i == "True") Staten = "Visible";//
else if (i == "False") Staten = "Collapsed";//
return Staten;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
[SYS]
Language=zh-CN
DyelotsDispenser=True
COMP1=COM7
COMP2=COM8
COMP3=COM9
COMP4=COM10
BAUD1 = 57600
BAUD2= 57600
BAUD3 =57600
BAUD4 =57600
[SQL_SERVER]
SQL1=www.scserverddns.top\EXPRESS ,21344
SQL2=BatchDyeingCentral
SQL3=SQL SERVER
SQL4=sa
SQL5=SC971216@server
[SN]
SN3=5BEE2D9CF3E1A8DD
SN2=BED2E58B6EBB4BD4
SN1=5BEE2D9CF3E1A8DD
[VOICE]
V1=-2
V2=100
Binary file not shown.
+59
View File
@@ -0,0 +1,59 @@
[2025-07-02 21:49:42];[Error] ||
[2025-07-02 21:49:42];[Error source] ||.Net SqlClient Data Provider
[2025-07-02 21:49:42];[Error message] ||在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)
[2025-07-02 21:49:42];[Error area] || 在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.Open()
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
[2025-07-02 21:50:08];[Error] ||
[2025-07-02 21:50:08];[Error source] ||System.Data.SqlClient.SqlException (0x80131904): 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接) ---> System.ComponentModel.Win32Exception (0x80004005): 系统找不到指定的文件。
在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.Open()
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:2,State:0,Class:20
[2025-07-02 21:50:08];[Error message] ||在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)
[2025-07-02 21:50:08];[Error area] ||System.Data.SqlClient.SqlException (0x80131904): 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接) ---> System.ComponentModel.Win32Exception (0x80004005): 系统找不到指定的文件。
在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.Open()
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:2,State:0,Class:20
+20
View File
@@ -0,0 +1,20 @@
[2025-07-24 21:48:12];[Error] ||
[2025-07-24 21:48:12];[Error source] ||.Net SqlClient Data Provider
[2025-07-24 21:48:12];[Error message] ||在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)
[2025-07-24 21:48:12];[Error area] || 在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.Open()
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
+20
View File
@@ -0,0 +1,20 @@
[2025-08-28 17:45:02];[Error] ||
[2025-08-28 17:45:02];[Error source] ||.Net SqlClient Data Provider
[2025-08-28 17:45:02];[Error message] ||在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)
[2025-08-28 17:45:02];[Error area] || 在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
在 System.Data.SqlClient.SqlConnection.Open()
在 SunlightCentralizedControlManagement_SCCM_.ViewModel.ManualDyelotModel..ctor() 位置 C:\Users\Administrator\source\repos\SunlightCentralizedControlManagement(SCCM)\ViewModel\ManualDyelotModel.cs:行号 35
Binary file not shown.
+64
View File
@@ -0,0 +1,64 @@
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.EX.DispenseState"
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:SunlightCentralizedControlManagement_SCCM_.EX"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
GridLinesVisibility="All" ColumnHeaderHeight="40"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" BorderBrush="#FFC9C9C9" FontSize="16" BorderThickness="5,5,5,5" >
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="25" />
<Setter Property="FontSize" Value="15" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.ID}" Binding="{Binding ID}" Width="80" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Machine}" Width="100" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Redye}" Binding="{Binding ReDye}" Width="80" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding StepNumber}" Width="80" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Time}" Binding="{Binding CreationTime}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.ProductCode}" Binding="{Binding ProductCode}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.ProductName}" Binding="{Binding ProductName}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Grams}" Binding="{Binding Weight}" Width="200" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.State}" Binding="{Binding State}" Width="100" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.Volume}" Binding="{Binding Volume}" Width="100" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.DispenseModule}" Binding="{Binding DispenseModule}" Width="100" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.StartTime}" Binding="{Binding DispenseStartTime}" Width="200" IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
+69
View File
@@ -0,0 +1,69 @@
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SunlightCentralizedControlManagement_SCCM_.EX
{
/// <summary>
/// DispenseState.xaml 的交互逻辑
/// </summary>
public partial class DispenseState : UserControl
{
public DispenseState()
{
InitializeComponent();
}
public async void State(object dat,string mac)
{
string Connstr_SC;
string WaitChemical_WaitDispenseDyestuff;
string DAT = mac.Substring(0,3);
if (DAT == "252")
{
WaitChemical_WaitDispenseDyestuff = "SELECT * FROM [dbo].[WaitDispenseDyestuff] WHERE DispenseMachine = '" + dat + "'";
}
else
{
WaitChemical_WaitDispenseDyestuff = "SELECT * FROM [dbo].[WaitChemical] WHERE DispenseMachine = '" + dat + "'";
}
try
{
if (MainWindowViewModel.SQMOD == "Windows Authentication")
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
await conn_SC.OpenAsync(); //连接数据库
SqlDataAdapter WaitChemical_data = new SqlDataAdapter(WaitChemical_WaitDispenseDyestuff, Connstr_SC); //查询
conn_SC.Close();
DataTable ds = new DataTable();//载入信息
WaitChemical_data.Fill(ds);
Grid_data.ItemsSource = ds.DefaultView;
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}
}
}
}
+123
View File
@@ -0,0 +1,123 @@
using LiveChartsCore.Kernel;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Contexts;
using System.Security.Principal;
using System.Threading.Tasks;
using TouchSocket.Core;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
namespace SunlightCentralizedControlManagement_SCCM_.EX.Exchange
{
public class BDC_SQL
{
public class BDCSqlHelper
{
// SqlConnection conn_SC = new SqlConnection();//数据库
string db;
public void Config(string IP, string DATABASE, string USER, string PAWSSD, bool MODE)//连接dbc数据库
{
if (MODE) //连接数据库测试
{
db="server=" + IP + ";database=" + DATABASE + ";Trusted_Connection=SSPI";
}
else
{
db="server=" + IP + ";database=" + DATABASE + ";User ID=" + USER + ";Password=" + PAWSSD;
}
}
public async Task<int> UPDATA(string name,string where,DataRow entity)//dbc数据库
{
string DAT = null;
int rowsAffected = 0;
int type = 0;
try { type = entity.Field<int>("Type"); } catch { }
try
{
DAT = "DispenseDyelot='" + entity.Field<string>("Dyelot") + "',DispenseReDye='" + entity.Field<int>("Redye")+"',";
if (type == 2)
{
DAT = DAT+"DyeCallOff=" + entity.Field<int>("Step") + ",DyeState = 201,DyeTank=" +
entity.Field<int>("Tank");
}
else if (type == 3)
{
DAT = DAT+"PowderCallOff=" + entity.Field<int>("Step") +",PowderState=201,PowderTank=" +
entity.Field<int>("Tank");
}
else
{
DAT = DAT+"ChemicalCallOff=" + entity.Field<int>("Step") +",ChemicalState=201,ChemicalTank=" +
entity.Field<int>("Tank");
}
using (var connection = new SqlConnection(db))
{
await connection.OpenAsync();
var command = connection.CreateCommand();
command.CommandText = "UPDATE "+ name + " SET "+ DAT + " WHERE "+ where;
// command.Parameters.AddWithValue("@table", name);
// command.Parameters.AddWithValue("@Id", where);
// command.Parameters.AddWithValue("@data", DAT);
rowsAffected = await command.ExecuteNonQueryAsync();
LogGing.ExchangeDATA( command.CommandText.ToString());
}
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}
return rowsAffected;
}
public async Task<DataTable> SELECT(string name, string where)//dbc数据库
{
DataTable rowsAffected = new DataTable();
try
{
using (var connection = new SqlConnection(db))
{
await connection.OpenAsync();
var command = connection.CreateCommand();
command.CommandText = "SELECT * FROM " + name + " WHERE " + where;
var dat = await command.ExecuteReaderAsync();
rowsAffected.Load(dat);
LogGing.ExchangeDATA(command.CommandText.ToString());
}
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}
return rowsAffected;
}
}
}
}
+124
View File
@@ -0,0 +1,124 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.EX.ManualDyelot"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.EX"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:core="clr-namespace:System;assembly=netstandard"
d:DataContext="{d:DesignInstance Type=viewmodel:ManualDyelotModel}"
mc:Ignorable="d" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen"
Title="ManualDyelot" Height="960" Width="1280">
<Window.Resources>
<viewmodel:ManualDyelotModel x:Key="ManualDyelotModel"/>
</Window.Resources>
<Grid Background="#FFC9C9C9">
<Grid Margin="5,5,5,5" Background="White">
<DataGrid x:Name="Grid_data" AlternationCount="2" d:ItemsSource="{d:SampleData ItemCount=99}"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
GridLinesVisibility="All" ColumnHeaderHeight="50" BorderThickness="0,0,5,0"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column"
SelectionMode="Single" FontSize="20" Margin="5,5,500,5">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="35" />
<Setter Property="FontSize" Value="20" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTemplateColumn Header="{x:Static lang:Resources.ProductCode}" 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 ManualDyelotModel}}"
DisplayMemberPath="ProductCode"
Text="{Binding PRODUCT_CODE}" IsTextSearchEnabled="True" StaysOpenOnEdit="True"
BorderBrush="{x:Null}" Background="{x:Null}"
DropDownClosed="CP_PRODUCT_CODE_DropDownClosed">
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.ProcessName}" Width="200" MaxWidth="400" MinWidth="100" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_PRODUCT_NAME" BorderThickness="0,0,0,0"
ItemsSource="{Binding stuff_Product, Source={StaticResource ManualDyelotModel}}"
DisplayMemberPath="ProductName"
Text="{Binding PRODUCT_NAME}"
DropDownClosed="CP_PRODUCT_NAME_DropDownClosed"
BorderBrush="{x:Null}" Background="{x:Null}" Focusable="True" IsTabStop="False"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Grams}" 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_KeyDown" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="State" Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Right" Height="55" Margin="0,0,280,10" VerticalAlignment="Bottom" Width="200" Click="State_Click" Padding="0,4,0,4" FontSize="20"/>
<Button x:Name="Cancel" Content="{x:Static lang:Resources.Cancel}" HorizontalAlignment="Right" Height="55" Margin="0,0,15,10" VerticalAlignment="Bottom" Width="200" Click="Cancel_Click" Padding="0,4,0,4" FontSize="20"/>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,100,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,100,15,0" TextWrapping="Wrap" x:Name="orders"
VerticalAlignment="Top" Width="350" FontSize="35"/>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,150,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,150,15,0" TextWrapping="Wrap" x:Name="dyelot"
VerticalAlignment="Top" Width="350" FontSize="35"/>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="50" VerticalAlignment="Top" Margin="150,200,15,0" HorizontalAlignment="Right" Width="350">
<ComboBox Height="50" x:Name="comboBoxMachine" VerticalAlignment="Stretch"
FontSize="35" DropDownClosed="comboBoxMachine_DropDownClosed" />
</Border>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,200,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="50" VerticalAlignment="Top" Margin="150,250,15,0" HorizontalAlignment="Right" Width="350">
<ComboBox Height="50" x:Name="comboBoxtank" VerticalAlignment="Stretch" FontSize="35" />
</Border>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,250,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Tank}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="50" VerticalAlignment="Top" Margin="150,300,15,0" HorizontalAlignment="Right" Width="350">
<TextBox Height="50" x:Name="comboBoxTotal" VerticalAlignment="Stretch" FontSize="35" />
</Border>
<TextBlock HorizontalAlignment="Right" Height="50" Margin="10,300,365,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
VerticalAlignment="Top" Width="130" FontSize="35" Background="#FFEAEAEA"/>
</Grid>
</Grid>
</Window>
+334
View File
@@ -0,0 +1,334 @@
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Xml.Linq;
using DyeingComputer.UserClass;
using System.Windows.Forms;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using OpenTK.Graphics.OpenGL;
using ScottPlot.TickGenerators.TimeUnits;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
namespace SunlightCentralizedControlManagement_SCCM_.EX
{
/// <summary>
/// ManualDyelot.xaml 的交互逻辑
/// </summary>
public partial class ManualDyelot : Window
{
DataTable dyelotdat = new DataTable();
public static string Machines;
DataTable mach = new DataTable();
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
int ID_N = 1;
int type_;
DateTime time = DateTime.Now;
public ManualDyelot()
{
InitializeComponent();
State.IsEnabled = false;
string[] strings = { "0", "1", "2", "3" };
comboBoxtank.ItemsSource = strings;
comboBoxtank.Text = "0";
comboBoxTotal.Text = "0";
int mrc = MainWindowViewModel.Machines.Rows.Count;
string[] stringsM = new string[mrc];
for (int i = 0; i < mrc; i++)
{
stringsM[i] = MainWindowViewModel.Machines.Rows[i]["name"].ToString();
}
comboBoxMachine.ItemsSource = stringsM;
dyelot.Text = "00_" + DateTime.Now.ToString("yyMMddHHmmss");
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("ProductType", typeof(int));
RRODUCTdataTable.Columns.Add("Created", typeof(string));
RRODUCTdataTable.Columns.Add("PRODUCT_CODE", typeof(string));
RRODUCTdataTable.Columns.Add("PRODUCT_NAME", typeof(string));
RRODUCTdataTable.Columns.Add("TARGET_WT", typeof(float));
RRODUCTdataTable.Columns.Add("Amount", typeof(string));
RRODUCTdataTable.Columns.Add("UNIT", typeof(string));
DataRow row = RRODUCTdataTable.NewRow(); //ID列
row["ID"] = ID_N;
row["DYELOT"] = dyelot.Text;
row["ReDye"] = 0;
row["STEP"] = "1";
row["ProductType"] = type_;
row["Created"] = time;
row["UNIT"] = "g";
RRODUCTdataTable.Rows.Add(row);
Grid_data.ItemsSource = RRODUCTdataTable.DefaultView;
}
public void MAC(object Mac,int t)
{
Machines = Mac.ToString();
type_ = t;
/* string Connstr_SC;
string sql = "SELECT * FROM [dbo].[Pipes] WHERE Dispenser = '" + Machines + "'";
try
{
if (MainWindowViewModel.SQMOD == "Windows Authentication")
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
await conn_SC.OpenAsync(); //连接数据库
new SqlDataAdapter(sql, Connstr_SC).Fill(dyelotdat);
// SqlDataAdapter _data = new SqlDataAdapter(sql, Connstr_SC); //查询
conn_SC.Close();
for (int i = 0; i < dyelotdat.Rows.Count; i++)
{
SelectProductCode.Add(dyelotdat.Rows[i].Field<string>("ProductCode"));
SelectProductName.Add(dyelotdat.Rows[i].Field<string>("ProductName"));
}
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}*/
}
private async void State_Click(object sender, RoutedEventArgs e)//确认按键
{
int t = RRODUCTdataTable.Rows.Count; //获取数据行包含空白行
RRODUCTdataTable.Rows[t - 1].Delete();
RRODUCTdataTable.AcceptChanges();
if (string.IsNullOrEmpty(comboBoxMachine.Text)) return;//未输入机台时返回
try
{
Dictionary<string, object> Dyelot_DAT = new Dictionary<string, object>();//缓存函数
for (int x = 0; x < RRODUCTdataTable.Rows.Count; x++)
{
Dyelot_DAT.Add("WorkOrder", orders.Text);
Dyelot_DAT.Add("Dyelot", RRODUCTdataTable.Rows[x]["Dyelot"]);
Dyelot_DAT.Add("Redye", RRODUCTdataTable.Rows[x]["Redye"]);
Dyelot_DAT.Add("Step", RRODUCTdataTable.Rows[x]["Step"]);
Dyelot_DAT.Add("TIME", RRODUCTdataTable.Rows[x]["Created"]);
Dyelot_DAT.Add("Tank", comboBoxtank.Text);
Dyelot_DAT.Add("State", "201");
Dyelot_DAT.Add("Machine", comboBoxMachine.Text);
Dyelot_DAT.Add("ProductCode", RRODUCTdataTable.Rows[x]["PRODUCT_CODE"]);
Dyelot_DAT.Add("ProductName", RRODUCTdataTable.Rows[x]["PRODUCT_NAME"]);
Dyelot_DAT.Add("ProductType", RRODUCTdataTable.Rows[x]["ProductType"]);
Dyelot_DAT.Add("DispenseStartTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
Dyelot_DAT.Add("Grams", RRODUCTdataTable.Rows[x]["TARGET_WT"]);
Dyelot_DAT.Add("Amount", RRODUCTdataTable.Rows[x]["Amount"]);
MainWindowViewModel.SQLiteHelpers.InsertData("Dyelot", Dyelot_DAT);//行插入
Dyelot_DAT.Clear();
}
LogGing.ExchangeDATA("Dyelot=" + dyelot.Text + ";Machine=" + comboBoxMachine.Text +
";Program=------;User=" + MainWindowViewModel.USER_data + ";");
string Connstr_SC;
if (MainWindowViewModel.SQMOD == "Windows Authentication")
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
}
SqlConnection destinationConnection = new SqlConnection(Connstr_SC); //创建一个数据库连接;
await destinationConnection.OpenAsync(); //打开连接
//写总览
string dyelots_sql = string.Format("INSERT INTO [dbo].[DYELOTS]([Dyelot] ,[ReDye] , [OrderNo] , [Machine] ,[DispenseMachine] ,[UserAccount] ) " +
"VALUES ('" + dyelot.Text + "','0','" + orders.Text + "','" + comboBoxMachine.Text + "','" + comboBoxMachine.Text + "','" + MainWindow.user_ + "')");
SqlCommand INSERT_cmd = new SqlCommand(dyelots_sql, destinationConnection);
int dyelots_sqlIN = INSERT_cmd.ExecuteNonQuery(); //执行语句
//写明细
SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection);// 实例化 sqlbulkcopy;
bulkCopy.DestinationTableName = "dbo.DyelotsBulkedRecipe";// 目标表名称/
bulkCopy.ColumnMappings.Add("DYELOT", "Dyelot");
bulkCopy.ColumnMappings.Add("ReDye", "ReDye");
bulkCopy.ColumnMappings.Add("STEP", "StepNumber");
bulkCopy.ColumnMappings.Add("PRODUCT_CODE", "ProductCode");
bulkCopy.ColumnMappings.Add("PRODUCT_NAME", "ProductName");
bulkCopy.ColumnMappings.Add("ProductType", "ProductType");
bulkCopy.ColumnMappings.Add("Created", "Created");
bulkCopy.ColumnMappings.Add("Amount", "Amount");
bulkCopy.ColumnMappings.Add("TARGET_WT", "Grams");
bulkCopy.WriteToServer(RRODUCTdataTable); //将传入的数据写到数据库;
string mac_sql = string.Format("UPDATE [dbo].[Machines] SET DispenseDyelot='" + dyelot.Text
+ "',DispenseReDye='0',ChemicalCallOff=1,ChemicalState=201,ChemicalTank='" + comboBoxtank.Text
+ "' WHERE NAME='" + comboBoxMachine.Text + "'");
SqlCommand UPDATE_mac = new SqlCommand(mac_sql, destinationConnection);
int mac_ = UPDATE_mac.ExecuteNonQuery(); //执行语句
if (mac_ == 0) System.Windows.Forms.MessageBox.Show(Properties.Resources.Not_M);
destinationConnection.Close();
this.Close();//退出页面
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
System.Windows.Forms.MessageBox.Show(ex.Message.ToString());
}
}
private void comboBoxMachine_DropDownClosed(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
{
string Macht= MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "WorkOrder", "NAME = '" + comboBoxMachine.Text + "'").ToString();
if (Macht != "------")
{
orders.Text = Macht;
}
else
{
orders.Text = dyelot.Text;
}
}
}
private void Cancel_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
public ObservableCollection<string> SelectProductCode
{
get { return _selectProductCode; }
set { _selectProductCode = value; }
}
private ObservableCollection<string> _selectProductCode = new ObservableCollection<string>();
public ObservableCollection<string> SelectProductName
{
get { return _selectProductName; }
set { _selectProductName = value; }
}
private ObservableCollection<string> _selectProductName = new ObservableCollection<string>();
string Code_;
string Name_;
private void CP_PRODUCT_CODE_DropDownClosed(object sender, EventArgs e)//代码选择事件
{
State.IsEnabled = false;
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
int grid_row = Grid_data.SelectedIndex; //获取当前行
Code_ = curComboBox.Text.TrimEnd();
DataRow[] r = ManualDyelotModel.STUFFdataTable.Select("ProductCode ='" + Code_ + "'"); //查询判断原料代码是否有效
if (!r.Any()) //检查原料信息
{
return;
}
int ID_ = grid_row + 1;
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_CODE ='" + Code_ + "'and ID <> '" + ID_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
curComboBox.Text = null;
System.Windows.MessageBox.Show(Properties.Resources.RTRM);
return;
}
Name_ = r[0].ItemArray[1].ToString();
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.EndEdit();
DataGridHelper.SetRealTimeCommit(Grid_data, true); //实时更新datagrid
}
private void CP_PRODUCT_NAME_DropDownClosed(object sender, EventArgs e)//选择原料事件
{
State.IsEnabled = false;
System.Windows.Controls.ComboBox curComboBox = sender as System.Windows.Controls.ComboBox;
int grid_row = Grid_data.SelectedIndex; //获取当前行
if (curComboBox.Text != "")
{
Name_ = curComboBox.Text.TrimEnd();
DataRow[] r = ManualDyelotModel.STUFFdataTable.Select("ProductName ='" + Name_ + "'"); //查询判断原料代码是否有效
DataRow[] c = RRODUCTdataTable.Select("PRODUCT_NAME ='" + Name_ + "'");//查询判断原料代码是否重复
if (c.Any())
{
curComboBox.Text = null;
System.Windows.MessageBox.Show(Properties.Resources.RTRM);
return;
}
Code_ = r[0].ItemArray[0].ToString();
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.EndEdit();
}
}
private void CP_CONC_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)//输入目标量事件
{
System.Windows.Controls.TextBox textBox = sender as System.Windows.Controls.TextBox;
int grid_row = Grid_data.SelectedIndex; //获取当前行
if (string.IsNullOrEmpty(textBox.Text)) return;
if (e.Key == Key.Enter)
{
if (grid_row == -1) grid_row = 0;
DataRow row = RRODUCTdataTable.Rows[grid_row];
if (string.IsNullOrEmpty(row["PRODUCT_CODE"].ToString()))
{
textBox.Text = null;
return;
}
row.BeginEdit();
row["Amount"] = textBox.Text + "g";
row["TARGET_WT"] = textBox.Text;
row.EndEdit();
ID_N++;
DataRow rowadd = RRODUCTdataTable.NewRow(); //ID列
rowadd["ID"] = ID_N;
rowadd["DYELOT"] = dyelot.Text;
rowadd["ReDye"] = 0;
rowadd["STEP"] = "1";
row["ProductType"] = type_;
rowadd["Created"] = time;
rowadd["UNIT"] = "g";
RRODUCTdataTable.Rows.Add(rowadd);
State.IsEnabled = true;
}
}
}
}
+20
View File
@@ -0,0 +1,20 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.EX.VNC"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.EX"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:rdp="clr-namespace:VncSharpWpf;assembly=VncSharpWpf"
mc:Ignorable="d" Loaded="Window_Loaded"
Title="VNC" Height="1140" Width="1920">
<Grid Margin="0,0,0,0">
<Button x:Name="Save" Content="{x:Static lang:Resources.Cancel}" HorizontalAlignment="Right" Height="35" Margin="450,0,50,10" VerticalAlignment="Bottom" Width="80" Click="Save_Click"/>
<TextBlock x:Name="log" VerticalAlignment="Bottom" Text="LINK-------" Margin="0,0,0,10" HorizontalAlignment="Left" Width="600" Height="35" FontSize="24" FontWeight="Bold" FontStyle="Italic" />
<Grid Margin="0,0,0,60">
<rdp:RemoteDesktopWpf x:Name="rdp" />
</Grid>
</Grid>
</Window>
+96
View File
@@ -0,0 +1,96 @@
using SunlightCentralizedControlManagement_SCCM_.View;
using SunlightCentralizedControlManagement_SCCM_.EX;
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.Net.NetworkInformation;
using VncSharpWpf;
using System.Net.Sockets;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
namespace SunlightCentralizedControlManagement_SCCM_.EX
{
/// <summary>
/// UserMessage.xaml 的交互逻辑
/// </summary>
public partial class VNC : Window
{
string host = "127.0.0.1"; // 替换为你的 VNC 服务器地址
int port = 5901; // 替换为你的 VNC 服务器端口
string password = "123456"; // 替换为你的 VNC 服务器密码
public VNC()
{
InitializeComponent();
}
private void Save_Click(object sender, RoutedEventArgs e)
{
if (rdp.IsConnected) { rdp.Disconnect(); }//断开连接
this.Close();
}
public void Parameter(object IP, object PROT, object USER, object PASSWD)
{
host = IP.ToString();
port = Convert.ToInt16(PROT);
password = PASSWD.ToString();
}
private async void Window_Loaded(object sender, RoutedEventArgs e)
{
if (await PingTest(host))
{
if (!rdp.IsConnected)
{
log.Text = host + " OK";
try
{
rdp.VncPort = port;
rdp.Passwd = password;
rdp.Connect(host, false, false);
//rdp.SetScalingMode(false);//自动缩放全屏
// rdp.SetInputMode(false);//可交互
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}
}
}
}
private async Task<bool> PingTest(string ip)
{
bool result = false;
Ping pingSender = new Ping();
try
{
PingReply reply = await pingSender.SendPingAsync(ip, 3000);
if (reply.Status == IPStatus.Success)
{
result = true;
}
}
catch (PingException)
{
result = false;
}
return result;
}
}
}
+132
View File
@@ -0,0 +1,132 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.KEY.TouchKeyboard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
mc:Ignorable="d" WindowStyle="None" ResizeMode="NoResize" Topmost="True"
WindowStartupLocation="CenterScreen"
Title="TouchKeyboard" Height="500" Width="750">
<Window.Resources>
<Style x:Key="KeyButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#FFF0F0F0"/>
<Setter Property="BorderBrush" Value="#FFCCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="MinWidth" Value="60"/>
<Setter Property="MinHeight" Value="40"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#FFDDDDDD"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SpecialKeyButtonStyle" BasedOn="{StaticResource KeyButtonStyle}" TargetType="Button">
<Setter Property="Background" Value="#FFE0E0E0"/>
<Setter Property="FontSize" Value="16"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 预览区域 -->
<TextBox x:Name="PreviewTextBox" Grid.Row="0" Height="60" Margin="10"
FontSize="24" VerticalContentAlignment="Center" IsReadOnly="False"/>
<!-- 键盘主体区域 -->
<Grid Grid.Row="1" Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 数字行 -->
<StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Center">
<Button Content="1" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="2" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="3" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="4" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="5" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="6" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="7" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="8" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="9" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="0" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="DEL" Style="{StaticResource SpecialKeyButtonStyle}" Click="Backspace_Click" Width="60"/>
</StackPanel>
<!-- 第一行字母 -->
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
<Button Content="Q" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="W" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="E" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="R" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="T" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="Y" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="U" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="I" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="O" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="P" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
</StackPanel>
<!-- 第二行字母 -->
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
<Button Content="A" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="S" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="D" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="F" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="G" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="H" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="J" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="K" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="L" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="/" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="HIDE" Style="{StaticResource SpecialKeyButtonStyle}" Click="Hide_Click" Width="60"/>
</StackPanel>
<!-- 第三行字母 -->
<StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Center">
<Button x:Name="ShiftButton" Content="⇧" Style="{StaticResource SpecialKeyButtonStyle}" Click="Shift_Click" Width="60"/>
<Button Content="Z" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="X" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="C" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="V" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="B" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="N" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="M" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="." Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="ENTER" Style="{StaticResource SpecialKeyButtonStyle}" Click="Enter_Click" Width="120"/>
</StackPanel>
</Grid>
<!-- 状态栏 -->
<StatusBar Grid.Row="2">
<StatusBarItem>
<TextBlock x:Name="StatusTextBlock" Text="就绪"/>
</StatusBarItem>
</StatusBar>
</Grid>
</Window>
+116
View File
@@ -0,0 +1,116 @@
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 static SunlightCentralizedControlManagement_SCCM_.KEY.TouchKeyboardNumeral;
namespace SunlightCentralizedControlManagement_SCCM_.KEY
{
/// <summary>
/// TouchKeyboard.xaml 的交互逻辑
/// </summary>
public partial class TouchKeyboard : Window
{
private bool isShiftActive = false;
public string KeyValue;
public event EventHandler<KeyPressedEventArgs> KeyPressed;
public TouchKeyboard()
{
InitializeComponent();
}
private void KeyButton_Click(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
if (button != null)
{
string key = button.Content.ToString();
if (key.Length == 1 && char.IsLetter(key[0]))
{
key = isShiftActive ? key.ToUpper() : key.ToLower();
}
PreviewTextBox.Text += key;
// 输入后关闭Shift状态
if (isShiftActive)
{
isShiftActive = false;
UpdateButtonAppearance();
}
}
}
private void Shift_Click(object sender, RoutedEventArgs e)
{
isShiftActive = !isShiftActive;
UpdateButtonAppearance();
}
private void Backspace_Click(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(PreviewTextBox.Text))
{
PreviewTextBox.Text = PreviewTextBox.Text.Substring(0, PreviewTextBox.Text.Length - 1);
}
}
private void Enter_Click(object sender, RoutedEventArgs e)
{
// 触发回车事件
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Enter, PreviewTextBox.Text));
this.Close();
// PreviewTextBox.Text += Environment.NewLine;
}
private void Hide_Click(object sender, RoutedEventArgs e)
{
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Hide, ""));
this.Close();
}
private void UpdateButtonAppearance()
{
// 更新Shift按钮的外观以反映当前状态
if (isShiftActive)
{
ShiftButton.Background = new SolidColorBrush(Colors.LightBlue);
}
else
{
ShiftButton.Background = new SolidColorBrush(Color.FromRgb(224, 224, 224));
}
}
public class KeyPressedEventArgs : EventArgs
{
public KeyType KeyType { get; }
public string KeyValue { get; }
public KeyPressedEventArgs(KeyType keyType, string keyValue)
{
KeyType = keyType;
KeyValue = keyValue;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// 初始化为默认模式
// SetKeyboardMode(KeyboardMode.Default);
PreviewTextBox.Text = null;
}
}
}
+100
View File
@@ -0,0 +1,100 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.KEY.TouchKeyboardNumeral"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
mc:Ignorable="d"
WindowStyle="None"
ResizeMode="NoResize"
Topmost="True"
WindowStartupLocation="CenterScreen"
Title="TouchKeyboardNumeral"
Loaded="Window_Loaded"
Height="500" Width="550">
<Window.Resources>
<Style x:Key="KeyButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#FFF0F0F0"/>
<Setter Property="BorderBrush" Value="#FFCCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="MinWidth" Value="100"/>
<Setter Property="MinHeight" Value="40"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#FFDDDDDD"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#FFBBBBBB"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SpecialKeyButtonStyle" BasedOn="{StaticResource KeyButtonStyle}" TargetType="Button">
<Setter Property="Background" Value="#FFE0E0E0"/>
<Setter Property="FontSize" Value="16"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 预览区域 -->
<TextBox x:Name="PreviewTextBox" Grid.Row="0" Height="60" Margin="10"
FontSize="24" VerticalContentAlignment="Center" IsReadOnly="False"/>
<!-- 键盘主体区域 -->
<Grid Grid.Row="1" Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 数字行 -->
<StackPanel x:Name="FirstRow" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Center">
<Button Content="7" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="8" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="9" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="0" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="DEL" Style="{StaticResource SpecialKeyButtonStyle}" Click="Backspace_Click" Width="60"/>
</StackPanel>
<!-- 数字行 -->
<StackPanel x:Name="SecondRow" Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
<Button Content="4" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="5" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="6" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="." Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="HIDE" Style="{StaticResource SpecialKeyButtonStyle}" Click="Hide_Click" Width="60"/>
</StackPanel>
<!-- 数字行 -->
<StackPanel x:Name="ThirdRow" Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
<Button Content="1" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="2" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="3" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
<Button Content="ENTER" Style="{StaticResource SpecialKeyButtonStyle}" Click="Enter_Click" Width="200"/>
</StackPanel>
</Grid>
</Grid>
</Window>
+215
View File
@@ -0,0 +1,215 @@
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;
namespace SunlightCentralizedControlManagement_SCCM_.KEY
{
/// <summary>
/// TouchKeyboard.xaml 的交互逻辑
/// </summary>
public partial class TouchKeyboardNumeral : Window
{
private bool mode = false;
public string KeyValue;
public event EventHandler<KeyPressedEventArgs> KeyPressed;
private KeyboardMode currentMode = KeyboardMode.Default;
private int minValue = 0;
private int maxValue = 9;
private TextBox targetTextBox;
// 定义键盘模式枚举
public enum KeyboardMode
{
Default, // 默认模式,所有键可用
NumericOnly, // 只允许数字
DecimalOnly, // 允许数字和小数点
LimitedRange // 限制数字范围
}
public TouchKeyboardNumeral()
{
InitializeComponent();
}
public void SetKeyboardMode(KeyboardMode mode, TextBox target = null, int min = 0, int max = 9)
{
currentMode = mode;
targetTextBox = target;
minValue = min;
maxValue = max;
UpdateKeyboardLayout();
}
private void UpdateKeyboardLayout()
{
switch (currentMode)
{
case KeyboardMode.NumericOnly:
// 只允许数字,禁用小数点
SetButtonEnabled(".", false);
break;
case KeyboardMode.DecimalOnly:
// 允许数字和小数点
SetButtonEnabled(".", true);
break;
case KeyboardMode.LimitedRange:
// 根据范围启用/禁用数字键
for (int i = 0; i <= 9; i++)
{
SetButtonEnabled(i.ToString(), i >= minValue && i <= maxValue);
}
mode = true;
break;
case KeyboardMode.Default:
default:
// 启用所有键
foreach (var element in FirstRow.Children)
{
if (element is Button button && char.IsDigit(button.Content.ToString()[0]))
button.IsEnabled = true;
}
foreach (var element in SecondRow.Children)
{
if (element is Button button && (char.IsDigit(button.Content.ToString()[0]) || button.Content.ToString() == "."))
button.IsEnabled = true;
}
foreach (var element in ThirdRow.Children)
{
if (element is Button button && char.IsDigit(button.Content.ToString()[0]))
button.IsEnabled = true;
}
break;
}
}
// 设置按钮启用状态
private void SetButtonEnabled(string content, bool enabled)
{
// 在第一行查找
foreach (var element in FirstRow.Children)
{
if (element is Button button && button.Content.ToString() == content)
{
button.IsEnabled = enabled;
return;
}
}
// 在第二行查找
foreach (var element in SecondRow.Children)
{
if (element is Button button && button.Content.ToString() == content)
{
button.IsEnabled = enabled;
return;
}
}
// 在第三行查找
foreach (var element in ThirdRow.Children)
{
if (element is Button button && button.Content.ToString() == content)
{
button.IsEnabled = enabled;
return;
}
}
}
// 数字键点击事件
private void KeyButton_Click(object sender, RoutedEventArgs e)
{
if (mode && PreviewTextBox.Text.Length > 0) return;
Button button = sender as Button;
if (button != null && button.IsEnabled)
{
string keyValue = button.Content.ToString();
PreviewTextBox.Text += keyValue;
// 触发按键事件
// KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Character, keyValue));
}
}
// 退格键点击事件
private void Backspace_Click(object sender, RoutedEventArgs e)
{
if (PreviewTextBox.Text.Length > 0)
{
PreviewTextBox.Text = PreviewTextBox.Text.Substring(0, PreviewTextBox.Text.Length - 1);
// 触发退格事件
// KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Backspace, ""));
}
}
// 回车键点击事件
private void Enter_Click(object sender, RoutedEventArgs e)
{
// 触发回车事件
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Enter, PreviewTextBox.Text));
// 隐藏键盘
this.Hide();
}
// 隐藏键点击事件
private void Hide_Click(object sender, RoutedEventArgs e)
{
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Hide, ""));
// 隐藏键盘
this.Hide();
}
public class KeyPressedEventArgs : EventArgs
{
public KeyType KeyType { get; }
public string KeyValue { get; }
public KeyPressedEventArgs(KeyType keyType, string keyValue)
{
KeyType = keyType;
KeyValue = keyValue;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// 初始化为默认模式
// SetKeyboardMode(KeyboardMode.Default);
PreviewTextBox.Text = null;
mode = false;
}
}
// 按键类型枚举
public enum KeyType
{
Character,
Backspace,
Enter,
Hide
}
// 按键事件参数
public class KeyPressedEventArgs : EventArgs
{
public KeyType KeyType { get; }
public string KeyValue { get; }
public KeyPressedEventArgs(KeyType keyType, string keyValue)
{
KeyType = keyType;
KeyValue = keyValue;
}
}
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

+5 -3
View File
@@ -1,4 +1,5 @@
using SunlightCentralizedControlManagement_SCCM_.ViewModel; using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System; using System;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
@@ -82,9 +83,10 @@ namespace SunlightCentralizedControlManagement_SCCM_
} }
} }
} }
catch (Exception) catch (Exception ex)
{ {
System.Windows.MessageBox.Show(Properties.Resources.NPERR, "SCCM", MessageBoxButton.OK, MessageBoxImage.Error); LogGing.ERRDATA(ex);
System.Windows.MessageBox.Show("Unable to start. Check the log for details.", "SCCM", MessageBoxButton.OK, MessageBoxImage.Error);
} }
} }
+2 -2
View File
@@ -13,7 +13,7 @@
Loaded="Window_Loaded" Loaded="Window_Loaded"
Title="SUNLIGHT SCCM b0.0.1 (2024/08/10)" Title="SUNLIGHT SCCM b0.0.1 (2024/08/10)"
Height="1080" Width="1920" Background="#FF003640" Height="1080" Width="1920" Background="#FF003640"
WindowState ="Maximized" WindowStyle="None"> WindowStyle="None" ResizeMode="NoResize">
<Window.Resources> <Window.Resources>
<Storyboard x:Key="MenuOpen"> <Storyboard x:Key="MenuOpen">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="GridMenu"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="GridMenu">
@@ -127,7 +127,7 @@
<Grid x:Name="gdMian" Background="White" Margin="60,50,0,0"> <Grid x:Name="gdMian" Background="White" Margin="60,50,0,0">
<ContentControl x:Name="Picture"/> <ContentControl x:Name="Picture"/>
<Grid x:Name="Cdk_page" Visibility="Collapsed" Margin="0,0,0,0" Background="White" Opacity="0.8"> <Grid x:Name="Cdk_page" Visibility="Collapsed" Margin="0,0,0,0" Background="White" 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="150" Margin="0,0,0,300" TextWrapping="Wrap" Text="注册信息到期,为避免影响系统使用请及时提交注册信息!" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="keytext" Height="50" Margin="0,0,0,100" TextWrapping="Wrap" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red"/> <TextBlock x:Name="keytext" Height="50" Margin="0,0,0,100" TextWrapping="Wrap" 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"/> <TextBlock Height="50" Margin="0,0,0,0" TextWrapping="Wrap" Text="请联系 SUNLIGHT" Width="300" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button Content="{x:Static lang:Resources.Permit }" HorizontalAlignment="Center" Height="50" Margin="200,100,0,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="DarkGray" Click="ButtonPermit_Click"/> <Button Content="{x:Static lang:Resources.Permit }" HorizontalAlignment="Center" Height="50" Margin="200,100,0,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="DarkGray" Click="ButtonPermit_Click"/>
+56 -3
View File
@@ -14,6 +14,7 @@ using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
@@ -30,8 +31,14 @@ namespace SunlightCentralizedControlManagement_SCCM_
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
public static string user_; public static string user_;
public static DataTable InfData = new DataTable();
// public static string[] Inf_string ;
public UserInformation userInformation;
// public UserInf userInf;
public MainWindow() public MainWindow()
{ {
WindowStartupLocation = WindowStartupLocation.CenterScreen;
DataContext = new MainWindowViewModel(); DataContext = new MainWindowViewModel();
InitializeComponent(); InitializeComponent();
CountDown(); CountDown();
@@ -45,7 +52,46 @@ namespace SunlightCentralizedControlManagement_SCCM_
} }
user_ = App.USER_Purview; user_ = App.USER_Purview;
username.Text = user_; username.Text = user_;
/**添加提示信息栏**/
InfData.Columns.Add("Machine", Type.GetType("System.String"));
InfData.Columns.Add("Information", Type.GetType("System.String"));
InfData.Columns.Add("Code", Type.GetType("System.String"));
InfData.Columns.Add("ID", Type.GetType("System.Int32"));
InfData.RowChanged += new DataRowChangeEventHandler(InfTable);//
} }
private void InfTable(object sender, DataRowChangeEventArgs e)//触发行改变事件
{
if (userInformation == null || !userInformation.IsLoaded)//窗口不存在及创建
{
userInformation = new UserInformation();
userInformation.Topmost = true;
userInformation.Show();
userInformation.Activate();
}
else
{//窗口纯在及置顶
userInformation.Activate();
if (userInformation.WindowState == WindowState.Minimized) userInformation.WindowState = WindowState.Normal;
}
}
/* private void UserInfTable(string dat)//触发行改变事件
{
userInf.Inf_DAT = dat;
if (userInf == null || !userInf.IsLoaded)//窗口不存在及创建
{
userInf = new UserInf();
userInf.Topmost = true;
userInf.Show();
userInf.Activate();
}
else
{//窗口纯在及置顶
userInf.Activate();
if (userInf.WindowState == WindowState.Minimized) userInf.WindowState = WindowState.Normal;
}
}*/
private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e) private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e)
{ {
@@ -116,9 +162,8 @@ namespace SunlightCentralizedControlManagement_SCCM_
} }
private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e) private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
{ {
Picture.Content = new View.DispenseView();
} }
private void Buttonhelp_Click(object sender, RoutedEventArgs e) private void Buttonhelp_Click(object sender, RoutedEventArgs e)
{ {
WindowsView.Help help_page = new WindowsView.Help(); WindowsView.Help help_page = new WindowsView.Help();
@@ -216,7 +261,15 @@ namespace SunlightCentralizedControlManagement_SCCM_
private void Window_Loaded(object sender, RoutedEventArgs e)//打开页面 private void Window_Loaded(object sender, RoutedEventArgs e)//打开页面
{ {
var windowHandle = new WindowInteropHelper(this).Handle;
var currentScreen = Screen.FromHandle(windowHandle);
System.Drawing.Rectangle rectangle = currentScreen.WorkingArea;
this.Left = rectangle.Left;
this.Top=rectangle.Top;
this.Width = rectangle.Width;
this.Height = rectangle.Height;
} }
} }
+307 -1
View File
@@ -19,7 +19,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。 // (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources { public class Resources {
@@ -60,6 +60,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Manual/Automatic 的本地化字符串。
/// </summary>
public static string _Auto {
get {
return ResourceManager.GetString("_Auto", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 continue 的本地化字符串。 /// 查找类似 continue 的本地化字符串。
/// </summary> /// </summary>
@@ -267,6 +276,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Cancel 的本地化字符串。
/// </summary>
public static string Cancel {
get {
return ResourceManager.GetString("Cancel", resourceCulture);
}
}
/// <summary>
/// 查找类似 chemicals 的本地化字符串。
/// </summary>
public static string chemicals {
get {
return ResourceManager.GetString("chemicals", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Client 的本地化字符串。 /// 查找类似 Client 的本地化字符串。
/// </summary> /// </summary>
@@ -609,6 +636,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Details 的本地化字符串。
/// </summary>
public static string Details {
get {
return ResourceManager.GetString("Details", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Dide 的本地化字符串。 /// 查找类似 Dide 的本地化字符串。
/// </summary> /// </summary>
@@ -663,6 +699,42 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 DispenseEndTime 的本地化字符串。
/// </summary>
public static string DispenseEndTime {
get {
return ResourceManager.GetString("DispenseEndTime", resourceCulture);
}
}
/// <summary>
/// 查找类似 DispenseException 的本地化字符串。
/// </summary>
public static string DispenseException {
get {
return ResourceManager.GetString("DispenseException", resourceCulture);
}
}
/// <summary>
/// 查找类似 DispenseGrams 的本地化字符串。
/// </summary>
public static string DispenseGrams {
get {
return ResourceManager.GetString("DispenseGrams", resourceCulture);
}
}
/// <summary>
/// 查找类似 DispenseModule 的本地化字符串。
/// </summary>
public static string DispenseModule {
get {
return ResourceManager.GetString("DispenseModule", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Details were not sent 的本地化字符串。 /// 查找类似 Details were not sent 的本地化字符串。
/// </summary> /// </summary>
@@ -699,6 +771,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 dye 的本地化字符串。
/// </summary>
public static string dye {
get {
return ResourceManager.GetString("dye", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 DyeingMachine 的本地化字符串。 /// 查找类似 DyeingMachine 的本地化字符串。
/// </summary> /// </summary>
@@ -942,6 +1023,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Grams 的本地化字符串。
/// </summary>
public static string Grams {
get {
return ResourceManager.GetString("Grams", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Group 的本地化字符串。 /// 查找类似 Group 的本地化字符串。
/// </summary> /// </summary>
@@ -1068,6 +1158,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Information 的本地化字符串。
/// </summary>
public static string Information {
get {
return ResourceManager.GetString("Information", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 I/O 的本地化字符串。 /// 查找类似 I/O 的本地化字符串。
/// </summary> /// </summary>
@@ -1185,6 +1284,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Machines 的本地化字符串。
/// </summary>
public static string Machines {
get {
return ResourceManager.GetString("Machines", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Malfunction 的本地化字符串。 /// 查找类似 Malfunction 的本地化字符串。
/// </summary> /// </summary>
@@ -1203,6 +1311,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Manual 的本地化字符串。
/// </summary>
public static string Manual {
get {
return ResourceManager.GetString("Manual", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 MasterCylinder 的本地化字符串。 /// 查找类似 MasterCylinder 的本地化字符串。
/// </summary> /// </summary>
@@ -1419,6 +1536,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 NOT AVAILABLE 的本地化字符串。
/// </summary>
public static string Not_a {
get {
return ResourceManager.GetString("Not_a", resourceCulture);
}
}
/// <summary>
/// 查找类似 NOT Machine 的本地化字符串。
/// </summary>
public static string Not_M {
get {
return ResourceManager.GetString("Not_M", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Notimplementation 的本地化字符串。 /// 查找类似 Notimplementation 的本地化字符串。
/// </summary> /// </summary>
@@ -1590,6 +1725,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Pequest 的本地化字符串。
/// </summary>
public static string Pequest {
get {
return ResourceManager.GetString("Pequest", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Permit 的本地化字符串。 /// 查找类似 Permit 的本地化字符串。
/// </summary> /// </summary>
@@ -1689,6 +1833,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 powder 的本地化字符串。
/// </summary>
public static string powder {
get {
return ResourceManager.GetString("powder", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 PrepareMedications 的本地化字符串。 /// 查找类似 PrepareMedications 的本地化字符串。
/// </summary> /// </summary>
@@ -1806,6 +1959,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 ProductCode 的本地化字符串。
/// </summary>
public static string ProductCode {
get {
return ResourceManager.GetString("ProductCode", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 ProductionPlanning 的本地化字符串。 /// 查找类似 ProductionPlanning 的本地化字符串。
/// </summary> /// </summary>
@@ -1815,6 +1977,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 ProductName 的本地化字符串。
/// </summary>
public static string ProductName {
get {
return ResourceManager.GetString("ProductName", resourceCulture);
}
}
/// <summary>
/// 查找类似 ProductType 的本地化字符串。
/// </summary>
public static string ProductType {
get {
return ResourceManager.GetString("ProductType", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 ProgramGroup 的本地化字符串。 /// 查找类似 ProgramGroup 的本地化字符串。
/// </summary> /// </summary>
@@ -1833,6 +2013,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 ProgramName 的本地化字符串。
/// </summary>
public static string ProgramName {
get {
return ResourceManager.GetString("ProgramName", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 ProportionalValves 的本地化字符串。 /// 查找类似 ProportionalValves 的本地化字符串。
/// </summary> /// </summary>
@@ -2103,6 +2292,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Repeat the raw material 的本地化字符串。
/// </summary>
public static string RTRM {
get {
return ResourceManager.GetString("RTRM", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 RunningTime 的本地化字符串。 /// 查找类似 RunningTime 的本地化字符串。
/// </summary> /// </summary>
@@ -2148,6 +2346,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 screen 的本地化字符串。
/// </summary>
public static string Screen {
get {
return ResourceManager.GetString("Screen", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Search 的本地化字符串。 /// 查找类似 Search 的本地化字符串。
/// </summary> /// </summary>
@@ -2193,6 +2400,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Speed 的本地化字符串。
/// </summary>
public static string Speed {
get {
return ResourceManager.GetString("Speed", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 SQL 的本地化字符串。 /// 查找类似 SQL 的本地化字符串。
/// </summary> /// </summary>
@@ -2202,6 +2418,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Start 的本地化字符串。
/// </summary>
public static string Start {
get {
return ResourceManager.GetString("Start", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 StartDate 的本地化字符串。 /// 查找类似 StartDate 的本地化字符串。
/// </summary> /// </summary>
@@ -2292,6 +2517,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Subroutine 的本地化字符串。
/// </summary>
public static string Subroutine {
get {
return ResourceManager.GetString("Subroutine", resourceCulture);
}
}
/// <summary>
/// 查找类似 Swing 的本地化字符串。
/// </summary>
public static string Swing {
get {
return ResourceManager.GetString("Swing", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 SystemDataLoss 的本地化字符串。 /// 查找类似 SystemDataLoss 的本地化字符串。
/// </summary> /// </summary>
@@ -2427,6 +2670,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Test Voice 的本地化字符串。
/// </summary>
public static string TESTVOICE {
get {
return ResourceManager.GetString("TESTVOICE", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Time 的本地化字符串。 /// 查找类似 Time 的本地化字符串。
/// </summary> /// </summary>
@@ -2445,6 +2697,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 The machine is not ready 的本地化字符串。
/// </summary>
public static string TMNR {
get {
return ResourceManager.GetString("TMNR", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Today 的本地化字符串。 /// 查找类似 Today 的本地化字符串。
/// </summary> /// </summary>
@@ -2517,6 +2778,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 user_lock 的本地化字符串。
/// </summary>
public static string user_lock {
get {
return ResourceManager.GetString("user_lock", resourceCulture);
}
}
/// <summary>
/// 查找类似 user_unlock 的本地化字符串。
/// </summary>
public static string user_unlock {
get {
return ResourceManager.GetString("user_unlock", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Valid time 的本地化字符串。 /// 查找类似 Valid time 的本地化字符串。
/// </summary> /// </summary>
@@ -2535,6 +2814,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 VOICE 的本地化字符串。
/// </summary>
public static string VOICE {
get {
return ResourceManager.GetString("VOICE", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 void 的本地化字符串。 /// 查找类似 void 的本地化字符串。
/// </summary> /// </summary>
@@ -2544,6 +2832,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
} }
} }
/// <summary>
/// 查找类似 Vol 的本地化字符串。
/// </summary>
public static string Vol {
get {
return ResourceManager.GetString("Vol", resourceCulture);
}
}
/// <summary>
/// 查找类似 Volume 的本地化字符串。
/// </summary>
public static string Volume {
get {
return ResourceManager.GetString("Volume", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Washing 的本地化字符串。 /// 查找类似 Washing 的本地化字符串。
/// </summary> /// </summary>
+102
View File
@@ -990,4 +990,106 @@
<data name="TTAE" xml:space="preserve"> <data name="TTAE" xml:space="preserve">
<value>The ticket already exists</value> <value>The ticket already exists</value>
</data> </data>
<data name="Details" xml:space="preserve">
<value>Details</value>
</data>
<data name="ProductCode" xml:space="preserve">
<value>ProductCode</value>
</data>
<data name="ProductName" xml:space="preserve">
<value>ProductName</value>
</data>
<data name="ProductType" xml:space="preserve">
<value>ProductType</value>
</data>
<data name="Grams" xml:space="preserve">
<value>Grams</value>
</data>
<data name="DispenseGrams" xml:space="preserve">
<value>Actual</value>
</data>
<data name="DispenseEndTime" xml:space="preserve">
<value>EndTime</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Manual" xml:space="preserve">
<value>Manual</value>
</data>
<data name="Not_a" xml:space="preserve">
<value>NOT AVAILABLE</value>
</data>
<data name="Screen" xml:space="preserve">
<value>Screen</value>
</data>
<data name="Volume" xml:space="preserve">
<value>Volume</value>
</data>
<data name="DispenseModule" xml:space="preserve">
<value>DispenseModule</value>
</data>
<data name="Information" xml:space="preserve">
<value>Information</value>
</data>
<data name="RTRM" xml:space="preserve">
<value>Repeat the raw material</value>
</data>
<data name="Not_M" xml:space="preserve">
<value>Machine does not exist</value>
</data>
<data name="dye" xml:space="preserve">
<value>Dye</value>
</data>
<data name="chemicals" xml:space="preserve">
<value>Chemicals</value>
</data>
<data name="powder" xml:space="preserve">
<value>Powder</value>
</data>
<data name="TMNR" xml:space="preserve">
<value>The machine is not ready</value>
</data>
<data name="user_lock" xml:space="preserve">
<value>LOCK</value>
</data>
<data name="user_unlock" xml:space="preserve">
<value>UNLOCK</value>
</data>
<data name="VOICE" xml:space="preserve">
<value>Voice</value>
</data>
<data name="TESTVOICE" xml:space="preserve">
<value>Test Voice</value>
</data>
<data name="Speed" xml:space="preserve">
<value>Speed</value>
</data>
<data name="Vol" xml:space="preserve">
<value>Vol</value>
</data>
<data name="Pequest" xml:space="preserve">
<value>Pequest</value>
</data>
<data name="Subroutine" xml:space="preserve">
<value>Subroutine</value>
</data>
<data name="DispenseException" xml:space="preserve">
<value>Dispense Exception</value>
</data>
<data name="_Auto" xml:space="preserve">
<value>Manual/Automatic</value>
</data>
<data name="Swing" xml:space="preserve">
<value>Swing</value>
</data>
<data name="Start" xml:space="preserve">
<value>Start</value>
</data>
<data name="ProgramName" xml:space="preserve">
<value>Program Name</value>
</data>
<data name="Machines" xml:space="preserve">
<value>Machines</value>
</data>
</root> </root>
+102
View File
@@ -990,4 +990,106 @@
<data name="TTAE" xml:space="preserve"> <data name="TTAE" xml:space="preserve">
<value>The ticket already exists</value> <value>The ticket already exists</value>
</data> </data>
<data name="Details" xml:space="preserve">
<value>Details</value>
</data>
<data name="ProductCode" xml:space="preserve">
<value>ProductCode</value>
</data>
<data name="ProductName" xml:space="preserve">
<value>ProductName</value>
</data>
<data name="ProductType" xml:space="preserve">
<value>ProductType</value>
</data>
<data name="Grams" xml:space="preserve">
<value>Grams</value>
</data>
<data name="DispenseGrams" xml:space="preserve">
<value>DispenseGrams</value>
</data>
<data name="DispenseEndTime" xml:space="preserve">
<value>DispenseEndTime</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Manual" xml:space="preserve">
<value>Manual</value>
</data>
<data name="Not_a" xml:space="preserve">
<value>NOT AVAILABLE</value>
</data>
<data name="Screen" xml:space="preserve">
<value>screen</value>
</data>
<data name="Volume" xml:space="preserve">
<value>Volume</value>
</data>
<data name="DispenseModule" xml:space="preserve">
<value>DispenseModule</value>
</data>
<data name="Information" xml:space="preserve">
<value>Information</value>
</data>
<data name="RTRM" xml:space="preserve">
<value>Repeat the raw material</value>
</data>
<data name="Not_M" xml:space="preserve">
<value>NOT Machine</value>
</data>
<data name="dye" xml:space="preserve">
<value>dye</value>
</data>
<data name="chemicals" xml:space="preserve">
<value>chemicals</value>
</data>
<data name="powder" xml:space="preserve">
<value>powder</value>
</data>
<data name="TMNR" xml:space="preserve">
<value>The machine is not ready</value>
</data>
<data name="user_lock" xml:space="preserve">
<value>user_lock</value>
</data>
<data name="user_unlock" xml:space="preserve">
<value>user_unlock</value>
</data>
<data name="VOICE" xml:space="preserve">
<value>VOICE</value>
</data>
<data name="TESTVOICE" xml:space="preserve">
<value>Test Voice</value>
</data>
<data name="Speed" xml:space="preserve">
<value>Speed</value>
</data>
<data name="Vol" xml:space="preserve">
<value>Vol</value>
</data>
<data name="Pequest" xml:space="preserve">
<value>Pequest</value>
</data>
<data name="Subroutine" xml:space="preserve">
<value>Subroutine</value>
</data>
<data name="DispenseException" xml:space="preserve">
<value>DispenseException</value>
</data>
<data name="_Auto" xml:space="preserve">
<value>Manual/Automatic</value>
</data>
<data name="Swing" xml:space="preserve">
<value>Swing</value>
</data>
<data name="Start" xml:space="preserve">
<value>Start</value>
</data>
<data name="ProgramName" xml:space="preserve">
<value>ProgramName</value>
</data>
<data name="Machines" xml:space="preserve">
<value>Machines</value>
</data>
</root> </root>
+103 -1
View File
@@ -586,7 +586,7 @@
<value>速率</value> <value>速率</value>
</data> </data>
<data name="Tank" xml:space="preserve"> <data name="Tank" xml:space="preserve">
<value>缸</value> <value>桶</value>
</data> </data>
<data name="Tank1" xml:space="preserve"> <data name="Tank1" xml:space="preserve">
<value>缸</value> <value>缸</value>
@@ -990,4 +990,106 @@
<data name="TTAE" xml:space="preserve"> <data name="TTAE" xml:space="preserve">
<value>工单已经存在</value> <value>工单已经存在</value>
</data> </data>
<data name="Details" xml:space="preserve">
<value>明细</value>
</data>
<data name="ProductCode" xml:space="preserve">
<value>原料代码</value>
</data>
<data name="ProductName" xml:space="preserve">
<value>原料名称</value>
</data>
<data name="ProductType" xml:space="preserve">
<value>原料类型</value>
</data>
<data name="Grams" xml:space="preserve">
<value>克重</value>
</data>
<data name="DispenseGrams" xml:space="preserve">
<value>实际</value>
</data>
<data name="DispenseEndTime" xml:space="preserve">
<value>完成时间</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>取消</value>
</data>
<data name="Manual" xml:space="preserve">
<value>手动</value>
</data>
<data name="Not_a" xml:space="preserve">
<value>当前功能不可用</value>
</data>
<data name="Screen" xml:space="preserve">
<value>远程画面</value>
</data>
<data name="Volume" xml:space="preserve">
<value>容量</value>
</data>
<data name="DispenseModule" xml:space="preserve">
<value>运行模组</value>
</data>
<data name="Information" xml:space="preserve">
<value>信息</value>
</data>
<data name="RTRM" xml:space="preserve">
<value>重复原料</value>
</data>
<data name="Not_M" xml:space="preserve">
<value>机台不存在</value>
</data>
<data name="dye" xml:space="preserve">
<value>染料</value>
</data>
<data name="chemicals" xml:space="preserve">
<value>助剂</value>
</data>
<data name="powder" xml:space="preserve">
<value>粉体</value>
</data>
<data name="TMNR" xml:space="preserve">
<value>机台未就绪</value>
</data>
<data name="user_lock" xml:space="preserve">
<value>锁定</value>
</data>
<data name="user_unlock" xml:space="preserve">
<value>解锁</value>
</data>
<data name="VOICE" xml:space="preserve">
<value>语音</value>
</data>
<data name="TESTVOICE" xml:space="preserve">
<value>测试语音</value>
</data>
<data name="Speed" xml:space="preserve">
<value>语速</value>
</data>
<data name="Vol" xml:space="preserve">
<value>音量</value>
</data>
<data name="Pequest" xml:space="preserve">
<value>请求</value>
</data>
<data name="Subroutine" xml:space="preserve">
<value>副功能</value>
</data>
<data name="DispenseException" xml:space="preserve">
<value>输送异常</value>
</data>
<data name="_Auto" xml:space="preserve">
<value>手/自动</value>
</data>
<data name="Swing" xml:space="preserve">
<value>摆布</value>
</data>
<data name="Start" xml:space="preserve">
<value>开始</value>
</data>
<data name="ProgramName" xml:space="preserve">
<value>工艺名</value>
</data>
<data name="Machines" xml:space="preserve">
<value>机台</value>
</data>
</root> </root>
+103 -1
View File
@@ -586,7 +586,7 @@
<value>速率</value> <value>速率</value>
</data> </data>
<data name="Tank" xml:space="preserve"> <data name="Tank" xml:space="preserve">
<value>缸</value> <value>桶</value>
</data> </data>
<data name="Tank1" xml:space="preserve"> <data name="Tank1" xml:space="preserve">
<value>缸</value> <value>缸</value>
@@ -990,4 +990,106 @@
<data name="TTAE" xml:space="preserve"> <data name="TTAE" xml:space="preserve">
<value>工單已經存在</value> <value>工單已經存在</value>
</data> </data>
<data name="Details" xml:space="preserve">
<value>詳細</value>
</data>
<data name="ProductCode" xml:space="preserve">
<value>原料代碼</value>
</data>
<data name="ProductName" xml:space="preserve">
<value>原料名稱</value>
</data>
<data name="ProductType" xml:space="preserve">
<value>原料類型</value>
</data>
<data name="Grams" xml:space="preserve">
<value>克重</value>
</data>
<data name="DispenseGrams" xml:space="preserve">
<value>實際</value>
</data>
<data name="DispenseEndTime" xml:space="preserve">
<value>完成時間</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>取消</value>
</data>
<data name="Manual" xml:space="preserve">
<value>手動</value>
</data>
<data name="Not_a" xml:space="preserve">
<value>目前功能不可用</value>
</data>
<data name="Screen" xml:space="preserve">
<value>遠端畫面</value>
</data>
<data name="Volume" xml:space="preserve">
<value>容量</value>
</data>
<data name="DispenseModule" xml:space="preserve">
<value>運行模組</value>
</data>
<data name="Information" xml:space="preserve">
<value>訊息</value>
</data>
<data name="RTRM" xml:space="preserve">
<value>重複原料</value>
</data>
<data name="Not_M" xml:space="preserve">
<value>機台不存在</value>
</data>
<data name="dye" xml:space="preserve">
<value>染料</value>
</data>
<data name="chemicals" xml:space="preserve">
<value>助劑</value>
</data>
<data name="powder" xml:space="preserve">
<value>粉體</value>
</data>
<data name="TMNR" xml:space="preserve">
<value>機台未就緒</value>
</data>
<data name="user_lock" xml:space="preserve">
<value>鎖定</value>
</data>
<data name="user_unlock" xml:space="preserve">
<value>解鎖</value>
</data>
<data name="VOICE" xml:space="preserve">
<value>語音</value>
</data>
<data name="TESTVOICE" xml:space="preserve">
<value>測試語音</value>
</data>
<data name="Speed" xml:space="preserve">
<value>語速</value>
</data>
<data name="Vol" xml:space="preserve">
<value>音量</value>
</data>
<data name="Pequest" xml:space="preserve">
<value>請求</value>
</data>
<data name="Subroutine" xml:space="preserve">
<value>副功能</value>
</data>
<data name="DispenseException" xml:space="preserve">
<value>輸送異常</value>
</data>
<data name="_Auto" xml:space="preserve">
<value>手/自動</value>
</data>
<data name="Swing" xml:space="preserve">
<value>擺佈</value>
</data>
<data name="Start" xml:space="preserve">
<value>開始</value>
</data>
<data name="ProgramName" xml:space="preserve">
<value>工藝名</value>
</data>
<data name="Machines" xml:space="preserve">
<value>機器</value>
</data>
</root> </root>
@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SunlightCentralizedControlM
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nGantt", "..\nGantt\nGantt.csproj", "{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nGantt", "..\nGantt\nGantt.csproj", "{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VncSharpWpf", "..\VncSharpWpf\VncSharpWpf.csproj", "{77B5CB63-E14B-4253-881D-6BE9D7C57076}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU {CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU {CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.Build.0 = Release|Any CPU {CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.Build.0 = Release|Any CPU
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Debug|Any CPU.ActiveCfg = Debug|x86
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Debug|Any CPU.Build.0 = Debug|x86
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Release|Any CPU.ActiveCfg = Release|x86
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Release|Any CPU.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -77,9 +77,13 @@
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="SkiaSharp">
<HintPath>bin\Debug\SkiaSharp.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Speech" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@@ -93,6 +97,7 @@
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ApplicationDefinition Include="App.xaml"> <ApplicationDefinition Include="App.xaml">
@@ -101,15 +106,36 @@
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="ConvertMoels\BoolRBConvert.cs" /> <Compile Include="ConvertMoels\BoolRBConvert.cs" />
<Compile Include="ConvertMoels\StatenClassConvert.cs" /> <Compile Include="ConvertMoels\StatenClassConvert.cs" />
<Compile Include="ConvertMoels\BoolToVisidilityConvert.cs" />
<Compile Include="ConvertMoels\StatenToImageConvert.cs" />
<Compile Include="ConvertMoels\StatexmlConvert.cs" />
<Compile Include="EX\DispenseState.xaml.cs">
<DependentUpon>DispenseState.xaml</DependentUpon>
</Compile>
<Compile Include="EX\Exchange\BDC_SQL.cs" />
<Compile Include="KEY\TouchKeyboard.xaml.cs">
<DependentUpon>TouchKeyboard.xaml</DependentUpon>
</Compile>
<Compile Include="KEY\TouchKeyboardNumeral.xaml.cs">
<DependentUpon>TouchKeyboardNumeral.xaml</DependentUpon>
</Compile>
<Compile Include="EX\ManualDyelot.xaml.cs">
<DependentUpon>ManualDyelot.xaml</DependentUpon>
</Compile>
<Compile Include="EX\VNC.xaml.cs">
<DependentUpon>VNC.xaml</DependentUpon>
</Compile>
<Compile Include="Login.xaml.cs"> <Compile Include="Login.xaml.cs">
<DependentUpon>Login.xaml</DependentUpon> <DependentUpon>Login.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UserClass\AsyncSerialPortClient.cs" />
<Compile Include="UserClass\AsyncTcpClient.cs" /> <Compile Include="UserClass\AsyncTcpClient.cs" />
<Compile Include="UserClass\ClsLock.cs" /> <Compile Include="UserClass\ClsLock.cs" />
<Compile Include="UserClass\CRCcheck16.cs" /> <Compile Include="UserClass\CRCcheck16.cs" />
<Compile Include="UserClass\CSV.cs" /> <Compile Include="UserClass\CSV.cs" />
<Compile Include="UserClass\DataGridHelper.cs" /> <Compile Include="UserClass\DataGridHelper.cs" />
<Compile Include="UserClass\DataTableForToObservableCollection.cs" /> <Compile Include="UserClass\DataTableForToObservableCollection.cs" />
<Compile Include="UserClass\DataTableManager .cs" />
<Compile Include="UserClass\get_local_ip_address.cs" /> <Compile Include="UserClass\get_local_ip_address.cs" />
<Compile Include="UserClass\HardwareSN.cs" /> <Compile Include="UserClass\HardwareSN.cs" />
<Compile Include="UserClass\IniFile.cs" /> <Compile Include="UserClass\IniFile.cs" />
@@ -118,15 +144,30 @@
<Compile Include="UserClass\NetFwManger.cs" /> <Compile Include="UserClass\NetFwManger.cs" />
<Compile Include="UserClass\NumericTextColumn .cs" /> <Compile Include="UserClass\NumericTextColumn .cs" />
<Compile Include="UserClass\PID.cs" /> <Compile Include="UserClass\PID.cs" />
<Compile Include="UserClass\RS485MasterStation.cs" />
<Compile Include="UserClass\SYSInfo.cs" /> <Compile Include="UserClass\SYSInfo.cs" />
<Compile Include="UserClass\PressKey.cs" /> <Compile Include="UserClass\PressKey.cs" />
<Compile Include="UserClass\SqliteHelper.cs" /> <Compile Include="UserClass\SqliteHelper.cs" />
<Compile Include="UserClass\StrToInt.cs" /> <Compile Include="UserClass\StrToInt.cs" />
<Compile Include="UserClass\SubItem.cs" /> <Compile Include="UserClass\SubItem.cs" />
<Compile Include="UserClass\UserControlMenuItem.cs" /> <Compile Include="UserClass\UserControlMenuItem.cs" />
<Compile Include="UserControls\DispenseMacInfo.xaml.cs">
<DependentUpon>DispenseMacInfo.xaml</DependentUpon>
</Compile>
<Compile Include="WindowsView\UserWorkOrder.xaml.cs">
<DependentUpon>UserWorkOrder.xaml</DependentUpon>
</Compile>
<Compile Include="WindowsView\UserInf.xaml.cs">
<DependentUpon>UserInf.xaml</DependentUpon>
</Compile>
<Compile Include="WindowsView\UserInformation.xaml.cs">
<DependentUpon>UserInformation.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModel\CurveTempModel.cs" /> <Compile Include="ViewModel\CurveTempModel.cs" />
<Compile Include="ViewModel\CurveDiagramViewModel.cs" /> <Compile Include="ViewModel\CurveDiagramViewModel.cs" />
<Compile Include="ViewModel\MainWindowViewModel.cs" /> <Compile Include="ViewModel\MainWindowViewModel.cs" />
<Compile Include="ViewModel\MonitorViewModel.cs" />
<Compile Include="ViewModel\ManualDyelotModel.cs" />
<Compile Include="ViewModel\ViewModelLocator.cs" /> <Compile Include="ViewModel\ViewModelLocator.cs" />
<Compile Include="View\CurveTemp.xaml.cs"> <Compile Include="View\CurveTemp.xaml.cs">
<DependentUpon>CurveTemp.xaml</DependentUpon> <DependentUpon>CurveTemp.xaml</DependentUpon>
@@ -137,6 +178,12 @@
<Compile Include="View\LogView.xaml.cs"> <Compile Include="View\LogView.xaml.cs">
<DependentUpon>LogView.xaml</DependentUpon> <DependentUpon>LogView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="View\DispenseView.xaml.cs">
<DependentUpon>DispenseView.xaml</DependentUpon>
</Compile>
<Compile Include="View\DispenseMachinesSet.xaml.cs">
<DependentUpon>DispenseMachinesSet.xaml</DependentUpon>
</Compile>
<Compile Include="View\MachinesView.xaml.cs"> <Compile Include="View\MachinesView.xaml.cs">
<DependentUpon>MachinesView.xaml</DependentUpon> <DependentUpon>MachinesView.xaml</DependentUpon>
</Compile> </Compile>
@@ -176,6 +223,9 @@
<Compile Include="UserControls\RoilingTextBlock.xaml.cs"> <Compile Include="UserControls\RoilingTextBlock.xaml.cs">
<DependentUpon>RoilingTextBlock.xaml</DependentUpon> <DependentUpon>RoilingTextBlock.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="View\DyelotView.xaml.cs">
<DependentUpon>DyelotView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Whole.xaml.cs"> <Compile Include="View\Whole.xaml.cs">
<DependentUpon>Whole.xaml</DependentUpon> <DependentUpon>Whole.xaml</DependentUpon>
</Compile> </Compile>
@@ -197,9 +247,32 @@
<Compile Include="WindowsView\User.xaml.cs"> <Compile Include="WindowsView\User.xaml.cs">
<DependentUpon>User.xaml</DependentUpon> <DependentUpon>User.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="WindowsView\UserMessage.xaml.cs">
<DependentUpon>UserMessage.xaml</DependentUpon>
</Compile>
<Compile Include="WindowsView\ViewStep.xaml.cs"> <Compile Include="WindowsView\ViewStep.xaml.cs">
<DependentUpon>ViewStep.xaml</DependentUpon> <DependentUpon>ViewStep.xaml</DependentUpon>
</Compile> </Compile>
<Page Include="EX\DispenseState.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="KEY\TouchKeyboard.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="KEY\TouchKeyboardNumeral.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="EX\ManualDyelot.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EX\VNC.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Login.xaml"> <Page Include="Login.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -222,6 +295,22 @@
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Page Include="UserControls\DispenseMacInfo.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WindowsView\UserWorkOrder.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WindowsView\UserInf.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WindowsView\UserInformation.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\CurveTemp.xaml"> <Page Include="View\CurveTemp.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -234,6 +323,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="View\DispenseView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\DispenseMachinesSet.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\MachinesView.xaml"> <Page Include="View\MachinesView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -286,6 +383,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="View\DyelotView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\Whole.xaml"> <Page Include="View\Whole.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -314,6 +415,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="WindowsView\UserMessage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WindowsView\ViewStep.xaml"> <Page Include="WindowsView\ViewStep.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -348,6 +453,7 @@
<None Include="DATA\Chart.db" /> <None Include="DATA\Chart.db" />
<None Include="DATA\nGantt.zip" /> <None Include="DATA\nGantt.zip" />
<None Include="DATA\SCCM.db" /> <None Include="DATA\SCCM.db" />
<None Include="DATA\VncSharpWpf.zip" />
<None Include="Fonts\font-awesome-4.7.0.zip" /> <None Include="Fonts\font-awesome-4.7.0.zip" />
<None Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.eot" /> <None Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.eot" />
<Resource Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.ttf" /> <Resource Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.ttf" />
@@ -404,37 +510,134 @@
<Version>2.0.0-rc4.5</Version> <Version>2.0.0-rc4.5</Version>
</PackageReference> </PackageReference>
<PackageReference Include="MaterialDesignThemes"> <PackageReference Include="MaterialDesignThemes">
<Version>5.1.0</Version> <Version>5.2.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Web.WebView2">
<Version>1.0.2903.40</Version>
</PackageReference> </PackageReference>
<PackageReference Include="NModbus"> <PackageReference Include="NModbus">
<Version>3.0.81</Version> <Version>3.0.81</Version>
</PackageReference> </PackageReference>
<PackageReference Include="ScottPlot"> <PackageReference Include="ScottPlot">
<Version>5.0.47</Version> <Version>5.0.56</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Data.SQLite"> <PackageReference Include="System.Data.SQLite">
<Version>1.0.119</Version> <Version>1.0.119</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Management"> <PackageReference Include="System.Management">
<Version>9.0.0</Version> <Version>9.0.8</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.ObjectModel"> <PackageReference Include="System.ObjectModel">
<Version>4.3.0</Version> <Version>4.3.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="TouchSocket"> <PackageReference Include="TouchSocket">
<Version>3.0.9</Version> <Version>3.1.16</Version>
</PackageReference>
<PackageReference Include="TouchSocket.SerialPorts">
<Version>3.1.16</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="ControlUse\" /> <Folder Include="ControlUse\" />
<Folder Include="EX\EXModel\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="EX\DLL\VncSharpWpf.dll" />
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" /> <Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" /> <Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" /> <Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
<Resource Include="lmage\IconParkExtend.png" />
<Resource Include="lmage\IconParkExtendR.png" />
<Resource Include="lmage\IconParkExtendY.png" />
<Resource Include="lmage\IconParkInfo.png" />
<Resource Include="lmage\IconParkUsbOne.png" />
<Resource Include="lmage\00.png" />
<Resource Include="lmage\1000-1.png" />
<Resource Include="lmage\1000-2.png" />
<Resource Include="lmage\1000-3.png" />
<Resource Include="lmage\10000.png" />
<Resource Include="lmage\10001.gif" />
<Resource Include="lmage\2000.png" />
<Resource Include="lmage\2001.png" />
<Resource Include="lmage\ADD.jpg" />
<Resource Include="lmage\ADD.png" />
<Resource Include="lmage\beng_err.png" />
<Resource Include="lmage\beng_run.png" />
<Resource Include="lmage\beng_stop.png" />
<Resource Include="lmage\ERR.png" />
<Resource Include="lmage\fa_bili.png" />
<Resource Include="lmage\FlatColorIconsCancel.png" />
<Resource Include="lmage\FxemojiBellcancellation.png" />
<Resource Include="lmage\FxemojiRingingbell.png" />
<Resource Include="lmage\guamaoqi.png" />
<Resource Include="lmage\guandao %281%29.png" />
<Resource Include="lmage\guandao %2810%29.png" />
<Resource Include="lmage\guandao %2811%29.png" />
<Resource Include="lmage\guandao %2812%29.png" />
<Resource Include="lmage\guandao %2813%29.png" />
<Resource Include="lmage\guandao %2814%29.png" />
<Resource Include="lmage\guandao %2815%29.png" />
<Resource Include="lmage\guandao %2816%29.png" />
<Resource Include="lmage\guandao %282%29.png" />
<Resource Include="lmage\guandao %283%29.png" />
<Resource Include="lmage\guandao %284%29.png" />
<Resource Include="lmage\guandao %285%29.png" />
<Resource Include="lmage\guandao %286%29.png" />
<Resource Include="lmage\guandao %287%29.png" />
<Resource Include="lmage\guandao %288%29.png" />
<Resource Include="lmage\guandao %289%29.png" />
<Resource Include="lmage\Hand.png" />
<Resource Include="lmage\IconParkAutoFocus.png" />
<Resource Include="lmage\IconParkLock.png" />
<Resource Include="lmage\IconParkMessages.png" />
<Resource Include="lmage\IconParkPauseOne.png" />
<Resource Include="lmage\IconParkPlay.png" />
<Resource Include="lmage\IconParkPlayTwo.png" />
<Resource Include="lmage\IconParkStopwatch.png" />
<Resource Include="lmage\ID001.png" />
<Resource Include="lmage\ID007.png" />
<Resource Include="lmage\ID008.png" />
<Resource Include="lmage\ID013.png" />
<Resource Include="lmage\ID015.png" />
<Resource Include="lmage\ID017.png" />
<Resource Include="lmage\ID020.png" />
<Resource Include="lmage\ID022.png" />
<Resource Include="lmage\ID031.png" />
<Resource Include="lmage\ID035.png" />
<Resource Include="lmage\ID036.png" />
<Resource Include="lmage\ID039.png" />
<Resource Include="lmage\ID040.png" />
<Resource Include="lmage\ID041.png" />
<Resource Include="lmage\ID049.png" />
<Resource Include="lmage\ID050.png" />
<Resource Include="lmage\ID051.png" />
<Resource Include="lmage\ID054.png" />
<Resource Include="lmage\ID055.png" />
<Resource Include="lmage\ID056.png" />
<Resource Include="lmage\ID064.png" />
<Resource Include="lmage\ID065.png" />
<Resource Include="lmage\ID066.png" />
<Resource Include="lmage\ID067.png" />
<Resource Include="lmage\ID090.png" />
<Resource Include="lmage\ID091.png" />
<Resource Include="lmage\ID093.png" />
<Resource Include="lmage\ID094.png" />
<Resource Include="lmage\inf.png" />
<Resource Include="lmage\link.png" />
<Resource Include="lmage\LOCK.png" />
<Resource Include="lmage\Manual.png" />
<Resource Include="lmage\start.png" />
<Resource Include="lmage\start2.png" />
<Resource Include="lmage\start3.png" />
<Resource Include="lmage\StreamlinePlayList4Solid.png" />
<Resource Include="lmage\StreamlinePlayList8.png" />
<Resource Include="lmage\StreamlineUltimateColorColorPaletteSample1.png" />
<Resource Include="lmage\tong.png" />
<Resource Include="LOGO\sunlight_logo.jpg" />
<Resource Include="LOGO\303pdw.png" />
<Resource Include="LOGO\303.png" />
<Resource Include="LOGO\302.png" />
<Resource Include="LOGO\252RMRD.png" />
<Resource Include="LOGO\252RB.png" />
<Resource Include="LOGO\252-2t.png" />
<Resource Include="LOGO\242w.png" />
<Resource Include="sunlight_logotext.jpg" /> <Resource Include="sunlight_logotext.jpg" />
<Resource Include="WindowsView\sunlight_logotext.jpg" /> <Resource Include="WindowsView\sunlight_logotext.jpg" />
<Resource Include="sunlightlogo.jpg" /> <Resource Include="sunlightlogo.jpg" />
@@ -476,6 +679,13 @@
<Project>{ccc54f28-5d20-4ab3-a1a8-c62cd2da3ae7}</Project> <Project>{ccc54f28-5d20-4ab3-a1a8-c62cd2da3ae7}</Project>
<Name>nGantt</Name> <Name>nGantt</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\VncSharpWpf\VncSharpWpf.csproj">
<Project>{77b5cb63-e14b-4253-881d-6be9d7c57076}</Project>
<Name>VncSharpWpf</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterResolveReferences"> <Target Name="AfterResolveReferences">
+522
View File
@@ -0,0 +1,522 @@
using Newtonsoft.Json;
using ScottPlot.Plottables;
using SunlightCentralizedControlManagement_SCCM_.View;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using TouchSocket.Core;
using TouchSocket.SerialPorts;
using TouchSocket.Sockets;
using static SkiaSharp.HarfBuzz.SKShaper;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static System.Net.Mime.MediaTypeNames;
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{
public class AsyncSerialPortClient
{
public static string ClipBetween(string source, char startChar, char endChar, bool includeBounds = false)
{
if (string.IsNullOrEmpty(source))
return string.Empty;
int startIndex = source.IndexOf(startChar);
if (startIndex == -1) return string.Empty;
int endIndex = source.IndexOf(endChar, startIndex + 1);
if (endIndex == -1) return string.Empty;
if (includeBounds)
{
return source.Substring(startIndex, endIndex - startIndex + 1);
}
else
{
int contentStart = startIndex + 1;
int contentLength = endIndex - startIndex - 1;
return contentLength > 0 ? source.Substring(contentStart, contentLength) : string.Empty;
}
}
public static string PortCOM1 { get; set; }
public static string PortCOM2 { get; set; }
public static string PortCOM3 { get; set; }
public static string PortCOM4 { get; set; }
public static async Task PortClient(SerialPortClient portclient, string com, int BAUD)
{
//var client = new SerialPortClient();
portclient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到端口
portclient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
portclient.Closing = (client, e) => { return EasyTask.CompletedTask; };//即将从端口断开连接。此处仅主动断开才有效。
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
portclient.Received = (client, e) =>
{
//接受重置事件状态
_responseEvent.Set();
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
@"\n", RegexOptions.IgnoreCase);
for (int i = 0; i < sArray.Length; i++)
{
if (sArray[i].Length > 5)
{
string SYSAPI = sArray[i].Substring(0, 5);
string Station = ClipBetween(sArray[i], '[', ']');
string DAT = sArray[i].Substring(sArray[i].IndexOf("]") + 1);
if (SYSAPI == "SC800")
{
try
{
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" + Station + "' AND Serial = 'PORT1'").First();
drEmployee.BeginEdit();
drEmployee["State"] = "802";
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
}
catch (Exception ex)
{
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
}
}
else if (SYSAPI == "SC810")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex)
{
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
}
}//回复的工单记录状态后就位111
else if (SYSAPI == "SC811")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkorderSteps", new Dictionary<string, object> { { "Mode", 1 } },
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "' AND Step ='" +
_dat.GetValue("Step") + "'", null);
int x = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkorderSteps where WorkOrder='" +
_dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "' AND Mode <> '1'", null).Tables[0].Rows.Count;
if (x == 0)
{
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//回复的工单明细状态后就位113
else if (SYSAPI == "SC812")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//回复的工单设置状态后就位101
else if (SYSAPI == "SC827")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//获取呼叫领料单
else if (SYSAPI == "SC830")
{
try
{
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
string mac;
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" + Station + "' AND Serial = 'PORT1'").First();
mac = drEmployee["Name"].ToString();
drEmployee.BeginEdit();
drEmployee["ERR"] = _new.GetValue("ERR");
drEmployee["LOCK"] = _new.GetValue("LOCK");
drEmployee["Message"] = _new.GetValue("Status");
drEmployee["WorkOrder"] = _new.GetValue("Work");
drEmployee["Temperature"] = _new.GetValue("MTT");
drEmployee["WaterLevel"] = _new.GetValue("MTL");
drEmployee["Process"] = _new.GetValue("Process");
drEmployee["Step"] = _new.GetValue("Step");
drEmployee["UserButton"] = _new.GetValue("UserB");
if (_new.GetValue("InfoS").ToString() != "900")
{ drEmployee["UserInfoStart"] = _new.GetValue("InfoS"); }
drEmployee["UserInfo"] = _new.GetValue("Info");
drEmployee["WORK_RUN"] = _new.GetValue("RUN");
drEmployee["RUN_STEPID"] = _new.GetValue("STEPID");
drEmployee["CALL"] = _new.GetValue("CALL");
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
if (_new.GetValue("Status").ToString() != "----------")
{
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
Chart_new.Add("WorkOrder", _new.GetValue("Work"));
//Chart_new.Add("Machine", mac);
//Chart_new.Add("Time", _new.GetValue("Time"));
Chart_new.Add("MST", _new.GetValue("MST"));
Chart_new.Add("MTT", _new.GetValue("MTT"));
Chart_new.Add("MTL", _new.GetValue("MTL"));
Chart_new.Add("MTH", _new.GetValue("MTH"));
Chart_new.Add("MUT", _new.GetValue("MUT"));
Chart_new.Add("STTA", _new.GetValue("STTA"));
Chart_new.Add("STLA", _new.GetValue("STLA"));
Chart_new.Add("STTB", _new.GetValue("STTB"));
Chart_new.Add("STLB", _new.GetValue("STLB"));
Chart_new.Add("STTC", _new.GetValue("STTC"));
Chart_new.Add("STLC", _new.GetValue("STLC"));
MainWindowViewModel.SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
}
}
catch (Exception ex)
{
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
}
}//当前信息
else if (SYSAPI == "SC831")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}
else if (SYSAPI == "SC832")
{
try
{
MainWindowViewModel.MachineLOG = DAT;
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//当前细节信息
else if (SYSAPI == "SC833")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//当前领料单信息
else if (SYSAPI == "SC851")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//数字开关表
else if (SYSAPI == "SC852")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//寄存器表
else if (SYSAPI == "SC853")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//缓存表
else if (SYSAPI == "SC854")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//程序设置表
else if (SYSAPI == "SC855")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//系统设置表
else if (SYSAPI == "SC859")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//信息
else if (SYSAPI == "SC910")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//发布失败
else if (SYSAPI == "SC911")
{
try
{
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//细节错误
else if (SYSAPI == "SC980")
{
}
}
}
return EasyTask.CompletedTask; ;
};
await portclient.SetupAsync(new TouchSocketConfig()
.SetMaxBufferSize(1024 * 1024 * 10)
.SetSerialPortOption(new SerialPortOption()
{
BaudRate = BAUD,//波特率
DataBits = 8,//数据位
Parity = System.IO.Ports.Parity.None,//校验位
PortName = com,//COM
StopBits = System.IO.Ports.StopBits.One,//停止位
})
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) })
.ConfigurePlugins(a =>
{
//a.Add<MyPlugin>();
}
));
try
{
await portclient.ConnectAsync();
}
catch (Exception ex) { LogGing.ERRDATA(ex); }
}
public static async Task PortClient2(SerialPortClient portclient, string com, int BAUD)
{
//var client = new SerialPortClient();
portclient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到端口
portclient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
portclient.Closing = (client, e) => { return EasyTask.CompletedTask; };//即将从端口断开连接。此处仅主动断开才有效。
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
portclient.Received = (client, e) =>
{
_responseEvent2.Set();
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
@"\n", RegexOptions.IgnoreCase);
return EasyTask.CompletedTask; ;
};
await portclient.SetupAsync(new TouchSocketConfig()
.SetSerialPortOption(new SerialPortOption()
{
BaudRate = BAUD,//波特率
DataBits = 8,//数据位
Parity = System.IO.Ports.Parity.None,//校验位
PortName = com,//COM
StopBits = System.IO.Ports.StopBits.One,//停止位
})
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) })
.ConfigurePlugins(a =>
{
//a.Add<MyPlugin>();
}));
try
{
await portclient.ConnectAsync();
}
catch (Exception ex) { LogGing.ERRDATA(ex); }
}
public static async Task PortClient3(SerialPortClient portclient, string com, int BAUD)
{
//var client = new SerialPortClient();
portclient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到端口
portclient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
portclient.Closing = (client, e) => { return EasyTask.CompletedTask; };//即将从端口断开连接。此处仅主动断开才有效。
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
portclient.Received = (client, e) =>
{
_responseEvent3.Set();
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
@"\n", RegexOptions.IgnoreCase);
return EasyTask.CompletedTask; ;
};
await portclient.SetupAsync(new TouchSocketConfig()
.SetSerialPortOption(new SerialPortOption()
{
BaudRate = BAUD,//波特率
DataBits = 8,//数据位
Parity = System.IO.Ports.Parity.None,//校验位
PortName = com,//COM
StopBits = System.IO.Ports.StopBits.One,//停止位
})
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) })
.ConfigurePlugins(a =>
{
//a.Add<MyPlugin>();
}));
try
{
await portclient.ConnectAsync();
}
catch (Exception ex) { LogGing.ERRDATA(ex); }
}
public static async Task PortClient4(SerialPortClient portclient, string com, int BAUD)
{
//var client = new SerialPortClient();
portclient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到端口
portclient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
portclient.Closing = (client, e) => { return EasyTask.CompletedTask; };//即将从端口断开连接。此处仅主动断开才有效。
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
portclient.Received = (client, e) =>
{
_responseEvent4.Set();
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
@"\n", RegexOptions.IgnoreCase);
return EasyTask.CompletedTask; ;
};
await portclient.SetupAsync(new TouchSocketConfig()
.SetSerialPortOption(new SerialPortOption()
{
BaudRate = BAUD,//波特率
DataBits = 8,//数据位
Parity = System.IO.Ports.Parity.None,//校验位
PortName = com,//COM
StopBits = System.IO.Ports.StopBits.One,//停止位
})
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(500) })
.ConfigurePlugins(a =>
{
//a.Add<MyPlugin>();
}));
try
{
await portclient.ConnectAsync();
}
catch (Exception ex) { LogGing.ERRDATA(ex); }
}
public static readonly ManualResetEventSlim _responseEvent = new ManualResetEventSlim(false);
public static readonly ManualResetEventSlim _responseEvent2 = new ManualResetEventSlim(false);
public static readonly ManualResetEventSlim _responseEvent3 = new ManualResetEventSlim(false);
public static readonly ManualResetEventSlim _responseEvent4 = new ManualResetEventSlim(false);
/// <summary>
/// 发送指令并等待响应,超时时间为500ms
/// </summary>
/// <param name="command">要发送的指令字节数组</param>
/// <returns>从机的响应数据,超时则为null</returns>
public static void SendCommandAndWait(SerialPortClient serialPortClients, string command)
{
try
{
var t = CRCcheck16.ToCRC16(command);
_responseEvent.Reset();
serialPortClients.Send(command); // 发送指令
// 等待500毫秒或直到收到响应
if (!_responseEvent.Wait(TimeSpan.FromMilliseconds(1000)))
{
_responseEvent.Set();
//清楚了解状态
string Station = ClipBetween(command, '[', ']');
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
Station + "' AND Serial = 'PORT1'").First();
if (drEmployee.Field<int>("State") != 800)
{
drEmployee.BeginEdit();
drEmployee["State"] = "800";
drEmployee["WorkOrder"] = "------";
drEmployee["Dyelot"] = "";
drEmployee["Temperature"] = 0.0;
drEmployee["WaterLevel"] = 0.0;
drEmployee["Process"] = "";
drEmployee["Step"] = "";
drEmployee["Message"] = "";
drEmployee["SYSKEY"] = "";
drEmployee["WORK_RUN"] = "-1";
drEmployee["ERR"] = false;
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
}
}
}
catch (Exception) { }
}
public static void SendCommandAndWait2(SerialPortClient serialPortClients, string command)
{
try
{
_responseEvent2.Reset();
serialPortClients.Send(command); // 发送指令
// 等待500毫秒或直到收到响应
_responseEvent2.Wait(TimeSpan.FromMilliseconds(1000));
// 重置事件状态
_responseEvent2.Set();
}
catch (Exception) { }
}
public static void SendCommandAndWait3(SerialPortClient serialPortClients, string command)
{
try
{
_responseEvent3.Reset();
serialPortClients.Send(command); // 发送指令
// 等待500毫秒或直到收到响应
_responseEvent3.Wait(TimeSpan.FromMilliseconds(1000));
// 重置事件状态
_responseEvent3.Set();
}
catch (Exception) { }
}
public static void SendCommandAndWait4(SerialPortClient serialPortClients, string command)
{
try
{
_responseEvent4.Reset();
serialPortClients.Send(command); // 发送指令
// 等待500毫秒或直到收到响应
_responseEvent4.Wait(TimeSpan.FromMilliseconds(1000));
// 重置事件状态
_responseEvent4.Set();
}
catch (Exception) { }
}
}
}
+277 -137
View File
@@ -1,96 +1,129 @@
using System; using DyeingComputer.UserClass;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ScottPlot;
using ScottPlot.Colormaps;
using SkiaSharp;
using SunlightCentralizedControlManagement_SCCM_.View;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.Sockets; using System.Net.Sockets;
using System.Reflection.Emit; using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Diagnostics;
using TouchSocket.Core;
using TouchSocket.Sockets;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System.Runtime.InteropServices;
using ScottPlot.Colormaps;
using static System.Windows.Forms.AxHost;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using Newtonsoft.Json;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using SunlightCentralizedControlManagement_SCCM_.View;
using TcpClient = TouchSocket.Sockets.TcpClient;
using Newtonsoft.Json.Linq;
using System.Xml.Linq;
using ScottPlot;
using System.Collections;
using DyeingComputer.UserClass;
using System.Windows; using System.Windows;
using System.Windows.Documents;
using System.Xml.Linq;
using TouchSocket.Core;
using TouchSocket.SerialPorts;
using TouchSocket.Sockets;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static SunlightCentralizedControlManagement_SCCM_.View.MachinesView;
using static System.Windows.Forms.AxHost;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
using TcpClient = TouchSocket.Sockets.TcpClient;
namespace SunlightCentralizedControlManagement_SCCM_.UserClass namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{/// <summary> {/// <summary>
/// 异步TCP客户端 /// 异步TCP客户端
/// </summary> /// </summary>
public class AsyncTcpClient public class AsyncTcpClient
{ {
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
private static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
private static readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
public static async Task TcpClient(TcpClient tcpClient, string ip, string port) public static async Task TcpClient(TcpClient tcpClient, string ip, string port)
{ {
//TcpClient tcpClient = new TcpClient(); //TcpClient tcpClient = new TcpClient();
tcpClient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到服务器,此时已经创建socket,但是还未建立tcp tcpClient.Connecting = (client, e) => { return EasyTask.CompletedTask; };//即将连接到服务器,此时已经创建socket,但是还未建立tcp
tcpClient.Connected = (client, e) => tcpClient.Connected = (client, e) =>
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First(); try
drEmployee.BeginEdit(); {
drEmployee["State"] = "801"; lock (MainWindowViewModel.Machines.Rows.SyncRoot)
drEmployee.EndEdit(); {
drEmployee.AcceptChanges(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee.ClearErrors(); drEmployee.BeginEdit();
drEmployee["State"] = "801";
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_OK"); drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_OK");
}
catch (Exception ex)
{
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
}
return EasyTask.CompletedTask; return EasyTask.CompletedTask;
};//成功连接到服务器 };//成功连接到服务器
tcpClient.Closing = (client, e) => tcpClient.Closing = (client, e) =>
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First(); try
drEmployee.BeginEdit(); {
drEmployee["State"] = "899"; lock (MainWindowViewModel.Machines.Rows.SyncRoot)
drEmployee["WorkOrder"] = "------"; {
drEmployee["Dyelot"] = ""; DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee["Temperature"] = "---.-"; drEmployee.BeginEdit();
drEmployee["WaterLevel"] = "----"; drEmployee["State"] = "800";
drEmployee["Process"] = ""; drEmployee["WorkOrder"] = "------";
drEmployee["Step"] = ""; drEmployee["Dyelot"] = "";
drEmployee["Message"] = ""; drEmployee["Temperature"] = 0.0;
drEmployee.EndEdit(); drEmployee["WaterLevel"] = 0.0;
drEmployee.AcceptChanges(); drEmployee["Process"] = "";
drEmployee.ClearErrors(); drEmployee["Step"] = "";
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP"); drEmployee["Message"] = "";
drEmployee["SYSKEY"] = "";
drEmployee["WORK_RUN"] = "-1";
drEmployee["ERR"] = false;
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP");
}
catch (Exception ex)
{
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
}
return EasyTask.CompletedTask; return EasyTask.CompletedTask;
};//即将从服务器断开连接。此处仅主动断开才有效。 };//即将从服务器断开连接。此处仅主动断开才有效。
tcpClient.Closed = (client, e) => tcpClient.Closed = (client, e) =>
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First(); try
drEmployee.BeginEdit(); {
drEmployee["State"] = "899"; lock (MainWindowViewModel.Machines.Rows.SyncRoot)
drEmployee["WorkOrder"] = "------"; {
drEmployee["Dyelot"] = ""; DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee["Temperature"] = "---.-"; drEmployee.BeginEdit();
drEmployee["WaterLevel"] = "----"; drEmployee["State"] = "800";
drEmployee["Process"] = ""; drEmployee["WorkOrder"] = "------";
drEmployee["Step"] = ""; drEmployee["Dyelot"] = "";
drEmployee["Message"] = ""; drEmployee["Temperature"] = 0.0;
drEmployee.EndEdit(); drEmployee["WaterLevel"] = 0.0;
drEmployee.AcceptChanges(); drEmployee["Process"] = "";
drEmployee.ClearErrors(); drEmployee["Step"] = "";
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT"); drEmployee["Message"] = "";
drEmployee["SYSKEY"] = "";
drEmployee["WORK_RUN"] = "-1";
drEmployee["ERR"] = false;
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT");
}
catch (Exception ex)
{
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
}
return EasyTask.CompletedTask; return EasyTask.CompletedTask;
};//从服务器断开连接,当连接不成功时不会触发。 };//从服务器断开连接,当连接不成功时不会触发。
tcpClient.Received = (client, e) => tcpClient.Received = (client, e) =>
@@ -105,43 +138,141 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化 Chart_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First(); lock (MainWindowViewModel.Machines.Rows.SyncRoot)
drEmployee.BeginEdit(); {
drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString(); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString(); drEmployee.BeginEdit();
drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString(); drEmployee["SYSKEY"] = Chart_new.GetValue("SYSKEY").ToString();
drEmployee["State"] = "802"; // drEmployee["NAME"] = Chart_new.GetValue("MACHINE").ToString();
drEmployee.EndEdit(); drEmployee["Groups"] = Chart_new.GetValue("GROUP").ToString();
drEmployee.AcceptChanges(); drEmployee["State"] = "802";
drEmployee.ClearErrors(); drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
}
catch (Exception ex)
{
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
} }
else if (SYSAPI == "SC810") else if (SYSAPI == "SC810")
{ {
try try
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库 MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
"WorkOrder ='" + DAT + "'", null); "WorkOrder ='" + DAT + "'", null);
SQLiteHelpers.Close(); // Dictionary<string, object> _dat;
// _dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
// MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
// "WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex)
{
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
} }
else if (SYSAPI == "SC811") else if (SYSAPI == "SC811")
{ {
try try
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库 MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
"WorkOrder ='" + DAT + "'", null); "WorkOrder ='" + DAT + "'", null);
SQLiteHelpers.Close(); // Dictionary<string, object> _dat;
}catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } // _dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
// MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
// "WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='"+ _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
} }
else if (SYSAPI == "SC812")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
"WorkOrder ='" + DAT + "'", null);
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}
else if (SYSAPI == "SC822")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
Application.Current.Dispatcher.Invoke(() =>
{
UserWorkOrder userWorkOrder = new UserWorkOrder();
userWorkOrder.WorkOrderTable = dataTable;
userWorkOrder.Show();
});
}
catch (Exception)
{
Application.Current.Dispatcher.Invoke(() =>
{
UserInf userInf = new UserInf();
userInf.Inf_DAT = "没有等待中的工艺";
userInf.Show();
userInf.Activate();
});
// LogGing.LogGingDATA("[ERR='" + ex + "']=Exception");
MainWindowViewModel.ERR_c++;
}
}
else if (SYSAPI == "SC827")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
foreach (DataRow sourceRow in dataTable.Rows)
{
lock (MainWindowViewModel.Dyelot_CALL.Rows.SyncRoot)
{
// 创建新行(基于目标表结构)
DataRow newRow = MainWindowViewModel.Dyelot_CALL.NewRow();
// 复制源表中存在的列数据
foreach (DataColumn column in dataTable.Columns)
{
if (MainWindowViewModel.Dyelot_CALL.Columns.Contains(column.ColumnName))
{
newRow[column.ColumnName] = sourceRow[column.ColumnName];
}
}
MainWindowViewModel.Dyelot_CALL.Rows.Add(newRow);
Dictionary<string, object> Product_ = new Dictionary<string, object>();//缓存函数
Product_.Add("State", 202);
Product_.Add("Dyelot", newRow.Field<string>("Dyelot"));
Product_.Add("Step", newRow.Field<int>("Step"));
Product_.Add("ProductCode", newRow.Field<string>("ProductCode"));
Product_.Add("Amount", newRow.Field<object>("Amount"));
Product_.Add("DispenseEndTime", newRow.Field<object>("DispenseEndTime"));
newRow.BeginEdit();
newRow["State"] = 202;
newRow.EndEdit();
MainWindowViewModel.SQLiteHelpers.InsertData("DyelotHistory", MainWindowViewModel.SQLiteHelpers.ToDictionary(newRow));// 执行插入
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{
ID = Convert.ToInt16(MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines,
"ID", "Name='" + newRow.Field<string>("Machine") + "'")),
DAT = "SC828" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines,
"SYSKEY", "Name='" + newRow.Field<string>("Machine") + "'") + Product_.ToJsonString()
});
}
}
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//获取呼叫领料单
else if (SYSAPI == "SC830") else if (SYSAPI == "SC830")
{ {
try try
@@ -149,24 +280,37 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> _new = new Dictionary<string, object>();//缓存函数
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化 _new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "' AND port='" + client.Port + "'").First(); string mac;
drEmployee.BeginEdit(); // 首先确保 DataTable 使用线程安全的访问方式
drEmployee["Message"] = _new.GetValue("Status"); lock (MainWindowViewModel.Machines.Rows.SyncRoot)
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder"); {
drEmployee["Temperature"] = _new.GetValue("MTT"); DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
drEmployee["WaterLevel"] = _new.GetValue("MTL"); mac = drEmployee["Name"].ToString();
drEmployee["Process"] = _new.GetValue("Process"); drEmployee.BeginEdit();
drEmployee["Step"] = _new.GetValue("Step"); drEmployee["ERR"] = _new.GetValue("ERR");
drEmployee.EndEdit(); drEmployee["LOCK"] = _new.GetValue("LOCK");
drEmployee.AcceptChanges(); drEmployee["Message"] = _new.GetValue("Status");
drEmployee.ClearErrors(); drEmployee["WorkOrder"] = _new.GetValue("WorkNumder");
drEmployee["Temperature"] = _new.GetValue("MTT");
drEmployee["WaterLevel"] = _new.GetValue("MTL");
drEmployee["Process"] = _new.GetValue("Process");
drEmployee["Step"] = _new.GetValue("Step");
drEmployee["UserButton"] = _new.GetValue("UserButton");
if (_new.GetValue("UserInfoStart").ToString() != "900")
{ drEmployee["UserInfoStart"] = _new.GetValue("UserInfoStart"); }
drEmployee["UserInfo"] = _new.GetValue("UserInfo");
drEmployee["WORK_RUN"] = _new.GetValue("WORK_RUN");
drEmployee["RUN_STEPID"] = _new.GetValue("RUN_STEPID");
drEmployee["CALL"] = _new.GetValue("CALL");
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
if (_new.GetValue("Status").ToString() != "----------") if (_new.GetValue("Status").ToString() != "----------")
{ {
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder")); Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
Chart_new.Add("Machine", _new.GetValue("Machine")); Chart_new.Add("Machine", mac);
Chart_new.Add("Time", _new.GetValue("Time")); Chart_new.Add("Time", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
Chart_new.Add("MST", _new.GetValue("MST")); Chart_new.Add("MST", _new.GetValue("MST"));
Chart_new.Add("MTT", _new.GetValue("MTT")); Chart_new.Add("MTT", _new.GetValue("MTT"));
Chart_new.Add("MTL", _new.GetValue("MTL")); Chart_new.Add("MTL", _new.GetValue("MTL"));
@@ -179,14 +323,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
Chart_new.Add("STTC", _new.GetValue("STTC")); Chart_new.Add("STTC", _new.GetValue("STTC"));
Chart_new.Add("STLC", _new.GetValue("STLC")); Chart_new.Add("STLC", _new.GetValue("STLC"));
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径 MainWindowViewModel.SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.InsertData("Chart", Chart_new);// 执行插入
SQLiteHelpers.Close();
} }
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
} }//当前信息
else if (SYSAPI == "SC831") else if (SYSAPI == "SC831")
{ {
try try
@@ -195,7 +337,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化 MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
} }//步骤信息
else if (SYSAPI == "SC832") else if (SYSAPI == "SC832")
{ {
try try
@@ -208,7 +350,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{ {
try try
{ {
MainWindowViewModel.MachineLOG = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MonitorView.Product_DAT = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
MonitorView.Product_bool = true;
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//当前领料单信息 }//当前领料单信息
@@ -257,15 +401,22 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//系统设置表 }//系统设置表
else if (SYSAPI == "SC859")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MachinesView.LOG_dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//信息
else if (SYSAPI == "SC910") else if (SYSAPI == "SC910")
{ {
try try
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
SQLiteHelpers.Open(); //打开数据库 MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 109 } },
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 109 } },
"WorkOrder ='" + DAT + "'", null); "WorkOrder ='" + DAT + "'", null);
SQLiteHelpers.Close();
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//发布失败 }//发布失败
@@ -274,17 +425,23 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
try try
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
SQLiteHelpers.Open(); //打开数据库 MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 119 } },
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 119 } },
"WorkOrder ='" + DAT + "'", null); "WorkOrder ='" + DAT + "'", null);
SQLiteHelpers.Close();
} }
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//细节错误 }//细节错误
else if (SYSAPI == "SC921")
{
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//错误
else if (SYSAPI == "SC980") else if (SYSAPI == "SC980")
{ {
DAT = DAT.Substring(DAT.IndexOf("]") + 1); DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MessageBox.Show(DAT,"SCCM", MessageBoxButton.OK, MessageBoxImage.Question); MessageBox.Show(DAT, "SCCM", MessageBoxButton.OK, MessageBoxImage.Question);
} }
return EasyTask.CompletedTask; return EasyTask.CompletedTask;
@@ -292,41 +449,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
//载入配置 //载入配置
await tcpClient.SetupAsync(new TouchSocketConfig() await tcpClient.SetupAsync(new TouchSocketConfig()
.SetMaxBufferSize(1024*1024) .SetMaxBufferSize(1024* 1024*100)
.SetMinBufferSize(1024*64) .SetMinBufferSize(1024*1024)
.SetRemoteIPHost(ip + ":" + port) .SetRemoteIPHost(ip + ":" + port)
.ConfigurePlugins(a => .ConfigurePlugins(a =>
{ {
a.UseCheckClear() //使用Polling轮询连接插件
.SetCheckClearType(CheckClearType.All) a.UseTcpReconnection()
.SetTick(TimeSpan.FromSeconds(30)) .UsePolling(TimeSpan.FromSeconds(5));
.SetOnClose((c, t) =>
{
c.TryShutdown();
});
a.UseTcpReconnection();//触发型重连
}) })
.ConfigureContainer(a => .ConfigureContainer(a =>
{ {
// a.AddConsoleLogger();//添加一个日志注入
}));
// Result result = await }
_ = tcpClient.TryConnectAsync(); ));
// return result.IsSuccess;
/* try await tcpClient.TryConnectAsync();
{
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。
return true;
}
catch
{
return false;
}*/
} }
} }
} }
+360
View File
@@ -0,0 +1,360 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{
/// <summary>
/// 线程安全的 DataTable 管理器
/// 提供对 DataTable 的安全并发访问
/// </summary>
public class DataTableManager : IDisposable
{
private DataTable _dataTable;
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
private bool _disposed = false;
#region 构造函数
public DataTableManager()
{
_dataTable = new DataTable();
}
public DataTableManager(DataTable dataTable)
{
_dataTable = dataTable ?? throw new ArgumentNullException(nameof(dataTable));
}
public DataTableManager(string tableName)
{
_dataTable = new DataTable(tableName);
}
#endregion
#region 基本操作
/// <summary>
/// 安全地添加列
/// </summary>
public void AddColumn(string columnName, Type dataType)
{
ExecuteWriteOperation(table =>
{
table.Columns.Add(columnName, dataType);
});
}
/// <summary>
/// 安全地添加行
/// </summary>
public void AddRow(params object[] values)
{
ExecuteWriteOperation(table =>
{
DataRow newRow = table.NewRow();
for (int i = 0; i < Math.Min(values.Length, table.Columns.Count); i++)
{
newRow[i] = values[i] ?? DBNull.Value;
}
table.Rows.Add(newRow);
});
}
/// <summary>
/// 安全地更新单元格值
/// </summary>
public bool UpdateCell(int rowIndex, string columnName, object value)
{
return ExecuteWriteOperation(table =>
{
if (IsValidRowIndex(table, rowIndex) && table.Columns.Contains(columnName))
{
table.Rows[rowIndex][columnName] = value ?? DBNull.Value;
return true;
}
return false;
});
}
/// <summary>
/// 安全地删除行
/// </summary>
public bool DeleteRow(int rowIndex)
{
return ExecuteWriteOperation(table =>
{
if (IsValidRowIndex(table, rowIndex))
{
table.Rows[rowIndex].Delete();
return true;
}
return false;
});
}
#endregion
#region 查询操作
/// <summary>
/// 安全地获取行
/// </summary>
public DataRow GetRow(int rowIndex)
{
return ExecuteReadOperation(table =>
{
return IsValidRowIndex(table, rowIndex) ? table.Rows[rowIndex] : null;
});
}
/// <summary>
/// 安全地查找行(使用筛选条件)
/// </summary>
public DataRow[] FindRows(string filterExpression)
{
return ExecuteReadOperation(table =>
{
try
{
return string.IsNullOrEmpty(filterExpression)
? table.Select()
: table.Select(filterExpression);
}
catch (EvaluateException)
{
return new DataRow[0];
}
});
}
/// <summary>
/// 安全地获取行数
/// </summary>
public int GetRowCount()
{
return ExecuteReadOperation(table => table.Rows.Count);
}
/// <summary>
/// 安全地检查行是否存在
/// </summary>
public bool RowExists(int rowIndex)
{
return ExecuteReadOperation(table => IsValidRowIndex(table, rowIndex));
}
#endregion
#region 批量操作
/// <summary>
/// 安全地批量添加行
/// </summary>
public void BulkAddRows(IEnumerable<object[]> rowsData)
{
ExecuteWriteOperation(table =>
{
foreach (var rowData in rowsData)
{
DataRow newRow = table.NewRow();
for (int i = 0; i < Math.Min(rowData.Length, table.Columns.Count); i++)
{
newRow[i] = rowData[i] ?? DBNull.Value;
}
table.Rows.Add(newRow);
}
});
}
/// <summary>
/// 安全地清空所有数据
/// </summary>
public void Clear()
{
ExecuteWriteOperation(table =>
{
table.Clear();
});
}
#endregion
#region 数据导出
/// <summary>
/// 获取数据快照(线程安全的副本)
/// </summary>
public DataTable GetSnapshot()
{
return ExecuteReadOperation(table =>
{
return table.Copy(); // 创建数据的独立副本
});
}
/// <summary>
/// 获取只读视图
/// </summary>
public DataView GetReadOnlyView()
{
return ExecuteReadOperation(table =>
{
return new DataView(table) { AllowEdit = false };
});
}
/// <summary>
/// 导出到新 DataTable(包含结构)
/// </summary>
public DataTable ExportToDataTable()
{
return ExecuteReadOperation(table =>
{
DataTable exported = table.Clone();
exported.Merge(table, false, MissingSchemaAction.Add);
return exported;
});
}
#endregion
#region 锁操作核心
/// <summary>
/// 执行读取操作(共享锁)
/// </summary>
private T ExecuteReadOperation<T>(Func<DataTable, T> operation)
{
_lock.EnterReadLock();
try
{
return operation(_dataTable);
}
finally
{
_lock.ExitReadLock();
}
}
/// <summary>
/// 执行写入操作(独占锁)
/// </summary>
private void ExecuteWriteOperation(Action<DataTable> operation)
{
_lock.EnterWriteLock();
try
{
operation(_dataTable);
_dataTable.AcceptChanges();
}
finally
{
_lock.ExitWriteLock();
}
}
private T ExecuteWriteOperation<T>(Func<DataTable, T> operation)
{
_lock.EnterWriteLock();
try
{
var result = operation(_dataTable);
_dataTable.AcceptChanges();
return result;
}
finally
{
_lock.ExitWriteLock();
}
}
private bool IsValidRowIndex(DataTable table, int rowIndex)
{
return rowIndex >= 0 && rowIndex < table.Rows.Count;
}
#endregion
#region 高级功能
/// <summary>
/// 带超时的安全操作
/// </summary>
public bool TryUpdateCell(int rowIndex, string columnName, object value, int timeoutMs = 5000)
{
if (_lock.TryEnterWriteLock(timeoutMs))
{
try
{
if (IsValidRowIndex(_dataTable, rowIndex) && _dataTable.Columns.Contains(columnName))
{
_dataTable.Rows[rowIndex][columnName] = value ?? DBNull.Value;
_dataTable.AcceptChanges();
return true;
}
return false;
}
finally
{
_lock.ExitWriteLock();
}
}
return false;
}
/// <summary>
/// 执行事务性操作
/// </summary>
public void ExecuteTransaction(Action<DataTable> transaction)
{
_lock.EnterWriteLock();
try
{
// 开始事务
_dataTable.BeginLoadData();
try
{
transaction(_dataTable);
_dataTable.AcceptChanges();
}
catch
{
_dataTable.RejectChanges();
throw;
}
finally
{
_dataTable.EndLoadData();
}
}
finally
{
_lock.ExitWriteLock();
}
}
#endregion
#region 属性和清理
public string TableName
{
get => ExecuteReadOperation(table => table.TableName);
set => ExecuteWriteOperation(table => table.TableName = value);
}
public DataColumnCollection Columns
{
get => ExecuteReadOperation(table => table.Columns);
}
public void Dispose()
{
if (!_disposed)
{
_lock?.Dispose();
_dataTable?.Dispose();
_disposed = true;
}
GC.SuppressFinalize(this);
}
~DataTableManager()
{
Dispose();
}
#endregion
}
}
+617
View File
@@ -0,0 +1,617 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TouchSocket.Core;
using TouchSocket.SerialPorts;
using TouchSocket.Sockets;
namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{
#region 基础数据结构
/// <summary>
/// 485 设备地址
/// </summary>
public struct DeviceAddress
{
public byte Value { get; }
public DeviceAddress(byte address)
{
if (address == 0) throw new ArgumentException("设备地址不能为0(广播地址)");
Value = address;
}
public static implicit operator byte(DeviceAddress address) => address.Value;
public static implicit operator DeviceAddress(byte address) => new DeviceAddress(address);
public override string ToString() => $"0x{Value:X2}";
}
/// <summary>
/// 485 命令帧
/// </summary>
public class CommandFrame
{
public DeviceAddress DeviceAddress { get; set; }
public byte FunctionCode { get; set; }
public byte[] Data { get; set; }
public ushort CRC { get; set; }
public byte[] ToBytes()
{
// 实现帧序列化逻辑,包括CRC计算
var dataLength = Data?.Length ?? 0;
var frame = new byte[3 + dataLength + 2]; // 地址+功能码+数据+CRC
frame[0] = DeviceAddress;
frame[1] = FunctionCode;
if (dataLength > 0)
Array.Copy(Data, 0, frame, 2, dataLength);
// 计算CRC (这里使用Modbus CRC算法示例)
CRC = CalculateCRC(frame, 0, frame.Length - 2);
frame[frame.Length - 2] = (byte)(CRC & 0xFF);
frame[frame.Length - 1] = (byte)(CRC >> 8);
return frame;
}
private ushort CalculateCRC(byte[] data, int offset, int length)
{
// 简化的CRC计算示例,实际应根据协议实现
ushort crc = 0xFFFF;
for (int i = offset; i < offset + length; i++)
{
crc ^= data[i];
for (int j = 0; j < 8; j++)
{
if ((crc & 0x0001) != 0)
{
crc >>= 1;
crc ^= 0xA001;
}
else
{
crc >>= 1;
}
}
}
return crc;
}
}
/// <summary>
/// 响应帧
/// </summary>
public class ResponseFrame
{
public DeviceAddress DeviceAddress { get; set; }
public byte FunctionCode { get; set; }
public byte[] Data { get; set; }
public ushort CRC { get; set; }
public bool IsValid { get; set; }
public string Error { get; set; }
public static ResponseFrame FromBytes(byte[] data)
{
// 实现帧解析逻辑,包括CRC验证
var frame = new ResponseFrame();
if (data.Length < 4) // 最小帧长度
{
frame.IsValid = false;
frame.Error = "帧长度不足";
return frame;
}
frame.DeviceAddress = data[0];
frame.FunctionCode = data[1];
// 检查CRC
ushort receivedCRC = (ushort)(data[data.Length - 1] << 8 | data[data.Length - 2]);
ushort calculatedCRC = CalculateCRC(data, 0, data.Length - 2);
if (receivedCRC != calculatedCRC)
{
frame.IsValid = false;
frame.Error = "CRC校验失败";
return frame;
}
// 提取数据部分
if (data.Length > 4)
{
frame.Data = new byte[data.Length - 4];
Array.Copy(data, 2, frame.Data, 0, frame.Data.Length);
}
frame.IsValid = true;
return frame;
}
private static ushort CalculateCRC(byte[] data, int offset, int length)
{
// 与CommandFrame相同的CRC算法
ushort crc = 0xFFFF;
for (int i = offset; i < offset + length; i++)
{
crc ^= data[i];
for (int j = 0; j < 8; j++)
{
if ((crc & 0x0001) != 0)
{
crc >>= 1;
crc ^= 0xA001;
}
else
{
crc >>= 1;
}
}
}
return crc;
}
}
/// <summary>
/// 通信任务
/// </summary>
public class CommunicationTask
{
public DeviceAddress DeviceAddress { get; set; }
public CommandFrame Command { get; set; }
public TaskCompletionSource<ResponseFrame> CompletionSource { get; set; }
public int TimeoutMs { get; set; } = 1000;
public int RetryCount { get; set; } = 3;
}
#endregion
#region 异常类
public class RS485CommunicationException : Exception
{
public DeviceAddress DeviceAddress { get; }
public byte FunctionCode { get; }
public RS485CommunicationException(DeviceAddress address, byte functionCode, string message)
: base($"设备 {address} 功能码 0x{functionCode:X2} 通信失败: {message}")
{
DeviceAddress = address;
FunctionCode = functionCode;
}
}
public class RS485TimeoutException : RS485CommunicationException
{
public RS485TimeoutException(DeviceAddress address, byte functionCode)
: base(address, functionCode, "响应超时")
{
}
}
public class RS485CRCException : RS485CommunicationException
{
public RS485CRCException(DeviceAddress address, byte functionCode)
: base(address, functionCode, "CRC校验失败")
{
}
}
#endregion
#region 主站实现
/// <summary>
/// 485 主站实现
/// </summary>
public class RS485MasterStation : IDisposable
{
private readonly SerialPortClient _serialPortClient;
private readonly ConcurrentDictionary<DeviceAddress, DeviceState> _deviceStates;
private readonly ConcurrentQueue<CommunicationTask> _taskQueue;
private readonly CancellationTokenSource _cancellationTokenSource;
private Task _processingTask;
private bool _isDisposed = false;
// 响应超时时间(毫秒)
public int ResponseTimeout { get; set; } = 1000;
// 帧间延迟(毫秒)
public int InterFrameDelay { get; set; } = 10;
// 最大重试次数
public int MaxRetries { get; set; } = 3;
/// <summary>
/// 设备状态
/// </summary>
private class DeviceState
{
public DeviceAddress Address { get; set; }
public DateTime LastCommunication { get; set; }
public bool IsOnline { get; set; }
public int TimeoutCount { get; set; }
}
public RS485MasterStation(string portName, int baudRate = 9600)
{
_serialPortClient = new SerialPortClient();
_deviceStates = new ConcurrentDictionary<DeviceAddress, DeviceState>();
_taskQueue = new ConcurrentQueue<CommunicationTask>();
_cancellationTokenSource = new CancellationTokenSource();
// 配置串口
_serialPortClient.Setup(new TouchSocketConfig()
.SetSerialPortOption(new SerialPortOption()
{
PortName = portName,
BaudRate = baudRate,
DataBits = 8,
Parity = Parity.None,
StopBits = StopBits.One
}));
// 注册数据接收事件
_serialPortClient.Received = OnDataReceived;
}
/// <summary>
/// 启动主站
/// </summary>
public void Start()
{
_serialPortClient.Connect();
_processingTask = Task.Run(ProcessQueue, _cancellationTokenSource.Token);
Console.WriteLine("485主站已启动");
}
/// <summary>
/// 停止主站
/// </summary>
public void Stop()
{
_cancellationTokenSource.Cancel();
_serialPortClient.Close();
Console.WriteLine("485主站已停止");
}
/// <summary>
/// 添加设备到监控列表
/// </summary>
public void AddDevice(DeviceAddress address)
{
_deviceStates[address] = new DeviceState
{
Address = address,
LastCommunication = DateTime.MinValue,
IsOnline = false,
TimeoutCount = 0
};
Console.WriteLine($"已添加设备: {address}");
}
/// <summary>
/// 从监控列表移除设备
/// </summary>
public void RemoveDevice(DeviceAddress address)
{
_deviceStates.TryRemove(address, out _);
Console.WriteLine($"已移除设备: {address}");
}
/// <summary>
/// 发送命令到设备
/// </summary>
public Task<ResponseFrame> SendCommandAsync(DeviceAddress address, byte functionCode, byte[] data = null, int timeoutMs = 1000, int retryCount = 3)
{
var command = new CommandFrame
{
DeviceAddress = address,
FunctionCode = functionCode,
Data = data ?? new byte[0]
};
var task = new CommunicationTask
{
DeviceAddress = address,
Command = command,
CompletionSource = new TaskCompletionSource<ResponseFrame>(),
TimeoutMs = timeoutMs,
RetryCount = retryCount
};
_taskQueue.Enqueue(task);
return task.CompletionSource.Task;
}
/// <summary>
/// 读取保持寄存器
/// </summary>
public async Task<byte[]> ReadHoldingRegistersAsync(DeviceAddress address, ushort startAddress, ushort numberOfRegisters)
{
var data = new byte[4];
data[0] = (byte)(startAddress >> 8); // 起始地址高字节
data[1] = (byte)(startAddress & 0xFF); // 起始地址低字节
data[2] = (byte)(numberOfRegisters >> 8); // 寄存器数量高字节
data[3] = (byte)(numberOfRegisters & 0xFF); // 寄存器数量低字节
var response = await SendCommandAsync(address, 0x03, data);
if (!response.IsValid)
throw new RS485CommunicationException(address, 0x03, response.Error);
return response.Data;
}
/// <summary>
/// 写入单个寄存器
/// </summary>
public async Task WriteSingleRegisterAsync(DeviceAddress address, ushort registerAddress, ushort value)
{
var data = new byte[4];
data[0] = (byte)(registerAddress >> 8); // 寄存器地址高字节
data[1] = (byte)(registerAddress & 0xFF); // 寄存器地址低字节
data[2] = (byte)(value >> 8); // 值高字节
data[3] = (byte)(value & 0xFF); // 值低字节
var response = await SendCommandAsync(address, 0x06, data);
if (!response.IsValid)
throw new RS485CommunicationException(address, 0x06, response.Error);
}
/// <summary>
/// 处理任务队列
/// </summary>
private async Task ProcessQueue()
{
while (!_cancellationTokenSource.Token.IsCancellationRequested)
{
if (_taskQueue.TryDequeue(out var task))
{
await ProcessTask(task);
}
else
{
// 队列为空,执行设备轮询
await PollDevices();
await Task.Delay(100, _cancellationTokenSource.Token); // 短暂休眠
}
}
}
/// <summary>
/// 处理单个通信任务
/// </summary>
private async Task ProcessTask(CommunicationTask task)
{
int retryCount = 0;
ResponseFrame response = null;
while (retryCount < task.RetryCount && !_cancellationTokenSource.Token.IsCancellationRequested)
{
try
{
// 发送命令
var commandData = task.Command.ToBytes();
_serialPortClient.Send(commandData);
// 等待响应
var timeoutTask = Task.Delay(task.TimeoutMs, _cancellationTokenSource.Token);
var responseTask = task.CompletionSource.Task;
var completedTask = await Task.WhenAny(responseTask, timeoutTask);
if (completedTask == responseTask)
{
response = await responseTask;
if (response.IsValid)
{
UpdateDeviceState(task.DeviceAddress, true);
task.CompletionSource.SetResult(response);
return;
}
else
{
throw new RS485CRCException(task.DeviceAddress, task.Command.FunctionCode);
}
}
else
{
throw new RS485TimeoutException(task.DeviceAddress, task.Command.FunctionCode);
}
}
catch (RS485CommunicationException ex)
{
retryCount++;
UpdateDeviceState(task.DeviceAddress, false);
if (retryCount >= task.RetryCount)
{
task.CompletionSource.SetException(ex);
return;
}
// 等待一段时间后重试
await Task.Delay(InterFrameDelay, _cancellationTokenSource.Token);
}
}
}
/// <summary>
/// 轮询所有设备状态
/// </summary>
private async Task PollDevices()
{
foreach (var deviceState in _deviceStates.Values.ToList())
{
// 检查设备是否需要轮询(例如,超过一定时间未通信)
if ((DateTime.Now - deviceState.LastCommunication).TotalSeconds > 30)
{
try
{
// 发送诊断命令(如读取设备状态)
await ReadHoldingRegistersAsync(deviceState.Address, 0, 1);
Console.WriteLine($"设备 {deviceState.Address} 轮询成功");
}
catch (Exception ex)
{
Console.WriteLine($"设备 {deviceState.Address} 轮询失败: {ex.Message}");
}
// 添加帧间延迟
await Task.Delay(InterFrameDelay, _cancellationTokenSource.Token);
}
}
}
/// <summary>
/// 数据接收处理
/// </summary>
private Task OnDataReceived(ISerialPortClient client, ReceivedDataEventArgs e)
{
try
{
// 解析响应帧
var response = ResponseFrame.FromBytes(e.ByteBlock.ReadBytesPackage());
if (response.IsValid)
{
// 查找匹配的任务并设置结果
foreach (var task in _taskQueue.Where(t => t.DeviceAddress.Value == response.DeviceAddress.Value))
{
task.CompletionSource.TrySetResult(response);
}
UpdateDeviceState(response.DeviceAddress, true);
}
else
{
Console.WriteLine($"收到无效响应: {response.Error}");
}
}
catch (Exception ex)
{
Console.WriteLine($"处理接收数据时出错: {ex.Message}");
}
return Task.CompletedTask;
}
/// <summary>
/// 更新设备状态
/// </summary>
private void UpdateDeviceState(DeviceAddress address, bool communicationSuccess)
{
if (_deviceStates.TryGetValue(address, out var state))
{
state.LastCommunication = DateTime.Now;
if (communicationSuccess)
{
state.IsOnline = true;
state.TimeoutCount = 0;
}
else
{
state.TimeoutCount++;
if (state.TimeoutCount > MaxRetries)
{
state.IsOnline = false;
Console.WriteLine($"设备 {address} 已离线");
}
}
}
}
/// <summary>
/// 获取所有设备状态
/// </summary>
public Dictionary<DeviceAddress, bool> GetDeviceStatuses()
{
return _deviceStates.ToDictionary(
kvp => kvp.Key,
kvp => kvp.Value.IsOnline);
}
/// <summary>
/// 资源释放
/// </summary>
public void Dispose()
{
if (!_isDisposed)
{
_isDisposed = true;
_cancellationTokenSource.Cancel();
_serialPortClient.SafeDispose();
_cancellationTokenSource.Dispose();
}
}
}
#endregion
#region 使用示例
class Program
{
static async Task Main(string[] args)
{
// 创建485主站实例
using (var master = new RS485MasterStation("COM1", 9600))
try
{
// 添加要监控的设备
master.AddDevice(0x01);
master.AddDevice(0x02);
master.AddDevice(0x03);
// 启动主站
master.Start();
// 等待一段时间让主站初始化
await Task.Delay(1000);
// 示例1: 读取设备1的保持寄存器
try
{
var data = await master.ReadHoldingRegistersAsync(0x01, 0, 10);
Console.WriteLine($"成功读取设备1的寄存器数据: {BitConverter.ToString(data)}");
}
catch (RS485CommunicationException ex)
{
Console.WriteLine(ex.Message);
}
// 示例2: 向设备2写入寄存器值
try
{
await master.WriteSingleRegisterAsync(0x02, 0x1000, 0x1234);
Console.WriteLine("成功向设备2写入寄存器值");
}
catch (RS485CommunicationException ex)
{
Console.WriteLine(ex.Message);
}
// 显示所有设备状态
var statuses = master.GetDeviceStatuses();
foreach (var status in statuses)
{
Console.WriteLine($"设备 {status.Key}: {(status.Value ? "在线" : "离线")}");
}
// 保持运行
Console.WriteLine("按任意键退出...");
Console.ReadKey();
}
finally
{
master.Stop();
}
}
}
#endregion
}
+18
View File
@@ -680,6 +680,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
return result; return result;
} }
/// <summary>
/// 将DataRow转换为Dictionary&lt;string, object&gt;
/// </summary>
/// <param name="row">DataRow实例</param>
/// <returns>键为列名、值为对应数据的字典</returns>
public Dictionary<string, object> ToDictionary(DataRow row)
{
var dictionary = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
if (row == null) return dictionary;
foreach (DataColumn column in row.Table.Columns)
{
object value = row[column] == DBNull.Value ? null : row[column];
dictionary[column.ColumnName] = value;
}
return dictionary;
}
} }
#endregion #endregion
} }
+51
View File
@@ -0,0 +1,51 @@
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.UserControls.DispenseMacInfo"
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:SunlightCentralizedControlManagement_SCCM_.UserControls"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="400" Background="#FF828282">
<Grid Margin="5,5,5,5" Background="White" >
<Image x:Name="IMAGE" VerticalAlignment="Top" Height="400" Margin="0,5,0,0" />
<Grid Margin="0,400,0,0">
<TextBlock TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" Height="30" VerticalAlignment="Top" FontSize="16"
HorizontalAlignment="Left" Width="150" Background="#FFE0E0E0"/>
<TextBlock TextWrapping="Wrap" Text="{x:Static lang:Resources.State}" Height="30" VerticalAlignment="Top" FontSize="16"
Margin="0,30,0,0" HorizontalAlignment="Left" Width="150" Background="#FFE0E0E0"/>
<TextBlock TextWrapping="Wrap" Text="{x:Static lang:Resources.WorkingStatus}" Height="30" VerticalAlignment="Top" FontSize="16"
Margin="0,60,0,0" HorizontalAlignment="Left" Width="150" Background="#FFE0E0E0"/>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,0,80,0">
<TextBlock x:Name="mac" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,0,0,0" HorizontalAlignment="Right" Width="80">
<TextBlock x:Name="macg" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,30,80,0">
<TextBlock x:Name="state" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,30,0,0" HorizontalAlignment="Right" Width="80">
<TextBlock x:Name="type_N" TextWrapping="Wrap" Text="-------" FontSize="16" />
</Border>
<Border BorderBrush="#FFE0E0E0" BorderThickness="1" Height="30" VerticalAlignment="Top" Margin="150,60,0,0">
<TextBlock x:Name="WorkingStatus" TextWrapping="Wrap" Text="------" FontSize="16" />
</Border>
<Button x:Name="State" Content="{x:Static lang:Resources.Information}" HorizontalAlignment="Right" Height="35" Margin="0,0,15,10" VerticalAlignment="Bottom" Width="80" Click="State_Click" Padding="0,4,0,4"/>
<Button x:Name="Manual" Content="{x:Static lang:Resources.Manual}" HorizontalAlignment="Right" Height="35" Margin="0,0,115,10" VerticalAlignment="Bottom" Width="80" Click="Manual_Click" Padding="0,4,0,4"/>
<Button x:Name="Screen" Content="{x:Static lang:Resources.Screen}" HorizontalAlignment="Right" Height="35" Margin="0,0,215,10" VerticalAlignment="Bottom" Width="80" Click="Screen_Click" Padding="0,4,0,4"/>
<materialDesign:PackIcon x:Name="mlock" Kind="Lock" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="40" Height="40" Foreground="#FFA98C00" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="0,0,0,5"/>
<materialDesign:PackIcon x:Name="Disconnect" Kind="LanDisconnect" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="40" Height="40" Foreground="#FFA98C00" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="50,0,0,5"/>
</Grid>
<TextBlock x:Name="IP" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
<TextBlock x:Name="PORT" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
<TextBlock x:Name="USER" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
<TextBlock x:Name="PASSWD" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
<TextBlock x:Name="type_" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
</Grid>
</UserControl>
+73
View File
@@ -0,0 +1,73 @@
using ScottPlot.Plottables;
using SunlightCentralizedControlManagement_SCCM_.EX;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace SunlightCentralizedControlManagement_SCCM_.UserControls
{
/// <summary>
/// info.xaml 的交互逻辑
/// </summary>
public partial class DispenseMacInfo : UserControl
{
public DispenseMacInfo()
{
InitializeComponent();
}
private void State_Click(object sender, RoutedEventArgs e)//状态
{
if ((mlock.Visibility == Visibility.Visible) || (Disconnect.Visibility == Visibility.Visible))
{
MessageBox.Show(Properties.Resources.Not_a,"Dispense",MessageBoxButton.OK);
return;
}
UserMessage userMessage = new UserMessage();
userMessage.DispenseMacInfo(mac.Text, macg.Text);
userMessage.Show();
}
private void Manual_Click(object sender, RoutedEventArgs e)//手动呼叫
{
if ((mlock.Visibility == Visibility.Visible) || (Disconnect.Visibility == Visibility.Visible))
{
MessageBox.Show(Properties.Resources.Not_a, "Dispense", MessageBoxButton.OK);
return;
}
ManualDyelot manualDyelot = new ManualDyelot();
manualDyelot.MAC(mac.Text,Convert.ToInt16(type_.Text));
manualDyelot.Show();
}
private void Screen_Click(object sender, RoutedEventArgs e)//远程画面
{
if ((mlock.Visibility == Visibility.Visible)||(Disconnect.Visibility == Visibility.Visible))
{
MessageBox.Show(Properties.Resources.Not_a, "Dispense", MessageBoxButton.OK);
return;
}
VNC screen = new VNC();
screen.Parameter(IP.Text,PORT.Text,USER.Text,PASSWD.Text);
screen.Show();
}
}
}
+19 -14
View File
@@ -5,20 +5,25 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.UserControls" xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.UserControls"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties" xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
mc:Ignorable="d" xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
mc:Ignorable="d"
Loaded="UserControl_Loaded"
d:DesignHeight="400" d:DesignWidth="300" Background="White"> d:DesignHeight="400" d:DesignWidth="300" Background="White">
<Grid> <Grid Background="#FFBFBFBF">
<TextBlock x:Name="name" VerticalAlignment="Top" Height="50" Background="#FF646464" Text="-----" FontWeight="Bold" FontSize="36" /> <TextBlock x:Name="name" VerticalAlignment="Top" Height="50" Background="#FF646464" Text="-----" FontWeight="Bold" FontSize="36" />
<TextBlock x:Name="temp" VerticalAlignment="Top" Height="50" Text="---.-°C" FontWeight="Bold" FontSize="36" HorizontalAlignment="Right" Padding="5,0,5,0"/> <TextBlock x:Name="temp" VerticalAlignment="Top" Height="50" Text="---.-°C" FontWeight="Bold" FontSize="36" HorizontalAlignment="Right" Padding="5,0,5,0"/>
<TextBlock Text="{x:Static lang:Resources.process}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,50,5,0" VerticalAlignment="Top" Focusable="False"/> <Grid Margin="2,50,2,2" Background="White">
<TextBlock Text="{x:Static lang:Resources.Step}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,100,5,0" VerticalAlignment="Top" Focusable="False"/> <TextBlock Text="{x:Static lang:Resources.process}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,0,5,0" VerticalAlignment="Top" Focusable="False"/>
<TextBlock Text="{x:Static lang:Resources.message}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,150,5,0" VerticalAlignment="Top" Focusable="False"/> <TextBlock Text="{x:Static lang:Resources.Step}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,50,5,0" VerticalAlignment="Top" Focusable="False"/>
<TextBlock Text="{x:Static lang:Resources.orders}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,200,5,0" VerticalAlignment="Top" Focusable="False"/> <TextBlock Text="{x:Static lang:Resources.message}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,100,5,0" VerticalAlignment="Top" Focusable="False"/>
<TextBlock x:Name="time" Text="----------------------------" Height="30" FontWeight="Bold" FontSize="24" Margin="5,250,5,0" VerticalAlignment="Top" Focusable="False"/> <TextBlock Text="{x:Static lang:Resources.orders}" Height="30" FontWeight="Bold" FontSize="24" Margin="5,150,5,0" VerticalAlignment="Top" Focusable="False"/>
<local:RoilingTextBlock Foreground="Black" x:Name="Process" Text="NO Information" FontSize="21" Height="30" Margin="120,50,0,0" VerticalAlignment="Top"/> <TextBlock x:Name="time" Text="----------------------------" Height="30" FontWeight="Bold" FontSize="24" Margin="5,180,5,0" VerticalAlignment="Top" Focusable="False"/>
<local:RoilingTextBlock Foreground="Black" x:Name="Step" Text="NO Information" FontSize="21" Height="30" Margin="120,100,0,0" VerticalAlignment="Top"/> <local:RoilingTextBlock Foreground="Black" x:Name="Process" Text="NO Information" FontSize="21" Height="30" Margin="120,0,0,0" VerticalAlignment="Top"/>
<local:RoilingTextBlock Foreground="Black" x:Name="Message" Text="NO Information" FontSize="21" Height="30" Margin="120,150,0,0" VerticalAlignment="Top"/> <local:RoilingTextBlock Foreground="Black" x:Name="Step" Text="NO Information" FontSize="21" Height="30" Margin="120,50,0,0" VerticalAlignment="Top"/>
<local:RoilingTextBlock Foreground="Black" x:Name="Orders" Text="NO Information" FontSize="21" Height="30" Margin="120,200,0,0" VerticalAlignment="Top"/> <local:RoilingTextBlock Foreground="Black" x:Name="Message" Text="NO Information" FontSize="21" Height="30" Margin="120,100,0,0" VerticalAlignment="Top"/>
<StackPanel x:Name="log" Margin="0,300,0,0"/> <local:RoilingTextBlock Foreground="Black" x:Name="Orders" Text="NO Information" FontSize="21" Height="30" Margin="120,150,0,0" VerticalAlignment="Top"/>
<lvc:CartesianChart x:Name="OscChart" Margin="0,200,0,0" EasingFunction="{x:Null}" ZoomMode="PanX"
Series="{Binding Series}" YAxes="{Binding YAxes}" XAxes="{Binding XAxes}"/>
</Grid>
</Grid> </Grid>
</UserControl> </UserControl>
+129 -14
View File
@@ -1,8 +1,22 @@
using ScottPlot.Plottables; using LiveChartsCore;
using LiveChartsCore.Defaults;
using LiveChartsCore.Kernel.Sketches;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Painting;
using Newtonsoft.Json.Linq;
using ScottPlot;
using ScottPlot.Plottables;
using ScottPlot.Statistics;
using SkiaSharp;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Data;
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
using System.Linq; using System.Linq;
using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@@ -23,27 +37,128 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
/// <summary> /// <summary>
/// info.xaml 的交互逻辑 /// info.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class info : UserControl public partial class info : UserControl, INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
if (propertyName != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
private ObservableCollection<DateTimePoint> MTH_values = new ObservableCollection<DateTimePoint>();
public ObservableCollection<ISeries> _series { get; set; }
public ObservableCollection<ISeries> Series
{
get => _series;
set
{
_series = value;
OnPropertyChanged(nameof(Series));
}
}
//x轴时间格式
public Axis[] XAxes { get; set; } =
{
new DateTimeAxis(TimeSpan.FromSeconds(5) , date => date.ToString("HH:mm"))
{
MinLimit = DateTime.Now.AddHours(-6).Ticks,
MaxLimit = DateTime.Now.AddHours(0.5).Ticks,
CrosshairLabelsBackground = SKColors.DarkGray.AsLvcColor(),
CrosshairLabelsPaint = new SolidColorPaint(SKColors.DarkSlateBlue, 1),
CrosshairPaint = new SolidColorPaint(SKColors.DarkSlateGray, 1),
},
};
//颜色
private static readonly SKColor s_blue = new SKColor(25, 118, 210);
private static readonly SKColor s_red = new SKColor(229, 57, 53);
public ICartesianAxis[] YAxes { get; set; } ={
new Axis //y在此轴上缩放
{
MinLimit =0,
MaxLimit =160,
NamePadding = new LiveChartsCore.Drawing.Padding(0, 20),
Padding = new LiveChartsCore.Drawing.Padding(0, 0, 20, 0),
TextSize = 12,
LabelsPaint = new SolidColorPaint(s_blue),
TicksPaint = new SolidColorPaint(s_blue),
SubticksPaint = new SolidColorPaint(s_blue),
DrawTicksPath = true,
CrosshairSnapEnabled = true,
Position = LiveChartsCore.Measure.AxisPosition.Start
},//温度轴
};
public info() public info()
{ {
InitializeComponent(); InitializeComponent();
CountDown(); DataContext = this;
} }
private void CountDown() public void DataAdd(DateTime dateTime, double dat)
{ {
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick Dispatcher.Invoke(() =>
{
// 添加新数据点
MTH_values.Add(new DateTimePoint(dateTime, dat));
// 更新X轴范围,始终保持最近6小时
XAxes[0].MinLimit = dateTime.AddHours(-6).Ticks;
XAxes[0].MaxLimit = dateTime.AddMinutes(1).Ticks;
// 移除6小时前的旧数据
while (MTH_values.Count > 0 &&
MTH_values[0].DateTime < dateTime.AddHours(-6))
{
MTH_values.RemoveAt(0);
}
});
}
public void DataROW(DataRow[] dataRows)
{
DateTime dateTime = DateTime.Now;
foreach (DataRow row in dataRows)
{ {
Interval = TimeSpan.FromSeconds(10)//秒 // 添加新数据点
}; MTH_values.Add(new DateTimePoint((DateTime)row["DateTime"], (double)row["DAT"]));
timer1s.Tick += Tick_Event_1S; }
timer1s.Start(); Dispatcher.Invoke(() =>
}//时间周期初始化 {
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S // 更新X轴范围,始终保持最近6小时
{ XAxes[0].MinLimit = dateTime.AddHours(-6).Ticks;
XAxes[0].MaxLimit = dateTime.AddMinutes(1).Ticks;
});
} }
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
// 初始化系列
Series = new ObservableCollection<ISeries>
{
new LineSeries<DateTimePoint>
{
Name = Properties.Resources.Temperature,
Values = MTH_values,
Stroke = new SolidColorPaint(s_red, 2),
GeometrySize = 0,
GeometryStroke = new SolidColorPaint(s_red, 2),
Fill = null,
LineSmoothness = 0,
ScalesYAt = 0,
}
};
}
}
} }
+24 -6
View File
@@ -13,7 +13,10 @@
Loaded="UserControl_Loaded" Loaded="UserControl_Loaded"
d:DesignHeight="900" d:DesignWidth="1800"> d:DesignHeight="900" d:DesignWidth="1800">
<UserControl.Resources> <UserControl.Resources>
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/> <ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}" <DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
@@ -21,7 +24,7 @@
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30" Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
Margin="0,0,0,60" HorizontalAlignment="Right" Width="300" MouseDoubleClick="Griddata_MouseDoubleClick"> Margin="0,0,0,60" HorizontalAlignment="Right" Width="330" MouseDoubleClick="Griddata_MouseDoubleClick">
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" /> <Setter Property="Height" Value="30" />
@@ -52,11 +55,26 @@
</DataGrid.CellStyle> </DataGrid.CellStyle>
<DataGrid.Columns> <DataGrid.Columns>
<!--列信息绑定--> <!--列信息绑定-->
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}"> <DataGridTemplateColumn Width="100" Header="{x:Static lang:Resources.State}">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center" <UniformGrid VerticalAlignment="Bottom" HorizontalAlignment="Left">
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/> <Border>
<Grid>
<StackPanel Width="100" Orientation="Horizontal">
<materialDesign:PackIcon Width="25" Height="30"
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
<materialDesign:PackIcon Width="25" Height="30" Kind="Lock"
Visibility="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
<materialDesign:PackIcon Width="25" Height="30" Kind="HandBackRight"
Visibility="{Binding Path=AUTO,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
</StackPanel>
</Grid>
</Border>
</UniformGrid>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
@@ -68,7 +86,7 @@
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30" Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
VerticalAlignment="Top" Height="500" Margin="0,0,300,0" MouseDoubleClick="GridWorkOrder_MouseDoubleClick" > VerticalAlignment="Top" Height="500" Margin="0,0,330,0" MouseDoubleClick="GridWorkOrder_MouseDoubleClick" >
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" /> <Setter Property="Height" Value="30" />
@@ -165,7 +183,7 @@
</ListView> </ListView>
</StackPanel> </StackPanel>
<Grid Background="White" Margin="0,500,300,60"> <Grid Background="White" Margin="0,500,330,60">
<ContentControl x:Name="Picture"/> <ContentControl x:Name="Picture"/>
</Grid> </Grid>
</Grid> </Grid>
+11 -40
View File
@@ -28,9 +28,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
/// </summary> /// </summary>
public partial class CurveView : UserControl public partial class CurveView : UserControl
{ {
private SQLiteHelper SQLiteHelpers = null; //定义数据库 public static DataTable WorkOrder = new DataTable(); //物料缓存
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
public static DataTable WorkOrder = new DataTable(); //物料缓存
public static string CurveDiagram; public static string CurveDiagram;
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
private string SYS_machines =null; private string SYS_machines =null;
@@ -62,11 +60,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void UserControl_Loaded(object sender, RoutedEventArgs e) private void UserControl_Loaded(object sender, RoutedEventArgs e)
{ {
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd"); Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd");
Picture.Content = new View.CurveDiagram(false,"","","", CurveDiagram); Picture.Content = new View.CurveDiagram(false,"","","", CurveDiagram);
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
} }
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e) private void WorkOrderNumder_Click(object sender, RoutedEventArgs e)
@@ -83,24 +79,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"), Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"),
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram); DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
SQLiteHelpers.Open(); //打开数据库
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" + DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" +
SYS_machines + "'", null).Tables[0]; //读取表写入缓存 SYS_machines + "'", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
GridWorkOrder.ItemsSource = WorkOrder.DefaultView; GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
} }
else else
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
SQLiteHelpers.Open(); //打开数据库
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" + DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'", null).Tables[0]; //读取表写入缓存 DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
GridWorkOrder.ItemsSource = WorkOrder.DefaultView; GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
} }
@@ -114,24 +104,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"), Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"),
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram);//刷新图表 DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram);//刷新图表
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
SQLiteHelpers.Open(); //打开数据库
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" + DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" +
SYS_machines + "'", null).Tables[0]; //读取表写入缓存 SYS_machines + "'", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
GridWorkOrder.ItemsSource = WorkOrder.DefaultView; GridWorkOrder.ItemsSource = WorkOrder.DefaultView; }
}
else else
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
SQLiteHelpers.Open(); //打开数据库
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" + DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'", null).Tables[0]; //读取表写入缓存 DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
GridWorkOrder.ItemsSource = WorkOrder.DefaultView; GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
} }
@@ -145,24 +128,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"), Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"),
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram); DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd"), CurveDiagram);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
SQLiteHelpers.Open(); //打开数据库
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" + DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" +
SYS_machines + "'", null).Tables[0]; //读取表写入缓存 SYS_machines + "'", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
GridWorkOrder.ItemsSource = WorkOrder.DefaultView; GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
} }
else else
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
SQLiteHelpers.Open(); //打开数据库
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" + DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'", null).Tables[0]; //读取表写入缓存 DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
GridWorkOrder.ItemsSource = WorkOrder.DefaultView; GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
} }
@@ -176,13 +153,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
SYS_machines = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列, SYS_machines = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
mac.Text = SYS_machines; mac.Text = SYS_machines;
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
SQLiteHelpers.Open(); //打开数据库
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime<='" +
DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" + DateTime.Parse(Sdatepicker.Text).AddDays(1).ToString("yyyy/MM/dd") + "' and StartTime>='" +
DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd") + "'and Machines='" +
SYS_machines + "'", null).Tables[0]; //读取表写入缓存 SYS_machines + "'", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
GridWorkOrder.ItemsSource = WorkOrder.DefaultView; GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"), Picture.Content = new View.CurveDiagram(false, SYS_machines, DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd"),
@@ -206,10 +180,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
string SysTime = DateTime.Parse(sender.ToString()).ToString("yyyy/MM/dd"); string SysTime = DateTime.Parse(sender.ToString()).ToString("yyyy/MM/dd");
string SysTimeDays = DateTime.Parse(sender.ToString()).AddDays(1).ToString("yyyy/MM/dd"); string SysTimeDays = DateTime.Parse(sender.ToString()).AddDays(1).ToString("yyyy/MM/dd");
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where " + "StartTime>='" + SysTime + "'and StartTime<='" + SysTimeDays + "'", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Open(); //打开数据库
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where " + "StartTime>='" + SysTime + "'and StartTime<='" + SysTimeDays + "'", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
GridWorkOrder.ItemsSource = WorkOrder.DefaultView; GridWorkOrder.ItemsSource = WorkOrder.DefaultView;
} }
+94
View File
@@ -0,0 +1,94 @@
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.DispenseMachinesSet"
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:SunlightCentralizedControlManagement_SCCM_.View"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
mc:Ignorable="d"
Loaded="UserControl_Loaded"
d:DesignHeight="900" d:DesignWidth="1200">
<UserControl.Resources>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
</UserControl.Resources>
<Grid>
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
Background="#FFC7C7C7" HorizontalGridLinesBrush="{x:Null}" VerticalGridLinesBrush="#FFC9C9C9"
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
HorizontalAlignment="Right" Width="500" MouseDoubleClick="Griddata_MouseDoubleClick">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="25" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="210" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Group}" Binding="{Binding Groups}" Width="210" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding IP}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding PORT}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding User}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Passsword}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding LOCK}" Width="0" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
<Image HorizontalAlignment="Left" x:Name="IMAGE" VerticalAlignment="Bottom" Width="400" Height="400" Margin="10,200,0,100" />
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" FontSize="20" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,150,0,0" x:Name="User" VerticalAlignment="Top" Width="270" FontSize="20" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,150,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,200,0,0" x:Name="Password" VerticalAlignment="Top" Width="270" FontSize="20" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,200,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Password}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<CheckBox x:Name="dLICK" Content="{x:Static lang:Resources._lock}" HorizontalAlignment="Left" Height="35 " Margin="10,250,0,0" VerticalAlignment="Top" Width="200" FontSize="20"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="TextMachineGroup" VerticalAlignment="Top" Width="270" FontSize="20"
DropDownClosed="TextMachineGroup_DropDownClosed" TextBoxBase.TextChanged="TextMachineGroup_DropDownClosed"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,50,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.MachineGroup}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,100,0,0" x:Name="IP" VerticalAlignment="Top" Width="200" FontSize="20" MaxLines="1"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="350,100,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" Width="20" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="360,100,0,0" x:Name="PORT" VerticalAlignment="Top" Width="60" FontSize="20" MaxLines="1" Text="5901"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,100,0,0" TextWrapping="Wrap" Text="IP/PORT" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,600,0,15" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Bottom" Width="140" FontSize="20"/>
<Button Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Left" Height="35" Margin="250,600,0,15" VerticalAlignment="Bottom" Width="80" Click="Save_Click"/>
<Button Content="{x:Static lang:Resources.Delete}" HorizontalAlignment="Left" Height="35" Margin="340,600,0,15" VerticalAlignment="Bottom" Width="80" Click="Delete_Click"/>
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="160,600,50,15" VerticalAlignment="Bottom" Width="80" Click="Test_Click"/>
</Grid>
</UserControl>
+272
View File
@@ -0,0 +1,272 @@
using SkiaSharp;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
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 static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
namespace SunlightCentralizedControlManagement_SCCM_.View
{
/// <summary>
/// MachinesSet.xaml 的交互逻辑
/// </summary>
public partial class DispenseMachinesSet : UserControl
{
int type_;
public DispenseMachinesSet()
{
InitializeComponent();
//
string[] Machine_ = { "252", "252RB", "252-2T", "252RDRM", "242W", "302", "303", "303PDW" };
TextMachineGroup.ItemsSource = Machine_;
}
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
//private string SYS_machines = null;
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
DataTable dataTable = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from MachinesDispense Order by id", null).Tables[0];
Griddata.ItemsSource = dataTable.DefaultView;
}
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
comboBoxMachine.Text = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
TextMachineGroup.Text = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
IP.Text = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
PORT.Text = (Griddata.Columns[4].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
User.Text = (Griddata.Columns[5].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
Password.Text = (Griddata.Columns[6].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
string TYR= (Griddata.Columns[7].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;
dLICK.IsChecked = Convert.ToBoolean((Griddata.Columns[7].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text);//定位第列,
}
}
private void Save_Click(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(comboBoxMachine.Text) && !string.IsNullOrEmpty(TextMachineGroup.Text) && !string.IsNullOrEmpty(IP .Text))
{
WriteableBitmap wb = new WriteableBitmap((BitmapSource)IMAGE.Source);
byte[] imageData = SourceToArray(wb);
Dictionary<string, object> dr_new = new Dictionary<string, object>();//缓存函数
dr_new.Add("Name", comboBoxMachine.Text);
dr_new.Add("Groups", TextMachineGroup.Text);
dr_new.Add("IP", IP.Text);
dr_new.Add("PORT", PORT.Text);
dr_new.Add("type", type_);
dr_new.Add("State", "899");
dr_new.Add("User", User.Text);
dr_new.Add("Password", Password.Text);
dr_new.Add("LOCK", dLICK.IsChecked.ToString());
dr_new.Add("DATA",imageData);
if (MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from MachinesDispense where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
{
MainWindowViewModel.SQLiteHelpers.InsertData("MachinesDispense", dr_new);
}
else
{
MainWindowViewModel.SQLiteHelpers.Update("MachinesDispense", dr_new, "name='" + comboBoxMachine.Text + "'", null);
}
Griddata.ItemsSource = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select Name,Groups,IP,PORT,DATA from MachinesDispense Order by id", null).Tables[0].DefaultView;
MessageBox.Show(Properties.Resources.Save + comboBoxMachine.Text, "SCCM", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
MessageBox.Show(Properties.Resources.ERR , "SCCM", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
private void Delete_Click(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
{
MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码
{
MainWindowViewModel.SQLiteHelpers.Delete("MachinesDispense", "Name='" + comboBoxMachine.Text + "'", null);
Griddata.ItemsSource = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select Name,Groups,IP,PORT,DATA from MachinesDispense Order by id", null).Tables[0].DefaultView;
comboBoxMachine.Text = null;
}
}
else
{
textlog.Text = "Invalid";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
private void Test_Click(object sender, RoutedEventArgs e)//测试按钮
{
if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text))
{
textlog.Text = "TEST";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
//------------使用ping类------
string host = IP.Text;
Ping p1 = new Ping();
PingReply reply = p1.Send(host); //发送主机名或Ip地址
//StringBuilder sbuilder;
if (reply.Status == IPStatus.Success)
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//连接服务器,绑定IP 与 端口
IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Parse(IP.Text), int.Parse(PORT.Text));
try
{
socket.Connect(iPEndPoint);
socket.Close();//离线
textlog.Text = "Link succeed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
}
catch (Exception)
{
textlog.Text = "Link failed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
}
}
else if (reply.Status == IPStatus.TimedOut)
{
textlog.Text = "Link timeout";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
else
{
textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
else
{
textlog.Text = "Invalid";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
private void TextMachineGroup_DropDownClosed(object sender, EventArgs e)
{
Uri uri;
BitmapImage bitmapImage;
switch (TextMachineGroup.Text)//步骤用时计算
{
case "252":
uri = new Uri("pack://application:,,,/LOGO/252-2t.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "252-2T":
uri = new Uri("pack://application:,,,/LOGO/252-2t.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "252RB":
uri = new Uri("pack://application:,,,/LOGO/252RB.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "252RDRM":
uri = new Uri("pack://application:,,,/LOGO/252RMRD.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "242W":
uri = new Uri("pack://application:,,,/LOGO/242w.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 1;
break;
case "302":
uri = new Uri("pack://application:,,,/LOGO/302.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 2;
break;
case "303":
uri = new Uri("pack://application:,,,/LOGO/303.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 3;
break;
case "302PDW":
uri = new Uri("pack://application:,,,/LOGO/303pdw.png");
bitmapImage = new BitmapImage(uri);
IMAGE.Source = bitmapImage;
type_ = 3;
break;
default:
break;
}
}
public static byte[] BitmapImageToByteArray(BitmapImage bmp)
{
byte[] byteArray = null;
try
{
Stream sMarket = bmp.StreamSource;
if (sMarket != null && sMarket.Length > 0)
{
//很重要,因为Position经常位于Stream的末尾,导致下面读取到的长度为0。
sMarket.Position = 0;
using (BinaryReader br = new BinaryReader(sMarket))
{
byteArray = br.ReadBytes((int)sMarket.Length);
}
}
}
catch
{
//other exception handling
}
return byteArray;
}
public static byte[] SourceToArray(WriteableBitmap source)
{
byte[] byteArray = null;
try
{
using (MemoryStream ms = new MemoryStream())
{
JpegBitmapEncoder coder = new JpegBitmapEncoder();
coder.QualityLevel = 100;
coder.Frames.Add(BitmapFrame.Create(source));
coder.Save(ms);
byteArray = ms.ToArray();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
}
return byteArray;
}
}
}
+29
View File
@@ -0,0 +1,29 @@
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.DispenseView"
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:SunlightCentralizedControlManagement_SCCM_.View"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
mc:Ignorable="d"
Loaded="UserControl_Loaded"
d:DesignHeight="900" d:DesignWidth="1200">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<ScrollViewer Margin="0" VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Horizontal" x:Name="DispenseMacView" Background="White">
</WrapPanel>
</ScrollViewer>
</Grid>
<StackPanel Grid.Row="1" Height="60" Background="#FF00204E" Orientation="Horizontal">
</StackPanel>
</Grid>
</UserControl>
+180
View File
@@ -0,0 +1,180 @@
using LiveChartsCore.Geo;
using SkiaSharp;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.UserControls;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using SunlightCentralizedControlManagement_SCCM_.ConvertMoels;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Numerics;
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 static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using System.Windows.Threading;
using Newtonsoft.Json.Linq;
using System.Xml.Linq;
using static System.Windows.Forms.AxHost;
namespace SunlightCentralizedControlManagement_SCCM_.View
{
/// <summary>
/// MachinesSet.xaml 的交互逻辑
/// </summary>
public partial class DispenseView : UserControl
{
public DispenseView()
{
InitializeComponent();
}
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
DataTable DispenseMac = new DataTable();
UserControls.DispenseMacInfo[] dispenseMacInfo = new UserControls.DispenseMacInfo[99]; //定义总览信息卡
//private string SYS_machines = null;
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
DispenseMac = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from MachinesDispense ", null).Tables[0];//缓存
/// <summary>
/// 生成总览信息卡
/// </summary>
for (int i = 0; i < DispenseMac.Rows.Count; i++)
{
string x = DispenseMac.AsEnumerable().Select(row => row.Field<string>("State")).ElementAt(i);
bool y = DispenseMac.AsEnumerable().Select(row => row.Field<bool>("LOCK")).ElementAt(i);
dispenseMacInfo[i] = new UserControls.DispenseMacInfo();
dispenseMacInfo[i].Margin = new Thickness(5, 5, 0, 5);
dispenseMacInfo[i].Width = 400;
dispenseMacInfo[i].Height = 600;
dispenseMacInfo[i].IP.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("IP")).ElementAt(i);
dispenseMacInfo[i].USER.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("User")).ElementAt(i);
dispenseMacInfo[i].PORT.Text = DispenseMac.AsEnumerable().Select(row => row.Field<int>("PORT")).ElementAt(i).ToString();
dispenseMacInfo[i].PASSWD.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("Password")).ElementAt(i);
dispenseMacInfo[i].type_.Text = DispenseMac.AsEnumerable().Select(row => row.Field<int>("type")).ElementAt(i).ToString();
dispenseMacInfo[i].type_N.Text = StatenClassConvert.Convert(DispenseMac.AsEnumerable().Select(row => row.Field<int>("type")).ElementAt(i));
dispenseMacInfo[i].mac.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("name")).ElementAt(i);
dispenseMacInfo[i].macg.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("Groups")).ElementAt(i);
dispenseMacInfo[i].state.Text = StatenClassConvert.Convert(x);
if (x == "899")
{
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
else
{
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
}
dispenseMacInfo[i].WorkingStatus.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("WorkingStatus")).ElementAt(i);
if (y)
{
dispenseMacInfo[i].mlock.Visibility = Visibility.Visible;
}
else
{
dispenseMacInfo[i].mlock.Visibility = Visibility.Collapsed;
}
//dispenseMacInfo[i].name.Text = Selet_Machines(MainWindowViewModel.Machines, "name", i).ToString();
// dispenseMacInfo[i].IMAGE = ;
MemoryStream memoryStream = new MemoryStream(DispenseMac.AsEnumerable().Select(row => row.Field<byte[]>("DATA")).ElementAt(i));
//数据流生成图片显示
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.StreamSource = memoryStream;
bitmapImage.EndInit();
dispenseMacInfo[i].IMAGE.Source = bitmapImage;
DispenseMacView.Children.Add(dispenseMacInfo[i]);
CountDown();
}
}
private void CountDown()
{
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每10秒调用一次Tick
{
Interval = TimeSpan.FromSeconds(10)//秒
};
timer1s.Tick += Tick_Event_1S;
timer1s.Start();
}//时间周期初始化
async void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{
for (int i = 0; i < DispenseMac.Rows.Count; i++)
{
if (await PingTest(dispenseMacInfo[i].IP.Text))
{
DataRow drEmployee = DispenseMac.Select("IP='" + dispenseMacInfo[i].IP.Text + "'").First();
drEmployee.BeginEdit();
drEmployee["State"] = "802";
drEmployee.EndEdit();
drEmployee.AcceptChanges();
drEmployee.ClearErrors();
}
string x = DispenseMac.AsEnumerable().Select(row => row.Field<string>("State")).ElementAt(i);
bool y = DispenseMac.AsEnumerable().Select(row => row.Field<bool>("LOCK")).ElementAt(i);
dispenseMacInfo[i].state.Text = StatenClassConvert.Convert(x);
dispenseMacInfo[i].WorkingStatus.Text = DispenseMac.AsEnumerable().Select(row => row.Field<string>("WorkingStatus")).ElementAt(i);
if (x == "899")
{
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0));
dispenseMacInfo[i].Disconnect.Visibility = Visibility.Visible;
}
else
{
dispenseMacInfo[i].state.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
dispenseMacInfo[i].Disconnect.Visibility = Visibility.Collapsed;
}
if (y)
{
dispenseMacInfo[i].mlock.Visibility = Visibility.Visible;
}
else
{
dispenseMacInfo[i].mlock.Visibility = Visibility.Collapsed;
}
}
}
private async Task<bool> PingTest(string ip)
{
bool result = false;
Ping pingSender = new Ping();
try
{
PingReply reply = await pingSender.SendPingAsync(ip, 3000);
if (reply.Status == IPStatus.Success)
{
result = true;
}
}
catch (PingException )
{
result = false;
}
return result;
}
}
}
+107 -24
View File
@@ -6,18 +6,24 @@
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View" xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties" xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
mc:Ignorable="d" Loaded="UserControl_Loaded" mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DesignHeight="900" d:DesignWidth="1100"> d:DesignHeight="900" d:DesignWidth="1100">
<UserControl.Resources>
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
</UserControl.Resources>
<Grid Background="White" Cursor=""> <Grid Background="White" Cursor="">
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,30,10,0" x:Name="comboBoxWorkOrder" VerticalAlignment="Top" Width="270" <ComboBox HorizontalAlignment="Left" Height="40" Margin="140,30,10,0" x:Name="comboBoxWorkOrder" VerticalAlignment="Top" Width="270"
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxWorkOrder_KeyDown"/> FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxWorkOrder_KeyDown"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270" <ComboBox HorizontalAlignment="Left" Height="40" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270"
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxDyelot_KeyDown" /> FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" KeyDown="comboBoxDyelot_KeyDown" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,80,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Dyelot}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,130,10,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" <ComboBox HorizontalAlignment="Left" Height="40" Margin="140,130,10,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270"
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" IsReadOnly="True" /> FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" IsReadOnly="True" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
@@ -25,38 +31,59 @@
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="360,180,280,0" x:Name="color" TextWrapping="Wrap" <TextBlock HorizontalAlignment="Left" Height="40" Margin="360,180,280,0" x:Name="color" TextWrapping="Wrap"
VerticalAlignment="Top" Width="50" Background="#FF336FA8" MouseDown="color_color_MouseDoubleClick"/> VerticalAlignment="Top" Width="50" Background="#FF336FA8" MouseDown="color_color_MouseDoubleClick"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,180,10,0" x:Name="TEXTColorNumber" VerticalAlignment="Top" Width="200" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,180,10,0" x:Name="TEXTColorNumber" VerticalAlignment="Top" Width="200"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,230,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ColorName}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,230,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ColorName}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,230,10,0" x:Name="TEXTColorName" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,230,10,0" x:Name="TEXTColorName" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,280,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Client}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,280,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Client}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,280,10,0" x:Name="TEXTClient" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,280,10,0" x:Name="TEXTClient" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,330,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothSpecies}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,330,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothSpecies}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,330,10,0" x:Name="TEXTClothSpecies" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,330,10,0" x:Name="TEXTClothSpecies" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,380,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWeight}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,380,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWeight}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,380,10,0" x:Name="TEXTClothWeight" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,380,10,0" x:Name="TEXTClothWeight" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTClothWeight" InputMethod.IsInputMethodEnabled="False"/> FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTClothWeight" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,430,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.BathRatio}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,430,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.BathRatio}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,430,10,0" x:Name="TEXTBathRatio" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,430,10,0" x:Name="TEXTBathRatio" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTBathRatio" InputMethod.IsInputMethodEnabled="False"/> FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTBathRatio" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,480,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,480,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Total}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,480,10,0" x:Name="TEXTTotal" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,480,10,0" x:Name="TEXTTotal" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTTotal" InputMethod.IsInputMethodEnabled="False"/> FontSize="15" BorderBrush="#FF673AB7" PreviewTextInput="Tb_KeyTEXTTotal" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,530,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}" <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,530,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}"
VerticalAlignment="Top" Width="120" FontSize="25"/> VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="140,530,10,0" x:Name="TEXTUSER" VerticalAlignment="Top" Width="270" <TextBox HorizontalAlignment="Left" Height="40" Margin="140,530,10,0" x:Name="TEXTUSER" VerticalAlignment="Top" Width="270"
FontSize="15" BorderBrush="#FF673AB7" /> FontSize="15" BorderBrush="#FF673AB7" />
<ComboBox HorizontalAlignment="Right" Height="30" Margin="150,30,50,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="470" <TextBlock HorizontalAlignment="Right" Height="40" Margin="10,80,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Pump}"
VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="40" Margin="140,80,380,0" x:Name="PumpSpeed" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,80,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Blower}"
VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="40" Margin="360,80,50,0" x:Name="Blower" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,130,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Swing}"
VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="40" Margin="140,130,380,0" x:Name="Swing" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Right" Height="40" Margin="240,130,150,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.ClothWheel}"
VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="40" Margin="360,130,50,0" x:Name="ClothWheel" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" />
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,180,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Nozzle}"
VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Right" Height="40" Margin="140,180,380,0" x:Name="Nozzle" VerticalAlignment="Top" Width="100"
FontSize="15" BorderBrush="#FF673AB7" />
<ComboBox HorizontalAlignment="Right" Height="40" Margin="150,30,50,0" x:Name="comboBoxProgram" VerticalAlignment="Top" Width="470"
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxProgram_DropDownClosed" FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxProgram_DropDownClosed"
TextBoxBase.TextChanged="comboBoxProgram_TextChanged"/> TextBoxBase.TextChanged="comboBoxProgram_TextChanged"/>
<TextBlock HorizontalAlignment="Right" Height="40" Margin="10,30,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}" <TextBlock HorizontalAlignment="Right" Height="40" Margin="10,30,480,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.process}"
@@ -66,10 +93,10 @@
GridLinesVisibility="All" ColumnHeaderHeight="40" MouseDoubleClick="Grid_data_MouseDoubleClick" GridLinesVisibility="All" ColumnHeaderHeight="40" MouseDoubleClick="Grid_data_MouseDoubleClick"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30" Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
Margin="0,100,10,60" Width="600" HorizontalAlignment="Right" BorderBrush="#FFC9C9C9" FontSize="16" BorderThickness="5,5,5,5" > Margin="0,250,10,60" Width="600" HorizontalAlignment="Right" BorderBrush="#FFC9C9C9" FontSize="16" BorderThickness="5,5,5,5" >
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="25" /> <Setter Property="Height" Value="100" />
<Setter Property="FontSize" Value="15" /> <Setter Property="FontSize" Value="15" />
<Style.Triggers> <Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0"> <Trigger Property="ItemsControl.AlternationIndex" Value="0">
@@ -106,20 +133,76 @@
<!--列信息绑定--> <!--列信息绑定-->
<DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="40" IsReadOnly="True" /> <DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}"
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="0" MinWidth="0" MaxWidth="0" Binding="{Binding StepID}" IsReadOnly="True"/> Width="60" IsReadOnly="True">
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="150" Binding="{Binding StepName}" IsReadOnly="True"/> <DataGridTextColumn.ElementStyle>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="*" Binding="{Binding ParameterName}" IsReadOnly="True"/> <Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepID}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepName}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding ParameterName}" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter6}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="100" IsReadOnly="True">
<DataGridTextColumn Binding="{Binding Parameter7}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTemplateColumn.CellTemplate>
<DataGridTextColumn Binding="{Binding Parameter8}" Width="0" MinWidth="0" MaxWidth="0"/> <DataTemplate>
<DataGridTextColumn Binding="{Binding Parameter9}" Width="0" MinWidth="0" MaxWidth="0"/> <Image Source="{Binding Path=StepID,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
<DataGridTextColumn Binding="{Binding Parameter10}" Width="0" MinWidth="0" MaxWidth="0"/> </DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="300" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0,0,0.5">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.Function}"/>
<Run Text=":"/>
<Run Text="{Binding StepName}"/>
</TextBlock>
</Border>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0.5,0,0">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.ParameterSet}"/>
<Run Text=":"/>
<Run Text="{Binding ParameterName}"/>
</TextBlock>
</Border>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S1,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S2,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S3 ,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
@@ -128,7 +211,7 @@
<materialDesign:PackIcon Kind="ArrowRight" Foreground="#FF00204E" HorizontalAlignment="Center" VerticalAlignment="Center" Width="50" Height="35" /> <materialDesign:PackIcon Kind="ArrowRight" Foreground="#FF00204E" HorizontalAlignment="Center" VerticalAlignment="Center" Width="50" Height="35" />
</Button> </Button>
<Grid Background="White" Margin="10,500,300,60" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="250" Width="400"> <Grid Background="White" Margin="10,500,300,45" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="250" Width="400">
<ContentControl x:Name="Picture"/> <ContentControl x:Name="Picture"/>
</Grid> </Grid>
</Grid> </Grid>
+87 -80
View File
@@ -33,22 +33,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
/// ProductionPlanningEdit.xaml 的交互逻辑 /// ProductionPlanningEdit.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class DyeingPlanView : UserControl public partial class DyeingPlanView : UserControl
{ {
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
DataTable ProgramName = new DataTable(); DataTable ProgramName = new DataTable();
DataTable WorkOrder =new DataTable(); DataTable WorkOrder =new DataTable();
DataTable dat = new DataTable(); DataTable dat = new DataTable();
DataTable TEMPTable = new DataTable(); DataTable TEMPTable = new DataTable();
DataTable DyelotsBulkedRecipe=new DataTable(); DataTable DyelotsBulkedRecipe=new DataTable();
public string WorkOrder_n; public string WorkOrder_n;
string Numder = null;
string ID = null;
string P1, P2, P3, P4, P5;
public DyeingPlanView() public DyeingPlanView()
{ {
InitializeComponent(); InitializeComponent();
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 ProgramName = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from ProgramName order by ProgramID desc", null).Tables[0];//缓存
SQLiteHelpers.Open(); //打开数据库
ProgramName = SQLiteHelpers.ExecuteDataSet("select * from ProgramName order by ProgramID desc", null).Tables[0];//缓存
SQLiteHelpers.Close(); //关闭连接
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台 comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramName")).ToList();//转换工艺代码 comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramName")).ToList();//转换工艺代码
TEXTUSER.Text = MainWindow.user_; TEXTUSER.Text = MainWindow.user_;
@@ -66,10 +64,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (sArray.Length <= 1) if (sArray.Length <= 1)
{ {
comboBoxDyelot.IsEnabled = true; comboBoxDyelot.IsEnabled = true;
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 DataTable DatDyelot = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Machine='" + comboBoxMachine.Text + "' and State='101' order by Dyelot desc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Open(); //打开数据库
DataTable DatDyelot = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Machine='" + comboBoxMachine.Text + "' and State='101' order by Dyelot desc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Close(); //关闭连接
comboBoxDyelot.ItemsSource = DatDyelot.AsEnumerable().Select(rowdata => rowdata.Field<string>("Dyelot")).ToList();//转换代码 comboBoxDyelot.ItemsSource = DatDyelot.AsEnumerable().Select(rowdata => rowdata.Field<string>("Dyelot")).ToList();//转换代码
} }
} }
@@ -119,11 +114,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
string State_ = "100"; string State_ = "100";
string Dyelot_ = comboBoxDyelot.Text; string Dyelot_ = comboBoxDyelot.Text;
string color_ = color.Background.ToString(); string color_ = color.Background.ToString();
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
try try
{ {
sTime = SQLiteHelpers.ExecuteDataSet( sTime = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
"select * from WorkOrder where Machines='" + comboBoxMachine.Text + "' order by EndTime desc", null). "select * from WorkOrder where Machines='" + comboBoxMachine.Text + "' order by EndTime desc", null).
Tables[0].Select().First().Field<object>("EndTime").ToString(); //读取计划表写入缓存 Tables[0].Select().First().Field<object>("EndTime").ToString(); //读取计划表写入缓存
if (DateTime.Now < DateTime.Parse(sTime)) if (DateTime.Now < DateTime.Parse(sTime))
@@ -171,30 +164,25 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
WorkOrder_new.Add("Total", TEXTTotal.Text); WorkOrder_new.Add("Total", TEXTTotal.Text);
WorkOrder_new.Add("USER", TEXTUSER.Text); WorkOrder_new.Add("USER", TEXTUSER.Text);
WorkOrder_new.Add("ColorName", TEXTColorName.Text); WorkOrder_new.Add("ColorName", TEXTColorName.Text);
SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入 MainWindowViewModel.SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入
//插入信息
Dictionary<string, object> WorkOrder_set = new Dictionary<string, object>();//缓存函数
WorkOrder_set.Add("WorkOrder", WorkOrder_);
WorkOrder_set.Add("PumpSpeed", PumpSpeed.Text);
WorkOrder_set.Add("Blower", Blower.Text);
WorkOrder_set.Add("Swing", Swing.Text);
WorkOrder_set.Add("ClothWheel", ClothWheel.Text);
WorkOrder_set.Add("Nozzle", Nozzle.Text);
MainWindowViewModel.SQLiteHelpers.InsertData("WorkOrderSet", WorkOrder_set);// 执行插入
Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数
for (int x = 0; x < dat.Rows.Count; x++) for (int x = 0; x < dat.Rows.Count; x++)
{ {
WorkOrder_DAT = MainWindowViewModel.SQLiteHelpers.ToDictionary(dat.Rows[x]);
WorkOrder_DAT.Add("WorkOrder", WorkOrder_); WorkOrder_DAT.Add("WorkOrder", WorkOrder_);
WorkOrder_DAT.Add("Dyelot", Dyelot_); WorkOrder_DAT.Add("Dyelot", Dyelot_);
WorkOrder_DAT.Add("ProgramID", dat.Rows[x]["ProgramID"]); MainWindowViewModel.SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
WorkOrder_DAT.Add("Program", dat.Rows[x]["Program"]);
WorkOrder_DAT.Add("Step", dat.Rows[x]["Step"]);
WorkOrder_DAT.Add("StepID", dat.Rows[x]["StepID"]);
WorkOrder_DAT.Add("StepName", dat.Rows[x]["StepName"]);
WorkOrder_DAT.Add("ParameterName", dat.Rows[x]["ParameterName"]);
WorkOrder_DAT.Add("Parameter1", dat.Rows[x]["Parameter1"]);
WorkOrder_DAT.Add("Parameter2", dat.Rows[x]["Parameter2"]);
WorkOrder_DAT.Add("Parameter3", dat.Rows[x]["Parameter3"]);
WorkOrder_DAT.Add("Parameter4", dat.Rows[x]["Parameter4"]);
WorkOrder_DAT.Add("Parameter5", dat.Rows[x]["Parameter5"]);
WorkOrder_DAT.Add("Parameter6", dat.Rows[x]["Parameter6"]);
WorkOrder_DAT.Add("Parameter7", dat.Rows[x]["Parameter7"]);
WorkOrder_DAT.Add("Parameter8", dat.Rows[x]["Parameter8"]);
WorkOrder_DAT.Add("Parameter9", dat.Rows[x]["Parameter9"]);
WorkOrder_DAT.Add("Parameter10", dat.Rows[x]["Parameter10"]);
SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
WorkOrder_DAT.Clear(); WorkOrder_DAT.Clear();
} }
if (!String.IsNullOrEmpty(comboBoxDyelot.Text))//料单信息 if (!String.IsNullOrEmpty(comboBoxDyelot.Text))//料单信息
@@ -219,11 +207,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
WorkOrder_DAT.Add("DispenseGrams", DyelotsBulkedRecipe.Rows[x]["DispenseGrams"]); WorkOrder_DAT.Add("DispenseGrams", DyelotsBulkedRecipe.Rows[x]["DispenseGrams"]);
WorkOrder_DAT.Add("Dispense", DyelotsBulkedRecipe.Rows[x]["Dispenser"]); WorkOrder_DAT.Add("Dispense", DyelotsBulkedRecipe.Rows[x]["Dispenser"]);
WorkOrder_DAT.Add("UserAccount", DyelotsBulkedRecipe.Rows[x]["UserAccount"]); WorkOrder_DAT.Add("UserAccount", DyelotsBulkedRecipe.Rows[x]["UserAccount"]);
SQLiteHelpers.InsertData("Dyelot", WorkOrder_DAT);//行插入 MainWindowViewModel.SQLiteHelpers.InsertData("Dyelot", WorkOrder_DAT);//行插入
WorkOrder_DAT.Clear(); WorkOrder_DAT.Clear();
} }
} }
SQLiteHelpers.Close(); //关闭连接
LogGing.ExchangeDATA("Dyelot=" + comboBoxWorkOrder.Text + ";Machine=" + comboBoxMachine.Text + LogGing.ExchangeDATA("Dyelot=" + comboBoxWorkOrder.Text + ";Machine=" + comboBoxMachine.Text +
";Program=" + comboBoxProgram.Text + ";User=" + TEXTUSER.Text + ";"); ";Program=" + comboBoxProgram.Text + ";User=" + TEXTUSER.Text + ";");
@@ -251,11 +238,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (!string.IsNullOrEmpty(comboBoxProgram.Text)) if (!string.IsNullOrEmpty(comboBoxProgram.Text))
{ {
dat.Clear(); dat.Clear();
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 dat = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
SQLiteHelpers.Open(); //打开数据库
dat = SQLiteHelpers.ExecuteDataSet(
"select * from ProgramSteps where Program='" + comboBoxProgram.SelectedValue + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存 "select * from ProgramSteps where Program='" + comboBoxProgram.SelectedValue + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Close(); //关闭连接
DatSteps(dat); DatSteps(dat);
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
} }
@@ -269,8 +253,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
try try
{ {
string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase); string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
/* if (!string.IsNullOrEmpty(WorkOrder_n)) /* if (!string.IsNullOrEmpty(WorkOrder_n))
{ {
dat = SQLiteHelpers.ExecuteDataSet( dat = SQLiteHelpers.ExecuteDataSet(
@@ -278,7 +260,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
}//插入工单不为空时载入细节信息*/ }//插入工单不为空时载入细节信息*/
for (int i = 0; i < sArray.Length; i++) for (int i = 0; i < sArray.Length; i++)
{ {
DataTable temp = SQLiteHelpers.ExecuteDataSet( DataTable temp = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
"select * from ProgramSteps where Program='" + sArray[i] + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存 "select * from ProgramSteps where Program='" + sArray[i] + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
if (dat.Columns.Count == 0) dat = temp.Clone(); if (dat.Columns.Count == 0) dat = temp.Clone();
foreach (DataRow drT in temp.Rows) foreach (DataRow drT in temp.Rows)
@@ -287,7 +269,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
}//以工艺名组合工艺细节 }//以工艺名组合工艺细节
SQLiteHelpers.Close(); //关闭连接
DatSteps(dat); DatSteps(dat);
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
@@ -297,11 +278,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
}//工艺修改事件 }//工艺修改事件
string Numder = null;
string ID = null;
string P1, P2, P3, P4, P5;
private void MenuItem_edit(object sender, RoutedEventArgs e) private void MenuItem_edit(object sender, RoutedEventArgs e)
{ {
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
@@ -317,7 +293,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = dat.Rows.Count.ToString(); if (ID == null) ID = dat.Rows.Count.ToString();
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -341,9 +317,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DatSteps(dat); DatSteps(dat);
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = dat.Rows.Count.ToString(); if (ID == null) ID = dat.Rows.Count.ToString();
ViewStep viewstop = new ViewStep(null, null, null, null, null, null); ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -376,7 +353,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = dat.Rows.Count.ToString(); if (ID == null) ID = dat.Rows.Count.ToString();
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -384,51 +361,75 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果 private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
{ {
int i = dat.Rows.Count; int n = Convert.ToInt16(ID);
int n = StrToInt.To16Convert10(ID); ID = null;
if (e.Mode) if (e.PNAME != "")
{ {
DataRow dr = dat.Rows[n - 1]; DataRow dr = dat.Rows[n - 1];
dr.BeginEdit(); dr.BeginEdit();
dr["StepID"] = e.StepID; dr["StepID"] = e.StepID;
dr["StepName"] = e.StepNAME; dr["StepName"] = e.StepNAME;
dr["ParameterName"] = e.PNAME; dr["ParameterName"] = e.PNAME;
dr["Parameter1"] = e.P1; dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter2"] = e.P2; dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter3"] = e.P3; dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter4"] = e.P4; dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter5"] = e.P5; dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
dr["Parameter4_S1"] = e.Row_DAT.Field<double>("Parameter4_S1");
dr["Parameter5_S1"] = e.Row_DAT.Field<double>("Parameter5_S1");
dr["Parameter1_S2"] = e.Row_DAT.Field<double>("Parameter1_S2");
dr["Parameter2_S2"] = e.Row_DAT.Field<double>("Parameter2_S2");
dr["Parameter3_S2"] = e.Row_DAT.Field<double>("Parameter3_S2");
dr["Parameter4_S2"] = e.Row_DAT.Field<double>("Parameter4_S2");
dr["Parameter5_S2"] = e.Row_DAT.Field<double>("Parameter5_S2");
dr["Parameter1_S3"] = e.Row_DAT.Field<double>("Parameter1_S3");
dr["Parameter2_S3"] = e.Row_DAT.Field<double>("Parameter2_S3");
dr["Parameter3_S3"] = e.Row_DAT.Field<double>("Parameter3_S3");
dr["Parameter4_S3"] = e.Row_DAT.Field<double>("Parameter4_S3");
dr["Parameter5_S3"] = e.Row_DAT.Field<double>("Parameter5_S3");
dr["StepName_S1"] = e.Row_DAT.Field<string>("StepName_S1");
dr["StepName_S2"] = e.Row_DAT.Field<string>("StepName_S2");
dr["StepName_S3"] = e.Row_DAT.Field<string>("StepName_S3");
dr["StepID_S1"] = e.Row_DAT.Field<string>("StepID_S1");
dr["StepID_S2"] = e.Row_DAT.Field<string>("StepID_S2");
dr["StepID_S3"] = e.Row_DAT.Field<string>("StepID_S3");
dr.EndEdit(); dr.EndEdit();
Grid_data.SelectedIndex = -1;
} }
else else
{ {
dat.Rows.RemoveAt(Convert.ToInt32(ID) - 1); MainWindowViewModel.dt_TP.Rows.RemoveAt(n - 1);
DatSteps(dat); DatSteps(dat);
} Grid_data.SelectedIndex = -1;
}
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
} }
private void TEMP() private void TEMP()
{ {
//处理计划温度图表 //处理计划温度图表
TEMPTable.Clear(); TEMPTable.Clear();
DataRow nrow = TEMPTable.NewRow();
string TIMET = "00:00:00"; string TIMET = "00:00:00";
Double MSTT = 30.0; Double MSTT = 30.0;
Double TT;
Double TC;
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
for (int i = 0; i < dat.Rows.Count; i++) for (int i = 0; i < dat.Rows.Count; i++)
{ {
switch (dat.Rows[i][3].ToString())//步骤用时计算 switch (dat.Rows[i].Field<string>("StepID"))//步骤用时计算
{ {
case "001": case "001":
Double TT = MSTT; TT = MSTT;
Double TC; TC = dat.Rows[i].Field<double>("Parameter2");
TC = (Double)dat.Rows[i][7];
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制 if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
MSTT = (Double)dat.Rows[i][6]; MSTT = dat.Rows[i].Field<double>("Parameter1");
TT = Math.Abs(MSTT - TT) / TC * 60; TT = Math.Abs(MSTT - TT) / TC * 60;
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "007": case "007":
@@ -440,10 +441,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "013": case "013":
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3") * dat.Rows[i].Field<double>("Parameter4")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "015": case "015":
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "017": case "017":
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "020": case "020":
TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss");
@@ -454,17 +461,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "031": case "031":
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][6]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "065": case "065":
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][8]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "091": case "091":
TT = MSTT;
TC = (Double)dat.Rows[i][7];
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
MSTT = (Double)dat.Rows[i][6];
TT = Math.Abs(MSTT - TT) / TC * 60;
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
case "093": case "093":
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][6]).ToString("HH:mm:ss"); TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
TEMPTable.Rows.Add(new object[] { TIMET, MSTT }); TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
break; break;
default: default:
@@ -477,10 +491,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
if (e.Key == Key.Enter && MainWindowViewModel.DyelotsDispenser) if (e.Key == Key.Enter && MainWindowViewModel.DyelotsDispenser)
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); int dat_c = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where WorkOrder = '" + comboBoxWorkOrder.Text + "'", null).Tables[0].Rows.Count;//缓存
SQLiteHelpers.Open(); //打开数据库
int dat_c = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where WorkOrder = '" + comboBoxWorkOrder.Text + "'", null).Tables[0].Rows.Count;//缓存
SQLiteHelpers.Close();
if (dat_c > 0)//查询料单是否可用 if (dat_c > 0)//查询料单是否可用
{ {
@@ -509,7 +520,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
conn_SC.Close(); conn_SC.Close();
DyelotsBulkedRecipe_.Fill(DyelotsBulkedRecipe); DyelotsBulkedRecipe_.Fill(DyelotsBulkedRecipe);
DataTable ds = new DataTable();//载入信息 DataTable ds = new DataTable();//载入信息
DYELOTS_data.Fill(ds); DYELOTS_data.Fill(ds);
TEXTColorNumber.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorNo")).First(); TEXTColorNumber.Text = ds.AsEnumerable().Select(row => row.Field<string>("ColorNo")).First();
@@ -555,10 +565,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
string DYELOTS_sql = "SELECT * FROM [dbo].[DYELOTS] WHERE Dyelot = '" + comboBoxDyelot.Text + "'";//单号查询语句 string DYELOTS_sql = "SELECT * FROM [dbo].[DYELOTS] WHERE Dyelot = '" + comboBoxDyelot.Text + "'";//单号查询语句
try try
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); int dat_c = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot = '" + comboBoxDyelot.Text + "'", null).Tables[0].Rows.Count;//缓存
SQLiteHelpers.Open(); //打开数据库
int dat_c = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot = '" + comboBoxDyelot.Text + "'", null).Tables[0].Rows.Count;//缓存
SQLiteHelpers.Close();
if (dat_c > 0)//查询料单是否可用 if (dat_c > 0)//查询料单是否可用
{ {
+72
View File
@@ -0,0 +1,72 @@
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.DyelotView"
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:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ConvertMoels:StatenConvert x:Key="StatenConvert"/>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
</UserControl.Resources>
<Grid>
<DataGrid x:Name="Grid_data" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
GridLinesVisibility="All" ColumnHeaderHeight="40"
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
Margin="0,0,0,0" BorderBrush="#FFC9C9C9" FontSize="16" BorderThickness="5,5,5,5" >
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="25" />
<Setter Property="FontSize" Value="15" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="80" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static lang:Resources.ProductCode}" Width="150" Binding="{Binding ProductCode}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ProductName}" Width="150" Binding="{Binding ProductName}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ProductType}" Width="100" Binding="{Binding ProductType}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.State}" Width="80" Binding="{Binding Path=State,Converter={StaticResource StatenConvert}}" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Grams}" Width="150" Binding="{Binding Grams}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.DispenseGrams}" Width="150" Binding="{Binding Amount}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.DispenseEndTime}" Width="200" Binding="{Binding DispenseEndTime}" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
+51
View File
@@ -0,0 +1,51 @@
using DyeingComputer.UserClass;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
namespace SunlightCentralizedControlManagement_SCCM_.View
{
/// <summary>
/// Whole.xaml 的交互逻辑
/// </summary>
public partial class DyelotView : UserControl
{
public DyelotView()
{
InitializeComponent();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
}
public void Dyelot(object dat)
{
DataTable dat_c = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where WorkOrder = '" + dat + "'", null).Tables[0];//缓存
Grid_data.ItemsSource = dat_c.DefaultView;
}
public void DyelotDatatable(DataTable dat)
{
Grid_data.ItemsSource = dat.DefaultView;
}
}
}
+8 -3
View File
@@ -8,10 +8,10 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="630" d:DesignWidth="1280" VerticalAlignment="Top"> d:DesignHeight="630" d:DesignWidth="1280" VerticalAlignment="Top">
<Grid> <Grid>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxCOM0" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="16" /> <ComboBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxCOM0" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged0" FontSize="16" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Port}" VerticalAlignment="Top" Width="120" FontSize="25"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Port}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="comboBoxCOM1" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="16"/> <ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="comboBoxCOM1" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged1" FontSize="16"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,90,0,0" x:Name="comboBoxCOM2" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="16"/> <ComboBox HorizontalAlignment="Left" Height="30" Margin="150,90,0,0" x:Name="comboBoxCOM2" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged2" FontSize="16"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,130,0,0" x:Name="comboBoxLanguage" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxLanguage_SelectionChanged" FontSize="16"/> <ComboBox HorizontalAlignment="Left" Height="30" Margin="150,130,0,0" x:Name="comboBoxLanguage" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxLanguage_SelectionChanged" FontSize="16"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Language}" VerticalAlignment="Top" Width="120" FontSize="25"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Language}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,170,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.SERVER}" VerticalAlignment="Top" Width="120" FontSize="25"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,170,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.SERVER}" VerticalAlignment="Top" Width="120" FontSize="25"/>
@@ -28,6 +28,11 @@
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,375,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,375,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/>
<CheckBox x:Name="dDispenser" Content="{x:Static lang:Resources.LinkDispenser}" HorizontalAlignment="Left" Height="35 " Margin="410,10,0,0" VerticalAlignment="Top" Width="200" <CheckBox x:Name="dDispenser" Content="{x:Static lang:Resources.LinkDispenser}" HorizontalAlignment="Left" Height="35 " Margin="410,10,0,0" VerticalAlignment="Top" Width="200"
Checked="dDispenser_Checked" Unchecked="dDispenser_Checked" FontSize="20"/> Checked="dDispenser_Checked" Unchecked="dDispenser_Checked" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,450,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Speed}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox x:Name="VOICE_V1" HorizontalAlignment="Left" Height="40" Margin="150,450,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,490,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Vol}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox x:Name="VOICE_V2" HorizontalAlignment="Left" Height="40" Margin="150,490,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
<Button Content="{x:Static lang:Resources.VOICE}" HorizontalAlignment="Left" Height="35" Margin="270,535,0,0" VerticalAlignment="Top" Width="80" Click="VOICE_Click"/>
</Grid> </Grid>
</UserControl> </UserControl>
+39 -10
View File
@@ -1,9 +1,11 @@
using SunlightCentralizedControlManagement_SCCM_.UserClass; using ScottPlot.TickGenerators.TimeUnits;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel; using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Linq; using System.Linq;
using System.Speech.Synthesis;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@@ -28,14 +30,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
InitializeComponent(); InitializeComponent();
// 获取所有可用串口端口,并添加到comboBoxCOM // 获取所有可用串口端口,并添加到comboBoxCOM
string[] ports = System.IO.Ports.SerialPort.GetPortNames(); string[] ports = System.IO.Ports.SerialPort.GetPortNames();
ports.Append("COM");
comboBoxCOM0.ItemsSource = ports; comboBoxCOM0.ItemsSource = ports;
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM"); comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COMP1");
comboBoxCOM1.ItemsSource = ports; comboBoxCOM1.ItemsSource = ports;
comboBoxCOM1.Text = Configini.IniReadvalue("SYS", "COM"); comboBoxCOM1.Text = Configini.IniReadvalue("SYS", "COMP2");
comboBoxCOM2.ItemsSource = ports; comboBoxCOM2.ItemsSource = ports;
comboBoxCOM2.Text = Configini.IniReadvalue("SYS", "COM"); comboBoxCOM2.Text = Configini.IniReadvalue("SYS", "COMP3");
string[] Language = {"en-US","zh-CN","zh-TW" }; string[] Language = {"en-US","zh-CN","zh-TW" };
string[] SQMOD = { "Windows Authentication", "SQL SERVER"}; string[] SQMOD = { "Windows Authentication", "SQL SERVER"};
@@ -50,19 +53,33 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
TEXT_SQLUSER.Text = Configini.IniReadvalue("SQL_SERVER", "SQL4"); TEXT_SQLUSER.Text = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWORD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL5"); TEXT_SQLPASWORD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL5");
dDispenser.IsChecked = Convert.ToBoolean(Configini.IniReadvalue("SYS", "DyelotsDispenser")); dDispenser.IsChecked = Convert.ToBoolean(Configini.IniReadvalue("SYS", "DyelotsDispenser"));
VOICE_V1.Text = Configini.IniReadvalue("VOICE", "V1");
VOICE_V2.Text = Configini.IniReadvalue("VOICE", "V2");
} }
catch (Exception ex) { LogGing.ERRDATA(ex); } catch (Exception ex) { LogGing.ERRDATA(ex); }
} }
//调用配置文件 //调用配置文件
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
private SpeechSynthesizer synth = new SpeechSynthesizer();//语音
private void comboBoxCOM_SelectionChanged(object sender, SelectionChangedEventArgs e) private void comboBoxCOM_SelectionChanged0(object sender, SelectionChangedEventArgs e)
{ {
Configini.IniWritevalue("SYS", "COM0", comboBoxCOM0.SelectedValue.ToString()); Configini.IniWritevalue("SYS", "COMP1", comboBoxCOM0.SelectedValue.ToString());
Configini.IniWritevalue("SYS", "COM1", comboBoxCOM1.SelectedValue.ToString()); // Configini.IniWritevalue("SYS", "COMP1", comboBoxCOM1.SelectedValue.ToString());
Configini.IniWritevalue("SYS", "COM2", comboBoxCOM2.SelectedValue.ToString()); // Configini.IniWritevalue("SYS", "COMP2", comboBoxCOM2.SelectedValue.ToString());
}
private void comboBoxCOM_SelectionChanged1(object sender, SelectionChangedEventArgs e)
{
//Configini.IniWritevalue("SYS", "COMP0", comboBoxCOM0.SelectedValue.ToString());
Configini.IniWritevalue("SYS", "COMP2", comboBoxCOM1.SelectedValue.ToString());
// Configini.IniWritevalue("SYS", "COMP2", comboBoxCOM2.SelectedValue.ToString());
}
private void comboBoxCOM_SelectionChanged2(object sender, SelectionChangedEventArgs e)
{
//Configini.IniWritevalue("SYS", "COMP0", comboBoxCOM0.SelectedValue.ToString());
// Configini.IniWritevalue("SYS", "COMP1", comboBoxCOM1.SelectedValue.ToString());
Configini.IniWritevalue("SYS", "COMP3", comboBoxCOM2.SelectedValue.ToString());
} }
private void comboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e) private void comboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
Configini.IniWritevalue("SYS", "Language", comboBoxLanguage.SelectedValue.ToString()); Configini.IniWritevalue("SYS", "Language", comboBoxLanguage.SelectedValue.ToString());
@@ -109,7 +126,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
MainWindowViewModel.SQMOD = TEXT_SQMOD.Text; MainWindowViewModel.SQMOD = TEXT_SQMOD.Text;
MainWindowViewModel.SQLUSER = TEXT_SQLUSER.Text; MainWindowViewModel.SQLUSER = TEXT_SQLUSER.Text;
MainWindowViewModel.SQLPASWORD = TEXT_SQLPASWORD.Text; MainWindowViewModel.SQLPASWORD = TEXT_SQLPASWORD.Text;
MainWindowViewModel.SQL_LINK();//更新设定
} }
} }
@@ -118,5 +134,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Configini.IniWritevalue("SYS", "DyelotsDispenser", dDispenser.IsChecked.ToString()); Configini.IniWritevalue("SYS", "DyelotsDispenser", dDispenser.IsChecked.ToString());
MainWindowViewModel.DyelotsDispenser = (bool)dDispenser.IsChecked; MainWindowViewModel.DyelotsDispenser = (bool)dDispenser.IsChecked;
} }
private void VOICE_Click(object sender, RoutedEventArgs e)//语言测试按钮
{
try
{
synth.Rate = int.Parse(VOICE_V1.Text);
synth.Volume = int.Parse(VOICE_V2.Text);
synth.SpeakAsync(Properties.Resources.TESTVOICE);
Configini.IniWritevalue("VOICE", "V1", VOICE_V1.Text);
Configini.IniWritevalue("VOICE", "V2", VOICE_V2.Text);
}
catch (Exception) { }
}
} }
} }
+1 -9
View File
@@ -27,14 +27,6 @@
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" Background="#FF00204E"/> <GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" Background="#FF00204E"/>
<RichTextBox Grid.Column="2" x:Name="Logtext" IsReadOnly="True" VerticalScrollBarVisibility="Visible" Background="White" SelectionBrush="White"> <RichTextBox Grid.Column="2" x:Name="Logtext" IsReadOnly="True" Background="White" SelectionBrush="White"/>
<FlowDocument>
<Paragraph>
<Run Text="LOG"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
<!--遮罩-->
</Grid> </Grid>
</UserControl> </UserControl>
+22 -10
View File
@@ -24,6 +24,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
string Log_time = DateTime.Now.ToString("yyyy-MM-dd"); string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
DataTable logdataTable = new DataTable(); //建立RRODUCT缓存 DataTable logdataTable = new DataTable(); //建立RRODUCT缓存
long TEXT_L;
public LogView() public LogView()
{ {
@@ -46,7 +47,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
foreach (var item in loginfo.GetFiles()) foreach (var item in loginfo.GetFiles())
{ {
DataRow FileRow = logdataTable.NewRow(); DataRow FileRow = logdataTable.NewRow();
FileRow["Name"] = item.Name; FileRow["Name"] = item.Name;
FileRow["Length"] = item.Length / 1024; FileRow["Length"] = item.Length / 1024;
FileRow["CreationTimeUtc"] = item.CreationTimeUtc; FileRow["CreationTimeUtc"] = item.CreationTimeUtc;
@@ -64,25 +64,37 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
/*定位选中行及指定列单元格文本信息*/ /*定位选中行及指定列单元格文本信息*/
LOGDATA_file((gridLog.Columns[0].GetCellContent(gridLog.Items[rownum]) as TextBlock).Text.TrimEnd());// LOGDATA_file((gridLog.Columns[0].GetCellContent(gridLog.Items[rownum]) as TextBlock).Text.TrimEnd());//
TEXT_L = long.Parse((gridLog.Columns[1].GetCellContent(gridLog.Items[rownum]) as TextBlock).Text.ToString()) *1024+1024;//
} }
} }
private void LOGDATA_file(string dat) //读取文件显示到前端 private async void LOGDATA_file(string dat) //读取文件显示到前端
{ {
Logtext.SelectAll();
Logtext.Cut();
Logtext.Document = new FlowDocument(); Logtext.Document = new FlowDocument();
string filePath = System.Environment.CurrentDirectory + "\\"+comboBox_log.Text+"\\"; string filePath = System.Environment.CurrentDirectory + "\\"+comboBox_log.Text+ "\\";
try try
{ {
// 使用StreamReader读取文件 Logtext.AppendText("Loading...");
using (StreamReader reader = new StreamReader(filePath + dat)) string log_ = null;
string log_DAT = await Task<string>.Run(() =>
{ {
// 读取文件直到文件的末尾 // 使用StreamReader读取文件
while (!reader.EndOfStream) using (StreamReader reader = new StreamReader(filePath + dat))
{ {
// 添加文件的每一行到RichTextBox // 读取文件直到文件的末尾
Logtext.AppendText(reader.ReadLine() + "\r\n"); while (!reader.EndOfStream)
{
// 添加文件的每一行到RichTextBox
log_ = log_ + reader.ReadLine() + "\n";
}
} }
} return log_;
});
Logtext.SelectAll();
Logtext.Cut();
Logtext.AppendText(log_DAT);
} }
catch (Exception ex) catch (Exception ex)
{ {
+19 -14
View File
@@ -63,26 +63,31 @@
<DataGridTextColumn Binding="{Binding IP}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding IP}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding PORT}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding PORT}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Serial}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Serial}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Baud}" Width="0" IsReadOnly="True"/> <DataGridTextColumn Binding="{Binding Station}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding ID}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Model}" Width="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Type}" Width="0" IsReadOnly="True"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" FontSize="20" IsEditable="True" /> <ComboBox HorizontalAlignment="Left" Height="40" Margin="150,10,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" FontSize="20" IsEditable="True" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Top" Width="120" FontSize="25"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="TextMachineGroup" VerticalAlignment="Top" Width="270" FontSize="20" MaxLines="1"/> <TextBox HorizontalAlignment="Left" Height="40" Margin="150,50,0,0" x:Name="TextMachineGroup" VerticalAlignment="Top" Width="270" FontSize="20" MaxLines="1"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,50,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.MachineGroup}" VerticalAlignment="Top" Width="120" FontSize="25"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,50,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.MachineGroup}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,100,0,0" x:Name="IP" VerticalAlignment="Top" Width="200" FontSize="20" MaxLines="1"/> <ComboBox HorizontalAlignment="Left" Height="40" Margin="150,100,0,0" x:Name="comboBoxtype" VerticalAlignment="Top" Width="270" FontSize="20" IsEditable="True" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="350,100,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" Width="20" FontSize="25"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,100,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Type}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="360,100,0,0" x:Name="PORT" VerticalAlignment="Top" Width="60" FontSize="20" MaxLines="1" Text="7789"/> <TextBox HorizontalAlignment="Left" Height="40" Margin="150,150,0,0" x:Name="IP" VerticalAlignment="Top" Width="200" FontSize="20" MaxLines="1"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,100,0,0" TextWrapping="Wrap" Text="IP/PORT" VerticalAlignment="Top" Width="120" FontSize="25"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,150,0,0" x:Name="comboBoxCOM0" VerticalAlignment="Top" Width="200" FontSize="20" />
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,150,0,0" TextWrapping="Wrap" Text="COM" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="360,150,0,0" x:Name="BAUD" VerticalAlignment="Top" Width="60" FontSize="20" MaxLines="1" Text="57600"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="350,150,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" Width="20" FontSize="25"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="350,150,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" Width="20" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,200,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/> <TextBox HorizontalAlignment="Left" Height="40" Margin="360,150,0,0" x:Name="PORT" VerticalAlignment="Top" Width="60" FontSize="20" MaxLines="1" Text="7789"/>
<Button Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Left" Height="35" Margin="250,200,0,5" VerticalAlignment="Top" Width="80" Click="Save_Click"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,150,0,0" TextWrapping="Wrap" Text="IP/PORT" VerticalAlignment="Top" Width="120" FontSize="25"/>
<Button Content="{x:Static lang:Resources.Delete}" HorizontalAlignment="Left" Height="35" Margin="340,200,0,5" VerticalAlignment="Top" Width="80" Click="Delete_Click"/> <ComboBox HorizontalAlignment="Left" Height="40" Margin="150,200,0,0" x:Name="comboBoxCOM0" VerticalAlignment="Top" Width="200" FontSize="20" />
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="160,200,50,5" VerticalAlignment="Top" Width="80" Click="Test_Click"/> <TextBlock HorizontalAlignment="Left" Height="40" Margin="10,200,0,0" TextWrapping="Wrap" Text="COM" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox HorizontalAlignment="Left" Height="40" Margin="360,200,0,0" x:Name="Station" VerticalAlignment="Top" Width="60" FontSize="20" MaxLines="1" Text="00"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="350,200,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" Width="20" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,250,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/>
<Button Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Left" Height="35" Margin="250,250,0,5" VerticalAlignment="Top" Width="80" Click="Save_Click"/>
<Button Content="{x:Static lang:Resources.Delete}" HorizontalAlignment="Left" Height="35" Margin="340,250,0,5" VerticalAlignment="Top" Width="80" Click="Delete_Click"/>
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="160,250,50,5" VerticalAlignment="Top" Width="80" Click="Test_Click"/>
+227 -62
View File
@@ -9,6 +9,7 @@ using System.Linq;
using System.Net; using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Net.Sockets; using System.Net.Sockets;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@@ -34,17 +35,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
InitializeComponent(); InitializeComponent();
// 获取所有可用串口端口,并添加到comboBoxCOM // 获取所有可用串口端口,并添加到comboBoxCOM
string[] ports = System.IO.Ports.SerialPort.GetPortNames(); // string[] ports = System.IO.Ports.SerialPort.GetPortNames();
comboBoxCOM0.ItemsSource = ports; comboBoxCOM0.ItemsSource = ports;
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM"); comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM");
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台 comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
comboBoxtype.ItemsSource = type_;
} }
private SQLiteHelper SQLiteHelpers = null; //定义数据库 string[] ports = { "PORT1", "PORT2", "PORT3", "PORT4" };
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径 string[] type_ = { "828", "838" };
string link_model = "838" ;
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
//private string SYS_machines = null; //private string SYS_machines = null;
int ID_;
private void UserControl_Loaded(object sender, RoutedEventArgs e) private void UserControl_Loaded(object sender, RoutedEventArgs e)
{ {
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView; Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
@@ -55,47 +58,129 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效 if (rownum != -1)//判断鼠标定位是否有效
{ {
ID_ = int.Parse((Griddata.Columns[7].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text);
comboBoxMachine.Text = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列, comboBoxMachine.Text = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
TextMachineGroup.Text = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列, TextMachineGroup.Text = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
IP.Text = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列, IP.Text = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
PORT.Text = (Griddata.Columns[4].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列, PORT.Text = (Griddata.Columns[4].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
comboBoxCOM0.Text = (Griddata.Columns[5].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列, comboBoxCOM0.Text = (Griddata.Columns[5].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
BAUD.Text = (Griddata.Columns[6].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列, Station.Text = (Griddata.Columns[6].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
comboBoxtype.Text = (Griddata.Columns[8].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;
} }
} }
private void Save_Click(object sender, RoutedEventArgs e) private void Save_Click(object sender, RoutedEventArgs e)
{ {
if (string.IsNullOrEmpty(Station.Text)) Station.Text = "255";
if (!string.IsNullOrEmpty(comboBoxMachine.Text)) if (!string.IsNullOrEmpty(comboBoxMachine.Text))
{ {
Dictionary<string, object> dr_new = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
dr_new.Add("Name", comboBoxMachine.Text); if (MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Machines where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
dr_new.Add("Groups", TextMachineGroup.Text);
dr_new.Add("IP", IP.Text);
dr_new.Add("PORT", PORT.Text);
dr_new.Add("Serial", comboBoxCOM0.Text);
dr_new.Add("Baud", BAUD.Text);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
if (SQLiteHelpers.ExecuteDataSet("select * from Machines where name ='" + comboBoxMachine.Text + "'", null).Tables[0].Rows.Count == 0)
{ {
SQLiteHelpers.InsertData("Machines", dr_new); lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
DataRow dat_ = MainWindowViewModel.Machines.NewRow();
dat_.BeginEdit();
dat_["Name"] = comboBoxMachine.Text;
dat_["Groups"] = TextMachineGroup.Text;
dat_["IP"] = IP.Text;
dat_["PORT"] = PORT.Text;
dat_["Serial"] = comboBoxCOM0.Text;
dat_["Model"] = comboBoxtype.Text;
dat_["Station"] = Station.Text;
dat_["ID"] = 999;
dat_["ERR"] = false;
dat_["AUTO"] = false;
dat_["CALL"] = false;
dat_["LOCK"] = false;
dat_["State"] = 800;
dat_["Temperature"] = 0;
dat_["WaterLevel"] = 0;
dat_["WORK_RUN"] = -1;
dat_["UserInfoStart"] = 900;
if (comboBoxtype.Text.Contains(link_model))
{
dat_["Desktop"] = true;
dat_["Type"] = true;
}
else
{
dat_["Desktop"] = false;
dat_["Type"] = false;
}
dat_.EndEdit();
MainWindowViewModel.Machines.Rows.Add(dat_);
DatSteps(MainWindowViewModel.Machines);
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
{
Machines_DAT.Add("ID", MainWindowViewModel.Machines.Rows[x]["ID"]);
Machines_DAT.Add("Name", MainWindowViewModel.Machines.Rows[x]["Name"]);
Machines_DAT.Add("IP", MainWindowViewModel.Machines.Rows[x]["IP"]);
Machines_DAT.Add("PORT", MainWindowViewModel.Machines.Rows[x]["PORT"]);
Machines_DAT.Add("Serial", MainWindowViewModel.Machines.Rows[x]["Serial"]);
Machines_DAT.Add("Station", MainWindowViewModel.Machines.Rows[x]["Station"]);
Machines_DAT.Add("Groups", MainWindowViewModel.Machines.Rows[x]["Groups"]);
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
Machines_DAT.Clear();
}
}
} }
else else
{ {
SQLiteHelpers.Update("Machines",dr_new,"name='"+comboBoxMachine.Text+"'",null); lock (MainWindowViewModel.Machines.Rows.SyncRoot)
} {
MainWindowViewModel.Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存 DataRow dr = MainWindowViewModel.Machines.Rows[ID_];
SQLiteHelpers.Close(); dr.BeginEdit();
dr["Name"] = comboBoxMachine.Text;
dr["Groups"] = TextMachineGroup.Text;
dr["IP"] = IP.Text;
dr["PORT"] = PORT.Text;
dr["Serial"] = comboBoxCOM0.Text;
dr["Model"] = comboBoxtype.Text;
dr["Station"] = Station.Text;
if (comboBoxtype.Text.Contains(link_model))
{
dr["Desktop"] = true;
dr["Type"] = true;
}
else
{
dr["Desktop"] = false;
dr["Type"] = false;
}
dr.EndEdit();
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
{
Machines_DAT.Add("ID", MainWindowViewModel.Machines.Rows[x]["ID"]);
Machines_DAT.Add("Name", MainWindowViewModel.Machines.Rows[x]["Name"]);
Machines_DAT.Add("IP", MainWindowViewModel.Machines.Rows[x]["IP"]);
Machines_DAT.Add("PORT", MainWindowViewModel.Machines.Rows[x]["PORT"]);
Machines_DAT.Add("Serial", MainWindowViewModel.Machines.Rows[x]["Serial"]);
Machines_DAT.Add("Station", MainWindowViewModel.Machines.Rows[x]["Station"]);
Machines_DAT.Add("Groups", MainWindowViewModel.Machines.Rows[x]["Groups"]);
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
Machines_DAT.Add("Type", MainWindowViewModel.Machines.Rows[x]["Type"]);
Machines_DAT.Add("Model", MainWindowViewModel.Machines.Rows[x]["Model"]);
Machines_DAT.Add("LOCK", "FALSE");
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
Machines_DAT.Clear();
}
}
}
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView; Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
comboBoxMachine.Text = null; comboBoxMachine.Text = null;
TextMachineGroup.Text = null; TextMachineGroup.Text = null;
IP.Text = null; IP.Text = null;
PORT.Text = "7789"; PORT.Text = "7789";
comboBoxCOM0.Text = null; comboBoxCOM0.Text = null;
BAUD.Text = "57600"; Station.Text = "00";
} }
else else
{ {
@@ -103,18 +188,37 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
} }
} }
private void Delete_Click(object sender, RoutedEventArgs e) private void Delete_Click(object sender, RoutedEventArgs e)//删除
{ {
if (!string.IsNullOrEmpty(comboBoxMachine.Text)) if (!string.IsNullOrEmpty(comboBoxMachine.Text))
{ {
MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question); MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码 if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 lock (MainWindowViewModel.Machines.Rows.SyncRoot)
SQLiteHelpers.Open(); //打开数据库 {
SQLiteHelpers.Delete("Machines", "Name='" + comboBoxMachine.Text + "'", null); MainWindowViewModel.Machines.Rows.RemoveAt(ID_ - 1);
MainWindowViewModel.Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存 DatSteps(MainWindowViewModel.Machines);
SQLiteHelpers.Close(); }
Dictionary<string, object> Machines_DAT = new Dictionary<string, object>();//缓存函数
MainWindowViewModel.SQLiteHelpers.Delete("Machines", null, null);//
for (int x = 0; x < MainWindowViewModel.Machines.Rows.Count; x++)
{
Machines_DAT.Add("ID", MainWindowViewModel.Machines.Rows[x]["ID"]);
Machines_DAT.Add("Name", MainWindowViewModel.Machines.Rows[x]["Name"]);
Machines_DAT.Add("IP", MainWindowViewModel.Machines.Rows[x]["IP"]);
Machines_DAT.Add("PORT", MainWindowViewModel.Machines.Rows[x]["PORT"]);
Machines_DAT.Add("Serial", MainWindowViewModel.Machines.Rows[x]["Serial"]);
Machines_DAT.Add("Station", MainWindowViewModel.Machines.Rows[x]["Station"]);
Machines_DAT.Add("Groups", MainWindowViewModel.Machines.Rows[x]["Groups"]);
Machines_DAT.Add("Desktop", MainWindowViewModel.Machines.Rows[x]["Desktop"]);
Machines_DAT.Add("Dispense", MainWindowViewModel.Machines.Rows[x]["Dispense"]);
Machines_DAT.Add("LOCK", "FALSE");
MainWindowViewModel.SQLiteHelpers.InsertData("Machines", Machines_DAT);//行插入
Machines_DAT.Clear();
}
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView; Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
comboBoxMachine.Text = null; comboBoxMachine.Text = null;
} }
@@ -125,56 +229,117 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
} }
} }
public void DatSteps(DataTable db)//行号刷新
{
int a = db.Rows.Count;
for (int i = 0; i < a; i++)
{
DataRow dr = db.Rows[i];
dr.BeginEdit();
dr["ID"] = i;
dr.EndEdit();
}
}
private void Test_Click(object sender, RoutedEventArgs e)//测试按钮 private void Test_Click(object sender, RoutedEventArgs e)//测试按钮
{ {
if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text))
{ if (comboBoxtype.Text.Contains(link_model))
textlog.Text = "TEST"; {//网络
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255)); if (!string.IsNullOrEmpty(IP.Text) && !string.IsNullOrEmpty(PORT.Text))
//------------使用ping类------
string host = IP.Text;
Ping p1 = new Ping();
PingReply reply = p1.Send(host); //发送主机名或Ip地址
//StringBuilder sbuilder;
if (reply.Status == IPStatus.Success)
{ {
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); textlog.Text = "TEST";
//连接服务器,绑定IP 与 端口 textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Parse(IP.Text), int.Parse(PORT.Text)); //------------使用ping类------
string host = IP.Text;
try try
{ {
socket.Connect(iPEndPoint); Ping p1 = new Ping();
socket.Close();//离线 PingReply reply = p1.Send(host); //发送主机名或Ip地址
textlog.Text = "Link succeed"; //StringBuilder sbuilder;
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); if (reply.Status == IPStatus.Success)
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//连接服务器,绑定IP 与 端口
IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Parse(IP.Text), int.Parse(PORT.Text));
try
{
socket.Connect(iPEndPoint);
socket.Close();//离线
textlog.Text = "Link succeed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
}
catch (Exception)
{
textlog.Text = "Link failed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
}
}
else if (reply.Status == IPStatus.TimedOut)
{
textlog.Text = "Link timeout";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
else
{
textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
} }
catch (Exception) catch (Exception)
{ {
textlog.Text = "Link failed"; textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
} }
} }
else if (reply.Status == IPStatus.TimedOut) else if (!string.IsNullOrEmpty(comboBoxCOM0.Text))
{ {
textlog.Text = "Link timeout";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
} }
else else
{ {
textlog.Text = "No links"; textlog.Text = "Invalid";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
} }
}
else if (!string.IsNullOrEmpty(comboBoxCOM0.Text))
{
} }
else else
{ {//串口
textlog.Text = "Invalid"; if (!string.IsNullOrEmpty(comboBoxCOM0.Text) && !string.IsNullOrEmpty(Station.Text))
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); {
} textlog.Text = "TEST";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
//------------使用ping类------
string host = IP.Text;
Ping p1 = new Ping();
PingReply reply = p1.Send(host); //发送主机名或Ip地址
//StringBuilder sbuilder;
if (reply.Status == IPStatus.Success)
{
try
{
textlog.Text = "Link succeed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
}
catch (Exception)
{
textlog.Text = "Link failed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 0));
}
}
else
{
textlog.Text = "No links";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
else
{
textlog.Text = "Invalid";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
}
}
} }
} }
} }
+68 -10
View File
@@ -9,12 +9,15 @@
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels" xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
xmlns:localUserClass="clr-namespace:DyeingComputer.UserClass" xmlns:localUserClass="clr-namespace:DyeingComputer.UserClass"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel" xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}" d:DataContext="{d:DesignInstance Type=local:MachinesView}"
mc:Ignorable="d" mc:Ignorable="d"
Loaded="UserControl_Loaded" Loaded="UserControl_Loaded"
d:DesignHeight="900" d:DesignWidth="1200"> d:DesignHeight="900" d:DesignWidth="1200">
<UserControl.Resources> <UserControl.Resources>
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/> <ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
<ConvertMoels:BoolRBConvert x:Key="BoolRBConvert"/> <ConvertMoels:BoolRBConvert x:Key="BoolRBConvert"/>
<ConvertMoels:IORBConvert x:Key="IORBConvert"/> <ConvertMoels:IORBConvert x:Key="IORBConvert"/>
</UserControl.Resources> </UserControl.Resources>
@@ -23,13 +26,13 @@
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="60"/> <RowDefinition Height="60"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<DataGrid Grid.Row="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}" <DataGrid Grid.Row="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=999}"
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True"
AutoGenerateColumns="False" MinColumnWidth="30" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalAlignment="Left" Width="280" MouseDoubleClick="Griddata_MouseDoubleClick"> HorizontalAlignment="Left" Width="250" MouseDoubleClick="Griddata_MouseDoubleClick">
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" /> <Setter Property="Height" Value="30" />
@@ -68,25 +71,72 @@
</DataGrid.Resources> </DataGrid.Resources>
<DataGrid.Columns> <DataGrid.Columns>
<!--列信息绑定--> <!--列信息绑定-->
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}"> <DataGridTemplateColumn Width="100" Header="{x:Static lang:Resources.State}">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center" <UniformGrid VerticalAlignment="Bottom" HorizontalAlignment="Left">
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/> <Border>
<Grid>
<StackPanel Width="100" Orientation="Horizontal">
<materialDesign:PackIcon Width="25" Height="30"
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
<materialDesign:PackIcon Width="25" Height="30" Kind="Lock"
Visibility="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
</StackPanel>
</Grid>
</Border>
</UniformGrid>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="210" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="150" IsReadOnly="True"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Grid Grid.Row="0" Margin="280,0,0,0"> <Grid Grid.Row="0" Margin="250,0,0,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition Height="0"/>
<RowDefinition Height="5"/> <RowDefinition Height="5"/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ContentControl Grid.Row="0" x:Name="machineView"/> <ContentControl Grid.Row="0" x:Name="machineView"/>
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/> <GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/>
<Grid Grid.Row="2" x:Name="LOG_GRID" Visibility="Collapsed">
<DataGrid x:Name="LOG_Grid" AlternationCount="2" Margin="0,0,0,0"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
Background="White" SelectionMode="Single" FontSize="15" >
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="25" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
</DataGrid>
</Grid>
<Grid Grid.Row="2" x:Name="SET_GRID" Visibility="Collapsed"> <Grid Grid.Row="2" x:Name="SET_GRID" Visibility="Collapsed">
<DataGrid x:Name="SET_Grid" AlternationCount="2" Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False" <DataGrid x:Name="SET_Grid" AlternationCount="2" Margin="0,0,0,0" d:ItemsSource="{d:SampleData ItemCount=99}" AutoGenerateColumns="False"
ItemsSource="{Binding Path=Paramete_Set,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=Paramete_Set,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
@@ -376,6 +426,14 @@
</StackPanel> </StackPanel>
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_LOG">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="MathLog" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.log}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel>
</ListViewItem>
</ListView>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="2" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="400" HorizontalAlignment="Right"> <StackPanel Grid.Row="2" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="400" HorizontalAlignment="Right">
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
+413 -64
View File
@@ -4,11 +4,14 @@ using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Net.Sockets; using System.Net.Sockets;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@@ -23,28 +26,45 @@ using System.Windows.Shapes;
using System.Windows.Threading; using System.Windows.Threading;
using TouchSocket.Core; using TouchSocket.Core;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
namespace SunlightCentralizedControlManagement_SCCM_.View namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
/// <summary> /// <summary>
/// MachinesSet.xaml 的交互逻辑 /// MachinesSet.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class MachinesView : UserControl public partial class MachinesView : UserControl, INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
if (propertyName != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
public MachinesView() public MachinesView()
{ {
DataContext = this;
InitializeComponent(); InitializeComponent();
CountDown(); CountDown();
} }
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
//private string SYS_machines = null;
private void UserControl_Loaded(object sender, RoutedEventArgs e) private void UserControl_Loaded(object sender, RoutedEventArgs e)
{ {
} }
string machine; string machine;
int LOG_ = 0;
public static DataTable LOG_dataTable = new DataTable();
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e) private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{ {
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
@@ -63,6 +83,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_ArrowLeftRight(object sender, MouseButtonEventArgs e) private void ListViewItem_ArrowLeftRight(object sender, MouseButtonEventArgs e)
{ {
LOG_GRID.Visibility = Visibility.Collapsed;
IO_GRID.Visibility = Visibility.Visible; IO_GRID.Visibility = Visibility.Visible;
SYS_GRID.Visibility = Visibility.Collapsed; SYS_GRID.Visibility = Visibility.Collapsed;
SET_GRID.Visibility = Visibility.Collapsed; SET_GRID.Visibility = Visibility.Collapsed;
@@ -70,13 +91,81 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
private void ListViewItem_VideoHomeSystem(object sender, MouseButtonEventArgs e) private void ListViewItem_VideoHomeSystem(object sender, MouseButtonEventArgs e)
{ {
LOG_GRID.Visibility = Visibility.Collapsed;
IO_GRID.Visibility = Visibility.Collapsed; IO_GRID.Visibility = Visibility.Collapsed;
SYS_GRID.Visibility = Visibility.Visible; SYS_GRID.Visibility = Visibility.Visible;
SET_GRID.Visibility = Visibility.Collapsed; SET_GRID.Visibility = Visibility.Collapsed;
view = 2; view = 2;
} }
private void ListViewItem_LOG(object sender, MouseButtonEventArgs e)
{
if (LOG_ >= 3) { LOG_ = 0; }
else
{ LOG_++; }
LOG_GRID.Visibility = Visibility.Visible;
IO_GRID.Visibility = Visibility.Collapsed;
SYS_GRID.Visibility = Visibility.Collapsed;
SET_GRID.Visibility = Visibility.Collapsed;
view = 3;
LOG_dataTable.Clear();
Dictionary<string, object> dat_859 =new Dictionary<string, object>();
if (LOG_ == 0)
{
MAC_name.Text = machine+ "(SERVER)";
dat_859.Add("INSTRUCTION", "SERVER");
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
}
else if (LOG_ == 1)
{
MAC_name.Text = machine + "(OperationLog)";
dat_859.Add("INSTRUCTION", "OperationLog");
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
}
else if (LOG_ == 2)
{
MAC_name.Text = machine + "(IOLog)";
dat_859.Add("INSTRUCTION", "IOLog");
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
}
else
{
MAC_name.Text = machine + "(ERRLog)";
dat_859.Add("INSTRUCTION", "ERRLog");
dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss"));
dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
}
if (!string.IsNullOrEmpty(machine))
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
{
if (drEmployee.Field<bool>("Type"))//
{//网络
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{
ID = index,
DAT = "SC859" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
+ dat_859.ToJsonString()
});
}
else
{//串口
}
}
}
}
private void ListViewItem_Dharmachakra(object sender, MouseButtonEventArgs e) private void ListViewItem_Dharmachakra(object sender, MouseButtonEventArgs e)
{ {
LOG_GRID.Visibility = Visibility.Collapsed;
IO_GRID.Visibility = Visibility.Collapsed; IO_GRID.Visibility = Visibility.Collapsed;
SYS_GRID.Visibility = Visibility.Collapsed; SYS_GRID.Visibility = Visibility.Collapsed;
SET_GRID.Visibility = Visibility.Visible; SET_GRID.Visibility = Visibility.Visible;
@@ -109,18 +198,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
datagrid_v.Add("PLC", newValue); datagrid_v.Add("PLC", newValue);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 MainWindowViewModel.SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
SQLiteHelpers.Close();//关闭数据库
} }
IO_data();//重新获得io表 IO_data();//重新获得io表
MainWindowViewModel.D_view = true; D_view = true;
} }
private void Grid_D_BeginningEdit(object sender, DataGridBeginningEditEventArgs e) private void Grid_D_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{ {
MainWindowViewModel.D_view = false; D_view = false;
} }
private void Grid_A_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) private void Grid_A_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
@@ -135,17 +221,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
datagrid_v.Add("PLC", newValue); datagrid_v.Add("PLC", newValue);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 MainWindowViewModel.SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
SQLiteHelpers.Close();//关闭数据库
} }
MainWindowViewModel.A_view = true; A_view = true;
} }
private void Grid_A_BeginningEdit(object sender, DataGridBeginningEditEventArgs e) private void Grid_A_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{ {
MainWindowViewModel.A_view = false; A_view = false;
} }
private void SYS_Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) private void SYS_Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
@@ -162,13 +245,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID")); int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString if (drEmployee.Field<bool>("Type"))//
{ {//网络
ID = index, MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
DAT = "SC862" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + datagrid_v.ToJsonString() {
});//发送862指令修改系统设置 ID = index,
DAT = "SC862" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString()
});//发送862指令修改系统设置
}
else
{//串口
}
} }
MainWindowViewModel.SysSet_view = true; SysSet_view = true;
} }
private void SET_Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) private void SET_Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
@@ -176,7 +266,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息 string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
int rownum = SET_Grid.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = SET_Grid.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效 if (rownum != -1)//判断鼠标定位是否有效
{ {
string ID = (SET_Grid.Columns[1].GetCellContent(SET_Grid.Items[rownum]) as TextBlock).Text;//定位第1列, string ID = (SET_Grid.Columns[1].GetCellContent(SET_Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
@@ -185,23 +275,30 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID")); int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString if (drEmployee.Field<bool>("Type"))//
{ {//网络
ID = index, MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
DAT = "SC861" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)+datagrid_v.ToJsonString() {
});//发送861指令修改程序设置 ID = index,
DAT = "SC861" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + datagrid_v.ToJsonString()
});//发送861指令修改程序设置
}
else
{//串口
}
} }
MainWindowViewModel.ParameterSet_view = true; ParameterSet_view = true;
} }
private void SYS_Grid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e) private void SYS_Grid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{ {
MainWindowViewModel.SysSet_view = false; SysSet_view = false;
} }
private void SET_Grid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e) private void SET_Grid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{ {
MainWindowViewModel.ParameterSet_view = false; ParameterSet_view = false;
} }
private int view = 0; private int view = 0;
@@ -210,42 +307,67 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (!string.IsNullOrEmpty(machine)) if (!string.IsNullOrEmpty(machine))
{ {
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
int index = Convert.ToInt16(drEmployee.Field<object>("ID")); if (drEmployee.Field<bool>("Type"))//
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息 {//网络
{ int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
if (view == 0) int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
{ {
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString if (view == 0)
{ {
ID = index, MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
DAT = "SC851" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) {
}); ID = index,
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString DAT = "SC851" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
});
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{
ID = index,
DAT = "SC852" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
});
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{
ID = index,
DAT = "SC853" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
});
}
else if (view == 1)
{ {
ID = index, MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
DAT = "SC852" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) {
}); ID = index,
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString DAT = "SC854" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
});
}
else if (view == 2)
{ {
ID = index, MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
DAT = "SC853" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) {
}); ID = index,
} else if (view==1) DAT = "SC855" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'")
{ });
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString }
{
ID = index,
DAT = "SC854" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)
});
} }
else if (view == 2) }
else
{//串口
int State_ = Convert.ToInt16(drEmployee.Field<object>("State"));
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
if ((State_ == 101) || (State_ == 201) || (State_ == 202) || (State_ == 309))//获得细节信息
{ {
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString if (view == 0)
{ {
ID = index,
DAT = "SC855" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) }
}); else if (view == 1)
{
}
else if (view == 2)
{
}
} }
} }
} }
@@ -261,8 +383,235 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
timer1s.Start(); timer1s.Start();
}//时间周期初始化 }//时间周期初始化
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{ IO_data(); } {
IO_data();
DATA_view();
if (LOG_dataTable.Rows.Count > 0) {
LOG_Grid.ItemsSource = LOG_dataTable.DefaultView;
// LOG_dataTable.Clear();
}
}
private async void DATA_view()//IO显示
{
await Task.Run(() =>
{
try
{
if (dt_m.Rows.Count >= 0)
{
SYSData_M = ToObservableCollection<DATA_M>(dt_m);
}
}
catch (Exception) { }
try
{
if (dt_a.Rows.Count >= 0)
{
if ((bool)A_view) SYSData_A = ToObservableCollection<DATA_A>(dt_a);
}
}
catch (Exception) { }
try
{
if (dt_d.Rows.Count >= 0)
{
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
}
}
catch (Exception) { }
try
{
TechnologicalMachine_View = ToObservableCollection<TechnologicalM>(Machines);
}
catch (Exception) { }
try
{
if (dt_ParameterSet.Rows.Count >= 0)
{
if (ParameterSet_view) Paramete_Set = ToObservableCollection<ParameterSet>(dt_ParameterSet);
}
}
catch (Exception) { }
try
{
if (dt_SysSet.Rows.Count >= 0)
{
if (SysSet_view) Sys_Set = ToObservableCollection<SysSet>(dt_SysSet);
}
}
catch (Exception) { }
});
}
bool A_view =true;
bool D_view =true;
bool ParameterSet_view = true;
bool SysSet_view = true;
ObservableCollection<DATA_A> sysData_A = new ObservableCollection<DATA_A>();
ObservableCollection<DATA_D> sysData_D = new ObservableCollection<DATA_D>();
ObservableCollection<DATA_M> sysData_M = new ObservableCollection<DATA_M>();
ObservableCollection<ParameterSet> paramete_Set = new ObservableCollection<ParameterSet>();
ObservableCollection<SysSet> sys_Set = new ObservableCollection<SysSet>();
ObservableCollection<TechnologicalM> technologicalMachine_View = new ObservableCollection<TechnologicalM>();
public ObservableCollection<DATA_A> SYSData_A
{
get { return sysData_A; }
set
{
sysData_A = value;
RaisePropertyChanged("SYSData_A");
}
}
public ObservableCollection<DATA_D> SYSData_D
{
get { return sysData_D; }
set
{
sysData_D = value;
RaisePropertyChanged("SYSData_D");
}
}
public ObservableCollection<DATA_M> SYSData_M
{
get { return sysData_M; }
set
{
sysData_M = value;
RaisePropertyChanged("SYSData_M");
}
}
public ObservableCollection<TechnologicalM> TechnologicalMachine_View
{
get { return technologicalMachine_View; }
set
{
technologicalMachine_View = value;
RaisePropertyChanged("TechnologicalMachine_View");
}
}
public ObservableCollection<ParameterSet> Paramete_Set
{
get { return paramete_Set; }
set
{
paramete_Set = value;
RaisePropertyChanged("Paramete_Set");
}
}
public ObservableCollection<SysSet> Sys_Set
{
get { return sys_Set; }
set
{
sys_Set = value;
RaisePropertyChanged("Sys_Set");
}
}
public class DATA_A
{
public string IOName { get; set; }
public int AIO { get; set; }
public string ID { get; set; }
public string PLC { get; set; }
public string type { get; set; }
}
public class DATA_D
{
public string IOName { get; set; }
public bool DIO { get; set; }
public string ID { get; set; }
public string PLC { get; set; }
public string type { get; set; }
}
public class DATA_M
{
public string IOName { get; set; }
public double Value { get; set; }
public string ID { get; set; }
public string PLC { get; set; }
public string type { get; set; }
}
public class TechnologicalM
{
public string Name { get; set; }
public string WorkOrder { get; set; }
public string Dyelot { get; set; }
public string Temperature { get; set; }
public string WaterLevel { get; set; }
public string Process { get; set; }
public string Step { get; set; }
public string Message { get; set; }
public string State { get; set; }
public string LOCK { get; set; }
}
public class ParameterSet
{
public string Category { get; set; }
public string ParameterID { get; set; }
public string ParameterName { get; set; }
public string Value { get; set; }
}
public class SysSet
{
public string Category { get; set; }
public string ParameterID { get; set; }
public string ParameterName { get; set; }
public string Value { get; set; }
}
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
{
try
{
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;
}
catch (Exception) { return null; }
}
} }
} }
+217 -48
View File
@@ -5,14 +5,29 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View" xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties" xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:rdp="clr-namespace:VncSharpWpf;assembly=VncSharpWpf"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel" xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels" xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}" d:DataContext="{d:DesignInstance Type=local:MonitorView}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="1000" d:DesignWidth="1900"> d:DesignHeight="1000" d:DesignWidth="1900">
<UserControl.Resources> <UserControl.Resources>
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/> <ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
<ContextMenu x:Key="PersoncontextMenu">
<MenuItem Header="{x:Static lang:Resources._lock}" Click="MenuItem_LOCK_XML"/>
<MenuItem Header="{x:Static lang:Resources._Auto}" Click="MenuItem_AUTO_XML"/>
<MenuItem Header="{x:Static lang:Resources.Stop}" Click="MenuItem_Stop_XML"/>
<MenuItem Header="{x:Static lang:Resources.Start}" Click="MenuItem_Start_XML"/>
</ContextMenu>
<ContextMenu x:Key="PersoncontextMenuStep">
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
<MenuItem Header="{x:Static lang:Resources.Insert}" Click="MenuItem_Insert"/>
<MenuItem Header="{x:Static lang:Resources.Delete}" Click="MenuItem_Delete"/>
</ContextMenu>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -21,16 +36,19 @@
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="60"/> <RowDefinition Height="60"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True" SelectionChanged="Griddata_SelectionChanged" <DataGrid Grid.Row="0" Grid.Column="0" x:Name="Griddata" AlternationCount="2" IsReadOnly="True"
SelectionChanged="Griddata_SelectionChanged" EnableRowVirtualization="True" EnableColumnVirtualization="True"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=TechnologicalMachine_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="True"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" > CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" >
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" /> <Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="25" /> <Setter Property="FontSize" Value="25" />
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers> <Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0"> <Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" /> <Setter Property="Background" Value="#FFFFFFFF" />
@@ -39,6 +57,27 @@
<Setter Property="Background" Value="#FFF0F0F0" /> <Setter Property="Background" Value="#FFF0F0F0" />
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="False"/> <Trigger Property="IsMouseOver" Value="False"/>
<DataTrigger Binding="{Binding State}" Value="309">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="308">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="800">
<Setter Property="IsHitTestVisible" Value="False"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="101">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenu}"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="201">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenu}"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="202">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenu}"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="309">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenu}"/>
</DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</DataGrid.RowStyle> </DataGrid.RowStyle>
@@ -46,6 +85,7 @@
<Style TargetType="DataGridCell"> <Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/> <Setter Property="MinWidth" Value="20"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsSelected" Value="True"> <Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/> <Setter Property="Background" Value="#FFC0C0C0"/>
@@ -61,51 +101,92 @@
<Setter Property="Background" Value="#FFFFFFFF"/> <Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/> <Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/> <Setter Property="Foreground" Value="#000000"/>
</Style> </Style>
</DataGrid.Resources> </DataGrid.Resources>
<DataGrid.Columns> <DataGrid.Columns>
<!--列信息绑定--> <!--列信息绑定-->
<DataGridTemplateColumn Width="70" Header="{x:Static lang:Resources.State}"> <DataGridTextColumn Binding="{Binding State}" Width="0" MaxWidth="0" IsReadOnly="True"/>
<DataGridTemplateColumn Width="100" Header="{x:Static lang:Resources.State}">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<materialDesign:PackIcon Kind="StateMachine" Width="25" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center" <UniformGrid VerticalAlignment="Bottom" HorizontalAlignment="Left">
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/> <Border>
<Grid>
<StackPanel Width="100" Orientation="Horizontal">
<materialDesign:PackIcon Width="25" Height="30"
Kind="{Binding Path=State,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
<materialDesign:PackIcon Width="25" Height="30" Kind="Lock"
Visibility="{Binding Path=LOCK,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
<materialDesign:PackIcon Width="25" Height="30" Kind="HandBackRight"
Visibility="{Binding Path=AUTO,Converter={StaticResource StatexmlConvert}}"
Foreground="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
</StackPanel>
</Grid>
</Border>
</UniformGrid>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="150" IsReadOnly="True"> <DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Name}" Width="80" IsReadOnly="True">
<DataGridTextColumn.ElementStyle> <DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}"> <Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/> <Setter Property="Foreground" Value="{Binding Path=State,Converter={StaticResource StateToColorConvert}}"/>
</Style> </Style>
</DataGridTextColumn.ElementStyle> </DataGridTextColumn.ElementStyle>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True">
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="200" IsReadOnly="True"/> <DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="ToolTip" Value="{Binding WorkOrder}"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Dyelot}" Binding="{Binding Dyelot}" Width="0" MaxWidth="0" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Temperature}" Binding="{Binding Temperature}" Width="100" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.Temperature}" Binding="{Binding Temperature}" Width="100" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.WaterLevel}" Binding="{Binding WaterLevel}" Width="100" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.WaterLevel}" Binding="{Binding WaterLevel}" Width="100" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.process}" Binding="{Binding Process}" Width="300" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.process}" Binding="{Binding Process}" Width="300" IsReadOnly="True">
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="300" IsReadOnly="True"/> <DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="ToolTip" Value="{Binding Process}"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="300" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="ToolTip" Value="{Binding Step}"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.message}" Binding="{Binding Message}" Width="*" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.message}" Binding="{Binding Message}" Width="*" IsReadOnly="True"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/> <GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FF00204E"/>
<Grid Grid.Row="2" d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"> <Grid Grid.Row="2" >
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition Width="5"/> <ColumnDefinition Width="5"/>
<ColumnDefinition/> <ColumnDefinition MinWidth="1200"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" IsReadOnly="True" SelectionChanged="Gridstep_SelectionChanged" <DataGrid Grid.Column="2" x:Name="Gridstep" AlternationCount="2" SelectionChanged="Gridstep_SelectionChanged"
d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30" EnableRowVirtualization="True" EnableColumnVirtualization="True"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=TechnologicalProcess_View,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White"
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" BorderBrush="{x:Null}" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" BorderBrush="{x:Null}"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" > CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" CanUserAddRows="False">
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" /> <Setter Property="IsHitTestVisible" Value="{Binding DataContext.IsInteractive,
RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<Setter Property="Height" Value="100" />
<Setter Property="FontSize" Value="25" /> <Setter Property="FontSize" Value="25" />
<Style.Triggers> <Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0"> <Trigger Property="ItemsControl.AlternationIndex" Value="0">
@@ -115,6 +196,19 @@
<Setter Property="Background" Value="#FFF0F0F0" /> <Setter Property="Background" Value="#FFF0F0F0" />
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="False"/> <Trigger Property="IsMouseOver" Value="False"/>
<DataTrigger Binding="{Binding RUN}" Value="1">
<Setter Property="Background" Value="#FF00D6FF"/>
</DataTrigger>
<DataTrigger Binding="{Binding RUN}" Value="2">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding RUN}" Value="9">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding DataContext.IsInteractive,
RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="true">
<Setter Property="ContextMenu" Value="{StaticResource PersoncontextMenuStep}"/>
</DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</DataGrid.RowStyle> </DataGrid.RowStyle>
@@ -134,26 +228,102 @@
<!--列信息绑定--> <!--列信息绑定-->
<DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Step}" Width="70" Header="{x:Static lang:Resources.Step}" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}"
<DataGridTextColumn Binding="{Binding StepID}" Width="0" MinWidth="0" MaxWidth="0" IsReadOnly="True"/> Width="80" IsReadOnly="True">
<DataGridTextColumn Binding="{Binding StepName}" Header="{x:Static lang:Resources.Directives}" Width="300" IsReadOnly="True"/> <DataGridTextColumn.ElementStyle>
<DataGridTextColumn Binding="{Binding ParameterName}" Header="{x:Static lang:Resources.ParameterSet}" Width="*" IsReadOnly="True"/> <Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepID}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepName}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding ParameterName}" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding DYELOT}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="600" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0,0,0.5">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.Function}"/>
<Run Text=":"/>
<Run Text="{Binding StepName}"/>
</TextBlock>
</Border>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0.5,0,0">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.ParameterSet}"/>
<Run Text=":"/>
<Run Text="{Binding ParameterName}"/>
</TextBlock>
</Border>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S1,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S2,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S3 ,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Remark}" Binding="{Binding Remark}"
Width="*" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/> <TextBlock Grid.Column="0" x:Name="machin_LOG" TextWrapping="Wrap" FontSize="27" VerticalAlignment="Top" Height="40" Background="#FF2793FF" Foreground="White" FontWeight="Bold"/>
<TextBlock Grid.Column="0" x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White" Margin="0,40,0,0" Grid.ColumnSpan="2"/> <Grid Margin="0,40,0,0" Grid.ColumnSpan="2" Grid.Column="0" >
<ContentControl Grid.Column="0" x:Name="Picture" Background="White" Margin="0,40,0,0" Grid.ColumnSpan="2"/> <rdp:RemoteDesktopWpf x:Name="rdp" Visibility="Collapsed" />
<ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="VerticalOnly">
<TextBlock x:Name="log" Text="{Binding Sys_machine}" TextWrapping="Wrap" FontSize="25" Background="White"/>
</ScrollViewer>
<ContentControl x:Name="Picture" Background="White"/>
</Grid>
<GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/> <GridSplitter Grid.Row="0" Grid.Column="1" Width="5" HorizontalAlignment="Center" Background="#FF00204E"/>
</Grid> </Grid>
<StackPanel Grid.Row="3" x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0" Width="700" HorizontalAlignment="Left"> <StackPanel Grid.Row="3" x:Name="mt" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Width="800" HorizontalAlignment="Left">
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_DyeingMachine"> <ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_DyeingMachine" IsHitTestVisible="False" x:Name="DyeingMachine">
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
<materialDesign:PackIcon Kind="CoffeeMachine" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="CoffeeMachine" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.DyeingMachine}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.DyeingMachine}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -161,34 +331,33 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_Curve"> <ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Curve" IsHitTestVisible="False" x:Name="Curve">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="ChartBellCurve" Width="25" Height="25" Margin="10" VerticalAlignment="Center"/> <materialDesign:PackIcon Kind="ChartBellCurve" Width="40" Height="30" Margin="10" VerticalAlignment="Center"/>
<TextBlock Text="{x:Static lang:Resources.Curve}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Curve}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel> </StackPanel>
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Conveyor"> <ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Screen" IsHitTestVisible="False" x:Name="Screen">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Pipe" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Monitor" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Conveyor}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Screen}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel> </StackPanel>
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Receipt"> <ListViewItem MinWidth="150" MouseLeftButtonUp="ListViewItem_Receipt" IsHitTestVisible="False" x:Name="Receipt">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="ReceiptText" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="ReceiptText" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Receipt}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Receipt}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel> </StackPanel>
</ListViewItem> </ListViewItem>
</ListView> </ListView>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="3" x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="700,0,0,0"> <StackPanel Grid.Row="3" x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="800,0,0,0">
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Resume" IsEnabled="False" x:Name="Resume"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Resume" IsHitTestVisible="False" x:Name="Resume">
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
<materialDesign:PackIcon Kind="Resume" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Resume" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Resume}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Resume}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -196,7 +365,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Paused" IsEnabled="False" x:Name="Paused"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Paused" IsHitTestVisible="False" x:Name="Paused">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Pause" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Pause" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Paused}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Paused}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -204,7 +373,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Stop" IsEnabled="False" x:Name="Stop"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Stop" IsHitTestVisible="False" x:Name="Stop">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Stop" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Stop" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Stop}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Stop}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -212,7 +381,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsHitTestVisible="False" x:Name="edit">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -220,7 +389,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Jump" IsEnabled="False" x:Name="Jump"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Jump" IsHitTestVisible="False" x:Name="Jump">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Jump" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Jump" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Jump}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Jump}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -228,7 +397,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsEnabled="False" x:Name="Insert"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsHitTestVisible="False" x:Name="Insert">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="InsertInvitation" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="InsertInvitation" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -236,7 +405,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsHitTestVisible="False" x:Name="Delete">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
+1137 -117
View File
File diff suppressed because it is too large. Load diff
+72 -10
View File
@@ -6,8 +6,14 @@
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View" xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties" xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
mc:Ignorable="d" Loaded="UserControl_Loaded" mc:Ignorable="d" Loaded="UserControl_Loaded"
d:DesignHeight="900" d:DesignWidth="550"> d:DesignHeight="900" d:DesignWidth="550">
<UserControl.Resources>
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
</UserControl.Resources>
<Grid Background="White" Cursor=""> <Grid Background="White" Cursor="">
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,30,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270" <ComboBox HorizontalAlignment="Left" Height="30" Margin="150,30,0,0" x:Name="comboBoxMachine" VerticalAlignment="Top" Width="270"
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" IsReadOnly="True" /> FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" IsReadOnly="True" />
@@ -34,7 +40,7 @@
Margin="0,200,0,60" > Margin="0,200,0,60" >
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="25" /> <Setter Property="Height" Value="100" />
<Setter Property="FontSize" Value="15" /> <Setter Property="FontSize" Value="15" />
<Style.Triggers> <Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0"> <Trigger Property="ItemsControl.AlternationIndex" Value="0">
@@ -64,20 +70,76 @@
<!--列信息绑定--> <!--列信息绑定-->
<DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="40" IsReadOnly="True" /> <DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}"
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="0" MinWidth="0" MaxWidth="0" Binding="{Binding StepID}" IsReadOnly="True"/> Width="60" IsReadOnly="True">
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="200" Binding="{Binding StepName}" IsReadOnly="True"/> <DataGridTextColumn.ElementStyle>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="*" Binding="{Binding ParameterName}" IsReadOnly="True"/> <Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepID}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepName}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding ParameterName}" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter6}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="100" IsReadOnly="True">
<DataGridTextColumn Binding="{Binding Parameter7}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTemplateColumn.CellTemplate>
<DataGridTextColumn Binding="{Binding Parameter8}" Width="0" MinWidth="0" MaxWidth="0"/> <DataTemplate>
<DataGridTextColumn Binding="{Binding Parameter9}" Width="0" MinWidth="0" MaxWidth="0"/> <Image Source="{Binding Path=StepID,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
<DataGridTextColumn Binding="{Binding Parameter10}" Width="0" MinWidth="0" MaxWidth="0"/> </DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="300" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0,0,0.5">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.Function}"/>
<Run Text=":"/>
<Run Text="{Binding StepName}"/>
</TextBlock>
</Border>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0.5,0,0">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.ParameterSet}"/>
<Run Text=":"/>
<Run Text="{Binding ParameterName}"/>
</TextBlock>
</Border>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S1,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S2,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S3 ,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
+43 -42
View File
@@ -31,9 +31,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
/// ProductionPlanningEdit.xaml 的交互逻辑 /// ProductionPlanningEdit.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class ProductionPlanningEdit : UserControl public partial class ProductionPlanningEdit : UserControl
{ {
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
DataTable ProgramName = new DataTable(); DataTable ProgramName = new DataTable();
DataTable WorkOrder =new DataTable(); DataTable WorkOrder =new DataTable();
DataTable dat = new DataTable(); DataTable dat = new DataTable();
@@ -41,15 +39,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
public ProductionPlanningEdit(string workOrder, bool save) public ProductionPlanningEdit(string workOrder, bool save)
{ {
InitializeComponent(); InitializeComponent();
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 ProgramName = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from ProgramName order by ProgramID desc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Open(); //打开数据库
ProgramName = SQLiteHelpers.ExecuteDataSet("select * from ProgramName order by ProgramID desc", null).Tables[0]; //读取计划表写入缓存
if (!string.IsNullOrEmpty(workOrder)) if (!string.IsNullOrEmpty(workOrder))
{ {
WorkOrder = SQLiteHelpers.ExecuteDataSet("select * from Workorder where Workorder='" + workOrder + "' order by EndTime desc", null).Tables[0]; WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Workorder where Workorder='" + workOrder + "' order by EndTime desc", null).Tables[0];
// dat = SQLiteHelpers.ExecuteDataSet("select * from WorkorderSteps order by Step asc", null).Tables[0]; // dat = SQLiteHelpers.ExecuteDataSet("select * from WorkorderSteps order by Step asc", null).Tables[0];
} }
SQLiteHelpers.Close(); //关闭连接
if (!string.IsNullOrEmpty(workOrder)) if (!string.IsNullOrEmpty(workOrder))
{ {
@@ -83,10 +78,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (sArray.Length <= 1) if (sArray.Length <= 1)
{ {
comboBoxDyelot.IsEnabled = true; comboBoxDyelot.IsEnabled = true;
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 DataTable DatDyelot = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Machine='" + comboBoxMachine.Text + "' and State='101' order by Dyelot desc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Open(); //打开数据库
DataTable DatDyelot = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Machine='" + comboBoxMachine.Text + "' and State='101' order by Dyelot desc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Close(); //关闭连接
comboBoxDyelot.ItemsSource = DatDyelot.AsEnumerable().Select(rowdata => rowdata.Field<string>("Dyelot")).ToList();//转换代码 comboBoxDyelot.ItemsSource = DatDyelot.AsEnumerable().Select(rowdata => rowdata.Field<string>("Dyelot")).ToList();//转换代码
} }
} }
@@ -153,11 +145,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
string State_ = "100"; string State_ = "100";
string Dyelot_ = comboBoxDyelot.Text; string Dyelot_ = comboBoxDyelot.Text;
string color_ = color_color.Background.ToString(); string color_ = color_color.Background.ToString();
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
try try
{ {
sTime = SQLiteHelpers.ExecuteDataSet( sTime = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
"select * from WorkOrder where Machines='" + comboBoxMachine.Text + "' order by EndTime desc", null). "select * from WorkOrder where Machines='" + comboBoxMachine.Text + "' order by EndTime desc", null).
Tables[0].Select().First().Field<object>("EndTime").ToString(); //读取计划表写入缓存 Tables[0].Select().First().Field<object>("EndTime").ToString(); //读取计划表写入缓存
if (DateTime.Now < DateTime.Parse(sTime)) if (DateTime.Now < DateTime.Parse(sTime))
@@ -196,8 +186,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
WorkOrder_new.Add("Dyelot", Dyelot_); WorkOrder_new.Add("Dyelot", Dyelot_);
WorkOrder_new.Add("Remark", null); WorkOrder_new.Add("Remark", null);
WorkOrder_new.Add("lock", 0); WorkOrder_new.Add("lock", 0);
WorkOrder_new.Add("color", color_); WorkOrder_new.Add("color", color_);
SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入 MainWindowViewModel.SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入
Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数
for (int x = 0; x < dat.Rows.Count; x++) for (int x = 0; x < dat.Rows.Count; x++)
@@ -219,11 +209,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
WorkOrder_DAT.Add("Parameter7", dat.Rows[x]["Parameter7"]); WorkOrder_DAT.Add("Parameter7", dat.Rows[x]["Parameter7"]);
WorkOrder_DAT.Add("Parameter8", dat.Rows[x]["Parameter8"]); WorkOrder_DAT.Add("Parameter8", dat.Rows[x]["Parameter8"]);
WorkOrder_DAT.Add("Parameter9", dat.Rows[x]["Parameter9"]); WorkOrder_DAT.Add("Parameter9", dat.Rows[x]["Parameter9"]);
WorkOrder_DAT.Add("Parameter10", dat.Rows[x]["Parameter10"]); WorkOrder_DAT.Add("Parameter10", dat.Rows[x]["Parameter10"]);
SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入 MainWindowViewModel.SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
WorkOrder_DAT.Clear(); WorkOrder_DAT.Clear();
} }
SQLiteHelpers.Close(); //关闭连接
} }
else else
{//多机器载入 {//多机器载入
@@ -260,11 +249,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
string State_ = "100"; string State_ = "100";
string Dyelot_ = comboBoxDyelot.Text; string Dyelot_ = comboBoxDyelot.Text;
string color_ = color_color.Background.ToString(); string color_ = color_color.Background.ToString();
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
try try
{ {
sTime = SQLiteHelpers.ExecuteDataSet( sTime = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
"select * from WorkOrder where Machines='" + sArray[i] + "' order by EndTime desc", null). "select * from WorkOrder where Machines='" + sArray[i] + "' order by EndTime desc", null).
Tables[0].Select().First().Field<object>("EndTime").ToString(); //读取计划表写入缓存 Tables[0].Select().First().Field<object>("EndTime").ToString(); //读取计划表写入缓存
if (DateTime.Now < DateTime.Parse(sTime)) if (DateTime.Now < DateTime.Parse(sTime))
@@ -306,7 +293,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
WorkOrder_new.Add("color", color_); WorkOrder_new.Add("color", color_);
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 //SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
//SQLiteHelpers.Open(); //打开数据库 //SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入 MainWindowViewModel.SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);// 执行插入
Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> WorkOrder_DAT = new Dictionary<string, object>();//缓存函数
for (int x = 0; x < dat.Rows.Count; x++) for (int x = 0; x < dat.Rows.Count; x++)
@@ -329,10 +316,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
WorkOrder_DAT.Add("Parameter8", dat.Rows[x]["Parameter8"]); WorkOrder_DAT.Add("Parameter8", dat.Rows[x]["Parameter8"]);
WorkOrder_DAT.Add("Parameter9", dat.Rows[x]["Parameter9"]); WorkOrder_DAT.Add("Parameter9", dat.Rows[x]["Parameter9"]);
WorkOrder_DAT.Add("Parameter10", dat.Rows[x]["Parameter10"]); WorkOrder_DAT.Add("Parameter10", dat.Rows[x]["Parameter10"]);
SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入 MainWindowViewModel.SQLiteHelpers.InsertData("WorkorderSteps", WorkOrder_DAT);//行插入
WorkOrder_DAT.Clear(); WorkOrder_DAT.Clear();
} }
SQLiteHelpers.Close(); //关闭连接
} }
} }
this.Visibility = Visibility.Collapsed; this.Visibility = Visibility.Collapsed;
@@ -359,11 +345,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (!string.IsNullOrEmpty(comboBoxProgram.Text)) if (!string.IsNullOrEmpty(comboBoxProgram.Text))
{ {
dat.Clear(); dat.Clear();
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 dat = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
SQLiteHelpers.Open(); //打开数据库
dat = SQLiteHelpers.ExecuteDataSet(
"select * from ProgramSteps where Program='" + comboBoxProgram.SelectedValue + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存 "select * from ProgramSteps where Program='" + comboBoxProgram.SelectedValue + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
SQLiteHelpers.Close(); //关闭连接
DatSteps(dat); DatSteps(dat);
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
} }
@@ -378,11 +361,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
try try
{ {
string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase); string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
for (int i = 0; i < sArray.Length; i++) for (int i = 0; i < sArray.Length; i++)
{ {
DataTable temp = SQLiteHelpers.ExecuteDataSet( DataTable temp = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
"select * from ProgramSteps where Program='" + sArray[i] + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存 "select * from ProgramSteps where Program='" + sArray[i] + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
if (dat.Columns.Count == 0) dat = temp.Clone(); if (dat.Columns.Count == 0) dat = temp.Clone();
foreach (DataRow drT in temp.Rows) foreach (DataRow drT in temp.Rows)
@@ -392,10 +373,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
}//以工艺名组合工艺细节 }//以工艺名组合工艺细节
if (!string.IsNullOrEmpty(WorkOrder_n)) if (!string.IsNullOrEmpty(WorkOrder_n))
{ {
dat = SQLiteHelpers.ExecuteDataSet( dat = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_n + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存 "select * from WorkorderSteps where WorkOrder='" + WorkOrder_n + "' order by Step asc", null).Tables[0]; //读取计划表写入缓存
}//插入工单不为空时载入细节信息 }//插入工单不为空时载入细节信息
SQLiteHelpers.Close(); //关闭连接
DatSteps(dat); DatSteps(dat);
Grid_data.ItemsSource = dat.DefaultView;//显示 Grid_data.ItemsSource = dat.DefaultView;//显示
} }
@@ -442,7 +422,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = dat.Rows.Count.ToString(); if (ID == null) ID = dat.Rows.Count.ToString();
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -454,15 +434,36 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
int n = StrToInt.To16Convert10(ID); int n = StrToInt.To16Convert10(ID);
DataRow dr = dat.Rows[n - 1]; DataRow dr = dat.Rows[n - 1];
dr.BeginEdit(); dr.BeginEdit();
dr["StepID"] = e.StepID; dr["StepID"] = e.StepID;
dr["StepName"] = e.StepNAME; dr["StepName"] = e.StepNAME;
dr["ParameterName"] = e.PNAME; dr["ParameterName"] = e.PNAME;
dr["Parameter1"] = e.P1; dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter2"] = e.P2; dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter3"] = e.P3; dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter4"] = e.P4; dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter5"] = e.P5; dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
dr["Parameter4_S1"] = e.Row_DAT.Field<double>("Parameter4_S1");
dr["Parameter5_S1"] = e.Row_DAT.Field<double>("Parameter5_S1");
dr["Parameter1_S2"] = e.Row_DAT.Field<double>("Parameter1_S2");
dr["Parameter2_S2"] = e.Row_DAT.Field<double>("Parameter2_S2");
dr["Parameter3_S2"] = e.Row_DAT.Field<double>("Parameter3_S2");
dr["Parameter4_S2"] = e.Row_DAT.Field<double>("Parameter4_S2");
dr["Parameter5_S2"] = e.Row_DAT.Field<double>("Parameter5_S2");
dr["Parameter1_S3"] = e.Row_DAT.Field<double>("Parameter1_S3");
dr["Parameter2_S3"] = e.Row_DAT.Field<double>("Parameter2_S3");
dr["Parameter3_S3"] = e.Row_DAT.Field<double>("Parameter3_S3");
dr["Parameter4_S3"] = e.Row_DAT.Field<double>("Parameter4_S3");
dr["Parameter5_S3"] = e.Row_DAT.Field<double>("Parameter5_S3");
dr["StepName_S1"] = e.Row_DAT.Field<string>("StepName_S1");
dr["StepName_S2"] = e.Row_DAT.Field<string>("StepName_S2");
dr["StepName_S3"] = e.Row_DAT.Field<string>("StepName_S3");
dr["StepID_S1"] = e.Row_DAT.Field<string>("StepID_S1");
dr["StepID_S2"] = e.Row_DAT.Field<string>("StepID_S2");
dr["StepID_S3"] = e.Row_DAT.Field<string>("StepID_S3");
dr.EndEdit(); dr.EndEdit();
Grid_data.ItemsSource = dat.DefaultView; Grid_data.ItemsSource = dat.DefaultView;
+23 -32
View File
@@ -60,8 +60,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
DataTable WorkOrder; DataTable WorkOrder;
private DateTime minDate; private DateTime minDate;
private DateTime maxDate; private DateTime maxDate;
@@ -71,6 +69,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
minDate = DateTime.Now.Date; minDate = DateTime.Now.Date;
maxDate = minDate.AddDays(1); maxDate = minDate.AddDays(1);
//添加表右键功能 //添加表右键功能
ganttTaskContextMenuItems.Add(new ContextMenuItem(DyelotClicked, Properties.Resources.Dyelot + "..."));
ganttTaskContextMenuItems.Add(new ContextMenuItem(ViewClicked, Properties.Resources.View + "...")); ganttTaskContextMenuItems.Add(new ContextMenuItem(ViewClicked, Properties.Resources.View + "..."));
ganttTaskContextMenuItems.Add(new ContextMenuItem(DelayedClicked, Properties.Resources.State + "...")); ganttTaskContextMenuItems.Add(new ContextMenuItem(DelayedClicked, Properties.Resources.State + "..."));
ganttTaskContextMenuItems.Add(new ContextMenuItem(EditClicked, Properties.Resources.edit + "...")); ganttTaskContextMenuItems.Add(new ContextMenuItem(EditClicked, Properties.Resources.edit + "..."));
@@ -82,13 +81,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private ObservableCollection<ContextMenuItem> ganttTaskContextMenuItems = new ObservableCollection<ContextMenuItem>(); private ObservableCollection<ContextMenuItem> ganttTaskContextMenuItems = new ObservableCollection<ContextMenuItem>();
public void GanttChartNEW() public void GanttChartNEW()
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 WorkOrder = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
SQLiteHelpers.Open(); //打开数据库
WorkOrder = SQLiteHelpers.ExecuteDataSet(
"select * from WorkOrder where StartTime>'" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd HH:mm:ss") "select * from WorkOrder where StartTime>'" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd HH:mm:ss")
+ "'or EndTime>'" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd HH:mm:ss") + "'Order by StartTime", null).Tables[0]; //读取表写入缓存 + "'or EndTime>'" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd HH:mm:ss") + "'Order by StartTime", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
//生成表 //生成表
GanttChart.ClearGantt(); GanttChart.ClearGantt();
@@ -124,6 +120,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Name = Properties.Resources.ProcessName + ": " + dataRows[j].Field<string>("ProgramName"), Name = Properties.Resources.ProcessName + ": " + dataRows[j].Field<string>("ProgramName"),
Background = colorBackground, Background = colorBackground,
Status = colorStatus, Status = colorStatus,
WorkOrder = dataRows[j].Field<string>("WorkOrder").ToString(),
ID = Properties.Resources.WorkOrder + ": " + dataRows[j].Field<string>("WorkOrder").ToString(), ID = Properties.Resources.WorkOrder + ": " + dataRows[j].Field<string>("WorkOrder").ToString(),
Dyelot = Properties.Resources.Dyelot + ": " + dataRows[j].Field<string>("Dyelot"), Dyelot = Properties.Resources.Dyelot + ": " + dataRows[j].Field<string>("Dyelot"),
Remark = Properties.Resources.Remark + ": " + dataRows[j].Field<string>("Remark"), Remark = Properties.Resources.Remark + ": " + dataRows[j].Field<string>("Remark"),
@@ -145,11 +142,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
Picture.Content = null; Picture.Content = null;
Picture.Width = 600; Picture.Width = 600;
Picture.Content = new ProductionPlanningEdit(ganttTask.ID,false); Picture.Content = new ProductionPlanningEdit(ganttTask.WorkOrder,false);
} }
private void AdvanceClicked(GanttTask ganttTask) private void DyelotClicked(GanttTask ganttTask)//领料单查看
{ {
UserMessage userMessage = new UserMessage();
userMessage.Dyelots(ganttTask.WorkOrder);
userMessage.ShowDialog();
} }
private void DelayedClicked(GanttTask ganttTask) private void DelayedClicked(GanttTask ganttTask)
{ {
@@ -158,12 +157,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void EditClicked(GanttTask ganttTask) private void EditClicked(GanttTask ganttTask)
{ {
if (MainWindowViewModel.USER_Capacity[6]) if (MainWindowViewModel.USER_Capacity[6])
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 DataTable WorkOrder_dt = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
SQLiteHelpers.Open(); //打开数据库 "select * from WorkOrder where WorkOrder='" + ganttTask.WorkOrder + "'Order by StartTime", null).Tables[0]; //读取表写入缓存
DataTable WorkOrder_dt = SQLiteHelpers.ExecuteDataSet(
"select * from WorkOrder where WorkOrder='" + ganttTask.ID + "'Order by StartTime", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
if (DateTime.Now > DateTime.Parse(WorkOrder_dt.Select().First().Field<object>("EndTime").ToString())) if (DateTime.Now > DateTime.Parse(WorkOrder_dt.Select().First().Field<object>("EndTime").ToString()))
{ {
@@ -176,7 +172,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
Picture.Content = null; Picture.Content = null;
Picture.Width = 600; Picture.Width = 600;
Picture.Content = new ProductionPlanningEdit(ganttTask.ID, true); Picture.Content = new ProductionPlanningEdit(ganttTask.WorkOrder, true);
} }
else else
{ {
@@ -192,11 +188,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + ganttTask.Name, "Delete ", if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + ganttTask.Name, "Delete ",
System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
{ {
///执行删除 ///执行删除
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 MainWindowViewModel.SQLiteHelpers.Delete("WorkOrder", "WorkOrder='" + ganttTask.WorkOrder + "'", null);
SQLiteHelpers.Open(); //打开数据库 MainWindowViewModel.SQLiteHelpers.Delete("WorkOrderSteps", "WorkOrder='" + ganttTask.WorkOrder + "'", null);
SQLiteHelpers.Delete("WorkOrder", "WorkOrder='" + ganttTask.ID + "'", null);
SQLiteHelpers.Close();
GanttChartNEW(); GanttChartNEW();
} }
} }
@@ -242,13 +236,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e) private void WorkOrderNumder_Click(object sender, RoutedEventArgs e)
{ {
Picture.Content = null; Picture.Content = null;
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 int con = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(
SQLiteHelpers.Open(); //打开数据库
int con = SQLiteHelpers.ExecuteDataSet(
"select * from WorkOrder where WorkOrder='" + Select_WorkOrderNumder.Text + "select * from WorkOrder where WorkOrder='" + Select_WorkOrderNumder.Text +
"'Order by StartTime", null).Tables[0].Rows.Count; "'Order by StartTime", null).Tables[0].Rows.Count;
SQLiteHelpers.Close();
if (con > 0) if (con > 0)
{ {
@@ -289,7 +280,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
{ {
Interval = TimeSpan.FromSeconds(1)//秒 Interval = TimeSpan.FromSeconds(5)//秒
}; };
timer1s.Tick += Tick_Event_1S; timer1s.Tick += Tick_Event_1S;
timer1s.Start(); timer1s.Start();
@@ -297,11 +288,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
public static bool UI; public static bool UI;
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{ {
if (UI) // if (UI)
{ // {
GanttChartNEW(); GanttChartNEW();
UI= false; // UI= false;
} // }
} }
} }
} }
+4 -4
View File
@@ -65,7 +65,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsHitTestVisible="False" x:Name="edit">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -73,7 +73,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Rename" IsEnabled="False" x:Name="Rename"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Rename" IsHitTestVisible="False" x:Name="Rename">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Rename" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Rename" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Rename}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Rename}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -81,7 +81,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Remark" IsEnabled="False" x:Name="Remark"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Remark" IsHitTestVisible="False" x:Name="Remark">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Note" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Note" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Remark}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Remark}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -89,7 +89,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsHitTestVisible="False" x:Name="Delete">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
+47 -62
View File
@@ -1,4 +1,5 @@
using SunlightCentralizedControlManagement_SCCM_.WindowsView; using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
@@ -21,24 +22,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Group.Text = "ALL"; Group.Text = "ALL";
} }
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
DataSet sql; //内存数据缓存 DataSet sql; //内存数据缓存
string[] group_data;
public void Programgroup_sql() public void Programgroup_sql()
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
string sql_script = "select * from ProgramName order by ProgramID desc"; string sql_script = "select * from ProgramName order by ProgramID desc";
string sql_ProgramGroup = "select * from ProgramGroup order by ID desc"; string sql_ProgramGroup = "select * from ProgramGroup order by ID desc";
if (sql != null) sql.Clear(); //清空缓存 if (sql != null) sql.Clear(); //清空缓存
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存 sql = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表 if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
DataTable GROUP = SQLiteHelpers.ExecuteDataSet(sql_ProgramGroup, null).Tables[0]; //获得程序组 DataTable GROUP = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(sql_ProgramGroup, null).Tables[0]; //获得程序组
List<string> result = new List<string>(); List<string> result = new List<string>();
result.Add("ALL"); result.Add("ALL");
for (int i =0; i<GROUP.Rows.Count;i++) for (int i =0; i<GROUP.Rows.Count;i++)
@@ -46,8 +41,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
result.Add (GROUP.Rows[i][1].ToString()); result.Add (GROUP.Rows[i][1].ToString());
} }
Group.ItemsSource = result.ToArray(); Group.ItemsSource = result.ToArray();
SQLiteHelpers.Close(); //关闭连接
} }
public static string Programgroup_Numder { get; set; } public static string Programgroup_Numder { get; set; }
@@ -61,10 +54,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Programgroup_ID = (Grid.Columns[0].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列, Programgroup_ID = (Grid.Columns[0].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
Programgroup_Numder = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列, Programgroup_Numder = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
} }
edit.IsEnabled = true; edit.IsHitTestVisible = true;
Rename.IsEnabled = true; Rename.IsHitTestVisible = true;
Remark.IsEnabled = true; Remark.IsHitTestVisible = true;
Delete.IsEnabled = true; Delete.IsHitTestVisible = true;
} }
private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件 private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件
@@ -87,45 +80,42 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
void InputBox_new_accept(object sender, EventArgs e)//新建按钮窗口返回 void InputBox_new_accept(object sender, EventArgs e)//新建按钮窗口返回
{ {
//事件的接收者通过一个简单的类型转换得到InputBox的引用 //事件的接收者通过一个简单的类型转换得到InputBox的引用
InputBox frm = (InputBox)sender; InputBox frm = (InputBox)sender;
//接收到InputBox的TextBox值 //接收到InputBox的TextBox值
string VALUE = frm.InputValue; string VALUE = frm.InputValue;
string ID = DateTime.Now.ToString("yyMMddHHmmss"); //id为时间合 string ID = DateTime.Now.ToString("yyMMddHHmmss"); //id为时间合
Dictionary<string, object> Program_new = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Program_new = new Dictionary<string, object>();//缓存函数
Program_new.Add("ProgramName", VALUE); Program_new.Add("ProgramName", VALUE);
Program_new.Add("ProgramID", ID); Program_new.Add("ProgramID", ID);
Program_new.Add("Groups", Group.Text); Program_new.Add("Groups", Group.Text);
Program_new.Add("Step", "0"); Program_new.Add("Step", "0");
Program_new.Add("Time", "0:00"); Program_new.Add("Time", "0:00");
Program_new.Add("Notes", null); Program_new.Add("Notes", null);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 MainWindowViewModel.SQLiteHelpers.InsertData("ProgramName", Program_new);// 执行插入
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.InsertData("ProgramName", Program_new);// 执行插入
SQLiteHelpers.Close(); //关闭连接
Programgroup_Numder = VALUE; Programgroup_Numder = VALUE;
Programgroup_ID = ID; Programgroup_ID = ID;
Programgroup_sql(); Programgroup_sql();
} }
private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件 private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Rename.IsEnabled = false; Rename.IsHitTestVisible = false;
Remark.IsEnabled = false; Remark.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (Programgroup_ID == null) return; if (Programgroup_ID == null) return;
container.Content = new ProgramstepsView(); container.Content = new ProgramstepsView();
} }
private void ListViewItem_Rename(object sender, System.Windows.Input.MouseButtonEventArgs e)//重命名 private void ListViewItem_Rename(object sender, System.Windows.Input.MouseButtonEventArgs e)//重命名
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Rename.IsEnabled = false; Rename.IsHitTestVisible = false;
Remark.IsEnabled = false; Remark.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (Programgroup_ID == null) return; if (Programgroup_ID == null) return;
InputBox frm = new InputBox(); InputBox frm = new InputBox();
frm.Accept += new EventHandler(InputBox_Rename_accept); frm.Accept += new EventHandler(InputBox_Rename_accept);
@@ -140,11 +130,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Dictionary<string, object> Program_Rename = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Program_Rename = new Dictionary<string, object>();//缓存函数
Program_Rename.Add("ProgramName", VALUE); Program_Rename.Add("ProgramName", VALUE);
Program_Rename.Add("Groups", Group.Text); Program_Rename.Add("Groups", Group.Text);
MainWindowViewModel.SQLiteHelpers.Update("ProgramName", Program_Rename, "ProgramID='" + Programgroup_ID + "'", null);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库 Dictionary<string, object> Program_Steps = new Dictionary<string, object>();//缓存函数
SQLiteHelpers.Update("ProgramName", Program_Rename, "ProgramID='" + Programgroup_ID + "'", null); Program_Steps.Add("Program", VALUE);
SQLiteHelpers.Close(); //关闭连接 MainWindowViewModel.SQLiteHelpers.Update("ProgramSteps", Program_Steps, "ProgramID='" + Programgroup_ID + "'", null);
Programgroup_sql(); Programgroup_sql();
Programgroup_Numder = null; Programgroup_Numder = null;
@@ -153,10 +144,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_Remark(object sender, System.Windows.Input.MouseButtonEventArgs e)//备注 private void ListViewItem_Remark(object sender, System.Windows.Input.MouseButtonEventArgs e)//备注
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Rename.IsEnabled = false; Rename.IsHitTestVisible = false;
Remark.IsEnabled = false; Remark.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (Programgroup_ID == null) return; if (Programgroup_ID == null) return;
InputBox frm = new InputBox(); InputBox frm = new InputBox();
frm.Accept += new EventHandler(InputBox_Remark_accept); frm.Accept += new EventHandler(InputBox_Remark_accept);
@@ -171,10 +162,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Dictionary<string, object> Program_Remark = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Program_Remark = new Dictionary<string, object>();//缓存函数
Program_Remark.Add("Notes", VALUE); Program_Remark.Add("Notes", VALUE);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 MainWindowViewModel.SQLiteHelpers.Update("ProgramName", Program_Remark, "ProgramID='" + Programgroup_ID + "'", null);
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.Update("ProgramName", Program_Remark, "ProgramID='" + Programgroup_ID + "'", null);
SQLiteHelpers.Close(); //关闭连接
Programgroup_sql(); Programgroup_sql();
Programgroup_Numder = null; Programgroup_Numder = null;
@@ -183,21 +171,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除 private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Rename.IsEnabled = false; Rename.IsHitTestVisible = false;
Remark.IsEnabled = false; Remark.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (Programgroup_Numder == null) return; if (Programgroup_Numder == null) return;
///弹窗提示确认删除 ///弹窗提示确认删除
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + Programgroup_Numder, "Delete ", if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + Programgroup_Numder, "Delete ",
System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
{ {
///执行删除 ///执行删除
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 MainWindowViewModel.SQLiteHelpers.Delete("ProgramName", "ProgramID='" + Programgroup_ID + "'", null);
SQLiteHelpers.Open(); //打开数据库 MainWindowViewModel.SQLiteHelpers.Delete("ProgramSteps", "ProgramID='" + Programgroup_ID + "'", null);
SQLiteHelpers.Delete("ProgramName", "ProgramID='" + Programgroup_ID + "'", null);
SQLiteHelpers.Delete("ProgramSteps", "ProgramID='" + Programgroup_ID + "'", null);
SQLiteHelpers.Close();
Programgroup_sql(); Programgroup_sql();
} }
Programgroup_Numder = null; Programgroup_Numder = null;
+107 -28
View File
@@ -11,18 +11,24 @@
d:DesignHeight="630" d:DesignWidth="1280"> d:DesignHeight="630" d:DesignWidth="1280">
<UserControl.Resources> <UserControl.Resources>
<ConvertMoels:RowToIndexConverter x:Key="RowToIndexConverter"/> <ConvertMoels:RowToIndexConverter x:Key="RowToIndexConverter"/>
</UserControl.Resources> <ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
<Grid> <ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
<DataGrid x:Name="Grid" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=90}" <ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
PreviewMouseLeftButtonUp="Grid_PreviewMouseLeftButtonUp" MouseDoubleClick="Grid_MouseDoubleClick" <ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" </UserControl.Resources>
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15" <Grid>
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30" <DataGrid x:Name="Grid_step" AlternationCount="2" MouseDoubleClick="Grid_MouseDoubleClick"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single" MouseLeftButtonUp="Grid_PreviewMouseLeftButtonUp"
Margin="0,0,0,60"> d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White"
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" BorderBrush="{x:Null}"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" CanUserAddRows="True">
<DataGrid.RowStyle > <DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" /> <Setter Property="IsHitTestVisible" Value="{Binding DataContext.IsInteractive,
RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<Setter Property="Height" Value="100" />
<Setter Property="FontSize" Value="25" /> <Setter Property="FontSize" Value="25" />
<Style.Triggers> <Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0"> <Trigger Property="ItemsControl.AlternationIndex" Value="0">
@@ -32,42 +38,115 @@
<Setter Property="Background" Value="#FFF0F0F0" /> <Setter Property="Background" Value="#FFF0F0F0" />
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="False"/> <Trigger Property="IsMouseOver" Value="False"/>
<DataTrigger Binding="{Binding RUN}" Value="1">
<Setter Property="Background" Value="#FF00D6FF"/>
</DataTrigger>
<DataTrigger Binding="{Binding RUN}" Value="2">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding RUN}" Value="9">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</DataGrid.RowStyle> </DataGrid.RowStyle>
<DataGrid.CellStyle> <DataGrid.CellStyle>
<Style TargetType="DataGridCell"> <Style TargetType="{x:Type DataGridCell}">
<Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsSelected" Value="True"> <Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/> <Setter Property="Background" Value="#FF00D6FF"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/> <Setter Property="BorderBrush" Value="#FF00D6FF"/>
<Setter Property="Foreground" Value="Black"/> <Setter Property="Foreground" Value="Black"/>
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</DataGrid.CellStyle> </DataGrid.CellStyle>
<DataGrid.Columns> <DataGrid.Columns>
<!--列信息绑定--> <!--列信息绑定-->
<DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="60" IsReadOnly="True"/> <DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}"
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="100" Binding="{Binding StepID}" IsReadOnly="True"/> Width="80" IsReadOnly="True">
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="300" Binding="{Binding StepName}" IsReadOnly="True"/> <DataGridTextColumn.ElementStyle>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="*" Binding="{Binding ParameterName}" IsReadOnly="True"/> <Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepID}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding StepName}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="0" MinWidth="0"
MaxWidth="0" Binding="{Binding ParameterName}" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/>
<DataGridTextColumn Binding="{Binding Parameter6}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="100" IsReadOnly="True">
<DataGridTextColumn Binding="{Binding Parameter7}" Width="0" MinWidth="0" MaxWidth="0"/> <DataGridTemplateColumn.CellTemplate>
<DataGridTextColumn Binding="{Binding Parameter8}" Width="0" MinWidth="0" MaxWidth="0"/> <DataTemplate>
<DataGridTextColumn Binding="{Binding Parameter9}" Width="0" MinWidth="0" MaxWidth="0"/> <Image Source="{Binding Path=StepID,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
<DataGridTextColumn Binding="{Binding Parameter10}" Width="0" MinWidth="0" MaxWidth="0"/> </DataTemplate>
<DataGridTextColumn Binding="{Binding StepTime}" Width="0" MinWidth="0" MaxWidth="0"/> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="600" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0,0,0.5">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.Function}"/>
<Run Text=":"/>
<Run Text="{Binding StepName}"/>
</TextBlock>
</Border>
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0.5,0,0">
<TextBlock Height="50" >
<Run Text="{x:Static lang:Resources.ParameterSet}"/>
<Run Text=":"/>
<Run Text="{Binding ParameterName}"/>
</TextBlock>
</Border>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S1,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S2,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=StepID_S3 ,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static lang:Resources.Remark}" Binding="{Binding Remark}"
Width="*" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<StackPanel x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,400,0"> <StackPanel x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,400,0">
@@ -80,7 +159,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsHitTestVisible="False" x:Name="edit">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -88,7 +167,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsEnabled="False" x:Name="Insert"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Insert" IsHitTestVisible="False" x:Name="Insert">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="InsertComment" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="InsertComment" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Insert}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
@@ -104,7 +183,7 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsHitTestVisible="False" x:Name="Delete">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
+222 -118
View File
@@ -1,4 +1,7 @@
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using SunlightCentralizedControlManagement_SCCM_.WindowsView; using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -24,6 +27,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Xml.Linq; using System.Xml.Linq;
using TouchSocket.Core;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep; using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement;
@@ -46,10 +50,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Programgroup_sql(); Programgroup_sql();
} }
private SQLiteHelper SQLiteHelpers = null; //定义数据库 // DataSet sql; //内存数据缓存
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径 DataTable Step;
DataSet sql; //内存数据缓存
string ProgramID; string ProgramID;
string ProgramNAME; string ProgramNAME;
string Numder = null; string Numder = null;
@@ -58,39 +60,26 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
string StepTime = null; string StepTime = null;
public void Programgroup_sql() public void Programgroup_sql()
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
string sql_script = "select * from ProgramSteps where ProgramID='" + ProgramID + "' order by Step asc"; string sql_script = "select * from ProgramSteps where ProgramID='" + ProgramID + "' order by Step asc";
Step = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //读取计划表写入缓存
if (sql != null) sql.Clear(); //清空缓存 Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
//sql.Tables[0].Rows.Add(datatable_t);
DataRow dr = sql.Tables[0].NewRow();//添加表数据
dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME;
sql.Tables[0].Rows.Add(dr);
Dat();
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
SQLiteHelpers.Close(); //关闭连接
} }
public void Dat()//行号刷新 public void Dat(DataTable dat)//行号刷新
{ {
int a = sql.Tables[0].Rows.Count; int a = dat.Rows.Count;
for (int i = 0; i < a; i++) for (int i = 0; i < a; i++)
{ {
DataRow dr = sql.Tables[0].Rows[i]; DataRow dr = dat.Rows[i];
dr.BeginEdit(); dr.BeginEdit();
dr["Step"] = i + 1; dr["Step"] = i + 1;
dr.EndEdit(); dr.EndEdit();
} }
dat.AcceptChanges();
} }
private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面时的操作 private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面时的操作
{ {
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString();
Grid.SelectedIndex = Convert.ToInt32(ID)-1;
} }
public static T GetVisualChild<T>(Visual parent) where T : Visual public static T GetVisualChild<T>(Visual parent) where T : Visual
{ {
@@ -114,43 +103,83 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void Grid_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)//表格选择事件 private void Grid_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)//表格选择事件
{ {
edit.IsEnabled = true; edit.IsHitTestVisible = true;
Insert.IsEnabled = true; Insert.IsHitTestVisible = true;
Delete.IsEnabled = true; Delete.IsHitTestVisible = true;
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效 if (rownum != -1)//判断鼠标定位是否有效
{ {
ID = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列, ID = (Grid_step.Columns[2].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第0列,
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列, Numder = (Grid_step.Columns[3].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第1列,
P1 = (Grid.Columns[6].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第6列, P1 = (Grid_step.Columns[6].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第6列,
P2 = (Grid.Columns[7].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第7列, P2 = (Grid_step.Columns[7].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第7列,
P3 = (Grid.Columns[8].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第8列, P3 = (Grid_step.Columns[8].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第8列,
P4 = (Grid.Columns[9].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第9列, P4 = (Grid_step.Columns[9].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第9列,
P5 = (Grid.Columns[10].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第10列, P5 = (Grid_step.Columns[10].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第10列,
StepTime = (Grid.Columns[16].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;// StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
} }
} }
private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件 private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件
{ {
edit.IsEnabled = true; edit.IsHitTestVisible = true;
Insert.IsEnabled = true; Insert.IsHitTestVisible = true;
Delete.IsEnabled = true; Delete.IsHitTestVisible = true;
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量 int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效 if (rownum != -1)//判断鼠标定位是否有效
{ {
ID = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列, ID = (Grid_step.Columns[2].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第0列,
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列, Numder = (Grid_step.Columns[3].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第1列,
P1 = (Grid.Columns[6].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第6列, P1 = (Grid_step.Columns[6].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第6列,
P2 = (Grid.Columns[7].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第7列, P2 = (Grid_step.Columns[7].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第7列,
P3 = (Grid.Columns[8].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第8列, P3 = (Grid_step.Columns[8].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第8列,
P4 = (Grid.Columns[9].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第9列, P4 = (Grid_step.Columns[9].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第9列,
P5 = (Grid.Columns[10].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第10列, P5 = (Grid_step.Columns[10].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第10列,
StepTime = (Grid.Columns[16].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;// StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString(); if (string.IsNullOrEmpty(ID))
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); {
DataRow dr = Step.NewRow();//添加表数据
dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME;
dr["Parameter1"] = 0;
dr["Parameter2"] = 0;
dr["Parameter3"] = 0;
dr["Parameter4"] = 0;
dr["Parameter5"] = 0;
dr["Parameter6"] = 0;
dr["Parameter7"] = 0;
dr["Parameter8"] = 0;
dr["Parameter9"] = 0;
dr["Parameter10"] = 0;
dr["Parameter1_S1"] = 0;
dr["Parameter2_S1"] = 0;
dr["Parameter3_S1"] = 0;
dr["Parameter4_S1"] = 0;
dr["Parameter5_S1"] = 0;
dr["Parameter1_S2"] = 0;
dr["Parameter2_S2"] = 0;
dr["Parameter3_S2"] = 0;
dr["Parameter4_S2"] = 0;
dr["Parameter5_S2"] = 0;
dr["Parameter1_S3"] = 0;
dr["Parameter2_S3"] = 0;
dr["Parameter3_S3"] = 0;
dr["Parameter4_S3"] = 0;
dr["Parameter5_S3"] = 0;
dr["StepName_S1"] = " ";
dr["StepName_S2"] = " ";
dr["StepName_S3"] = " ";
dr["StepID_S1"] = "000";
dr["StepID_S2"] = "000";
dr["StepID_S3"] = "000";
Step.Rows.InsertAt(dr, Step.Rows.Count);
Dat(Step);
ID = (Step.Rows.Count).ToString();
}
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
@@ -164,46 +193,76 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件 private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Insert.IsEnabled = false; Insert.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString(); if (string.IsNullOrEmpty(ID))
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); {
DataRow dr = Step.NewRow();//添加表数据
dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME;
dr["Parameter1"] = 0;
dr["Parameter2"] = 0;
dr["Parameter3"] = 0;
dr["Parameter4"] = 0;
dr["Parameter5"] = 0;
dr["Parameter6"] = 0;
dr["Parameter7"] = 0;
dr["Parameter8"] = 0;
dr["Parameter9"] = 0;
dr["Parameter10"] = 0;
dr["Parameter1_S1"] = 0;
dr["Parameter2_S1"] = 0;
dr["Parameter3_S1"] = 0;
dr["Parameter4_S1"] = 0;
dr["Parameter5_S1"] = 0;
dr["Parameter1_S2"] = 0;
dr["Parameter2_S2"] = 0;
dr["Parameter3_S2"] = 0;
dr["Parameter4_S2"] = 0;
dr["Parameter5_S2"] = 0;
dr["Parameter1_S3"] = 0;
dr["Parameter2_S3"] = 0;
dr["Parameter3_S3"] = 0;
dr["Parameter4_S3"] = 0;
dr["Parameter5_S3"] = 0;
dr["StepName_S1"] = " ";
dr["StepName_S2"] = " ";
dr["StepName_S3"] = " ";
dr["StepID_S1"] = "000";
dr["StepID_S2"] = "000";
dr["StepID_S3"] = "000";
Step.Rows.InsertAt(dr, Step.Rows.Count);
Dat(Step);
ID = Step.Rows.Count.ToString();
}
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.data = ID; viewstop.data = ID;
viewstop.ShowDialog(); viewstop.ShowDialog();
} }
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果 private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
{ {
int i = sql.Tables[0].Rows.Count; int i = Step.Rows.Count;
int n = StrToInt.To16Convert10(ID); int n = Convert.ToInt16(ID);
if (i == n)
{ int steptime = 0;//时间秒
DataRow dr_ = sql.Tables[0].NewRow();//添加表数据
dr_["ProgramID"] = ProgramID;
dr_["Program"] = ProgramNAME;
sql.Tables[0].Rows.Add(dr_);
Dat();
ID = (n + 1).ToString();
}
int steptime=0;//时间秒
string[] time_D = { "001", "013", "015", "017", "065" }; string[] time_D = { "001", "013", "015", "017", "065" };
string[] time_J = { "031", "093" }; string[] time_J = { "031", "093" };
string[] time_T = { "054", "055","056" }; string[] time_T = { "054", "055", "056" };
foreach (var item in time_D) foreach (var item in time_D)
{ {
if (item == e.StepID) if (item == e.StepID)
{ {
steptime = Convert.ToUInt16(e.P3)*60; steptime = Convert.ToUInt16(e.Row_DAT.Field<double>("Parameter3")) * 60;
} }
} }
foreach (var item in time_J) foreach (var item in time_J)
{ {
if (item == e.StepID) if (item == e.StepID)
{ {
steptime = Convert.ToUInt16(e.P1) * 60; steptime = Convert.ToUInt16(e.Row_DAT.Field<double>("Parameter1")) * 60;
} }
} }
foreach (var item in time_T) foreach (var item in time_T)
@@ -213,78 +272,126 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
steptime = 5; steptime = 5;
} }
} }
if (steptime==0) if (steptime == 0)
{ {
steptime = 300; steptime = 300;
} }
DataRow dr = sql.Tables[0].Rows[n - 1]; DataRow dr = Step.Rows[n - 1];
dr.BeginEdit(); dr.BeginEdit();
dr["StepID"] = e.StepID; dr["StepID"] = e.StepID;
dr["StepName"] = e.StepNAME; dr["StepName"] = e.StepNAME;
dr["ParameterName"] = e.PNAME; dr["ParameterName"] = e.PNAME;
dr["Parameter1"] = e.P1; dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter2"] = e.P2; dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter2");
dr["Parameter3"] = e.P3; dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter3");
dr["Parameter4"] = e.P4; dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter4");
dr["Parameter5"] = e.P5; dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter5");
dr["StepTime"] =steptime;// dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
dr["Parameter4_S1"] = e.Row_DAT.Field<double>("Parameter4_S1");
dr["Parameter5_S1"] = e.Row_DAT.Field<double>("Parameter5_S1");
dr["Parameter1_S2"] = e.Row_DAT.Field<double>("Parameter1_S2");
dr["Parameter2_S2"] = e.Row_DAT.Field<double>("Parameter2_S2");
dr["Parameter3_S2"] = e.Row_DAT.Field<double>("Parameter3_S2");
dr["Parameter4_S2"] = e.Row_DAT.Field<double>("Parameter4_S2");
dr["Parameter5_S2"] = e.Row_DAT.Field<double>("Parameter5_S2");
dr["Parameter1_S3"] = e.Row_DAT.Field<double>("Parameter1_S3");
dr["Parameter2_S3"] = e.Row_DAT.Field<double>("Parameter2_S3");
dr["Parameter3_S3"] = e.Row_DAT.Field<double>("Parameter3_S3");
dr["Parameter4_S3"] = e.Row_DAT.Field<double>("Parameter4_S3");
dr["Parameter5_S3"] = e.Row_DAT.Field<double>("Parameter5_S3");
dr["StepName_S1"] = e.Row_DAT.Field<string>("StepName_S1");
dr["StepName_S2"] = e.Row_DAT.Field<string>("StepName_S2");
dr["StepName_S3"] = e.Row_DAT.Field<string>("StepName_S3");
dr["StepID_S1"] = e.Row_DAT.Field<string>("StepID_S1");
dr["StepID_S2"] = e.Row_DAT.Field<string>("StepID_S2");
dr["StepID_S3"] = e.Row_DAT.Field<string>("StepID_S3");
dr["StepTime"] = steptime;//
dr.EndEdit(); dr.EndEdit();
Grid.ItemsSource = sql.Tables[0].DefaultView; Grid_step.ItemsSource = Step.DefaultView;
} }
private void ListViewItem_Insert(object sender, System.Windows.Input.MouseButtonEventArgs e)//插入事件 private void ListViewItem_Insert(object sender, System.Windows.Input.MouseButtonEventArgs e)//插入事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Insert.IsEnabled = false; Insert.IsHitTestVisible = false;
Delete.IsEnabled = false; int d = 0; Delete.IsHitTestVisible = false;
int d = 0;
if (ID != null) { d = Convert.ToInt32(ID); } else { return; } if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
DataRow dr = sql.Tables[0].NewRow();//添加表数据 DataRow dr = Step.NewRow();//添加表数据
dr["ProgramID"] = ProgramID; dr["ProgramID"] = ProgramID;
dr["Program"] = ProgramNAME; dr["Program"] = ProgramNAME;
sql.Tables[0].Rows.InsertAt(dr, d - 1); dr["Parameter1"] = 0;
dr["Parameter2"] = 0;
dr["Parameter3"] = 0;
dr["Parameter4"] = 0;
dr["Parameter5"] = 0;
dr["Parameter6"] = 0;
dr["Parameter7"] = 0;
dr["Parameter8"] = 0;
dr["Parameter9"] = 0;
dr["Parameter10"] = 0;
dr["Parameter1_S1"] = 0;
dr["Parameter2_S1"] = 0;
dr["Parameter3_S1"] = 0;
dr["Parameter4_S1"] = 0;
dr["Parameter5_S1"] = 0;
dr["Parameter1_S2"] = 0;
dr["Parameter2_S2"] = 0;
dr["Parameter3_S2"] = 0;
dr["Parameter4_S2"] = 0;
dr["Parameter5_S2"] = 0;
dr["Parameter1_S3"] = 0;
dr["Parameter2_S3"] = 0;
dr["Parameter3_S3"] = 0;
dr["Parameter4_S3"] = 0;
dr["Parameter5_S3"] = 0;
dr["StepName_S1"] = " ";
dr["StepName_S2"] = " ";
dr["StepName_S3"] = " ";
dr["StepID_S1"] = "000";
dr["StepID_S2"] = "000";
dr["StepID_S3"] = "000";
Step.Rows.InsertAt(dr, d - 1);
ID = null; ID = null;
Dat(); Dat(Step);
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表 Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
} }
private void ListViewItem_Save(object sender, System.Windows.Input.MouseButtonEventArgs e)//保存事件 private void ListViewItem_Save(object sender, System.Windows.Input.MouseButtonEventArgs e)//保存事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Insert.IsEnabled = false; Insert.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
int r = 0; int r = 0;
MainWindowViewModel.SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '" + ProgramID + "'", null);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '" + ProgramID + "'", null);
DataTable data_t = new DataTable(); DataTable data_t = new DataTable();
data_t = sql.Tables[0].Clone(); data_t = Step.Clone();
int a = sql.Tables[0].Rows.Count; int a = Step.Rows.Count;
for (int i = 0; i < a - 1; i++) for (int i = 0; i < a ; i++)
{ {
data_t.Clear();//清空 data_t.Clear();//清空
DataRow dt = sql.Tables[0].Rows[i];//行转换 DataRow dt = Step.Rows[i];//行转换
DataRow dr = data_t.NewRow(); DataRow dr = data_t.NewRow();
dr.ItemArray = dt.ItemArray; dr.ItemArray = dt.ItemArray;
data_t.Rows.InsertAt(dr, 0); data_t.Rows.InsertAt(dr, 0);
r = SQLiteHelpers.InsertData("ProgramSteps", SQLiteHelpers.DataTableToDictionary(data_t));//行插入 r = MainWindowViewModel.SQLiteHelpers.InsertData("ProgramSteps", MainWindowViewModel.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
} }
int time =Convert.ToUInt16( sql.Tables[0].Compute("sum(StepTime)", ""))/60; int time =Convert.ToUInt16( Step.Compute("sum(StepTime)", ""))/60;
string time_ =DateTime.Parse( TimeSpan.FromMinutes(time).ToString()).ToString("HH:mm");// DateTime.Parse(time.ToString()).ToString("HH:mm"); string time_ =DateTime.Parse( TimeSpan.FromMinutes(time).ToString()).ToString("HH:mm");// DateTime.Parse(time.ToString()).ToString("HH:mm");
Dictionary<string, object> Program_Step = new Dictionary<string, object>();//缓存函数 Dictionary<string, object> Program_Step = new Dictionary<string, object>();//缓存函数
Program_Step.Add("Step", a - 1); Program_Step.Add("Step", a - 1);
Program_Step.Add("Time", time_); Program_Step.Add("Time", time_);
SQLiteHelpers.Update("ProgramName", Program_Step, "ProgramID='" + ProgramID + "'", null); MainWindowViewModel.SQLiteHelpers.Update("ProgramName", Program_Step, "ProgramID='" + ProgramID + "'", null);
SQLiteHelpers.Close(); //关闭连接
if (r != 0) if (r != 0)
{ {
System.Windows.Forms.MessageBox.Show(ProgramNAME, Properties.Resources.Save); System.Windows.Forms.MessageBox.Show(ProgramNAME, Properties.Resources.Save);
@@ -294,20 +401,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除事件 private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)//删除事件
{ {
edit.IsEnabled = false; edit.IsHitTestVisible = false;
Insert.IsEnabled = false; Insert.IsHitTestVisible = false;
Delete.IsEnabled = false; Delete.IsHitTestVisible = false;
int d = 0; int a = Step.Rows.Count;
int a = sql.Tables[0].Rows.Count; int rownum = Grid_step.SelectedIndex;
if (rownum >= 0 && rownum<a)
if (ID != null) { d = Convert.ToInt32(ID); } else { return; } {
if (a != d)//如果删除不是最后一行执行 Step.Rows.RemoveAt(rownum);
{ Dat(Step);
sql.Tables[0].Rows.RemoveAt(d - 1); Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
Dat();
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
} }
} }
+9 -1
View File
@@ -22,6 +22,14 @@
</StackPanel> </StackPanel>
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_ConveyorCenters" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" >
<materialDesign:PackIcon Kind="Material" Width="40" Height="30" Margin="10" VerticalAlignment="Center"/>
<TextBlock Text="{x:Static lang:Resources.ConveyorCenters}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel>
</ListViewItem>
</ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_EngineerSet" VerticalAlignment="Center"> <ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_EngineerSet" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
@@ -29,7 +37,7 @@
<TextBlock Text="{x:Static lang:Resources.EngineerSet}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.EngineerSet}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel> </StackPanel>
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_log" VerticalAlignment="Center"> <ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_log" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
+5
View File
@@ -51,5 +51,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
Picture.Content = new View.LogView(); Picture.Content = new View.LogView();
} }
private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
{
Picture.Content = new View.DispenseMachinesSet();
}
} }
} }
+1 -3
View File
@@ -8,9 +8,7 @@
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <Grid>
<ScrollViewer Margin="0" VerticalScrollBarVisibility="Auto"> <ScrollViewer Margin="0" VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Horizontal" x:Name="WholeView" Background="White"> <WrapPanel Orientation="Horizontal" x:Name="WholeView" Background="White"/>
</WrapPanel>
</ScrollViewer> </ScrollViewer>
</Grid> </Grid>
</UserControl> </UserControl>
+37 -17
View File
@@ -55,16 +55,21 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
else else
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); } { inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); }
inf[i].temp.Text = (Selet_Machines(MainWindowViewModel.Machines, "Temperature", i) + "°C").ToString(); inf[i].temp.Text = Selet_Machines(MainWindowViewModel.Machines, "Temperature", i).ToString() + "°C";
inf[i].Process.Text = Selet_Machines(MainWindowViewModel.Machines, "Process", i).ToString(); inf[i].Process.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Process", i);
inf[i].Step.Text = Selet_Machines(MainWindowViewModel.Machines, "Step", i).ToString(); inf[i].Step.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Step", i);
inf[i].Message.Text = Selet_Machines(MainWindowViewModel.Machines, "Message", i).ToString(); inf[i].Message.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Message", i);
inf[i].Orders.Text = Selet_Machines(MainWindowViewModel.Machines, "WorkOrder", i).ToString(); inf[i].Orders.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "WorkOrder", i);
inf[i].time.Text = Selet_Machines(MainWindowViewModel.Machines, "time", i).ToString(); inf[i].time.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "time", i);
WholeView.Children.Add(inf[i]); WholeView.Children.Add(inf[i]);
} }
for (int i = 0; i < MainWindowViewModel.Machines.Rows.Count; i++)
{
DataRow[] rows= MainWindowViewModel.Whole_dat.Select("Machine='" + inf[i].name.Text+"'");
inf[i].DataROW(rows);
}
CountDown(); CountDown();
} }
@@ -86,17 +91,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
} }
} }
int t30S = 0;
private void CountDown() private void CountDown()
{ {
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
{ {
Interval = TimeSpan.FromSeconds(1)//秒 Interval = TimeSpan.FromSeconds(1)//秒
}; };
timer1s.Tick += Tick_Event_1S; timer1s.Tick += Tick_Event_S;
timer1s.Start(); timer1s.Start();
}//时间周期初始化 }//时间周期初始化
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
void Tick_Event_S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{ {
DateTime dateTime = DateTime.Now;
for (int i = 0; i < MainWindowViewModel.Machines.Rows.Count; i++) for (int i = 0; i < MainWindowViewModel.Machines.Rows.Count; i++)
{ {
string State_ = Selet_Machines(MainWindowViewModel.Machines, "State", i).ToString(); string State_ = Selet_Machines(MainWindowViewModel.Machines, "State", i).ToString();
@@ -105,18 +113,30 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
else if (State_ == "201") else if (State_ == "201")
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(0, 255, 0)); } { inf[i].name.Background = new SolidColorBrush(Color.FromRgb(0, 255, 0)); }
else if (State_ == "202") else if (State_ == "202")
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 255, 0)); } { inf[i].name.Background = new SolidColorBrush(Color.FromRgb(0, 255, 0)); }
else else
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); } { inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); }
inf[i].temp.Text = Selet_Machines(MainWindowViewModel.Machines, "Temperature", i).ToString() + "°C";
inf[i].Process.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Process", i);
inf[i].Step.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Step", i);
inf[i].Message.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "Message", i);
inf[i].Orders.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "WorkOrder", i);
inf[i].time.Text = (string)Selet_Machines(MainWindowViewModel.Machines, "time", i);
inf[i].temp.Text = (Selet_Machines(MainWindowViewModel.Machines, "Temperature", i) + "°C").ToString(); if ((t30S > 10)&&(State_!="800"))
inf[i].Process.Text = Selet_Machines(MainWindowViewModel.Machines, "Process", i).ToString(); {
inf[i].Step.Text = Selet_Machines(MainWindowViewModel.Machines, "Step", i).ToString(); t30S = 0;
inf[i].Message.Text = Selet_Machines(MainWindowViewModel.Machines, "Message", i).ToString(); inf[i].DataAdd(dateTime,Convert.ToDouble( Selet_Machines(MainWindowViewModel.Machines, "Temperature", i)));
inf[i].Orders.Text = Selet_Machines(MainWindowViewModel.Machines, "WorkOrder", i).ToString();
inf[i].time.Text = Selet_Machines(MainWindowViewModel.Machines, "time", i).ToString(); // DataRow whole_Dat = MainWindowViewModel.Whole_dat.NewRow();
// whole_Dat["Machine"] = Selet_Machines(MainWindowViewModel.Machines, "NAME", i).ToString();
// whole_Dat["DateTime"] = dateTime;
// whole_Dat["DAT"] = (double)Selet_Machines(MainWindowViewModel.Machines, "Temperature", i);
// MainWindowViewModel.Whole_dat.Rows.Add(whole_Dat);
}
} }
t30S++;
} }
} }
} }
+28 -32
View File
@@ -90,7 +90,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
CrosshairSnapEnabled = true, CrosshairSnapEnabled = true,
Position = LiveChartsCore.Measure.AxisPosition.End Position = LiveChartsCore.Measure.AxisPosition.End
}, //液位轴 }, //液位轴
new Axis // /* new Axis //
{ {
MinLimit =0, MinLimit =0,
MaxLimit =14, MaxLimit =14,
@@ -106,10 +106,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
DrawTicksPath = true, DrawTicksPath = true,
CrosshairSnapEnabled = true, CrosshairSnapEnabled = true,
Position = LiveChartsCore.Measure.AxisPosition.End Position = LiveChartsCore.Measure.AxisPosition.End
}, //PH轴 },*/ //PH轴
}; };
private static Random _r = new Random();
private static ObservableCollection<DateTimePoint> MTT_values; private static ObservableCollection<DateTimePoint> MTT_values;
private static ObservableCollection<DateTimePoint> MTL_values; private static ObservableCollection<DateTimePoint> MTL_values;
private static ObservableCollection<DateTimePoint> MTH_values; private static ObservableCollection<DateTimePoint> MTH_values;
@@ -121,9 +120,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
private static ObservableCollection<DateTimePoint> STLB_values; private static ObservableCollection<DateTimePoint> STLB_values;
private static ObservableCollection<DateTimePoint> STTC_values; private static ObservableCollection<DateTimePoint> STTC_values;
private static ObservableCollection<DateTimePoint> STLC_values; private static ObservableCollection<DateTimePoint> STLC_values;
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
private static string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
static DataTable CDB = new DataTable(); static DataTable CDB = new DataTable();
private static int CDB_Count;//长度 private static int CDB_Count;//长度
@@ -136,10 +132,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
if (mode) if (mode)
{ {
if (string.IsNullOrEmpty(w)) return; if (string.IsNullOrEmpty(w)) return;
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径 CDB = MainWindowViewModel.SQLiteChartAdress.ExecuteDataSet("select * from Chart where WorkOrder = '" + w + "'order by Time", null).Tables[0];
SQLiteHelpers.Open(); //打开数据库
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where WorkOrder = '" + w + "'order by Time", null).Tables[0];
SQLiteHelpers.Close();
} }
else else
@@ -147,18 +140,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
if (string.IsNullOrEmpty(m)) return; if (string.IsNullOrEmpty(m)) return;
if (string.IsNullOrEmpty(s)) return; if (string.IsNullOrEmpty(s)) return;
if (string.IsNullOrEmpty(e)) return; if (string.IsNullOrEmpty(e)) return;
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径 // SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库 // SQLiteHelpers.Open(); //打开数据库
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where Machine = '" + m + "'" + CDB = MainWindowViewModel.SQLiteChartAdress.ExecuteDataSet("select * from Chart where Machine = '" + m + "'" +
" and Time > '" + s + "' and Time < '" + e + "' order by Time", null).Tables[0]; " and Time > '" + s + "' and Time < '" + e + "' order by Time", null).Tables[0];
SQLiteHelpers.Close(); // SQLiteHelpers.Close();
} }
CDB_Count = CDB.Rows.Count; CDB_Count = CDB.Rows.Count;
var MTT_items = new List<DateTimePoint>(); var MTT_items = new List<DateTimePoint>();
var MTL_items = new List<DateTimePoint>(); var MTL_items = new List<DateTimePoint>();
var MTH_items = new List<DateTimePoint>(); // var MTH_items = new List<DateTimePoint>();
var MST_items = new List<DateTimePoint>(); var MST_items = new List<DateTimePoint>();
var MUT_items = new List<DateTimePoint>(); var MUT_items = new List<DateTimePoint>();
var STTA_items = new List<DateTimePoint>(); var STTA_items = new List<DateTimePoint>();
@@ -167,26 +160,29 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
var STLB_items = new List<DateTimePoint>(); var STLB_items = new List<DateTimePoint>();
var STTC_items = new List<DateTimePoint>(); var STTC_items = new List<DateTimePoint>();
var STLC_items = new List<DateTimePoint>(); var STLC_items = new List<DateTimePoint>();
for (var i = 0; i < CDB_Count; i++) for (var i = 0; i < CDB_Count; i=i+4)
{ {
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time")); try
MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT"))); {
MTL_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTL"))); DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
MTH_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTH"))); MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT")));
MST_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MST"))); MTL_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTL")));
MUT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MUT"))); // MTH_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTH")));
STTA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTA"))); MST_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MST")));
STLA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLA"))); MUT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MUT")));
STTB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTB"))); STTA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTA")));
STLB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLB"))); STLA_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLA")));
STTC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTC"))); STTB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTB")));
STLC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLC"))); STLB_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLB")));
STTC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STTC")));
STLC_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("STLC")));
}
catch (Exception) { }
} }
MTT_values = new ObservableCollection<DateTimePoint>(MTT_items); MTT_values = new ObservableCollection<DateTimePoint>(MTT_items);
MTL_values = new ObservableCollection<DateTimePoint>(MTL_items); MTL_values = new ObservableCollection<DateTimePoint>(MTL_items);
MTH_values = new ObservableCollection<DateTimePoint>(MTH_items); // MTH_values = new ObservableCollection<DateTimePoint>(MTH_items);
MST_values = new ObservableCollection<DateTimePoint>(MST_items); MST_values = new ObservableCollection<DateTimePoint>(MST_items);
MUT_values = new ObservableCollection<DateTimePoint>(MUT_items); MUT_values = new ObservableCollection<DateTimePoint>(MUT_items);
STTA_values = new ObservableCollection<DateTimePoint>(STTA_items); STTA_values = new ObservableCollection<DateTimePoint>(STTA_items);
@@ -198,7 +194,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
Series = new ISeries[] Series = new ISeries[]
{ {
new LineSeries<DateTimePoint> /* new LineSeries<DateTimePoint>
{ {
Name = Properties.Resources.MasterCylinder +"PH", Name = Properties.Resources.MasterCylinder +"PH",
Values = MTH_values, Values = MTH_values,
@@ -208,7 +204,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
Fill = null, Fill = null,
LineSmoothness = 0, LineSmoothness = 0,
ScalesYAt = 2, ScalesYAt = 2,
}, //PH }, *///PH
new LineSeries<DateTimePoint> new LineSeries<DateTimePoint>
{ {
Name = Resources.Target + Resources.Temperature, Name = Resources.Target + Resources.Temperature,
File diff suppressed because it is too large. Load diff
+108
View File
@@ -0,0 +1,108 @@
using SunlightCentralizedControlManagement_SCCM_.EX;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using System;
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.Text;
using System.Threading.Tasks;
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
public class ManualDyelotModel : ViewModelBase
{
public static DataTable STUFFdataTable = new DataTable(); //建立STUFF
public ManualDyelotModel()
{
string Connstr_SC;
string sql = "SELECT * FROM [dbo].[Pipes] WHERE Dispenser = '" + ManualDyelot.Machines + "'";
try
{
if (MainWindowViewModel.SQMOD == "Windows Authentication")
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
conn_SC.Open(); //连接数据库
new SqlDataAdapter(sql, Connstr_SC).Fill(STUFFdataTable);
// SqlDataAdapter _data = new SqlDataAdapter(sql, Connstr_SC); //查询
conn_SC.Close();
}
catch (Exception ex)
{
LogGing.ERRDATA(ex);
}
stuff_Product = ToObservableCollection<Product>(STUFFdataTable); //stuff_Product表转换
}
public ObservableCollection<Product> stuff_Product { get; set; } //stuff_Product动态表实力化
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转换器
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;
}
}
}
}
+34
View File
@@ -0,0 +1,34 @@
using SunlightCentralizedControlManagement_SCCM_.EX;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using System;
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.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
public class MonitorViewModel : ViewModelBase
{
public MonitorViewModel()
{
// DispatcherTimer timer1s = new DispatcherTimer(DispatcherPriority.Normal);//初始化循环,每1秒调用一次Tick
// timer1s.Interval = TimeSpan.FromMilliseconds(950);//秒
// timer1s.Tick += Tick_Main_1S;
// timer1s.Start();
}
}
}
+7
View File
@@ -36,5 +36,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
return ServiceLocator.Current.GetInstance<CurveTempModel>(); return ServiceLocator.Current.GetInstance<CurveTempModel>();
} }
} }
public ManualDyelotModel ManualDM
{
get
{
return ServiceLocator.Current.GetInstance<ManualDyelotModel>();
}
}
} }
} }
+1 -1
View File
@@ -11,7 +11,7 @@
Title="SUNLIGHT" Title="SUNLIGHT"
Height="150" Width="400"> Height="150" Width="400">
<Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}"> <Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}">
<TextBox x:Name="Boxx" Height="40" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26" <TextBox x:Name="Boxx" Height="50" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26"
MaxLines="1" BorderThickness="3,3,3,3" ClipToBounds="True"/> MaxLines="1" BorderThickness="3,3,3,3" ClipToBounds="True"/>
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/> <Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/> <Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
+4 -9
View File
@@ -28,9 +28,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
//声明一个更新Address的委托 //声明一个更新Address的委托
public delegate void AddressUpdateHandler(object sender, AddressUpdateEventArgs e); public delegate void AddressUpdateHandler(object sender, AddressUpdateEventArgs e);
//声明一个更新Address的事件 //声明一个更新Address的事件
public event AddressUpdateHandler AddressUpdated; public event AddressUpdateHandler AddressUpdated;
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private string MACHINEDATA; private string MACHINEDATA;
DataTable machine_table; DataTable machine_table;
private List<string> machine; private List<string> machine;
@@ -39,13 +37,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
public MachineSelection() public MachineSelection()
{ {
InitializeComponent(); InitializeComponent();
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 comboBoxMachine.ItemsSource = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from MachinesGroups order by Name desc", null).Tables[0].
SQLiteHelpers.Open(); //打开数据库
comboBoxMachine.ItemsSource = SQLiteHelpers.ExecuteDataSet("select * from MachinesGroups order by Name desc", null).Tables[0].
AsEnumerable().Select(rowdata => rowdata.Field<string>("Name")).ToList();//转换代码 AsEnumerable().Select(rowdata => rowdata.Field<string>("Name")).ToList();//转换代码
machine_table = SQLiteHelpers.ExecuteDataSet("select * from Machines order by Name desc", null).Tables[0]; machine_table = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Machines order by Name desc", null).Tables[0];
SQLiteHelpers.Close(); //关闭连接
machine = machine_table.AsEnumerable().Select(rowdata => rowdata.Field<string>("Name")).ToList();//转换代码 machine = machine_table.AsEnumerable().Select(rowdata => rowdata.Field<string>("Name")).ToList();//转换代码
+8 -18
View File
@@ -1,5 +1,6 @@
using nGantt.GanttChart; using nGantt.GanttChart;
using SunlightCentralizedControlManagement_SCCM_.View; using SunlightCentralizedControlManagement_SCCM_.View;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
@@ -16,9 +17,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
/// Machine.xaml 的交互逻辑 /// Machine.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class User : Window public partial class User : Window
{ {
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
private UserClass.SqliteHelper.SQLiteHelper SQLiteHelpers = null; //定义数据库
CheckBox[] checkBoxes = new CheckBox[99]; CheckBox[] checkBoxes = new CheckBox[99];
string[] strings = new string[13] {"修改系统设置", "修改用户设置", string[] strings = new string[13] {"修改系统设置", "修改用户设置",
"单机监控","单机控制","单机设置","新建排程","排程编辑","排程删除", "单机监控","单机控制","单机设置","新建排程","排程编辑","排程删除",
@@ -40,10 +39,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
checkBoxes[i].Height = 50; checkBoxes[i].Height = 50;
Capacity.Children.Add(checkBoxes[i]); Capacity.Children.Add(checkBoxes[i]);
} }
SQLiteHelpers = new UserClass.SqliteHelper.SQLiteHelper(DBAddress); //数据库连接路径 DataGriduser.ItemsSource = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0].DefaultView;
SQLiteHelpers.Open(); //打开数据库
DataGriduser.ItemsSource = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0].DefaultView;
SQLiteHelpers.Close();
} }
private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件 private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件
@@ -105,22 +101,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
USER_new.Add("Groups", Group); USER_new.Add("Groups", Group);
USER_new.Add("Capacity", Cap); USER_new.Add("Capacity", Cap);
USER_new.Add("Note", note); USER_new.Add("Note", note);
SQLiteHelpers = new UserClass.SqliteHelper.SQLiteHelper(DBAddress); //数据库连接路径 MainWindowViewModel.SQLiteHelpers.Delete("USER", "Name='" + name + "'", null);
SQLiteHelpers.Open(); //打开数据库 MainWindowViewModel.SQLiteHelpers.InsertData("USER", USER_new);// 执行插入
SQLiteHelpers.Delete("USER", "Name='" + name + "'", null); DataGriduser.ItemsSource = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0].DefaultView;
SQLiteHelpers.InsertData("USER", USER_new);// 执行插入
DataGriduser.ItemsSource = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0].DefaultView;
SQLiteHelpers.Close();
_Name.Text = null; _Name.Text = null;
} }
private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{ {
SQLiteHelpers = new UserClass.SqliteHelper.SQLiteHelper(DBAddress); //数据库连接路径 MainWindowViewModel.SQLiteHelpers.Delete("USER", "Name='" + _Name.Text + "'", null);
SQLiteHelpers.Open(); //打开数据库 DataGriduser.ItemsSource = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0].DefaultView;
SQLiteHelpers.Delete("USER", "Name='" + _Name.Text + "'", null);
DataGriduser.ItemsSource = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0].DefaultView;
SQLiteHelpers.Close();
_Name.Text = null; _Name.Text = null;
} }
} }
+23
View File
@@ -0,0 +1,23 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.UserInf"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
WindowStartupLocation="CenterScreen"
Loaded ="Window_Loaded"
ResizeMode="NoResize"
mc:Ignorable="d"
Title="SUNLIGHT 800" Height="400" Width="800">
<Grid>
<Grid Margin="0,0,0,100">
<TextBox x:Name="INF_DATA" Margin="140,20,20,20" TextWrapping="Wrap" FontSize="30" IsReadOnly="True" BorderBrush="#FF673AB7" BorderThickness="2,2,2,2" Cursor="Hand" />
<Image Height="100" Width="100" FlowDirection="LeftToRight" HorizontalAlignment="Left" Margin="20,0,0,0" Source="/Lmage/IconParkInfo.png" VerticalAlignment="Center"/>
</Grid>
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="45" Margin="50,70,20,20"
VerticalAlignment="Bottom" Width="100" Click="YES_Click" HorizontalContentAlignment="Center"/>
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="45" Margin="50,70,20,20"
VerticalAlignment="Bottom" Width="100" Click="YES_Click"/>
</Grid>
</Window>
+47
View File
@@ -0,0 +1,47 @@
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Xml.Linq;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
{
/// <summary>
/// ViewProgram.xaml 的交互逻辑
/// </summary>
public partial class UserInf : Window
{
public string Inf_DAT;//信息
public UserInf()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
INF_DATA.Text = Inf_DAT;
}
private void YES_Click(object sender, RoutedEventArgs e)//确认
{
this.Close(); //关闭窗口
}
}
}
+55
View File
@@ -0,0 +1,55 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.UserInformation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
mc:Ignorable="d"
Closing="Window_Closing"
ResizeMode="NoResize"
WindowStyle="SingleBorderWindow"
Title="SUNLIGHT" Height="450" Width="800">
<Grid>
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
AutoGenerateColumns="False" MinColumnWidth="30" Background="White" GridLinesVisibility="All"
ColumnHeaderHeight="60" HorizontalContentAlignment="Right" CanUserReorderColumns="False"
CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="30" Focusable="True" >
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Resources>
<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/>
</Style>
<DataTemplate x:Key="btnCell">
<!--注意此处的设置方式-->
<Button Content="{x:Static lang:Resources.Confirm}" Click="Button_Click" Tag="{Binding}" FontSize="20"/>
</DataTemplate>
</DataGrid.Resources>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Machine}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Code}" MaxWidth="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding ID}" MaxWidth="0" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Information}" Binding="{Binding Information}" Width="*" IsReadOnly="True"/>
<DataGridTemplateColumn Width="100" CellTemplate="{StaticResource btnCell}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
+97
View File
@@ -0,0 +1,97 @@
using ScottPlot.Colormaps;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
using System.Linq;
using System.Speech.Synthesis;
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.Threading;
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
{
/// <summary>
/// UserInformation.xaml 的交互逻辑
/// </summary>
public partial class UserInformation : Window
{
private static UserClass.IniFile.IniFiles Configini =
new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
DispatcherTimer timers = new DispatcherTimer(DispatcherPriority.Normal);//初始化循环,调用一次Tick
private SpeechSynthesizer synth = new SpeechSynthesizer();//语音
int inf_cont = 0;
public UserInformation()
{
InitializeComponent();
Griddata.ItemsSource = MainWindow.InfData.DefaultView;
synth.Rate = int.Parse( Configini.IniReadvalue("VOICE", "V1"));
synth.Volume = int.Parse( Configini.IniReadvalue("VOICE", "V2"));
Speak();
CountDown();
}
public void CountDown()
{
timers.Interval = TimeSpan.FromSeconds(5);//秒
timers.Tick += DisTimer_S;
timers.Start();
}//时间周期初始化
void DisTimer_S(object sender, EventArgs e)//Tick_Event周期执行事件50MS
{
Speak();
}
private void Speak()//语音
{
if (inf_cont < MainWindow.InfData.Rows.Count)
{
synth.SpeakAsync(Properties.Resources.Machine + MainWindow.InfData.Rows[inf_cont][0].ToString() +
MainWindow.InfData.Rows[inf_cont][1].ToString());//播报
inf_cont++;
}
else
{
synth.SpeakAsync(Properties.Resources.Machine + MainWindow.InfData.Rows[0][0].ToString() +
MainWindow.InfData.Rows[0][1].ToString());//播报
inf_cont = 0;
}
if (MainWindow.InfData.Rows.Count == 0) { this.Close(); }
}
private void Button_Click(object sender, RoutedEventArgs e)
{
try
{
var button = sender as Button;
DataRowView datarow = (DataRowView)button.Tag;
var id = datarow.Row.Field<int>("ID");
MainWindow.InfData.Select("ID='" + id + "'").First().Delete();
Griddata.ItemsSource = MainWindow.InfData.DefaultView;
if (MainWindow.InfData.Rows.Count == 0) { this.Close(); }
}
catch (Exception) { }
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
synth.Dispose();
timers.Stop();
}
}
}
+15
View File
@@ -0,0 +1,15 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.UserMessage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
mc:Ignorable="d"
Title="UserMessage" Height="450" Width="800">
<Grid Margin="0,0,0,0">
<Button x:Name="Save" Content="{x:Static lang:Resources.Cancel}" HorizontalAlignment="Right" Height="35" Margin="450,0,50,10" VerticalAlignment="Bottom" Width="80" Click="Save_Click"/>
<ContentControl x:Name="Picture" Margin="0,0,0,50"/>
</Grid>
</Window>
+46
View File
@@ -0,0 +1,46 @@
using SunlightCentralizedControlManagement_SCCM_.View;
using SunlightCentralizedControlManagement_SCCM_.EX;
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;
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
{
/// <summary>
/// UserMessage.xaml 的交互逻辑
/// </summary>
public partial class UserMessage : Window
{
public UserMessage()
{
InitializeComponent();
}
public void DispenseMacInfo(object dat, string mac)
{
DispenseState dispenseState = new DispenseState();
dispenseState.State(dat,mac);
Picture.Content = dispenseState;
}
public void Dyelots(object dat)
{
DyelotView dyelotView = new DyelotView();
dyelotView.Dyelot(dat);
Picture.Content= dyelotView;
}
private void Save_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}
+93
View File
@@ -0,0 +1,93 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.UserWorkOrder"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
WindowStartupLocation="CenterScreen"
Loaded ="Window_Loaded"
ResizeMode="NoResize"
mc:Ignorable="d"
Title="SUNLIGHT 800" Height="400" Width="800">
<Grid>
<DataGrid Grid.Row="0" Grid.Column="0" x:Name="WorkOrder" AlternationCount="2" IsReadOnly="True"
SelectedCellsChanged="WorkOrder_SelectedCellsChanged" EnableRowVirtualization="True" EnableColumnVirtualization="True"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" AutoGenerateColumns="False" MinColumnWidth="30"
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="True"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" Margin="0,0,0,132" >
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="25" />
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
<DataTrigger Binding="{Binding lock}" Value="True">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="309">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="308">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding State}" Value="800">
<Setter Property="IsHitTestVisible" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Resources>
<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.WorkOrder}" Binding="{Binding WorkOrder}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ProgramName}" Binding="{Binding ProgramName}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.StartTime}" Binding="{Binding StartTime}" Width="250" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Machines}" Binding="{Binding Machines}" Width="100" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ColorNumber}" Binding="{Binding ColorNumber}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Client}" Binding="{Binding Client}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ClothWeight}" Binding="{Binding ClothWeight}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ClothSpecies}" Binding="{Binding ClothSpecies}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.BathRatio}" Binding="{Binding BathRatio}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Total}" Binding="{Binding Total}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.USER}" Binding="{Binding USER}" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ColorName}" Binding="{Binding ColorName}" Width="200" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
<Image Height="100" Width="100" FlowDirection="LeftToRight" HorizontalAlignment="Left" Margin="20,0,0,20" Source="/Lmage/IconParkInfo.png" VerticalAlignment="Bottom"/>
<Button Content="{x:Static lang:Resources.Start}" HorizontalAlignment="Right" Height="45" Margin="50,70,200,20" IsEnabled="False" x:Name="Start"
VerticalAlignment="Bottom" Width="100" Click="Start_Click" HorizontalContentAlignment="Center"/>
<Button Content="{x:Static lang:Resources.Quit}" HorizontalAlignment="Right" Height="45" Margin="50,70,20,20"
VerticalAlignment="Bottom" Width="100" Click="Quit_Click" HorizontalContentAlignment="Center"/>
</Grid>
</Window>
+139
View File
@@ -0,0 +1,139 @@
using ScottPlot.TickGenerators.TimeUnits;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Xml.Linq;
using TouchSocket.Core;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
{
/// <summary>
/// ViewProgram.xaml 的交互逻辑
/// </summary>
public partial class UserWorkOrder : Window
{
public DataTable WorkOrderTable = new DataTable();//信息
private string WorkOrder_=null;
private string machine_ = null;
public UserWorkOrder()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
WorkOrder.ItemsSource = WorkOrderTable.DefaultView;
}
private void Start_Click(object sender, RoutedEventArgs e)//确认
{
Dictionary<string, object> dat_821 = new Dictionary<string, object>();
dat_821.Clear();
dat_821.Add("INSTRUCTION", "START");
dat_821.Add("WorkOrder", WorkOrder_);
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine_ + "'").First();
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
string dat = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString();
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
if (drEmployee.Field<bool>("Type"))
{//网络
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
{
ID = index,
DAT = dat
});
}
else
{//串口
if (drEmployee.Field<string>("Serial") == "PORT1")
{
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat);
if (!exists)
{
stringQueueSerial_1.Enqueue(new QueueSerial
{
ID = index,
DAT = dat
});
}
}
else if (drEmployee.Field<string>("Serial") == "PORT2")
{
bool exists = stringQueueSerial_2.Any(item => item.ID == index && item.DAT == dat);
if (!exists)
{
stringQueueSerial_2.Enqueue(new QueueSerial
{
ID = index,
DAT = dat
});
}
}
else if (drEmployee.Field<string>("Serial") == "PORT3")
{
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat);
if (!exists)
{
stringQueueSerial_3.Enqueue(new QueueSerial
{
ID = index,
DAT = dat
});
}
}
else if (drEmployee.Field<string>("Serial") == "PORT4")
{
bool exists = stringQueueSerial_4.Any(item => item.ID == index && item.DAT == dat);
if (!exists)
{
stringQueueSerial_4.Enqueue(new QueueSerial
{
ID = index,
DAT = dat
});
}
}
}
}
this.Close();
}
private void Quit_Click(object sender, RoutedEventArgs e)//退出
{
this.Close(); //关闭窗口
}
private void WorkOrder_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
{
int rownum = WorkOrder.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
WorkOrder_ = (WorkOrder.Columns[0].GetCellContent(WorkOrder.Items[rownum]) as TextBlock).Text;//定位第0列,
machine_ = (WorkOrder.Columns[3].GetCellContent(WorkOrder.Items[rownum]) as TextBlock).Text;//定位第0列,
Start.IsEnabled = true;
}
}
}
}
+138 -25
View File
@@ -5,36 +5,149 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView" xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties" xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d" mc:Ignorable="d"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
ResizeMode="NoResize" ResizeMode="NoResize"
Title="SUNLIGHT 800" Height="400" Width="400"> WindowStyle="None"
<Grid FocusManager.FocusedElement="{Binding ElementName=boxNAME}"> Title="SUNLIGHT 800" Height="800" Width="600">
<TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30" Margin="10,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE"/> <Grid>
<TextBlock Text="{x:Static lang:Resources.Function}" HorizontalAlignment="Left" Height="30" Margin="10,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE"/> <Grid.RowDefinitions>
<ComboBox x:Name="boxID" HorizontalAlignment="Right" Height="30" Margin="0,60,10,0" VerticalAlignment="Top" Width="230" FontSize="18" SelectionChanged="BoxID_SelectionChanged" BorderBrush="#FF5100E0"/> <RowDefinition Height="300"/>
<TextBox x:Name="boxNAME" HorizontalAlignment="Right" Height="30" Margin="0,20,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" ToolTip="code" <RowDefinition/>
TextChanged="TextBox_TextChanged" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="18" HorizontalContentAlignment="Left" MaxLength="3" CaretBrush="#FF5100E0" BorderBrush="#FF5100E0"/> <RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Border Grid.Row="1" BorderThickness="5,5,5,5" BorderBrush="#FFABABAB"/>
<Grid Grid.Row="0">
<TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30"
Margin="210,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150"
FontSize="20" Background="#FFEFEEEE"/>
<TextBlock Text="{x:Static lang:Resources.Function}" HorizontalAlignment="Left" Height="30"
Margin="210,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150"
FontSize="20" Background="#FFEFEEEE"/>
<ComboBox x:Name="boxID" HorizontalAlignment="Right" Height="30" Margin="0,60,10,0"
VerticalAlignment="Top" Width="230" FontSize="20" SelectionChanged="BoxID_SelectionChanged"/>
<TextBox x:Name="boxNAME" HorizontalAlignment="Right" Height="30" Margin="0,20,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
TextChanged="TextBox_TextChanged" PreviewTextInput="Tb_KeyPress"
InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"/>
<Image x:Name="imageP" HorizontalAlignment="Left" Height="200" Margin="10,20,0,0" VerticalAlignment="Top" Width="200">
<Image.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
</Image.OpacityMask>
</Image>
<TextBlock x:Name="P1N" HorizontalAlignment="Left" Height="30" Margin="210,120,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P1" HorizontalAlignment="Right" Height="30" Margin="0,120,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP1" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P1_TextChanged"/>
<TextBlock x:Name="P2N" HorizontalAlignment="Left" Height="30" Margin="210,155,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P2" HorizontalAlignment="Right" Height="30" Margin="0,155,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP2" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P2_TextChanged"/>
<TextBlock x:Name="P3N" HorizontalAlignment="Left" Height="30" Margin="210,190,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P3" HorizontalAlignment="Right" Height="30" Margin="0,190,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP3" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P3_TextChanged"/>
<TextBlock x:Name="P4N" HorizontalAlignment="Left" Height="30" Margin="210,225,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P4" HorizontalAlignment="Right" Height="30" Margin="0,225,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P4_TextChanged"/>
<TextBlock x:Name="P5N" HorizontalAlignment="Left" Height="30" Margin="210,260,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P5" HorizontalAlignment="Right" Height="30" Margin="0,260,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P5_TextChanged"/>
</Grid>
<TextBlock x:Name="P1N" HorizontalAlignment="Left" Height="30" Margin="10,120,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> <Grid Grid.Row="1">
<TextBox x:Name="P1" HorizontalAlignment="Right" Height="30" Margin="0,120,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <TextBlock x:Name="Sub" Text="{x:Static lang:Resources.Subroutine}" HorizontalAlignment="Left"
Text="0" PreviewTextInput="Tb_KeyP1" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Height="40" Margin="210,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="360"
<TextBlock x:Name="P2N" HorizontalAlignment="Left" Height="30" Margin="10,155,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> FontSize="25" Background="#FFEFEEEE"/>
<TextBox x:Name="P2" HorizontalAlignment="Right" Height="30" Margin="0,155,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <Image x:Name="imageP1" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125"
Text="0" PreviewTextInput="Tb_KeyP2" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Margin="20,10,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4"
<TextBlock x:Name="P3N" HorizontalAlignment="Left" Height="30" Margin="10,190,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> MouseLeftButtonDown="imageP1_MouseLeftButtonDown" MouseLeftButtonUp="imageP1_MouseLeftButtonUp"/>
<TextBox x:Name="P3" HorizontalAlignment="Right" Height="30" Margin="0,190,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <Image x:Name="imageP2" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125"
Text="0" PreviewTextInput="Tb_KeyP3" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Margin="20,145,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4"
<TextBlock x:Name="P4N" HorizontalAlignment="Left" Height="30" Margin="10,225,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> MouseLeftButtonDown="imageP2_MouseLeftButtonDown" MouseLeftButtonUp="imageP2_MouseLeftButtonUp"/>
<TextBox x:Name="P4" HorizontalAlignment="Right" Height="30" Margin="0,225,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <Image x:Name="imageP3" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125"
Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Margin="20,280,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4"
<TextBlock x:Name="P5N" HorizontalAlignment="Left" Height="30" Margin="10,260,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="130" FontSize="20" Background="#FFEFEEEE" Visibility="Hidden"/> MouseLeftButtonDown="imageP3_MouseLeftButtonDown" MouseLeftButtonUp="imageP3_MouseLeftButtonUp"/>
<TextBox x:Name="P5" HorizontalAlignment="Right" Height="30" Margin="0,260,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" <TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30"
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Left" Visibility="Hidden" CaretBrush="#FF5100E0" /> Margin="210,70,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150"
FontSize="20" Background="#FFEFEEEE"/>
<TextBlock Text="{x:Static lang:Resources.Function}" HorizontalAlignment="Left" Height="30"
Margin="210,110,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150"
FontSize="20" Background="#FFEFEEEE"/>
<ComboBox x:Name="boxIDp" HorizontalAlignment="Right" Height="30" Margin="0,110,10,0"
VerticalAlignment="Top" Width="230" FontSize="20" SelectionChanged="boxIDp_SelectionChanged"/>
<TextBox x:Name="boxNAMEp" HorizontalAlignment="Right" Height="30" Margin="0,70,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
IsReadOnly="True" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"
TextChanged="TextBoxp_TextChanged" />
<TextBlock x:Name="P1NP" HorizontalAlignment="Left" Height="30" Margin="210,170,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P1P" HorizontalAlignment="Right" Height="30" Margin="0,170,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP1p"
TextChanged="P1P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P2NP" HorizontalAlignment="Left" Height="30" Margin="210,205,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P2P" HorizontalAlignment="Right" Height="30" Margin="0,205,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP2p"
TextChanged="P2P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P3NP" HorizontalAlignment="Left" Height="30" Margin="210,240,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P3P" HorizontalAlignment="Right" Height="30" Margin="0,240,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP3p"
TextChanged="P3P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P4NP" HorizontalAlignment="Left" Height="30" Margin="210,275,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P4P" HorizontalAlignment="Right" Height="30" Margin="0,275,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP4p"
TextChanged="P4P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P5NP" HorizontalAlignment="Left" Height="30" Margin="210,310,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P5P" HorizontalAlignment="Right" Height="30" Margin="0,310,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP5p"
TextChanged="P5P_TextChanged" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
</Grid>
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click" Background="#FF5100E0"/> <Button Grid.Row="2" x:Name="yes" Content="{x:Static lang:Resources.YES}"
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click" Background="#FF5100E0"/> HorizontalAlignment="Right" Height="35" Margin="0,0,200,5"
VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
<Button Grid.Row="2" x:Name="no" Content="{x:Static lang:Resources.NO}"
HorizontalAlignment="Right" Height="35" Margin="0,0,50,5"
VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
</Grid> </Grid>
</Window> </Window>
+1287 -123
View File
File diff suppressed because it is too large. Load diff
Loaded 100 of 188 files, more files were not shown because too many files have changed in this diff. Show more