求助高手啊~!!! 感激不尽!
; [' W! ]0 h# u0 E) |& c; P6 v% _0 o# M) X: Z* U. j$ M+ K- k; N0 C
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
# P( n4 j3 i) z& D: _, _% I4 U***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
" ]. n% d/ H2 W! E***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
0 z5 s5 w! A5 S w6 Q% [$ k% j, R0 c; l+ I! g4 _/ {9 T
* q- W- o, W+ [: s
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)/ t8 [0 x4 H8 G9 A$ Z+ y+ C! V
out1=S1-inv1;, P, O) f- B: R# A' j) v# v" Z
out2=0;
) s i1 ^6 |2 L3 Pout3=0; /货品1需要补货/8 b- {% _) n& P( q
; n5 R$ f8 f; `. h6 \8 Helse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)8 K2 q7 n0 G& |
out1=0;& D4 A+ b" ~* G! Z. {% V
out2=S2-inv2;1 b; Z. B" C( ~% ]
out3=0; /货品2需要补货/& S9 N0 z' w2 P* k. T
$ Y/ O+ ]3 Z8 Y: [
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
" K- O1 T5 n8 W6 Mout1=0;
8 J+ z2 n; F# y% R3 g; S, Qout2=0;
3 X/ Q2 y8 A7 G: V; j1 Mout3=S3-inv3; /货品3需要补货/
K: j, K7 e% M8 N& f" X- f( n$ k7 g0 }7 ^# i8 S: J
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)4 u- |1 z: L$ r6 \" R4 z
out1=S1-inv1;0 ~7 n* G3 b+ g0 @' \$ s3 n
out2=S2-inv2;
' b$ T/ G! y6 }: {- v: ~out3=0; /货品1,2需要补货/6 N/ [) ?$ r5 e- U- S. ]5 O% n! N
& S$ c& }6 Q3 p4 F y$ T
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)
4 o0 `8 N4 d6 {out1=S1-inv1;: ~1 i9 A! I8 w$ z1 f$ {
out2=0;: d/ r3 k1 ~' i3 t; Z C
out3=S3-inv3; /货品1,3需要补货/9 V ^+ O( A9 A: M% p
4 k( }8 Z( U9 f; x& v1 X/ k5 aelse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)3 `: ? [1 `4 |- ^ }" t
out1=0;) s$ U& f7 I3 @' F) l
out2=S2-inv2;
8 w) |7 W; R e( K' f0 D) Lout3=S3-inv3; /货品2,3需要补货/
( B+ Y; _1 G: f4 \1 U9 g3 e8 s# l9 W7 ^7 t" o6 W
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3): o) O& x2 D0 _/ G, x( i
out1=S1-inv1;) ^/ t6 @9 G' P* i. }* H. m
out2=S2-inv2;9 a, k7 D2 N: I7 A6 a* a: |
out3=S3-inv3; /货品1,2,3需要补货/
8 ^/ B6 s( i0 E O! G# I2 K
8 i/ ]" U( b; w e) l. m( M* j问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE..."," U" p. e. L/ w: |; C/ S: _7 Z
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
& e2 j) _6 o/ G& c! }" ]
\. O8 e/ s1 |( a3 u请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?$ H* ^+ z" Z: @ \# |: G2 w+ b j" E0 ~7 J
谢谢~!!!!!!! |