在展示ABAP代码之前需要先在"SE11"中新建一个配置表:ZCHENH006.表的结构参见我的一篇 省市县级联搜索帮助的Bolg。

废话不多说,先上代码

  1 *&---------------------------------------------------------------------*
  2 *& REPORT  ZCHENH050
  3 *&
  4 *&---------------------------------------------------------------------*
  5 *&
  6 *&
  7 *&---------------------------------------------------------------------*
  8 
  9 REPORT zchenh050.
 10 *https://jingyan.baidu.com/article/72ee561abd962fe16038df48.html
 11 * 身份证算法实现
 12 *
 13 * 1、号码的结构 公民身份号码是特征组合码,
 14 *     由十七位数字本体码和一位校验码组成。
 15 * 排列顺序从左至右依次为:六位数字地址码,八位数字出生日期码  三位数字顺序码和一位数字校验码。
 16 *
 17 * 2、地址码(前六位数) 表示编码对象常住户口所在县(市、旗、区)的行政区划代码,按GB/T2260的规定执行。
 18 *
 19 * 3、出生日期码(第七位至十四位) 表示编码对象出生的年、月、日,按GB/T7408的规定执行,年、月、日代码之间不用分隔符。
 20 *
 21 * 4、顺序码(第十五位至十七位)
 22 *    表示在同一地址码所标识的区域范围内,对同年、同月、同日出生的人编定的顺序号,顺序码的奇数分配给男性,偶数分配给女性。
 23 *
 24 * 5、校验码(第十八位数)
 25 *   (1)十七位数字本体码加权求和公式 S = SUM(AI * WI), I = 0, ... , 16
 26 * ,先对前17位数字的权求和
 27 *  AI:表示第I位置上的身份证号码数字值
 28 *   WI:表示第I位置上的加权因子 WI: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
 29 * (2)计算模 Y = MOD(S, 11)
 30 * (3)通过模得到对应的校验码 Y: 0 1 2 3 4 5 6 7  8 9 10
 31 *   校验码: 1 0 X 9 8 7 6 5 4 3 2
 32 *
 33 TABLES:sscrfields.
 34 TYPE-POOLS: vrm.
 35 DATA: gv_cl_random TYPE REF TO cl_random_number,
 36       gv_ret_random TYPE i.
 37 DATA:gt_data TYPE zchenh006 OCCURS 0 WITH HEADER LINE.
 38 DATA:BEGIN OF gt_check OCCURS 0,
 39   ai TYPE i,
 40   wi TYPE c,
 41   END OF gt_check.
 42 *  Wi表示第i位置上的加权因子,其各位对应的值依次为: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
 43 DATA:BEGIN OF gt_wi OCCURS 0,
 44   ai TYPE i,
 45   wi TYPE i,
 46 END OF gt_wi.
 47 DATA:BEGIN OF gt_idcard OCCURS 0,
 48   idcard(18),
 49 END OF gt_idcard.
 50 DATA:BEGIN OF gt_alv OCCURS 0,
 51   chk,
 52   idx TYPE sy-index,
 53   idcard(18),
 54   msg(255),
 55   END OF gt_alv.
 56 
 57 SELECTION-SCREEN FUNCTION KEY 1.
 58 SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
 59 PARAMETERS:p_r1 TYPE c RADIOBUTTON GROUP pr DEFAULT 'X' USER-COMMAND c1, "导入配置
 60            p_r2 TYPE c RADIOBUTTON GROUP pr,           "快速生成身份证
 61            p_r3 TYPE c RADIOBUTTON GROUP pr,           "输入身份证信息查询
 62            p_r4 TYPE c RADIOBUTTON GROUP pr.           "随机生成N个身份证
 63 *PARAMETERS:P_CALL TYPE C NO-DISPLAY.
 64 SELECTION-SCREEN END  OF BLOCK b1.
 65 
 66 SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
 67 
 68 *SELECTION-SCREEN BEGIN OF LINE . "将元素排列到一行
 69 PARAMETERS: p_file LIKE rlgrap-filename
 70                   MODIF ID m1.
 71 
 72 SELECTION-SCREEN COMMENT /1(75) text-003 MODIF ID m1.
 73 *SELECTION-SCREEN END OF LINE.
 74 SELECTION-SCREEN END OF BLOCK b2.
 75 
 76 SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-004.
 77 PARAMETERS:p_belnr TYPE zchenh006-belnr
 78                   MODIF ID m2. " 出生地
 79 
 80 PARAMETERS: p_date LIKE sy-datum
 81              OBLIGATORY
 82                   MODIF ID m2. " 出生日期
 83 PARAMETERS: p_sex LIKE zchenh001-zsex DEFAULT ''
 84                   OBLIGATORY
 85                   MODIF ID m2. " 性别
 86 SELECTION-SCREEN END OF BLOCK b3.
 87 
 88 SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-005.
 89 
 90 SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-006.
 91 PARAMETERS: p_num TYPE sy-tabix AS LISTBOX VISIBLE LENGTH 20 DEFAULT 100
 92                  MODIF ID m3. " 身份证号码
 93 SELECTION-SCREEN END OF BLOCK b5.
 94 
 95 SELECT-OPTIONS:s_idcard FOR gt_alv-idcard NO INTERVALS
 96                     MODIF ID m4. " 身份证号码
 97 SELECTION-SCREEN END OF BLOCK b4.
 98 
 99 PARAMETERS:p_local AS CHECKBOX MODIF ID m5.
100 
101 INITIALIZATION.
102   PERFORM frm_init_data.
103 
104 AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_belnr.
105   PERFORM frm_f4_help_for_p_belnr.
106 
107 AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
108   PERFORM frm_get_filename.
109 
110 AT SELECTION-SCREEN.
111   IF sy-ucomm = 'FC01'.
112     PERFORM frm_download_templete.
113   ENDIF.
114 
115 AT SELECTION-SCREEN OUTPUT."动态选择屏幕
116   PERFORM frm_modify_screen.
117 
118 START-OF-SELECTION.
119   IF p_r1 IS NOT INITIAL.
120     PERFORM frm_put_data.
121     PERFORM frm_save_data.
122   ENDIF.
123   IF p_r2 IS NOT INITIAL.
124     PERFORM frm_get_id6. " 获取前六位
125     PERFORM frm_get_birthday." 获取生日
126     PERFORM frm_create_no3. " 获取三位顺序码
127     PERFORM frm_check_id. " 校验身份证
128     PERFORM frm_show_id. " alv 显示身份证
129   ENDIF.
130   IF p_r3 IS NOT INITIAL.
131     IF p_num IS INITIAL OR p_num LE 0.
132       MESSAGE '请选择随机生成身份证的数量!'  TYPE 'E' .
133       STOP.
134     ENDIF.
135     DO p_num TIMES.
136       PERFORM frm_set_id6. " 随机生成身份证前6位
137       PERFORM frm_set_birthday. "随机生成身份证的生日
138       PERFORM frm_set_no3. "随机生成三位顺序码
139     ENDDO.
140     PERFORM frm_check_id. " 校验身份证
141     PERFORM frm_show_id. " alv 显示身份证
142   ENDIF.
143 
144   IF p_r4 IS NOT INITIAL.
145     IF s_idcard[] IS INITIAL.
146       MESSAGE '请输入身份证编码!'  TYPE 'E' .
147       STOP.
148     ENDIF.
149     LOOP AT s_idcard.
150       gt_alv-idcard = s_idcard-low.
151       PERFORM frm_split_idcard USING gt_alv-idcard CHANGING gt_alv-msg. " 解析身份证
152       APPEND gt_alv.
153     ENDLOOP.
154     PERFORM frm_show_id. " alv 显示身份证
155   ENDIF.
156 
157 
158 *&---------------------------------------------------------------------*
159 *&      FORM  FRM_PUT_DATA
160 *&---------------------------------------------------------------------*
161 *       TEXT
162 *----------------------------------------------------------------------*
163 *  -->  P1        TEXT
164 *  <--  P2        TEXT
165 *----------------------------------------------------------------------*
166 FORM frm_put_data .
167 *  清空数据库配置表
168 *  DELETE FROM zchenh006.
169   TYPE-POOLS truxs.
170   DATA  gt_raw TYPE truxs_t_text_data.
171   TYPES: BEGIN OF gty_excel,
172       col1    TYPE  string,
173       col2    TYPE  string,
174   END OF gty_excel.
175   DATA: gt_excel TYPE TABLE OF gty_excel,
176         gs_excel TYPE gty_excel.
177   CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
178     EXPORTING
179 *     I_FIELD_SEPERATOR    =
180       i_line_header        = 'X'
181       i_tab_raw_data       = gt_raw
182       i_filename           = p_file
183     TABLES
184       i_tab_converted_data = gt_data
185     EXCEPTIONS
186       conversion_failed    = 1
187       OTHERS               = 2.
188 ENDFORM.                    " FRM_PUT_DATA
189 *&---------------------------------------------------------------------*
190 *&      FORM  FRM_SAVE_DATA
191 *&---------------------------------------------------------------------*
192 *       TEXT
193 *----------------------------------------------------------------------*
194 *  -->  P1        TEXT
195 *  <--  P2        TEXT
196 *----------------------------------------------------------------------*
197 FORM frm_save_data .
198   IF gt_data[] IS NOT INITIAL.
199     MODIFY zchenh006 FROM TABLE gt_data.
200     IF sy-subrc = 0.
201       COMMIT WORK.
202     ELSE.
203       ROLLBACK WORK.
204     ENDIF.
205   ENDIF.
206 ENDFORM.                    " FRM_SAVE_DATA
207 *&---------------------------------------------------------------------*
208 *&      FORM  FRM_DOWNLOAD_TEMPLETE
209 *&---------------------------------------------------------------------*
210 *       TEXT
211 *----------------------------------------------------------------------*
212 *  -->  P1        TEXT
213 *  <--  P2        TEXT
214 *----------------------------------------------------------------------*
215 FORM frm_download_templete .
216   DATA:ls_wwwdata_item LIKE wwwdatatab,
217       lv_file         TYPE rlgrap-filename,
218       li_rc           LIKE sy-subrc,
219       lv_objid        TYPE wwwdata-objid.
220 * 获取保存路径
221   CALL FUNCTION 'WS_FILENAME_GET'
222     EXPORTING
223       def_filename     = '省份编号导入模板.XLSX'
224       def_path         = 'D:\'
225       mask             = 'EXCEL文件 (*.XLSX)|*.XLSX|所有文件(*.*)|*.*|,'
226       mode             = 'S'
227       title            = '选择导出文件位置'
228     IMPORTING
229       filename         = lv_file
230     EXCEPTIONS
231       inv_winsys       = 1
232       no_batch         = 2
233       selection_cancel = 3
234       selection_error  = 4
235       OTHERS           = 5.
236   IF sy-subrc <> 0.
237 * IMPLEMENT SUITABLE ERROR HANDLING HERE
238     MESSAGE '导出路径错误!' TYPE 'S'.
239   ENDIF.
240 
241 *  检查模板是否存在
242   CLEAR:ls_wwwdata_item.
243   lv_objid = 'ZCHENH050'.
244   SELECT SINGLE *
245     FROM wwwdata
246     INTO CORRESPONDING FIELDS OF ls_wwwdata_item
247   WHERE srtf2 = 0
248     AND relid = 'MI'
249     AND objid = lv_objid .
250 
251   IF sy-subrc NE 0.
252     MESSAGE '文件模板不存在!' TYPE 'S'.
253   ENDIF.
254 *  下载模板
255   CALL FUNCTION 'DOWNLOAD_WEB_OBJECT'
256     EXPORTING
257       key         = ls_wwwdata_item
258       destination = lv_file
259     IMPORTING
260       rc          = li_rc.
261   IF li_rc NE '0'.
262     MESSAGE '文件模板下载失败!' TYPE 'S'.
263   ELSE.
264     MESSAGE '文件模板下载成功!' TYPE 'S'.
265   ENDIF.
266 ENDFORM.                    " FRM_DOWNLOAD_TEMPLETE
267 *&---------------------------------------------------------------------*
268 *&      FORM  FRM_GET_BIRTHDAY
269 *&---------------------------------------------------------------------*
270 *       出生日期
271 *----------------------------------------------------------------------*
272 *  -->  P1        TEXT
273 *  <--  P2        TEXT
274 *----------------------------------------------------------------------*
275 FORM frm_get_birthday .
276   LOOP AT gt_idcard.
277     gt_idcard-idcard+6(8) = p_date.
278     MODIFY gt_idcard.
279   ENDLOOP.
280 ENDFORM.                    " FRM_GET_BIRTHDAY
281 *&---------------------------------------------------------------------*
282 *&      FORM  FRM_MODIFY_SCREEN
283 *&---------------------------------------------------------------------*
284 *       TEXT
285 *----------------------------------------------------------------------*
286 *  -->  P1        TEXT
287 *  <--  P2        TEXT
288 *----------------------------------------------------------------------*
289 FORM frm_modify_screen .
290   LOOP AT SCREEN.
291     CASE screen-group1.
292       WHEN 'M1'.
293         IF p_r1 IS INITIAL.
294           screen-active = '0'.
295         ELSE.
296           screen-active = '1'.
297         ENDIF.
298       WHEN 'M2'.
299         IF p_r2 IS INITIAL.
300           screen-active = '0'.
301         ELSE.
302           screen-active = '1'.
303         ENDIF.
304       WHEN 'M3'.
305         IF p_r3 IS INITIAL.
306           screen-active = '0'.
307         ELSE.
308           screen-active = '1'.
309         ENDIF.
310       WHEN 'M4'.
311         IF p_r4 IS INITIAL.
312           screen-active = '0'.
313         ELSE.
314           screen-active = '1'.
315         ENDIF.
316       WHEN 'M5'.
317         IF p_r2 IS NOT INITIAL OR p_r3 IS NOT INITIAL.
318           screen-active = '1'.
319         ELSE.
320           screen-active = '0'.
321         ENDIF.
322     ENDCASE.
323 *    IF screen-name = 'P_BEZEI'.
324 *      screen-input = '0'.
325 *    ENDIF.
326     MODIFY SCREEN.
327   ENDLOOP.
328 
329   DATA: lv_name TYPE vrm_id,
330         lt_list TYPE vrm_values,
331         ls_value LIKE LINE OF lt_list.
332   REFRESH lt_list.
333   lv_name = 'P_NUM'.
334   DO 100 TIMES.
335     ls_value-key = sy-index.
336     CONDENSE ls_value-key.
337     CONCATENATE '随机生成' ls_value-key ''
338            INTO ls_value-text.
339     APPEND ls_value TO lt_list.
340   ENDDO.
341 
342   CALL FUNCTION 'VRM_SET_VALUES'
343     EXPORTING
344       id     = lv_name
345       values = lt_list.
346 
347 ENDFORM.                    " FRM_MODIFY_SCREEN
348 *&---------------------------------------------------------------------*
349 *&      Form  FRM_GET_ID6
350 *&---------------------------------------------------------------------*
351 *       text
352 *----------------------------------------------------------------------*
353 *  -->  p1        text
354 *  <--  p2        text
355 *----------------------------------------------------------------------*
356 FORM frm_get_id6 .
357   IF p_belnr IS INITIAL.
358     MESSAGE '请选择省/市/县编码!' TYPE 'E'.
359   ENDIF.
360   SELECT * INTO TABLE gt_data FROM zchenh006 UP TO 3 ROWS WHERE belnr = p_belnr .
361   IF gt_data[] IS INITIAL.
362     MESSAGE '配置表未配置!' TYPE 'E'.
363   ENDIF.
364   LOOP AT gt_data.
365     gt_idcard-idcard(6) = gt_data-belnr.
366     APPEND gt_idcard.
367   ENDLOOP.
368 ENDFORM.                    " FRM_GET_ID6
369 *&---------------------------------------------------------------------*
370 *&      Form  FRM_CREATE_NO3
371 *&---------------------------------------------------------------------*
372 *       text
373 *----------------------------------------------------------------------*
374 *  -->  p1        text
375 *  <--  p2        text
376 *----------------------------------------------------------------------*
377 FORM frm_create_no3 .
378   DATA:BEGIN OF lt_idcard OCCURS 0,
379     idcard(18),
380   END OF lt_idcard.
381   DATA:lv_sex.
382   lv_sex = '1'.
383   IF p_sex NE ''.
384     lv_sex = '2'.
385   ENDIF.
386 
387   LOOP AT gt_idcard.
388     DO 99 TIMES.
389       gt_idcard-idcard+14(2) = sy-index. " 当地公安局编号:01 02 03 04 05 06...
390       IF sy-index < 10.
391         gt_idcard-idcard+14(1) = '0'. " 小于10时补充前导零
392         gt_idcard-idcard+15(1) = sy-index.
393       ENDIF.
394       gt_idcard-idcard+16(1) = lv_sex. " 性别编码
395       APPEND gt_idcard-idcard TO lt_idcard.
396     ENDDO.
397   ENDLOOP.
398   gt_idcard[] = lt_idcard[].
399 ENDFORM.                    " FRM_CREATE_NO3
400 *&---------------------------------------------------------------------*
401 *&      Form  FRM_CHECK_ID
402 *&---------------------------------------------------------------------*
403 *       text
404 *----------------------------------------------------------------------*
405 *  -->  p1        text
406 *  <--  p2        text
407 *----------------------------------------------------------------------*
408 FORM frm_check_id.
409   DATA:lv_sum TYPE i,
410         lv_idx TYPE i,
411         lv_y TYPE i.
412 
413   LOOP AT gt_idcard.
414     CLEAR:lv_sum,lv_idx.
415     LOOP AT gt_wi.
416       lv_idx = sy-tabix - 1.
417       lv_sum = lv_sum + gt_wi-wi * gt_idcard-idcard+lv_idx(1).
418     ENDLOOP.
419 
420     lv_y = lv_sum MOD 11.
421     READ TABLE gt_check WITH KEY ai = lv_y.
422     IF sy-subrc = 0.
423       gt_idcard-idcard+17(1) = gt_check-wi.
424       MODIFY gt_idcard TRANSPORTING idcard.
425     ENDIF.
426   ENDLOOP.
427   LOOP AT gt_idcard.
428 *    WRITE:/,sy-tabix,'您的身份证账号为:',gt_idcard-idcard.
429     gt_alv-idx = sy-tabix.
430     gt_alv-idcard = gt_idcard.
431     APPEND gt_alv.
432   ENDLOOP.
433   IF p_local IS NOT INITIAL.
434     PERFORM frm_download_idcard.
435   ENDIF.
436 
437 ENDFORM.                    " FRM_CHECK_ID
438 *&---------------------------------------------------------------------*
439 *&      Form  FRM_SPLIT_IDCARD
440 *&---------------------------------------------------------------------*
441 *       text
442 *----------------------------------------------------------------------*
443 *  -->  p1        text
444 *  <--  p2        text
445 *----------------------------------------------------------------------*
446 FORM frm_split_idcard USING p_id TYPE char18 CHANGING p_msg TYPE char255.
447   DATA:lv_belnr(6),
448         lv_date TYPE sy-datum,
449         lv_sex,
450         lv_check,
451         lv_sdesc TYPE zchenh006-sdesc,
452         lv_sdesc1 TYPE string,
453         lv_mess(255),
454         lv_flag,
455         lv_day TYPE string.
456   lv_belnr = p_id(6).
457   lv_date = p_id+6(8).
458   lv_sex = p_id+16(1).
459   lv_check = p_id+17(1).
460   " 获取县级信息
461   SELECT SINGLE sdesc INTO lv_sdesc  FROM zchenh006 WHERE belnr = lv_belnr.
462   IF sy-subrc NE 0.
463     lv_flag = 'X'.
464     lv_mess = '异常:身份证地址码有误; '.
465   ENDIF.
466   CONCATENATE lv_sdesc lv_sdesc1 INTO lv_sdesc1.
467   " 获取市区级信息
468   lv_belnr+4(2) = '00'.
469   SELECT SINGLE sdesc INTO lv_sdesc  FROM zchenh006 WHERE belnr = lv_belnr.
470   CONCATENATE lv_sdesc lv_sdesc1 INTO lv_sdesc1.
471   " 获取省级信息
472   lv_belnr+2(4) = '0000'.
473   SELECT SINGLE sdesc INTO lv_sdesc  FROM zchenh006 WHERE belnr = lv_belnr.
474   CONCATENATE lv_sdesc lv_sdesc1 INTO lv_sdesc1.
475   CONCATENATE lv_mess '您的地址信息:' lv_sdesc1 '' INTO lv_mess.
476 
477 *1. 身份证日期校验
478   CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
479     EXPORTING
480       date                      = lv_date
481     EXCEPTIONS
482       plausibility_check_failed = 1
483       OTHERS                    = 2.
484   IF sy-subrc NE 0 OR lv_date GE sy-datum.
485     lv_flag = 'X'.
486     CONCATENATE  lv_mess '异常:出生日期非法;  ' INTO lv_mess.
487   ELSE.
488     DATA:lv_age TYPE string.
489     lv_age = sy-datum+0(4) - lv_date+0(4).  " 计算年
490 
491     IF ( sy-datum+4(2) GT lv_date+4(2) )    " 计算月           " 当前月大于出生月,说明生日过了,年龄加1
492       OR ( sy-datum+4(2) EQ lv_date+4(2)    " 计算月           " 当前月等于出生月,则需要看日期,年龄加1
493       AND sy-datum+6(2) GE lv_date+6(2) ).  " 当前月等于出生月,说明再看天数,若天数大于,则说明生日未过了,年龄加1
494       lv_age = lv_age + 1.
495     ENDIF.
496 
497     CONCATENATE lv_mess '您的年龄:' lv_age '周岁;  '
498         INTO lv_mess.
499   ENDIF.
500 
501   CONCATENATE lv_mess '您的出生日期:' lv_date+0(4) ''  lv_date+4(2) ''  lv_date+6(2) '日;  '
502          INTO lv_mess.
503 
504   CLEAR:lv_age.
505   lv_age = sy-datum - lv_date.
506   lv_day = lv_age / 365.
507   CONCATENATE lv_mess '您的出生至今:'  lv_age '天; ' '实际年龄为:' lv_day '; '
508          INTO lv_mess.
509 
510   IF lv_sex = 1 OR lv_sex = 3 OR lv_sex = 5 OR lv_sex = 7 OR lv_sex = 9.
511     CONCATENATE lv_mess '您的性别: 男;  '
512            INTO lv_mess.
513   ELSE.
514     CONCATENATE lv_mess '您的性别: 女;  '
515            INTO lv_mess.
516   ENDIF.
517 
518   DATA:lv_sum TYPE i,
519        lv_idx TYPE i,
520        lv_y TYPE i.
521 
522   CLEAR:lv_sum,lv_idx.
523   LOOP AT gt_wi.
524     lv_idx = sy-tabix - 1.
525     lv_sum = lv_sum + gt_wi-wi * p_id+lv_idx(1).
526   ENDLOOP.
527   lv_y = lv_sum MOD 11.
528   READ TABLE gt_check WITH KEY ai = lv_y.
529 
530   IF sy-subrc = 0 AND gt_check-wi = p_id+17(1).
531     CONCATENATE  '恭喜:您的身份校验通过 ;  ' lv_mess INTO lv_mess.
532   ELSE.
533     lv_flag = 'X'.
534     CONCATENATE '异常:您的身份校验未通过; ' lv_mess  INTO lv_mess.
535   ENDIF.
536 
537   CONDENSE lv_mess.
538 *  WRITE:/,'身份证号:',p_idcard,'解析结果:' ,/,lv_mess.
539   p_msg = lv_mess.
540 ENDFORM.                    " FRM_SPLIT_IDCARD
541 *&---------------------------------------------------------------------*
542 *&      Form  FRM_INIT_DATA
543 *&---------------------------------------------------------------------*
544 *       text
545 *----------------------------------------------------------------------*
546 *  -->  p1        text
547 *  <--  p2        text
548 *----------------------------------------------------------------------*
549 FORM frm_init_data .
550   DATA:functxt TYPE smp_dyntxt.
551   functxt-icon_id = icon_export.
552   functxt-quickinfo = '模板下载'.
553   functxt-icon_text = '模板下载'.
554   sscrfields-functxt_01 = functxt.
555 
556   p_date = sy-datum.
557   p_date+0(4) =  p_date+0(4) - 20.
558 
559   gt_check-ai = 0.
560   gt_check-wi = 1.
561   APPEND gt_check.
562 
563   gt_check-ai = 1.
564   gt_check-wi = 0.
565   APPEND gt_check.
566 
567   gt_check-ai = 2.
568   gt_check-wi = 'X'.
569   APPEND gt_check.
570 
571   gt_check-ai = 3.
572   gt_check-wi = 9.
573   APPEND gt_check.
574 
575   gt_check-ai = 4.
576   gt_check-wi = 8.
577   APPEND gt_check.
578 
579   gt_check-ai = 5.
580   gt_check-wi = 7.
581   APPEND gt_check.
582 
583   gt_check-ai = 6.
584   gt_check-wi = 6.
585   APPEND gt_check.
586 
587   gt_check-ai = 7.
588   gt_check-wi = 5.
589   APPEND gt_check.
590 
591   gt_check-ai = 8.
592   gt_check-wi = 4.
593   APPEND gt_check.
594 
595   gt_check-ai = 9.
596   gt_check-wi = 3.
597   APPEND gt_check.
598 
599   gt_check-ai = 10.
600   gt_check-wi = 2.
601   APPEND gt_check.
602 
603   gt_wi-wi = 7.
604   gt_wi-ai = 1.
605   APPEND gt_wi.
606 
607   gt_wi-wi = 9.
608   gt_wi-ai = 2.
609   APPEND gt_wi.
610 
611   gt_wi-wi = 10.
612   gt_wi-ai = 3.
613   APPEND gt_wi.
614 
615   gt_wi-wi = 5.
616   gt_wi-ai = 4.
617   APPEND gt_wi.
618 
619   gt_wi-wi = 8.
620   gt_wi-ai = 5.
621   APPEND gt_wi.
622 
623   gt_wi-wi = 4.
624   gt_wi-ai = 6.
625   APPEND gt_wi.
626   gt_wi-wi = 2.
627   gt_wi-ai = 7.
628   APPEND gt_wi.
629 
630   gt_wi-wi = 1.
631   gt_wi-ai = 8.
632   APPEND gt_wi.
633 
634   gt_wi-wi = 6.
635   gt_wi-ai = 9.
636   APPEND gt_wi.
637 
638   gt_wi-wi = 3.
639   gt_wi-ai = 10.
640   APPEND gt_wi.
641 
642   gt_wi-wi = 7.
643   gt_wi-ai = 11.
644   APPEND gt_wi.
645 
646   gt_wi-wi = 9.
647   gt_wi-ai = 12.
648   APPEND gt_wi.
649 
650   gt_wi-wi = 10.
651   gt_wi-ai = 13.
652   APPEND gt_wi.
653 
654   gt_wi-wi = 5.
655   gt_wi-ai = 14.
656   APPEND gt_wi.
657 
658   gt_wi-wi = 8.
659   gt_wi-ai = 15.
660   APPEND gt_wi.
661 
662   gt_wi-wi = 4.
663   gt_wi-ai = 16.
664   APPEND gt_wi.
665 
666   gt_wi-wi = 2.
667   gt_wi-ai = 17.
668   APPEND gt_wi.
669 
670   CREATE OBJECT gv_cl_random.
671   CALL METHOD gv_cl_random->if_random_number~init .
672 
673 ENDFORM.                    " FRM_INIT_DATA
674 *&---------------------------------------------------------------------*
675 *&      Form  FRM_DOWNLOAD_IDCARD
676 *&---------------------------------------------------------------------*
677 *       text
678 *----------------------------------------------------------------------*
679 *  -->  p1        text
680 *  <--  p2        text
681 *----------------------------------------------------------------------*
682 FORM frm_download_idcard .
683   DATA:lv_filename TYPE string,
684        lv_path     TYPE string,
685        lv_fullpath TYPE string.
686   WHILE lv_fullpath IS INITIAL.
687     CALL METHOD cl_gui_frontend_services=>file_save_dialog
688       EXPORTING
689         window_title              = '请选择保存文件路径'
690 *       default_extension         =
691         default_file_name         = 'ZCHENH050.txt'
692 *       with_encoding             =
693 *       file_filter               =
694 *       initial_directory         =
695         prompt_on_overwrite       = 'X'
696       CHANGING
697         filename                  = lv_filename
698         path                      = lv_path
699         fullpath                  = lv_fullpath
700 *       user_action               =
701 *       file_encoding             =
702       EXCEPTIONS
703         cntl_error                = 1
704         error_no_gui              = 2
705         not_supported_by_gui      = 3
706         invalid_default_file_name = 4
707         OTHERS                    = 5.
708   ENDWHILE.
709 
710 
711   CALL METHOD cl_gui_frontend_services=>gui_download
712     EXPORTING
713       filename = lv_fullpath
714       filetype = 'ASC'
715     CHANGING
716       data_tab = gt_idcard[]. "
717 ENDFORM.                    " FRM_DOWNLOAD_IDCARD
718 *&---------------------------------------------------------------------*
719 *&      Form  FRM_F4_HELP_FOR_P_BELNR
720 *&---------------------------------------------------------------------*
721 *       text
722 *----------------------------------------------------------------------*
723 *  -->  p1        text
724 *  <--  p2        text
725 *----------------------------------------------------------------------*
726 FORM frm_f4_help_for_p_belnr .
727 
728 *HRPADES_T005S_BLAND " 国家地区的搜索帮助
729   " 设置地区的搜索帮助
730   DATA:lt_zchenh006 TYPE zchenh006 OCCURS 0 WITH HEADER LINE.
731   DATA:lv_index TYPE sy-index.
732   SELECT * INTO TABLE lt_zchenh006 FROM zchenh006 WHERE belnr NOT LIKE '%0'.
733   SORT lt_zchenh006 BY belnr.
734 *  DATA:BEGIN OF lt_title OCCURS 0,
735 *    title TYPE string,
736 *    END OF lt_title.
737 *  lt_title-title = '客户端'. APPEND lt_title.
738 *  lt_title-title = '省份编码'.APPEND lt_title.
739 *  lt_title-title = '省份描述'.APPEND lt_title.
740   CALL FUNCTION 'TR_F4_HELP'
741   EXPORTING
742     iv_title                     ='自定义国家搜索帮助'
743 *     is_sel_title1                 = lt_title
744 *     is_sel_title2                 = ''
745     iv_start_column               = 2
746     iv_start_row                  = 0
747     iv_number_of_rows             = 8
748     iv_no_of_key_columns          = 1
749     iv_width_of_titles            = 'X'
750 *     iv_without_selection          = ''
751 *     iv_multiple_selection         = ''
752     iv_with_sort_icon             = 'X'
753     iv_with_printer_icon          = 'X'
754     iv_with_filter_icon           = 'X'
755     iv_with_search_icon           = 'X'
756     iv_with_other_view_icon       = 'X'
757     iv_extended_display           = 'X'
758 *     iv_show_also_1                = ''
759 *  IMPORTING
760 *    EV_EXT_DISPLAY_SELECTED       =
761 *    EV_OTHER_VIEW_SELECTED        =
762   TABLES
763     it_sel_table                  = lt_zchenh006
764   CHANGING
765 *    CV_FIRST_INDEX                =
766     cv_selected_index             = lv_index
767 *    CT_SEL_LINES                  =
768   EXCEPTIONS
769     no_lines                      = 1
770     no_line_picked                = 2
771     OTHERS                        = 3 .
772 
773   CLEAR p_belnr.
774   IF lv_index IS NOT INITIAL.
775     READ TABLE lt_zchenh006 INDEX lv_index.
776     p_belnr = lt_zchenh006-belnr .
777   ELSE.
778     p_belnr = ''.
779   ENDIF.
780 ENDFORM.                    " FRM_F4_HELP_FOR_P_BELNR
781 *&---------------------------------------------------------------------*
782 *&      Form  FRM_GET_FILENAME
783 *&---------------------------------------------------------------------*
784 *       text
785 *----------------------------------------------------------------------*
786 *  -->  p1        text
787 *  <--  p2        text
788 *----------------------------------------------------------------------*
789 FORM frm_get_filename .
790 
791   CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
792     EXPORTING
793       program_name  = syst-repid
794       dynpro_number = syst-dynnr
795 *     FIELD_NAME    = ' '
796       static        = 'X'
797       mask          = '(Excel文件)|*.xls|*.xlsx'
798     CHANGING
799       file_name     = p_file
800     EXCEPTIONS
801       mask_too_long = 1
802       OTHERS        = 2.
803 ENDFORM.                    " FRM_GET_FILENAME
804 *&---------------------------------------------------------------------*
805 *&      Form  FRM_SHOW_ID
806 *&---------------------------------------------------------------------*
807 *       text
808 *----------------------------------------------------------------------*
809 *  -->  p1        text
810 *  <--  p2        text
811 *----------------------------------------------------------------------*
812 FORM frm_show_id .
813   DATA: fieldcat TYPE lvc_t_fcat WITH HEADER LINE.
814   DATA: layout TYPE lvc_s_layo .
815 
816   DEFINE add_fieldcat.
817     fieldcat-fieldname = &1.
818     fieldcat-just      = 'L'.
819     fieldcat-scrtext_l = &2.
820     fieldcat-edit = &3.
821     fieldcat-checkbox = &4.
822     fieldcat-ref_table = &5.
823     fieldcat-ref_field = &6.
824     fieldcat-fix_column = &7.
825     fieldcat-outputlen = &8.
826 
827     append fieldcat.
828   END-OF-DEFINITION.
829   add_fieldcat 'IDX' '序号' '' '' '' '' 'X' '2'.
830   add_fieldcat 'IDCARD' '身份证编号' '' '' '' '' 'X' '20'.
831   add_fieldcat 'MSG' '解析结果' '' '' '' '' 'X' '120'.
832   layout-zebra = 'X'.
833 *  layout-cwidth_opt = 'X'. " 自适应列宽
834   layout-sel_mode     = 'A' .       " 选择模式,"A"在最左端有选择按钮
835   layout-box_fname    = 'CHK'.
836 
837   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
838     EXPORTING
839       i_interface_check        = ''
840       i_grid_title             = '身份证解析'
841       i_callback_program       = sy-repid
842       is_layout_lvc            = layout
843       it_fieldcat_lvc          = fieldcat[]
844       i_callback_pf_status_set = 'FRM_SET_PF_STATUS'
845       i_callback_user_command  = 'FRM_USER_COMMAND'
846     TABLES
847       t_outtab                 = gt_alv[]
848     EXCEPTIONS
849       program_error            = 1
850       OTHERS                   = 2.
851 ENDFORM.                    " FRM_SHOW_ID
852 
853 *&---------------------------------------------------------------------*
854 *&      Form  frm_set_pf_status
855 *&---------------------------------------------------------------------*
856 *       text
857 *----------------------------------------------------------------------*
858 *      -->RT_EXTAB   text
859 *----------------------------------------------------------------------*
860 FORM frm_set_pf_status USING rt_extab TYPE slis_t_extab.
861   SET PF-STATUS 'ZCHENH050'.
862 ENDFORM.                    "set_pf_status
863 
864 *&---------------------------------------------------------------------*
865 *&      Form  frm_user_command
866 *&---------------------------------------------------------------------*
867 *       text
868 *----------------------------------------------------------------------*
869 *      -->R_UCOMM      text
870 *      -->RS_SELFIELD  text
871 *----------------------------------------------------------------------*
872 FORM frm_user_command  USING r_ucomm LIKE sy-ucomm
873                          rs_selfield TYPE slis_selfield.
874   DATA:lv_idx TYPE sy-tabix.
875   CASE r_ucomm.
876     WHEN '&IC1'."双击解析
877       CHECK rs_selfield-fieldname = 'IDCARD'.
878       CLEAR: gt_idcard,gt_idcard[].
879       READ TABLE gt_alv INDEX rs_selfield-tabindex.
880       CHECK NOT gt_alv-idcard IS INITIAL.
881       PERFORM frm_split_idcard USING gt_alv-idcard CHANGING gt_alv-msg. " 解析身份证
882       MODIFY gt_alv INDEX rs_selfield-tabindex.
883     WHEN '&CHECK'.
884       DATA: t1 TYPE i,
885             t2 TYPE i,
886             t  TYPE p DECIMALS 2,
887             lv_msg(255).
888       t = 0.
889       GET RUN TIME FIELD t1.
890       LOOP AT gt_alv WHERE chk IS NOT INITIAL.
891         lv_idx = sy-tabix.
892         GET RUN TIME FIELD t2.
893         t2 = t2 - t1.
894         t = t + t2.
895         PERFORM frm_split_idcard USING gt_alv-idcard CHANGING gt_alv-msg. " 解析身份证
896         MODIFY gt_alv INDEX lv_idx TRANSPORTING msg.
897         t1 = t2.
898       ENDLOOP.
899       lv_msg = t.
900       CONDENSE lv_msg.
901       CONCATENATE  '解析耗时:' lv_msg 'microseconds' INTO lv_msg.
902       MESSAGE lv_msg TYPE 'S'.
903     WHEN '&F03' OR '&F15' OR '&F12'.
904       SET SCREEN 0.
905       LEAVE SCREEN.
906     WHEN OTHERS.
907   ENDCASE.
908   rs_selfield-refresh = 'X'.
909 ENDFORM.                    "frm_user_command
910 *&---------------------------------------------------------------------*
911 *&      Form  FRM_SET_ID6
912 *&---------------------------------------------------------------------*
913 *       随机生成身份证前六位
914 *----------------------------------------------------------------------*
915 *  -->  p1        text
916 *  <--  p2        text
917 *----------------------------------------------------------------------*
918 FORM frm_set_id6 .
919 
920   SELECT * INTO TABLE gt_data FROM zchenh006 WHERE belnr NOT LIKE '%0'.
921   IF gt_data[] IS INITIAL.
922     MESSAGE '配置表未配置!' TYPE 'E'.
923   ENDIF.
924 
925   DESCRIBE TABLE gt_data LINES gv_ret_random.
926 
927   CALL METHOD gv_cl_random->if_random_number~get_random_int
928     EXPORTING
929       i_limit  = gv_ret_random
930     RECEIVING
931       r_random = gv_ret_random.
932 
933   READ TABLE gt_data INDEX gv_ret_random.
934   gt_idcard-idcard(6) = gt_data-belnr.
935 *  APPEND gt_idcard.
936 ENDFORM.                    " FRM_SET_ID6
937 *&---------------------------------------------------------------------*
938 *&      Form  FRM_SET_BIRTHDAY
939 *&---------------------------------------------------------------------*
940 *       text
941 *----------------------------------------------------------------------*
942 *  -->  p1        text
943 *  <--  p2        text
944 *----------------------------------------------------------------------*
945 FORM frm_set_birthday.
946   DATA:lv_datum TYPE sy-datum VALUE '19900101'.
947   gv_ret_random = sy-datum - lv_datum.
948   CALL METHOD gv_cl_random->if_random_number~get_random_int
949     EXPORTING
950       i_limit  = gv_ret_random
951     RECEIVING
952       r_random = gv_ret_random.
953   lv_datum = lv_datum + gv_ret_random.
954   gt_idcard-idcard+6(8) = lv_datum.
955 ENDFORM.                    " FRM_SET_BIRTHDAY
956 *&---------------------------------------------------------------------*
957 *&      Form  FRM_SET_NO3
958 *&---------------------------------------------------------------------*
959 *       text
960 *----------------------------------------------------------------------*
961 *  -->  p1        text
962 *  <--  p2        text
963 *----------------------------------------------------------------------*
964 FORM frm_set_no3 .
965   DATA:BEGIN OF lt_idcard OCCURS 0,
966     idcard(18),
967   END OF lt_idcard.
968   DATA:lv_sex.
969 *  产生随机性别
970   CALL METHOD gv_cl_random->if_random_number~get_random_int
971     EXPORTING
972       i_limit  = 1
973     RECEIVING
974       r_random = gv_ret_random.
975   lv_sex = '1'.
976   IF gv_ret_random NE '1'.
977     lv_sex = '2'.
978   ENDIF.
979   CLEAR:gv_ret_random.
980   WHILE gv_ret_random IS INITIAL OR gv_ret_random EQ 0.
981     CALL METHOD gv_cl_random->if_random_number~get_random_int
982       EXPORTING
983         i_limit  = 99
984       RECEIVING
985         r_random = gv_ret_random.
986   ENDWHILE.
987 
988   gt_idcard-idcard+14(2) = gv_ret_random. " 当地公安局编号:01 02 03 04 05 06...
989   IF gv_ret_random < 10.
990     gt_idcard-idcard+14(1) = '0'. " 小于10时补充前导零
991     gt_idcard-idcard+15(1) = gv_ret_random.
992   ENDIF.
993   gt_idcard-idcard+16(1) = lv_sex. " 性别编码
994   APPEND gt_idcard.
995   CLEAR:gt_idcard.
996 ENDFORM.                    " FRM_SET_NO3
View Code


程序完整运行需要以下几个步骤。

1.上传模板。导入配置进入自建表ZCHENH006,但是在导入配置之前需要下载模板,程序虽提供的有模板下载按钮,但是需要用户先使用“SMW0”上传文件模板,在这里,本程序先给出导入模板和配置信息。

导入模ZCHENH006配置信息

解压密码:1187163927

2.自建表配置。SMW0上传文件后,使用新建程序上传配置文件到自建表。

 

 

3.导入配置后,接下来修改选择屏幕的文本信息。切换到“SE38”或者"SE80"找到该程序后进入编辑模式。在上方的工具栏中:转到 -> 文本元素 -> 选择文本,或者在“SE38”界面输入程序后选择"“文本元素”,点击:“修改”按钮。

 

 

 

 

SE11进入新建配置表:ZCHENH006

表结构如下图:

 

 

 

到此,就可以运行程序了,通过程序先导入配置表数据,就可以随心所欲生成身份证以及校验了。

 

 

 

以下是程序运行截图:

  程序默认生成的身份证是20年前的今天的男性。

运行完毕后,会在本地生成一个txt文件,代码中需要修改默认生成文件的路径,否则会报错,同时,选择屏幕生成的文件excel时,因为身份证号码是18位,所以导致excel会以科学计数法显示不全。

运行完毕示例:

随机生成并解析身份证:

 

 

 

 

 解析身份证,好奇的博友可以自行看看代码与百度下身份证编码和解析规则。

可以用本程序生成的SFZ到SFZ查询系统进行查询。

特别说明:该程序仅用于生成的身份证测试,不可用于其他非法活动。

 

附给出java版代码:

 1 import java.util.Date;
 2 import java.text.SimpleDateFormat;
 3 import java.util.Random;
 4 
 5 public class StringUtils {
 6      static final int cities [] = {
 7    350602, 370782, 513431, 532624, 530426, 370203, 350128, 421002, 350624, 430225, 360300, 350203, 220211, 420822, 530625, 653126, 420203, 220182, 230603, 533323, 430121, 621225, 652827, 511500, 450205, 652824, 411402, 440781, 469022, 370214, 542521, 433101, 460100, 530381, 411722, 533400, 110229, 640300, 210700, 450127, 440105, 530828, 120000, 420000, 211402, 341823, 220402, 330500, 371324, 150500, 150927, 321284, 230231, 150926, 630123, 341700, 441400, 542330, 370684, 370828, 654326, 610831, 140300, 350581, 421182, 421200, 341124, 371423, 445302, 513225, 532522, 469026, 450102, 433130, 222406, 511325, 410328, 210422, 430405, 341100, 140212, 445222, 350403, 430521, 520111, 652924, 522201, 542327, 110103, 530826, 630122, 610527, 330481, 522424, 820000, 231081, 410103, 431223, 230524, 441284, 500226, 152524, 211382, 530300, 411102, 410727, 152223, 451200, 610203, 230805, 500116, 341222, 420324, 610500, 141128, 371202, 140426, 510181, 341021, 340421, 130623, 152529, 130626, 530902, 220102, 532801, 220183, 632122, 371622, 140721, 340121, 420503, 632524, 610327, 130500, 152923, 150422, 420528, 140221, 430502, 610921, 422822, 130627, 430105, 410926, 340603, 510321, 211202, 522729, 653100, 421123, 310104, 341282, 410602, 510304, 230712, 320481, 532627, 610800, 610522, 360829, 410105, 410106, 431126, 330127, 131126, 350428, 130930, 430621, 130724, 450681, 411381, 130208, 411200, 522327, 640105, 321282, 632323, 371481, 420800, 621124, 341825, 340300, 450923, 530500, 411423, 150302, 530821, 140802, 310115, 410203, 420116, 371724, 430922, 130800, 150502, 210711, 230207, 511529, 530325, 320402, 542300, 140723, 542221, 511800, 150430, 440700, 220421, 350181, 520329, 350784, 440115, 330304, 411221, 510107, 360803, 520221, 350603, 421003, 411522, 150205, 220503, 620421, 370303, 451031, 150525, 360700, 340711, 620403, 610924, 500117, 542626, 511922, 620800, 450123, 533123, 320900, 410423, 330902, 451002, 623027, 620923, 220204, 420923, 210922, 150429, 150929, 420684, 610427, 150624, 340702, 360313, 320300, 320600, 431228, 621000, 370323, 530421, 640104, 370503, 533421, 420102, 371428, 220105, 350981, 370113, 230503, 130925, 231025, 620300, 341524, 130127, 231200, 130224, 420606, 652922, 371426, 130402, 140826, 511304, 610724, 511823, 542100, 510303, 440113, 500114, 542337, 451381, 513336, 441427, 450311, 630105, 361122, 610829, 360425, 130128, 350105, 511525, 220202, 632724, 350205, 310112, 640303, 623023, 140726, 513229, 330103, 420204, 140725, 350500, 511826, 211322, 630102, 230822, 653022, 130426, 371121, 632200, 640521, 621100, 511524, 130803, 130982, 451202, 350600, 450324, 130424, 510800, 640324, 131028, 450305, 340828, 140423, 654028, 110114, 340503, 653128, 610823, 510184, 310105, 542622, 610821, 511602, 522730, 331000, 360100, 410421, 450107, 150826, 610525, 140922, 140107, 632522, 130283, 130121, 130431, 632523, 430223, 530112, 361023, 361181, 411421, 340302, 654325, 360733, 370322, 450126, 632721, 320924, 430321, 532625, 652927, 440523, 230302, 511702, 361025, 150725, 360731, 321183, 451024, 440404, 320205, 321302, 370306, 371322, 510311, 360102, 431124, 410883, 500238, 230110, 522422, 331123, 411403, 522229, 520424, 510682, 320000, 231102, 652101, 371000, 130107, 420527, 542121, 500112, 150425, 140225, 341623, 331100, 430522, 540123, 500000, 652923, 130726, 150223, 420529, 440783, 530921, 211003, 320281, 513223, 530700, 450400, 331004, 410303, 511681, 640205, 640424, 620821, 441424, 530522, 630000, 370634, 360726, 230604, 150523, 371302, 340323, 141023, 220581, 610431, 610524, 220724, 150922, 410600, 211103, 440800, 632222, 230505, 330211, 360721, 130406, 522627, 422826, 220122, 210882, 230826, 530102, 130921, 469002, 360424, 340123, 220502, 120112, 450422, 370830, 152201, 320107, 361028, 510104, 440923, 654000, 330621, 141034, 450803, 510727, 621222, 530000, 610825, 610302, 510400, 450109, 441202, 429021, 654201, 211300, 140624, 360302, 511528, 130108, 532527, 652826, 520303, 530825, 330322, 511600, 430281, 340406, 230624, 522223, 500235, 220281, 411503, 610322, 411330, 533100, 210122, 411726, 341102, 220181, 530626, 130826, 411622, 232722, 340825, 230102, 441500, 360826, 420111, 141082, 141182, 231281, 620200, 441581, 431129, 440183, 130604, 220800, 532329, 620321, 610526, 510000, 411224, 621022, 130428, 340521, 130205, 421087, 532621, 130628, 310118, 440902, 510502, 321000, 420583, 130804, 542522, 360103, 410800, 420113, 530829, 532524, 421125, 542301, 513424, 460107, 320830, 421000, 513230, 331024, 360222, 220303, 530602, 511522, 130823, 441802, 420881, 330200, 330727, 361124, 530113, 330803, 440114, 210211, 430726, 152526, 533321, 460000, 510600, 411282, 420281, 500118, 522625, 350426, 150522, 330382, 530424, 611023, 130532, 231084, 469031, 150300, 210600, 341302, 130185, 320400, 450330, 445102, 150404, 420506, 410311, 411623, 522401, 440803, 421022, 320114, 451226, 211421, 611024, 360200, 410700, 150222, 371203, 360123, 320703, 210282, 320322, 211221, 433100, 623025, 350505, 330108, 230803, 360732, 510124, 510302, 420106, 430211, 330183, 420205, 640323, 140224, 653226, 321102, 420984, 330424, 441882, 210800, 340500, 140932, 510703, 522631, 230127, 420582, 211302, 330503, 500242, 652302, 371626, 433123, 520321, 210900, 652900, 410184, 654221, 330881, 371081, 410104, 370829, 150104, 450521, 441223, 420600, 460106, 433125, 130630, 370211, 520114, 451423, 230381, 231085, 360321, 340223, 430412, 410811, 130303, 542127, 632621, 220103, 610830, 211121, 650106, 451324, 654322, 430224, 610626, 341821, 150981, 421023, 430203, 441827, 653201, 411000, 211081, 632127, 610624, 370321, 130638, 532530, 210204, 451321, 510525, 140924, 330326, 230203, 520328, 321081, 330782, 350583, 510623, 621025, 622926, 450222, 610404, 431322, 350123, 611021, 371400, 360900, 131023, 360111, 370902, 440281, 131081, 150421, 330329, 340104, 140200, 520200, 610822, 370700, 411600, 341721, 210811, 230705, 341502, 522623, 220622, 130184, 152200, 542424, 130200, 130730, 130400, 430721, 431026, 230902, 140729, 152502, 130522, 652925, 450303, 632626, 350504, 230100, 211011, 530428, 451030, 610422, 450405, 532327, 310108, 371327, 210100, 500113, 371102, 410221, 511821, 542122, 360122, 610828, 350721, 450502, 445321, 511825, 140108, 320504, 513432, 371325, 610623, 431202, 330825, 511725, 150621, 511129, 350623, 430682, 511133, 150103, 110116, 152202, 350481, 451425, 420504, 440300, 522425, 360823, 510403, 620103, 320382, 632722, 421024, 410326, 450421, 220882, 350724, 542329, 370900, 610304, 230500, 341800, 341000, 230882, 610622, 522626, 653124, 230700, 431123, 450122, 620402, 370523, 532628, 451227, 620422, 320721, 210681, 451302, 230707, 130525, 210727, 341421, 420922, 110109, 410402, 350925, 640400, 371122, 450100, 513430, 231224, 433122, 230208, 610727, 610303, 140226, 140429, 330102, 653225, 632726, 522230, 542125, 230703, 341723, 130207, 532502, 620724, 530321, 469028, 131128, 320115, 610402, 320723, 610328, 231002, 140702, 330683, 371312, 230421, 411121, 211303, 410922, 441624, 220700, 370405, 420300, 220282, 370784, 632625, 430529, 510524, 141123, 650200, 140430, 361123, 110000, 370283, 430124, 141181, 420105, 330122, 150100, 511521, 431122, 440308, 222424, 330903, 130625, 210102, 610423, 632624, 513200, 513231, 610521, 440229, 130727, 230230, 210202, 511621, 130404, 520422, 430681, 510521, 532532, 410204, 532323, 130126, 411625, 511100, 320623, 530822, 420381, 350423, 654202, 512022, 220702, 361030, 230711, 210111, 530128, 431302, 341321, 532328, 542334, 140121, 542523, 320507, 620902, 450221, 370612, 410724, 520122, 131182, 431002, 321300, 610502, 522222, 621121, 210403, 370284, 522300, 210423, 420302, 450602, 530326, 350902, 530722, 350781, 330109, 310230, 522723, 610326, 320111, 620822, 350525, 510823, 450981, 630100, 500240, 320305, 361128, 361024, 232700, 341023, 350782, 650202, 532926, 610103, 610923, 350200, 141028, 450512, 513332, 411721, 441481, 431381, 511000, 440205, 430703, 522325, 361129, 130132, 350924, 610632, 131121, 350211, 140421, 421100, 410803, 510626, 321181, 150428, 530624, 361027, 450902, 331082, 360921, 222403, 340881, 231182, 431025, 610926, 511400, 420625, 140322, 370786, 710000, 522328, 370304, 620121, 371523, 420683, 450702, 540124, 360428, 420505, 140105, 411323, 430921, 450921, 320206, 140223, 320506, 620623, 370212, 441200, 360983, 310120, 410400, 430423, 371723, 530422, 320724, 513325, 441324, 530600, 370400, 230722, 610728, 513335, 620982, 110107, 350429, 623021, 230708, 371328, 131082, 441825, 370783, 610400, 140781, 421122, 430300, 513429, 522634, 350825, 500115, 210504, 130722, 430923, 370686, 422827, 141030, 420802, 140603, 422828, 140923, 131026, 542200, 220623, 141027, 360203, 222402, 350824, 513331, 632801, 430603, 140823, 440513, 110102, 120225, 610429, 610826, 350430, 542231, 532531, 420100, 441881, 450200, 532525, 621002, 440606, 511822, 370681, 500101, 371326, 430100, 410900, 532822, 130824, 441226, 410482, 370831, 210321, 513427, 340404, 420104, 610621, 371700, 530622, 511421, 140500, 140829, 371103, 650100, 460108, 360600, 370881, 361021, 371082, 522732, 542226, 150800, 210323, 532301, 430722, 441625, 622901, 371425, 513333, 411321, 440811, 130721, 533325, 530111, 410782, 430624, 210702, 130130, 421222, 411327, 130624, 230108, 231222, 610582, 430981, 410224, 610700, 360830, 130705, 530802, 361125, 220106, 542427, 320411, 652926, 210903, 120223, 330682, 140600, 430700, 411602, 430702, 371726, 440282, 440982, 540122, 360827, 653121, 230715, 530323, 620721, 141031, 610112, 140902, 130183, 622923, 371625, 210603, 532325, 532500, 321100, 320113, 411023, 652122, 513434, 320321, 510105, 430304, 330104, 361127, 440608, 230123, 520112, 542129, 350122, 632128, 654300, 130635, 410381, 650105, 370205, 410181, 511181, 211321, 130733, 542128, 445323, 450821, 621221, 361000, 450329, 360622, 340207, 522428, 530827, 141130, 610631, 620111, 410000, 210522, 220104, 130631, 610102, 140825, 230710, 341702, 650103, 150727, 320802, 542126, 445122, 532528, 522722, 130433, 140921, 522725, 320684, 522200, 440605, 370685, 510903, 652825, 441521, 310103, 320103, 220221, 410711, 623026, 370124, 532600, 130421, 230111, 445100, 320505, 350104, 542422, 230621, 520421, 220323, 130302, 520302, 320405, 331021, 411624, 130203, 469027, 152523, 130133, 542338, 441323, 620500, 420981, 150221, 360782, 150802, 411082, 141100, 610323, 130923, 430611, 360423, 620722, 330206, 640381, 620700, 150921, 370406, 654002, 540127, 410222, 330411, 130629, 510802, 511025, 130322, 450000, 451402, 420321, 150124, 610723, 120110, 371100, 370000, 522601, 150823, 230206, 361026, 610000, 310114, 130223, 530924, 141021, 360802, 420902, 542623, 430725, 451300, 130125, 450332, 632700, 469033, 411329, 530721, 430406, 130637, 331023, 420114, 622921, 150822, 530630, 632725, 421221, 610104, 320705, 370481, 440400, 621126, 530328, 513437, 220723, 450105, 140728, 510812, 230605, 350722, 441623, 520121, 410325, 500236, 140727, 131181, 610116, 370403, 210000, 410411, 469023, 130100, 410122, 410523, 411681, 140122, 360730, 330324, 510421, 320700, 350527, 371500, 440402, 640302, 411024, 500107, 320124, 370921, 370682, 230225, 530900, 530124, 532523, 810000, 371422, 511527, 620823, 411081, 411724, 430822, 340403, 330802, 421083, 421281, 130928, 430811, 210802, 522624, 445281, 520102, 140927, 150625, 511523, 420325, 513330, 140623, 410324, 440825, 431221, 654003, 445300, 341004, 130521, 340208, 410802, 440000, 410183, 422823, 542222, 522426, 621200, 150928, 210803, 650203, 654301, 320903, 341422, 430202, 632121, 650204, 430524, 130481, 542430, 130981, 320324, 210400, 330381, 230183, 431128, 653130, 130929, 321088, 431127, 320921, 330824, 420322, 640181, 530126, 120111, 320804, 371321, 140621, 530628, 150304, 230300, 510114, 542331, 370826, 230704, 610426, 430511, 341622, 430602, 350821, 445202, 371323, 451229, 652829, 533423, 210283, 450600, 230321, 130523, 620100, 530400, 321322, 610824, 451027, 321011, 654223, 410725, 441300, 620522, 411729, 370882, 370785, 520113, 360430, 440233, 542524, 610329, 520325, 110112, 520203, 640122, 659001, 331126, 632822, 361126, 610222, 371524, 231004, 140181, 370305, 350926, 330282, 469006, 610114, 150303, 420624, 340321, 350400, 430421, 430781, 610204, 130534, 451400, 450500, 440785, 340405, 450300, 231000, 410200, 511111, 131003, 620922, 659004, 611000, 610100, 321111, 410825, 542333, 340811, 410225, 532324, 420804, 650205, 640100, 411324, 230804, 140425, 150627, 341802, 130530, 469007, 321023, 652300, 360426, 370213, 411525, 370704, 371424, 542124, 542133, 150200, 542527, 130634, 110104, 230184, 150423, 370102, 421121, 511028, 652328, 130123, 440604, 130535, 210726, 130432, 130706, 232723, 130229, 621228, 320323, 632622, 640121, 230304, 430424, 621224, 610702, 450223, 513224, 330783, 320800, 231202, 510723, 530621, 211422, 530129, 451026, 341221, 152531, 330600, 441900, 340803, 451102, 210213, 622922, 150700, 152221, 320482, 141033, 230900, 230124, 530103, 440222, 451025, 320582, 511902, 210604, 230422, 341822, 410108, 431027, 451225, 130723, 370200, 442000, 652123, 410526, 152530, 520402, 140424, 430381, 500225, 610902, 410302, 440983, 500232, 130225, 440512, 440232, 621026, 410182, 330900, 230221, 361022, 513401, 130300, 411727, 360429, 440802, 610929, 650121, 532927, 230523, 421102, 530925, 360727, 513300, 610722, 654023, 210505, 411122, 321324, 441423, 140123, 469000, 141122, 152900, 371525, 140830, 500233, 211102, 220881, 140722, 150821, 130527, 150207, 620981, 441203, 360728, 653224, 532331, 450503, 330212, 532823, 611002, 620702, 542332, 130429, 130430, 350723, 632600, 542624, 542526, 450226, 130632, 510725, 650107, 230903, 350402, 411100, 360403, 512081, 542132, 152921, 340400, 420500, 450721, 450722, 370112, 530823, 340602, 650104, 340700, 370125, 542232, 530423, 430103, 420700, 540121, 610481, 350305, 330602, 469029, 440882, 220822, 341225, 371721, 130822, 610802, 522726, 511722, 210300, 533124, 653123, 150924, 341003, 532322, 420525, 340800, 370285, 640200, 513433, 350923, 410702, 620621, 130529, 371600, 510724, 610625, 310116, 510122, 410306, 130984, 230904, 130321, 420117, 430426, 542225, 310109, 152522, 411104, 500231, 632802, 340122, 150902, 513328, 410425, 632221, 520330, 532526, 542425, 652100, 532932, 431300, 230702, 420682, 152222, 441426, 320502, 350503, 370687, 510106, 440600, 120115, 652800, 130304, 152525, 451222, 330182, 610126, 340304, 659003, 320200, 430382, 340504, 350425, 640422, 130000, 130423, 522633, 150923, 410928, 320811, 330681, 350900, 130204, 330784, 441602, 360322, 360502, 430581, 440305, 632300, 510704, 610428, 652928, 230128, 220721, 430723, 652929, 210411, 411723, 330110, 140106, 350783, 220722, 410422, 340823, 220300, 632800, 320105, 330522, 230223, 510683, 542123, 360781, 110106, 513322, 360923, 640106, 441823, 542400, 411502, 370602, 610122, 451023, 451481, 320923, 654200, 371502, 532922, 130202, 150526, 542336, 411425, 131002, 371623, 530502, 220582, 370703, 210112, 530922, 653122, 654021, 654022, 500109, 330303, 320585, 450403, 150723, 411728, 341125, 441700, 420581, 420626, 532623, 411500, 620924, 210224, 623022, 421224, 513221, 321323, 632123, 430821, 340621, 371522, 511102, 440306, 500111, 450881, 140900, 611025, 632525, 440511, 622924, 140400, 411103, 141081, 421181, 510811, 441303, 230306, 371402, 230303, 440224, 320826, 410923, 431081, 360724, 411002, 410102, 630104, 522622, 211282, 152528, 654024, 510108, 532326, 429006, 150125, 530181, 211481, 510182, 610528, 650109, 210781, 330300, 370404, 230716, 340822, 220100, 211005, 421126, 350100, 411481, 350524, 542627, 469021, 152224, 320621, 330502, 410527, 420112, 430481, 513323, 652200, 130636, 230407, 130582, 140321, 620600, 360800, 420921, 140100, 411422, 340802, 220284, 350921, 341024, 469003, 410726, 110117, 230307, 510921, 341522, 510132, 440903, 420526, 150900, 130633, 230281, 654025, 231024, 522224, 620400, 510411, 542335, 320211, 410500, 610730, 510300, 510681, 410223, 620104, 150400, 530402, 340000, 141125, 341402, 542421, 350700, 150782, 654321, 420222, 420821, 500241, 410505, 513329, 222400, 522632, 360725, 371200, 310117, 140800, 320503, 371728, 320381, 331122, 230600, 321182, 450302, 360926, 621021, 231005, 141002, 513428, 422801, 220521, 341503, 130903, 621024, 210113, 320202, 640202, 110113, 654027, 650000, 421124, 320304, 340102, 350303, 360602, 140929, 340311, 520327, 421202, 533122, 621102, 620000, 623001, 420107, 610726, 440106, 440100, 451000, 431028, 430400, 610430, 653125, 530723, 653200, 141121, 230200, 532925, 542233, 131100, 410581, 530322, 130926, 320682, 141102, 130181, 130621, 320611, 130983, 131025, 230781, 371482, 533324, 512000, 210503, 430221, 650201, 520181, 441781, 230400, 410404, 371526, 321202, 152527, 371521, 341181, 330921, 340604, 370923, 410704, 510522, 620824, 120105, 510900, 140622, 621023, 130227, 513334, 340200, 370302, 230125, 130182, 540125, 422825, 431230, 441302, 410822, 220681, 130324, 620826, 210181, 511781, 522728, 650102, 522600, 321112, 411281, 150602, 210203, 320829, 330726, 411725, 411523, 130703, 530425, 430122, 411527, 652722, 410728, 440804, 500106, 440900, 513233, 211404, 540000, 370725, 130425, 231121, 500103, 510781, 350111, 130683, 341400, 431022, 441702, 420103, 510504, 211122, 321084, 522727, 610324, 431003, 150206, 450922, 431102, 450224, 360922, 469005, 341521, 429004, 510700, 150783, 410211, 231100, 130524, 130528, 522225, 350213, 230713, 640221, 512002, 511402, 150724, 451224, 141022, 522226, 361100, 370521, 450423, 530324, 360824, 360500, 420702, 130732, 140928, 131022, 451228, 330402, 341203, 350625, 341002, 654225, 410403, 510821, 130827, 522629, 630103, 411325, 370832, 360734, 340111, 542600, 320584, 542328, 500102, 430407, 371727, 410506, 520323, 430302, 450481, 653127, 230714, 140222, 610725, 433126, 150600, 330100, 222404, 141026, 110101, 469030, 350103, 360681, 522322, 510129, 341200, 220322, 441225, 522630, 610827, 640423, 542223, 211004, 131127, 210281, 140428, 341722, 341103, 632821, 500243, 469001, 231123, 360481, 430500, 640522, 440184, 110111, 361002, 653131, 340703, 360729, 370983, 431121, 511123, 320100, 211223, 141025, 522423, 130434, 441422, 532928, 210402, 410781, 513400, 150825, 610331, 441821, 441502, 360825, 440500, 331003, 371624, 370126, 130922, 140211, 350702, 542228, 652901, 410304, 652723, 440104, 150121, 360521, 430104, 450321, 610424, 522702, 320412, 411303, 450124, 510322, 654226, 440103, 451323, 520123, 340303, 520322, 140881, 429005, 411700, 140581, 451021, 620523, 530926, 140981, 451028, 360202, 370300, 411025, 140602, 140524, 150781, 230706, 500237, 610900, 130581, 653101, 320925, 331102, 360881, 542429, 610928, 330203, 450700, 652700, 450802, 210602, 211381, 220602, 451424, 330483, 430528, 441402, 511622, 430111, 420602, 220400, 231221, 360281, 441800, 510402, 130700, 430800, 530627, 652327, 621227, 210421, 330723, 610425, 431224, 120103, 522636, 450804, 230202, 511126, 220422, 150626, 220802, 230305, 441224, 430408, 231083, 371427, 350822, 610628, 500200, 350212, 350000, 210304, 130825, 430626, 231003, 371311, 140110, 230227, 410927, 450621, 230229, 430802, 411626, 440307, 361029, 210804, 621122, 320203, 410603, 130900, 130681, 320583, 411426, 140822, 220605, 320982, 370100, 321003, 441322, 211281, 652223, 371621, 341600, 511300, 610630, 371083, 350124, 230204, 320102, 350521, 542525, 654224, 360735, 450103, 511425, 210911, 513426, 510100, 211403, 150424, 120114, 510121, 532800, 450326, 140522, 210624, 150721, 431100, 330800, 510115, 150123, 450703, 445224, 330105, 330328, 141029, 230406, 350725, 320922, 150403, 360925, 230623, 513326, 513338, 340824, 513232, 430600, 341423, 341424, 150521, 370282, 441283, 320282, 370827, 341324, 420900, 361102, 511424, 330000, 350626, 370281, 511721, 530121, 340203, 321200, 210124, 360121, 532622, 411322, 653024, 140521, 341202, 441600, 522326, 530125, 330226, 511422, 520425, 140427, 210404, 420303, 632521, 150581, 500108, 533300, 230205, 140824, 640402, 511302, 211224, 450924, 451123, 610922, 620524, 530824, 430482, 542426, 422800, 141126, 350622, 320404, 433124, 210104, 430527, 230521, 371300, 231124, 350182, 120221, 431321, 321203, 330283, 440112, 430204, 410202, 430724, 331181, 130927, 542621, 232721, 130924, 130129, 152500, 520100, 341323, 131000, 330523, 331125, 542625, 511024, 513327, 610925, 410300, 220600, 450203, 441721, 431200, 530523, 350982, 411702, 441622, 653000, 370781, 421300, 610581, 522700, 440304, 341122, 410503, 110228, 230800, 640502, 220524, 150785, 511323, 511423, 371581, 320116, 320681, 222405, 341525, 542428, 440116, 430503, 510922, 632100, 130725, 360981, 320104, 450108, 310106, 130728, 330624, 420323, 511923, 522635, 520326, 330400, 340502, 532300, 433127, 421381, 511303, 130702, 500222, 610927, 231223, 130403, 141024, 640000, 431225, 430422, 141129, 630121, 350628, 513436, 620122, 341824, 511124, 460105, 431281, 511322, 530927, 530427, 431024, 653223, 131124, 231283, 640425, 451223, 110108, 140000, 513222, 632321, 340827, 140926, 130435, 320125, 611026, 621123, 220621, 231225, 130427, 230828, 150524, 610111, 610403, 500234, 140525, 520103, 410882, 110115, 540100, 530800, 511526, 230104, 210682, 360821, 410185, 370982, 330482, 361121, 451221, 350424, 340402, 610202, 131122, 211100, 321281, 510503, 370522, 623024, 421081, 210782, 431103, 653023, 130821, 532930, 652823, 510722, 620725, 632224, 410323, 141127, 222426, 469032, 440981, 120113, 513226, 511011, 230709, 320902, 370500, 360124, 532900, 350322, 340202, 532501, 231282, 640500, 341204, 350526, 140930, 411400, 420607, 440784, 520381, 530629, 220500, 542325, 659000, 211400, 440203, 542322, 321002, 411627, 230502, 350800, 620302, 130828, 451121, 411628, 652325, 431226, 520400, 510112, 610721, 150925, 210521, 450603, 140109, 331002, 450800, 522400, 621223, 220000, 340322, 370105, 130729, 210114, 350206, 533422, 371722, 511381, 511724, 542423, 341621, 542229, 230403, 330204, 620825, 350302, 211002, 152501, 320303, 230109, 370800, 340721, 431000, 150702, 211324, 522323, 130682, 419001, 360000, 450331, 140724, 530524, 130684, 360828, 532626, 130533, 140481, 220200, 230833, 522731, 530127, 360402, 441826, 411521, 222401, 140827, 540126, 330521, 532929, 500119, 610602, 340221, 330185, 360421, 610729, 211021, 130531, 411202, 150000, 445121, 410327, 230382, 610330, 510904, 341523, 611022, 620105, 130731, 411528, 150426, 513337, 445221, 350427, 230000, 310101, 410305, 511132, 420703, 360723, 513324, 210502, 360105, 451122, 341226, 500223, 430525, 130230, 330822, 620503, 451281, 220203, 320803, 370502, 610627, 510603, 511502, 610124, 654026, 621226, 321283, 632623, 652222, 131125, 411621, 410322, 440507, 430623, 652301, 513435, 652201, 450900, 420502, 370181, 370705, 371329, 360104, 140931, 410100, 341602, 330702, 410502, 150105, 150623, 451322, 230129, 445200, 510500, 441523, 410821, 211000, 532931, 140821, 450328, 331022, 542323, 140227, 532901, 610113, 512021, 420704, 220821, 140431, 440883, 130526, 610115, 340103, 532923, 410329, 410522, 350823, 430102, 120104, 652801, 620423, 522228, 130600, 654323, 210881, 310000, 620521, 331124, 210200, 130131, 330703, 511112, 622925, 431382, 513321, 632324, 220382, 360400, 320706, 632322, 341022, 610600, 150722, 620622, 360924, 532529, 510726, 431227, 500110, 510113, 320831, 511900, 510923, 371421, 530923, 140828, 430902, 652828, 451421, 450225, 210381, 210905, 620123, 420200, 360427, 431222, 500229, 511321, 520324, 131123, 360902, 440204, 542224, 230405, 141124, 410611, 430903, 210921, 653001, 622900, 440607, 511827, 341322, 350681, 410721, 510824, 530521, 150622, 620900, 370683, 652323, 230606, 450325, 421127, 659002, 530623, 370811, 411424, 410823, 220302, 430523, 511802, 511921, 430200, 231226, 620802, 350582, 445381, 511700, 511623, 230103, 513422, 141000, 411526, 610523, 370613, 210904, 450322, 210703, 632723, 331127, 150726, 350629, 620525, 371725, 530100, 230602, 520382, 510822, 511824, 130281, 430900, 341500, 150784, 310110, 210123, 371602, 542227, 411300, 440515, 220381, 361130, 410902, 520201, 451422, 130603, 500105, 500230, 440703, 230182, 440303, 330421, 450304, 522324, 441723, 653221, 350802, 431229, 220112, 370600, 230921, 210500, 450327, 469025, 341300, 411302, 632823, 513227, 440823, 511723, 653129, 410621, 430000, 620602, 350922, 513423, 131102, 632126, 140925, 410703, 440705, 411328, 130622, 621125, 341182, 410804, 120106, 500104, 520423, 653222, 430181, 445322, 450204, 350502, 230224, 620921, 370202, 370883, 330700, 410205, 320981, 350300, 370724, 320311, 450404, 130124, 150203, 140700, 331121, 530724, 622927, 542324, 230126, 511113, 620502, 653227, 140303, 230622, 360323, 610125, 230881, 610629, 350627, 510183, 150122, 210103, 341881, 371702, 340222, 360702, 230522, 520222, 330225, 520000, 320581, 530122, 140882, 511324, 371002, 370611, 440514, 513425, 620723, 533103, 441621, 411326, 522227, 500224, 141032, 331081, 320722, 360982, 220283, 130323, 231181, 421223, 522628, 450125, 350421, 370911, 350125, 440403, 652324, 469024, 411222, 533102, 422802, 210212, 510422, 150402, 152922, 431023, 522427, 610300, 340826, 360722, 370104, 530302, 654324, 330281, 421303, 623000, 632500, 210311, 460200, 441421, 500227, 150824, 510131, 410481, 310113, 321311, 150202, 131024, 340600, 652701, 420982, 431125, 652822, 370702, 330302, 330327, 431021, 330922, 522301, 532924, 211200, 350881, 542326, 360822, 620102, 542500, 621202, 621027, 450323, 440200, 420202, 500228, 520300, 340100, 220523, 440704, 320500, 320204, 210105, 330781, 451022, 451029, 632223, 513228, 411524, 341126, 451100, 530702, 440881, 410622, 350121, 420115, 610200, 350304, 320602, 522701
 8  };
 9 
10 public static String getIdNo(boolean male){
11   //随机生成生日 1~99岁
12   long begin = System.currentTimeMillis() - 3153600000000L;//100年内
13   long end = System.currentTimeMillis() - 31536000000L; //1年内
14   long rtn = begin + (long) (Math.random() * (end - begin));
15   Date date = new Date(rtn);
16   SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
17   String birth = simpleDateFormat.format(date);
18   return getIdNo(birth,male);
19  }
20     
21  public static String getIdNo(String birth,boolean male){
22   StringBuilder sb = new StringBuilder();
23   Random random = new Random();
24   int value = random.nextInt(cities.length);
25   sb.append(cities[value]);
26   sb.append(birth);
27   value = random.nextInt(999) + 1;
28   if(male && value % 2 == 0){
29    value++;
30   }
31   if(!male && value % 2 == 1){ value++;}
32   if(value >= 100){ sb.append(value);
33   }else if(value >= 10){sb.append('0').append(value);
34   }else{ sb.append("00").append(value);
35   }
36   sb.append(calcTrailingNumber(sb));
37   return sb.toString();
38  }
39  private static final int[] calcC = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
40  private static final char[] calcR = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
41 /*
42   * <p>18位身份证验证</p>
43   * 根据〖中华人民共和国国家标准 GB 11643-1999〗中有关公民身份号码的规定,公民身份号码是特征组合码,由十七位数字本体码和一位数字校验码组成。
44   * 排列顺序从左至右依次为:六位数字地址码,八位数字出生日期码,三位数字顺序码和一位数字校验码。
45   * 第十八位数字(校验码)的计算方法为:
46   * 1.将前面的身份证号码17位数分别乘以不同的系数。从第一位到第十七位的系数分别为:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
47   * 2.将这17位数字和系数相乘的结果相加。
48   * 3.用加出来和除以11,看余数是多少?
49   * 4.余数只可能有0 1 2 3 4 5 6 7 8 9 10这11个数字。其分别对应的最后一位身份证的号码为1 0 X 9 8 7 6 5 4 3 2。
50   * 5.通过上面得知如果余数是2,就会在身份证的第18位数字上出现罗马数字的Ⅹ。如果余数是10,身份证的最后一位号码就是2。
51   */
52  private static char calcTrailingNumber(StringBuilder sb) {
53   int[] n = new int[17];
54   int result = 0;
55   for (int i = 0; i < n.length; i++) {
56    n[i] = Integer.parseInt(String.valueOf(sb.charAt(i)));
57   }
58   for (int i = 0; i < n.length; i++) {
59    result += calcC[i] * n[i];
60   }
61   return calcR[result % 11];
62  }
63  public static void main(String[] args) {
64   long a = System.currentTimeMillis();
65   System.out.println(getIdNo("19790306",true));
66   System.out.println(getIdNo("20100112",false));
67   System.out.println(getIdNo(true));
68   System.out.println(getIdNo(false));
69   a = System.currentTimeMillis() - a;
70   System.out.println("耗时"+a+"毫秒");
71  }
72 }
View Code