过程里面写过程的意义
例如:
procedure TF_ImportStockSector.SetImportData;
procedure CalcData(icNode: TdxTreeListNode; iiID: Integer);
var
BondPoolStrings: TStrings;
lcNodeTemp: TdxTreeListNode;
j: Integer;
lsID: String;
begin
if icNode.HasChildren then
begin
BondPoolStrings := TStringList.Create;
BondPoolStrings.Add(IntToStr(iiID));
BondPoolStrings.Add(icNode.Strings[0]); //库名称
BondPoolStrings.Add('-'); //库类型
BondPoolStrings.Add('-'); //证券代码
BondPoolStrings.Add('-'); //交易市场
lsID := IntToStr(UCommonOthers.GC_GetGenerateCode('pm_securities_sector',1));
BondPoolStrings.Add(lsID);//股票库ID
ImportData.Add(BondPoolStrings);
for j := 0 to icNode.Count - 1 do
begin
lcNodeTemp := icNode.Items[j];
//计算汇总数据,递归调用
CalcData(lcNodeTemp,StrToInt(lsID));
end;
end
else
begin
BondPoolStrings := TStringList.Create;
if icNode.Strings[2] = '' then
begin
BondPoolStrings.Add(IntToStr(iiID));
BondPoolStrings.Add(icNode.Strings[0]); //库名称
BondPoolStrings.Add('-'); //库类型
BondPoolStrings.Add('-'); //证券代码
BondPoolStrings.Add('-'); //交易市场
lsID := IntToStr(UCommonOthers.GC_GetGenerateCode('pm_securities_sector',1));
BondPoolStrings.Add(lsID);//股票库ID
end
else
begin
BondPoolStrings.Add('0'); //父ID
BondPoolStrings.Add('-'); //库名称
BondPoolStrings.Add('-'); //库类型
BondPoolStrings.Add(icNode.Strings[1]); //证券代码
BondPoolStrings.Add(icNode.Strings[0]); //交易市场
BondPoolStrings.Add(IntToStr(iiID)); //库ID
end;
ImportData.Add(BondPoolStrings);
end;
end;
var
i: Integer;
begin
for i := 0 to Grid.Count - 1 do//Iterate
begin
CalcData(Grid.Items[i],0);
end;
end;
过程里面写过程是为什么,和我直接写在过程外边的过程有什么地方不一样吗