error пре 6 година
родитељ
комит
61c5b9c02e

+ 1 - 1
configinfo.cpp

@@ -32,7 +32,7 @@ void ConfigInfo::save()
 {
 {
     QJsonObject obj;
     QJsonObject obj;
     obj.insert("baseUrl","http://erp.itwsw.cn/api");
     obj.insert("baseUrl","http://erp.itwsw.cn/api");
-    obj.insert("printerName","");
+    obj.insert("printerName","TSC TTP-244 Pro");
     obj.insert("portName","COM1");
     obj.insert("portName","COM1");
     obj.insert("portBaudRate",9600);
     obj.insert("portBaudRate",9600);
     obj.insert("portType",0);
     obj.insert("portType",0);

+ 30 - 5
globalinfo.cpp

@@ -47,13 +47,19 @@ void GlobalInfo::start(UserInfo & user,bool online)
     packmanger  = nullptr;
     packmanger  = nullptr;
     initInfo();
     initInfo();
     _remoteConfig->refConfig();
     _remoteConfig->refConfig();
+    selectProject(online);
+    selectBoxModel();
+    selectPackModel();
+}
+
+void GlobalInfo::selectProject(bool online)
+{
+    _projectmanger->setStatus();
     if(online){
     if(online){
         _projectmanger->syncLocalList();
         _projectmanger->syncLocalList();
     } else {
     } else {
         _projectmanger->loadServerList(false);
         _projectmanger->loadServerList(false);
     }
     }
-    selectBoxModel();
-    selectPackModel();
 }
 }
 
 
 void GlobalInfo::selectBoxModel()
 void GlobalInfo::selectBoxModel()
@@ -101,7 +107,6 @@ void GlobalInfo::printerBox(QSharedPointer<BoxInfo> info)
 void GlobalInfo::printerBoxModel(QSharedPointer<BoxInfo> info,int ModelIndex)
 void GlobalInfo::printerBoxModel(QSharedPointer<BoxInfo> info,int ModelIndex)
 {
 {
     if(_printer){
     if(_printer){
-//        qDebug()<<"this";
         emit _printer->printerBoxModel(info,ModelIndex);
         emit _printer->printerBoxModel(info,ModelIndex);
     }
     }
 }
 }
@@ -122,7 +127,6 @@ void GlobalInfo::printerPack(QSharedPointer<PackInfo> info)
 void GlobalInfo::printerPackModel(QSharedPointer<PackInfo> info,int ModelIndex)
 void GlobalInfo::printerPackModel(QSharedPointer<PackInfo> info,int ModelIndex)
 {
 {
     if(_printer){
     if(_printer){
-//        qDebug()<<"this";
         emit _printer->printerPackModel(info,ModelIndex);
         emit _printer->printerPackModel(info,ModelIndex);
     }
     }
 }
 }
@@ -142,7 +146,11 @@ void GlobalInfo::syncProject(ProjectInfoManger * manger, bool )
         auto info = _serverInfo.at(i);
         auto info = _serverInfo.at(i);
         _project.insert(info->batch_no,info);
         _project.insert(info->batch_no,info);
     }
     }
-    emit doInited();
+    if(!islogin){
+        emit doInited();
+        islogin = true;
+    }
+        emit selectproject();
 }
 }
 
 
 void GlobalInfo::configUpdate(const DaBaoConfig & config)
 void GlobalInfo::configUpdate(const DaBaoConfig & config)
@@ -165,6 +173,23 @@ void GlobalInfo::wareConfigUp(const QList<WarehouseConfig> ware)
 
 
 QList<QSharedPointer<ProjectInfo>> GlobalInfo::searchProject(const QString & batchno,const QString &specs)
 QList<QSharedPointer<ProjectInfo>> GlobalInfo::searchProject(const QString & batchno,const QString &specs)
 {
 {
+    if(!batchno.isEmpty()&&!specs.isEmpty()){
+        QList<QSharedPointer<ProjectInfo>> ret;
+        for(int i = 0; i < _serverInfo.size(); ++i){
+            auto info = _serverInfo.at(i);
+            bool doIn =false;
+            if(info->batch_no.contains(batchno)){
+                doIn = true;
+            }
+            if(doIn){
+                if(info->specs.contains(specs)){
+                    ret.append(info);
+                }
+            }
+        }
+        return ret;
+    }
+
     QList<QSharedPointer<ProjectInfo>> ret;
     QList<QSharedPointer<ProjectInfo>> ret;
     for(int i = 0; i < _cacheInfo.size(); ++i){
     for(int i = 0; i < _cacheInfo.size(); ++i){
         auto info = _cacheInfo.at(i);
         auto info = _cacheInfo.at(i);

+ 4 - 0
globalinfo.h

@@ -62,6 +62,7 @@ public:
     void printerBoxModel(QSharedPointer<BoxInfo> info,int ModelIndex);
     void printerBoxModel(QSharedPointer<BoxInfo> info,int ModelIndex);
     void printerPack(QSharedPointer<PackInfo> info);
     void printerPack(QSharedPointer<PackInfo> info);
     void printerPackModel(QSharedPointer<PackInfo> info,int ModelIndex);
     void printerPackModel(QSharedPointer<PackInfo> info,int ModelIndex);
+    void setIslogin(bool login){ islogin = login;}
 
 
     // 同步调用
     // 同步调用
     void doSync(QDate & tm);
     void doSync(QDate & tm);
@@ -71,12 +72,14 @@ signals:
     void dbConfigUpdated();
     void dbConfigUpdated();
     void dengJiUped();
     void dengJiUped();
     void doInited();
     void doInited();
+    void selectproject();
     void logOuted();
     void logOuted();
     void wareUped();
     void wareUped();
     void boxModelUped();
     void boxModelUped();
     void packModelUpde();
     void packModelUpde();
 public slots:
 public slots:
     void start(UserInfo & user,bool online);
     void start(UserInfo & user,bool online);
+    void selectProject(bool online);
     void selectBoxModel();
     void selectBoxModel();
     void selectPackModel();
     void selectPackModel();
 
 
@@ -103,6 +106,7 @@ private:
     QString pack_num;
     QString pack_num;
     UserInfo _users;
     UserInfo _users;
     bool _isNoLine;
     bool _isNoLine;
+    bool islogin = false;
 private:
 private:
     PackInfoManger * packmanger;
     PackInfoManger * packmanger;
     PrinterThreadHandle * _printer;
     PrinterThreadHandle * _printer;

+ 7 - 7
handle/packinfoseed2server.cpp

@@ -29,13 +29,13 @@ void PackInfoSeed2Server::doSend()
         }
         }
         _current = _queue.first();
         _current = _queue.first();
         //docs: http://doc.vanlai.net:3001/web/#/1?page_id=64
         //docs: http://doc.vanlai.net:3001/web/#/1?page_id=64
-        if(_current->autoRuku == true){
-            QString url = GlobalInfo::this_()->config()->baseUrl+"/v1/product/directly/into";
-            _requst.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
-            _requst.post(url,_current->toObject());
-            return;
-        }
-        QString url = GlobalInfo::this_()->config()->baseUrl+"/v1/product/pending";
+//        if(_current->autoRuku == true){
+//            QString url = GlobalInfo::this_()->config()->baseUrl+"/v1/product/directly/into";
+//            _requst.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
+//            _requst.post(url,_current->toObject());
+//            return;
+//        }
+        QString url = GlobalInfo::this_()->config()->baseUrl+"/v2/product/pending";
         _requst.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
         _requst.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
         _requst.post(url,_current->toObject());
         _requst.post(url,_current->toObject());
     }
     }

+ 0 - 4
handle/printer/boxtemlateone.cpp

@@ -41,7 +41,6 @@ QImage BoxTemlateOne::doPrinter(QSharedPointer<BoxInfo> box)
     font.setWeight(QFont::ExtraLight);
     font.setWeight(QFont::ExtraLight);
     painter.setFont(font);
     painter.setFont(font);
     painter.drawText(6*5,15*5,box->parentPack()->customer);
     painter.drawText(6*5,15*5,box->parentPack()->customer);
-//    qDebug()<< "公司名称:" <<box->parentPack()->customer;
 
 
     font.setPixelSize(20);
     font.setPixelSize(20);
     font.setBold(true);
     font.setBold(true);
@@ -88,7 +87,6 @@ QImage BoxTemlateOne::doPrinter(QSharedPointer<BoxInfo> box)
 
 
 QImage BoxTemlateOne::doPrinter(QSharedPointer<BoxInfo> box,int ModelIndex)
 QImage BoxTemlateOne::doPrinter(QSharedPointer<BoxInfo> box,int ModelIndex)
 {
 {
-//    qDebug()<<GlobalInfo::this_()->BoxModelList().size();
     boxM = GlobalInfo::this_()->BoxModelList().at(ModelIndex);
     boxM = GlobalInfo::this_()->BoxModelList().at(ModelIndex);
 
 
     QSharedPointer<PackInfo> pinfo = box->parentPack();
     QSharedPointer<PackInfo> pinfo = box->parentPack();
@@ -126,7 +124,6 @@ QImage BoxTemlateOne::doPrinter(QSharedPointer<BoxInfo> box,int ModelIndex)
     font.setWeight(QFont::ExtraLight);
     font.setWeight(QFont::ExtraLight);
     painter.setFont(font);
     painter.setFont(font);
     painter.drawText(6*5,15*5,box->parentPack()->customer);
     painter.drawText(6*5,15*5,box->parentPack()->customer);
-//    qDebug()<< "公司名称:" <<box->parentPack()->customer;
 
 
     font.setPixelSize(20);
     font.setPixelSize(20);
     font.setBold(true);
     font.setBold(true);
@@ -231,7 +228,6 @@ QSize BoxTemlateOne::printSize()
 
 
 QImage BoxTemlateOne::Boxmodel()
 QImage BoxTemlateOne::Boxmodel()
 {
 {
-    qDebug()<<"this";
     QSize size(MAXWIDTH*5,MAXHEIGHT*5);
     QSize size(MAXWIDTH*5,MAXHEIGHT*5);
     QImage image(size,QImage::Format_ARGB32);
     QImage image(size,QImage::Format_ARGB32);
     image.fill(qRgba(255, 255, 255, 255));
     image.fill(qRgba(255, 255, 255, 255));

+ 0 - 1
handle/printer/code39.cpp

@@ -94,7 +94,6 @@ void Code39::draw(QPainter & painter, QRect & pos,QString & barcode)
         painter.drawLine(i*LineWidth+LineWidth/2+move,pos.top(),i*LineWidth+LineWidth/2+move,MAXHEIGHT);
         painter.drawLine(i*LineWidth+LineWidth/2+move,pos.top(),i*LineWidth+LineWidth/2+move,MAXHEIGHT);
     }
     }
 
 
-//    qDebug()<<barcode<<endl;
     //添加底部条形码字符
     //添加底部条形码字符
     painter.setPen(black);
     painter.setPen(black);
     painter.setRenderHint(QPainter::Antialiasing,true);
     painter.setRenderHint(QPainter::Antialiasing,true);

+ 6 - 1
handle/projectinfomanger.cpp

@@ -45,11 +45,16 @@ bool ProjectInfoManger::syncLocalList()
     return true;
     return true;
 }
 }
 
 
+void ProjectInfoManger::setStatus()
+{
+    _status = IDIL;
+}
+
 void ProjectInfoManger::doSendLoad()
 void ProjectInfoManger::doSendLoad()
 {
 {
     _status = Load_Server_List;
     _status = Load_Server_List;
     // docs: http://doc.vanlai.net:3001/web/#/1?page_id=60
     // docs: http://doc.vanlai.net:3001/web/#/1?page_id=60
-    QString url = GlobalInfo::this_()->config()->baseUrl+"/v1/goods/list?page=0&limit=10000";
+    QString url = GlobalInfo::this_()->config()->baseUrl+"/v2/goods/list?page=0&limit=10000&status=ON";
     _requst.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
     _requst.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
     _requst.get(url);
     _requst.get(url);
 }
 }

+ 2 - 0
handle/projectinfomanger.h

@@ -32,6 +32,8 @@ public slots:
     bool loadServerList(bool local);
     bool loadServerList(bool local);
 
 
     bool syncLocalList();
     bool syncLocalList();
+
+    void setStatus();
 private slots:
 private slots:
 
 
     void doSendLoad();
     void doSendLoad();

+ 5 - 6
handle/remotepackconfig.cpp

@@ -17,11 +17,13 @@ RemotePackConfig::RemotePackConfig(QObject *parent) : QObject(parent)
     parsefUNS.insert("A1000106",[this](const QJsonObject & obj){this->_config.nianxiang = this->getConfigStringList(obj);});
     parsefUNS.insert("A1000106",[this](const QJsonObject & obj){this->_config.nianxiang = this->getConfigStringList(obj);});
     parsefUNS.insert("A1000107",[this](const QJsonObject & obj){this->_config.zhixiang = this->getConfigStringList(obj);});
     parsefUNS.insert("A1000107",[this](const QJsonObject & obj){this->_config.zhixiang = this->getConfigStringList(obj);});
     parsefUNS.insert("A1000108",[this](const QJsonObject & obj){this->_config.mashu = this->getConfigStringInt(obj);});
     parsefUNS.insert("A1000108",[this](const QJsonObject & obj){this->_config.mashu = this->getConfigStringInt(obj);});
-   parsefUNS.insert("A1000109",[this](const QJsonObject & obj){this->_config.cheZhong = this->getConfigStringList(obj);});
-   parsefUNS.insert("A1000110",[this](const QJsonObject & obj){this->_config.gangHao = this->getConfigStringList(obj);});
+//   parsefUNS.insert("A1000109",[this](const QJsonObject & obj){this->_config.cheZhong = this->getConfigStringList(obj);});
+//   parsefUNS.insert("A1000110",[this](const QJsonObject & obj){this->_config.gangHao = this->getConfigStringList(obj);});
    parsefUNS.insert("A1000111",[this](const QJsonObject & obj){this->_config.xiangHaoXianShiGuiZe = this->getConfigInt(obj);});
    parsefUNS.insert("A1000111",[this](const QJsonObject & obj){this->_config.xiangHaoXianShiGuiZe = this->getConfigInt(obj);});
    parsefUNS.insert("A1000112",[this](const QJsonObject & obj){this->_config.daBaoRuku = this->getConfigBool(obj);});
    parsefUNS.insert("A1000112",[this](const QJsonObject & obj){this->_config.daBaoRuku = this->getConfigBool(obj);});
    parsefUNS.insert("A1000113",[this](const QJsonObject & obj){this->_config.daBaoRiQiXianShiFangShi = this->getConfigInt(obj);});
    parsefUNS.insert("A1000113",[this](const QJsonObject & obj){this->_config.daBaoRiQiXianShiFangShi = this->getConfigInt(obj);});
+   parsefUNS.insert("A1000114",[this](const QJsonObject & obj){this->_config.pinZhong = this->getConfigStringList(obj);});
+
    parsefUNS.insert("A2000200",[this](const QJsonObject & obj){this->_config.ziDongDushu = this->getConfigBool(obj);});
    parsefUNS.insert("A2000200",[this](const QJsonObject & obj){this->_config.ziDongDushu = this->getConfigBool(obj);});
    parsefUNS.insert("A2000201",[this](const QJsonObject & obj){this->_config.buDingZhongDaBaoXianzhi = this->getConfigBool(obj);});
    parsefUNS.insert("A2000201",[this](const QJsonObject & obj){this->_config.buDingZhongDaBaoXianzhi = this->getConfigBool(obj);});
    parsefUNS.insert("A2000202",[this](const QJsonObject & obj){this->_config.dingZhongDaBaoXianZhiKaiQi = this->getConfigBool(obj);});
    parsefUNS.insert("A2000202",[this](const QJsonObject & obj){this->_config.dingZhongDaBaoXianZhiKaiQi = this->getConfigBool(obj);});
@@ -56,7 +58,7 @@ RemotePackConfig::RemotePackConfig(QObject *parent) : QObject(parent)
    parsefUNS.insert("A3000303",[this](const QJsonObject & obj){this->_config.morenDaYinXIaoShouDan = this->getConfigInt(obj);});
    parsefUNS.insert("A3000303",[this](const QJsonObject & obj){this->_config.morenDaYinXIaoShouDan = this->getConfigInt(obj);});
    parsefUNS.insert("A3000304",[this](const QJsonObject & obj){this->_config.morenXianShiQianKuan = this->getConfigInt(obj);});
    parsefUNS.insert("A3000304",[this](const QJsonObject & obj){this->_config.morenXianShiQianKuan = this->getConfigInt(obj);});
    parsefUNS.insert("A3000305",[this](const QJsonObject & obj){this->_config.xiaoShouEJingDu = this->getConfigInt(obj);});
    parsefUNS.insert("A3000305",[this](const QJsonObject & obj){this->_config.xiaoShouEJingDu = this->getConfigInt(obj);});
-   parsefUNS.insert("A4000400",[this](const QJsonObject & obj){this->_config.diys = this->getDiys(obj);});
+//   parsefUNS.insert("A4000400",[this](const QJsonObject & obj){this->_config.diys = this->getDiys(obj);});
 
 
   //TODO:http://doc.vanlai.net:3001/web/#/1?page_id=57 补全剩下
   //TODO:http://doc.vanlai.net:3001/web/#/1?page_id=57 补全剩下
 //http://erp.itwsw.cn/#/packageCon
 //http://erp.itwsw.cn/#/packageCon
@@ -253,7 +255,6 @@ int RemotePackConfig::getConfigInt(const QJsonObject & data)
 QPair<int,int> RemotePackConfig::getConfigpAIR(const QJsonObject & data)
 QPair<int,int> RemotePackConfig::getConfigpAIR(const QJsonObject & data)
 {
 {
     QJsonArray value_array = data.value("value").toArray();
     QJsonArray value_array = data.value("value").toArray();
-//    qDebug()<<value_array;
     QPair<int,int> list;
     QPair<int,int> list;
     int vSize = value_array.size();
     int vSize = value_array.size();
     bool frist = true;
     bool frist = true;
@@ -262,11 +263,9 @@ QPair<int,int> RemotePackConfig::getConfigpAIR(const QJsonObject & data)
 //        if(value_object.value("selected").toBool(false)){
 //        if(value_object.value("selected").toBool(false)){
             if(frist) {
             if(frist) {
                 list.first = value_object.value("value").toInt();
                 list.first = value_object.value("value").toInt();
-//                qDebug()<<"不定重范围"<<value_object.value("value").toInt();
                 frist = false;
                 frist = false;
             } else {
             } else {
                 list.second = value_object.value("value").toInt();
                 list.second = value_object.value("value").toInt();
-//                qDebug()<<"不定重范围"<<value_object.value("value").toInt();
             }
             }
 
 
 //        }
 //        }

+ 1 - 0
handle/remotepackconfig.h

@@ -37,6 +37,7 @@ struct DaBaoConfig
     QList<int> mashu;//码数
     QList<int> mashu;//码数
     QStringList cheZhong;//车重
     QStringList cheZhong;//车重
     QStringList gangHao;//缸号
     QStringList gangHao;//缸号
+    QStringList pinZhong;//品种
     int xiangHaoXianShiGuiZe;//箱号显示规则
     int xiangHaoXianShiGuiZe;//箱号显示规则
     int daBaoRiQiXianShiFangShi;//打包日期时间显示方式
     int daBaoRiQiXianShiFangShi;//打包日期时间显示方式
     bool daBaoRuku;//打包即入库
     bool daBaoRuku;//打包即入库


+ 3 - 5
mainwindow.cpp

@@ -100,6 +100,7 @@ void MainWindow::backSelect(int i)
         QMessageBox::information(this,tr("注意"),tr("请登录"));
         QMessageBox::information(this,tr("注意"),tr("请登录"));
         return;
         return;
     }
     }
+
     ui->pageSelectValue->setStatus(i);
     ui->pageSelectValue->setStatus(i);
     ui->pageSelectValue->Start();
     ui->pageSelectValue->Start();
     ui->stackedWidget->setCurrentWidget(ui->pageSelectValue);
     ui->stackedWidget->setCurrentWidget(ui->pageSelectValue);
@@ -107,13 +108,13 @@ void MainWindow::backSelect(int i)
 
 
 void MainWindow::FixedAndUncertain(QString batchno)
 void MainWindow::FixedAndUncertain(QString batchno)
 {
 {
-//    qDebug()<<batchno;
     ui->stackedWidget->setCurrentWidget(ui->pageAutoPack);
     ui->stackedWidget->setCurrentWidget(ui->pageAutoPack);
 //    ui->dingzhongButton->setChecked(true);
 //    ui->dingzhongButton->setChecked(true);
     ui->dingzhong->setProInfo(GlobalInfo::this_()->project().value(batchno));
     ui->dingzhong->setProInfo(GlobalInfo::this_()->project().value(batchno));
     ui->dingzhong->changeSpecs();
     ui->dingzhong->changeSpecs();
     ui->buding->setProInfo(GlobalInfo::this_()->project().value(batchno));
     ui->buding->setProInfo(GlobalInfo::this_()->project().value(batchno));
     ui->buding->changeSpecs();
     ui->buding->changeSpecs();
+
 }
 }
 
 
 void MainWindow::backFAndU()
 void MainWindow::backFAndU()
@@ -141,7 +142,6 @@ void MainWindow::changeToPackDetail()
     QList<PackSaveInfo> save;
     QList<PackSaveInfo> save;
     for(int i = saveinfo.size()-1;i>=0;i--){
     for(int i = saveinfo.size()-1;i>=0;i--){
         save.append(saveinfo.at(i));
         save.append(saveinfo.at(i));
-//        qDebug()<<i;
     }
     }
     ui->pagePackDetail->setSaveInfo(save);
     ui->pagePackDetail->setSaveInfo(save);
     ui->pagePackDetail->days = 0;
     ui->pagePackDetail->days = 0;
@@ -206,14 +206,12 @@ void MainWindow::logout()
     ui->dingzhong->save();
     ui->dingzhong->save();
     ui->buding->save();
     ui->buding->save();
     GlobalInfo::this_()->logOuted();
     GlobalInfo::this_()->logOuted();
-    UserInfo user;
-    GlobalInfo::this_()->start(user,true);
+    GlobalInfo::this_()->setIslogin(false);
     ui->stackedWidget->setCurrentWidget(ui->pageLogin);
     ui->stackedWidget->setCurrentWidget(ui->pageLogin);
 }
 }
 
 
 
 
 void MainWindow::on_backButton_clicked()
 void MainWindow::on_backButton_clicked()
 {
 {
-    qDebug()<<"this";
     ui->stackedWidget->setCurrentWidget(ui->pageMain);
     ui->stackedWidget->setCurrentWidget(ui->pageMain);
 }
 }

+ 1 - 1
mainwindow.ui

@@ -21,7 +21,7 @@
     <item row="0" column="0">
     <item row="0" column="0">
      <widget class="QStackedWidget" name="stackedWidget">
      <widget class="QStackedWidget" name="stackedWidget">
       <property name="currentIndex">
       <property name="currentIndex">
-       <number>3</number>
+       <number>0</number>
       </property>
       </property>
       <widget class="QWidget" name="pageMain">
       <widget class="QWidget" name="pageMain">
        <layout class="QGridLayout" name="gridLayout_4">
        <layout class="QGridLayout" name="gridLayout_4">

+ 5 - 5
struct_/packinfo.cpp

@@ -83,11 +83,11 @@ QSharedPointer<BoxInfo> BoxInfo::fromObject(QSharedPointer<PackInfo> & pack,QJso
     ret->case_number = case_number;
     ret->case_number = case_number;
     ret->box_weight = obj.value("box_weight").toInt();
     ret->box_weight = obj.value("box_weight").toInt();
     ret->tube_number = obj.value("tube_number").toInt();
     ret->tube_number = obj.value("tube_number").toInt();
-    ret->bucket_weight = obj.value("tube_number").toInt();
+    ret->bucket_weight = obj.value("bucket_weight").toInt();
     ret->gross_weight = obj.value("gross_weight").toInt();
     ret->gross_weight = obj.value("gross_weight").toInt();
     ret->net_weight = obj.value("net_weight").toInt();
     ret->net_weight = obj.value("net_weight").toInt();
     ret->Level = obj.value("Level").toString();
     ret->Level = obj.value("Level").toString();
-    ret->twist_type = obj.value("bucket_color").toString();
+    ret->twist_type = obj.value("twist_type").toString();
     ret->bucket_color = obj.value("bucket_color").toString();
     ret->bucket_color = obj.value("bucket_color").toString();
     ret->sort = obj.value("sort").toString();
     ret->sort = obj.value("sort").toString();
     ret->remark = obj.value("remark").toString();
     ret->remark = obj.value("remark").toString();
@@ -118,7 +118,9 @@ QJsonObject PackInfo::toObject()
     ret.insert("customer",customer);
     ret.insert("customer",customer);
     ret.insert("batch_no",batch_no);
     ret.insert("batch_no",batch_no);
     ret.insert("autoRuku",autoRuku);
     ret.insert("autoRuku",autoRuku);
-    ret.insert("warehouse_id",warehouse_id);
+    if(warehouse_id>0){
+        ret.insert("warehouse_id",warehouse_id);
+    }
 
 
     ret.insert("packType",packType);
     ret.insert("packType",packType);
 
 
@@ -238,8 +240,6 @@ void PackInfo::addBoxInfoList(QSharedPointer<BoxInfo> boxes)
 
 
 void PackInfo::delBoxInfoAt(int num)
 void PackInfo::delBoxInfoAt(int num)
 {
 {
-    qDebug()<<"size"<<_boxes.size();
-    qDebug()<<"num"<<num;
     _boxes.removeAt(num);
     _boxes.removeAt(num);
 }
 }
 
 

+ 2 - 2
struct_/packinfo.h

@@ -65,10 +65,10 @@ public:
     QString packing_time;//	是	string	打包时间
     QString packing_time;//	是	string	打包时间
     QString packing_type;//	是	string	打包类型
     QString packing_type;//	是	string	打包类型
     QString carton_type;//	是	string	纸箱
     QString carton_type;//	是	string	纸箱
-    int operator_id = 0;//	是	int	操作员ID
+    QString operator_id;//	是	int	操作员ID
     QString batch_no;//批号
     QString batch_no;//批号
     bool autoRuku;//    打包及入库是否点击
     bool autoRuku;//    打包及入库是否点击
-    int warehouse_id;//仓库id
+    int warehouse_id = 0;//仓库id
 
 
     QString remark;//	否	string
     QString remark;//	否	string
 
 

+ 19 - 3
widget/addnewspecsform.cpp

@@ -10,6 +10,8 @@ AddNewSpecsForm::AddNewSpecsForm(QWidget *parent) :
     connect(glo,&GlobalInfo::dbConfigUpdated,this,&AddNewSpecsForm::init);
     connect(glo,&GlobalInfo::dbConfigUpdated,this,&AddNewSpecsForm::init);
     connect(&request,&HttpRequest::result,this,&AddNewSpecsForm::result);
     connect(&request,&HttpRequest::result,this,&AddNewSpecsForm::result);
     ui->tiJiao_text->hide();
     ui->tiJiao_text->hide();
+    ui->label_18->hide();
+    ui->bucket_number->hide();
 }
 }
 
 
 AddNewSpecsForm::~AddNewSpecsForm()
 AddNewSpecsForm::~AddNewSpecsForm()
@@ -20,6 +22,9 @@ AddNewSpecsForm::~AddNewSpecsForm()
 void AddNewSpecsForm::init()
 void AddNewSpecsForm::init()
 {
 {
     DaBaoConfig config = glo->dbConfig();
     DaBaoConfig config = glo->dbConfig();
+
+    ui->product_type_code->clear();
+    ui->product_type_code->addItems(config.pinZhong);
     //机台
     //机台
     ui->machine_no->clear();
     ui->machine_no->clear();
     ui->machine_no->addItems(config.jitai);
     ui->machine_no->addItems(config.jitai);
@@ -65,7 +70,7 @@ void AddNewSpecsForm::projectData(){
     project.reset(new ProjectInfo);
     project.reset(new ProjectInfo);
     project->batch_no = ui->batch_no->text();
     project->batch_no = ui->batch_no->text();
     project->category = ui->category->text();
     project->category = ui->category->text();
-    project->product_type_code = ui->product_type_code->text();
+    project->product_type_code = ui->product_type_code->currentText();
     project->spec_role = ui->spec_role->text();
     project->spec_role = ui->spec_role->text();
     project->denier = ui->denier->text();
     project->denier = ui->denier->text();
     project->dtex = ui->dtex->text();
     project->dtex = ui->dtex->text();
@@ -82,7 +87,6 @@ void AddNewSpecsForm::projectData(){
     project->customer = ui->customer->text();
     project->customer = ui->customer->text();
     project->remark = ui->remark->toPlainText();
     project->remark = ui->remark->toPlainText();
     project->tel = ui->tel->text();
     project->tel = ui->tel->text();
-    qDebug()<<"this";
 }
 }
 
 
 void AddNewSpecsForm::on_StartButton_clicked()
 void AddNewSpecsForm::on_StartButton_clicked()
@@ -100,6 +104,18 @@ void AddNewSpecsForm::on_StartButton_clicked()
         return;
         return;
     }
     }
 
 
+    if(ui->denier->text().isEmpty()){
+        QMessageBox::information(this,tr("注意"),tr("旦数为空"));
+        ui->StartButton->setEnabled(true);
+        return;
+    }
+
+    if(ui->dtex->text().isEmpty()){
+        QMessageBox::information(this,tr("注意"),tr("分特为空"));
+        ui->StartButton->setEnabled(true);
+        return;
+    }
+
     ui->tiJiao_text->show();
     ui->tiJiao_text->show();
     ui->StartButton->setEnabled(false);
     ui->StartButton->setEnabled(false);
     projectData();
     projectData();
@@ -116,7 +132,7 @@ void AddNewSpecsForm::on_StartButton_clicked()
         return;
         return;
     }
     }
 
 
-    QString url = GlobalInfo::this_()->config()->baseUrl+"/v1/goods/add";
+    QString url = GlobalInfo::this_()->config()->baseUrl+"/v2/goods/add";
     request.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
     request.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
     request.post(url,project->toObject());
     request.post(url,project->toObject());
 }
 }

+ 129 - 89
widget/addnewspecsform.ui

@@ -122,11 +122,15 @@
    <item row="2" column="0">
    <item row="2" column="0">
     <widget class="QWidget" name="widget_2" native="true">
     <widget class="QWidget" name="widget_2" native="true">
      <layout class="QGridLayout" name="gridLayout_5">
      <layout class="QGridLayout" name="gridLayout_5">
-      <item row="1" column="5">
-       <widget class="QLineEdit" name="category"/>
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_3">
+        <property name="text">
+         <string>品    种</string>
+        </property>
+       </widget>
       </item>
       </item>
-      <item row="4" column="1">
-       <widget class="QComboBox" name="carton_type"/>
+      <item row="0" column="1">
+       <widget class="QComboBox" name="product_type_code"/>
       </item>
       </item>
       <item row="0" column="2">
       <item row="0" column="2">
        <widget class="QLabel" name="label_14">
        <widget class="QLabel" name="label_14">
@@ -135,18 +139,62 @@
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="2" column="2">
-       <widget class="QLabel" name="label_16">
-        <property name="text">
-         <string>捻    向</string>
-        </property>
-       </widget>
+      <item row="0" column="3">
+       <widget class="QLineEdit" name="spec_role"/>
       </item>
       </item>
-      <item row="3" column="5">
-       <widget class="QComboBox" name="machine_no"/>
+      <item row="0" column="4">
+       <layout class="QHBoxLayout" name="horizontalLayout_5">
+        <item>
+         <widget class="QLabel" name="label_28">
+          <property name="styleSheet">
+           <string notr="true">color: rgb(255, 0, 0);</string>
+          </property>
+          <property name="text">
+           <string>*</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="label_19">
+          <property name="text">
+           <string>旦数(D)</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
       </item>
       </item>
-      <item row="5" column="1">
-       <widget class="QLineEdit" name="customer"/>
+      <item row="0" column="5">
+       <widget class="QLineEdit" name="denier"/>
+      </item>
+      <item row="1" column="0">
+       <layout class="QHBoxLayout" name="horizontalLayout_4">
+        <item>
+         <widget class="QLabel" name="label_27">
+          <property name="maximumSize">
+           <size>
+            <width>8</width>
+            <height>19</height>
+           </size>
+          </property>
+          <property name="styleSheet">
+           <string notr="true">color: rgb(255, 0, 0);</string>
+          </property>
+          <property name="text">
+           <string>*</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="label_4">
+          <property name="text">
+           <string>分特(dt)</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="1" column="1">
+       <widget class="QLineEdit" name="dtex"/>
       </item>
       </item>
       <item row="1" column="2">
       <item row="1" column="2">
        <widget class="QLabel" name="label_15">
        <widget class="QLabel" name="label_15">
@@ -155,6 +203,39 @@
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
+      <item row="1" column="3">
+       <widget class="QLineEdit" name="fiber"/>
+      </item>
+      <item row="1" column="4">
+       <layout class="QGridLayout" name="gridLayout">
+        <item row="0" column="1">
+         <widget class="QLabel" name="label_20">
+          <property name="text">
+           <string>类  型</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0">
+         <widget class="QLabel" name="label_26">
+          <property name="maximumSize">
+           <size>
+            <width>8</width>
+            <height>19</height>
+           </size>
+          </property>
+          <property name="styleSheet">
+           <string notr="true">color: rgb(255, 0, 0);</string>
+          </property>
+          <property name="text">
+           <string>*</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="1" column="5">
+       <widget class="QLineEdit" name="category"/>
+      </item>
       <item row="2" column="0">
       <item row="2" column="0">
        <widget class="QLabel" name="label_5">
        <widget class="QLabel" name="label_5">
         <property name="text">
         <property name="text">
@@ -162,35 +243,28 @@
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="3" column="2">
-       <widget class="QLabel" name="label_17">
-        <property name="text">
-         <string>筒    重</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QLineEdit" name="product_type_code"/>
+      <item row="2" column="1">
+       <widget class="QLineEdit" name="color"/>
       </item>
       </item>
-      <item row="4" column="0">
-       <widget class="QLabel" name="label_7">
+      <item row="2" column="2">
+       <widget class="QLabel" name="label_16">
         <property name="text">
         <property name="text">
-         <string>纸    箱</string>
+         <string>捻    向</string>
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="0" column="3">
-       <widget class="QLineEdit" name="spec_role"/>
+      <item row="2" column="3">
+       <widget class="QComboBox" name="twist_type"/>
       </item>
       </item>
-      <item row="3" column="4">
-       <widget class="QLabel" name="label_22">
+      <item row="2" column="4">
+       <widget class="QLabel" name="label_21">
         <property name="text">
         <property name="text">
-         <string>机    台</string>
+         <string>管    色</string>
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="1" column="1">
-       <widget class="QLineEdit" name="dtex"/>
+      <item row="2" column="5">
+       <widget class="QComboBox" name="bucket_color"/>
       </item>
       </item>
       <item row="3" column="0">
       <item row="3" column="0">
        <widget class="QLabel" name="label_6">
        <widget class="QLabel" name="label_6">
@@ -202,38 +276,35 @@
       <item row="3" column="1">
       <item row="3" column="1">
        <widget class="QComboBox" name="box_weight"/>
        <widget class="QComboBox" name="box_weight"/>
       </item>
       </item>
-      <item row="2" column="5">
-       <widget class="QComboBox" name="bucket_color"/>
-      </item>
-      <item row="2" column="4">
-       <widget class="QLabel" name="label_21">
+      <item row="3" column="2">
+       <widget class="QLabel" name="label_17">
         <property name="text">
         <property name="text">
-         <string>管    色</string>
+         <string>筒    重</string>
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="4" column="5">
-       <widget class="QLineEdit" name="specs"/>
-      </item>
-      <item row="0" column="5">
-       <widget class="QLineEdit" name="denier"/>
+      <item row="3" column="3">
+       <widget class="QComboBox" name="bucket_weight"/>
       </item>
       </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="label_4">
+      <item row="3" column="4">
+       <widget class="QLabel" name="label_22">
         <property name="text">
         <property name="text">
-         <string>分特(dt)</string>
+         <string>机    台</string>
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="0" column="4">
-       <widget class="QLabel" name="label_19">
+      <item row="3" column="5">
+       <widget class="QComboBox" name="machine_no"/>
+      </item>
+      <item row="4" column="0">
+       <widget class="QLabel" name="label_7">
         <property name="text">
         <property name="text">
-         <string>旦数(D)</string>
+         <string>纸    箱</string>
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="2" column="1">
-       <widget class="QLineEdit" name="color"/>
+      <item row="4" column="1">
+       <widget class="QComboBox" name="carton_type"/>
       </item>
       </item>
       <item row="4" column="2">
       <item row="4" column="2">
        <widget class="QLabel" name="label_18">
        <widget class="QLabel" name="label_18">
@@ -242,35 +313,8 @@
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="1" column="4">
-       <layout class="QGridLayout" name="gridLayout">
-        <item row="0" column="0">
-         <widget class="QLabel" name="label_26">
-          <property name="styleSheet">
-           <string notr="true">color: rgb(255, 0, 0);</string>
-          </property>
-          <property name="text">
-           <string>*</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="1">
-         <widget class="QLabel" name="label_20">
-          <property name="text">
-           <string>类   型</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item row="3" column="3">
-       <widget class="QComboBox" name="bucket_weight"/>
-      </item>
-      <item row="2" column="3">
-       <widget class="QComboBox" name="twist_type"/>
-      </item>
-      <item row="1" column="3">
-       <widget class="QLineEdit" name="fiber"/>
+      <item row="4" column="3">
+       <widget class="QLineEdit" name="bucket_number"/>
       </item>
       </item>
       <item row="4" column="4">
       <item row="4" column="4">
        <widget class="QLabel" name="label_23">
        <widget class="QLabel" name="label_23">
@@ -279,8 +323,8 @@
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="4" column="3">
-       <widget class="QLineEdit" name="bucket_number"/>
+      <item row="4" column="5">
+       <widget class="QLineEdit" name="specs"/>
       </item>
       </item>
       <item row="5" column="0">
       <item row="5" column="0">
        <widget class="QLabel" name="label_8">
        <widget class="QLabel" name="label_8">
@@ -289,12 +333,8 @@
         </property>
         </property>
        </widget>
        </widget>
       </item>
       </item>
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_3">
-        <property name="text">
-         <string>品    种</string>
-        </property>
-       </widget>
+      <item row="5" column="1">
+       <widget class="QLineEdit" name="customer"/>
       </item>
       </item>
       <item row="5" column="4">
       <item row="5" column="4">
        <widget class="QLabel" name="label_24">
        <widget class="QLabel" name="label_24">

+ 0 - 1
widget/editboxinfodialog.cpp

@@ -13,7 +13,6 @@ EditBoxInfoDialog::EditBoxInfoDialog(QSharedPointer<BoxInfo> &box, QWidget *pare
     ui->pz->setValue(_box->box_weight / 1000.00);
     ui->pz->setValue(_box->box_weight / 1000.00);
     ui->netW->setValue(_box->net_weight / 1000.00);
     ui->netW->setValue(_box->net_weight / 1000.00);
     ui->grossW->setValue(_box->gross_weight / 1000.0);
     ui->grossW->setValue(_box->gross_weight / 1000.0);
-    qDebug()<<_box->bucket_weight;
 }
 }
 
 
 EditBoxInfoDialog::~EditBoxInfoDialog()
 EditBoxInfoDialog::~EditBoxInfoDialog()

+ 60 - 35
widget/fixedweightpackform.cpp

@@ -16,6 +16,7 @@ FixedWeightPackForm::FixedWeightPackForm(QWidget *parent) :
     connect(glo,&GlobalInfo::dbConfigUpdated,this,&FixedWeightPackForm::upconfig);
     connect(glo,&GlobalInfo::dbConfigUpdated,this,&FixedWeightPackForm::upconfig);
     connect(glo,&GlobalInfo::dengJiUped,this,&FixedWeightPackForm::upDengjiInfo);
     connect(glo,&GlobalInfo::dengJiUped,this,&FixedWeightPackForm::upDengjiInfo);
     connect(glo,&GlobalInfo::doInited,this,&FixedWeightPackForm::changeSpecs);
     connect(glo,&GlobalInfo::doInited,this,&FixedWeightPackForm::changeSpecs);
+    connect(glo,&GlobalInfo::selectproject,this,&FixedWeightPackForm::changeSpecs);
     connect(glo,&GlobalInfo::wareUped,this,&FixedWeightPackForm::upWare);
     connect(glo,&GlobalInfo::wareUped,this,&FixedWeightPackForm::upWare);
     connect(glo,&GlobalInfo::boxModelUped,this,&FixedWeightPackForm::upBoxModelList);
     connect(glo,&GlobalInfo::boxModelUped,this,&FixedWeightPackForm::upBoxModelList);
     connect(glo,&GlobalInfo::packModelUpde,this,&FixedWeightPackForm::upPackModelList);
     connect(glo,&GlobalInfo::packModelUpde,this,&FixedWeightPackForm::upPackModelList);
@@ -64,7 +65,7 @@ void FixedWeightPackForm::calcData()
 void FixedWeightPackForm::save()
 void FixedWeightPackForm::save()
 {
 {
     QStringList list;
     QStringList list;
-    qDebug()<<ui->taitou->text();
+
     list << ui->taitou->text() <<  ui->taiPhone->text();
     list << ui->taitou->text() <<  ui->taiPhone->text();
     PQ::CacheFile::writeFile("dingzhongInfo.cache",list.join("[,]").toUtf8());
     PQ::CacheFile::writeFile("dingzhongInfo.cache",list.join("[,]").toUtf8());
 
 
@@ -84,9 +85,11 @@ void FixedWeightPackForm::on_addPackList_clicked()
         packinfo->customer = ui->taitou->text();
         packinfo->customer = ui->taitou->text();
         packinfo->telephone = ui->taiPhone->text();
         packinfo->telephone = ui->taiPhone->text();
     }
     }
-//    qDebug()<<packinfo->boxes().at(0)->tube_number;
 
 
-    packinfo->autoRuku = ui->ruku->isChecked();
+        packinfo->warehouse_id = 0;
+    if(ui->ruku->isChecked()){
+        packinfo->warehouse_id = ui->wareBox->currentData().toInt();
+    }
     if(ui->AutoSync->isChecked() && !GlobalInfo::this_()->isNoLine())
     if(ui->AutoSync->isChecked() && !GlobalInfo::this_()->isNoLine())
         packServer->send(packinfo);
         packServer->send(packinfo);
     Manger->savePackInfo(packinfo);
     Manger->savePackInfo(packinfo);
@@ -120,7 +123,6 @@ void FixedWeightPackForm::on_addBoxList_clicked()
 
 
     if(chengZhongJingDu == 2){
     if(chengZhongJingDu == 2){
         if(netNum<=0){
         if(netNum<=0){
-    //        netNum = 0.00;
             QMessageBox::information(this,tr("注意"),tr("重量异常"));
             QMessageBox::information(this,tr("注意"),tr("重量异常"));
             return;
             return;
         }
         }
@@ -132,28 +134,26 @@ void FixedWeightPackForm::on_addBoxList_clicked()
         }
         }
     }
     }
 
 
-
     checkPackInfo(); //检查packinfo isNull
     checkPackInfo(); //检查packinfo isNull
     //当当前箱数大于等于最大箱数是启动on_addPackList_clicked();
     //当当前箱数大于等于最大箱数是启动on_addPackList_clicked();
     if(packinfo->boxes().size() >= ui->comboBox->currentText().toInt()){
     if(packinfo->boxes().size() >= ui->comboBox->currentText().toInt()){
         on_addPackList_clicked();
         on_addPackList_clicked();
-        checkPackInfo();
-        return;
+//        return;
     }
     }
-
+    checkPackInfo(); //检查packinfo isNull
     auto index = packinfo->boxInfoSize();
     auto index = packinfo->boxInfoSize();
     auto box = packinfo->addBoxInfo();
     auto box = packinfo->addBoxInfo();
-    calcData();
+//    calcData();
     box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
     box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
     box->tube_number = ui->tongshu->text().toInt();
     box->tube_number = ui->tongshu->text().toInt();
 //    box->bucket_weight = int((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble())*1000);
 //    box->bucket_weight = int((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble())*1000);
     box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble()+0.005)*100)*10);
     box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble()+0.005)*100)*10);
     if(chengZhongJingDu == 2){
     if(chengZhongJingDu == 2){
-        box->gross_weight = int(gross_weight*1000);
-        box->net_weight = int(netNum*1000);
+        box->gross_weight = QString::number(gross_weight*1000).toInt();
+        box->net_weight = QString::number(netNum*1000).toInt();
     }else if(chengZhongJingDu == 1){
     }else if(chengZhongJingDu == 1){
-        box->gross_weight = int(f_gross_weight*1000);
-        box->net_weight = int(f_netNum*1000);
+        box->gross_weight = QString::number(f_gross_weight*1000).toInt();
+        box->net_weight = QString::number(f_netNum*1000).toInt();
     }
     }
     box->Level = ui->dengji->currentText();
     box->Level = ui->dengji->currentText();
     box->twist_type = ui->nianxiang->currentText();
     box->twist_type = ui->nianxiang->currentText();
@@ -162,14 +162,12 @@ void FixedWeightPackForm::on_addBoxList_clicked()
 //    box->remark = ui->beizhu->toPlainText();
 //    box->remark = ui->beizhu->toPlainText();
     packinfo->level = ui->dengji->currentText();
     packinfo->level = ui->dengji->currentText();
     packinfo->level_id = ui->dengji->currentData().toInt();
     packinfo->level_id = ui->dengji->currentData().toInt();
-    packinfo->warehouse_id = ui->wareBox->currentData().toInt();
     packinfo->autoRuku = ui->ruku->isChecked();
     packinfo->autoRuku = ui->ruku->isChecked();
     addTableWidget(box,index);
     addTableWidget(box,index);
 
 
 
 
 //    把box数据添加到packinfo的boxes数据表里;
 //    把box数据添加到packinfo的boxes数据表里;
     packinfo->addBoxInfoList(box);
     packinfo->addBoxInfoList(box);
-//    qDebug()<<"currentindex"<<ui->xiangdan->currentIndex();
     if(ui->xiangdanPrint->isChecked()){
     if(ui->xiangdanPrint->isChecked()){
         if(ui->xiangdan->currentIndex() == 0){
         if(ui->xiangdan->currentIndex() == 0){
             GlobalInfo::this_()->printerBox(box);
             GlobalInfo::this_()->printerBox(box);
@@ -208,13 +206,12 @@ void FixedWeightPackForm::checkPackInfo()
 {
 {
     if(packinfo.isNull()){
     if(packinfo.isNull()){
         packinfo.reset(new PackInfo(_info));
         packinfo.reset(new PackInfo(_info));
-        packinfo->operator_id = GlobalInfo::this_()->user().userId;
+        packinfo->operator_id = QString::number(GlobalInfo::this_()->user().userId);
         packinfo->packing_time = QDate::currentDate().toString("yyyy-MM-dd");
         packinfo->packing_time = QDate::currentDate().toString("yyyy-MM-dd");
         packinfo->packing_type = _info->category;
         packinfo->packing_type = _info->category;
         packinfo->packType = 0;
         packinfo->packType = 0;
 
 
         //
         //
-        packinfo->warehouse_id = 0;
         packinfo->batch_no = _info->batch_no;
         packinfo->batch_no = _info->batch_no;
         packinfo->quantity = packinfo->boxes().size();
         packinfo->quantity = packinfo->boxes().size();
         packinfo->level_id = ui->dengji->currentData().toInt();
         packinfo->level_id = ui->dengji->currentData().toInt();
@@ -227,6 +224,9 @@ void FixedWeightPackForm::checkPackInfo()
 
 
         restTableWidget();
         restTableWidget();
     }
     }
+    if(packinfo->goodsID()<0){
+        packinfo.clear();
+    }
 }
 }
 
 
 //往tablewidget里添加数据
 //往tablewidget里添加数据
@@ -279,6 +279,7 @@ void FixedWeightPackForm::init()
         Manger = GlobalInfo::this_()->packInfoManger();
         Manger = GlobalInfo::this_()->packInfoManger();
         packServer = new PackInfoSeed2Server(Manger,this,true);
         packServer = new PackInfoSeed2Server(Manger,this,true);
     }
     }
+    ui->jitai->setCurrentText(_info->machine_no);
     ui->pizhong->setCurrentText(QString(_info->box_weight));
     ui->pizhong->setCurrentText(QString(_info->box_weight));
     ui->guanse->setCurrentText(_info->bucket_color);
     ui->guanse->setCurrentText(_info->bucket_color);
     ui->zhixiang->setCurrentText(_info->carton_type);
     ui->zhixiang->setCurrentText(_info->carton_type);
@@ -317,7 +318,8 @@ void FixedWeightPackForm::upconfig()
             f_chengZhongJingDuModel_Num = 0.08;
             f_chengZhongJingDuModel_Num = 0.08;
             break;
             break;
     }
     }
-//    qDebug()<<"称重精度数据"<<chengZhongJingDuModel_Num;
+    // 打包及入库
+    ui->ruku->setChecked(config.daBaoRuku);
     // 码数
     // 码数
     ui->comboBox->clear();
     ui->comboBox->clear();
     for(int i = 0; i < config.mashu.size(); ++i){
     for(int i = 0; i < config.mashu.size(); ++i){
@@ -371,9 +373,6 @@ void FixedWeightPackForm::upWare()
 {
 {
     QList<WarehouseConfig> ware = glo->wareList();
     QList<WarehouseConfig> ware = glo->wareList();
     for(int i = 0;i<ware.size();i++){
     for(int i = 0;i<ware.size();i++){
-//        qDebug()<<ware.at(i).name;
-//        qDebug()<<ware.at(i).factory_name;
-//        qDebug()<<ware.at(i).warehouse_id;
         ui->wareBox->addItem(ware.at(i).name,ware.at(i).warehouse_id);
         ui->wareBox->addItem(ware.at(i).name,ware.at(i).warehouse_id);
     }
     }
 }
 }
@@ -488,7 +487,7 @@ void FixedWeightPackForm::xuanZe_clicked(QString batchno)
 void FixedWeightPackForm::del_clicked(int row)
 void FixedWeightPackForm::del_clicked(int row)
 {
 {
     if(packinfo.isNull()) return;
     if(packinfo.isNull()) return;
-    qDebug()<<row;
+
     packinfo->delBoxInfoAt(row);
     packinfo->delBoxInfoAt(row);
     restTableWidget();
     restTableWidget();
 }
 }
@@ -554,19 +553,24 @@ void FixedWeightPackForm::on_pushContinue_clicked()
     }
     }
     if(list.isEmpty()){
     if(list.isEmpty()){
         QMessageBox::warning(this,tr("无可接续码单"),tr("无可接续码单"));
         QMessageBox::warning(this,tr("无可接续码单"),tr("无可接续码单"));
+        return;
     }
     }
-    qDebug()<<list.size();
+    QList<PackSaveInfo>Plist;
     for(int i = 0;i<list.size();i++){
     for(int i = 0;i<list.size();i++){
-        if(list.at(i).packInfo->batch_no!=_info->batch_no){
-            list.removeAt(i);
+        if(list.at(i).packInfo->batch_no==_info->batch_no){
+            Plist.append(list.at(i));
         }
         }
     }
     }
-    std::sort(list.begin(),list.end(),[](const PackSaveInfo & item1, const PackSaveInfo & item2){
+    std::sort(Plist.begin(),Plist.end(),[](const PackSaveInfo & item1, const PackSaveInfo & item2){
         return item1.packInfo->time() < item2.packInfo->time();
         return item1.packInfo->time() < item2.packInfo->time();
     });
     });
+    if(Plist.isEmpty()){
+        QMessageBox::warning(this,tr("无可接续码单"),tr("无可接续码单"));
+        return;
+    }
     QSharedPointer<PackInfo> pInfo;
     QSharedPointer<PackInfo> pInfo;
-    for (int i = list.size() - 1;i >= 0 ; --i) {
-        auto & v = list.at(i);
+    for (int i = Plist.size() - 1;i >= 0 ; --i) {
+        auto & v = Plist.at(i);
         if(v.packInfo->packType != 0) continue;
         if(v.packInfo->packType != 0) continue;
         if(v.packInfo->boxInfoSize() < ui->comboBox->currentText().toInt()){
         if(v.packInfo->boxInfoSize() < ui->comboBox->currentText().toInt()){
             pInfo = v.packInfo;
             pInfo = v.packInfo;
@@ -602,9 +606,26 @@ void FixedWeightPackForm::EditBatch()
         calcData();
         calcData();
         box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
         box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
         box->tube_number = ui->tongshu->text().toInt();
         box->tube_number = ui->tongshu->text().toInt();
-        box->bucket_weight = int((ui->pizhong->currentText().toDouble()*ui->tongshu->text().toDouble())*1000);
-        box->gross_weight = int(gross_weight*1000);
-        box->net_weight = int(netNum*1000);
+//        box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble()+0.005)*100)*10);
+//        if(chengZhongJingDu == 2){
+//            box->gross_weight = QString::number(gross_weight*1000).toInt();
+//            box->net_weight = QString::number(netNum*1000).toInt();
+////            qDebug()<<"boxNet"<<box->net_weight;
+////            qDebug()<<"net"<<netNum*1000;
+//        }else if(chengZhongJingDu == 1){
+//            box->gross_weight = QString::number(f_gross_weight*1000).toInt();
+//            box->net_weight = QString::number(f_netNum*1000).toInt();
+////            qDebug()<<"f_boxNet"<<box->net_weight;
+////            qDebug()<<"f_net"<<f_netNum*1000;
+//        }
+        box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*box->tube_number+0.005)*100)*10);
+        int net = box->gross_weight-(ui->pizhong->currentText().toDouble()+box->tube_number*ui->tongzhong->currentText().toDouble())*1000;
+        if(chengZhongJingDu==2){
+            box->net_weight = net;
+        }else if(chengZhongJingDu == 1){
+            box->net_weight = floor(((net/1000.00)+0.05)*10)*100;
+        }
+
         box->Level = ui->dengji->currentText();
         box->Level = ui->dengji->currentText();
         box->twist_type = ui->nianxiang->currentText();
         box->twist_type = ui->nianxiang->currentText();
         box->bucket_color = ui->guanse->currentText();
         box->bucket_color = ui->guanse->currentText();
@@ -660,9 +681,14 @@ void FixedWeightPackForm::on_useNewDataButton_clicked()
         calcData();
         calcData();
         box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
         box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
         box->tube_number = ui->tongshu->text().toInt();
         box->tube_number = ui->tongshu->text().toInt();
-        box->bucket_weight = int(ui->tongzhong->currentText().toInt()*ui->tongshu->text().toDouble()*1000);
-        box->gross_weight = int(gross_weight*1000);
-        box->net_weight = int(netNum*1000);
+        box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*box->tube_number+0.005)*100)*10);
+        int net = box->gross_weight-(ui->pizhong->currentText().toDouble()+box->tube_number*ui->tongzhong->currentText().toDouble())*1000;
+        if(chengZhongJingDu==2){
+            box->net_weight = net;
+        }else if(chengZhongJingDu == 1){
+            box->net_weight = floor(((net/1000.00)+0.05)*10)*100;
+        }
+//        qDebug()<<"单精度"<<floor(((net/1000.00)+0.05)*10)*100;
         box->Level = ui->dengji->currentText();
         box->Level = ui->dengji->currentText();
         box->twist_type = ui->nianxiang->currentText();
         box->twist_type = ui->nianxiang->currentText();
         box->bucket_color = ui->guanse->currentText();
         box->bucket_color = ui->guanse->currentText();
@@ -673,6 +699,5 @@ void FixedWeightPackForm::on_useNewDataButton_clicked()
     packinfo->customer = ui->taitou->text();
     packinfo->customer = ui->taitou->text();
     packinfo->telephone = ui->taiPhone->text();
     packinfo->telephone = ui->taiPhone->text();
     packinfo->autoRuku = ui->ruku->isChecked();
     packinfo->autoRuku = ui->ruku->isChecked();
-    packinfo->warehouse_id = ui->wareBox->currentData().toInt();
     restTableWidget();
     restTableWidget();
 }
 }

+ 3 - 3
widget/fixedweightpackform.h

@@ -68,7 +68,7 @@ private:
     void Makeup_clicked(int row);
     void Makeup_clicked(int row);
     void edit_clicked(int row);
     void edit_clicked(int row);
     void init();
     void init();
-    void checkPackInfo();
+    void checkPackInfo();//检查packinfo isNull
     void addTableWidget(QSharedPointer<BoxInfo> box, int row);
     void addTableWidget(QSharedPointer<BoxInfo> box, int row);
     void restTableWidget();
     void restTableWidget();
     void updateTableWidget(QList<QSharedPointer<ProjectInfo>> & list);
     void updateTableWidget(QList<QSharedPointer<ProjectInfo>> & list);
@@ -103,8 +103,8 @@ private:
 
 
     int chengZhongJingDu;
     int chengZhongJingDu;
     int chengZhongJingDuModel;
     int chengZhongJingDuModel;
-    double chengZhongJingDuModel_Num = 0.00;//打包精度计算时所需的数,类似四舍五入时把double+0.5在向下取整;
-    double f_chengZhongJingDuModel_Num = 0.00;//单精度计算时的数;
+    double chengZhongJingDuModel_Num = 0.005;//打包精度计算时所需的数,类似四舍五入时把double+0.5在向下取整;
+    double f_chengZhongJingDuModel_Num = 0.05;//单精度计算时的数;
 };
 };
 
 
 #endif // FIXEDWEIGHTPACKFORM_H
 #endif // FIXEDWEIGHTPACKFORM_H

+ 5 - 2
widget/fixedweightpackform.ui

@@ -38,6 +38,9 @@
       <string notr="true"/>
       <string notr="true"/>
      </property>
      </property>
      <layout class="QGridLayout" name="gridLayout_13">
      <layout class="QGridLayout" name="gridLayout_13">
+      <property name="leftMargin">
+       <number>0</number>
+      </property>
       <property name="topMargin">
       <property name="topMargin">
        <number>0</number>
        <number>0</number>
       </property>
       </property>
@@ -740,7 +743,7 @@ color: rgb(0, 170, 255);</string>
              </font>
              </font>
             </property>
             </property>
             <property name="text">
             <property name="text">
-             <string/>
+             <string>0</string>
             </property>
             </property>
            </widget>
            </widget>
           </item>
           </item>
@@ -1044,7 +1047,7 @@ color: rgb(0, 170, 255);</string>
                <item>
                <item>
                 <widget class="QComboBox" name="tongzhong">
                 <widget class="QComboBox" name="tongzhong">
                  <property name="editable">
                  <property name="editable">
-                  <bool>true</bool>
+                  <bool>false</bool>
                  </property>
                  </property>
                 </widget>
                 </widget>
                </item>
                </item>

+ 1 - 1
widget/loginform.ui

@@ -6,7 +6,7 @@
    <rect>
    <rect>
     <x>0</x>
     <x>0</x>
     <y>0</y>
     <y>0</y>
-    <width>395</width>
+    <width>357</width>
     <height>241</height>
     <height>241</height>
    </rect>
    </rect>
   </property>
   </property>

+ 0 - 3
widget/modelselectform.cpp

@@ -70,7 +70,6 @@ void ModelSelectForm::selectBoxModelFoName(QString baseModelName)
     QStringList modelName;
     QStringList modelName;
     for(int i = 0;i<boxModelList.size();i++){
     for(int i = 0;i<boxModelList.size();i++){
         if(boxModelList.at(i)->baseModel_Name!=baseModelName){
         if(boxModelList.at(i)->baseModel_Name!=baseModelName){
-            qDebug()<<boxModelList.at(i)->baseModel_Name;
             continue;
             continue;
         }
         }
         modelName.append(boxModelList.at(i)->Model_Name);
         modelName.append(boxModelList.at(i)->Model_Name);
@@ -112,7 +111,6 @@ void ModelSelectForm::addNewBoxModel(QString baseModelName)
 
 
 void ModelSelectForm::boxModelView(QString baseModelName)
 void ModelSelectForm::boxModelView(QString baseModelName)
 {
 {
-    qDebug()<<"modelView";
     emit showBaseBoxModel(baseModelName,2);
     emit showBaseBoxModel(baseModelName,2);
 }
 }
 
 
@@ -204,7 +202,6 @@ void ModelSelectForm::addNewPackModel(QString baseModelName)
 
 
 void ModelSelectForm::packModelView(QString baseModelName)
 void ModelSelectForm::packModelView(QString baseModelName)
 {
 {
-    qDebug()<<"modelView";
     emit showBasePackModel(baseModelName,2);
     emit showBasePackModel(baseModelName,2);
 }
 }
 
 

+ 2 - 2
widget/packdetailform.cpp

@@ -61,7 +61,6 @@ void PackDetailForm::on_pushButton_clicked()
 
 
         for(int i = 0;i<=days;i++){
         for(int i = 0;i<=days;i++){
             QDate tm = ui->endTimeEdit->date().addDays(-i);
             QDate tm = ui->endTimeEdit->date().addDays(-i);
-            qDebug()<<tm;
             QList<PackSaveInfo> saveinfo;
             QList<PackSaveInfo> saveinfo;
             //issync未同步按钮是否点击
             //issync未同步按钮是否点击
             if(!ui->issync->isChecked()){
             if(!ui->issync->isChecked()){
@@ -185,7 +184,8 @@ void PackDetailForm::changeTreeWidget(/*QList<QMap<QString,QString>> productList
                 {
                 {
                     QStringList columItemList;
                     QStringList columItemList;
                     QTreeWidgetItem *child;
                     QTreeWidgetItem *child;
-                    columItemList<<boxes.at(j)->caseNumber()<<QString::number(boxes.at(j)->gross_weight/1000)<<QString::number(boxes.at(j)->net_weight/1000);
+                    columItemList<<boxes.at(j)->caseNumber()<<QString::number(boxes.at(j)->gross_weight/1000.00)<<QString::number(boxes.at(j)->net_weight/1000.00);
+//                    qDebug()<<"test"<<boxes.at(j)->caseNumber()<<QString::number(boxes.at(j)->gross_weight/1000.00)<<QString::number(boxes.at(j)->net_weight/1000.00);
                     child = new QTreeWidgetItem(columItemList);
                     child = new QTreeWidgetItem(columItemList);
                     item->addChild(child);
                     item->addChild(child);
 //                    ui->treeWidget->setCurrentItem(child);
 //                    ui->treeWidget->setCurrentItem(child);

+ 7 - 0
widget/selectvalueform.cpp

@@ -10,6 +10,7 @@ SelectValueForm::SelectValueForm(QWidget *parent) :
     connect(&_request,&HttpRequest::result,this,&SelectValueForm::result);
     connect(&_request,&HttpRequest::result,this,&SelectValueForm::result);
     nowPage = 0;
     nowPage = 0;
     connect(glo,&GlobalInfo::doInited,this,&SelectValueForm::Start);
     connect(glo,&GlobalInfo::doInited,this,&SelectValueForm::Start);
+    connect(glo,&GlobalInfo::selectproject,this,&SelectValueForm::Start);
     ui->denier->hide();
     ui->denier->hide();
     ui->dtex->hide();
     ui->dtex->hide();
     ui->fiber->hide();
     ui->fiber->hide();
@@ -18,6 +19,7 @@ SelectValueForm::SelectValueForm(QWidget *parent) :
 //    ui->specs->hide();
 //    ui->specs->hide();
     ui->color->hide();
     ui->color->hide();
     ui->pushButton_2->setEnabled(false);
     ui->pushButton_2->setEnabled(false);
+//    ui->RefreshButton->hide();
 }
 }
 
 
 SelectValueForm::~SelectValueForm()
 SelectValueForm::~SelectValueForm()
@@ -195,3 +197,8 @@ void SelectValueForm::on_closeButton_clicked()
     ui->specs->clear();
     ui->specs->clear();
     on_searchButton_clicked();
     on_searchButton_clicked();
 }
 }
+
+void SelectValueForm::on_RefreshButton_clicked()
+{
+    GlobalInfo::this_()->selectProject(!GlobalInfo::this_()->isNoLine());
+}

+ 2 - 0
widget/selectvalueform.h

@@ -55,6 +55,8 @@ private slots:
 
 
     void on_closeButton_clicked();
     void on_closeButton_clicked();
 
 
+    void on_RefreshButton_clicked();
+
 private:
 private:
     Ui::SelectValueForm *ui;
     Ui::SelectValueForm *ui;
     int nowPage;
     int nowPage;

+ 7 - 0
widget/selectvalueform.ui

@@ -324,6 +324,13 @@
           </item>
           </item>
           <item>
           <item>
            <layout class="QHBoxLayout" name="horizontalLayout_8">
            <layout class="QHBoxLayout" name="horizontalLayout_8">
+            <item>
+             <widget class="QPushButton" name="RefreshButton">
+              <property name="text">
+               <string>刷新</string>
+              </property>
+             </widget>
+            </item>
             <item>
             <item>
              <spacer name="horizontalSpacer_4">
              <spacer name="horizontalSpacer_4">
               <property name="orientation">
               <property name="orientation">

+ 1 - 1
widget/showmadanlabelform.cpp

@@ -34,7 +34,7 @@ void ShowMaDanLabelForm::init(QString baseModelName, int status,QString modelNam
     ui->saveButton->hide();
     ui->saveButton->hide();
     ui->upModel->hide();
     ui->upModel->hide();
     BaseModel = baseModelName;
     BaseModel = baseModelName;
-    qDebug()<<BaseModel;
+//    qDebug()<<BaseModel;
     Status = status;
     Status = status;
 
 
     QPalette palette;
     QPalette palette;

+ 53 - 25
widget/uncertainweightpackform.cpp

@@ -15,6 +15,7 @@ UncertainWeightPackForm::UncertainWeightPackForm(QWidget *parent) :
     connect(timer,&QTimer::timeout,this,&UncertainWeightPackForm::calcData);
     connect(timer,&QTimer::timeout,this,&UncertainWeightPackForm::calcData);
     timer->start(500);
     timer->start(500);
 //    ui->widget_6->setEnabled(false);
 //    ui->widget_6->setEnabled(false);
+    ui->tongshuguding->setEnabled(false);
 //    //筒数限制,true限制
 //    //筒数限制,true限制
     istubeNumTure = false;
     istubeNumTure = false;
 //    ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
 //    ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
@@ -23,6 +24,7 @@ UncertainWeightPackForm::UncertainWeightPackForm(QWidget *parent) :
     connect(glo,&GlobalInfo::dbConfigUpdated,this,&UncertainWeightPackForm::upconfig);
     connect(glo,&GlobalInfo::dbConfigUpdated,this,&UncertainWeightPackForm::upconfig);
     connect(glo,&GlobalInfo::dengJiUped,this,&UncertainWeightPackForm::upDengjiInfo);
     connect(glo,&GlobalInfo::dengJiUped,this,&UncertainWeightPackForm::upDengjiInfo);
     connect(glo,&GlobalInfo::doInited,this,&UncertainWeightPackForm::changeSpecs);
     connect(glo,&GlobalInfo::doInited,this,&UncertainWeightPackForm::changeSpecs);
+    connect(glo,&GlobalInfo::selectproject,this,&UncertainWeightPackForm::changeSpecs);
     connect(glo,&GlobalInfo::wareUped,this,&UncertainWeightPackForm::upWare);
     connect(glo,&GlobalInfo::wareUped,this,&UncertainWeightPackForm::upWare);
     connect(glo,&GlobalInfo::boxModelUped,this,&UncertainWeightPackForm::upBoxModelList);
     connect(glo,&GlobalInfo::boxModelUped,this,&UncertainWeightPackForm::upBoxModelList);
     connect(glo,&GlobalInfo::packModelUpde,this,&UncertainWeightPackForm::upPackModelList);
     connect(glo,&GlobalInfo::packModelUpde,this,&UncertainWeightPackForm::upPackModelList);
@@ -61,7 +63,6 @@ void UncertainWeightPackForm::calcData()
 
 
         f_gross_weight = float(floor((gross_weight+f_chengZhongJingDuModel_Num)*10))/10;
         f_gross_weight = float(floor((gross_weight+f_chengZhongJingDuModel_Num)*10))/10;
         f_netNum = float(floor((netNum+f_chengZhongJingDuModel_Num)*10))/10;
         f_netNum = float(floor((netNum+f_chengZhongJingDuModel_Num)*10))/10;
-
     } else {
     } else {
         netNum = floor((ui->grossWeight->text().toDouble()+chengZhongJingDuModel_Num)*100)/100;
         netNum = floor((ui->grossWeight->text().toDouble()+chengZhongJingDuModel_Num)*100)/100;
         gross_weight = floor(((ui->grossWeight->text().toDouble() + pz + tz*ts)+chengZhongJingDuModel_Num)*100)/100;
         gross_weight = floor(((ui->grossWeight->text().toDouble() + pz + tz*ts)+chengZhongJingDuModel_Num)*100)/100;
@@ -72,7 +73,7 @@ void UncertainWeightPackForm::calcData()
 
 
     if(istubeNumTure){
     if(istubeNumTure){
         if(ui->tongshu->text().toInt()>tubeNumMax || ui->tongshu->text().toInt()<tubeNumMin){
         if(ui->tongshu->text().toInt()>tubeNumMax || ui->tongshu->text().toInt()<tubeNumMin){
-            ui->tongshu->setValue(tubeNumMin);
+            ui->tongshu->setValue(6);
         }
         }
     }
     }
 //    ui->netWeight_2->setText(QString::number(netNum));
 //    ui->netWeight_2->setText(QString::number(netNum));
@@ -102,7 +103,11 @@ void UncertainWeightPackForm::on_addPackList_clicked()
         packinfo->telephone = ui->taiPhone->text();
         packinfo->telephone = ui->taiPhone->text();
     }
     }
 //    qDebug()<<packinfo->boxes().at(0)->tube_number;
 //    qDebug()<<packinfo->boxes().at(0)->tube_number;
-    packinfo->autoRuku = ui->ruku->isChecked();
+    packinfo->warehouse_id = 0;
+    if(ui->ruku->isChecked()){
+        packinfo->warehouse_id = ui->wareBox->currentData().toInt();
+    }
+
     if(ui->autoSync->isChecked() && !GlobalInfo::this_()->isNoLine())
     if(ui->autoSync->isChecked() && !GlobalInfo::this_()->isNoLine())
         packServer->send(packinfo);
         packServer->send(packinfo);
     Manger->savePackInfo(packinfo);
     Manger->savePackInfo(packinfo);
@@ -144,9 +149,10 @@ void UncertainWeightPackForm::on_addBoxList_clicked()
     //当当前箱数大于等于最大箱数是启动on_addPackList_clicked();
     //当当前箱数大于等于最大箱数是启动on_addPackList_clicked();
     if(packinfo->boxes().size() >= ui->mashu->currentText().toInt()){
     if(packinfo->boxes().size() >= ui->mashu->currentText().toInt()){
         on_addPackList_clicked();
         on_addPackList_clicked();
-        checkPackInfo();
+//        checkPackInfo();
+//        return;
     }
     }
-
+    checkPackInfo(); //检查packinfo isNull
     auto index = packinfo->boxInfoSize();
     auto index = packinfo->boxInfoSize();
     auto box = packinfo->addBoxInfo();
     auto box = packinfo->addBoxInfo();
     calcData();
     calcData();
@@ -154,11 +160,11 @@ void UncertainWeightPackForm::on_addBoxList_clicked()
     box->tube_number = ui->tongshu->text().toInt();
     box->tube_number = ui->tongshu->text().toInt();
     box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble()+0.005)*100)*10);
     box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble()+0.005)*100)*10);
     if(chengZhongJingDu == 2){
     if(chengZhongJingDu == 2){
-        box->gross_weight = int(gross_weight*1000);
-        box->net_weight = int(netNum*1000);
+        box->gross_weight = QString::number(gross_weight*1000).toInt();
+        box->net_weight = QString::number(netNum*1000).toInt();
     }else if(chengZhongJingDu == 1){
     }else if(chengZhongJingDu == 1){
-        box->gross_weight = int(f_gross_weight*1000);
-        box->net_weight = int(f_netNum*1000);
+        box->gross_weight = QString::number(f_gross_weight*1000).toInt();
+        box->net_weight = QString::number(f_netNum*1000).toInt();
     }
     }
     box->Level = ui->dengji->currentText();
     box->Level = ui->dengji->currentText();
     box->twist_type = ui->nianxiang->currentText();
     box->twist_type = ui->nianxiang->currentText();
@@ -167,7 +173,7 @@ void UncertainWeightPackForm::on_addBoxList_clicked()
 //    box->remark = ui->beizhu->toPlainText();
 //    box->remark = ui->beizhu->toPlainText();
     packinfo->level = ui->dengji->currentText();
     packinfo->level = ui->dengji->currentText();
     packinfo->level_id = ui->dengji->currentData().toInt();
     packinfo->level_id = ui->dengji->currentData().toInt();
-    packinfo->warehouse_id = ui->wareBox->currentData().toInt();
+//    packinfo->warehouse_id = ui->wareBox->currentData().toInt();
     packinfo->autoRuku = ui->ruku->isChecked();
     packinfo->autoRuku = ui->ruku->isChecked();
 
 
     addTableWidget(box,index);
     addTableWidget(box,index);
@@ -228,7 +234,7 @@ void UncertainWeightPackForm::on_tongshuguding_currentIndexChanged(const QString
 //筒数是否限制
 //筒数是否限制
 void UncertainWeightPackForm::on_tongshuxianzhi_stateChanged(int arg1)
 void UncertainWeightPackForm::on_tongshuxianzhi_stateChanged(int arg1)
 {
 {
-    qDebug()<<arg1;
+//    qDebug()<<arg1;
 
 
     if(arg1 == 2){
     if(arg1 == 2){
         istubeNumTure = true;
         istubeNumTure = true;
@@ -325,6 +331,8 @@ void UncertainWeightPackForm::upconfig()
     // TODO:打包配置更新
     // TODO:打包配置更新
     DaBaoConfig config = glo->dbConfig();
     DaBaoConfig config = glo->dbConfig();
 
 
+    ui->autoRead->setChecked(config.ziDongDushu);
+
     //称重精度
     //称重精度
     chengZhongJingDu = config.chengZhongJIngDu;
     chengZhongJingDu = config.chengZhongJIngDu;
 
 
@@ -346,6 +354,11 @@ void UncertainWeightPackForm::upconfig()
     }
     }
 //    qDebug()<<"称重精度数据"<<chengZhongJingDuModel_Num;
 //    qDebug()<<"称重精度数据"<<chengZhongJingDuModel_Num;
 
 
+    if(config.morenTongZhongGUDing){
+        ui->tongshuguding->setCurrentText("固定");
+    }
+    // 打包及入库
+    ui->ruku->setChecked(config.daBaoRuku);
     // 码数
     // 码数
     ui->mashu->clear();
     ui->mashu->clear();
     for(int i = 0; i < config.mashu.size(); ++i){
     for(int i = 0; i < config.mashu.size(); ++i){
@@ -490,6 +503,7 @@ void UncertainWeightPackForm::setProInfo(const QSharedPointer<ProjectInfo> & inf
         packinfo->packing_type = _info->category;
         packinfo->packing_type = _info->category;
     }
     }
     init();
     init();
+    EditBatch();
 }
 }
 
 
 void UncertainWeightPackForm::xuanZe_clicked(QString batchno)
 void UncertainWeightPackForm::xuanZe_clicked(QString batchno)
@@ -505,7 +519,7 @@ void UncertainWeightPackForm::xuanZe_clicked(QString batchno)
 void UncertainWeightPackForm::del_clicked(int row)
 void UncertainWeightPackForm::del_clicked(int row)
 {
 {
     if(packinfo.isNull()) return;
     if(packinfo.isNull()) return;
-    qDebug()<<row;
+//    qDebug()<<row;
     packinfo->delBoxInfoAt(row);
     packinfo->delBoxInfoAt(row);
     restTableWidget();
     restTableWidget();
 }
 }
@@ -557,19 +571,24 @@ void UncertainWeightPackForm::on_pushContinue_clicked()
     }
     }
     if(list.isEmpty()){
     if(list.isEmpty()){
         QMessageBox::warning(this,tr("无可接续码单"),tr("无可接续码单"));
         QMessageBox::warning(this,tr("无可接续码单"),tr("无可接续码单"));
+        return;
     }
     }
-    qDebug()<<list.size();
+    QList<PackSaveInfo>Plist;
     for(int i = 0;i<list.size();i++){
     for(int i = 0;i<list.size();i++){
-        if(list.at(i).packInfo->batch_no!=_info->batch_no){
-            list.removeAt(i);
+        if(list.at(i).packInfo->batch_no==_info->batch_no){
+            Plist.append(list.at(i));
         }
         }
     }
     }
-    std::sort(list.begin(),list.end(),[](const PackSaveInfo & item1, const PackSaveInfo & item2){
+    std::sort(Plist.begin(),Plist.end(),[](const PackSaveInfo & item1, const PackSaveInfo & item2){
         return item1.packInfo->time() < item2.packInfo->time();
         return item1.packInfo->time() < item2.packInfo->time();
     });
     });
+    if(Plist.isEmpty()){
+        QMessageBox::warning(this,tr("无可接续码单"),tr("无可接续码单"));
+        return;
+    }
     QSharedPointer<PackInfo> pInfo;
     QSharedPointer<PackInfo> pInfo;
-    for (int i = list.size() - 1;i >= 0 ; --i) {
-        auto & v = list.at(i);
+    for (int i = Plist.size() - 1;i >= 0 ; --i) {
+        auto & v = Plist.at(i);
         if(v.packInfo->packType != 0) continue;
         if(v.packInfo->packType != 0) continue;
         if(v.packInfo->boxInfoSize() < ui->mashu->currentText().toInt()){
         if(v.packInfo->boxInfoSize() < ui->mashu->currentText().toInt()){
             pInfo = v.packInfo;
             pInfo = v.packInfo;
@@ -605,9 +624,14 @@ void UncertainWeightPackForm::EditBatch()
         calcData();
         calcData();
         box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
         box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
         box->tube_number = ui->tongshu->text().toInt();
         box->tube_number = ui->tongshu->text().toInt();
-        box->bucket_weight = int((ui->pizhong->currentText().toDouble()*ui->tongshu->text().toDouble())*1000);
-        box->gross_weight = int(gross_weight*1000);
-        box->net_weight = int(netNum*1000);
+        box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*box->tube_number+0.005)*100)*10);
+        int net = box->gross_weight-(ui->pizhong->currentText().toDouble()+box->tube_number*ui->tongzhong->currentText().toDouble())*1000;
+//        qDebug()<<box->gross_weight;
+        if(chengZhongJingDu==2){
+            box->net_weight = net;
+        }else if(chengZhongJingDu == 1){
+            box->net_weight = floor(((net/1000.00)+0.05)*10)*100;
+        }
         box->Level = ui->dengji->currentText();
         box->Level = ui->dengji->currentText();
         box->twist_type = ui->nianxiang->currentText();
         box->twist_type = ui->nianxiang->currentText();
         box->bucket_color = ui->guanse->currentText();
         box->bucket_color = ui->guanse->currentText();
@@ -663,9 +687,13 @@ void UncertainWeightPackForm::on_useNewDataButton_clicked()
         calcData();
         calcData();
         box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
         box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
         box->tube_number = ui->tongshu->text().toInt();
         box->tube_number = ui->tongshu->text().toInt();
-        box->bucket_weight = int(ui->tongzhong->currentText().toInt()*ui->tongshu->text().toDouble()*1000);
-        box->gross_weight = int(gross_weight*1000);
-        box->net_weight = int(netNum*1000);
+        box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*box->tube_number+0.005)*100)*10);
+        int net = box->gross_weight-(ui->pizhong->currentText().toDouble()+box->tube_number*ui->tongzhong->currentText().toDouble())*1000;
+        if(chengZhongJingDu==2){
+            box->net_weight = net;
+        }else if(chengZhongJingDu == 1){
+            box->net_weight = floor(((net/1000.00)+0.05)*10)*100;
+        }
         box->Level = ui->dengji->currentText();
         box->Level = ui->dengji->currentText();
         box->twist_type = ui->nianxiang->currentText();
         box->twist_type = ui->nianxiang->currentText();
         box->bucket_color = ui->guanse->currentText();
         box->bucket_color = ui->guanse->currentText();
@@ -676,6 +704,6 @@ void UncertainWeightPackForm::on_useNewDataButton_clicked()
     packinfo->customer = ui->taitou->text();
     packinfo->customer = ui->taitou->text();
     packinfo->telephone = ui->taiPhone->text();
     packinfo->telephone = ui->taiPhone->text();
     packinfo->autoRuku = ui->ruku->isChecked();
     packinfo->autoRuku = ui->ruku->isChecked();
-    packinfo->warehouse_id = ui->wareBox->currentData().toInt();
+//    packinfo->warehouse_id = ui->wareBox->currentData().toInt();
     restTableWidget();
     restTableWidget();
 }
 }

+ 2 - 2
widget/uncertainweightpackform.h

@@ -113,8 +113,8 @@ private:
 
 
     int chengZhongJingDu;
     int chengZhongJingDu;
     int chengZhongJingDuModel;
     int chengZhongJingDuModel;
-    double chengZhongJingDuModel_Num = 0.00;//打包精度计算时所需的数,类似四舍五入时把double+0.5在向下取整;
-    double f_chengZhongJingDuModel_Num = 0.00;//单精度计算时的数;
+    double chengZhongJingDuModel_Num = 0.005;//打包精度计算时所需的数,类似四舍五入时把double+0.5在向下取整;
+    double f_chengZhongJingDuModel_Num = 0.05;//单精度计算时的数;
 
 
     bool istubeNumTure;
     bool istubeNumTure;
     int tubeNumMax;
     int tubeNumMax;