wu
2024-03-07 712b7bd7bfc09dee41a63c769a272b9ebae68c90
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
@@ -9,6 +9,7 @@
import com.example.springboot.entity.north_glass_buffer1;
import com.example.springboot.entity.device.PlcParameterObject;
import com.example.springboot.mapper.AlarmMapper;
import com.example.springboot.mapper.AlbaniaMapper;
import com.example.springboot.mapper.SpianMapper;
public class PlcHoldNew extends Thread {
@@ -17,7 +18,7 @@
  @Autowired
  private JdbcConnections jdbcConnections;
  private SpianMapper spianMapper;
  private AlbaniaMapper albaniaMapper;
  private SpianService spianService;
  int aaa;
@@ -35,55 +36,27 @@
      // if (S7control.getinstance().CheckConnected() == false) {
      spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
      spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
      albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class);
      //读取DB105区文件
      PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
      //读106
      PlcParameterObject plcread=PLCAutoMes.PlcReadObject;
      //读103
      PlcParameterObject plcstate=PLCAutoMes.plcStateObject;
      String OutRequest=plcread.getPlcParameter("OutRequest").getValue();//出片请求
      String OutActivate=plcmes.getPlcParameter("OutActivate").getValue();//出片启动
      
      String OutRequest=plcread.getPlcParameter("OutRequest").getValue();//出片请求一线
      String OutActivate=plcmes.getPlcParameter("OutActivate").getValue();//出片请求二线
      String AddRequest=plcmes.getPlcParameter("AddRequest").getValue();//进片请求
      String CarRequest=plcmes.getPlcParameter("CatReque").getValue();//运送车请求
      //S7control.getinstance().WriteWord( plcmes.getPlcParameter("1231").getAddress(plcmes.getPlcParameter("1231").getAddressIndex()), (short) 0);
      // 出片任务
      
      if (OutActivate.equals("1") == false&&OutRequest.equals("1")==true) {
        S7control.getinstance().WriteWord("DB105.18", (short) 0);// 出片任务启动改为0
      }
      String FeedRequest=plcread.getPlcParameter("FeedRequest").getValue();// 进片请求字
      String AddActivate=plcmes.getPlcParameter("AddActivate").getValue();// 进片启动
      if (FeedRequest.equals("1") == false&&AddActivate.equals("1")==true) {
        S7control.getinstance().WriteWord("DB105.16", (short) 0);//进片任务启动改为0
      }
      if (OutActivate.equals("1") == true) {
        // 判断当前是否有未执行的任务
        int outnum = spianMapper.SelectOutSliceshu();//是否有正在出片的任务
        int cageoutsum = spianMapper.Selectcageout(3);//笼子内是否还有在出片的玻璃
        // 当没有任务执行并且出片车空闲时
        if (outnum == 0 &&  Plchome.isAllowQueue == true && cageoutsum == 0) {
          // 判断铝框出片队列表是否有待出片的玻璃
          String outglassid = spianMapper.SelectOutSlice();
          // 当有待出片的玻璃时
          if (outglassid != null) {
            // 获取该玻璃是否被禁用
            int glassdisabled = spianMapper.SelectCageGlassState(outglassid);
            // 未禁用下发任务
            if (glassdisabled == 0) {
              spianService.selectout2(outglassid);
              Plchome.isQueueWarning = false;
            } else { // 禁用更改状态弹出提示
              Plchome.isQueueWarning = true;
            }
      if (OutActivate.equals("1") == false&&CarRequest.equals("0")==true) {
        S7control.getinstance().WriteWord("DB105.18", (short)1);// 将大车的状态改为运输中
          }
        }
     
      }
      ///////////// 进片任务