wu
2023-09-18 9ecf9412567ad052ec304d99be8810a8badebb98
新增笼子表状态判断
5个文件已修改
100 ■■■■ 已修改文件
CanadaMes-ui/src/views/home/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/home/index.vue
@@ -265,6 +265,7 @@
                        :style="{ height: 35 * item['glassWidth'] + 'px', top: item['width'] * 35 - 35 + 'px', left: 3.07 * index + Math.abs(item['cage'] - 5) * 6.8 + 'px' }"
                        @click="showcageinfo(item['cage'])"></div>
                </div>
                <div class="blue gezi" :style="{display:flex,position: absolute,float:left,top: 105 +'px',left: 1050 +'px',height: loadglassheight+'px',width: 5+'px'}"></div>
                <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
                <div class="blocks-img" :style="{ left: car2 + 'px', top: '175px' }"></div>
                <div class="blocks-img2"></div>
@@ -409,7 +410,8 @@
            // car2: 300,
            cageinfo: [],
            cage: 0,
            carlist: []
            carlist: [],
            loadglassheight:0
        };
    },
    created() {
@@ -455,7 +457,7 @@
                    this.tasklist1 = obj.tasklist1[0];
                    this.tasklist2 = obj.tasklist2[0];
                    this.alarm = obj.alarmmg[0];
                    this.loadglassheight=obj.loadglassheight;
                    SelectCageInfo(this.cage).then(res => {
                        this.cageinfo = res.data.cageinfo;
                    });
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.ibatis.javassist.compiler.ast.Symbol;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.service.JdbcConnections;
@@ -23,7 +24,8 @@
  @Override
  public void run() {
    boolean inglassbegin=false;
    boolean outglassbegin=false;
    while (this != null) {
      try {
@@ -38,6 +40,7 @@
      // 根据玻璃id获取订单号,单独数据源
      // try {
      //   Glass glass = jdbcConnections.selectGlass(112);
      //   // System.out.println(glass.getOrderId());
@@ -51,8 +54,8 @@
      List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 获取进片车状态
      List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.12", 1);// 获取进片车任务是否启动
        
      if (datas1List != null && datas1ListState != null) {
        // 获取prc进片请求数据
        boolean exist = datas1List.contains((short) 1);
        // 获取进片车状态
@@ -62,11 +65,29 @@
       
        String glassid="";
        StringBuilder strId=new StringBuilder();
         StringBuilder writedstrId=new StringBuilder();
       if(!inglassbegin&!exist1)
       {
         inglassbegin=true;
       }
       if(inglassbegin&exist1)
       {
        inglassbegin=false;
        spianMapper.UpdataAddCageState(1,2);
       }
        // 进片请求为1时
        if (exist == true) {
          // 当进片车空闲时
          if (exist1 == true) {
            //获取已下发的进片id 与plc请求的id作比较
              byte[] writedglassidbytes = S7control.getinstance().ReadByte("DB105.16", 1);
            if (writedglassidbytes != null) {
              // 获取玻璃id
              for (byte iditem : writedglassidbytes) {
                writedstrId.append(iditem);
              }
            }
            // 获取进片id
            byte[] datas1ListID = S7control.getinstance().ReadByte("DB106.26", 1);
            if (datas1ListID != null) {
@@ -75,9 +96,13 @@
                strId.append(list1);
                
              }
              spianService.selectAll(strId.toString());
              if(!writedstrId.toString().equals(strId.toString())) //已经下发的id与plc请求的id不一样时,认为不是重复的任务,才执行下发任务指令
              {
                 spianService.selectAll(strId.toString());
                  S7control.getinstance().WriteByte("DB105.16",datas1ListID);//派发进片id
              }
              //spianService.selectAll(Short.parseShort(strId.toString()));
              S7control.getinstance().WriteByte("DB105.16",datas1ListID);//派发进片id
            }
          }
@@ -95,6 +120,15 @@
      
      List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态
      List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.14", 1); // 出片任务是否启动
      StringBuilder writedstrIdOut=new StringBuilder();
       //获取已下发的出片id
              byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 1);
            if (writedglassidbytesOut != null) {
              // 获取玻璃id
              for (byte iditem : writedglassidbytesOut) {
                writedstrIdOut.append(iditem);
              }
            }
      boolean outstate=false;//出片车空闲判断
      boolean outstate1=false;//出片车任务是否启动
       if (outlist != null&&outlist1!=null) {
@@ -104,8 +138,18 @@
         
          Glass glass=spianMapper.SelectDBOut();//判断是否有调拨后的出片任务未完成
         if(outstate== true ){
          if(glass.getId()==2){
          if(!outglassbegin&!outstate)//当任务还未开始,且出片车不空闲时,任务状态改为开始
       {
         outglassbegin=true;
       }
       if(outglassbegin&outstate)//当任务开始且出片车空闲时
       {
        outglassbegin=false;
        spianMapper.UpdataAddCageState(0,3);
       }
         if(outstate== true &glass.getGlassId()!=null){ //当出片车空闲且有出片任务待完成时
          if(glass.getId()==2&!writedstrIdOut.toString().equals(glass.getGlassId().toString())){
           spianService.selectout2(glass.getGlassId().toString());
            }
        } 
@@ -120,8 +164,10 @@
 
     
        if (outstate == true) { // 出片车状态空闲时
            Integer state=spianMapper.Selectoutstate();
            String orderid = spianMapper.SelectOrderout();
            if (orderid != null) {
            if (orderid != null &&state==0) {
              spianService.selectout(orderid);
            }      
        }
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -61,6 +61,10 @@
            if(paramlist!=null){
            jsonObject.append("params", paramlist);
            }
           List<Short> inglassInfo =  S7control.getinstance().ReadWord("DB106.24",1);
           if(inglassInfo!=null&inglassInfo.size()>0){
            jsonObject.append("loadglassheight", inglassInfo.get(0)*70);
            }
            // jsonObject.append("params", new short[] { 30, 40, });
            WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Home");
            if (sendwServer != null) {
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
@@ -65,6 +65,9 @@
    //修改同笼子格子宽度
     @Update("update storage_cage set width=width-#{width} where   cage=#{cage} and cell=#{cell};")
    void UpdataAddCage1(double width,int cage,int cell);
    //修改同笼子格子宽度
     @Update("update storage_cage set state=#{state} where   state=#{oldstate};")
    void UpdataAddCageState(int state,int oldstate);
    //修改同笼子格子宽度(出片)
     @Update("update storage_cage set width=width+#{width} where   cage=#{cage} and cell=#{cell};")
    void UpdataOutCage1(double width,int cage,int cell);
@@ -97,5 +100,8 @@
    //根据笼子格子层数获取玻璃id
     @Select("select glass_id from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;")
     String SelectGlassid(int cage,int cell);
     //根据笼子格子层数获取玻璃id
     @Select("SELECT COUNT(*) FROM `storage_cage` where state=3;")
     Integer Selectoutstate();
}
    
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
@@ -59,7 +59,7 @@
            datas.add((short) 1);
               
            spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度
            spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//清除格子玻璃信息
            spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//清除格子玻璃信息
            spianMapper.Inserttask(1, 0,cageout.getId(),1000,orderid);//新增任务         
            S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务
            outmesid(glassid);//派发出片ID
@@ -69,14 +69,14 @@
            int state = spianMapper.selectGlassState(cage, cell);
            // 判断内片是否需要调拨
            if (state == 0) {
                spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);
                //spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);
                datas.add((short) prcid);
                datas.add((short) 1000);
                datas.add((short) 1);
                datas.add((short) 1);
                spianMapper.Inserttask(1, 0,cageout.getId(),1000,orderid);//新增任务
                spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度
                spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//清除格子玻璃信息
                spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//清除格子玻璃信息
                S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务
                outmesid(glassid);//派发出片ID
                //spianMapper.Updatetask(1, 1);//完成任务
@@ -105,7 +105,7 @@
                   spianMapper.UpdateDBCage(ids, cage, cell);// 将原格子数据更新到新格子里
                   spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度
                   spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度
                   spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 清除被调拨格子数据
                   spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 清除被调拨格子数据
                   spianMapper.Inserttask(2, 0,cageout.getId(),ids,orderid);//新增调度任务
                    // 传输mes数据,坐标,数据
                        S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务
@@ -133,7 +133,7 @@
                    spianMapper.Inserttask(2, 0,cageout.getId(),ids,orderid);//新增调度任务
                    spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度
                    spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度
                    spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 清除被调拨格子数据
                    spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 清除被调拨格子数据
                    // 传输mes数据,坐标,数据
                        S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务    
                        
@@ -210,7 +210,7 @@
                    datas.add((short) prctier);
                    datas.add((short) 1);
                    // 数据库修改笼子表新增一条玻璃
                    spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 1);
                    spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 2);
                    spianMapper.UpdataAddCage1(widths, cage1, cells);//减少格子宽度
                    spianMapper.Inserttask(0, 0, 1000, ids,glassid.toString());//新增任务  
                    S7control.getinstance().WriteWord(adddresslist, datas);
@@ -264,7 +264,7 @@
            datas.add((short) 1);
               
            spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度
            spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//清除格子玻璃信息
            spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//清除格子玻璃信息
            spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//新增任务
            //int state = spianMapper.selectGlassState(cage, cell);//获取格子数量
            if(state==2){
@@ -281,14 +281,14 @@
            int state = spianMapper.selectGlassState(cage, cell);
            // 判断内片是否需要调拨
            if (state == 0) {
                spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);
                //spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);
                datas.add((short) prcid);
                datas.add((short) 1000);
                datas.add((short) 1);
                datas.add((short) 1);
                spianMapper.Inserttask(1, 0,cageout.getId(),1000 ,glassid);//新增任务
                spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度
                spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//清除格子玻璃信息
                spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);//清除格子玻璃信息
                outmesid(glassid);//派发出片ID
                S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务
                
@@ -319,7 +319,7 @@
                   spianMapper.UpdateDBCage(ids, cage, cell);// 将原格子数据更新到新格子里
                   spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度
                   spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度
                   spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 清除被调拨格子数据
                   spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 清除被调拨格子数据
                   spianMapper.Inserttask(2, 0,cageout.getId(),ids,glassid);//新增调度任务
                   spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//新增出片任务
                    // 传输mes数据,坐标,数据
@@ -349,7 +349,7 @@
                    spianMapper.UpdateDBCage(ids, cage, cell);// 将原格子数据更新到新格子里
                    spianMapper.UpdataAddCage1(glasswidth, cages, cells);//减少新格子宽度
                    spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度
                    spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 0);// 清除被调拨格子数据
                    spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, 2, 3);// 清除被调拨格子数据
                    // 传输mes数据,坐标,数据
                        S7control.getinstance().WriteWord(adddresslist, datas);//派发出片车任务