wu
2024-11-12 ca1ae93196be366e707647c42e3039512a2cf45f
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
@@ -17,7 +17,7 @@
  private StorageCageService storageCageService;
  int aaa;
  String huibao = "";
  String qidong = "";
  @Override
  public void run() {
@@ -32,7 +32,8 @@
      storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
      spianService = WebSocketServer.applicationContext.getBean(SpianServiceNew.class);
      albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class);
      spianService.selectout(1);
      // spianService.selectout(1);
      // spianService.mateOut();
      // 读取DB14区文件
      PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
      if (plcmes.getPlcParameter("PLCToMES").getValue() != null) {
@@ -42,11 +43,16 @@
        String IDStatus1 = plcmes.getPlcParameter("IDStatus1").getValue();// 1号任务完成
        String MESToPLCStatus1 = plcmes.getPlcParameter("MESToPLCStatus1").getValue();// 1号确认字
        String MESToPLC = plcmes.getPlcParameter("MESToPLC").getValue();// 发送任务字
        int taskcont = albaniaMapper.SelectTaskcount(); // 正在进行的任务数量
        int outtask = albaniaMapper.SelectOutTaskCount(); // 等待补发的出片任务数量
        if(outtask>0){
          spianService.mateOut();
        if (ExportTOMES1 != null && MESToPLC != null && taskcont == 0) {
          //当可以发任务并且出片队列有任务时
          if (ExportTOMES1.equals("1") == true && MESToPLC.equals("0") == true && PLCToMES.equals("1") == true&&outtask>0 && MESToPLCStatus1.equals("0")) {
             spianService.mateOut();
          }
        }
        // String scan=plcmes.getPlcParameter("scan").getValue();//发送扫码信息
        // if(scan.equals("1")==true){
        // spianService.scan(scan);
@@ -57,12 +63,22 @@
          System.out.println("汇报记录:" + IDStatus1 + "时间" + currentTime);
        }
        huibao = IDStatus1;
        if (!qidong.equals(MESToPLC)) {
          System.out.println("启动记录:" + MESToPLC + "时间" + currentTime);
        }
        qidong = MESToPLC;
        PLCToMES = plcmes.getPlcParameter("PLCToMES").getValue();// 运送车请求
        IDStatus1 = plcmes.getPlcParameter("IDStatus1").getValue();// 1号任务完成
        MESToPLCStatus1 = plcmes.getPlcParameter("MESToPLCStatus1").getValue();// 1号确认字
        MESToPLC = plcmes.getPlcParameter("MESToPLC").getValue();// 发送任务字
        // 一号线请求
        if (ExportTOMES1 != null && MESToPLC != null && taskcont == 0) {
          if (ExportTOMES1.equals("1") == true && MESToPLC.equals("0") == true && PLCToMES.equals("1") == true
              && MESToPLCStatus1.equals("0") == true) {
            System.out
                .println("出片状态:MESToPLC:" + MESToPLC + "PLCToMES:" + PLCToMES + "MESToPLCStatus1:" + MESToPLCStatus1);
              && MESToPLCStatus1.equals("0") == true&&outtask == 0) {
            // System.out
            //     .println("出片状态:MESToPLC:" + MESToPLC + "PLCToMES:" + PLCToMES + "MESToPLCStatus1:" + MESToPLCStatus1);
            spianService.selectout(1);
            try {
              Thread.sleep(200); // 每100毫秒检查一次
@@ -79,14 +95,14 @@
        // 运送车请求和测量完成请求
        GlassInfo glass = albaniaMapper.SelectGlass();
        if (PLCToMES != null && glass != null && MESToPLC != null && taskcont == 0) {
          if (PLCToMES.equals("1") == true && MESToPLC.equals("0") == true && MESToPLCStatus1.equals("0") == true) {
          if (PLCToMES.equals("1") == true && MESToPLC.equals("0") == true && MESToPLCStatus1.equals("0") == true&&outtask == 0) {
            try {
              Thread.sleep(100); // 每100毫秒检查一次
            } catch (InterruptedException e) {
              Thread.currentThread().interrupt(); // 处理线程中断
            }
            System.out
                .println("进片状态:MESToPLC:" + MESToPLC + "PLCToMES:" + PLCToMES + "MESToPLCStatus1:" + MESToPLCStatus1);
            // System.out
            //     .println("进片状态:MESToPLC:" + MESToPLC + "PLCToMES:" + PLCToMES + "MESToPLCStatus1:" + MESToPLCStatus1);
            spianService.selectAll(glass);
          }
        }