files.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from rest_framework_csv.renderers import CSVStreamingRenderer
  2. def file_headers_list():
  3. return [
  4. 'document_date',
  5. 'document_number',
  6. 'document_type',
  7. 'business_type',
  8. 'iout_type',
  9. 'department',
  10. 'warehouse_name',
  11. 'goods_code',
  12. 'goods_desc',
  13. 'goods_std',
  14. 'goods_batch',
  15. 'in_batch',
  16. 'out_batch',
  17. 'goods_in',
  18. 'goods_out',
  19. 'goods_notes',
  20. 'creator'
  21. ]
  22. def cn_data_header_list():
  23. return dict([
  24. ('document_date', '单据日期'),
  25. ('document_number', '单据编号'),
  26. ('document_type', '单据类型'),
  27. ('business_type', '业务类型'),
  28. ('iout_type', '出入库类型'),
  29. ('department', '部门'),
  30. ('warehouse_code', '仓库编码'),
  31. ('warehouse_name', '仓库名称'),
  32. ('goods_code', '商品编码'),
  33. ('goods_desc', '商品描述'),
  34. ('goods_std', '商品标准'),
  35. ('goods_batch', '商品批次'),
  36. ('in_batch', '入库批次'),
  37. ('out_batch', '出库批次'),
  38. ('goods_in', '入库数量'),
  39. ('goods_out', '出库数量'),
  40. ('goods_notes', '备注'),
  41. ('creator', '创建人')
  42. ])
  43. class FileFlowListRenderCN(CSVStreamingRenderer):
  44. header = file_headers_list()
  45. labels = cn_data_header_list()