From f3fea817e20a192b2831102a8356045f3d56aa73 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期三, 24 一月 2024 13:32:24 +0800
Subject: [PATCH] 增加json文件
---
src/main/java/com/canadames/mapper/device/DeviceDao.java | 16 +
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java | 186 +++++++++++
springboot-vue3/JsonFile/PlcRead.json | 195 ++++++++++++
springboot-vue3/src/main/java/com/example/springboot/component/PlcRead.java | 91 +++++
src/main/java/com/canadames/service/device/impl/DeviceServiceImpl.java | 20 +
springboot-vue3/JsonFile/Plcframe.json | 51 +++
src/main/java/com/canadames/service/device/DeviceService.java | 16 +
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java | 87 +++++
src/main/java/com/canadames/controller/device/DeviceController.java | 20 +
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview2.java | 92 +++++
src/main/resources/mapper/device/DeviceEntityMapper.xml | 5
springboot-vue3/JsonFile/PlcMes.json | 107 ++++++
src/main/java/com/canadames/entity/device/DeviceEntity.java | 61 +++
13 files changed, 947 insertions(+), 0 deletions(-)
diff --git a/springboot-vue3/JsonFile/PlcMes.json b/springboot-vue3/JsonFile/PlcMes.json
new file mode 100644
index 0000000..53ccdef
--- /dev/null
+++ b/springboot-vue3/JsonFile/PlcMes.json
@@ -0,0 +1,107 @@
+{
+ "plcAddressBegin":"DB105.0",
+ "plcAddressLenght":"52",
+ "dataType":"word",
+ "parameteInfor":[
+ {
+ "codeId": "AddStart",
+ "addressIndex":"0",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "Addgoal",
+ "addressIndex":"2",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "AddLength",
+ "addressIndex":"4",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "AddWidth",
+ "addressIndex":"6",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "AddCount",
+ "addressIndex":"8",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "OutStart",
+ "addressIndex":"10",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "Outgoal",
+ "addressIndex":"12",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "OutCount",
+ "addressIndex":"14",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "AddActivate",
+ "addressIndex":"16",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "OutActivate",
+ "addressIndex":"18",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "FeedID",
+ "addressIndex":"20",
+ "addressLenght":"14",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "ReleaseID",
+ "addressIndex":"34",
+ "addressLenght":"16",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "B01report",
+ "addressIndex":"50",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "B02report",
+ "addressIndex":"52",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ }
+
+
+ ]
+}
diff --git a/springboot-vue3/JsonFile/PlcRead.json b/springboot-vue3/JsonFile/PlcRead.json
new file mode 100644
index 0000000..6bcfbe9
--- /dev/null
+++ b/springboot-vue3/JsonFile/PlcRead.json
@@ -0,0 +1,195 @@
+{
+ "plcAddressBegin": "DB106.0.0",
+ "plcAddressLenght": "66",
+ "dataType": "word",
+ "parameteInfor": [{
+ "codeId": "A01Position",
+ "addressIndex": "0",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A01FlipPosition",
+ "addressIndex": "2",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A01QuestStartPosition",
+ "addressIndex": "4",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A01EndPosition",
+ "addressIndex": "6",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "FeedCarStatus",
+ "addressIndex": "8",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A02QuestOver",
+ "addressIndex": "10",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A02Position",
+ "addressIndex": "12",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A02FlipPosition",
+ "addressIndex": "14",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A02QuestStartPosition",
+ "addressIndex": "16",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A02EndPosition",
+ "addressIndex": "18",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "ExitCarStatus",
+ "addressIndex": "20",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "A02QuestOver",
+ "addressIndex": "22",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "FeedRequest",
+ "addressIndex": "24",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "FeedID",
+ "addressIndex": "26",
+ "addressLenght":"14",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B01Position",
+ "addressIndex": "40",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B01QuestPosition",
+ "addressIndex": "42",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B01CurrentTaskMode",
+ "addressIndex": "44",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B01CarStatus",
+ "addressIndex": "46",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B01CarTaskStatus",
+ "addressIndex": "48",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B02Position",
+ "addressIndex": "50",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B02CarCurrentTask",
+ "addressIndex": "52",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B02CurrentTaskMode",
+ "addressIndex": "54",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B02CarStatus",
+ "addressIndex": "56",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B02CarSaskStatus",
+ "addressIndex": "58",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B01CompleteTheReport",
+ "addressIndex": "60",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "B02CompleteTheReport",
+ "addressIndex": "62",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "OutRequest",
+ "addressIndex": "64",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/springboot-vue3/JsonFile/Plcframe.json b/springboot-vue3/JsonFile/Plcframe.json
new file mode 100644
index 0000000..c270227
--- /dev/null
+++ b/springboot-vue3/JsonFile/Plcframe.json
@@ -0,0 +1,51 @@
+{
+ "plcAddressBegin":"DB17.0",
+ "plcAddressLenght":"40",
+ "dataType":"word",
+ "parameteInfor":[
+ {
+ "codeId": "E01id",
+ "addressIndex":"0",
+ "addressLenght":"14",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "E01Quest",
+ "addressIndex":"16",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "E01Reply",
+ "addressIndex":"18",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"m/min"
+ },
+ {
+ "codeId": "J01Quest",
+ "addressIndex":"20",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "J01id",
+ "addressIndex":"22",
+ "addressLenght":"14",
+ "ratio":"1",
+ "unit":"mm/S"
+ },
+ {
+ "codeId": "J01TurnGo",
+ "addressIndex":"38",
+ "addressLenght":"2",
+ "ratio":"1",
+ "unit":"mm/S"
+ }
+
+
+ ]
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java
new file mode 100644
index 0000000..b488fed
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java
@@ -0,0 +1,87 @@
+package com.example.springboot.component;
+
+import com.example.springboot.entity.device.PlcBitObject;
+import com.example.springboot.entity.device.PlcParameterObject;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.example.springboot.component.InitUtil.readAndUpdateBitValues;
+import static com.example.springboot.component.InitUtil.readAndUpdateWordValues;
+
+public class PLCAutoMes extends Thread {
+
+ // 鐢ㄤ簬瀛樺偍搴旂敤绋嬪簭鐨勯厤缃俊鎭�
+ private Configuration config;
+ private static InitUtil initUtil;
+ // 鍒涘缓涓�涓嚜瀹氫箟鐨� S7 鎺у埗鍣ㄦ秷鎭鐞嗗櫒瀵硅薄
+ MessageHandler customS7Control = new MessageHandler();
+
+ // 鍗曚緥瀹炰緥
+ private static PLCAutoMes instance;
+
+ // 绉佹湁鏋勯�犲嚱鏁�
+ public PLCAutoMes() throws IOException {
+ config = new Configuration("config.properties");
+ initUtil = new InitUtil();
+ }
+
+ // 鑾峰彇鍗曚緥瀹炰緥
+ public static synchronized PLCAutoMes getInstance() throws IOException {
+ if (instance == null) {
+ instance = new PLCAutoMes();
+ }
+ return instance;
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+
+
+ String jsonFilePath = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath();
+
+ String jsonFilePath2 = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath();
+ String jsonFilePath3 = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath();
+ System.out.println(jsonFilePath);
+
+ // 璋冪敤initword鏂规硶
+ PlcParameterObject PlcMesObject= initUtil.initword(jsonFilePath);
+ // 璋冪敤initbit鏂规硶
+ PlcParameterObject PlcReadObject= initUtil.initword(jsonFilePath2);
+ // 璋冪敤initbit鏂规硶
+ PlcParameterObject PlcframeObject= initUtil.initword(jsonFilePath3);
+ readAndUpdateWordValues(PlcframeObject);
+ readAndUpdateWordValues(PlcMesObject);
+ readAndUpdateWordValues(PlcReadObject);
+
+
+ // readAndUpdateWordValues(plcStateObject);
+ int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex();
+ System.out.println(index);
+ PlcMesObject.getPlcParameter("AddStart").getAddress(index);
+ System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index));
+ List<String> addresses = new ArrayList<>();
+ addresses.add("FeedCarStatus");
+ addresses.add("OutRequest");
+ System.out.println(PlcReadObject.getPlcParameterValues(addresses));
+ List<String> addresses2 = new ArrayList<>();
+ addresses2.add("conveyorVelocity(AutoSLOW)");
+ addresses2.add("D01.SRdec");
+
+ System.out.println(PlcReadObject.getPlcParameterValues(addresses2));
+
+
+
+
+ }
+ }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview2.java
new file mode 100644
index 0000000..f9e253f
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview2.java
@@ -0,0 +1,92 @@
+package com.example.springboot.component;
+
+import com.example.springboot.entity.device.PlcBitObject;
+import com.example.springboot.entity.device.PlcParameterObject;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.example.springboot.component.InitUtil.readAndUpdateBitValues;
+import static com.example.springboot.component.InitUtil.readAndUpdateWordValues;
+
+public class PLCAutomaticParameterSettingReview2 extends Thread {
+
+ // 鐢ㄤ簬瀛樺偍搴旂敤绋嬪簭鐨勯厤缃俊鎭�
+ private Configuration config;
+ private static InitUtil initUtil;
+ // 鍒涘缓涓�涓嚜瀹氫箟鐨� S7 鎺у埗鍣ㄦ秷鎭鐞嗗櫒瀵硅薄
+ MessageHandler customS7Control = new MessageHandler();
+
+ // 鍗曚緥瀹炰緥
+ private static PLCAutomaticParameterSettingReview2 instance;
+
+ // 绉佹湁鏋勯�犲嚱鏁�
+ public PLCAutomaticParameterSettingReview2() throws IOException {
+ config = new Configuration("config.properties");
+ initUtil = new InitUtil();
+ }
+
+ // 鑾峰彇鍗曚緥瀹炰緥
+ public static synchronized PLCAutomaticParameterSettingReview2 getInstance() throws IOException {
+ if (instance == null) {
+ instance = new PLCAutomaticParameterSettingReview2();
+ }
+ return instance;
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ String jsonFilePath = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcMes.json").getPath();
+
+ // String jsonFilePath2 =
+ // PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json")
+ // .getPath();
+ // String jsonFilePath4 =
+ // PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json")
+ // .getPath();
+ // System.out.println(jsonFilePath4);
+
+ // 璋冪敤initword鏂规硶
+ PlcParameterObject plcParameterObject = initUtil.initword(jsonFilePath);
+ // PlcParameterObject plcStateObject = initUtil.initword(jsonFilePath4);
+
+ // 璋冪敤initbit鏂规硶
+ // PlcBitObject plcBitObject = initUtil.initbit(jsonFilePath2);
+ // readAndUpdateBitValues(plcBitObject);
+ readAndUpdateWordValues(plcParameterObject);
+
+ // readAndUpdateWordValues(plcStateObject);
+ int index = plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddressIndex();
+ System.out.println(index);
+ plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index);
+ System.out.println(plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index));
+ // S7control.getinstance().WriteWord(plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddress(index),
+ // (short) 100);
+ List<String> addresses = new ArrayList<>();
+ addresses.add("conveyorVelocity(AutoFAST)");
+ addresses.add("A02ID");
+ System.out.println(plcParameterObject.getPlcParameterValues(addresses));
+ List<String> addresses2 = new ArrayList<>();
+ addresses2.add("conveyorVelocity(AutoSLOW)");
+ addresses2.add("D01.SRdec");
+
+ // System.out.println(plcBitObject.getPlcBitValues(addresses2));
+
+ // int index2 = plcBitObject.getPlcBit("DO1id").getAddressIndex();
+ // System.out.println(index2);
+
+ // plcBitObject.getPlcBit("DO1id").getAddress(index2);
+ // System.out.println(plcBitObject.getPlcBit("DO1id").getAddress(index2));
+
+ }
+ }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
new file mode 100644
index 0000000..1717468
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
@@ -0,0 +1,186 @@
+package com.example.springboot.component;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.example.springboot.service.JdbcConnections;
+import com.example.springboot.service.SpianService;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+
+import com.example.springboot.entity.north_glass_buffer1;
+import com.example.springboot.mapper.AlarmMapper;
+import com.example.springboot.mapper.SpianMapper;
+
+public class PlcHoldNew extends Thread {
+
+ private AlarmMapper alarmMapper;
+
+ @Autowired
+ private JdbcConnections jdbcConnections;
+ private SpianMapper spianMapper;
+ private SpianService spianService;
+
+ int aaa;
+
+ @Override
+ public void run() {
+
+ while (this != null) {
+ try {
+
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ // \\ TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ // if (S7control.getinstance().CheckConnected() == false) {
+ spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
+ spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
+ jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
+
+ String str = "";
+ BufferedReader bufferedReader = null;
+ FileInputStream fileInputStream;
+
+
+
+
+
+ // 鏍规嵁鐜荤拑id鑾峰彇璁㈠崟鍙�,鍗曠嫭鏁版嵁婧�
+ // try {
+ // north_glass_buffer1 glass = jdbcConnections.selectGlass(112);
+ // // System.out.println(glass.getOrderId());
+ // } catch (SQLException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+
+ // 鍑虹墖浠诲姟////////////////////////////////
+ List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 鍑虹墖杞︾姸鎬�
+ List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 鍑虹墖浠诲姟鏄惁鍚姩
+ // StringBuilder writedstrIdOut = new StringBuilder();
+ // 鑾峰彇宸蹭笅鍙戠殑鍑虹墖id
+ byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 14);
+ String writedstrIdOut = new String(writedglassidbytesOut);
+
+ boolean outstate = false;// 鍑虹墖杞︾┖闂插垽鏂�
+ boolean outstate1 = false;// 鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔�
+ if (outlist != null && outlist1 != null) {
+
+ outstate = outlist.contains((short) 0);// 鍑虹墖杞︾┖闂插垽鏂� 褰撳嚭鐗囪溅绌洪棽鏃朵负true
+ outstate1 = outlist1.contains((short) 1);// 鍑虹墖杞︿换鍔℃槸鍚﹀惎鍔� 褰撳嚭鐗囪溅浠诲姟鍚姩鏃朵负true
+
+ // 鍒ゆ柇褰撳墠鏄惁鏈夋湭鎵ц鐨勪换鍔�
+ int outnum = spianMapper.SelectOutSliceshu();
+ int cageoutsum = spianMapper.Selectcageout(3);
+ // 褰撴病鏈変换鍔℃墽琛屽苟涓斿嚭鐗囪溅绌洪棽鏃�
+ if (outnum == 0 && outstate == true && Plchome.isAllowQueue == true && cageoutsum == 0) {
+ // 鍒ゆ柇閾濇鍑虹墖闃熷垪琛ㄦ槸鍚︽湁寰呭嚭鐗囩殑鐜荤拑
+ String outglassid = spianMapper.SelectOutSlice();
+ // 褰撴湁寰呭嚭鐗囩殑鐜荤拑鏃�
+ if (outglassid != null) {
+ // 鑾峰彇璇ョ幓鐠冩槸鍚﹁绂佺敤
+ int glassdisabled = spianMapper.SelectCageGlassState(outglassid);
+ // 鏈鐢ㄤ笅鍙戜换鍔�
+ if (glassdisabled == 0) {
+ spianService.selectout2(outglassid);
+ Plchome.isQueueWarning = false;
+ outstate = false;
+ } else { // 绂佺敤鏇存敼鐘舵�佸脊鍑烘彁绀�
+ Plchome.isQueueWarning = true;
+ }
+
+ }
+ }
+ if (outstate == true) {// 褰撳嚭鐗囪溅绌洪棽鏃�,涓斿嚭鐗囧惎鍔ㄤ负1鏃讹紝浠诲姟鍚姩鏀逛负0
+ if (outstate1 == true) {
+ S7control.getinstance().WriteWord("DB105.18", (short) 0);// 鍑虹墖浠诲姟鍚姩鏀逛负0
+ }
+ }
+ }
+
+ ///////////// 杩涚墖浠诲姟
+ List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 鑾峰彇prc杩涚墖璇锋眰鏁版嵁
+ List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 鑾峰彇杩涚墖杞︾姸鎬�
+ List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 鑾峰彇杩涚墖杞︿换鍔℃槸鍚﹀惎鍔�
+
+ boolean B01backs = spianService.listbool("DB106.60");// b01姹囨姤
+ boolean B02backs = spianService.listbool("DB106.62");// b02姹囨姤
+
+ StringBuilder B01glassid = spianService.queGlassid("DB103.184", 14);// BO1鐨勭幓鐠僫d
+ StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02鐨勭幓鐠僫d
+
+ // 褰撹繘鐗囧皬杞﹀畬鎴愪换鍔℃椂
+ if (B01backs == true) {
+ // 褰揃01灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬� 涓�1
+ // spianService.overtask(B01glassid.toString());// 瀹屾垚浠诲姟
+ // S7control.getinstance().WriteWord("DB106.60", (short) 0);// 鎭㈠B01灏忚溅搴旂瓟鏀逛负0
+ boolean yingda = spianService.listbool("DB106.60");// b01姹囨姤
+ System.out.println("姹囨姤鏃禕01|绗�" + aaa + "娆�" + B01glassid + "搴旂瓟" + yingda);
+ aaa += 1;
+ }
+
+ // 褰撳嚭鐗囧皬杞﹀畬鎴愪换鍔℃椂
+ if (B02backs == true) {
+ // 褰揃02灏忚溅姹囨姤瀹屾垚鏃舵洿鏀圭幓鐠冪姸鎬佷负0
+ // spianService.overtask(B02glassid.toString());// 瀹屾垚浠诲姟
+ // S7control.getinstance().WriteWord("DB106.62", (short) 0);// 鎭㈠B02灏忚溅搴旂瓟鏀逛负0
+ System.out.println("姹囨姤鏃禕02|" + B02glassid);
+ boolean yingda1 = spianService.listbool("DB106.62");// b02姹囨姤
+ System.out.println("姹囨姤鏃禕02|绗�" + aaa + "娆�" + B02glassid + "搴旂瓟" + yingda1);
+ }
+
+
+ // 鑾峰彇DO1鏁版嵁
+ StringBuilder queueid1 = spianService.queGlassid("DB106.26", 14);// 鑾峰彇璇锋眰鐨刬d璺烡O1鍚屾椂娓�
+ // 鑾峰彇DO2鏁版嵁
+ StringBuilder queueid2 = spianService.queGlassid("DB103.58", 14);
+
+ int questate = spianMapper.Selectquecount(queueid1.toString());// 鍒ゆ柇鎵爜浣嶆槸鍚︽湁鐜荤拑宸茬‘璁�
+ // queueid1.toString().isEmpty()
+ north_glass_buffer1 glass1 = spianMapper.selectGlass(queueid1.toString());// D01鐨勭幓鐠冧俊鎭�
+ north_glass_buffer1 glass2 = spianMapper.selectGlass(queueid2.toString());// D02鐜荤拑淇℃伅
+ // 褰撴壂鐮佷綅鐜荤拑id涓虹┖鏃� 瀹藉害涓�0
+ if (queueid1 != null && questate == 0) {
+ // 鍐欏叆D01鐨勬暟鎹埌涓婄墖闃熷垪琛�
+ if (glass1 == null) { // 褰撴病鏈夊�兼椂浼犵┖
+ spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 1);
+ } else {
+
+ spianMapper.Updatequeue(queueid1.toString(), glass1.getordernumber(), glass1.getlistnumber(),
+ glass1.getboxnumber(), 0, glass1.getglasslengthmm().toString(), glass1.getglassheightmm().toString(),
+ glass1.getglasslength().toString(), glass1.getglassheight().toString(), 1);
+ }
+
+ }
+ if (queueid2 != null) {
+ // 鍐欏叆D02鐨勬暟鎹埌涓婄墖闃熷垪琛�
+ if (glass2 == null) {
+ spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 2);
+ } else {
+ spianMapper.Updatequeue(queueid2.toString(), glass2.getordernumber(), glass2.getlistnumber(),
+ glass2.getboxnumber(), 0, glass2.getglasslengthmm().toString(), glass2.getglassheightmm().toString(),
+ glass2.getglasslength().toString(), glass2.getglassheight().toString(), 2);
+ spianMapper.overqueue2(queueid2.toString(), 0, 1);// 鏇存敼鎵爜浣嶄换鍔¤〃鐨勭姸鎬佷负0
+ S7control.getinstance().WriteWord("DB105.16", (short) 0);// 鍏抽棴浠诲姟鍚姩
+ }
+
+ }
+
+
+
+ // 鏌ヨ鏁版嵁搴�
+ // 鎺ㄩ�佸埌鍓嶇
+
+ // }
+ }
+ }
+
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcRead.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcRead.java
new file mode 100644
index 0000000..4ba005c
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcRead.java
@@ -0,0 +1,91 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Arrays;
+
+public class PlcRead extends Thread {
+ String name = "";
+ Integer count = 0;
+
+ public void readValue() {
+ String str = "";
+ BufferedReader bufferedReader = null;
+ FileInputStream fileInputStream;
+ try {
+ // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
+ fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/Read.json");
+ // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
+ InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
+ // 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
+ bufferedReader = new BufferedReader(inputStreamReader);
+ String line = null;
+ // 灏� bufferedReader 鍐呭涓�琛屼竴琛岃祴鍊肩粰str
+ while ((line = bufferedReader.readLine()) != null) {
+ str += line;
+ }
+
+ // 灏唖tr瀛楃涓叉牸寮忚浆涓簀son
+ JSONObject jsonObject = new JSONObject(str);
+
+ // 鑾峰彇json涓殑鍊�
+ JSONArray address = jsonObject.getJSONArray("address");
+ for (int i = 0; i < address.size(); i++) {
+ JSONObject ress = (JSONObject) address.get(i);
+
+ this.name = ress.getStr("name");
+ this.count = ress.getInt("count");
+
+ }
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void run() {
+ while (this != null) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ List<Boolean> plclist = S7control.getinstance().ReadBits("DB106.0.0", 78);
+
+ if (plclist != null) {
+ // 灏嗚幏鍙栫殑甯冨皵绫诲瀷杞崲涓烘暣鏁扮被鍨�
+ List<Integer> Intlist = new ArrayList<>();
+ for (Boolean value : plclist) {
+ if (value != null) {
+ Intlist.add(value == true ? 0 : 1);
+ }
+
+ }
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.append("sig", Intlist);
+
+ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Mes");
+ if (sendwServer != null) {
+ for (WebSocketServer webserver : sendwServer) {
+ webserver.sendMessage(jsonObject.toString());
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/canadames/controller/device/DeviceController.java b/src/main/java/com/canadames/controller/device/DeviceController.java
new file mode 100644
index 0000000..764defe
--- /dev/null
+++ b/src/main/java/com/canadames/controller/device/DeviceController.java
@@ -0,0 +1,20 @@
+package com.canadames.controller.device;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author yyq
+ * @since 2024-01-17
+ */
+@RestController
+@RequestMapping("/device-entity")
+public class DeviceController {
+
+}
diff --git a/src/main/java/com/canadames/entity/device/DeviceEntity.java b/src/main/java/com/canadames/entity/device/DeviceEntity.java
new file mode 100644
index 0000000..c9d3d12
--- /dev/null
+++ b/src/main/java/com/canadames/entity/device/DeviceEntity.java
@@ -0,0 +1,61 @@
+package com.canadames.entity.device;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author yyq
+ * @since 2024-01-17
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("device")
+@ApiModel(value="DeviceEntity瀵硅薄", description="")
+public class DeviceEntity implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String deviceId;
+
+ private String createUser;
+
+ private LocalDateTime createTime;
+
+ private String deviceName;
+
+ private String status;
+
+ private String info;
+
+ private String model;
+
+ private LocalDateTime countTimeFlag;
+
+ private String address;
+
+ private String gps;
+
+ private LocalDate debugTime;
+
+ private LocalDate endTime;
+
+ private String customerName;
+
+ private String customerDeviceName;
+
+ private LocalDate lastProductCountDate;
+
+
+}
diff --git a/src/main/java/com/canadames/mapper/device/DeviceDao.java b/src/main/java/com/canadames/mapper/device/DeviceDao.java
new file mode 100644
index 0000000..29ddbc7
--- /dev/null
+++ b/src/main/java/com/canadames/mapper/device/DeviceDao.java
@@ -0,0 +1,16 @@
+package com.canadames.mapper.device;
+
+import com.canadames.entity.device.DeviceEntity;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author yyq
+ * @since 2024-01-17
+ */
+public interface DeviceDao extends BaseMapper<DeviceEntity> {
+
+}
diff --git a/src/main/java/com/canadames/service/device/DeviceService.java b/src/main/java/com/canadames/service/device/DeviceService.java
new file mode 100644
index 0000000..ee32c88
--- /dev/null
+++ b/src/main/java/com/canadames/service/device/DeviceService.java
@@ -0,0 +1,16 @@
+package com.canadames.service.device;
+
+import com.canadames.entity.device.DeviceEntity;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 鏈嶅姟绫�
+ * </p>
+ *
+ * @author yyq
+ * @since 2024-01-17
+ */
+public interface DeviceService extends IService<DeviceEntity> {
+
+}
diff --git a/src/main/java/com/canadames/service/device/impl/DeviceServiceImpl.java b/src/main/java/com/canadames/service/device/impl/DeviceServiceImpl.java
new file mode 100644
index 0000000..7aefa58
--- /dev/null
+++ b/src/main/java/com/canadames/service/device/impl/DeviceServiceImpl.java
@@ -0,0 +1,20 @@
+package com.canadames.service.device.impl;
+
+import com.canadames.entity.device.DeviceEntity;
+import com.canadames.mapper.device.DeviceDao;
+import com.canadames.service.device.DeviceService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author yyq
+ * @since 2024-01-17
+ */
+@Service
+public class DeviceServiceImpl extends ServiceImpl<DeviceDao, DeviceEntity> implements DeviceService {
+
+}
diff --git a/src/main/resources/mapper/device/DeviceEntityMapper.xml b/src/main/resources/mapper/device/DeviceEntityMapper.xml
new file mode 100644
index 0000000..71c82ba
--- /dev/null
+++ b/src/main/resources/mapper/device/DeviceEntityMapper.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.canadames.mapper.device.DeviceDao">
+
+</mapper>
--
Gitblit v1.8.0