求助高手啊~!!! 感激不尽!3 x) l( o* D9 R8 m5 |9 `
- v: N1 K! t# f& c% @# r
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
/ T x9 q( l! z5 N( t2 n% r***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********& `" @0 l( e/ k6 f9 z- h$ l v# X' K
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
t4 c# K2 X% p( o
, p6 j1 Z2 z( D2 N# V8 S6 T7 j6 r J8 d0 R
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
$ _3 q- k7 ?2 j9 E. i- Z7 [8 Dout1=S1-inv1;
6 b7 |' h: g2 _8 b& Qout2=0;, Y, \1 U2 i0 @5 P
out3=0; /货品1需要补货/$ n- d) d' ^/ j' C0 V
" z- I2 g) n1 |3 @1 N! j+ {else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)/ W, {1 W' k7 x3 j
out1=0;$ h8 y. e7 Q/ d8 {9 r1 t$ {
out2=S2-inv2;7 `1 i7 ]' k5 D& i, i& ?
out3=0; /货品2需要补货/4 K5 \7 F/ H/ o5 s& v4 ]. d
: M( Z r' B/ w
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)- p K, C/ g$ Q3 }7 Y* y4 y+ H. |
out1=0;' `: w) ^' f" q' ^( f' Q* q
out2=0;
- ?% ]# Y' m G$ y$ nout3=S3-inv3; /货品3需要补货/
7 r# o X( w' k, h) t: t- w2 x+ A7 V1 y
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
0 d( R) X% N: F# ^1 y8 g& t* Tout1=S1-inv1;% U/ x0 w R" |9 Q
out2=S2-inv2;$ J) q O0 N8 t+ x$ G7 a
out3=0; /货品1,2需要补货/
8 A9 R7 \2 [: y5 ?5 h7 S; b7 t) Q! [3 b& k8 D( v
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)
' _4 `; G+ D+ w2 g0 M$ P5 Uout1=S1-inv1;% r# E5 p) ]' o# T2 Y* h. ~( D& B
out2=0;
4 Z8 V- J* L; K6 a! ?( Yout3=S3-inv3; /货品1,3需要补货/# Q4 ^! s, |% y7 c8 z( J3 N3 ]
T! ^! o9 ?" F* _
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
* O% g. U6 h# l" Qout1=0;
9 R+ s1 W& r1 ^* `out2=S2-inv2;
5 }( ]' B8 Z0 _3 k* ]out3=S3-inv3; /货品2,3需要补货/$ \' I. ?" H- T9 y9 d# [7 G9 y
) ~: [* a: s$ ?; c! \! q) e
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
6 t# T) L# E4 c- Hout1=S1-inv1;* J) D b! q0 y) S) Y3 b' A
out2=S2-inv2;* h% I E. \( d5 c% R7 x
out3=S3-inv3; /货品1,2,3需要补货/& J8 }# P T" n0 d
" P1 U' w( f. J问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",+ x2 ~ e1 K3 @5 J/ g
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.% K; Z# e! B, z3 ]9 A- ?
9 m" @; U( f5 S/ \& l4 l; M; e请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
8 K8 I3 W% A: U3 H% }谢谢~!!!!!!! |