ZengTao
2024-04-09 ced0655bb9f83906eb9986462c9641c15baa5918
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
@@ -4,13 +4,12 @@
import com.example.springboot.service.StorageCageService;
import com.example.springboot.entity.GlassInfo;
import com.example.springboot.entity.device.PlcParameterObject;
import com.example.springboot.mapper.AlarmMapper;
import com.example.springboot.mapper.AlbaniaMapper;
public class PlcHoldNew extends Thread {
  private AlarmMapper alarmMapper;
  @Autowired
  private AlbaniaMapper albaniaMapper;
@@ -24,7 +23,7 @@
    while (this != null) {
      try {
        Thread.sleep(100);
        Thread.sleep(500);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
@@ -38,8 +37,8 @@
      PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
      if(plcmes.getPlcParameter("PLCToMES").getValue()!=null){
        
      // spianService.Mestast("NG0001-1",0,3,1,"MESID1",1);
      //  S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)1);//出片任务启动
      //spianService.Mestast("NG0001-1",1,4,1,"MESID1",1);
       
    
      String ExportTOMES1=plcmes.getPlcParameter("ExportTOMES1").getValue();//出片请求一线
@@ -47,26 +46,27 @@
      String PLCToMES=plcmes.getPlcParameter("PLCToMES").getValue();//运送车请求
      String IDStatus1=plcmes.getPlcParameter("IDStatus1").getValue();//1号任务完成
      String MESToPLCStatus1=plcmes.getPlcParameter("MESToPLCStatus1").getValue();//1号确认字
      String MESToPLC=plcmes.getPlcParameter("MESToPLC").getValue();//发送任务字
      
      //一号线请求
      if(ExportTOMES1!=null){
      if (ExportTOMES1.equals("1") == true&&PLCToMES.equals("1")==true) {
      if(ExportTOMES1!=null&&MESToPLC!=null){
      if (ExportTOMES1.equals("1") == true&&MESToPLC.equals("0")==true) {
        //将运输车状态改为忙碌
        spianService.selectout(1);
      }
    }
      // //二线号请求时
      if(ExportToMES2!=null ){
      if (ExportToMES2.equals("1") == true&&PLCToMES.equals("1")==true) {
      if(ExportToMES2!=null &&MESToPLC!=null){
      if (ExportToMES2.equals("1") == true&&MESToPLC.equals("0")==true) {
        //将运输车状态改为忙碌
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
        spianService.selectout(2);
      }
    }
      //进片请求时
      GlassInfo glass=albaniaMapper.SelectGlass();
      if(PLCToMES!=null && glass!=null){
      if(PLCToMES.equals("1")==true&&glass!=null){
      if(PLCToMES!=null && glass!=null&&MESToPLC!=null){
      if(PLCToMES.equals("1")==true&&MESToPLC.equals("0")==true){
        spianService.selectAll(glass);
      }
    }
@@ -79,18 +79,14 @@
          
          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//PLC理片任务状态汇报
          String Glassid=plcmes.getPlcParameter("MESID"+i).getValueString();//MES玻璃ID
          GlassInfo id=albaniaMapper.SelectTaskId(Glassid);
            if(id!=null&&Tastover.equals("1")){
              //调用完成任务 Glassid
              storageCageService.FinishTask(id.getId());
            }    
              S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) 0);//清除任务字
              S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 1);//完成确认字
            }
              S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) 0);//清除任务发送字
          }