Selaa lähdekoodia

附件,下载附件时,记住用户下载路径,可通过打开按钮打开

MaiXinRong 6 vuotta sitten
vanhempi
commit
39aa5c2c18

+ 52 - 3
Forms/UpFileFrame.dfm

@@ -52,13 +52,13 @@ object UpFileView: TUpFileView
   object pnlPlay: TPanel
     Left = 189
     Top = 12
-    Width = 64
+    Width = 68
     Height = 29
     Color = clTeal
     TabOrder = 0
     Visible = False
     object btnPlay: TPNGButton
-      Left = 0
+      Left = 56
       Top = 0
       Width = 28
       Height = 30
@@ -345,7 +345,7 @@ object UpFileView: TUpFileView
       OnClick = btnPlayClick
     end
     object btnDelete: TPNGButton
-      Left = 31
+      Left = 33
       Top = 0
       Width = 23
       Height = 30
@@ -475,6 +475,55 @@ object UpFileView: TUpFileView
       ShowHint = True
       OnClick = btnDeleteClick
     end
+    object btnOpen: TPNGButton
+      Left = 7
+      Top = 0
+      Width = 24
+      Height = 30
+      Hint = #25171#24320
+      Layout = pbsImageLeft
+      Spacing = 0
+      ImageNormal.Data = {
+        89504E470D0A1A0A0000000D4948445200000018000000180806000000E0773D
+        F80000000473424954080808087C086488000000097048597300000099000000
+        9901708F607C0000001974455874536F667477617265007777772E696E6B7363
+        6170652E6F72679BEE3C1A0000018F4944415478DAB5D5CB2B056118C7F1F7E4
+        7616885C4A2965212C45166281382E595860C14A94582A0B3BC95F20A548C952
+        59B0648152AE858D7BA2140B978DCD71FB3ECD7B6A8CCECC3B86A73E75E6EDBC
+        F39B799A6726A4BE5722AA90A4DCEB0147CAA0428EE33134E0C6654FAAFE4F17
+        16FD06CC62054B2E7B32708917F463F53F028E3184193463F72F0352B0863032
+        718D3ABF01DBC8F368EF930E9946B5DF8016B47B04489B064C029AD08D75541A
+        B4C85EA52601CFD8C01C5AFF23E043FFF1C4D6A27A443C4E7E8A611D508BA85B
+        4089DE100B3844A147C03DDE75C00272306E1AE0B74512D0A9EFC42840D6D3F5
+        C63797806C34220D1D7E02B2B08709E41ADC89B44786EECCB17EEBD622790DF4
+        1AB62A5EED48C0278A1D01FB384772C08048BC0019BEBE8027DF448D33600AF3
+        CA9AEAA0572F1FAE2D6740014694F58E0952CB68931FCE807C5C28EB95FCDB92
+        87A64C59C3FA2360128301AF5E66A72776100BA8C09DB23E85E100278FEA8BBD
+        B207C8235984576536546E2583396A5F900019F37224043CF9230E9C8B5F8791
+        71D8BE0809E60000000049454E44AE426082}
+      ImageOver.Data = {
+        89504E470D0A1A0A0000000D4948445200000018000000180806000000E0773D
+        F80000000473424954080808087C086488000000097048597300000099000000
+        9901708F607C0000001974455874536F667477617265007777772E696E6B7363
+        6170652E6F72679BEE3C1A0000018F4944415478DAB5D5CB2B056118C7F1F7E4
+        7616885C4A2965212C45166281382E595860C14A94582A0B3BC95F20A548C952
+        59B0648152AE858D7BA2140B978DCD71FB3ECD7B6A8CCECC3B86A73E75E6EDBC
+        F39B799A6726A4BE5722AA90A4DCEB0147CAA0428EE33134E0C6654FAAFE4F17
+        16FD06CC62054B2E7B32708917F463F53F028E3184193463F72F0352B0863032
+        718D3ABF01DBC8F368EF930E9946B5DF8016B47B04489B064C029AD08D75541A
+        B4C85EA52601CFD8C01C5AFF23E043FFF1C4D6A27A443C4E7E8A611D508BA85B
+        4089DE100B3844A147C03DDE75C00272306E1AE0B74512D0A9EFC42840D6D3F5
+        C63797806C34220D1D7E02B2B08709E41ADC89B44786EECCB17EEBD622790DF4
+        1AB62A5EED48C0278A1D01FB384772C08048BC0019BEBE8027DF448D33600AF3
+        CA9AEAA0572F1FAE2D6740014694F58E0952CB68931FCE807C5C28EB95FCDB92
+        87A64C59C3FA2360128301AF5E66A72776100BA8C09DB23E85E100278FEA8BBD
+        B207C8235984576536546E2583396A5F900019F37224043CF9230E9C8B5F8791
+        71D8BE0809E60000000049454E44AE426082}
+      ButtonStyle = pbsNoFrame
+      ParentShowHint = False
+      ShowHint = True
+      OnClick = btnOpenClick
+    end
   end
   object pnlOrder: TPanel
     Left = 56

+ 19 - 0
Forms/UpFileFrame.pas

@@ -27,12 +27,14 @@ type
     pnlOrder: TPanel;
     btnUp: TSpeedButton;
     btnCancel: TSpeedButton;
+    btnOpen: TPNGButton;
     procedure btnCancelClick(Sender: TObject);
     procedure btnUpClick(Sender: TObject);
     procedure btnPlayClick(Sender: TObject);
     procedure lblFileClick(Sender: TObject);
     procedure FrameClick(Sender: TObject);
     procedure btnDeleteClick(Sender: TObject);
+    procedure btnOpenClick(Sender: TObject);
   private
     FOwner: TObject;
     FData: TUpFile;
@@ -316,5 +318,22 @@ begin
   RefreshStatus(Data.Status);
 end;
 
+procedure TUpFileView.btnOpenClick(Sender: TObject);
+var
+  sDownFile: string;
+begin
+  sDownFile := TProjectData(FProjectData).AttachmentInfoData.GetAttachmentPath(Data.WebID);
+  if (sDownFile <> '') then
+  begin
+    if FileExists(sDownFile) then
+      ShellExecute(0, 'open', PChar(ExtractFileName(sDownFile)), '', PChar(ExtractFilePath(sDownFile)), SW_SHOWNORMAL)
+    else
+      TipMessage('当前文件不存在,请重新下载');
+  end
+  else if FileExists(Data.LocalFile) then
+    ShellExecute(0, 'open', PChar(ExtractFileName(Data.LocalFile)), '', PChar(ExtractFilePath(Data.LocalFile)), SW_SHOWNORMAL)
+  else
+    TipMessage('当前文件不存在,请重新下载');
+end;
 
 end.

+ 1 - 0
Forms/UpFileManageFrame.pas

@@ -379,6 +379,7 @@ begin
         Selected.Data.Status := ufsNormal;
         sName := ExtractFileName(sFile);
         sPath := ExtractFilePath(sFile);
+        TProjectData(FProjectData).AttachmentInfoData.SaveAttachmentPath(Selected.Data.WebID, sFile);
         ShellExecute(Handle, 'open', pchar(sName), nil, pchar(sPath), SW_SHOWNORMAL);
       end
       else

+ 1 - 1
Units/Connections.pas

@@ -8,7 +8,7 @@ uses
 const
   ProductName = 'Measure';
   EmptyFileVersion = '1.0.0.0';
-  FileVersion = '1.0.1.21';
+  FileVersion = '1.0.1.22';
   EncryptVersion = 'Auto1.0';
   SAdoConnectStr = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;' +
                    'User ID=Admin;Password='''';Persist Security Info=True';

+ 8 - 0
Units/DataBaseTables.pas

@@ -807,6 +807,14 @@ const
     (FieldName: 'EndTotalPrice'; FieldType: ftDouble; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
 
+  SAttachmentInfo = 'AttachmentInfo';
+  tdAttachmentInfo: array [0..3] of TScFieldDef =(
+    (FieldName: 'WebID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
+    (FieldName: 'Mac'; FieldType: ftString; Size: 50; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),  
+    (FieldName: 'UserID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'Path'; FieldType: ftString; Size: 255; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False)
+  );
+
   {PhaseData}
 
   // Refer  : Ô­±¨

+ 8 - 0
Units/ProjectData.pas

@@ -8,6 +8,7 @@ uses
   BillsGatherDm, BGLDm, StaffDm, BillsCompileDm, BillsMeasureDm,
   BillsBookmarkDm, UpFileManageUnit, ProjectGLDm, PriceMarginBillsDm,
   DetailGLDm, OtherMeasureOnceDm, OtherMeasurePhaseDm, DealPayFinalDm,
+  AttachmentInfoDm,
   Classes, SysUtils, ADODB, sdDB, Checker;
 
 type
@@ -50,6 +51,8 @@ type
     FOtherMeasureOnceData: TOtherMeasureOnceData;
     FOtherMeasurePhaseData: TOtherMeasurePhaseData;
 
+    FAttachmentInfoData: TAttachmentInfoData;
+
     FCanUnlockInfo: Boolean;
 
     FWebID: Integer;
@@ -237,6 +240,7 @@ type
     property SearchData: TSearchData read FSearchData;
     property MainListData: TMainListData read FMainListData;
     property AttachmentData: TUpFiles read FAttachmentData;   // 附件
+    property AttachmentInfoData: TAttachmentInfoData read FAttachmentInfoData;
 
     property ProjectGLData: TProjectGLData read FProjectGLData;
     property DetailGLData: TDetailGLData read FDetailGLData;
@@ -334,6 +338,7 @@ begin
   FOtherMeasureOnceData := TOtherMeasureOnceData.Create(Self);
   FOtherMeasurePhaseData := TOtherMeasurePhaseData.Create(Self);
   FAttachmentData := TUpFiles.Create;
+  FAttachmentInfoData := TAttachmentInfoData.Create(Self);
   FPhaseIndex := 0;
 end;
 
@@ -355,6 +360,7 @@ destructor TProjectData.Destroy;
 begin
   try
     FCheckers.Free;
+    FAttachmentInfoData.Free;
     FOtherMeasurePhaseData.Free;
     FOtherMeasureOnceData.Free;
     FPriceMarginBillsData.Free;
@@ -502,6 +508,7 @@ begin
   UpdateSysProgress(190, '正在读取数据');
   FOtherMeasureOnceData.Open(FConnection.Connection);
   FOtherMeasurePhaseData.Open(FConnection.Connection);
+  FAttachmentInfoData.Open(FConnection.Connection);
   UpdateSysProgress(200, '就绪');
 
   if _IsDebugView then
@@ -2185,6 +2192,7 @@ begin
 
     FOtherMeasureOnceData.Save;
     FOtherMeasurePhaseData.Save;
+    FAttachmentInfoData.Save;
     UpdateSysProgress(170, '正在保存数据');
 
     FProjProperties.AuditCompany := FStaffData.FinalStaffCompany;

+ 1 - 0
Units/UpdateDataBase.pas

@@ -107,6 +107,7 @@ begin
     Updater.AddTableDef(SOtherMeasureOnce, @tdOtherMeasureOnce, Length(tdOtherMeasureOnce), False, False);
     Updater.AddTableDef(SOtherMeasurePhase, @tdOtherMeasurePhase, Length(tdOtherMeasurePhase), False, False);
     Updater.AddTableDef(SOMPhaseDetail, @tdOMPhaseDetail, Length(tdOMPhaseDetail), False, False);
+    Updater.AddTableDef(SAttachmentInfo, @tdAttachmentInfo, Length(tdAttachmentInfo), False, False);
     Updater.ExcuteUpdate;
   finally
     Updater.Free;

+ 13 - 1
Units/UtilMethods.pas

@@ -5,7 +5,7 @@ interface
 uses
   Controls, ZhAPI, ActnList, ZjIDTree, DB, ZjGridDBA, ZjGrid, Windows, Messages,
   sdDB, VCLZip, VCLUnZip, Dialogs, Forms, ShlObj, Classes, StrUtils, Math, ADODB,
-  IdGlobal;
+  IdGlobal, uGetMacAddr;
 
 type 
   TRoundMode = (rmNearest, rmUp, rmDown);
@@ -93,6 +93,7 @@ type
   function GetTempFileName(const APath, AExt: string): string; overload;
   function GenerateTempFolder(AGeneratePath: string): string;
   function GetNewGUIDFileName(const AGeneratePath: string): string;
+  function GetMacAddr: string;
 
   {Progress bar Control}
   procedure UpdateSysProgress(APosition: Integer; const AHint: string);
@@ -1054,6 +1055,17 @@ begin
   until not FileExists(Result);
 end;
 
+function GetMacAddr: string;
+var
+  sgs: TStrings;
+begin
+  sgs := GetMacAddress;
+  if (sgs.Count > 0) then
+    Result := sgs[0]
+  else
+    Result := '';
+end;
+
 {Progress bar Control}
 procedure UpdateSysProgress(APosition: Integer; const AHint: string);
 begin