严智鑫
2024-04-09 e7110f57152cc0428dfa18ea34a924b06b2d89b3
Merge branch 'master' of http://10.153.19.25:10101/r/Albania_Mes

# Conflicts:
# Albania_Mes-ui/src/views/home/index.vue
9个文件已修改
123 ■■■■ 已修改文件
Albania_Mes-ui/src/api/home.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java 4 ●●●● 补丁 | 查看 | 原始文档 | 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 15 ●●●●● 补丁 | 查看 | 原始文档 | 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 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/api/home.js
@@ -326,9 +326,9 @@
    })
}
export function ClaimTasks(flowcard,state) {
export function ClaimTasks(flowcard,state,line) {
    return request({
        url: '/home/ClaimTasks?flowcard='+flowcard+'&state='+state,
        url: '/home/ClaimTasks?flowcard='+flowcard+'&state='+state+'&line='+line,
        method: 'post',
        data:""
    })
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/Plcalarm.java
@@ -28,7 +28,7 @@
    FileInputStream fileInputStream;
    try {
      // 从文件中读取字节数据存入 fileInputStream
      fileInputStream = new FileInputStream("D:/canadames/Alarm.json");
      fileInputStream = new FileInputStream("D:/Albania_Mes/Alarm.json");
      // 读取 fileInputStream 中字节并将其解码为字符
      InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
      // 提高读取效率,在 BufferedReader 内包装 InputStreamReader
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/controller/HomeController.java
@@ -479,8 +479,8 @@
  
  //领取/暂停任务
  @PostMapping("/ClaimTasks")
  public Result ClaimTasks(String flowcard,Integer state) {
    return storageCageService.ClaimTasks(flowcard,state);
  public Result ClaimTasks(String flowcard,Integer state, Integer line) {
    return storageCageService.ClaimTasks(flowcard,state,line);
  }
  
  //修改出片方式
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
@@ -238,7 +238,7 @@
  List<StorageCage> SelectStorageCageInfo();
  // 删除格子内玻璃信息
  @Update("update storage_cage set width=5000,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,thickness=null,glasstype=null,number=null where cell=#{cell}")
  @Update("update storage_cage set films=null,width=5000,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,thickness=null,glasstype=null,number=null where cell=#{cell}")
  void DeleteStroageCageByCell(Integer cell);
  // 修改格子玻璃数量
@@ -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);
  // 根据任务类型获取任务
@@ -277,14 +277,14 @@
  @Select("select gi.*,sum(sc.number) as cageno from glassinfo gi left join storage_cage sc on gi.glasstype=sc.glasstype where gi.flowcard=#{flowcard} group by gi.id order by gi.mateid,gi.tier")
  List<GlassInfo> SelectOrderView(String flowcard);
  @Update("update flowcard set state=#{state} where flowcard=#{flowcard}")
  void ClaimTasks(String flowcard, int state);
  @Update("update flowcard set state=#{state},line=#{line} where flowcard=#{flowcard}")
  void ClaimTasks(String flowcard, int state, int line);
  @Update("update flowcard set method=#{method} where flowcard=#{flowcard}")
  void ModeChange(String flowcard, int method);
  @Update("update queue set flowcard=#{flowcard},glasswidth=#{width},glassheight=#{height},glasstype=#{glasstype},state=1 where state<=0")
  void UpdateQueue(String flowcard, double width, double height, Integer glasstype);
  @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/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) {
@@ -291,11 +292,11 @@
    }
    // 开始任务
    public Result ClaimTasks(String flowcard, Integer state) {
    public Result ClaimTasks(String flowcard, Integer state, Integer line) {
        if (state == 1) {
            homeMapper.ClaimTasks(flowcard, 0);
            homeMapper.ClaimTasks(flowcard, 0,line);
        } else {
            homeMapper.ClaimTasks(flowcard, 1);
            homeMapper.ClaimTasks(flowcard, 1,line);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
@@ -317,7 +318,7 @@
    // 修改测量信息
    public Result UpdateQueue(GlassInfo glassInfo) {
        homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
                glassInfo.getGlasstype());
                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);