求助高手啊~!!! 感激不尽!) i* L( i7 [! _8 S5 b4 L d- s
3 h& p ?( y. E7 ^& r; X, ~! K9 P
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:+ X1 Z$ O0 r8 M( _; V% r @
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
: U" ?5 _. f: y7 V6 E8 K***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
/ a+ X6 }1 X( `7 `0 D- Q& U! W( A( X
E' ^% \& x+ F% B: s4 L
! W; n/ c8 N6 S% u5 N& J* Aif (inv1<=ss1 and inv2>ss2 and inv3>ss3)
. l* A1 `7 K" ?1 Fout1=S1-inv1;/ j4 e! D) e7 R; i
out2=0;2 S/ B( n. U( `. z+ m
out3=0; /货品1需要补货/* F- _ k8 n2 I7 ^
, m' S9 K* x4 c7 _else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)& x: w: g4 |$ }3 ~& p/ p/ P
out1=0;" n# R1 l+ w* a2 h
out2=S2-inv2;4 {2 G2 y/ [6 F/ U
out3=0; /货品2需要补货/8 i$ m: M6 D* V( z# C
- B% T, K# |) g9 t. ]
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)4 P. p) A, I8 J! t8 e
out1=0;
2 w& x* J2 |" F5 w8 t1 rout2=0;1 c% n! e: O, Z; @- h$ G) Y+ ~
out3=S3-inv3; /货品3需要补货/6 s& B, Z# v( w$ ?+ e! O
# x, _8 p3 G2 L. Velse if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)5 }+ U& d) V7 L8 N2 _/ {
out1=S1-inv1;
& {; n9 X& q& t6 _3 Qout2=S2-inv2;
7 U- n V* D1 R S. Mout3=0; /货品1,2需要补货/
+ q. V5 \2 i6 {9 G2 \3 a( z
6 h( m8 {. f4 q0 G9 U4 Kelse if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)5 ^1 b5 u, c/ g! L
out1=S1-inv1;
/ s2 g, N- A' Fout2=0;( u9 \3 j( M2 b4 R+ ~7 E, l
out3=S3-inv3; /货品1,3需要补货/# x$ b+ ~! b2 [- T/ W. P8 `
$ F! X% o7 [3 celse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
3 Y/ o, p& A6 t6 l* Yout1=0;
3 Z0 _: Y u& V% Gout2=S2-inv2;
$ w* K, i; k) H4 L) eout3=S3-inv3; /货品2,3需要补货/
2 G7 r. q% P( w5 M: F$ r
0 Y+ v/ h4 L, `! ~ Celse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)2 r5 I8 V/ q% J" D7 z
out1=S1-inv1;; h" R& J+ Y+ ^( h- h
out2=S2-inv2;! T4 [' [7 |1 ^" X7 A
out3=S3-inv3; /货品1,2,3需要补货/' o+ ]6 A( I( H4 {" m' L& C' ~
: L1 n. f( s @, o
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
# a$ f- w( Y: p8 A: j但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.2 c+ y- P0 ?5 q7 n$ c
! p- G0 s) e# }: _请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
" _+ l4 K' r5 R8 I% c谢谢~!!!!!!! |