Commit cae41a62 authored by Scott Sun's avatar Scott Sun

scott

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