ZengTao
2024-01-16 def4c65d0ed71a48374c8614fcc74820ce2b6d84
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -16,6 +16,7 @@
import com.example.springboot.entity.Queue;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
import com.example.springboot.entity.north_glass_buffer1;
import com.example.springboot.mapper.HomeMapper;
import com.example.springboot.mapper.SpianMapper;
@@ -37,14 +38,16 @@
    public static String FrameNo = "";
    // 是否需要手动确认玻璃
    public static Boolean isConfirm = false;
    //待确认的出片队列
    public static List<north_glass_buffer1> AluminumFrame;
    private Configuration config;
    // private Configuration config;
    private StorageCageService storageCageService;
    public Plchome() throws IOException {
        config = new Configuration("config.properties");
    }
    // public Plchome() throws IOException {
    //     config = new Configuration("config.properties");
    // }
    // public static Map b=new HashMap<>();
    // b.put()
@@ -112,17 +115,34 @@
            jsonObject.append("isAllowReordering", Plchome.isAllowReordering);
            // 是否需要人工确认上片玻璃
            jsonObject.append("isConfirm", isConfirm);
            // String framenos="X21763329601FB";
            //     if (!framenos.equals(Plchome.FrameNo)) {
            //         Plchome.FrameNo = framenos;
            //         try {
            //             north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
            //         } catch (SQLException e) {
            //             // TODO Auto-generated catch block
            //             e.printStackTrace();
            //         }
            //     }
            // 查询当前铝框信息
            Out_slice CurrentFrame = outSliceServive.SelectCurrentFrame();
            jsonObject.append("CurrentFrame", CurrentFrame);
            if (S7control.getinstance().CheckConnected() == true) {
                // 获取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.40", 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进片车与出片车位置W
                List<String> addressList = new ArrayList<String>();
                addressList.add("DB106.12");
@@ -147,20 +167,58 @@
                    }
                }
                // 获取铝框idDB106.DBW64,添加到出片队列
                // // 获取铝框idDB106.DBW64,添加到出片队列
                // String frameno="X21763329601FB";
                String frameno = spianService.queGlassid("DB103.270", 14).toString();
                // String frameno="X12345611002GV";
                // frameno="X21763329601FB";
                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);
                }
                // // 获取铝框idDB106.DBW64,添加到出片队列
                // String frameno = spianService.queGlassid("DB103.270", 14).toString();
                // // String frameno="X12345611002GV";
                // // frameno="X21763329601FB";
                // 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){
                //                 north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
                //                 break;
                //             }
                //             num++;
                //         }
                //         if(num==north_glass_buffer1s.size()){
                //             jsonObject.append("AluminumFrame", north_glass_buffer1s);
                //         }
                //     } catch (SQLException e) {
                //         // TODO Auto-generated catch block
                //         e.printStackTrace();
                //     }
                // }
                // 获取进片请求状态
                List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
@@ -184,14 +242,14 @@
                // 是否急停
                List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
                for (Boolean emergencystop : emergencystops) {
                    jsonObject.
                    append("emergencystop", emergencystop);
                    jsonObject.append("emergencystop", emergencystop);
                }
            
                // // 终止继续按钮
                // List<String> niuanaddressList3 = Arrays.asList(config.getProperty("Parameter2.stop").split(","));
                // List<Boolean> anniuread = S7control.getinstance().readBits(niuanaddressList3);
                // List<String> niuanaddressList3 =
                // Arrays.asList(config.getProperty("Parameter2.stop").split(","));
                // List<Boolean> anniuread =
                // S7control.getinstance().readBits(niuanaddressList3);
                // // Boolean[] value4 = { false, false};
                // // List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
                // Boolean[] value5 = { true };
@@ -319,7 +377,8 @@
                            //         }
                            //     }
                            // } catch (Exception e) {
                            //     System.err.println("An error occurred while writing bit to PLC: " + e.getMessage());
                            // System.err.println("An error occurred while writing bit to PLC: " +
                            // e.getMessage());
                            // }
                            webserver.clearMessages();
                        }