merge_select.go 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. package main
  2. // 根据字符特征打分
  3. // 3为最高分,pj为评级 A AD A AA AA AB
  4. func Select(compareStr string, info *Info, compareInfo *Project) (res, pj int) {
  5. //没有可对比的项目名称、或项目编号 //评级
  6. if compareNoPass[compareStr] {
  7. } else {
  8. switch compareStr {
  9. case "AAA":
  10. res = 3
  11. pj = 3
  12. case "AAB":
  13. res = 3
  14. pj = 3
  15. case "ABA":
  16. res = 3
  17. pj = 3
  18. case "ABB":
  19. if info.LenPN > 10 || info.PCBH > 8 || info.PTCBH > 8 {
  20. res = 3
  21. } else {
  22. res = 2
  23. }
  24. pj = 3
  25. case "BAA":
  26. if info.PNBH > 10 || info.LenPC > 8 || info.LenPTC > 8 {
  27. res = 3
  28. } else {
  29. res = 2
  30. }
  31. pj = 3
  32. case "BAB":
  33. if info.PNBH > 10 || info.LenPTC > 8 || info.PTCBH > 8 {
  34. res = 3
  35. } else {
  36. res = 2
  37. }
  38. pj = 3
  39. case "BBA":
  40. if info.PNBH > 10 || info.PCBH > 8 || info.LenPC > 8 {
  41. res = 3
  42. } else {
  43. res = 2
  44. }
  45. pj = 3
  46. case "BBB":
  47. v := 0
  48. if info.PNBH > 10 {
  49. v++
  50. }
  51. if info.PCBH > 8 {
  52. v++
  53. }
  54. if info.PTCBH > 8 {
  55. v++
  56. }
  57. if v > 1 {
  58. res = 3
  59. } else {
  60. res = 2
  61. }
  62. pj = 2
  63. case "AAD":
  64. if info.LenPC > 8 || info.LenPN > 12 {
  65. res = 3
  66. } else {
  67. res = 2
  68. }
  69. pj = 3
  70. case "ABD":
  71. if info.LenPN > 10 && info.PCBH > 8 {
  72. res = 3
  73. pj = 2
  74. } else if info.LenPN > 10 || info.PCBH > 8 {
  75. res = 2
  76. pj = 3
  77. } else {
  78. res = 1
  79. pj = 3
  80. }
  81. case "BAD":
  82. if info.LenPC > 13 || (info.PNBH > 10 && info.LenPC > 8) {
  83. res = 3
  84. pj = 3
  85. } else if info.PNBH > 10 || info.LenPC > 8 {
  86. res = 2
  87. pj = 3
  88. } else {
  89. res = 1
  90. pj = 3
  91. }
  92. case "BBD":
  93. if info.PNBH > 12 && info.PCBH > 10 {
  94. res = 3
  95. pj = 1
  96. } else if info.PNBH > 10 && info.PCBH > 8 {
  97. res = 2
  98. pj = 3
  99. } else {
  100. res = 1
  101. pj = 3
  102. }
  103. case "ADA":
  104. if info.LenPN > 12 || (info.LenPTC > 8 && !StrOrNum2.MatchString(info.PTC)) {
  105. res = 3
  106. } else {
  107. res = 2
  108. }
  109. pj = 2
  110. case "ADB":
  111. if info.LenPN > 10 && info.PTCBH > 8 && !StrOrNum2.MatchString(info.PTC) {
  112. res = 3
  113. pj = 2
  114. } else if info.LenPN > 10 || info.PTCBH > 8 {
  115. res = 2
  116. pj = 3
  117. } else {
  118. res = 1
  119. pj = 3
  120. }
  121. case "BDA":
  122. if info.PNBH > 10 && info.LenPTC > 8 && !StrOrNum2.MatchString(info.PTC) {
  123. res = 3
  124. pj = 2
  125. } else if info.PNBH > 10 || info.LenPTC > 8 {
  126. res = 2
  127. pj = 3
  128. } else {
  129. res = 1
  130. pj = 3
  131. }
  132. case "BDB":
  133. if info.PNBH > 12 && info.PTCBH > 10 && !StrOrNum2.MatchString(info.PTC) {
  134. res = 3
  135. } else if info.PNBH > 10 && info.PTCBH > 8 {
  136. res = 2
  137. } else {
  138. res = 1
  139. }
  140. pj = 2
  141. case "ADD":
  142. if info.LenPN > 18 {
  143. res = 3
  144. pj = 2
  145. } else if info.LenPN > 10 {
  146. res = 2
  147. pj = 2
  148. } else {
  149. res = 1
  150. pj = 2
  151. }
  152. case "BDD":
  153. if CheckContain(info.ProjectName, compareInfo.ProjectName) != 3 {
  154. if info.PNBH > 10 {
  155. res = 2
  156. } else {
  157. res = 1
  158. }
  159. pj = 1
  160. }
  161. case "DAA":
  162. if info.LenPTC > 8 || info.LenPC > 8 {
  163. res = 3
  164. pj = 2
  165. } else {
  166. res = 2
  167. pj = 3
  168. }
  169. case "DAB":
  170. if info.LenPC > 8 && info.PTCBH > 8 {
  171. res = 3
  172. pj = 2
  173. } else if info.LenPC > 8 || info.PTCBH > 8 {
  174. res = 2
  175. pj = 3
  176. } else {
  177. res = 1
  178. pj = 3
  179. }
  180. case "DAD":
  181. if info.LenPC > 14 && !StrOrNum2.MatchString(info.ProjectCode) {
  182. res = 3
  183. pj = 2
  184. } else if info.LenPC > 8 {
  185. res = 2
  186. pj = 2
  187. } else {
  188. res = 1
  189. pj = 2
  190. }
  191. case "DBA":
  192. if info.PCBH > 8 && info.LenPC > 8 && !StrOrNum2.MatchString(info.PTC) {
  193. res = 3
  194. pj = 2
  195. } else if info.PCBH > 8 || info.LenPC > 8 {
  196. res = 2
  197. pj = 2
  198. } else {
  199. res = 1
  200. pj = 3
  201. }
  202. case "DBB":
  203. if info.PCBH > 10 && info.PTCBH > 10 && !StrOrNum2.MatchString(info.ProjectCode) {
  204. res = 3
  205. pj = 1
  206. } else if info.PCBH > 8 && info.PTCBH > 8 {
  207. res = 2
  208. pj = 2
  209. } else {
  210. res = 1
  211. pj = 3
  212. }
  213. case "DBD":
  214. if info.PCBH > 12 && !StrOrNum2.MatchString(info.ProjectCode) {
  215. res = 2
  216. pj = 1
  217. } else {
  218. res = 1
  219. pj = 1
  220. }
  221. case "DDA":
  222. if info.LenPTC > 14 && !StrOrNum2.MatchString(info.PTC) {
  223. res = 3
  224. pj = 1
  225. } else if info.LenPTC > 8 {
  226. res = 2
  227. pj = 1
  228. } else {
  229. res = 1
  230. pj = 2
  231. }
  232. case "DDB":
  233. if info.PTCBH > 12 && !StrOrNum2.MatchString(info.PTC) {
  234. res = 2
  235. } else {
  236. res = 1
  237. }
  238. pj = 1
  239. case "ACA":
  240. if info.LenPN > 10 && info.LenPTC > 8 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
  241. res = 3
  242. pj = 2
  243. } else if info.LenPN > 10 || info.LenPTC > 8 {
  244. res = 2
  245. pj = 2
  246. } else {
  247. res = 1
  248. pj = 3
  249. }
  250. case "ACB":
  251. if info.LenPN > 10 && info.PTCBH > 8 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
  252. res = 3
  253. pj = 2
  254. } else if info.LenPN > 10 || info.PTCBH > 8 {
  255. res = 2
  256. pj = 2
  257. } else {
  258. res = 1
  259. pj = 3
  260. }
  261. case "BCA":
  262. if (info.PNBH > 10 && info.LenPTC > 8) || info.LenPTC > 12 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
  263. res = 3
  264. pj = 2
  265. } else if info.PNBH > 10 || info.LenPTC > 8 {
  266. res = 2
  267. pj = 2
  268. } else {
  269. res = 1
  270. pj = 3
  271. }
  272. case "BCB":
  273. if info.PNBH > 12 && info.PTCBH > 12 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
  274. res = 3
  275. pj = 1
  276. } else if info.PNBH > 10 || info.PTCBH > 8 {
  277. res = 2
  278. pj = 2
  279. } else {
  280. res = 1
  281. pj = 2
  282. }
  283. case "AAC":
  284. if (info.LenPN > 10 && info.LenPC > 8) || info.LenPN > 14 || (info.LenPC > 10 && !StrOrNum2.MatchString(info.ProjectCode)) {
  285. res = 3
  286. pj = 3
  287. } else {
  288. res = 2
  289. pj = 3
  290. }
  291. case "ABC":
  292. if info.LenPN > 14 && info.PCBH > 10 && !StrOrNum2.MatchString(info.ProjectCode) {
  293. res = 3
  294. pj = 2
  295. } else if info.LenPN > 10 || info.PCBH > 8 {
  296. res = 2
  297. pj = 3
  298. } else {
  299. res = 1
  300. pj = 3
  301. }
  302. case "BAC":
  303. if info.PNBH > 14 && info.LenPC > 8 && !StrOrNum2.MatchString(info.ProjectCode) {
  304. res = 3
  305. pj = 2
  306. } else if info.PNBH > 10 || info.LenPC > 8 {
  307. res = 2
  308. pj = 3
  309. } else {
  310. res = 1
  311. pj = 3
  312. }
  313. case "BBC":
  314. if info.PNBH > 14 && info.PCBH > 10 && !StrOrNum2.MatchString(info.ProjectCode) {
  315. res = 3
  316. pj = 1
  317. } else if info.PNBH > 10 || info.PCBH > 8 {
  318. res = 2
  319. pj = 2
  320. } else {
  321. res = 1
  322. pj = 2
  323. }
  324. case "ACC":
  325. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  326. if info.LenPN > 16 {
  327. res = 2
  328. pj = 1
  329. } else {
  330. res = 1
  331. pj = 2
  332. }
  333. }
  334. case "ACD":
  335. //项目编号不一致
  336. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  337. if info.LenPN > 16 {
  338. res = 2
  339. } else {
  340. res = 1
  341. }
  342. pj = 1
  343. }
  344. case "ADC":
  345. if info.LenPN > 16 {
  346. res = 2
  347. } else {
  348. res = 1
  349. }
  350. pj = 1
  351. case "BCC":
  352. //项目编号不一致
  353. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  354. if info.PNBH > 12 {
  355. res = 1
  356. }
  357. pj = 1
  358. }
  359. case "BCD":
  360. //项目编号不一致
  361. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  362. if info.PNBH > 8 {
  363. res = 1
  364. }
  365. pj = 1
  366. }
  367. case "BDC":
  368. if info.PNBH > 7 {
  369. res = 1
  370. }
  371. pj = 1
  372. case "CAA":
  373. if info.LenPC > 12 || info.LenPTC > 12 {
  374. res = 3
  375. pj = 2
  376. } else if info.LenPC > 8 || info.LenPTC > 8 {
  377. res = 2
  378. pj = 3
  379. } else {
  380. res = 1
  381. pj = 3
  382. }
  383. case "CAB":
  384. if info.LenPC > 12 && info.PTCBH > 8 {
  385. res = 3
  386. pj = 2
  387. } else if info.LenPC > 12 || info.PTCBH > 8 {
  388. res = 2
  389. pj = 3
  390. } else {
  391. res = 1
  392. pj = 3
  393. }
  394. case "CAC":
  395. if info.LenPC > 9 && !StrOrNum2.MatchString(info.ProjectCode) {
  396. res = 2
  397. pj = 2
  398. } else {
  399. res = 1
  400. pj = 1
  401. }
  402. case "CAD":
  403. if info.LenPC > 9 && !StrOrNum2.MatchString(info.ProjectCode) {
  404. res = 2
  405. } else {
  406. res = 1
  407. }
  408. pj = 1
  409. case "CBA":
  410. if info.LenPTC > 14 && info.PCBH > 12 {
  411. res = 3
  412. pj = 2
  413. } else if info.LenPTC > 12 || info.PCBH > 10 {
  414. res = 2
  415. pj = 2
  416. } else {
  417. res = 1
  418. pj = 2
  419. }
  420. case "CBB":
  421. if info.PCBH > 13 && info.PTCBH > 13 {
  422. res = 3
  423. pj = 1
  424. } else if info.PCBH > 9 || info.PTCBH > 9 {
  425. res = 2
  426. pj = 2
  427. } else {
  428. res = 1
  429. pj = 2
  430. }
  431. case "CBC":
  432. if info.PCBH > 14 && !StrOrNum2.MatchString(info.ProjectCode) {
  433. res = 2
  434. } else if info.PCBH > 5 {
  435. res = 1
  436. }
  437. pj = 1
  438. case "CBD":
  439. if info.PCBH > 14 && !StrOrNum2.MatchString(info.ProjectCode) {
  440. res = 2
  441. } else if info.PCBH > 5 {
  442. res = 1
  443. }
  444. pj = 1
  445. case "CCA":
  446. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  447. if info.LenPTC > 12 && !StrOrNum2.MatchString(info.PTC) {
  448. res = 2
  449. } else if info.LenPTC > 5 {
  450. res = 1
  451. }
  452. pj = 1
  453. }
  454. case "CCB":
  455. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  456. if info.PTCBH > 10 && !StrOrNum2.MatchString(info.PTC) {
  457. res = 1
  458. }
  459. pj = 1
  460. }
  461. case "CDA":
  462. if info.LenPTC > 12 && !StrOrNum2.MatchString(info.PTC) {
  463. res = 2
  464. } else {
  465. res = 1
  466. }
  467. pj = 1
  468. case "CDB":
  469. if info.PTCBH > 10 && !StrOrNum2.MatchString(info.PTC) {
  470. res = 1
  471. pj = 1
  472. }
  473. case "DAC":
  474. if info.LenPC > 13 && !StrOrNum2.MatchString(info.ProjectCode) {
  475. res = 3
  476. } else if info.LenPC > 8 {
  477. res = 2
  478. } else {
  479. res = 1
  480. }
  481. pj = 1
  482. case "DBC":
  483. if info.PCBH > 8 {
  484. res = 1
  485. }
  486. pj = 1
  487. case "DCA":
  488. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  489. if info.LenPTC > 10 {
  490. res = 2
  491. } else {
  492. res = 1
  493. }
  494. pj = 1
  495. }
  496. case "DCB":
  497. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  498. if info.PTCBH > 8 && !StrOrNum2.MatchString(info.PTC) {
  499. res = 1
  500. }
  501. pj = 1
  502. }
  503. }
  504. }
  505. return
  506. }