def get_branch_sku_list(current_page, page_size, search_data=None, exact=True): start_num = (current_page - 1) * page_size end_num = start_num + page_size - 1 condition = get_search_data_sql(search_data, exact) sql = """ SELECT a.* FROM ( SELECT row_number () OVER ( ORDER BY proid ) AS row_num, pcb.ClassName AS big_class_name, pc.ClassName, pd.BrandName, vbp.* FROM v_branch_product vbp LEFT JOIN product_class pcb ON vbp.bigclass= pcb.ClassId LEFT JOIN product_class pc ON vbp.classid= pc.ClassId LEFT JOIN product_brand pd ON vbp.BrandId= pd.BrandId {2} ) a WHERE a.row_num BETWEEN {0} AND {1} """ sql = sql.format(start_num, end_num, condition) # print(sql) res = result_by_query(sql) return res
def get_branch_by_code(branchcode): sql = """ SELECT * FROM branch WHERE BraType='0' AND Status='0' and braid='{0}' ORDER BY BraName,braid """ sql = sql.format(branchcode) rst = result_by_query(sql) return rst
def query_branch_section_menu(): sql = """ SELECT cast (id as int) AS centid, cast(id_child as int) AS sectionid ,menutext AS sectionname FROM system_function_mobile WHERE id_child_child=0 and isnull(Flag,'0')='1' ORDER BY id,id_child """ rst = result_by_query(sql) return rst
def get_sku_all(): sql = """ SELECT a.* FROM ( SELECT row_number () OVER ( ORDER BY proid ) AS row_num,* FROM product ) a WHERE a.row_num BETWEEN 1 AND 50 """ res = result_by_query(sql) return res
def query_branch_function_menu(centid, sectionid): # 0 1 POS # 2 2 商品管理 # 2 4 价格管理 # 2 5 促销管理 sql = """ SELECT CAST (id*1000+id_child*100+id_child_child AS INT) AS functionid ,menutext AS functionname ,isnull(iconname,'') as iconname ,isnull(methodname,'') as methodname FROM system_function_mobile WHERE id_child_child NOT IN (0,-1) and id={0} AND id_child={1} and isnull(Flag,'0')='1' """ sql = sql.format(centid, sectionid) rst = result_by_query(sql) return rst
def get_sku_list(current_page, page_size, search_data=None, exact=True): start_num = (current_page - 1) * page_size end_num = start_num + page_size - 1 condition = get_search_data_sql(search_data, exact) sql = """ SELECT a.* FROM ( SELECT row_number () OVER ( ORDER BY proid ) AS row_num,* FROM product {2} ) a WHERE a.row_num BETWEEN {0} AND {1} """ sql = sql.format(start_num, end_num, condition) # print(sql) res = result_by_query(sql) return res
def get_sku_by_proid(proid): sql = """ SELECT row_number () OVER ( ORDER BY proid ) AS row_num,* FROM product """ #判断店内码还是国际码 if proid[0] == '2': condtion = """ where proid ='{0}' """ else: condtion = """ where barcode ='{0}' """ sql = sql + condtion sql = sql.format(proid) res = result_by_query(sql) return res
def get_branch_all(): sql = " SELECT * FROM branch WHERE BraType='0' AND Status='0' ORDER BY BraName,braid " res = result_by_query(sql) return res