error 6 лет назад
Родитель
Сommit
3774c75420

+ 6 - 3
JxcClient.pro

@@ -39,7 +39,6 @@ SOURCES += \
     struct_/packinfo.cpp \
     struct_/projectinfo.cpp \
     widget/addnewspecsform.cpp \
-    widget/dateselectdialog.cpp \
     widget/displaysettingsform.cpp \
     widget/editboxinfodialog.cpp \
     widget/fixedweightpackform.cpp \
@@ -49,6 +48,8 @@ SOURCES += \
     widget/packdetailform.cpp \
     widget/selectvalueform.cpp \
     widget/settingsform.cpp \
+    widget/showmadanlabelform.cpp \
+    widget/showxiangdanlabelform.cpp \
     widget/statisticsform.cpp \
     widget/uncertainweightpackform.cpp
 
@@ -74,7 +75,6 @@ HEADERS += \
     struct_/packinfo.h \
     struct_/projectinfo.h \
     widget/addnewspecsform.h \
-    widget/dateselectdialog.h \
     widget/displaysettingsform.h \
     widget/editboxinfodialog.h \
     widget/fixedweightpackform.h \
@@ -83,12 +83,13 @@ HEADERS += \
     widget/packdetailform.h \
     widget/selectvalueform.h \
     widget/settingsform.h \
+    widget/showmadanlabelform.h \
+    widget/showxiangdanlabelform.h \
     widget/statisticsform.h \
     widget/uncertainweightpackform.h
 
 FORMS += \
     widget/addnewspecsform.ui \
-    widget/dateselectdialog.ui \
     widget/displaysettingsform.ui \
     widget/editboxinfodialog.ui \
     widget/fixedweightpackform.ui \
@@ -97,6 +98,8 @@ FORMS += \
     widget/packdetailform.ui \
     widget/selectvalueform.ui \
     widget/settingsform.ui \
+    widget/showmadanlabelform.ui \
+    widget/showxiangdanlabelform.ui \
     widget/statisticsform.ui \
     widget/uncertainweightpackform.ui
 

+ 1 - 1
handle/printer/baseboxprinter.h

@@ -14,7 +14,7 @@ public:
     virtual ~BaseBoxPrinter();
 
     virtual QImage doPrinter(QSharedPointer<BoxInfo> box) = 0;
-
+    virtual QImage BoxModel() = 0;
     virtual QSize printSize() = 0;
 protected:
     Code39 code;

+ 24 - 0
handle/printer/boxtemlateone.cpp

@@ -98,6 +98,30 @@ QSize BoxTemlateOne::printSize()
     return QSize(100,80);
 }
 
+QImage BoxTemlateOne::BoxModel()
+{
+    qDebug()<<"this";
+    QSize size(MAXWIDTH*5,MAXHEIGHT*5);
+    QImage image(size,QImage::Format_ARGB32);
+    image.fill(qRgba(255, 255, 255, 255));
+    QPainter painter(&image);
+    painter.drawRect(5*5,5*5,90*5,15*5);
+    painter.drawRect(5*5,20*5,90*5,35*5);
+    painter.drawLine(20*5,20*5,20*5,55*5);
+    painter.drawLine(50*5,20*5,50*5,55*5);
+    painter.drawLine(66*5,20*5,66*5,55*5);
+    painter.drawLine(5*5,27*5,95*5,27*5);
+    painter.drawLine(5*5,34*5,95*5,34*5);
+    painter.drawLine(5*5,41*5,95*5,41*5);
+    painter.drawLine(5*5,48*5,95*5,48*5);
+    painter.drawRect(5*5,55*5,90*5,15*5);
+    painter.drawRect(5*5,70*5,90*5,7*5);
+    QString path = PQ::PQLogManger::this_()->getSaveFilePath();
+//    if(save)
+        image.save(path+"/xiangdan/code"+"11111"+".bmp");
+    return image;
+}
+
 
 PackTemlateOne::PackTemlateOne()
 {}

+ 1 - 1
handle/printer/boxtemlateone.h

@@ -10,7 +10,7 @@ public:
     BoxTemlateOne();
 
     virtual QImage doPrinter(QSharedPointer<BoxInfo> box);
-
+    virtual QImage BoxModel();
     virtual QSize printSize();
 
 private:

+ 1 - 0
images.qrc

@@ -1,5 +1,6 @@
 <RCC>
     <qresource prefix="/">
         <file>images/backImage.jpg</file>
+        <file>images/moren.bmp</file>
     </qresource>
 </RCC>

BIN
images/moren.bmp


+ 14 - 4
mainwindow.cpp

@@ -12,10 +12,11 @@ MainWindow::MainWindow(QWidget *parent)
     connect(ui->pageSelectValue,&SelectValueForm::selectProject,this,&MainWindow::FixedAndUncertain);
     connect(ui->pageSelectValue,&SelectValueForm::back,this,&MainWindow::backMenu);
     connect(ui->pageSelectValue,&SelectValueForm::backFandU,this,&MainWindow::backFAndU);
-//    connect(ui->actionPack,&QAction::triggered,this,&MainWindow::backMenu);
+
     connect(ui->pageSettings,&SettingsForm::back,this,&MainWindow::backMenu);
     connect(ui->pagePackDetail,&PackDetailForm::back,this,&MainWindow::backMenu);
     connect(ui->pageAddNew,&AddNewSpecsForm::back,this,&MainWindow::backMenu);
+
     connect(ui->dingzhong,&FixedWeightPackForm::backup,this,&MainWindow::backSelect);
     connect(ui->dingzhong,&FixedWeightPackForm::NoSyncList,this,&MainWindow::changeToPackDetail);
     connect(ui->dingzhong,&FixedWeightPackForm::buding,this,&MainWindow::on_buding);
@@ -26,12 +27,18 @@ MainWindow::MainWindow(QWidget *parent)
     connect(ui->buding,&UncertainWeightPackForm::backup,this,&MainWindow::backSelect);
     connect(ui->buding,&UncertainWeightPackForm::NoSyncList,this,&MainWindow::changeToPackDetail);
 
+    connect(ui->pageShowXiangDan,&ShowXiangDanLabelForm::back,this,&MainWindow::backMenu);
+
+    connect(ui->pageShowMaDan,&ShowMaDanLabelForm::back,this,&MainWindow::backMenu);
+
 
     connect(ui->actionSetting,&QAction::triggered,this,&MainWindow::changeToSettings);
     connect(ui->actionAddNew,&QAction::triggered,this,&MainWindow::changeToAddNew);
     connect(ui->actionPack,&QAction::triggered,this,&MainWindow::changeToPackDetail);
     connect(ui->actionSelectvalue,&QAction::triggered,this,&MainWindow::backSelect);
     connect(ui->actionLogout,&QAction::triggered,this,&MainWindow::logout);
+    connect(ui->actionXiangDanModel,&QAction::triggered,this,&MainWindow::changeToShowXiangDan);
+    connect(ui->actionMaDanModel,&QAction::triggered,this,&MainWindow::changeToShowMaDan);
 //    connect(ui->backButton,&QPushButton::clicked,this,&MainWindow::backMenu);
     ui->stackedWidget->setCurrentWidget(ui->pageLogin);
 }
@@ -141,11 +148,14 @@ void MainWindow::changeToPackDetail()
     ui->pagePackDetail->changeTreeWidget(0,5);
 }
 
-void MainWindow::changedjmb(QImage image)
+void MainWindow::changeToShowMaDan()
 {
-    ui->stackedWidget->setCurrentWidget(ui->pageTest);
-    ui->djmb->setPixmap(QPixmap::fromImage(image));
+    ui->stackedWidget->setCurrentWidget(ui->pageShowMaDan);
+}
 
+void MainWindow::changeToShowXiangDan()
+{
+    ui->stackedWidget->setCurrentWidget(ui->pageShowXiangDan);
 }
 
 void MainWindow::on_dingzhong()

+ 3 - 4
mainwindow.h

@@ -30,9 +30,6 @@ private slots:
 
     void on_pushBuDingZhong_clicked();
 
-
-
-
     void on_backButton_clicked();
 
     void on_autoSync_stateChanged(int arg1);
@@ -41,12 +38,14 @@ private:
     void backMenu();
     void backSelect(int i = 0);
     void pageStatusChange(const ProjectInfo & info, int status);
-    void changedjmb(QImage image);
     void changeToSettings();
     void changeToAddNew();
     void FixedAndUncertain(QString batchno);
     void backFAndU();
     void changeToPackDetail();
+    void changeToShowMaDan();
+    void changeToShowXiangDan();
+
     void on_buding();
     void on_dingzhong();
     void logout();

+ 40 - 12
mainwindow.ui

@@ -21,7 +21,7 @@
     <item row="0" column="0">
      <widget class="QStackedWidget" name="stackedWidget">
       <property name="currentIndex">
-       <number>5</number>
+       <number>3</number>
       </property>
       <widget class="QWidget" name="pageMain">
        <layout class="QGridLayout" name="gridLayout_4">
@@ -82,17 +82,10 @@
        </layout>
       </widget>
       <widget class="AddNewSpecsForm" name="pageAddNew"/>
-      <widget class="QWidget" name="pageTest">
-       <layout class="QGridLayout" name="gridLayout">
-        <item row="0" column="0">
-         <widget class="QLabel" name="djmb">
-          <property name="text">
-           <string/>
-          </property>
-         </widget>
-        </item>
-       </layout>
+      <widget class="ShowMaDanLabelForm" name="pageShowMaDan">
+       <layout class="QGridLayout" name="gridLayout"/>
       </widget>
+      <widget class="ShowXiangDanLabelForm" name="pageShowXiangDan"/>
       <widget class="SettingsForm" name="pageSettings"/>
       <widget class="QWidget" name="pageLogin">
        <property name="styleSheet">
@@ -214,7 +207,7 @@
      <x>0</x>
      <y>0</y>
      <width>1033</width>
-     <height>23</height>
+     <height>26</height>
     </rect>
    </property>
    <widget class="QMenu" name="menu">
@@ -245,9 +238,17 @@
      <string>统计</string>
     </property>
    </widget>
+   <widget class="QMenu" name="menu_5">
+    <property name="title">
+     <string>模板管理</string>
+    </property>
+    <addaction name="actionXiangDanModel"/>
+    <addaction name="actionMaDanModel"/>
+   </widget>
    <addaction name="menu"/>
    <addaction name="menu_2"/>
    <addaction name="menu_3"/>
+   <addaction name="menu_5"/>
   </widget>
   <action name="actionSetting">
    <property name="text">
@@ -294,6 +295,21 @@
     <string>退出账号</string>
    </property>
   </action>
+  <action name="actionShowModel">
+   <property name="text">
+    <string>模板管理</string>
+   </property>
+  </action>
+  <action name="actionXiangDanModel">
+   <property name="text">
+    <string>箱单管理</string>
+   </property>
+  </action>
+  <action name="actionMaDanModel">
+   <property name="text">
+    <string>码单管理</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>
@@ -338,6 +354,18 @@
    <header>widget/addnewspecsform.h</header>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>ShowMaDanLabelForm</class>
+   <extends>QWidget</extends>
+   <header>widget/showmadanlabelform.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>ShowXiangDanLabelForm</class>
+   <extends>QWidget</extends>
+   <header>widget/showxiangdanlabelform.h</header>
+   <container>1</container>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>

+ 1 - 1
struct_/packinfo.h

@@ -42,8 +42,8 @@ struct BoxInfo
     QJsonObject toObject();
 
     static QSharedPointer<BoxInfo> fromObject(QSharedPointer<PackInfo> & pack, QJsonObject &obj);
-private:
     BoxInfo(QSharedPointer<PackInfo> pack,QString code);
+private:
     QString case_number;//	是	string	箱号
     QWeakPointer<PackInfo> parent;
     friend class PackInfo;

+ 0 - 34
widget/dateselectdialog.cpp

@@ -1,34 +0,0 @@
-#include "dateselectdialog.h"
-#include "ui_dateselectdialog.h"
-
-DateSelectDialog::DateSelectDialog(QWidget *parent) :
-    QDialog(parent),
-    ui(new Ui::DateSelectDialog)
-{
-    ui->setupUi(this);
-
-}
-
-DateSelectDialog::~DateSelectDialog()
-{
-    delete ui;
-}
-
-void DateSelectDialog::on_cancelButton_clicked()
-{
-    this->close();
-}
-
-void DateSelectDialog::on_pushButton_clicked()
-{
-    QCalendarWidget *calendar1 = new  QCalendarWidget(this);
-    calendar1->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
-    calendar1->setHorizontalHeaderFormat(QCalendarWidget::SingleLetterDayNames);
-    calendar1->adjustSize();
-    calendar1->raise();
-}
-
-void DateSelectDialog::on_startButton_clicked()
-{
-
-}

+ 0 - 32
widget/dateselectdialog.h

@@ -1,32 +0,0 @@
-#ifndef DATESELECTDIALOG_H
-#define DATESELECTDIALOG_H
-
-#include <QDialog>
-
-namespace Ui {
-class DateSelectDialog;
-}
-
-class DateSelectDialog : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit DateSelectDialog(QWidget *parent = nullptr);
-    ~DateSelectDialog();
-
-signals:
-    void timeUp();
-
-private slots:
-    void on_cancelButton_clicked();
-
-    void on_pushButton_clicked();
-
-    void on_startButton_clicked();
-
-private:
-    Ui::DateSelectDialog *ui;
-};
-
-#endif // DATESELECTDIALOG_H

+ 0 - 71
widget/dateselectdialog.ui

@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>DateSelectDialog</class>
- <widget class="QDialog" name="DateSelectDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>887</width>
-    <height>506</height>
-   </rect>
-  </property>
-  <property name="maximumSize">
-   <size>
-    <width>99999</width>
-    <height>99999</height>
-   </size>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <widget class="QCalendarWidget" name="calendarWidget">
-   <property name="geometry">
-    <rect>
-     <x>428</x>
-     <y>117</y>
-     <width>248</width>
-     <height>236</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QPushButton" name="startButton">
-   <property name="geometry">
-    <rect>
-     <x>428</x>
-     <y>360</y>
-     <width>93</width>
-     <height>28</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>确定</string>
-   </property>
-  </widget>
-  <widget class="QPushButton" name="cancelButton">
-   <property name="geometry">
-    <rect>
-     <x>580</x>
-     <y>360</y>
-     <width>93</width>
-     <height>28</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>取消</string>
-   </property>
-  </widget>
-  <widget class="QDateTimeEdit" name="dateTimeEdit">
-   <property name="geometry">
-    <rect>
-     <x>120</x>
-     <y>380</y>
-     <width>194</width>
-     <height>22</height>
-    </rect>
-   </property>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>

+ 30 - 12
widget/fixedweightpackform.cpp

@@ -93,10 +93,21 @@ void FixedWeightPackForm::on_addPackList_clicked()
 
 void FixedWeightPackForm::on_addBoxList_clicked()
 {
-    if(ui->grossWeight_2->text().toInt()<0){
+    if(ui->grossWeight_2->text().toDouble()<=0){
         QMessageBox::information(this,tr("注意"),tr("重量异常"));
         return;
     }
+    if(ui->tongshu->text().toInt()<=0){
+        QMessageBox::information(this,tr("注意"),tr("筒数异常"));
+        return;
+    }
+    calcData();
+    if(netNum<=0){
+//        netNum = 0.00;
+        QMessageBox::information(this,tr("注意"),tr("重量异常"));
+        return;
+    }
+
     checkPackInfo(); //检查packinfo isNull
     //当当前箱数大于等于最大箱数是启动on_addPackList_clicked();
     if(packinfo->boxes().size() >= ui->comboBox->currentText().toInt()){
@@ -193,13 +204,14 @@ void FixedWeightPackForm::addTableWidget(QSharedPointer<BoxInfo> box, int row)
     ui->tableWidget->item(row,5)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
 
     QWidget *tmp_widget = new QWidget();
+    tmp_widget->setMaximumWidth(200);
     QHBoxLayout *tmp_layout = new QHBoxLayout(tmp_widget);
     auto btn_1 = new QPushButton("删除",tmp_widget);
-    btn_1->setMaximumWidth(50);
+    btn_1->setMaximumWidth(40);
     auto btn_2 = new QPushButton("修改",tmp_widget);
-    btn_2->setMaximumWidth(50);
+    btn_2->setMaximumWidth(40);
     auto btn_3 = new QPushButton("补打",tmp_widget);
-    btn_3->setMaximumWidth(50);
+    btn_3->setMaximumWidth(40);
     tmp_layout->addWidget(btn_1);
     tmp_layout->addWidget(btn_2);
     tmp_layout->addWidget(btn_3);
@@ -210,6 +222,10 @@ void FixedWeightPackForm::addTableWidget(QSharedPointer<BoxInfo> box, int row)
     connect(btn_2,&QPushButton::clicked,[i,this](){this->edit_clicked(i);});
     connect(btn_3,&QPushButton::clicked,[i,this](){this->Makeup_clicked(i);});
     ui->tableWidget->setCellWidget(row,6,tmp_widget);
+//    ui->tableWidget->resizeColumnsToContents();
+    ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);    //x先自适应宽度
+    ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
+    ui->tableWidget->horizontalHeader()->setSectionResizeMode(6, QHeaderView::ResizeToContents);
 }
 
 void FixedWeightPackForm::init()
@@ -359,6 +375,7 @@ void FixedWeightPackForm::updateTableWidget(QList<QSharedPointer<ProjectInfo>> &
     }
     if(currt >= 0)
         ui->tableWidget_2->setCurrentCell(currt,0);
+
 }
 
 void FixedWeightPackForm::setProInfo(const QSharedPointer<ProjectInfo> & info)
@@ -394,13 +411,16 @@ void FixedWeightPackForm::restTableWidget()
 {
     ui->tableWidget->clearContents();
     ui->tableWidget->setRowCount(0);
-    ui->tableWidget->setColumnWidth(0,200);
-    ui->tableWidget->setColumnWidth(1,75);
-    ui->tableWidget->setColumnWidth(2,75);
-    ui->tableWidget->setColumnWidth(3,75);
-    ui->tableWidget->setColumnWidth(4,75);
-    ui->tableWidget->setColumnWidth(5,75);
 
+
+//    ui->tableWidget->setColumnWidth(0,200);
+//    ui->tableWidget->setColumnWidth(1,75);
+//    ui->tableWidget->setColumnWidth(2,75);
+//    ui->tableWidget->setColumnWidth(3,75);
+//    ui->tableWidget->setColumnWidth(4,75);
+//    ui->tableWidget->setColumnWidth(5,75);
+
+//    ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
 //    ui->tableWidget->setColumnWidth(0,130);
 //    ui->tableWidget->setColumnWidth(1,45);
 //    ui->tableWidget->setColumnWidth(2,45);
@@ -408,8 +428,6 @@ void FixedWeightPackForm::restTableWidget()
 //    ui->tableWidget->setColumnWidth(4,45);
 //    ui->tableWidget->setColumnWidth(5,45);
 //    ui->tableWidget->resizeColumnToContents(45);
-//    ui->tableWidget->resizeColumnsToContents();
-    ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
 //    ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
 //    ui->tableWidget->resizeColumnToContents(10);
 //    ui->tableWidget->resizeColumnsToContents();

+ 2 - 1
widget/packdetailform.cpp

@@ -8,7 +8,8 @@ PackDetailForm::PackDetailForm(QWidget *parent) :
     ui(new Ui::PackDetailForm)
 {
     ui->setupUi(this);
-//    ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
+    ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
+    ui->treeWidget->header()->setStretchLastSection( true);
     nowPageNum = 0;
     limits = 5;
     connect(glo,&GlobalInfo::dengJiUped,this,&PackDetailForm::upconfig);

+ 0 - 1
widget/packdetailform.h

@@ -7,7 +7,6 @@
 #include "QTreeWidget"
 #include "globalinfo.h"
 #include "handle/packinfoseed2server.h"
-#include "dateselectdialog.h"
 
 namespace Ui {
 class PackDetailForm;

+ 2 - 2
widget/packdetailform.ui

@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1150</width>
-    <height>703</height>
+    <width>1144</width>
+    <height>723</height>
    </rect>
   </property>
   <property name="windowTitle">

+ 19 - 0
widget/showmadanlabelform.cpp

@@ -0,0 +1,19 @@
+#include "showmadanlabelform.h"
+#include "ui_showmadanlabelform.h"
+
+ShowMaDanLabelForm::ShowMaDanLabelForm(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::ShowMaDanLabelForm)
+{
+    ui->setupUi(this);
+}
+
+ShowMaDanLabelForm::~ShowMaDanLabelForm()
+{
+    delete ui;
+}
+
+void ShowMaDanLabelForm::on_backButton_clicked()
+{
+    emit back();
+}

+ 28 - 0
widget/showmadanlabelform.h

@@ -0,0 +1,28 @@
+#ifndef SHOWMADANLABELFORM_H
+#define SHOWMADANLABELFORM_H
+
+#include <QWidget>
+
+namespace Ui {
+class ShowMaDanLabelForm;
+}
+
+class ShowMaDanLabelForm : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit ShowMaDanLabelForm(QWidget *parent = nullptr);
+    ~ShowMaDanLabelForm();
+
+signals:
+    void back();
+
+private slots:
+    void on_backButton_clicked();
+
+private:
+    Ui::ShowMaDanLabelForm *ui;
+};
+
+#endif // SHOWMADANLABELFORM_H

+ 503 - 0
widget/showmadanlabelform.ui

@@ -0,0 +1,503 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ShowMaDanLabelForm</class>
+ <widget class="QWidget" name="ShowMaDanLabelForm">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>851</width>
+    <height>491</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="1" column="0">
+    <widget class="QWidget" name="widget" native="true">
+     <property name="styleSheet">
+      <string notr="true">background-color: rgb(255, 255, 255);</string>
+     </property>
+     <widget class="QWidget" name="widget_3" native="true">
+      <property name="geometry">
+       <rect>
+        <x>11</x>
+        <y>11</y>
+        <width>500</width>
+        <height>400</height>
+       </rect>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>500</width>
+        <height>400</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>500</width>
+        <height>400</height>
+       </size>
+      </property>
+      <property name="styleSheet">
+       <string notr="true">background-image: url(:/images/moren.bmp);</string>
+      </property>
+      <widget class="QLineEdit" name="text1">
+       <property name="geometry">
+        <rect>
+         <x>29</x>
+         <y>109</y>
+         <width>71</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="text2">
+       <property name="geometry">
+        <rect>
+         <x>29</x>
+         <y>141</y>
+         <width>71</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="text3">
+       <property name="geometry">
+        <rect>
+         <x>29</x>
+         <y>179</y>
+         <width>71</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="text4">
+       <property name="geometry">
+        <rect>
+         <x>29</x>
+         <y>211</y>
+         <width>71</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="text5">
+       <property name="geometry">
+        <rect>
+         <x>29</x>
+         <y>249</y>
+         <width>71</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="text5_2">
+       <property name="geometry">
+        <rect>
+         <x>253</x>
+         <y>249</y>
+         <width>75</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="text3_2">
+       <property name="geometry">
+        <rect>
+         <x>253</x>
+         <y>179</y>
+         <width>75</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="text1_2">
+       <property name="geometry">
+        <rect>
+         <x>253</x>
+         <y>109</y>
+         <width>75</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="text4_2">
+       <property name="geometry">
+        <rect>
+         <x>253</x>
+         <y>211</y>
+         <width>75</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="text2_2">
+       <property name="geometry">
+        <rect>
+         <x>253</x>
+         <y>141</y>
+         <width>75</width>
+         <height>21</height>
+        </rect>
+       </property>
+       <property name="font">
+        <font>
+         <pointsize>12</pointsize>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="styleSheet">
+        <string notr="true"/>
+       </property>
+       <property name="text">
+        <string>品名</string>
+       </property>
+       <property name="frame">
+        <bool>false</bool>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+     </widget>
+    </widget>
+   </item>
+   <item row="0" column="0" colspan="2">
+    <widget class="QWidget" name="widget_4" native="true">
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>40</height>
+      </size>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3">
+      <item row="0" column="0">
+       <widget class="QPushButton" name="backButton">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>25</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>返回首页</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>360</width>
+          <height>15</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="0" column="2">
+       <widget class="QLabel" name="label">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>24</height>
+         </size>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>14</pointsize>
+         </font>
+        </property>
+        <property name="text">
+         <string>码单模板</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="3">
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>470</width>
+          <height>15</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QWidget" name="widget_2" native="true">
+     <property name="minimumSize">
+      <size>
+       <width>300</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>300</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <widget class="QLabel" name="label_2">
+      <property name="geometry">
+       <rect>
+        <x>10</x>
+        <y>30</y>
+        <width>71</width>
+        <height>21</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>当前模板:</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_3">
+      <property name="geometry">
+       <rect>
+        <x>90</x>
+        <y>30</y>
+        <width>91</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>默认模板</string>
+      </property>
+     </widget>
+     <widget class="QTableWidget" name="tableWidget">
+      <property name="geometry">
+       <rect>
+        <x>10</x>
+        <y>60</y>
+        <width>271</width>
+        <height>141</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pushButton_2">
+      <property name="geometry">
+       <rect>
+        <x>90</x>
+        <y>220</y>
+        <width>93</width>
+        <height>28</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>新建模板</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pushButton_3">
+      <property name="geometry">
+       <rect>
+        <x>90</x>
+        <y>260</y>
+        <width>93</width>
+        <height>28</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>更新模板</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pushButton_4">
+      <property name="geometry">
+       <rect>
+        <x>90</x>
+        <y>300</y>
+        <width>93</width>
+        <height>28</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>删除模板</string>
+      </property>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 205 - 0
widget/showxiangdanlabelform.cpp

@@ -0,0 +1,205 @@
+#include "showxiangdanlabelform.h"
+#include "ui_showxiangdanlabelform.h"
+#include "QDebug"
+
+ShowXiangDanLabelForm::ShowXiangDanLabelForm(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::ShowXiangDanLabelForm)
+{
+    ui->setupUi(this);
+    ui->ModelList->setRowCount(1);
+    ui->ModelList->setItem(0,0,new QTableWidgetItem("test"));
+    ui->showWidget->setAutoFillBackground(true);
+    addComboBox();
+    controlHide();
+}
+
+ShowXiangDanLabelForm::~ShowXiangDanLabelForm()
+{
+    delete ui;
+}
+
+void ShowXiangDanLabelForm::on_backButton_clicked()
+{
+    emit back();
+}
+
+void ShowXiangDanLabelForm::on_ModelList_cellClicked(int row, int column)
+{
+    if(ui->addNewModel->text() == "保存模板"){
+        if(row!=ui->ModelList->rowCount()-1){
+        QMessageBox::information(this,tr("警告"),tr("请先保存当前新建模板"));
+        return;
+        }
+    }
+    if(row == 0){
+        QImage image;
+        image.load(":/images/moren.bmp");
+        QPalette palette;
+        _boxPrinter.reset(new BoxTemlateOne());
+        palette.setBrush(ui->showWidget->backgroundRole(), QBrush(image.scaled(// 缩放背景图.
+            ui->showWidget->size(),
+            Qt::IgnoreAspectRatio,
+            Qt::SmoothTransformation)));
+        ui->showWidget->setPalette(palette);
+    }
+
+}
+
+void ShowXiangDanLabelForm::on_addNewModel_clicked()
+{
+    if(ui->addNewModel->text() == "新建模板"){
+//    qDebug()<<ui->ModelList->rowCount();
+        ui->ModelList->setRowCount(ui->ModelList->rowCount()+1);
+        ui->ModelList->setItem(ui->ModelList->rowCount()-1,0,new QTableWidgetItem("请输入名称"));
+
+        controlShow();
+        QPalette palette;
+        _boxPrinter.reset(new BoxTemlateOne());
+        palette.setBrush(ui->showWidget->backgroundRole(), QBrush(_boxPrinter->BoxModel().scaled(// 缩放背景图.
+            ui->showWidget->size(),
+            Qt::IgnoreAspectRatio,
+            Qt::SmoothTransformation)));
+        ui->showWidget->setPalette(palette);
+
+        ui->addNewModel->setText("保存模板");
+    }else if(ui->addNewModel->text() == "保存模板"){
+        if(ui->ModelList->item(ui->ModelList->rowCount(),0)->text()=="请输入名称"){
+           QMessageBox::information(this,tr("提示"),tr("请输入名称"));
+           return;
+        }
+        QMessageBox::information(this,tr("提示"),tr("保存成功"));
+        ui->addNewModel->setText("新建模板");
+    }
+
+}
+
+void ShowXiangDanLabelForm::on_upModel_clicked()
+{
+    controlShow();
+}
+
+void ShowXiangDanLabelForm::controlHide()
+{
+    ui->text1->hide();//第一行从上而下
+    ui->text2->hide();
+    ui->text3->hide();
+    ui->text4->hide();
+    ui->text5->hide();
+    ui->text1_2->hide();//第二行从上而下
+    ui->text2_2->hide();
+    ui->text3_2->hide();
+    ui->text4_2->hide();
+    ui->text5_2->hide();
+
+    ui->data1->hide();
+    ui->data2->hide();
+    ui->data3->hide();
+    ui->data4->hide();
+    ui->data5->hide();
+    ui->data1_2->hide();
+    ui->data2_2->hide();
+    ui->data3_2->hide();
+    ui->data4_2->hide();
+    ui->data5_2->hide();
+
+}
+
+void ShowXiangDanLabelForm::controlShow()
+{
+    ui->text1->show();//第一行从上而下
+    ui->text2->show();
+    ui->text3->show();
+    ui->text4->show();
+    ui->text5->show();
+    ui->text1_2->show();//第二行从上而下
+    ui->text2_2->show();
+    ui->text3_2->show();
+    ui->text4_2->show();
+    ui->text5_2->show();
+
+    ui->data1->show();
+    ui->data2->show();
+    ui->data3->show();
+    ui->data4->show();
+    ui->data5->show();
+    ui->data1_2->show();
+    ui->data2_2->show();
+    ui->data3_2->show();
+    ui->data4_2->show();
+    ui->data5_2->show();
+}
+
+void ShowXiangDanLabelForm::addComboBox()
+{
+    QList<QString> text;
+    text.append("品名");
+    text.append("批号");
+    text.append("规格");
+    text.append("等级");
+    text.append("箱号");
+    text.append("毛重");
+    text.append("净重");
+    text.append("筒数");
+    text.append("捻向");
+    text.append("纸管颜色");
+
+    QList<QString> data;
+    data.append("product_type_code");
+    data.append("batch_no");
+    data.append("specs");
+    data.append("level");
+    data.append("case_number");
+    data.append("gross_weight");
+    data.append("net_weight");
+    data.append("tube_number");
+    data.append("twist_type");
+    data.append("bucket_color");
+
+    for(int i = 0;i<text.size();i++){
+        ui->data1->addItem(text.at(i),data.at(i));
+    }
+
+    for(int i = 0;i<text.size();i++){
+        ui->data2->addItem(text.at(i),data.at(i));
+    }
+
+    for(int i = 0;i<text.size();i++){
+        ui->data3->addItem(text.at(i),data.at(i));
+    }
+
+    for(int i = 0;i<text.size();i++){
+        ui->data4->addItem(text.at(i),data.at(i));
+    }
+
+    for(int i = 0;i<text.size();i++){
+        ui->data5->addItem(text.at(i),data.at(i));
+    }
+
+    for(int i = 0;i<text.size();i++){
+        ui->data1_2->addItem(text.at(i),data.at(i));
+    }
+
+    for(int i = 0;i<text.size();i++){
+        ui->data2_2->addItem(text.at(i),data.at(i));
+    }
+
+    for(int i = 0;i<text.size();i++){
+        ui->data3_2->addItem(text.at(i),data.at(i));
+    }
+
+    for(int i = 0;i<text.size();i++){
+        ui->data4_2->addItem(text.at(i),data.at(i));
+    }
+
+    for(int i = 0;i<text.size();i++){
+        ui->data5_2->addItem(text.at(i),data.at(i));
+    }
+
+
+
+}
+
+
+
+

+ 68 - 0
widget/showxiangdanlabelform.h

@@ -0,0 +1,68 @@
+#ifndef SHOWXIANGDANLABELFORM_H
+#define SHOWXIANGDANLABELFORM_H
+
+#include <QWidget>
+#include "handle/printer/baseboxprinter.h"
+#include "handle/printer/boxtemlateone.h"
+#include "QMessageBox"
+
+namespace Ui {
+class ShowXiangDanLabelForm;
+}
+
+struct BoxModel{
+    QString text1;
+    QString text2;
+    QString text3;
+    QString text4;
+    QString text5;
+    QString text1_2;
+    QString text2_2;
+    QString text3_2;
+    QString text4_2;
+    QString text5_2;
+
+    QString data1;
+    QString data2;
+    QString data3;
+    QString data4;
+    QString data5;
+    QString data1_2;
+    QString data2_2;
+    QString data3_2;
+    QString data4_2;
+    QString data5_2;
+
+};
+
+class ShowXiangDanLabelForm : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit ShowXiangDanLabelForm(QWidget *parent = nullptr);
+    ~ShowXiangDanLabelForm();
+
+signals:
+    void back();
+
+private slots:
+    void controlHide();
+    void controlShow();
+    void addComboBox();
+
+    void on_addNewModel_clicked();
+
+    void on_upModel_clicked();
+
+    void on_ModelList_cellClicked(int row, int column);
+
+    void on_backButton_clicked();
+
+
+private:
+    Ui::ShowXiangDanLabelForm *ui;
+    QSharedPointer<BaseBoxPrinter> _boxPrinter;
+};
+
+#endif // SHOWXIANGDANLABELFORM_H

+ 604 - 0
widget/showxiangdanlabelform.ui

@@ -0,0 +1,604 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ShowXiangDanLabelForm</class>
+ <widget class="QWidget" name="ShowXiangDanLabelForm">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>851</width>
+    <height>491</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0" colspan="2">
+    <widget class="QWidget" name="widget_4" native="true">
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>40</height>
+      </size>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3">
+      <item row="0" column="0">
+       <widget class="QPushButton" name="backButton">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>25</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>返回首页</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>360</width>
+          <height>15</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="0" column="2">
+       <widget class="QLabel" name="label">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>24</height>
+         </size>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>14</pointsize>
+         </font>
+        </property>
+        <property name="text">
+         <string>箱单模板</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="3">
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>470</width>
+          <height>15</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QWidget" name="widget" native="true">
+     <property name="styleSheet">
+      <string notr="true"/>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2">
+      <item row="0" column="0">
+       <widget class="QWidget" name="showWidget" native="true">
+        <property name="minimumSize">
+         <size>
+          <width>500</width>
+          <height>400</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>500</width>
+          <height>400</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true"/>
+        </property>
+        <widget class="QLineEdit" name="text1">
+         <property name="geometry">
+          <rect>
+           <x>29</x>
+           <y>109</y>
+           <width>71</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="text2">
+         <property name="geometry">
+          <rect>
+           <x>29</x>
+           <y>141</y>
+           <width>71</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="text3">
+         <property name="geometry">
+          <rect>
+           <x>29</x>
+           <y>179</y>
+           <width>71</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="text4">
+         <property name="geometry">
+          <rect>
+           <x>29</x>
+           <y>211</y>
+           <width>71</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="text5">
+         <property name="geometry">
+          <rect>
+           <x>29</x>
+           <y>249</y>
+           <width>71</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="text5_2">
+         <property name="geometry">
+          <rect>
+           <x>253</x>
+           <y>249</y>
+           <width>75</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="text3_2">
+         <property name="geometry">
+          <rect>
+           <x>253</x>
+           <y>179</y>
+           <width>75</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="text1_2">
+         <property name="geometry">
+          <rect>
+           <x>253</x>
+           <y>109</y>
+           <width>75</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="text4_2">
+         <property name="geometry">
+          <rect>
+           <x>253</x>
+           <y>211</y>
+           <width>75</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QLineEdit" name="text2_2">
+         <property name="geometry">
+          <rect>
+           <x>253</x>
+           <y>141</y>
+           <width>75</width>
+           <height>21</height>
+          </rect>
+         </property>
+         <property name="font">
+          <font>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="styleSheet">
+          <string notr="true"/>
+         </property>
+         <property name="text">
+          <string>品名</string>
+         </property>
+         <property name="frame">
+          <bool>false</bool>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data1">
+         <property name="geometry">
+          <rect>
+           <x>120</x>
+           <y>109</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data2">
+         <property name="geometry">
+          <rect>
+           <x>120</x>
+           <y>141</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data3">
+         <property name="geometry">
+          <rect>
+           <x>120</x>
+           <y>179</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data4">
+         <property name="geometry">
+          <rect>
+           <x>120</x>
+           <y>211</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data5">
+         <property name="geometry">
+          <rect>
+           <x>120</x>
+           <y>249</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data2_2">
+         <property name="geometry">
+          <rect>
+           <x>350</x>
+           <y>141</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data3_2">
+         <property name="geometry">
+          <rect>
+           <x>350</x>
+           <y>179</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data5_2">
+         <property name="geometry">
+          <rect>
+           <x>350</x>
+           <y>249</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data4_2">
+         <property name="geometry">
+          <rect>
+           <x>350</x>
+           <y>211</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+        <widget class="QComboBox" name="data1_2">
+         <property name="geometry">
+          <rect>
+           <x>350</x>
+           <y>109</y>
+           <width>111</width>
+           <height>22</height>
+          </rect>
+         </property>
+        </widget>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QWidget" name="widget_2" native="true">
+     <property name="minimumSize">
+      <size>
+       <width>300</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>300</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <widget class="QLabel" name="label_2">
+      <property name="geometry">
+       <rect>
+        <x>10</x>
+        <y>30</y>
+        <width>71</width>
+        <height>21</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>当前模板:</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_3">
+      <property name="geometry">
+       <rect>
+        <x>90</x>
+        <y>30</y>
+        <width>91</width>
+        <height>16</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>默认模板</string>
+      </property>
+     </widget>
+     <widget class="QTableWidget" name="ModelList">
+      <property name="geometry">
+       <rect>
+        <x>10</x>
+        <y>60</y>
+        <width>271</width>
+        <height>141</height>
+       </rect>
+      </property>
+      <column>
+       <property name="text">
+        <string>名称</string>
+       </property>
+      </column>
+     </widget>
+     <widget class="QPushButton" name="addNewModel">
+      <property name="geometry">
+       <rect>
+        <x>90</x>
+        <y>220</y>
+        <width>93</width>
+        <height>28</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>新建模板</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="upModel">
+      <property name="geometry">
+       <rect>
+        <x>90</x>
+        <y>260</y>
+        <width>93</width>
+        <height>28</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>更新模板</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="delModel">
+      <property name="geometry">
+       <rect>
+        <x>90</x>
+        <y>300</y>
+        <width>93</width>
+        <height>28</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>删除模板</string>
+      </property>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 22 - 12
widget/uncertainweightpackform.cpp

@@ -61,9 +61,7 @@ void UncertainWeightPackForm::calcData()
         netNum = ui->grossWeight->text().toDouble();
         gross_weight = netNum + pz + tz * ts;
     }
-    if(netNum<0){
-        netNum = 0.00;
-    }
+
     if(istubeNumTure){
         if(ui->tongshu->text().toInt()>tubeNumMax || ui->tongshu->text().toInt()<tubeNumMin){
             ui->tongshu->setValue(tubeNumMin);
@@ -112,10 +110,21 @@ void UncertainWeightPackForm::on_addPackList_clicked()
 
 void UncertainWeightPackForm::on_addBoxList_clicked()
 {
-    if(ui->grossWeight->text().toInt()<0){
+    if(ui->grossWeight->text().toDouble()<=0){
         QMessageBox::information(this,tr("注意"),tr("重量异常"));
         return;
     }
+    if(ui->tongshu->text().toInt()<=0){
+        QMessageBox::information(this,tr("注意"),tr("筒数异常"));
+        return;
+    }
+
+    if(netNum<=0){
+//        netNum = 0.00;
+        QMessageBox::information(this,tr("注意"),tr("重量异常"));
+        return;
+    }
+
     checkPackInfo(); //检查packinfo isNull
     //当当前箱数大于等于最大箱数是启动on_addPackList_clicked();
     if(packinfo->boxes().size() >= ui->mashu->currentText().toInt()){
@@ -254,6 +263,7 @@ void UncertainWeightPackForm::addTableWidget(QSharedPointer<BoxInfo> box, int ro
     connect(btn_2,&QPushButton::clicked,[i,this](){this->edit_clicked(i);});
     connect(btn_3,&QPushButton::clicked,[i,this](){this->Makeup_clicked(i);});
     ui->tableWidget->setCellWidget(row,6,tmp_widget);
+    ui->tableWidget->resizeColumnsToContents();
 }
 
 void UncertainWeightPackForm::init()
@@ -445,14 +455,14 @@ void UncertainWeightPackForm::restTableWidget()
 {
     ui->tableWidget->clearContents();
     ui->tableWidget->setRowCount(0);
-    ui->tableWidget->setColumnWidth(0,200);
-    ui->tableWidget->setColumnWidth(1,75);
-    ui->tableWidget->setColumnWidth(2,75);
-    ui->tableWidget->setColumnWidth(3,75);
-    ui->tableWidget->setColumnWidth(4,75);
-    ui->tableWidget->setColumnWidth(5,75);
-
-    ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
+//    ui->tableWidget->setColumnWidth(0,200);
+//    ui->tableWidget->setColumnWidth(1,75);
+//    ui->tableWidget->setColumnWidth(2,75);
+//    ui->tableWidget->setColumnWidth(3,75);
+//    ui->tableWidget->setColumnWidth(4,75);
+//    ui->tableWidget->setColumnWidth(5,75);
+
+//    ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
 
     if(!packinfo.isNull()){
         for(int i =  0; i < packinfo->boxInfoSize(); ++i){