Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
Scott
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Scott Sun
Scott
Commits
a6e7887f
Commit
a6e7887f
authored
5 years ago
by
Scott Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s
parent
e3a61df3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
108 deletions
+34
-108
ATS_AIM_customer_data_analysis.js
ats/analysis/ATS_AIM_customer_data_analysis.js
+27
-41
scott_test.js
test/scott_test.js
+7
-67
No files found.
ats/analysis/ATS_AIM_customer_data_analysis.js
View file @
a6e7887f
...
@@ -311,35 +311,20 @@ try {
...
@@ -311,35 +311,20 @@ try {
var
allStep
=
GEN
.
getStepList
({
job
:
job
})
var
allStep
=
GEN
.
getStepList
({
job
:
job
})
allStep
.
forEach
(
function
(
step
){
allStep
.
forEach
(
function
(
step
){
GEN
.
openStep
({
job
:
job
,
name
:
step
})
GEN
.
openStep
({
job
:
job
,
name
:
step
})
console
.
log
(
3
)
GEN
.
COM
(
"chklist_single,show=yes,action=valor_cleanup_set_smd"
)
GEN
.
COM
(
"chklist_single,show=yes,action=valor_cleanup_set_smd"
)
console
.
log
(
4
)
GEN
.
COM
(
"chklist_cupd,chklist=valor_cleanup_set_smd,nact=1,params=((pp_layer=.type=signal|mixed&side=top|bottom)(pp_work_on=SMD
\
;BGA)(pp_delete=No)(pp_types=Square
\
;Rect
\
;Oval)(pp_other_smd=)(pp_sm=No)(pp_drill=)(pp_rotate=No)(pp_ignore_covered=Yes)(pp_bga_types=Round)(pp_other_bga=)(pp_sm_bga=No)(pp_bga_max_pitch=70)(pp_bga_actions=Set attribute)(pp_bga_suffix=_bga)(pp_identify_gf=)),mode=regular"
)
GEN
.
COM
(
"chklist_cupd,chklist=valor_cleanup_set_smd,nact=1,params=((pp_layer=.type=signal|mixed&side=top|bottom)(pp_work_on=SMD
\
;BGA)(pp_delete=No)(pp_types=Square
\
;Rect
\
;Oval)(pp_other_smd=)(pp_sm=No)(pp_drill=)(pp_rotate=No)(pp_ignore_covered=Yes)(pp_bga_types=Round)(pp_other_bga=)(pp_sm_bga=No)(pp_bga_max_pitch=70)(pp_bga_actions=Set attribute)(pp_bga_suffix=_bga)(pp_identify_gf=)),mode=regular"
)
console
.
log
(
5
)
GEN
.
COM
(
"get_user_name"
)
GEN
.
COM
(
"get_user_name"
)
console
.
log
(
6
)
GEN
.
COM
(
"get_job_path,job="
+
job
)
GEN
.
COM
(
"get_job_path,job="
+
job
)
console
.
log
(
7
)
GEN
.
COM
(
"disp_on"
)
GEN
.
COM
(
"disp_on"
)
console
.
log
(
8
)
GEN
.
COM
(
"origin_on"
)
GEN
.
COM
(
"origin_on"
)
console
.
log
(
9
)
GEN
.
COM
(
"chklist_cnf_act,chklist=valor_cleanup_set_smd,nact=1,cnf=no"
)
GEN
.
COM
(
"chklist_cnf_act,chklist=valor_cleanup_set_smd,nact=1,cnf=no"
)
console
.
log
(
10
)
GEN
.
COM
(
"chklist_run,chklist=valor_cleanup_set_smd,nact=1,area=profile"
)
GEN
.
COM
(
"chklist_run,chklist=valor_cleanup_set_smd,nact=1,area=profile"
)
console
.
log
(
11
)
GEN
.
COM
(
"skip_next_pre_hook"
)
GEN
.
COM
(
"skip_next_pre_hook"
)
console
.
log
(
12
)
GEN
.
COM
(
"chklist_run,chklist=valor_cleanup_set_smd,nact=1,area=profile"
)
GEN
.
COM
(
"chklist_run,chklist=valor_cleanup_set_smd,nact=1,area=profile"
)
console
.
log
(
13
)
GEN
.
COM
(
"get_user_name"
)
GEN
.
COM
(
"get_user_name"
)
console
.
log
(
14
)
GEN
.
COM
(
"skip_current_command"
)
GEN
.
COM
(
"skip_current_command"
)
console
.
log
(
15
)
GEN
.
COM
(
"disp_on"
)
GEN
.
COM
(
"disp_on"
)
console
.
log
(
16
)
GEN
.
COM
(
"origin_on"
)
GEN
.
COM
(
"origin_on"
)
console
.
log
(
17
)
GEN
.
COM
(
"show_tab,tab=Checklists,show=no"
)
GEN
.
COM
(
"show_tab,tab=Checklists,show=no"
)
GEN
.
closeStep
()
GEN
.
closeStep
()
})
})
...
@@ -476,7 +461,7 @@ try {
...
@@ -476,7 +461,7 @@ try {
console
.
log
(
"==================================> 12 Drill analysis"
)
console
.
log
(
"==================================> 12 Drill analysis"
)
var
drillRes
=
analysisDrill
(
drillToSignals
,
step
)
// 钻孔分析结果
var
drillRes
=
analysisDrill
(
drillToSignals
,
step
)
// 钻孔分析结果
console
.
log
(
"===========
=
====drillRes:"
+
_
.
toString
(
drillRes
));
console
.
log
(
"===============drillRes:"
+
_
.
toString
(
drillRes
));
drillRes
.
forEach
(
function
(
item
){
drillRes
.
forEach
(
function
(
item
){
save_layerinfo
({
save_layerinfo
({
jobid
:
JobId
,
jobid
:
JobId
,
...
@@ -487,7 +472,6 @@ try {
...
@@ -487,7 +472,6 @@ try {
}
}
})
})
})
})
throw
"tmp"
// 数据入库
// 数据入库
Object
.
keys
(
res
).
forEach
(
function
(
key
){
Object
.
keys
(
res
).
forEach
(
function
(
key
){
var
val
=
res
[
key
]
var
val
=
res
[
key
]
...
@@ -785,32 +769,34 @@ function save_layerinfo(props){ // 保存层信息
...
@@ -785,32 +769,34 @@ function save_layerinfo(props){ // 保存层信息
var
layerinfohash
=
props
.
layerinfohash
;
var
layerinfohash
=
props
.
layerinfohash
;
Object
.
keys
(
layerinfohash
).
forEach
(
function
(
key
){
Object
.
keys
(
layerinfohash
).
forEach
(
function
(
key
){
var
val
=
layerinfohash
[
key
];
var
val
=
layerinfohash
[
key
];
var
value
=
db
.
query
(
""
,
function
(
q
){
if
(
val
&&
val
!=
""
){
return
q
.
selectValue
({
var
value
=
db
.
query
(
""
,
function
(
q
){
table
:
'pdm_job_layerattr'
,
return
q
.
selectValue
({
field
:
"value"
,
table
:
'pdm_job_layerattr'
,
where
:{
job_id
:
jobid
,
attr_name
:
key
,
layer
:
layer
}
field
:
"value"
,
})
where
:{
job_id
:
jobid
,
attr_name
:
key
,
layer
:
layer
}
});
console
.
log
(
"+==========dblayervalue:"
+
value
)
if
(
/done/ig
.
test
(
value
)
||
!
value
){
db
.
query
(
""
,
function
(
q
){
console
.
log
(
"+==========insertRowlayervalue:layer:"
+
layer
+
";attrname:"
+
key
+
";value:"
+
val
)
return
q
.
insertRow
({
table
:
'pdm_job_layerattr'
,
// todo
data
:{
job_id
:
jobid
,
attr_name
:
key
,
value
:
val
,
layer
:
layer
},
// todo
return_field
:
'job_id'
,
})
});
}
else
if
(
value
!==
val
)
{
db
.
query
(
""
,
function
(
q
){
console
.
log
(
"+==========updateRowlayer:layer:"
+
layer
+
";attrname:"
+
key
+
";value:"
+
val
)
return
q
.
updateRow
({
table
:
'pdm_job_layerattr'
,
where
:{
job_id
:
jobid
,
attr_name
:
key
},
data
:{
value
:
val
},
})
})
});
});
console
.
log
(
"+==========dblayervalue:"
+
value
)
if
(
/done/ig
.
test
(
value
)
||
!
value
){
db
.
query
(
""
,
function
(
q
){
console
.
log
(
"+==========insertRowlayervalue:layer:"
+
layer
+
";attrname:"
+
key
+
";value:"
+
val
)
return
q
.
insertRow
({
table
:
'pdm_job_layerattr'
,
// todo
data
:{
job_id
:
jobid
,
attr_name
:
key
,
value
:
val
,
layer
:
layer
},
// todo
return_field
:
'job_id'
,
})
});
}
else
if
(
value
!==
val
)
{
db
.
query
(
""
,
function
(
q
){
console
.
log
(
"+==========updateRowlayer:layer:"
+
layer
+
";attrname:"
+
key
+
";value:"
+
val
)
return
q
.
updateRow
({
table
:
'pdm_job_layerattr'
,
where
:{
job_id
:
jobid
,
attr_name
:
key
},
data
:{
value
:
val
},
})
});
}
}
}
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
test/scott_test.js
View file @
a6e7887f
...
@@ -64,29 +64,15 @@ try {
...
@@ -64,29 +64,15 @@ try {
var
matrix
=
GEN
.
getMatrix
({
job
:
job
})
var
matrix
=
GEN
.
getMatrix
({
job
:
job
})
var
drillLayers
=
Object
.
keys
(
matrix
).
filter
(
function
(
v
){
return
matrix
[
v
].
layer_type
==
"dril
l"
})
var
signalLayers
=
Object
.
keys
(
matrix
).
filter
(
function
(
v
){
return
matrix
[
v
].
layer_type
==
"signa
l"
})
var
step
=
"cad"
var
step
=
"cad"
GEN
.
openStep
({
job
:
job
,
name
:
step
})
GEN
.
openStep
({
job
:
job
,
name
:
step
})
console
.
log
(
"==================================>drillLayers:"
+
_
.
toString
(
drillLayers
))
var
copper_percent_pcs
=
signalLayers
.
map
(
function
(
v
){
// 钻孔
var
tmp
=
{
layer
:
v
}
var
drillToSignals
=
drillLayers
.
map
(
function
(
v
){
// 获取到钻孔层对应的顶层和底层
tmp
.
copper_percent
=
GEN
.
copperArea
({
layer1
:
v
}).
percent
+
"%"
var
simbols
=
GEN
.
getLayerSymsHist
({
job
:
job
,
step
:
step
,
layer
:
v
})
return
tmp
var
symbol
=
_
.
values
(
simbols
).
sort
(
function
(
a
,
b
){
return
Number
(
a
.
size
)
-
Number
(
b
.
size
)})
})
.
reduce
(
function
(
a
,
b
){
console
.
log
(
"==================================>copper_percent_pcs:"
+
_
.
toString
(
copper_percent_pcs
))
if
(
b
.
pad
!=
"0"
){
a
.
push
(
b
.
symbol
)
}
return
a
},[])[
0
]
return
{
layer
:
v
,
symbol
:
symbol
,
start
:
matrix
[
v
][
"drl_start"
],
end
:
matrix
[
v
][
"drl_end"
]}
})
console
.
log
(
"===============================>drillToSignals:"
+
_
.
toString
(
drillToSignals
))
// var drillRes = analysisDrill(drillToSignals,step) // 钻孔分析结果
// console.log("==================================>drillRes:"+_.toString(drillRes))
QDfm
.
updateRow
({
QDfm
.
updateRow
({
table
:
"pdm_aimdfm_task"
,
table
:
"pdm_aimdfm_task"
,
...
@@ -115,49 +101,3 @@ catch (e) {
...
@@ -115,49 +101,3 @@ catch (e) {
resultData
.
push
({
type
:
"error"
,
title
:
"脚本执行出错!"
,
detail
:
[{
desc
:
_
.
toString
(
e
)}]});
resultData
.
push
({
type
:
"error"
,
title
:
"脚本执行出错!"
,
detail
:
[{
desc
:
_
.
toString
(
e
)}]});
return
{
status
:
Status
,
result_data
:
resultData
};
return
{
status
:
Status
,
result_data
:
resultData
};
}
}
function
analysisDrill
(
par
,
step
){
// {"layer":"d1-2","symbol":"r3.937","start":"top","end":"isl2"}
// {"layer":"d1-2","symbol":"r35.0394","start":"top","end":"bottom"}
var
job
=
Job
.
toLowerCase
()
var
res
=
par
.
map
(
function
(
drill
){
GEN
.
affectedLayer
({
affected
:
'no'
,
mode
:
'all'
})
GEN
.
affectedLayer
({
affected
:
'yes'
,
layer
:
drill
.
layer
})
GEN
.
selClearFeature
()
GEN
.
selectByFilter
({
feat_types
:
"pad"
,
include_syms
:
drill
.
symbol
})
if
(
GEN
.
getSelectCount
()
>
0
){
// 拷贝到_tmp
var
tmplayer
=
drill
.
layer
+
"_tmp"
if
(
GEN
.
isLayerExists
({
job
:
job
,
layer
:
tmplayer
})){
GEN
.
deleteLayer
({
job
:
job
,
step
:
step
,
layer
:
tmplayer
})}
GEN
.
selCopyOther
({
dest
:
"layer_name"
,
target_layer
:
tmplayer
})
GEN
.
affectedLayer
({
affected
:
"no"
,
mode
:
"all"
})
GEN
.
selClearFeature
();
[
drill
.
start
,
drill
.
end
].
forEach
(
function
(
item
,
i
){
GEN
.
workLayer
({
name
:
item
,
display_number
:
1
,
clear_before
:
"yes"
})
GEN
.
COM
(
"sel_ref_feat"
,
{
layers
:
tmplayer
,
use
:
"filter"
,
mode
:
"touch"
,
pads_as
:
"shape"
,
f_types
:
"pad"
,
polarity
:
"positive
\
;negative"
,
include_syms
:
drill
.
symbol
})
if
(
GEN
.
getSelectCount
()
>
0
){
var
res
=
""
var
pads
=
GEN
.
getFeatures
({
job
:
job
,
step
:
step
,
layer
:
item
,
options
:
"select"
})
if
(
pads
&&
pads
.
length
)
{
pads
=
pads
.
filter
(
function
(
item
){
return
/^r
\d
+/
.
test
(
item
.
symbol
)
})
pads
=
pads
.
sort
(
function
(
a
,
b
){
return
parseInt
(
a
.
symbol
)
-
parseInt
(
b
.
symbol
)
})
res
=
pads
[
0
].
symbol
.
slice
(
1
)
}
if
(
i
==
0
)
{
drill
.
drl_pad_top
=
res
}
else
if
(
i
==
1
){
drill
.
drl_pad_bot
=
res
}
}
})
GEN
.
deleteLayer
({
job
:
job
,
step
:
step
,
layer
:
tmplayer
})
}
return
drill
})
return
res
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment