|
随手翻译了一下,不成体系。搞清楚合成器的第一个输入端口和其他输入端口的区别可能更容易看懂。+ s) F* Y$ `7 z" Z0 A4 v+ \; m
- /**根据全局表更新合成清单*/8 Y# d) }% a! T2 k$ K9 n2 C
- string tablename ="订单表";
& E! n; p' y+ g0 B - /*1 X( F+ ~. e5 ?
- This option should only be used on Combiners.
' b0 ~$ m7 K' C& n" L2 W; n - 这段代码只能用于合成器。
! }2 @+ T3 W" D3 H0 V; K( T; g - Each column in the GlobalTable is the component list for a single itemtype.. @8 P$ H% n/ L7 f% A! Y D9 y9 T
- 全局表中的每一列是被合成临时实体的清单。
1 g9 f0 o' @& ]* S/ ^! [ - The itemtype of the first flowitem to enter is used to find the correct column.
, R" b8 |0 U) _ - 从第一个输入端口进入的临时实体的类型决定了在全局表中的哪一列去查询合成清单。; G. \, q( J6 V+ y
- It is assumed that the global table has a row for each input port number 2 and higher.
' h9 @. _ T4 I - 全局表的每一行都代表着一个编号大于等于2的输入端口。
8 J6 M8 y; i& ? - */
( h% o. d7 t3 r$ u2 u1 U - ) J/ [0 q0 i( |& V- w' A) B, `
- if(port == 1)
, v+ W2 ^* Y/ s0 p0 ^ - { //The trigger on entry code fires each time a flow item enters the combiner.
$ u5 J" l6 l7 p5 O - //For this reason we check to make sure that the port entered is equal to 1! d6 R: f. H' W' L1 @
- //because only the container will enter through port 1.
( W* w7 i% g( d$ r8 @ - //每个临时实体进入合成器都会激活进入触发,所以必须要检查临时实体是否是从第一个端口进入的。1 F* L$ |* Z: u. X& ^& w- K
- //只有从第一个端口进入的临时实体才是托盘等容器类临时实体。
9 q5 y" W4 U4 A% D% s - //在上文已经解释过,第一个端口进入的临时实体的类型决定了采用全局表中的哪一列来设置合成清单。
9 T% E3 }0 p, 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! E* {) M- `4 l9 c# s4 l! U1 Z
- //合成清单以表格的形式存在。我们可以使用cell命令来获取数据节点。3 U) M" U$ |' }
- //the number of items to retrieve from each port. Once you know what node contains the information you can use the setnodenum! L6 \7 d- G! t* s
- //command to set the component list number based on the global table.
. T0 @3 r7 c5 i7 n, s- e - //当你知道数据存储于哪个节点之后,你就可以读取全局表中的数据,然后使用setnodenum命令在合成器中设置合成清单。
) e3 b |2 h) @, w. V" M) w5 d) @ - 3 Z1 l) k, l/ p- R$ c3 o1 A- l
- treenode thelist = getvarnode(current,"componentlist");
0 f5 `3 S& A) Z4 |1 [8 V# r. j - treenode thesum = getvarnode(current,"targetcomponentsum");
+ ?% E8 M5 G8 ?# K0 w- L - //更改合成清单需要对两个数据节点进行设置。一个是componentlist,这个节点有一列数据,记录了从每个端口输入多少个临时实体。
$ l" A8 ?7 J+ ]' N# C - //另一个是targetcomponentsum,记录本次打包的临时实体的总数。
+ W4 U- k2 F) Z: d' I5 z - setnodenum(thesum,0);3 C1 ]- }6 @! j R% q( t
- 3 @: `$ w3 N! e& F6 [. W- S9 r, \
- for(int index=1; index<=nrows(thelist); index++)0 `; `* d& K1 [$ E+ P. i
- //componentlist以表格的形式存在,只有一列。如果合成器有n个输入端口,那么就有n-1行。(第一个输入端口输入的是容器)) p# K( Q4 w5 v) Q* @- q- Y% q
- {
- \# A0 a {/ s3 E% s" W. q, r/ V - setnodenum(cellrowcolumn(thelist,index,1),gettablenum(tablename,index,getitemtype(item)));
/ n0 w$ @: f( S6 ^/ t - //第一输入端口进入的临时实体的类型,决定了使用全局表中的哪一列数据。1 f* l( d X: Z0 _ W
- //把该列数据全部读取出来,依次写入componentlist。
0 L* `4 e( m2 K: ]" V1 t - inc(thesum,gettablenum(tablename,index,getitemtype(item)));1 \5 ^2 c; J. Z7 B
- //同时更新targetcomponentsum的值。! x7 A' d& A7 ~' b( b
- }
: w% Z" F: S5 A) k; Q - }
复制代码 |
|