unit U_SLT; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, jpeg, cxControls, cxContainer, cxEdit, cxImage, IdFTP, ShellAPI, cxGraphics, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters, Data.DB, Data.Win.ADODB; type TfrmSLT = class(TFrame) cxImage1: TcxImage; Panel1: TPanel; ADOQueryTemp: TADOQuery; procedure cxImage1DblClick(Sender: TObject); private CYID, FileName: string; { Private declarations } public procedure Init(fCYID: string; fFileName: string; fPicture: TJpegImage); { Public declarations } end; implementation uses U_DataLink, U_RTFun; {$R *.dfm} procedure TfrmSLT.Init(fCYID: string; fFileName: string; fPicture: TJpegImage); begin CYID := trim(fCYID); FileName := trim(fFileName); Panel1.Caption := FileName; cxImage1.Picture.Assign(fPicture); end; procedure TfrmSLT.cxImage1DblClick(Sender: TObject); var IdFTP1: TIdFTP; FPath, FFName: string; FInt: integer; mfileSize: Integer; mCreationTime: TdateTime; mWriteTime: TdateTime; begin try IdFTP1 := TIdFTP.Create(self); IdFTP1.Host := PicSvr; IdFTP1.Username := 'three'; IdFTP1.Password := '641010'; IdFTP1.Connect(); except IdFTP1.Quit; IdFTP1.Free; Application.MessageBox('无法连接到文件服务器,请检查!', '提示', MB_ICONWARNING); Exit; end; FPath := 'D:\Right1209\'; if not DirectoryExists(ExtractFileDir(FPath)) then CreateDir(ExtractFileDir(FPath)); FFName := Trim(FileName); FFName := FPath + FFName; if FileExists(FFName) then begin FInt := 1; GetFileInfo(FFName, mfileSize, mCreationTime, mWriteTime); with ADOQueryTemp do begin Close; SQL.Clear; SQL.Add('select TFID,WBID,TFDate,Files,Filler,FillTime,FileName from TP_File '); SQL.Add(' where FileName=''' + Trim(FileName) + ''''); SQL.Add(' and FileType=''YP'' '); SQL.Add(' and TFDate>''' + FormatDateTime('yyyy-MM-dd hh:nn:ss', mWriteTime) + ''''); // ShowMessage(SQL.Text); Open; end; if not ADOQueryTemp.IsEmpty then begin if FileExists(FFName) then DeleteFile(FFName); FInt := 0; end; end; if FInt <> 1 then IdFTP1.Get(UserDataFlag + 'YP\' + FileName, pchar(FFName)); if IdFTP1.Connected then begin IdFTP1.Quit; IdFTP1.Free; end; ShellExecute(Handle, 'open', PChar(FFName), '', '', SW_SHOWNORMAL); end; end.