Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -36,10 +36,10 @@ bool PpmHandler::init(MainDispatcher *mainDispatcher)
m_dtcPpm = ParticipantManagement::Interface::Dtc::create(m_mainDispatcher->ddsHandler()->ddsConnector());
DEBUG_LOG() << "-------------<><><>------" << m_mainDispatcher->exerciseId();
DEBUG_LOG(m_logger) << "-------------<><><>------" << m_mainDispatcher->exerciseId();
if (!m_dtcPpm->enableParticipant() || !m_dtcPpm->enableDynamicParticipantData() || !m_dtcPpm->enableParticipantPosition())
{
ERROR_LOG() << "Can not read data from Ppm";
ERROR_LOG(m_logger) << "Can not read data from Ppm";
return false;
}
@@ -70,7 +70,7 @@ void PpmHandler::modifyPartyAdlerProperties(const int wsId,
const ParticipantManagement::ConnectState &connectState,
const bool isVerbund)
{
DEBUG_LOG() << "modifyParty"
DEBUG_LOG(m_logger) << "modifyParty"
<< " assetId=" << assetId << " partyId=" << partyId << " saaName=" << saaName << " szenarName=" << szenarName << " connectState=" << connectState
<< " isVerbund=" << isVerbund;
@@ -93,11 +93,11 @@ void PpmHandler::modifyPartyAdlerProperties(const int wsId,
if (parserError.error != QJsonParseError::NoError)
{
ERROR_LOG() << "Error parsing json document: " << parserError.errorString() << " '" << propertiesBa << "'";
ERROR_LOG(m_logger) << "Error parsing json document: " << parserError.errorString() << " '" << propertiesBa << "'";
doc = QJsonDocument();
}
DEBUG_LOG() << "json to parse: " << doc.toJson();
DEBUG_LOG(m_logger) << "json to parse: " << doc.toJson();
QJsonObject obj(doc.object());
obj[QStringLiteral("Adler")] = adlerPropertiesObj;
@@ -110,11 +110,11 @@ void PpmHandler::modifyPartyAdlerProperties(const int wsId,
void PpmHandler::parseSQFS(const Feuerstellungsdaten &exSQFS, const int wsId)
{
DEBUG_LOG() << "Start parse SQFS";
DEBUG_LOG(m_logger) << "Start parse SQFS";
auto saa = m_mainDispatcher->jsonDispatcher()->getSAAByWs(wsId);
if (!saa)
{
ERROR_LOG() << "SQ WS from SAA but SAA with id " << wsId << " not found";
ERROR_LOG(m_logger) << "SQ WS from SAA but SAA with id " << wsId << " not found";
return;
}
const QString &verein = exSQFS.feuereinheit.verein;
@@ -179,7 +179,7 @@ void PpmHandler::parseSQFS(const Feuerstellungsdaten &exSQFS, const int wsId)
const auto root = findRootUnit(saa->getPartyId());
if (root.id() > 0)
{
DEBUG_LOG() << "Append FS Unit to root Unit";
DEBUG_LOG(m_logger) << "Append FS Unit to root Unit";
list.push_back(root);
}
@@ -214,11 +214,11 @@ void PpmHandler::parseSQFS(const Feuerstellungsdaten &exSQFS, const int wsId)
void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
{
DEBUG_LOG() << "Start parse SQWS";
DEBUG_LOG(m_logger) << "Start parse SQWS";
auto saa = m_mainDispatcher->jsonDispatcher()->getSAAByWs(wsId);
if (!saa)
{
ERROR_LOG() << "SQ WS from SAA but SAA with id " << wsId << " not found";
ERROR_LOG(m_logger) << "SQ WS from SAA but SAA with id " << wsId << " not found";
return;
}
const ProjectDataManagement::L27_EffectorId &internalName = exSQWS.kenner;
@@ -253,7 +253,7 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
if (pp.id() > 0)
{
DEBUG_LOG() << "Found Participant only update pos";
DEBUG_LOG(m_logger) << "Found Participant only update pos";
sendPositionFromTempMap(currentRandomNumber, saa->getPartyId(), saa->getIsVerbund());
sendChargesFromTempMap(currentRandomNumber, saa->getPartyId(), saa->getIsVerbund());
@@ -267,10 +267,10 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
const ParticipantManagement::Type type = m_dtcPpm->getTypeFromAdlerType(waffensystemtypMap.key(internalType.underlying()), false, saa->getIsVerbund());
DEBUG_LOG() << "found type with id: " << type.id() << " for name: " << waffensystemtypMap.key(internalType);
DEBUG_LOG(m_logger) << "found type with id: " << type.id() << " for name: " << waffensystemtypMap.key(internalType);
if (type.id() <= 0)
{
ERROR_LOG() << "NO Type Found";
ERROR_LOG(m_logger) << "NO Type Found";
return;
}
@@ -280,12 +280,12 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
uint superiorModId = QRandomGenerator::global()->generate() / 2;
ParticipantManagement::Participant pUnit = findParticipantByInternalName(verein, saa->getPartyId(), saa->getIsVerbund());
DEBUG_LOG() << "Looking for Verein: " << verein << " found Unit: " << pUnit.id() << " foundData: " << pUdata.modId();
DEBUG_LOG(m_logger) << "Looking for Verein: " << verein << " found Unit: " << pUnit.id() << " foundData: " << pUdata.modId();
if (pUdata.modId() > 0)
{
superiorModId = pUdata.modId();
DEBUG_LOG() << "FOUND UNIT in list use their modId " << superiorModId << " RND: " << currentRandomNumber;
DEBUG_LOG(m_logger) << "FOUND UNIT in list use their modId " << superiorModId << " RND: " << currentRandomNumber;
}
else if (pUnit.id() > 0)
{
@@ -296,7 +296,7 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
list.push_back(pUData);
m_tempPartDataList.insert(currentRandomNumber, list);
DEBUG_LOG() << "CREATE Uit from ppm " << superiorModId << " RND: " << currentRandomNumber;
DEBUG_LOG(m_logger) << "CREATE Uit from ppm " << superiorModId << " RND: " << currentRandomNumber;
ParticipantManagement::Participant tmp = pUnit;
while (tmp.superiorId() > 0)
{
@@ -314,11 +314,11 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
const auto root = findRootUnit(saa->getPartyId());
if (root.id() > 0)
{
DEBUG_LOG() << "Append to Unit" << superiorModId << " RND: " << currentRandomNumber;
DEBUG_LOG(m_logger) << "Append to Unit" << superiorModId << " RND: " << currentRandomNumber;
list.push_back(root);
}
const ParticipantManagement::Type unitType = m_dtcPpm->getTypeFromAdlerType(waffensystemtypMap.key(internalType), true, saa->getIsVerbund());
DEBUG_LOG() << "CREATE NEW Unit use supId" << superiorModId << " RND: " << currentRandomNumber;
DEBUG_LOG(m_logger) << "CREATE NEW Unit use supId" << superiorModId << " RND: " << currentRandomNumber;
ParticipantManagement::ParticipantData data;
data.id(0);
data.partyId(saa->getPartyId());
@@ -337,7 +337,7 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
list.push_back(data);
}
DEBUG_LOG() << "Create new Participant"
DEBUG_LOG(m_logger) << "Create new Participant"
<< " RND: " << currentRandomNumber;
ParticipantManagement::ParticipantData data;
@@ -366,11 +366,11 @@ void PpmHandler::parseSQWS(const Waffensystemdaten &exSQWS, const int wsId)
void PpmHandler::parseSQLP(const Ladeplatzdaten &exSQLP, const int wsId)
{
DEBUG_LOG() << "START parse SQLP";
DEBUG_LOG(m_logger) << "START parse SQLP";
auto saa = m_mainDispatcher->jsonDispatcher()->getSAAByWs(wsId);
if (!saa)
{
ERROR_LOG() << "SQ LP from SAA but SAA with id " << wsId << " not found";
ERROR_LOG(m_logger) << "SQ LP from SAA but SAA with id " << wsId << " not found";
return;
}
const QString &verein = exSQLP.einheit.verein;
@@ -409,7 +409,7 @@ void PpmHandler::parseSQLP(const Ladeplatzdaten &exSQLP, const int wsId)
DEBUG_LOG() << "Create new Participant LP";
DEBUG_LOG(m_logger) << "Create new Participant LP";
std::vector<ParticipantManagement::ParticipantData> list;
@@ -418,7 +418,7 @@ void PpmHandler::parseSQLP(const Ladeplatzdaten &exSQLP, const int wsId)
const auto root = findRootUnit(saa->getPartyId());
if (root.id() > 0)
{
DEBUG_LOG() << "Append LP to Unit";
DEBUG_LOG(m_logger) << "Append LP to Unit";
list.push_back(root);
}
@@ -471,7 +471,7 @@ void PpmHandler::removeAllSAAParticipants(const int partyId)
list.push_back(pToDel);
}
req.data(list);
DEBUG_LOG() << "Remove all participants (without Units): " << list.size();
DEBUG_LOG(m_logger) << "Remove all participants (without Units): " << list.size();
m_ftcPpm->modifyParticipantDataRequest(req, this);
}
@@ -676,7 +676,7 @@ void PpmHandler::onSendParticipantDataTimeout()
{
m_sendParticipantDataTimer->stop();
if (m_randomNumbers.empty())
ERROR_LOG() << "Cant Send ParticipantData RandomNumbers is empty";
ERROR_LOG(m_logger) << "Cant Send ParticipantData RandomNumbers is empty";
ParticipantManagement::ModifyParticipantDataRequest *newRequest = new ParticipantManagement::ModifyParticipantDataRequest();
int currentRandomNumber = m_randomNumbers.first();
newRequest->requestId(currentRandomNumber);
@@ -707,7 +707,7 @@ void PpmHandler::handleParticipantPositionChangedExternal(const ParticipantManag
void PpmHandler::handleParticipantPositionChangedInternal(const ParticipantManagement::ParticipantPosition &position)
{
DEBUG_LOG() << "handleParticipantPositionChangedInternal";
DEBUG_LOG(m_logger) << "handleParticipantPositionChangedInternal";
ParticipantManagement::Participant part = m_dtcPpm->participant(position.participantId());
const bool hasMountedParticipants = position.mountedParticipants().is_set() && position.mountedParticipants().get().size() > 0;
@@ -739,7 +739,7 @@ void PpmHandler::handleParticipantPositionChangedInternal(const ParticipantManag
void PpmHandler::sendParticipantMount(const ParticipantManagement::Participant &part, const ParticipantManagement::Participant &partToBeMounted)
{
m_mountedParticipants.insert(part.equipmentNumber().get(), partToBeMounted.equipmentNumber().get());
ERROR_LOG() << "Mount Participant";
ERROR_LOG(m_logger) << "Mount Participant";
QJsonObject telegram;
telegram[QStringLiteral("type")] = QStringLiteral("UFomHlaParticipantMount");
@@ -759,7 +759,7 @@ void PpmHandler::sendParticipantMount(const ParticipantManagement::Participant &
void PpmHandler::sendParticipantUnmount(const ParticipantManagement::Participant &participant)
{
m_mountedParticipants.remove(participant.equipmentNumber().get());
DEBUG_LOG() << "Unmount Participant";
DEBUG_LOG(m_logger) << "Unmount Participant";
QJsonObject telegram;
telegram[QStringLiteral("type")] = QStringLiteral("UFomHlaParticipantUnmount");
@@ -800,7 +800,7 @@ void PpmHandler::sendParticipantPositionChanged(const ParticipantManagement::Par
void PpmHandler::onModifyParticipantDataReply(const Core::FunctionReplyObject &reply)
{
DEBUG_LOG() << "Got Function Reply " << reply.str();
DEBUG_LOG(m_logger) << "Got Function Reply " << reply.str();
if (!reply.error())
{
@@ -815,7 +815,7 @@ void PpmHandler::onModifyParticipantDataReply(const Core::FunctionReplyObject &r
const bool isVerbund = m_mainDispatcher->jsonDispatcher()->getSAAByParty(partyId)->getIsVerbund();
DEBUG_LOG() << "Got ModifyParticipant Reply SEND from temp Maps (partyId: " << partyId << " , isVerbund: " << isVerbund << ")";
DEBUG_LOG(m_logger) << "Got ModifyParticipant Reply SEND from temp Maps (partyId: " << partyId << " , isVerbund: " << isVerbund << ")";
if (m_tempPositionMap.contains(reply.id()))
sendPositionFromTempMap(reply.id(), partyId, isVerbund);
@@ -828,7 +828,7 @@ void PpmHandler::onModifyParticipantDataReply(const Core::FunctionReplyObject &r
}
else
{
ERROR_LOG() << "GOT ModifyParticipant Replay with error " << reply.translated();
ERROR_LOG(m_logger) << "GOT ModifyParticipant Replay with error " << reply.translated();
}
@@ -845,7 +845,7 @@ void PpmHandler::onModifyParticipantDataReply(const Core::FunctionReplyObject &r
m_tempPartDataList.remove(reply.id());
}
void PpmHandler::onModifyPartyDataReply(const Core::FunctionReplyObject &reply) { DEBUG_LOG() << "Got Function Reply " << reply.str(); }
void PpmHandler::onModifyPartyDataReply(const Core::FunctionReplyObject &reply) { DEBUG_LOG(m_logger) << "Got Function Reply " << reply.str(); }
QList<ParticipantManagement::Participant> PpmHandler::findAllSAAParticipants(const int partyId)
{
@@ -908,7 +908,7 @@ ParticipantManagement::ParticipantData PpmHandler::findRootUnit(const int partyI
ParticipantManagement::Participant PpmHandler::findParticipantByInternalName(const QString &internalName, const int partyId, const bool isVerbund)
{
ParticipantManagement::Participant pp;
DEBUG_LOG() << "START find participant: " << internalName;
DEBUG_LOG(m_logger) << "START find participant: " << internalName;
auto participantMap = m_dtcPpm->participants();
for (const auto &part : std::as_const(participantMap))
{
@@ -931,13 +931,13 @@ ParticipantManagement::Participant PpmHandler::findParticipantByInternalName(con
void PpmHandler::onPartyChanged(const ParticipantManagement::Party &data, DataModification modType)
{
DEBUG_LOG() << Q_FUNC_INFO << ", modType: " << modType;
DEBUG_LOG(m_logger) << Q_FUNC_INFO << ", modType: " << modType;
if (modType == DataModification::eRemoved)
return;
const ParticipantManagement::ConnectState connectState = m_dtcPpm->saaConnectedState(data.id());
DEBUG_LOG() << "++++ connectState: " << connectState;
DEBUG_LOG(m_logger) << "++++ connectState: " << connectState;
if (connectState != ParticipantManagement::ConnectState::Disconnecting)
@@ -947,7 +947,7 @@ void PpmHandler::onPartyChanged(const ParticipantManagement::Party &data, DataMo
if (!saa)
return;
DEBUG_LOG() << "++++ szenarName: " << saa->getSzenarName() << ", wsId: " << saa->getWsId();
DEBUG_LOG(m_logger) << "++++ szenarName: " << saa->getSzenarName() << ", wsId: " << saa->getWsId();
EXStatus status;
status.status = Szenarstatus::Gestoppt;
@@ -1015,7 +1015,7 @@ void PpmHandler::sendChargesFromTempMap(const int rndNmbr, const int partyId, co
if (chargeTypeId <= 0)
continue;
DEBUG_LOG() << "---- participant.id:" << participant.id() << (participant.typeId() == type.id() ? " (Ladeplatz)" : "");
DEBUG_LOG(m_logger) << "---- participant.id:" << participant.id() << (participant.typeId() == type.id() ? " (Ladeplatz)" : "");
QVector<int> gearTypesIds = m_mainDispatcher->pdmHandler()->getDtc()->gearTypeIdFromChargeTypeId(chargeTypeId);
@@ -1059,7 +1059,7 @@ int PpmHandler::convertStatus_L28(const ProjectDataManagement::L28_Status &statu
return ADLER_NOT_OPERATIONAL;
default:
WARNING_LOG() << "Status " << status << " not handled in switch";
WARNING_LOG(m_logger) << "Status " << status << " not handled in switch";
break;
}