From 34799c5814a3e324a1a78b8cdb006896ddf354de Mon Sep 17 00:00:00 2001 From: krivoshein Date: Tue, 3 Feb 2026 17:57:45 +0300 Subject: [PATCH] bugFix refact 0 --- .../Core/recognizesystem.cpp | 40 ++++++------------- LibInstructorsAndTrainees/metatypes.cpp | 8 ---- LibInstructorsAndTrainees/metatypes.h | 5 +-- LibServer/Systems/processingsystem.cpp | 8 ---- LibServer/Systems/sendsystem.cpp | 2 - 5 files changed, 13 insertions(+), 50 deletions(-) diff --git a/LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp b/LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp index cbc524a..531c65f 100644 --- a/LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp +++ b/LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp @@ -154,7 +154,7 @@ void RecognizeSystem::recognize(QTcpSocket *socket) continue; } - quint64 toFile = file.write(tmpBlock); + qint64 toFile = file.write(tmpBlock); emit sigSendDebugLog(Tools::getTime() + "CLIENT: toFile :" + toFile); sizeReceiveData += toFile; @@ -278,12 +278,8 @@ void RecognizeSystem::recognize(QTcpSocket *socket) emit signal_AnswerDocsChanged(); } - //if(packetType == PacketType::TYPE_XMLANSWER_QUERY_LIST_SUB_PROC_AMM) - //{ - //} - - //А)xml-ответы на запросы к БД + //А)xml-ответы на запросы к БД (или автоматическая рассылка) //B)перечни Подпроцедур switch(packetType) { @@ -304,15 +300,16 @@ void RecognizeSystem::recognize(QTcpSocket *socket) stream.startTransaction(); stream >> fileSize; - if(!stream.commitTransaction()){ + if(!stream.commitTransaction()) + { emit sigSendDebugLog(Tools::getTime() + "CLIENT: fileSize - FAIL commitTransaction"); - if (!socket->waitForReadyRead(TCP_READ_TIMEOUT)) { + if (!socket->waitForReadyRead(TCP_READ_TIMEOUT)) + { emit sigSendDebugLog(Tools::getTime() + "CLIENT: ERROR! readyRead timeout - fileSize!!!"); return; } continue; - } emit sigSendDebugLog("CLIENT: filesize: " + QString::number(fileSize)); @@ -332,13 +329,16 @@ void RecognizeSystem::recognize(QTcpSocket *socket) stream.startTransaction(); stream >> tmpBlock; - if(!stream.commitTransaction()){ + if(!stream.commitTransaction()) + { - if(socket->state() == QAbstractSocket::UnconnectedState){ + if(socket->state() == QAbstractSocket::UnconnectedState) + { emit sigSocketDisabled(); return; } - if(socket->waitForReadyRead(TCP_READ_TIMEOUT)){ + if(socket->waitForReadyRead(TCP_READ_TIMEOUT)) + { continue; } @@ -349,7 +349,6 @@ void RecognizeSystem::recognize(QTcpSocket *socket) emit sigSendDebugLog(Tools::getTime() + "CLIENT: toFile :" + array.size()); - //sizeReceiveData += array.size(); sizeReceiveData = array.size(); countSend++; @@ -384,21 +383,6 @@ void RecognizeSystem::recognize(QTcpSocket *socket) } packetType = PacketType::TYPE_NONE; - - - - /* - QByteArray array; - stream.startTransaction(); - stream >> array; - - if(!stream.commitTransaction()) - continue; - - xmlParserQueryToDB(packetType, array); - - packetType = PacketType::TYPE_NONE; - */ } break; }; diff --git a/LibInstructorsAndTrainees/metatypes.cpp b/LibInstructorsAndTrainees/metatypes.cpp index 54815e6..d2736ca 100644 --- a/LibInstructorsAndTrainees/metatypes.cpp +++ b/LibInstructorsAndTrainees/metatypes.cpp @@ -1,7 +1,6 @@ #include "metatypes.h" - void registerMetaType() { qRegisterMetaType>("QList"); @@ -11,16 +10,9 @@ void registerMetaType() qRegisterMetaType>("QList"); qRegisterMetaType>("QList"); qRegisterMetaType>("QList"); - //qRegisterMetaType>>("QMap>"); - - qRegisterMetaType("MapListsTasksAllTraineeType"); - qRegisterMetaType("PacketType"); qRegisterMetaType("ClientMessage"); qRegisterMetaType>("QList"); - qRegisterMetaType>("QList"); - - qRegisterMetaType>("QMap"); } diff --git a/LibInstructorsAndTrainees/metatypes.h b/LibInstructorsAndTrainees/metatypes.h index 8117d8f..4334053 100644 --- a/LibInstructorsAndTrainees/metatypes.h +++ b/LibInstructorsAndTrainees/metatypes.h @@ -2,7 +2,6 @@ #define METATYPES_H #include -#include #include "instructor.h" #include "trainee.h" @@ -25,12 +24,10 @@ Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(MapListsTasksAllTraineeType) Q_DECLARE_METATYPE(PacketType) Q_DECLARE_METATYPE(ClientMessage) Q_DECLARE_METATYPE(QList) - -Q_DECLARE_METATYPE(MapListsTasksAllTraineeType) - Q_DECLARE_METATYPE(QList) #endif // METATYPES_H diff --git a/LibServer/Systems/processingsystem.cpp b/LibServer/Systems/processingsystem.cpp index 90ec1fc..bbc3a30 100644 --- a/LibServer/Systems/processingsystem.cpp +++ b/LibServer/Systems/processingsystem.cpp @@ -330,14 +330,6 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu //Отправка списка задач AMM всех обучаемых клиенту GUI sendListsTasksAMMofAllTraineestoClient(client, listTrainees); } - /* - for(Trainee trainee : listTrainees) - { - //Отправка списка задач AMM этого обучаемого клиенту GUI - sendListTasksAMMofTraineetoClient(client, trainee.getID()); - //Отправка списка задач FIM этого обучаемого клиенту GUI - sendListTasksFIMofTraineetoClient(client, trainee.getID()); - }*/ break; } diff --git a/LibServer/Systems/sendsystem.cpp b/LibServer/Systems/sendsystem.cpp index ab10ae7..ab8fe44 100644 --- a/LibServer/Systems/sendsystem.cpp +++ b/LibServer/Systems/sendsystem.cpp @@ -97,14 +97,12 @@ void SendSystem::sendFileBlockByteArray(QByteArray array, PacketType packetType) stream << packetType; //Отправляем тип блока stream << size; - //while (size > 0) while (bytesSended < size) { QByteArray chunk = array.mid(bytesSended,sendFileBlockSize); stream << chunk; bytesSended += chunk.length(); - //size -= bytesSended; } } else