求助高手啊~!!! 感激不尽!
" [* y% r& M% a* i7 ^6 O5 D- I' G( f' P2 |6 E: l
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:7 j6 i! {. o& s% w
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
N8 O$ l, U9 P! s***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********1 n& S% Y+ ?1 m. S- A6 p: N
4 E) T/ w% F* n: A( s
2 `/ B# ?9 S- {5 y3 d- R
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)6 Q0 M6 _$ U6 ]2 u8 D
out1=S1-inv1;+ q P: U4 J! r) I
out2=0;3 Y. Q- r* ~0 y W0 U. }/ [4 G1 h
out3=0; /货品1需要补货/3 _" E2 C" D; @
! Y: V7 I! D1 K! g* r0 welse if (inv1>ss1 and inv2<=ss2 and inv3>ss3) }1 _3 n; }/ E* L ^3 o
out1=0;
/ y4 }* X) x# v4 W' W+ Mout2=S2-inv2;
E) |$ v: D9 U( B' B9 P6 b2 @out3=0; /货品2需要补货/
% F, v( @8 \$ V) K3 _' E
( U W8 j9 K" i0 [6 Z7 \+ _: `+ r5 welse if (inv1>ss1 and inv2>ss2 and inv3<=ss3)+ c/ D: v2 q" y* R4 s
out1=0;6 Z8 U: x/ Q3 a' x0 H( H7 ^0 `2 O
out2=0; t; Z& R8 B$ c; Q+ ~! n
out3=S3-inv3; /货品3需要补货/' ~ N# D3 L& L0 w2 J+ @+ ]
: W4 l: b9 r1 O2 x& ]else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)' V( _/ {3 I! @
out1=S1-inv1;
0 ~! G/ M8 g- O2 t$ Oout2=S2-inv2;
' o4 F6 J7 J, j3 ^1 iout3=0; /货品1,2需要补货/- h+ d8 o5 l* d; b; X0 y
2 E A6 i) u- F
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)# Z+ O+ Q+ G& p# `3 V; }
out1=S1-inv1;. Z5 b9 q* F k/ c# X3 d! n
out2=0;
3 t7 ~& E5 P- S; `8 c1 E3 {out3=S3-inv3; /货品1,3需要补货/8 u. g( I; G6 f: d! T0 P R+ W
; x5 n6 l& J2 Q& ]9 I
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
! Q3 z: x( \& |' ?out1=0;' J( s3 m/ ?# m( g5 j) H# U6 i) D# k
out2=S2-inv2;# @. d* X' @3 L0 c
out3=S3-inv3; /货品2,3需要补货/
2 s# z4 O8 y' e1 [4 M2 Q3 X: S% {+ U1 G+ x2 f# s1 V S
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
% ^ _0 i3 x5 [1 P' I) W! U2 s3 O4 Mout1=S1-inv1;! |) u! ]5 y6 {; u& z' R
out2=S2-inv2;' m; Y( `. N& K& V$ E. Z5 h% }
out3=S3-inv3; /货品1,2,3需要补货/
! x) j# [5 V& ?: R
5 t: Y/ j/ b0 ^2 P7 g) d问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
' H7 I4 T$ i u' j. E( e5 S但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.' \# ~0 e$ V7 d
+ S# B5 _ x9 {( n/ [& U请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?; z* E: a# U2 s4 M6 Z M2 H
谢谢~!!!!!!! |