2,495
社区成员
发帖
与我相关
我的任务
分享
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;
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;
function Insdata(con:TADOConnection;StrWoSN,StrLotSN,StrNumberSN:string;ChBox:TCheckBox):Boolean;
begin
if not ChBox.Checked then
begin
try
con.BeginTrans;
con.Execute('insert into ServerData(NumberSN,WoSN,LotSN)values('+''''+StrNumberSN+''''+','+''''+StrWoSN+''''+','+''''+StrLotSN+''''+')');
con.CommitTrans;
Result:=True;
except
con.RollbackTrans;
ShowMessage('數據記錄重復!請確認!!!');
Result:=False;
end;
end
else
Result:=True;
end;
function TRes_HrCq_HBD_F.ReturnBM(bm:string):string;
var
Temp:TStrings;
i:Integer;
begin
Temp:=TStringList.Create;
Result:='';
try
Temp.DelimitedText:=bm;
Temp.Delimiter:=',';
for i:=0 to Temp.Count -1 do
Result:=Result+QuotedStr(Temp[i])+',';
Result:=Copy(Result,1,Length(Result)-1);
finally
Temp.Free;
end;
end;
function IntToStr(Value: Integer): string;
// FmtStr(Result, '%d', [Value]);
asm
PUSH ESI
MOV ESI, ESP
SUB ESP, 16
XOR ECX, ECX // base: 0 for signed decimal
PUSH EDX // result ptr
XOR EDX, EDX // zero filled field width: 0 for no leading zeros
CALL CvtInt
MOV EDX, ESI
POP EAX // result ptr
{$IF DEFINED(Unicode)}
CALL System.@UStrFromPCharLen
{$ELSE}
PUSH DefaultSystemCodePage
CALL System.@LStrFromPCharLen
{$IFEND}
ADD ESP, 16
POP ESI
end;
定义函数 funtion 函数名({参数}):返回值类型;
function FUNC():string;//无参数函数
begin
end;
function FUNC(const A:integer):string;//常数参数函数
begin
end;
function FUNC(A:integer):string;//传值参数函数
begin
end;
function FUNC(var A:integer):string;//传址参数函数
begin
end;
调用 Edit1.Text:=FUNC();//无参数函数返回值
Edit1.Text:=FUNC(1);//带参数函数返回值
还有
function Func(out A:string):boolean;
begin
end;
调用
var
str:string;
if Func(str) then
begin
Edit1.Text:=str;
end;
procedure swap(x, y: integer);
begin
x := x xor y;
y := y xor x;
x := x xor y;
end;
定义函数 funtion 函数名({参数}):返回值类型;
function FUNC():string;//无参数函数
begin
end;
function FUNC(const A:integer):string;//常数参数函数
begin
end;
function FUNC(A:integer):string;//传值参数函数
begin
end;
function FUNC(var A:integer):string;//传址参数函数
begin
end;
调用 Edit1.Text:=FUNC();//无参数函数返回值
Edit1.Text:=FUNC(1);//带参数函数返回值