package main

//根据字符特征打分
//3为最高分，pj为评级 A AD A  AA AA AB
func Select(compareStr string, info *Info, compareInfo *ProjectInfo) (res, pj int) {
	//没有可对比的项目名称、或项目编号 //评级
	if compareNoPass[compareStr] {

	} else {
		switch compareStr {
		case "AAA":
			res = 3
			pj = 3
		case "AAB":
			res = 3
			pj = 3
		case "ABA":
			res = 3
			pj = 3
		case "ABB":
			if info.LenPN > 10 || info.PCBH > 8 || info.PTCBH > 8 {
				res = 3
			} else {
				res = 2
			}
			pj = 3
		case "BAA":
			if info.PNBH > 10 || info.LenPC > 8 || info.LenPTC > 8 {
				res = 3
			} else {
				res = 2
			}
			pj = 3
		case "BAB":
			if info.PNBH > 10 || info.LenPTC > 8 || info.PTCBH > 8 {
				res = 3
			} else {
				res = 2
			}
			pj = 3
		case "BBA":
			if info.PNBH > 10 || info.PCBH > 8 || info.LenPC > 8 {
				res = 3
			} else {
				res = 2
			}
			pj = 3
		case "BBB":
			v := 0
			if info.PNBH > 10 {
				v++
			}
			if info.PCBH > 8 {
				v++
			}
			if info.PTCBH > 8 {
				v++
			}
			if v > 1 {
				res = 3
			} else {
				res = 2
			}
			pj = 2
		case "AAD":
			if info.LenPC > 8 || info.LenPN > 12 {
				res = 3
			} else {
				res = 2
			}
			pj = 3
		case "ABD":
			if info.LenPN > 10 && info.PCBH > 8 {
				res = 3
				pj = 2
			} else if info.LenPN > 10 || info.PCBH > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "BAD":
			if info.LenPC > 13 || (info.PNBH > 10 && info.LenPC > 8) {
				res = 3
				pj = 3
			} else if info.PNBH > 10 || info.LenPC > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "BBD":
			if info.PNBH > 12 && info.PCBH > 10 {
				res = 3
				pj = 1
			} else if info.PNBH > 10 && info.PCBH > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "ADA":
			if info.LenPN > 12 || (info.LenPTC > 8 && !StrOrNum2.MatchString(info.PTC)) {
				res = 3
			} else {
				res = 2
			}
			pj = 2
		case "ADB":
			if info.LenPN > 10 && info.PTCBH > 8 && !StrOrNum2.MatchString(info.PTC) {
				res = 3
				pj = 2
			} else if info.LenPN > 10 || info.PTCBH > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "BDA":
			if info.PNBH > 10 && info.LenPTC > 8 && !StrOrNum2.MatchString(info.PTC) {
				res = 3
				pj = 2
			} else if info.PNBH > 10 || info.LenPTC > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "BDB":
			if info.PNBH > 12 && info.PTCBH > 10 && !StrOrNum2.MatchString(info.PTC) {
				res = 3
			} else if info.PNBH > 10 && info.PTCBH > 8 {
				res = 2
			} else {
				res = 1
			}
			pj = 2
		case "ADD":
			if info.LenPN > 18 {
				res = 3
				pj = 2
			} else if info.LenPN > 10 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 2
			}
		case "BDD":
			if info.PNBH > 10 {
				res = 2
			} else {
				res = 1
			}
			pj = 1
		case "DAA":
			if info.LenPTC > 8 || info.LenPC > 8 {
				res = 3
				pj = 2
			} else {
				res = 2
				pj = 3
			}
		case "DAB":
			if info.LenPC > 8 && info.PTCBH > 8 {
				res = 3
				pj = 2
			} else if info.LenPC > 8 || info.PTCBH > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "DAD":
			if info.LenPC > 14 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 3
				pj = 2
			} else if info.LenPC > 8 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 2
			}
		case "DBA":
			if info.PCBH > 8 && info.LenPC > 8 && !StrOrNum2.MatchString(info.PTC) {
				res = 3
				pj = 2
			} else if info.PCBH > 8 || info.LenPC > 8 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 3
			}
		case "DBB":
			if info.PCBH > 10 && info.PTCBH > 10 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 3
				pj = 1
			} else if info.PCBH > 8 && info.PTCBH > 8 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 3
			}
		case "DBD":
			if info.PCBH > 12 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 2
				pj = 1
			} else {
				res = 1
				pj = 1
			}
		case "DDA":
			if info.LenPTC > 14 && !StrOrNum2.MatchString(info.PTC) {
				res = 3
				pj = 1
			} else if info.LenPTC > 8 {
				res = 2
				pj = 1
			} else {
				res = 1
				pj = 2
			}
		case "DDB":
			if info.PTCBH > 12 && !StrOrNum2.MatchString(info.PTC) {
				res = 2
			} else {
				res = 1
			}
			pj = 1
		case "ACA":
			if info.LenPN > 10 && info.LenPTC > 8 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
				res = 3
				pj = 2
			} else if info.LenPN > 10 || info.LenPTC > 8 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 3
			}
		case "ACB":
			if info.LenPN > 10 && info.PTCBH > 8 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
				res = 3
				pj = 2
			} else if info.LenPN > 10 || info.PTCBH > 8 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 3
			}
		case "BCA":
			if (info.PNBH > 10 && info.LenPTC > 8) || info.LenPTC > 12 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
				res = 3
				pj = 2
			} else if info.PNBH > 10 || info.LenPTC > 8 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 3
			}
		case "BCB":
			if info.PNBH > 12 && info.PTCBH > 12 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
				res = 3
				pj = 1
			} else if info.PNBH > 10 || info.PTCBH > 8 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 2
			}
		case "AAC":
			if (info.LenPN > 10 && info.LenPC > 8) || info.LenPN > 14 || (info.LenPC > 10 && !StrOrNum2.MatchString(info.ProjectCode)) {
				res = 3
				pj = 3
			} else {
				res = 2
				pj = 3
			}
		case "ABC":
			if info.LenPN > 14 && info.PCBH > 10 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 3
				pj = 2
			} else if info.LenPN > 10 || info.PCBH > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "BAC":
			if info.PNBH > 14 && info.LenPC > 8 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 3
				pj = 2
			} else if info.PNBH > 10 || info.LenPC > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "BBC":
			if info.PNBH > 14 && info.PCBH > 10 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 3
				pj = 1
			} else if info.PNBH > 10 || info.PCBH > 8 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 2
			}
		case "ACC":
			if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
				if info.LenPN > 16 {
					res = 2
					pj = 1
				} else {
					res = 1
					pj = 2
				}
			}
		case "ACD":
			//项目编号不一致
			if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
				if info.LenPN > 16 {

					res = 2
				} else {
					res = 1

				}
				pj = 1
			}

		case "ADC":
			if info.LenPN > 16 {
				res = 2
			} else {
				res = 1
			}
			pj = 1
		case "BCC":
			//项目编号不一致
			if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
				if info.PNBH > 12 {
					res = 1
				}
				pj = 1
			}
		case "BCD":
			//项目编号不一致
			if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
				if info.PNBH > 8 {
					res = 1
				}
				pj = 1
			}
		case "BDC":
			if info.PNBH > 7 {
				res = 1
			}
			pj = 1
		case "CAA":
			if info.LenPC > 12 || info.LenPTC > 12 {
				res = 3
				pj = 2
			} else if info.LenPC > 8 || info.LenPTC > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "CAB":
			if info.LenPC > 12 && info.PTCBH > 8 {
				res = 3
				pj = 2
			} else if info.LenPC > 12 || info.PTCBH > 8 {
				res = 2
				pj = 3
			} else {
				res = 1
				pj = 3
			}
		case "CAC":
			if info.LenPC > 9 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 1
			}
		case "CAD":
			if info.LenPC > 9 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 2
			} else {
				res = 1
			}
			pj = 1
		case "CBA":
			if info.LenPTC > 14 && info.PCBH > 12 {
				res = 3
				pj = 2
			} else if info.LenPTC > 12 || info.PCBH > 10 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 2
			}
		case "CBB":
			if info.PCBH > 13 && info.PTCBH > 13 {
				res = 3
				pj = 1
			} else if info.PCBH > 9 || info.PTCBH > 9 {
				res = 2
				pj = 2
			} else {
				res = 1
				pj = 2
			}
		case "CBC":
			if info.PCBH > 14 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 2
			} else if info.PCBH > 5 {
				res = 1
			}
			pj = 1
		case "CBD":
			if info.PCBH > 14 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 2
			} else if info.PCBH > 5 {
				res = 1
			}
			pj = 1
		case "CCA":
			if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
				if info.LenPTC > 12 && !StrOrNum2.MatchString(info.PTC) {
					res = 2
				} else if info.LenPTC > 5 {
					res = 1
				}
				pj = 1
			}
		case "CCB":
			if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
				if info.PTCBH > 10 && !StrOrNum2.MatchString(info.PTC) {
					res = 1
				}
				pj = 1
			}
		case "CDA":
			if info.LenPTC > 12 && !StrOrNum2.MatchString(info.PTC) {
				res = 2
			} else {
				res = 1
			}
			pj = 1
		case "CDB":
			if info.PTCBH > 10 && !StrOrNum2.MatchString(info.PTC) {
				res = 1
				pj = 1
			}
		case "DAC":
			if info.LenPC > 13 && !StrOrNum2.MatchString(info.ProjectCode) {
				res = 3
			} else if info.LenPC > 8 {
				res = 2
			} else {
				res = 1
			}
			pj = 1
		case "DBC":
			if info.PCBH > 8 {
				res = 1
			}
			pj = 1
		case "DCA":
			if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
				if info.LenPTC > 10 {
					res = 2
				} else {
					res = 1
				}
				pj = 1
			}
		case "DCB":
			if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
				if info.PTCBH > 8 && !StrOrNum2.MatchString(info.PTC) {
					res = 1
				}
				pj = 1
			}
		}

	}
	return
}
