求助高手啊~!!! 感激不尽!
2 W F* a) `6 R M
* w9 l a, c8 V# Q1 z如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:+ K- l$ u, ?; r9 b
***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
- U* N: V8 P; x a5 W***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
) J' m( f* y/ x/ U& [* y( Q' P
. \( q, M# B' r0 V3 W
l% j m) `8 {: l4 Mif (inv1<=ss1 and inv2>ss2 and inv3>ss3)7 P% C; \7 K& z H, H/ Z9 F3 h
out1=S1-inv1;
$ X% R6 {. s0 ]7 V# j; p2 e4 {& _out2=0;+ r& [$ p; O6 d
out3=0; /货品1需要补货/' u( E8 ]6 U! i/ `+ J- D
# L6 j: Z, N. c& b8 g! x: Lelse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)* l6 f! i& ^* v/ [
out1=0;
! v6 v* r; x, n! }3 _, ?out2=S2-inv2;# i2 ^7 e/ k/ H4 [$ y# f0 d& t+ Q
out3=0; /货品2需要补货/6 [' q& Q7 N: K8 X/ U
3 R9 D2 E3 s2 d5 e( F5 o" celse if (inv1>ss1 and inv2>ss2 and inv3<=ss3). h6 x# ^/ w9 L( I2 M& v
out1=0;
; @1 C7 z1 T( V. ]! V! |out2=0;% Y1 z" ~7 C1 _
out3=S3-inv3; /货品3需要补货// _; X: {& J* O7 x$ P i- l$ @ A8 c6 z
$ B$ Y' G) n+ g$ F7 e
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)4 |) O8 m& Z8 u% U& `( c
out1=S1-inv1;
/ D b% a( [* P8 Cout2=S2-inv2;! ^6 r* ?: G/ S( a4 O
out3=0; /货品1,2需要补货/9 a/ X5 Q' y; h; s% Q/ t9 g
& R+ u/ G: q: Q" Y/ ]else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)) T% i d: }- A7 |6 e7 n
out1=S1-inv1;
7 C Z0 Y. _$ [1 a( ?$ A/ ?0 Nout2=0;
H8 s7 W+ Z! nout3=S3-inv3; /货品1,3需要补货/5 G0 u8 ^. L4 S5 G! E7 t
1 Z1 R7 t( I! ]6 Q7 ~$ s
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
5 J x3 d5 {- H* Pout1=0;
' b4 n6 N+ x( h) d9 \* J; Tout2=S2-inv2;' i! H3 H2 a. R0 `2 G( g1 N+ T
out3=S3-inv3; /货品2,3需要补货/
z( o( f4 {8 g6 ~9 \
* [) K* v; U* h$ c1 f; G" {else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)
2 ^ c" y; X. T; U5 u- r% sout1=S1-inv1;
* { U2 C/ Q- ~' Rout2=S2-inv2;
- Z, h4 c: V8 D5 }out3=S3-inv3; /货品1,2,3需要补货/
$ g1 R. y9 z6 k" _
% W$ }6 h* x% w$ h, R! o* M5 [问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",% J" y( G9 o8 ^: w" U
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.. Q+ }& D# l& N: R( x3 c- N- h: [/ I
, s# L4 ?, T- y {: x
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?
) V- s% j6 n3 l! R' c* T) v/ y, r谢谢~!!!!!!! |