求助高手啊~!!! 感激不尽!4 n0 H$ D. d; B5 b8 N/ a! V& ]
- u, \ ~) m6 B5 u. V6 C' G4 N如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:8 p+ z# P; ?8 v2 E4 S
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
: r" b/ f8 ?2 ?/ z: i: K4 I***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********+ v0 \$ M7 I: u: [8 i
9 p, ?+ y0 U z) m- T
2 l- {5 E0 }8 Y) g4 pif (inv1<=ss1 and inv2>ss2 and inv3>ss3)$ _. K6 U5 ]/ i" M* X, M+ P9 @
out1=S1-inv1;
8 w/ h' f) m: @0 G- y1 yout2=0;9 u$ p" _# T% x! Y7 p2 O) C
out3=0; /货品1需要补货/
. C% t% m/ S3 S& V+ W3 @0 u
; ]& R- y( I! l/ f8 Jelse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)/ d! ]3 }$ f. D7 P* A
out1=0;
B& S! B: T; a3 oout2=S2-inv2;
: l0 O/ i5 f6 Zout3=0; /货品2需要补货/' M g8 B4 s. s+ c- y8 R3 ~* [
( S2 m S. Q/ a( _
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
) V* z1 s6 G- a. Cout1=0;% R. R; _' j0 W/ x% l
out2=0;
! z" U- @* a0 |out3=S3-inv3; /货品3需要补货/9 T( f2 p+ G! S3 }
/ }# P4 X# ^) f
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
% H+ i: q x- n( kout1=S1-inv1;
/ v# v( ^: S4 p8 n6 rout2=S2-inv2;! G/ |" c9 Q: Z5 ^
out3=0; /货品1,2需要补货/
: V0 V) m2 _! }+ C2 ^3 N
; V l3 N& V# k0 Ielse if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)2 i) H M7 U: y
out1=S1-inv1;
3 T; @5 Z+ s) c0 xout2=0;, Y G! O; w# `# n/ g0 g
out3=S3-inv3; /货品1,3需要补货/
+ @9 O1 L3 u8 _+ B) T6 p! B, k
: S2 e2 z1 ^& T7 T. Y2 R% relse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)& K( q6 |$ w+ n3 T7 T
out1=0;% W" I& Z! M# i, u3 s) j
out2=S2-inv2;+ l* u9 ~) A& w8 r
out3=S3-inv3; /货品2,3需要补货/2 S3 m! L/ r: ?7 {! _
7 `9 c0 {) Y p2 Y, V; B' felse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
" Z+ [4 k2 {% {$ Xout1=S1-inv1;
( [+ M4 [. A. x$ H% fout2=S2-inv2;
% s2 Z: }3 n9 t/ [4 yout3=S3-inv3; /货品1,2,3需要补货/
, E- p7 a" x9 f) i4 a- p. ~1 O. r \- m8 `4 _
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",) D+ C8 [8 v' j/ `& A
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.+ u! m8 n1 Q* O: i2 g4 M ~
! x3 [) P& E3 Y* t d) s
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢? e1 v% ~9 X7 @# u4 j# ^9 f
谢谢~!!!!!!! |