求助高手啊~!!! 感激不尽!9 J. {" `# I# \- T _0 C! U) c
& A! F8 X1 {6 W! }' Z0 A( M9 r
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
; Z: h; n6 c# x$ f. X( B# N***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********. ]& s$ T( }7 b4 Y! \- _/ D
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
8 }2 p9 `& s) u% K. p; x+ c
, z; H8 A- H. E- x0 `9 v: S4 Y/ f! S+ H1 X+ k7 [
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
& ^5 y8 J! f( c% k3 H' k1 Y5 Oout1=S1-inv1;1 E t! C) n7 B: \/ {* d& r
out2=0;
' ?* z3 [1 w* I: U( r' J' Kout3=0; /货品1需要补货/
" m! g9 Z y" @ ^. b# M- M
! e9 Y9 k# X8 p: pelse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)7 i3 l; M1 T/ P, V! x x
out1=0;" E4 x. t" N6 x1 `$ ?/ z
out2=S2-inv2;
- }* V& r" x7 |* @9 y& {3 S& |out3=0; /货品2需要补货/1 x- W- U2 v% d; w3 ]( C
& ]( Q( A. N- g
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)) `8 s+ i9 L5 M& l
out1=0;- K' `' {7 ]4 D% O1 T: d# o
out2=0;3 Q' G. c0 a6 a" H6 u
out3=S3-inv3; /货品3需要补货/$ W6 o; g2 D u& }9 F' ^
, K9 [* H. F& C$ ~" I
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)" c- d1 ~6 z1 f8 @! V. W e" M1 H
out1=S1-inv1;
' [( w7 Y7 i! Y% e% d. eout2=S2-inv2;$ `8 J5 Q: P+ C- m! T, D# Q( Q
out3=0; /货品1,2需要补货/
1 [, A5 V Q/ g* \6 Z; s
a ]: W2 d" `) n L% Delse if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)
% u. M7 L& C, k; ?( w8 yout1=S1-inv1;3 Q/ e- v4 i* }3 U5 A
out2=0;, M8 v$ r- x) \' y) ?, C
out3=S3-inv3; /货品1,3需要补货/! w. a; i9 u2 s: v9 X$ |, {; U
! V, r) z" ~! ]5 V9 w$ q
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
* M7 ?& K* D' }* Q: ~4 Nout1=0;; H, g0 U U% j& X
out2=S2-inv2;
' S$ q7 D: s* g9 R9 H0 y9 @) vout3=S3-inv3; /货品2,3需要补货/ L0 m9 ]1 h8 I( k1 m
; y& f! J1 L) k( c) @7 D: ?else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)8 M! j- R( @" p3 r$ C7 B
out1=S1-inv1;
4 X& p4 [3 @; X% J5 V. H$ G8 I6 Bout2=S2-inv2;2 p X- T; M c1 X. ]+ J
out3=S3-inv3; /货品1,2,3需要补货/
! |$ L0 i& f; r7 A5 e& R# M3 ~1 W v# @ M1 p6 C
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",5 [9 a0 @2 Z- H
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.1 D6 P6 x0 X7 _
7 S5 s' Q y% C: j+ k5 b; W0 W
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?- M7 k9 c$ O7 |/ w* y* [& x# S
谢谢~!!!!!!! |