|
随手翻译了一下,不成体系。搞清楚合成器的第一个输入端口和其他输入端口的区别可能更容易看懂。
* ]. {" F5 K# t$ s, C) ^& v- /**根据全局表更新合成清单*/' V: X6 d( y+ ?/ ^4 {
- string tablename ="订单表";
* X: V: V# {& [' x9 B. x - /*
5 x. H H5 {/ m; g - This option should only be used on Combiners.
9 }# |7 M( T9 Y: u' G - 这段代码只能用于合成器。
' `! u! O7 j7 S# I9 p- k1 Z0 i - Each column in the GlobalTable is the component list for a single itemtype.; _* ~) d# C" T. |, d9 Y
- 全局表中的每一列是被合成临时实体的清单。; \9 F0 E0 f( x7 j$ a; H' X+ x
- The itemtype of the first flowitem to enter is used to find the correct column., L" ]; f) W( S0 }
- 从第一个输入端口进入的临时实体的类型决定了在全局表中的哪一列去查询合成清单。* [$ f8 q7 O$ R; M
- It is assumed that the global table has a row for each input port number 2 and higher.) M; B: U- {# W: ?
- 全局表的每一行都代表着一个编号大于等于2的输入端口。0 D% n( l/ |$ Z
- */% m+ y# O- Z4 j
- 7 D' i7 E! P; F
- if(port == 1)7 L" w2 ?& O( L* a# `; b; K
- { //The trigger on entry code fires each time a flow item enters the combiner.+ M& v* f# H' J. b7 W
- //For this reason we check to make sure that the port entered is equal to 12 ~; \$ U9 J; y. R+ n
- //because only the container will enter through port 1." b5 W' ^! Y+ K0 u3 H2 f' L2 F7 {
- //每个临时实体进入合成器都会激活进入触发,所以必须要检查临时实体是否是从第一个端口进入的。
* F7 f8 L' c* v! h. a0 T - //只有从第一个端口进入的临时实体才是托盘等容器类临时实体。8 E% }" d. y6 e7 D- L" b/ K
- //在上文已经解释过,第一个端口进入的临时实体的类型决定了采用全局表中的哪一列来设置合成清单。
/ B% o1 i( m* Q0 ? - //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" L) i& b3 ]7 Q
- //合成清单以表格的形式存在。我们可以使用cell命令来获取数据节点。+ s# Z5 @. U3 a& Z0 p. D' k6 T
- //the number of items to retrieve from each port. Once you know what node contains the information you can use the setnodenum
- `- e, ~( A3 x }' T, u, p4 f - //command to set the component list number based on the global table.. k8 W7 H. s9 J [" F5 v( y
- //当你知道数据存储于哪个节点之后,你就可以读取全局表中的数据,然后使用setnodenum命令在合成器中设置合成清单。
/ u; R% q) @; h; \* R
+ q% ~2 S# m. ~/ H- treenode thelist = getvarnode(current,"componentlist");
% `' w. |7 ~: v7 Y - treenode thesum = getvarnode(current,"targetcomponentsum");% N, x7 X2 Y1 ~: j$ f# W" d e& s
- //更改合成清单需要对两个数据节点进行设置。一个是componentlist,这个节点有一列数据,记录了从每个端口输入多少个临时实体。
5 b! k0 |( g/ b/ e: t8 E6 p3 v" L - //另一个是targetcomponentsum,记录本次打包的临时实体的总数。8 i4 K% W3 B# z! Y
- setnodenum(thesum,0);
$ S2 a0 W+ \! G' `1 i( | - " d& ~7 _- Z- ?9 J( t+ Z
- for(int index=1; index<=nrows(thelist); index++)' M2 s! \2 M Q9 Q9 h9 S9 j
- //componentlist以表格的形式存在,只有一列。如果合成器有n个输入端口,那么就有n-1行。(第一个输入端口输入的是容器)
2 q3 `1 s* p6 G( l* y - {3 S u- c- f% T# t+ J
- setnodenum(cellrowcolumn(thelist,index,1),gettablenum(tablename,index,getitemtype(item)));
5 _9 x- @( T* Z; x0 R" i3 _2 A8 f - //第一输入端口进入的临时实体的类型,决定了使用全局表中的哪一列数据。9 t2 C7 K% S; T! m
- //把该列数据全部读取出来,依次写入componentlist。
+ K7 o* S) v# A* L# E% E - inc(thesum,gettablenum(tablename,index,getitemtype(item)));8 y+ V3 Z/ J. z) H) x* ]
- //同时更新targetcomponentsum的值。
0 d% K( m7 v6 c& M. | - }% k$ P$ n$ Y; }5 r b& ~
- }
复制代码 |
|