求助高手啊~!!! 感激不尽!7 x! V$ @- Q! Z) a# `* T
% X; D% r4 d" m" ]$ }% z
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
) M8 T5 _6 s% y$ o$ u4 _# o6 I9 M***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
; N( b1 ~) m; w: ~* {% T E***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
" T7 `; ~: O* `4 |% i
/ `+ \' Y9 M" K) w* t- n8 J3 q( _6 J& {" O$ h; C# D8 D3 \
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)3 G' r' t% ?- C) F
out1=S1-inv1;3 d, l' j1 o+ e% z3 z8 e; K$ |( y
out2=0;
T3 T6 }2 g, p% J9 U2 b* }( L4 Fout3=0; /货品1需要补货/
$ ]7 E, W u* J8 p, J) R
7 C: F9 V# Z- belse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)! D8 Q q8 R+ g
out1=0;
2 l$ W) V5 K/ h. b, Oout2=S2-inv2;
! i% [; P% M& }$ m$ \( xout3=0; /货品2需要补货/
- g2 M% i7 V7 d' o: n7 J7 y6 d% J0 f! Y0 {
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
. H; ]. ?% j- P* U" D. yout1=0;' `% e7 V) ]) I' F$ P7 X
out2=0;8 u( O8 h3 T$ N- l/ z. Y
out3=S3-inv3; /货品3需要补货/$ Z B) k( s8 w, e/ b
) [; D7 i8 _, H$ f' P' h0 u
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3). E; p( m4 o& _: ]+ q
out1=S1-inv1; L F' g4 ^; c! E! ?1 r! b
out2=S2-inv2;7 O! i" L6 r! O0 @. l7 n
out3=0; /货品1,2需要补货/
" M' i! A0 A" \2 J0 V5 c B; M8 a; J1 V+ o
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)
" f/ K" J ], L2 v/ r: xout1=S1-inv1;* A5 [; B, W& B5 Z& V2 W
out2=0;$ E2 G3 T4 q" j9 n. O2 N
out3=S3-inv3; /货品1,3需要补货/
E2 \! \7 k, p2 C7 p% \* M* Z. d: F
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3): g" B! k2 L& P! ^2 n/ o
out1=0;$ w+ v2 e2 @7 k1 X1 Q- l+ s& `
out2=S2-inv2;
6 s, k- b2 a5 E2 R& Y# ?out3=S3-inv3; /货品2,3需要补货/& G, e* R4 l- j# O9 l0 O" o
! t! X% y$ [" ~4 C$ [else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3): ^9 i8 }8 I! q/ _" I; [
out1=S1-inv1;; l0 ^9 X# _/ p7 r; Z9 s
out2=S2-inv2;9 g4 S/ Z! a1 |4 p* W P* j
out3=S3-inv3; /货品1,2,3需要补货/& T* v/ W/ P9 y. s) U
* d* T0 L7 Q4 M
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",* l$ s" g& \* o: @! f- B
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
2 ]- f/ q& U# y9 S0 Y. d4 x! w. p; P0 z/ r6 H9 }! H/ n: x
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
" f, C/ p ~: h0 T \谢谢~!!!!!!! |