求助高手啊~!!! 感激不尽!/ f+ a5 x& @. T" j+ a
1 l$ x% x/ n* b, ~; A6 \如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
]) P( l7 }/ u) ?: a3 r***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
_3 `/ N+ ]# J! \* ~6 o! I***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
. {8 F/ \$ H/ n3 N0 E* K
3 y8 T3 u- ~: \1 K9 h \& e
# Q4 t1 N1 |. ~# vif (inv1<=ss1 and inv2>ss2 and inv3>ss3); |/ X* n: @" B5 Y, g9 G; }
out1=S1-inv1;7 d' Y! a. J9 B0 \) E7 ]+ `2 K m
out2=0;/ m# }8 R% a: n, ]8 a; C j
out3=0; /货品1需要补货/
% }5 E4 D) n# d- Q
8 P6 _9 B" Q5 w/ |& G1 \else if (inv1>ss1 and inv2<=ss2 and inv3>ss3). o6 u+ E3 }/ _; Q' Z- N! @
out1=0;
. o+ {' j: S' _7 Pout2=S2-inv2;- {- H! ]& ?" @& h9 Z) V) ]# u
out3=0; /货品2需要补货/3 Y7 B6 b: ]4 Z2 D0 |. H
! b K0 [8 M ~# ?: K @/ ?8 X
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
; |( _7 v7 L! d8 J; hout1=0;3 v C9 B1 b% L5 D
out2=0;
0 D- I: e' m; T* Kout3=S3-inv3; /货品3需要补货/
/ Q! P N) Q# P. {0 i: [5 I
) J9 f4 i( n* ~! g- K7 t; E) nelse if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
8 _; f j6 J" Bout1=S1-inv1;- m1 x# Y3 F- Z: w! M4 C) ^( `
out2=S2-inv2;+ r; E: f" v- D8 J( G4 X
out3=0; /货品1,2需要补货/
) r" @; H1 v) t# y( I" d
' @! [5 V2 S+ Q7 W" K7 S" _! eelse if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)
6 a1 Z! T3 I* I% a+ q' o& Sout1=S1-inv1;5 r2 r$ [5 t& B! R. W
out2=0;8 H& p' p2 h! W2 N7 B8 J
out3=S3-inv3; /货品1,3需要补货/
, v/ Z0 ?4 l+ o0 }- b6 ]6 ~1 J; g# T& ^" d; p. z$ t
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
, ~" _) Z/ C6 r e5 n$ y, F# bout1=0;
f8 [' z6 K8 p+ a+ D; tout2=S2-inv2;1 i$ g3 U7 p! g) q9 W
out3=S3-inv3; /货品2,3需要补货/
( K3 a9 d3 t& a& h2 W. v$ D+ s
& x$ ^3 c% e" J) X7 `) H8 \ Yelse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
; G% Y: }+ I& L# Z' h* Z+ d8 lout1=S1-inv1;
1 L- r8 J6 o e6 P; G( Dout2=S2-inv2;
$ j9 S% q( C* x8 x0 ^. r: l* Lout3=S3-inv3; /货品1,2,3需要补货/, c* {' \5 L( J! w5 J3 W
* X& ~- t" a. b2 v5 M' g- C+ M问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",' I# L) ?5 U `+ W6 o: b- Z
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
" @. X/ m" f: `& W1 R
3 V9 p2 L8 T" b4 r1 O9 w% F请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
3 n9 l0 X. u: f ]9 M谢谢~!!!!!!! |