error 6 anos atrás
pai
commit
9a4de92c58

+ 0 - 9
JxcClient.pro

@@ -38,11 +38,8 @@ SOURCES += \
     struct_/packinfo.cpp \
     struct_/projectinfo.cpp \
     widget/addnewspecsform.cpp \
-<<<<<<< HEAD
     widget/displaysettingsform.cpp \
-=======
     widget/editboxinfodialog.cpp \
->>>>>>> acffbf9eb654f14ea802492964b4af4f93956627
     widget/fixedweightpackform.cpp \
     widget/loginform.cpp \
     main.cpp \
@@ -74,11 +71,8 @@ HEADERS += \
     struct_/packinfo.h \
     struct_/projectinfo.h \
     widget/addnewspecsform.h \
-<<<<<<< HEAD
     widget/displaysettingsform.h \
-=======
     widget/editboxinfodialog.h \
->>>>>>> acffbf9eb654f14ea802492964b4af4f93956627
     widget/fixedweightpackform.h \
     widget/loginform.h \
     mainwindow.h \
@@ -90,11 +84,8 @@ HEADERS += \
 
 FORMS += \
     widget/addnewspecsform.ui \
-<<<<<<< HEAD
     widget/displaysettingsform.ui \
-=======
     widget/editboxinfodialog.ui \
->>>>>>> acffbf9eb654f14ea802492964b4af4f93956627
     widget/fixedweightpackform.ui \
     widget/loginform.ui \
     mainwindow.ui \

+ 0 - 3
globalinfo.cpp

@@ -33,12 +33,9 @@ bool GlobalInfo::addCacheInfo(QSharedPointer<ProjectInfo> & info)
     if(!v.isNull()) return false;
     _cacheInfo.append(info);
     _project.insert(info->batch_no,info);
-<<<<<<< HEAD
     return packmanger->syncLocalProjectInfo(_cacheInfo);
-=======
     packmanger->syncLocalProjectInfo(_cacheInfo);
     return true;
->>>>>>> acffbf9eb654f14ea802492964b4af4f93956627
 }
 
 

+ 1 - 1
globalinfo.h

@@ -81,7 +81,7 @@ private:
 private:
     PackInfoManger * packmanger;
     PrinterThreadHandle * _printer;
-    SerialThreadHandle * _serial;//t
+    SerialThreadHandle * _serial;
     RemotePackConfig * _remoteConfig;
     ProjectInfoManger * _projectmanger;
 };

+ 1 - 0
handle/projectinfomanger.cpp

@@ -93,6 +93,7 @@ void ProjectInfoManger::handleList()
 
 void ProjectInfoManger::result(int code, const QJsonObject & body)
 {
+    qDebug()<<body;
     switch (_status) {
     case Load_Server_List:
         handleGetList(code,body);

+ 18 - 0
mainwindow.cpp

@@ -11,6 +11,8 @@ MainWindow::MainWindow(QWidget *parent)
 
     connect(ui->pageSelectValue,&SelectValueForm::selectProject,this,&MainWindow::FixedAndUncertain);
     connect(ui->actionSetting,&QAction::triggered,this,&MainWindow::changeToSettings);
+    connect(ui->actionAddNew,&QAction::triggered,this,&MainWindow::changeToAddNew);
+    connect(ui->pageDingZhong,&FixedWeightPackForm::NoSyncList,this,&MainWindow::changeToPackDetail);
     connect(ui->actionPack,&QAction::triggered,this,&MainWindow::backMenu);
     ui->stackedWidget->setCurrentWidget(ui->pageLogin);
 
@@ -75,6 +77,22 @@ void MainWindow::FixedAndUncertain(QString batchno)
     ui->dingzhong->setProInfo(GlobalInfo::this_()->project().value(batchno));
 }
 
+void MainWindow::changeToAddNew()
+{
+    ui->stackedWidget->setCurrentWidget(ui->pageAddNew);
+}
+
+void MainWindow::changeToPackDetail()
+{
+    qDebug()<<"this";
+    QDate tm = QDate::currentDate();
+    QList<PackSaveInfo> saveinfo = GlobalInfo::this_()->packInfoManger()->getPackInfo(tm);
+    for(int i = 0;i<saveinfo.size();i++){
+        saveinfo.at(i).packInfo->goodsID();
+    }
+    ui->stackedWidget->setCurrentWidget(ui->pagePackDetail);
+}
+
 void MainWindow::changedjmb(QImage image)
 {
     ui->stackedWidget->setCurrentWidget(ui->pageTest);

+ 4 - 0
mainwindow.h

@@ -5,6 +5,7 @@
 #include "configinfo.h"
 //#include "handle/seriport/rtuport.h"
 #include "struct_/projectinfo.h"
+#include "handle/packinfomanger.h"
 
 QT_BEGIN_NAMESPACE
 namespace Ui { class MainWindow; }
@@ -33,12 +34,15 @@ private slots:
 
     void on_budingButton_clicked();
 
+
 private:
     void backMenu();
     void pageStatusChange(const ProjectInfo & info, int status);
     void changedjmb(QImage image);
     void changeToSettings();
+    void changeToAddNew();
     void FixedAndUncertain(QString batchno);
+    void changeToPackDetail();
 //    RtuPort rtuport;
 
 private:

+ 11 - 4
mainwindow.ui

@@ -232,6 +232,7 @@ color: rgb(255, 255, 255);</string>
         </item>
        </layout>
       </widget>
+      <widget class="AddNewSpecsForm" name="pageAddNew"/>
       <widget class="QWidget" name="pageTest">
        <layout class="QGridLayout" name="gridLayout">
         <item row="0" column="0">
@@ -435,7 +436,7 @@ color: rgb(255, 255, 255);</string>
      <property name="title">
       <string>规格设置</string>
      </property>
-     <addaction name="action_2"/>
+     <addaction name="actionAddNew"/>
      <addaction name="action_3"/>
      <addaction name="action_4"/>
     </widget>
@@ -449,7 +450,7 @@ color: rgb(255, 255, 255);</string>
      <string>入库</string>
     </property>
     <addaction name="actionPack"/>
-    <addaction name="action_6"/>
+    <addaction name="actionModify"/>
    </widget>
    <widget class="QMenu" name="menu_3">
     <property name="title">
@@ -471,7 +472,7 @@ color: rgb(255, 255, 255);</string>
     <string>退出账号</string>
    </property>
   </action>
-  <action name="action_2">
+  <action name="actionAddNew">
    <property name="text">
     <string>新建规格</string>
    </property>
@@ -491,7 +492,7 @@ color: rgb(255, 255, 255);</string>
     <string>打包</string>
    </property>
   </action>
-  <action name="action_6">
+  <action name="actionModify">
    <property name="text">
     <string>修改</string>
    </property>
@@ -544,6 +545,12 @@ color: rgb(255, 255, 255);</string>
    <header>widget/uncertainweightpackform.h</header>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>AddNewSpecsForm</class>
+   <extends>QWidget</extends>
+   <header>widget/addnewspecsform.h</header>
+   <container>1</container>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>

+ 54 - 5
widget/addnewspecsform.cpp

@@ -8,6 +8,8 @@ AddNewSpecsForm::AddNewSpecsForm(QWidget *parent) :
 {
     ui->setupUi(this);
     connect(glo,&GlobalInfo::dbConfigUpdated,this,&AddNewSpecsForm::init);
+    connect(&request,&HttpRequest::result,this,&AddNewSpecsForm::result);
+    ui->tiJiao_text->hide();
 }
 
 AddNewSpecsForm::~AddNewSpecsForm()
@@ -18,14 +20,54 @@ AddNewSpecsForm::~AddNewSpecsForm()
 void AddNewSpecsForm::init()
 {
     DaBaoConfig config = glo->dbConfig();
-//    ui->product_type_code->addItems();
+    //机台
+    ui->machine_no->clear();
+    ui->machine_no->addItems(config.jitai);
+
+    //皮重
+    ui->box_weight->clear();
+    for(int i = 0;i<config.xiangzhong.size();i++){
+        ui->box_weight->addItem(QString::number(config.xiangzhong.at(i)));
+    }
+
+    //管色
+    ui->bucket_color->clear();
+    ui->bucket_color->addItems(config.guanse);
+
+    //捻向
+    ui->twist_type->clear();
+    ui->twist_type->addItems(config.nianxiang);
+
+    //纸箱
+    ui->carton_type->clear();
+    ui->carton_type->addItems(config.zhixiang);
+
+    //筒重
+    ui->bucket_weight->clear();
+    for(int i = 0;i<config.tongZhong.size();i++){
+        ui->bucket_weight->addItem(QString::number(config.tongZhong.at(i)));
+    }
+}
+
+void AddNewSpecsForm::result(int code, const QJsonObject & body)
+{
+    ui->tiJiao_text->hide();
+    qDebug()<<body;
+    ui->StartButton->setEnabled(true);
+    if(code == 200 && body.value("message") == ""){
+        QMessageBox::information(this,tr("提示"),tr("保存成功"));
+        return;
+    }
+    QMessageBox::information(this,tr("提示"),tr("保存失败"));
 }
 
 void AddNewSpecsForm::projectData(){
     if(ui->batch_no->text().isEmpty()){
         QMessageBox::information(this,tr("注意"),tr("批号为空"));
+        ui->StartButton->setEnabled(true);
         return;
     }
+    project.reset(new ProjectInfo);
     project->batch_no = ui->batch_no->text();
     project->category = ui->category->text();
     project->product_type_code = ui->product_type_code->currentText();
@@ -44,21 +86,28 @@ void AddNewSpecsForm::projectData(){
     project->bucket_number = ui->bucket_number->text();
     project->customer = ui->customer->text();
     project->remark = ui->remark->toPlainText();
-
-//    project.toObject();
-
+    qDebug()<<"this";
 }
 
 void AddNewSpecsForm::on_StartButton_clicked()
 {
+    ui->tiJiao_text->show();
+    ui->StartButton->setEnabled(false);
     projectData();
     if(GlobalInfo::this_()->isNoLine()){
         if(GlobalInfo::this_()->addCacheInfo(project)){
             QMessageBox::information(this,tr("成功"),tr("离线保存成功"));
+            ui->StartButton->setEnabled(true);
+            ui->tiJiao_text->hide();
             return;
         }
         QMessageBox::information(this,tr("失败"),tr("离线保存失败"));
+        ui->StartButton->setEnabled(true);
+        ui->tiJiao_text->hide();
+        return;
     }
 
-
+    QString url = GlobalInfo::this_()->config()->baseUrl+"/v1/goods/add";
+    request.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
+    request.post(url,project->toObject());
 }

+ 4 - 0
widget/addnewspecsform.h

@@ -5,6 +5,7 @@
 #include "struct_/projectinfo.h"
 #include "globalinfo.h"
 #include "handle/projectinfomanger.h"
+#include "handle/httprequest.h"
 
 namespace Ui {
 class AddNewSpecsForm;
@@ -21,6 +22,7 @@ public:
 private slots:
     void init();
     void on_StartButton_clicked();
+    void result(int code, const QJsonObject & body);
 
 private:
     void projectData();
@@ -30,6 +32,8 @@ private:
     QSharedPointer<ProjectInfoManger> projectinfo;
     GlobalInfo * glo = GlobalInfo::this_();
 
+    HttpRequest request;
+
 private:
     Ui::AddNewSpecsForm *ui;
 };

+ 7 - 0
widget/addnewspecsform.ui

@@ -441,6 +441,13 @@
           </property>
          </spacer>
         </item>
+        <item>
+         <widget class="QLabel" name="tiJiao_text">
+          <property name="text">
+           <string>提交中...</string>
+          </property>
+         </widget>
+        </item>
         <item>
          <widget class="QPushButton" name="pushButton">
           <property name="text">

+ 8 - 3
widget/fixedweightpackform.cpp

@@ -25,8 +25,8 @@ FixedWeightPackForm::FixedWeightPackForm(QWidget *parent) :
     ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
 //    packServer = new PackInfoSeed2Server(Manger);
     // todo: 暂时隐藏同步
-    ui->pushNoSyncList->hide();
-    ui->pushSync->hide();
+//    ui->pushNoSyncList->hide();
+//    ui->pushSync->hide();
 }
 
 FixedWeightPackForm::~FixedWeightPackForm()
@@ -407,9 +407,14 @@ void FixedWeightPackForm::on_pushEditBatch_clicked()
         box->bucket_color = ui->guanse->currentText();
         box->sort = "1";
 //        box->remark = ui->beizhu->toPlainText();
-
     }
     packinfo->level = ui->dengji->currentText();
     packinfo->level_id = ui->dengji->currentData().toInt();
     restTableWidget();
 }
+
+void FixedWeightPackForm::on_pushNoSyncList_clicked()
+{
+    qDebug()<<"this";
+    emit NoSyncList();
+}

+ 4 - 0
widget/fixedweightpackform.h

@@ -41,6 +41,8 @@ private slots:
 
     void on_pushEditBatch_clicked();
 
+    void on_pushNoSyncList_clicked();
+
 public slots:
     void upconfig(/*const DaBaoConfig & config*/);
     void upDengjiInfo(/*const QList<DengJiConfigItem> & dengJis*/);
@@ -57,8 +59,10 @@ private:
     void restTableWidget();
     void updateTableWidget(QList<QSharedPointer<ProjectInfo>> & list);
     void upSum();
+
 signals:
     void back();
+    void NoSyncList();
 
 private:
     Ui::FixedWeightPackForm *ui;

+ 4 - 0
widget/packdetailform.h

@@ -19,12 +19,14 @@ public:
     explicit PackDetailForm(QWidget *parent = nullptr);
     ~PackDetailForm();
 //    void upconfig(const DaBaoConfig &config);
+    inline void setSaveInfo(PackSaveInfo saveinfo){saveInfo = saveinfo;}
 
 private slots:
     void on_pushButton_clicked();
 //    void changeTable(QList<QMap<QString,QString>> productList);
 
     void changeTreeWidget(QList<QMap<QString,QString>> productList);
+//    void changeTreeWidget()
     void tongbu_clicked(QTreeWidgetItem * item,int row);
     void code_single_clicked(int row);
     void case_number_clicked();
@@ -53,6 +55,8 @@ private:
     QSharedPointer<PackInfo> packinfo;
     int nowPageNum;
     int pageNumAll;
+
+    PackSaveInfo saveInfo;
 };
 
 #endif // PACKDETAILFORM_H

+ 3 - 3
widget/packdetailform.ui

@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1067</width>
-    <height>596</height>
+    <width>1150</width>
+    <height>703</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -88,7 +88,7 @@
                 <string notr="true">color: rgb(255, 255, 255);</string>
                </property>
                <property name="text">
-                <string>自动打包</string>
+                <string>打包明细</string>
                </property>
                <property name="scaledContents">
                 <bool>false</bool>