动态 版块 发帖 消息 我的
xwylt
书山有路勤为径,学海无涯苦作舟
子版块
lytcreate
59
new.py
 0   0  7天前
lytcreate
80
cursor.execute("select COUNT(*) as cya from aqk_sot where sotintime between %s and %s and sotdepartment='冲压PR'",[benyuestart,benyueend,]) cy_zs = cursor.fetchone() cursor.execute("select COUNT(*) as cyb from aqk_sot where sotintime between %s and %s and sotdepartment='冲压PR' and state='关闭'",[benyuestart,benyueend,]) cy_gb = cursor.fetchone() if cy_zs['cya'] == 0: cyzgl = 100 else: cyzgl = round(cy_gb['cyb']/cy_zs['cya'],2)*100 cy_list = [] cyc = collections.OrderedDict() cyc["_id"] = 'd9ea4cfd5f680f2300007ac019c871e5' cyc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' cyc["quyu"] = '冲压' cyc["wentishu"] = str(cy_zs['cya']) cyc["yizhenggai"] = str(cy_gb['cyb']) cyc["zhenggailv"] = str(cyzgl) cy_list.append(cyc) for cyd in range(0, len(cy_list)): cye = json.dumps(cy_list[cyd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as cyf: cyf.write(cye) cyf.write('\n') # 整改率-车身 cursor.execute( "select COUNT(*) as csa from aqk_sot where sotintime between %s and %s and sotdepartment='车身BD'", [benyuestart, benyueend, ]) cs_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as csb from aqk_sot where sotintime between %s and %s and sotdepartment='车身BD' and state='关闭'", [benyuestart, benyueend, ]) cs_gb = cursor.fetchone() if cs_zs['csa'] == 0: cszgl = 100 else: cszgl = round(cs_gb['csb'] / cs_zs['csa'], 2) * 100 cs_list = [] csc = collections.OrderedDict() csc["_id"] = '2c9645925f681173000086b162eec81d' csc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' csc["quyu"] = '车身' csc["wentishu"] = str(cs_zs['csa']) csc["yizhenggai"] = str(cs_gb['csb']) csc["zhenggailv"] = str(cszgl) cs_list.append(csc) for csd in range(0, len(cs_list)): cse = json.dumps(cs_list[csd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as csf: csf.write(cse) csf.write('\n') # 整改率-涂装 cursor.execute( "select COUNT(*) as tza from aqk_sot where sotintime between %s and %s and sotdepartment='涂装PS'", [benyuestart, benyueend, ]) tz_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as tzb from aqk_sot where sotintime between %s and %s and sotdepartment='涂装PS' and state='关闭'", [benyuestart, benyueend, ]) tz_gb = cursor.fetchone() if tz_zs['tza'] == 0: tzzgl = 100 else: tzzgl = round(tz_gb['tzb'] / tz_zs['tza'], 2) * 100 tz_list = [] tzc = collections.OrderedDict() tzc["_id"] = 'c4747cd45f6812e000006aa807fd522e' tzc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' tzc["quyu"] = '涂装' tzc["wentishu"] = str(tz_zs['tza']) tzc["yizhenggai"] = str(tz_gb['tzb']) tzc["zhenggailv"] = str(tzzgl) tz_list.append(tzc) for tzd in range(0, len(tz_list)): tze = json.dumps(tz_list[tzd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as tzf: tzf.write(tze) tzf.write('\n') # 整改率-总装 cursor.execute( "select COUNT(*) as zza from aqk_sot where sotintime between %s and %s and sotdepartment='总装GA'", [benyuestart, benyueend, ]) zz_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as zzb from aqk_sot where sotintime between %s and %s and sotdepartment='总装GA' and state='关闭'", [benyuestart, benyueend, ]) zz_gb = cursor.fetchone() if zz_zs['zza'] == 0: zzzgl = 100 else: zzzgl = round(zz_gb['zzb'] / zz_zs['zza'], 2) * 100 zz_list = [] zzc = collections.OrderedDict() zzc["_id"] = '2c9645925f68133b000086cf79aedb32' zzc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' zzc["quyu"] = '总装' zzc["wentishu"] = str(zz_zs['zza']) zzc["yizhenggai"] = str(zz_gb['zzb']) zzc["zhenggailv"] = str(zzzgl) zz_list.append(zzc) for zzd in range(0, len(zz_list)): zze = json.dumps(zz_list[tzd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as zzf: zzf.write(zze) zzf.write('\n') # 整改率-维修 cursor.execute( "select COUNT(*) as wxa from aqk_sot where sotintime between %s and %s and sotdepartment='维修MS'", [benyuestart, benyueend, ]) wx_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as wxb from aqk_sot where sotintime between %s and %s and sotdepartment='维修MS' and state='关闭'", [benyuestart, benyueend, ]) wx_gb = cursor.fetchone() if wx_zs['wxa'] == 0: wxzgl = 100 else: wxzgl = round(wx_gb['wxb'] / wx_zs['wxa'], 2) * 100 wx_list = [] wxc = collections.OrderedDict() wxc["_id"] = '8f29e52a5f68140f00007cad1ab6aa5d' wxc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' wxc["quyu"] = '维修' wxc["wentishu"] = str(wx_zs['wxa']) wxc["yizhenggai"] = str(wx_gb['wxb']) wxc["zhenggailv"] = str(wxzgl) wx_list.append(wxc) for wxd in range(0, len(wx_list)): wxe = json.dumps(wx_list[wxd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as wxf: wxf.write(wxe) wxf.write('\n') # 整改率-发动机 cursor.execute( "select COUNT(*) as fdja from aqk_sot where sotintime between %s and %s and sotdepartment='发动机PT'", [benyuestart, benyueend, ]) fdj_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as fdjb from aqk_sot where sotintime between %s and %s and sotdepartment='发动机PT' and state='关闭'", [benyuestart, benyueend, ]) fdj_gb = cursor.fetchone() if fdj_zs['fdja'] == 0: fdjzgl = 100 else: fdjzgl = round(fdj_gb['fdjb'] / fdj_zs['fdja'], 2) * 100 fdj_list = [] fdjc = collections.OrderedDict() fdjc["_id"] = '8f29e52a5f6815ac00007cc72f5725be' fdjc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' fdjc["quyu"] = '发动机' fdjc["wentishu"] = str(fdj_zs['fdja']) fdjc["yizhenggai"] = str(fdj_gb['fdjb']) fdjc["zhenggailv"] = str(fdjzgl) fdj_list.append(fdjc) for fdjd in range(0, len(fdj_list)): fdje = json.dumps(fdj_list[fdjd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as fdjf: fdjf.write(fdje) fdjf.write('\n') # 整改率-技术质量 cursor.execute( "select COUNT(*) as jsa from aqk_sot where sotintime between %s and %s and sotdepartment='技术质量TQ'", [benyuestart, benyueend, ]) js_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as jsb from aqk_sot where sotintime between %s and %s and sotdepartment='技术质量TQ' and state='关闭'", [benyuestart, benyueend, ]) js_gb = cursor.fetchone() if js_zs['jsa'] == 0: jszgl = 100 else: jszgl = round(js_gb['jsb'] / js_zs['jsa'], 2) * 100 js_list = [] jsc = collections.OrderedDict() jsc["_id"] = '2c9645925f68165c0000870e2710b5b4' jsc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' jsc["quyu"] = '技术质量' jsc["wentishu"] = str(js_zs['jsa']) jsc["yizhenggai"] = str(js_gb['jsb']) jsc["zhenggailv"] = str(jszgl) js_list.append(jsc) for jsd in range(0, len(js_list)): jse = json.dumps(js_list[jsd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as jsf: jsf.write(jse) jsf.write('\n') # 整改率-采购 cursor.execute( "select COUNT(*) as cga from aqk_sot where sotintime between %s and %s and sotdepartment='采购物流PC&L'", [benyuestart, benyueend, ]) cg_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as cgb from aqk_sot where sotintime between %s and %s and sotdepartment='采购物流PC&L' and state='关闭'", [benyuestart, benyueend, ]) cg_gb = cursor.fetchone() if cg_zs['cga'] == 0: cgzgl = 100 else: cgzgl = round(cg_gb['cgb'] / cg_zs['cga'], 2) * 100 cg_list = [] cgc = collections.OrderedDict() cgc["_id"] = '8f29e52a5f6816b200007cde5e54a1b1' cgc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' cgc["quyu"] = '采购物流' cgc["wentishu"] = str(cg_zs['cga']) cgc["yizhenggai"] = str(cg_gb['cgb']) cgc["zhenggailv"] = str(cgzgl) cg_list.append(cgc) for cgd in range(0, len(cg_list)): cge = json.dumps(cg_list[cgd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as cgf: cgf.write(cge) cgf.write('\n') # 整改率-HR cursor.execute( "select COUNT(*) as hra from aqk_sot where sotintime between %s and %s and sotdepartment='人力资源HR'", [benyuestart, benyueend, ]) hr_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as hrb from aqk_sot where sotintime between %s and %s and sotdepartment='人力资源HR' and state='关闭'", [benyuestart, benyueend, ]) hr_gb = cursor.fetchone() if hr_zs['hra'] == 0: hrzgl = 100 else: hrzgl = round(hr_gb['hrb'] / hr_zs['hra'], 2) * 100 hr_list = [] hrc = collections.OrderedDict() hrc["_id"] = '8f29e52a5f68176b00007cee01e70830' hrc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' hrc["quyu"] = '人力资源HR' hrc["wentishu"] = str(hr_zs['hra']) hrc["yizhenggai"] = str(hr_gb['hrb']) hrc["zhenggailv"] = str(hrzgl) hr_list.append(hrc) for hrd in range(0, len(hr_list)): hre = json.dumps(hr_list[hrd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as hrf: hrf.write(hre) hrf.write('\n') # 整改率-综合管理科 cursor.execute( "select COUNT(*) as poa from aqk_sot where sotintime between %s and %s and sotdepartment='综合管理PO'", [benyuestart, benyueend, ]) po_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as pob from aqk_sot where sotintime between %s and %s and sotdepartment='综合管理PO' and state='关闭'", [benyuestart, benyueend, ]) po_gb = cursor.fetchone() if po_zs['poa'] == 0: pozgl = 100 else: pozgl = round(po_gb['pob'] / hr_zs['poa'], 2) * 100 po_list = [] poc = collections.OrderedDict() poc["_id"] = '8f29e52a5f6817eb00007cf24f46883e' poc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' poc["quyu"] = '综合管理' poc["wentishu"] = str(po_zs['poa']) poc["yizhenggai"] = str(po_gb['pob']) poc["zhenggailv"] = str(pozgl) po_list.append(poc) for pod in range(0, len(po_list)): poe = json.dumps(po_list[pod], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as pof: pof.write(poe) pof.write('\n') # 整改率-安全科 cursor.execute( "select COUNT(*) as aqa from aqk_sot where sotintime between %s and %s and sotdepartment='安全科EHS'", [benyuestart, benyueend, ]) aq_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as aqb from aqk_sot where sotintime between %s and %s and sotdepartment='安全科EHS' and state='关闭'", [benyuestart, benyueend, ]) aq_gb = cursor.fetchone() if aq_zs['aqa'] == 0: aqzgl = 100 else: aqzgl = round(aq_gb['aqb'] / aq_zs['aqa'], 2) * 100 aq_list = [] aqc = collections.OrderedDict() aqc["_id"] = 'c4747cd45f68182900006af524a05646' aqc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' aqc["quyu"] = '安全科' aqc["wentishu"] = str(aq_zs['aqa']) aqc["yizhenggai"] = str(aq_gb['aqb']) aqc["zhenggailv"] = str(aqzgl) aq_list.append(aqc) for aqd in range(0, len(aq_list)): aqe = json.dumps(aq_list[aqd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as aqf: aqf.write(aqe) aqf.write('\n') # 整改率-销售公司 cursor.execute( "select COUNT(*) as xsa from aqk_sot where sotintime between %s and %s and sotdepartment='销售公司Sales'", [benyuestart, benyueend, ]) xs_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as xsb from aqk_sot where sotintime between %s and %s and sotdepartment='销售公司Sales' and state='关闭'", [benyuestart, benyueend, ]) xs_gb = cursor.fetchone() if xs_zs['xsa'] == 0: xszgl = 100 else: xszgl = round(xs_gb['aqb'] / xs_zs['xsa'], 2) * 100 xs_list = [] xsc = collections.OrderedDict() xsc["_id"] = '2c9645925f6818910000873b51fd76a5' xsc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' xsc["quyu"] = '销售公司' xsc["wentishu"] = str(xs_zs['xsa']) xsc["yizhenggai"] = str(xs_gb['xsb']) xsc["zhenggailv"] = str(xszgl) xs_list.append(xsc) for xsd in range(0, len(xs_list)): xse = json.dumps(xs_list[xsd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as xsf: xsf.write(xse) xsf.write('\n') # 整改率-yiling cursor.execute( "select COUNT(*) as yla from aqk_sot where sotintime between %s and %s and sotdepartment='益菱公司YL'", [benyuestart, benyueend, ]) yl_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as ylb from aqk_sot where sotintime between %s and %s and sotdepartment='益菱公司YL' and state='关闭'", [benyuestart, benyueend, ]) yl_gb = cursor.fetchone() if yl_zs['yla'] == 0: ylzgl = 100 else: ylzgl = round(yl_gb['ylb'] / yl_zs['yla'], 2) * 100 yl_list = [] ylc = collections.OrderedDict() ylc["_id"] = 'd9ea4cfd5f68191400007b5b3529afda' ylc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' ylc["quyu"] = '益菱公司' ylc["wentishu"] = str(yl_zs['yla']) ylc["yizhenggai"] = str(yl_gb['ylb']) ylc["zhenggailv"] = str(ylzgl) yl_list.append(ylc) for yld in range(0, len(yl_list)): yle = json.dumps(yl_list[yld], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as ylf: ylf.write(yle) ylf.write('\n') # 整改率-vp cursor.execute( "select COUNT(*) as vpa from aqk_sot where sotintime between %s and %s and sotdepartment='vp'", [benyuestart, benyueend, ]) vp_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as vpb from aqk_sot where sotintime between %s and %s and sotdepartment='vp' and state='关闭'", [benyuestart, benyueend, ]) vp_gb = cursor.fetchone() if vp_zs['vpa'] == 0: vpzgl = 100 else: vpzgl = round(vp_gb['vpb'] / vp_zs['vpa'], 2) * 100 vp_list = [] vpc = collections.OrderedDict() vpc["_id"] = 'c4747cd45f68196f00006b046bd45c54' vpc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' vpc["quyu"] = 'vp' vpc["wentishu"] = str(vp_zs['vpa']) vpc["yizhenggai"] = str(vp_gb['vpb']) vpc["zhenggailv"] = str(vpzgl) vp_list.append(vpc) for vpd in range(0, len(vp_list)): vpe = json.dumps(vp_list[vpd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as vpf: vpf.write(vpe) vpf.write('\n') # 整改率-qita cursor.execute( "select COUNT(*) as qta from aqk_sot where sotintime between %s and %s and sotdepartment='其它Others'", [benyuestart, benyueend, ]) qt_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as qtb from aqk_sot where sotintime between %s and %s and sotdepartment='其它Others' and state='关闭'", [benyuestart, benyueend, ]) qt_gb = cursor.fetchone() if qt_zs['qta'] == 0: qtzgl = 100 else: qtzgl = round(qt_gb['qtb'] / qt_zs['qta'], 2) * 100 qt_list = [] qtc = collections.OrderedDict() qtc["_id"] = '2c9645925f6819f40000875f38197e68' qtc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' qtc["quyu"] = '其它' qtc["wentishu"] = str(qt_zs['qta']) qtc["yizhenggai"] = str(qt_gb['qtb']) qtc["zhenggailv"] = str(qtzgl) qt_list.append(qtc) for qtd in range(0, len(qt_list)): qte = json.dumps(qt_list[qtd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as qtf: qtf.write(qte) qtf.write('\n') # 整改率-zongji cursor.execute( "select COUNT(*) as zja from aqk_sot where sotintime between %s and %s", [benyuestart, benyueend, ]) zj_zs = cursor.fetchone() cursor.execute( "select COUNT(*) as zjb from aqk_sot where sotintime between %s and %s and state='关闭'", [benyuestart, benyueend, ]) zj_gb = cursor.fetchone() if zj_zs['zja'] == 0: zjzgl = 100 else: zjzgl = round(zj_gb['zjb'] / zj_zs['zja'], 2) * 100 zj_list = [] zjc = collections.OrderedDict() zjc["_id"] = 'd9ea4cfd5f681a4a00007b7133283848' zjc["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY' zjc["quyu"] = '总计' zjc["wentishu"] = str(zj_zs['zja']) zjc["yizhenggai"] = str(zj_gb['zjb']) zjc["zhenggailv"] = str(zjzgl) zj_list.append(zjc) for zjd in range(0, len(zj_list)): zje = json.dumps(zj_list[zjd], ensure_ascii=False) with open('F:\小程序-各部门问题统计(dangyuewentitongji).json', 'a') as zjf: zjf.write(zje) zjf.write('\n')
 0   0  8天前
lytcreate
55
https://www.52pojie.cn/thread-804891-1-1.html
 0   0  8天前
lytcreate
86
def xcx(request):    if request.method == 'GET':        today = datetime.date.today()        benyuestart = datetime.date(today.year,today.month,1)        benyueend = datetime.date(today.year,today.month+1,1) - datetime.timedelta(1)                conn = pymysql.connect(host=host, port=port, user=user, password=password, database=database, charset='utf8')        cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)        cursor.execute("select * from aqk_score where scoreintime between %s and %s",[benyuestart,benyueend,])        byaqjf = cursor.fetchall()        byaqjf_list = []        for byjf in byaqjf:            a = collections.OrderedDict()            a["_id"] = byjf['xid']            a["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY'            a["note"] = byjf['areas']            a["timee"] = str(byjf['scores'])            byaqjf_list.append(a)        for b in range(0,len(byaqjf_list)):            c = json.dumps(byaqjf_list[b],ensure_ascii=False)            with open('D:\wwwroot\Wechatdata\小程序-当月安全积分表(userlist).json','a',encoding='utf-8-sig') as d:                d.write(c)                d.write('\n')#各区域每月积分雷达图--文件制度管理cursor.execute("select documents from aqk_score where scoreintime between %s and %s order by id",[benyuestart,benyueend,])wjzdgl = cursor.fetchall()# print(wjzdgl)# print(wjzdgl[0]['documents'])wjzd_list = []e = collections.OrderedDict()e["_id"] = '8f29e52a5f6464ee00001e47666bb8a5'e["序号"] = '1'e["leibie"] = '文件制度管理'e["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY'e["chongya"] = str(wjzdgl[0]['documents'])e["cheshen"] = str(wjzdgl[1]['documents'])e["tuzhuang"] = str(wjzdgl[2]['documents'])e["zongzhuang"] = str(wjzdgl[3]['documents'])e["weixiu"] = str(wjzdgl[4]['documents'])e["fadongji"] = str(wjzdgl[5]['documents'])e["caigouwuliu"] = str(wjzdgl[6]['documents'])e["jishuzhiliang"] = str(wjzdgl[7]['documents'])wjzd_list.append(e)# print(wjzd_list)# print(wjzd_list[0])for h in range(0, len(wjzd_list)): f = json.dumps(wjzd_list[h], ensure_ascii=False) with open('F:\小程序-部门安全积分细表(雷达图)(dangyueanquanxiaofen)', 'a') as g: g.write(f) g.write('\n')# 各区域每月积分雷达图--安全改进cursor.execute("select improvement from aqk_score where scoreintime between %s and %s order by id", [benyuestart, benyueend, ])aqgj = cursor.fetchall() # print(wjzdgl) # print(wjzdgl[0]['documents'])aqgj_list = []i = collections.OrderedDict()i["_id"] = '112557505f6465ca0000222c5a94c400'i["序号"] = '2'i["leibie"] = '安全改进'i["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY'i["chongya"] = str(aqgj[0]['improvement'])i["cheshen"] = str(aqgj[1]['improvement'])i["tuzhuang"] = str(aqgj[2]['improvement'])i["zongzhuang"] = str(aqgj[3]['improvement'])i["weixiu"] = str(aqgj[4]['improvement'])i["fadongji"] = str(aqgj[5]['improvement'])i["caigouwuliu"] = str(aqgj[6]['improvement'])i["jishuzhiliang"] = str(aqgj[7]['improvement'])aqgj_list.append(i) # print(wjzd_list) # print(wjzd_list[0])for j in range(0, len(aqgj_list)): k = json.dumps(aqgj_list[j], ensure_ascii=False) with open('F:\小程序-部门安全积分细表(雷达图)(dangyueanquanxiaofen)', 'a') as l: l.write(k) l.write('\n')# 各区域每月积分雷达图--安全检查cursor.execute("select safety from aqk_score where scoreintime between %s and %s order by id", [benyuestart, benyueend, ])aqjc = cursor.fetchall() # print(wjzdgl) # print(wjzdgl[0]['documents'])aqjc_list = []n = collections.OrderedDict()n["_id"] = '2c9645925f64666400002100174fccd4'n["序号"] = '3'n["leibie"] = '安全检查(绩效评价)'n["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY'n["chongya"] = str(aqjc[0]['safety'])n["cheshen"] = str(aqjc[1]['safety'])n["tuzhuang"] = str(aqjc[2]['safety'])n["zongzhuang"] = str(aqjc[3]['safety'])n["weixiu"] = str(aqjc[4]['safety'])n["fadongji"] = str(aqjc[5]['safety'])n["caigouwuliu"] = str(aqjc[6]['safety'])n["jishuzhiliang"] = str(aqjc[7]['safety'])aqjc_list.append(n) # print(wjzd_list) # print(wjzd_list[0])for m in range(0, len(aqjc_list)): o = json.dumps(aqjc_list[m], ensure_ascii=False) with open('F:\小程序-部门安全积分细表(雷达图)(dangyueanquanxiaofen)', 'a') as p: p.write(o) p.write('\n') # 各区域每月积分雷达图--其他专项cursor.execute("select otherobject from aqk_score where scoreintime between %s and %s order by id", [benyuestart, benyueend, ])qtzxgz = cursor.fetchall() # print(wjzdgl) # print(wjzdgl[0]['documents'])qtzx_list = []q = collections.OrderedDict()q["_id"] = '8f29e52a5f64673500001e657769063f'q["序号"] = '4'q["leibie"] = '其他专项工作'q["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY'q["chongya"] = str(qtzxgz[0]['otherobject'])q["cheshen"] = str(qtzxgz[1]['otherobject'])q["tuzhuang"] = str(qtzxgz[2]['otherobject'])q["zongzhuang"] = str(qtzxgz[3]['otherobject'])q["weixiu"] = str(qtzxgz[4]['otherobject'])q["fadongji"] = str(qtzxgz[5]['otherobject'])q["caigouwuliu"] = str(qtzxgz[6]['otherobject'])q["jishuzhiliang"] = str(qtzxgz[7]['otherobject'])qtzx_list.append(q) # print(wjzd_list) # print(wjzd_list[0])for r in range(0, len(qtzx_list)): s = json.dumps(qtzx_list[r], ensure_ascii=False) with open('F:\小程序-部门安全积分细表(雷达图)(dangyueanquanxiaofen)', 'a') as t: t.write(s) t.write('\n')# 各区域每月积分雷达图--6spcursor.execute("select psobject from aqk_score where scoreintime between %s and %s order by id", [benyuestart, benyueend, ])psobject = cursor.fetchall() # print(wjzdgl) # print(wjzdgl[0]['documents'])ps_list = []u = collections.OrderedDict()u["_id"] = '8f29e52a5f64679600001e682062b8a3'u["序号"] = '5'u["leibie"] = '6ps相关工作'u["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY'u["chongya"] = str(psobject[0]['psobject'])u["cheshen"] = str(psobject[1]['psobject'])u["tuzhuang"] = str(psobject[2]['psobject'])u["zongzhuang"] = str(psobject[3]['psobject'])u["weixiu"] = str(psobject[4]['psobject'])u["fadongji"] = str(psobject[5]['psobject'])u["caigouwuliu"] = str(psobject[6]['psobject'])u["jishuzhiliang"] = str(psobject[7]['psobject'])ps_list.append(u) # print(wjzd_list) # print(wjzd_list[0])for v in range(0, len(ps_list)): w = json.dumps(ps_list[v], ensure_ascii=False) with open('F:\小程序-部门安全积分细表(雷达图)(dangyueanquanxiaofen)', 'a') as x: x.write(w) x.write('\n')# 各区域每月积分雷达图-消防及应急cursor.execute("select emergency from aqk_score where scoreintime between %s and %s order by id", [benyuestart, benyueend, ])xfjyjgl = cursor.fetchall() # print(wjzdgl) # print(wjzdgl[0]['documents'])xf_list = []aa = collections.OrderedDict()aa["_id"] = '112557505f64684a000022562733325d'aa["序号"] = '6'aa["leibie"] = '消防及应急管理'aa["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY'aa["chongya"] = str(xfjyjgl[0]['emergency'])aa["cheshen"] = str(xfjyjgl[1]['emergency'])aa["tuzhuang"] = str(xfjyjgl[2]['emergency'])aa["zongzhuang"] = str(xfjyjgl[3]['emergency'])aa["weixiu"] = str(xfjyjgl[4]['emergency'])aa["fadongji"] = str(xfjyjgl[5]['emergency'])aa["caigouwuliu"] = str(xfjyjgl[6]['emergency'])aa["jishuzhiliang"] = str(xfjyjgl[7]['emergency'])xf_list.append(aa) # print(wjzd_list) # print(wjzd_list[0])for ab in range(0, len(xf_list)): ac = json.dumps(xf_list[ab], ensure_ascii=False) with open('F:\小程序-部门安全积分细表(雷达图)(dangyueanquanxiaofen)', 'a') as ad: ad.write(ac) ad.write('\n')# 各区域每月积分雷达图-培训、沟通cursor.execute("select practise from aqk_score where scoreintime between %s and %s order by id", [benyuestart, benyueend, ])pxgt = cursor.fetchall() # print(wjzdgl) # print(wjzdgl[0]['documents'])px_list = []ae = collections.OrderedDict()ae["_id"] = 'c4747cd45f6468b000001a6a702e9863'ae["序号"] = '7'ae["leibie"] = '培训、沟通'ae["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY'ae["chongya"] = str(pxgt[0]['practise'])ae["cheshen"] = str(pxgt[1]['practise'])ae["tuzhuang"] = str(pxgt[2]['practise'])ae["zongzhuang"] = str(pxgt[3]['practise'])ae["weixiu"] = str(pxgt[4]['practise'])ae["fadongji"] = str(pxgt[5]['practise'])ae["caigouwuliu"] = str(pxgt[6]['practise'])ae["jishuzhiliang"] = str(pxgt[7]['practise'])px_list.append(ae) # print(wjzd_list) # print(wjzd_list[0])for af in range(0, len(px_list)): ag = json.dumps(px_list[af], ensure_ascii=False) with open('F:\小程序-部门安全积分细表(雷达图)(dangyueanquanxiaofen)', 'a') as ah: ah.write(ag) ah.write('\n')# 各区域每月积分雷达图-工作策划及资源保障cursor.execute("select plan from aqk_score where scoreintime between %s and %s order by id", [benyuestart, benyueend, ])gzch = cursor.fetchall() # print(wjzdgl) # print(wjzdgl[0]['documents'])ch_list = []aj = collections.OrderedDict()aj["_id"] = '2c9645925f646917000021291010802b'aj["序号"] = '8'aj["leibie"] = '工作策划及资源保障'aj["_openid"] = 'oySrZ5TjT4h_nbUV-RFJAG_3H3JY'aj["chongya"] = str(gzch[0]['plan'])aj["cheshen"] = str(gzch[1]['plan'])aj["tuzhuang"] = str(gzch[2]['plan'])aj["zongzhuang"] = str(gzch[3]['plan'])aj["weixiu"] = str(gzch[4]['plan'])aj["fadongji"] = str(gzch[5]['plan'])aj["caigouwuliu"] = str(gzch[6]['plan'])aj["jishuzhiliang"] = str(gzch[7]['plan'])ch_list.append(aj) # print(wjzd_list) # print(wjzd_list[0])for ak in range(0, len(ch_list)): am = json.dumps(ch_list[ak], ensure_ascii=False) with open('F:\小程序-部门安全积分细表(雷达图)(dangyueanquanxiaofen)', 'a') as an: an.write(am) an.write('\n')        conn.close()        return redirect("/home/")            else:        return redirect("/home/")
 0   0  9天前
lytcreate
60
解决果然,json.dumps()这个方法是没有encoding这个参数的,要想将默认的ascii字符改为中文,应该将ensure_asciii设为Falseself.write(json.dumps(result,ensure_ascii=False))
 0   0  9天前
lytcreate
80
小程序-当月安全积分表(userlist).json{"_id":"c4747cd45f6310530000044465161adf","_openid":"oySrZ5TjT4h_nbUV-RFJAG_3H3JY","note":"冲压车间","timee":"90"}{"_id":"c4747cd45f6310d90000044b0b2e3d3e","_openid":"oySrZ5TjT4h_nbUV-RFJAG_3H3JY","note":"车身车间","timee":"91"}{"_id":"c4747cd45f6319b8000004c94d65572a","_openid":"oySrZ5TjT4h_nbUV-RFJAG_3H3JY","timee":"92","note":"涂装车间"}{"_id":"2c9645925f631a22000005dd58fab0a4","_openid":"oySrZ5TjT4h_nbUV-RFJAG_3H3JY","note":"总装车间","timee":"94"}{"_id":"c4747cd45f631a56000004d576a7b769","_openid":"oySrZ5TjT4h_nbUV-RFJAG_3H3JY","note":"整车维修车间","timee":"80"}{"_id":"2c9645925f631a78000005e506e62635","_openid":"oySrZ5TjT4h_nbUV-RFJAG_3H3JY","note":"发动机工厂","timee":"75"}{"_id":"2c9645925f631aa9000005e9714b0bbd","_openid":"oySrZ5TjT4h_nbUV-RFJAG_3H3JY","note":"采购物流","timee":"99"}{"_id":"112557505f631ad7000006216df94388","_openid":"oySrZ5TjT4h_nbUV-RFJAG_3H3JY","note":"技术质量","timee":"55"}小程序-部门安全积分细表(雷达图)(dangyueanquanxiaofen)小程序-各部门问题统计(dangyuewentitongji)小程序-区域每月积分表(quyumeiyuejifen)小程序-危险源数据(weixianyuanqindan).json小程序,饼图数据(wentipie).json
 0   0  9天前
lytcreate
78
with open('E:\python\python\test.txt', 'w') as f: f.write('Hello, python!')
 0   0  10天前
lytcreate
67
1、mysql -h ip -uroot -p 密码 输入后会提示错误解决方法:在装有MySQL的机器上登录MySQL mysql -u root -p密码执行use mysql;执行update user set host = '%' where user = 'root';这一句执行完可能会报错,不用管它。执行FLUSH PRIVILEGES之后可以远程访问了,但是安装数据库的电脑无法访问,再后续操作MySQL 连接错误,使用Navicat连接MySQL出现错误:1045 Access denied for user 'root'@'localhost' (using password: YES)②C:\ProgramData\MySQL\MySQL Server 8.0\my.ini;),在[mysqld]这个条目下加入 skip-grant-tables 保存退出后重启mysql这时候在cmd里面输入mysql -u root -p就可以不用密码登录了,出现 password:的时候直接回车可以进入,不会出现ERROR 1045 (28000),但很多操作都会受限制,因为没有grant权限。 继续按下面的流程走:1.进入mysql数据库:mysql> use mysql; Database changed2.给root用户设置新密码:  mysql> update user set password=password("新密码") where user="root"; Query OK, 1 rows affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 03.刷新数据库mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)  4.退出mysql:mysql> quit; Bye 改好之后,再修改一下my.ini这个文件,把我们刚才加入的 "skip-grant-tables"这行删除,保存退出再重启mysql服务,再重新连接就可以了。
 0   0  12天前
lytcreate
77
如果要定时备份mysq,可以给Windows设置定时任务compmgmt.msc再输出:%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.sql
 0   0  12天前
lytcreate
59
windows中怎么添加定时任务linux中有crontab定时任务,很方便其实windows也有类似的Windows键+R,调出此窗口,输入compmgmt.msc 
 0   0  12天前
快速发帖 高级模式
我的小伙伴
Powered by Xwylt.com
© 2020-2020 lytcreate
您的IP:3.237.186.116,2020-10-21 20:31:44,Processed in 0.02113 second(s).
Powered by HadSky
书山有路勤为径,学海无涯苦作舟