求助高手啊~!!! 感激不尽!5 r+ @1 i0 A" X0 T% ^9 a
/ g1 L, x+ F6 L" s
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:$ d; d+ o6 O0 r; _9 i3 w& _. t
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
! X) S/ r6 H& B* g0 s8 E- d***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
" O1 q: C g1 C% G
& Z$ b; j$ ^( Y; L* B, [
. M2 O( l M: `9 e' U( Z3 b( E2 z0 Z+ tif (inv1<=ss1 and inv2>ss2 and inv3>ss3); g5 R, }8 p" b- ^/ _2 i3 M' _5 R
out1=S1-inv1;: [0 V5 |3 z/ z
out2=0;! {" o* l7 W9 L. I: L
out3=0; /货品1需要补货/
! V6 M; ~ r$ ]: C5 @& j" ?, F3 K# k! j4 P4 _ _+ _
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)6 H: x5 i" b7 }3 c; h0 |
out1=0;
" O) T- U" Q$ R9 F {0 mout2=S2-inv2;
5 ^" {/ q8 s0 N* Iout3=0; /货品2需要补货/
0 i+ N- i) w7 p+ o" ~7 V" I- k, G
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)
/ _5 h' T @8 B( e) N' E* @- Q( Yout1=0;
& ~/ N3 i1 ]- K* Q: Uout2=0;( h: J. Z, J4 I2 i/ v" k' ^
out3=S3-inv3; /货品3需要补货/7 o- A0 t* D1 a6 D! v
, l! Y# a+ O/ Z2 {' }
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
/ R: m* [7 P4 L: jout1=S1-inv1;
/ m. `4 w4 V& c, w% y" p3 y- vout2=S2-inv2;3 ^% S* p+ s. `; T* p8 a O2 z
out3=0; /货品1,2需要补货/2 @/ O) c0 M' M7 m
9 F+ p5 x3 m" `0 F# y
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)
# n) t X3 c5 p; \out1=S1-inv1;
6 B" Q( j# J5 y0 n ^, zout2=0;6 q8 Q! J, b# p& ^, h3 h. O
out3=S3-inv3; /货品1,3需要补货/- D8 d# B) ~3 I9 V
( c" p+ p. t7 S1 f7 _. V( delse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
2 s& D; J# {/ F" J, e O5 Q, j/ Lout1=0;; M3 E7 Q# y6 N5 [# T7 Z
out2=S2-inv2;% h- v. E* y. F* o3 e' z1 O$ g
out3=S3-inv3; /货品2,3需要补货/, P6 [2 j" s- s) V$ I( t! K6 R& T
9 w( G3 p* q4 n9 O* T2 t' w
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)& Y/ ~) `9 ^. f5 w' c& V& F) ^, V
out1=S1-inv1;
: Q( T% w# A5 C6 cout2=S2-inv2;1 D. [. d$ `9 Y. `
out3=S3-inv3; /货品1,2,3需要补货/
, v5 ?. w' N4 N, P9 k. \* P- ]2 ?, z
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",9 n: ?9 c: K2 ?
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.3 o/ e8 _5 X U" {( Q& q
. e( |2 w3 }0 d1 f9 O7 g& m9 ]& l请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?1 r! S5 b* P. S6 P% s0 _7 X
谢谢~!!!!!!! |