求助高手啊~!!! 感激不尽!5 d3 R. w- w5 u8 m6 T% H' u
* G) Z1 @( O# I
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:; X, f1 I* E6 ^; G$ L, ]* u
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********( N0 s+ ^6 `. Z0 c9 H, J, [0 q
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
. _5 f$ S8 C( ^3 ^$ C8 t( P% R# ~8 k# h8 ]( x
7 V. U; |1 g7 Y, aif (inv1<=ss1 and inv2>ss2 and inv3>ss3)
8 T9 p. v3 N9 [; Y9 _out1=S1-inv1;
' P! H2 s" t( ^. lout2=0;; |* V9 L# _) \- v0 b6 v" B
out3=0; /货品1需要补货/8 y" ^7 z. S) T3 o" F5 w; O$ d
. r) j% m1 u9 h; g- Q1 q; W/ ]% n
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
3 H L8 y4 H8 vout1=0;& V# @/ i! u$ T* D
out2=S2-inv2;
2 K/ G: p7 J5 ]2 a% C) H3 Y$ jout3=0; /货品2需要补货/3 x6 B' ]& e! k) _2 ?
# ?) x: }% P+ felse if (inv1>ss1 and inv2>ss2 and inv3<=ss3)5 t3 q3 c* x: B& c7 S. \7 P
out1=0;3 R) f' t9 W3 s. z( Y
out2=0;
( _, E# u; @: l* `8 yout3=S3-inv3; /货品3需要补货/
- j) e& f# v2 P3 e! _7 \) N5 n( {) A' C% K3 ~7 D
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)8 y: W6 [( c6 ?/ o
out1=S1-inv1;. C0 m) l9 t" ^5 {' K5 z
out2=S2-inv2;
& D4 L9 \. c* x* C' p4 H3 ^5 gout3=0; /货品1,2需要补货/
- w( \& H y9 |9 Y; g& P" W9 p8 x4 y( ~/ b5 M e) _
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)5 b% C, M/ L p* X3 h
out1=S1-inv1;
# R. Z7 e# |& N9 }$ s& eout2=0;' @) G0 e" A6 Q6 R9 l+ K0 n/ D
out3=S3-inv3; /货品1,3需要补货/
) n6 t/ c, g! ]" m5 I2 b: u% {) t- t2 q; Y# U0 T" b, |; ~; F
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
" }8 ]& |3 |' o; P3 _& y) Mout1=0;( p; s: } F9 E6 |4 @9 j" R' }
out2=S2-inv2;
5 X8 Q1 l1 G- Sout3=S3-inv3; /货品2,3需要补货/ P, k; Q/ Q" g" A8 {' w
8 B4 L; M. X/ T6 W2 |& u+ V+ f
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
" w6 |! G. ~) f0 vout1=S1-inv1;/ V0 q* U/ W! W" @! ~
out2=S2-inv2;; U% ^; _! B' T! f4 | \( ~
out3=S3-inv3; /货品1,2,3需要补货/5 l9 C+ E$ V7 m; y# c& i" Z
0 F' \/ W0 L5 b
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
1 V0 g" @+ g6 v, B4 `但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.8 U( ^$ v' ]! n0 ?
8 `1 o v6 ?. R4 v I. g
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
% S0 U. E* v! c谢谢~!!!!!!! |