Add messages sent to ISMAS.

This commit is contained in:
Gerhard Hoffmann 2023-08-11 10:58:29 +02:00
parent 79906df12e
commit 746565dbe0

View File

@ -507,6 +507,16 @@ bool Worker::updateTriggerSet() {
if (parseError.error != QJsonParseError::NoError) { if (parseError.error != QJsonParseError::NoError) {
qCritical() << "(2) INVALID JSON MSG: PARSING FAILED (msg=" << msg << "):" qCritical() << "(2) INVALID JSON MSG: PARSING FAILED (msg=" << msg << "):"
<< parseError.error << parseError.errorString(); << parseError.error << parseError.errorString();
setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::JSON_PARSE_FAILURE,
QString("(2) INVALID JSON %1 %2 %3")
.arg(msg)
.arg(parseError.error)
.arg(parseError.errorString()));
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.jsonParseFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
m_updateStatus.m_statusDescription));
emit showErrorMessage("check update trigger", emit showErrorMessage("check update trigger",
QString("invalid json ") + msg.mid(0, 20)); QString("invalid json ") + msg.mid(0, 20));
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL); emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
@ -514,8 +524,14 @@ bool Worker::updateTriggerSet() {
} }
if (!document.isObject()) { if (!document.isObject()) {
qCritical() << "FILE IS NOT A JSON OBJECT!"; qCritical() << "FILE IS NOT A JSON OBJECT!";
emit showErrorMessage("check update trigger", setProgress(100);
QString("not a json object") + msg); m_updateStatus = UpdateStatus(UPDATE_STATUS::JSON_PARSE_FAILURE,
QString("NOT A JSON-OBJECT %1").arg(msg));
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.jsonParseFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
m_updateStatus.m_statusDescription));
emit showErrorMessage("check update trigger", QString("not a json object") + msg);
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL); emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
return false; return false;
} }
@ -562,8 +578,44 @@ bool Worker::updateTriggerSet() {
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL); emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
return false; return false;
} }
qInfo() << "MACHINE-AND-CUSTOMER-CHECK" << m_updateStatus.m_statusDescription;
} else {
setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Dev_ID DOES NOT CONTAIN Custom_ID AND/OR Device_ID");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
m_updateStatus.m_statusDescription));
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
return false;
} }
} else {
setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Dev_ID KEY NOT A JSON-OBJECT");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
m_updateStatus.m_statusDescription));
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
return false;
} }
} else {
setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Dev_ID KEY NOT AVAILABLE");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
m_updateStatus.m_statusDescription));
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
return false;
} }
setProgress(progress + 1); setProgress(progress + 1);
@ -581,31 +633,72 @@ bool Worker::updateTriggerSet() {
<< "In updateTriggerSet() TRG value=<" << "In updateTriggerSet() TRG value=<"
<< triggerValue << ">"; << triggerValue << ">";
if (triggerValue == "WAIT") { if (triggerValue == "WAIT") {
setProgress(100); setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_TRIGGER_SET, m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_SANITY_CHECK_OK,
QString("UPDATE TRIGGER SET. CONTINUE. ")); QString("MACHINE-NR (%1) AND CUST-NR (%2) OK")
.arg(m_machineNr).arg(m_customerNr));
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.updateOfPSAContinues("MACHINE-AND-CUSTOMER-CHECK",
m_updateStatus.m_statusDescription));
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT, m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_TRIGGER_SET,
QString("#M=APISM#C=CMD_EVENT#J=") + QString("UPDATE TRIGGER SET. CONTINUE. "));
m_ismasClient.updateTriggerSet(m_updateStatus.m_statusDescription, "")); IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.updateTriggerSet(m_updateStatus.m_statusDescription, ""));
emit replaceLast("Update trigger set ...", UPDATE_STEP_OK); emit replaceLast("Update trigger set ...", UPDATE_STEP_OK);
return true; return true;
} else { } else {
emit showErrorMessage("check update trigger", // if the download-button once has the wrong value, it will never recover
QString ("TRG value=<") + triggerValue setProgress(100);
+ ">\n(reset download button?)"); m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
QThread::sleep(6); QString("TRIGGER-VALUE ") + triggerValue + " NOT 'WAIT'");
continue; IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
} QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
m_updateStatus.m_statusDescription));
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
return false;
} }
} else { } else {
emit showErrorMessage("check update trigger", "TRG key not contained"); setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"TRG KEY NOT AVAILABLE");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
m_updateStatus.m_statusDescription));
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
return false;
} }
} else { } else {
emit showErrorMessage("check update trigger", "Fileupload not a json-object"); setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Fileupload NOT A JSON-OBJECT");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
m_updateStatus.m_statusDescription));
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
return false;
} }
} else {
setProgress(100);
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_WAIT_STATE_CHECK_FAILURE,
"Fileupload KEY NOT AVAILABLE");
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
QString("#M=APISM#C=CMD_EVENT#J=") +
m_ismasClient.sanityCheckFailed(IsmasClient::RESULT_CODE::INSTALL_ERROR,
m_updateStatus.m_statusDescription));
emit replaceLast("Update trigger set ...", UPDATE_STEP_FAIL);
emit showErrorMessage("check update trigger", m_updateStatus.m_statusDescription);
return false;
} }
if (obj.contains("error")) { if (obj.contains("error")) {