|
随手翻译了一下,不成体系。搞清楚合成器的第一个输入端口和其他输入端口的区别可能更容易看懂。
3 f5 j3 f A! T+ @- /**根据全局表更新合成清单*/
: C3 _5 Y2 c" u" v' { - string tablename ="订单表";- P8 C# W/ e; l5 L2 D9 u
- /*% a' G9 m' b! @0 |8 x
- This option should only be used on Combiners.1 w9 a% n! ]/ V' c8 P
- 这段代码只能用于合成器。1 F4 ^! y7 y3 P" s+ D, R5 N
- Each column in the GlobalTable is the component list for a single itemtype.8 G& z- k& N8 T5 ^. l0 ?! A; {
- 全局表中的每一列是被合成临时实体的清单。( w( B, Y* F; |6 U6 ?; o
- The itemtype of the first flowitem to enter is used to find the correct column.
4 s# d6 O0 ?7 v9 Z0 M- S - 从第一个输入端口进入的临时实体的类型决定了在全局表中的哪一列去查询合成清单。( I( I7 u" }# i' D* ~
- It is assumed that the global table has a row for each input port number 2 and higher.
) s$ |2 h P# h7 R- I C8 O - 全局表的每一行都代表着一个编号大于等于2的输入端口。
" ~. `( N% B% e2 \# ]9 f& r - */; O- N# `8 m7 E/ H, k/ f j
2 A' a, G% S5 z5 H% i- if(port == 1)
2 v- Y3 d8 e! t% K9 O - { //The trigger on entry code fires each time a flow item enters the combiner.
, T8 }& Q! {! H - //For this reason we check to make sure that the port entered is equal to 1
) X) P& P" ]$ p @. v( |+ i+ r* ~ - //because only the container will enter through port 1.
. _' F# X6 y! @ - //每个临时实体进入合成器都会激活进入触发,所以必须要检查临时实体是否是从第一个端口进入的。
- }6 s5 f1 _& r) |% m* b9 t8 Y- v - //只有从第一个端口进入的临时实体才是托盘等容器类临时实体。
& _6 b: k% l! \ - //在上文已经解释过,第一个端口进入的临时实体的类型决定了采用全局表中的哪一列来设置合成清单。( ]1 N6 B8 M( R5 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: C. z. W! @4 H/ _$ _( N
- //合成清单以表格的形式存在。我们可以使用cell命令来获取数据节点。& |$ y- \$ a+ `1 t. V/ S& g
- //the number of items to retrieve from each port. Once you know what node contains the information you can use the setnodenum
4 q/ w6 w. C2 j - //command to set the component list number based on the global table.: `' C0 P- t. e1 g
- //当你知道数据存储于哪个节点之后,你就可以读取全局表中的数据,然后使用setnodenum命令在合成器中设置合成清单。! ]4 w( z. S& o& k# M% f
' M! o; J8 k7 k1 Q! G6 G3 [- treenode thelist = getvarnode(current,"componentlist");
8 i, ]$ D9 k0 x+ `6 M - treenode thesum = getvarnode(current,"targetcomponentsum");
: [. @* a" o+ W4 g2 M/ _& ? - //更改合成清单需要对两个数据节点进行设置。一个是componentlist,这个节点有一列数据,记录了从每个端口输入多少个临时实体。
* l+ O1 M& V0 |/ [( E - //另一个是targetcomponentsum,记录本次打包的临时实体的总数。/ \8 r D! z- ^/ J. s
- setnodenum(thesum,0);1 D* w" j" F3 l
. v7 {' ]( ^( n I- for(int index=1; index<=nrows(thelist); index++)9 G8 }: i0 |6 Q0 i
- //componentlist以表格的形式存在,只有一列。如果合成器有n个输入端口,那么就有n-1行。(第一个输入端口输入的是容器)
- _8 y8 K% X' d1 q0 | - {
# e; V% B' a. F9 f4 O - setnodenum(cellrowcolumn(thelist,index,1),gettablenum(tablename,index,getitemtype(item)));7 [6 O x! ?( h* J
- //第一输入端口进入的临时实体的类型,决定了使用全局表中的哪一列数据。2 W1 o; Q `- `( f! t. `, e
- //把该列数据全部读取出来,依次写入componentlist。' Q0 v! [9 X3 Y4 ]. T
- inc(thesum,gettablenum(tablename,index,getitemtype(item)));
9 `* K; s n* }/ ?0 }2 X - //同时更新targetcomponentsum的值。
! y' Q& d; _% g4 J8 A9 Z* F - }8 p3 A$ N% s6 M% i5 g4 t& J
- }
复制代码 |
|