求助高手啊~!!! 感激不尽!
$ N: E ~0 a' c, k+ G% z
, Z. t# Z5 K( g2 u) D f% d如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
- i! `+ D2 y. |. R; `$ e' K***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********0 F/ W* q( h7 E2 ]1 V7 z
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
$ N B: n, g) ~6 z6 S
5 `; M8 p: H! H
0 \- \( J* L$ ]' f) ~if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
6 I) _ Z, |8 y" |out1=S1-inv1;
/ @' ^" T2 D1 t* u; W1 [out2=0;
q1 `: v! Q- z1 q- n) W6 Pout3=0; /货品1需要补货/- }+ m" k8 L$ `! {% a4 i( G
$ B/ @# f( I+ _else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
# c3 {5 k" I. j8 A9 @, \& o3 cout1=0;
" a( a7 [& R! r" L$ j0 R, Q9 i& Hout2=S2-inv2;( ~/ ?) ~& o8 s# ^4 h+ c1 L
out3=0; /货品2需要补货/! d0 \' I0 C! t b z
% Y- E2 W& v0 [
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
& y& ^+ V X) S! J8 G9 ~1 Wout1=0;) X+ Q2 N; c/ M3 F' f
out2=0;+ m! Q F y& _9 G1 \
out3=S3-inv3; /货品3需要补货/
: J I0 r' {1 C R, g3 n! k) p% o' M: V- i
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)& i- p+ c# f; D+ t: _0 ~- s
out1=S1-inv1;
+ X# m( b, M ^out2=S2-inv2;* U1 C% q3 L9 K/ | c \4 Q
out3=0; /货品1,2需要补货/# h I& ~8 h$ `8 ?9 F1 G% e# r
/ w+ w* V. c k8 |; \3 d4 y
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)) @/ e5 F! {# I7 ], O% E$ [5 T7 B, ? c
out1=S1-inv1;7 `* T/ ^( i' o8 t$ f! }; I4 Q
out2=0;
- C4 R. A; x4 b0 S+ ~out3=S3-inv3; /货品1,3需要补货/3 y# ^% S! G/ q0 F8 }
& d7 J* k" K% X! c
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3), \: m2 b2 _& C+ f
out1=0;
! g( i \( t7 `3 ]4 P' U! U" Cout2=S2-inv2;
* w2 I# f; `3 X2 _6 d9 jout3=S3-inv3; /货品2,3需要补货/
$ U0 i; v9 i% `
3 M( f6 J% n) _else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
7 B D1 u5 v3 e& F* m* @ K1 b4 oout1=S1-inv1;
, k; V0 D6 E. A* i( Kout2=S2-inv2;
: N1 j" h+ _4 ?9 T: V1 G$ r2 B: kout3=S3-inv3; /货品1,2,3需要补货/
1 l5 e9 w( i% q* s5 D) D& o {1 F7 m+ x
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
4 w. f6 l0 b1 l* |" y; E但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.7 s/ w5 z1 f7 }, s" _+ Z
( e" ?- { A2 ~7 h2 k/ I" X请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?* U9 B9 U# \7 z* E
谢谢~!!!!!!! |