springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java
@@ -75,10 +75,11 @@ // System.out.println(jsonFilePath); //readAndUpdateWordValues(PlcReadObject); List<Short> ss=S7control.getinstance().ReadWord("DB14.0", 1); readAndUpdateWordValues(PlcMesObject); //readAndUpdateWordValues(PlcframeObject); // readAndUpdateWordValues(PlcframeObject); // readAndUpdateWordValues(plcStateObject); int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex(); // System.out.println(index); springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
@@ -25,14 +25,15 @@ // \\ TODO Auto-generated catch block e.printStackTrace(); } //S7control.getinstance().ReadWord("DB14.0", 1); // if (S7control.getinstance().CheckConnected() == false) { spianService = WebSocketServer.applicationContext.getBean(SpianServiceNew.class); albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class); // spianService.selectAll(albaniaMapper.SelectGlass()); spianService.selectAll(albaniaMapper.SelectGlass()); //读取DB14区文件 PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; String ExportTOMES1=plcmes.getPlcParameter("ExportTOMES1").getValue();//出片请求一线 String ExportToMES2=plcmes.getPlcParameter("ExportToMES2").getValue();//出片请求二线 @@ -69,8 +70,10 @@ for(int i=1;i<7;i++){ String Glassid=plcmes.getPlcParameter("MESID"+i).getValue();//依次获取任务ID int tastid=albaniaMapper.SelectTaskId(Glassid.substring(0,14)); storageCageService.FinishTask(tastid); //调用完成任务 Glassid storageCageService.FinishTask(tastid); //删除queue表的数据 albaniaMapper.DeleteQueue(Glassid.substring(0,14)); S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 1);//完成确认字 } springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -16,12 +16,12 @@ // TODO Auto-generated method stub // System.out.println("启动完成"); // new PLCAutoMes().start(); //new PLCAutoMes().start(); // new PlcHold().start(); // new PlcHoldNew().start(); new PlcHoldNew().start(); new Plchome().start(); // new Plchome().start(); // new PlcLayout().start(); // new Plcalarm().start(); // new Plcsign().start(); springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java
@@ -1,4 +1,5 @@ package com.example.springboot.mapper; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; @@ -11,10 +12,10 @@ @Repository public interface AlbaniaMapper { //判断笼内是否有合适的类型空格 @Select("select id from storage_cage where glasstype=#{glasstype} and width>=#{width}+#{widths} and state=0 order by id limit 1") @Select("select id from storage_cage where glasstype=#{glasstype} and width>=#{width}+#{widths} and state=0 and disabled=0 order by id limit 1") int SelectCage(int glasstype,Double width,int widths); //判断笼内没有玻璃的空格 @Select("select id from storage_cage where number=0 and cage>#{cage} and cage<#{cage2} order by id limit 1") @Select("select id from storage_cage where number=0 and cage>#{cage} and cage<#{cage2} and disabled=0 order by id limit 1") int SelectNewCell(int cage,int cage2); //增加玻璃数 @Update("update storage_cage set number=number+1,width=width-glasswidth where id=#{id}") @@ -29,7 +30,7 @@ @Update("UPDATE `albania`.`storage_cage` SET `glass_id` =#{glassid}, `width` =width-#{glasswidth}, `glasswidth` =#{glasswidth}, `glassheight` =#{glassheight}, `glasswidthmm` =#{glasswidthmm}, `glassheightmm` = #{glassheightmm}, `state` = #{state}, `glasstype` = #{glasstype}, `number` = #{number} WHERE `id` =#{id};") void AddCage(int id,String glassid,Double glasswidth,Double glassheight,Double glasswidthmm,Double glassheightmm,int state,int glasstype,int number); //获取进片数据 @Select("select glassid,flowcard,glasswidth as width,glassheight as height,glasswidthmm,glassheightmm,glasstype from queue where state=0 limit 1") @Select("select glassid,flowcard,glasswidth as width,glassheight as height,glasswidthmm,glassheightmm,glasstype from queue where state=1 limit 1") GlassInfo SelectGlass(); //一号线查询任务 @Select("select * from v_cagerelease1 where mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid);") @@ -46,7 +47,13 @@ //发送出片后增加已发数量 @Update("update glassinfo set finishnumber=finishnumber+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{tier};") void AddFinishNumber(String flowcard,int mateid,int tier); //获取当前任务的id @Select("select id from storage_task where state=0 glassid=#{glassid} LIMIT 1") int SelectTaskId(String glassid); //删除测量表的信息 @Delete("delete from queue where glassid=#{glassid}") int DeleteQueue(String glassid); } springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java
@@ -21,6 +21,10 @@ //读取DB105区文件 private PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; public Short selectAll(GlassInfo glassInfo) { if(glassInfo==null){ //有进片请求但是测量台没有玻璃 return 400; } //定义初始字段 int cageid; String glassid=glassInfo.getGlassid();