| | |
| | | |
| | | |
| | | private void initialize(){ |
| | | mapParameter.put("A06_request_word","DB11.0"); |
| | | mapParameter.put("A05_scanning_ID","DB11.2"); |
| | | mapParameter.put("MES_confirmation_word","DB11.40"); |
| | | mapParameter.put("A09_glass_status","DB11.70"); |
| | | mapParameter.put("A10_glass_status","DB11.72"); |
| | | mapParameter.put("A09_prohibit_film_production","DB11.74"); |
| | | mapParameter.put("A10_prohibit_film_production","DB11.76"); |
| | | mapParameter.put("A06_request_word","DB11.0");//请求字 |
| | | mapParameter.put("A05_scanning_ID","DB11.2");//请求ID |
| | | mapParameter.put("MES_confirmation_word","DB11.40");//MES发送字 |
| | | mapParameter.put("A09_glass_status","DB11.70");//A09玻璃状态 |
| | | mapParameter.put("A10_glass_status","DB11.72");//A10玻璃状态 |
| | | mapParameter.put("A09_prohibit_film_production","DB11.74");//A9禁止出片 |
| | | mapParameter.put("A10_prohibit_film_production","DB11.76");//A10禁止出片 |
| | | mapSettings.put("territoryPoor",3); |
| | | |
| | | // mapValue.put("A06_request_word","1");//请求字 |
| | |
| | | mapValue.put(key,value); |
| | | } |
| | | } |
| | | private void inTo(){ |
| | | private boolean inTo(){ |
| | | List<GlassInfo> glassInfos=glassInfoService.selectId(mapValue.get("A05_scanning_ID")); |
| | | if(glassInfos.size()<1){ |
| | | log.info("此玻璃编号不存在"); |
| | |
| | | taskCache.setCreateTime(new DateTime()); |
| | | edgStorageCageDetailsMapper.updateById(edgStorageCageDetails); |
| | | taskCacheService.insertTaskCache(taskCache); |
| | | return true; |
| | | }else{ |
| | | log.info("不存在空格"); |
| | | } |
| | | }else{ |
| | | log.info("此玻璃编号存在多个"); |
| | | } |
| | | return false; |
| | | } |
| | | private void outTo(int line){ |
| | | private boolean outTo(int line){ |
| | | int endcell=0; |
| | | EdgStorageCageDetails outEdgStorageCageDetails=new EdgStorageCageDetails(); |
| | | TaskCache taskCacheA09=taskCacheService.selectLastOutCacheInfo(""); |
| | | TaskCache taskCacheA10=taskCacheService.selectLastOutCacheInfo(""); |
| | | TaskCache taskCacheA09=taskCacheService.selectLastOutCacheInfo(2001); |
| | | TaskCache taskCacheA10=taskCacheService.selectLastOutCacheInfo(2002); |
| | | //两线各自要出的玻璃 |
| | | EdgStorageCageDetails glassInfo09=edgStorageCageDetailsService.selectConformGlass(taskCacheA09.getGlassId(),(int)mapSettings.get("territoryPoor")); |
| | | EdgStorageCageDetails glassInfo10=edgStorageCageDetailsService.selectConformGlass(taskCacheA10.getGlassId(),(int)mapSettings.get("territoryPoor")); |
| | | //决定线路 |
| | | if(line==1){ |
| | | endcell=9000; |
| | | endcell=2001; |
| | | outEdgStorageCageDetails=glassInfo09; |
| | | }else if(line==2){ |
| | | endcell=1000; |
| | | endcell=2002; |
| | | outEdgStorageCageDetails=glassInfo10; |
| | | }else if(line==3){ |
| | | endcell=9000;//默认走一号线 优化方向可根据 对比两线速度/两线当前任务情况做 |
| | | endcell=2001;//默认走一号线 优化方向可根据 对比两线速度/两线当前任务情况做 |
| | | outEdgStorageCageDetails=glassInfo09; |
| | | } |
| | | if(outEdgStorageCageDetails!=null&&endcell>0){ |
| | |
| | | taskCache.setTaskType(2); |
| | | taskCache.setCreateTime(new DateTime()); |
| | | taskCacheService.insertTaskCache(taskCache); |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | |
| | | |
| | | |
| | | } |
| | | @Override |
| | | public void run() { |
| | | boolean start=true; |
| | | boolean start=false; |
| | | boolean isSend=false; |
| | | while (this != null&&start) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | try { |
| | |
| | | }else if("1".equals(mapValue.get("A06_request_word"))&& |
| | | "0".equals(mapValue.get("MES_confirmation_word"))) |
| | | { |
| | | |
| | | inTo(); |
| | | //进片任务 查找是否存在此片玻璃 存在则生成任务 |
| | | isSend=inTo(); |
| | | }else if("2".equals(mapValue.get("A06_request_word"))&& |
| | | "0".equals(mapValue.get("MES_confirmation_word"))&& |
| | | ( |
| | |
| | | "0".equals(mapValue.get("A10_glass_status")) |
| | | ) |
| | | ){ |
| | | |
| | | outTo(3); |
| | | //出片任务 查找两条线上一次任务的尺寸 |
| | | isSend=outTo(3); |
| | | }else if("3".equals(mapValue.get("A06_request_word"))&& |
| | | "0".equals(mapValue.get("MES_confirmation_word"))){ |
| | | |
| | | //先出后进 |
| | | if("0".equals(mapValue.get("A09_glass_status"))||"0".equals(mapValue.get("A10_glass_status"))){ |
| | | outTo(3); |
| | | isSend=outTo(3); |
| | | }else{ |
| | | inTo(); |
| | | isSend=inTo(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // List<String> address2=new ArrayList<String>(); |
| | | // address.add(""); |
| | | // List<String> list2= S7object.getinstance().plccontrol.readStrings(address); |
| | | // PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | // log.info("plcmes:{}",plcmes); |
| | | // S7object.getinstance().plccontrol.WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); |
| | | |
| | | // taskCacheMapper = WebSocketServer.applicationContext.getBean(TaskCacheMapper.class); |
| | | // List<TaskCache> list=taskCacheMapper.selectList(null); |
| | | // log.info("数据{}",list); |
| | | // 注入mapper |
| | | // HomeService = WebSocketServer.applicationContext.getBean(HomeService.class); |
| | | // QueueMapper = WebSocketServer.applicationContext.getBean(QueueMapper.class); |
| | | |
| | | |
| | | // //读取DB105区文件 |
| | | // PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | // |
| | | // String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//请求 |
| | | // String MesSend=plcmes.getPlcParameter("MESToGaStatus").getValue();//发送 |
| | | // double width=Double.valueOf(plcmes.getPlcParameter("width").getValue());//宽 |
| | | // double height=Double.valueOf(plcmes.getPlcParameter("Height").getValue());//高 |
| | | |
| | | //获取测量的长,宽 |
| | | boolean istest = true; |
| | | // String PlcRequest = "1"; |
| | | // String MesSend = "0"; |
| | | // double width = 516; |
| | | // double height = 507; |
| | | //System.out.println(111); |
| | | // //查询当前订单任务 |
| | | //List<FlowCard> OrderTask = storageCageService.SelectOrderTask(); |
| | | //jsonObject.append("OrderTask", OrderTask); |
| | | if(isSend){ |
| | | S7object.getinstance().plccontrol.WriteWord(mapParameter.get("MES_confirmation_word"),(short)1); |
| | | } |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |