wu
2024-03-18 6356c6e148c854bb60ba1cd51fafdabfa932efff
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
@@ -37,35 +37,34 @@
      // if (S7control.getinstance().CheckConnected() == false) {
      spianService = WebSocketServer.applicationContext.getBean(SpianServiceNew.class);
      albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class);
      spianService.selectAll(albaniaMapper.SelectGlass());
      //读取DB14区文件
      PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
    
      //读103
      
      String ExportTOMES1=plcmes.getPlcParameter("ExportTOMES1").getValue();//出片请求一线
      String ExportToMES2=plcmes.getPlcParameter("ExportToMES2").getValue();//出片请求二线
      String PLCToMES=plcmes.getPlcParameter("PLCToMES").getValue();//进片请求
      String B01State=plcmes.getPlcParameter("B01State").getValue();//运送车请求
      String TastState=plcmes.getPlcParameter("MESToPLCStatus1").getValue();//任务完成
      String TastType=plcmes.getPlcParameter("TastType").getValue();//任务类型
      
      //调用出片任务
      if (ExportTOMES1.equals("1") == false&&PLCToMES.equals("0")==true) {
      //一号线请求
      if (ExportTOMES1.equals("1") == true&&B01State.equals("0")==true) {
        //将运输车状态改为忙碌
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 1);
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
        spianService.selectout(1);
      }
      //二线请求时
      if (ExportToMES2.equals("1") == false&&PLCToMES.equals("0")==true) {
      //二线号请求时
      if (ExportToMES2.equals("1") == true&&B01State.equals("0")==true) {
        //将运输车状态改为忙碌
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 1);
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
        spianService.selectout(2);
      }
      //调用进片任务
      //进片请求时
      if(PLCToMES.equals("1")==true&&B01State.equals("0")==true){
        //将运输车状态改为忙碌
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(plcmes.getPlcParameter("B01report").getAddressIndex()), (short) 1);
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
        
        spianService.selectAll(albaniaMapper.SelectGlass());
      }
@@ -74,6 +73,16 @@
      //任务完成时
      if(TastState.equals("1")==true){
        //完成确认字
        for(int i=1;i<7;i++){
          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//依次获取任务类型
          String Glassid=plcmes.getPlcParameter("MESID"+i).getValue();//依次获取任务类型
          if(Tastover.equals("1")){
            //调用完成任务 Glassid
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 1);//完成确认字
          }
        }
      }