Esempio n. 1
0
    def get_sort_basa(self):
        res = self.get_basa(fun2=1)
        ff = self.get_price()

        def com_l(d, element):
            if element:
                for x in d:
                    if x.code == element:
                        return True, x
                return False, pd.DataFrame()
            else:
                return False, pd.DataFrame()

        list_erc = []
        for x in ff:
            s1, s2 = com_l(res.iloc, x)
            if s1:
                if (float(price_test(
                        s2.sprice))) > 0 and (float(price_test(
                            s2.rprice))) / (float(price_test(s2.sprice))) < 3:
                    s2.sprice = round(
                        float(price_test(s2.sprice)) / self.usd_ua, 1)
                list_erc.append(s2)
            else:
                list_erc.append(pd.DataFrame())
        return list_erc
Esempio n. 2
0
    def send_res(self, w=0):
        try:
            with open("dict_file.json", "r") as read_file:
                data = json.load(read_file)
        except Exception as e:
            print(e)
            data = {}

        dict_serj = {'mti': ("J2:J2000", "K5:K1500", 9, 10)}
        dict_it = {}

        res = self.get_basa()
        print('ok... MTI loaded')

        for x in res.iloc:
            if self.usd_ua:
                if x.store in ('-', '0', '1') or not x.store:
                    dict_it[artile_test(x.partnum)] = (round(
                        float(price_test(x.price_uah_order)) / self.usd_ua,
                        1), 1)
                else:
                    dict_it[artile_test(x.partnum)] = (round(
                        float(price_test(x.price_uah_order)) / self.usd_ua,
                        1), 0)
                #dict_it[artile_test(x.partnum)] = round(float(price_test(x.price_uah_order))/self.usd_ua, 1)
            else:
                dict_it[artile_test(x.partnum)] = price_test(x.price_uah_order)

        try:
            list_get_list = get_list_sheet("Price", "B5:B1000")
        except:
            print('not received get_list_sheet')
            list_get_list = []

        dict_for_paint = send_all(data,
                                  dict_it,
                                  list_get_list,
                                  dict_serj['mti'],
                                  wait=w)
        print('ok... MTI sended')
        return dict_for_paint
Esempio n. 3
0
    def send_res(self, w=0):
        try:
            with open("dict_file.json", "r") as read_file:
                data = json.load(read_file)
        except Exception as e:
            print(e)
            data = {}

        dict_serj = {'erc': ("I2:I2000", "J5:J1500", 8, 9)}
        dict_it = {}

        res = self.get_basa()
        print('ok... ERC loaded')

        for x in res.iloc:
            if self.usd_ua:
                if (float(price_test(
                        x.sprice))) > 0 and (float(price_test(
                            x.rprice))) / (float(price_test(x.sprice))) < 3:
                    if x.swh and x.swh != 'Нет':
                        dict_it[artile_test(x.code)] = (round(
                            float(price_test(x.sprice)) / self.usd_ua, 1), 0)
                    else:
                        dict_it[artile_test(x.code)] = (round(
                            float(price_test(x.sprice)) / self.usd_ua, 1), 1)
                    #dict_it[artile_test(x.code)] = round(float(price_test(x.sprice))/self.usd_ua, 1)
                else:
                    if x.swh and x.swh != 'Нет':
                        dict_it[artile_test(x.code)] = (round(
                            float(price_test(x.sprice)), 1), 0)
                    else:
                        dict_it[artile_test(x.code)] = (round(
                            float(price_test(x.sprice)), 1), 1)
                    #dict_it[artile_test(x.code)] = round(float(price_test(x.sprice)), 1)
            else:
                dict_it[artile_test(x.code)] = price_test(x.sprice)

        try:
            list_get_list = get_list_sheet("Price", "B5:B1000")
        except:
            print('not received get_list_sheet')
            list_get_list = []

        dict_for_paint = send_all(data,
                                  dict_it,
                                  list_get_list,
                                  dict_serj['erc'],
                                  wait=w)
        print('ok... ERC sended')
        return dict_for_paint
Esempio n. 4
0
    def send_res(self, w=0):
        try:
            with open("dict_file.json", "r") as read_file:
                data = json.load(read_file)
        except Exception as e:
            print(e)
            data = {}

        dict_serj = {'elko': ("K2:K2000", "L5:L1500", 10, 11)}
        dict_it = {}

        res = self.get_basa()
        print('ok... Elko loaded')

        for x in res.iloc:
            if self.usd_ua:
                if x.quantity == '0' or not x.quantity:
                    dict_it[artile_test(x.manufacturerCode)] = (round(
                        float(price_test(x.price)) / self.usd_ua, 1), 1)
                else:
                    dict_it[artile_test(x.manufacturerCode)] = (round(
                        float(price_test(x.price)) / self.usd_ua, 1), 0)
            else:
                dict_it[artile_test(x.manufacturerCode)] = price_test(x.price)

        try:
            list_get_list = get_list_sheet("Price", "B5:B1000")
        except:
            print('not received get_list_sheet')
            list_get_list = []

        dict_for_paint = send_all(data,
                                  dict_it,
                                  list_get_list,
                                  dict_serj['elko'],
                                  wait=w)
        print('ok... Elko sended')
        return dict_for_paint
Esempio n. 5
0
    def get_sort_basa(self):
        res = self.get_basa(fun2=1)
        ff = self.get_price()

        def com_l(d, element):
            if element:
                for x in d:
                    if x.partnum == element:
                        return True, x
                return False, pd.DataFrame()
            else:
                return False, pd.DataFrame()

        list_mti = []
        for x in ff:
            s1, s2 = com_l(res.iloc, x)
            if s1:
                s2.price_uah_order = round(
                    float(price_test(s2.price_uah_order)) / self.usd_ua, 1)
                list_mti.append(s2)
            else:
                list_mti.append(pd.DataFrame())
        return list_mti