resources.py 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # -*- coding: utf-8 -*-
  2. from __future__ import absolute_import
  3. from import_export import resources
  4. from import_export.fields import Field
  5. class ProductionPlanResource(resources.Resource):
  6. def __init__(self):
  7. super(ProductionPlanResource, self).__init__()
  8. self.fields['no'] = Field(attribute='no')
  9. self.fields['name'] = Field(attribute='name')
  10. self.fields['total_count'] = Field(attribute='total_count')
  11. self.fields['create_user_text'] = Field(attribute='create_user_text')
  12. self.fields['create_time'] = Field(attribute='create_time')
  13. self.fields['status_text'] = Field(attribute='status_text')
  14. self.fields['check_time'] = Field(attribute='check_time')
  15. self.fields['check_user_text'] = Field(attribute='check_user_text')
  16. self.fields['notes'] = Field(attribute='notes')
  17. def get_export_headers(self):
  18. return [u'单号', u'名称', u'合计数量', u'创建时间', u'创建人', u'审核状态', u'审核时间', u'审核人', u'备注',]
  19. class Meta:
  20. fields = ('no', 'name', 'total_count', 'create_time', 'create_user_text', 'status_text', 'check_time', 'check_user_text',
  21. 'notes',)
  22. export_order = fields
  23. class ProductionPlanDetailResource(resources.Resource):
  24. def __init__(self):
  25. super(ProductionPlanDetailResource, self).__init__()
  26. self.fields['name'] = Field(attribute='name')
  27. self.fields['model'] = Field(attribute='model')
  28. self.fields['quality_request_text'] = Field(attribute='quality_request_text')
  29. self.fields['count'] = Field(attribute='count')
  30. self.fields['p_department_text'] = Field(attribute='p_department_text')
  31. self.fields['product_time'] = Field(attribute='product_time')
  32. self.fields['product_user_text'] = Field(attribute='product_user_text')
  33. self.fields['notes'] = Field(attribute='notes')
  34. def get_export_headers(self):
  35. return [u'产品名称', u'产品代码', u'质量要求', u'数量', u'生产车间', u'生产时间', u'负责人', u'备注',]
  36. class Meta:
  37. fields = ('name', 'model', 'quality_request_text', 'count', 'p_department_text', 'product_time',
  38. 'product_user_text', 'notes',)
  39. export_order = fields
  40. class SalePlanResource(resources.Resource):
  41. def __init__(self):
  42. super(SalePlanResource, self).__init__()
  43. self.fields['no'] = Field(attribute='no')
  44. self.fields['create_time'] = Field(attribute='create_time')
  45. self.fields['customer_text'] = Field(attribute='customer_text')
  46. self.fields['goods_text'] = Field(attribute='goods_text')
  47. self.fields['total_count'] = Field(attribute='total_count')
  48. self.fields['total_amount'] = Field(attribute='total_amount')
  49. self.fields['status_text'] = Field(attribute='status_text')
  50. self.fields['create_user_text'] = Field(attribute='create_user_text')
  51. self.fields['department_text'] = Field(attribute='department_text')
  52. self.fields['check_user_text'] = Field(attribute='check_user_text')
  53. self.fields['check_time'] = Field(attribute='check_time')
  54. self.fields['notes'] = Field(attribute='notes')
  55. def get_export_headers(self):
  56. return [u'单号', u'客户', u'产品', u'合计数量', u'合计金额', u'创建时间', u'创建人', u'所属部门', u'审核状态', u'审核时间', u'审核人', u'备注']
  57. class Meta:
  58. fields = ('no', 'customer_text', 'goods_text','total_count', 'total_amount', 'create_time', 'create_user_text', 'department_text', 'status_text',
  59. 'check_time', 'check_user_text', 'notes')
  60. export_order = fields
  61. class SalePlanDetailResource(resources.Resource):
  62. def __init__(self):
  63. super(SalePlanDetailResource, self).__init__()
  64. self.fields['goods_text'] = Field(attribute='goods_text')
  65. self.fields['goods_model'] = Field(attribute='goods_model')
  66. self.fields['quality_request_text'] = Field(attribute='quality_request_text')
  67. self.fields['require_count'] = Field(attribute='require_count')
  68. self.fields['price'] = Field(attribute='price')
  69. self.fields['require_time'] = Field(attribute='require_time')
  70. self.fields['current_count'] = Field(attribute='current_count')
  71. self.fields['require_production_count'] = Field(attribute='require_production_count')
  72. def get_export_headers(self):
  73. return [u'产品名称', u'产品代码', u'质量要求', u'数量', u'单价', u'需求时间', u'当前库存', u'需生产']
  74. class Meta:
  75. fields = ('goods_text', 'goods_model', 'quality_request_text', 'require_count', 'price', 'require_time', 'current_count',
  76. 'require_production_count')
  77. export_order = fields