WorkBook1.7z
上传内置模板看下呢
-----------------------------
if (this.value != "") {
var sql = 'select max(产品编码) cpbm from product where 产品类型="' + this.value + '"';
var bm=FR.remoteEvaluate('=sql("mysql","SELECT max(产品编码) cpbm from product where 产品类型=\''+this.value+'\'",1,1)');
var new_bm = FR.remoteEvaluate('CONCATENATE(format(right("' + bm + '", 6) + 1, "#000000"))');
_g().setCellValue('B2', new_bm); }
---------------------------------------
if (this.value != "") {
var sql = 'select max(产品编码) cpbm from product where 产品类型="' + this.value + '"';
var bm=FR.remoteEvaluate('=sql("micro_crm","SELECT max(产品编码) cpbm from product where 产品类型=\''+this.value+'\'",1,1)');
var new_bm = FR.remoteEvaluate('CONCATENATE(left("' + bm + '", 2), format(right("' + bm + '", 6) + 1, "#000000"))');
if(bm.length==0){//判断该产品类型下是否有产品编码,如果没有,给默认值
_g().setCellValue('B2', 'PJ000001');
}else{
_g().setCellValue('B2', new_bm);
}
}