|
@@ -14,6 +14,8 @@
|
|
|
#include <QMessageBox>
|
|
|
#include <QTimeZone>
|
|
|
#include "../global.h"
|
|
|
+#include "../backendapimanager.h"
|
|
|
+#include "../logger.h"
|
|
|
|
|
|
#define ANSI_COLOR_GREEN "\x1B[32m"
|
|
|
#define ANSI_COLOR_RESET "\x1B[0m"
|
|
@@ -59,10 +61,12 @@ void firingWidget::sendMqttMessage(const QString &topic, const QByteArray &messa
|
|
|
|
|
|
if (mqttThread && m_isMqttConnected)
|
|
|
{
|
|
|
- emit mqttThread->sendMessageRequested(topic, message);
|
|
|
+ Logger::getInstance().info(QString("发送MQTT消息到主题: %1, 消息: %2").arg(topic, QString(message)));
|
|
|
+ emit mqttThread->sendMessageRequested(topic, message, quint8(2), false);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ Logger::getInstance().error("MQTT未连接, 无法发送消息");
|
|
|
qDebug() << "MQTT 未连接,无法发送消息";
|
|
|
}
|
|
|
}
|
|
@@ -154,7 +158,7 @@ bool firingWidget::uploadToDanLing(const QJsonObject &jsonObj)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-bool firingWidget::recordBlastReg(const QJsonObject &jsonObj)
|
|
|
+bool firingWidget::recordBlastEquipments(const QJsonObject &jsonObj)
|
|
|
{
|
|
|
QJsonArray regsArray = jsonObj["regs"].toArray();
|
|
|
for (const auto ®Value : regsArray)
|
|
@@ -359,6 +363,7 @@ void firingWidget::onLastStageChanged(int newStage)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ Logger::getInstance().info(QString("Stage changed to: %1, sending message: %2").arg(newStage).arg(message));
|
|
|
if (!message.isEmpty())
|
|
|
{
|
|
|
if (lastStage == 4 && !m_select)
|
|
@@ -371,6 +376,7 @@ void firingWidget::onLastStageChanged(int newStage)
|
|
|
bool success = serialTool->sendData(data);
|
|
|
if (success)
|
|
|
{
|
|
|
+ Logger::getInstance().info(QString("Data sent successfully to serial tool: %1").arg(data));
|
|
|
qDebug() << "Data sent successfully";
|
|
|
}
|
|
|
else
|
|
@@ -384,6 +390,7 @@ void firingWidget::onLastStageChanged(int newStage)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ Logger::getInstance().error("SerialTool instance not found.");
|
|
|
qDebug() << "serialTool Not fond.";
|
|
|
// 在准备起爆状态下 但是没有获取串口
|
|
|
lastStage = 10;
|
|
@@ -411,170 +418,12 @@ void firingWidget::cancelBlasting()
|
|
|
}
|
|
|
void firingWidget::on_sendTest_4_clicked()
|
|
|
{
|
|
|
- // qDebug() << "navProgress 取消流程";
|
|
|
- // QString message = "取消流程";
|
|
|
- // if (!message.isEmpty()) {
|
|
|
- // sendMqttMessage(topic, message.toUtf8());
|
|
|
- // }
|
|
|
-
|
|
|
- lat = labLat;
|
|
|
- lon = labLon;
|
|
|
- QSqlDatabase db = DatabaseManager::getInstance().getDatabase();
|
|
|
- if (!db.transaction())
|
|
|
- {
|
|
|
- qDebug() << "Failed to start transaction:" << db.lastError().text();
|
|
|
- // return false;
|
|
|
- }
|
|
|
- // 假设的 JSON 数据
|
|
|
- QString jsonData = R"(
|
|
|
- {
|
|
|
- "blast_latitude": "30.2039",
|
|
|
- "project_xmbh": "",
|
|
|
- "app_version": "1.52",
|
|
|
- "operator_identity": "330781198509079292",
|
|
|
- "blast_time": "2017-07-12 15:00:15",
|
|
|
- "regs": [
|
|
|
- {
|
|
|
- "net_charged_v": "13499",
|
|
|
- "after_test_bus_i": "0",
|
|
|
- "after_test_bus_v": "7006",
|
|
|
- "equipment_version": "AK01_V3.2_240726",
|
|
|
- "bus_leakage_current_i": "0",
|
|
|
- "reg_deto_count": "2",
|
|
|
- "before_blasting_i": "1",
|
|
|
- "error_deto_count": "2",
|
|
|
- "net_charged_i": "0",
|
|
|
- "before_blasting_v": "13484",
|
|
|
- "dets": [
|
|
|
- {
|
|
|
- "uid": "24211104F18004",
|
|
|
- "freq": "80000",
|
|
|
- "out_code": "2411104F18000",
|
|
|
- "tag": "1-1-1",
|
|
|
- "in_code": "045AC8360A4C0061",
|
|
|
- "status": "0x03",
|
|
|
- "delay_time": "0.0"
|
|
|
- },
|
|
|
- {
|
|
|
- "uid": "24211104F18005",
|
|
|
- "freq": "80000",
|
|
|
- "out_code": "2411104F18001",
|
|
|
- "tag": "1-2-1",
|
|
|
- "in_code": "055AC8360A4C0088",
|
|
|
- "status": "0x03",
|
|
|
- "delay_time": "20.0"
|
|
|
- }
|
|
|
- ],
|
|
|
- "equipment_sn": "F34A0000001"
|
|
|
- }
|
|
|
- ],
|
|
|
- "reg_deto_count": "2",
|
|
|
- "project_name": "sidf",
|
|
|
- "operator_name": "樊工",
|
|
|
- "phone": "18611112222",
|
|
|
- "project_htid": "",
|
|
|
- "company_code": "3701234300003",
|
|
|
- "blast_longitude": "120.196",
|
|
|
- "error_deto_count": "2",
|
|
|
- "equipment_sn": "F34A0000001"
|
|
|
- }
|
|
|
- )";
|
|
|
-
|
|
|
- QJsonDocument doc = QJsonDocument::fromJson(jsonData.toUtf8());
|
|
|
- QJsonObject jsonObj = doc.object();
|
|
|
- // 创建 HBlastRecord 对象
|
|
|
- HBlastRecord record;
|
|
|
- record.setProjectName(jsonObj["project_name"].toString());
|
|
|
- record.setProjectHtid(jsonObj["project_htid"].toString());
|
|
|
- record.setProjectXmbh(jsonObj["project_xmbh"].toString());
|
|
|
- record.setOperatorName(jsonObj["operator_name"].toString());
|
|
|
- record.setPhone(jsonObj["phone"].toString());
|
|
|
- record.setOperatorIdentity(jsonObj["operator_identity"].toString());
|
|
|
- record.setEquipmentSn(jsonObj["equipment_sn"].toString());
|
|
|
- record.setCompanyCode(jsonObj["company_code"].toString());
|
|
|
- record.setAppVersion(jsonObj["app_version"].toString());
|
|
|
-
|
|
|
- // record.setLongitude(jsonObj["blast_longitude"].toString());
|
|
|
- // record.setLatitude(jsonObj["blast_latitude"].toString());
|
|
|
-
|
|
|
- record.setLongitude(lat);
|
|
|
- record.setLatitude(lon);
|
|
|
- record.setRegDetCount(jsonObj["reg_deto_count"].toInt());
|
|
|
- record.setErrorDetCount(jsonObj["error_deto_count"].toInt());
|
|
|
- record.setBlastAt(QDateTime::fromString(jsonObj["blast_time"].toString(), "yyyy-MM-dd hh:mm:ss"));
|
|
|
- record.setCreatedAt(QDateTime::currentDateTime());
|
|
|
- qDebug() << "currentDateTime." << QDateTime::currentDateTime();
|
|
|
-
|
|
|
- record.setUuid(QUuid::createUuid().toString(QUuid::WithoutBraces).remove(QRegularExpression("-")));
|
|
|
-
|
|
|
- // if (dao.addHBlastRecord(record)) {
|
|
|
- // qDebug() << "Record inserted successfully.";
|
|
|
- // }else{
|
|
|
- // qDebug() << "Failed to insert record.";
|
|
|
- // }
|
|
|
- // if (!addDetData(jsonObj)) {
|
|
|
- // qDebug() << "Insert failed for UID:"; // 假设 record 有 uid 成员
|
|
|
- // if (db.rollback()) {
|
|
|
- // qDebug() << "Transaction rolled back successfully.";
|
|
|
- // } else {
|
|
|
- // qDebug() << "Failed to roll back transaction:" << db.lastError().text();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (!addRegData(jsonObj)) {
|
|
|
- // if (db.rollback()) {
|
|
|
- // qDebug() << "Transaction rolled back successfully.";
|
|
|
- // } else {
|
|
|
- // qDebug() << "Failed to roll back transaction:" << db.lastError().text();
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- // db.commit();
|
|
|
-
|
|
|
- if (lat == "定位失败" && lat == "未知" && lon == "定位失败" && lon == "未知")
|
|
|
- {
|
|
|
- // 数据出本地 不传丹灵
|
|
|
- if (dao.addHBlastRecord(record))
|
|
|
- {
|
|
|
- qDebug() << "Record inserted successfully.";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- qDebug() << "Failed to insert record.";
|
|
|
- }
|
|
|
- if (!recordDetsData(jsonObj))
|
|
|
- {
|
|
|
- qDebug() << "Insert failed for UID:"; // 假设 record 有 uid 成员
|
|
|
- if (db.rollback())
|
|
|
- {
|
|
|
- qDebug() << "Transaction rolled back successfully.";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- qDebug() << "Failed to roll back transaction:" << db.lastError().text();
|
|
|
- }
|
|
|
- }
|
|
|
- if (!recordBlastReg(jsonObj))
|
|
|
- {
|
|
|
- if (db.rollback())
|
|
|
- {
|
|
|
- qDebug() << "Transaction rolled back successfully.";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- qDebug() << "Failed to roll back transaction:" << db.lastError().text();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- db.commit();
|
|
|
- }
|
|
|
- // danUpload(jsonObj);
|
|
|
- // if (db.commit()) {
|
|
|
- // qDebug() << "Transaction committed successfully.";
|
|
|
- // } else {
|
|
|
- // qDebug() << "Failed to commit transaction:" << db.lastError().text();
|
|
|
- // }
|
|
|
}
|
|
|
|
|
|
+void firingWidget::testonBlastSucess(const QJsonObject &jsonObj)
|
|
|
+{
|
|
|
+ onBlastSucess(jsonObj);
|
|
|
+}
|
|
|
// 处理爆破成功,安全验证装置通过MQTT传回的数据
|
|
|
void firingWidget::onBlastSucess(const QJsonObject &jsonObj)
|
|
|
{
|
|
@@ -584,41 +433,35 @@ void firingWidget::onBlastSucess(const QJsonObject &jsonObj)
|
|
|
lon = labLon;
|
|
|
|
|
|
saveDataToLocalDB(jsonObj);
|
|
|
- uploadToServer(jsonObj);
|
|
|
|
|
|
- if (lat == "定位失败" && lat == "未知" && lon == "定位失败" && lon == "未知"){
|
|
|
+ if (lat == "定位失败" && lat == "未知" && lon == "定位失败" && lon == "未知")
|
|
|
+ {
|
|
|
QMessageBox::critical(nullptr, "错误", "未获取有效定位数据,数据将暂不上传丹灵");
|
|
|
// 数据:存本地 不传丹灵
|
|
|
}
|
|
|
- // TODO location数据如果错误,不提交丹灵
|
|
|
- // danUpload(jsonObj);
|
|
|
- // if (db.commit()) {
|
|
|
- // qDebug() << "Transaction committed successfully.";
|
|
|
- // } else {
|
|
|
- // qDebug() << "Failed to commit transaction:" << db.lastError().text();
|
|
|
- // }
|
|
|
+ uploadToDanLing(jsonObj);
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
- Id int `json:"-" comment:"主键编码"` // 主键编码
|
|
|
- Uuid string `json:"uuid" comment:""`
|
|
|
- ProjectName string `json:"project_name" comment:"工程名称"`
|
|
|
- ProjectHtid string `json:"project_htid" comment:"合同编号"`
|
|
|
- ProjectXmbh string `json:"project_xmbh" comment:"项目编号"`
|
|
|
- OperatorName string `json:"operator_name" comment:"操作员"`
|
|
|
- Phone string `json:"phone" comment:"操作员电话"`
|
|
|
- OperatorIdentity string `json:"operator_identity" comment:"操作员身份证"`
|
|
|
- EquipmentSn string `json:"equipment_sn" comment:"设备序列号"`
|
|
|
- CompanyCode string `json:"company_code" comment:"公司代码"`
|
|
|
- AppVersion string `json:"app_version" comment:"app版本"`
|
|
|
- Longitude string `json:"blast_longitude" comment:"经度"`
|
|
|
- Latitude string `json:"blast_latitude" comment:"纬度"`
|
|
|
- EquipmentCount string `json:"equipment_count" comment:"设备数量"`
|
|
|
- RegDetCount string `json:"reg_deto_count" comment:"注册雷管数量"`
|
|
|
- ErrorDetCount string `json:"error_deto_count" comment:"异常雷管数量"`
|
|
|
- BlastAt string `json:"blast_time" comment:"爆破时间"`
|
|
|
- Regs []HBlastRecordEquipmentInsertReq `json:"regs"`
|
|
|
- WBlasterId string `json:"w_blaster_id"`
|
|
|
+/*
|
|
|
+ Id int `json:"-" comment:"主键编码"` // 主键编码
|
|
|
+ Uuid string `json:"uuid" comment:""`
|
|
|
+ ProjectName string `json:"project_name" comment:"工程名称"`
|
|
|
+ ProjectHtid string `json:"project_htid" comment:"合同编号"`
|
|
|
+ ProjectXmbh string `json:"project_xmbh" comment:"项目编号"`
|
|
|
+ OperatorName string `json:"operator_name" comment:"操作员"`
|
|
|
+ Phone string `json:"phone" comment:"操作员电话"`
|
|
|
+ OperatorIdentity string `json:"operator_identity" comment:"操作员身份证"`
|
|
|
+ EquipmentSn string `json:"equipment_sn" comment:"设备序列号"`
|
|
|
+ CompanyCode string `json:"company_code" comment:"公司代码"`
|
|
|
+ AppVersion string `json:"app_version" comment:"app版本"`
|
|
|
+ Longitude string `json:"blast_longitude" comment:"经度"`
|
|
|
+ Latitude string `json:"blast_latitude" comment:"纬度"`
|
|
|
+ EquipmentCount string `json:"equipment_count" comment:"设备数量"`
|
|
|
+ RegDetCount string `json:"reg_deto_count" comment:"注册雷管数量"`
|
|
|
+ ErrorDetCount string `json:"error_deto_count" comment:"异常雷管数量"`
|
|
|
+ BlastAt string `json:"blast_time" comment:"爆破时间"`
|
|
|
+ Regs []HBlastRecordEquipmentInsertReq `json:"regs"`
|
|
|
+ WBlasterId string `json:"w_blaster_id"`
|
|
|
*/
|
|
|
void firingWidget::uploadToServer(const QJsonObject &jsonObj)
|
|
|
{
|
|
@@ -636,31 +479,33 @@ void firingWidget::saveDataToLocalDB(const QJsonObject &jsonObj)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (!recordBlastData(jsonObj))
|
|
|
+ HBlastRecord *blastRecord = recordBlastProject(jsonObj);
|
|
|
+ if (blastRecord == nullptr)
|
|
|
{
|
|
|
if (db.rollback())
|
|
|
{
|
|
|
- qDebug() << "Transaction rolled back successfully.";
|
|
|
+ qDebug() << "Transaction rolled back successfully for no blastRecoard created.";
|
|
|
+ Logger::getInstance().error(QString("Failed to create blast record. data: %1").arg(QJsonDocument(jsonObj).toJson(QJsonDocument::Indented)));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
qDebug() << "Failed to roll back transaction:" << db.lastError().text();
|
|
|
}
|
|
|
}
|
|
|
- if (!recordBlastReg(jsonObj))
|
|
|
+ if (!recordBlastEquipments(jsonObj))
|
|
|
{
|
|
|
if (db.rollback())
|
|
|
{
|
|
|
- qDebug() << "Transaction rolled back successfully.";
|
|
|
+ qDebug() << "Transaction rolled back successfully for equiments.";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
qDebug() << "Failed to roll back transaction:" << db.lastError().text();
|
|
|
}
|
|
|
}
|
|
|
- if (!recordDetsData(jsonObj))
|
|
|
+ QList<HBlastRecordDet *> detsRecords = recordDetsData(jsonObj);
|
|
|
+ if (detsRecords.isEmpty())
|
|
|
{
|
|
|
- qDebug() << "Insert failed for UID:"; // 假设 record 有 uid 成员
|
|
|
if (db.rollback())
|
|
|
{
|
|
|
qDebug() << "Transaction rolled back successfully.";
|
|
@@ -672,77 +517,95 @@ void firingWidget::saveDataToLocalDB(const QJsonObject &jsonObj)
|
|
|
}
|
|
|
|
|
|
db.commit();
|
|
|
+
|
|
|
+ if (blastRecord != nullptr)
|
|
|
+ {
|
|
|
+ if (!backendAPIManager::uploadBlastProject(blastRecord->BlastRecordToJson()))
|
|
|
+ {
|
|
|
+ Logger::getInstance().error(QString("Failed to upload blast project. data: %1").arg(QJsonDocument(blastRecord->BlastRecordToJson()).toJson(QJsonDocument::Indented)));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-HBlastRecord* firingWidget::recordBlastData(const QJsonObject &jsonObj)
|
|
|
+HBlastRecord *firingWidget::recordBlastProject(const QJsonObject &jsonObj)
|
|
|
{
|
|
|
- HBlastRecord record;
|
|
|
- record.setProjectName(jsonObj["project_name"].toString());
|
|
|
- record.setProjectHtid(jsonObj["project_htid"].toString());
|
|
|
- record.setProjectXmbh(jsonObj["project_xmbh"].toString());
|
|
|
- record.setOperatorName(jsonObj["operator_name"].toString());
|
|
|
- record.setPhone(jsonObj["phone"].toString());
|
|
|
- record.setOperatorIdentity(jsonObj["operator_identity"].toString());
|
|
|
- record.setEquipmentSn(jsonObj["equipment_sn"].toString());
|
|
|
- record.setCompanyCode(jsonObj["company_code"].toString());
|
|
|
- record.setAppVersion(jsonObj["app_version"].toString());
|
|
|
-
|
|
|
- record.setLongitude(jsonObj["blast_longitude"].toString());
|
|
|
- record.setLatitude(jsonObj["blast_latitude"].toString());
|
|
|
-
|
|
|
- // record.setLongitude(lat);
|
|
|
- // record.setLatitude(lon);
|
|
|
- record.setRegDetCount(jsonObj["reg_deto_count"].toString().toInt());
|
|
|
- record.setErrorDetCount(jsonObj["error_deto_count"].toString().toInt());
|
|
|
- QDateTime blastTime = QDateTime::fromString(jsonObj["blast_time"].toString(), "yyyy-MM-dd hh:mm:ss +08:00");
|
|
|
- blastTime.setTimeZone(QTimeZone(QByteArrayLiteral("Asia/Shanghai")));
|
|
|
- record.setBlastAt(blastTime);
|
|
|
- record.setCreatedAt(QDateTime::currentDateTime());
|
|
|
- qDebug() << "currentDateTime." << QDateTime::currentDateTime();
|
|
|
- record.setUuid(blast_uuid);
|
|
|
-
|
|
|
- if (dao.addHBlastRecord(record))
|
|
|
+ HBlastRecord *record = new HBlastRecord();
|
|
|
+ record->setProjectName(jsonObj["project_name"].toString());
|
|
|
+ record->setProjectHtid(jsonObj["project_htid"].toString());
|
|
|
+ record->setProjectXmbh(jsonObj["project_xmbh"].toString());
|
|
|
+ record->setOperatorName(jsonObj["operator_name"].toString());
|
|
|
+ record->setPhone(jsonObj["phone"].toString());
|
|
|
+ record->setOperatorIdentity(jsonObj["operator_identity"].toString());
|
|
|
+ record->setEquipmentSn(jsonObj["equipment_sn"].toString());
|
|
|
+ record->setCompanyCode(jsonObj["company_code"].toString());
|
|
|
+ record->setAppVersion(jsonObj["app_version"].toString());
|
|
|
+
|
|
|
+ record->setLongitude(jsonObj["blast_longitude"].toString().left(10));
|
|
|
+ record->setLatitude(jsonObj["blast_latitude"].toString().left(10));
|
|
|
+
|
|
|
+ // record->setLongitude(lat);
|
|
|
+ // record->setLatitude(lon);
|
|
|
+ record->setRegDetCount(jsonObj["reg_deto_count"].toString().toInt());
|
|
|
+ record->setErrorDetCount(jsonObj["error_deto_count"].toString().toInt());
|
|
|
+ QDateTime blastTime = QDateTime::fromString(jsonObj["blast_time"].toString(), "yyyy-MM-dd hh:mm:ss");
|
|
|
+ // blastTime.setTimeZone(QTimeZone(QByteArrayLiteral("Asia/Shanghai")));
|
|
|
+ record->setBlastAt(blastTime);
|
|
|
+ record->setCreatedAt(QDateTime::currentDateTime());
|
|
|
+ record->setUuid(blast_uuid);
|
|
|
+
|
|
|
+ if (dao.addHBlastRecord(*record))
|
|
|
{
|
|
|
qDebug() << "Record inserted successfully.";
|
|
|
- return &record;
|
|
|
+ return record;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
qDebug() << "Failed to insert record.";
|
|
|
+ delete record;
|
|
|
return nullptr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-bool firingWidget::recordDetsData(const QJsonObject &jsonObj)
|
|
|
+QList<HBlastRecordDet *> firingWidget::recordDetsData(const QJsonObject &jsonObj)
|
|
|
{
|
|
|
+ QList<HBlastRecordDet *> recordDets;
|
|
|
QJsonArray regsArray = jsonObj["regs"].toArray();
|
|
|
+
|
|
|
for (const auto ®Value : regsArray)
|
|
|
{
|
|
|
QJsonObject regObj = regValue.toObject();
|
|
|
QJsonArray detsArray = regObj["dets"].toArray();
|
|
|
+
|
|
|
for (const auto &detValue : detsArray)
|
|
|
{
|
|
|
QJsonObject detObj = detValue.toObject();
|
|
|
- HBlastRecordDet recordDet;
|
|
|
-
|
|
|
- recordDet.setId(0);
|
|
|
- recordDet.setUuid(QUuid::createUuid().toString(QUuid::WithoutBraces).remove(QRegularExpression("-")));
|
|
|
- recordDet.setOutCode(detObj["out_code"].toString());
|
|
|
- recordDet.setInnerCode(detObj["in_code"].toString());
|
|
|
- recordDet.setUid(detObj["uid"].toString());
|
|
|
- recordDet.setStatus(detObj["status"].toString());
|
|
|
- recordDet.setFreq(detObj["freq"].toString());
|
|
|
- recordDet.setDelayTime(detObj["delay_time"].toString());
|
|
|
- recordDet.setTag(detObj["tag"].toString());
|
|
|
- recordDet.setCreatedAt(QDateTime::currentDateTime());
|
|
|
- recordDet.setBlastRecordId(blast_uuid);
|
|
|
- recordDet.setRegId(reg_uuid);
|
|
|
- recordDet.setCreatedAt(QDateTime::currentDateTime());
|
|
|
- if (!daoDet.addHBlastRecordDet(recordDet))
|
|
|
+ HBlastRecordDet *recordDet = new HBlastRecordDet();
|
|
|
+
|
|
|
+ recordDet->setId(0);
|
|
|
+ recordDet->setUuid(QUuid::createUuid().toString(QUuid::WithoutBraces).remove(QRegularExpression("-")));
|
|
|
+ recordDet->setOutCode(detObj["out_code"].toString());
|
|
|
+ recordDet->setInnerCode(detObj["in_code"].toString());
|
|
|
+ recordDet->setUid(detObj["uid"].toString());
|
|
|
+ recordDet->setStatus(detObj["status"].toString());
|
|
|
+ recordDet->setFreq(detObj["freq"].toString());
|
|
|
+ recordDet->setDelayTime(detObj["delay_time"].toString());
|
|
|
+ recordDet->setTag(detObj["tag"].toString());
|
|
|
+ recordDet->setCreatedAt(QDateTime::currentDateTime());
|
|
|
+ recordDet->setBlastRecordId(blast_uuid);
|
|
|
+ recordDet->setRegId(reg_uuid);
|
|
|
+ recordDet->setCreatedAt(QDateTime::currentDateTime());
|
|
|
+
|
|
|
+ if (daoDet.addHBlastRecordDet(*recordDet))
|
|
|
+ {
|
|
|
+ recordDets.append(recordDet);
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- return false;
|
|
|
+ Logger::getInstance().error(QString("Failed to insert record det. data %1").arg(QJsonDocument(recordDet->BlastRecordDetToJson()).toJson(QJsonDocument::Compact)));
|
|
|
+ delete recordDet;
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return true;
|
|
|
+ return recordDets;
|
|
|
}
|