wu
2024-01-26 90b7450b05c3a26767727b12fc08f9667ebb1868
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -12,6 +12,7 @@
import com.example.springboot.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.entity.Glass;
import com.example.springboot.entity.Out_slice;
import com.example.springboot.entity.Queue;
import com.example.springboot.entity.StorageCage;
@@ -45,6 +46,8 @@
    private StorageCageService storageCageService;
    public static Boolean FeedState = false;
    // public Plchome() throws IOException {
    // config = new Configuration("config.properties");
    // }
@@ -63,7 +66,8 @@
            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);
                north_Glass_Buffer1Service = WebSocketServer.applicationContext
                        .getBean(North_Glass_Buffer1Service.class);
            storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
            dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
@@ -120,14 +124,10 @@
            // 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) {
            // 铝框线交互
                    if (S7controlLK.getinstance().CheckConnected() == true) {
            if (CurrentFrame != null) {
                S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(),"DB17.0");
            }
@@ -155,19 +155,16 @@
                    }
                    S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
                }
                    }
            
            if (S7control.getinstance().CheckConnected() == true) {
                // 获取当前扫码方式
                List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
                if (Scanningmethods != null) {
                    for (Boolean Scanningmethod : Scanningmethods) {
                        jsonObject.append("Scanningmethod", Scanningmethod);
                    }
                }
                    // 获取当前扫码枪玻璃id
                String CurrrentGlassId = spianService.queGlassid("DB103.256", 14).toString();
                jsonObject.append("CurrrentGlassId", CurrrentGlassId);
@@ -244,12 +241,6 @@
                    jsonObject.append("AluminumFrame", AluminumFrame);
                }
                // 获取进片请求状态
                List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
                boolean D01RequestState = D01Request.contains((short) 1);
                // boolean D01RequestState =true;
                jsonObject.append("D01RequestState", D01RequestState);
                // 复位倒计时
                // 地址104.9.6
                List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
@@ -268,14 +259,30 @@
                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);
                    // 自动进片
                    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);
                        }
                    }
            }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            
            boolean dbconnected = false;
            try {