求助高手啊~!!! 感激不尽!+ D. {0 L7 N+ s4 U: j6 ~+ Z! s
9 b: F t, [' O/ S: [' c4 o
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
~# s% e/ b9 ]3 ^8 ^- C***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********" _2 J9 v) N7 h. `& W+ o# n
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
& W5 p! v( | ?3 G+ q
! b% J6 C' n9 B4 D$ I, g* G' ?9 H3 d' k) K4 v. d d# W
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
! a6 q+ h4 L5 w- e3 ~- Pout1=S1-inv1;
9 C; c( O+ ~1 a u+ X2 jout2=0;
, I& V: K3 x' p5 V' gout3=0; /货品1需要补货/% V* S( K; p; Y/ n1 A
* R2 P7 }+ {1 H' W+ aelse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)( Z$ S4 h& e& Q4 w5 l" `
out1=0;2 T5 r: R7 u1 h8 P3 C% w
out2=S2-inv2;
$ R4 H: U9 j0 R% kout3=0; /货品2需要补货/- j7 a" V4 n7 c/ M+ I' a) o+ r" d
7 F+ @& w( Y% m* Felse if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
/ ?/ f+ v& e" D+ R. G7 I/ hout1=0;
" t/ s$ i9 R# L' Dout2=0;) X2 c! ?. P' Z9 B+ _. V; q
out3=S3-inv3; /货品3需要补货/
; X( U8 l6 }. V& d% a- J' g9 q+ H* i8 ~ S5 V
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)7 V9 }4 ~ {, ~
out1=S1-inv1;
0 ?( [% {7 n( I% J* ^" I. a9 f% oout2=S2-inv2;
' l. n% ], ]- U' ?5 C% rout3=0; /货品1,2需要补货/
0 i3 s- Q. T" Z/ `; D* O
* y- h, Z0 b9 ~% B8 felse if (inv1<=ss1 and inv2>ss2 and inv3<=ss3), U" Y1 ^6 \+ ` h' s; h% S
out1=S1-inv1;
5 e* ^5 l* Z$ ` rout2=0;
% h( t s2 d! ?4 X: _2 zout3=S3-inv3; /货品1,3需要补货/; j) N2 p; P. t$ U6 A- A3 F
' O1 i6 `) t$ Nelse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)" V- F3 E7 ?+ n: p# R
out1=0;
% v, j# K; K, X8 Aout2=S2-inv2;9 P& T: G# ^! b2 A" {; A9 B* N
out3=S3-inv3; /货品2,3需要补货/
9 Z; I1 d& q: T3 a2 A
/ g# R' X6 x) J, h- melse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3): J: j- T4 d& Z+ N
out1=S1-inv1;
9 ]) r# P* p9 Lout2=S2-inv2;7 w- Z$ Z' l. i# U
out3=S3-inv3; /货品1,2,3需要补货/1 ~! p9 }7 Z" h; }, L p
- H* Z7 r1 V0 `7 n, a' ]
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
& ?7 ]6 ^ B' u \但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.. f* Y/ x; x. U X/ x- R3 x* S
1 z4 n+ v) G4 [( j( `6 t请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?% q4 `1 U4 @# K. E
谢谢~!!!!!!! |