求助高手啊~!!! 感激不尽!
- c( f/ D' B9 H/ l% u: @) L( m \8 ~9 ~/ E; \5 R
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
* ?/ N; q6 n3 b1 j***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 *********** N" F8 C. C, s; ^6 s. B
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
' R( N: R0 `, Z/ L1 J/ P+ G
& m, V9 ~8 _/ |+ ?! x: f. k; G
4 B3 J3 G$ O. v) {- K) Q0 Lif (inv1<=ss1 and inv2>ss2 and inv3>ss3)
2 T9 L6 f8 Y7 o$ nout1=S1-inv1;5 [) a3 S5 j S
out2=0;
" l8 s3 N+ n7 T$ gout3=0; /货品1需要补货/
0 j I6 t" ]9 ^, _, `( Z1 I; y A/ J, m! j- s9 T
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
9 o5 x$ A0 q$ Vout1=0;* i+ z/ b+ d% o- \: o' s
out2=S2-inv2;5 S$ I. s. n4 G( Z# T
out3=0; /货品2需要补货/: O. j* V( {) j# U
% y) z" ?6 a/ f! N: o# zelse if (inv1>ss1 and inv2>ss2 and inv3<=ss3)! ]( P0 K( }- f. w
out1=0;
/ Z5 }' G4 N: y! Jout2=0;* s) G8 K; j( P3 J5 X
out3=S3-inv3; /货品3需要补货/$ }4 q6 m8 F* X; ?1 z) T
% B# C6 Z, Z$ A8 y1 _8 selse if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
' G1 R2 S! b0 T% z. Cout1=S1-inv1;
+ Q- b/ ` f1 a wout2=S2-inv2;
2 F8 s8 | N1 V1 E3 H( \7 O) @out3=0; /货品1,2需要补货/
8 @0 N# H3 X9 {% @1 b- q. n! K. i3 Y+ E7 F- P! Q8 `2 }
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)7 [2 E4 ?. z, z* `, T
out1=S1-inv1;
1 t8 N+ Z5 f+ j) Oout2=0;5 s$ ~+ ^5 x! a- \
out3=S3-inv3; /货品1,3需要补货/
, ^, p# l2 G$ M) G1 W8 ~5 U5 O5 ~) l( F9 T2 T6 K0 n4 ^2 ]
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)9 Y4 t$ o, t, |; Z7 p2 w( d
out1=0;4 b V3 ], R4 }( Q" I9 d
out2=S2-inv2;, Y4 P7 v! B) ]
out3=S3-inv3; /货品2,3需要补货/% @6 R( k$ N4 ~8 @+ y3 r, {# z
' @* C% ?3 f+ w) {8 m" }else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)0 K, ^" \9 T1 n, ^( Z; c. N, _
out1=S1-inv1;- }1 W( g3 t6 ~% P
out2=S2-inv2;
. M- w1 A4 |) ~. Cout3=S3-inv3; /货品1,2,3需要补货/, y1 _. d& M7 h) l! b
- e7 a h7 C' d" i7 l
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
! t9 b5 E8 }+ ]5 y( |但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果./ e# p/ O9 I+ Z; b. u
1 K# L4 f8 @0 a9 S" v0 ?0 T
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
) }# c( |/ U: g: \& x* j! a# i* s谢谢~!!!!!!! |