求助高手啊~!!! 感激不尽!
8 W& Z& v; X$ L! Y1 z6 y% [# w4 I$ n- U
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:% q1 S( H9 E5 |/ b7 O
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
$ K2 l' c- o# R! U, p: B- u( w& a***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
( ~3 i6 b% ^* t8 ~. Q) D3 \2 t
; W) ^* B1 V b" ?$ Z+ p
: \$ }2 Y" }1 B' v P1 r Q4 }if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
( _/ M% m% n/ Y- z1 vout1=S1-inv1;
, O- G( N2 ], i0 m- C0 l2 Dout2=0;; A3 D! ?* p6 m6 i, `
out3=0; /货品1需要补货/
# N* I4 A- A6 [, J$ R7 M! b3 W+ p% O- \) V. Y9 _. {# z% X o# D
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)' r: L; U& B9 |, B' h) g4 ~- J- g
out1=0;
+ w4 _: L) G( Q, L% v% Jout2=S2-inv2;
. ~7 }% ]! Y& C. T, B7 Sout3=0; /货品2需要补货/
$ x+ w* z, S: p1 y: j# h' A3 \* j9 q
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)" V" X m5 ?( c" Q
out1=0;
) G" v5 @& g: |6 d% C6 ?out2=0;* n% P/ P0 [$ a. c& R3 _" K) M" v5 M- X
out3=S3-inv3; /货品3需要补货/1 P1 \+ ? n5 u5 V
2 F" }/ w |! u$ X
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)3 @3 I# b }" f* q$ d( Y6 t
out1=S1-inv1;6 ] @3 d0 M5 _" w4 g& g
out2=S2-inv2;+ G9 p$ Q/ b2 M1 [9 u
out3=0; /货品1,2需要补货/. x5 ?3 T' f J5 e
8 J. D# c4 f d1 }0 ]else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)0 A$ D- D; D2 N+ N/ ?
out1=S1-inv1;4 }/ }& X r8 s1 \" }1 G
out2=0;4 E2 ?$ [( g- O. D
out3=S3-inv3; /货品1,3需要补货/
1 M( ~! {$ T) C& E* I
2 {2 ]( N7 P$ lelse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
, P: ]; V) x5 G/ g0 oout1=0;
3 _, w9 N1 A+ Y* Y. ^0 ?out2=S2-inv2;
v# A+ w! q0 Y. \+ Xout3=S3-inv3; /货品2,3需要补货/
8 l& Y/ X7 l1 S4 O. o, ~2 f$ n( M5 o
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)6 E/ G8 A1 Z, H: P
out1=S1-inv1;
. p( a* |; u" f8 tout2=S2-inv2;
4 z: U8 q4 p1 A" ^: K% x! t7 Xout3=S3-inv3; /货品1,2,3需要补货/3 v/ j0 z _* Q, \5 w$ y
" q( I6 ~' F+ Q5 J* l
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
' h5 g2 P, S3 A; h1 ~: _- j2 C% A但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
- K! y9 w/ [, n9 T! W
1 Y* P P) v* T5 ?& N8 j请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?5 ]: N8 D# X' y+ T2 F9 P6 N
谢谢~!!!!!!! |