| | |
| | | import com.example.springboot.service.JdbcConnections; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.entity.Glass; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | |
| | |
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class); |
| | | jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class); |
| | | |
| | | spianService.selectout("1145"); |
| | | 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(); |
| | | //增加队列表数据 |
| | | //spianMapper.insertqueue("1",1,1500); |
| | | |
| | | |
| | | // 根据玻璃id获取订单号,单独数据源 |
| | | // try { |
| | | |
| | | // Glass glass = jdbcConnections.selectGlass(112); |
| | | // north_glass_buffer1 glass = jdbcConnections.selectGlass(112); |
| | | |
| | | // // System.out.println(glass.getOrderId()); |
| | | // } catch (SQLException e) { |
| | |
| | | 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) { |
| | | |
| | |
| | | // 当进片车空闲时 |
| | | if (exist1 == true) { |
| | | //获取已下发的进片id 与plc请求的id作比较 |
| | | byte[] writedglassidbytes = S7control.getinstance().ReadByte("DB105.16", 1); |
| | | byte[] writedglassidbytes = S7control.getinstance().ReadByte("DB105.16", 13); |
| | | if (writedglassidbytes != null) { // |
| | | // 获取玻璃id |
| | | for (byte iditem : writedglassidbytes) { |
| | |
| | | } |
| | | } |
| | | // 获取进片id |
| | | byte[] datas1ListID = S7control.getinstance().ReadByte("DB106.26", 1); |
| | | byte[] datas1ListID = S7control.getinstance().ReadByte("DB106.26", 13); |
| | | if (datas1ListID != null) { |
| | | // 获取玻璃id |
| | | for (byte list1 : datas1ListID) { |
| | |
| | | } |
| | | } |
| | | |
| | | //spianService.selectAll((short) 111); |
| | | |
| | | List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态 |
| | | List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.14", 1); // 出片任务是否启动 |
| | | StringBuilder writedstrIdOut=new StringBuilder(); |
| | | //获取已下发的出片id |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 1); |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 13); |
| | | if (writedglassidbytesOut != null) { |
| | | // 获取玻璃id |
| | | for (byte iditem : writedglassidbytesOut) { |
| | | writedstrIdOut.append(iditem); |
| | | 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); |
| | | } |
| | | |
| | | // 出片任务//////////////////////////////// |
| | | boolean outstate=false;//出片车空闲判断 |
| | | boolean outstate1=false;//出片车任务是否启动 |
| | | if (outlist != null&&outlist1!=null) { |
| | |
| | | outstate = outlist.contains((short) 0);//出片车空闲判断 |
| | | outstate1 = outlist1.contains((short) 1);//出片车任务是否启动 |
| | | |
| | | Glass glass=spianMapper.SelectDBOut();//判断是否有调拨后的出片任务未完成 |
| | | north_glass_buffer1 glass = spianMapper.SelectDBOut();// 判断是否有调拨后的出片任务未完成 |
| | | |
| | | if(!outglassbegin&!outstate)//当任务还未开始,且出片车不空闲时,任务状态改为开始 |
| | | { |
| | |
| | | { |
| | | outglassbegin=false; |
| | | spianMapper.UpdatetaskOut(); //完成上一次出片或者调度任务 |
| | | spianMapper.UpdataAddCageState(0,3); |
| | | spianMapper.UpdataAddCageState(0, 3);// 将出片中的格子状态改成0 |
| | | } |
| | | |
| | | if(outstate== true &glass.getGlassId()!=null){ //当出片车空闲且有出片任务待完成时 |
| | | if(glass.getId()==2&!writedstrIdOut.toString().equals(glass.getGlassId().toString())){ |
| | | spianService.selectout2(glass.getGlassId().toString()); |
| | | if (outstate == true & glass.getbarcode() != null) { // 当出片车空闲且有出片任务待完成时 |
| | | // 判断有两个出片或调拨任务时并且出片id和未完成的出片任务id不一样时执行出片 |
| | | if (glass.getId() == 2 & !writedstrIdOut.toString().equals(glass.getbarcode().toString())) { |
| | | spianService.selectout2(glass.getbarcode().toString()); |
| | | } |
| | | } |
| | | // 判断当前是否有未执行的任务 |
| | | int outnum = spianMapper.SelectOutSliceshu(); |
| | | if (outnum == 0) { |
| | | // 判断铝框出片队列表是否有待出片的玻璃 |
| | | String outglassid = spianMapper.SelectOutSlice(); |
| | | if (outglassid != null) { |
| | | spianService.selectout2(outglassid); |
| | | } |
| | | } |
| | | if(outstate==false){//下发任务后将任务启动改为0//出片车空闲判断 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (outstate == true) { // 出片车状态空闲时 |
| | | Integer state=spianMapper.Selectoutstate(); |
| | | String orderid = spianMapper.SelectOrderout(); |
| | |
| | | spianService.selectout(orderid); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 查询数据库 |
| | | // 推送到前端 |