求助高手啊~!!! 感激不尽!
: o7 L& _ O# j8 w7 D2 R2 t/ R) K$ R( X
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
5 M, ^, J! d7 b4 G) s* [" }***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
9 A8 B& L8 B) i1 Q***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********7 b2 j% r( H0 {, `& g9 b
- |6 T X% I2 l
9 A4 h2 [5 q* J% ], L5 U8 J$ qif (inv1<=ss1 and inv2>ss2 and inv3>ss3)6 G4 m( n) Q9 x% q. ?
out1=S1-inv1;
% Y, d- |- L# P+ k H) oout2=0;% Y: o9 g& x6 U" E
out3=0; /货品1需要补货/, Y! ~# b4 j3 E2 h% L0 J
% x8 z- y* H: ^
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)* J2 H E0 l! k6 r3 ]
out1=0;' P6 C( s6 F: d0 c( R& c% {) w) a
out2=S2-inv2;
, I( V0 A9 t x b, Y: Nout3=0; /货品2需要补货/2 [: j" C: T2 V0 j
( d/ I/ P7 h7 K0 velse if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
/ p J0 `; s0 s: _* m1 Iout1=0;2 x" l5 Z& K! q6 a( n. V
out2=0;2 ?; @6 W0 d# s0 j: P6 c/ B
out3=S3-inv3; /货品3需要补货/1 y6 h! z; X' E; _
# H) o, A; w# O- r" [6 p
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
$ E+ P& h. h2 v6 h: C+ ^4 W8 q, |out1=S1-inv1;. c* @* G6 d' P+ H, `
out2=S2-inv2;
& j1 `# d5 l. Vout3=0; /货品1,2需要补货/) i3 }4 w" S6 c+ p
D' q! q$ `% D. a! c& O( yelse if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)/ ^% C/ ^4 x0 w1 b: x* c
out1=S1-inv1;" V: W8 z& |9 J* K* I) J2 e
out2=0;4 v _' E( f3 }3 P1 E4 Q' [1 g
out3=S3-inv3; /货品1,3需要补货/
8 ~; r( p3 Q4 t5 }. n( t! {
5 t( W, t% s, X: Z0 Yelse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
% X+ u' d3 g: Uout1=0;/ R2 ?9 E! z9 I9 J0 z" c
out2=S2-inv2;
" E8 R, g2 C" P4 }% I, Nout3=S3-inv3; /货品2,3需要补货/
4 {% i* F9 y; Z" L4 g. _
, y- f' N* |9 Z! f; z+ h* Melse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
! i( `3 [' n% b+ B2 cout1=S1-inv1;+ d3 K& ^9 p# o/ V$ T% |
out2=S2-inv2;! w8 W" {0 _2 @. S4 R
out3=S3-inv3; /货品1,2,3需要补货/
5 R$ {( J4 T% D; [1 @* t
' I3 R4 ~1 d9 }& v- s问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
, Y: G* s a; }6 V& j2 O/ W但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
0 y% X0 V' s% K
" y4 \1 Y4 i9 M请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
6 s# u# u1 ]( H4 J, X谢谢~!!!!!!! |