| | |
| | | package com.mes.service; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.mes.entity.device.PLCAutoMes; |
| | | import com.mes.common.PlcTools.S7control; |
| | | import com.mes.entity.device.PlcParameterObject; |
| | | import com.google.common.primitives.Bytes; |
| | | import com.mes.entity.GlassInfo; |
| | | |
| | | import com.mes.entity.UpWorkstation; |
| | | import com.mes.mapper.LoadGlassMapper; |
| | | |
| | | @Service |
| | | public class LoadGlassService { |
| | | @Autowired |
| | | private com.mes.common.PlcTools.S7control s7control; |
| | | |
| | | private S7control s7control; |
| | | private LoadGlassMapper LoadGlassMapper; |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | //显示工位上的玻璃信息 |
| | | public List<UpWorkstation> selectAll() { |
| | | List<UpWorkstation> glassInfo= LoadGlassMapper.SelectALL(); |
| | | List<UpWorkstation> glassInfo= LoadGlassMapper.selectALL(); |
| | | return glassInfo; |
| | | } |
| | | //增加人工输入的工位玻璃信息 |
| | | public void insertGlass(UpWorkstation upwork) { |
| | | LoadGlassMapper.insertGlass(upwork.getPatternwidth(),upwork.getPatternheigth(),upwork.getPatternthickness(),1); |
| | | LoadGlassMapper.insertGlass(upwork); |
| | | } |
| | | //删除人工搬走的玻璃信息 |
| | | public void deleteGlass(int id) { |
| | |
| | | } |
| | | |
| | | } |
| | | //判断优先吸片位置 |
| | | public int selectPriority() { |
| | | int loadid1=LoadGlassMapper.SelectPriority(1); |
| | | int loadid2=LoadGlassMapper.SelectPriority(2); |
| | | //判断优先吸片位置后发送出片任务 |
| | | public void selectPriority() { |
| | | int loadid1=LoadGlassMapper.selectPriority(1); |
| | | int loadid2=LoadGlassMapper.selectPriority(2); |
| | | //判断一二号工位哪边的顺序更先 |
| | | if(loadid1>loadid2) { |
| | | return 1; |
| | | s7control.WriteWord("DB100.10", (short)2); |
| | | }else if(loadid1==loadid2){ |
| | | //当两个工位上的玻璃数相同时,判断哪个工位上的玻璃数更少,优先清空一个架子 |
| | | int glassnum1=Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | int glassnum2=Integer.parseInt(plcmes.getPlcParameter("玻璃数").getValue()); |
| | | if(glassnum1>glassnum2){ |
| | | s7control.WriteWord("DB100.10", (short)2); |
| | | }else{ |
| | | s7control.WriteWord("DB100.10", (short)1); |
| | | } |
| | | }else{ |
| | | return 2; |
| | | s7control.WriteWord("DB100.10", (short)1); |
| | | } |
| | | } |
| | | |