| | |
| | | private void submitGenerateStoreTasks() { |
| | | List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if (stationThread == null) { |
| | | continue; |
| | | } |
| | | |
| | | Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap(); |
| | | if (stationMap == null || stationMap.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | List<StationObjModel> barcodeStations = getBarcodeStations(basDevp); |
| | | for (StationObjModel stationObjModel : barcodeStations) { |
| | | Integer stationId = stationObjModel == null ? null : stationObjModel.getStationId(); |
| | | if (stationId == null) { |
| | | if (stationId == null || !stationMap.containsKey(stationId)) { |
| | | continue; |
| | | } |
| | | if (!canRequestStoreIn(stationMap.get(stationId))) { |
| | | continue; |
| | | } |
| | | storeInTaskGenerationService.submitGenerateStoreTask( |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean matchCandidate(StoreInTaskContext context) { |
| | | StationProtocol stationProtocol = context.getStationProtocol(); |
| | | return stationProtocol.isAutoing() |
| | | && stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() > 0 |
| | | && !Cools.isEmpty(stationProtocol.getBarcode()); |
| | | } |
| | | |
| | | @Override |
| | | public void onRequestPermitGranted(StoreInTaskContext context) { |
| | | redisUtil.set(getGenerateLockKey(context), "lock", 3); |
| | | } |
| | |
| | | stationCommandDispatcher.dispatch(context.getBasDevp().getDevpNo(), command, "fake-process", "write-info"); |
| | | } |
| | | |
| | | private boolean canRequestStoreIn(StationProtocol stationProtocol) { |
| | | return stationProtocol != null |
| | | && stationProtocol.isAutoing() |
| | | && stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() > 0 |
| | | && !Cools.isEmpty(stationProtocol.getBarcode()); |
| | | } |
| | | |
| | | // 计算所有站点停留时间 |
| | | public void calcAllStationStayTime() { |
| | | List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>()); |