求助高手啊~!!! 感激不尽!
. }) U- l) G* w
& S6 T9 _7 J2 R% s% z0 f9 U如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
" F* {' a( }' E; g6 y ]***********其中inv1,2,3分别表示3种货品各自的库存量, ss1,2,3分别表示各自的安全库存 ***********" Z, e# L* s% m [4 N) Y
***********S1,2,3分别表示各自的最大库存, out1,2,3分别为各自的补货量***********
' V6 R% s7 }) d, N1 Q; f0 S$ n u/ O7 @! \2 f. D" m9 E; W
n! {3 `7 f$ M: P+ n1 p( p/ E3 q
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
) H. i' G8 l" bout1=S1-inv1;
- J2 \$ q! d% E, Y( Eout2=0;
- b/ a0 _: Y. v1 s% L! Iout3=0; /货品1需要补货// y) ?2 p4 M0 S
$ w+ O3 @6 `6 t; t. Qelse if (inv1>ss1 and inv2<=ss2 and inv3>ss3)' K4 c0 b: V' [9 Y
out1=0;
4 G9 R4 \8 \, \7 v5 J$ W1 J8 Q4 \out2=S2-inv2;6 I2 S# B6 C: a
out3=0; /货品2需要补货/3 N2 f% J$ v( \; I4 A" g
# `8 I* j1 r0 H; f& A7 |9 [2 l, Y
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)* W, Z- J9 @6 G
out1=0;. R* u4 ~7 K2 Y5 x) z
out2=0;4 {0 @. N& X2 Y
out3=S3-inv3; /货品3需要补货/
! q0 y; ~& G8 [# ]2 H+ e$ m: K2 R g" Q
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
; L& ~, o6 K" n! B- [, Lout1=S1-inv1;( Z9 B7 v. w7 x6 V6 C" P; j
out2=S2-inv2;
. ]/ `! G$ q- g( g6 C/ rout3=0; /货品1,2需要补货/7 P1 C( @% G( Y
1 c% U/ r8 O' D& p9 m% {* z# Y4 c
else if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)
) N- E. F( C0 [+ X$ Wout1=S1-inv1;7 ~* [2 \+ C1 x: r5 h: z
out2=0;
3 j) h4 D0 J! r8 S# Z3 ^out3=S3-inv3; /货品1,3需要补货/
# p* ~0 n; q9 r. R/ R
: m. v* [! j. \" t. [$ A8 j% selse if (inv1>ss1 and inv2<=ss2 and inv3<=ss3); ]5 @: C z) Z2 Z/ J- L5 G% Y
out1=0;/ |! g( M" W! y: d& U9 O
out2=S2-inv2;
7 B0 [* ?& a, a1 w/ \' O$ x# R" ^out3=S3-inv3; /货品2,3需要补货/
. N+ J$ l! y+ f+ E- S1 [' L# E* W# T: W/ z+ [
else if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)" a9 M. V' c0 i4 R) e4 Y
out1=S1-inv1;
* b2 G) ]$ G" v+ N5 O# q! K% B4 G/ Wout2=S2-inv2;# J2 U' Q. [: R2 n7 t* T
out3=S3-inv3; /货品1,2,3需要补货/# Y. I: ^9 Z: F+ I; S
) z- |( A# K$ B7 z8 b问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
9 C& Y9 a2 f5 u* H# M但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
/ B. P5 ]( M8 Y! q$ G; P8 i! x: x1 n* \' Z
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?% Q- n1 @ h: o& t# S/ R1 r
谢谢~!!!!!!! |