|
随手翻译了一下,不成体系。搞清楚合成器的第一个输入端口和其他输入端口的区别可能更容易看懂。
- }* y5 R" v6 `+ V$ `- /**根据全局表更新合成清单*/3 [- L. k, G5 \9 u2 H \
- string tablename ="订单表";* y% a o9 ~$ g5 t, e
- /*
3 b2 ]% y8 a6 |- ~* J8 ? - This option should only be used on Combiners.( s: {5 F# |# [1 u. J8 l. w
- 这段代码只能用于合成器。$ x$ H0 `0 @, Z; `" F: a% g
- Each column in the GlobalTable is the component list for a single itemtype.* ^; |/ p4 n& ]$ h- j3 `, x" ?
- 全局表中的每一列是被合成临时实体的清单。- ?5 _& F( z! t& w
- The itemtype of the first flowitem to enter is used to find the correct column.
( m5 g1 r9 v+ T0 u. _9 c6 W; f - 从第一个输入端口进入的临时实体的类型决定了在全局表中的哪一列去查询合成清单。2 o: H# c1 q$ F ]7 U0 G* O# J
- It is assumed that the global table has a row for each input port number 2 and higher.
! U0 V( Z% u+ i$ {3 T - 全局表的每一行都代表着一个编号大于等于2的输入端口。- o) M+ M' \( x
- */9 T& h% Q& _$ d/ f
- 8 O- y k, K) b ?0 r' h
- if(port == 1): O: |. Z% V8 _
- { //The trigger on entry code fires each time a flow item enters the combiner.
& ]$ S, A) }8 G7 ~- u& H1 y0 V9 R - //For this reason we check to make sure that the port entered is equal to 16 }, j# J. F+ d1 G# q9 `
- //because only the container will enter through port 1.7 x" v$ p* G. Z& e. [+ b
- //每个临时实体进入合成器都会激活进入触发,所以必须要检查临时实体是否是从第一个端口进入的。" V. Y/ M7 R' m" o
- //只有从第一个端口进入的临时实体才是托盘等容器类临时实体。+ v+ h! b/ i& @9 @ x
- //在上文已经解释过,第一个端口进入的临时实体的类型决定了采用全局表中的哪一列来设置合成清单。
/ P7 `- x; Y2 ]* |6 v. v - //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: d0 Y8 P5 G; r, F4 X
- //合成清单以表格的形式存在。我们可以使用cell命令来获取数据节点。( B9 k/ ~; ` z) x0 K$ s# _% D
- //the number of items to retrieve from each port. Once you know what node contains the information you can use the setnodenum
/ s( G2 K, y K% e) j5 H$ m - //command to set the component list number based on the global table.' h% S- H: O; T# a7 N
- //当你知道数据存储于哪个节点之后,你就可以读取全局表中的数据,然后使用setnodenum命令在合成器中设置合成清单。- T5 }: _; s& c/ d4 G1 \7 B6 _; O; M9 w
2 V0 L. R b/ X2 W% \% J- treenode thelist = getvarnode(current,"componentlist");( b' Z0 v" V6 |
- treenode thesum = getvarnode(current,"targetcomponentsum");
+ O% Z( x1 R! E- E - //更改合成清单需要对两个数据节点进行设置。一个是componentlist,这个节点有一列数据,记录了从每个端口输入多少个临时实体。
0 D# f; r$ @4 g" { - //另一个是targetcomponentsum,记录本次打包的临时实体的总数。3 x/ F, i: i# ~+ R" C$ y
- setnodenum(thesum,0);
" Y5 b2 z; c, d+ I: U" M' C - ! o6 a; ?( S, J( @' u+ |
- for(int index=1; index<=nrows(thelist); index++)7 i/ W! S$ J+ _" k
- //componentlist以表格的形式存在,只有一列。如果合成器有n个输入端口,那么就有n-1行。(第一个输入端口输入的是容器)$ f7 I4 O) v/ L( i/ {! t, _: }
- {8 X: p, A5 i) {9 m6 @# e. T: y
- setnodenum(cellrowcolumn(thelist,index,1),gettablenum(tablename,index,getitemtype(item)));
% r" q9 n* c/ L; d0 l - //第一输入端口进入的临时实体的类型,决定了使用全局表中的哪一列数据。6 |- e/ h0 @0 ~0 e" _1 i
- //把该列数据全部读取出来,依次写入componentlist。6 P7 C/ I/ [/ F7 _# Q
- inc(thesum,gettablenum(tablename,index,getitemtype(item)));# W% Q" e1 g4 W& i
- //同时更新targetcomponentsum的值。5 O! h9 M, f- y' \
- }
1 Z9 m! B; B% V7 J8 O" Y) i - }
复制代码 |
|