| | |
| | | // \\ TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | if (S7control.getinstance().CheckConnected() == true) { |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class); |
| | | jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class); |
| | |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | //spianService.selectAll("X12345610402GV"); |
| | | // 出片任务//////////////////////////////// |
| | | List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态 |
| | | List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 出片任务是否启动 |
| | | // StringBuilder writedstrIdOut = new StringBuilder(); |
| | | // 获取已下发的出片id |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 14); |
| | | String writedstrIdOut = new String(writedglassidbytesOut); |
| | | |
| | | boolean outstate = false;// 出片车空闲判断 |
| | | boolean outstate1 = false;// 出片车任务是否启动 |
| | | if (outlist != null && outlist1 != null) { |
| | | |
| | | outstate = outlist.contains((short) 0);// 出片车空闲判断 当出片车空闲时为true |
| | | outstate1 = outlist1.contains((short) 1);// 出片车任务是否启动 当出片车任务启动时为true |
| | | |
| | | // 判断当前是否有未执行的任务 |
| | | int outnum = spianMapper.SelectOutSliceshu(); |
| | | int cageoutsum=spianMapper.Selectcageout(3); |
| | | // 当没有任务执行并且出片车空闲时 |
| | | if (outnum == 0 && outstate == true && Plchome.isAllowQueue == true&&cageoutsum==0) { |
| | | // 判断铝框出片队列表是否有待出片的玻璃 |
| | | String outglassid = spianMapper.SelectOutSlice(); |
| | | if (outglassid != null) { |
| | | |
| | | spianService.selectout2(outglassid); |
| | | outstate = false; |
| | | } |
| | | } |
| | | if (outstate == true) {// 当出片车空闲时,且出片启动为1时,任务启动改为0 |
| | | if (outstate1 == true) { |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 0);// 出片任务启动改为0 |
| | | } |
| | | } |
| | | } |
| | | |
| | | /////////////进片任务 |
| | | List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 获取prc进片请求数据 |
| | | List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 获取进片车状态 |
| | | List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 获取进片车任务是否启动 |
| | |
| | | spianService.overtask(B02glassid.toString());// 完成任务 |
| | | S7control.getinstance().WriteWord("DB106.62", (short) 0);// 恢复B02小车应答改为0 |
| | | System.out.println("汇报时B02|" + B02glassid); |
| | | boolean yingda = spianService.listbool("DB106.62");// b01汇报 |
| | | System.out.println("汇报时B01|第"+aaa+"次"+ B02glassid+"应答"+yingda); |
| | | boolean yingda = spianService.listbool("DB106.62");// b02汇报 |
| | | System.out.println("汇报时B02|第"+aaa+"次"+ B02glassid+"应答"+yingda); |
| | | } |
| | | |
| | | // 获取DO1数据 |
| | |
| | | |
| | | } |
| | | |
| | | // 出片任务//////////////////////////////// |
| | | List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态 |
| | | List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 出片任务是否启动 |
| | | // StringBuilder writedstrIdOut = new StringBuilder(); |
| | | // 获取已下发的出片id |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 14); |
| | | String writedstrIdOut = new String(writedglassidbytesOut); |
| | | |
| | | boolean outstate = false;// 出片车空闲判断 |
| | | boolean outstate1 = false;// 出片车任务是否启动 |
| | | if (outlist != null && outlist1 != null) { |
| | | |
| | | outstate = outlist.contains((short) 0);// 出片车空闲判断 当出片车空闲时为true |
| | | outstate1 = outlist1.contains((short) 1);// 出片车任务是否启动 当出片车任务启动时为true |
| | | |
| | | // 判断当前是否有未执行的任务 |
| | | int outnum = spianMapper.SelectOutSliceshu(); |
| | | // 当没有任务执行并且出片车空闲时 |
| | | if (outnum == 0 && outstate == true && Plchome.isAllowQueue == true) { |
| | | // 判断铝框出片队列表是否有待出片的玻璃 |
| | | String outglassid = spianMapper.SelectOutSlice(); |
| | | if (outglassid != null) { |
| | | |
| | | spianService.selectout2(outglassid); |
| | | outstate = false; |
| | | } |
| | | } |
| | | if (outstate == true) {// 当出片车空闲时,且出片启动为1时,任务启动改为0 |
| | | if (outstate1 == true) { |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 0);// 出片任务启动改为0 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // if (outstate == true) { // 出片车状态空闲时 |
| | | // Integer state = spianMapper.Selectoutstate(); |
| | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |