mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Merge branch 'work41' into DEV
This commit is contained in:
@@ -5,7 +5,8 @@ common_info_for_project(DataBaseInterface)
|
|||||||
add_library(DataBaseInterface SHARED
|
add_library(DataBaseInterface SHARED
|
||||||
DataBaseLMS_global.h
|
DataBaseLMS_global.h
|
||||||
databaselms.cpp
|
databaselms.cpp
|
||||||
databaselms_tasks.cpp
|
databaselms_tasks_amm.cpp
|
||||||
|
databaselms_tasks_fim.cpp
|
||||||
databaselms_groups.cpp
|
databaselms_groups.cpp
|
||||||
databaselms_users.cpp
|
databaselms_users.cpp
|
||||||
databaselms_instructors.cpp
|
databaselms_instructors.cpp
|
||||||
|
|||||||
314
LibDataBaseInterface/databaselms_tasks_amm.cpp
Normal file
314
LibDataBaseInterface/databaselms_tasks_amm.cpp
Normal file
@@ -0,0 +1,314 @@
|
|||||||
|
#include "databaselms.h"
|
||||||
|
|
||||||
|
#include <QtSql>
|
||||||
|
#include <QSqlDatabase>
|
||||||
|
#include <QSqlDriver>
|
||||||
|
|
||||||
|
int DataBaseLMS::insertTaskAMM(TaskAmmFim task, int id_trainee)
|
||||||
|
{
|
||||||
|
QString queryStr;
|
||||||
|
bool resBool = false;
|
||||||
|
|
||||||
|
resBool = db->transaction();
|
||||||
|
|
||||||
|
task.ammProcedure.title = task.ammProcedure.title.replace("'", "''"); //Задваиваем одинарные кавычки
|
||||||
|
|
||||||
|
queryStr = QString("INSERT INTO public.tasks_amm (title, dm_code, fk_trainee_id) "
|
||||||
|
"VALUES ('%1', '%2', %3) "
|
||||||
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
|
task.ammProcedure.title,
|
||||||
|
task.ammProcedure.dmCode,
|
||||||
|
QString::number(id_trainee));
|
||||||
|
|
||||||
|
int task_id = queryExecInt(queryStr);
|
||||||
|
if(!task_id)
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(SubProc subProc : task.listSubProc)
|
||||||
|
{
|
||||||
|
subProc.setTitle(subProc.getTitle().replace("'", "''")); //Задваиваем одинарные кавычки
|
||||||
|
|
||||||
|
queryStr = QString("INSERT INTO public.subprocs (dm_code, title, canplay, fk_task_amm_id) "
|
||||||
|
"VALUES ('%1', '%2', '%3', %4) "
|
||||||
|
"RETURNING subprocs.subproc_id").arg(
|
||||||
|
subProc.getDmCode(),
|
||||||
|
subProc.getTitle(),
|
||||||
|
subProc.getModeListStr(),
|
||||||
|
QString::number(task_id));
|
||||||
|
|
||||||
|
int subproc_id = queryExecInt(queryStr);
|
||||||
|
if(!subproc_id)
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resBool = db->commit();
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::updateTaskAMM(TaskAmmFim task)
|
||||||
|
{
|
||||||
|
task.ammProcedure.title = task.ammProcedure.title.replace("'", "''"); //Задваиваем одинарные кавычки
|
||||||
|
|
||||||
|
QString queryStr = QString("UPDATE public.tasks_amm SET title = '%1', dm_code = '%2', status = '%3' "
|
||||||
|
"WHERE task_id = %4 "
|
||||||
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
|
task.ammProcedure.title,
|
||||||
|
task.ammProcedure.dmCode,
|
||||||
|
task.status,
|
||||||
|
QString::number(task.getID()) );
|
||||||
|
|
||||||
|
return queryExecInt(queryStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::updateStatusTaskAMM(int task_id, QString status)
|
||||||
|
{
|
||||||
|
QString queryStr;
|
||||||
|
bool resBool = false;
|
||||||
|
int id_trainee = 0;
|
||||||
|
|
||||||
|
resBool = db->transaction();
|
||||||
|
|
||||||
|
queryStr = QString("SELECT users.user_id "
|
||||||
|
"FROM public.users JOIN public.tasks_amm ON users.user_id = tasks_amm.fk_trainee_id "
|
||||||
|
"WHERE tasks_amm.task_id = %1 "
|
||||||
|
"ORDER BY users.user_id ASC").arg(
|
||||||
|
QString::number(task_id));
|
||||||
|
|
||||||
|
QSqlQuery query = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &query))
|
||||||
|
{
|
||||||
|
if (query.first())
|
||||||
|
{//Обучаемый
|
||||||
|
id_trainee = query.value(0).toInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!id_trainee)
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
queryStr = QString("UPDATE public.tasks_amm SET status = '%1' "
|
||||||
|
"WHERE task_id = %2 "
|
||||||
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
|
status,
|
||||||
|
QString::number(task_id) );
|
||||||
|
|
||||||
|
|
||||||
|
if(!queryExecInt(queryStr))
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
resBool = db->commit();
|
||||||
|
return id_trainee;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataBaseLMS::deleteTaskAMM(int id_task)
|
||||||
|
{
|
||||||
|
QString queryStr;
|
||||||
|
bool resBool = false;
|
||||||
|
int id_trainee = 0;
|
||||||
|
|
||||||
|
resBool = db->transaction();
|
||||||
|
|
||||||
|
queryStr = QString("SELECT users.user_id "
|
||||||
|
"FROM public.users JOIN public.tasks_amm ON users.user_id = tasks_amm.fk_trainee_id "
|
||||||
|
"WHERE tasks_amm.task_id = %1 "
|
||||||
|
"ORDER BY users.user_id ASC").arg(
|
||||||
|
QString::number(id_task));
|
||||||
|
|
||||||
|
QSqlQuery queryUserSEL = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &queryUserSEL))
|
||||||
|
{
|
||||||
|
if (queryUserSEL.first())
|
||||||
|
{//Обучаемый
|
||||||
|
id_trainee = queryUserSEL.value(0).toInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!id_trainee)
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
queryStr = QString("DELETE FROM public.subprocs "
|
||||||
|
"WHERE fk_task_amm_id = %1 ").arg(
|
||||||
|
QString::number(id_task));
|
||||||
|
|
||||||
|
QSqlQuery querySubProcDEL = QSqlQuery(*db);
|
||||||
|
if(!queryExec(queryStr, &querySubProcDEL))
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------
|
||||||
|
queryStr = QString("DELETE FROM public.tasks_amm "
|
||||||
|
"WHERE task_id = %1 "
|
||||||
|
"RETURNING tasks_amm.task_id").arg(
|
||||||
|
QString::number(id_task));
|
||||||
|
|
||||||
|
if(!queryExecInt(queryStr))
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
resBool = db->commit();
|
||||||
|
return id_trainee;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<TaskAmmFim> DataBaseLMS::selectTasksAMMofTrainee(int id_trainee)
|
||||||
|
{
|
||||||
|
QList<TaskAmmFim> listTasks;
|
||||||
|
QString queryStr;
|
||||||
|
bool resBool = false;
|
||||||
|
|
||||||
|
resBool = db->transaction();
|
||||||
|
|
||||||
|
queryStr = QString("SELECT tasks_amm.task_id, tasks_amm.title, tasks_amm.dm_code, tasks_amm.status, "
|
||||||
|
"users.user_id "
|
||||||
|
"FROM public.tasks_amm JOIN public.users ON users.user_id = tasks_amm.fk_trainee_id "
|
||||||
|
"WHERE tasks_amm.fk_trainee_id = %1 "
|
||||||
|
"ORDER BY tasks_amm.task_id ASC").arg(
|
||||||
|
id_trainee);
|
||||||
|
|
||||||
|
QSqlQuery query = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &query))
|
||||||
|
{
|
||||||
|
while (query.next())
|
||||||
|
{//Задача
|
||||||
|
TaskAmmFim task;
|
||||||
|
|
||||||
|
task.setID(query.value(0).toInt());
|
||||||
|
task.ammProcedure.title = query.value(1).toString();
|
||||||
|
task.ammProcedure.dmCode = query.value(2).toString();
|
||||||
|
task.status = query.value(3).toString();
|
||||||
|
|
||||||
|
//Выгребаем все subproc для этой задачи
|
||||||
|
queryStr = QString("SELECT subprocs.subproc_id, subprocs.dm_code, subprocs.title, subprocs.canplay, "
|
||||||
|
"tasks_amm.task_id "
|
||||||
|
"FROM public.subprocs JOIN public.tasks_amm ON tasks_amm.task_id = subprocs.fk_task_amm_id "
|
||||||
|
"WHERE subprocs.fk_task_amm_id = %1 "
|
||||||
|
"ORDER BY subprocs.subproc_id ASC").arg(
|
||||||
|
task.getID());
|
||||||
|
|
||||||
|
QSqlQuery querySubProc = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &querySubProc))
|
||||||
|
{
|
||||||
|
while (querySubProc.next())
|
||||||
|
{//Подпроцедура
|
||||||
|
SubProc subProc;
|
||||||
|
int subproc_id = 0;
|
||||||
|
|
||||||
|
subproc_id = querySubProc.value(0).toString().toInt();
|
||||||
|
subProc.setDmCode(querySubProc.value(1).toString());
|
||||||
|
subProc.setTitle(querySubProc.value(2).toString());
|
||||||
|
subProc.setModeListStr(querySubProc.value(3).toString());
|
||||||
|
|
||||||
|
task.listSubProc.append(subProc);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return QList<TaskAmmFim>();
|
||||||
|
}
|
||||||
|
|
||||||
|
listTasks.append(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return QList<TaskAmmFim>();
|
||||||
|
}
|
||||||
|
|
||||||
|
resBool = db->commit();
|
||||||
|
return listTasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskAmmFim DataBaseLMS::selectTaskAMMbyID(int id_task)
|
||||||
|
{
|
||||||
|
TaskAmmFim task;
|
||||||
|
|
||||||
|
QString queryStr;
|
||||||
|
bool resBool = false;
|
||||||
|
|
||||||
|
resBool = db->transaction();
|
||||||
|
|
||||||
|
queryStr = QString("SELECT tasks_amm.task_id, tasks_amm.title, tasks_amm.dm_code, tasks_amm.status "
|
||||||
|
"FROM public.tasks_amm "
|
||||||
|
"WHERE tasks_amm.task_id = %1 "
|
||||||
|
"ORDER BY tasks_amm.task_id ASC").arg(
|
||||||
|
id_task);
|
||||||
|
|
||||||
|
QSqlQuery query = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &query))
|
||||||
|
{
|
||||||
|
if (query.first())
|
||||||
|
{//Задача
|
||||||
|
task.setID(query.value(0).toInt());
|
||||||
|
task.ammProcedure.title = query.value(1).toString();
|
||||||
|
task.ammProcedure.dmCode = query.value(2).toString();
|
||||||
|
task.status = query.value(3).toString();
|
||||||
|
|
||||||
|
//Выгребаем все subproc для этой задачи
|
||||||
|
queryStr = QString("SELECT subprocs.subproc_id, subprocs.dm_code, subprocs.title, subprocs.canplay, "
|
||||||
|
"tasks_amm.task_id "
|
||||||
|
"FROM public.subprocs JOIN public.tasks_amm ON tasks_amm.task_id = subprocs.fk_task_amm_id "
|
||||||
|
"WHERE subprocs.fk_task_amm_id = %1 "
|
||||||
|
"ORDER BY subprocs.subproc_id ASC").arg(
|
||||||
|
task.getID());
|
||||||
|
|
||||||
|
QSqlQuery querySubProc = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &querySubProc))
|
||||||
|
{
|
||||||
|
while (querySubProc.next())
|
||||||
|
{//Подпроцедура
|
||||||
|
SubProc subProc;
|
||||||
|
int subproc_id = 0;
|
||||||
|
|
||||||
|
subproc_id = querySubProc.value(0).toString().toInt();
|
||||||
|
subProc.setDmCode(querySubProc.value(1).toString());
|
||||||
|
subProc.setTitle(querySubProc.value(2).toString());
|
||||||
|
subProc.setModeListStr(querySubProc.value(3).toString());
|
||||||
|
|
||||||
|
task.listSubProc.append(subProc);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return TaskAmmFim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return TaskAmmFim();
|
||||||
|
}
|
||||||
|
|
||||||
|
resBool = db->commit();
|
||||||
|
return task;
|
||||||
|
}
|
||||||
@@ -4,316 +4,6 @@
|
|||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QSqlDriver>
|
#include <QSqlDriver>
|
||||||
|
|
||||||
int DataBaseLMS::insertTaskAMM(TaskAmmFim task, int id_trainee)
|
|
||||||
{
|
|
||||||
QString queryStr;
|
|
||||||
bool resBool = false;
|
|
||||||
|
|
||||||
resBool = db->transaction();
|
|
||||||
|
|
||||||
task.ammProcedure.title = task.ammProcedure.title.replace("'", "''"); //Задваиваем одинарные кавычки
|
|
||||||
|
|
||||||
queryStr = QString("INSERT INTO public.tasks_amm (title, dm_code, fk_trainee_id) "
|
|
||||||
"VALUES ('%1', '%2', %3) "
|
|
||||||
"RETURNING tasks_amm.task_id").arg(
|
|
||||||
task.ammProcedure.title,
|
|
||||||
task.ammProcedure.dmCode,
|
|
||||||
QString::number(id_trainee));
|
|
||||||
|
|
||||||
int task_id = queryExecInt(queryStr);
|
|
||||||
if(!task_id)
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for(SubProc subProc : task.listSubProc)
|
|
||||||
{
|
|
||||||
subProc.setTitle(subProc.getTitle().replace("'", "''")); //Задваиваем одинарные кавычки
|
|
||||||
|
|
||||||
queryStr = QString("INSERT INTO public.subprocs (dm_code, title, canplay, fk_task_amm_id) "
|
|
||||||
"VALUES ('%1', '%2', '%3', %4) "
|
|
||||||
"RETURNING subprocs.subproc_id").arg(
|
|
||||||
subProc.getDmCode(),
|
|
||||||
subProc.getTitle(),
|
|
||||||
subProc.getModeListStr(),
|
|
||||||
QString::number(task_id));
|
|
||||||
|
|
||||||
int subproc_id = queryExecInt(queryStr);
|
|
||||||
if(!subproc_id)
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
resBool = db->commit();
|
|
||||||
return task_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DataBaseLMS::updateTaskAMM(TaskAmmFim task)
|
|
||||||
{
|
|
||||||
task.ammProcedure.title = task.ammProcedure.title.replace("'", "''"); //Задваиваем одинарные кавычки
|
|
||||||
|
|
||||||
QString queryStr = QString("UPDATE public.tasks_amm SET title = '%1', dm_code = '%2', status = '%3' "
|
|
||||||
"WHERE task_id = %4 "
|
|
||||||
"RETURNING tasks_amm.task_id").arg(
|
|
||||||
task.ammProcedure.title,
|
|
||||||
task.ammProcedure.dmCode,
|
|
||||||
task.status,
|
|
||||||
QString::number(task.getID()) );
|
|
||||||
|
|
||||||
return queryExecInt(queryStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int DataBaseLMS::updateStatusTaskAMM(int task_id, QString status)
|
|
||||||
{
|
|
||||||
QString queryStr;
|
|
||||||
bool resBool = false;
|
|
||||||
int id_trainee = 0;
|
|
||||||
|
|
||||||
resBool = db->transaction();
|
|
||||||
|
|
||||||
queryStr = QString("SELECT users.user_id "
|
|
||||||
"FROM public.users JOIN public.tasks_amm ON users.user_id = tasks_amm.fk_trainee_id "
|
|
||||||
"WHERE tasks_amm.task_id = %1 "
|
|
||||||
"ORDER BY users.user_id ASC").arg(
|
|
||||||
QString::number(task_id));
|
|
||||||
|
|
||||||
QSqlQuery query = QSqlQuery(*db);
|
|
||||||
|
|
||||||
if(queryExec(queryStr, &query))
|
|
||||||
{
|
|
||||||
if (query.first())
|
|
||||||
{//Обучаемый
|
|
||||||
id_trainee = query.value(0).toInt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!id_trainee)
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
queryStr = QString("UPDATE public.tasks_amm SET status = '%1' "
|
|
||||||
"WHERE task_id = %2 "
|
|
||||||
"RETURNING tasks_amm.task_id").arg(
|
|
||||||
status,
|
|
||||||
QString::number(task_id) );
|
|
||||||
|
|
||||||
|
|
||||||
if(!queryExecInt(queryStr))
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
resBool = db->commit();
|
|
||||||
return id_trainee;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DataBaseLMS::deleteTaskAMM(int id_task)
|
|
||||||
{
|
|
||||||
QString queryStr;
|
|
||||||
bool resBool = false;
|
|
||||||
int id_trainee = 0;
|
|
||||||
|
|
||||||
resBool = db->transaction();
|
|
||||||
|
|
||||||
queryStr = QString("SELECT users.user_id "
|
|
||||||
"FROM public.users JOIN public.tasks_amm ON users.user_id = tasks_amm.fk_trainee_id "
|
|
||||||
"WHERE tasks_amm.task_id = %1 "
|
|
||||||
"ORDER BY users.user_id ASC").arg(
|
|
||||||
QString::number(id_task));
|
|
||||||
|
|
||||||
QSqlQuery queryUserSEL = QSqlQuery(*db);
|
|
||||||
|
|
||||||
if(queryExec(queryStr, &queryUserSEL))
|
|
||||||
{
|
|
||||||
if (queryUserSEL.first())
|
|
||||||
{//Обучаемый
|
|
||||||
id_trainee = queryUserSEL.value(0).toInt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!id_trainee)
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
queryStr = QString("DELETE FROM public.subprocs "
|
|
||||||
"WHERE fk_task_amm_id = %1 ").arg(
|
|
||||||
QString::number(id_task));
|
|
||||||
|
|
||||||
QSqlQuery querySubProcDEL = QSqlQuery(*db);
|
|
||||||
if(!queryExec(queryStr, &querySubProcDEL))
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------
|
|
||||||
queryStr = QString("DELETE FROM public.tasks_amm "
|
|
||||||
"WHERE task_id = %1 "
|
|
||||||
"RETURNING tasks_amm.task_id").arg(
|
|
||||||
QString::number(id_task));
|
|
||||||
|
|
||||||
if(!queryExecInt(queryStr))
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
resBool = db->commit();
|
|
||||||
return id_trainee;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<TaskAmmFim> DataBaseLMS::selectTasksAMMofTrainee(int id_trainee)
|
|
||||||
{
|
|
||||||
QList<TaskAmmFim> listTasks;
|
|
||||||
QString queryStr;
|
|
||||||
bool resBool = false;
|
|
||||||
|
|
||||||
resBool = db->transaction();
|
|
||||||
|
|
||||||
queryStr = QString("SELECT tasks_amm.task_id, tasks_amm.title, tasks_amm.dm_code, tasks_amm.status, "
|
|
||||||
"users.user_id "
|
|
||||||
"FROM public.tasks_amm JOIN public.users ON users.user_id = tasks_amm.fk_trainee_id "
|
|
||||||
"WHERE tasks_amm.fk_trainee_id = %1 "
|
|
||||||
"ORDER BY tasks_amm.task_id ASC").arg(
|
|
||||||
id_trainee);
|
|
||||||
|
|
||||||
QSqlQuery query = QSqlQuery(*db);
|
|
||||||
|
|
||||||
if(queryExec(queryStr, &query))
|
|
||||||
{
|
|
||||||
while (query.next())
|
|
||||||
{//Задача
|
|
||||||
TaskAmmFim task;
|
|
||||||
|
|
||||||
task.setID(query.value(0).toInt());
|
|
||||||
task.ammProcedure.title = query.value(1).toString();
|
|
||||||
task.ammProcedure.dmCode = query.value(2).toString();
|
|
||||||
task.status = query.value(3).toString();
|
|
||||||
|
|
||||||
//Выгребаем все subproc для этой задачи
|
|
||||||
queryStr = QString("SELECT subprocs.subproc_id, subprocs.dm_code, subprocs.title, subprocs.canplay, "
|
|
||||||
"tasks_amm.task_id "
|
|
||||||
"FROM public.subprocs JOIN public.tasks_amm ON tasks_amm.task_id = subprocs.fk_task_amm_id "
|
|
||||||
"WHERE subprocs.fk_task_amm_id = %1 "
|
|
||||||
"ORDER BY subprocs.subproc_id ASC").arg(
|
|
||||||
task.getID());
|
|
||||||
|
|
||||||
QSqlQuery querySubProc = QSqlQuery(*db);
|
|
||||||
|
|
||||||
if(queryExec(queryStr, &querySubProc))
|
|
||||||
{
|
|
||||||
while (querySubProc.next())
|
|
||||||
{//Подпроцедура
|
|
||||||
SubProc subProc;
|
|
||||||
int subproc_id = 0;
|
|
||||||
|
|
||||||
subproc_id = querySubProc.value(0).toString().toInt();
|
|
||||||
subProc.setDmCode(querySubProc.value(1).toString());
|
|
||||||
subProc.setTitle(querySubProc.value(2).toString());
|
|
||||||
subProc.setModeListStr(querySubProc.value(3).toString());
|
|
||||||
|
|
||||||
task.listSubProc.append(subProc);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return QList<TaskAmmFim>();
|
|
||||||
}
|
|
||||||
|
|
||||||
listTasks.append(task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return QList<TaskAmmFim>();
|
|
||||||
}
|
|
||||||
|
|
||||||
resBool = db->commit();
|
|
||||||
return listTasks;
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskAmmFim DataBaseLMS::selectTaskAMMbyID(int id_task)
|
|
||||||
{
|
|
||||||
TaskAmmFim task;
|
|
||||||
|
|
||||||
QString queryStr;
|
|
||||||
bool resBool = false;
|
|
||||||
|
|
||||||
resBool = db->transaction();
|
|
||||||
|
|
||||||
queryStr = QString("SELECT tasks_amm.task_id, tasks_amm.title, tasks_amm.dm_code, tasks_amm.status "
|
|
||||||
"FROM public.tasks_amm "
|
|
||||||
"WHERE tasks_amm.task_id = %1 "
|
|
||||||
"ORDER BY tasks_amm.task_id ASC").arg(
|
|
||||||
id_task);
|
|
||||||
|
|
||||||
QSqlQuery query = QSqlQuery(*db);
|
|
||||||
|
|
||||||
if(queryExec(queryStr, &query))
|
|
||||||
{
|
|
||||||
if (query.first())
|
|
||||||
{//Задача
|
|
||||||
task.setID(query.value(0).toInt());
|
|
||||||
task.ammProcedure.title = query.value(1).toString();
|
|
||||||
task.ammProcedure.dmCode = query.value(2).toString();
|
|
||||||
task.status = query.value(3).toString();
|
|
||||||
|
|
||||||
//Выгребаем все subproc для этой задачи
|
|
||||||
queryStr = QString("SELECT subprocs.subproc_id, subprocs.dm_code, subprocs.title, subprocs.canplay, "
|
|
||||||
"tasks_amm.task_id "
|
|
||||||
"FROM public.subprocs JOIN public.tasks_amm ON tasks_amm.task_id = subprocs.fk_task_amm_id "
|
|
||||||
"WHERE subprocs.fk_task_amm_id = %1 "
|
|
||||||
"ORDER BY subprocs.subproc_id ASC").arg(
|
|
||||||
task.getID());
|
|
||||||
|
|
||||||
QSqlQuery querySubProc = QSqlQuery(*db);
|
|
||||||
|
|
||||||
if(queryExec(queryStr, &querySubProc))
|
|
||||||
{
|
|
||||||
while (querySubProc.next())
|
|
||||||
{//Подпроцедура
|
|
||||||
SubProc subProc;
|
|
||||||
int subproc_id = 0;
|
|
||||||
|
|
||||||
subproc_id = querySubProc.value(0).toString().toInt();
|
|
||||||
subProc.setDmCode(querySubProc.value(1).toString());
|
|
||||||
subProc.setTitle(querySubProc.value(2).toString());
|
|
||||||
subProc.setModeListStr(querySubProc.value(3).toString());
|
|
||||||
|
|
||||||
task.listSubProc.append(subProc);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return TaskAmmFim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
resBool = db->rollback();
|
|
||||||
return TaskAmmFim();
|
|
||||||
}
|
|
||||||
|
|
||||||
resBool = db->commit();
|
|
||||||
return task;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int DataBaseLMS::insertTaskFIM(TaskAmmFim task, int id_trainee)
|
int DataBaseLMS::insertTaskFIM(TaskAmmFim task, int id_trainee)
|
||||||
{
|
{
|
||||||
QString queryStr;
|
QString queryStr;
|
||||||
@@ -340,12 +30,14 @@ int DataBaseLMS::insertTaskFIM(TaskAmmFim task, int id_trainee)
|
|||||||
{
|
{
|
||||||
malfanction.description = malfanction.description.replace("'", "''"); //Задваиваем одинарные кавычки
|
malfanction.description = malfanction.description.replace("'", "''"); //Задваиваем одинарные кавычки
|
||||||
|
|
||||||
queryStr = QString("INSERT INTO public.malfunctions (num, dm_code, description, fk_task_fim_id) "
|
queryStr = QString("INSERT INTO public.malfunctions (num, dm_code, description, go_name, obj_name, fk_task_fim_id) "
|
||||||
"VALUES ('%1', '%2', '%3', %4) "
|
"VALUES ('%1', '%2', '%3', '%4', '%5', %6) "
|
||||||
"RETURNING malfunctions.malfunction_id").arg(
|
"RETURNING malfunctions.malfunction_id").arg(
|
||||||
malfanction.num,
|
malfanction.num,
|
||||||
malfanction.dmCode,
|
malfanction.dmCode,
|
||||||
malfanction.description,
|
malfanction.description,
|
||||||
|
malfanction.goName,
|
||||||
|
malfanction.objName,
|
||||||
QString::number(task_id));
|
QString::number(task_id));
|
||||||
|
|
||||||
int malfunction_id = queryExecInt(queryStr);
|
int malfunction_id = queryExecInt(queryStr);
|
||||||
@@ -471,6 +163,17 @@ int DataBaseLMS::updateStatusTaskFIM(int task_id, QString status)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queryStr = QString("DELETE FROM public.report_wh_items "
|
||||||
|
"WHERE fk_report_id = %1 ").arg(
|
||||||
|
QString::number(report_id));
|
||||||
|
|
||||||
|
QSqlQuery queryWhItemsDEL = QSqlQuery(*db);
|
||||||
|
if(!queryExec(queryStr, &queryWhItemsDEL))
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
queryStr = QString("DELETE FROM public.reports "
|
queryStr = QString("DELETE FROM public.reports "
|
||||||
"WHERE report_id = %1 ").arg(
|
"WHERE report_id = %1 ").arg(
|
||||||
QString::number(report_id));
|
QString::number(report_id));
|
||||||
@@ -601,6 +304,17 @@ int DataBaseLMS::deleteTaskFIM(int id_task)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queryStr = QString("DELETE FROM public.report_wh_items "
|
||||||
|
"WHERE fk_report_id = %1 ").arg(
|
||||||
|
QString::number(report_id));
|
||||||
|
|
||||||
|
QSqlQuery queryWhItemsDEL = QSqlQuery(*db);
|
||||||
|
if(!queryExec(queryStr, &queryWhItemsDEL))
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
queryStr = QString("DELETE FROM public.reports "
|
queryStr = QString("DELETE FROM public.reports "
|
||||||
"WHERE report_id = %1 ").arg(
|
"WHERE report_id = %1 ").arg(
|
||||||
QString::number(report_id));
|
QString::number(report_id));
|
||||||
@@ -657,7 +371,7 @@ QList<TaskAmmFim> DataBaseLMS::selectTasksFIMofTrainee(int id_trainee)
|
|||||||
task.status = query.value(2).toString();
|
task.status = query.value(2).toString();
|
||||||
|
|
||||||
//Выгребаем все malfunction для этой задачи
|
//Выгребаем все malfunction для этой задачи
|
||||||
queryStr = QString("SELECT malfunctions.malfunction_id, malfunctions.num, malfunctions.dm_code, malfunctions.description, "
|
queryStr = QString("SELECT malfunctions.malfunction_id, malfunctions.num, malfunctions.dm_code, malfunctions.description, malfunctions.go_name, malfunctions.obj_name, "
|
||||||
"tasks_fim.task_id "
|
"tasks_fim.task_id "
|
||||||
"FROM public.malfunctions JOIN public.tasks_fim ON tasks_fim.task_id = malfunctions.fk_task_fim_id "
|
"FROM public.malfunctions JOIN public.tasks_fim ON tasks_fim.task_id = malfunctions.fk_task_fim_id "
|
||||||
"WHERE malfunctions.fk_task_fim_id = %1 "
|
"WHERE malfunctions.fk_task_fim_id = %1 "
|
||||||
@@ -677,6 +391,8 @@ QList<TaskAmmFim> DataBaseLMS::selectTasksFIMofTrainee(int id_trainee)
|
|||||||
malfanction.num = queryMalf.value(1).toString();
|
malfanction.num = queryMalf.value(1).toString();
|
||||||
malfanction.dmCode = queryMalf.value(2).toString();
|
malfanction.dmCode = queryMalf.value(2).toString();
|
||||||
malfanction.description = queryMalf.value(3).toString();
|
malfanction.description = queryMalf.value(3).toString();
|
||||||
|
malfanction.goName = queryMalf.value(4).toString();
|
||||||
|
malfanction.objName = queryMalf.value(5).toString();
|
||||||
|
|
||||||
//Выгребаем сигналы для этой неисправности
|
//Выгребаем сигналы для этой неисправности
|
||||||
queryStr = QString("SELECT malf_signs.sign_id, malf_signs.type, malf_signs.description "
|
queryStr = QString("SELECT malf_signs.sign_id, malf_signs.type, malf_signs.description "
|
||||||
@@ -715,7 +431,7 @@ QList<TaskAmmFim> DataBaseLMS::selectTasksFIMofTrainee(int id_trainee)
|
|||||||
|
|
||||||
//Выгребаем отчет для этой задачи
|
//Выгребаем отчет для этой задачи
|
||||||
int report_id = 0;
|
int report_id = 0;
|
||||||
queryStr = QString("SELECT reports.report_id "
|
queryStr = QString("SELECT reports.report_id, reports.mmel "
|
||||||
"FROM public.reports "
|
"FROM public.reports "
|
||||||
"WHERE fk_task_fim_id = %1 "
|
"WHERE fk_task_fim_id = %1 "
|
||||||
"ORDER BY reports.report_id ASC").arg(
|
"ORDER BY reports.report_id ASC").arg(
|
||||||
@@ -729,6 +445,7 @@ QList<TaskAmmFim> DataBaseLMS::selectTasksFIMofTrainee(int id_trainee)
|
|||||||
{//Отчет
|
{//Отчет
|
||||||
report_id = queryReport.value(0).toInt();
|
report_id = queryReport.value(0).toInt();
|
||||||
task.report.id = report_id;
|
task.report.id = report_id;
|
||||||
|
task.report.mmel = queryReport.value(1).toBool();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -771,6 +488,36 @@ QList<TaskAmmFim> DataBaseLMS::selectTasksFIMofTrainee(int id_trainee)
|
|||||||
resBool = db->rollback();
|
resBool = db->rollback();
|
||||||
return QList<TaskAmmFim>();
|
return QList<TaskAmmFim>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Выгребаем все wh_item отчета
|
||||||
|
|
||||||
|
queryStr = QString("SELECT report_wh_items.wh_item_id, report_wh_items.status, report_wh_items.go_name, report_wh_items.obj_name, report_wh_items.code, report_wh_items.fk_report_id, report_wh_items.number "
|
||||||
|
"FROM public.report_wh_items "
|
||||||
|
"WHERE fk_report_id = %1 "
|
||||||
|
"ORDER BY report_wh_items.number ASC").arg(
|
||||||
|
QString::number(report_id));
|
||||||
|
|
||||||
|
QSqlQuery queryWhItems = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &queryWhItems))
|
||||||
|
{
|
||||||
|
while (queryWhItems.next())
|
||||||
|
{//report_wh_item
|
||||||
|
FIMReportWarehouseItem reportWhItem;
|
||||||
|
reportWhItem.id = queryWhItems.value(0).toInt();
|
||||||
|
reportWhItem.status = queryWhItems.value(1).toInt();
|
||||||
|
reportWhItem.goName = queryWhItems.value(2).toString();
|
||||||
|
reportWhItem.objName = queryWhItems.value(3).toString();
|
||||||
|
reportWhItem.code = queryWhItems.value(4).toString();
|
||||||
|
|
||||||
|
task.report.warehouseItemList.append(reportWhItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return QList<TaskAmmFim>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
listTasks.append(task);
|
listTasks.append(task);
|
||||||
@@ -813,7 +560,7 @@ TaskAmmFim DataBaseLMS::selectTaskFIMbyID(int id_task)
|
|||||||
task.status = query.value(2).toString();
|
task.status = query.value(2).toString();
|
||||||
|
|
||||||
//Выгребаем все malfunction для этой задачи
|
//Выгребаем все malfunction для этой задачи
|
||||||
queryStr = QString("SELECT malfunctions.malfunction_id, malfunctions.num, malfunctions.dm_code, malfunctions.description, "
|
queryStr = QString("SELECT malfunctions.malfunction_id, malfunctions.num, malfunctions.dm_code, malfunctions.description, malfunctions.go_name, malfunctions.obj_name, "
|
||||||
"tasks_fim.task_id "
|
"tasks_fim.task_id "
|
||||||
"FROM public.malfunctions JOIN public.tasks_fim ON tasks_fim.task_id = malfunctions.fk_task_fim_id "
|
"FROM public.malfunctions JOIN public.tasks_fim ON tasks_fim.task_id = malfunctions.fk_task_fim_id "
|
||||||
"WHERE malfunctions.fk_task_fim_id = %1 "
|
"WHERE malfunctions.fk_task_fim_id = %1 "
|
||||||
@@ -833,6 +580,8 @@ TaskAmmFim DataBaseLMS::selectTaskFIMbyID(int id_task)
|
|||||||
malfanction.num = queryMalf.value(1).toString();
|
malfanction.num = queryMalf.value(1).toString();
|
||||||
malfanction.dmCode = queryMalf.value(2).toString();
|
malfanction.dmCode = queryMalf.value(2).toString();
|
||||||
malfanction.description = queryMalf.value(3).toString();
|
malfanction.description = queryMalf.value(3).toString();
|
||||||
|
malfanction.goName = queryMalf.value(4).toString();
|
||||||
|
malfanction.objName = queryMalf.value(5).toString();
|
||||||
|
|
||||||
//Выгребаем сигналы для этой неисправности
|
//Выгребаем сигналы для этой неисправности
|
||||||
queryStr = QString("SELECT malf_signs.sign_id, malf_signs.type, malf_signs.description "
|
queryStr = QString("SELECT malf_signs.sign_id, malf_signs.type, malf_signs.description "
|
||||||
@@ -871,7 +620,7 @@ TaskAmmFim DataBaseLMS::selectTaskFIMbyID(int id_task)
|
|||||||
|
|
||||||
//Выгребаем отчет для этой задачи
|
//Выгребаем отчет для этой задачи
|
||||||
int report_id = 0;
|
int report_id = 0;
|
||||||
queryStr = QString("SELECT reports.report_id "
|
queryStr = QString("SELECT reports.report_id, reports.mmel "
|
||||||
"FROM public.reports "
|
"FROM public.reports "
|
||||||
"WHERE fk_task_fim_id = %1 "
|
"WHERE fk_task_fim_id = %1 "
|
||||||
"ORDER BY reports.report_id ASC").arg(
|
"ORDER BY reports.report_id ASC").arg(
|
||||||
@@ -885,6 +634,7 @@ TaskAmmFim DataBaseLMS::selectTaskFIMbyID(int id_task)
|
|||||||
{//Отчет
|
{//Отчет
|
||||||
report_id = queryReport.value(0).toInt();
|
report_id = queryReport.value(0).toInt();
|
||||||
task.report.id = report_id;
|
task.report.id = report_id;
|
||||||
|
task.report.mmel = queryReport.value(1).toBool();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -927,6 +677,36 @@ TaskAmmFim DataBaseLMS::selectTaskFIMbyID(int id_task)
|
|||||||
resBool = db->rollback();
|
resBool = db->rollback();
|
||||||
return TaskAmmFim();
|
return TaskAmmFim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Выгребаем все wh_item отчета
|
||||||
|
|
||||||
|
queryStr = QString("SELECT report_wh_items.wh_item_id, report_wh_items.status, report_wh_items.go_name, report_wh_items.obj_name, report_wh_items.code, report_wh_items.fk_report_id, report_wh_items.number "
|
||||||
|
"FROM public.report_wh_items "
|
||||||
|
"WHERE fk_report_id = %1 "
|
||||||
|
"ORDER BY report_wh_items.number ASC").arg(
|
||||||
|
QString::number(report_id));
|
||||||
|
|
||||||
|
QSqlQuery queryWhItems = QSqlQuery(*db);
|
||||||
|
|
||||||
|
if(queryExec(queryStr, &queryWhItems))
|
||||||
|
{
|
||||||
|
while (queryWhItems.next())
|
||||||
|
{//report_wh_item
|
||||||
|
FIMReportWarehouseItem reportWhItem;
|
||||||
|
reportWhItem.id = queryWhItems.value(0).toInt();
|
||||||
|
reportWhItem.status = queryWhItems.value(1).toInt();
|
||||||
|
reportWhItem.goName = queryWhItems.value(2).toString();
|
||||||
|
reportWhItem.objName = queryWhItems.value(3).toString();
|
||||||
|
reportWhItem.code = queryWhItems.value(4).toString();
|
||||||
|
|
||||||
|
task.report.warehouseItemList.append(reportWhItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return TaskAmmFim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -972,10 +752,11 @@ int DataBaseLMS::updateReportFIMforTask(TaskAmmFim task)
|
|||||||
|
|
||||||
if(!report_id)
|
if(!report_id)
|
||||||
{
|
{
|
||||||
queryStr = QString("INSERT INTO public.reports (fk_task_fim_id) "
|
queryStr = QString("INSERT INTO public.reports (fk_task_fim_id, mmel) "
|
||||||
"VALUES (%1) "
|
"VALUES (%1, %2) "
|
||||||
"RETURNING reports.report_id").arg(
|
"RETURNING reports.report_id").arg(
|
||||||
task.getID());
|
QString::number(task.getID()),
|
||||||
|
(task.report.mmel ? "true" : "false"));
|
||||||
|
|
||||||
report_id = queryExecInt(queryStr);
|
report_id = queryExecInt(queryStr);
|
||||||
if(!report_id)
|
if(!report_id)
|
||||||
@@ -996,6 +777,17 @@ int DataBaseLMS::updateReportFIMforTask(TaskAmmFim task)
|
|||||||
resBool = db->rollback();
|
resBool = db->rollback();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queryStr = QString("DELETE FROM public.report_wh_items "
|
||||||
|
"WHERE fk_report_id = %1 ").arg(
|
||||||
|
QString::number(report_id));
|
||||||
|
|
||||||
|
QSqlQuery queryWhItemsDEL = QSqlQuery(*db);
|
||||||
|
if(!queryExec(queryStr, &queryWhItemsDEL))
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int number = 0;
|
int number = 0;
|
||||||
@@ -1019,6 +811,26 @@ int DataBaseLMS::updateReportFIMforTask(TaskAmmFim task)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
number = 0;
|
||||||
|
for(FIMReportWarehouseItem reportWhItem : task.report.warehouseItemList)
|
||||||
|
{
|
||||||
|
queryStr = QString("INSERT INTO public.report_wh_items (status, go_name, obj_name, code, fk_report_id, number) "
|
||||||
|
"VALUES ('%1', '%2', '%3', '%4', %5, %6) "
|
||||||
|
"RETURNING report_wh_items.wh_item_id").arg(
|
||||||
|
QString::number(reportWhItem.status),
|
||||||
|
reportWhItem.goName,
|
||||||
|
reportWhItem.objName,
|
||||||
|
reportWhItem.code,
|
||||||
|
QString::number(report_id),
|
||||||
|
QString::number(++number));
|
||||||
|
|
||||||
|
if(!queryExecInt(queryStr))
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
queryStr = QString("UPDATE public.tasks_fim SET status = '%1' "
|
queryStr = QString("UPDATE public.tasks_fim SET status = '%1' "
|
||||||
"WHERE task_id = %2 ").arg(
|
"WHERE task_id = %2 ").arg(
|
||||||
"checkup",
|
"checkup",
|
||||||
@@ -384,8 +384,19 @@ int DataBaseLMS::deleteTrainee(int id_trainee)
|
|||||||
queryStr = QString("DELETE FROM public.report_items "
|
queryStr = QString("DELETE FROM public.report_items "
|
||||||
"WHERE report_items.fk_report_id = %1 ").arg(
|
"WHERE report_items.fk_report_id = %1 ").arg(
|
||||||
report_id);
|
report_id);
|
||||||
QSqlQuery queryReportDEL = QSqlQuery(*db);
|
QSqlQuery queryItemsDEL = QSqlQuery(*db);
|
||||||
if(!queryExec(queryStr, &queryReportDEL))
|
if(!queryExec(queryStr, &queryItemsDEL))
|
||||||
|
{
|
||||||
|
resBool = db->rollback();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Удаление wh_items для этого отчета*/
|
||||||
|
queryStr = QString("DELETE FROM public.report_wh_items "
|
||||||
|
"WHERE report_wh_items.fk_report_id = %1 ").arg(
|
||||||
|
report_id);
|
||||||
|
QSqlQuery queryWhItemsDEL = QSqlQuery(*db);
|
||||||
|
if(!queryExec(queryStr, &queryWhItemsDEL))
|
||||||
{
|
{
|
||||||
resBool = db->rollback();
|
resBool = db->rollback();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -20,11 +20,13 @@ void TaskAmmFim::addMalfunction(Malfunction malfunction)
|
|||||||
malfunctionList.append(malfunction);
|
malfunctionList.append(malfunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Malfunction::initialize(QString dmCode, QString num, QString description)
|
void Malfunction::initialize(QString dmCode, QString num, QString description, QString goName, QString objName)
|
||||||
{
|
{
|
||||||
this->dmCode = dmCode;
|
this->dmCode = dmCode;
|
||||||
this->num = num;
|
this->num = num;
|
||||||
this->description = description;
|
this->description = description;
|
||||||
|
this->goName = goName;
|
||||||
|
this->objName = objName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Malfunction::addMalfunctionSign(MalfunctionSign sign)
|
void Malfunction::addMalfunctionSign(MalfunctionSign sign)
|
||||||
|
|||||||
@@ -84,13 +84,15 @@ public:
|
|||||||
Malfunction(){};
|
Malfunction(){};
|
||||||
~Malfunction(){};
|
~Malfunction(){};
|
||||||
public:
|
public:
|
||||||
void initialize(QString dmCode, QString num, QString description);
|
void initialize(QString dmCode, QString num, QString description, QString goName, QString objName);
|
||||||
void addMalfunctionSign(MalfunctionSign sign);
|
void addMalfunctionSign(MalfunctionSign sign);
|
||||||
public:
|
public:
|
||||||
QString dmCode; // dmCode процедуры
|
QString dmCode; // dmCode процедуры
|
||||||
QString num; // номер по-порядку в пункте "2. Возможные причины" процедуры
|
QString num; // номер по-порядку в пункте "2. Возможные причины" процедуры
|
||||||
QString description; // описание
|
QString description; // описание
|
||||||
QList<MalfunctionSign> malfunctionSigns;// список соответствующих неисправности признаков
|
QList<MalfunctionSign> malfunctionSigns;// список соответствующих неисправности признаков
|
||||||
|
QString goName; // имя GameObject (со скриптом DismantleData) - неисправный прибор
|
||||||
|
QString objName;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DATABASELMS_EXPORT FIMReportItem
|
class DATABASELMS_EXPORT FIMReportItem
|
||||||
@@ -104,6 +106,23 @@ public:
|
|||||||
ProcedureID procedure; // ссылка на процедуру, при необходимости
|
ProcedureID procedure; // ссылка на процедуру, при необходимости
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DATABASELMS_EXPORT FIMReportWarehouseItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FIMReportWarehouseItem(){};
|
||||||
|
~FIMReportWarehouseItem(){};
|
||||||
|
public:
|
||||||
|
int id = 0; // для идентификации в БД
|
||||||
|
// статус GameObject-а в сцене
|
||||||
|
int status = 0; // 0 - демонтировано, 1 - неисправно, 2 - заменено на новое со склада
|
||||||
|
// имя GameObject-а в сцене
|
||||||
|
QString goName = "";
|
||||||
|
// человеческое название прибора
|
||||||
|
QString objName = "";
|
||||||
|
// его код из документации
|
||||||
|
QString code = "";
|
||||||
|
};
|
||||||
|
|
||||||
class DATABASELMS_EXPORT FIMReport
|
class DATABASELMS_EXPORT FIMReport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -111,7 +130,9 @@ public:
|
|||||||
~FIMReport(){};
|
~FIMReport(){};
|
||||||
public:
|
public:
|
||||||
int id = 0; // для идентификации в БД
|
int id = 0; // для идентификации в БД
|
||||||
QList<FIMReportItem> itemList;
|
QList<FIMReportItem> itemList; // список выполненных/просмотренных процедур
|
||||||
|
QList<FIMReportWarehouseItem> warehouseItemList;
|
||||||
|
bool mmel = false; // выпуск самолета по MMEL
|
||||||
};
|
};
|
||||||
|
|
||||||
class DATABASELMS_EXPORT TaskAmmFim
|
class DATABASELMS_EXPORT TaskAmmFim
|
||||||
|
|||||||
@@ -201,7 +201,9 @@ QByteArray DataParser::createQueryToDBMessage(ClientQueryToDB *queryToDB, int id
|
|||||||
xmlWriter.writeStartElement("malfunction");
|
xmlWriter.writeStartElement("malfunction");
|
||||||
xmlWriter.writeAttribute("dmCode", malfunction.dmCode);
|
xmlWriter.writeAttribute("dmCode", malfunction.dmCode);
|
||||||
xmlWriter.writeAttribute("num", malfunction.num);
|
xmlWriter.writeAttribute("num", malfunction.num);
|
||||||
xmlWriter.writeAttribute("description", malfunction.description);
|
xmlWriter.writeAttribute("description", malfunction.description);
|
||||||
|
xmlWriter.writeAttribute("goName", malfunction.goName);
|
||||||
|
xmlWriter.writeAttribute("objName", malfunction.objName);
|
||||||
|
|
||||||
for(MalfunctionSign sign : malfunction.malfunctionSigns)
|
for(MalfunctionSign sign : malfunction.malfunctionSigns)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -862,6 +862,8 @@ void RecognizeSystem::xmlParserQueryToDB(PacketType packetType, QByteArray array
|
|||||||
malfunction.num = malfOrReportNode.toElement().attribute("num");
|
malfunction.num = malfOrReportNode.toElement().attribute("num");
|
||||||
malfunction.dmCode = malfOrReportNode.toElement().attribute("dmCode");
|
malfunction.dmCode = malfOrReportNode.toElement().attribute("dmCode");
|
||||||
malfunction.description = malfOrReportNode.toElement().attribute("description");
|
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++)
|
for(int s = 0; s < malfOrReportNode.childNodes().count(); s++)
|
||||||
{
|
{
|
||||||
@@ -883,6 +885,7 @@ void RecognizeSystem::xmlParserQueryToDB(PacketType packetType, QByteArray array
|
|||||||
{//Отчет
|
{//Отчет
|
||||||
FIMReport report;
|
FIMReport report;
|
||||||
report.id = malfOrReportNode.toElement().attribute("report_id").toInt();
|
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++)
|
for(int k = 0; k < malfOrReportNode.childNodes().count(); k++)
|
||||||
{
|
{
|
||||||
@@ -904,6 +907,17 @@ void RecognizeSystem::xmlParserQueryToDB(PacketType packetType, QByteArray array
|
|||||||
|
|
||||||
report.itemList.append(reportItem);
|
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;
|
task.report = report;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ CheckerTask::CheckerTask(ConnectorToServer* connectorToServer, TypeChecker type,
|
|||||||
{
|
{
|
||||||
fimTasksWidget = new FIMtasksWidget(nullptr, TypeListTreeAMMFIM::listOneTask, this);
|
fimTasksWidget = new FIMtasksWidget(nullptr, TypeListTreeAMMFIM::listOneTask, this);
|
||||||
ui->verticalLayout_3->addWidget(fimTasksWidget);
|
ui->verticalLayout_3->addWidget(fimTasksWidget);
|
||||||
|
fimTasksWidget->setMaximumHeight(300);
|
||||||
|
|
||||||
ui->lblName->setVisible(false);
|
ui->lblName->setVisible(false);
|
||||||
ui->lblDMcode->setVisible(false);
|
ui->lblDMcode->setVisible(false);
|
||||||
@@ -189,6 +190,10 @@ void CheckerTask::outReport(FIMReport report)
|
|||||||
ui->plainText->appendHtml("<br>");
|
ui->plainText->appendHtml("<br>");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//Действия обучаемого
|
||||||
|
str = QString("<b>%1</b>").arg(tr("Trainee's actions:"));
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
for(FIMReportItem item : report.itemList)
|
for(FIMReportItem item : report.itemList)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -197,12 +202,16 @@ void CheckerTask::outReport(FIMReport report)
|
|||||||
ui->plainText->appendHtml(str);
|
ui->plainText->appendHtml(str);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//AMM/FIM
|
||||||
|
str = QString("<p style=\"color:gray;\">%1</p>").arg(item.procedure.doc);
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
//Title
|
//Title
|
||||||
str = QString("<b>%1</b>").arg(item.procedure.title);
|
str = QString("<p style=\"color:blue;\">%1</p>").arg(item.procedure.title);
|
||||||
ui->plainText->appendHtml(str);
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
//DMcode
|
//DMcode
|
||||||
str = QString("<p>%1</p>").arg(item.procedure.dmCode);
|
str = QString("<p style=\"color:gray;\">%1</p>").arg(item.procedure.dmCode);
|
||||||
ui->plainText->appendHtml(str);
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
//Result
|
//Result
|
||||||
@@ -215,11 +224,84 @@ void CheckerTask::outReport(FIMReport report)
|
|||||||
ui->plainText->appendHtml(str);
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
//Text
|
//Text
|
||||||
str = QString("<p style=\"color:green;\">%1</p>").arg(item.text);
|
str = QString("<p style=\"color:gray;\">%1 %2</p>").arg(tr("Comment:"), item.text);
|
||||||
ui->plainText->appendHtml(str);
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
ui->plainText->appendHtml("<br>");
|
ui->plainText->appendHtml("<br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ui->plainText->appendHtml("<br>");
|
||||||
|
|
||||||
|
//Устройства/приборы
|
||||||
|
bool flNeedMMEL = false;
|
||||||
|
str = QString("<b>%1</b>").arg(tr("Devices/instruments:"));
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
|
for(FIMReportWarehouseItem whItem : report.warehouseItemList)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
//WhItem ID
|
||||||
|
str = QString("<p>WhItem ID: %1</p>").arg(QString::number(whItem.id));
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// статус GameObject-а в сцене
|
||||||
|
str = QString("<p>%1</p>").arg(getStatusStr(whItem.status));
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
if(whItem.status == 0)
|
||||||
|
flNeedMMEL = true;
|
||||||
|
|
||||||
|
// имя GameObject-а в сцене
|
||||||
|
//str = QString("<p>%1</p>").arg(whItem.goName);
|
||||||
|
//ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
|
// человеческое название прибора
|
||||||
|
str = QString("<p>%1</p>").arg(whItem.objName);
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
|
// его код из документации
|
||||||
|
str = QString("<p>%1</p>").arg(whItem.code);
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
|
ui->plainText->appendHtml("<br>");
|
||||||
|
}
|
||||||
|
|
||||||
|
//ui->plainText->appendHtml("<br>");
|
||||||
|
|
||||||
|
if(flNeedMMEL)
|
||||||
|
{
|
||||||
|
QString strMMEL = tr("Trainee believes that:");
|
||||||
|
str = QString("<p style=\"color:gray;\">%1</p>").arg(strMMEL);
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
|
||||||
|
if(report.mmel)
|
||||||
|
{
|
||||||
|
strMMEL = tr("The aircraft may operate with its equipment removed in accordance with the \"Master Minimum Equipment List\"");
|
||||||
|
str = QString("<p style=\"color:green;\">%1</p>").arg(strMMEL);
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strMMEL = tr("The aircraft cannot be flown with equipment removed in accordance with the \"Master Minimum Equipment List\"");
|
||||||
|
str = QString("<p style=\"color:orange;\">%1</p>").arg(strMMEL);
|
||||||
|
ui->plainText->appendHtml(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CheckerTask::getStatusStr(int status)
|
||||||
|
{
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
//демонтировано
|
||||||
|
case 0: return tr("dismantled");
|
||||||
|
//неисправно
|
||||||
|
case 1: return tr("faulty");
|
||||||
|
//заменено на новое со склада
|
||||||
|
case 2: return tr("replaced with a new one from the warehouse");
|
||||||
|
//unknown
|
||||||
|
default: return "unknown";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//НЕВЕРНО
|
//НЕВЕРНО
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void outReport(FIMReport report);
|
void outReport(FIMReport report);
|
||||||
|
QString getStatusStr(int status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskAmmFim task;
|
TaskAmmFim task;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ DialogChekerTask::DialogChekerTask(ConnectorToServer* connectorToServer, Checker
|
|||||||
{
|
{
|
||||||
case CheckerTask::TypeChecker::fim_check:
|
case CheckerTask::TypeChecker::fim_check:
|
||||||
this->setWindowTitle(tr("Check Task"));
|
this->setWindowTitle(tr("Check Task"));
|
||||||
this->setMinimumSize(1400, 700);
|
this->setMinimumSize(1400, 900);
|
||||||
//this->setWindowState(Qt::WindowMaximized);
|
//this->setWindowState(Qt::WindowMaximized);
|
||||||
break;
|
break;
|
||||||
case CheckerTask::TypeChecker::amm_check:
|
case CheckerTask::TypeChecker::amm_check:
|
||||||
|
|||||||
@@ -310,9 +310,9 @@ void FIMtasksWidget::reSetHeadTreeWidget()
|
|||||||
QStringList listHeaders;
|
QStringList listHeaders;
|
||||||
|
|
||||||
if(type == TypeListTreeAMMFIM::listForTrainee)
|
if(type == TypeListTreeAMMFIM::listForTrainee)
|
||||||
listHeaders = QStringList{tr("Procedure FIM"), tr("Status"), tr("ID")};
|
listHeaders = QStringList{tr("Procedure FIM"), tr("Device"), tr("Status"), tr("ID")};
|
||||||
else
|
else
|
||||||
listHeaders = QStringList{tr("Procedure FIM"), tr("Status"), tr("ID")};
|
listHeaders = QStringList{tr("Procedure FIM"), tr("Device"), tr("Status"), tr("ID")};
|
||||||
|
|
||||||
treeWidget->setHeaderLabels(listHeaders);
|
treeWidget->setHeaderLabels(listHeaders);
|
||||||
}
|
}
|
||||||
@@ -323,6 +323,8 @@ void FIMtasksWidget::setWidthColumnsTree()
|
|||||||
|
|
||||||
treeWidget->setColumnWidth(ColumnsTreeFIM::clmnFIM_Title, 100);
|
treeWidget->setColumnWidth(ColumnsTreeFIM::clmnFIM_Title, 100);
|
||||||
listWidthColumn.append(100);
|
listWidthColumn.append(100);
|
||||||
|
treeWidget->setColumnWidth(ColumnsTreeFIM::clmnFIM_Device, 150);
|
||||||
|
listWidthColumn.append(150);
|
||||||
treeWidget->setColumnWidth(ColumnsTreeFIM::clmnFIM_status, 150);
|
treeWidget->setColumnWidth(ColumnsTreeFIM::clmnFIM_status, 150);
|
||||||
listWidthColumn.append(130);
|
listWidthColumn.append(130);
|
||||||
treeWidget->setColumnWidth(ColumnsTreeFIM::clmnFIM_ID, 50);
|
treeWidget->setColumnWidth(ColumnsTreeFIM::clmnFIM_ID, 50);
|
||||||
|
|||||||
@@ -225,7 +225,9 @@ void TaskAMMFIMTreePreparation::loadFIMtasksFromXML(QByteArray array)
|
|||||||
|
|
||||||
malfunction.initialize(nodeMap.namedItem("dmCode").nodeValue(),
|
malfunction.initialize(nodeMap.namedItem("dmCode").nodeValue(),
|
||||||
nodeMap.namedItem("num").nodeValue(),
|
nodeMap.namedItem("num").nodeValue(),
|
||||||
nodeMap.namedItem("description").nodeValue());
|
nodeMap.namedItem("description").nodeValue(),
|
||||||
|
nodeMap.namedItem("goName").nodeValue(),
|
||||||
|
nodeMap.namedItem("objName").nodeValue());
|
||||||
|
|
||||||
QDomElement signElement = malfunctionElement.firstChildElement();
|
QDomElement signElement = malfunctionElement.firstChildElement();
|
||||||
if(!signElement.isNull())
|
if(!signElement.isNull())
|
||||||
@@ -614,6 +616,7 @@ void TaskAMMFIMTreePreparation::slot_prepareFIMListItems(QByteArray array)
|
|||||||
itemMalfunction->setFlags(itemMalfunction->flags() ^ Qt::ItemIsSelectable);
|
itemMalfunction->setFlags(itemMalfunction->flags() ^ Qt::ItemIsSelectable);
|
||||||
|
|
||||||
itemMalfunction->setText(ColumnsTreeFIM::clmnFIM_Title, malfunction.description);
|
itemMalfunction->setText(ColumnsTreeFIM::clmnFIM_Title, malfunction.description);
|
||||||
|
itemMalfunction->setText(ColumnsTreeFIM::clmnFIM_Device, malfunction.objName);
|
||||||
if(type == TypeListTreeAMMFIM::listCommon)
|
if(type == TypeListTreeAMMFIM::listCommon)
|
||||||
{
|
{
|
||||||
itemMalfunction->setFlags(itemMalfunction->flags() | Qt::ItemIsUserCheckable);
|
itemMalfunction->setFlags(itemMalfunction->flags() | Qt::ItemIsUserCheckable);
|
||||||
@@ -706,6 +709,7 @@ void TaskAMMFIMTreePreparation::slot_prepareFIMListItemsForTrainee(QList<TaskAmm
|
|||||||
QTreeWidgetItem* itemMalfunction = new QTreeWidgetItem();
|
QTreeWidgetItem* itemMalfunction = new QTreeWidgetItem();
|
||||||
|
|
||||||
itemMalfunction->setText(ColumnsTreeFIM::clmnFIM_Title, malfunction.description);
|
itemMalfunction->setText(ColumnsTreeFIM::clmnFIM_Title, malfunction.description);
|
||||||
|
itemMalfunction->setText(ColumnsTreeFIM::clmnFIM_Device, malfunction.objName);
|
||||||
if(type == TypeListTreeAMMFIM::listCommon)
|
if(type == TypeListTreeAMMFIM::listCommon)
|
||||||
{
|
{
|
||||||
itemMalfunction->setFlags(itemMalfunction->flags() | Qt::ItemIsUserCheckable);
|
itemMalfunction->setFlags(itemMalfunction->flags() | Qt::ItemIsUserCheckable);
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ enum ColumnsTreeAMM{
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum ColumnsTreeFIM{
|
enum ColumnsTreeFIM{
|
||||||
clmnFIM_Title = 0,
|
clmnFIM_Title = 0,
|
||||||
|
clmnFIM_Device,
|
||||||
clmnFIM_status,
|
clmnFIM_status,
|
||||||
clmnFIM_ID,
|
clmnFIM_ID,
|
||||||
clmnFIM_count
|
clmnFIM_count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,8 @@ QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim>
|
|||||||
malfunctionNode.toElement().setAttribute("dmCode", malfunction.dmCode);
|
malfunctionNode.toElement().setAttribute("dmCode", malfunction.dmCode);
|
||||||
malfunctionNode.toElement().setAttribute("num", malfunction.num);
|
malfunctionNode.toElement().setAttribute("num", malfunction.num);
|
||||||
malfunctionNode.toElement().setAttribute("description", malfunction.description);
|
malfunctionNode.toElement().setAttribute("description", malfunction.description);
|
||||||
|
malfunctionNode.toElement().setAttribute("goName", malfunction.goName);
|
||||||
|
malfunctionNode.toElement().setAttribute("objName", malfunction.objName);
|
||||||
|
|
||||||
for(MalfunctionSign sign : malfunction.malfunctionSigns)
|
for(MalfunctionSign sign : malfunction.malfunctionSigns)
|
||||||
{//Сигналы
|
{//Сигналы
|
||||||
@@ -223,6 +225,7 @@ QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim>
|
|||||||
QDomNode reportNode = commonDOM.createElement("report");
|
QDomNode reportNode = commonDOM.createElement("report");
|
||||||
taskNode.appendChild(reportNode);
|
taskNode.appendChild(reportNode);
|
||||||
reportNode.toElement().setAttribute("report_id", report.id);
|
reportNode.toElement().setAttribute("report_id", report.id);
|
||||||
|
reportNode.toElement().setAttribute("mmel", report.mmel ? "true" : "false");
|
||||||
|
|
||||||
for(FIMReportItem reportItem : task.report.itemList)
|
for(FIMReportItem reportItem : task.report.itemList)
|
||||||
{//FIMReportItem
|
{//FIMReportItem
|
||||||
@@ -240,6 +243,17 @@ QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim>
|
|||||||
procedureIDNode.toElement().setAttribute("dmCode", reportItem.procedure.dmCode);
|
procedureIDNode.toElement().setAttribute("dmCode", reportItem.procedure.dmCode);
|
||||||
procedureIDNode.toElement().setAttribute("result", reportItem.procedure.result);
|
procedureIDNode.toElement().setAttribute("result", reportItem.procedure.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(FIMReportWarehouseItem reportWhItem : task.report.warehouseItemList)
|
||||||
|
{//FIMReportWarehouseItem
|
||||||
|
QDomNode reportWhItemNode = commonDOM.createElement("reportWHItem");
|
||||||
|
reportNode.appendChild(reportWhItemNode);
|
||||||
|
reportWhItemNode.toElement().setAttribute("wh_item_id", reportWhItem.id);
|
||||||
|
reportWhItemNode.toElement().setAttribute("status", reportWhItem.status);
|
||||||
|
reportWhItemNode.toElement().setAttribute("goName", reportWhItem.goName);
|
||||||
|
reportWhItemNode.toElement().setAttribute("objName", reportWhItem.objName);
|
||||||
|
reportWhItemNode.toElement().setAttribute("code", reportWhItem.code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -208,41 +208,29 @@ void ProcessParser::clientUnityTaskFIMreport(QXmlStreamReader &xmlReader, Client
|
|||||||
|
|
||||||
report.itemList.append(reportItem);
|
report.itemList.append(reportItem);
|
||||||
}
|
}
|
||||||
|
else if(reportItemNode.nodeName() == "warehouseItems")
|
||||||
|
{
|
||||||
|
FIMReportWarehouseItem warehouseItem;
|
||||||
|
warehouseItem.id = 0;
|
||||||
|
warehouseItem.status = reportItemNode.toElement().attribute("status").toInt();
|
||||||
|
warehouseItem.goName = reportItemNode.toElement().attribute("goName");
|
||||||
|
warehouseItem.objName = reportItemNode.toElement().attribute("name");
|
||||||
|
warehouseItem.code = reportItemNode.toElement().attribute("code");
|
||||||
|
|
||||||
|
report.warehouseItemList.append(warehouseItem);
|
||||||
|
}
|
||||||
|
else if(reportItemNode.nodeName() == "mmel")
|
||||||
|
{
|
||||||
|
QString str1 = reportItemNode.nodeValue();
|
||||||
|
QString str2 = reportItemNode.toElement().text();
|
||||||
|
|
||||||
|
report.mmel = (reportItemNode.toElement().text() == "true" ? true : false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task.report = report;
|
task.report = report;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
|
||||||
//TODO -------------- (!Заглушка!) Отчет о выполнении
|
|
||||||
FIMReport report;
|
|
||||||
FIMReportItem reportItem;
|
|
||||||
QString text; // текст, вводимый обучаемым
|
|
||||||
ProcedureID procedure; // ссылка на процедуру, при необходимости
|
|
||||||
|
|
||||||
text = "1. Выполнил такую процедуру";
|
|
||||||
procedure.doc = "fim";
|
|
||||||
procedure.title = "Процедура №1";
|
|
||||||
procedure.dmCode = "RRJ-N-27-92-00-51D01-420A-A";
|
|
||||||
procedure.result = "viewed";
|
|
||||||
reportItem.text = text;
|
|
||||||
reportItem.procedure = procedure;
|
|
||||||
report.itemList.append(reportItem);
|
|
||||||
|
|
||||||
text = "2. Выполнил такую процедуру";
|
|
||||||
procedure.doc = "fim";
|
|
||||||
procedure.title = "Процедура №2";
|
|
||||||
procedure.dmCode = "RRJ-N-28-22-00-01A01-420A-A";
|
|
||||||
procedure.result = "viewed";
|
|
||||||
reportItem.text = text;
|
|
||||||
reportItem.procedure = procedure;
|
|
||||||
report.itemList.append(reportItem);
|
|
||||||
|
|
||||||
task.report = report;
|
|
||||||
//-----------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
listTasks.append(task);
|
listTasks.append(task);
|
||||||
|
|
||||||
@@ -279,6 +267,8 @@ TaskAmmFim ProcessParser::xmlParserQueryToDB_ASSIGN_TASK_FIM_TO_TRAINEE(QByteArr
|
|||||||
malfunction.num = malfunctionNode.toElement().attribute("num");
|
malfunction.num = malfunctionNode.toElement().attribute("num");
|
||||||
malfunction.dmCode = malfunctionNode.toElement().attribute("dmCode");
|
malfunction.dmCode = malfunctionNode.toElement().attribute("dmCode");
|
||||||
malfunction.description = malfunctionNode.toElement().attribute("description");
|
malfunction.description = malfunctionNode.toElement().attribute("description");
|
||||||
|
malfunction.goName = malfunctionNode.toElement().attribute("goName");
|
||||||
|
malfunction.objName = malfunctionNode.toElement().attribute("objName");
|
||||||
|
|
||||||
//Сигналы
|
//Сигналы
|
||||||
for(int j = 0; j < malfunctionNode.childNodes().count(); j++)
|
for(int j = 0; j < malfunctionNode.childNodes().count(); j++)
|
||||||
|
|||||||
Binary file not shown.
@@ -149,33 +149,78 @@ Delete it anyway?</source>
|
|||||||
<translation>Новая</translation>
|
<translation>Новая</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="211"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="220"/>
|
||||||
<source>viewed</source>
|
<source>viewed</source>
|
||||||
<translation>Просмотрено</translation>
|
<translation>Просмотрено</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="152"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="153"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="213"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="222"/>
|
||||||
<source>completed</source>
|
<source>completed</source>
|
||||||
<translation>выполнена</translation>
|
<translation>выполнена</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="157"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="158"/>
|
||||||
<source>failed</source>
|
<source>failed</source>
|
||||||
<translation>неверно</translation>
|
<translation>неверно</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="162"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="163"/>
|
||||||
<source>checkup</source>
|
<source>checkup</source>
|
||||||
<translation>на проверке</translation>
|
<translation>на проверке</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="167"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="168"/>
|
||||||
<source>new</source>
|
<source>new</source>
|
||||||
<translation>новая</translation>
|
<translation>новая</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="236"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="194"/>
|
||||||
|
<source>Trainee's actions:</source>
|
||||||
|
<translation>Действия обучаемого:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="227"/>
|
||||||
|
<source>Comment:</source>
|
||||||
|
<translation>Комментарий:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="237"/>
|
||||||
|
<source>Devices/instruments:</source>
|
||||||
|
<translation>Устройства/приборы:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="273"/>
|
||||||
|
<source>Trainee believes that:</source>
|
||||||
|
<translation>Обучаемый считает, что:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="279"/>
|
||||||
|
<source>The aircraft may operate with its equipment removed in accordance with the "Master Minimum Equipment List"</source>
|
||||||
|
<translation>Самолет может выполнять полёт с демонтированным оборудованием в соответствии с "Главным перечнем минимального состава оборудования"</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="285"/>
|
||||||
|
<source>The aircraft cannot be flown with equipment removed in accordance with the "Master Minimum Equipment List"</source>
|
||||||
|
<translation>Самолет не может выполнять полёт с демонтированным оборудованием в соответствии с "Главным перечнем минимального состава оборудования"</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="297"/>
|
||||||
|
<source>dismantled</source>
|
||||||
|
<translation>демонтировано</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="299"/>
|
||||||
|
<source>faulty</source>
|
||||||
|
<translation>неисправно</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="301"/>
|
||||||
|
<source>replaced with a new one from the warehouse</source>
|
||||||
|
<translation>заменено на новый со склада</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="318"/>
|
||||||
<source>Change task status?
|
<source>Change task status?
|
||||||
The status will be set:
|
The status will be set:
|
||||||
'failed'</source>
|
'failed'</source>
|
||||||
@@ -184,8 +229,8 @@ The status will be set:
|
|||||||
'неверно'</translation>
|
'неверно'</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="286"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="368"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="292"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="374"/>
|
||||||
<source>Change task status?
|
<source>Change task status?
|
||||||
The status will be set:
|
The status will be set:
|
||||||
'new'</source>
|
'new'</source>
|
||||||
@@ -194,7 +239,7 @@ The status will be set:
|
|||||||
'новая'</translation>
|
'новая'</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="314"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="396"/>
|
||||||
<source>Change task status?
|
<source>Change task status?
|
||||||
The status will be set:
|
The status will be set:
|
||||||
'checkup'</source>
|
'checkup'</source>
|
||||||
@@ -203,8 +248,8 @@ The status will be set:
|
|||||||
'на проверке'</translation>
|
'на проверке'</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="258"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="340"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="264"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/checkertask.cpp" line="346"/>
|
||||||
<source>Change task status?
|
<source>Change task status?
|
||||||
The status will be set:
|
The status will be set:
|
||||||
'completed'</source>
|
'completed'</source>
|
||||||
@@ -1123,14 +1168,20 @@ The changes will not be accepted.</source>
|
|||||||
<translation>Процедура FIM</translation>
|
<translation>Процедура FIM</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/fimtaskswidget.cpp" line="402"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/fimtaskswidget.cpp" line="313"/>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/fimtaskswidget.cpp" line="315"/>
|
||||||
|
<source>Device</source>
|
||||||
|
<translation>Устройство</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../LibInstructorsAndTrainees/tasks/fimtaskswidget.cpp" line="404"/>
|
||||||
<source>The deletion will be irrevocable.
|
<source>The deletion will be irrevocable.
|
||||||
Delete it anyway?</source>
|
Delete it anyway?</source>
|
||||||
<translation>Удаление будет безвозвратным.
|
<translation>Удаление будет безвозвратным.
|
||||||
Всё равно удалить?</translation>
|
Всё равно удалить?</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/fimtaskswidget.cpp" line="446"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/fimtaskswidget.cpp" line="448"/>
|
||||||
<source>Assign this task?</source>
|
<source>Assign this task?</source>
|
||||||
<translation>Назначить эту задачу?</translation>
|
<translation>Назначить эту задачу?</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -1755,30 +1806,30 @@ The server will be restarted.</source>
|
|||||||
<context>
|
<context>
|
||||||
<name>TaskAMMFIMTreePreparation</name>
|
<name>TaskAMMFIMTreePreparation</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="512"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="514"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="585"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="587"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="678"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="681"/>
|
||||||
<source>completed</source>
|
<source>completed</source>
|
||||||
<translation>выполнена</translation>
|
<translation>выполнена</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="517"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="519"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="590"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="592"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="683"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="686"/>
|
||||||
<source>failed</source>
|
<source>failed</source>
|
||||||
<translation>неверно</translation>
|
<translation>неверно</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="522"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="524"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="595"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="597"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="688"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="691"/>
|
||||||
<source>checkup</source>
|
<source>checkup</source>
|
||||||
<translation>на проверке</translation>
|
<translation>на проверке</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="527"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="529"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="600"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="602"/>
|
||||||
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="693"/>
|
<location filename="../LibInstructorsAndTrainees/tasks/tasktreepreparation.cpp" line="696"/>
|
||||||
<source>new</source>
|
<source>new</source>
|
||||||
<translation>новая</translation>
|
<translation>новая</translation>
|
||||||
</message>
|
</message>
|
||||||
|
|||||||
Reference in New Issue
Block a user