Skip to content
Snippets Groups Projects
Commit 6042d45c authored by Jan Reher's avatar Jan Reher
Browse files

Changed TestXmlStructure.cxx to output a structure for unit assignment

to module
parent cc311d87
No related branches found
No related tags found
2 merge requests!4Many proven updates being brought into stable branch.,!3Commented in the lines in apdUnitCreator.cpp that do the actual database
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <iostream> #include <iostream>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtXml/QXmlStreamWriter> #include <QXML/QXmlStreamWriter> // For Compilation: QXml/QXmlStreamWriter
#include "productiondatabaseclient.h" #include "productiondatabaseclient.h"
ProductionDatabase::ProductionDatabaseClient *proddbclient; ProductionDatabase::ProductionDatabaseClient *proddbclient;
...@@ -11,13 +11,20 @@ void initialize(); ...@@ -11,13 +11,20 @@ void initialize();
void screeningInfo(); void screeningInfo();
void assignApds(std::string redSerial, std::string blueSerial); void assignApds(std::string redSerial, std::string blueSerial);
void assignUnit(std::string detectorSerial, std::string crystalSerial, std::string barcode); void assignUnit(std::string detectorSerial, std::string crystalSerial, std::string barcode);
void assignToModule(std::vector<uint> barcodes, std::string moduleSN);
int main() { int main() {
initialize(); initialize();
assignApds("0607004597", "0607004598" ); std::vector<uint> barcodes;
assignApds("0607004600", "0607004601" ); barcodes.push_back(1309009619);
assignUnit("0607004598/0607004597","790","1309009220"); barcodes.push_back(1309009602);
assignUnit("0607004601/0607004600","790","1309009237"); barcodes.push_back(1309009633);
barcodes.push_back(1309009664);
barcodes.push_back(1309009657);
barcodes.push_back(1309009696);
barcodes.push_back(1309009640);
barcodes.push_back(1309009626);
assignToModule(barcodes, "29012015-9");
return 0; return 0;
} }
...@@ -28,6 +35,38 @@ void initialize() { ...@@ -28,6 +35,38 @@ void initialize() {
proddbclient->checkConnectivityAndCredentials(); proddbclient->checkConnectivityAndCredentials();
} }
void assignToModule(std::vector<uint> barcodes, std::string moduleSN) {
QString buffer;
QXmlStreamWriter xml ( &buffer );
xml.setAutoFormatting(true);
xml.writeStartDocument( QString::fromUtf8( "1.0" ) );
xml.writeStartElement( QString::fromUtf8( "productiondb" ) ) ;
xml.writeTextElement("moduleSN",QString::fromStdString(moduleSN));
xml.writeEmptyElement("Slot0");
xml.writeEmptyElement("Slot1");
xml.writeEmptyElement("Slot2");
xml.writeEmptyElement("Slot3");
xml.writeEmptyElement("Slot4");
xml.writeEmptyElement("Slot5");
xml.writeEmptyElement("Slot6");
xml.writeEmptyElement("Slot7");
xml.writeTextElement("Slot8",QString::number(barcodes[0]));
xml.writeTextElement("Slot9",QString::number(barcodes[1] ));
xml.writeTextElement("SlotA",QString::number(barcodes[2] ));
xml.writeTextElement("SlotB",QString::number(barcodes[3] ));
xml.writeTextElement("SlotC",QString::number(barcodes[4] ));
xml.writeTextElement("SlotD",QString::number(barcodes[5] ));
xml.writeTextElement("SlotE",QString::number(barcodes[6] ));
xml.writeTextElement("SlotF",QString::number(barcodes[7] ));
xml.writeEndDocument();
std::string xmlRequest = buffer.toStdString();
std::cerr << xmlRequest << std::endl;
//proddbclient->postXmlRequest("",xmlRequest);
}
void assignUnit(std::string detectorSerial, std::string crystalSerial, std::string barcode) { void assignUnit(std::string detectorSerial, std::string crystalSerial, std::string barcode) {
QString buffer; QString buffer;
QXmlStreamWriter xml ( &buffer ); QXmlStreamWriter xml ( &buffer );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment