|
@@ -76,37 +76,6 @@ void ProjectDialog::updateL3AddressOptions() {
|
|
|
|
|
|
void ProjectDialog::setChildOptions(const QJsonArray &newDataOptions) { dataOptions = newDataOptions; }
|
|
void ProjectDialog::setChildOptions(const QJsonArray &newDataOptions) { dataOptions = newDataOptions; }
|
|
|
|
|
|
-void ProjectDialog::SetComboBoxLora(const QString &grandChildName) {
|
|
|
|
- ui->comboBoxLora->clear();
|
|
|
|
- for (const QJsonValue &item : dataOptions) {
|
|
|
|
- const QJsonArray &childrenArray = item["children"].toArray();
|
|
|
|
- for (const QJsonValue &child : childrenArray) {
|
|
|
|
- const QJsonObject &childObj = child.toObject();
|
|
|
|
- const QJsonArray &grandChildrenArray = childObj["children"].toArray();
|
|
|
|
- for (const QJsonValue &grandChild : grandChildrenArray) {
|
|
|
|
- const QJsonObject &grandChildObj = grandChild.toObject();
|
|
|
|
- if (grandChildObj["name"].toString() == grandChildName) {
|
|
|
|
- const QJsonArray &greatGrandChildrenArray = grandChildObj["children"].toArray();
|
|
|
|
- for (const QJsonValue &greatGrandChild : greatGrandChildrenArray) {
|
|
|
|
- const QJsonObject &greatGrandChildObj = greatGrandChild.toObject();
|
|
|
|
- qDebug() << "greatGrandChildObj " << greatGrandChildObj;
|
|
|
|
- QString name = greatGrandChildObj["name"].toString();
|
|
|
|
- QString loraSn = greatGrandChildObj["loraSn"].toString();
|
|
|
|
- ui->comboBoxLora->addItem(name);
|
|
|
|
- nameLoraSnMap.insert(name, loraSn);
|
|
|
|
- QHash<QString, QString>::const_iterator i;
|
|
|
|
- for (i = nameLoraSnMap.constBegin(); i != nameLoraSnMap.constEnd(); ++i) {
|
|
|
|
- qDebug() << "Key:" << i.key() << ", Value:" << i.value();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ui->comboBoxLora->setCurrentIndex(-1);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void ProjectDialog::extractNames(const QJsonArray &array, QStringList &names) {
|
|
void ProjectDialog::extractNames(const QJsonArray &array, QStringList &names) {
|
|
for (const auto &item : array) {
|
|
for (const auto &item : array) {
|
|
if (item.isObject()) {
|
|
if (item.isObject()) {
|
|
@@ -150,13 +119,6 @@ void ProjectDialog::on_comboBoxAddr_2_currentIndexChanged(int index) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ProjectDialog::on_comboBoxAddr_3_currentIndexChanged(int index) {
|
|
|
|
- if (index >= 0 && index < L3AddressOptions.size()) {
|
|
|
|
- QString grandChildName = L3AddressOptions[index].toObject()["uuid"].toString();
|
|
|
|
- SetComboBoxLora(grandChildName);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void ProjectDialog::validateAndSaveProject() {
|
|
void ProjectDialog::validateAndSaveProject() {
|
|
QString detNum = ui->editDetNum->text().trimmed();
|
|
QString detNum = ui->editDetNum->text().trimmed();
|
|
QString blastCount = ui->editRegCount->text().trimmed();
|
|
QString blastCount = ui->editRegCount->text().trimmed();
|
|
@@ -169,7 +131,6 @@ void ProjectDialog::validateAndSaveProject() {
|
|
QString l1AddressName = ui->comboBoxAddr->currentText().trimmed();
|
|
QString l1AddressName = ui->comboBoxAddr->currentText().trimmed();
|
|
QString l2AddressName = ui->comboBoxAddr_2->currentText().trimmed();
|
|
QString l2AddressName = ui->comboBoxAddr_2->currentText().trimmed();
|
|
QString l3AddressName = ui->comboBoxAddr_3->currentText().trimmed();
|
|
QString l3AddressName = ui->comboBoxAddr_3->currentText().trimmed();
|
|
- QString loraAddress = ui->comboBoxLora->currentText().trimmed();
|
|
|
|
QString xmbh = ui->editXMBH->text().trimmed();
|
|
QString xmbh = ui->editXMBH->text().trimmed();
|
|
QString htid = ui->editHTID->text().trimmed();
|
|
QString htid = ui->editHTID->text().trimmed();
|
|
|
|
|
|
@@ -201,8 +162,6 @@ void ProjectDialog::validateAndSaveProject() {
|
|
data["addressUuid"] = addressUuid;
|
|
data["addressUuid"] = addressUuid;
|
|
data["blasterIdentity"] = blasterId;
|
|
data["blasterIdentity"] = blasterId;
|
|
data["operatorIdentity"] = operatorId;
|
|
data["operatorIdentity"] = operatorId;
|
|
- data["loraAddress"] = loraAddress;
|
|
|
|
- data["loraSn"] = nameLoraSnMap.value(loraAddress);
|
|
|
|
data["blastCount"] = blastCount;
|
|
data["blastCount"] = blastCount;
|
|
if (operationStatus == 0) {
|
|
if (operationStatus == 0) {
|
|
emit validateDetNum(data);
|
|
emit validateDetNum(data);
|
|
@@ -228,6 +187,7 @@ void ProjectDialog::setFormData(const HProject &Project) {
|
|
ui->editHTID->setText(Project.getHtid());
|
|
ui->editHTID->setText(Project.getHtid());
|
|
ui->editXMBH->setText(Project.getXmbh());
|
|
ui->editXMBH->setText(Project.getXmbh());
|
|
ui->editRegCount->setText(Project.getBlastCount());
|
|
ui->editRegCount->setText(Project.getBlastCount());
|
|
|
|
+ ui->level4Address->setText(Project.getLevel4Address());
|
|
int indexBlast = ui->comboBoxBlast->findText(Project.getBlasterName());
|
|
int indexBlast = ui->comboBoxBlast->findText(Project.getBlasterName());
|
|
if (indexBlast != -1) {
|
|
if (indexBlast != -1) {
|
|
ui->comboBoxBlast->setCurrentIndex(indexBlast);
|
|
ui->comboBoxBlast->setCurrentIndex(indexBlast);
|