求助高手啊~!!! 感激不尽!& |: ]" j, P3 H/ t% d
( _6 I9 P: P# \, L如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
6 q- g* g9 y+ \8 L% {- ?( E: [4 H***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********" v4 k% J6 {$ y+ p) O
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********; b% Z; c- g5 v, ?6 N( b1 i
( w+ v" d P* b5 Y m- @; U
' M. X$ T! M5 X+ P. B% K& Xif (inv1<=ss1 and inv2>ss2 and inv3>ss3)6 X- D' _; X c' q. i0 `: o* }
out1=S1-inv1;
( \+ ]( G' P4 }- G8 b5 Q- [out2=0;
( ?5 \) r7 h# X5 }& `2 N, Sout3=0; /货品1需要补货/6 S- }$ I. p' {; p. o! I
0 w9 [4 E( G1 `: j$ ?/ {else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
5 y4 V7 j2 H2 ]+ \out1=0;
9 G/ n: G- u2 pout2=S2-inv2;
U1 m) L% F% kout3=0; /货品2需要补货/; n! z6 Z# x* K% p
4 E ^+ b0 \- o( e/ @" z8 oelse if (inv1>ss1 and inv2>ss2 and inv3<=ss3)7 U' P/ L( j; M1 K$ }# t' Q( }
out1=0;4 e# [3 U0 B5 Y5 r3 K: p- K- g
out2=0;
' F+ u. O( a2 e# \out3=S3-inv3; /货品3需要补货/
9 r5 o" J( V9 i! l% T. C; { H3 M6 o4 H( {
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
8 @8 |5 c" A; }3 H7 d, fout1=S1-inv1;' B9 W$ | S% T& V( Y/ k
out2=S2-inv2;
# n, s e- a! b; hout3=0; /货品1,2需要补货/
$ [* r/ V$ C' c) \% V& ` G! ]# z |5 H. C; J0 o
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)! Q- S( ]3 x8 u$ U+ @* D) R n2 @6 D
out1=S1-inv1;3 m/ _+ A: s, t1 m8 n8 W: R, [
out2=0;' Z9 Y9 Y+ T# U
out3=S3-inv3; /货品1,3需要补货/# c' F% V4 [: M+ }6 D+ E
' Y& W6 v& S$ _: I& j; z8 H
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)) K) } V0 {# t: n- \
out1=0;
5 g x) f8 o! b9 I' g- ^! Kout2=S2-inv2;+ E# b8 L$ E# N$ g, x
out3=S3-inv3; /货品2,3需要补货/
i* d- T) p8 g" c4 U }$ r) \3 L. W; o9 J% h
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
- O; f& g" s0 [( Rout1=S1-inv1;( L$ a" a1 `% J/ g2 O) ~: N
out2=S2-inv2;
$ E3 f. s3 q" g8 Z8 C* B. g/ vout3=S3-inv3; /货品1,2,3需要补货/6 Y5 F z* I- {" b
& ] n9 i( t8 U5 x' B问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",4 ?5 b9 T) Z; [' A, r
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.! E, j/ a! M* x) ]
! {2 a6 ]3 O' Q
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?4 y& m! A9 V3 Q2 X
谢谢~!!!!!!! |