Commit cae41a62 authored by Scott Sun's avatar Scott Sun

scott

parent f81d71c9
......@@ -72,6 +72,7 @@ if (mode === "aimdfm") {
var Status = 'ok';
var resultData = [];
try {
console.log("=============================check in====================");
GEN.COM("open_job,job="+Job+",open_win=no,disk_map=,job_map=")
GEN.AUX("set_group,group=99")
GEN.COM("close_job,job="+Job+"")
......@@ -80,9 +81,26 @@ try {
GEN.COM("disp_on")
GEN.COM("origin_on")
GEN.COM("checkin_closed_job,job="+Job);
if (mode === "aimdfm") {
if (GEN.hasError()) {
Status = 'error';
resultData.push({ type: "error", title: "GEN错误!", detail: [{ desc: _.join(GEN.STATUS, "\n") }] });
return {
status: Status,
result_data: resultData
};
} else {
resultData.push({ type: "info", title: "操作完成, 请注意检查!" });
return {
status: Status,
result_data: resultData
};
}
}else {
return "Done"
}
}
catch (e) {
Status = 'error';
resultData.push({type: "error", title: "脚本执行出错!", detail: [{desc: _.toString(e)}]});
return (mode === "aimdfm") ? {status: Status, result_data: resultData} : "Error";
......
......@@ -166,8 +166,10 @@ if(mailUserList && mailUserList.length) {
})
}
var cam_workflow_info = IKM.get_jobinfo({jobid:JobId, jobinfo:"cam_workflow_info"});
console.log("==========cam_workflow_info===========:" + cam_workflow_info);
try {
if(cam_workflow_info && cam_workflow_info != ""){
console.log("==========cam_workflow_info===========:" + cam_workflow_info);
throw cam_workflow_info
}
cam_workflow_info = "sendmail"
......@@ -185,7 +187,7 @@ try {
// 检查料号是否能够check out
if(GEN.checkInout({job:job,mode:"test"}) != 0 && mode == "aimdfm"){ throw "the job check" }
GEN.checkInout({job:job,mode:"out"});
script_info({ msg: "analysis start" ,result_severity:"info"})
script_info({ msg: "开始分析客户料号" ,result_severity:"info"})
script_info({ progress: 65 })
var pcs_step = par.pcs_step == "" ? "cad" : par.pcs_step;
var array_step = par.array_step == "" ? "stp" : par.array_step;
......@@ -197,7 +199,7 @@ try {
pcs_step = step_list[0]
}
script_info({ msg: "analysis update_matrix_info" })
script_info({ msg: "分析上传matrix信息",result_severity:"info" })
script_info({ progress: 65 })
var matrix = UPLOAD_LAYER_MATRIX({job:job}) // 分析matrix 获得分析后的matrix信息
GEN.openStep({job:job, name:pcs_step})
......@@ -253,7 +255,7 @@ try {
})
GEN.clearLayers()
script_info({ msg: "analysis drill_stack" })
script_info({ msg: "分析钻孔叠构" })
script_info({ progress: 70 })
// * new 钻孔叠构
var cam_drill_structure = []
......@@ -378,7 +380,7 @@ 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: "analysis panel_info" })
script_info({ msg: "分析profile" })
script_info({ progress: 70 })
// * profile 和 拼版
var pandle_step = step_list.map(function(v){
......@@ -452,7 +454,7 @@ try {
}
ALL.gold_fingers = gold_fingers
GEN.closeStep()
script_info({ msg: "analysis some_job_info" })
script_info({ msg: "分析料号信息" })
var config = {
jobInfo: {
layer_count: ["signal","power_ground"], // Board属性的signal或者power_ground层
......@@ -532,7 +534,7 @@ try {
console.log("=================================> 5 save drill info")
script_info({ msg: "analysis drill_info" })
script_info({ msg: "分析钻孔信息" })
script_info({ progress: 75 })
// * 获取pcs_step 和 array_step的钻孔信息
var drill_tool_info = {};
......@@ -657,7 +659,7 @@ try {
})
console.log("=============================> 6 set smd bga")
script_info({ msg: "analysis smd&bga" })
script_info({ msg: "分析smd和bga" })
script_info({ progress: 80 });
step_list.forEach(function(step){
GEN.openStep({job:job,name:step})
......@@ -808,7 +810,7 @@ try {
// jobpath = "/home/local_db/server_db/jobs/"+job
// }
mkPath(jobpath,["user","opcam","steps"])
script_info({ msg: "analysis signal" })
script_info({ msg: "分析线路" })
script_info({ progress: 85 })
stepList.forEach(function(step){
GEN.openStep({ job: job, name: step })
......@@ -961,7 +963,7 @@ try {
if(par.erf){
tmpitem.erf = par.erf
}
script_info({ msg: "analysis run_signal_chk" })
script_info({ msg: "运行线路分析checklist" })
createChklistAndRun({ // 创建checklist并运行
layers: signalLayers,
items: [tmpitem]
......@@ -987,7 +989,6 @@ try {
GEN.closeStep()
})
mvOutProfile({job:job, step:pcs_step})
IKM.msg("end wait for save")
// 保存
......@@ -1019,7 +1020,6 @@ try {
})
});
script_info({ msg: "analysis export" })
script_info({ progress: 95 })
// 导出
if(par.export_path != "" && par.export_mode != "" && par.export_submode != "" ){
......@@ -1256,8 +1256,7 @@ function getMatrixInfo(props){ // 获取matrix各种信息
res.mBoardLayer.push(key)
switch (value.layer_type) {
case "signal":
s.mSignal[key] = value
res.mSignal[key] = value
res.mSignals.push(value)
break;
case "drill":
......
......@@ -94,7 +94,7 @@ if(cam_workflow_info){
IKM.save_job_info({jobid:JobId, jobinfohash:{cam_workflow_info:""}})
}
try {
script_info({ msg: "import start", result_severity:"info" })
script_info({ msg: "开始导入", result_severity:"info" })
var par = PAR;
// var db_path = db.query("",function(q){
// return q.selectValue({
......@@ -104,7 +104,9 @@ try {
// })
// });
// if(_.isEmpty(db_path)){throw "quote-data-upload error"}
if(!par.path || par.path == "") {throw "path error"}
if(!par.path || par.path == "") {
script_info({ msg: "资料路径不存在", result_severity:"error" });
throw "path error"}
if(!par.hasOwnProperty("config_path") || par.config_path==""){
console.log("===================cfg");
par.config_path = "cam/input_data"
......@@ -120,7 +122,9 @@ try {
where:{id : JobId}
})
});
if(_.isEmpty(db_customer)){throw "customer error"}
if(_.isEmpty(db_customer)){
script_info({ msg: "该料号客户不存在", result_severity:"error" });
throw "customer error"}
if(db_customer && !(/^done$/ig.test(db_customer)) && db_customer != "" ){
par.customer = db_customer
}
......@@ -132,9 +136,13 @@ try {
where:{path : par.config_path}
})
});
if (!cfg || cfg == ""){throw "cfg can not find"}
if (!cfg || cfg == ""){
script_info({ msg: "客户配置不存在", result_severity:"error" });
throw "cfg can not find"}
var config = eval(cfg);
if(!config.hasOwnProperty("customer")){throw "config error"}
if(!config.hasOwnProperty("customer")){
script_info({ msg: "客户配置不存在", result_severity:"error" });
throw "config error"}
var job = Job;
if(_.isEmpty(job)) throw "没有传入料号名!";
job = job.toLowerCase()
......@@ -146,7 +154,9 @@ try {
var step = custCfg.step.toLowerCase()
// 获取路径下文件信息
var path = par.path
if(!fs.exists(path)){throw "path error"}
if(!fs.exists(path)){
script_info({ msg: "资料路径不存在", result_severity:"error" });
throw "path error"}
var pathInfo = fs.listDir(path + "/" + db_customer.toLowerCase(), 1)
// 判断存不存在料号文件
// var vc_position = db.query("",function(q){
......@@ -161,7 +171,9 @@ try {
// job_file_baseName = job_file_baseName + "_" + vc_position
// }
var jobFile = pathInfo.filter(function(v){return v.baseName.toLowerCase() == job_file_baseName})
if(jobFile.length == 0){throw "job file is not exist"}
if(jobFile.length == 0){
script_info({ msg: "资料路径不存在", result_severity:"error" });
throw "job file is not exist"}
var jobFiles = [] // 记录要分析的文件
if (!jobFile[0].isDir) {
jobFiles.push(jobFile[0])
......@@ -197,7 +209,7 @@ try {
// 分析料号文件 得到料号导入信息 导入类型
var jobInfo = analyJobFiles({jobFiles:jobFiles.filter(function(v){return v.isFile}),custCfg:custCfg,config:config,job:job })
if(jobInfo.data.length == 0){
script_info({ msg: "file error", result_severity:"error" })
script_info({ msg: "未找到料号文件", result_severity:"error" });
throw "file error"}
var importOk = false; // 是否成功导入
......@@ -288,15 +300,23 @@ try {
gerberCfg.step = step
return gerberCfg
})
GEN.COM("input_manual_reset")
gerberInfo.forEach(function(v){
GEN.COM("input_result_reset,step=,category=warnings,close_tab=yes")
GEN.COM("input_create,path="+v.path)
GEN.COM("input_selected_reset")
GEN.COM("input_selected_add,path="+v.path)
GEN.COM("input_identify_selected,path=,job="+job+",script_path=,gbr_ext=no,drl_ext=no,gbr_units=auto,drl_units=auto,unify=yes,break_sr=yes,gbr_wtp_filter=*,drl_wtp_filter=*,gbr_wtp_units=auto,drl_wtp_units=auto,wtp_dir=,have_wheels=yes,wheel=,gbr_consider_headlines=yes,drl_consider_headlines=yes,board_size_x=0,board_size_y=0")
GEN.COM("input_manual_reset")
import_info.push({name:v.layer, type:"gerber274x", date:now(),user:$.user_name})
GEN.COM("input_manual_set",v)
})
GEN.COM("input_manual")
})
importOk = true
}
if(!importOk){ script_info({ msg: "import error",result_severity:"error" }); throw "import error"}
if(!importOk){ script_info({ msg: "导入错误",result_severity:"error" }); throw "import error"}
script_info({ progress: 20 })
reNameStep(job)
if(/2171/.test(par.customer)){
......@@ -351,7 +371,7 @@ try {
import_html += "</table>"
// name type date user
resultData.push({type: "info",title:"导入资料列表",detail: [{ desc: import_html }] })
script_info({ msg: "import ok" })
script_info({ msg: "导入资料成功" })
if (mode === "aimdfm") {
$.QDfm.updateRow({
table: "pdm_aimdfm_task",
......@@ -458,6 +478,7 @@ function analyJobFiles(props){
}
}
}
function importJob(props,delSameJob){
var name = props.name
if (GEN.isJobExists({ job: name })) {
......
......@@ -102,11 +102,11 @@ try {
if(cam_workflow_info && cam_workflow_info != ""){
throw cam_workflow_info
}
script_info({ msg: "format start" ,result_severity:"info"})
script_info({ msg: "料号标准化流程开始" ,result_severity:"info"})
script_info({ progress: 35 })
var par = PAR;
if(!par.hasOwnProperty("config_path") || par.config_path==""){
console.log("==============cfg");
console.log("=========== ===cfg");
par.config_path = "cam/input_data"
};
var db_customer = db.query("",function(q){
......@@ -137,9 +137,13 @@ try {
var custCfg = config.customer[par.customer] // 获取客户配置
if(!custCfg){throw "config error"}
// 料号验证
if(!GEN.isJobExists({job:job})){ throw "job "+ job+ " is not exist" }
if(!GEN.isJobExists({job:job})){
script_info({ msg: "料号"+job+"不存在" ,result_severity:"error"})
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"){ throw "the job check" }
if(GEN.checkInout({job:job,mode:"test"}) != 0 && mode == "aimdfm"){
script_info({ msg: "料号"+job+" check" ,result_severity:"error"})
throw "the job check" }
console.log("Checkout====== ========================>")
GEN.checkInout({job:job,mode:"out"});
console.log("Checkout success==============================>")
......@@ -260,7 +264,7 @@ try {
var after_sort_matrix = ret.sortNames
// 改名
script_info({ msg: "format rename" ,result_severity:"info"})
script_info({ msg: "开始改名" ,result_severity:"info"})
script_info({ progress: 50 })
err = reName({job:job, matrix:after_sort_matrix, cfg:format_cfg})
if(err){throw err}
......@@ -383,7 +387,7 @@ try {
GEN.closeJob({job:job});
GEN.COM("open_job,job="+job);
script_info({ msg: "format create profile" ,result_severity:"info"})
script_info({ msg: "准备创建profile" ,result_severity:"info"})
script_info({ progress: 55 })
var all_layer = Object.keys(tmp_matrix)
// 没有outline层
......@@ -429,6 +433,8 @@ try {
}
}
script_info({ msg: "料号标准化结束" ,result_severity:"warn"})
db.query("",function(q){
return q.updateRow({
table:'pdm_job',
......@@ -482,7 +488,6 @@ catch (e) {
// subject:db_customer + ' / '+Job+ " format error",
// content:_.toString(e)
// })
Status = 'error';
resultData.push({type: "error", title: "脚本执行出错!", detail: [{desc: _.toString(e)}]});
return (mode === "aimdfm") ? {status: Status, result_data: resultData} : "Error";
......
......@@ -68,9 +68,9 @@
},
"Gerber274x_4": {
"nf1": 2,
"nf2": 3,
"nf2": 4,
"units": "mm",
"zeroes": "none",
"zeroes": "leading",
"decimal": "no",
"nf_comp": 0,
"break_sr": "yes",
......@@ -80,7 +80,7 @@
"drill_only": "no",
"multiplier": 1,
"resolution": 3,
"tool_units": "mm",
"tool_units": "inch",
"coordinates": "absolute",
"merge_by_rule": "no",
"signed_coords": "no",
......
......@@ -109,7 +109,7 @@ try {
// var ($signal,@signal,@pg_layer,$pg_layer,@drill,@sm_layer,@ss_layer,$ss_layer);
var matrix = GEN.getMatrix({job:job});
for (var layer in matrix) {
var layerInfo = matrix[layer]
var layerInfo = matrix[layer];
if(layerInfo.context == "board") {
if(layerInfo.layer_type == 'signal' && /(cil)|(col)/.test(layer)){
var lyr_paras = {};
......
This diff is collapsed.
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