コード例 #1
0
ファイル: views.py プロジェクト: grand-zz/epos
def edit(request):
    if request.method == 'GET':
        id = request.GET.get("id")
        # conn = pymysql.connect(host="localhost", user="******", passwd="root", db="mysql", charset='utf8')
        # cursor = conn.cursor(pymysql.cursors.DictCursor)
        # cursor.execute("SELECT id,rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz FROM b_peixunjieguo where id =%s", [id])
        # student = cursor.fetchone()
        # cursor.close()
        sql = "SELECT id,rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz FROM b_peixunjieguo where id =%s"
        with SQLPoll() as db:
            student = db.fetch_one(sql, id)
        return render(request, 'peixun/edit.html', {'student': student})
    else:
        id = request.POST.get('id', '')
        rq = request.POST.get('rq', '')
        dph = request.POST.get('dph', '')
        pp = request.POST.get('pp', '')
        xm = request.POST.get('xm', '')
        scfs = request.POST.get('scfs', '')
        xsfs = request.POST.get('xsfs', '')
        zf = request.POST.get('zf', '')
        bz = request.POST.get('bz', '')
        pxyy = request.POST.get('pxyy', '')
        qtbz = request.POST.get('qtbz', '')
        # conn = pymysql.connect(host="localhost", user="******", passwd="root", db="mysql", charset='utf8')
        # cursor = conn.cursor(pymysql.cursors.DictCursor)
        # cursor.execute("UPDATE b_peixunjieguo set rq=%s,dph=%s,pp=%s,xm=%s,scfs=%s,xsfs=%s,zf=%s,bz=%s,pxyy=%s,qtbz=%s where id =%s", [rq, dph, pp, xm, scfs, xsfs, zf, bz, pxyy, qtbz, id])
        # conn.commit()
        # cursor.close()
        sql = "UPDATE b_peixunjieguo set rq=%s,dph=%s,pp=%s,xm=%s,scfs=%s,xsfs=%s,zf=%s,bz=%s,pxyy=%s,qtbz=%s where id =%s"
        args = (rq, dph, pp, xm, scfs, xsfs, zf, bz, pxyy, qtbz, id)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #2
0
def edit(request):
    if request.method == 'GET':
        id = request.GET.get("id")
        sql = "SELECT id,clr,pwh,pp,gzlx,rq,sj,ms,clcs,wczt,syyqm,bz FROM b_epos where id =%s"
        with SQLPoll() as db:
            student = db.fetch_one(sql, id)
        return render(request, 'student/edit.html', {'student': student})
    else:
        id = request.POST.get('id', '')
        clr = request.POST.get('clr', '')
        pwh = request.POST.get('pwh', '')
        pp = request.POST.get('pp', '')
        gzlx = request.POST.get('gzlx', '')
        rq = request.POST.get('rq', '')
        sj = request.POST.get('sj', '')
        ms = request.POST.get('ms', '')
        clcs = request.POST.get('clcs', '')
        wczt = request.POST.get('wczt', '')
        syyqm = request.POST.get('syyqm', '')
        bz = request.POST.get('bz', '')
        sql = "UPDATE b_epos set clr=%s,pwh=%s,pp=%s,gzlx=%s,rq=%s,sj=%s,ms=%s,clcs=%s,wczt=%s,syyqm=%s,bz=%s where id =%s"
        args = (clr, pwh, pp, gzlx, rq, sj, ms, clcs, wczt, syyqm, bz, id)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #3
0
ファイル: views.py プロジェクト: grand-zz/epos
def find(request):
    request.encoding = 'utf-8'
    if 'rq1' in request.GET and request.GET['rq1']:
        rq1 = request.GET['rq1']
        rq2 = request.GET['rq1']
        pag = request.GET['pag']
        if pag:
            pag = int(pag)
        else:
            pag = 1
        rq1 = time.strftime("%Y.%m.%d", time.strptime(rq1, "%Y-%m-%d"))
        # sql ="SELECT id,rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz FROM b_peixunjieguo where rq =%s  ORDER BY rq"
        # conn = pymysql.connect(host="localhost", user="******", passwd="root", db="mysql", charset='utf8')
        # cursor = conn.cursor(pymysql.cursors.DictCursor)
        # cursor.execute(
        #     "SELECT id,rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz FROM b_peixunjieguo where rq =%s  ORDER BY rq",[rq1])
        # students = cursor.fetchall()
        # cursor.close()
        sql = "SELECT id,rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz FROM b_peixunjieguo where rq =%s  ORDER BY rq"
        with SQLPoll() as db:
            students = db.fetch_all(sql, rq1)
        p = Paginator(students, 10)
        students = p.get_page(pag)
        wz = "/peixun/find?rq1=" + rq2 + "&pag="
        page_num = p.page_range
        return render(request, 'peixun/index.html', {
            'students': students,
            'wz': wz,
            'page_num': page_num,
            'rq2': rq2
        })
    else:
        return redirect('../')
コード例 #4
0
ファイル: views.py プロジェクト: grand-zz/epos
def find(request):
    request.encoding = 'utf-8'
    if 'rq1' in request.GET and request.GET['rq1']:
        rq1 = request.GET['rq1']
        rq2 = request.GET['rq1']
        pag = request.GET['pag']
        if pag:
            pag = int(pag)
        else:
            pag = 1
        rq1 = time.strftime("%Y.%m.%d", time.strptime(rq1, "%Y-%m-%d"))
        sql = 'SELECT id,shh,pp,pwh,azlx,zjsl,azrq,zjry,bz  FROM b_zhuangjijilv where azrq =%s  ORDER BY azrq'
        with SQLPoll() as db:
            students = db.fetch_all(sql, rq1)
        p = Paginator(students, 10)
        students = p.get_page(pag)
        wz = "/zhuangji/find?rq1=" + rq2 + "&pag="
        page_num = p.page_range
        return render(request, 'zhuangji/index.html', {
            'students': students,
            'wz': wz,
            'page_num': page_num,
            'rq2': rq2
        })
    else:
        return redirect('../')
コード例 #5
0
ファイル: views.py プロジェクト: grand-zz/epos
def Pie_base(sql, titl) -> Pie:
    pie = Pie()
    # engine = create_engine("mysql+pymysql://root:root@localhost:3306/mysql", encoding="utf-8")
    # session = sessionmaker(bind=engine)
    # # sql= "select gzlx as 故障类型,count(1) as 数量 from b_epos where rq BETWEEN '%s' and '%s' group by gzlx"% (rq1, rq2)
    # df = pd.read_sql(sql, engine)
    # rows=df.values.tolist()
    # headers=df.columns.tolist()
    with SQLPoll() as db:
        students = db.fetch_all(sql, None)
    headers = []
    for student in students:
        headers = list(student.keys())
        break
    c = []
    rows = []
    for student in students:
        c = list(student.values())
        rows += [c]
    if len(rows) == 0:
        rows = [['无', 0]]
    pie.add("", rows)
    pie.set_global_opts(title_opts=opts.TitleOpts(title=titl))
    pie.set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {d}%"))
    return pie
コード例 #6
0
ファイル: views.py プロジェクト: grand-zz/epos
def table_base(sql, titl) -> Table:
    table = Table()
    # engine = create_engine("mysql+pymysql://root:root@localhost:3306/mysql", encoding="utf-8")
    # session = sessionmaker(bind=engine)
    # df = pd.read_sql(sql, engine)
    # rows=df.values.tolist()
    # headers=df.columns.tolist()
    with SQLPoll() as db:
        students = db.fetch_all(sql, None)
    headers = []
    for student in students:
        headers = list(student.keys())
        break
    c = []
    rows = []
    for student in students:
        c = list(student.values())
        rows += [c]
    if len(rows) == 0:
        headers = ['记录', '数量']
        rows = [['无', 0]]
    table.add(
        headers,
        rows).set_global_opts(title_opts=opts.ComponentTitleOpts(title=titl))
    return table
コード例 #7
0
ファイル: views.py プロジェクト: grand-zz/epos
def find(request):
    request.encoding = 'utf-8'
    if 'rq1' in request.GET and request.GET['rq1']:
        rq1 = request.GET['rq1']
        rq2 = request.GET['rq1']
        pag = request.GET['pag']
        if pag:
            pag = int(pag)
        else:
            pag = 1
        rq1 = time.strftime("%Y.%m.%d", time.strptime(rq1, "%Y-%m-%d"))
        sql = 'SELECT id,rq,sj,sfxs,zbry FROM b_xiaosha where rq =%s  ORDER BY rq,sj'
        with SQLPoll() as db:
            students = db.fetch_all(sql, rq1)
        p = Paginator(students, 10)
        students = p.get_page(pag)
        wz = "/xiaosha/find?rq1=" + rq2 + "&pag="
        page_num = p.page_range
        return render(request, 'xiaosha/index.html', {
            'students': students,
            'wz': wz,
            'page_num': page_num,
            'rq2': rq2
        })
    else:
        return redirect('../')
コード例 #8
0
ファイル: views.py プロジェクト: grand-zz/epos
def index(request):
    request.encoding = 'utf-8'
    pag = request.GET.get('pag')
    if pag:
        pag = int(pag)
    else:
        pag = 1
    rq2 = ''
    sql = "SELECT id,rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz FROM b_peixunjieguo ORDER BY rq"
    # conn = pymysql.connect(host="localhost", user="******", passwd="root", db="mysql", charset='utf8')
    # with conn.cursor(cursorclass=pymysql.cursors.DictCursor) as cursor:
    # cursor=conn.cursor(pymysql.cursors.DictCursor)
    # cursor.execute("SELECT id,rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz FROM b_peixunjieguo ORDER BY rq")
    # students = cursor.fetchall()
    # cursor.close()
    with SQLPoll() as db:
        students = db.fetch_all(sql, None)
    p = Paginator(students, 10)
    students = p.get_page(pag)
    page_num = p.page_range
    wz = "/peixun/?pag="
    return render(request, 'peixun/index.html', {
        'students': students,
        'wz': wz,
        'page_num': page_num,
        'rq2': rq2
    })
コード例 #9
0
ファイル: views.py プロジェクト: grand-zz/epos
def edit(request):
    if request.method == 'GET':
        id = request.GET.get("id")
        sql = "SELECT id,rq,sj,sfxs,zbry FROM b_xiaosha where id =%s"
        with SQLPoll() as db:
            student = db.fetch_one(sql, id)
        return render(request, 'xiaosha/edit.html', {'student': student})
    else:
        id = request.POST.get('id', '')
        rq = request.POST.get('rq', '')
        sj = request.POST.get('sj', '')
        sfxs = request.POST.get('sfxs', '')
        zbry = request.POST.get('zbry', '')
        sql = "UPDATE b_xiaosha set rq=%s,sj=%s,sfxs=%s,zbry=%s where id =%s"
        args = (rq, sj, sfxs, zbry, id)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #10
0
ファイル: views.py プロジェクト: grand-zz/epos
def delete(request):
    id = request.GET.get("id")
    # conn = pymysql.connect(host="localhost", user="******", passwd="root", db="mysql", charset='utf8')
    # cursor = conn.cursor(pymysql.cursors.DictCursor)
    # cursor.execute("DELETE FROM b_peixunjieguo WHERE id =%s", [id])
    # conn.commit()
    # cursor.close()
    sql = "DELETE FROM b_peixunjieguo WHERE id =%s"
    with SQLPoll() as db:
        db.execute(sql, id)
    return redirect('../')
コード例 #11
0
ファイル: views.py プロジェクト: grand-zz/epos
def edit(request):
    if request.method == 'GET':
        id = request.GET.get("id")
        sql = "SELECT id,xlqk,gzcl,xjr,shr,rq,bz FROM b_yysxj where id =%s"
        with SQLPoll() as db:
            student = db.fetch_one(sql, id)
        return render(request, 'yunyingshang/edit.html', {'student': student})
    else:
        id = request.POST.get('id', '')
        xlqk = request.POST.get('xlqk', '')
        gzcl = request.POST.get('gzcl', '')
        xjr = request.POST.get('xjr', '')
        shr = request.POST.get('shr', '')
        rq = request.POST.get('rq', '')
        bz = request.POST.get('bz', '')
        sql = "UPDATE b_yysxj set xlqk=%s,gzcl=%s,xjr=%s,shr=%s,rq=%s,bz=%s where id =%s"
        args = (xlqk, gzcl, xjr, shr, rq, bz, id)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #12
0
ファイル: views.py プロジェクト: grand-zz/epos
def edit(request):
    if request.method == 'GET':
        id = request.GET.get("id")
        sql ="SELECT id,sjbh,sbxlqk,sbwd,gzcl,xjr,shr,rq FROM b_shujingxj where id =%s"
        with SQLPoll() as db:
            student = db.fetch_one(sql, id)
        return render(request, 'shujing/edit.html', {'student': student})
    else:
        id = request.POST.get('id', '')
        sjbh = request.POST.get('sjbh', '')
        sbxlqk = request.POST.get('sbxlqk', '')
        sbwd = request.POST.get('sbwd', '')
        gzcl = request.POST.get('gzcl', '')
        xjr = request.POST.get('xjr', '')
        shr = request.POST.get('shr', '')
        rq = request.POST.get('rq', '')
        sql ="UPDATE b_shujingxj set sjbh=%s,sbxlqk=%s,sbwd=%s,gzcl=%s,xjr=%s,shr=%s,rq=%s where id =%s"
        args=(sjbh,sbxlqk,sbwd,gzcl,xjr,shr,rq, id)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #13
0
ファイル: views.py プロジェクト: grand-zz/epos
def add(request):
    if request.method == 'GET':
        return render(request, 'xiaosha/add.html')
    else:
        rq = request.POST.get('rq', '')
        sj = request.POST.get('sj', '')
        sfxs = request.POST.get('sfxs', '')
        zbry = request.POST.get('zbry', '')
        sql = "INSERT INTO b_xiaosha (rq,sj,sfxs,zbry) values (%s,%s,%s,%s)"
        args = (rq, sj, sfxs, zbry)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #14
0
ファイル: views.py プロジェクト: grand-zz/epos
def edit(request):
    if request.method == 'GET':
        id = request.GET.get("id")
        sql = "SELECT id,shh,pp,pwh,azlx,zjsl,azrq,zjry,bz FROM b_zhuangjijilv where id =%s"
        with SQLPoll() as db:
            student = db.fetch_one(sql, id)
        return render(request, 'zhuangji/edit.html', {'student': student})
    else:
        id = request.POST.get('id', '')
        shh = request.POST.get('shh', '')
        pp = request.POST.get('pp', '')
        pwh = request.POST.get('pwh', '')
        azlx = request.POST.get('azlx', '')
        zjsl = request.POST.get('zjsl', '')
        azrq = request.POST.get('azrq', '')
        zjry = request.POST.get('zjry', '')
        bz = request.POST.get('bz', '')
        sql = "UPDATE b_zhuangjijilv set shh=%s,pp=%s,pwh=%s,azlx=%s,zjsl=%s,azrq=%s,zjry=%s,bz=%s where id =%s"
        args = (shh, pp, pwh, azlx, zjsl, azrq, zjry, bz, id)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #15
0
ファイル: views.py プロジェクト: grand-zz/epos
def add(request):
    if request.method == 'GET':
        return render(request, 'yunyingshang/add.html')
    else:
        xlqk = request.POST.get('xlqk', '')
        gzcl = request.POST.get('gzcl', '')
        xjr = request.POST.get('xjr', '')
        shr = request.POST.get('shr', '')
        rq = request.POST.get('rq', '')
        bz = request.POST.get('bz', '')
        sql = "INSERT INTO b_yysxj (xlqk,gzcl,xjr,shr,rq,bz) values (%s,%s,%s,%s,%s,%s)"
        args = (xlqk, gzcl, xjr, shr, rq, bz)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #16
0
ファイル: views.py プロジェクト: grand-zz/epos
def add(request):
    if request.method == 'GET':
        return render(request, 'shujing/add.html')
    else:
        sjbh = request.POST.get('sjbh', '')
        sbxlqk = request.POST.get('sbxlqk', '')
        sbwd = request.POST.get('sbwd', '')
        gzcl = request.POST.get('gzcl', '')
        xjr = request.POST.get('xjr', '')
        shr = request.POST.get('shr', '')
        rq = request.POST.get('rq', '')
        sql ="INSERT INTO b_shujingxj (sjbh,sbxlqk,sbwd,gzcl,xjr,shr,rq) values (%s,%s,%s,%s,%s,%s,%s)"
        args=(sjbh, sbxlqk, sbwd, gzcl, xjr, shr, rq)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #17
0
ファイル: views.py プロジェクト: grand-zz/epos
def add(request):
    if request.method == 'GET':
        return render(request, 'zhuangji/add.html')
    else:
        shh = request.POST.get('shh', '')
        pp = request.POST.get('pp', '')
        pwh = request.POST.get('pwh', '')
        azlx = request.POST.get('azlx', '')
        zjsl = request.POST.get('zjsl', '')
        azrq = request.POST.get('azrq', '')
        zjry = request.POST.get('zjry', '')
        bz = request.POST.get('bz', '')
        sql = "INSERT INTO b_zhuangjijilv (shh,pp,pwh,azlx,zjsl,azrq,zjry,bz) values (%s,%s,%s,%s,%s,%s,%s,%s)"
        args = (shh, pp, pwh, azlx, zjsl, azrq, zjry, bz)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #18
0
def add(request):
    if request.method == 'GET':
        return render(request, 'student/add.html')
    else:
        clr = request.POST.get('clr', '')
        pwh = request.POST.get('pwh', '')
        pp = request.POST.get('pp', '')
        gzlx = request.POST.get('gzlx', '')
        rq = request.POST.get('rq', '')
        sj = request.POST.get('sj', '')
        ms = request.POST.get('ms', '')
        clcs = request.POST.get('clcs', '')
        wczt = request.POST.get('wczt', '')
        syyqm = request.POST.get('syyqm', '')
        bz = request.POST.get('bz', '')
        sql = "INSERT INTO b_epos (clr,pwh,pp,gzlx,rq,sj,ms,clcs,wczt,syyqm,bz) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
        args = (clr, pwh, pp, gzlx, rq, sj, ms, clcs, wczt, syyqm, bz)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #19
0
ファイル: views.py プロジェクト: grand-zz/epos
def index(request):
    request.encoding = 'utf-8'
    pag = request.GET.get('pag')
    if pag:
        pag = int(pag)
    else:
        pag = 1
    rq2 = ''
    sql = 'SELECT id,shh,pp,pwh,azlx,zjsl,azrq,zjry,bz FROM b_zhuangjijilv ORDER BY azrq'
    with SQLPoll() as db:
        students = db.fetch_all(sql, None)
    p = Paginator(students, 10)
    students = p.get_page(pag)
    page_num = p.page_range
    wz = "/zhuangji/?pag="
    return render(request, 'zhuangji/index.html', {
        'students': students,
        'wz': wz,
        'page_num': page_num,
        'rq2': rq2
    })
コード例 #20
0
ファイル: views.py プロジェクト: grand-zz/epos
def index(request):
    request.encoding = 'utf-8'
    pag = request.GET.get('pag')
    if pag:
        pag = int(pag)
    else:
        pag = 1
    rq2 = ''
    sql = 'SELECT id,xlqk,gzcl,xjr,shr,rq,bz FROM b_yysxj ORDER BY rq'
    with SQLPoll() as db:
        students = db.fetch_all(sql, None)
    p = Paginator(students, 10)
    students = p.get_page(pag)
    page_num = p.page_range
    wz = "/yunyingshang/?pag="
    return render(request, 'yunyingshang/index.html', {
        'students': students,
        'wz': wz,
        'page_num': page_num,
        'rq2': rq2
    })
コード例 #21
0
ファイル: views.py プロジェクト: grand-zz/epos
def index(request):
    request.encoding = 'utf-8'
    pag = request.GET.get('pag')
    if pag:
        pag = int(pag)
    else:
        pag = 1
    rq2 = ''
    sql = 'SELECT id,rq,sj,sfxs,zbry FROM b_xiaosha ORDER BY rq,sj'
    with SQLPoll() as db:
        students = db.fetch_all(sql, None)
    p = Paginator(students, 10)
    students = p.get_page(pag)
    page_num = p.page_range
    wz = "/xiaosha/?pag="
    return render(request, 'xiaosha/index.html', {
        'students': students,
        'wz': wz,
        'page_num': page_num,
        'rq2': rq2
    })
コード例 #22
0
def index(request):
    request.encoding = 'utf-8'
    pag = request.GET.get('pag')
    if pag:
        pag = int(pag)
    else:
        pag = 1
    rq2 = ''
    sql = 'SELECT id,clr,pwh,pp,gzlx,rq,sj,ms,clcs,wczt,syyqm,bz FROM b_epos ORDER BY rq,sj'
    with SQLPoll() as db:
        students = db.fetch_all(sql, None)
    p = Paginator(students, 8)
    students = p.get_page(pag)
    page_num = p.page_range
    wz = "/epos/?pag="
    return render(request, 'student/index.html', {
        'students': students,
        'wz': wz,
        'page_num': page_num,
        'rq2': rq2
    })
コード例 #23
0
ファイル: views.py プロジェクト: grand-zz/epos
def add(request):
    if request.method == 'GET':
        return render(request, 'peixun/add.html')
    else:
        rq = request.POST.get('rq', '')
        dph = request.POST.get('dph', '')
        pp = request.POST.get('pp', '')
        xm = request.POST.get('xm', '')
        scfs = request.POST.get('scfs', '')
        xsfs = request.POST.get('xsfs', '')
        zf = request.POST.get('zf', '')
        bz = request.POST.get('bz', '')
        pxyy = request.POST.get('pxyy', '')
        qtbz = request.POST.get('qtbz', '')
        # conn = pymysql.connect(host="localhost", user="******", passwd="root", db="mysql", charset='utf8')
        # cursor = conn.cursor(pymysql.cursors.DictCursor)
        # cursor.execute("INSERT INTO b_peixunjieguo (rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",[rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz])
        # conn.commit()
        # cursor.close()
        sql = "INSERT INTO b_peixunjieguo (rq,dph,pp,xm,scfs,xsfs,zf,bz,pxyy,qtbz) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
        args = (rq, dph, pp, xm, scfs, xsfs, zf, bz, pxyy, qtbz)
        with SQLPoll() as db:
            db.execute(sql, args)
        return redirect('../')
コード例 #24
0
ファイル: views.py プロジェクト: grand-zz/epos
def delete(request):
    id = request.GET.get("id")
    sql = "DELETE FROM b_xiaosha WHERE id =%s"
    with SQLPoll() as db:
        db.execute(sql, id)
    return redirect('../')