求助高手啊~!!! 感激不尽!
: x% l% ~9 y% {7 C' Z; t; l
. Q" U5 m3 M" x9 z4 b' d0 l如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:, q! f* n& v1 E9 x
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
" f* |5 m, i. E- @. t1 b! ]- ]***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
& q$ ?( L! Z6 w" C# V( B
! u5 m( a2 F4 E$ M$ ? D6 z8 p }% e: s) ^
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
* ~, o$ n6 G8 j6 w' j8 p; Wout1=S1-inv1;
, ]' x* \) q* k3 d8 P! v8 Qout2=0;3 a2 z3 M. `( p% P. Z$ r; Y
out3=0; /货品1需要补货/
9 x; l3 k; [2 J/ c6 d9 x- Q, P0 F* j' ]
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
* S |4 B: Y$ E6 c% p/ }8 Xout1=0;
% ~4 A# ^3 C. V0 H; A5 p4 Nout2=S2-inv2;
4 k+ F1 }1 C# \out3=0; /货品2需要补货/7 o7 ~. x5 o3 H; V
0 D# s I8 e/ s" V; x! N0 b+ M: celse if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
# v; z9 [& E4 B9 p0 E( x& Dout1=0;
% y8 \3 m4 x9 m3 a& q! jout2=0;% h* t# U/ J7 y5 h5 h' _1 z
out3=S3-inv3; /货品3需要补货/
0 S! ^% t1 e8 | Y
( `8 K7 t( S6 U# a8 K; `else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
/ N3 n5 a* `0 n1 W% c5 N/ O4 ~out1=S1-inv1;
# ]7 |7 [: H9 [. f* L) T; Gout2=S2-inv2;+ x0 L7 o: j1 s2 U4 j' p' I
out3=0; /货品1,2需要补货/ ]1 `4 J( _( G$ c, L, M8 i. F
- X/ |' ]8 R7 |6 Gelse if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)" f! c6 w& \/ A! z G ?) r% _
out1=S1-inv1;9 L- `8 X$ o5 u2 r: c
out2=0;+ U- m$ K( x2 n2 j- b, E' _
out3=S3-inv3; /货品1,3需要补货/
+ |/ ` C6 o1 ?3 O: B
6 v3 ^; j+ q b L- k6 L* k- \( g- g- Ielse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3) E) l$ V+ {& D4 V
out1=0;
- I& i; @( W$ C2 s7 Rout2=S2-inv2;5 y8 C* U. T1 ~; M
out3=S3-inv3; /货品2,3需要补货/4 \1 s6 x# ?$ m X
& v# U1 V( r; melse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
1 V# U. s/ H" u: D; pout1=S1-inv1;
, f. @$ _$ i1 gout2=S2-inv2;
" s6 B# p0 n( [- r( @) Gout3=S3-inv3; /货品1,2,3需要补货/
& _; m8 S9 Z. U' r8 F, @8 t( v- U" ?
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
; \, S q m6 C( p) m7 X但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.9 e1 l7 o" s1 _$ [2 Q- a9 Y6 `% ~
$ ^% n, l. `$ Z4 D" D请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?( B& U- G% E7 W7 H
谢谢~!!!!!!! |