求助高手啊~!!! 感激不尽!6 p3 D; J6 c: o* h& J" l! Z
0 Z3 u5 i% t9 Y
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
# y0 s" T) J: e9 a3 Z* G1 y( E***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********7 Y& W" Z& V8 A0 ?3 x$ V
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********. |. R9 i" U' J6 B, S0 w; W
, S7 ]" V9 Y2 o/ u5 ~( g. |
) {) Z! `# [% X
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
2 ?; n* G5 `: u% Uout1=S1-inv1;
- \; l2 @) o* x8 d0 ?2 eout2=0;8 |6 z5 H7 Z" j( ?
out3=0; /货品1需要补货/
6 t3 r T# L' R. S. X! t
) o8 [: E9 f1 j$ k9 J4 g& telse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
4 |1 ^3 b, Z: u1 G6 t8 aout1=0;2 o$ Q q' t- U
out2=S2-inv2;4 B, V1 @% l4 }. f. l! D2 f
out3=0; /货品2需要补货/
2 S! U2 C6 ~( i% G8 u
6 b' w6 A6 N( Q3 B' [$ v5 X4 Felse if (inv1>ss1 and inv2>ss2 and inv3<=ss3)# w2 F& q. \8 b
out1=0;
1 s# G9 X0 p' p: [, T( {; uout2=0;! ~# f4 F6 d$ ?
out3=S3-inv3; /货品3需要补货/, ^ k R1 ]& o9 U! K7 Z
7 z2 ~" [: n- _% P4 @; Velse if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)' G, } ]% M& x, Z' o' Z
out1=S1-inv1;
, s* z, m. W; {, Z+ u% Zout2=S2-inv2;
- Z& f- V3 {0 X, jout3=0; /货品1,2需要补货/: s* m S/ L0 v) C
3 \6 V& A4 n/ s, ]else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)' m# g5 y. t* ]$ j' [( O
out1=S1-inv1;* h" N5 l% Y* U+ g- R
out2=0; k7 B3 v3 f" a2 r/ \! d( k
out3=S3-inv3; /货品1,3需要补货/
3 R7 r* [! c8 U; e3 W, ?5 ?& I
, j& x2 _* n# a5 B" \# {: Melse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)1 t! T; K% |: T# _
out1=0;
% F! y# r/ P" T* h7 v7 z' H( dout2=S2-inv2;( a: n4 H) y( L1 ~5 V) _
out3=S3-inv3; /货品2,3需要补货/( n4 u# f/ y. y1 n' {8 x1 C
2 B" B* u6 l9 f- d' @( J" K1 P5 w
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
% ^3 f' Z V9 ?6 ]+ V" a/ H Eout1=S1-inv1;
1 O" p: d$ k4 ]% p: `out2=S2-inv2;- R' o8 Y" b, _0 P* K$ p; d
out3=S3-inv3; /货品1,2,3需要补货/
B5 o1 S$ Y4 x; b- p4 ?2 g( T3 S0 C, N8 r6 M1 T% _0 ?
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",/ B+ R$ ]) O' o
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
6 Y3 C. k7 Q" t9 ]% i. \
& n( J& N/ X/ u4 u请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
$ z( j+ p* f, N5 o% l( f2 _( f谢谢~!!!!!!! |