From a65b82e86951db8540d38141715be2444b12dc99 Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期一, 18 三月 2024 12:23:10 +0800
Subject: [PATCH] 更新
---
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java | 266 +++++++++++++---------------------------------------
1 files changed, 67 insertions(+), 199 deletions(-)
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
index a849080..684d234 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -1,38 +1,42 @@
package com.example.springboot.component;
-
-import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
-
-import java.io.IOException;
-import java.sql.SQLException;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-
import com.example.springboot.service.*;
+
+import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
-import com.example.springboot.entity.Glass;
+import com.example.springboot.entity.FlowCard;
+import com.example.springboot.entity.FlowCard;
+import com.example.springboot.entity.GlassInfo;
+import com.example.springboot.entity.MeasureSetting;
import com.example.springboot.entity.Out_slice;
import com.example.springboot.entity.Queue;
import com.example.springboot.entity.StorageCage;
+import com.example.springboot.entity.StorageTask;
import com.example.springboot.entity.alarmmg;
import com.example.springboot.entity.north_glass_buffer1;
import com.example.springboot.entity.device.PlcParameterObject;
import com.example.springboot.mapper.HomeMapper;
+import com.example.springboot.mapper.GlassInfoMapper;
+import com.example.springboot.mapper.MeasureSettingMapper;
+import com.example.springboot.mapper.QueueMapper;
import com.example.springboot.mapper.SpianMapper;
public class Plchome extends Thread {
@Autowired
private HomeMapper homeMapper;
+ @Autowired
+ private HomeService HomeService;
+ private QueueMapper QueueMapper;
+ private GlassInfoMapper GlassInfoMapper;
+ private MeasureSettingMapper MeasureSettingMapper;
private OutSliceServive outSliceServive;
private SpianMapper spianMapper;
private SpianService spianService;
- private North_Glass_Buffer1Service north_Glass_Buffer1Service;
- private JdbcConnections dbserve;
+
// 鍑虹墖闃熷垪鏄惁鍏佽鍑虹墖
public static Boolean isAllowQueue = true;
public static Boolean isAllowReordering = true;
@@ -64,14 +68,13 @@
try {
Thread.sleep(1000);
// 娉ㄥ叆mapper
+ HomeService = WebSocketServer.applicationContext.getBean(HomeService.class);
+ QueueMapper = WebSocketServer.applicationContext.getBean(QueueMapper.class);
homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
outSliceServive = WebSocketServer.applicationContext.getBean(OutSliceServive.class);
- north_Glass_Buffer1Service = WebSocketServer.applicationContext
- .getBean(North_Glass_Buffer1Service.class);
storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
- dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
// 绗煎瓙浣跨敤鎯呭喌
List<StorageCage> tableData = homeMapper.selectAll();
@@ -94,20 +97,7 @@
List<alarmmg> alarmmg = homeMapper.SelectAlarmmgInfo();
jsonObject.append("alarmmg", alarmmg);
- // 浼� 鑾峰彇杩涙槸鍚︽湁寰呯‘璁ょ殑鐜荤拑id
- String queid = spianMapper.Selectqueueid();
- int state = spianMapper.Selectqueuestate();
- jsonObject.append("queid", queid);
- jsonObject.append("state", state);
- // 鑾峰彇鎵爜浣嶄笌涓婄墖浣嶇幓鐠冧俊鎭�
- Queue form2 = homeMapper.GetQueueInfo(2);
- Queue form3 = homeMapper.GetQueueInfo(1);
- if (form2.getglassId() != null && form2.getglassId() != "") {
- jsonObject.append("form2", form2);
- }
- if (form3.getglassId() != null && form3.getglassId() != "") {
- jsonObject.append("form3", form3);
- }
+
// 鑾峰彇鍑虹墖闃熷垪淇℃伅
List<Out_slice> listoutslice = outSliceServive.SelectProductionqueue();
jsonObject.append("listoutslice", listoutslice);
@@ -122,187 +112,66 @@
// 鏌ヨ褰撳墠閾濇淇℃伅
Out_slice CurrentFrame = outSliceServive.SelectCurrentFrame();
jsonObject.append("CurrentFrame", CurrentFrame);
+
+ //璇诲彇DB105鍖烘枃浠�
+ PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
+
+ //String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//璇锋眰
+ //double width=plcmes.getPlcParameter("Height").getValue();//瀹�
+ //double height=plcmes.getPlcParameter("width").getValue();//楂�
+ //鑾峰彇娴嬮噺鐨勯暱锛屽
+ String url="C:\\Users\\SNG-ZDH-012\\Desktop\\闃垮皵宸村凹浜氭暟鎹姹�.xlsx";
+ //List typecount= HomeService.ReadExecl2(s);
+ // List xiaopian=HomeService.ReadExecl2(s);
+ // //xiaopian NG1{A:10,B20} NG2{A:5,B5}
+ // for(Object C:xiaopian){
+ // //鐪嬪眰鏁�
+ // }
+ // for(int i=0;i<result.size();i++){
+ // System.out.println(result.get(i));
+ // }
+
+
+ //List result= HomeService.ReadExecl(url);
+ // for(int i=0;i<result.size();i++){
+ // System.out.println(result.get(i));
+ // }
+
+
+
+ String PlcRequest = "1";
+ double width = 402;
+ double height = 402;
+
+ //鍖归厤
+ if ("1".equals(PlcRequest)) {
+ boolean Result=HomeService.Normal(width, height, "1");
+ }
// String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
// String J01id = new String( S7controlLK.getinstance().ReadByte("DB17.22",14));
- if (S7control.getinstance().CheckConnected() == true) {
+
+ //鏌ヨ鐞嗙墖绗间俊鎭�
+ List<StorageCage> StorageCageInfo = storageCageService.SelectStorageCageInfo();
+ jsonObject.append("StorageCageInfo", StorageCageInfo);
- // 閾濇绾夸氦浜�
- if (S7controlLK.getinstance().CheckConnected() == true) {
- if (CurrentFrame != null) {
- S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(), "DB17.0");
- }
- String E01id = S7controlLK.getinstance().readStrings("DB17.0");
- String J01id = S7controlLK.getinstance().readStrings("DB17.22");
+ //鏌ヨ褰撳墠杩涚墖浠诲姟
+ List<StorageTask> StoragTaskeTaskFeed = storageCageService.SelectStorageTask(0);
+ jsonObject.append("StoragTaskeTaskFeed", StoragTaskeTaskFeed);
- List<Short> liststates = S7controlLK.getinstance().ReadWord("DB17.38", 1);
- List<Short> liststate = S7controlLK.getinstance().ReadWord("DB17.20", 1);
- Short framerequest = liststate.get(0);
- if (framerequest == 1) {
- // 閾濇id
- String position;
- try {
- position = dbserve.SelectPositionByFrameBarcode(J01id);
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- position = "0";
- e.printStackTrace();
- }
- Short send;
- if (position.equals("0")) {
- send = 0;
- } else {
- send = 1;
- }
- S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
- }
- }
+ //鏌ヨ褰撳墠鍑虹墖浠诲姟
+ List<StorageTask> StoragTaskeTaskOut = storageCageService.SelectStorageTask(1);
+ jsonObject.append("StoragTaskeTaskOut", StoragTaskeTaskOut);
- // 鑾峰彇褰撳墠鎵爜鏂瑰紡
- List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
- if (Scanningmethods != null) {
- for (Boolean Scanningmethod : Scanningmethods) {
- jsonObject.append("Scanningmethod", Scanningmethod);
- }
- }
- // 鑾峰彇褰撳墠鎵爜鏋幓鐠僫d
- String CurrrentGlassId = spianService.queGlassid("DB103.256", 14).toString();
- jsonObject.append("CurrrentGlassId", CurrrentGlassId);
-
- // 鑾峰彇D01-D06,A01,A02,B01,B02鐘舵��
- List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
- jsonObject.append("DeviceList", DeviceList);
- // 鑾峰彇D01-D06,A01,A02,B01,B02鐜荤拑id
- List<String> GlassIdList = new ArrayList<String>();
- GlassIdList.add(spianService.queGlassid("DB103.44", 14).toString());
- GlassIdList.add(spianService.queGlassid("DB103.58", 14).toString());
-
- GlassIdList.add(spianService.queGlassid("DB103.184", 14).toString());
- GlassIdList.add(spianService.queGlassid("DB103.212", 14).toString());
-
- GlassIdList.add(spianService.queGlassid("DB103.128", 14).toString());
- GlassIdList.add(spianService.queGlassid("DB103.142", 14).toString());
- GlassIdList.add(spianService.queGlassid("DB103.156", 14).toString());
-
- GlassIdList.add(spianService.queGlassid("DB103.72", 14).toString());
- GlassIdList.add(spianService.queGlassid("DB103.86", 14).toString());
- GlassIdList.add(spianService.queGlassid("DB103.100", 14).toString());
- GlassIdList.add(spianService.queGlassid("DB103.114", 14).toString());
- jsonObject.append("GlassIdList", GlassIdList);
-
- // 鑾峰彇Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃�
- List<String> addressList = new ArrayList<String>();
- addressList.add("DB106.12");
- addressList.add("DB106.0");
- List<Short> paramlist = S7control.getinstance().ReadWord(addressList);
- if (paramlist != null) {
- jsonObject.append("params", paramlist);
- }
- // // 鑾峰彇杩涚墖杞︾姸鎬�
- // List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8",
- // 1);// 鑾峰彇杩涚墖杞︾姸鎬�
- // if (datas1ListState != null) {
- // boolean exist1 = datas1ListState.contains((short) 0);
- // jsonObject.append("zhuangtai", exist1);
- // }
-
- // // 鑾峰彇杩涚墖鐜荤拑淇℃伅
- // List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1);
- // if (inglassInfo != null) {
- // if (inglassInfo.size() > 0) {
- // jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
- // }
- // }
- // // 鑾峰彇閾濇idDB106.DBW64锛屾坊鍔犲埌鍑虹墖闃熷垪
- // String frameno="X21763329601FB";
- String frameno = spianService.queGlassid("DB103.270", 14).toString();
- if (!frameno.equals(Plchome.FrameNo)) {
- Plchome.FrameNo = frameno;
- try {
- Short num = 0;
- List<north_glass_buffer1> north_glass_buffer1s = north_Glass_Buffer1Service
- .SelectAluminumFrameInfoById(Plchome.FrameNo);
- for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) {
- if (north_glass_buffer1.getstorageCage() == null) {
- break;
- }
- num++;
- }
- if (num == north_glass_buffer1s.size()) {
- north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
- } else {
- Plchome.AluminumFrame = north_glass_buffer1s;
- }
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- if (AluminumFrame != null) {
- jsonObject.append("AluminumFrame", AluminumFrame);
- }
-
- // 澶嶄綅鍊掕鏃�
- // 鍦板潃104.9.6
- List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
- for (Boolean countdowns : countdown) {
- jsonObject.append("countdown", countdowns);
- }
- // jsonObject.append("countdown", true);
- // 澶嶄綅瀹屾垚淇″彿
- List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
- for (Boolean reset : resetss) {
- jsonObject.append("reset", reset);
- }
-
- // 鏄惁鎬ュ仠
- List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
- for (Boolean emergencystop : emergencystops) {
- jsonObject.append("emergencystop", emergencystop);
- }
- // 鑾峰彇杩涚墖璇锋眰鐘舵��
- List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
- boolean D01RequestState = D01Request.contains((short) 1);
- jsonObject.append("D01RequestState", D01RequestState);
-
- // 鑾峰彇杩涚墖鍙戦�佺姸鎬�
- List<Short> D01respnse = S7control.getinstance().ReadWord("DB106.16", 1);
- boolean D01ResponseState = D01respnse.contains((short) 1);
- // jsonObject.append("D01RequestState", D01RequestState);
- // 鑷姩杩涚墖
- isConfirm = true;
- if (isConfirm == true && form3.getglassId() != null && form3.getglassId() != "") {
- if ((form3.getglassheight() < 380 || form3.getglasswidth() < 390
- || form3.getglassheight() > 1810
- || form3.getglasswidth() > 2760)
- || (form3.getglassheight() < 390 || form3.getglasswidth() < 380
- || form3.getglassheight() > 2760 || form3.getglasswidth() > 1810)) {
- FeedState = true;
- jsonObject.append("FeedState", FeedState);
- FeedState = false;
- } else {
- if (D01RequestState == true && D01ResponseState != true) {
- storageCageService.InsertQueueGlassId((short) 1, form3);
- }
- }
- }
-
- }
+ //鏌ヨ褰撳墠璁㈠崟浠诲姟
+ List<FlowCard> OrderTask = storageCageService.SelectOrderTask();
+ jsonObject.append("OrderTask", OrderTask);
} catch (InterruptedException e) {
e.printStackTrace();
}
- boolean dbconnected = false;
- try {
- dbserve.getConn();
- dbconnected = true;
- } catch (Exception e) {
- // TODO: handle exception
- dbconnected = false;
- }
- jsonObject.append("dbconnected", dbconnected);
// jsonObject.append("params", new short[] { 30, 40, });
ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Home");
if (sendwServer != null) {
@@ -317,7 +186,6 @@
// // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
webserver.clearMessages();
}
-
}
}
--
Gitblit v1.8.0