wu
2024-04-01 0321d9947724d726f4829a8f44f766c220917887
代码更新
8个文件已修改
129 ■■■■ 已修改文件
Albania_Mes-ui/src/views/home/index.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/views/home/index.vue
@@ -520,17 +520,16 @@
                <!--显示-->
                <div style="width:1000px;height: 720px;border: 2px solid #d1d1d1;float: left;">
                    <!--玻璃图  #81b337-->
                    <div :style="'top:10px;bottom: 10px;left: 10px;right: 10px;margin:'+((720-(this.LastQueue.glasswidth / 25 * 7))/2)+'px auto;width:'
                        + (this.LastQueue.glasswidth / 25 * 7) + 'px;height:'
                        + (this.LastQueue.glasswidth / 25 * 7) + 'px;height:'
                        + (this.LastQueue.glassheight / 25 * 7) + 'px;line-height: '
                        + (this.LastQueue.glassheight / 25 * 7) + 'px; background-color: '
                        + (this.LastQueue.state>0?'#4CCCE4':(this.LastQueue.state==0?'#E4CA4C':'#E4CA4C'))+';text-align: center;'">
                        {{ (this.LastQueue.glasswidth+this.LastQueue.glassheight)!=0?(this.LastQueue.glasswidth+"*"+this.LastQueue.glassheight):"" }}
                + (this.LastQueue.glasswidth / 25 * 7) + 'px;height:'
                + (this.LastQueue.glassheight / 25 * 7) + 'px;line-height: '
                + (this.LastQueue.glassheight / 25 * 7) + 'px;background-color: #93d2f3;text-align: center;'">
                        {{ this.LastQueue.glasswidth }}*{{ this.LastQueue.glassheight }}
                    <div :style="'top:10px;bottom: 10px;left: 10px;right: 10px;margin:'+((720-(this.LastQueue.glasswidth / 25 * 7))/2)+'px auto;'+
                        'width:'+ (this.LastQueue.glasswidth / 25 * 7) + 'px;'+
                        'height:'+ (this.LastQueue.glassheight / 25 * 7) + 'px;'+
                        'line-height: '+ (this.LastQueue.glassheight / 25 * 7) + 'px;'+
                        'background-color: '+ (this.LastQueue.state>0?'#4CCCE4':(this.LastQueue.state==0?'#E4CA4C':'#E4CA4C'))+
                        ';text-align: center;'">
                        {{ this.LastQueue.glasswidth!=null?(this.LastQueue.glasswidth+"*"+this.LastQueue.glassheight):"" }}
                    </div>
                </div>
@@ -548,7 +547,7 @@
                    <br>    
                    <span class="measuretitle">测量宽:</span> <span class="measureValue">{{ this.LastQueue.glassheightmm }}</span> <span class="measureUnit">mm</span>
                    <br>
                    <span class="measuretitle">匹配结果:</span> <span class="measureValue">{{ this.LastQueue.state>0?"匹配成功":(this.LastQueue.state==0?"匹配失败":"多数据匹配") }}</span>
                    <span class="measuretitle">匹配结果:</span> <span class="measureValue">{{ this.LastQueue.state>0?"匹配成功":(this.LastQueue.state==0?"多数据匹配":"匹配失败") }}</span>
                    <br>
                </div>
            </div>
@@ -1138,7 +1137,6 @@
            //let tbdata=JSON.stringify(this.dataList);
            let tbdata=this.dataList;
            console.log(tbdata);
            let tbdata = this.dataList;
            importData(tbdata).then(res => {
                if (res.data.message == 200) {
                    this.$message.success(this.$t('Operation successful'));
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,9 +23,8 @@
    while (this != null) {
      try {
        Thread.sleep(100);
        Thread.sleep(500);
      } catch (InterruptedException e) {
        // \\ TODO Auto-generated catch block
        e.printStackTrace();
      }
@@ -39,35 +37,36 @@
      PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
      if(plcmes.getPlcParameter("PLCToMES").getValue()!=null){
        
      // spianService.Mestast("1234567890123",40,0,2,"MESID1");
      // S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)2);//出片任务启动
      //spianService.Mestast("NG0001-1",1,4,1,"MESID1",1);
    
      String ExportTOMES1=plcmes.getPlcParameter("ExportTOMES1").getValue();//出片请求一线
      String ExportToMES2=plcmes.getPlcParameter("ExportToMES2").getValue();//出片请求二线
      String PLCToMES=plcmes.getPlcParameter("PLCToMES").getValue();//运送车请求
      //String B01State=plcmes.getPlcParameter("B01State").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);
      }
    }
@@ -80,22 +79,18 @@
          
          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//PLC理片任务状态汇报
          String Glassid=plcmes.getPlcParameter("MESID"+i).getValueString();//MES玻璃ID
          GlassInfo id=albaniaMapper.SelectTaskId(Glassid);
          if(Tastover.equals("1")){
            if(id!=null){
          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);//清除任务发送字
          }
          
        }
      }
      //汇报取消时
      if(IDStatus1.equals("0")==true &&MESToPLCStatus1.equals("1")){
        
@@ -103,10 +98,7 @@
        for(int i=1;i<7;i++){
          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//依次获取任务汇报
          if(Tastover.equals("0")){
            //S7control.getinstance().WriteWord(plcmes.getPlcParameter("IDStatus"+i).getAddress(), (short) 0);//清除确认字
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 0);//清除确认字
            // System.out.println(plcmes.getPlcParameter("MESToPLCStatus1").getValue());
            // System.out.println(S7control.getinstance().ReadWord("DB14.158", 1));
          }
        }
      }
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -127,11 +127,11 @@
                // String MesSend=S7control.getinstance().ReadWord("DB14.170", 1).get(0)+"";
                //获取测量的长,宽
                 boolean istest = false;
                 boolean istest = true;
                // String PlcRequest = "1";
                // String MesSend = "0";
                // double width = 402;
                // double height = 402;
                // double width = 516;
                // double height = 507;
                
                //匹配
                //System.err.println(PlcRequest+","+MesSend+","+width+","+height);
springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java
@@ -39,7 +39,7 @@
    @Select("select * from v_cagerelease2 where mateid not in(select mateid from v_cagerelease2 where surplus=0 group by mateid)LIMIT 1;")
    GlassInfo SelectOutGlass2();
    //流程卡任务查询
    @Select("select G.flowcard,G.glasstype,G.number,G.mateid,G.tier,G.starttime,G.finishnumber,IF((G.number-G.finishnumber-ku.KuCount)<0,G.number,ku.KuCount) as 'surplus',G.totaltier as id from (select Gfd.flowcard,Ggf.glasstype,Ggf.number,Ggf.mateid,Ggf.tier,Ggf.finishnumber,Gfd.starttime,Gfd.totaltier  from flowcard as Gfd LEFT JOIN glassinfo as Ggf on Gfd.flowcard=Ggf.flowcard where Gfd.state=1 and Gfd.line=#{line}) as G left join (select glasstype,sum(number) AS KuCount from storage_cage where flowcard is not null group by glasstype) as ku on G.glasstype=ku.glasstype where G.mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid)order by `g`.`starttime`,`g`.`mateid`,`g`.`finishnumber`,`g`.`tier`LIMIT 1;")
    @Select("select G.flowcard,G.glasstype,G.number,G.mateid,G.tier,G.starttime,G.finishnumber,IF((G.number-G.finishnumber-ku.KuCount)<0,G.number,ku.KuCount) as 'surplus',G.totaltier as id,G.width,G.glassid from (select Gfd.flowcard,Ggf.glasstype,Ggf.number,Ggf.mateid,Ggf.tier,Ggf.finishnumber,Gfd.starttime,Gfd.totaltier,Ggf.width,Ggf.glassid  from flowcard as Gfd LEFT JOIN glassinfo as Ggf on Gfd.flowcard=Ggf.flowcard where Gfd.state=1 and Gfd.line=#{line}) as G left join (select glasstype,sum(number) AS KuCount from storage_cage where flowcard is not null group by glasstype) as ku on G.glasstype=ku.glasstype where G.mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid)order by `g`.`starttime`,`g`.`mateid`,`g`.`finishnumber`,`g`.`tier`LIMIT 1;")
    GlassInfo SelectOutGlass(int line);
    //获取该类型在库存的位置
    @Select("select * from storage_cage where glasstype=#{glasstype} and number>0 limit 1")
@@ -57,9 +57,12 @@
    @Select("select method from flowcard where state=1 and line=#{line} ORDER BY starttime LIMIT 1;")
    GlassInfo SelectMethod(int line);
    //直出模式任务查询
    @Select("select b.flowcard,b.glasstype,b.mateid,a.totaltier as id from flowcard a  left join glassinfo b on a.flowcard=b.flowcard where a.line=#{line}")
    @Select("select b.flowcard,b.glasstype,b.mateid,a.totaltier as id,IFNULL(c.number,0)as number,b.glassid from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where a.line=#{line} and c.number>0")
    GlassInfo SelectOutGlass2(int line);
    @Select("update storage_cage a set a.glasswidth=#{width},a.glassheight=#{height} where id=#{id} ")
    void UpdateStorage(double width,double height,int id);
    @Update("update queue set state=2 where glassid=#{glassid};")
    void UpdateQueueState(String glassid);
}
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -246,7 +246,7 @@
  void updateStroageCageByCell(Integer cell, Integer num);
  // 计算格子内剩余宽度
  @Update("update storage_cage set width=5000-(glasswidth+100)*number where cell=#{cell}")
  @Update("update storage_cage set width=5000-if(glasswidth is null,0,glasswidth+50)*number where cell=#{cell}")
  void UpdateStroageCageWidthByCell(Integer cell);
  // 根据任务类型获取任务
@@ -283,8 +283,8 @@
  @Update("update flowcard set method=#{method} where flowcard=#{flowcard}")
  void ModeChange(String flowcard, int method);
  @Update("update queue set glassid=concat(#P{flowcard},'-',#{tier}),flowcard=#{flowcard},glasswidth=#{width},glassheight=#{height},glasstype=#{glasstype},thickness=#{thickness},state=1 where state<=0")
  void UpdateQueue(String flowcard, double width, double height, Integer glasstype, Double thickness);
  @Update("update queue set glassid=concat(#{flowcard},'-',#{tier}),flowcard=#{flowcard},glasswidth=#{width},glassheight=#{height},glasstype=#{glasstype},thickness=#{thickness},state=1 where state<=0")
  void UpdateQueue(String flowcard, double width, double height, Integer glasstype, Double thickness, Integer tier);
  @Update("update glassinfo set finishnumber=ifnull(finishnumber,0)+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{geTier}")
  void AddGlassNo(String flowcard, Integer mateid, Integer geTier);
@@ -316,4 +316,7 @@
  @Insert("INSERT INTO flowcard(`flowcard`, `totaltier`, `number`, `line`, `state`, `method`, `starttime`) "
                    +" select #{flowcard}, 0, #{number}, 0, 0, 0, now() where 0=( select count(*) from flowcard where flowcard=#{flowcard});")
  void InsertFlowcard(String flowcard, Integer number);
    @Select("Delete from queue where glassid=#{glassId}")
    void DeletequeueByGlassid(String glassId);
}
springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java
@@ -30,8 +30,8 @@
    // @Update("UPDATE role_permission SET state = #{state} WHERE role_id = #{roleId} AND permission_id = #{permissionId}")
    // void updateState(@Param("roleId") int roleId, @Param("permissionId") int permissionId, @Param("state") int state);
    @Insert("insert into queue (glassid,flowcard,listid,boxid,glasswidth,glassheight,glasswidthmm,glassheightmm,glasstype,state,time) "+
                        "select glassid,flowcard,null,null,width,height,#{glasswidthmm},#{glassheightmm},glasstype,#{state},NOW() from glassinfo where glassid=#{glassid}")
    @Insert("insert into queue (glassid,flowcard,listid,boxid,glasswidth,glassheight,glasswidthmm,glassheightmm,glasstype,state,time,thickness) "+
                        "select glassid,flowcard,null,null,width,height,#{glasswidthmm},#{glassheightmm},glasstype,#{state},NOW(),thickness from glassinfo where glassid=#{glassid}")
    void insert(@Param("glassid") String glassid, @Param("glasswidthmm") double glasswidthmm, @Param("glassheightmm") double glassheightmm,@Param("state") int state);
    
    @Insert("insert into queue (glassid,flowcard,listid,boxid,glasswidth,glassheight,glasswidthmm,glassheightmm,glasstype,state,time) "+
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, cage.getGlassWidthMm(), cage.getGlassHeightMm(), 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
    }
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -223,7 +223,7 @@
            homeMapper.DeleteStroageCageByCell(cell);
        } else {
            homeMapper.updateStroageCageByCell(cell, num);
            homeMapper.UpdateStroageCageWidthByCell(cell);
            homeMapper.UpdateStroageCageWidthByCell(cell);//修改笼子宽度
        }
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
@@ -250,6 +250,7 @@
        homeMapper.FinishTask(storageTask.getId());// 完成任务
        if (storageTask.getTaskType().equals("0")) {
            UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()), 1);// 玻璃数量+1
            homeMapper.DeletequeueByGlassid(storageTask.getGlassId());
        } else {
            StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getShelfRack());
            if (storageCage.getNumber() > 1) {
@@ -317,7 +318,7 @@
    // 修改测量信息
    public Result UpdateQueue(GlassInfo glassInfo) {
        homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
                glassInfo.getGlasstype(),glassInfo.getThickness());
                glassInfo.getGlasstype(),glassInfo.getThickness(),glassInfo.getTier());
        Map<String, Object> map = new HashMap<>();
        PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);