| | |
| | | import com.mes.common.PlcParameterObject; |
| | | import com.mes.upworkstation.entity.UpWorkstation; |
| | | import com.mes.upworkstation.mapper.LoadGlassMapper; |
| | | |
| | | import com.mes.common.S7object; |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Service |
| | | public class LoadGlassService { |
| | | |
| | | |
| | | private LoadGlassMapper LoadGlassMapper; |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | private LoadGlassMapper loadGlassMapper; |
| | | //PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | //显示工位上的玻璃信息 |
| | | public List<UpWorkstation> selectAll() { |
| | | List<UpWorkstation> glassInfo= LoadGlassMapper.selectALL(); |
| | | return glassInfo; |
| | | return loadGlassMapper.selectALL(); |
| | | } |
| | | //增加人工输入的工位玻璃信息 |
| | | public void insertGlass(UpWorkstation upwork) { |
| | | LoadGlassMapper.insertGlass(upwork); |
| | | loadGlassMapper.insertGlass(upwork); |
| | | } |
| | | //删除人工搬走的玻璃信息 |
| | | public void deleteGlass(int id) { |
| | | LoadGlassMapper.deleteGlass(id); |
| | | loadGlassMapper.deleteGlass(id); |
| | | } |
| | | //判断是否可以吸片进行任务 |
| | | public boolean isCanLoadGlass() { |
| | | String loadstate=plcmes.getPlcParameter("吸片信号").getValue(); |
| | | if(loadstate.equals("1")) { |
| | | return true; |
| | | }else{ |
| | | return false; |
| | | } |
| | | String loadstart="吸片信号";//plcmes.getPlcParameter("吸片信号").getValue(); |
| | | return "1".equals(loadstart); |
| | | |
| | | } |
| | | //判断优先吸片位置后发送出片任务 |
| | | public void selectPriority() { |
| | | int loadid1=LoadGlassMapper.selectPriority(1); |
| | | int loadid2=LoadGlassMapper.selectPriority(2); |
| | | int loadid1=loadGlassMapper.selectPriority(1); |
| | | int loadid2=loadGlassMapper.selectPriority(2); |
| | | //判断一二号工位哪边的顺序更先 |
| | | if(loadid1>loadid2) { |
| | | //s7control.WriteWord("DB100.10", (short)2); |
| | | S7object.getinstance().plccontrol.WriteWord("DB100.10", (short)2); |
| | | }else if(loadid1==loadid2){ |
| | | //当两个工位上的玻璃数相同时,判断哪个工位上的玻璃数更少,优先清空一个架子 |
| | | int glassnum1=Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | int glassnum2=Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | int glassnum1=1;//Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | int glassnum2=2;//Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | if(glassnum1>glassnum2){ |
| | | // s7control.WriteWord("DB100.10", (short)2); |
| | | S7object.getinstance().plccontrol.WriteWord("DB100.10", (short)2); |
| | | }else{ |
| | | //s7control.WriteWord("DB100.10", (short)1); |
| | | S7object.getinstance().plccontrol.WriteWord("DB100.10", (short)1); |
| | | } |
| | | }else{ |
| | | //s7control.WriteWord("DB100.10", (short)1); |
| | | S7object.getinstance().plccontrol.WriteWord("DB100.10", (short)1); |
| | | } |
| | | } |
| | | |