ZengTao
2024-04-10 557aaaac3832a634b7ecec55a5327dfb9f8c7dff
springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java
@@ -28,7 +28,7 @@
    StorageCage cage;
    String glassid=glassInfo.getGlassid();
    Double width=glassInfo.getWidth();
    //int mateid=glassInfo.getMateid();
    Double height=glassInfo.getHeight();
    String flowcard=glassInfo.getFlowcard();
    int glasstype=glassInfo.getGlasstype();
    //判断是否有同类型的
@@ -37,8 +37,7 @@
    //如果有同类型时直接增加
    if(cage!=null){
        //发送plc任务
        Mestast(glassid, 40, cage.getId(), 1,"MESID1",1);
        //任务发送字
        Mestast(glassid, 1001, cage.getId(), 1,"MESID1",1);
        
    }else{ 
         //判断玻璃是否进入大片笼
@@ -46,14 +45,13 @@
            cage=albaniaMapper.SelectNewCell(3,5);
        }else{
            cage=albaniaMapper.SelectNewCell(0,5);
            //发送plc任务
        }
        //当返回的格子号为空时,返回400笼子已满
        if(cage!=null){
            albaniaMapper.AddCage(cage.getId(), glassid, cage.getGlassWidth(), cage.getGlassHeight(), cage.getGlassWidthMm(), cage.getGlassHeightMm(), 1, cage.getGlasstype(), 0);
            albaniaMapper.AddCage(cage.getId(), glassid,width, height, 1, cage.getGlasstype(), 0);
            Mestast(glassid,1001,cage.getId(),1,"MESID1",1);
            //发送plc任务
            albaniaMapper.UpdateStorage(width,height,cage.getId());
            albaniaMapper.UpdateQueueState(glassid);
        }else{
            return(400);
        }
@@ -85,19 +83,18 @@
                    return (400);
                }else{
                    
                    glass= albaniaMapper.SelectCageGlass(glassmate.getGlasstype());
                  if(glass!=null){
                glass= albaniaMapper.SelectCageGlass(glassmate.getGlasstype());
                  if(glass!=null){
                    //发送任务之前判断车上的剩余宽度是否大于此玻璃
                    width+=glassmate.getWidth()+50;
                    width=width+glassmate.getWidth()+50;
                    //大于车上空余宽度时提前发送出片启动
                    if(width>5000){
                        //本次配片完成发送启动命令
                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)1);//出片任务启动
                        return (200);//结束
                      }
                    //发送配片数据
                    Mestast(glass.getGlassId(), glass.getId(),7, 0,"MESID"+i,i);
                    Mestast(glass.getGlassId(), glass.getId(),40, 0,"MESID"+i,i);
                    albaniaMapper.AddFinishNumber(glassmate.getFlowcard(), glassmate.getMateid(), glassmate.getTier());
                    albaniaMapper.Inserttask(1, 0, glass.getId(), 2002, glassmate.getGlassid(), glassmate.getGlasstype(),glass.getFlowcard(),glassmate.getMateid(),glassmate.getTier());
                      if(glassmate.getTier()==glassmate.getId()){//当配片数量等于成品小片总片数时
@@ -131,9 +128,6 @@
        System.out.println("outmesidbytes:" + bytes.length);
        System.out.println(plcmes.getPlcParameter(address).getAddress());
        System.out.println();
        //S7control.getinstance().WriteByte(plcmes.getPlcParameter(address).getAddress(),bytes);
        //S7control.getinstance().WriteByte(address, bytes);// 派发出片id
    }