求助高手啊~!!! 感激不尽!3 V0 ^) P* c# i, P9 h0 I6 e
" u. E# G/ B$ x如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:! I7 y3 c) ~+ a0 s ? c
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
- R" }" X! K9 x***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********2 {. V4 J. s7 i# D$ ?! y0 S
( N0 t0 L& _+ k' D# ?/ G5 w
2 S5 _5 J6 ~0 P* c
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)2 B+ b8 X- z6 G- f9 b4 ~3 \
out1=S1-inv1;
$ l2 {$ b8 |# Oout2=0;3 M9 l* j! C c* N* K1 t0 p
out3=0; /货品1需要补货/. V0 F3 o, f, F% K# {- z) P1 I
8 `# \# T7 m6 b' C7 G2 ?
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)! a- n3 I; u7 H3 _" u
out1=0;
6 q+ f: M* g7 C8 Z# E! Z8 bout2=S2-inv2;
2 I1 c6 y& _* ]( ]3 w' g" A- D1 I: xout3=0; /货品2需要补货/
2 R, m9 V, W) N0 O
9 G3 e9 y1 C' I# e7 ?else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
" X O3 g; X3 J U) U! eout1=0;0 s' Q3 H8 ^% @/ V3 j/ G
out2=0;
j: X4 l. w! X& uout3=S3-inv3; /货品3需要补货/3 ] F# T" K3 n6 P$ C" ^
4 {% c. ?# }! r) h5 k
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
% W9 ]! B7 R1 N5 P& H2 m5 k- Hout1=S1-inv1;- x7 e" N! _) V8 Z. ~# V
out2=S2-inv2;1 l6 T4 d2 V$ ~6 T& r, f
out3=0; /货品1,2需要补货/3 i3 {4 S+ X8 a* ?5 A! G
, O2 e4 j1 o6 f B
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)
" x' i% D$ ^; i7 D6 s- eout1=S1-inv1;
7 P" k3 E) E3 R* F' S+ `8 Gout2=0;
i+ P" {7 b* ~; M6 i) Zout3=S3-inv3; /货品1,3需要补货/: c. S, ^7 c: T
( P: [; J; F% z7 s( u1 Jelse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3), t/ B& ^# m2 ?4 c
out1=0;. C [; |4 v& Q! F6 v
out2=S2-inv2;
6 E* \" c" q) E. Cout3=S3-inv3; /货品2,3需要补货/3 W" B. o3 {& j# ~; j8 V3 u+ J4 W$ _7 e
* T% |5 A! |; Telse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
2 g! d; w8 B8 K; S1 H; k! pout1=S1-inv1;+ l/ O+ l! T" M3 x+ G
out2=S2-inv2;3 |/ n& B5 P( `' n
out3=S3-inv3; /货品1,2,3需要补货/
" V/ C' [4 f, Y3 v
# C' x: Y9 I6 L$ G- x8 M问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
/ [# J4 ]6 t# k& A, O2 ]! \但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
% u- [; Z; o: g4 N$ }+ t8 B# w& T$ s, Z6 v9 Q" m
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
" u+ R, f4 f; H+ t5 p$ [谢谢~!!!!!!! |