Commit c52da11a authored by Scott Sun's avatar Scott Sun

s

parent 0b956001
......@@ -206,6 +206,7 @@ try {
if(GEN.checkInout({job:job,mode:"test"}) != 0 && mode == "aimdfm"){ throw "the job check" }
GEN.checkInout({job:job,mode:"out"});
script_info({ msg: "Data Analysis" ,result_severity:"info"})
global._ERRORMAG = "Failed to Data Analysis";
script_info({ progress: 65 })
var pcs_step = par.pcs_step == "" ? "cad" : par.pcs_step;
var array_step = par.array_step == "" ? "stp" : par.array_step;
......@@ -217,7 +218,9 @@ try {
pcs_step = step_list[0]
}
script_info({ msg: "Error-Upload matrix",result_severity:"info" })
script_info({ msg: "Upload matrix",result_severity:"info" })
global._ERRORMAG = "Error-Upload matrix";
script_info({ progress: 65 })
var matrix = UPLOAD_LAYER_MATRIX({job:job}) // 分析matrix 获得分析后的matrix信息
GEN.openStep({job:job, name:pcs_step})
......@@ -273,7 +276,9 @@ try {
})
GEN.clearLayers()
script_info({ msg: "Error-Drill Stackup analysis" })
script_info({ msg: "Drill Stackup analysis" })
global._ERRORMAG = "Error-Drill Stackup analysis";
script_info({ progress: 70 })
// * new 钻孔叠构
var cam_drill_structure = []
......@@ -397,7 +402,9 @@ try {
var analysis_obj = analysis({job:job,jobId:JobId,pcs_step:pcs_step,array_step:array_step,matrix:matrix})
// 创建profile
var tmp_matrix = GEN.getMatrix({job:job})
script_info({ msg: "Error-Profile analysis" })
script_info({ msg: "Profile analysis" })
global._ERRORMAG = "Error-Profile analysis";
script_info({ progress: 70 })
// * profile 和 拼版
var pandle_step = step_list.map(function(v){
......@@ -471,7 +478,9 @@ try {
}
ALL.gold_fingers = gold_fingers
GEN.closeStep()
script_info({ msg: "Error-PN analysis" })
script_info({ msg: "PN analysis" })
global._ERRORMAG = "Error-PN analysis";
var config = {
jobInfo: {
layer_count: ["signal","power_ground"], // Board属性的signal或者power_ground层
......@@ -541,7 +550,12 @@ try {
}
}
console.log("=================================> 4 save job info")
if(db_customer == "1352"){
jobInfo.array_size_x = jobInfo.pcs_size_x
jobInfo.array_size_y = jobInfo.pcs_size_y
delete jobInfo.pcs_size_x
delete jobInfo.pcs_size_y
}
save_job_info({
jobid: JobId,
jobinfohash: jobInfo
......@@ -549,7 +563,9 @@ try {
console.log("=================================> 5 save drill info")
script_info({ msg: "Error-Drill layer analysis" })
script_info({ msg: "Drill layer analysis" })
global._ERRORMAG = "Error-Drill layer analysis";
script_info({ progress: 75 })
// * 获取pcs_step 和 array_step的钻孔信息
var drill_tool_info = {};
......@@ -569,10 +585,11 @@ try {
var type = item.type;
var step = item.name;
if(GEN.isStepExists({job:job, step:step})){
GEN.openStep({job:job, name:step})
drillLayers.forEach(function(layer){
var layer = layer.name;
if(!GEN.isLayerEmpty({job:job,step:step,layer:layer})){
// GEN.COM("tools_set,layer="+layer+",slots=by_length")
GEN.COM("tools_set,layer="+layer+",slots=by_length")
var tool = GEN.getTool({job:job,step:step,layer:layer,units:"mm"}); // {"1":{"count":"01156","num":"1","type":"plated","min_tol":"0","max_tol":"0","finish_size":"100.31","drill_size":"100.31","slot_len":"0","type2":"standard","shape":"hole","bit":0}}
if(!drill_tool_info[layer]){
drill_tool_info[layer] = tool;
......@@ -605,6 +622,7 @@ try {
}
}
})
GEN.closeStep()
}
})
......@@ -674,7 +692,9 @@ try {
})
console.log("=============================> 6 set smd bga")
script_info({ msg: "Error-SMD&BGA analysis" })
script_info({ msg: "SMD&BGA analysis" })
global._ERRORMAG = "Error-SMD&BGA analysis";
script_info({ progress: 80 });
step_list.forEach(function(step){
GEN.openStep({job:job,name:step})
......@@ -734,7 +754,9 @@ try {
if(oping_layer){
GEN.COM("filter_atr_set,filter_name=popup,condition=yes,attribute=.smd")
GEN.COM("sel_ref_feat,layers="+oping_layer+",use=filter,mode=disjoint,pads_as=shape,f_types=line\;pad\;surface\;arc\;text,polarity=positive\;negative,include_syms=,exclude_syms=")
GEN.COM("COM filter_reset,filter_name=popup")
if(GEN.getSelectCount() > 0){
GEN.COM("sel_delete_atr,attributes=.smd")
}
}
})
GEN.closeStep()
......@@ -775,7 +797,6 @@ try {
var signalLayers = analysis_obj.matrixInfo.mSignals.map(function(v){return v.name})
var drillLayers = analysis_obj.matrixInfo.mDrills.map(function(v){return v.name})
console.log("=============================> 13 save copperArea copper_distribution")
var copper_distribution_steplist= [pcs_step, array_step];
copper_distribution_steplist.forEach(function(step){
......@@ -838,7 +859,9 @@ try {
// jobpath = "/home/local_db/server_db/jobs/"+job
// }
// mkPath(jobpath,["user","opcam","steps"])
script_info({ msg: "Error-Signal layer analysis" })
script_info({ msg: "Signal layer analysis" })
global._ERRORMAG = "Error-Signal layer analysis";
script_info({ progress: 85 })
stepList.forEach(function(step){
GEN.openStep({ job: job, name: step })
......@@ -996,7 +1019,9 @@ try {
// layers: signalLayers,
// items: [tmpitem]
// })
script_info({ msg: "Error-Run Checklist",result_severity:"ok" })
script_info({ msg: "Run Checklist",result_severity:"ok" })
global._ERRORMAG = "Error-Run Checklist";
// if (GEN.isChklistExists({ job: job, step: step, chklist: oChecklistName })) {
// GEN.COM("chklist_delete", { chklist: oChecklistName })
// }
......@@ -1044,6 +1069,7 @@ try {
GEN.closeStep()
})
// mvOutProfile({job:job, step:pcs_step})
global._ERRORMAG = false;
// 保存
if(/yes/ig.test(par.auto_save)){
......@@ -1093,10 +1119,10 @@ try {
// }
// 邮件触发
// sendEmail({
// subject:db_customer + ' / '+job+' reading is ready!',
// content: db_customer + ' / '+job+' reading is ready!'
// })
sendEmail({
subject:db_customer + ' / '+job+' reading is ready!',
content: db_customer + ' / '+job+' reading is ready!'
})
if (mode === "aimdfm") {
$.QDfm.updateRow({
......@@ -1506,12 +1532,55 @@ function analysis(props){
return res.length
}
T_m_p.prototype.analysis_vc_card_size = function(props){ // card短边尺寸 string
if(db_customer == "1352"){
var signals = this.matrixInfo.mSignals.map(function(v){return v.name})
GEN.openStep({job:this.job,name:this.pcs_step})
GEN.selClearFeature()
GEN.affectedLayer({affected:'yes',layer:signals,clear_before:'yes'})
GEN.selectByFilter({profile:"in"});
if(GEN.getSelectCount() > 0){
if(GEN.isLayerExists({job:this.job,layer:"_signals"})){GEN.deleteLayer({job:this.job,layer:["_signals"]})}
GEN.selCopyOther({dest:'layer_name',target_layer:'_signals',invert:'no',dx:0,dy:0,size:0})
var tmp = GEN.getLayerLimits({job:this.job,step:this.pcs_step,layer:'_signals',units:'mm'})
var size1 = Number(tmp.xsize);
var size2 = Number(tmp.ysize);
if(size1 > size2){
var tmpsize = size2
size2 = size1
size1 = tmpsize
}
var tmp_width = 0;
// 获取边线宽度
if(GEN.isLayerExists({job:this.job,layer:"tmp2"})){GEN.deleteLayer({job:this.job,layer:["tmp2"]})}
GEN.COM("profile_to_rout,layer=tmp2,width=1")
// 看_signals是否有跟tmp2碰到
GEN.workLayer({name:"_signals",display_number:2,clear_before:'yes'})
GEN.COM("filter_reset,filter_name=popup")
GEN.COM("filter_set,filter_name=popup,update_popup=no,feat_types=line")
GEN.COM("sel_ref_feat,layers=tmp2,use=filter,mode=touch,pads_as=shape,f_types=line\;pad\;surface\;arc\;text,polarity=positive\;negative,include_syms=,exclude_syms=")
if(GEN.getSelectCount() > 0) {
// 获取选择东西的 symbol
var feats = GEN.getFeatures({job:this.job,step:this.pcs_step,layer:"_signals",options:"select",units:"mm"});
GEN.selClearFeature()
var minSyms = feats.map(function(v){return (v.symbol.slice(1) - 0)})
minSyms.sort();
tmp_width = minSyms[0]/1000
}
if(props == "xsize"){
return (size1-tmp_width).toFixed(2) //
}
if(props == "ysize"){
return (size2-tmp_width).toFixed(2) //
}
}
GEN.closeStep()
}
return GEN.getProfileLimits({job:this.job,step:this.pcs_step,units:"mm"})[props].toFixed(2)
}
T_m_p.prototype.analysis_vc_array_size = function(props){ // array长边尺寸 string
if(!this.array_step){return "_error"}
var tmp = GEN.getProfileLimits({job:this.job,step:this.array_step,units:"mm"})
var size1 = Number(tmp.xsize)
var size1 = Number(tmp.xsize)
var size2 = Number(tmp.ysize)
if(size1 > size2){
var tmpsize = size2
......
......@@ -103,6 +103,7 @@ try {
throw cam_workflow_info
}
script_info({ msg: "Data formatting" ,result_severity:"info"})
global._ERRORMAG = "Failed to data format";
script_info({ progress: 35 })
var par = PAR;
if(!par.hasOwnProperty("config_path") || par.config_path==""){
......@@ -132,17 +133,19 @@ try {
var config = eval(cfg)
var job = Job;
if(_.isEmpty(job)) throw "没有传入料号名!";
job = job.toLowerCase()
job = job.toLowerCase();
var custCfg = config.customer[par.customer] // 获取客户配置
var custCfg = config.customer[par.customer]; // 获取客户配置
if(!custCfg){throw "config error"}
// 料号验证
if(!GEN.isJobExists({job:job})){
script_info({ msg: "No PN was found in system" ,result_severity:"error"})
script_info({ msg: "Find PN in system" ,result_severity:"error"})
global._ERRORMAG = "No PN was found in system";
throw "job "+ job+ " is not exist" }
if(!GEN.isJobOpen({job:job})){GEN.openJob({job:job})}
if(GEN.checkInout({job:job,mode:"test"}) != 0 && mode == "aimdfm"){
script_info({ msg: "PN is not checkin" ,result_severity:"error"})
script_info({ msg: "PN Checkin" ,result_severity:"error"})
global._ERRORMAG = "PN is not checkin";
throw "the job check" }
console.log("Checkout====== ========================>")
GEN.checkInout({job:job,mode:"out"});
......@@ -264,7 +267,8 @@ try {
var after_sort_matrix = ret.sortNames
// 改名
script_info({ msg: "Failed to change name(Name clashes)" ,result_severity:"info"})
script_info({ msg: "Change the name" ,result_severity:"info"})
global._ERRORMAG = "Failed to change name";
script_info({ progress: 50 })
err = reName({job:job, matrix:after_sort_matrix, cfg:format_cfg})
if(err){throw err}
......@@ -392,6 +396,8 @@ try {
GEN.COM("open_job,job="+job);
script_info({ msg: "Creating Profile" ,result_severity:"info"})
global._ERRORMAG = "Failed to create profile";
script_info({ progress: 55 })
var all_layer = Object.keys(tmp_matrix);
// 没有outline层
......@@ -523,6 +529,8 @@ try {
var hasProfile = GEN.getProfile({job:job, step:tmp_step})
if(hasProfile.match(/\n/ig).length == 1){
script_info({ msg: "Failed to create profile" ,result_severity:"warn"})
global._ERRORMAG = "Failed to create profile";
job_attrs.readin_result = "Failed to create profile"
db.query("",function(q){
return q.updateRow({
......@@ -538,6 +546,7 @@ try {
script_info({ msg: "Data format is done" ,result_severity:"warn"})
global._ERRORMAG = false;
db.query("",function(q){
return q.updateRow({
......@@ -553,7 +562,6 @@ try {
GEN.saveJob({ job: job });
GEN.checkInout({job:job,mode:"in"})
GEN.closeJob({job:job})
if (mode === "aimdfm") {
$.QDfm.updateRow({
......
......@@ -229,6 +229,8 @@ try {
script_info({ progress: 10 })
if(/odb/ig.test(jobInfo.type)){ // odb导入
script_info({ msg: "Import odb++", result_severity:"error" });
global._ERRORMAG = "Fail to import odb++";
if(jobInfo.data.length == 1){ // 只分析到一个tgz文件 直接导入
IKM.msg("只分析到一个tgz文件 直接导入")
import_info.push({name:jobInfo.data[0].file.name, type:"odb++", date:now(),user:$.user_name})
......@@ -301,6 +303,8 @@ try {
}
if(/gerber/ig.test(jobInfo.type)){ // gerber导入
script_info({ msg: "Import gerber", result_severity:"error" });
global._ERRORMAG = "Fail to import gerber";
GEN.createJob({name:job,db:custCfg.db})
GEN.createStep({job:job,name:step})
var gerberInfo = jobInfo.data.map(function(item){
......@@ -338,6 +342,7 @@ try {
}
if(!importOk){ throw "import error"}
script_info({ progress: 20 })
global._ERRORMAG = null;
reNameStep(job)
if(/2171/.test(par.customer)){
// var matrix = GEN.getMatrix({job:job});
......@@ -607,7 +612,7 @@ function decompression(path, zips) {
function changePath(path) {
return path.replace(/[^/]+\//ig, function(v){
if(v.length >= 10 && /\s/ig.test(v)) {
v = v.replace(" ", "")
v = v.replace(" ", "\\ ")
return v.slice(0,6) + "~1/"
} else {
return v
......@@ -618,9 +623,9 @@ function changePath(path) {
function autoUn(path, dirname) {
if(/\.rar$/.test(path)){
fs.mkdir(dirname)
process.exec('unrar', ['x' , path, dirname, "-o+"])
process.exec('/opt/rar/unrar', ['x' , path, dirname, "-o+"])
} else {
process.exec('7za', ['x' , path, "-o"+dirname, "-aoa"])
process.exec('/usr/local/lib/p7zip/7za', ['x' , path, "-o"+dirname, "-aoa"])
}
}
......
......@@ -608,7 +608,7 @@
{"orig_name" : ["^(?:(?!assy|enig|pm|past|ss|silk|sm|soldermask).)+_top\.art$","^top$","^top.art$"], "tl_name" : "top" },
{"orig_name" : ["^(?:(?!assy|enig|pm|past|ss|silk|sm|soldermask).)+_bottom\.art$","^bot\\.art$","^bottom$","^bottom\\.art$"], "tl_name" : "bottom" },
{"orig_name" : ["int(\\d+)\\.art"], "tl_name" : "l_($1+1)"},
{"orig_name" : ["l(\\d+).*\\.gbr$","^0?(\\d+)[\\D].*\\.art$","\\.p(\\d+)p?$","\\.l(\\d+)$","^l(\\d+).*\\.art$","^l(\\d+)\\.art$","^0(\\d+).*ccp_ms","^s(\\d+)\\.art","laye?r?(\\d+)","layer_(\\d+)"], "tl_name" : "l_($1)"},
{"orig_name" : ["^lay(\\d+)\\.art$|l(\\d+).*\\.gbr$","^0?(\\d+)[\\D].*\\.art$","\\.p(\\d+)p?$","\\.l(\\d+)$","^l(\\d+).*\\.art$","^l(\\d+)\\.art$","^0(\\d+).*ccp_ms","^s(\\d+)\\.art","laye?r?(\\d+)","layer_(\\d+)"], "tl_name" : "l_($1)"},
{"orig_name" : ["(\\d+)-(\\d+)-((?:(?!laser)[a-zA-Z])+)\\.drl$","\\.d(\\d+)-(\\d+)((?:(?!laser)[a-zA-Z])+)$"], "tl_name" : "d($1)-($2)-($3)"},
{"orig_name" : ["\\.ncd(\\d)-(\\d)$","\\.d(\\d+)-(\\d+)$","-(\\d+)-(\\d+)\\.drl$","(\\d+)-(\\d+)-laser\\.drl$","d(\\d+)-(\\d+)"], "tl_name" : "d_($1)-($2)"},
{"orig_name" : ["\\.ncdthru$"], "tl_name" : "drill" },
......
This diff is collapsed.
......@@ -78,29 +78,31 @@ for(var key in default_par){ if (!par.hasOwnProperty(key) || par[key] == ""){ pa
var job = Job;
try {
if(_.isEmpty(job)){throw "参数job不存在"} else { job = job.toLowerCase() }
if(!GEN.isJobExists({job:job})){throw "料号"+job+"不存在"}
if(!GEN.isJobOpen({job:job})){ GEN.openJob({job:job}) }
if(mode == "aimdfm"){ if(GEN.checkInout({job:job,mode:"test"}) != 0){ throw "the job check" } else { GEN.checkInout({job:job,mode:"out"}) } }
var stepList = GEN.getStepList({job:job})
stepList = stepList.filter(function(step){
var reg = new RegExp(par.step,"ig")
return reg.test(step)
})
stepList.forEach(function(step){
GEN.openStep({job:job,name:step})
// var tool = GEN.getTool({job:job,step:step,layer:"ftdrill",units:"mm"},true); // {"1":{"count":"01156","num":"1","type":"plated","min_tol":"0","max_tol":"0","finish_size":"100.31","drill_size":"100.31","slot_len":"0","type2":"standard","shape":"hole","bit":0}}
// fs.writeFile("/home/toplinker/samba/scott_test/tmp", _.toString(tool))
// if(!GEN.isJobExists({job:job})){throw "料号"+job+"不存在"}
// if(!GEN.isJobOpen({job:job})){ GEN.openJob({job:job}) }
// if(mode == "aimdfm"){ if(GEN.checkInout({job:job,mode:"test"}) != 0){ throw "the job check" } else { GEN.checkInout({job:job,mode:"out"}) } }
})
// 保存
// var stepList = GEN.getStepList({job:job})
// stepList = stepList.filter(function(step){
// var reg = new RegExp(par.step,"ig")
// process.exec('7za', ['x' ,"/tmp/topcamtest/custom0.zip", "-o/tmp/topcamtest/custom0", "-aoa"])
// return reg.test(step)
// })
process.exec('/usr/local/lib/p7zip/7za', ['x' ,"/tmp/tmp/custom0.zip","-o/tmp/tmp/custom0","-aoa"])
// /usr/local/lib/p7zip/7za x /tmp/topcamtest/custom0.zip -o/tmp/topcamtest/custom0 -aoa
// /usr/bin/sudo -u genesis -b -s /usr/bin/id -un > /tmp/topcamtest/test.txt
// mkdir /tmp/test
// exportInfo(ret)
// /usr/bin/sudo -u genesis -b -s /usr/local/lib/p7zip/7za x /tmp/topcamtest/custom0.zip -o/tmp/topcamtest/custom0 -aoa
// sudo -u genesis -b -s /bin/csh -c "setenv DISPLAY ':0.0';cd /opt/toplinker/aimdfmserver/bin;./aimdfmserver > /dev/null"
// stepList.forEach(function(step){
// GEN.openStep({job:job,name:step});
// GEN.COM("tools_set,layer=ftdrill,slots=by_length")
// var tool = GEN.getTool({job:job,step:step,layer:"ftdrill",units:"mm"},true); // {"1":{"count":"01156","num":"1","type":"plated","min_tol":"0","max_tol":"0","finish_size":"100.31","drill_size":"100.31","slot_len":"0","type2":"standard","shape":"hole","bit":0}}
// fs.writeFile("/home/toplinker/samba/scott_test/tmp", _.toString(tool))
// })
// 保存
if(/yes/ig.test(par.auto_save)){GEN.checkInout({job:job,mode:"out"}); GEN.saveJob({ job: job });GEN.checkInout({job:job,mode:"in"});GEN.closeJob({job:job});} else {GEN.checkInout({job:job,mode:"in"})}
if (mode === "aimdfm") {
$.QDfm.updateRow({table: "pdm_aimdfm_task",data: {progress: 33.33},where: { id: $.task_id }});
......@@ -112,4 +114,8 @@ try {
IKM.msg(_.join(GEN.STATUS, "\n"));IKM.msg(e);Status = 'error';
resultData.push({type: "error", title: "脚本执行出错!", detail: [{desc: _.toString(e)}]});
return (mode === "aimdfm") ? {status: Status, result_data: resultData} : "Error";
}
function exportInfo(info){
fs.writeFile("/home/toplinker/samba/scott_test/tmp", _.toString(info))
}
\ No newline at end of file
......@@ -11,9 +11,6 @@ var JobId = $.job_id;
try {
var _matrix = GEN.getMatrix({job:job})
var _layers = Object.keys(_matrix)
var specialLayers = _layers.filter(function(v){return /^gnd\d?\\.art$|^in\d?\\.art$|^vcc\\.art$/.test(v)})
......
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