1234567891011121314151617181920212223 |
- from src.models.storage_turn_model import storage_turn_model
- from src.logic.abstract_process import abstract_process
- class process_turn(abstract_process):
- @classmethod
- def create(self, transactions):
- """Создать обработку"""
- res = dict()
- for t in transactions:
- k = (t.warehouse, t.nomenclature, t.measurement_unit)
- v = t.amount * t.transaction_type
- if k in res.keys():
- res[k] += v
- else:
- res[k] = v
- ts = list()
- for k, v in res.items():
- t = storage_turn_model("Turn", k[0], v, k[1], k[2])
- ts.append(t)
- return ts
|