|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
#include "appconfig.h"
|
|
|
#include "localplans.h"
|
|
|
+#include "uiformat.h"
|
|
|
|
|
|
#include <QCoreApplication>
|
|
|
#include <QDateTime>
|
|
|
@@ -12,8 +13,10 @@
|
|
|
#include <QJsonArray>
|
|
|
#include <QJsonDocument>
|
|
|
#include <QJsonObject>
|
|
|
+#include <QNetworkProxy>
|
|
|
#include <QNetworkRequest>
|
|
|
#include <QSaveFile>
|
|
|
+#include <QUrl>
|
|
|
#include <QUuid>
|
|
|
|
|
|
namespace {
|
|
|
@@ -145,7 +148,11 @@ BackendLink::BackendLink(QObject *parent)
|
|
|
connect(&m_ws, &QWebSocket::textMessageReceived, this, &BackendLink::onTextMessage);
|
|
|
connect(&m_ws, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error),
|
|
|
this, [this](QAbstractSocket::SocketError) {
|
|
|
- qInfo().noquote() << "[backend]" << m_ws.errorString();
|
|
|
+ const QString err = m_ws.errorString();
|
|
|
+ qInfo().noquote() << "[backend]" << err;
|
|
|
+ if (err.contains(QStringLiteral("proxy"), Qt::CaseInsensitive))
|
|
|
+ qInfo().noquote() << "[backend] 提示:连接受本机代理影响;内网后端已强制直连,"
|
|
|
+ "若仍失败请核对 config.json 的 url 与系统代理设置";
|
|
|
});
|
|
|
|
|
|
m_reconnect.setSingleShot(true);
|
|
|
@@ -216,6 +223,23 @@ void BackendLink::openSocket()
|
|
|
qInfo().noquote() << "[backend] 连接" << m_url << "...";
|
|
|
m_connectStartMs = nowMs();
|
|
|
|
|
|
+ // 内网 / 本机后端一律直连,不让 QWebSocket 去用系统或环境变量代理。
|
|
|
+ // 开发机上常设 http_proxy(本机抓包/加速代理),Qt 会把它拿去连 ws://,
|
|
|
+ // 握手前就报 "The proxy type is invalid for this operation",于是每 3s 重连、
|
|
|
+ // 界面一直「控制台离线」,点开始测试就提示「后端未连接,本次未下发任务」。
|
|
|
+ // 后端在局域网,本来也不该经过代理;外网地址仍沿用系统默认代理。
|
|
|
+ const QUrl url(m_url);
|
|
|
+ const QString host = url.host();
|
|
|
+ const bool direct = host.isEmpty()
|
|
|
+ || host == QStringLiteral("localhost")
|
|
|
+ || host == QStringLiteral("127.0.0.1")
|
|
|
+ || host == QLatin1String("::1")
|
|
|
+ || host.startsWith(QStringLiteral("192.168."))
|
|
|
+ || host.startsWith(QStringLiteral("10."))
|
|
|
+ || host.startsWith(QStringLiteral("172."));
|
|
|
+ m_ws.setProxy(direct ? QNetworkProxy(QNetworkProxy::NoProxy)
|
|
|
+ : QNetworkProxy(QNetworkProxy::DefaultProxy));
|
|
|
+
|
|
|
QNetworkRequest request{QUrl(m_url)};
|
|
|
request.setRawHeader("X-Client-Id", m_clientId.toUtf8());
|
|
|
m_ws.open(request);
|
|
|
@@ -225,7 +249,8 @@ void BackendLink::onConnected()
|
|
|
{
|
|
|
qInfo().noquote() << "[backend] 已连上" << m_url << "client_id =" << m_clientId;
|
|
|
m_lastMessageMs = nowMs();
|
|
|
- m_autoPaused = false; // 重新连上后允许再次自动下发
|
|
|
+ // 断线后不自动恢复阶段动作:手册要求连接变化时暂停本地自动下发。
|
|
|
+ // 只有用户明确发起新一轮 StartTest 才解除暂停,避免重连后对旧 input_id 误操作。
|
|
|
m_reconnect.stop();
|
|
|
m_disconnectDebounce.stop();
|
|
|
if (!m_reportedConnected) {
|
|
|
@@ -313,14 +338,19 @@ void BackendLink::flushDeferredUart(int station)
|
|
|
|
|
|
void BackendLink::onDisconnected()
|
|
|
{
|
|
|
- qInfo().noquote() << "[backend] 连接断开," << kReconnectMs / 1000 << "s 后重试";
|
|
|
+ qInfo().noquote() << "[backend] 连接断开," << QString::number(kReconnectMs / 1000.0, 'f', 1) << "s 后重试";
|
|
|
m_autoPaused = true; // 连接变化 → 暂停自动下发
|
|
|
m_handlers.clear();
|
|
|
+ m_errorHandlers.clear();
|
|
|
|
|
|
// 旧的推送包属于上一条连接:重连后后端会重放当前会话,回填也会重新走,这里直接丢掉
|
|
|
for (int i = 0; i < kStationCount; ++i) {
|
|
|
m_backfillHoldUntil[i] = 0;
|
|
|
m_uartDeferred[i].clear();
|
|
|
+ // 在途 SetStageIntent 的回执可能随断线丢失,不能让 pending 永久卡住;
|
|
|
+ // ready 也不能在重连后被当成当前轮次已可靠预置。
|
|
|
+ m_stageIntentPending[i].clear();
|
|
|
+ m_stageIntentReady[i].clear();
|
|
|
}
|
|
|
|
|
|
if (m_reportedConnected && !m_disconnectDebounce.isActive())
|
|
|
@@ -397,9 +427,9 @@ void BackendLink::onTextMessage(const QString &json)
|
|
|
const QString event = obj.value(QStringLiteral("event")).toString();
|
|
|
if (!event.isEmpty()) {
|
|
|
const QJsonObject result = obj.value(QStringLiteral("result")).toObject();
|
|
|
- if (event == QStringLiteral("state"))
|
|
|
+ if (event == QStringLiteral("state")) {
|
|
|
applyState(result);
|
|
|
- else if (event == QStringLiteral("bios_uart")) {
|
|
|
+ } else if (event == QStringLiteral("bios_uart")) {
|
|
|
// 回填期间先把推送压住:等 ReadBiosUart 把历史补齐再按原顺序放,
|
|
|
// 否则推送把游标先推到很后面,回填回来的前几万字节会被当成重复整包丢掉。
|
|
|
const int index = stationIndex(result.value(QStringLiteral("station_id")).toString());
|
|
|
@@ -408,13 +438,61 @@ void BackendLink::onTextMessage(const QString &json)
|
|
|
else
|
|
|
applyBiosUart(result);
|
|
|
} else if (event == QStringLiteral("task_complete")) {
|
|
|
+ // 0.8.1.19:每轮终态主动推送。只接受当前 boot_id 的事件,避免旧轮次迟到包推进新任务。
|
|
|
const int index = stationIndex(result.value(QStringLiteral("station_id")).toString());
|
|
|
- if (index >= 0) {
|
|
|
- const QString verdict = result.value(QStringLiteral("verdict")).toString();
|
|
|
- const QString status = result.value(QStringLiteral("task_status")).toString();
|
|
|
- emit logLine(index, QStringLiteral("[qt] 收到本轮测试完成推送(verdict=%1, task_status=%2)")
|
|
|
- .arg(verdict, status));
|
|
|
- emit taskCompleted(index, result);
|
|
|
+ const QString bootId = result.value(QStringLiteral("boot_id")).toString();
|
|
|
+ const QString taskStatus = result.value(QStringLiteral("task_status")).toString();
|
|
|
+ const bool complete = result.value(QStringLiteral("complete")).toBool();
|
|
|
+ const bool terminal = taskStatus == QStringLiteral("completed")
|
|
|
+ || taskStatus == QStringLiteral("failed");
|
|
|
+ if (index >= 0 && complete && terminal) {
|
|
|
+ const bool eventIsOld = !m_waitingNewBoot[index] && !bootId.isEmpty()
|
|
|
+ && !m_bootId[index].isEmpty() && bootId != m_bootId[index];
|
|
|
+ const bool stillOldDuringRestart = m_waitingNewBoot[index]
|
|
|
+ && (bootId.isEmpty()
|
|
|
+ || bootId == m_bootId[index]);
|
|
|
+ if (eventIsOld || stillOldDuringRestart) {
|
|
|
+ qInfo().noquote() << "[backend] 忽略旧轮次 task_complete:"
|
|
|
+ << stationId(index) << bootId
|
|
|
+ << "当前 boot_id =" << m_bootId[index];
|
|
|
+ } else {
|
|
|
+ // 新轮次的 task_complete 可能先于下一帧 state 到达;boot_id 不同且正等待新轮次时,
|
|
|
+ // 以该事件确认轮次切换,避免误丢真正的终态通知。
|
|
|
+ if (!bootId.isEmpty() && m_waitingNewBoot[index]
|
|
|
+ && bootId != m_bootId[index]) {
|
|
|
+ m_bootId[index] = bootId;
|
|
|
+ m_waitingNewBoot[index] = false;
|
|
|
+ m_appliedCpu[index].clear();
|
|
|
+ m_handledInput[index].clear();
|
|
|
+ m_stageDoneKeys[index].clear();
|
|
|
+ m_stagePendingCmd[index].clear();
|
|
|
+ m_stagePendingKey[index].clear();
|
|
|
+ m_stationPaused[index] = false;
|
|
|
+ m_blockedWarned[index] = false;
|
|
|
+ m_lastCompleteCmd[index].clear();
|
|
|
+ m_lastTaskStatus[index].clear();
|
|
|
+ m_stageErrorsJson[index].clear();
|
|
|
+ m_lastVerdict[index].clear();
|
|
|
+ }
|
|
|
+ // 快照事件与「队列推进」分开去重:
|
|
|
+ // StageAction/GetCommand 的 complete=true 可能先到并占用
|
|
|
+ // m_lastTaskCompleteBoot;不能因此吞掉后到的 verdict/stage_completions。
|
|
|
+ const bool newSnapshot = bootId.isEmpty()
|
|
|
+ || bootId != m_lastTaskCompleteEventBoot[index];
|
|
|
+ if (newSnapshot) {
|
|
|
+ if (!bootId.isEmpty())
|
|
|
+ m_lastTaskCompleteEventBoot[index] = bootId;
|
|
|
+ emit taskCompleteArrived(index, result);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 队列终态单独去重,命令回执先到时事件只补快照、不重复推进。
|
|
|
+ if (bootId.isEmpty() || bootId != m_lastTaskCompleteBoot[index]) {
|
|
|
+ if (!bootId.isEmpty())
|
|
|
+ m_lastTaskCompleteBoot[index] = bootId;
|
|
|
+ m_lastTaskStatus[index] = taskStatus;
|
|
|
+ emit taskProgressReported(index, true, taskStatus);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return;
|
|
|
@@ -460,16 +538,110 @@ void BackendLink::onTextMessage(const QString &json)
|
|
|
// ---------------------------------------------------------------------------
|
|
|
// 状态推送:四工位快照 → 落库 + 本地 plan
|
|
|
// ---------------------------------------------------------------------------
|
|
|
+// 手册 9.2:StartTest / StageAction / GetCommand 的命令结果对象新增
|
|
|
+// complete(当前任务是否到终态)与 task_status(任务状态枚举)。
|
|
|
+// complete 也可能表示「这条命令自己到终态」,所以上层只有同时看到
|
|
|
+// task_status=completed/failed 才把它当作任务终态,避免阶段动作提前推进队列。
|
|
|
+void BackendLink::reportCommandProgress(int station, const QString &commandId,
|
|
|
+ const QJsonObject &result)
|
|
|
+{
|
|
|
+ if (station < 0 || station >= kStationCount)
|
|
|
+ return;
|
|
|
+
|
|
|
+ // 字段可能在命令结果顶层,也可能嵌在 result.result 里(GetCommand 把业务结果
|
|
|
+ // 放在嵌套 result 下),两处都认,兼容后端不同实现。
|
|
|
+ bool complete = result.value(QStringLiteral("complete")).toBool();
|
|
|
+ QString taskStatus = result.value(QStringLiteral("task_status")).toString();
|
|
|
+ const QJsonObject inner = result.value(QStringLiteral("result")).toObject();
|
|
|
+ if (!complete)
|
|
|
+ complete = inner.value(QStringLiteral("complete")).toBool();
|
|
|
+ if (taskStatus.isEmpty())
|
|
|
+ taskStatus = inner.value(QStringLiteral("task_status")).toString();
|
|
|
+
|
|
|
+ // complete 只有与任务终态同时出现才可推进本地队列。
|
|
|
+ const bool terminalTask = taskStatus == QStringLiteral("completed")
|
|
|
+ || taskStatus == QStringLiteral("failed")
|
|
|
+ || taskStatus == QStringLiteral("interrupted");
|
|
|
+
|
|
|
+ // task_complete 推送与 GetCommand 可能描述同一轮终态:按 boot_id 跨通道去重,
|
|
|
+ // 防止先收到推送推进到下一任务后,又被迟到的 GetCommand 把下一任务误推进一次。
|
|
|
+ const bool alreadyReportedForBoot = !m_bootId[station].isEmpty()
|
|
|
+ && m_lastTaskCompleteBoot[station] == m_bootId[station];
|
|
|
+
|
|
|
+ // 换条停机(run_state=blocked)期间不再上报 complete:命令结果包可能比 state 包先到,
|
|
|
+ // 那时上层还没看到 awaiting_dimm_replacement,会误把队列推进到下一条任务。
|
|
|
+ if (complete && terminalTask && !alreadyReportedForBoot
|
|
|
+ && !m_blockedWarned[station] && m_lastCompleteCmd[station] != commandId) {
|
|
|
+ m_lastCompleteCmd[station] = commandId;
|
|
|
+ m_lastTaskStatus[station] = taskStatus;
|
|
|
+ if (!m_bootId[station].isEmpty())
|
|
|
+ m_lastTaskCompleteBoot[station] = m_bootId[station];
|
|
|
+ emit taskProgressReported(station, true, taskStatus);
|
|
|
+ } else if (!taskStatus.isEmpty() && taskStatus != m_lastTaskStatus[station]) {
|
|
|
+ m_lastTaskStatus[station] = taskStatus;
|
|
|
+ emit taskProgressReported(station, false, taskStatus);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 手册 9.5:确认已更换 DIMM,清除后端换条停机挂起(awaiting_dimm_replacement)。
|
|
|
+void BackendLink::confirmDimmReplacement(int station)
|
|
|
+{
|
|
|
+ if (station < 0 || station >= kStationCount)
|
|
|
+ return;
|
|
|
+ if (!isConnected()) {
|
|
|
+ emit dimmConfirmed(station, false, QStringLiteral("后端未连接"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const QString commandId = newCommandId(QStringLiteral("dimm"), station);
|
|
|
+ QJsonObject params;
|
|
|
+ params.insert(QStringLiteral("command_id"), commandId);
|
|
|
+ params.insert(QStringLiteral("station_id"), stationId(station));
|
|
|
+ // ConfirmDimmReplacement 只要求 command_id + station_id。
|
|
|
+ // 该工位可能因为 blocked 被暂停自动下发,确认换条后恢复(下一轮 boot_id 也会再清一次)。
|
|
|
+ m_stationPaused[station] = false;
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 提交更换异常内存条确认(%1)").arg(commandId));
|
|
|
+
|
|
|
+ sendRequest(QStringLiteral("ConfirmDimmReplacement"), params,
|
|
|
+ [this, station](const QJsonObject &result) {
|
|
|
+ const QString state = result.value(QStringLiteral("state")).toString();
|
|
|
+ if (state == QStringLiteral("failed") || state == QStringLiteral("interrupted")) {
|
|
|
+ const QJsonObject err = result.value(QStringLiteral("error")).toObject();
|
|
|
+ const QString msg = QStringLiteral("%1 %2")
|
|
|
+ .arg(err.value(QStringLiteral("code")).toString(),
|
|
|
+ err.value(QStringLiteral("message")).toString())
|
|
|
+ .trimmed();
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 确认更换内存条失败:%1").arg(msg));
|
|
|
+ emit dimmConfirmed(station, false, msg);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 已确认更换异常内存条,后端换条停机挂起已解除"));
|
|
|
+ emit dimmConfirmed(station, true, QString());
|
|
|
+ }, [this, station](const QString &code, const QString &message) {
|
|
|
+ const QString msg = QStringLiteral("%1 %2").arg(code, message).trimmed();
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 确认更换内存条失败:%1").arg(msg));
|
|
|
+ emit dimmConfirmed(station, false, msg);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
void BackendLink::applyState(const QJsonObject &result)
|
|
|
{
|
|
|
const QString serverId = result.value(QStringLiteral("server_id")).toString();
|
|
|
if (!m_serverId.isEmpty() && serverId != m_serverId) {
|
|
|
// 后端重启:清掉旧输入节点与自动运行归属,不重放任何动作
|
|
|
qInfo().noquote() << "[backend] server_id 变化,清理旧输入节点与自动运行状态";
|
|
|
+ // 后端实例变化后,旧命令、输入节点与阶段意图均不可继续使用。
|
|
|
+ // 暂停自动动作,要求用户明确重新开始,避免对新后端会话误发旧计划。
|
|
|
+ m_autoPaused = true;
|
|
|
for (int i = 0; i < kStationCount; ++i) {
|
|
|
m_handledInput[i].clear();
|
|
|
m_appliedCpu[i].clear();
|
|
|
m_bootId[i].clear();
|
|
|
+ m_lastTaskCompleteBoot[i].clear();
|
|
|
+ m_lastTaskCompleteEventBoot[i].clear();
|
|
|
+ m_stageIntentPending[i].clear();
|
|
|
+ m_stageIntentReady[i].clear();
|
|
|
+ m_waitingNewBoot[i] = false;
|
|
|
}
|
|
|
m_pending.clear();
|
|
|
m_pollCount.clear();
|
|
|
@@ -513,7 +685,7 @@ void BackendLink::applyStation(int station, const QJsonObject &st)
|
|
|
m_lastInputId[station] = st.value(QStringLiteral("input")).toObject()
|
|
|
.value(QStringLiteral("id")).toString();
|
|
|
|
|
|
- // boot_id 变化 = 新一轮启动:内存参数要在新的 UIP1 重新下发
|
|
|
+ // boot_id 变化 = 新一轮启动:内存参数要在新的 ICT1 重新下发
|
|
|
const QString bootId = st.value(QStringLiteral("boot_id")).toString();
|
|
|
if (!bootId.isEmpty() && bootId != m_bootId[station]) {
|
|
|
m_bootId[station] = bootId;
|
|
|
@@ -523,6 +695,11 @@ void BackendLink::applyStation(int station, const QJsonObject &st)
|
|
|
m_stagePendingCmd[station].clear();
|
|
|
m_stagePendingKey[station].clear();
|
|
|
m_stationPaused[station] = false; // 新一轮启动,恢复自动化
|
|
|
+ m_blockedWarned[station] = false; // 新一轮允许重新提示换条停机
|
|
|
+ m_lastCompleteCmd[station].clear(); // 新任务允许再报一次 complete
|
|
|
+ m_lastTaskCompleteBoot[station].clear();
|
|
|
+ m_waitingNewBoot[station] = false;
|
|
|
+ m_lastTaskStatus[station].clear();
|
|
|
m_uartSeen[station] = false; // 新一轮重新统计,便于诊断
|
|
|
m_stageErrorsJson[station].clear(); // 新一轮允许重新报告相同内容
|
|
|
m_lastVerdict[station].clear(); // 新一轮的 verdict 重新计
|
|
|
@@ -569,8 +746,33 @@ void BackendLink::applyStation(int station, const QJsonObject &st)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 手册 9.2:state 推送的 station.command 同样带 complete / task_status;
|
|
|
+ // 工位对象自己也有 task_status,变化时才上报(每秒一包,不去重会刷屏)。
|
|
|
+ const QJsonObject command = st.value(QStringLiteral("command")).toObject();
|
|
|
+ if (!command.isEmpty())
|
|
|
+ reportCommandProgress(station,
|
|
|
+ command.value(QStringLiteral("command_id")).toString(), command);
|
|
|
+ const QString taskStatus = st.value(QStringLiteral("task_status")).toString();
|
|
|
+ if (!taskStatus.isEmpty() && taskStatus != m_lastTaskStatus[station]) {
|
|
|
+ m_lastTaskStatus[station] = taskStatus;
|
|
|
+ emit taskProgressReported(station, false, taskStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 手册 9.2/9.5:阶段 FAIL 后后端把 run_state 置为 blocked 并挂起换条,
|
|
|
+ // 此时停止该工位的自动下发,等测试员换条后点「开始测试」强制重启新一轮。
|
|
|
+ const QString runState = st.value(QStringLiteral("run_state")).toString();
|
|
|
+ const bool awaitingDimm = st.value(QStringLiteral("awaiting_dimm_replacement")).toBool();
|
|
|
+ if ((runState == QStringLiteral("blocked") || awaitingDimm) && !m_blockedWarned[station]) {
|
|
|
+ m_blockedWarned[station] = true;
|
|
|
+ m_stationPaused[station] = true;
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 后端换条停机(run_state=blocked):本阶段已跑完,"
|
|
|
+ "等待更换异常内存条;换好后点「开始测试」可强制重启新一轮"));
|
|
|
+ emit alarmReported(station, QString(),
|
|
|
+ QStringLiteral("换条停机:等待更换异常内存条并重新开始测试"));
|
|
|
+ }
|
|
|
+
|
|
|
// FAIL 之后该工位停止自动动作,等人工处理(其他工位不受影响)
|
|
|
- if (st.value(QStringLiteral("run_state")).toString() == QStringLiteral("failed")) {
|
|
|
+ if (runState == QStringLiteral("failed")) {
|
|
|
if (!m_stationPaused[station]) {
|
|
|
qInfo().noquote() << "[backend] 工位" << stationId(station) << "进入 failed,暂停该工位自动下发";
|
|
|
m_stationPaused[station] = true;
|
|
|
@@ -578,6 +780,108 @@ void BackendLink::applyStation(int station, const QJsonObject &st)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 0.8.1.19:在新的 StartTest 已受理后,将四个阶段意图提前写入后端。
|
|
|
+ // 每个阶段的最后一次意图由后端 Last-Write-Wins 规则决定;成功预置后不再
|
|
|
+ // 在 input.ready 时重复发送 StageAction,防止后端自动消费与前端动作撞车。
|
|
|
+void BackendLink::stageStationIntents(int station)
|
|
|
+{
|
|
|
+ if (station < 0 || station >= kStationCount || !isConnected())
|
|
|
+ return;
|
|
|
+
|
|
|
+ m_stageIntentPending[station].clear();
|
|
|
+ m_stageIntentReady[station].clear();
|
|
|
+
|
|
|
+ auto sendIntent = [this, station](const QString &stage,
|
|
|
+ const QString &action,
|
|
|
+ const QJsonObject &extra) {
|
|
|
+ m_stageIntentPending[station].insert(stage);
|
|
|
+
|
|
|
+ QJsonObject params;
|
|
|
+ params.insert(QStringLiteral("station_id"), stationId(station));
|
|
|
+ params.insert(QStringLiteral("stage"), stage);
|
|
|
+ params.insert(QStringLiteral("action"), action);
|
|
|
+ for (auto it = extra.constBegin(); it != extra.constEnd(); ++it)
|
|
|
+ params.insert(it.key(), it.value());
|
|
|
+
|
|
|
+ sendRequest(QStringLiteral("SetStageIntent"), params,
|
|
|
+ [this, station, stage, action](const QJsonObject &result) {
|
|
|
+ m_stageIntentPending[station].remove(stage);
|
|
|
+ const QString confirmation = result.value(QStringLiteral("confirmation")).toString();
|
|
|
+ QString stageText = ui::inputStageText(stage);
|
|
|
+ if (stageText == stage)
|
|
|
+ stageText = stage.toUpper();
|
|
|
+ if (confirmation == QStringLiteral("staged")) {
|
|
|
+ m_stageIntentReady[station].insert(stage);
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 阶段意图已预置:%1 / %2(staged)")
|
|
|
+ .arg(stageText, action));
|
|
|
+ } else {
|
|
|
+ // 只有明确返回 staged 才能认定后端已接管;否则保留 input.ready 回退路径。
|
|
|
+ m_stageIntentReady[station].remove(stage);
|
|
|
+ emit logLine(station, QStringLiteral("[qt] %1 阶段未确认预置(confirmation=%2),到达提示符后回退普通动作")
|
|
|
+ .arg(stageText, confirmation.isEmpty()
|
|
|
+ ? QStringLiteral("missing") : confirmation));
|
|
|
+ }
|
|
|
+ }, [this, station, stage, action](const QString &code, const QString &message) {
|
|
|
+ // 旧版后端不支持 SetStageIntent 时自动回退到 input.ready -> StageAction。
|
|
|
+ m_stageIntentPending[station].remove(stage);
|
|
|
+ m_stageIntentReady[station].remove(stage);
|
|
|
+ emit logLine(station, QStringLiteral("[qt] %1 阶段预置失败(%2 %3),到达提示符后回退普通动作")
|
|
|
+ .arg(stage, code, message));
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // ICT1:完整透传本地 memory_params(包含快捷参数及扩展目录参数),并单独指定 RMT 开关。
|
|
|
+ QJsonObject ict1;
|
|
|
+ const bool runRmt = m_rmtParams[station].value(QStringLiteral("enabled")).toBool(true);
|
|
|
+ ict1.insert(QStringLiteral("run_rmt"), runRmt);
|
|
|
+ if (!m_memoryParams[station].isEmpty())
|
|
|
+ ict1.insert(QStringLiteral("memory_params"), m_memoryParams[station]);
|
|
|
+ sendIntent(QStringLiteral("uip1"), QStringLiteral("continue_uip"), ict1);
|
|
|
+
|
|
|
+ // AMT:按启用开关预置 start_amt / skip_amt;selected、only_tests、skip_tests 均透传。
|
|
|
+ const QJsonObject amt = m_amtParams[station];
|
|
|
+ const bool runAmt = amt.value(QStringLiteral("enabled")).toBool(true);
|
|
|
+ QJsonObject amtExtra;
|
|
|
+ amtExtra.insert(QStringLiteral("run_amt"), runAmt);
|
|
|
+ if (runAmt) {
|
|
|
+ QJsonObject payload;
|
|
|
+ QString testCommand = amt.value(QStringLiteral("test_command")).toString().trimmed();
|
|
|
+ if (testCommand.isEmpty())
|
|
|
+ testCommand = QStringLiteral("amemdiag 1");
|
|
|
+ payload.insert(QStringLiteral("test_command"), testCommand);
|
|
|
+ const char *const amtKeys[] = {"selected", "only_tests", "skip_tests"};
|
|
|
+ for (const char *key : amtKeys) {
|
|
|
+ const QJsonValue value = amt.value(QLatin1String(key));
|
|
|
+ if (!value.isUndefined() && !value.isNull()
|
|
|
+ && (!value.isArray() || !value.toArray().isEmpty()))
|
|
|
+ payload.insert(QLatin1String(key), value);
|
|
|
+ }
|
|
|
+ if (amt.contains(QStringLiteral("end_step")))
|
|
|
+ payload.insert(QStringLiteral("end_step"), amt.value(QStringLiteral("end_step")));
|
|
|
+ amtExtra.insert(QStringLiteral("amt"), payload);
|
|
|
+ }
|
|
|
+ sendIntent(QStringLiteral("amt"),
|
|
|
+ runAmt ? QStringLiteral("start_amt") : QStringLiteral("skip_amt"),
|
|
|
+ amtExtra);
|
|
|
+
|
|
|
+ // ICT2:继续固件流程,不重复应用 ICT1 参数。
|
|
|
+ sendIntent(QStringLiteral("uip2"), QStringLiteral("continue_uip"), QJsonObject());
|
|
|
+
|
|
|
+ // MT:后端按 mt86.cfg / PXE 规则处理文件与地址范围;这里只传本地明确配置项。
|
|
|
+ const QJsonObject mt = m_mtParams[station];
|
|
|
+ const bool runMt = mt.value(QStringLiteral("enabled")).toBool(true);
|
|
|
+ QJsonObject mtExtra;
|
|
|
+ mtExtra.insert(QStringLiteral("run_mt"), runMt);
|
|
|
+ if (runMt) {
|
|
|
+ const QJsonObject payload = LocalPlans::mtStagePayload(mt);
|
|
|
+ if (!payload.isEmpty())
|
|
|
+ mtExtra.insert(QStringLiteral("mt"), payload);
|
|
|
+ }
|
|
|
+ sendIntent(QStringLiteral("mt"),
|
|
|
+ runMt ? QStringLiteral("start_mt") : QStringLiteral("skip_mt"),
|
|
|
+ mtExtra);
|
|
|
+}
|
|
|
+
|
|
|
void BackendLink::autoPlan(int station, const QJsonObject &st)
|
|
|
{
|
|
|
if (m_autoPaused || m_stationPaused[station])
|
|
|
@@ -610,6 +914,14 @@ void BackendLink::autoPlan(int station, const QJsonObject &st)
|
|
|
if (stage == QStringLiteral("amt") && testComplete && amtWanted)
|
|
|
key = QStringLiteral("amt-exit/%1").arg(cpu);
|
|
|
|
|
|
+ // SetStageIntent 已成功预置时,后端会在该阶段提示符自动消费;
|
|
|
+ // AMT 跑完后后端也会按 exit_after=true 自动提交 exit,不重复发送 skip_amt。
|
|
|
+ const QString intentStage = (stage == QStringLiteral("uefi"))
|
|
|
+ ? QStringLiteral("mt") : stage;
|
|
|
+ if (m_stageIntentPending[station].contains(intentStage)
|
|
|
+ || m_stageIntentReady[station].contains(intentStage))
|
|
|
+ return;
|
|
|
+
|
|
|
if (m_stageDoneKeys[station].contains(key))
|
|
|
return;
|
|
|
|
|
|
@@ -617,23 +929,17 @@ void BackendLink::autoPlan(int station, const QJsonObject &st)
|
|
|
QJsonObject extra;
|
|
|
|
|
|
if (stage == QStringLiteral("uip1")) {
|
|
|
- // 每个 CPU 的 UIP1 各下发一次内存参数;同一 CPU 再次进入 UIP1 只发空回车。
|
|
|
- // 手册 3.4:UIP1 的 continue_uip 要带 run_rmt(默认 true),后端据此决定
|
|
|
+ // 每个 CPU 的 ICT1 各下发一次内存参数;同一 CPU 再次进入 ICT1 只发空回车。
|
|
|
+ // 手册 3.4:ICT1 的 continue_uip 要带 run_rmt(默认 true),后端据此决定
|
|
|
// 下发 rmt enable 跑完整 RMT 扫描,还是直接空回车跳过。
|
|
|
action = QStringLiteral("continue_uip");
|
|
|
const bool wantRmt = m_rmtParams[station].value(QStringLiteral("enabled")).toBool(true);
|
|
|
extra.insert(QStringLiteral("run_rmt"), wantRmt);
|
|
|
- if (!m_rmtParams[station].isEmpty())
|
|
|
- extra.insert(QStringLiteral("rmt"), m_rmtParams[station]);
|
|
|
const bool firstCpu = m_appliedCpu[station].isEmpty();
|
|
|
if (!m_appliedCpu[station].contains(cpu) && !m_memoryParams[station].isEmpty()) {
|
|
|
extra.insert(QStringLiteral("memory_params"), m_memoryParams[station]);
|
|
|
m_appliedCpu[station].insert(cpu);
|
|
|
}
|
|
|
- // StartTest 协议只收 command_id / station_id,本轮任务列表随第一个 CPU 的
|
|
|
- // ICT1 一次性带下去;后端按列表顺序执行(一个机台可以挂多条任务)。
|
|
|
- if (firstCpu && !m_stationTasks[station].isEmpty())
|
|
|
- extra.insert(QStringLiteral("tasks"), m_stationTasks[station]);
|
|
|
} else if (stage == QStringLiteral("uip2")) {
|
|
|
action = QStringLiteral("continue_uip"); // 空参数,只发一个 CR
|
|
|
} else if (stage == QStringLiteral("amt")) {
|
|
|
@@ -649,11 +955,24 @@ void BackendLink::autoPlan(int station, const QJsonObject &st)
|
|
|
action = QStringLiteral("start_amt");
|
|
|
extra.insert(QStringLiteral("run_amt"), true);
|
|
|
|
|
|
+ // 只带测试命令;旧版 overrides / raw_commands 纯净接口会忽略,不再传
|
|
|
QString testCommand = amt.value(QStringLiteral("test_command")).toString().trimmed();
|
|
|
if (testCommand.isEmpty())
|
|
|
testCommand = QStringLiteral("amemdiag 1");
|
|
|
- QJsonObject amtPayload = amt;
|
|
|
+ QJsonObject amtPayload;
|
|
|
amtPayload.insert(QStringLiteral("test_command"), testCommand);
|
|
|
+ // 手册 9.4:后端按 amt.selected(或 only_tests / skip_tests)自动生成
|
|
|
+ // 合规的 tp 表指令;end_step=0 可单步快跑全部算法。没勾就完全不传,
|
|
|
+ // 由后端按默认「19 项全跑」执行,避免把空数组误读成「一项都不跑」。
|
|
|
+ const char *const amtKeys[] = {"selected", "only_tests", "skip_tests"};
|
|
|
+ for (const char *key : amtKeys) {
|
|
|
+ const QJsonValue value = amt.value(QLatin1String(key));
|
|
|
+ if (!value.isUndefined() && !value.isNull()
|
|
|
+ && (!value.isArray() || !value.toArray().isEmpty()))
|
|
|
+ amtPayload.insert(QLatin1String(key), value);
|
|
|
+ }
|
|
|
+ if (amt.contains(QStringLiteral("end_step")))
|
|
|
+ amtPayload.insert(QStringLiteral("end_step"), amt.value(QStringLiteral("end_step")));
|
|
|
extra.insert(QStringLiteral("amt"), amtPayload);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -691,7 +1010,10 @@ void BackendLink::autoPlan(int station, const QJsonObject &st)
|
|
|
}
|
|
|
}
|
|
|
if (!ok) {
|
|
|
- qInfo().noquote() << "[backend] 工位" << stationId(station) << stage
|
|
|
+ QString stageText = ui::inputStageText(stage);
|
|
|
+ if (stageText == stage)
|
|
|
+ stageText = stage.toUpper();
|
|
|
+ qInfo().noquote() << "[backend] 工位" << stationId(station) << stageText
|
|
|
<< "当前不允许" << action << ",等待状态变化";
|
|
|
return;
|
|
|
}
|
|
|
@@ -724,13 +1046,36 @@ void BackendLink::submitStageAction(int station, const QString &inputId,
|
|
|
sendRequest(QStringLiteral("StageAction"), params, [this, commandId, station](const QJsonObject &result) {
|
|
|
const QString state = result.value(QStringLiteral("state")).toString();
|
|
|
qInfo().noquote() << "[backend] StageAction" << commandId << "state =" << state;
|
|
|
+ reportCommandProgress(station, commandId, result); // 手册 9.2:complete / task_status
|
|
|
if (state == QStringLiteral("failed") || state == QStringLiteral("interrupted")) {
|
|
|
- m_stagePendingCmd[station].clear();
|
|
|
- m_stationPaused[station] = true;
|
|
|
- emit logLine(station, QStringLiteral("[qt] 阶段动作 %1(已暂停该工位自动下发)").arg(state));
|
|
|
+ forgetCommand(commandId);
|
|
|
+ if (m_stagePendingCmd[station] == commandId)
|
|
|
+ m_stagePendingCmd[station].clear();
|
|
|
+ const QJsonObject err = result.value(QStringLiteral("error")).toObject();
|
|
|
+ const QString code = err.value(QStringLiteral("code")).toString();
|
|
|
+ const QString msg = err.value(QStringLiteral("message")).toString();
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 阶段动作 %1:%2 %3")
|
|
|
+ .arg(state, code, msg).trimmed());
|
|
|
+ if (state == QStringLiteral("failed") && code == QStringLiteral("FAILED_PRECONDITION")) {
|
|
|
+ m_stageDoneKeys[station].remove(m_stagePendingKey[station]);
|
|
|
+ } else {
|
|
|
+ m_stationPaused[station] = true;
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 阶段动作 %1(已暂停该工位自动下发)").arg(state));
|
|
|
+ }
|
|
|
} else if (state == QStringLiteral("succeeded")) {
|
|
|
- m_stagePendingCmd[station].clear();
|
|
|
+ forgetCommand(commandId);
|
|
|
+ if (m_stagePendingCmd[station] == commandId)
|
|
|
+ m_stagePendingCmd[station].clear();
|
|
|
}
|
|
|
+ }, [this, commandId, station](const QString &code, const QString &message) {
|
|
|
+ forgetCommand(commandId);
|
|
|
+ if (m_stagePendingCmd[station] == commandId)
|
|
|
+ m_stagePendingCmd[station].clear();
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 阶段动作被后端拒绝:%1 %2").arg(code, message).trimmed());
|
|
|
+ if (code == QStringLiteral("FAILED_PRECONDITION"))
|
|
|
+ m_stageDoneKeys[station].remove(m_stagePendingKey[station]);
|
|
|
+ else
|
|
|
+ m_stationPaused[station] = true;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -783,14 +1128,12 @@ bool BackendLink::startTest(int station)
|
|
|
"照常提交开始测试,由后端核验").arg(power, phase));
|
|
|
}
|
|
|
|
|
|
- // 同一工位已有未结束的 StartTest 时支持强制抢占重发:忘记旧 command_id,签发新一轮命令
|
|
|
+ // 同一工位已有未结束的 StartTest:拒绝重复排入(后端也会拒),直接告诉调用方
|
|
|
if (m_startPending[station]) {
|
|
|
- qInfo().noquote() << "[backend]" << stationId(station) << "抢占未完成的 StartTest"
|
|
|
- << m_startCmd[station] << ",重新签发开始测试";
|
|
|
- if (!m_startCmd[station].isEmpty())
|
|
|
- forgetCommand(m_startCmd[station]);
|
|
|
- m_startPending[station] = false;
|
|
|
- m_startCmd[station].clear();
|
|
|
+ qInfo().noquote() << "[backend]" << stationId(station) << "已有未完成的 StartTest"
|
|
|
+ << m_startCmd[station] << ",忽略本次点击";
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 该工位已有未完成的 StartTest,忽略本次点击"));
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
const QString commandId = newCommandId(QStringLiteral("start"), station);
|
|
|
@@ -801,8 +1144,11 @@ bool BackendLink::startTest(int station)
|
|
|
m_stageDoneKeys[station].clear();
|
|
|
m_stagePendingCmd[station].clear();
|
|
|
m_stagePendingKey[station].clear();
|
|
|
+ m_stageIntentPending[station].clear();
|
|
|
+ m_stageIntentReady[station].clear();
|
|
|
m_stationPaused[station] = false;
|
|
|
m_autoPaused = false;
|
|
|
+ m_waitingNewBoot[station] = true;
|
|
|
|
|
|
// 日志区会被上层清空:短时间内丢弃旧会话的残留字节,等新会话再显示。
|
|
|
// 注意必须是「限时」静音:后端在一次重启前后可能沿用同一个会话编号,
|
|
|
@@ -824,12 +1170,17 @@ bool BackendLink::startTest(int station)
|
|
|
sendRequest(QStringLiteral("StartTest"), params, [this, station, commandId](const QJsonObject &result) {
|
|
|
const QString state = result.value(QStringLiteral("state")).toString();
|
|
|
qInfo().noquote() << "[backend] StartTest" << commandId << "state =" << state;
|
|
|
+ reportCommandProgress(station, commandId, result); // 手册 9.2:complete / task_status
|
|
|
if (state == QStringLiteral("queued") || state == QStringLiteral("running")
|
|
|
|| state == QStringLiteral("dispatching")) {
|
|
|
+ // StartTest 已受理,当前旧启动已被后端接管;现在预置新一轮四阶段意图,
|
|
|
+ // 请求帧按 WebSocket 顺序先于后续阶段状态处理,不会抢写旧 BIOS 会话。
|
|
|
+ stageStationIntents(station);
|
|
|
emit logLine(station, QStringLiteral("[qt] StartTest 已受理(%1),等待新 BIOS 启动与可交互输入")
|
|
|
.arg(state));
|
|
|
emit startTestReplied(station, true, state);
|
|
|
} else if (state == QStringLiteral("failed") || state == QStringLiteral("interrupted")) {
|
|
|
+ forgetCommand(commandId);
|
|
|
m_startPending[station] = false;
|
|
|
if (m_startCmd[station] == commandId)
|
|
|
m_startCmd[station].clear();
|
|
|
@@ -840,13 +1191,16 @@ bool BackendLink::startTest(int station)
|
|
|
emit logLine(station, QStringLiteral("[qt] StartTest %1:%2 %3").arg(state, code, msg));
|
|
|
emit startTestReplied(station, false, QStringLiteral("%1 %2").arg(code, msg).trimmed());
|
|
|
} else if (state == QStringLiteral("succeeded")) {
|
|
|
- // 直接终态(复位/开机已确认并进入可交互窗口)
|
|
|
+ forgetCommand(commandId);
|
|
|
+ // 直接终态(复位/开机已确认并进入可交互窗口),仍先预置后续阶段意图。
|
|
|
+ stageStationIntents(station);
|
|
|
m_startPending[station] = false;
|
|
|
if (m_startCmd[station] == commandId)
|
|
|
m_startCmd[station].clear();
|
|
|
emit startTestReplied(station, true, state);
|
|
|
}
|
|
|
}, [this, station, commandId](const QString &code, const QString &message) {
|
|
|
+ forgetCommand(commandId);
|
|
|
// 后端在 RPC 层直接拒掉 StartTest(典型:FAILED_PRECONDITION,
|
|
|
// 该工位正被另一个客户端/网页端执行)。此时不会有任何命令记录,
|
|
|
// 必须在这里就把在途闸门放开、并通知界面复位按钮,
|
|
|
@@ -953,41 +1307,6 @@ void BackendLink::listUefiFiles(int station, const QString &path)
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-void BackendLink::confirmDimmReplacement(int station)
|
|
|
-{
|
|
|
- if (station < 0 || station >= kStationCount)
|
|
|
- return;
|
|
|
- if (!isConnected()) {
|
|
|
- emit dimmConfirmed(station, false, QStringLiteral("后端未连接"));
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- const QString commandId = newCommandId(QStringLiteral("dimm"), station);
|
|
|
- QJsonObject params;
|
|
|
- params.insert(QStringLiteral("command_id"), commandId);
|
|
|
- params.insert(QStringLiteral("station_id"), stationId(station));
|
|
|
-
|
|
|
- m_stationPaused[station] = false;
|
|
|
- emit logLine(station, QStringLiteral("[qt] 提交更换异常内存条确认(%1)").arg(commandId));
|
|
|
-
|
|
|
- sendRequest(QStringLiteral("ConfirmDimmReplacement"), params,
|
|
|
- [this, station](const QJsonObject &result) {
|
|
|
- const QString state = result.value(QStringLiteral("state")).toString();
|
|
|
- if (state == QStringLiteral("failed") || state == QStringLiteral("interrupted")) {
|
|
|
- const QString msg = rpcErrorText(result);
|
|
|
- emit logLine(station, QStringLiteral("[qt] 确认更换内存条失败:%1").arg(msg));
|
|
|
- emit dimmConfirmed(station, false, msg);
|
|
|
- return;
|
|
|
- }
|
|
|
- emit logLine(station, QStringLiteral("[qt] 已确认更换异常内存条,解除停机挂起状态"));
|
|
|
- emit dimmConfirmed(station, true, QString());
|
|
|
- }, [this, station](const QString &code, const QString &message) {
|
|
|
- const QString msg = QStringLiteral("%1 %2").arg(code, message).trimmed();
|
|
|
- emit logLine(station, QStringLiteral("[qt] 确认更换内存条失败:%1").arg(msg));
|
|
|
- emit dimmConfirmed(station, false, msg);
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
void BackendLink::trackCommand(const QString &commandId, int station)
|
|
|
{
|
|
|
m_pending.insert(commandId, station);
|
|
|
@@ -1052,12 +1371,14 @@ void BackendLink::pollCommand(const QString &commandId)
|
|
|
sendRequest(QStringLiteral("GetCommand"), params, [this, commandId](const QJsonObject &result) {
|
|
|
const QString state = result.value(QStringLiteral("state")).toString();
|
|
|
const int station = m_pending.value(commandId, -1);
|
|
|
+ reportCommandProgress(station, commandId, result); // 手册 9.2:complete / task_status
|
|
|
const bool terminal = (state == QStringLiteral("succeeded")
|
|
|
|| state == QStringLiteral("failed")
|
|
|
|| state == QStringLiteral("interrupted"));
|
|
|
+ const bool isStartCommand = station >= 0 && m_startCmd[station] == commandId;
|
|
|
if (terminal) {
|
|
|
forgetCommand(commandId);
|
|
|
- if (station >= 0 && m_startCmd[station] == commandId) {
|
|
|
+ if (isStartCommand) {
|
|
|
m_startCmd[station].clear();
|
|
|
m_startPending[station] = false; // 放开工位,允许再次点「开始测试」
|
|
|
} else if (station >= 0 && m_stagePendingCmd[station] == commandId) {
|
|
|
@@ -1075,16 +1396,18 @@ void BackendLink::pollCommand(const QString &commandId)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (station >= 0 && state == QStringLiteral("failed")) {
|
|
|
+ if (station >= 0 && (state == QStringLiteral("failed")
|
|
|
+ || state == QStringLiteral("interrupted"))) {
|
|
|
const QJsonObject err = result.value(QStringLiteral("error")).toObject();
|
|
|
const QString code = err.value(QStringLiteral("code")).toString();
|
|
|
const QString msg = err.value(QStringLiteral("message")).toString();
|
|
|
- emit logLine(station, QStringLiteral("[qt] 命令 %1 失败:%2 %3")
|
|
|
- .arg(commandId, code, msg));
|
|
|
+ emit logLine(station, QStringLiteral("[qt] 命令 %1 %2:%3 %4")
|
|
|
+ .arg(commandId, state == QStringLiteral("interrupted")
|
|
|
+ ? QStringLiteral("中断") : QStringLiteral("失败"), code, msg));
|
|
|
|
|
|
// 输入节点已变化:撤回该节点的「已完成」标记,等新状态用新 input.id 重试;
|
|
|
// 其他错误(链路不可用 / 后端 INTERNAL 等)才真正暂停该工位。
|
|
|
- if (code == QStringLiteral("FAILED_PRECONDITION")) {
|
|
|
+ if (state == QStringLiteral("failed") && code == QStringLiteral("FAILED_PRECONDITION")) {
|
|
|
m_stageDoneKeys[station].remove(m_stagePendingKey[station]);
|
|
|
} else {
|
|
|
m_stationPaused[station] = true;
|
|
|
@@ -1094,10 +1417,10 @@ void BackendLink::pollCommand(const QString &commandId)
|
|
|
// 必须像 RPC 层拒绝一样放开在途闸门、通知界面把按钮退回「开始测试」。
|
|
|
// 少了这一步,按钮会永久卡在「执行中」,再点还会被「已有未完成 StartTest」
|
|
|
// 吞掉 —— 现场表现就是「点了没反应,只能重启软件」。
|
|
|
- if (m_startCmd[station] == commandId) {
|
|
|
- m_startCmd[station].clear();
|
|
|
- m_startPending[station] = false;
|
|
|
- emit startTestReplied(station, false, QStringLiteral("%1 %2").arg(code, msg).trimmed());
|
|
|
+ if (isStartCommand) {
|
|
|
+ // 上面的终态处理已清空 m_startCmd,这里用预先捕获的标记通知界面复位按钮。
|
|
|
+ emit startTestReplied(station, false,
|
|
|
+ QStringLiteral("%1 %2").arg(code, msg).trimmed());
|
|
|
}
|
|
|
}
|
|
|
qInfo().noquote() << "[backend] GetCommand" << commandId << "→" << state;
|
|
|
@@ -1146,16 +1469,6 @@ QString BackendLink::newCommandId(const QString &kind, int station)
|
|
|
.arg(++m_commandSeq);
|
|
|
}
|
|
|
|
|
|
-void BackendLink::setStationTasks(int station, const QJsonArray &tasks)
|
|
|
-{
|
|
|
- if (station < 0 || station >= kStationCount)
|
|
|
- return;
|
|
|
- m_stationTasks[station] = tasks;
|
|
|
- qInfo().noquote() << "[backend]" << stationId(station)
|
|
|
- << "本轮任务已装载,条数 =" << tasks.size()
|
|
|
- << "(随 ICT1 阶段下发)";
|
|
|
-}
|
|
|
-
|
|
|
void BackendLink::setMemoryParams(int station, const QJsonObject &memoryParams)
|
|
|
{
|
|
|
if (station < 0 || station >= kStationCount)
|