packinfo.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef PACKINFO_H
  2. #define PACKINFO_H
  3. #include <QString>
  4. #include <QSharedPointer>
  5. #include "projectinfo.h"
  6. #include "QJsonArray"
  7. QString getDecimalbit(double v,int i = 2);
  8. class PackInfo;
  9. struct RuKuInfo
  10. {
  11. int warehouse_id;
  12. int way;
  13. QJsonArray product_details;
  14. QString remark;
  15. QJsonObject toObject();
  16. };
  17. struct BoxInfo
  18. {
  19. inline QSharedPointer<PackInfo> parentPack() {
  20. return parent.toStrongRef();
  21. }
  22. inline QString caseNumber() {return case_number;}
  23. int box_weight = 0;// 是 int 皮重 单位:克
  24. int tube_number = 0;// 是 int 筒数
  25. int bucket_weight = 0;// 是 int 总筒重 单位:克
  26. int gross_weight = 0;// 是 int 毛重 单位:克
  27. int net_weight = 0;// 是 int 净重 单位:克
  28. QString Level;//等级;
  29. QString twist_type;// string 捻向
  30. QString bucket_color;// string 管色
  31. QString sort;// 是 string 排序
  32. QString remark;// 否 string 备注
  33. QJsonObject toObject();
  34. static QSharedPointer<BoxInfo> fromObject(QSharedPointer<PackInfo> & pack, QJsonObject &obj);
  35. private:
  36. BoxInfo(QSharedPointer<PackInfo> pack,QString code);
  37. QString case_number;// 是 string 箱号
  38. QWeakPointer<PackInfo> parent;
  39. friend class PackInfo;
  40. };
  41. Q_DECLARE_METATYPE(QSharedPointer<BoxInfo>);
  42. class PackInfo : public QEnableSharedFromThis<PackInfo>
  43. {
  44. public:
  45. PackInfo(const QSharedPointer<ProjectInfo> & info);
  46. int quantity = 0;// 是 int 箱数
  47. int level_id = 0;// 是 int 等级ID
  48. QString level;
  49. QString machine_no;// 是 string 机台
  50. QString packing_time;// 是 string 打包时间
  51. QString packing_type;// 是 string 打包类型
  52. QString carton_type;// 是 string 纸箱
  53. int operator_id = 0;// 是 int 操作员ID
  54. QString batch_no;//批号
  55. int warehouse_id;//仓库id
  56. QString remark;// 否 string
  57. QString telephone;// 公司
  58. QString customer;// 抬头
  59. int packType;//0 定重,1 不定重
  60. inline const QList<QSharedPointer<BoxInfo>> & boxes() const {return _boxes;} //array 成品详情
  61. inline const QSharedPointer<ProjectInfo> & info() const {return _info;}
  62. inline QString codeSingle() const {return code_single;} //string 码单
  63. int tube_number(); //int 筒数
  64. int gross_weight(); // 毛重 单位:克
  65. int net_weight(); //单位:克
  66. int goodsID() {return goods_id;}
  67. inline qint64 time() {return _time;}
  68. QSharedPointer<BoxInfo> addBoxInfo();
  69. void addBoxInfoList(QSharedPointer<BoxInfo> boxes);
  70. void delBoxInfoAt(int num);
  71. QSharedPointer<BoxInfo> boxInfoAt(int num);
  72. int boxInfoSize();
  73. void upInfo(const QSharedPointer<ProjectInfo> & info){
  74. _info = info;
  75. if(!info.isNull())
  76. goods_id = info->goods_id;
  77. }
  78. QJsonObject toObject();
  79. static QSharedPointer<PackInfo> fromObject(QJsonObject &obj);
  80. private:
  81. QString buildPackId();
  82. QString buildBoxId();
  83. private:
  84. QList<QSharedPointer<BoxInfo>> _boxes;
  85. QSharedPointer<ProjectInfo> _info;
  86. QString code_single;
  87. int goods_id;
  88. qint64 _time;
  89. int _boxIndex;
  90. static int lastMin;
  91. static int lastNum;
  92. };
  93. Q_DECLARE_METATYPE(QSharedPointer<PackInfo>);
  94. #endif // PACKINFO_H