ZengTao
2024-04-23 d3784e22324ba6ae25fffc0e19874a07dd0d12ae
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -7,7 +7,9 @@
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.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +20,7 @@
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;
@@ -34,7 +37,7 @@
    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 = "";
    // 是否需要手动确认玻璃
@@ -61,7 +64,6 @@
            try {
                Thread.sleep(1000);
                // 注入mapper
                homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
                spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
                spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
@@ -123,7 +125,7 @@
                // 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) {
                    // 铝框线交互
@@ -189,7 +191,7 @@
                    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");
@@ -197,21 +199,21 @@
                    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();
@@ -248,7 +250,7 @@
                        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);
@@ -269,15 +271,22 @@
                    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() != "") {
                        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);
                            }
                        }
                    }
                }
            } catch (InterruptedException e) {