| | |
| | | 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.ibatis.annotations.Result;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | |
|
| | | import com.example.springboot.entity.Glass;
|
| | |
| | | import com.example.springboot.entity.StorageCage;
|
| | | 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.SpianMapper;
|
| | |
|
| | |
| | | public static Boolean isAllowQueue = true;
|
| | | public static Boolean isAllowReordering = true;
|
| | | // 出片队列警告
|
| | | public static Boolean isQueueWarning = false;
|
| | | public static Boolean isQueueWarning = true;
|
| | | // 铝框id
|
| | | public static String FrameNo = "";
|
| | | // 是否需要手动确认玻璃
|
| | |
| | |
|
| | | public static Boolean FeedState = false;
|
| | |
|
| | | public static StringBuilder feedglassid;
|
| | |
|
| | | // public Plchome() throws IOException {
|
| | | // config = new Configuration("config.properties");
|
| | | // }
|
| | |
| | | public void run() {
|
| | | while (this != null) {
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | jsonObject.append("feedglassid", feedglassid);
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | | // 注入mapper
|
| | |
| | | GlassIdList.add(spianService.queGlassid("DB103.114", 14).toString());
|
| | | jsonObject.append("GlassIdList", GlassIdList);
|
| | |
|
| | | // 读去Plc进片车与出片车位置W
|
| | | // 获取Plc进片车与出片车位置
|
| | | List<String> addressList = new ArrayList<String>();
|
| | | addressList.add("DB106.12");
|
| | | addressList.add("DB106.0");
|
| | |
| | | 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> 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);
|
| | | }
|
| | | }
|
| | | // // 获取进片玻璃信息
|
| | | // 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();
|
| | | String frameno = spianService.queGlassid("DB103.270", 11).toString();
|
| | | if (!frameno.equals(Plchome.FrameNo)) {
|
| | | Plchome.FrameNo = frameno;
|
| | | try {
|
| | |
| | | jsonObject.append("countdown", countdowns);
|
| | | }
|
| | | // jsonObject.append("countdown", true);
|
| | | // 复位完成信号ss
|
| | | // 复位完成信号
|
| | | List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
|
| | | for (Boolean reset : resetss) {
|
| | | jsonObject.append("reset", reset);
|
| | |
| | | boolean D01ResponseState = D01respnse.contains((short) 1);
|
| | | // jsonObject.append("D01RequestState", D01RequestState);
|
| | | // 自动进片
|
| | | 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)) {
|
| | |
|
| | | if (isConfirm == true && D01RequestState == true && D01ResponseState == false) {
|
| | | storageCageService.InsertQueueGlassId((short) 1, form3);
|
| | | if (isConfirm == true && form3.getglassId() != null && form3.getglassId() != "") {
|
| | | double width = 0;
|
| | | double height = 0;
|
| | | if (form3.getglassheight() < form3.getglasswidth()) {
|
| | | height = form3.getglassheight();
|
| | | width = form3.getglasswidth();
|
| | | } else {
|
| | | height = form3.getglasswidth();
|
| | | width = form3.getglassheight();
|
| | | }
|
| | | if (height < 380 || width < 380 || height > 1810 || width > 2760) {
|
| | | FeedState = true;
|
| | | jsonObject.append("FeedState", FeedState);
|
| | | FeedState = false;
|
| | | } else {
|
| | | if (D01RequestState == true && D01ResponseState != true) {
|
| | | storageCageService.InsertQueueGlassId((short) 1, form3);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | 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) {
|
| | | for (WebSocketServer webserver : sendwServer) {
|
| | | webserver.sendMessage(jsonObject.toString());
|
| | |
|
| | | } catch (InterruptedException e) {
|
| | | if (webserver != null) {
|
| | |
|
| | | List<String> messages = webserver.getMessages();
|
| | |
|
| | | if (!messages.isEmpty()) {
|
| | | // // 将最后一个消息转换为整数类型的列表
|
| | | webserver.clearMessages();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | } catch (InterruptedException | SQLException 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) {
|
| | | for (WebSocketServer webserver : sendwServer) {
|
| | | webserver.sendMessage(jsonObject.toString());
|
| | |
|
| | | if (webserver != null) {
|
| | |
|
| | | List<String> messages = webserver.getMessages();
|
| | |
|
| | | if (!messages.isEmpty()) {
|
| | | // // 将最后一个消息转换为整数类型的列表
|
| | | webserver.clearMessages();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|