コード例 #1
0
def getPropertysaAndClass(request):
    if request.is_ajax():
        mysql_single, cu = MySQLSingle().getConCu()
        # 直接获取所有的post请求数据
        cu.execute('SELECT DISTINCT CPname from componentproperty ')
        table_data = cu.fetchall()
        temp = {}
        result_property = []
        i = 0
        for obj in range(0, len(table_data)):
            temp['id'] = table_data[i]['CPname']
            temp['text'] = table_data[i]['CPname']
            result_property.append(temp.copy())
            i = i + 1
        cu.execute('SELECT DISTINCT Claname from classification ')
        class_data = cu.fetchall()
        temp = {}
        result_class = []
        i = 0
        for obj in range(0, len(class_data)):
            temp['id'] = class_data[i]['Claname']
            temp['text'] = class_data[i]['Claname']
            result_class.append(temp.copy())
            i = i + 1
        result = {}
        result['CPnameList'] = result_property
        result['ClanameList'] = result_class
        return JsonResponse(result,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
    else:
        return HttpResponse("收到")
コード例 #2
0
def getEss(request):
    if request.method == "POST":
        mysql_single, cu = MySQLSingle().getConCu()
        data = request.POST
        pmodel = data.get('message')
        print("请求ess信息列表")
        cu.execute(
            'select ESS  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s"'
            % pmodel)
        cu_ess = cu.fetchall()
        re_ess = []
        temp = {}
        ESS_1 = 0
        ESS_2 = 0
        ESS_3 = 0
        for i in range(0, len(cu_ess)):
            number = cu_ess[i]['ESS']
            if number == '1':
                ESS_1 += 1
            elif number == '2':
                ESS_2 += 1
            elif number == '3':
                ESS_3 += 1
        temp['value'] = ESS_1
        temp['name'] = 'ESS=1'
        re_ess.append(temp.copy())
        temp['value'] = ESS_2
        temp['name'] = 'ESS=2'
        re_ess.append(temp.copy())
        temp['value'] = ESS_3
        temp['name'] = 'ESS=3'
        re_ess.append(temp.copy())
        return JsonResponse(re_ess,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
コード例 #3
0
def getPnrs(request):
    if request.is_ajax():
        mysql_single, cu = MySQLSingle().getConCu()
        # 直接获取所有的post请求数据
        data = request.POST
        message = data.get('message')
        print("信息查询页面请求ata部件:" + message)
        info = message.split("-")
        '''
        cu.execute(
            'create or REPLACE view combine(mername,pmodel,pnr) as select manufacturer.Mername as a,pmodel.PModelname as b,apply.prn as c from  pmodel INNER join manufacturer on pmodel.Mername = manufacturer.Mername inner join apply on pmodel.PModelname = apply.PModelname')
        mysql_single.commit()
        '''
        cu.execute(
            'SELECT DISTINCT * from combine inner join component on combine.pnr=component.PNR where combine.mername="%s" and combine.pmodel="%s" and component.ATA="%s"'
            % (info[0], info[1], info[2]))
        table_data = cu.fetchall()
        json_str = {}
        json_str['total'] = len(table_data)
        json_str['rows'] = table_data
        return JsonResponse(json_str,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
    else:
        return HttpResponse("收到")
コード例 #4
0
def getAdvancePnrs(request):
    if request.is_ajax():
        mysql_single, cu = MySQLSingle().getConCu()
        # 直接获取所有的post请求数据
        data = request.POST
        atas = data.get('ATAs')
        PModelnames = data.get('PModelnames')
        Mernames = data.get('Mernames')

        print("高级信息查询页面请求ata部件:\n" + str(atas) + "\n" + str(PModelnames) +
              "\n" + str(Mernames))
        '''
        cu.execute(
            'create or REPLACE view combine(mername,pmodel,pnr) as select manufacturer.Mername as a,pmodel.PModelname as b,apply.prn as c from  pmodel INNER join manufacturer on pmodel.Mername = manufacturer.Mername inner join apply on pmodel.PModelname = apply.PModelname')
        mysql_single.commit()
        '''
        #为不同的情况构建子句
        flag_ata = (0 == len(atas.strip()))
        flag_pmod = (0 == len(PModelnames.strip()))
        flag_man = (0 == len(Mernames.strip()))

        if (flag_ata) and (flag_man) and (flag_pmod):
            where_str = ''
        elif (flag_ata) and (flag_man) and (not flag_pmod):
            where_str = 'where combine.pmodel in (%s)' % (
                '\'' + str(PModelnames).replace(',', '\',\'') + '\'')
        elif (flag_ata) and (not flag_man) and (flag_pmod):
            where_str = 'where combine.mername in (%s)' % (
                '\'' + str(Mernames).replace(',', '\',\'') + '\'')
        elif (flag_ata) and (not flag_man) and (not flag_pmod):
            where_str = 'where combine.mername in (%s) and combine.pmodel in (%s)' % (
                '\'' + str(Mernames).replace(',', '\',\'') + '\'',
                '\'' + str(PModelnames).replace(',', '\',\'') + '\'')
        elif (not flag_ata) and (flag_man) and (flag_pmod):
            where_str = 'where component.ATA in (%s)' % (
                '\'' + str(atas).replace(',', '\',\'') + '\'')
        elif (not flag_ata) and (flag_man) and (not flag_pmod):
            where_str = 'where component.ATA in (%s) and combine.pmodel in (%s)' % (
                '\'' + str(atas).replace(',', '\',\'') + '\'',
                '\'' + str(PModelnames).replace(',', '\',\'') + '\'')
        elif (not flag_ata) and (not flag_man) and (flag_pmod):
            where_str = 'where component.ATA in (%s) and combine.mername in (%s)' % (
                '\'' + str(atas).replace(',', '\',\'') + '\'',
                '\'' + str(Mernames).replace(',', '\',\'') + '\'')
        elif (not flag_ata) and (not flag_man) and (not flag_pmod):
            where_str = 'where component.ATA in (%s) and combine.mername in (%s) and combine.pmodel in (%s)' % (
                '\'' + str(atas).replace(',', '\',\'') + '\'',
                '\'' + str(Mernames).replace(',', '\',\'') + '\'',
                '\'' + str(PModelnames).replace(',', '\',\'') + '\'')
        sql_str = 'SELECT DISTINCT * from combine inner join component on combine.pnr=component.PNR %s' % where_str
        cu.execute(sql_str)
        table_data = cu.fetchall()
        json_str = {}
        json_str['total'] = len(table_data)
        json_str['rows'] = table_data
        return JsonResponse(json_str,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
    else:
        return HttpResponse("收到")
コード例 #5
0
def getATAESSNumbers(request):
    if request.method == "POST":
        mysql_single, cu = MySQLSingle().getConCu()
        data = request.POST
        pmodel = data.get('pmodel')
        ess = data.get('ess')
        ess_str = '1'
        if ess == 'NO-GO项目(ESS=1)':
            ess_str = '1'
        elif ess == 'GO-IF项目(ESS=2)':
            ess_str = '2'
        elif ess == 'GO项目(ESS=3)':
            ess_str = '3'
        print("请横向柱状图信息列表")
        cu.execute(
            'select component.ATA as ATAname,count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "%s" GROUP BY component.ATA '
            % (pmodel, ess_str))
        cu_ess = cu.fetchall()
        result_MFR = []
        result_number = []
        res = {}
        for i in range(0, len(cu_ess)):
            result_MFR.append(cu_ess[i]['ATAname'])
            result_number.append(cu_ess[i]['anumber'])
        res['ATA'] = result_MFR
        res['number'] = result_number
        return JsonResponse(res,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
コード例 #6
0
def getAllPropertyInfos(request):
    if request.is_ajax():
        mysql_single, cu = MySQLSingle().getConCu()
        # 直接获取所有的post请求数据
        print('前台请求属性列表')
        cu.execute('SELECT CPname, CPremark,CPother from componentproperty')
        table_data = cu.fetchall()
        json_str = {}
        json_str['total'] = len(table_data)
        json_str['rows'] = table_data
        return JsonResponse(json_str,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
    else:
        return HttpResponse("收到")
コード例 #7
0
def main(request):
    mysql_single, cu = MySQLSingle().getConCu()
    cu.execute(
        'select count(*) as anumber  from component ')
    cu_comnumber = cu.fetchall()
    cu.execute(
        'select count(*) as anumber  from pmodel ')
    cu_pmodelnumber = cu.fetchall()
    cu.execute(
        'select count(*) as anumber  from manufacturer ')
    cu_mannumber = cu.fetchall()
    cu.execute(
        'select count(*) as anumber  from user ')
    cu_usernumber = cu.fetchall()
    return render(request, 'main.html',{'com':cu_comnumber[0]['anumber'],'pmo':cu_pmodelnumber[0]['anumber'],'man':cu_mannumber[0]['anumber'],'user':cu_usernumber[0]['anumber']})
コード例 #8
0
def chart(request):
    #预先获取数据
    mysql_single, cu = MySQLSingle().getConCu()
    print("分析页面预加载...")
    cu.execute("select distinct PModelname from pmodel")
    res_pmodel = cu.fetchall()
    i = 0
    result_pmodel = []
    temp = {}
    for obj in range(0, len(res_pmodel)):
        temp['id'] = res_pmodel[i]['PModelname']
        temp['text'] = res_pmodel[i]['PModelname']
        result_pmodel.append(temp.copy())
        i = i + 1
    print(result_pmodel)
    return render(request, 'analysis.html', {'PModelname': result_pmodel})
コード例 #9
0
ファイル: viewsLogin.py プロジェクト: onlyone2019/LRUSystem
def login(request):
    if request.method == "GET":
        return render(request, 'login.html')
    else:
        mysql_single, cu = MySQLSingle().getConCu()
        uaccount = request.POST.get('uaccount')
        upassword = request.POST.get('upassword')
        cu.execute("select upassword from user where uaccount =" + uaccount)
        a = cu.fetchall()
        # print(str(a))
        if len(a) > 0:
             if a[0]['upassword'] == upassword:
                return render(request, 'main.html')
             else:
                return render(request,'login.html',{'script':"alert",'wrong':'密码错误'})
        else:
             return render(request,'login.html',{'script':"alert",'wrong':'账号不存在'})
コード例 #10
0
def getAllMFRCodes(request):
    if request.is_ajax():
        mysql_single, cu = MySQLSingle().getConCu()
        # 直接获取所有的post请求数据
        data = request.POST
        pmodel = data.get('pmodel')
        print('前台请求供应商列表')
        cu.execute(
            'SELECT CODE, Name,Address from MFRCode where pmodel ="%s"' %
            pmodel)
        table_data = cu.fetchall()
        json_str = {}
        json_str['total'] = len(table_data)
        json_str['rows'] = table_data
        return JsonResponse(json_str,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
    else:
        return HttpResponse("收到")
コード例 #11
0
def getClassProperty(request):
    if request.is_ajax():
        data = request.POST
        message = data.get('message')
        print('分级筛选:' + str(message))
        mysql_single, cu = MySQLSingle().getConCu()
        # 直接获取所有的post请求数据
        cu.execute(
            'SELECT DISTINCT CPname from classification where Claname in (%s)'
            % ('\'' + str(message).replace(',', '\',\'') + '\''))
        table_data = cu.fetchall()
        res = []
        for i in range(0, len(table_data)):
            res.append(table_data[i]['CPname'])
        return JsonResponse(res,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
    else:
        return HttpResponse("收到")
コード例 #12
0
def tableshow(request):
    mysql_single, cu = MySQLSingle().getConCu()
    cu.execute("SELECT * FROM `component`")
    a = cu.fetchall()
    cu.execute("SELECT * FROM `manufacturer`")
    b = cu.fetchall()
    cu.execute("SELECT * FROM `pmodel`")
    pmodel = cu.fetchall()
    cu.execute("SELECT * FROM `cpclass`")
    cpclass = cu.fetchall()
    cu.execute("SELECT * FROM `componentproperty`")
    componentproperty = cu.fetchall()
    return render(
        request, 'tableshow.html', {
            'row_list': a,
            'manu_list': b,
            'pmodel_list': pmodel,
            'cpclass_list': cpclass,
            'componentproperty_list': componentproperty
        })
コード例 #13
0
def getManuPmodelATA(request):
    if request.method == "POST":
        mysql_single, cu = MySQLSingle().getConCu()
        print("信息查询页面请求各种信息列表")
        cu.execute("select distinct Mername from manufacturer")
        res_mername = cu.fetchall()
        i = 0
        result_Mername = []
        temp = {}
        for obj in range(0, len(res_mername)):
            temp['id'] = res_mername[i]['Mername']
            temp['text'] = res_mername[i]['Mername']
            result_Mername.append(temp.copy())
            i = i + 1
        cu.execute("select distinct ATA from component")
        res_ata = cu.fetchall()
        i = 0
        result_ATA = []
        temp = {}
        for obj in range(0, len(res_ata)):
            temp['id'] = res_ata[i]['ATA']
            temp['text'] = res_ata[i]['ATA']
            result_ATA.append(temp.copy())
            i = i + 1
        cu.execute("select distinct PModelname from pmodel")
        res_pmodel = cu.fetchall()
        i = 0
        result_pmodel = []
        temp = {}
        for obj in range(0, len(res_pmodel)):
            temp['id'] = res_pmodel[i]['PModelname']
            temp['text'] = res_pmodel[i]['PModelname']
            result_pmodel.append(temp.copy())
            i = i + 1
        result = {}
        result['ATA'] = result_ATA
        result['PModelname'] = result_pmodel
        result['Mername'] = result_Mername
        return JsonResponse(result,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
コード例 #14
0
def getAllPnrs(request):
    if request.is_ajax():
        mysql_single, cu = MySQLSingle().getConCu()
        # 直接获取所有的post请求数据
        '''
        cu.execute(
            'create or REPLACE view combine(mername,pmodel,pnr) as select manufacturer.Mername as a,pmodel.PModelname as b,apply.prn as c from  pmodel INNER join manufacturer on pmodel.Mername = manufacturer.Mername inner join apply on pmodel.PModelname = apply.PModelname')
        mysql_single.commit()
        '''
        cu.execute(
            'SELECT DISTINCT * from combine inner join component on combine.pnr=component.PNR'
        )
        table_data = cu.fetchall()
        json_str = {}
        json_str['total'] = len(table_data)
        json_str['rows'] = table_data
        return JsonResponse(json_str,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
    else:
        return HttpResponse("收到")
コード例 #15
0
def getATANumbers(request):
    if request.method == "POST":
        mysql_single, cu = MySQLSingle().getConCu()
        data = request.POST
        pmodel = data.get('message')
        print("请横向柱状图信息列表")
        cu.execute(
            'select component.ATA as ATAname,count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" GROUP BY component.ATA '
            % pmodel)
        cu_ess = cu.fetchall()
        result_MFR = []
        result_number = []
        res = {}
        for i in range(0, len(cu_ess)):
            result_MFR.append("ATA" + str(cu_ess[i]['ATAname']))
            result_number.append(cu_ess[i]['anumber'])
        res['ATA'] = result_MFR
        res['number'] = result_number
        return JsonResponse(res,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
コード例 #16
0
def getTree(request):  # 返回具体的树内容
    ATAnum = '28'
    plane = 'A321'
    if request.method == "GET":
        plane = request.GET.get('plane', default='A321')
        ATAnum = request.GET.get('ATAnum', default='28')
        mysql_single, cu = MySQLSingle().getConCu()
        cu.execute('select DISTINCT ATA,ATA_name,ATA_name_zh from newtree where ATA="%s" and Plane="%s"' % (
            ATAnum, plane))
        message = cu.fetchall()
        result = {}
        for i in range(0, len(message)):
            result['name'] = message[i]['ATA_name_zh']
            break
        result['children'] = []
        cu.execute('select DISTINCT child_ATA,child_ATA_name,child_ATA_name_zh from newtree where ATA="%s" and Plane="%s"' % (
            ATAnum, plane))
        message = cu.fetchall()
        for i in range(0, len(message)):
            child1 = {}
            if message[i]['child_ATA_name_zh'] != None:
                child1['name'] = message[i]['child_ATA_name_zh']
            else:
                child1['name'] = message[i]['child_ATA_name']
            to_search = message[i]['child_ATA']
            child1['children'] = []
            cu.execute('select DISTINCT grandson_ATA,grandson_ATA_name,grandson_ATA_name_zh from newtree where child_ATA="%s" and Plane="%s"' % (
                to_search, plane))
            data = cu.fetchall()
            for item in range(0, len(data)):
                tmp = {}
                nm = ""
                if data[item]['grandson_ATA_name_zh'] != None:
                    nm = data[item]['grandson_ATA_name_zh']
                else:
                    nm = data[item]['grandson_ATA_name']
                tmp['name'] = nm
                child1['children'].append(tmp.copy())
            result['children'].append(child1.copy())
        return JsonResponse(result, safe=False, json_dumps_params={'ensure_ascii': False})
コード例 #17
0
def searchInfo(request):
    mysql_single, cu = MySQLSingle().getConCu()
    cu.execute('SELECT DISTINCT Mername from manufacturer')
    fist_res = cu.fetchall()
    result = []
    fist_node = {}
    second_node = {}
    thrid_node = {}
    for i in range(0, len(fist_res)):
        fist_node['id'] = fist_res[i]['Mername']
        fist_node['pId'] = '-1'
        fist_node['name'] = fist_res[i]['Mername']
        fist_node['child'] = []
        cu.execute(
            'SELECT DISTINCT PModelname from pmodel where Mername="%s"' %
            fist_res[i]['Mername'])
        second_res = cu.fetchall()
        for j in range(0, len(second_res)):
            cu.execute(
                'SELECT DISTINCT ATA from apply INNER JOIN component on apply.prn=component.PNR where apply.PModelname="%s"'
                % second_res[j]['PModelname'])
            thrid_res = cu.fetchall()
            second_node['id'] = fist_res[i]['Mername'] + "-" + second_res[j][
                'PModelname']
            second_node['pId'] = fist_res[i]['Mername']
            second_node['name'] = second_res[j]['PModelname']
            second_node['child'] = []

            for k in range(0, len(thrid_res)):
                thrid_node['id'] = fist_res[i]['Mername'] + "-" + second_res[
                    j]['PModelname'] + "-" + thrid_res[k]['ATA']
                thrid_node['pId'] = fist_res[i]['Mername'] + "-" + second_res[
                    j]['PModelname']
                thrid_node['name'] = thrid_res[k]['ATA']
                second_node['child'].append(thrid_node.copy())
            fist_node['child'].append(second_node.copy())
        result.append(fist_node.copy())
    return render(request, 'searchInfo.html', {'node_list': result})
コード例 #18
0
def alllevel(request):  # 返回整棵树内容
    mysql_single, cu = MySQLSingle().getConCu()
    cu.execute(
        'select DISTINCT child_ATA,child_ATA_name,child_ATA_name_zh from tree where ATA="28"')
    message = cu.fetchall()
    result = []
    second = []
    i = 0
    tmp = {}
    tmp['id'] = '28'
    tmp['pId'] = '0'
    tmp['name'] = '燃油'
    result.append(tmp.copy())
    for i in range(0, len(message)):
        tmp['id'] = message[i]['child_ATA']
        tmp['pId'] = '28'
        if message[i]['child_ATA_name_zh'] != None:
            tmp['name'] = message[i]['child_ATA_name_zh']
        else:
            tmp['name'] = message[i]['child_ATA_name']
        second.append(message[i]['child_ATA'])
        result.append(tmp.copy())
    for i in range(0, len(second)):
        cu.execute(
            'select DISTINCT grandson_ATA,grandson_ATA_name,grandson_ATA_name_zh from tree where child_ATA="%s"' % second[i])
        message = cu.fetchall()
        for j in range(0, len(message)):
            tmp = {}
            tmp['id'] = message[j]['grandson_ATA']
            tmp['pId'] = second[i]
            if message[j]['grandson_ATA_name_zh'] != None:
                tmp['name'] = message[j]['grandson_ATA_name_zh']
            else:
                tmp['name'] = message[j]['grandson_ATA_name']
            # print(tmp)
            result.append(tmp.copy())
    return JsonResponse(result, safe=False, json_dumps_params={'ensure_ascii': False})
コード例 #19
0
def getMfrNumbers(request):
    if request.method == "POST":
        mysql_single, cu = MySQLSingle().getConCu()
        data = request.POST
        pmodel = data.get('message')
        print("请柱状图信息列表")
        cu.execute(
            'select component.MFR as MFRname,count(*) as lnumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" GROUP BY component.MFR ORDER BY lnumber DESC'
            % pmodel)
        cu_ess = cu.fetchall()
        result_MFR = []
        result_number = []
        res = {}
        number = 20  #限制数量
        for i in range(0, len(cu_ess)):
            if i >= 20:
                break
            result_MFR.append(cu_ess[i]['MFRname'])
            result_number.append(cu_ess[i]['lnumber'])
        res['MFR'] = result_MFR
        res['number'] = result_number
        return JsonResponse(res,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
コード例 #20
0
def getATA2ESSNumbers(request):
    if request.method == "POST":
        mysql_single, cu = MySQLSingle().getConCu()
        data = request.POST
        pmodel = data.get('pmodel')
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ATA = "28" and component.ESS = "1" '
            % pmodel)
        cu_ess1_ata28 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ATA = "32" and component.ESS = "1" '
            % pmodel)
        cu_ess1_ata32 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ATA = "34" and component.ESS = "1" '
            % pmodel)
        cu_ess1_ata34 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ATA = "28" and component.ESS = "2" '
            % pmodel)
        cu_ess2_ata28 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ATA = "32" and component.ESS = "2" '
            % pmodel)
        cu_ess2_ata32 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ATA = "34" and component.ESS = "2" '
            % pmodel)
        cu_ess2_ata34 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ATA = "28" and component.ESS = "3" '
            % pmodel)
        cu_ess3_ata28 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ATA = "32" and component.ESS = "3" '
            % pmodel)
        cu_ess3_ata32 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ATA = "34" and component.ESS = "3" '
            % pmodel)
        cu_ess3_ata34 = cu.fetchall()
        #first = ['spc', 1, 2, 6]
        second = [
            'ATA=28', cu_ess1_ata28[0]['anumber'], cu_ess2_ata28[0]['anumber'],
            cu_ess3_ata28[0]['anumber']
        ]
        thrid = [
            'ATA=32', cu_ess1_ata32[0]['anumber'], cu_ess2_ata32[0]['anumber'],
            cu_ess3_ata32[0]['anumber']
        ]
        fourth = [
            'ATA=34', cu_ess1_ata34[0]['anumber'], cu_ess2_ata34[0]['anumber'],
            cu_ess3_ata34[0]['anumber']
        ]
        res = []
        #res.append(first)
        res.append(second)
        res.append(thrid)
        res.append(fourth)
        return JsonResponse(res,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})
コード例 #21
0
def getSPCESSNumbers(request):
    if request.method == "POST":
        mysql_single, cu = MySQLSingle().getConCu()
        data = request.POST
        pmodel = data.get('pmodel')
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "1" and component.SPC = "1" '
            % pmodel)
        cu_spc1_ess1 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "2" and component.SPC = "1" '
            % pmodel)
        cu_spc1_ess2 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "3" and component.SPC = "1" '
            % pmodel)
        cu_spc1_ess3 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "1" and component.SPC = "2" '
            % pmodel)
        cu_spc2_ess1 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "2" and component.SPC = "2" '
            % pmodel)
        cu_spc2_ess2 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "3" and component.SPC = "2" '
            % pmodel)
        cu_spc2_ess3 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "1" and component.SPC = "6" '
            % pmodel)
        cu_spc6_ess1 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "2" and component.SPC = "6" '
            % pmodel)
        cu_spc6_ess2 = cu.fetchall()
        cu.execute(
            'select count(*) as anumber  from component inner join apply where apply.prn = component.PNR and apply.PModelname="%s" and component.ESS = "3" and component.SPC = "6" '
            % pmodel)
        cu_spc6_ess3 = cu.fetchall()
        #first = ['spc', 1, 2, 6]
        second = [
            'ESS=1', cu_spc1_ess1[0]['anumber'], cu_spc2_ess1[0]['anumber'],
            cu_spc6_ess1[0]['anumber']
        ]
        thrid = [
            'ESS=2', cu_spc1_ess2[0]['anumber'], cu_spc2_ess2[0]['anumber'],
            cu_spc6_ess2[0]['anumber']
        ]
        fourth = [
            'ESS=3', cu_spc1_ess3[0]['anumber'], cu_spc2_ess3[0]['anumber'],
            cu_spc6_ess3[0]['anumber']
        ]
        res = []
        #res.append(first)
        res.append(second)
        res.append(thrid)
        res.append(fourth)
        return JsonResponse(res,
                            safe=False,
                            json_dumps_params={'ensure_ascii': False})