bugFix Блочная передача больших данных

This commit is contained in:
2026-02-03 17:22:52 +03:00
parent 4a24f6fc29
commit 60534ebef4
17 changed files with 431 additions and 8 deletions

View File

@@ -294,6 +294,8 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
case TYPE_XMLANSWER_QUERY_DB__LIST_CLASSROOMS:
case TYPE_XMLANSWER_QUERY_TASKS_AMM_FOR_TRAINEE:
case TYPE_XMLANSWER_QUERY_TASKS_FIM_FOR_TRAINEE:
case TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_ALL_TRAINEES:
case TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_ALL_TRAINEES:
case TYPE_XMLANSWER_QUERY_LIST_SUB_PROC_AMM:
{
//ПОЛУЧЕНИЕ РАЗМЕРА ФАЙЛА
@@ -347,12 +349,15 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
emit sigSendDebugLog(Tools::getTime() + "CLIENT: toFile :" + array.size());
sizeReceiveData += array.size();
//sizeReceiveData += array.size();
sizeReceiveData = array.size();
countSend++;
tmpBlock.clear();
if(sizeReceiveData == fileSize){
//if(sizeReceiveData == fileSize)
if(sizeReceiveData >= fileSize)
{
emit sigSendDebugLog(Tools::getTime() + "FINAL Count send: " + QString::number(countSend));
emit sigSendDebugLog(Tools::getTime() + "FINAL Size received: " + QString::number(sizeReceiveData));
emit sigSendDebugLog(Tools::getTime() + "FINAL File size" + QString::number(fileSize));
@@ -952,6 +957,164 @@ void RecognizeSystem::xmlParserQueryToDB(PacketType packetType, QByteArray array
emit sigAnswerQueryToDB_ListTasksFIMforTrainee(listTasks, trainee_id);
}
break;
case TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_ALL_TRAINEES:
{
QMap<int, QList<TaskAmmFim> > mapOfLists;
QDomNode listsAllNode = commonDOM.namedItem("ListsTasksAMMofAllTrainees");
for(int i = 0; i < listsAllNode.childNodes().count(); i++)
{
QDomNode listOneNode = listsAllNode.childNodes().at(i);
if(listOneNode.nodeName() == "ListTasksAMM")
{
QList<TaskAmmFim> listTasks;
int trainee_id = 0;
trainee_id = listOneNode.toElement().attribute("trainee_id").toInt();
for(int i = 0; i < listOneNode.childNodes().count(); i++)
{
QDomNode taskNode = listOneNode.childNodes().at(i);
if(taskNode.nodeName() == "taskAMM")
{//Задача
TaskAmmFim task;
task.setID(taskNode.toElement().attribute("task_id").toInt());
task.ammProcedure.title = taskNode.toElement().attribute("title");
task.ammProcedure.dmCode = taskNode.toElement().attribute("dmCode");
task.status = taskNode.toElement().attribute("status");
for(int j = 0; j < taskNode.childNodes().count(); j++)
{
QDomNode subProcNode = taskNode.childNodes().at(j);
if(subProcNode.nodeName() == "SubProc")
{//Подпроцедура
SubProc subProc;
subProc.setDmCode(subProcNode.toElement().attribute("dmCode"));
subProc.setTitle(subProcNode.toElement().attribute("title"));
subProc.setModeListStr(subProcNode.toElement().attribute("canplay"));
task.listSubProc.append(subProc);
}
}
listTasks.append(task);
}
}
mapOfLists.insert(trainee_id, listTasks);
}
}
emit sigAnswerQueryToDB_ListsTasksAMMofAllTrainees(mapOfLists);
}
break;
case TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_ALL_TRAINEES:
{
QMap<int, QList<TaskAmmFim> > mapOfLists;
QDomNode listsAllNode = commonDOM.namedItem("ListsTasksFIMofAllTrainees");
for(int i = 0; i < listsAllNode.childNodes().count(); i++)
{
QDomNode listOneNode = listsAllNode.childNodes().at(i);
if(listOneNode.nodeName() == "ListTasksFIM")
{
QList<TaskAmmFim> listTasks;
int trainee_id = 0;
trainee_id = listOneNode.toElement().attribute("trainee_id").toInt();
for(int i = 0; i < listOneNode.childNodes().count(); i++)
{//Задачи
QDomNode taskNode = listOneNode.childNodes().at(i);
if(taskNode.nodeName() == "taskFIM")
{
TaskAmmFim task;
task.setID(taskNode.toElement().attribute("task_id").toInt());
task.title = taskNode.toElement().attribute("title");
task.status = taskNode.toElement().attribute("status");
for(int j = 0; j < taskNode.childNodes().count(); j++)
{
QDomNode malfOrReportNode = taskNode.childNodes().at(j);
if(malfOrReportNode.nodeName() == "malfunction")
{//Неисправность
Malfunction malfunction;
malfunction.num = malfOrReportNode.toElement().attribute("num");
malfunction.dmCode = malfOrReportNode.toElement().attribute("dmCode");
malfunction.description = malfOrReportNode.toElement().attribute("description");
malfunction.goName = malfOrReportNode.toElement().attribute("goName");
malfunction.objName = malfOrReportNode.toElement().attribute("objName");
for(int s = 0; s < malfOrReportNode.childNodes().count(); s++)
{
QDomNode signNode = malfOrReportNode.childNodes().at(s);
if(signNode.nodeName() == "malfunctionSign")
{
MalfunctionSign sign;
sign.type = signNode.toElement().attribute("type").toInt();
sign.description = signNode.toElement().attribute("description");
malfunction.malfunctionSigns.append(sign);
}
}
task.malfunctionList.append(malfunction);
}
else
if(malfOrReportNode.nodeName() == "report")
{//Отчет
FIMReport report;
report.id = malfOrReportNode.toElement().attribute("report_id").toInt();
report.mmel = malfOrReportNode.toElement().attribute("mmel") == "true" ? true : false;
for(int k = 0; k < malfOrReportNode.childNodes().count(); k++)
{
QDomNode reportItemNode = malfOrReportNode.childNodes().at(k);
if(reportItemNode.nodeName() == "reportItem")
{
FIMReportItem reportItem;
reportItem.id = reportItemNode.toElement().attribute("item_id").toInt();
reportItem.text = reportItemNode.toElement().attribute("text");
if(reportItemNode.childNodes().count())
{
QDomNode procedureIDNode = reportItemNode.childNodes().at(0);
reportItem.procedure.doc = procedureIDNode.toElement().attribute("doc");
reportItem.procedure.title = procedureIDNode.toElement().attribute("title");
reportItem.procedure.dmCode = procedureIDNode.toElement().attribute("dmCode");
reportItem.procedure.result = procedureIDNode.toElement().attribute("result");
}
report.itemList.append(reportItem);
}
else if(reportItemNode.nodeName() == "reportWHItem")
{
FIMReportWarehouseItem reportWhItem;
reportWhItem.id = reportItemNode.toElement().attribute("wh_item_id").toInt();
reportWhItem.status = reportItemNode.toElement().attribute("status").toInt();
reportWhItem.goName = reportItemNode.toElement().attribute("goName");
reportWhItem.objName = reportItemNode.toElement().attribute("objName");
reportWhItem.code = reportItemNode.toElement().attribute("code");
report.warehouseItemList.append(reportWhItem);
}
}
task.report = report;
}
}
listTasks.append(task);
}
}
mapOfLists.insert(trainee_id, listTasks);
}
}
emit sigAnswerQueryToDB_ListsTasksFIMofAllTrainees(mapOfLists);
}
break;
};
}