12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- # -*- coding: utf-8 -*-
- from .query_model_helper import QueryModelHelper
- class TestHelper:
- def __init__(self, env, get_model_from_func, detail_field, reference_field):
- self._env = env
- self._get_model_from = get_model_from_func
- self._detail_field = detail_field
- self._reference_field = reference_field
- pass
- def do(self):
- test = self._get_model_from(self._detail_field, self._reference_field,False)
- show_field_setting = [FieldSetting('jc_supply_chain_sale_order.name', '订单编号', 1),
- FieldSetting('jc_supply_chain_sale_order.bill_state', None, 2),
- FieldSetting('jc_supply_chain_sale_order.date', None, 7),
- FieldSetting('c_supply_chain_sale_order_detail.goods_id', None, 11),
- FieldSetting('jc_supply_chain_sale_order_detail.price', None, 21),
- FieldSetting('jc_supply_chain_sale_order_detail.money', None, 30, True, True),
- FieldSetting('jc_supply_chain_sale_order.customer_name', None, 3),
- FieldSetting('aaa', None, 2),
- FieldSetting('bbb', None, 2),
- FieldSetting('ccc', None, 2),
- FieldSetting('ddd', None, 2),
- FieldSetting('eee', None, 2),
- FieldSetting('fff', None, 2),
- FieldSetting('ggg', None, 2)]
- condition_field_setting = [
- FieldSetting('jc_supply_chain_sale_order.name', '订单编号', 1),
- FieldSetting('jc_supply_chain_sale_order.bill_state', None, 2),
- FieldSetting('jc_supply_chain_sale_order.date', None, 7),
- FieldSetting('c_supply_chain_sale_order_detail.goods_id', None, 11),
- FieldSetting('jc_supply_chain_sale_order_detail.price', None, 21),
- FieldSetting('jc_supply_chain_sale_order_detail.money', None, 30),
- FieldSetting('jc_supply_chain_sale_order.customer_name', None, 3),
- FieldSetting('aaa', None, 2),
- FieldSetting('bbb', None, 2),
- ]
- helper2 = QueryModelHelper(self._env, test)
- search_field_list = ['jc_supply_chain_sale_order.name', 'jc_supply_chain_sale_order.bill_state',
- 'jc_supply_chain_sale_order.date', 'jc_supply_chain_sale_order_detail.goods_id',
- 'jc_supply_chain_sale_order_detail.price', 'jc_supply_chain_sale_order_detail.money',
- 'jc_supply_chain_sale_order.customer_name']
- helper2.set_query_fields_list(search_field_list)
- helper2.set_setting(show_field_setting, condition_field_setting, [2], [])
- res = helper2.execute_query()
- print('execute result:', res)
- return
- class FieldSetting:
- def __init__(self, field, new_name, sequence, is_sum=False, is_number=False):
- self.field = field
- self.new_show_name = new_name
- self.sequence = sequence
- self.is_sum = is_sum
- self.is_number = is_number
- return
- def get_is_sum(self):
- return self.is_sum if self.is_number else False
|