|
随手翻译了一下,不成体系。搞清楚合成器的第一个输入端口和其他输入端口的区别可能更容易看懂。! L: s# W& f+ s2 J* Q: ]
- /**根据全局表更新合成清单*/; O2 I' b2 j! x9 T( D+ q1 M
- string tablename ="订单表";
7 D; V, k/ u& m# [ - /*
0 C0 m& I8 t+ M5 \ - This option should only be used on Combiners.
2 ?3 Z$ F' n0 {1 R- R# x" r - 这段代码只能用于合成器。
0 }6 e4 s) h' l2 v: j; O - Each column in the GlobalTable is the component list for a single itemtype.- z" y2 d% A: R* H# l
- 全局表中的每一列是被合成临时实体的清单。
$ n8 o0 ]6 x [, Q - The itemtype of the first flowitem to enter is used to find the correct column.- P8 p$ J$ M/ u& D) Y' L3 h
- 从第一个输入端口进入的临时实体的类型决定了在全局表中的哪一列去查询合成清单。
0 k& n# U% R4 A; r- K: |) T8 G - It is assumed that the global table has a row for each input port number 2 and higher. Y0 ]3 g' h! r
- 全局表的每一行都代表着一个编号大于等于2的输入端口。
& c2 P2 e- n. f" K7 @ - */
' b3 F& j$ ?4 S; j
. N5 i( i( N6 e( g! P/ L3 c- if(port == 1)3 D4 K0 }( z1 Y& a' H. C; N
- { //The trigger on entry code fires each time a flow item enters the combiner.0 k5 `$ v: s: } {" J0 {
- //For this reason we check to make sure that the port entered is equal to 1
( Y3 A# K F; ^# A5 }9 j - //because only the container will enter through port 1.; O2 k2 E$ g0 N2 b
- //每个临时实体进入合成器都会激活进入触发,所以必须要检查临时实体是否是从第一个端口进入的。, |* \1 F" r* n! _, t% `) b
- //只有从第一个端口进入的临时实体才是托盘等容器类临时实体。
# ]6 J! C3 F& M# \7 \ - //在上文已经解释过,第一个端口进入的临时实体的类型决定了采用全局表中的哪一列来设置合成清单。
0 y) _) c/ S9 z' U - //The component list in a combiner is set up as a table. This allows us to use the cell commands to obtain the node that contains
: M, f) L9 t! o - //合成清单以表格的形式存在。我们可以使用cell命令来获取数据节点。0 D4 @' h5 p$ W
- //the number of items to retrieve from each port. Once you know what node contains the information you can use the setnodenum; o- `) V7 m8 P0 }
- //command to set the component list number based on the global table.( ?- N$ P, j2 ^$ @/ H( _8 X
- //当你知道数据存储于哪个节点之后,你就可以读取全局表中的数据,然后使用setnodenum命令在合成器中设置合成清单。' [- i6 N6 G+ x _
- k2 y: V' B. d
- treenode thelist = getvarnode(current,"componentlist");
9 K$ W' Z" Z7 y - treenode thesum = getvarnode(current,"targetcomponentsum");* b* q2 K. P2 X( U0 I( P* G; z/ c
- //更改合成清单需要对两个数据节点进行设置。一个是componentlist,这个节点有一列数据,记录了从每个端口输入多少个临时实体。
2 I6 j, e5 P6 ^6 ] - //另一个是targetcomponentsum,记录本次打包的临时实体的总数。/ v4 [4 X, x- l0 |! F4 u+ m) [
- setnodenum(thesum,0);
$ m, A0 V1 K. o$ p0 S J( ?. i) \6 t1 t
W1 o& ]" N( L- G# S9 e3 N: N8 @7 l- for(int index=1; index<=nrows(thelist); index++). G( w. |/ W* t. s
- //componentlist以表格的形式存在,只有一列。如果合成器有n个输入端口,那么就有n-1行。(第一个输入端口输入的是容器). }' w/ x2 b/ a- z0 E! S2 s: ?5 G: X
- {
\2 n8 f( b" c3 n0 r - setnodenum(cellrowcolumn(thelist,index,1),gettablenum(tablename,index,getitemtype(item)));( P2 i6 f; B7 G+ Y6 G/ y% w
- //第一输入端口进入的临时实体的类型,决定了使用全局表中的哪一列数据。/ c3 }, h2 _( n4 N/ `
- //把该列数据全部读取出来,依次写入componentlist。( x6 Y0 u3 y) f9 v" `
- inc(thesum,gettablenum(tablename,index,getitemtype(item)));
$ r: T! @+ o4 g0 O$ O! B1 t - //同时更新targetcomponentsum的值。$ }; i5 n0 }$ Y) m4 c
- }
; n! ^. m4 j. |) B3 _ - }
复制代码 |
|