From c3204d686fbf8a64dd7fa4dcbb48c0a075df06e0 Mon Sep 17 00:00:00 2001 From: wuyouming666 <2265557248@qq.com> Date: 星期二, 05 十二月 2023 08:06:19 +0800 Subject: [PATCH] 更新电气管理界面 --- springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java | 30 ++++++++++++++++-------------- 1 files changed, 16 insertions(+), 14 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java index 393174d..54d6a6d 100644 --- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java +++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java @@ -82,20 +82,21 @@ e.printStackTrace(); } - this.readValue(); - String PlcAddress = this.name; - Integer Plccount = this.count; +// this.readValue(); +// String PlcAddress = this.name; +// Integer Plccount = this.count; // 鏍规嵁鍦板潃璇诲彇PCL鏁版嵁 - // List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, - // Plccount); - Boolean[] values = { false, false, true, false, true, false, true, false, - true, false, true, false, true, false, - true, false, true, false, true, false, true, false, true, false, true, false, - true, false, true, false, true, - false, true, false, true, false, - true, false, true, false }; - List<Boolean> plclist = new ArrayList<>(Arrays.asList(values)); + List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.0.0", 71); +// List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount); + // System.out.println(plclist); + // Boolean[] values = { false, false, true, false, true, false, true, false, + // true, false, true, false, true, false, + // true, false, true, false, true, false, true, false, true, false, true, false, + // true, false, true, false, true, + // false, true, false, true, false, + // true, false, true, false }; + // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values)); if (plclist != null) { JSONObject jsonObject = new JSONObject(); @@ -113,22 +114,23 @@ } // 灏咺ntlist杞崲涓烘暟缁� + // System.out.println(Intlist); Integer[] shuzu1 = Intlist.toArray(new Integer[0]); // 瀹氫箟鐨勬姤璀﹀唴瀹规暟缁�,鑾峰彇json杩斿洖鐨勯泦鍚� List<String> myCollection; myCollection = readValue(); String[] array1 = myCollection.toArray(new String[myCollection.size()]); - // System.out.println(myCollection); alarmMapper = WebSocketServer.applicationContext.getBean(AlarmMapper.class); for (short i = 0; i < array1.length; i++) { // 鏌ヨ瀵瑰簲鎶ヨ淇℃伅缁撴潫鏃堕棿涓簄ull鐨勬潯鏁� short result = alarmMapper.selectnullti(array1[i]); // 璇诲彇鍒癙LC鐨勫�间负1骞朵笖瀵瑰簲鎶ヨ淇℃伅缁撴潫鏃堕棿涓簄ull鐨勬潯鏁扮殑鏉℃暟涓�0 + // System.out.println(result); if (shuzu1[i] == 1 && result == 0) { // 濉姞涓�鏉℃姤璀︿俊鎭�,鏈夊紑濮嬫椂闂� - alarmMapper.Insertalarm(array1[i]); + // alarmMapper.Insertalarm(array1[i]); } else if (shuzu1[i] == 0 && result > 0) { // 淇敼璇ユ潯鎶ヨ淇℃伅鐨勭粨鏉熸椂闂� alarmMapper.updatealarm(array1[i]); -- Gitblit v1.8.0