动态 版块 发帖 消息 我的
xwylt
书山有路勤为径,学海无涯苦作舟
lytcreateLv5   
整改率     
	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  已被阅读了96次  楼主 2020-10-12 23:49:31
回复列表

回复:整改率

Powered by Xwylt.com
© 2020-2020 lytcreate
您的IP:54.236.35.159,2020-10-31 04:00:12,Processed in 0.00831 second(s).
Powered by HadSky
书山有路勤为径,学海无涯苦作舟
已有0次打赏