zwl
2026-03-20 84e27510eac3b86af8a98d7498eb451b876c5413
src/main/java/com/zy/core/plugin/FakeProcess.java
@@ -112,23 +112,23 @@
        asyncFakeRun();
        // 请求生成入库任务
        executeWithTimeout("generateStoreWrkFile", this::generateStoreWrkFile);
        this.generateStoreWrkFile();
        // 执行堆垛机任务
        executeWithTimeout("crnIoExecute", crnOperateUtils::crnIoExecute);
        crnOperateUtils.crnIoExecuteNormal();
        // 堆垛机任务执行完成-具备仿真能力
        executeWithTimeout("crnIoExecuteFinish", this::crnIoExecuteFinish);
        this.crnIoExecuteFinish();
        // 执行输送站点入库任务
        executeWithTimeout("stationInExecute", stationOperateProcessUtils::stationInExecute);
        stationOperateProcessUtils.stationInExecute();
        // 执行输送站点出库任务
        executeWithTimeout("stationOutExecute", stationOperateProcessUtils::stationOutExecute);
        stationOperateProcessUtils.stationOutExecute();
        // 检测输送站点出库任务执行完成
        executeWithTimeout("stationOutExecuteFinish", stationOperateProcessUtils::stationOutExecuteFinish);
        stationOperateProcessUtils.stationOutExecuteFinish();
        // 执行双工位堆垛机任务
        executeWithTimeout("dualCrnIoExecute", dualCrnOperateProcessUtils::dualCrnIoExecute);
        dualCrnOperateProcessUtils.dualCrnIoExecute();
        // 双工位堆垛机任务执行完成
        executeWithTimeout("dualCrnIoExecuteFinish", dualCrnOperateProcessUtils::dualCrnIoExecuteFinish);
        dualCrnOperateProcessUtils.dualCrnIoExecuteFinish();
        News.info("[WCS Debug] 主线程Run执行完成,耗时:{}ms", System.currentTimeMillis() - startTime);
    }
@@ -327,8 +327,8 @@
                    CreateInTaskParam taskParam = new CreateInTaskParam();
                    taskParam.setTaskNo(String.valueOf(commonService.getWorkNo(WrkIoType.IN.id)));
                    taskParam.setSourceStaNo(stationId);
                    taskParam.setStaNo(targetStationId);
                    taskParam.setSourceStaNo(String.valueOf(stationId));
                    taskParam.setStaNo(String.valueOf(targetStationId));
                    taskParam.setLocNo(locMast.getLocNo());
                    taskParam.setBarcode(stationProtocol.getBarcode());
                    WrkMast wrkMast = commonService.createInTask(taskParam);
@@ -476,9 +476,14 @@
                        if (lock != null) {
                            continue;
                        }
                        redisUtil.set(RedisKeyType.GENERATE_IN_TASK_LIMIT.key + stationId, "lock", 10);
                        String barcode = stationProtocol.getBarcode();
                        Integer stationIdVal = stationProtocol.getStationId();
                        String stationBackKey = RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + barcode + "_" + stationIdVal;
                        if (redisUtil.get(stationBackKey) != null) {
                            continue;
                        }
                        // 1. 首先查询是否有已完成的异步响应
                        String response = wmsOperateUtils.queryAsyncInTaskResponse(barcode, stationIdVal);
@@ -490,7 +495,7 @@
                                News.error("WMS入库请求失败,重新发起请求,barcode={},stationId={},response={}", barcode,
                                        stationIdVal, response);
                                wmsOperateUtils.applyInTaskAsync(barcode, stationIdVal,
                                        stationProtocol.getPalletHeight());
                                        stationProtocol.getPalletHeight(),stationProtocol.getWeight());
                                redisUtil.set(RedisKeyType.GENERATE_IN_TASK_LIMIT.key + stationId, "lock", 2);
                                continue;
                            }
@@ -501,7 +506,7 @@
                                StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                                CreateInTaskParam taskParam = new CreateInTaskParam();
                                taskParam.setTaskNo(dto.getTaskNo());
                                taskParam.setTaskNo(String.valueOf(dto.getTaskNo()));
                                taskParam.setLocNo(dto.getLocNo());
                                taskParam.setTaskPri(dto.getTaskPri());
                                taskParam.setBarcode(barcode);
@@ -513,14 +518,19 @@
                                    News.taskInfo(wrkMast.getWrkNo(), "获取输送线命令失败");
                                    continue;
                                }
                                redisUtil.del(stationBackKey);
                                MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
                            } else {
                                // 接口返回非200,重新发起请求
                                News.error("WMS入库接口返回非200,重新发起请求,barcode={},stationId={},response={}", barcode,
                                StationCommand command = stationThread.getCommand(StationCommandType.WRITE_INFO,
                                        9991, 1015, 1013, 0);
                                MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
                                redisUtil.set(stationBackKey, "lock", 15);
                                wmsOperateUtils.clearAsyncInTaskCache(barcode, stationIdVal);
                                // 接口返回非200,先退回,等待下次循环重新请求
                                News.error("WMS入库接口返回非200,先退回后等待重试,barcode={},stationId={},response={}", barcode,
                                        stationIdVal, response);
                                wmsOperateUtils.applyInTaskAsync(barcode, stationIdVal,
                                        stationProtocol.getPalletHeight());
                                redisUtil.set(RedisKeyType.GENERATE_IN_TASK_LIMIT.key + stationId, "lock", 2);
                                continue;
                            }
                        } else {
                            // 3. 没有响应结果,检查是否有请求正在进行中
@@ -528,10 +538,9 @@
                                // 没有请求进行中,发起新的异步请求
                                News.info("发起异步WMS入库请求,barcode={},stationId={}", barcode, stationIdVal);
                                wmsOperateUtils.applyInTaskAsync(barcode, stationIdVal,
                                        stationProtocol.getPalletHeight());
                                        stationProtocol.getPalletHeight(),stationProtocol.getWeight());
                                redisUtil.set(RedisKeyType.GENERATE_IN_TASK_LIMIT.key + stationId, "lock", 2);
                            }
                            // 如果有请求进行中,等待下次循环再检查
                        }
                    }
                }
@@ -789,9 +798,10 @@
                wrkMast.setWrkSts(updateWrkSts);
                wrkMast.setSystemMsg("");
                wrkMast.setWeight(Cools.isEmpty(crnProtocol.getWeight()) ? 11.11 : crnProtocol.getWeight());
                wrkMast.setIoTime(new Date());
                if (wrkMastService.updateById(wrkMast)) {
                    CrnCommand resetCommand = crnThread.getResetCommand(crnProtocol.getCrnNo());
                    CrnCommand resetCommand = crnThread.getResetCommand(crnProtocol.getTaskNo(), crnProtocol.getCrnNo());
                    MessageQueue.offer(SlaveType.Crn, crnProtocol.getCrnNo(), new Task(2, resetCommand));
                    News.info("堆垛机任务状态更新成功,堆垛机号={},工作号={}", basCrnp.getCrnNo(), crnProtocol.getTaskNo());
                }