| | |
| | | import com.zy.acs.framework.common.DateUtils; |
| | | import com.zy.acs.manager.common.config.UplinkProperties; |
| | | import com.zy.acs.manager.core.integrate.wms.TaskReportService; |
| | | import com.zy.acs.manager.core.integrate.wms.FaultReportService; |
| | | import com.zy.acs.manager.core.service.MainLockWrapService; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.*; |
| | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.Instant; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | |
| | | private SegmentService segmentService; |
| | | @Autowired |
| | | private TaskReportService taskReportService; |
| | | @Autowired |
| | | private VehFaultRecService vehFaultRecService; |
| | | @Autowired |
| | | private FaultReportService faultReportService; |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | private synchronized void autoCharge(){ |
| | | if (!configService.getVal("TaskAssignMode", Boolean.class)) { return; } |
| | | List<Agv> agvList = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val)); |
| | | for (Agv agv : agvList) { |
| | | AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId()); |
| | |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | | // @Scheduled(cron = "0 */2 * * * ? ") |
| | | private synchronized void autoStandby(){ |
| | | if (!configService.getVal("TaskAssignMode", Boolean.class)) { return; } |
| | | if (!configService.getVal("automaticStandbyPosition", Boolean.class)) { return; } |
| | | |
| | | List<Agv> agvList = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val)); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void reportFault() { |
| | | String reportFaultUrl = configService.getVal("reportFaultUrl", String.class); |
| | | if (Cools.isEmpty(reportFaultUrl)) { return; } |
| | | List<VehFaultRec> vehFaultRecList = vehFaultRecService.list((new LambdaQueryWrapper<VehFaultRec>().eq(VehFaultRec::getState, VehFaultRecStateType.PENDING).ge(VehFaultRec::getHappenTime, Instant.now().minusSeconds(3)))); |
| | | if (Cools.isEmpty(vehFaultRecList)) { return; } |
| | | for (VehFaultRec vehFaultRec : vehFaultRecList) { |
| | | boolean finished = faultReportService.reportFinished(vehFaultRec,reportFaultUrl); |
| | | if (finished) { |
| | | vehFaultRec.setState(VehFaultRecStateType.REPORT_SUCCESS.name()); |
| | | } else { |
| | | log.error("failed to report vehFaultRec to uplink"); |
| | | vehFaultRec.setState(VehFaultRecStateType.REPORT_FAILED.name()); |
| | | } |
| | | vehFaultRecService.updateById(vehFaultRec); |
| | | } |
| | | |
| | | } |
| | | } |