admin
2024-01-10 7f291910791bdb9a545dc12ef36c3c359cfa4e59
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/server/EOP030/impl/EOP030ServerInterfaceImpl.java
@@ -74,7 +74,6 @@
                    }
                }
                handleOilState();
            }else{
                logger.info("EOP030工位与PLC断开,请检查PLC或网络是否异常!");
            }
@@ -88,26 +87,6 @@
        }
    }
    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() {