2,496
社区成员
发帖
与我相关
我的任务
分享
procedure TRES_BOM_VIEW_F.btnSB_SearchClick(Sender: TObject);
begin
inherited;
try
RES_LOADING_F:=TRES_LOADING_F.Create(Self);
RES_LOADING_F.Label1.Caption:='正在檢索相關數據......';
RES_LOADING_F.Show;
RES_LOADING_F.Update;
CREATETREEVIEWMODEL;
finally
RES_LOADING_F.Close;
end;
end;
procedure TRES_BOM_VIEW_F.CREATETREEVIEWMODEL;
var
iLoop:Integer;
Master,MasterNode:TTreeNode;
begin
adoq_getop.Close;
//SELECT distinct PARN_TYP FROM WWW where parn_typ<>'.' and parn_typ is not null order by PARN_TYP desc
adoq_getop.SQL.Text:='SELECT distinct PARN_TYP FROM WWW where parn_typ<>''.'' and parn_typ is not null order by PARN_TYP desc';
adoq_getop.Open;
adoq_getop.First;
cx_TV.Items.BeginUpdate;
cx_TV.Items.Clear;
Master:=cx_TV.Items.Add(nil,'昆盈BOM表檢視');
while not adoq_getop.Eof do
begin
if adoq_getop.FieldByName('PARN_TYP').AsString<>'' then
begin
Screen.Cursor:=crSQLWait;
MasterNode:=cx_TV.Items.AddChild(Master,VarToStr(adoq_getop.FieldValues['PARN_TYP']));
Application.ProcessMessages;
qry_op.Close;
qry_op.SQL.Text:='SELECT DISTINCT PARN_LITM FROM WWW WHERE PARN_TYP='''+ VarToStr(adoq_getop.FieldValues['PARN_TYP'])+''' GROUP BY PARN_LITM';
qry_op.Open;
for iLoop:=0 to qry_op.RecordCount -1 do
begin
cx_TV.Items.AddChild(MasterNode,VarToStr(qry_op.FieldValues['PARN_LITM']));
qry_op.Next;
end;
Application.ProcessMessages;
cx_TV.Items.EndUpdate;
Screen.Cursor:=crDefault;
end;
adoq_getop.Next;
Application.ProcessMessages;
end;
{
ThreadTView:=cx_TV;
ViewThread:=TExpandLH.Create;
ViewThread.Resume;
}
end;