UnLoadGlassModule/src/main/java/com/mes/common/PlcTools/S7control.java
@@ -427,6 +427,11 @@ } }; public void writeString(String addr,String data) { s7PLC.writeString(addr,data); } UnLoadGlassModule/src/main/java/com/mes/entity/DownStorageCageDetails.java
File was deleted UnLoadGlassModule/src/main/java/com/mes/entity/EdgStorageCageDetails.java
New file @@ -0,0 +1,30 @@ package com.mes.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data //lombok 简写java代码 实体类的get与set @TableName("`edg_storage_cage_details`") public class EdgStorageCageDetails { @TableId(type = IdType.AUTO) private Integer id;//磨边前理片笼详情表id private Integer deviceid;//设备id private Integer slot;//栅格号 private Integer glassid;//玻璃id private Integer sequence;//小片在格内的顺序 private String flowcardid;//流程卡号 private Integer glasstype;//玻璃类型 private Double width;//宽 private Double height;//高 private Double thickness;//厚度 private Double edgwidth;//磨前宽 private Double edgheight;//磨前高 private Integer temperinglayoutid;//钢化版图id private Integer temperingfeedsequence;//钢化版图片序 private Integer patternsequence;//原片顺序 private Integer state;//状态 private Integer gap;//玻璃间隙 } UnLoadGlassModule/src/main/java/com/mes/entity/GlassInfo.java
New file @@ -0,0 +1,34 @@ package com.mes.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.math.BigInteger; @Data //lombok 简写java代码 实体类的get与set @TableName("`glass_info`") public class GlassInfo { @TableId(type = IdType.AUTO) private BigInteger id;//玻璃信息表id private String flowcardid;//流程卡 private Integer glasstype;//流程卡玻璃类型 private Double width;//宽 private Double height;//高 private Double thickness;//厚度 private Integer filmsid;//膜系 private Double edgwidth;//磨前宽 private Double edgheight;//磨前高 private Integer ismultiple;//是否配片 private Double maxwidth;//配片最大宽 private Double maxheight;//配片最大高 private Integer ishorizontal;//钢化是否接受横放 private Integer patternsequence;//原片顺序 private Integer temperinglayoutid;//钢化版图id private Integer temperingfeedsequence;//钢化版图片序 private Integer xcoordinate;//x坐标 private Integer ycoordinate;//y坐标 private Integer angle;//旋转角度(逆时针) } UnLoadGlassModule/src/main/java/com/mes/entity/TaskCache.java
New file @@ -0,0 +1,22 @@ package com.mes.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; @Data //lombok 简写java代码 实体类的get与set public class TaskCache { @TableId(type = IdType.AUTO) private int id;//id private String startCell;//起始 private String endCell;//结束 private String taskType;//类型 private double width;//宽 private double height;//搞 private String filmsId;//膜系 private double thickness;//厚度 private String flowCardId;//流程卡号 private int taskStatus;//状态 } UnLoadGlassModule/src/main/java/com/mes/entity/device/PlcParameterInfo.java
@@ -121,4 +121,8 @@ return addressIndex; } public String getAddress() { return getAddress(this.addressIndex); } } UnLoadGlassModule/src/main/java/com/mes/mapper/SelectInfo.java
New file @@ -0,0 +1,83 @@ package com.mes.mapper; import com.mes.entity.DownStorageCageDetails; import com.mes.entity.GlassInfo; import com.mes.entity.TaskCache; import org.apache.ibatis.annotations.*; import java.util.List; import java.util.Map; @Mapper public interface SelectInfo { // 玻璃信息 按ID查询 @Select("select * from `glass_info` where id=#{id}") GlassInfo SelectGlassId(String id); // 钢化按工程查询 // @Select("select * from `v_optimize_heat_layout` where project_no=#{projeceid} ") // List<Tempered> SelectTemperedTerritory(String projeceid); // // 切割版图按工程查询 @Select("select * from optimize_detail where project_no=#{projeceid} ") List<Map> SelectCutTerritory(String projeceid); // 查询磨边信息 @Select("select * from task_cache where task_type='2' and task_stauts='2' and end_cell=#{EndCell}") List<Map> SelectEdgInfo(String EndCell); // 查询笼子内空闲 @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is null order by escd.slot") List<DownStorageCageDetails> SelectCacheLeisure(); // 查询笼子内出片任务 @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot WHERE escd.slot IS NOT NULL order by escd.tempering_layout_id,escd.tempering_feed_sequence") List<DownStorageCageDetails> SelectCacheOut(); // 查询笼子内信息 @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot order by esc.slot") List<DownStorageCageDetails> SelectCachInfo(); // 查询可进此片玻璃的栅格号 @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is not null escd.tempering_layout_id=#{tempering_layout_id} and escd.tempering_feed_sequence<#{tempering_feed_sequence} and esc.remain_width-#{width}>0 order by escd.tempering_feed_sequence") List<DownStorageCageDetails> SelectIsExistIntoCache(Integer tempering_layout_id, Integer tempering_feed_sequence, double width); // 查询可进此片玻璃的栅格号 @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is not null escd.tempering_layout_id<#{tempering_layout_id} and esc.remain_width-#{width}>0 order by escd.tempering_layout_id desc,escd.tempering_feed_sequence") List<DownStorageCageDetails> SelectIsExistIntoCache(Integer tempering_layout_id, double width); // 查询全部任务 @Select("select * from down_glass_task") List<TaskCache> SelectCacheInfoAll(); // 查询进片任务 @Select("select * from down_glass_task where task_type='1' and task_stauts='0'") List<TaskCache> SelectInputCacheInfo(); // 查询出片任务 @Select("select * from down_glass_task where task_type='2' and task_stauts='0'") List<TaskCache> SelectOutCacheInfo(); // 查询 A04 或 A15 最新的一片 出片任务 @Select("select * from down_glass_task where task_type='2' and task_stauts='2' and end_cell=#{EndCell} limit 1") GlassInfo SelectLastOutCacheInfo(String EndCell); // 修改笼子内信息 @Update("update") Integer UpdateCache(@Param("id") Integer id, @Param("order_id") String order_id); // 添加下片任务 @Insert("INSERT into down_glass_task VALUES(#{id},#{start},#{end},#{type},0,)") Integer insertCacheTask(String id, String start, String end, String type,double width,double height,Integer filmsId,double thickness,String flowCardId); // // @Insert("INSERT `order`(order_id)VALUES(#{order_id})") // Integer insert(Order order); // // @Delete("delete from `order` where id=#{id}") // Integer deleteById(@Param("id") Integer id); // // @Update("update `order` set order_id=#{order_id} where id=#{id}") // Integer update(@Param("id") Integer id,@Param("order_id") String order_id); } UnLoadGlassModule/src/main/java/com/mes/service/DownGlassCacheLogic.java
New file @@ -0,0 +1,175 @@ package com.mes.service; import com.mes.common.PlcTools.S7control; import com.mes.entity.GlassInfo; import com.mes.entity.DownStorageCageDetails; import com.mes.entity.device.PlcParameterObject; import com.mes.mapper.SelectInfo; import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Data @Service public class DownGlassCacheLogic { @Autowired private SelectInfo selectInfo; //识别逻辑 不交互 public void identify(String Number){ //查询任务 PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); String s=S7control.getinstance().ReadWord("DB14.26", 1).get(0)+""; boolean isexist=isExist(Number); if (isexist) { //存在逻辑 1.添加信息 2.回复PLC存在 //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); }else { //不存在逻辑 1.回复PLC不存在 //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2); } } //下片前理片 public void Process(){ String Result=S7control.getinstance().ReadWord("DB14.0", 1).get(0)+""; String Number=S7control.getinstance().ReadWord("DB14.2", 1).get(0)+""; if(Result=="1"){//进片请求 processInto(Number); }else if(Result=="2"){//出片请求 processOut(); }else if(Result=="3"){//进出片请求 if (!processOut()) { //先出后进 processInto(Number); } } } //下片前理片 进 public boolean processInto(String Number){ //按id查询玻璃信息表里的玻璃 GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; if(GlassInfo!=null){//存在此玻璃编号 //同钢化版图内的栅格号 List<DownStorageCageDetails> list=selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperinglayoutid(),GlassInfo.getTemperingfeedsequence(),GlassInfo.getWidth()); //空栅格号 if (list.size()==0) { list=selectInfo.SelectCacheLeisure(); } //小于此玻璃钢化版图序号的栅格号 if(list.size()==0){ list=selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperinglayoutid(),GlassInfo.getWidth()); } if(list.size()>0){ //存在空格 //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) //2.回复 1进片 DownStorageCageDetails item=list.get(0); selectInfo.insertCacheTask(GlassInfo.getId()+"","0",item.getSlot()+"","1",GlassInfo.getWidth(),GlassInfo.getHeight(),GlassInfo.getFilmsid(),GlassInfo.getThickness(),GlassInfo.getFlowcardid()); S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); return true; } }else{ // ID编号不存在 不处理/回复PLC 进行报警提示 } //返回结果 return false; } //理片 出 public boolean processOut(){ //查询任务 String G04=S7control.getinstance().ReadWord("DB14.56", 1).get(0)+""; String G05=S7control.getinstance().ReadWord("DB14.58", 1).get(0)+""; PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; List<DownStorageCageDetails> list=selectInfo.SelectCacheOut(); boolean isOut=true;//其他情况条件 如:后续设备故障禁止理片出片 等 if (list.size()>0&&isOut) { DownStorageCageDetails item=list.get(0); if(G04=="0"&&G05=="1"){ //出到 G04 //selectInfo.insertCacheTask(item.getGlassId()+"","0","04","2"); selectInfo.insertCacheTask(item.getGlassId()+"","0","04","2",item.getWidth(),item.getHeight(),0,item.getThickness(),item.getFlowCardId()); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "1"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); return true; }else if(G04=="1"&&G05=="0"){ //出到 G05 //selectInfo.insertCacheTask(item.getGlassId()+"","0","05","2"); selectInfo.insertCacheTask(item.getGlassId()+"","0","05","2",item.getWidth(),item.getHeight(),0,item.getThickness(),item.getFlowCardId()); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "2"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); return true; }else if(G04=="0"&&G05=="0"){ //都允许 G04/G05 上一片是否和此片玻璃尺寸尺寸相同 String endcell="04"; String SendEndcell="1"; boolean If_=false; GlassInfo glassInfo04= selectInfo.SelectLastOutCacheInfo("04"); GlassInfo glassInfo05= selectInfo.SelectLastOutCacheInfo("05"); if(glassInfo05!=null&&glassInfo05.getWidth()==item.getWidth()&&glassInfo05.getHeight()==item.getHeight()){ endcell="05"; SendEndcell="2"; }else if(glassInfo05!=null&&If_){ //其他条件 } //selectInfo.insertCacheTask(item.getGlassId()+"","0",endcell,"2"); selectInfo.insertCacheTask(item.getGlassId()+"","0",endcell,"2",item.getWidth(),item.getHeight(),0,item.getThickness(),item.getFlowCardId()); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); return true; } } //返回结果 return false; } //磨边 不交互 理片和磨边机自己交互 public void processMb(String Number){ //按id查询玻璃信息表里的玻璃 GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; if(GlassInfo!=null){ //发送任务 ID 长 宽 厚 倒角 工艺功能等 S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.22").getAddress(),"N10000"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.24").getAddress(), "1000"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.26").getAddress(),"800"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(),"60"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.30").getAddress(), "2"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); } //返回结果 } //按id查询玻璃信息表里的玻璃 public boolean SelectMessageId(String Number){ //查询是否存在 GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); if(GlassInfo==null){ return false;//返回 不存在 } return true;//返回 存在 } //删除消息队列里此玻璃ID的数据 public boolean DeleteMessageId(String Number){ //查询是否存在 GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); if(GlassInfo==null){ return false;//返回 不存在 } return true;//返回 存在 } //是否存在此编号玻璃 public boolean isExist(String Number){ //查询是否存在 GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); if(GlassInfo==null){ return false;//返回 不存在 } return true;//返回 存在 } } UnLoadGlassModule/src/main/java/com/mes/service/DownGlassLogic.java
File was renamed from UnLoadGlassModule/src/main/java/com/mes/service/PlcService.java @@ -14,7 +14,7 @@ import java.util.List; @Data @Service public class PlcService { public class DownGlassLogic { @Autowired private DownWorkstationMapper downWorkstationMapper; UnLoadGlassModule/src/main/java/com/mes/service/Plchome.java
@@ -8,10 +8,10 @@ @Component public class Plchome extends Thread { private int i = 1; private final Supplier<PlcService> plcServiceSupplier; private final Supplier<DownGlassLogic> plcServiceSupplier; public Plchome() { this.plcServiceSupplier = () -> WebSocketServer.applicationContext.getBean(PlcService.class); this.plcServiceSupplier = () -> WebSocketServer.applicationContext.getBean(DownGlassLogic.class); } @@ -22,7 +22,7 @@ try { i++; Thread.sleep(100); PlcService plcService = plcServiceSupplier.get(); DownGlassLogic plcService = plcServiceSupplier.get(); // plcService.performPlcActions(); //plcService.unloadpush(); UnLoadGlassModule/target/MES-UnLoadGlassModule-0.0.1-SNAPSHOT.jar.originalBinary files differ
UnLoadGlassModule/target/maven-archiver/pom.properties
File was deleted UnLoadGlassModule/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
File was deleted UnLoadGlassModule/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
File was deleted UnLoadGlassModule/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
File was deleted UnLoadGlassModule/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
File was deleted UnLoadGlassModule/target/surefire-reports/TEST-com.mes.MesApplicationTests.xml
File was deleted UnLoadGlassModule/target/surefire-reports/com.mes.MesApplicationTests.txt
File was deleted