| | |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.javassist.compiler.ast.Symbol; |
| | |
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class); |
| | | jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class); |
| | | |
| | | String str = "Hello"; |
| | | char[] charArray = new char[str.length()]; |
| | | for (int i = 0; i < str.length(); i++) { |
| | | charArray[i] = str.charAt(i); |
| | | } |
| | | System.out.println(charArray); |
| | | // String str = "Hello"; |
| | | // char[] charArray = new char[str.length()]; |
| | | // for (int i = 0; i < str.length(); i++) { |
| | | // charArray[i] = str.charAt(i); |
| | | // } |
| | | // System.out.println(charArray); |
| | | // spianService.selectout("1145"); |
| | | // spianService.selectAll("11"); |
| | | // spianService.selectAll2(); |
| | |
| | | // 当进片车空闲时 |
| | | if (exist1 == true) { |
| | | // 获取已下发的进片id 与plc请求的id作比较 |
| | | byte[] writedglassidbytes = S7control.getinstance().ReadByte("DB105.16", 13); |
| | | byte[] writedglassidbytes = S7control.getinstance().ReadByte("DB105.16", 14); |
| | | String teststr1=new String(writedglassidbytes); |
| | | if (writedglassidbytes != null) { // |
| | | // 获取玻璃id |
| | | for (byte iditem : writedglassidbytes) { |
| | |
| | | } |
| | | } |
| | | // 获取进片id |
| | | byte[] datas1ListID = S7control.getinstance().ReadByte("DB106.26", 13); |
| | | if (datas1ListID != null) { |
| | | byte[] datas1ListID = S7control.getinstance().ReadByte("DB106.26", 14); |
| | | String teststr=new String(datas1ListID); |
| | | if (teststr != null) { |
| | | // 获取玻璃id |
| | | for (byte list1 : datas1ListID) { |
| | | strId.append(list1); |
| | | |
| | | } |
| | | if (!writedstrId.toString().equals(strId.toString())) // 已经下发的id与plc请求的id不一样时,认为不是重复的任务,才执行下发任务指令 |
| | | if (teststr1.equals(teststr)) // 已经下发的id与plc请求的id不一样时,认为不是重复的任务,才执行下发任务指令 |
| | | { |
| | | north_glass_buffer1 glass1 = spianMapper.selectGlass(teststr.toString()); |
| | | int questate = spianMapper.Selectqueuestate(); |
| | | |
| | | int glasslimit = 1;// 判断是否是多片上片 |
| | | if (glasslimit == 1) { |
| | | spianService.selectAll(strId.toString()); |
| | | if (questate == 0) { |
| | | |
| | | spianMapper.insertqueue(teststr, 1,glass1.getglasslengthmm()); |
| | | //spianService.selectAll(teststr); |
| | | |
| | | } else { |
| | | spianService.selectAll(strId.toString()); |
| | | //spianService.selectAll(teststr); |
| | | } |
| | | S7control.getinstance().WriteByte("DB105.16", datas1ListID);// 派发进片id |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 获取DO1数据 |
| | | StringBuilder queueid1 = spianService.queGlassid("DB106.DBB26"); |
| | | |
| | | // 获取DO2数据 |
| | | StringBuilder queueid2 = spianService.queGlassid("DB103.DBB46"); |
| | | int questate = spianMapper.Selectqueuestate(); |
| | | //queueid1.toString().isEmpty() |
| | | if (queueid1!=null&& questate == 0) { |
| | | // 写入D01的数据到上片队列表 |
| | | north_glass_buffer1 glass1 = spianMapper.selectGlass(queueid1.toString()); |
| | | spianMapper.insertqueue(queueid1.toString(), 1, glass1.getglasslengthmm()); |
| | | } |
| | | if (queueid2.toString().isEmpty()) { |
| | | // 写入D02的数据到上片队列表 |
| | | north_glass_buffer1 glass2 = spianMapper.selectGlass(queueid2.toString()); |
| | | spianMapper.insertqueue(queueid2.toString(), 2, glass2.getglasslengthmm()); |
| | | } |
| | | |
| | | |
| | | |
| | | List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态 |
| | | List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.14", 1); // 出片任务是否启动 |
| | | StringBuilder writedstrIdOut = new StringBuilder(); |
| | | //StringBuilder writedstrIdOut = new StringBuilder(); |
| | | // 获取已下发的出片id |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 13); |
| | | if (writedglassidbytesOut != null) { |
| | | // 获取玻璃id |
| | | for (byte iditem : writedglassidbytesOut) { |
| | | writedstrIdOut.append((char) iditem); |
| | | } |
| | | } |
| | | // 获取BO1数据 |
| | | StringBuilder queueid1 = spianService.queGlassid("DB103.DBB32"); |
| | | // 获取BO2数据 |
| | | StringBuilder queueid2 = spianService.queGlassid("DB103.DBB46"); |
| | | if (queueid1 != null) { |
| | | // 写入B01的数据到上片队列表 |
| | | spianMapper.insertqueue(queueid1.toString(), 1, 0); |
| | | } |
| | | if (queueid2 != null) { |
| | | // 写入B02的数据到上片队列表 |
| | | spianMapper.insertqueue(queueid2.toString(), 2, 0); |
| | | } |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 14); |
| | | String writedstrIdOut=new String(writedglassidbytesOut); |
| | | |
| | | |
| | | |
| | | // 出片任务//////////////////////////////// |
| | | boolean outstate = false;// 出片车空闲判断 |