def get_iphone_info(self, table_name, IEMI): try: sql = "SELECT istorage, color, grade FROM trillion.%s WHERE IEMI=%s AND bstorage='1';" % (table_name, IEMI) iphone_info = CommonDao.search_option(self, sql) return iphone_info except: pass
def get_iphone_info_theory(self, table_name, product_line): try: sql = f"SELECT productlines, istorage, color FROM trillion.{table_name} WHERE productlines='{product_line}' and bstorage='1';" iphone_info = CommonDao.search_option(self, sql) return iphone_info except: pass
def get_iphone_info(self, table_name, IEMI): try: sql = "SELECT productlines, istorage, color, bstorage FROM trillion.%s WHERE IEMI=%s;" % (table_name, IEMI) iphone_info = CommonDao.search_option(self, sql) return iphone_info except: pass
def check_transfer_sum_count(self, table_name, start_time, end_time): try: sql = f"SELECT COUNT(IEMI) FROM trillion.{table_name} WHERE bool='0' AND changetime BETWEEN '{start_time}' AND '{end_time}';" result = CommonDao.search_option(self, sql) return result except: pass
def get_color_count(self, table_name, storage, color): try: sql = "SELECT COUNT(IEMI) FROM trillion.%s WHERE bstorage='1' AND istorage='%s' AND color='%s';" % (table_name, storage, color) color_count = CommonDao.search_option(self, sql) return color_count except: pass
def get_iphone_info_all_actual(self, table_name): try: sql = f"SELECT productlines, istorage, color FROM trillion.{table_name} WHERE forinventory='1';" iphone_info = CommonDao.search_option(self, sql) return iphone_info except: pass
def get_all_count(self, table_name): try: sql = "SELECT COUNT(IEMI) FROM trillion.%s WHERE bstorage='1';" % table_name print(sql) all_count = CommonDao.search_option(self, sql) return all_count except: pass
def get_iphone_info(self, table_name, IEMI): try: sql = "SELECT istorage, color, company, intime, productlines, remarks, grade, outtime, bstorage, selller, tocompany FROM trillion.%s WHERE IEMI=%s;" % ( table_name, IEMI) iphone_info = CommonDao.search_option(self, sql) return iphone_info except: pass
def get_storage_count_condition(self, table_name, storage, para, condition): try: if condition == "": sql = f"SELECT COUNT(IEMI) FROM trillion.{table_name} WHERE bstorage='1' AND istorage='{storage}' AND grade is Null;" else: sql = f"SELECT COUNT(IEMI) FROM trillion.{table_name} WHERE bstorage='1' AND istorage='{storage}' AND {para}='{condition}';" storage_count_condition = CommonDao.search_option(self, sql) return storage_count_condition except: pass
def get_product_lines(self): try: sql = "SELECT productlines FROM trillion.productlines;" product_lines = CommonDao.search_option(self, sql) if isinstance(product_lines, list): return product_lines else: product_lines = self.com_db.get_local_data("productlines") return product_lines except: product_lines = self.com_db.get_local_data("productlines") return product_lines
def get_iphone_type(self): try: sql = "SELECT iphonetype FROM trillion.iphonetype;" iphone_type = CommonDao.search_option(self, sql) if isinstance(iphone_type, list): return iphone_type else: iphone_type = self.com_db.get_local_data("iphonetype") return iphone_type except: iphone_type = self.com_db.get_local_data("iphonetype") return iphone_type
def get_all_count_condition(self, table_name, para, condition): try: if condition == "": sql = f"SELECT COUNT(IEMI) FROM trillion.{table_name} WHERE bstorage='1' AND grade is Null;" else: sql = "SELECT COUNT(IEMI) FROM trillion.%s WHERE bstorage='1' AND %s='%s';" % (table_name, para, condition) print(sql) all_count_condition = CommonDao.search_option(self, sql) return all_count_condition except: pass
def get_iphone_color(self): try: sql = "SELECT iphonecolor FROM trillion.iphonecolor;" iphone_color = CommonDao.search_option(self, sql) if isinstance(iphone_color, list): return iphone_color else: iphone_color = self.com_db.get_local_data("iphonecolor") return iphone_color except: iphone_color = self.com_db.get_local_data("iphonecolor") return iphone_color
def get_in_company(self): try: sql = "SELECT incompany FROM trillion.incompany;" in_company = CommonDao.search_option(self, sql) if isinstance(in_company, list): return in_company else: in_company = self.com_db.get_local_data("incompany") return in_company except: in_company = self.com_db.get_local_data("incompany") return in_company