求助高手啊~!!! 感激不尽!
9 R/ C0 M. ]7 l' s& G
; n0 K& e- L Q* c# N8 e( z- q如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
1 c, R4 X1 l/ l7 n& N***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********
" z8 l' C" r4 J3 }; T) i# Y6 n***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
0 Y$ Q4 x& l) z/ ]" G: X0 B) _- g
7 b# P- L3 N# i. s8 F1 f4 A; m
2 `9 W- V' m' d9 V& D; gif (inv1<=ss1 and inv2>ss2 and inv3>ss3)+ `7 a9 S+ d" [5 V/ K
out1=S1-inv1;
, ?8 T" {* R/ P( r; `. Dout2=0;
5 N: J) q5 i, m3 E' fout3=0; /货品1需要补货/
1 y3 J; ]4 @ C
- R) \% H5 m2 M9 Gelse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
% b* J3 D1 M9 f( C# o* cout1=0;8 x# F1 n! g' M D% D
out2=S2-inv2;, p; E6 M+ C+ W0 U- e
out3=0; /货品2需要补货/& n8 L& b- |3 t' Z7 D; h
0 m: S4 C% D c4 t7 Eelse if (inv1>ss1 and inv2>ss2 and inv3<=ss3)4 ~3 q9 T9 J& {2 J; M0 R
out1=0;
+ y6 h$ A' |! E1 O4 j; V( ^. L1 rout2=0;# Y9 ]4 e8 D* t+ d% h* j: J" D$ W
out3=S3-inv3; /货品3需要补货/( r0 t: B' `& x" H
/ n3 q( P* ] G1 J
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)) J+ E6 v, I. G* u6 n
out1=S1-inv1;5 y* J# F% G" \2 F: E! Z4 \
out2=S2-inv2;7 w; o1 b; U6 C* o
out3=0; /货品1,2需要补货/
+ z- y; Y y$ M
+ X9 `% A* N8 u5 G- k& |else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3) `: ]) I Y' g
out1=S1-inv1;9 {: E2 ?* S* U. O
out2=0;
% }, @; U* M d* `1 dout3=S3-inv3; /货品1,3需要补货/5 i4 }% [4 v+ c/ M+ L6 S
/ _$ {* [" G* s
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3); ^, c8 ]4 d! J2 ^
out1=0;
7 U3 M7 X, t2 G4 Pout2=S2-inv2;1 z( T3 ~7 E/ q$ h; c+ p
out3=S3-inv3; /货品2,3需要补货/- z! a7 E- i( t0 \" U3 e0 n! K
1 B+ H, A- h9 t8 V6 {8 F1 Ielse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3); v% d( s( e( Y- ?0 B% a% j
out1=S1-inv1;
4 S6 p$ y3 m% M# R; d% _out2=S2-inv2;* l1 p3 q {9 C/ U+ R
out3=S3-inv3; /货品1,2,3需要补货/
3 x- N/ N1 d+ X) J* T x
" u- Z( F' N+ H5 K9 H问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE..."," E: ~; b" p h$ G8 p
但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
/ X! z- O# {* o$ @0 h8 @6 B. T7 X7 m% L3 A) A( z
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?! c) p5 r% R+ l# Z6 u1 K. W0 U. H0 L
谢谢~!!!!!!! |