packinfo.h 2.8 KB

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