merge_select.go 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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 info.PNBH > 10 {
  154. res = 2
  155. } else {
  156. res = 1
  157. }
  158. pj = 1
  159. case "DAA":
  160. if info.LenPTC > 8 || info.LenPC > 8 {
  161. res = 3
  162. pj = 2
  163. } else {
  164. res = 2
  165. pj = 3
  166. }
  167. case "DAB":
  168. if info.LenPC > 8 && info.PTCBH > 8 {
  169. res = 3
  170. pj = 2
  171. } else if info.LenPC > 8 || info.PTCBH > 8 {
  172. res = 2
  173. pj = 3
  174. } else {
  175. res = 1
  176. pj = 3
  177. }
  178. case "DAD":
  179. if info.LenPC > 14 && !StrOrNum2.MatchString(info.ProjectCode) {
  180. res = 3
  181. pj = 2
  182. } else if info.LenPC > 8 {
  183. res = 2
  184. pj = 2
  185. } else {
  186. res = 1
  187. pj = 2
  188. }
  189. case "DBA":
  190. if info.PCBH > 8 && info.LenPC > 8 && !StrOrNum2.MatchString(info.PTC) {
  191. res = 3
  192. pj = 2
  193. } else if info.PCBH > 8 || info.LenPC > 8 {
  194. res = 2
  195. pj = 2
  196. } else {
  197. res = 1
  198. pj = 3
  199. }
  200. case "DBB":
  201. if info.PCBH > 10 && info.PTCBH > 10 && !StrOrNum2.MatchString(info.ProjectCode) {
  202. res = 3
  203. pj = 1
  204. } else if info.PCBH > 8 && info.PTCBH > 8 {
  205. res = 2
  206. pj = 2
  207. } else {
  208. res = 1
  209. pj = 3
  210. }
  211. case "DBD":
  212. if info.PCBH > 12 && !StrOrNum2.MatchString(info.ProjectCode) {
  213. res = 2
  214. pj = 1
  215. } else {
  216. res = 1
  217. pj = 1
  218. }
  219. case "DDA":
  220. if info.LenPTC > 14 && !StrOrNum2.MatchString(info.PTC) {
  221. res = 3
  222. pj = 1
  223. } else if info.LenPTC > 8 {
  224. res = 2
  225. pj = 1
  226. } else {
  227. res = 1
  228. pj = 2
  229. }
  230. case "DDB":
  231. if info.PTCBH > 12 && !StrOrNum2.MatchString(info.PTC) {
  232. res = 2
  233. } else {
  234. res = 1
  235. }
  236. pj = 1
  237. case "ACA":
  238. if info.LenPN > 10 && info.LenPTC > 8 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
  239. res = 3
  240. pj = 2
  241. } else if info.LenPN > 10 || info.LenPTC > 8 {
  242. res = 2
  243. pj = 2
  244. } else {
  245. res = 1
  246. pj = 3
  247. }
  248. case "ACB":
  249. if info.LenPN > 10 && info.PTCBH > 8 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
  250. res = 3
  251. pj = 2
  252. } else if info.LenPN > 10 || info.PTCBH > 8 {
  253. res = 2
  254. pj = 2
  255. } else {
  256. res = 1
  257. pj = 3
  258. }
  259. case "BCA":
  260. if (info.PNBH > 10 && info.LenPTC > 8) || info.LenPTC > 12 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
  261. res = 3
  262. pj = 2
  263. } else if info.PNBH > 10 || info.LenPTC > 8 {
  264. res = 2
  265. pj = 2
  266. } else {
  267. res = 1
  268. pj = 3
  269. }
  270. case "BCB":
  271. if info.PNBH > 12 && info.PTCBH > 12 && info.LenPC != len([]rune(compareInfo.ProjectCode)) && !StrOrNum2.MatchString(info.PTC) {
  272. res = 3
  273. pj = 1
  274. } else if info.PNBH > 10 || info.PTCBH > 8 {
  275. res = 2
  276. pj = 2
  277. } else {
  278. res = 1
  279. pj = 2
  280. }
  281. case "AAC":
  282. if (info.LenPN > 10 && info.LenPC > 8) || info.LenPN > 14 || (info.LenPC > 10 && !StrOrNum2.MatchString(info.ProjectCode)) {
  283. res = 3
  284. pj = 3
  285. } else {
  286. res = 2
  287. pj = 3
  288. }
  289. case "ABC":
  290. if info.LenPN > 14 && info.PCBH > 10 && !StrOrNum2.MatchString(info.ProjectCode) {
  291. res = 3
  292. pj = 2
  293. } else if info.LenPN > 10 || info.PCBH > 8 {
  294. res = 2
  295. pj = 3
  296. } else {
  297. res = 1
  298. pj = 3
  299. }
  300. case "BAC":
  301. if info.PNBH > 14 && info.LenPC > 8 && !StrOrNum2.MatchString(info.ProjectCode) {
  302. res = 3
  303. pj = 2
  304. } else if info.PNBH > 10 || info.LenPC > 8 {
  305. res = 2
  306. pj = 3
  307. } else {
  308. res = 1
  309. pj = 3
  310. }
  311. case "BBC":
  312. if info.PNBH > 14 && info.PCBH > 10 && !StrOrNum2.MatchString(info.ProjectCode) {
  313. res = 3
  314. pj = 1
  315. } else if info.PNBH > 10 || info.PCBH > 8 {
  316. res = 2
  317. pj = 2
  318. } else {
  319. res = 1
  320. pj = 2
  321. }
  322. case "ACC":
  323. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  324. if info.LenPN > 16 {
  325. res = 2
  326. pj = 1
  327. } else {
  328. res = 1
  329. pj = 2
  330. }
  331. }
  332. case "ACD":
  333. //项目编号不一致
  334. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  335. if info.LenPN > 16 {
  336. res = 2
  337. } else {
  338. res = 1
  339. }
  340. pj = 1
  341. }
  342. case "ADC":
  343. if info.LenPN > 16 {
  344. res = 2
  345. } else {
  346. res = 1
  347. }
  348. pj = 1
  349. case "BCC":
  350. //项目编号不一致
  351. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  352. if info.PNBH > 12 {
  353. res = 1
  354. }
  355. pj = 1
  356. }
  357. case "BCD":
  358. //项目编号不一致
  359. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  360. if info.PNBH > 8 {
  361. res = 1
  362. }
  363. pj = 1
  364. }
  365. case "BDC":
  366. if info.PNBH > 7 {
  367. res = 1
  368. }
  369. pj = 1
  370. case "CAA":
  371. if info.LenPC > 12 || info.LenPTC > 12 {
  372. res = 3
  373. pj = 2
  374. } else if info.LenPC > 8 || info.LenPTC > 8 {
  375. res = 2
  376. pj = 3
  377. } else {
  378. res = 1
  379. pj = 3
  380. }
  381. case "CAB":
  382. if info.LenPC > 12 && info.PTCBH > 8 {
  383. res = 3
  384. pj = 2
  385. } else if info.LenPC > 12 || info.PTCBH > 8 {
  386. res = 2
  387. pj = 3
  388. } else {
  389. res = 1
  390. pj = 3
  391. }
  392. case "CAC":
  393. if info.LenPC > 9 && !StrOrNum2.MatchString(info.ProjectCode) {
  394. res = 2
  395. pj = 2
  396. } else {
  397. res = 1
  398. pj = 1
  399. }
  400. case "CAD":
  401. if info.LenPC > 9 && !StrOrNum2.MatchString(info.ProjectCode) {
  402. res = 2
  403. } else {
  404. res = 1
  405. }
  406. pj = 1
  407. case "CBA":
  408. if info.LenPTC > 14 && info.PCBH > 12 {
  409. res = 3
  410. pj = 2
  411. } else if info.LenPTC > 12 || info.PCBH > 10 {
  412. res = 2
  413. pj = 2
  414. } else {
  415. res = 1
  416. pj = 2
  417. }
  418. case "CBB":
  419. if info.PCBH > 13 && info.PTCBH > 13 {
  420. res = 3
  421. pj = 1
  422. } else if info.PCBH > 9 || info.PTCBH > 9 {
  423. res = 2
  424. pj = 2
  425. } else {
  426. res = 1
  427. pj = 2
  428. }
  429. case "CBC":
  430. if info.PCBH > 14 && !StrOrNum2.MatchString(info.ProjectCode) {
  431. res = 2
  432. } else if info.PCBH > 5 {
  433. res = 1
  434. }
  435. pj = 1
  436. case "CBD":
  437. if info.PCBH > 14 && !StrOrNum2.MatchString(info.ProjectCode) {
  438. res = 2
  439. } else if info.PCBH > 5 {
  440. res = 1
  441. }
  442. pj = 1
  443. case "CCA":
  444. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  445. if info.LenPTC > 12 && !StrOrNum2.MatchString(info.PTC) {
  446. res = 2
  447. } else if info.LenPTC > 5 {
  448. res = 1
  449. }
  450. pj = 1
  451. }
  452. case "CCB":
  453. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  454. if info.PTCBH > 10 && !StrOrNum2.MatchString(info.PTC) {
  455. res = 1
  456. }
  457. pj = 1
  458. }
  459. case "CDA":
  460. if info.LenPTC > 12 && !StrOrNum2.MatchString(info.PTC) {
  461. res = 2
  462. } else {
  463. res = 1
  464. }
  465. pj = 1
  466. case "CDB":
  467. if info.PTCBH > 10 && !StrOrNum2.MatchString(info.PTC) {
  468. res = 1
  469. pj = 1
  470. }
  471. case "DAC":
  472. if info.LenPC > 13 && !StrOrNum2.MatchString(info.ProjectCode) {
  473. res = 3
  474. } else if info.LenPC > 8 {
  475. res = 2
  476. } else {
  477. res = 1
  478. }
  479. pj = 1
  480. case "DBC":
  481. if info.PCBH > 8 {
  482. res = 1
  483. }
  484. pj = 1
  485. case "DCA":
  486. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  487. if info.LenPTC > 10 {
  488. res = 2
  489. } else {
  490. res = 1
  491. }
  492. pj = 1
  493. }
  494. case "DCB":
  495. if info.LenPC != len([]rune(compareInfo.ProjectCode)) {
  496. if info.PTCBH > 8 && !StrOrNum2.MatchString(info.PTC) {
  497. res = 1
  498. }
  499. pj = 1
  500. }
  501. }
  502. }
  503. return
  504. }