files.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. from rest_framework_csv.renderers import CSVStreamingRenderer
  2. def list_file_headers():
  3. return [
  4. ]
  5. def list_cn_data_header():
  6. return dict([
  7. ('asn_code', u'ASN单号'),
  8. ('asn_status', u'ASN状态'),
  9. ('total_weight', u'总重量'),
  10. ('total_volume', u'总体积'),
  11. ('total_cost', u'总成本'),
  12. ('supplier', u'供应商'),
  13. ('creater', u'创建人'),
  14. ('create_time', u'创建时间'),
  15. ('update_time', u'更新时间')
  16. ])
  17. def detail_file_headers():
  18. return [
  19. 'asn_code',
  20. 'asn_status',
  21. 'supplier',
  22. 'goods_code',
  23. 'goods_desc',
  24. 'goods_qty',
  25. 'goods_actual_qty',
  26. 'sorted_qty',
  27. 'goods_shortage_qty',
  28. 'goods_more_qty',
  29. 'goods_damage_qty',
  30. 'goods_weight',
  31. 'goods_volume',
  32. 'goods_cost',
  33. 'creater',
  34. 'create_time',
  35. 'update_time'
  36. ]
  37. def detail_cn_data_header():
  38. return dict([
  39. ('asn_code', u'ASN单号'),
  40. ('asn_status', u'ASN状态'),
  41. ('supplier', u'供应商'),
  42. ('goods_code', u'商品编码'),
  43. ('goods_desc', u'商品描述'),
  44. ('goods_qty', u'订单数量'),
  45. ('goods_actual_qty', u'实际到货数量'),
  46. ('sorted_qty', u'已分拣数量'),
  47. ('goods_shortage_qty', u'少到货数量'),
  48. ('goods_more_qty', u'多到货数量'),
  49. ('goods_damage_qty', u'破损数量'),
  50. ('goods_weight', u'商品重量'),
  51. ('goods_volume', u'商品体积'),
  52. ('goods_cost', u'商品成本'),
  53. ('creater', u'创建人'),
  54. ('create_time', u'创建时间'),
  55. ('update_time', u'更新时间')
  56. ])
  57. class FileListRenderCN(CSVStreamingRenderer):
  58. header = list_file_headers()
  59. labels = list_cn_data_header()
  60. class FileDetailRenderCN(CSVStreamingRenderer):
  61. header = detail_file_headers()
  62. labels = detail_cn_data_header()
  63. def BatchFile_headers_list():
  64. return [
  65. 'id',
  66. 'bound_number',
  67. 'bound_batch_order',
  68. 'warehouse_name',
  69. 'goods_code',
  70. 'goods_desc',
  71. 'goods_std',
  72. 'goods_unit',
  73. 'goods_qty',
  74. 'goods_in_qty',
  75. 'goods_in_location_qty',
  76. 'goods_out_qty',
  77. 'check_status',
  78. 'creater',
  79. 'create_time',
  80. 'update_time'
  81. ]
  82. def BatchFile_cn_data_header_list():
  83. return dict([
  84. ('id', '序号'),
  85. ('bound_number', '管理批次'),
  86. ('bound_batch_order', '批号'),
  87. ('warehouse_name', '仓库名称'),
  88. ('goods_code', '存货编码'),
  89. ('goods_desc', '存货名称'),
  90. ('goods_std', '规格型号'),
  91. ('goods_unit', '单位'),
  92. ('goods_qty', '计划数目'),
  93. ('goods_in_qty', '已入库/组盘数目'),
  94. ('goods_in_location_qty', '在库'),
  95. ('goods_out_qty', '已出库数目'),
  96. ('check_status', '质检状态'),
  97. ('creater', '创建人'),
  98. ('create_time', '创建时间'),
  99. ('update_time', '更新时间')
  100. ])
  101. class BatchFileRenderCN(CSVStreamingRenderer):
  102. header = BatchFile_headers_list()
  103. labels = BatchFile_cn_data_header_list()