# -*- coding: utf-8 -*- # @Time : 2023/9/27 19:13 # @Author : tx # @File : report_put_in.py # @Description : 入库统计报表导出 from helper.export.base import ReportExport from helper.report import report_put_in_drug class ReportPutIn1(ReportExport): def __init__(self, request, keyword): super().__init__() self.title = "入库验收记录" self.stateDict = {0: "待入库", 1: "在库", 2: "出库", 3: "空瓶", 4: "报废"} self.request = request self.keyword = keyword async def parse_data(self, request, keyword): keyword.page_no = 0 result = await report_put_in_drug(request, keyword) print("result", result) self.drug_attribute_key_list = result.get("attribute_key") if result.get("attribute_key") else [] return result.get("data") def parse_key_finds_list(self): """ 解析键列名 :return: """ key_list = ["expired_at","manufacturer","distribution","total_count","info","ysr","storage_at","jg"] finds_list = ["有效期","生产厂商","经销单位","数量","验收记录","验收人","日期", "结果"] self.key_list = self.drug_attribute_key_list + key_list self.finds_list = self.drug_attribute_key_list + finds_list async def main(self): """ 主函数 :param kwargs: :return: """ self.data_list = await self.parse_data(self.request, self.keyword) self.parse_key_finds_list()