merge_select.go 9.4 KB

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