ZengTao
2024-05-20 103e41d02eaccd836870bce3e544bb794447e2ac
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -148,64 +148,64 @@
                jsonObject.append("CurrentFrame", CurrentFrame);
                
                // try {
                //     // 铝框线交互
                //     // if (S7controlLK.getinstance().CheckConnected() == true) {
                //     // E02玻璃id
                //     // log.info("frame1"+S7controlLK.getinstance().CheckConnected());
                //     String E02id="";
                //     try {
                //         E02id= S7controlLK.getinstance().readStrings("DB17.40");
                //         plc2=true;
                //     } catch (Exception e) {
                //         // TODO: handle exception
                //         plc2=false;
                //         e.printStackTrace();
                //     }
                try {
                    // 铝框线交互
                    // if (S7controlLK.getinstance().CheckConnected() == true) {
                    // E02玻璃id
                    // log.info("frame1"+S7controlLK.getinstance().CheckConnected());
                    String E02id="";
                    try {
                        E02id= S7controlLK.getinstance().readStrings("DB17.40");
                        plc2=true;
                    } catch (Exception e) {
                        // TODO: handle exception
                        plc2=false;
                        e.printStackTrace();
                    }
                    
                //     jsonObject.append("Plc2", plc2);
                //     // log.info("铝框线读取2"+S7controlLK.getinstance().CheckConnected());
                    jsonObject.append("Plc2", plc2);
                    // log.info("铝框线读取2"+S7controlLK.getinstance().CheckConnected());
                    
                //     // log.info("E02id"+E02id);
                //     outSliceServive.FrameStateUpdate(E02id);
                //     if (CurrentFrame != null) {
                //         S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(), "DB17.0");
                    // log.info("E02id"+E02id);
                    outSliceServive.FrameStateUpdate(E02id);
                    if (CurrentFrame != null) {
                        S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(), "DB17.0");
                    }
                    // else{
                    //     S7controlLK.getinstance().writeStrings("", "DB17.0");
                //     }
                //     // else{
                //     //     S7controlLK.getinstance().writeStrings("", "DB17.0");
                //     // }
                //     String J01id = S7controlLK.getinstance().readStrings("DB17.22");
                //     List<Short> liststate = S7controlLK.getinstance().ReadWord("DB17.20", 1);
                //     Short framerequest = liststate.get(0);
                //     // log.info("liststate:" + liststate);
                //     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("1")) {
                //             send = 1;
                //         } else {
                //             send = 2;
                //         }
                //         if (J01id != null) {
                //             int barcodeState = spianMapper.SelectOverState(J01id);// 获取该铝框的状态
                //             if (barcodeState == 0) {// 当该铝框所有的玻璃都是完成状态时删除在出片队列的数据
                //                 spianMapper.DeleteQueue(J01id);
                //                 // log.info("deleteoutslice:" + J01id);
                //             }
                //         }
                //         S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
                //     }
                // } catch (Exception e) {
                //     e.printStackTrace();
                // }
                    String J01id = S7controlLK.getinstance().readStrings("DB17.22");
                    List<Short> liststate = S7controlLK.getinstance().ReadWord("DB17.20", 1);
                    Short framerequest = liststate.get(0);
                    // log.info("liststate:" + liststate);
                    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("1")) {
                            send = 1;
                        } else {
                            send = 2;
                        }
                        if (J01id != null) {
                            int barcodeState = spianMapper.SelectOverState(J01id);// 获取该铝框的状态
                            if (barcodeState == 0) {// 当该铝框所有的玻璃都是完成状态时删除在出片队列的数据
                                spianMapper.DeleteQueue(J01id);
                                // log.info("deleteoutslice:" + J01id);
                            }
                        }
                        S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (S7control.getinstance().CheckConnected() == true) {