WorkDetail.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class WorkDetail(object):
  6. def __init__(self):
  7. self._batch_code = None
  8. self._expire_date = None
  9. self._ext_info = None
  10. self._goods_code = None
  11. self._inventory_type = None
  12. self._price = None
  13. self._production_date = None
  14. self._quantity = None
  15. @property
  16. def batch_code(self):
  17. return self._batch_code
  18. @batch_code.setter
  19. def batch_code(self, value):
  20. self._batch_code = value
  21. @property
  22. def expire_date(self):
  23. return self._expire_date
  24. @expire_date.setter
  25. def expire_date(self, value):
  26. self._expire_date = value
  27. @property
  28. def ext_info(self):
  29. return self._ext_info
  30. @ext_info.setter
  31. def ext_info(self, value):
  32. self._ext_info = value
  33. @property
  34. def goods_code(self):
  35. return self._goods_code
  36. @goods_code.setter
  37. def goods_code(self, value):
  38. self._goods_code = value
  39. @property
  40. def inventory_type(self):
  41. return self._inventory_type
  42. @inventory_type.setter
  43. def inventory_type(self, value):
  44. self._inventory_type = value
  45. @property
  46. def price(self):
  47. return self._price
  48. @price.setter
  49. def price(self, value):
  50. self._price = value
  51. @property
  52. def production_date(self):
  53. return self._production_date
  54. @production_date.setter
  55. def production_date(self, value):
  56. self._production_date = value
  57. @property
  58. def quantity(self):
  59. return self._quantity
  60. @quantity.setter
  61. def quantity(self, value):
  62. self._quantity = value
  63. def to_alipay_dict(self):
  64. params = dict()
  65. if self.batch_code:
  66. if hasattr(self.batch_code, 'to_alipay_dict'):
  67. params['batch_code'] = self.batch_code.to_alipay_dict()
  68. else:
  69. params['batch_code'] = self.batch_code
  70. if self.expire_date:
  71. if hasattr(self.expire_date, 'to_alipay_dict'):
  72. params['expire_date'] = self.expire_date.to_alipay_dict()
  73. else:
  74. params['expire_date'] = self.expire_date
  75. if self.ext_info:
  76. if hasattr(self.ext_info, 'to_alipay_dict'):
  77. params['ext_info'] = self.ext_info.to_alipay_dict()
  78. else:
  79. params['ext_info'] = self.ext_info
  80. if self.goods_code:
  81. if hasattr(self.goods_code, 'to_alipay_dict'):
  82. params['goods_code'] = self.goods_code.to_alipay_dict()
  83. else:
  84. params['goods_code'] = self.goods_code
  85. if self.inventory_type:
  86. if hasattr(self.inventory_type, 'to_alipay_dict'):
  87. params['inventory_type'] = self.inventory_type.to_alipay_dict()
  88. else:
  89. params['inventory_type'] = self.inventory_type
  90. if self.price:
  91. if hasattr(self.price, 'to_alipay_dict'):
  92. params['price'] = self.price.to_alipay_dict()
  93. else:
  94. params['price'] = self.price
  95. if self.production_date:
  96. if hasattr(self.production_date, 'to_alipay_dict'):
  97. params['production_date'] = self.production_date.to_alipay_dict()
  98. else:
  99. params['production_date'] = self.production_date
  100. if self.quantity:
  101. if hasattr(self.quantity, 'to_alipay_dict'):
  102. params['quantity'] = self.quantity.to_alipay_dict()
  103. else:
  104. params['quantity'] = self.quantity
  105. return params
  106. @staticmethod
  107. def from_alipay_dict(d):
  108. if not d:
  109. return None
  110. o = WorkDetail()
  111. if 'batch_code' in d:
  112. o.batch_code = d['batch_code']
  113. if 'expire_date' in d:
  114. o.expire_date = d['expire_date']
  115. if 'ext_info' in d:
  116. o.ext_info = d['ext_info']
  117. if 'goods_code' in d:
  118. o.goods_code = d['goods_code']
  119. if 'inventory_type' in d:
  120. o.inventory_type = d['inventory_type']
  121. if 'price' in d:
  122. o.price = d['price']
  123. if 'production_date' in d:
  124. o.production_date = d['production_date']
  125. if 'quantity' in d:
  126. o.quantity = d['quantity']
  127. return o