在code editor模块 ,循环是不生效的吗?count0的结果始终为0) z$ o2 U' U( o O- o. A
/**Custom Code*/
5 Q- K5 V4 v& qObject current = param(1);
1 _$ D: F2 b- w) N) ~0 D, p4 ctreenode activity = param(2);
# l: K% W) r5 MToken token = param(3);
/ }, l1 x% F5 z9 _" i7 L% }( V4 aVariant assignTo = param(4);% X: J7 B4 a/ q C6 d$ _
string labelName = param(5);
5 c; K6 s/ g; w/ W/ T% Atreenode processFlow = ownerobject(activity);4 O0 o2 x$ A2 a1 P, I
# O3 C: {, M, K2 @: E0 `3 xdouble count0=0;double count1=0;/ w) c7 l( {, p( ^
* u+ L5 q/ Z- W( V. p+ u/ o# D2 F, U" b. J( S$ A
//本工序前暂存区
|$ p5 H( u& c
. l/ E: R7 C/ [! K$ j# ?; sfor (i = 0; i < Model.find("Plane5/1号暂存区").subnodes.length; i++) {% j* p% W, T. |* Y; Q _9 Y
' [( }) e1 i8 r+ X5 L
// 检查 type 属性是否为 3ded
* d3 z0 H( w) `) x if (getlabel(Model.find("Plane5/1号暂存区").subnodes[i],"type") == getlabel(current,"LastProduction")) {
, H2 n' j; r% o9 b1 G* p* O& G count0++;( [9 u1 E8 y% u/ Y, R
}
% i$ M. S% `, o ]% b}
6 Z0 i5 R# G! r+ \3 }- n//上一工序前暂存区, l( f2 L4 L6 L5 C. t6 @4 g: |
6 X0 f( O8 s3 l5 | x2 [! X
for (i = 0; i < Model.find("Plane5/2号暂存区").subnodes.length; i++) {
0 L8 T6 Q2 `% _" h: `* i' u
: ]$ B% ]6 {3 t; E* G // 检查 type 属性是否为 3ded
; y" l: U8 C" _" v3 y8 F& | if (getlabel(Model.find("Plane5/2号暂存区").subnodes[i],"type") == getlabel(current,"LastProduction")) {
& d" S9 R+ S7 Z; U: Q6 {3 d% u count1++;" L9 u6 o/ p2 P( E8 a7 v9 x: q" }
}
% I) w4 d$ L. k3 H( U& U; o}* v$ e; e7 K& u$ v2 V# M: A) ]' h
$ C/ J& W) ]1 Y# e6 creturn count0;
6 ~- `1 B0 t2 I2 n) u$ U$ [# C2 D
/ F9 k9 x: C" l
8 j1 D* @" Z8 ^) [) P$ U |