求助高手啊~!!! 感激不尽!# R4 y/ Z/ G8 [% Z: p) [( O
" ?1 i% K+ y; O0 A; \如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
* P- ?) _( ^2 v, }% q6 U***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
* F% Q3 y4 @2 h' Z***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
# i9 L( ]1 ?6 @- [5 [/ `5 K) E/ T& l+ Q# Q
# L4 f! J3 D( |' n! ?% [" v
if (inv1<=ss1 and inv2>ss2 and inv3>ss3); p+ l: O/ h- j r/ k; u9 o0 u
out1=S1-inv1;; ?9 A' u1 f+ Q6 L
out2=0;
" q/ O. v( |- m1 m# M) bout3=0; /货品1需要补货/) F) H9 u/ y* x( H) q$ D
3 V' B6 r/ G0 M. y
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)1 t. V6 i* ~+ t2 h% \) W5 D
out1=0;. q. A, T$ q: |- ]
out2=S2-inv2;: u! S/ `7 z2 G3 R( M
out3=0; /货品2需要补货/
8 I/ u4 A3 Z3 ?1 R. k( `! r. H6 u% F* O/ Z
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)! Y# s0 @+ c$ t
out1=0;! L" W9 W' ?3 n3 `7 d2 d) o
out2=0;, x& N) e2 {' g2 b9 S
out3=S3-inv3; /货品3需要补货/" y/ k1 f& U) e8 K* p) n
# U) U- X4 O5 celse if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)8 @5 C0 g1 l5 R! E8 O0 S
out1=S1-inv1;) K. g" ], [; c- n- B2 F) z
out2=S2-inv2;
$ h$ |: M* @, G/ o% [out3=0; /货品1,2需要补货/
/ r) d& _; c$ C! d* O9 t% ]' {$ z. ?
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)2 M; A$ _( R$ u( j9 J& r1 G/ \
out1=S1-inv1;
5 Z& }, O( S0 S0 R" p, c# uout2=0;4 b9 z5 `- i" ~- j. I
out3=S3-inv3; /货品1,3需要补货/
+ r/ L- j4 F5 W4 ~9 w6 I. o
/ `2 c. X2 A, \4 celse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)1 f: B$ F* c( ]8 u G
out1=0;( M6 s2 t/ k5 u* ?: T; {2 N# f0 W
out2=S2-inv2;. R5 Z" T1 |( w( h1 m: _
out3=S3-inv3; /货品2,3需要补货/
! c ]# Y' [# h# F# z
8 Q# \+ Y- s2 b- _2 C8 J$ ]else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
% @1 }" b9 g0 lout1=S1-inv1;
! ]: C$ h/ Y8 _& o' Z& o& s' cout2=S2-inv2;
1 R& g4 [8 q. Y+ Q* Wout3=S3-inv3; /货品1,2,3需要补货/
& q: S8 n% o* a( { B3 S0 f+ {1 C$ p% c9 }' g
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
2 r1 T9 k# ] U* w% L4 K但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.! k9 O3 [3 V8 Q- j( ?
|6 O2 E! _; Z% c1 I/ s! Y) u
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
0 V1 P n2 Y- A8 s谢谢~!!!!!!! |