Пример #1
0
def main():
    db = MySQL()
    sql = """select id,vendor_num from vendor where serial_no in (
"32FFD9054D4E383930760451", "51FF70067580505152530267", "48FF6C066666575136441067", "32006D063141333023100143", "48FF6F065184565122212587", "30FF6B063050333553462043", "52FF6F066765505035120767", "48FF76065184565159321887", "56FF77067067495046401667", "54FF6E067087505652290667", "48FF75065184565119371887", "48FF70065184565157241887", "51FF6B067580505111350167", "32FF6B06344D353318531357", "49FF6B065070495231520587", "48FF70065184565133561887", "51FF72065078565538530387"
) order by vendor_num"""
    rows = db.get_data_by_sql(sql)
    for row in rows:
        createQRCode(row[0], row[1])

    print "完成"
Пример #2
0
 def __init__(self):
     self.vendor_nums = "'1000008', '1000007', '1000006', '1000004', '1000005', '1000009', '1000010', '1000014', '1000015', " \
                   "'1000016', '1000017', '1000019', '1000011', '1000127', '1000348', '1000126', '1000339', '1000125', " \
                   "'1000108', '1000023', '1000068', '1000135', '1000102', '1000061', '1000342', '1000083', '1000121', " \
                   "'1000034', '1000063', '1000033', '1000052', '1000060', '1000070', '1000069', '1000122', '1000018', " \
                   "'1000020', '1000012', '1000106', '1000117', '1000123', '1000124', '1000128', '1000055', '1000041', " \
                   "'1000029', '1000030', '1000079', '1000130', '1000338', '1000075', '1000092'"
     self.database = MySQLUtil()
     self.date = datetime.datetime.now().strftime('%Y-%m-%d')
Пример #3
0
# -*- coding: UTF-8 -*-

from mysql.online import MySQL

db = MySQL()

employee_id_2_time = {}


def handle(record, num):
    withdraw_cash_record_id = record[0]
    employee_id = record[1]
    commit_time = record[2]
    withdraw_value = record[3]

    # get_cover_list_sql = "select sum(order_price) from mw_order where cover_id in (select id from cover where operate_bd = '%s') " \
    #                      "and order_status = 5 and pay_time < '%s'" % (employee_id, commit_time)

    get_order_ids_sql = "select id,min(out_time),max(out_time) from mw_order where cover_id in (select id from cover where operate_bd = '%s') " \
                    "and order_status = 5 and pay_time < '%s'" % (employee_id, commit_time)

    if employee_id_2_time.has_key(employee_id):
        end_time = "and pay_time > '%s'" % employee_id_2_time[employee_id]
        # get_cover_list_sql = get_cover_list_sql + end_time
        get_order_ids_sql = get_order_ids_sql + end_time

    employee_id_2_time[employee_id] = commit_time

    # total = db.get_data_by_sql(get_cover_list_sql)

    # print get_cover_list_sql
Пример #4
0
# -*- coding: UTF-8 -*-

import SimpleHttpClient
from mysql.online import MySQL

http = SimpleHttpClient.SimpleHttpClient("9e2402ba-6703-11e7-a5fa-9801a79f70e5_498129b4-29ae-41c5-b021-9e0b6de0b53f")

db = MySQL()

rows = db.get_data_by_sql("select id from sku_ranking where cover_id = 'b181f760-a7b3-4a7f-a979-81c761332618'")

# for row in rows:
#     result = http.get("http://st.mwoperation.meiweishenghuo.com/api/probe/updateSkuRanking", {"skuRankingId": row[0]})
#     print result.text

Пример #5
0
# -*- coding: UTF-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from mysql.online import MySQL


db = MySQL()
employee_id = "70b7ec63-99bc-4f24-b0bf-4efb5fc01e72"

cover_sql = "select c.nick_name,v.vendor_num from cover c join vendor v on c.vendor_id = v.id where c.id in (select cover_id from cover_employee_manager where employee_id = '%s')" % employee_id

cover_rows = db.get_data_by_sql(cover_sql)

for cover in cover_rows:
    print "点位编号:%s  昵称:%s" % (cover[1],cover[0])

trader_sql = "select jt.balance,e.employee_name from joining_trader jt join employee e on jt.employee_id = e.id where e.id = '%s'" % employee_id

trader = db.get_data_by_sql(trader_sql)

print "加盟商:%s   余额:%s" % (trader[0][1],trader[0][0])






Пример #6
0
class ProductData:
    def __init__(self):
        self.vendor_nums = "'1000008', '1000007', '1000006', '1000004', '1000005', '1000009', '1000010', '1000014', '1000015', " \
                      "'1000016', '1000017', '1000019', '1000011', '1000127', '1000348', '1000126', '1000339', '1000125', " \
                      "'1000108', '1000023', '1000068', '1000135', '1000102', '1000061', '1000342', '1000083', '1000121', " \
                      "'1000034', '1000063', '1000033', '1000052', '1000060', '1000070', '1000069', '1000122', '1000018', " \
                      "'1000020', '1000012', '1000106', '1000117', '1000123', '1000124', '1000128', '1000055', '1000041', " \
                      "'1000029', '1000030', '1000079', '1000130', '1000338', '1000075', '1000092'"
        self.database = MySQLUtil()
        self.date = datetime.datetime.now().strftime('%Y-%m-%d')

    def get_group_dict(self):
        database = self.database
        sql = "select id,group_name from goods_group where id in (select distinct group_id from cover_menu " \
              "where cover_menu_status = 1 and  vendor_id in (select id from vendor where vendor_num in " \
              "(%s))) order by goods_group_num desc;" % self.vendor_nums
        result = database.get_data_by_sql(sql)
        groups = {}
        for row in result:
            groups[row[0]] = row[1]
        return groups

    def get_excel_title(self):
        self.title = {
            "cover_name": {
                "columnNum": 0,
                "titleName": "点位昵称"
            },
            "replenishment": {
                "columnNum": 1,
                "titleName": "补货量"
            },
            "storage": {
                "columnNum": 2,
                "titleName": "剩余量"
            }
        }
        groups = self.get_group_dict()
        column_num = 3
        for key, value in groups.items():
            self.title[key] = {"columnNum": column_num, "titleName": value}
            column_num += 1
        print self.title

    def get_replenishment_amount(self, vendor_id):
        sql = "select count(distinct storage_id) from replenishment_record where vendor_id = %s and record_type = 1 and date(record_time) = date(%s);" % (
            vendor_id, self.date)
        result = self.database.get_data_by_sql(sql)
        return result[0]

    def get_replenishment_group_amount(self, vendor_id):
        sql = "select new_value,count(distinct storage_id) from replenishment_record where vendor_id = %s and record_type = 1 and date(record_time) = date(%s) group by new_value" % (
            vendor_id, self.date)
        results = self.database.get_data_by_sql(sql)
        group = {}
        for result in results:
            group[result[0]] = result[1]
        return group

    def get_storage_amount(self, vendor_id):
        sql = "select count(id) from storage where vendor_id = %s and storage_status = 1;" % vendor_id
        result = self.database.get_data_by_sql(sql)
        return result[0]

    def get_storage_group_amount(self, vendor_id):
        sql = "select group_id,count(id) from storage where vendor_id = %s and storage_status = 1 group by group_id;" % vendor_id
        results = self.database.get_data_by_sql(sql)
        storage = {}
        for result in results:
            storage[result[0]] = result[1]
        return storage