| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- #ifndef PACKINFO_H
- #define PACKINFO_H
- #include <QString>
- #include <QSharedPointer>
- #include "projectinfo.h"
- QString getDecimalbit(double v,int i = 2);
- class PackInfo;
- struct BoxInfo
- {
- inline QSharedPointer<PackInfo> parentPack() {
- return parent.toStrongRef();
- }
- inline QString caseNumber() {return case_number;}
- int box_weight = 0;// 是 int 皮重 单位:克
- int tube_number = 0;// 是 int 筒数
- int bucket_weight = 0;// 是 int 总筒重 单位:克
- int gross_weight = 0;// 是 int 毛重 单位:克
- int net_weight = 0;// 是 int 净重 单位:克
- QString Level;//等级;
- QString twist_type;// string 捻向
- QString bucket_color;// string 管色
- QString sort;// 是 string 排序
- QString remark;// 否 string 备注
- QJsonObject toObject();
- static QSharedPointer<BoxInfo> fromObject(QSharedPointer<PackInfo> & pack, QJsonObject &obj);
- private:
- BoxInfo(QSharedPointer<PackInfo> pack,QString code);
- QString case_number;// 是 string 箱号
- QWeakPointer<PackInfo> parent;
- friend class PackInfo;
- };
- Q_DECLARE_METATYPE(QSharedPointer<BoxInfo>);
- class PackInfo : public QEnableSharedFromThis<PackInfo>
- {
- public:
- PackInfo(const QSharedPointer<ProjectInfo> & info);
- int quantity = 0;// 是 int 箱数
- int level_id = 0;// 是 int 等级ID
- QString level;
- QString machine_no;// 是 string 机台
- QString packing_time;// 是 string 打包时间
- QString packing_type;// 是 string 打包类型
- QString carton_type;// 是 string 纸箱
- int operator_id = 0;// 是 int 操作员ID
- QString remark;// 否 string
- QString telephone;// 公司
- QString customer;// 抬头
- int packType;//0 定重,1 不定重
- inline const QList<QSharedPointer<BoxInfo>> & boxes() const {return _boxes;} //array 成品详情
- inline const QSharedPointer<ProjectInfo> & info() const {return _info;}
- inline QString codeSingle() const {return code_single;} //string 码单
- int tube_number(); //int 筒数
- int gross_weight(); // 毛重 单位:克
- int net_weight(); //单位:克
- int goodsID() {return goods_id;}
- inline qint64 time() {return _time;}
- QSharedPointer<BoxInfo> addBoxInfo();
- void addBoxInfoList(QSharedPointer<BoxInfo> boxes);
- void delBoxInfoAt(int num);
- QSharedPointer<BoxInfo> boxInfoAt(int num);
- int boxInfoSize();
- void upInfo(const QSharedPointer<ProjectInfo> & info){
- _info = info;
- if(!info.isNull())
- goods_id = info->goods_id;
- }
- QJsonObject toObject();
- static QSharedPointer<PackInfo> fromObject(QJsonObject &obj);
- private:
- QString buildPackId();
- QString buildBoxId();
- private:
- QList<QSharedPointer<BoxInfo>> _boxes;
- QSharedPointer<ProjectInfo> _info;
- QString code_single;
- int goods_id;
- qint64 _time;
- static int lastMin;
- static int lastNum;
- };
- Q_DECLARE_METATYPE(QSharedPointer<PackInfo>);
- #endif // PACKINFO_H
|