error 6 лет назад
Родитель
Сommit
5c3a3159f7
12 измененных файлов с 395 добавлено и 110 удалено
  1. 156 60
      handle/database.cpp
  2. 25 11
      handle/database.h
  3. 14 15
      handle/remotepackconfig.cpp
  4. 7 1
      mainwindow.cpp
  5. 1 0
      mainwindow.h
  6. 29 0
      mainwindow.ui
  7. 6 1
      packinfo.cpp
  8. 1 0
      packinfo.h
  9. 132 21
      widget/autopackform.cpp
  10. 12 0
      widget/autopackform.h
  11. 12 0
      widget/autopackform.ui
  12. 0 1
      widget/selectvalueform.cpp

+ 156 - 60
handle/database.cpp

@@ -25,103 +25,199 @@ bool Database::openDB()
     return _database.open();
 }
 
-bool Database::createDatabase()
+bool Database::createProductDatabase()
 {
-    QSqlDatabase db = QSqlDatabase::database("db"); //建立数据库连接
+    QSqlDatabase db = QSqlDatabase::database("db");
     QSqlQuery query(db);
 
 //    query.exec("DROP TABLE dabaodata");
 
-    bool success = query.exec("CREATE TABLE dabaodata ("
-                              "goods_id INTEGER NOT NULL,"
-                              "code_single INTEGER NOT NULL,"
-                              "level_id INTEGER NOT NULL,"
-                              "tube_number INTEGER NOT NULL,"
-                              "gross_weight DOUBLE NOT NULL,"
-                              "net_weight DOUBLE NOT NULL,"
-                              "machine_no VARCHAR(5),"
-                              "packing_time VARCHAR(15),"
-                              "packing_type VARCHAR(10),"
-                              "carton_type VARCHAR(5) NOT NULL,"
-                              "operator INTEGER NOT NULL,"
-                              "case_number INTEGER NOT NULL,"
-                              "backet_weight DOUBLE NOT NULL,"
-                              "sort VARCHAR NOT NULL,"
-                              "tongbu VARCHAR(1) DEFAULT 0,"
-                              "remark VARCHAR);");
-
+//    bool success = query.exec("CREATE TABLE dabaodata ("
+//                              "goods_id INTEGER NOT NULL,"
+//                              "code_single INTEGER NOT NULL,"
+//                              "level_id INTEGER NOT NULL,"
+//                              "tube_number INTEGER NOT NULL,"
+//                              "gross_weight DOUBLE NOT NULL,"
+//                              "net_weight DOUBLE NOT NULL,"
+//                              "machine_no VARCHAR(5),"
+//                              "packing_time VARCHAR(15),"
+//                              "packing_type VARCHAR(10),"
+//                              "carton_type VARCHAR(5) NOT NULL,"
+//                              "operator INTEGER NOT NULL,"
+//                              "case_number INTEGER NOT NULL,"
+//                              "backet_weight DOUBLE NOT NULL,"
+//                              "sort VARCHAR NOT NULL,"
+//                              "tongbu VARCHAR(1) DEFAULT 0,"
+//                              "remark VARCHAR);");
+
+    bool success = query.exec("CREATE TABLE product ("
+                                  "goods_id INTEGER NOT NULL,"
+                                  "code_single VARCHAR NOT NULL,"
+                                  "quantity INTEGER NOT NULL,"
+                                  "level_id INTEGER NOT NULL,"
+                                  "tube_number INTEGER NOT NULL,"
+                                  "gross_weight INTEGER NOT NULL,"
+                                  "net_weight INTEGER NOT NULL,"
+                                  "machine_no VARCHAR NOT NULL,"
+                                  "packing_time VARCHAR NOT NULL,"
+                                  "packing_type VARCHAR NOT NULL,"
+                                  "carton_type VARCHAR NOT NULL,"
+                                  "operator_id INTEGER NOT NULL,"
+                                  "remark VARCHAR);"
+                                  "tongbu VARCHAR(1) DEFAULT 0,");
 
     if(success)
     {
-        qDebug() << QObject::tr("数据库表创建成功!\n");
+        qDebug() << QObject::tr("product数据库表创建成功!\n");
         return true;
     }
     else
     {
-        qDebug() << QObject::tr("数据库表创建失败!\n");
+        qDebug() << QObject::tr("product数据库表创建失败!\n");
         return false;
     }
 }
 
-bool Database::changeState(QString xianghao)
+bool Database::createDetailsDatabase()
 {
-    QSqlDatabase db = QSqlDatabase::database("db"); //建立数据库连接
+    QSqlDatabase db = QSqlDatabase::database("db");
     QSqlQuery query(db);
 
-    bool success = query.exec("update dabaodata set tongbu=1 where case_number="+xianghao);
+    bool success = query.exec("CREATE TABLE details ("
+                                  "code_single VARCHAR NOT NULL,"
+                                  "case_number VARCHAR NOT NULL,"
+                                  "box_weight INTEGER NOT NULL,"
+                                  "tube_number INTEGER NOT NULL,"
+                                  "bucket_weight INTEGER NOT NULL,"
+                                  "gross_weight INTEGER NOT NULL,"
+                                  "net_weight INTEGER NOT NULL,"
+                                  "sort VARCHAR NOT NULL,"
+                                  "remark VARCHAR);");
+
     if(success)
     {
+        qDebug() << QObject::tr("details数据库表创建成功!\n");
         return true;
     }
     else
     {
+        qDebug() << QObject::tr("details数据库表创建失败!\n");
         return false;
     }
 }
 
-bool Database::insert(QString &table, QStringList &names, QStringList &values)
+
+
+//bool Database::insert(QString &table, QStringList &names, QStringList &values)
+//{
+//    if(names.size() != values.size())
+//    {
+//        return false;
+//    }
+
+////    QSqlQuery query(QSqlDatabase::database());
+
+//    QSqlDatabase db = QSqlDatabase::database("db");
+//    QSqlQuery query(db);
+
+//    QString sql = QString("insert into ") + table + QString("(");
+
+//    int i;
+//    for(i = 0; i < names.size(); i++)
+//    {
+//        sql = sql + names.value(i);
+//        if(i != names.size()-1)
+//        {
+//            sql += QString(",");
+//        }
+//        else
+//        {
+//            sql += QString(")");
+//        }
+//    }
+
+//    sql = sql + QString("values (");
+
+//    for(i = 0; i < values.size(); i++)
+//    {
+//        sql = sql + QString("'") + values.value(i) + QString("'");
+//        if (i != values.size()-1)
+//        {
+//            sql += QString(",");
+//        }
+//    }
+//    sql += QString(")");
+
+
+
+//    return (query.exec(sql)) ? true : false;
+//}
+
+bool Database::insertProduct(product_data productData)
 {
-    if(names.size() != values.size())
-    {
-        return false;
-    }
+    QSqlDatabase db = QSqlDatabase::database("db");
+    QSqlQuery query(db);
 
-//    QSqlQuery query(QSqlDatabase::database());
+    query.prepare("INSERT INTO product(goods_id,"
+                          "code_single, quantity, level_id, tube_number,"
+                          "gross_weight, net_weight, machine_no, packing_time,"
+                          "packing_type, carton_type, operator_id, remark)"
+                          "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)");
+    query.bindValue(0,productData.goods_id);
+    query.bindValue(1,productData.code_single);
+    query.bindValue(2,productData.quantity);
+    query.bindValue(3,productData.level_id);
+    query.bindValue(4,productData.tube_number);
+    query.bindValue(5,productData.gross_weight);
+    query.bindValue(6,productData.net_weight);
+    query.bindValue(7,productData.machine_no);
+    query.bindValue(8,productData.packing_time);
+    query.bindValue(9,productData.packing_type);
+    query.bindValue(10,productData.carton_type);
+    query.bindValue(11,productData.operator_id);
+    query.bindValue(12,productData.remark);
+
+    bool success=query.exec();
+    return success;
+}
 
-    QSqlDatabase db = QSqlDatabase::database("db"); //建立数据库连接
+bool Database::insertDetails(details_data detailsData)
+{
+    QSqlDatabase db = QSqlDatabase::database("db");
     QSqlQuery query(db);
 
-    QString sql = QString("insert into ") + table + QString("(");
+    query.prepare("INSERT INTO details(code_single,"
+                  "case_number, box_weight, tube_number, bucket_weight,"
+                  "gross_weight, net_weight, sort, remark)"
+                  "VALUES(?,?,?,?,?,?,?,?,?)");
+    query.bindValue(0,detailsData.code_single);
+    query.bindValue(1,detailsData.case_number);
+    query.bindValue(2,detailsData.box_weight);
+    query.bindValue(3,detailsData.tube_number);
+    query.bindValue(4,detailsData.bucket_weight);
+    query.bindValue(5,detailsData.gross_weight);
+    query.bindValue(6,detailsData.net_weight);
+    query.bindValue(7,detailsData.sort);
+    query.bindValue(8,detailsData.remark);
+
+    bool success=query.exec();
+    return success;
+}
+
+bool Database::changeState(QString codesingle)
+{
+    QSqlDatabase db = QSqlDatabase::database("db");
+    QSqlQuery query(db);
 
-    int i;
-    for(i = 0; i < names.size(); i++)
+    bool success = query.exec("update product set tongbu=1 where code_single="+codesingle);
+    if(success)
     {
-        sql = sql + names.value(i);
-        if(i != names.size()-1)
-        {
-            sql += QString(",");
-        }
-        else
-        {
-            sql += QString(")");
-        }
+        return true;
     }
-
-    sql = sql + QString("values (");
-
-    for(i = 0; i < values.size(); i++)
+    else
     {
-        sql = sql + QString("'") + values.value(i) + QString("'");
-        if (i != values.size()-1)
-        {
-            sql += QString(",");
-        }
+        return false;
     }
-    sql += QString(")");
-
-
-
-    return (query.exec(sql)) ? true : false;
 }
 
 bool Database::update(QString &table, QStringList &names, QStringList &values, QString &expression)
@@ -131,7 +227,7 @@ bool Database::update(QString &table, QStringList &names, QStringList &values, Q
     //UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
 //    QSqlQuery query(QSqlDatabase::database());
 
-    QSqlDatabase db = QSqlDatabase::database("db"); //建立数据库连接
+    QSqlDatabase db = QSqlDatabase::database("db");
     QSqlQuery query(db);
 
     QString sql = QString("update ")+table+QString(" set ");
@@ -160,7 +256,7 @@ QList<QStringList> Database::GetValues(QString &table, QStringList &values)
 {
     dbmxdata.clear();
     dbmxlist.clear();
-    QSqlDatabase db = QSqlDatabase::database("db"); //建立数据库连接
+    QSqlDatabase db = QSqlDatabase::database("db");
     QSqlQuery query(db);
 
     QString sql = QString("select * from ") + table;

+ 25 - 11
handle/database.h

@@ -7,24 +7,33 @@
 #include <QSqlQuery>
 #include <QSqlTableModel>
 
-struct dabao
+struct product_data
 {
     int goods_id;
-    int code_single;
+    QString code_single;
     int quantity;
     int level_id;
     int tube_number;
-    double gross_weight;
-    double net_weight;
+    int gross_weight;
+    int net_weight;
     QString machine_no;
     QString packing_time;
     QString packing_type;
     QString carton_type;
-    int user_id;
-    int case_number;
-    double backet_weight;
+    int operator_id;
+    QString remark;
+};
+
+struct details_data
+{
+    QString code_single;
+    QString case_number;
+    int box_weight;
+    int tube_number;
+    int bucket_weight;
+    int gross_weight;
+    int net_weight;
     QString sort;
-    QString tongbu;
     QString remark;
 };
 
@@ -39,13 +48,18 @@ public:
 //    void deleteData();
     void SetTableName(QString table);
     bool openDB();
-    bool createDatabase();
-    bool changeState(QString xianghao);
-    bool insert(QString &table, QStringList &names, QStringList &values);
+    bool createProductDatabase();
+    bool createDetailsDatabase();
+//    bool insert(QString &table, QStringList &names, QStringList &values);
     bool update(QString &table, QStringList &names, QStringList &values, QString &expression);
     bool del(QString &table, QString &expression);
     QList<QStringList> GetValues(QString &table, QStringList &values);
 
+    bool insertProduct(product_data productData);
+    bool insertDetails(details_data detailsData);
+    bool changeState(QString xianghao);
+
+
 
 private:
     QSqlDatabase _database;

+ 14 - 15
handle/remotepackconfig.cpp

@@ -190,17 +190,17 @@ int RemotePackConfig::getConfigInt(const QJsonObject & data)
     int list;
     int vSize = value_array.size();
     for(int i = 0; i < vSize; ++i){
-    QJsonValue value_content = value_array.at(i);
-    if(value_content.isObject()){
-        QJsonObject value_object = value_content.toObject();
+        QJsonValue value_content = value_array.at(i);
         if(value_content.isObject()){
             QJsonObject value_object = value_content.toObject();
-            if(value_object.value("selected").toBool(false)){
-                list = value_object.value("value").toInt();
+            if(value_content.isObject()){
+                QJsonObject value_object = value_content.toObject();
+                if(value_object.value("selected").toBool(false)){
+                    list = value_object.value("value").toInt();
+                }
             }
         }
     }
-    }
 
     return list;
 }
@@ -213,18 +213,17 @@ QPair<int,int> getConfigpAIR(const QJsonObject & data)
     int vSize = value_array.size();
     bool frist = true;
     for(int i = 0; i < vSize; ++i){
-            QJsonObject value_object = value_array.at(i).toObject();
-            if(value_object.value("selected").toBool(false)){
-                if(frist) {
-                    list.first = value_object.value("value").toInt();
-                    frist = false;
-                } else {
-                    list.second = value_object.value("value").toInt();
-                }
+        QJsonObject value_object = value_array.at(i).toObject();
+        if(value_object.value("selected").toBool(false)){
+            if(frist) {
+                list.first = value_object.value("value").toInt();
+                frist = false;
+            } else {
+                list.second = value_object.value("value").toInt();
+            }
 
         }
 
-
     }
 
     return list;

+ 7 - 1
mainwindow.cpp

@@ -12,6 +12,7 @@ MainWindow::MainWindow(QWidget *parent)
 
     connect(ui->pageSelectValue,&SelectValueForm::selectProject,this,&MainWindow::pageStatusChange);
     ui->stackedWidget->setCurrentWidget(ui->pageLogin);
+    connect(ui->pageAutoPack,&AutoPackForm::djmbbox,this,&MainWindow::changedjmb);
 }
 
 MainWindow::~MainWindow()
@@ -32,7 +33,6 @@ void MainWindow::pageStatusChange(const ProjectInfo & info, int status)
     case 1:
         ui->stackedWidget->setCurrentWidget(ui->pageAutoPack);
         ui->pageAutoPack->setProInfo(info);
-        ui->pageAutoPack->init();
     }
 }
 
@@ -40,3 +40,9 @@ void MainWindow::backMenu()
 {
     ui->stackedWidget->setCurrentWidget(ui->pageMain);
 }
+
+void MainWindow::changedjmb(QImage image)
+{
+    ui->stackedWidget->setCurrentWidget(ui->pageTest);
+    ui->djmb->setPixmap(QPixmap::fromImage(image));
+}

+ 1 - 0
mainwindow.h

@@ -22,6 +22,7 @@ private slots:
 private:
     void backMenu();
     void pageStatusChange(const ProjectInfo & info, int status);
+    void changedjmb(QImage image);
 
 private:
     Ui::MainWindow *ui;

+ 29 - 0
mainwindow.ui

@@ -15,6 +15,21 @@
   </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QHBoxLayout" name="horizontalLayout">
+    <property name="spacing">
+     <number>0</number>
+    </property>
+    <property name="leftMargin">
+     <number>0</number>
+    </property>
+    <property name="topMargin">
+     <number>0</number>
+    </property>
+    <property name="rightMargin">
+     <number>0</number>
+    </property>
+    <property name="bottomMargin">
+     <number>0</number>
+    </property>
     <item>
      <widget class="QStackedWidget" name="stackedWidget">
       <property name="currentIndex">
@@ -24,6 +39,9 @@
        <layout class="QHBoxLayout" name="horizontalLayout_2">
         <item>
          <layout class="QVBoxLayout" name="verticalLayout">
+          <property name="spacing">
+           <number>7</number>
+          </property>
           <item>
            <widget class="QWidget" name="widget" native="true">
             <property name="maximumSize">
@@ -207,6 +225,17 @@ color: rgb(255, 255, 255);</string>
         </item>
        </layout>
       </widget>
+      <widget class="QWidget" name="pageTest">
+       <layout class="QGridLayout" name="gridLayout">
+        <item row="0" column="0">
+         <widget class="QLabel" name="djmb">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
       <widget class="QWidget" name="pageLogin">
        <layout class="QVBoxLayout" name="verticalLayout_2">
         <item>

+ 6 - 1
packinfo.cpp

@@ -30,7 +30,7 @@ QString PackInfo::buildBoxId()
 {
      int nowNum = boxes().size() + 1;
      QDateTime now = QDateTime::currentDateTime();
-     QString id = now.toString("yyMMddhhmmss") + GlobalInfo::this_()->packNum() + QString::asprintf("%03d",nowNum);
+     QString id = now.toString("yyMMdd") + GlobalInfo::this_()->packNum() + QString::asprintf("%03d",nowNum);
      return id;
 }
 
@@ -66,3 +66,8 @@ QSharedPointer<BoxInfo> PackInfo::addBoxInfo()
     QSharedPointer<BoxInfo> ret(new BoxInfo(sharedFromThis(),buildBoxId()));
     return ret;
 }
+
+void PackInfo::addBoxInfoList(QSharedPointer<BoxInfo> boxes)
+{
+    _boxes.append(boxes);
+}

+ 1 - 0
packinfo.h

@@ -54,6 +54,7 @@ public:
     int net_weight(); //单位:克
 
     QSharedPointer<BoxInfo> addBoxInfo();
+    void addBoxInfoList(QSharedPointer<BoxInfo> boxes);
 
 private:
     QString buildPackId();

+ 132 - 21
widget/autopackform.cpp

@@ -28,8 +28,12 @@ void AutoPackForm::init()
     packConfig.refConfig();
     connect(&packConfig,&RemotePackConfig::configUpdate,this,&AutoPackForm::upconfig);
     connect(&packConfig,&RemotePackConfig::dengJIConfigUp,this,&AutoPackForm::upDengjiInfo);
-    PackInfo *pack = new PackInfo(_info);
-    packinfo.reset(pack);
+    connect(&_request,&HttpRequest::result,this,&AutoPackForm::httpResult);
+    ui->comboBox->clear();
+    for(int i = 0;i<20;i++){
+        ui->comboBox->addItem(QString::number(i));
+    }
+    on_addPackList_clicked();
 }
 
 void AutoPackForm::on_addPackList_clicked()
@@ -43,25 +47,6 @@ void AutoPackForm::on_addPackList_clicked()
 
 void AutoPackForm::upconfig(const DaBaoConfig &config)
 {
-//    ui->jitai->clear();
-//    ui->jitai->addItems(config.jitai);
-
-//    ui->dengji->clear();
-
-//    ui->tongzhong->clear();
-//    ui->tongzhong->addItems(config.tongzhong);
-
-//    ui->guanse->clear();
-//    ui->guanse->addItems(config.guanse);
-
-//    ui->nianxiang->clear();
-//    ui->nianxiang->addItems(config.nianxiang);
-
-//    ui->zhixiang->clear();
-//    ui->zhixiang->addItems(config.zhixiang);
-
-//    ui->xiangdan->clear();
-//    ui->madan->clear();
     // TODO:打包配置更新
     //机台
     ui->jitai->clear();
@@ -122,6 +107,9 @@ void AutoPackForm::doSend(QSharedPointer<PackInfo> &info)
 {
     if(info.isNull()) return;
     //TODO:发送码单 packinfo 数据, 转换为 json数据发送
+    QJsonObject json = this->toJson(info);
+    _request.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
+//    _request.post("http://doc.vanlai.net:3001/web/#/1?page_id=64",json);
 }  // http://doc.vanlai.net:3001/web/#/1?page_id=64
 
 void AutoPackForm::on_addBoxList_clicked()
@@ -135,5 +123,128 @@ void AutoPackForm::on_addBoxList_clicked()
     box->gross_weight = ui->grossWeight_2->text().toInt();
     box->box_weight = ui->netWeight_2->text().toInt();
     box->remark = ui->beizhu->toPlainText();
+    packinfo->level = ui->dengji->currentText();
+    packinfo->level_id = ui->dengji->currentData().toInt();
+    packinfo->addBoxInfoList(box);
+    insertDetailsSQL(box,packinfo->codeSingle());
+
     //TODO: 缓存数据,显示数据
+//    emit djmbbox(djmb.printBoxInfo(box->caseNumber(),box));
+//    qDebug()<<packinfo->boxes().size();
+//    doSend(packinfo);
+
+}
+
+void AutoPackForm::httpResult(int emitcode, const QJsonObject body)
+{
+    qDebug()<<emitcode;
+    qDebug()<<body;
+    database.changeState(packinfo->codeSingle());
+}
+
+void AutoPackForm::insertDetailsSQL(QSharedPointer<BoxInfo> boxes,QString codeSingle)
+{
+    detailsData.code_single = codeSingle;
+    detailsData.case_number = boxes->caseNumber();
+    detailsData.box_weight = boxes->box_weight;
+    detailsData.tube_number = boxes->tube_number;
+    detailsData.bucket_weight = boxes->bucket_weight;
+    detailsData.gross_weight = boxes->gross_weight;
+    detailsData.net_weight = boxes->net_weight;
+    detailsData.sort = boxes->sort;
+    detailsData.remark = boxes->remark;
+
+    if(database.insertDetails(detailsData)){
+        qDebug()<<"数据库添加失败";
+        return;
+    }
+    qDebug()<<"数据库添加成功";
+}
+
+void AutoPackForm::insertProductSQL(QSharedPointer<PackInfo> packes)
+{
+    productData.goods_id = _info.goods_id;
+    productData.code_single = packes->codeSingle();
+    productData.quantity = packes->quantity;
+    productData.level_id = packes->level_id;
+    productData.tube_number = packes->tube_number();
+    productData.gross_weight = packes->gross_weight();
+    productData.net_weight = packes->net_weight();
+    productData.machine_no = QString::number(packes->machine_no);
+    productData.packing_time = QString::number(packes->packing_time);
+    productData.packing_type = QString::number(packes->packing_type);
+    productData.carton_type = packes->carton_type;
+    productData.operator_id = packes->operator_id;
+    productData.remark = packes->remark;
+
+    if(database.insertProduct(productData)){
+        qDebug()<<"数据库添加失败";
+        return;
+    }
+    qDebug()<<"数据库添加失败";
+}
+
+
+
+//将打包数据转换为json数据
+QJsonObject AutoPackForm::toJson(QSharedPointer<PackInfo> &info)
+{
+    QJsonObject json;
+    QJsonObject detailsjson;
+    QJsonArray jsonarray;
+//    for(int i = 0;i<info->boxes().size();i++){
+//        detailsjson.insert("case_number",info->boxes().at(i)->caseNumber());
+//        detailsjson.insert("box_weight",info->boxes().at(i)->box_weight);
+//        detailsjson.insert("tube_number",info->boxes().at(i)->tube_number);
+//        detailsjson.insert("bucket_weight",info->boxes().at(i)->bucket_weight);
+//        detailsjson.insert("gross_weight",info->boxes().at(i)->gross_weight);
+//        detailsjson.insert("net_weight",info->boxes().at(i)->net_weight);
+//        detailsjson.insert("box_weight",info->boxes().at(i)->box_weight);
+//        detailsjson.insert("sort",info->boxes().at(i)->sort);
+//        detailsjson.insert("remark",info->boxes().at(i)->remark);
+//        jsonarray.append(detailsjson);
+//    }
+//    json.insert("goods_id",_info.goods_id);
+//    json.insert("code_single",info->codeSingle());
+//    json.insert("quantity",info->quantity);
+//    json.insert("level_id",info->level_id);
+//    json.insert("tube_number",info->tube_number());
+//    json.insert("gross_weight",info->gross_weight());
+//    json.insert("net_weight",info->net_weight());
+//    json.insert("machine_no",info->machine_no);
+//    json.insert("packing_time",info->packing_time);
+//    json.insert("packing_type",info->packing_type);
+//    json.insert("carton_type",info->carton_type);
+//    json.insert("operator",info->operator_id);
+//    json.insert("details",jsonarray);
+//    json.insert("remark",info->remark);
+    for(int i = 0;i<1;i++){
+        detailsjson.insert("case_number","11234123");
+        detailsjson.insert("box_weight","123");
+        detailsjson.insert("tube_number","12");
+        detailsjson.insert("bucket_weight","23");
+        detailsjson.insert("gross_weight","412");
+        detailsjson.insert("net_weight","312");
+        detailsjson.insert("box_weight","12");
+        detailsjson.insert("sort","32");
+        detailsjson.insert("remark","23");
+
+        jsonarray.append(detailsjson);
+    }
+    json.insert("goods_id","115");
+    json.insert("code_single","232");
+    json.insert("quantity","23");
+    json.insert("level_id","412");
+    json.insert("tube_number","134");
+    json.insert("gross_weight","1234");
+    json.insert("net_weight","1242");
+    json.insert("machine_no","2341");
+    json.insert("packing_time","134");
+    json.insert("packing_type","1234");
+    json.insert("carton_type","1234");
+    json.insert("operator","1001");
+    json.insert("details",jsonarray);
+    json.insert("remark","1");
+
+    return json;
 }

+ 12 - 0
widget/autopackform.h

@@ -6,6 +6,8 @@
 #include "handle/remotepackconfig.h"
 #include "packinfo.h"
 #include "httprequestid.h"
+#include "handle/danjumuban.h"
+#include "handle/database.h"
 
 namespace Ui {
 class AutoPackForm;
@@ -27,6 +29,7 @@ public slots:
     void init();
 signals:
     void back();
+    void djmbbox(QImage image);
 
 private slots:
     void on_pushBack_clicked();
@@ -38,6 +41,10 @@ private slots:
     void on_pushStart_clicked();
 
     void on_addBoxList_clicked();
+    void httpResult(int emitcode, const QJsonObject body);
+
+    void insertDetailsSQL(QSharedPointer<BoxInfo> boxes,QString codeSingle);
+    void insertProductSQL(QSharedPointer<PackInfo> packes);
 
 private:
     Ui::AutoPackForm *ui;
@@ -46,6 +53,11 @@ private:
     QMap<QString,DengJiConfigItem> dengjiMap;// <name,详细信息>
     RemotePackConfig packConfig;
     HttpRequest _request;
+    DanJuMuBan djmb;
+    Database database;
+    details_data detailsData;
+    product_data productData;
+    QJsonObject toJson(QSharedPointer<PackInfo> &info);
 
 };
 

+ 12 - 0
widget/autopackform.ui

@@ -14,6 +14,12 @@
    <string>Form</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_3">
+   <property name="leftMargin">
+    <number>11</number>
+   </property>
+   <property name="topMargin">
+    <number>11</number>
+   </property>
    <item>
     <widget class="QWidget" name="widget_4" native="true">
      <property name="minimumSize">
@@ -247,6 +253,9 @@ color: rgb(0, 170, 255);</string>
          <layout class="QHBoxLayout" name="horizontalLayout_8">
           <item>
            <widget class="QPushButton" name="addBoxList">
+            <property name="enabled">
+             <bool>true</bool>
+            </property>
             <property name="minimumSize">
              <size>
               <width>0</width>
@@ -264,6 +273,9 @@ color: rgb(0, 170, 255);</string>
           </item>
           <item>
            <widget class="QPushButton" name="addPackList">
+            <property name="enabled">
+             <bool>true</bool>
+            </property>
             <property name="minimumSize">
              <size>
               <width>0</width>

+ 0 - 1
widget/selectvalueform.cpp

@@ -30,7 +30,6 @@ void SelectValueForm::getInfo(int page, int pageListNum)
 
 void SelectValueForm::result(int code, const QJsonObject & body)
 {
-//    qDebug()<<body;
     if(body.value("code").toInt(404) != 200){
         nowPage = 0;
         pageListNum = 20;