<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/qm/onlinemanual/000004" xml:lang="zh-cn">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">表达式的语法</Title>
		<Keyword ContextSensitive="No"><Level1>质量管理子系统 (QM) 中表达式的语法</Level1>
		</Keyword>
	</Header>
	<GeneralSection><List><ListIntro>下面说明的是与表达式的语法有关的几个概念：</ListIntro>
			<ListItem>变量（例如电压）</ListItem>
			<ListItem>运算符（例如乘法运算符）</ListItem>
			<ListItem>函数（例如舍入）</ListItem>
			<ListItem>示例</ListItem>
		</List>
		<GeneralSection><SectionTitle>变量</SectionTitle>
			<Paragraph class="Default"></Paragraph>
			<Paragraph class="Default">变量在<Link href="/baanerp/qm/ptc/qmptc0123m000" role="session">算法变量 (qmptc0123m000)</Link> 进程中定义，可在<Link href="/baanerp/qm/ptc/qmptc0122m000" role="session">算法变量 (qmptc0122m000)</Link> 进程中将其链接至相应特性。</Paragraph>
			<Paragraph class="Default">变量区分大小写，必须以大写字母输入才能视为正确变量。</Paragraph>
		</GeneralSection>
		<ExampleSection><SectionTitle>示例</SectionTitle>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TD rowspan="1" colspan="1">正确</TD>
						<TD rowspan="1" colspan="1">1D、TA、V1 等</TD>
					</TR>
					<TR><TD rowspan="1" colspan="1">不正确</TD>
						<TD rowspan="1" colspan="1">1d、Ta、ta、v1 等</TD>
					</TR>
				</TBODY>
			</TABLE>
		</ExampleSection>
		<GeneralSection><SectionTitle>运算符</SectionTitle>
			<GeneralSection><SectionTitle>算术运算符：</SectionTitle>
				<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TD rowspan="1" colspan="1">* / + -</TD>
							<TD rowspan="1" colspan="1">乘/除/加/减</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">\</TD>
							<TD rowspan="1" colspan="1">除法运算后的余数</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">&amp;</TD>
							<TD rowspan="1" colspan="1">链接字符串（字母数字数组）</TD>
						</TR>
					</TBODY>
				</TABLE>
			</GeneralSection>
			<GeneralSection><SectionTitle>逻辑运算符：</SectionTitle>
				<Paragraph class="Default">或、与、非</Paragraph>
				<Paragraph class="Default">逻辑运算符用在布尔表达式中。 这些表达式的结果为“真”或“假”。 逻辑值“真”相当于值 1，逻辑值“假”相当于值 0。</Paragraph>
			</GeneralSection>
			<GeneralSection><SectionTitle>关系运算符：</SectionTitle>
				<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TD rowspan="1" colspan="1">=</TD>
							<TD rowspan="1" colspan="1">等于</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">&lt;&gt;</TD>
							<TD rowspan="1" colspan="1">不等于</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">&gt;</TD>
							<TD rowspan="1" colspan="1">大于</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">&gt;=</TD>
							<TD rowspan="1" colspan="1">大于等于</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">&lt;</TD>
							<TD rowspan="1" colspan="1">小于</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">&lt;=</TD>
							<TD rowspan="1" colspan="1">小于等于</TD>
						</TR>
					</TBODY>
				</TABLE>
				<Paragraph class="Default">赋值命令的记录方式为：=</Paragraph>
			</GeneralSection>
			<GeneralSection><SectionTitle>表达式中的优先级：</SectionTitle>
				<Paragraph class="Default"></Paragraph>
				<List><ListItem>算术运算符优先于关系运算符</ListItem>
					<ListItem>关系运算符优先于逻辑运算符</ListItem>
					<ListItem>算术运算符的优先级顺序是：* / \ + -</ListItem>
					<ListItem>逻辑运算符的优先级顺序是：非、与、或</ListItem>
				</List>
			</GeneralSection>
			<Note><SectionTitle>注意</SectionTitle>
				<Paragraph class="Default">可以通过加圆括号来改变上述优先级顺序。</Paragraph>
			</Note>
			<ExampleSection><SectionTitle>示例</SectionTitle>
				<Formula space-and-orientation="indented-estimated"><Paragraph class="Default"> 3 + 4 * 5 = 23 (3 + 4) * 5 = 35 </Paragraph>
				</Formula>
			</ExampleSection>
		</GeneralSection>
		<GeneralSection><SectionTitle>函数</SectionTitle>
			<GeneralSection><SectionTitle>算术函数：</SectionTitle>
				<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TD rowspan="1" colspan="1">round(X,Y,Z)</TD>
							<TD rowspan="1" colspan="1">对 X 值进行舍入</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">-</TD>
							<TD rowspan="1" colspan="1">Y 表示小数位数</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">-</TD>
							<TD rowspan="1" colspan="1">Z 表示舍入方法（向下舍入 = 0，四舍五入 = 1，向上舍入 = 2）</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">abs(X)</TD>
							<TD rowspan="1" colspan="1">X 的绝对值 (abs(-10.3) = 10.3)</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">int(X)</TD>
							<TD rowspan="1" colspan="1">X 的整数值 (int(11.6) = 11)</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">pow(X,Y)</TD>
							<TD rowspan="1" colspan="1">乘方 (pow(10,2) = 100)</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">sqrt(X)</TD>
							<TD rowspan="1" colspan="1">X 的平方根 (sqrt(16) = 4)</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">min(X,Y)</TD>
							<TD rowspan="1" colspan="1">X 和 Y 中的最小值 (min(6,10) = 6)</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">max(X,Y)</TD>
							<TD rowspan="1" colspan="1">X 和 Y 中的最大值 (max(6,10) = 10 )</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">pi</TD>
							<TD rowspan="1" colspan="1">圆周率常量 (3.1415926... )</TD>
						</TR>
					</TBODY>
				</TABLE>
			</GeneralSection>
			<GeneralSection><SectionTitle>三角函数：</SectionTitle>
				<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TD rowspan="1" colspan="1">sin(X)，cos(X)，tan(X)</TD>
							<TD rowspan="1" colspan="1">X（弧度）的正弦、余弦或正切</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">asin(X)，acos(X)，atan(X)</TD>
							<TD rowspan="1" colspan="1">X 的反正弦、反余弦或反正切</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">hsin(X)，hcos(X)，htan(X)</TD>
							<TD rowspan="1" colspan="1">X 的双曲正弦、双曲余弦或双曲正切</TD>
						</TR>
					</TBODY>
				</TABLE>
			</GeneralSection>
			<GeneralSection><SectionTitle>对数函数：</SectionTitle>
				<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TD rowspan="1" colspan="1">exp(X)</TD>
							<TD rowspan="1" colspan="1">e 的 X 次幂</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">log(X)</TD>
							<TD rowspan="1" colspan="1">X 的自然对数（以 e 为底）</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">log10(X)</TD>
							<TD rowspan="1" colspan="1">X 的常用对数（以 10 为底）</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1"></TD>
							<TD rowspan="1" colspan="1"></TD>
						</TR>
						<TR><TD rowspan="1" colspan="1"></TD>
							<TD rowspan="1" colspan="1"></TD>
						</TR>
						<TR><TD rowspan="1" colspan="1"></TD>
							<TD rowspan="1" colspan="1"></TD>
						</TR>
					</TBODY>
				</TABLE>
				<Paragraph class="Default"></Paragraph>
			</GeneralSection>
			<GeneralSection><SectionTitle>日期函数：</SectionTitle>
				<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TD rowspan="1" colspan="1">time</TD>
							<TD rowspan="1" colspan="1">当前时间</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">date</TD>
							<TD rowspan="1" colspan="1">当前日期</TD>
						</TR>
						<TR><TD rowspan="1" colspan="1">date(d,m,y)</TD>
							<TD rowspan="1" colspan="1">以“日, 月, 年”格式表示的日期</TD>
						</TR>
					</TBODY>
				</TABLE>
				<Paragraph class="Default">例如，date(1,5,1991) = 1991 年 5 月 1 日</Paragraph>
				<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TD rowspan="1" colspan="1"></TD>
							<TD rowspan="1" colspan="1"></TD>
						</TR>
						<TR><TD rowspan="1" colspan="1"></TD>
							<TD rowspan="1" colspan="1"></TD>
						</TR>
						<TR><TD rowspan="1" colspan="1"></TD>
							<TD rowspan="1" colspan="1"></TD>
						</TR>
					</TBODY>
				</TABLE>
			</GeneralSection>
			<ExampleSection><SectionTitle>示例</SectionTitle>
				<Formula space-and-orientation="indented-estimated"><Paragraph class="Default"> 5 IN [12,30] = 0 15 IN [12,30] = 1 </Paragraph>
				</Formula>
			</ExampleSection>
		</GeneralSection>
	</GeneralSection>
</ManualTopic>
