| | |
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class); |
| | | jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class); |
| | | |
| | | spianService.selectout("1145"); |
| | | //spianService.selectAll2(); |
| | | //增加队列表数据 |
| | | //spianMapper.insertqueue("1",1,1500); |
| | | |
| | | |
| | | // 根据玻璃id获取订单号,单独数据源 |
| | | // try { |
| | | |
| | |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | // spianService.selectAll((short)257); |
| | | |
| | | //判断进片请求 |
| | | 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.12", 1);// 获取进片车任务是否启动 |
| | | |
| | | //测试启动自定义prc值 |
| | | // List<Short> datas1List=new ArrayList<>(); |
| | | // datas1List.add((short)1); |
| | | // List<Short> datas1ListState=new ArrayList<>(); |
| | | // datas1List.add((short)0); |
| | | // List<Short> datas1ListState2=new ArrayList<>(); |
| | | // datas1List.add((short)0); |
| | | |
| | | |
| | | if (datas1List != null && datas1ListState != null) { |
| | | |
| | | // 获取prc进片请求数据 |
| | |
| | | StringBuilder strId=new StringBuilder(); |
| | | StringBuilder writedstrId=new StringBuilder(); |
| | | |
| | | if(!inglassbegin&!exist1) |
| | | if(!inglassbegin&!exist1)//当进片车不空闲时 |
| | | { |
| | | inglassbegin=true; |
| | | } |
| | | if(inglassbegin&exist1) |
| | | if(inglassbegin&exist1)//当进片车空闲时 |
| | | { |
| | | inglassbegin=false; |
| | | spianMapper.Updatetask(1, 0);//立即结束数据库表中的上片任务 |
| | | spianMapper.UpdataAddCageState(1,2); |
| | | } |
| | | // 进片请求为1时 |
| | |
| | | if (exist1 == true) { |
| | | //获取已下发的进片id 与plc请求的id作比较 |
| | | byte[] writedglassidbytes = S7control.getinstance().ReadByte("DB105.16", 1); |
| | | if (writedglassidbytes != null) { |
| | | if (writedglassidbytes != null) { // |
| | | // 获取玻璃id |
| | | for (byte iditem : writedglassidbytes) { |
| | | writedstrId.append(iditem); |
| | |
| | | } |
| | | if(!writedstrId.toString().equals(strId.toString())) //已经下发的id与plc请求的id不一样时,认为不是重复的任务,才执行下发任务指令 |
| | | { |
| | | spianService.selectAll(strId.toString()); |
| | | |
| | | int glasslimit=1;//判断是否是多片上片 |
| | | if(glasslimit==1){ |
| | | spianService.selectAll(strId.toString()); |
| | | }else{ |
| | | spianService.selectAll(strId.toString()); |
| | | } |
| | | S7control.getinstance().WriteByte("DB105.16",datas1ListID);//派发进片id |
| | | |
| | | |
| | | } |
| | | //spianService.selectAll(Short.parseShort(strId.toString())); |
| | | } |
| | |
| | | } |
| | | // System.out.println(exist); |
| | | } |
| | | |
| | | if(exist1==false){//下发任务后将任务启动改为0 |
| | | if(exist2==true) { |
| | | //下发任务后将任务启动改为0 |
| | | if(exist1==false){ //进片车忙碌时 |
| | | if(exist2==true) { //任务已启动时 |
| | | S7control.getinstance().WriteWord("DB105.12",(short)0);//进片任务启动改为0 |
| | | } |
| | | } |
| | |
| | | if(outglassbegin&outstate)//当任务开始且出片车空闲时 |
| | | { |
| | | outglassbegin=false; |
| | | spianMapper.UpdatetaskOut(); //完成上一次出片或者调度任务 |
| | | spianMapper.UpdataAddCageState(0,3); |
| | | } |
| | | |