1
2 天以前 5dfbde6716d9074099fa90799a079e09a8f407be
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java
@@ -553,19 +553,22 @@
                    // 立即触发异步任务,不等待结果
                    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("自动出库失败!!未查询到指定库存!!");
                        }
                    }
                }
@@ -609,8 +612,19 @@
    }
    @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<>();
@@ -639,7 +653,7 @@
//                return;
//            }
//            outStockService.genOutStockTask(tasks, loginUserId, orderId);
            outStockService.generateWaves(genWaveParams);
            R r = outStockService.generateWavesOrderAuto(genWaveParams, stationId,locCode);
            log.info("订单ID {} 自动转波次", orderId);
        } catch (Exception e) {