TODO changes
This commit is contained in:
parent
d9fca88af3
commit
2a726a96b7
|
@ -86,7 +86,3 @@ FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
|
||||||
GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8)
|
GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8)
|
||||||
FetchContent_MakeAvailable(cpr)
|
FetchContent_MakeAvailable(cpr)
|
||||||
target_link_libraries(checks-parser PRIVATE cpr::cpr)
|
target_link_libraries(checks-parser PRIVATE cpr::cpr)
|
||||||
|
|
||||||
|
|
||||||
find_package(KF${QT_VERSION_MAJOR}WidgetsAddons)
|
|
||||||
target_link_libraries(checks-parser PRIVATE KF${QT_VERSION_MAJOR}::WidgetsAddons)
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
Complete module "export":
|
||||||
|
make UI; [done]
|
||||||
|
make export to .csv [done]
|
||||||
|
Complete module "image-to-text":
|
||||||
|
make UI;
|
||||||
|
make use of tesseract/opencv (https://learnopencv.com/deep-learning-based-text-recognition-ocr-using-tesseract-and-opencv/);
|
||||||
|
Add features:
|
||||||
|
autodetect store type
|
||||||
|
|
11
TOOD
11
TOOD
|
@ -1,11 +0,0 @@
|
||||||
Complete module "export":
|
|
||||||
make UI;
|
|
||||||
make export to .ods
|
|
||||||
make export to .csv
|
|
||||||
(Optional) make export to .xlsx (if I find some FLOSS library for that Micro$hit format)
|
|
||||||
Complete module "image-to-text":
|
|
||||||
make UI;
|
|
||||||
make use of opencv (https://learnopencv.com/deep-learning-based-text-detection-using-opencv-c-python);
|
|
||||||
Add features:
|
|
||||||
autodetect store type
|
|
||||||
|
|
7
main.cpp
7
main.cpp
|
@ -2,7 +2,6 @@
|
||||||
#include "ofd/ofd.h"
|
#include "ofd/ofd.h"
|
||||||
#include "utils/utils.h"
|
#include "utils/utils.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
@ -10,12 +9,6 @@ int main(int argc, char *argv[]) {
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
OFD ofd;
|
|
||||||
std::vector<std::string> ofds = ofd.search_ofds();
|
|
||||||
|
|
||||||
for (OFDModule o : ofds) {
|
|
||||||
std::cout << to_utf8(o.get_name()) << ": " << to_utf8(o.get_url()) << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
MainWindow::~MainWindow() { delete ui; }
|
MainWindow::~MainWindow() { delete ui; }
|
||||||
|
|
||||||
void MainWindow::setupStoresList() {
|
void MainWindow::setupStoresList() {
|
||||||
// Make file format that is a regeeex which parse check, load these files
|
|
||||||
// here
|
|
||||||
parser = *(new Parser());
|
parser = *(new Parser());
|
||||||
|
|
||||||
std::vector<std::string> modules_names = parser.search_modules();
|
std::vector<std::string> modules_names = parser.search_modules();
|
||||||
|
@ -61,7 +59,7 @@ void MainWindow::on_parseButton_clicked() {
|
||||||
|
|
||||||
Check check;
|
Check check;
|
||||||
|
|
||||||
for (auto g : c) {
|
for (auto& g : c) {
|
||||||
check.add_goods(g);
|
check.add_goods(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
25
ofd/ofd.cpp
25
ofd/ofd.cpp
|
@ -52,11 +52,28 @@ std::string OFD::get_check_data(std::string fn, std::string fd,
|
||||||
-H 'sec-ch-ua-mobile: ?0' \
|
-H 'sec-ch-ua-mobile: ?0' \
|
||||||
-H 'sec-ch-ua-platform: "Linux"'
|
-H 'sec-ch-ua-platform: "Linux"'
|
||||||
|
|
||||||
cpr::Response r =
|
// curl 'https://ofd.beeline.ru/api/ofdcheck/checkf?fn=7281440701327430&fp=2807139546&fd=25051&format=4' \
|
||||||
cpr::Get(cpr::Url{to_utf8(module.get_url())},
|
-H 'Accept: application/json, text/plain, */*' \
|
||||||
cpr::Parameters{{"fn", fn}, {"fd", fd}, {"fp", fp}});
|
-H 'Accept-Language: en-US,en;q=0.9,eo;q=0.8,ru;q=0.7' \
|
||||||
|
-H 'Authorization: bearer null' \
|
||||||
|
-H 'Connection: keep-alive' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-H 'DNT: 1' \
|
||||||
|
-H 'Referer: https://ofd.beeline.ru/check-order?fn=7281440701327430&fp=2807139546&fd=25051' \
|
||||||
|
-H 'Sec-Fetch-Dest: empty' \
|
||||||
|
-H 'Sec-Fetch-Mode: cors' \
|
||||||
|
-H 'Sec-Fetch-Site: same-origin' \
|
||||||
|
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36' \
|
||||||
|
-H 'sec-ch-ua: "Chromium";v="127", "Not)A;Brand";v="99"' \
|
||||||
|
-H 'sec-ch-ua-mobile: ?0' \
|
||||||
|
-H 'sec-ch-ua-platform: "Linux"'
|
||||||
|
|
||||||
std::cout << r.text << std::endl;
|
// cpr::Response r = cpr::Get(cpr::Url{"https://httpbin.org/get"});
|
||||||
|
std::cout << fn << " " << fd << " " << fp << std::endl;
|
||||||
|
cpr::Response r =
|
||||||
|
//to_utf8(module.get_url())
|
||||||
|
cpr::Get(cpr::Url{"https://ofd.beeline.ru/api/ofdcheck/checkf"},
|
||||||
|
cpr::Parameters{{"fn", fn}, {"fd", fd}, {"fp", fp}, {"format", "4"}});
|
||||||
|
|
||||||
return r.text;
|
return r.text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,6 @@ public:
|
||||||
|
|
||||||
void set_module(std::string);
|
void set_module(std::string);
|
||||||
|
|
||||||
std::string get_check_data(std::string, std::string, std::string);
|
std::string get_check_data(std::string fn, std::string fd, std::string fp);
|
||||||
};
|
};
|
||||||
#endif // OFD_H
|
#endif // OFD_H
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// TODO: refactor that shit with custom qt widget(line edit + combo box)
|
|
||||||
|
|
||||||
#include "outputdialog.h"
|
#include "outputdialog.h"
|
||||||
#include "check/check.h"
|
#include "check/check.h"
|
||||||
#include "output/output_options.h"
|
#include "output/output_options.h"
|
||||||
|
@ -24,7 +22,7 @@ bool compare_position(Column &c1, Column &c2) {
|
||||||
void OutputDialog::on_buttonBox_accepted() {
|
void OutputDialog::on_buttonBox_accepted() {
|
||||||
std::ofstream output_file(this->options.get_path());
|
std::ofstream output_file(this->options.get_path());
|
||||||
|
|
||||||
for (int i = 0; i < ui->tableWidget->rowCount(); i ++) {
|
for (int i = 0; i < ui->tableWidget->rowCount(); i++) {
|
||||||
int position = ui->tableWidget->item(i, 0)->text().toInt();
|
int position = ui->tableWidget->item(i, 0)->text().toInt();
|
||||||
std::string name = ui->tableWidget->item(i, 1)->text().toStdString();
|
std::string name = ui->tableWidget->item(i, 1)->text().toStdString();
|
||||||
|
|
||||||
|
@ -40,7 +38,7 @@ void OutputDialog::on_buttonBox_accepted() {
|
||||||
this->options.get_columns().end(), compare_position);
|
this->options.get_columns().end(), compare_position);
|
||||||
|
|
||||||
if (options.get_print_header()) {
|
if (options.get_print_header()) {
|
||||||
for (auto& column : this->options.get_columns()) {
|
for (auto &column : this->options.get_columns()) {
|
||||||
output_file << column.name
|
output_file << column.name
|
||||||
<< (column.position == this->options.get_columns().size()
|
<< (column.position == this->options.get_columns().size()
|
||||||
? ""
|
? ""
|
||||||
|
@ -50,7 +48,7 @@ void OutputDialog::on_buttonBox_accepted() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto goods : this->check.get_goods()) {
|
for (auto goods : this->check.get_goods()) {
|
||||||
for (auto& column : this->options.get_columns()) {
|
for (auto &column : this->options.get_columns()) {
|
||||||
std::string output_str;
|
std::string output_str;
|
||||||
|
|
||||||
switch (column.type) {
|
switch (column.type) {
|
||||||
|
@ -116,4 +114,3 @@ void OutputDialog::on_printHeaderCheckBox_stateChanged(int value) {
|
||||||
void OutputDialog::on_printTotalCheckBox_stateChanged(int value) {
|
void OutputDialog::on_printTotalCheckBox_stateChanged(int value) {
|
||||||
this->options.set_print_total(value);
|
this->options.set_print_total(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue