求助高手啊~!!! 感激不尽!
( I1 @: R. J" c( a+ ^! |; l1 _) {; J0 N3 J
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:- `# J: U3 m6 @9 X. J0 y/ z
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
$ H. C% q0 c) U9 }1 ^* N***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********& E6 Q$ N; m1 b) R) Y7 ?
, P+ V3 s& W" [
9 ^4 h5 x- }2 q. D. Kif (inv1<=ss1 and inv2>ss2 and inv3>ss3)
4 ?& |/ W$ {9 J( i! Rout1=S1-inv1;
2 K- l! {+ h& I2 ^* g" n& r: sout2=0;
. J1 m2 N- z6 e; J% |5 u3 lout3=0; /货品1需要补货/8 e1 s& I1 f3 h& @$ l; ^" C9 Y' C/ a
8 q1 r6 Q9 O, u8 _- g' l \8 K6 A
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)# V2 _! v! f' U' V% v% h- Q E! Q
out1=0;
7 c" n, O( K/ E5 p5 ]out2=S2-inv2;
6 ^' v+ {# O: _8 f# \/ F4 W; Vout3=0; /货品2需要补货/
$ G0 ^- @3 |. B! k' F8 c' x @3 W1 B& ^& X: ^9 y7 P
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)8 D& I+ B, A. u+ K+ O; ]& j: t( Y5 U' Y
out1=0;
+ n; R6 B. [2 K. B& jout2=0;) a q2 P2 n6 v& c1 j5 B1 P) c
out3=S3-inv3; /货品3需要补货/) J' [6 M+ y8 Z# B! ~' v. T1 F% V
) z2 ~( M3 J5 O/ l3 G
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
: a$ K- L8 v: _6 X/ Z$ b3 @+ Kout1=S1-inv1;
4 F9 u: V D0 o, }8 F) ?out2=S2-inv2;5 [8 ?8 b6 e T7 Q4 N! [! k
out3=0; /货品1,2需要补货/
7 v, N1 u2 s/ D. I" u2 V2 [
* B- g& V: ?* z3 @9 Nelse if (inv1<=ss1 and inv2>ss2 and inv3<=ss3), R' K4 Z; n' q K
out1=S1-inv1;0 t9 E6 }% `' N8 Q7 ]0 d. J
out2=0;
) b- x1 Q& Q nout3=S3-inv3; /货品1,3需要补货/
) z4 t0 J# n' S3 n- @
( Z# @0 V; p* a4 X' Y! l8 G# m* Belse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
. o1 Q2 O0 g, C" u5 f8 ]out1=0;7 ?3 z E: g- T4 K
out2=S2-inv2;
0 `1 P/ F, [" P ~( a4 I h+ ^* ]5 @out3=S3-inv3; /货品2,3需要补货/# r. L: h; W5 ]- ~0 o D2 U
5 y, G, M9 ~" r/ x0 F! n; M
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
0 q% V6 p- r8 P- H. U) wout1=S1-inv1;
+ z9 N) B1 G Y8 f' k9 d; l; xout2=S2-inv2;8 x3 v1 p8 [: }' u
out3=S3-inv3; /货品1,2,3需要补货/& R3 J& N5 m& A7 c4 j" \- C
: a9 c/ y" K( ^% U, X3 [3 u
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
5 h) y$ S3 [* `( r. x5 [: v但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
) l1 K% j( D3 \3 G: N9 C% P. w0 ?- c
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?% x4 z M0 Y& L/ M$ F3 Z# a
谢谢~!!!!!!! |