Merge remote-tracking branch 'origin/main'
This commit is contained in:
@ -741,10 +741,53 @@ end.
|
|||||||
|
|
||||||
## 整数判断
|
## 整数判断
|
||||||
|
|
||||||
想要达到的:物料 **启用库存周期复检** 时,**复检周期须不小于0** 且 **不小于提醒提前期**
|
举例:物料 **启用库存周期复检** 时,**复检周期须不小于0** 且 **不小于提醒提前期**
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
脚本:
|
||||||
|
// 定义变量存储转换后的整数数值
|
||||||
|
var StockCycle, LeadDay: Integer;
|
||||||
|
begin
|
||||||
|
// 注释:在下面添加您的脚本代码
|
||||||
|
if cbxusr_FEnableCyclistQCSTK. checked = true then
|
||||||
|
begin
|
||||||
|
|
||||||
|
try
|
||||||
|
// 将输入框文本转换为整数
|
||||||
|
StockCycle := StrToInt(fedtusr_FStockCycle.Text);
|
||||||
|
LeadDay := StrToInt(fedtusr_FEWLeadDay.Text);
|
||||||
|
except
|
||||||
|
on E: EConvertError do
|
||||||
|
begin
|
||||||
|
ShowMessage('复检周期或提醒提前期输入格式错误,请输入有效的整数!');
|
||||||
|
if Pos(fedtusr_FStockCycle.Text, E.Message) > 0 then
|
||||||
|
fedtusr_FStockCycle.SetFocus
|
||||||
|
else
|
||||||
|
fedtusr_FEWLeadDay.SetFocus;
|
||||||
|
Abort;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// 检查复检周期是否大于提醒提前期,若不满足则提示错误
|
||||||
|
if not (StockCycle > LeadDay) then
|
||||||
|
begin
|
||||||
|
ShowMessage('启用库存周期复检时,复检周期必须大于提醒提前期,请重新设置!');
|
||||||
|
fedtusr_FStockCycle.SetFocus; // 将焦点定位到复检周期输入框
|
||||||
|
Abort; // 终止后续操作,防止错误数据提交
|
||||||
|
end;
|
||||||
|
|
||||||
|
// 检查复检周期是否小于0
|
||||||
|
if StockCycle < 0 then
|
||||||
|
begin
|
||||||
|
ShowMessage('启用库存周期复检时,复检周期不能小于0,请重新设置!');
|
||||||
|
fedtusr_FStockCycle.SetFocus;
|
||||||
|
Abort;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
前置条件:
|
前置条件:
|
||||||
// 定义变量存储转换后的整数数值
|
// 定义变量存储转换后的整数数值
|
||||||
|
Reference in New Issue
Block a user