| | |
| | | import cn.stylefeng.guns.modular.cm.paramCollection.service.ParamCollectionService; |
| | | import cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam; |
| | | import cn.stylefeng.guns.modular.cm.passingStationCollection.service.PassingStationCollectionService; |
| | | import cn.stylefeng.guns.modular.gm.greaseManage.model.params.GreaseManageParam; |
| | | import cn.stylefeng.guns.modular.gm.greaseManage.model.result.GreaseManageResult; |
| | | import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService; |
| | | import cn.stylefeng.guns.plcserver.opc.GlobalVariable; |
| | | import cn.stylefeng.guns.plcserver.opc.OPCComm; |
| | | import cn.stylefeng.guns.plcserver.opc.unit.OPCUnit; |
| | |
| | | import org.openscada.opc.lib.da.Group; |
| | | import org.openscada.opc.lib.da.Item; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | 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() { |
| | | IN_TIME = DateTool.getLocalTimeForDate(); |