packinfo.h 3.2 KB

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