| | |
| | | } |
| | | } |
| | | |
| | | handleOilState(); |
| | | }else{ |
| | | logger.info("EOP030工位与PLC断开,请检查PLC或网络是否异常!"); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public void handleOilState(){ |
| | | GreaseManageParam param = new GreaseManageParam(); |
| | | GreaseManageService greaseManageService = opc.greaseManageService; |
| | | param.setLocationCode(LOCATION_CODE); |
| | | List<GreaseManageResult> list = greaseManageService.findListBySpec(param); |
| | | if(list.size()>0) { |
| | | String duaDate = list.get(0).getDuaDate(); |
| | | LocalDate date1 = LocalDate.parse(duaDate); // 第一个日期 |
| | | LocalDate date2 = LocalDate.now(); // 当前日期(或者指定其他日期) |
| | | |
| | | long daysBetween = ChronoUnit.DAYS.between(date1, date2); |
| | | |
| | | if(daysBetween>0){ |
| | | OPCUnit.write(opc.getOP050_OIL_STATE(), "false"); //写油脂状态 |
| | | }else{ |
| | | OPCUnit.write(opc.getOP050_OIL_STATE(), "true"); //写油脂状态 |
| | | } |
| | | logger.info("到期日期:"+date1+"当前日期:"+date1+"剩余天数::"+daysBetween); |
| | | } |
| | | } |
| | | |
| | | //PC读工单 |
| | | public void handleOrder() { |