code_convert.py 5.48 KB
#encoding=utf-8

from excel_to_dict import excel_to_list
s1 = [['1', '001'], ['7', '002'], ['25', '003'], ['4', '004'], ['27', '005'], ['3', '006'], ['14', '007'], ['8', '008'], ['10', '009'], ['21', '010'], ['15', '011'], ['9', '012'], ['2', '013'], ['11', '014'], ['13', '015'], ['35', '016'], ['24', '017'], ['22', '018'], ['18', '019'], ['33', '020'], ['36', '021'], ['42', '022'], ['67', '023'], ['81', '025'], ['16', '026'], ['19', '027'], ['32', '028'], ['28', '029'], ['6', '030'], ['31', '031'], ['38', '032'], ['68', '033'], ['17', '034'], ['29', '035'], ['39', '037'], ['5', '038'], ['41', '039'], ['12', '040'], ['26', '041'], ['23', '042'], ['82', '043'], ['61', '044'], ['52', '047'], ['50', '051'], ['34', '052'], ['54', '053'], ['91', '056'], ['105', '057'], ['88', '058'], ['80', '065'], ['53', '066'], ['49', '067'], ['40', '070'], ['111', '081'], ['132', '083'], ['106', '086'], ['60', '087'], ['57', '090'], ['47', '095'], ['48', '096'], ['124', '103'], ['66', '104'], ['59', '107'], ['46', '108'], ['62', '109'], ['65', '110'], ['115', '112'], ['120', '117'], ['58', '121'], ['56', '124'], ['77', '128'], ['84', '191'], ['85', '230']]

s2 = [['37','024'],['89','036'],['30','045'],['64','049'],['135','054'],['95','060'],['98','061'],['45','062'],['44','068'],
      ['55','069'],['83','071'],['87','076'],['59','088'],['71','089'],['63','092'],['78','113'],['79','115'],['51','112'],
      ['113','155'],['-1','999'],['0','999'],['137','109'],['127','999']]

wenan_code_huawei_code_CLPP = s1 + s2

# def convert_CLPP(clpp_code):
#     for CLPP_code in wenan_code_huawei_code_CLPP:
#         #print(CLPP_code)
#         if CLPP_code[0] == clpp_code:
#             clpp_code = CLPP_code[1]
#     return  clpp_code

wenan_code_huawei_code_CSYS = [['02', 'A'], ['03', 'B'], ['12', 'C'], ['15', 'D'],
                               ['05', 'E'], ['16', 'F'], ['07', 'G'], ['09', 'H'],
                               ['01', 'J'], ['14', 'M'], ['17', 'Z'],['00','Y']]



#wenan_code_huawei_code_CLLX = [['01', '03'], ['03', '06'], ['04', '14'], ['10', '99'],['07','01'],['08','04'],['02','13']]
#wenan_code_huawei_code_CLLX = [['00', '02'], ['01', '03'], ['02', '13'], ['03', '06'],['04','14'],['07','01'],
                               #['08','04'],['09','01'],['10','99'],['11','99']]

#wenan_code_huawei_code_CLLX = [['H30','01'],['K33', '02'], ['H10', '03'],['K20','04'],['H20','03'],['K30','05'], ['K10', '06']]
wenan_code_huawei_code_CLLX = [['H30','005'],['K33', '001'], ['H10', '006'],['K20','003'],['H20','006'],['K30','003'], ['K10', '004'], ['X99','999']]

def convert_code(analyze_code,wenan_code_to_huawei_code):
    #print("----",analyze_code,wenan_code_to_huawei_code)
    for code_to_code in wenan_code_to_huawei_code:
        if (code_to_code[0] == analyze_code):
            analyze_code = code_to_code[1]
            print(code_to_code[0],'---------covert-------',analyze_code)
            return analyze_code



# def convert_code(analyze_code, wenan_code_to_huawei_code):
#     print("----",analyze_code,wenan_code_to_huawei_code)
#     if analyze_code in [code_to_code[0] for code_to_code in wenan_code_to_huawei_code]:
#         print(analyze_code,'----++++',[code_to_code[0] for code_to_code in wenan_code_to_huawei_code])
#         print()
#         analyze_code = code_to_code[1]
#         print(code_to_code[0],'---------covert-------',analyze_code)
#         return  analyze_code
#     else:
#         print('没有对应code......')
#         return analyze_code

# wenan_code_huawei_code_CDLX = [['02', '01'], ['00', '02'], ['01', '03'],
#                                ['9', '05'], ['3', '06'], ['4', '07'],
#                                ['6', '08'], ['7', '09'], ['8', '10'],
#                                ['0', '11'], ['1', '12'], ['2', '13']]

wenan_code_huawei_code_CDLX = [['02', '01'], ['00', '02'], ['01', '03'],
                               ['09', '05'], ['03', '06'], ['04', '07'],
                               ['06', '08'], ['07', '09'], ['08', '10'],
                               ['10', '11'], ['11', '12']]

wenan_code_huawei_code_event = [['01','02'],['06','03'],['21','06'],['19','07'],['40','08'],['26','09']]

#wenan_code_huawei_code_HPYS = [['5', '1'], ['1', '2'], ['2', '3'], ['3', '4'], ['6', '5'], ['1', '6'], ['9', '9'],['0','0']]

wenan_code_huawei_code_HPYS = [['0','0'],['1','2'],['2','3'],['3','4'],['4','5'],['6', '5'],['5','1'],['9','9'],['7','6']]

wenan_code_huawei_code_HPZL = [['31','52'],['32','51'],['00','99']]


wenan_code_huawei_code_WFDM = [[u'06', '47020'], [u'22', '46080'], [u'36', '42040'], [u'38', '12230']]



#wenan_code_huawei_code_WFDM = excel_to_list('illegal_code_file.xlsx')
wenan_code_huawei_code_WFDM = excel_to_list(r'/app/illegal_code_file.xlsx')

wenan_code_huawei_code_SJLX = excel_to_list(r'/app/event_code_file.xlsx')
if __name__ == '__main__':
    # a = convert_code('06',wenan_code_huawei_code_WFDM)
    # print(a)
    #print wenan_code_huawei_code_WFDM
    # print wenan_code_huawei_code_WFDM
    # print wenan_code_huawei_code_WFDM
    #print(wenan_code_huawei_code_SJLX)
    print(convert_code('00',wenan_code_huawei_code_CDLX))
    #print(convert_code('yichangtingche2', wenan_code_huawei_code_SJLX))
    #print( convert_code('1',wenan_code_huawei_code_CDLX),'----')
    #print(wenan_code_huawei_code_WFDM)
    # a = [[u'03', '46140'], [u'04', '46140'], [u'05', '40100'], [u'06', '47020'], [u'15', '40010'], [u'22', '46080']]
    # print [i[0] for i in a]
    print(wenan_code_huawei_code_WFDM)