Ver código fonte

更改细节

error 6 anos atrás
pai
commit
25493a97fa

+ 20 - 29
configinfo.cpp

@@ -3,36 +3,32 @@
 ConfigInfo::ConfigInfo()
 ConfigInfo::ConfigInfo()
 {
 {
 //    baseUrl = "http://erp.itwsw.cn/api";
 //    baseUrl = "http://erp.itwsw.cn/api";
-//    loginUrl = "http://erp.itwsw.cn/api/v1/signin";
-//    autoPackUrl = "http://erp.itwsw.cn/api/v1/product/pending";
-//    configUrl = "http://erp.itwsw.cn/api/v1/configuration";
-//    selectValueUrl = "http://erp.itwsw.cn/api/v1/goods/list";
-//    levelUrl = "http://erp.itwsw.cn/api/v1/level/list";
 
 
     packId = 1031;
     packId = 1031;
 
 
-    printerName = "Deli DL-820T";
+//    printerName = "Deli DL-820T";
 
 
-    Init();
+//    Init();
+    Start();
 
 
 }
 }
 
 
-void ConfigInfo::Init()
+void ConfigInfo::Start()
 {
 {
 
 
     m_psetting = new QSettings(FileName, QSettings::IniFormat);
     m_psetting = new QSettings(FileName, QSettings::IniFormat);
 
 
     //判断配置文件是否存在
     //判断配置文件是否存在
     QFileInfo fileInfo(FileName);
     QFileInfo fileInfo(FileName);
-   if(fileInfo.exists())
-   {
-        qDebug()<<"配置文件已存在";
+    if(!fileInfo.exists()){
+        qDebug()<<"配置文件不存在";
+        QMessageBox::information(NULL,"注意","请设置配置");
+        return;
+    }
+//   if(fileInfo.exists())
+//   {
+//        qDebug()<<"配置文件已存在";
         //url接口地址
         //url接口地址
-//        loginUrl = Get("url","loginUrl").toString();//登录接口
-//        autoPackUrl = Get("url","autoPackUrl").toString();  //待入库产品添加接口
-//        configUrl = Get("url","configUrl").toString();//配置接口
-//        selectValueUrl = Get("url","selectValueUrl").toString();//商品列表接口
-//        levelUrl = Get("url","levelUrl").toString();//等级列表接口
         baseUrl = Get("url","baseUrl").toString();//服务器地址
         baseUrl = Get("url","baseUrl").toString();//服务器地址
 
 
         //本机用户信息
         //本机用户信息
@@ -40,22 +36,17 @@ void ConfigInfo::Init()
 
 
         //硬件
         //硬件
         printerName = Get("hardware","printerName").toString();//打印机名称
         printerName = Get("hardware","printerName").toString();//打印机名称
-   }else{
-        qDebug()<<"配置文件不存在";
-        //url接口地址
-//        Set("url","autoPackUrl","http://erp.itwsw.cn/api/v1/product/pending");
-//        Set("url","loginUrl","http://erp.itwsw.cn/api/v1/signin");
-//        Set("url","configUrl","http://erp.itwsw.cn/api/v1/configuration");
-//        Set("url","selectValueUrl","http://erp.itwsw.cn/api/v1/goods/list");
-//        Set("url","levelUrl","http://erp.itwsw.cn/api/v1/level/list");
-        Set("url","baseUrl","http://erp.itwsw.cn/api");
+//   }else{
+//        qDebug()<<"配置文件不存在";
+//        //url接口地址
+//        Set("url","baseUrl","http://erp.itwsw.cn/api");
 
 
-        //本机用户信息
-        Set("user","packId",1031);
+//        //本机用户信息
+//        Set("user","packId",1031);
 
 
-        //硬件
+//        //硬件
         Set("hardware","printerName","Deli DL-820T");
         Set("hardware","printerName","Deli DL-820T");
-   }
+//   }
 }
 }
 
 
 void ConfigInfo::Set(QString qstrnodename,QString qstrkeyname,QVariant qvarvalue)
 void ConfigInfo::Set(QString qstrnodename,QString qstrkeyname,QVariant qvarvalue)

+ 3 - 1
configinfo.h

@@ -6,6 +6,7 @@
 #include "QCoreApplication"
 #include "QCoreApplication"
 #include "QDir"
 #include "QDir"
 #include "QDebug"
 #include "QDebug"
+#include "QMessageBox"
 
 
 class ConfigInfo
 class ConfigInfo
 {
 {
@@ -31,11 +32,12 @@ public:
 
 
     void Set(QString qstrnodename,QString qstrkeyname,QVariant qvarvalue);
     void Set(QString qstrnodename,QString qstrkeyname,QVariant qvarvalue);
     QVariant Get(QString qstrnodename,QString qstrkeyname);
     QVariant Get(QString qstrnodename,QString qstrkeyname);
+//    void Init();
+    void Start();
 private:
 private:
     QString FileName = QCoreApplication::applicationDirPath() + "/Config.ini";
     QString FileName = QCoreApplication::applicationDirPath() + "/Config.ini";
     QSettings *m_psetting;
     QSettings *m_psetting;
 
 
-    void Init();
 };
 };
 
 
 struct UserInfo
 struct UserInfo

+ 1 - 1
handle/autopackutils.cpp

@@ -22,7 +22,7 @@ void AutoPackUtils::doSend(QJsonObject json)
     _request.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
     _request.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
 //    qDebug()<<QString::number(GlobalInfo::this_()->user().accountId);
 //    qDebug()<<QString::number(GlobalInfo::this_()->user().accountId);
 //    qDebug()<<GlobalInfo::this_()->user().acessToken;
 //    qDebug()<<GlobalInfo::this_()->user().acessToken;
-//    _request.post(GlobalInfo::this_()->config().baseUrl+"/v1/product/pending",json);
+    _request.post(GlobalInfo::this_()->config().baseUrl+"/v1/product/pending",json);
 
 
 }
 }
 
 

+ 1 - 1
handle/autopackutils.h

@@ -9,7 +9,7 @@
 #include "globalinfo.h"
 #include "globalinfo.h"
 #include "danjumuban.h"
 #include "danjumuban.h"
 
 
-//自动打包工具类
+//打包公用工具类
 class AutoPackUtils : public QObject
 class AutoPackUtils : public QObject
 {
 {
 
 

+ 1 - 1
handle/code39.cpp

@@ -105,7 +105,7 @@ void Code39::draw(QPainter & painter, QRect & pos,QString & barcode)
     font.setPixelSize(5*5);
     font.setPixelSize(5*5);
     font.setWeight(QFont::ExtraLight);
     font.setWeight(QFont::ExtraLight);
     painter.setFont(font);
     painter.setFont(font);
-    painter.drawText(4*5,66*5,MAXWIDTH,16,Qt::AlignCenter,/*"S/N:" +*/ barcode);
+    painter.drawText(0*5,MAXHEIGHT+1,MAXWIDTH,17,Qt::AlignCenter,/*"S/N:" +*/ barcode);
 
 
     painter.restore();
     painter.restore();
 }
 }

+ 30 - 30
handle/danjumuban.cpp

@@ -96,7 +96,7 @@ QImage DanJuMuBan::printPackInfo(QString bar, QSharedPointer<PackInfo> info)
     QPainter painter(&image);
     QPainter painter(&image);
     painter.drawRect(4*5,4*5,92*5,68*5);
     painter.drawRect(4*5,4*5,92*5,68*5);
 
 
-    painter.drawLine(50*5,0,50*5,80*5);
+//    painter.drawLine(50*5,0,50*5,80*5);
     painter.drawLine(4*5,16*5,96*5,16*5);
     painter.drawLine(4*5,16*5,96*5,16*5);
     painter.drawLine(4*5,22*5,96*5,22*5);
     painter.drawLine(4*5,22*5,96*5,22*5);
     painter.drawLine(4*5,28*5,96*5,28*5);
     painter.drawLine(4*5,28*5,96*5,28*5);
@@ -130,35 +130,35 @@ QImage DanJuMuBan::printPackInfo(QString bar, QSharedPointer<PackInfo> info)
         int cloun = i % 5;
         int cloun = i % 5;
         painter.drawText((9 + line * 19)*5,(27 + cloun * 6)*5,QString("%1.").arg(i + 1));
         painter.drawText((9 + line * 19)*5,(27 + cloun * 6)*5,QString("%1.").arg(i + 1));
     }
     }
-//    painter.drawText(9*5,27*5,QStringLiteral("1."));
-//    painter.drawText(9*5,33*5,QStringLiteral("2."));
-//    painter.drawText(9*5,39*5,QStringLiteral("3."));
-//    painter.drawText(9*5,45*5,QStringLiteral("4."));
-//    painter.drawText(9*5,51*5,QStringLiteral("5."));
-//    painter.drawText(9*5,57*5,QStringLiteral("6."));
-
-//    painter.drawText(28*5,27*5,QStringLiteral("7."));
-//    painter.drawText(28*5,33*5,QStringLiteral("8."));
-//    painter.drawText(28*5,39*5,QStringLiteral("9."));
-//    painter.drawText(28*5,45*5,QStringLiteral("10."));
-//    painter.drawText(28*5,51*5,QStringLiteral("11."));
-//    painter.drawText(28*5,57*5,QStringLiteral("12."));
-
-//    painter.drawText(47*5,27*5,QStringLiteral("13."));
-//    painter.drawText(47*5,33*5,QStringLiteral("14."));
-//    painter.drawText(47*5,39*5,QStringLiteral("15."));
-//    painter.drawText(47*5,45*5,QStringLiteral("16."));
-//    painter.drawText(47*5,51*5,QStringLiteral("17."));
-//    painter.drawText(47*5,57*5,QStringLiteral("18."));
-
-//    painter.drawText(66*5,27*5,QStringLiteral("19."));
-//    painter.drawText(66*5,33*5,QStringLiteral("20."));
-
-//    painter.drawText(8*5,64*5,QStringLiteral("总数"));
-//    painter.drawText(38*5,64*5,QStringLiteral("总重量"));
-//    painter.drawText(68*5,64*5,QStringLiteral("总筒数"));
-
-    QRect target(0*5, 67*5, 100*5, 60*5);
+    painter.drawText(9*5,27*5,QStringLiteral("1."));
+    painter.drawText(9*5,33*5,QStringLiteral("2."));
+    painter.drawText(9*5,39*5,QStringLiteral("3."));
+    painter.drawText(9*5,45*5,QStringLiteral("4."));
+    painter.drawText(9*5,51*5,QStringLiteral("5."));
+    painter.drawText(9*5,57*5,QStringLiteral("6."));
+
+    painter.drawText(28*5,27*5,QStringLiteral("7."));
+    painter.drawText(28*5,33*5,QStringLiteral("8."));
+    painter.drawText(28*5,39*5,QStringLiteral("9."));
+    painter.drawText(28*5,45*5,QStringLiteral("10."));
+    painter.drawText(28*5,51*5,QStringLiteral("11."));
+    painter.drawText(28*5,57*5,QStringLiteral("12."));
+
+    painter.drawText(47*5,27*5,QStringLiteral("13."));
+    painter.drawText(47*5,33*5,QStringLiteral("14."));
+    painter.drawText(47*5,39*5,QStringLiteral("15."));
+    painter.drawText(47*5,45*5,QStringLiteral("16."));
+    painter.drawText(47*5,51*5,QStringLiteral("17."));
+    painter.drawText(47*5,57*5,QStringLiteral("18."));
+
+    painter.drawText(66*5,27*5,QStringLiteral("19."));
+    painter.drawText(66*5,33*5,QStringLiteral("20."));
+
+    painter.drawText(8*5,64*5,QStringLiteral("总数"));
+    painter.drawText(38*5,64*5,QStringLiteral("总重量"));
+    painter.drawText(68*5,64*5,QStringLiteral("总筒数"));
+
+    QRect target(0*5, 67*5, 100*5, 75*5);
     barCode.draw(painter,target,bar);
     barCode.draw(painter,target,bar);
 //    QRect source(-10*5, 0, 60*5, 40*5);
 //    QRect source(-10*5, 0, 60*5, 40*5);
 //    painter.drawImage(target,barCode.draw(barCode.CodeBinary(bar),bar),source);
 //    painter.drawImage(target,barCode.draw(barCode.CodeBinary(bar),bar),source);

+ 0 - 1
handle/remotepackconfig.cpp

@@ -60,7 +60,6 @@ RemotePackConfig::RemotePackConfig(QObject *parent) : QObject(parent)
 
 
 }
 }
 
 
-
 QList<DIYPackConfig> RemotePackConfig::getDiys(const QJsonObject & data)
 QList<DIYPackConfig> RemotePackConfig::getDiys(const QJsonObject & data)
 {
 {
     // TODO:
     // TODO:

+ 4 - 1
mainwindow.ui

@@ -33,7 +33,7 @@
     <item>
     <item>
      <widget class="QStackedWidget" name="stackedWidget">
      <widget class="QStackedWidget" name="stackedWidget">
       <property name="currentIndex">
       <property name="currentIndex">
-       <number>2</number>
+       <number>3</number>
       </property>
       </property>
       <widget class="QWidget" name="pageMain">
       <widget class="QWidget" name="pageMain">
        <layout class="QHBoxLayout" name="horizontalLayout_2">
        <layout class="QHBoxLayout" name="horizontalLayout_2">
@@ -238,6 +238,9 @@ color: rgb(255, 255, 255);</string>
       </widget>
       </widget>
       <widget class="SettingsForm" name="pageSettings"/>
       <widget class="SettingsForm" name="pageSettings"/>
       <widget class="QWidget" name="pageLogin">
       <widget class="QWidget" name="pageLogin">
+       <property name="styleSheet">
+        <string notr="true">background-color: rgb(119, 185, 255);</string>
+       </property>
        <layout class="QVBoxLayout" name="verticalLayout_2">
        <layout class="QVBoxLayout" name="verticalLayout_2">
         <item>
         <item>
          <spacer name="verticalSpacer">
          <spacer name="verticalSpacer">

+ 10 - 8
widget/autopackform.cpp

@@ -9,7 +9,7 @@ AutoPackForm::AutoPackForm(QWidget *parent) :
     ui->setupUi(this);
     ui->setupUi(this);
     QTimer *timer = new QTimer(this);
     QTimer *timer = new QTimer(this);
     connect(timer,&QTimer::timeout,this,&AutoPackForm::scaleData);
     connect(timer,&QTimer::timeout,this,&AutoPackForm::scaleData);
-    timer->start(100);
+//    timer->start(100);
 }
 }
 
 
 AutoPackForm::~AutoPackForm()
 AutoPackForm::~AutoPackForm()
@@ -51,6 +51,7 @@ void AutoPackForm::init()
 
 
 void AutoPackForm::on_addPackList_clicked()
 void AutoPackForm::on_addPackList_clicked()
 {
 {
+
     //把数据添加到数据库里
     //把数据添加到数据库里
     aputils.insertProductSQL(packinfo);
     aputils.insertProductSQL(packinfo);
     //TODO: 缓存箱单数据,页面显示情空
     //TODO: 缓存箱单数据,页面显示情空
@@ -141,12 +142,13 @@ void AutoPackForm::on_addBoxList_clicked()
 
 
     //TODO: 缓存数据,显示数据
     //TODO: 缓存数据,显示数据
     ui->tableWidget->setRowCount(ui->tableWidget->rowCount()+1);
     ui->tableWidget->setRowCount(ui->tableWidget->rowCount()+1);
-    ui->tableWidget->setItem(ui->tableWidget->rowCount(),0,new QTableWidgetItem(QString::number(ui->tableWidget->rowCount()+1)));
-    ui->tableWidget->setItem(ui->tableWidget->rowCount(),1,new QTableWidgetItem(box->caseNumber()));
-    ui->tableWidget->setItem(ui->tableWidget->rowCount(),2,new QTableWidgetItem(box->tube_number));
-    ui->tableWidget->setItem(ui->tableWidget->rowCount(),3,new QTableWidgetItem(box->gross_weight));
-    ui->tableWidget->setItem(ui->tableWidget->rowCount(),4,new QTableWidgetItem(box->bucket_weight));
-    ui->tableWidget->setItem(ui->tableWidget->rowCount(),5,new QTableWidgetItem(box->net_weight));
+    ui->tableWidget->setItem(ui->tableWidget->rowCount()-1,0,new QTableWidgetItem(QString::number(ui->tableWidget->rowCount())));
+    ui->tableWidget->setItem(ui->tableWidget->rowCount()-1,1,new QTableWidgetItem(box->caseNumber()));
+    ui->tableWidget->setItem(ui->tableWidget->rowCount()-1,2,new QTableWidgetItem(QString::number(box->tube_number)));
+    ui->tableWidget->setItem(ui->tableWidget->rowCount()-1,3,new QTableWidgetItem(QString::number(box->gross_weight)));
+    ui->tableWidget->setItem(ui->tableWidget->rowCount()-1,4,new QTableWidgetItem(QString::number(box->bucket_weight)));
+    ui->tableWidget->setItem(ui->tableWidget->rowCount()-1,5,new QTableWidgetItem(QString::number(box->net_weight)));
+
 
 
 //    emit djmbbox(djmb.printBoxInfo(box->caseNumber(),box));
 //    emit djmbbox(djmb.printBoxInfo(box->caseNumber(),box));
 //    qDebug()<<packinfo->boxes().size();
 //    qDebug()<<packinfo->boxes().size();
@@ -165,7 +167,7 @@ void AutoPackForm::on_addBoxList_clicked()
         packinfo->machine_no = ui->jitai->currentText();
         packinfo->machine_no = ui->jitai->currentText();
         packinfo->carton_type = ui->zhixiang->currentText();
         packinfo->carton_type = ui->zhixiang->currentText();
         on_addPackList_clicked();
         on_addPackList_clicked();
-
+//        emit djmbbox(djmb.printPackInfo(packinfo->codeSingle(),packinfo));
         qDebug()<<"这里";
         qDebug()<<"这里";
     }
     }
 }
 }

+ 1 - 1
widget/autopackform.ui

@@ -341,7 +341,7 @@ color: rgb(0, 170, 255);</string>
         <item>
         <item>
          <widget class="QPushButton" name="pushButton_18">
          <widget class="QPushButton" name="pushButton_18">
           <property name="text">
           <property name="text">
-           <string>PushButton</string>
+           <string>接续</string>
           </property>
           </property>
          </widget>
          </widget>
         </item>
         </item>

+ 8 - 0
widget/loginform.cpp

@@ -20,6 +20,14 @@ LoginForm::~LoginForm()
 
 
 void LoginForm::on_pushLogin_clicked()
 void LoginForm::on_pushLogin_clicked()
 {
 {
+
+    QFileInfo fileInfo(QCoreApplication::applicationDirPath() + "/Config.ini");
+    if(!fileInfo.exists()){
+        qDebug()<<"配置文件不存在";
+        QMessageBox::information(this,"注意","请设置配置");
+        return;
+    }
+
     auto glo = GlobalInfo::this_();
     auto glo = GlobalInfo::this_();
     auto uname = this->ui->lineUser->text();
     auto uname = this->ui->lineUser->text();
     auto upass = this->ui->linePass->text();
     auto upass = this->ui->linePass->text();

+ 98 - 82
widget/loginform.ui

@@ -13,93 +13,109 @@
   <property name="windowTitle">
   <property name="windowTitle">
    <string>Form</string>
    <string>Form</string>
   </property>
   </property>
-  <widget class="QLabel" name="label">
-   <property name="geometry">
-    <rect>
-     <x>40</x>
-     <y>50</y>
-     <width>58</width>
-     <height>18</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>用户名:</string>
-   </property>
-  </widget>
-  <widget class="QLabel" name="label_2">
-   <property name="geometry">
-    <rect>
-     <x>40</x>
-     <y>90</y>
-     <width>58</width>
-     <height>18</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>密码:</string>
-   </property>
-  </widget>
-  <widget class="QLineEdit" name="lineUser">
-   <property name="geometry">
-    <rect>
-     <x>120</x>
-     <y>40</y>
-     <width>191</width>
-     <height>32</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QLineEdit" name="linePass">
-   <property name="geometry">
-    <rect>
-     <x>120</x>
-     <y>80</y>
-     <width>191</width>
-     <height>32</height>
-    </rect>
-   </property>
-   <property name="echoMode">
-    <enum>QLineEdit::Password</enum>
-   </property>
-  </widget>
-  <widget class="QPushButton" name="pushLogin">
-   <property name="geometry">
-    <rect>
-     <x>70</x>
-     <y>120</y>
-     <width>181</width>
-     <height>51</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>登陆</string>
-   </property>
-  </widget>
-  <widget class="QPushButton" name="pushButton_2">
-   <property name="geometry">
-    <rect>
-     <x>297</x>
-     <y>163</y>
-     <width>51</width>
-     <height>31</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>设置</string>
-   </property>
-  </widget>
-  <widget class="QLabel" name="status">
+  <property name="styleSheet">
+   <string notr="true">background-color: rgb(255, 255, 255);</string>
+  </property>
+  <widget class="QWidget" name="widget" native="true">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
-     <x>80</x>
-     <y>10</y>
-     <width>201</width>
-     <height>21</height>
+     <x>0</x>
+     <y>0</y>
+     <width>351</width>
+     <height>201</height>
     </rect>
     </rect>
    </property>
    </property>
-   <property name="text">
-    <string>正在登陆中······</string>
+   <property name="styleSheet">
+    <string notr="true">background-color: rgb(185, 229, 255);</string>
    </property>
    </property>
+   <widget class="QLabel" name="label_2">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>90</y>
+      <width>58</width>
+      <height>18</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>密码:</string>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="lineUser">
+    <property name="geometry">
+     <rect>
+      <x>100</x>
+      <y>40</y>
+      <width>191</width>
+      <height>32</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLabel" name="status">
+    <property name="geometry">
+     <rect>
+      <x>60</x>
+      <y>10</y>
+      <width>201</width>
+      <height>21</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>正在登陆中······</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>50</y>
+      <width>58</width>
+      <height>18</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>用户名:</string>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="linePass">
+    <property name="geometry">
+     <rect>
+      <x>100</x>
+      <y>80</y>
+      <width>191</width>
+      <height>31</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushLogin">
+    <property name="geometry">
+     <rect>
+      <x>70</x>
+      <y>130</y>
+      <width>181</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="styleSheet">
+     <string notr="true">background-color: rgb(129, 207, 255);</string>
+    </property>
+    <property name="text">
+     <string>登陆</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_2">
+    <property name="geometry">
+     <rect>
+      <x>280</x>
+      <y>160</y>
+      <width>51</width>
+      <height>31</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>设置</string>
+    </property>
+   </widget>
   </widget>
   </widget>
  </widget>
  </widget>
  <resources/>
  <resources/>

+ 37 - 7
widget/packdetailform.cpp

@@ -29,8 +29,23 @@ void PackDetailForm::on_pushBack_clicked()
 void PackDetailForm::on_pushButton_clicked()
 void PackDetailForm::on_pushButton_clicked()
 {
 {
     nowPageNum = 0;
     nowPageNum = 0;
-//    changeTable(database.GetValues("product",productSqlLi st));
-    changeTreeWidget(database.GetValues("product",productSqlList,"limit 0,20"));
+//    changeTable(database.GetValues("product",productSqlList));
+    QString condition = "";
+    if(!ui->codeSingleLine->text().isEmpty()){
+    condition.append("code_single="+ui->codeSingleLine->text()+" ");
+    }
+    if(!ui->batch_noLine->text().isEmpty()){
+        if(!condition.isEmpty()){
+            condition.append("and ");
+        }
+        condition.append("batch_no="+ui->batch_noLine->text()+" ");
+    }
+    if(!condition.isEmpty()){
+        condition = "where "+ condition;
+    }
+        condition.append("limit 0,20");
+//        qDebug()<<condition;
+    changeTreeWidget(database.GetValues("product",productSqlList,/*"limit 0,20"*/condition));
 //    ui->pagesNum->setText(QString::number(pageNum)+"/"+QString::number(product.size()/20));
 //    ui->pagesNum->setText(QString::number(pageNum)+"/"+QString::number(product.size()/20));
     int pageListNum = database.GetTablePage();
     int pageListNum = database.GetTablePage();
     pageNumAll = pageListNum / 20;
     pageNumAll = pageListNum / 20;
@@ -79,7 +94,14 @@ void PackDetailForm::changeTreeWidget(QList<QMap<QString,QString>> productList)
             ui->treeWidget->setItemWidget(item,9,case_nember_btn);
             ui->treeWidget->setItemWidget(item,9,case_nember_btn);
 
 
             details = database.GetValues("details",detailSqlList," where code_single = "+product.at(i).value("code_single"));
             details = database.GetValues("details",detailSqlList," where code_single = "+product.at(i).value("code_single"));
-            for(int i=0; i<details.length(); ++i)//给A添加子项目
+
+
+//            QTreeWidgetItem *child;
+//            columItemList<<"箱号";
+//            child = new QTreeWidgetItem(columItemList);
+//            ui->treeWidget->setCurrentItem(child,1);
+
+            for(int i=0; i<details.length(); ++i)
                 {
                 {
                     QStringList columItemList;
                     QStringList columItemList;
                     QTreeWidgetItem *child;
                     QTreeWidgetItem *child;
@@ -87,7 +109,7 @@ void PackDetailForm::changeTreeWidget(QList<QMap<QString,QString>> productList)
                     child = new QTreeWidgetItem(columItemList);
                     child = new QTreeWidgetItem(columItemList);
                     item->addChild(child);
                     item->addChild(child);
         //            ui->tree->setItemWidget(child,1,new QSpinBox);
         //            ui->tree->setItemWidget(child,1,new QSpinBox);
-                    ui->treeWidget->setCurrentItem(child,1);
+                    ui->treeWidget->setCurrentItem(child);
                 }
                 }
         }
         }
 
 
@@ -128,7 +150,7 @@ void PackDetailForm::on_prevoiusPage_clicked()
         return;
         return;
     }
     }
     nowPageNum--;
     nowPageNum--;
-    changeTreeWidget(database.GetValues("product",productSqlList,"limit "+QString::number(nowPageNum)+",20"));
+    changeTreeWidget(database.GetValues("product",productSqlList,"limit "+QString::number(nowPageNum*20)+",20"));
 }
 }
 
 
 //下一页
 //下一页
@@ -138,18 +160,25 @@ void PackDetailForm::on_nextPage_clicked()
         return;
         return;
     }
     }
     nowPageNum++;
     nowPageNum++;
-    changeTreeWidget(database.GetValues("product",productSqlList,"limit "+QString::number(nowPageNum)+",20"));
+    changeTreeWidget(database.GetValues("product",productSqlList,"limit "+QString::number(nowPageNum*20)+",20"));
 }
 }
 
 
 //跳转
 //跳转
 void PackDetailForm::on_jump_clicked()
 void PackDetailForm::on_jump_clicked()
 {
 {
+    //判断jumpPage是否为数字,如果不是return
+    if(ui->jumpPage->text().toInt() == false){
+        return;
+    }
+    //判断jumpPage页数是否大于总页数,如果是return
     if(ui->jumpPage->text().toInt()>pageNumAll){
     if(ui->jumpPage->text().toInt()>pageNumAll){
         return;
         return;
     }
     }
-    changeTreeWidget(database.GetValues("product",productSqlList,"limit "+ui->jumpPage->text()+",20"));
+    nowPageNum = ui->jumpPage->text().toInt()-1;
+    changeTreeWidget(database.GetValues("product",productSqlList,"limit "+QString::number(nowPageNum*20)+",20"));
 }
 }
 
 
+//用作product数据库要查询的字段
 void PackDetailForm::productList()
 void PackDetailForm::productList()
 {
 {
     productSqlList.append("tongbu");
     productSqlList.append("tongbu");
@@ -169,6 +198,7 @@ void PackDetailForm::productList()
     productSqlList.append("remark");
     productSqlList.append("remark");
 }
 }
 
 
+//用作details数据库要查询的字段
 void PackDetailForm::detailsList()
 void PackDetailForm::detailsList()
 {
 {
     detailSqlList.append("code_single");
     detailSqlList.append("code_single");

+ 35 - 35
widget/packdetailform.ui

@@ -90,53 +90,22 @@
       <string notr="true">background-color: rgb(0, 170, 255);</string>
       <string notr="true">background-color: rgb(0, 170, 255);</string>
      </property>
      </property>
      <layout class="QGridLayout" name="gridLayout">
      <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0">
-       <widget class="QLineEdit" name="lineEdit">
-        <property name="placeholderText">
-         <string>码单</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QLineEdit" name="lineEdit_2">
-        <property name="placeholderText">
-         <string>批号</string>
-        </property>
-       </widget>
-      </item>
       <item row="0" column="2">
       <item row="0" column="2">
-       <widget class="QComboBox" name="comboBox">
+       <widget class="QComboBox" name="product_type_codeBox">
         <property name="currentText">
         <property name="currentText">
          <string/>
          <string/>
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="0" column="3">
-       <widget class="QLineEdit" name="lineEdit_3">
-        <property name="placeholderText">
-         <string>旦数</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="4">
-       <widget class="QLineEdit" name="lineEdit_4">
-        <property name="placeholderText">
-         <string>分特</string>
-        </property>
-       </widget>
-      </item>
       <item row="0" column="5">
       <item row="0" column="5">
-       <widget class="QLineEdit" name="lineEdit_5">
+       <widget class="QLineEdit" name="fiberLine">
         <property name="placeholderText">
         <property name="placeholderText">
          <string>孔数</string>
          <string>孔数</string>
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="0" column="6">
-       <widget class="QComboBox" name="comboBox_2"/>
-      </item>
       <item row="0" column="7">
       <item row="0" column="7">
-       <widget class="QComboBox" name="comboBox_3"/>
+       <widget class="QComboBox" name="UserIDBox"/>
       </item>
       </item>
       <item row="0" column="8">
       <item row="0" column="8">
        <widget class="QComboBox" name="comboBox_4"/>
        <widget class="QComboBox" name="comboBox_4"/>
@@ -160,6 +129,37 @@
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
+      <item row="0" column="4">
+       <widget class="QLineEdit" name="dtexLine">
+        <property name="placeholderText">
+         <string>分特</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLineEdit" name="codeSingleLine">
+        <property name="placeholderText">
+         <string>码单</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QLineEdit" name="batch_noLine">
+        <property name="placeholderText">
+         <string>批号</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="6">
+       <widget class="QComboBox" name="levelBox"/>
+      </item>
+      <item row="0" column="3">
+       <widget class="QLineEdit" name="denierLine">
+        <property name="placeholderText">
+         <string>旦数</string>
+        </property>
+       </widget>
+      </item>
      </layout>
      </layout>
     </widget>
     </widget>
    </item>
    </item>
@@ -224,7 +224,7 @@
      <item>
      <item>
       <widget class="QPushButton" name="pushButton_2">
       <widget class="QPushButton" name="pushButton_2">
        <property name="text">
        <property name="text">
-        <string>PushButton</string>
+        <string>显示毛重</string>
        </property>
        </property>
       </widget>
       </widget>
      </item>
      </item>

+ 10 - 1
widget/settingsform.cpp

@@ -6,6 +6,8 @@ SettingsForm::SettingsForm(QWidget *parent) :
     ui(new Ui::SettingsForm)
     ui(new Ui::SettingsForm)
 {
 {
     ui->setupUi(this);
     ui->setupUi(this);
+    ui->baseUrlLine->setText(config.baseUrl);
+    ui->printerName->setText(config.printerName);
 }
 }
 
 
 SettingsForm::~SettingsForm()
 SettingsForm::~SettingsForm()
@@ -13,7 +15,14 @@ SettingsForm::~SettingsForm()
     delete ui;
     delete ui;
 }
 }
 
 
-void SettingsForm::on_pushButton_2_clicked()
+void SettingsForm::on_back_btn_clicked()
 {
 {
     emit back();
     emit back();
 }
 }
+
+void SettingsForm::on_save_btn_clicked()
+{
+    config.Set("url","baseUrl",ui->baseUrlLine->text());
+    config.Set("hardware","printerName",ui->printerName->text());
+    config.Start();
+}

+ 5 - 1
widget/settingsform.h

@@ -2,6 +2,7 @@
 #define SETTINGSFORM_H
 #define SETTINGSFORM_H
 
 
 #include <QWidget>
 #include <QWidget>
+#include "configinfo.h"
 
 
 namespace Ui {
 namespace Ui {
 class SettingsForm;
 class SettingsForm;
@@ -16,13 +17,16 @@ public:
     ~SettingsForm();
     ~SettingsForm();
 
 
 private slots:
 private slots:
-    void on_pushButton_2_clicked();
+    void on_back_btn_clicked();
+
+    void on_save_btn_clicked();
 
 
 signals:
 signals:
     void back();
     void back();
 
 
 private:
 private:
     Ui::SettingsForm *ui;
     Ui::SettingsForm *ui;
+    ConfigInfo config;
 };
 };
 
 
 #endif // SETTINGSFORM_H
 #endif // SETTINGSFORM_H

+ 20 - 17
widget/settingsform.ui

@@ -26,16 +26,6 @@
     <string>打印机</string>
     <string>打印机</string>
    </property>
    </property>
   </widget>
   </widget>
-  <widget class="QComboBox" name="comboBox">
-   <property name="geometry">
-    <rect>
-     <x>190</x>
-     <y>50</y>
-     <width>87</width>
-     <height>22</height>
-    </rect>
-   </property>
-  </widget>
   <widget class="QLabel" name="label_2">
   <widget class="QLabel" name="label_2">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
@@ -72,15 +62,18 @@
     <string>服务器</string>
     <string>服务器</string>
    </property>
    </property>
   </widget>
   </widget>
-  <widget class="QLineEdit" name="lineEdit">
+  <widget class="QLineEdit" name="baseUrlLine">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
      <x>190</x>
      <x>190</x>
      <y>130</y>
      <y>130</y>
-     <width>271</width>
+     <width>301</width>
      <height>21</height>
      <height>21</height>
     </rect>
     </rect>
    </property>
    </property>
+   <property name="placeholderText">
+    <string>服务器地址:例http://erp.it.cn/api</string>
+   </property>
   </widget>
   </widget>
   <widget class="QLabel" name="label_4">
   <widget class="QLabel" name="label_4">
    <property name="geometry">
    <property name="geometry">
@@ -100,12 +93,12 @@
     <rect>
     <rect>
      <x>190</x>
      <x>190</x>
      <y>170</y>
      <y>170</y>
-     <width>271</width>
-     <height>161</height>
+     <width>301</width>
+     <height>171</height>
     </rect>
     </rect>
    </property>
    </property>
   </widget>
   </widget>
-  <widget class="QPushButton" name="pushButton">
+  <widget class="QPushButton" name="save_btn">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
      <x>190</x>
      <x>190</x>
@@ -118,10 +111,10 @@
     <string>保存</string>
     <string>保存</string>
    </property>
    </property>
   </widget>
   </widget>
-  <widget class="QPushButton" name="pushButton_2">
+  <widget class="QPushButton" name="back_btn">
    <property name="geometry">
    <property name="geometry">
     <rect>
     <rect>
-     <x>350</x>
+     <x>400</x>
      <y>430</y>
      <y>430</y>
      <width>93</width>
      <width>93</width>
      <height>28</height>
      <height>28</height>
@@ -131,6 +124,16 @@
     <string>返回</string>
     <string>返回</string>
    </property>
    </property>
   </widget>
   </widget>
+  <widget class="QLineEdit" name="printerName">
+   <property name="geometry">
+    <rect>
+     <x>190</x>
+     <y>50</y>
+     <width>301</width>
+     <height>21</height>
+    </rect>
+   </property>
+  </widget>
  </widget>
  </widget>
  <resources/>
  <resources/>
  <connections/>
  <connections/>