求助高手啊~!!! 感激不尽!
$ ]2 [4 c: ]# j' b5 L
0 l, |% N7 Q+ F) L- `1 a如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
6 o6 Z3 h; i& {& @6 y, d***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********" C. D4 b' `, v; c* z; @4 O5 A
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********6 r6 u$ Z2 `; a/ ]" D5 @8 f E# s
/ `0 _* @6 J& I; O; m5 |2 P
# s2 M1 l0 S* V: b' Z
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
: | q; u% i0 C7 L2 G- Eout1=S1-inv1;. F" C+ j4 Z5 s g
out2=0;
0 N% A' \: V6 V: Aout3=0; /货品1需要补货/4 Y& ~9 e! O- K3 m! S7 S( V
# D9 |; e* ~; @0 O2 Xelse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
) }( g+ f7 z# k9 t8 o- xout1=0;
. W+ E( ^1 M+ h0 y! ^ v9 eout2=S2-inv2;' O( [# ~/ f$ T) ~5 ^
out3=0; /货品2需要补货/2 a1 {4 Z& C2 S6 K7 p1 G
, i6 N0 h4 D( k) g5 G; j/ N
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)8 I, g2 w/ ^% b+ M) u
out1=0;
! x A, ]' U% o* n' a: xout2=0;3 ]* j0 M! h. {6 v1 g6 S
out3=S3-inv3; /货品3需要补货/
7 ^5 z& H# l* \3 F
* V* q' Z- M+ ?( ]! ~else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
- B6 ~4 V8 z9 B5 ]7 G. S5 j8 qout1=S1-inv1;
+ e, r) M: T+ `' U* Xout2=S2-inv2;
# {+ E* E# z2 `- ~! Pout3=0; /货品1,2需要补货/
/ V! ~9 ^1 @6 \% s/ t2 y9 l4 Y( r
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)" T& F* @% g+ E1 T- V1 Z9 X" b
out1=S1-inv1;
" J) I1 K2 R1 E6 {out2=0;
2 t% b7 U$ |7 V0 L9 Y7 Lout3=S3-inv3; /货品1,3需要补货/7 i* ?! u- G2 }
) k1 J: T8 Y* w& z1 v4 h" z5 S! Ielse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
: G( U& M; f$ D3 d, jout1=0;0 w9 O- ]6 X2 m, w' F& {
out2=S2-inv2;
/ M% j% c% A- P, u' [7 l7 Jout3=S3-inv3; /货品2,3需要补货/, P5 K! p* H- ~$ k2 \" T! @
. k: Q @* d$ d8 h& p* Helse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)5 p" U$ j: V* I" f- T
out1=S1-inv1;' q% o3 F* r x' U9 m- W+ _- L1 {
out2=S2-inv2;! p! T4 o8 ~& [# k
out3=S3-inv3; /货品1,2,3需要补货/. t: b2 g0 O' I4 p u
2 n+ Z; S$ r0 T5 H: C
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
$ ~" f! q8 e) Y2 i" ]但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.; s* Q$ F. J) w3 d
. ` G4 N: j$ P( U' {4 |请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢? R( u6 g8 l- Q& N; [# v3 B3 A
谢谢~!!!!!!! |