| | |
| | | // 立即触发异步任务,不等待结果 |
| | | if (!Cools.isEmpty(palletId.get()) && StringUtils.isNotBlank(syncOrder.getOrderNo()) && !Cools.isEmpty(syncOrder.getStationId())) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, palletId.get())); |
| | | if (!Cools.isEmpty(loc)) { |
| | | if (!Cools.isEmpty(loc) && loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | // outStockService.getOrderOutTaskItem(orderOutTaskParam,param.getOrderItemId()); |
| | | //出库 |
| | | // boolean itemsCheck = waitPakinService.mergeItemsCheck(pakinParam, loginUserId); |
| | | // if (true) { |
| | | CompletableFuture.runAsync(() -> { |
| | | try { |
| | | asyncOutboundExecutionWcs(syncOrder.getStationId(), wkOrder.getId(), loginUserId); |
| | | asyncOutboundExecutionWcs(syncOrder.getStationId(), wkOrder.getId(), loginUserId,loc.getCode()); |
| | | } catch (Exception e) { |
| | | log.warn("订单 {} 开始自动出库", syncOrder.getOrderNo()); |
| | | } |
| | | }); |
| | | // } |
| | | } else { |
| | | log.warn("订单 {} 自动出库失败!!未查询到指定库存!!", syncOrder.getOrderNo()); |
| | | throw new CoolException("自动出库失败!!未查询到指定库存!!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Async |
| | | public void asyncOutboundExecutionWcs(String stationId ,Long orderId, Long loginUserId) { |
| | | public void asyncOutboundExecutionWcs(String stationId ,Long orderId, Long loginUserId,String locCode) { |
| | | try { |
| | | int i = 0; |
| | | while (true) { |
| | | i++; |
| | | if (i > 5) return; |
| | | Thread.sleep(3000); |
| | | WkOrder byId = asnOrderService.getById(orderId); |
| | | if (Cools.isEmpty(byId)) { |
| | | continue; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | GenWaveParams genWaveParams = new GenWaveParams(); |
| | | List<Long> ids = new ArrayList<>(); |
| | |
| | | // return; |
| | | // } |
| | | // outStockService.genOutStockTask(tasks, loginUserId, orderId); |
| | | outStockService.generateWaves(genWaveParams); |
| | | R r = outStockService.generateWavesOrderAuto(genWaveParams, stationId,locCode); |
| | | |
| | | log.info("订单ID {} 自动转波次", orderId); |
| | | } catch (Exception e) { |