Continued
This commit is contained in:
parent
05c9a1dcf2
commit
dfb074e4ce
@ -1,7 +1,6 @@
|
|||||||
QT += core
|
QT += core
|
||||||
QT += serialport network
|
|
||||||
|
|
||||||
TARGET = ATBDownloadDCFirmware
|
TARGET = util
|
||||||
|
|
||||||
VERSION="0.1.0"
|
VERSION="0.1.0"
|
||||||
win32 {
|
win32 {
|
||||||
@ -63,11 +62,11 @@ contains( CONFIG, DesktopLinux ) {
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
tariff_json_template.cpp \
|
tariff_json_template.cpp \
|
||||||
tariff_json_parser.cpp
|
tariff_editor.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
tariff_json_template.h \
|
tariff_json_template.h \
|
||||||
tariff_json_parser.h
|
tariff_editor.h
|
||||||
|
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
tariff.json \
|
tariff.json \
|
||||||
|
@ -1,9 +1,51 @@
|
|||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "tariff_editor.h"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
Q_UNUSED(argc);
|
Q_UNUSED(argc);
|
||||||
Q_UNUSED(argv);
|
Q_UNUSED(argv);
|
||||||
|
|
||||||
|
TariffEditor editor;
|
||||||
|
editor.writeToDocument("Project", "Szeged");
|
||||||
|
editor.writeToDocument("Version", "1.0.0");
|
||||||
|
editor.writeToDocument("Date", "01.01.1970");
|
||||||
|
editor.writeToDocument("Commiter" , "");
|
||||||
|
editor.writeToDocument("Info", "");
|
||||||
|
|
||||||
|
editor.writeToDocument(editor.create("TariffType"));
|
||||||
|
editor.writeToDocument(editor.create("TariffAccuracy"));
|
||||||
|
editor.writeToDocument(editor.create("TariffPrice"));
|
||||||
|
editor.writeToDocument(editor.create("TariffProducts"));
|
||||||
|
editor.writeToDocument(editor.create("TariffConfig"));
|
||||||
|
editor.writeToDocument(editor.create("TimeRanges"));
|
||||||
|
|
||||||
|
|
||||||
|
qCritical().noquote() << editor.document().toJson();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
QFile currentFile("/home/linux/ATBTariffCalculator/Utilities/tariff.template.json");
|
||||||
|
if (currentFile.open(QIODevice::ReadOnly)) {
|
||||||
|
|
||||||
|
qCritical() << __LINE__;
|
||||||
|
QByteArray json = currentFile.readAll();
|
||||||
|
|
||||||
|
QJsonParseError e;
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(json, &e);
|
||||||
|
if (e.error == QJsonParseError::NoError) {
|
||||||
|
qCritical().noquote() << doc.toJson(QJsonDocument::JsonFormat::Indented);
|
||||||
|
} else {
|
||||||
|
qCritical() << e.errorString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,22 @@ Tarif-Datei Szeged in Zone 1 (expandiert, Vorschlag):
|
|||||||
"Commiter":"",
|
"Commiter":"",
|
||||||
"Info":"",
|
"Info":"",
|
||||||
|
|
||||||
|
"TariffType": [
|
||||||
|
{
|
||||||
|
"tariff_type_id": 1,
|
||||||
|
"tariff_type_label": "uniform-to-the-minute",
|
||||||
|
"comment": "same price for all computational units (minutes)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"TariffAccuracy": [
|
||||||
|
{
|
||||||
|
"tariff_accuracy_id": 1,
|
||||||
|
"tariff_accuracy_label": "computation per minute",
|
||||||
|
"tariff_accuracy_value": 1,
|
||||||
|
"comment": "accuracy of tariff computation is individual minutes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
"Products" : [
|
"Products" : [
|
||||||
{
|
{
|
||||||
"tariff_product_id": 0,
|
"tariff_product_id": 0,
|
||||||
@ -18,44 +34,17 @@ Tarif-Datei Szeged in Zone 1 (expandiert, Vorschlag):
|
|||||||
"tariff_product_time_ranges" : [100001]
|
"tariff_product_time_ranges" : [100001]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TariffAccuracy": [
|
|
||||||
{
|
|
||||||
"tariff_accuracy_id": 1,
|
|
||||||
"tariff_accuracy_label": "computation per minute",
|
|
||||||
"tariff_accuracy_value": 1,
|
|
||||||
"comment": "accuracy of tariff computation is individual minutes"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"TariffType": [
|
|
||||||
{
|
|
||||||
"tariff_type_id": 1,
|
|
||||||
"tariff_type_label": "linear",
|
|
||||||
"comment": "same price for all computational units, typically minutes"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"TariffTimeBase": [
|
|
||||||
{
|
|
||||||
"tariff_timebase_id": 1,
|
|
||||||
"tariff_timebase_label": "dynamic-timebase",
|
|
||||||
"comment": "computation starts at minute 0 (can be any minute during the day)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tariff_timebase_id": 2,
|
|
||||||
"tariff_timebase_label": "wall-clock-timebase",
|
|
||||||
"comment": "computation starts at fixed wall-clock time"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"TariffPriceCustomer": [
|
"TariffPriceCustomer": [
|
||||||
{
|
{
|
||||||
"tariff_price_customer_id": 1,
|
"tariff_price_customer_id": 1,
|
||||||
"tariff_price_customer": 165,
|
"tariff_price_customer": 165,
|
||||||
"editable": true,
|
"editable": true,
|
||||||
"comment": "price per hour as entered by customer"
|
"comment": "price per hour as entered by customer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tariff_price_customer_id": 2,
|
"tariff_price_customer_id": 2,
|
||||||
"tariff_price_customer": 990,
|
"tariff_price_customer": 990,
|
||||||
"editable": true,
|
"editable": true,
|
||||||
"comment": "price for dayticket as entered by customer"
|
"comment": "price for dayticket as entered by customer"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -92,10 +81,12 @@ Tarif-Datei Szeged in Zone 1 (expandiert, Vorschlag):
|
|||||||
},
|
},
|
||||||
"MinimalPrice": {
|
"MinimalPrice": {
|
||||||
"value" : 1,
|
"value" : 1,
|
||||||
|
"editable": true,
|
||||||
"comment": "price-id of customer entered price (for hour) expressed in minimal time: 15*(165/60) = 41.25"
|
"comment": "price-id of customer entered price (for hour) expressed in minimal time: 15*(165/60) = 41.25"
|
||||||
},
|
},
|
||||||
"MaximalPrice": {
|
"MaximalPrice": {
|
||||||
"value" : 1,
|
"value" : 1,
|
||||||
|
"editable": true,
|
||||||
"comment": "price-id of customer entered price (for hour) expressed in maximal time: 360*(165/60) = 990"
|
"comment": "price-id of customer entered price (for hour) expressed in maximal time: 360*(165/60) = 990"
|
||||||
},
|
},
|
||||||
"tariff_config_time_base": 1,
|
"tariff_config_time_base": 1,
|
||||||
|
@ -54,37 +54,37 @@
|
|||||||
{
|
{
|
||||||
"tariff_price_customer_id": 2,
|
"tariff_price_customer_id": 2,
|
||||||
"tariff_price_customer": 990,
|
"tariff_price_customer": 990,
|
||||||
"editable": true,
|
"editable": true,
|
||||||
"comment": "price for dayticket as entered by customer"
|
"comment": "price for dayticket as entered by customer"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TariffConfig": [
|
"TariffConfig": {
|
||||||
"tariff_config_id": 1,
|
"tariff_config_id": 1,
|
||||||
"tariff_config_label": "Tariff Config 1",
|
"tariff_config_label": "Tariff Config 1",
|
||||||
"tariff_config_accuracy": 1,
|
"tariff_config_accuracy": 1,
|
||||||
"tariff_config_type": 1,
|
"tariff_config_type": 1,
|
||||||
"MinimalTime": {
|
"MinimalTime": {
|
||||||
"value": 15,
|
"value": 15,
|
||||||
"editable": true,
|
"editable": true,
|
||||||
"comment": "minimal parking time in minutes (net)"
|
"comment": "minimal parking time in minutes (net)"
|
||||||
},
|
},
|
||||||
"MaximalTime": {
|
"MaximalTime": {
|
||||||
"value" : 360,
|
"value" : 360,
|
||||||
"editable": true,
|
"editable": true,
|
||||||
"comment": "maximal parking time in minutes (net)"
|
"comment": "maximal parking time in minutes (net)"
|
||||||
},
|
},
|
||||||
"MinimalPrice": {
|
"MinimalPrice": {
|
||||||
"value" : 1,
|
"value" : 1,
|
||||||
"comment": "price-id of customer entered price (for hour) expressed in minimal time: 15*(165/60) = 41.25"
|
"comment": "price-id of customer entered price (for hour) expressed in minimal time: 15*(165/60) = 41.25"
|
||||||
},
|
},
|
||||||
"MaximalPrice": {
|
"MaximalPrice": {
|
||||||
"value" : 1,
|
"value" : 1,
|
||||||
"comment": "price-id of customer entered price (for hour) expressed in maximal time: 360*(165/60) = 990"
|
"comment": "price-id of customer entered price (for hour) expressed in maximal time: 360*(165/60) = 990"
|
||||||
},
|
},
|
||||||
"tariff_config_time_base": 1,
|
"tariff_config_time_base": 1,
|
||||||
"tariff_config_carry_over": true,
|
"tariff_config_carry_over": true,
|
||||||
"tariff_config_prepaid": true
|
"tariff_config_prepaid": true
|
||||||
],
|
},
|
||||||
"TimeRanges" : [
|
"TimeRanges" : [
|
||||||
{
|
{
|
||||||
"time_range_id": 0,
|
"time_range_id": 0,
|
||||||
@ -5564,190 +5564,205 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"DayConfigurations": [
|
"DayConfigurations": [
|
||||||
"DayConfig_1": {
|
{
|
||||||
"day_config_id": 0,
|
"DayConfig_1": {
|
||||||
"day_config_date_range": 6,
|
"day_config_id": 0,
|
||||||
"comment_1": "day config is valid for the whole year",
|
"day_config_date_range": 6,
|
||||||
"day_config_product_ids": [0, 1],
|
"comment_1": "day config is valid for the whole year",
|
||||||
"comment_2": "short-time-parking or day-ticket on this day",
|
"day_config_product_ids": [0, 1],
|
||||||
"day_config_day_time_ranges": [
|
"comment_2": "short-time-parking or day-ticket on this day",
|
||||||
{
|
"day_config_day_time_ranges": [
|
||||||
// hier die time-ranges. werden mittels eines noch zu schrebenden tools erzeugt
|
{
|
||||||
// 100002: zeitbereich von 00:00-08:00
|
"day_time_ranges_short_time_parking": [
|
||||||
// 0-1079: jeweils eine minute
|
100002,
|
||||||
// 100003: zeitbereich von 18:00-24:00
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||||
"day_time_ranges_short_time_parking":" [
|
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||||
100002,
|
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
||||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
||||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
||||||
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
|
||||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||||
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
|
||||||
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
|
90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
|
||||||
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
|
||||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
|
110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
|
||||||
90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
|
120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
|
||||||
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
|
130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
|
||||||
110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
|
140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
|
||||||
120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
|
150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||||
130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
|
160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
|
||||||
140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
|
170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
|
||||||
150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
|
||||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
|
190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
|
||||||
170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
|
200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
|
||||||
180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
|
210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
|
||||||
190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
|
220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
|
||||||
200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
|
230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||||
210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
|
240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
|
||||||
220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
|
250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
|
||||||
230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
|
||||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
|
270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
|
||||||
250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
|
280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
|
||||||
260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
|
290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
|
||||||
270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
|
300, 301, 302, 303, 304, 305, 306, 307, 308, 309,
|
||||||
280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
|
310, 311, 312, 313, 314, 315, 316, 317, 318, 319,
|
||||||
290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
|
320, 321, 322, 323, 324, 325, 326, 327, 328, 329,
|
||||||
300, 301, 302, 303, 304, 305, 306, 307, 308, 309,
|
330, 331, 332, 333, 334, 335, 336, 337, 338, 339,
|
||||||
310, 311, 312, 313, 314, 315, 316, 317, 318, 319,
|
340, 341, 342, 343, 344, 345, 346, 347, 348, 349,
|
||||||
320, 321, 322, 323, 324, 325, 326, 327, 328, 329,
|
350, 351, 352, 353, 354, 355, 356, 357, 358, 359,
|
||||||
330, 331, 332, 333, 334, 335, 336, 337, 338, 339,
|
360, 361, 362, 363, 364, 365, 366, 367, 368, 369,
|
||||||
340, 341, 342, 343, 344, 345, 346, 347, 348, 349,
|
370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
|
||||||
350, 351, 352, 353, 354, 355, 356, 357, 358, 359,
|
380, 381, 382, 383, 384, 385, 386, 387, 388, 389,
|
||||||
360, 361, 362, 363, 364, 365, 366, 367, 368, 369,
|
390, 391, 392, 393, 394, 395, 396, 397, 398, 399,
|
||||||
370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
|
400, 401, 402, 403, 404, 405, 406, 407, 408, 409,
|
||||||
380, 381, 382, 383, 384, 385, 386, 387, 388, 389,
|
410, 411, 412, 413, 414, 415, 416, 417, 418, 419,
|
||||||
390, 391, 392, 393, 394, 395, 396, 397, 398, 399,
|
420, 421, 422, 423, 424, 425, 426, 427, 428, 429,
|
||||||
400, 401, 402, 403, 404, 405, 406, 407, 408, 409,
|
430, 431, 432, 433, 434, 435, 436, 437, 438, 439,
|
||||||
410, 411, 412, 413, 414, 415, 416, 417, 418, 419,
|
440, 441, 442, 443, 444, 445, 446, 447, 448, 449,
|
||||||
420, 421, 422, 423, 424, 425, 426, 427, 428, 429,
|
450, 451, 452, 453, 454, 455, 456, 457, 458, 459,
|
||||||
430, 431, 432, 433, 434, 435, 436, 437, 438, 439,
|
460, 461, 462, 463, 464, 465, 466, 467, 468, 469,
|
||||||
440, 441, 442, 443, 444, 445, 446, 447, 448, 449,
|
470, 471, 472, 473, 474, 475, 476, 477, 478, 479,
|
||||||
450, 451, 452, 453, 454, 455, 456, 457, 458, 459,
|
480, 481, 482, 483, 484, 485, 486, 487, 488, 489,
|
||||||
460, 461, 462, 463, 464, 465, 466, 467, 468, 469,
|
490, 491, 492, 493, 494, 495, 496, 497, 498, 499,
|
||||||
470, 471, 472, 473, 474, 475, 476, 477, 478, 479,
|
500, 501, 502, 503, 504, 505, 506, 507, 508, 509,
|
||||||
480, 481, 482, 483, 484, 485, 486, 487, 488, 489,
|
510, 511, 512, 513, 514, 515, 516, 517, 518, 519,
|
||||||
490, 491, 492, 493, 494, 495, 496, 497, 498, 499,
|
520, 521, 522, 523, 524, 525, 526, 527, 528, 529,
|
||||||
500, 501, 502, 503, 504, 505, 506, 507, 508, 509,
|
530, 531, 532, 533, 534, 535, 536, 537, 538, 539,
|
||||||
510, 511, 512, 513, 514, 515, 516, 517, 518, 519,
|
540, 541, 542, 543, 544, 545, 546, 547, 548, 549,
|
||||||
520, 521, 522, 523, 524, 525, 526, 527, 528, 529,
|
550, 551, 552, 553, 554, 555, 556, 557, 558, 559,
|
||||||
530, 531, 532, 533, 534, 535, 536, 537, 538, 539,
|
560, 561, 562, 563, 564, 565, 566, 567, 568, 569,
|
||||||
540, 541, 542, 543, 544, 545, 546, 547, 548, 549,
|
570, 571, 572, 573, 574, 575, 576, 577, 578, 579,
|
||||||
550, 551, 552, 553, 554, 555, 556, 557, 558, 559,
|
580, 581, 582, 583, 584, 585, 586, 587, 588, 589,
|
||||||
560, 561, 562, 563, 564, 565, 566, 567, 568, 569,
|
590, 591, 592, 593, 594, 595, 596, 597, 598, 599,
|
||||||
570, 571, 572, 573, 574, 575, 576, 577, 578, 579,
|
600, 601, 602, 603, 604, 605, 606, 607, 608, 609,
|
||||||
580, 581, 582, 583, 584, 585, 586, 587, 588, 589,
|
610, 611, 612, 613, 614, 615, 616, 617, 618, 619,
|
||||||
590, 591, 592, 593, 594, 595, 596, 597, 598, 599,
|
620, 621, 622, 623, 624, 625, 626, 627, 628, 629,
|
||||||
600, 601, 602, 603, 604, 605, 606, 607, 608, 609,
|
630, 631, 632, 633, 634, 635, 636, 637, 638, 639,
|
||||||
610, 611, 612, 613, 614, 615, 616, 617, 618, 619,
|
640, 641, 642, 643, 644, 645, 646, 647, 648, 649,
|
||||||
620, 621, 622, 623, 624, 625, 626, 627, 628, 629,
|
650, 651, 652, 653, 654, 655, 656, 657, 658, 659,
|
||||||
630, 631, 632, 633, 634, 635, 636, 637, 638, 639,
|
660, 661, 662, 663, 664, 665, 666, 667, 668, 669,
|
||||||
640, 641, 642, 643, 644, 645, 646, 647, 648, 649,
|
670, 671, 672, 673, 674, 675, 676, 677, 678, 679,
|
||||||
650, 651, 652, 653, 654, 655, 656, 657, 658, 659,
|
680, 681, 682, 683, 684, 685, 686, 687, 688, 689,
|
||||||
660, 661, 662, 663, 664, 665, 666, 667, 668, 669,
|
690, 691, 692, 693, 694, 695, 696, 697, 698, 699,
|
||||||
670, 671, 672, 673, 674, 675, 676, 677, 678, 679,
|
700, 701, 702, 703, 704, 705, 706, 707, 708, 709,
|
||||||
680, 681, 682, 683, 684, 685, 686, 687, 688, 689,
|
710, 711, 712, 713, 714, 715, 716, 717, 718, 719,
|
||||||
690, 691, 692, 693, 694, 695, 696, 697, 698, 699,
|
720, 721, 722, 723, 724, 725, 726, 727, 728, 729,
|
||||||
700, 701, 702, 703, 704, 705, 706, 707, 708, 709,
|
730, 731, 732, 733, 734, 735, 736, 737, 738, 739,
|
||||||
710, 711, 712, 713, 714, 715, 716, 717, 718, 719,
|
740, 741, 742, 743, 744, 745, 746, 747, 748, 749,
|
||||||
720, 721, 722, 723, 724, 725, 726, 727, 728, 729,
|
750, 751, 752, 753, 754, 755, 756, 757, 758, 759,
|
||||||
730, 731, 732, 733, 734, 735, 736, 737, 738, 739,
|
760, 761, 762, 763, 764, 765, 766, 767, 768, 769,
|
||||||
740, 741, 742, 743, 744, 745, 746, 747, 748, 749,
|
770, 771, 772, 773, 774, 775, 776, 777, 778, 779,
|
||||||
750, 751, 752, 753, 754, 755, 756, 757, 758, 759,
|
780, 781, 782, 783, 784, 785, 786, 787, 788, 789,
|
||||||
760, 761, 762, 763, 764, 765, 766, 767, 768, 769,
|
790, 791, 792, 793, 794, 795, 796, 797, 798, 799,
|
||||||
770, 771, 772, 773, 774, 775, 776, 777, 778, 779,
|
800, 801, 802, 803, 804, 805, 806, 807, 808, 809,
|
||||||
780, 781, 782, 783, 784, 785, 786, 787, 788, 789,
|
810, 811, 812, 813, 814, 815, 816, 817, 818, 819,
|
||||||
790, 791, 792, 793, 794, 795, 796, 797, 798, 799,
|
820, 821, 822, 823, 824, 825, 826, 827, 828, 829,
|
||||||
800, 801, 802, 803, 804, 805, 806, 807, 808, 809,
|
830, 831, 832, 833, 834, 835, 836, 837, 838, 839,
|
||||||
810, 811, 812, 813, 814, 815, 816, 817, 818, 819,
|
840, 841, 842, 843, 844, 845, 846, 847, 848, 849,
|
||||||
820, 821, 822, 823, 824, 825, 826, 827, 828, 829,
|
850, 851, 852, 853, 854, 855, 856, 857, 858, 859,
|
||||||
830, 831, 832, 833, 834, 835, 836, 837, 838, 839,
|
860, 861, 862, 863, 864, 865, 866, 867, 868, 869,
|
||||||
840, 841, 842, 843, 844, 845, 846, 847, 848, 849,
|
870, 871, 872, 873, 874, 875, 876, 877, 878, 879,
|
||||||
850, 851, 852, 853, 854, 855, 856, 857, 858, 859,
|
880, 881, 882, 883, 884, 885, 886, 887, 888, 889,
|
||||||
860, 861, 862, 863, 864, 865, 866, 867, 868, 869,
|
890, 891, 892, 893, 894, 895, 896, 897, 898, 899,
|
||||||
870, 871, 872, 873, 874, 875, 876, 877, 878, 879,
|
900, 901, 902, 903, 904, 905, 906, 907, 908, 909,
|
||||||
880, 881, 882, 883, 884, 885, 886, 887, 888, 889,
|
910, 911, 912, 913, 914, 915, 916, 917, 918, 919,
|
||||||
890, 891, 892, 893, 894, 895, 896, 897, 898, 899,
|
920, 921, 922, 923, 924, 925, 926, 927, 928, 929,
|
||||||
900, 901, 902, 903, 904, 905, 906, 907, 908, 909,
|
930, 931, 932, 933, 934, 935, 936, 937, 938, 939,
|
||||||
910, 911, 912, 913, 914, 915, 916, 917, 918, 919,
|
940, 941, 942, 943, 944, 945, 946, 947, 948, 949,
|
||||||
920, 921, 922, 923, 924, 925, 926, 927, 928, 929,
|
950, 951, 952, 953, 954, 955, 956, 957, 958, 959,
|
||||||
930, 931, 932, 933, 934, 935, 936, 937, 938, 939,
|
960, 961, 962, 963, 964, 965, 966, 967, 968, 969,
|
||||||
940, 941, 942, 943, 944, 945, 946, 947, 948, 949,
|
970, 971, 972, 973, 974, 975, 976, 977, 978, 979,
|
||||||
950, 951, 952, 953, 954, 955, 956, 957, 958, 959,
|
980, 981, 982, 983, 984, 985, 986, 987, 988, 989,
|
||||||
960, 961, 962, 963, 964, 965, 966, 967, 968, 969,
|
990, 991, 992, 993, 994, 995, 996, 997, 998, 999,
|
||||||
970, 971, 972, 973, 974, 975, 976, 977, 978, 979,
|
1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
|
||||||
980, 981, 982, 983, 984, 985, 986, 987, 988, 989,
|
1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019,
|
||||||
990, 991, 992, 993, 994, 995, 996, 997, 998, 999,
|
1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029,
|
||||||
1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
|
1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039,
|
||||||
1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019,
|
1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049,
|
||||||
1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029,
|
1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059,
|
||||||
1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039,
|
1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069,
|
||||||
1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049,
|
1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079,
|
||||||
1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059,
|
100003
|
||||||
1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069,
|
]
|
||||||
1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079,
|
},
|
||||||
100003
|
{
|
||||||
]
|
"day_time_ranges_day_ticket": [100001]
|
||||||
},
|
}
|
||||||
{
|
]
|
||||||
"day_time_ranges_day_ticket":" [100001]
|
}
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
},
|
"DayConfig_2": {
|
||||||
"DayConfig_2": {
|
"day_config_id": 1,
|
||||||
"day_config_id": 1,
|
"day_config_date_range": 6,
|
||||||
"day_config_date_range": 6,
|
"day_config_product_ids": [1],
|
||||||
"day_config_product_ids": [1],
|
"day_config_day_time_ranges": [
|
||||||
"day_config_day_time_ranges": [
|
{
|
||||||
{
|
"day_time_ranges_day_ticket": [100001]
|
||||||
"day_time_ranges_day_ticket":" [100001]
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
// usw. auch fuer verkaufsoffene Tage
|
|
||||||
],
|
],
|
||||||
"TariffDays": [
|
"TariffDays": [
|
||||||
"Mon": {
|
{
|
||||||
"day_id": 1,
|
"Mon": {
|
||||||
"day_config_id": 0
|
"day_id": 1,
|
||||||
|
"day_config_id": 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Tue": {
|
{
|
||||||
"day_id": 2,
|
"Tue": {
|
||||||
"day_config_id": 0
|
"day_id": 2,
|
||||||
|
"day_config_id": 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Wed": {
|
{
|
||||||
"day_id": 3,
|
"Wed": {
|
||||||
"day_config_id": 0
|
"day_id": 3,
|
||||||
|
"day_config_id": 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Thu": {
|
{
|
||||||
"day_id": 4,
|
"Thu": {
|
||||||
"day_config_id": 0
|
"day_id": 4,
|
||||||
|
"day_config_id": 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Fri": {
|
{
|
||||||
"day_id": 5,
|
"Fri": {
|
||||||
"day_config_id": 0
|
"day_id": 5,
|
||||||
|
"day_config_id": 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Sat": {
|
{
|
||||||
"day_id": 6,
|
"Sat": {
|
||||||
"day_config_id": 0
|
"day_id": 6,
|
||||||
|
"day_config_id": 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Sun": {
|
{
|
||||||
"day_id": 7,
|
"Sun": {
|
||||||
"day_config_id": 0
|
"day_id": 7,
|
||||||
|
"day_config_id": 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Christmas_1st_day": {
|
{
|
||||||
"day_id": 8,
|
"Christmas_1st_day": {
|
||||||
"day_config_id": 1,
|
"day_id": 8,
|
||||||
"day_date": "2024-12-25",
|
"day_config_id": 1,
|
||||||
"day_moveable": false
|
"day_date": "2024-12-25",
|
||||||
|
"day_moveable": false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Christmas_2nd_day": {
|
{
|
||||||
"day_id": 9,
|
"Christmas_2nd_day": {
|
||||||
"day_config_id": 1,
|
"day_id": 9,
|
||||||
"day_date": "2024-12-26",
|
"day_config_id": 1,
|
||||||
"day_moveable": false
|
"day_date": "2024-12-26",
|
||||||
|
"day_moveable": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// usw. die anderen Feiertage und verkaufsoffende Tage
|
|
||||||
]
|
]
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
5753
Utilities/tariff.template.json.bck
Normal file
5753
Utilities/tariff.template.json.bck
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,181 @@
|
|||||||
|
#include "tariff_editor.h"
|
||||||
|
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QPair>
|
||||||
|
|
||||||
|
#include <initializer_list>
|
||||||
|
|
||||||
|
TariffEditor::TariffEditor() {
|
||||||
|
m_doc = QJsonDocument();
|
||||||
|
// m_doc.setObject(QJsonObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject TariffEditor::create(QString const &key) {
|
||||||
|
QJsonArray a;
|
||||||
|
if (key.compare("TariffType", Qt::CaseInsensitive) == 0) {
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("tariff_type_id"), QJsonValue(1)),
|
||||||
|
QPair(QString("tariff_type_label"), QJsonValue("uniform-to-the-minute")),
|
||||||
|
QPair(QString("comment"), QJsonValue("same price for all computational units, typically minutes"))}));
|
||||||
|
} else
|
||||||
|
if (key.compare("TariffAccuracy", Qt::CaseInsensitive) == 0) {
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("tariff_accuracy_id"), QJsonValue(1)),
|
||||||
|
QPair(QString("tariff_accuracy_label"), QJsonValue("computation per minute")),
|
||||||
|
QPair(QString("tariff_accuracy_value"), QJsonValue(1)),
|
||||||
|
QPair(QString("comment"), QJsonValue("accuracy of tariff computation is individual minutes"))
|
||||||
|
}));
|
||||||
|
} else
|
||||||
|
if (key.compare("TariffPrice", Qt::CaseInsensitive) == 0) {
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("tariff_price_id"), QJsonValue(1)),
|
||||||
|
QPair(QString("tariff_price"), QJsonValue(165)),
|
||||||
|
QPair(QString("editable"), QJsonValue(true)),
|
||||||
|
QPair(QString("comment"), QJsonValue("price per hour as entered by customer"))
|
||||||
|
}));
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("tariff_price_id"), QJsonValue(2)),
|
||||||
|
QPair(QString("tariff_price"), QJsonValue(990)),
|
||||||
|
QPair(QString("editable"), QJsonValue(true)),
|
||||||
|
QPair(QString("comment"), QJsonValue("price for dayticket as entered by customer"))
|
||||||
|
}));
|
||||||
|
} else
|
||||||
|
if (key.compare("TariffConfig", Qt::CaseInsensitive) == 0) {
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("tariff_config_id"), QJsonValue(1)),
|
||||||
|
QPair(QString("tariff_config_label"), QJsonValue("Tariff-Config")),
|
||||||
|
QPair(QString("tariff_config_accuracy"), QJsonValue(1)),
|
||||||
|
QPair(QString("tariff_config_type"), QJsonValue(1)),
|
||||||
|
QPair(QString("tariff_config_carry_over"), QJsonValue(true)),
|
||||||
|
QPair(QString("tariff_config_prepaid"), QJsonValue(true))
|
||||||
|
}));
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("MinimalTime"),
|
||||||
|
QJsonValue(QJsonObject({
|
||||||
|
QPair(QString("value"), QJsonValue(15)),
|
||||||
|
QPair(QString("editable"), QJsonValue(true)),
|
||||||
|
QPair(QString("comment"), QJsonValue("minimal parking time in minutes (net)"))})))}));
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("MaximalTime"),
|
||||||
|
QJsonValue(QJsonObject({
|
||||||
|
QPair(QString("value"), QJsonValue(360)),
|
||||||
|
QPair(QString("editable"), QJsonValue(true)),
|
||||||
|
QPair(QString("comment"), QJsonValue("maximal parking time in minutes (net)"))})))}));
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("MinimalPrice"),
|
||||||
|
QJsonValue(QJsonObject({
|
||||||
|
QPair(QString("value"), QJsonValue(15)),
|
||||||
|
QPair(QString("editable"), QJsonValue(true)),
|
||||||
|
QPair(QString("comment"), QJsonValue("customer entered price (for hour) expressed in minimal time: 15*(165/60) = 41.25"))})))}));
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("MaximalPrice"),
|
||||||
|
QJsonValue(QJsonObject({
|
||||||
|
QPair(QString("value"), QJsonValue(990)),
|
||||||
|
QPair(QString("editable"), QJsonValue(true)),
|
||||||
|
QPair(QString("comment"), QJsonValue("customer entered price (for hour) expressed in maximal time: 15*(165/60) = 41.25"))})))}));
|
||||||
|
} else
|
||||||
|
if (key.compare("TariffProducts", Qt::CaseInsensitive) == 0) {
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("ShortTimeParking"),
|
||||||
|
QJsonValue(QJsonObject({
|
||||||
|
QPair(QString("tariff_product_id"), QJsonValue(1)),
|
||||||
|
QPair(QString("tariff_product_price_id"), QJsonValue(1))})))}));
|
||||||
|
a.push_back(QJsonObject({
|
||||||
|
QPair(QString("DayTicket"),
|
||||||
|
QJsonValue(QJsonObject({
|
||||||
|
QPair(QString("tariff_product_id"), QJsonValue(2)),
|
||||||
|
QPair(QString("tariff_product_price_id"), QJsonValue(2))})))}));
|
||||||
|
} else
|
||||||
|
if (key.compare("TimeRanges", Qt::CaseInsensitive) == 0) {
|
||||||
|
// if prepaid, unrestricted
|
||||||
|
QJsonArray b;
|
||||||
|
|
||||||
|
QJsonValue v;
|
||||||
|
|
||||||
|
v = QJsonObject({
|
||||||
|
QPair(QString("tariff_range_id"), QJsonValue(100001)),
|
||||||
|
QPair(QString("tariff_range_start"), QJsonValue("00:00:00")),
|
||||||
|
QPair(QString("tariff_range_end"), QJsonValue("00:00:00")),
|
||||||
|
QPair(QString("tariff_range_price_id"), QJsonValue(0)),
|
||||||
|
QPair(QString("comment"), QJsonValue(QString("start block is free of charge")))});
|
||||||
|
|
||||||
|
v = QJsonObject({QPair(QString("Block-Start-0"), v)});
|
||||||
|
b.append(v);
|
||||||
|
|
||||||
|
v = QJsonObject({
|
||||||
|
QPair(QString("tariff_range_id"), QJsonValue(100002)),
|
||||||
|
QPair(QString("tariff_range_start"), QJsonValue("00:00:00")),
|
||||||
|
QPair(QString("tariff_range_end"), QJsonValue("00:00:00")),
|
||||||
|
QPair(QString("tariff_range_price_id"), QJsonValue(0)),
|
||||||
|
QPair(QString("comment"), QJsonValue(QString("end block is free of charge")))}),
|
||||||
|
v = QJsonObject({QPair(QString("Block-End-0"), v)});
|
||||||
|
b.append(v);
|
||||||
|
|
||||||
|
v = QJsonObject({
|
||||||
|
QPair(QString("tariff_range_id"), QJsonValue(100003)),
|
||||||
|
QPair(QString("tariff_range_start"), QJsonValue("00:00:00")),
|
||||||
|
QPair(QString("tariff_range_end"), QJsonValue("08:00:00")),
|
||||||
|
QPair(QString("tariff_range_price_id"), QJsonValue(0)),
|
||||||
|
QPair(QString("comment"), QJsonValue(QString("start block is free of charge")))});
|
||||||
|
v = QJsonObject({QPair(QString("Block-Start-1"), v)});
|
||||||
|
b.append(v);
|
||||||
|
|
||||||
|
v = QJsonObject({
|
||||||
|
QPair(QString("tariff_range_id"), QJsonValue(100004)),
|
||||||
|
QPair(QString("tariff_range_start"), QJsonValue("18:00:00")),
|
||||||
|
QPair(QString("tariff_range_end"), QJsonValue("00:00:00")),
|
||||||
|
QPair(QString("tariff_range_price_id"), QJsonValue(0)),
|
||||||
|
QPair(QString("comment"), QJsonValue(QString("end block is free of charge")))});
|
||||||
|
v = QJsonObject({QPair(QString("Block-End-1"), v)});
|
||||||
|
b.append(v);
|
||||||
|
|
||||||
|
v = QJsonObject({
|
||||||
|
QPair(QString("tariff_range_id"), QJsonValue(100005)),
|
||||||
|
QPair(QString("tariff_range_start"), QJsonValue("00:00:00")),
|
||||||
|
QPair(QString("tariff_range_end"), QJsonValue("08:00:00")),
|
||||||
|
QPair(QString("tariff_range_price_id"), QJsonValue(0)),
|
||||||
|
QPair(QString("comment"), QJsonValue(QString("start block is free of charge")))});
|
||||||
|
v = QJsonObject({QPair(QString("Block-Start-1"), v)});
|
||||||
|
b.append(v);
|
||||||
|
|
||||||
|
v = QJsonObject({
|
||||||
|
QPair(QString("tariff_range_id"), QJsonValue(100006)),
|
||||||
|
QPair(QString("tariff_range_start"), QJsonValue("12:00:00")),
|
||||||
|
QPair(QString("tariff_range_end"), QJsonValue("00:00:00")),
|
||||||
|
QPair(QString("tariff_range_price_id"), QJsonValue(0)),
|
||||||
|
QPair(QString("comment"), QJsonValue(QString("end block is free of charge")))});
|
||||||
|
v = QJsonObject({QPair(QString("Block-End-1"), v)});
|
||||||
|
b.append(v);
|
||||||
|
|
||||||
|
a.push_back(QJsonObject({QPair(QString("OperationTimes"), b)}));
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
"time_range_id": 100001,
|
||||||
|
"time_range_start": "00:00:00",
|
||||||
|
"time_range_end": "00:00:00",
|
||||||
|
"time_range_start_minute": 0,
|
||||||
|
"time_range_end_minute": 1440,
|
||||||
|
"time_range_price_id": 2,
|
||||||
|
"comment": "[ 00:00-00:00 [ = [ 00:00-24:00 ["
|
||||||
|
},
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return QJsonObject({QPair(key, QJsonValue(a))});
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonDocument &TariffEditor::writeToDocument(QJsonObject const &object) {
|
||||||
|
QJsonArray a = m_doc.array();
|
||||||
|
a.push_back(object);
|
||||||
|
//a.push_back(object);
|
||||||
|
//a.push_back(QJsonObject(std::initializer_list{QPair(key, value)}));
|
||||||
|
m_doc.setArray(a);
|
||||||
|
return m_doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonDocument &TariffEditor::writeToDocument(QString const &key, QString const &value) {
|
||||||
|
return writeToDocument(std::initializer_list{QPair(key, QJsonValue(value))});
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef TARIFF_EDITOR_H_INCLUDED
|
||||||
|
#define TARIFF_EDITOR_H_INCLUDED
|
||||||
|
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QString>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
|
||||||
|
class TariffEditor {
|
||||||
|
QJsonDocument m_doc;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TariffEditor();
|
||||||
|
|
||||||
|
QJsonObject create(QString const &key);
|
||||||
|
QJsonDocument &document() { return m_doc; }
|
||||||
|
QJsonDocument const &document() const { return m_doc; }
|
||||||
|
QJsonDocument &writeToDocument(QString const &key, QString const &value);
|
||||||
|
QJsonDocument &writeToDocument(QJsonObject const &value);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TARIFF_EDITOR_H_INCLUDED
|
@ -8,7 +8,7 @@
|
|||||||
#include <QJsonValue>
|
#include <QJsonValue>
|
||||||
|
|
||||||
|
|
||||||
struct Tariff : public QJsonObject {
|
struct TariffTemplate : public QJsonObject {
|
||||||
QJsonValue m_project;
|
QJsonValue m_project;
|
||||||
QJsonValue m_version;
|
QJsonValue m_version;
|
||||||
QJsonValue m_date;
|
QJsonValue m_date;
|
||||||
|
Loading…
Reference in New Issue
Block a user