| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.WrkAnalysisService; |
| | | import com.zy.asrs.service.WrkMastLogService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.LocStsType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.enums.WrkIoType; |
| | | import com.zy.core.enums.WrkStsType; |
| | | import com.zy.core.thread.StationThread; |
| | | import com.zy.core.utils.StationOperateProcessUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | private final WrkAnalysisService wrkAnalysisService; |
| | | private final LocMastService locMastService; |
| | | private final NotifyUtils notifyUtils; |
| | | private final StationOperateProcessUtils stationOperateProcessUtils; |
| | | private final BasStationService basStationService; |
| | | |
| | | public WrkMastScheduler(WrkMastService wrkMastService, |
| | | WrkMastLogService wrkMastLogService, |
| | | WrkAnalysisService wrkAnalysisService, |
| | | LocMastService locMastService, |
| | | NotifyUtils notifyUtils) { |
| | | NotifyUtils notifyUtils, |
| | | StationOperateProcessUtils stationOperateProcessUtils, |
| | | BasStationService basStationService |
| | | ) { |
| | | this.wrkMastService = wrkMastService; |
| | | this.wrkMastLogService = wrkMastLogService; |
| | | this.wrkAnalysisService = wrkAnalysisService; |
| | | this.locMastService = locMastService; |
| | | this.notifyUtils = notifyUtils; |
| | | this.stationOperateProcessUtils = stationOperateProcessUtils; |
| | | this.basStationService = basStationService; |
| | | } |
| | | |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | |
| | | } |
| | | |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | Integer taskNo = wrkMast.getWrkNo(); |
| | | Integer sourceStaNo = wrkMast.getSourceStaNo(); |
| | | Integer staNo = wrkMast.getStaNo(); |
| | | |
| | | String locNo = wrkMast.getLocNo(); |
| | | LocMast locMast = locMastService.queryByLoc(locNo); |
| | | if (locMast == null) { |
| | |
| | | |
| | | //上报 |
| | | notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast)); |
| | | |
| | | //清理路径 |
| | | List<BasStation> basStations = basStationService.list(new QueryWrapper<BasStation>().in("station_id", sourceStaNo, staNo)); |
| | | if (!basStations.isEmpty()) { |
| | | for (BasStation basStation : basStations) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo()); |
| | | if (stationThread != null) { |
| | | stationOperateProcessUtils.attemptClearTaskPath(stationThread, taskNo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | Integer taskNo = wrkMast.getWrkNo(); |
| | | Integer sourceStaNo = wrkMast.getSourceStaNo(); |
| | | Integer staNo = wrkMast.getStaNo(); |
| | | |
| | | String locNo = wrkMast.getSourceLocNo(); |
| | | LocMast locMast = locMastService.queryByLoc(locNo); |
| | | if (locMast == null) { |
| | |
| | | |
| | | //上报 |
| | | notifyUtils.notify("task", 1, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(wrkMast)); |
| | | |
| | | //清理路径 |
| | | List<BasStation> basStations = basStationService.list(new QueryWrapper<BasStation>().in("station_id", sourceStaNo, staNo)); |
| | | if (!basStations.isEmpty()) { |
| | | for (BasStation basStation : basStations) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo()); |
| | | if (stationThread != null) { |
| | | stationOperateProcessUtils.attemptClearTaskPath(stationThread, taskNo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |