Commit 1008da97 authored by 邓乾隆's avatar 邓乾隆

证件号校验添加

parent 66b9a48f
...@@ -200,7 +200,8 @@ ...@@ -200,7 +200,8 @@
|| field_name.toUpperCase()=='INVOICE_TITLE' || field_name.toUpperCase()=='INVOICE_BP_ADDRESS' || field_name.toUpperCase()=='INVOICE_TITLE' || field_name.toUpperCase()=='INVOICE_BP_ADDRESS'
|| field_name.toUpperCase()=='INVOICE_BP_PHONE_NUM' || field_name.toUpperCase()=='INVOICE_BP_BANK' || field_name.toUpperCase()=='INVOICE_BP_PHONE_NUM' || field_name.toUpperCase()=='INVOICE_BP_BANK'
|| field_name.toUpperCase()=='INVOICE_BP_BANK_ACCOUNT' || field_name.toUpperCase()=='TAX_REGISTRY_NUM' || field_name.toUpperCase()=='INVOICE_BP_BANK_ACCOUNT' || field_name.toUpperCase()=='TAX_REGISTRY_NUM'
|| field_name.toUpperCase()=='REF_V07' || field_name.toUpperCase()=='RECEPTION_MAILE'){ || field_name.toUpperCase()=='REF_V07' || field_name.toUpperCase()=='RECEPTION_MAILE'
|| field_name.toUpperCase()=='ID_CARD_NO_AG'){
f.setInsertExpression('hlc_remove_space(${@'+field_name+'})'); f.setInsertExpression('hlc_remove_space(${@'+field_name+'})');
f.setUpdateExpression('hlc_remove_space(${@'+field_name+'})'); f.setUpdateExpression('hlc_remove_space(${@'+field_name+'})');
} }
......
...@@ -216,6 +216,28 @@ ...@@ -216,6 +216,28 @@
record.set('full_elec_invoice_flag','Y'); record.set('full_elec_invoice_flag','Y');
record.set('full_elec_invoice_flag_n','是'); record.set('full_elec_invoice_flag_n','是');
} }
}
//法人身份证号校验
if (name == 'id_card_no_leg' && value){
var id_card_no_leg = record.get('id_card_no_leg');
if (!checkCard(id_card_no_leg)) {
Leaf.showMessage('${l:HLS.PROMPT}', '法人代表身份证号格式错误!');
setTimeout(function () {
record.set('id_card_no_leg', '');
}, 20);
return false;
}
}
//经办人身份证校验
if (name == 'id_card_no_ag' && value){
var id_card_no_leg = record.get('id_card_no_ag');
if (!checkCard(id_card_no_leg)) {
Leaf.showMessage('${l:HLS.PROMPT}', '经办人身份证号格式错误!');
setTimeout(function () {
record.set('id_card_no_leg', '');
}, 20);
return false;
}
} }
} }
} }
......
...@@ -153,7 +153,29 @@ ...@@ -153,7 +153,29 @@
record.set('full_elec_invoice_flag_n','是'); record.set('full_elec_invoice_flag_n','是');
} }
} }
} //法人身份证号校验
if (name == 'id_card_no_leg' && value){
var id_card_no_leg = record.get('id_card_no_leg');
if (!checkCard(id_card_no_leg)) {
Leaf.showMessage('${l:HLS.PROMPT}', '法人代表身份证号格式错误!');
setTimeout(function () {
record.set('id_card_no_leg', '');
}, 20);
return false;
}
}
//经办人身份证校验
if (name == 'id_card_no_ag' && value){
var id_card_no_leg = record.get('id_card_no_ag');
if (!checkCard(id_card_no_leg)) {
Leaf.showMessage('${l:HLS.PROMPT}', '经办人身份证号格式错误!');
setTimeout(function () {
record.set('id_card_no_leg', '');
}, 20);
return false;
}
}
}
}; };
//保存前调用 //保存前调用
......
...@@ -43,6 +43,11 @@ checkCard = function(card) { ...@@ -43,6 +43,11 @@ checkCard = function(card) {
//去除空格 //去除空格
card = card.trim(); card = card.trim();
card = card.replace(/[\t\r\f\n\s]*/g,""); card = card.replace(/[\t\r\f\n\s]*/g,"");
//长度必须满18位
if(card.length != 18){
return false;
}
if (isCardNo(card) === false) { if (isCardNo(card) === false) {
return false; return false;
} }
...@@ -235,3 +240,25 @@ function checkPostCode(str) { ...@@ -235,3 +240,25 @@ function checkPostCode(str) {
} }
} }
//中征码校验
function checkDKK(financecode) {
let weightValue = [1, 3, 5, 7, 11, 2, 13, 1, 1, 17, 19, 97, 23, 29];
let checkValue = new Array(14).fill(0);
let totalValue = 0;
let c = 0;
for (let j = 0; j < 14; j++) {
if (financecode[j] >= 65 && financecode[j] <= 90) { // 大写字母
checkValue[j] = (financecode[j] - 65) + 10; // a-10 z-35
} else if (financecode[j] >= 48 && financecode[j] <= 57) { // 数字0-9
checkValue[j] = financecode[j] - 48; // 0-0 9-9
} else {
return false;
}
totalValue += weightValue[j] * checkValue[j];
}
c = 1 + totalValue % 97; // 1-97
let val = (financecode[14] - 48) * 10 + (financecode[15] - 48); // 14位码值不大于57,数值9
return val === c;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment