求助高手啊~!!! 感激不尽!
4 s* o/ c' j+ r# [* f+ H% v- N# z3 H. D2 n3 o1 j1 t- x4 m7 ~% P/ b/ ]
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:& V% L% H* l# b9 M
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
( {, B$ {$ v1 Y+ L* I***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********! \) u" o; A% \3 i
2 p' W7 Y& l% T# l! S% s
& V7 G# g6 h( u& l2 O0 d2 o: c
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)0 V. O) E/ ]1 n3 v1 r' K
out1=S1-inv1;" T) ]. l8 D4 J' Y
out2=0;
; N2 x4 A- u( W* \* nout3=0; /货品1需要补货/
( I/ @! I, Q$ w# H' ]$ _
5 ?3 H- ]3 e: B" C' y2 pelse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
( \, z' D1 a$ Hout1=0;0 x4 }9 d8 A- ?- c' b3 R
out2=S2-inv2;* X) M! L9 \. c: c) \' L" o0 G
out3=0; /货品2需要补货/: W5 @1 C' K- b0 L
6 g$ J4 @: ~+ G! ] ?2 S, l
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
0 U2 f+ {) g1 \- W0 u0 Q, V- Jout1=0; @. W3 X6 s( Z9 b9 C6 B
out2=0;
+ ~3 T+ ^8 Q4 W5 h) lout3=S3-inv3; /货品3需要补货/! b/ C1 |* b$ `6 x* b. {
, A2 j( a) x2 j0 L* e5 o- x8 V
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)$ R3 v) e) t7 H: F! q: A3 N; \+ e
out1=S1-inv1;
7 l' K+ H# ]2 K: m+ tout2=S2-inv2;2 s9 L- w: r/ \: Z1 k
out3=0; /货品1,2需要补货/
% O, ?, P9 M7 H5 g4 J+ D5 w0 Y- t7 B7 `# H: y- x7 |2 l( f; x( s
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)
2 C$ J9 O, R4 O& g# T# Y. J) qout1=S1-inv1;' j# m' J( r9 e; z, ~
out2=0;
4 y/ N( I' }1 g$ ^2 K. Uout3=S3-inv3; /货品1,3需要补货/
" P. Y9 w1 ?4 \8 `' o6 _
0 k/ y$ E. Q( T$ Z+ Zelse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)5 ?$ f+ q, l& P! ~. z) ?2 W
out1=0;
. s1 [& j5 ^3 f' |/ ~# C2 {out2=S2-inv2;9 @, m0 Z% u8 k/ U
out3=S3-inv3; /货品2,3需要补货/! F0 Y" T/ r0 g6 w% l7 [+ y
0 I C* B7 K& t+ t! H9 h% Aelse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
: }% p0 P H; nout1=S1-inv1;/ H2 N% O1 r( }2 W0 M5 F+ h
out2=S2-inv2;" @1 O' E! j( |4 i! o) ` x/ |
out3=S3-inv3; /货品1,2,3需要补货/
% ~. s' f, Z" I& W
( k6 |. K5 U4 T# ?问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
" t* A# c( m, D) q/ I但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果./ E4 v$ @6 \2 K6 [0 z
+ U3 Z |+ o- v请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
) Y. s7 a9 Z/ s谢谢~!!!!!!! |