#ifndef UNCERTAINWEIGHTPACKFORM_H
#define UNCERTAINWEIGHTPACKFORM_H

#include <QWidget>
#include "handle/remotepackconfig.h"
#include "struct_/packinfo.h"
#include "QTimer"
#include "QMessageBox"
#include "globalinfo.h"
#include "editboxinfodialog.h"

namespace Ui {
class UncertainWeightPackForm;
}

class UncertainWeightPackForm : public QWidget
{
    Q_OBJECT

public:
    explicit UncertainWeightPackForm(QWidget *parent = nullptr);
    ~UncertainWeightPackForm();

    void setProInfo(const QSharedPointer<ProjectInfo> & info);

private slots:

    void on_addBoxList_clicked();

    void on_addPackList_clicked();

    void calcData();

    void on_tongshuguding_currentIndexChanged(const QString &arg1);

    void on_tongshuxianzhi_stateChanged(int arg1);

    void on_searchButton_clicked();

    void on_pushContinue_clicked();

    void on_showMaoZhong_stateChanged(int);

    void on_pushEditBatch_clicked();

    void on_pushNoSyncList_clicked();

    void on_pushSync_clicked();

    void on_backButton_clicked();

    void on_dingzhong_clicked();

    void on_ruku_stateChanged(int arg1);

private slots:
    void upBoxModelList();//获取箱单模板
    void upPackModelList();//获取码单模板

    void on_useNewDataButton_clicked();

private:
    void updateTableWidget(QList<QSharedPointer<ProjectInfo>> & list);
    void init();
    void xuanZe_clicked(QString batchno);
    void del_clicked(int row);
    void Makeup_clicked(int row);
    void checkPackInfo();
    void EditBatch();

public slots:
    void setShortcutConfig();
    void upconfig();
    void upDengjiInfo();
    void changeSpecs();
    void upWare();


public:
    void addTableWidget(QSharedPointer<BoxInfo> box, int row);
    void restTableWidget();
    void upSum();
    void edit_clicked(int row);
    void save();


signals:
    void back();
    void NoSyncList();
    void dingzhong();
    void backup(int i);

private:
    Ui::UncertainWeightPackForm *ui;
    QSharedPointer<ProjectInfo> _info;
    QSharedPointer<PackInfo> packinfo;
    QMap<QString,DengJiConfigItem> dengjiMap;// <name,详细信息>
    HttpRequest _request;
//    AutoPackUtils aputils;
    bool autoRead;
    bool isRuku = false;
//    SelectSpecs specs;

    QList<QSharedPointer<ProjectInfo>> prolist;

    GlobalInfo * glo = GlobalInfo::this_();
    PackInfoSeed2Server *packServer;
    PackInfoManger *Manger;

    double netNum = 0.00;
    double gross_weight = 0.00;
    float f_gross_weight = 0.0;
    float f_netNum = 0.0;

    int chengZhongJingDu;
    int chengZhongJingDuModel;
    double chengZhongJingDuModel_Num = 0.005;//打包精度计算时所需的数，类似四舍五入时把double+0.5在向下取整；
    double f_chengZhongJingDuModel_Num = 0.05;//单精度计算时的数；

    bool istubeNumTure;
    int tubeNumMax;
    int tubeNumMin;
};

#endif // UNCERTAINWEIGHTPACKFORM_H
