From 0756bf12d10cf1b7f78c571de0a9ad69cbaeb7ca Mon Sep 17 00:00:00 2001
From: curtis <curtis@i-mps.com>
Date: 星期一, 30 三月 2026 14:24:17 +0800
Subject: [PATCH] fix: 更新內部引用方法參照

---
 reassemble/CB_IMGPSScanImp.lfcycle.pas |  771 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 771 insertions(+), 0 deletions(-)

diff --git a/reassemble/CB_IMGPSScanImp.lfcycle.pas b/reassemble/CB_IMGPSScanImp.lfcycle.pas
new file mode 100644
index 0000000..bcc1bab
--- /dev/null
+++ b/reassemble/CB_IMGPSScanImp.lfcycle.pas
@@ -0,0 +1,771 @@
+{ ==============================================================================
+  方法名稱:DefinePropertyPages
+  引用相依:
+  方法描述:Delphi ActiveForm 用於定義屬性頁面的存根方法,目前未實作具體內容。
+============================================================================== }
+procedure TCB_IMGPSScanX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
+begin
+  { Define property pages here.  Property pages are defined by calling
+    DefinePropertyPage with the class id of the page.  For example,
+      DefinePropertyPage(Class_CBS_IMScanXPage); }
+end;
+
+
+{ ==============================================================================
+  方法名稱:EventSinkChanged
+  引用相依:
+  方法描述:當事件接收器改變時觸發。將傳入的 EventSink 轉換為 ICB_IMGPSScanXEvent
+            s 並賦值給 FEvents,同時呼叫繼承的 EventSinkChanged 方法。
+============================================================================== }
+procedure TCB_IMGPSScanX.EventSinkChanged(const EventSink: IUnknown);
+begin
+  FEvents := EventSink as ICB_IMGPSScanXEvents;
+  inherited EventSinkChanged(EventSink);
+end;
+
+
+{ ==============================================================================
+  方法名稱:ActivateEvent
+  引用相依:
+  方法描述:觸發 COM 介面的 OnActivate 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.ActivateEvent(Sender: TObject);
+begin
+  if FEvents <> nil then FEvents.OnActivate;
+end;
+
+
+{ ==============================================================================
+  方法名稱:ClickEvent
+  引用相依:
+  方法描述:觸發 COM 介面的 OnClick 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.ClickEvent(Sender: TObject);
+begin
+  if FEvents <> nil then FEvents.OnClick;
+end;
+
+
+{ ==============================================================================
+  方法名稱:CreateEvent
+  引用相依:
+  方法描述:觸發 COM 介面的 OnCreate 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.CreateEvent(Sender: TObject);
+begin
+  if FEvents <> nil then FEvents.OnCreate;
+end;
+
+
+{ ==============================================================================
+  方法名稱:DblClickEvent
+  引用相依:
+  方法描述:觸發 COM 介面的 OnDblClick 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.DblClickEvent(Sender: TObject);
+begin
+  if FEvents <> nil then FEvents.OnDblClick;
+end;
+
+
+{ ==============================================================================
+  方法名稱:DeactivateEvent
+  引用相依:
+  方法描述:觸發 COM 介面的 OnDeactivate 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.DeactivateEvent(Sender: TObject);
+begin
+  if FEvents <> nil then FEvents.OnDeactivate;
+end;
+
+
+{ ==============================================================================
+  方法名稱:DestroyEvent
+  引用相依:_DelTree
+  方法描述:銷毀元件時的清理工作。負責釋放大量的 TStringList 物件,包含各類資訊清
+            單(表單、規則、註記、工作、影像路徑、條碼等)。針對特定模式(DSCAN/ESCAN),若
+             ImagePath 不為空則刪除該目錄及其子目錄。最後觸發 COM 介面的 OnDestro
+            y 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.DestroyEvent(Sender: TObject);
+begin
+  //********清單區********
+  Doc_Inf_List.Free;  //Doc_Inf 清單   Docno + 版本為key
+  DM_FORM_INF_List.Free;  //DM_FORM_INF 清單   Docno + 版本為key
+  FORM_INF_List.Free; //FORM_INF的清單
+  CHECK_RULE_INF_List.Free;  //CHECK_RULE_INF  清單
+  MEMO_INF_List.Free;  //MEMO_INF 清單
+  WORK_INF_List.Free;  //WORK_INF 清單
+  LASTEST_FORM_INF_List.Free; // LASTEST_FORM_INF 清單
+  FindResult.Free ;  //找SQLData的結果
+  OMRFileList.Free;  //要OMR檢核的文件(只檢查每種Form的第一頁)
+  FormCode_PageSize.Free; //文件的預設大小  FormCode_Height_Width
+  DocNo_NeedDoc.Free; //有Docno時要相依的文件   DocNo_相依文件_相依文件
+  DocNo_NoDoc.Free; //有Docno時互斥的文件   DocNo_互斥文件_互斥文件
+  DocNo_VerinCase.Free; //案件裡的DocNo+版本的清單
+  CaseDocNoList.Free;  //案件裡的DocNo清單
+  CaseDocNo_CopiesList.Free; //案件裡的DocNo份數清單
+  CaseList.Free;    //記錄掃瞄案件的順序
+  NoSaveBarCodeList.Free; //不儲存的條碼清單
+  FormID_List.Free;  //FormID清單
+  DocNo_List.Free; //DocNo清單
+  Context_DocnoList.Free; //案件裡的檔案Docno清單
+  ContextList.Free; //案件裡的檔案清單
+  AttContextList.Free; //案件裡的附加檔案清單
+  NowShowFileList.Free;  //目前顯示的影像清單
+  NowSelectFileList.Free; //目前被點選的影像清單
+  Cust_DocNoList.Free; //自行定義文件名稱
+  IN_WH_DocNoList.Free; //入庫的文件清單
+  GuideFormIDList.Free; //要當導引頁表單清單
+  DivPageFormIDList.Free; //要當分案頁表單清單
+  LastInitFormidList.Free;
+  LastAddFormidList.Free;
+  SampleFormIDList.Free;
+  ExistImgList.Free;
+  reSizeExistImgList.Free;
+  //********清單區********
+  if (FMode = 'DSCAN') or (FMode = 'ESCAN')  then //重掃件及異動件要只能掃指定編號的件
+  begin
+    if ImagePath<>'' then
+      _Deltree(ImagePath);
+  end;
+
+  if FEvents <> nil then FEvents.OnDestroy;
+end;
+
+
+{ ==============================================================================
+  方法名稱:KeyPressEvent
+  引用相依:
+  方法描述:處理鍵盤按鈕事件,並將按鍵資訊傳遞至 COM 介面的 OnKeyPress 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.KeyPressEvent(Sender: TObject; var Key: Char);
+var
+  TempKey: Smallint;
+begin
+  TempKey := Smallint(Key);
+  if FEvents <> nil then FEvents.OnKeyPress(TempKey);
+  Key := Char(TempKey);
+end;
+
+
+{ ==============================================================================
+  方法名稱:MouseEnterEvent
+  引用相依:
+  方法描述:當滑鼠進入元件時,觸發 COM 介面的 OnMouseEnter 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.MouseEnterEvent(Sender: TObject);
+begin
+  if FEvents <> nil then FEvents.OnMouseEnter;
+end;
+
+
+{ ==============================================================================
+  方法名稱:MouseLeaveEvent
+  引用相依:
+  方法描述:當滑鼠離開元件時,觸發 COM 介面的 OnMouseLeave 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.MouseLeaveEvent(Sender: TObject);
+begin
+  if FEvents <> nil then FEvents.OnMouseLeave;
+end;
+
+
+{ ==============================================================================
+  方法名稱:PaintEvent
+  引用相依:
+  方法描述:當元件需要重繪時,觸發 COM 介面的 OnPaint 事件。
+============================================================================== }
+procedure TCB_IMGPSScanX.PaintEvent(Sender: TObject);
+begin
+  if FEvents <> nil then FEvents.OnPaint;
+end;
+
+
+{ ==============================================================================
+  方法名稱:ActiveFormCreate
+  引用相依:
+  方法描述:ActiveForm 建立時的初始化處理。發送啟動訊息、設定預設檢視模式並初始化
+            影像顯示區域。遍歷所有影像捲軸盒(ISB),設定預設滑鼠模式為 mmUser 並將
+            縮放模式設為全頁顯示,最後延遲啟動 Timer。
+============================================================================== }
+procedure TCB_IMGPSScanX.ActiveFormCreate(Sender: TObject);
+var IScrollBox : TImageScrollBox;
+    i          :integer;
+begin
+  {HotKeyId1 := GlobalAddAtom('MyHotKey1')-$C000;
+  HotKeyId2 := GlobalAddAtom('MyHotKey2')-$C000;
+  HotKeyId3 := GlobalAddAtom('MyHotKey3')-$C000;
+  HotKeyId4 := GlobalAddAtom('MyHotKey4')-$C000;
+  RegisterHotKey(handle,HotKeyId1,0,VK_UP);      //printscreen
+  RegisterHotKey(handle,HotKeyId1,0,VK_Down);      //printscreen }
+  PostMessage(Handle,WM_ACTIVATE,WA_CLICKACTIVE,0);
+  vmode := 1;
+  DesableImage;
+  For i:= 1 to 8 do begin
+    IScrollBox := TImageScrollBox( FindComponent('ISB'+IntToStr(i)));
+    IScrollBox.MouseMode := mmUser;
+    iScrollBox.ZoomMode := zmFullPage;
+  end;
+  Sleep(500);
+  Timer1.Enabled := True;
+end;
+
+
+{ ==============================================================================
+  方法名稱:HotKeyDown
+  引用相依:
+  方法描述:熱鍵按下處理程序,目前為空實作。
+============================================================================== }
+procedure TCB_IMGPSScanX.HotKeyDown (var Msg : TMessage);
+begin
+
+end;
+
+
+{ ==============================================================================
+  方法名稱:InitialLanguage
+  引用相依:
+  方法描述:元件多國語言初始化核心函式。讀取 Language.Lng 設定檔,根據指定的語系遞
+            迴設定畫面上所有控制項(按鈕、選單、標籤、清單、群組框等)的 Caption 或 Hi
+            nt 文字,實現介面語系動態切換。
+============================================================================== }
+procedure TCB_IMGPSScanX.InitialLanguage(Sender: TObject);
+var
+  ini : Tmeminifile;
+  i,n : Integer;
+  FormName : String;
+  NowForm : TComponent;
+begin
+  if Sender is TActiveForm then
+    NowForm := TActiveForm(Sender);
+  if Sender is TForm then
+    NowForm := TForm(Sender);
+
+  FormName := NowForm.Name;
+  IISUnit.IIS_LngfileName := LngPath+'Language.Lng';  //給IISUnit 轉多國語言字串用
+  if FLanguage = '' then
+    FLanguage := 'zh_tw';
+  IISUnit.IIS_NowLng := FLanguage;
+  ini := TMeminifile.Create(LngPath+'Language.Lng');
+  try
+    IF NowForm is TForm Then
+      TForm(NowForm).Caption := ini.ReadString(FLanguage,FormName+'.FormTitle','');
+    for i := 0 to NowForm.ComponentCount - 1 do
+    begin
+//ShowMessage(NowForm.Components[i].Name);
+      if NowForm.Components[i] is TButton then
+      begin
+        TButton(NowForm.Components[i]).Caption := ini.ReadString(FLanguage,FormName+'.'+TButton(NowForm.Components[i]).Name,'');
+        //TBitBtn(NowForm.Components[i]).Caption := ini.ReadString(FormName,TBitBtn(NowForm.Components[i]).Name,'');
+        //TButton(NowForm.Components[i]).OnMouseEnter := BtnMouseEnter;
+      end
+      Else if NowForm.Components[i] is TBitBtn then
+      begin
+        TBitBtn(NowForm.Components[i]).Hint := ini.ReadString(FLanguage,FormName+'.'+TBitBtn(NowForm.Components[i]).Name,'');
+        //TBitBtn(NowForm.Components[i]).Caption := ini.ReadString(FormName,TBitBtn(NowForm.Components[i]).Name,'');
+        TBitBtn(NowForm.Components[i]).OnMouseEnter := BtnMouseEnter;
+      end
+      Else if NowForm.Components[i] is TMenuItem then
+      begin
+        if ini.ValueExists(FLanguage,FormName+'.'+TMenuItem(NowForm.Components[i]).Name) then
+          TMenuItem(NowForm.Components[i]).Caption := ini.ReadString(FLanguage,FormName+'.'+TMenuItem(NowForm.Components[i]).Name,'');
+      end
+      Else if NowForm.Components[i] is TCheckBox then
+      begin
+        TCheckBox(NowForm.Components[i]).Caption := ini.ReadString(FLanguage,FormName+'.'+TCheckBox(NowForm.Components[i]).Name,'');
+      end
+      Else if NowForm.Components[i] is TPJMenuSpeedButton then
+      begin
+        TPJMenuSpeedButton(NowForm.Components[i]).Hint := ini.ReadString(FLanguage,FormName+'.'+TPJMenuSpeedButton(NowForm.Components[i]).Name,'');
+      end
+      Else if NowForm.Components[i] is TLabel then
+      begin
+        TLabel(NowForm.Components[i]).Caption := ini.ReadString(FLanguage,FormName+'.'+TLabel(NowForm.Components[i]).Name,'');
+      end
+      Else if NowForm.Components[i] is TGroupBox then
+      begin
+        TGroupBox(NowForm.Components[i]).Caption := ini.ReadString(FLanguage,FormName+'.'+TGroupBox(NowForm.Components[i]).Name,'');
+      end
+      Else if NowForm.Components[i] is TListView then
+      begin
+        for n := 0 to TListView(NowForm.Components[i]).Columns.Count - 1 do
+        begin
+          TListView(NowForm.Components[i]).Columns.Items[n].Caption := ini.ReadString(FLanguage,FormName+'.'+TListView(NowForm.Components[i]).Name+'_'+inttostr(n),'');
+        end;
+      end
+      Else if NowForm.Components[i] is TRadioGroup then
+      begin
+        TRadioGroup(NowForm.Components[i]).Caption := ini.ReadString(FLanguage,FormName+'.'+TRadioGroup(NowForm.Components[i]).Name,'');
+        for n := 0 to TRadioGroup(NowForm.Components[i]).Items.Count - 1 do
+        begin
+          TRadioGroup(NowForm.Components[i]).Items.Strings[n] := ini.ReadString(FLanguage,FormName+'.'+TRadioGroup(NowForm.Components[i]).Name+'_'+inttostr(n),'');
+        end;
+      end;
+    end;
+  finally
+  ini.Free;
+  end;
+end;
+
+
+{ ==============================================================================
+  方法名稱:Timer1Timer
+  引用相依:FJpgCompression, FileExists, GetLocalAppDir, Str2Dir, _DelTree, init
+            kscan
+  方法描述:OCX 元件初始化的核心程序。負責從伺服器下載各類基礎資訊(業務、表單、文件
+            、檢核規則、常用片語、系統參數等),並設定本地暫存路徑(ScanTemp)。針對異動
+            或重掃模式,會自動建立空案件並下載既有影像。最後執行各類屬性與語系設定
+            ,確保掃描環境就緒。
+============================================================================== }
+procedure TCB_IMGPSScanX.Timer1Timer(Sender: TObject);
+var
+  StampDate,StampTime : String;
+  i: Integer;
+begin
+  Timer1.Enabled := False;
+  //FIs_In_Wh:='Y'; /// test 記得關掉
+  //FWH_category :='N';  // test 記得關掉
+//  FImgDelete := 'Y'; //test 記得關掉
+  //Showmessage('a');
+  //self.FIs_OldCase := 'Y';
+  PageLVclear := True;
+  InitialOk := False;
+
+  FMaxUploadSize:='10';
+  FJpgCompression:=50;
+  FFtpRootPath := '';  //影像平台沒有給FtpRoot目錄,會直接用FFtpExtraPath切換至指定目錄
+  //FMode := 'DSCAN' ;
+  //FIs_In_Wh := 'Y';
+  if FIs_In_Wh = 'Y' then
+    AttName := 'Attach'  //入庫附件
+  else
+    AttName := 'S_Attach'; //Smartlending 附件
+//ShowMessage('1111111');
+  if FMode = 'SAMPLESCAN' then
+  begin
+    NewScanBtn.Visible := False;
+    PJLinkedMenuSpeedButton2.Visible := False;
+    AddScanBtn.Visible := False;
+    CheckCaseBtn.Visible := False;
+    Panel18.Visible := False;
+    TransBtn.Visible := False;
+    FC6.Visible := False;
+    SampleScanBtn.Visible := True;
+    Panel1.Visible := True;
+    Panel6.Visible := True;
+    ScanDuplexCB.Visible := False; //雙面掃描
+  end
+  Else if (FMode = 'NSCAN') then
+  begin
+    Panel18.Visible := True;
+    Panel1.Visible := True;
+    Panel6.Visible := True;
+    Panel21.Visible := True;
+    Panel23.Visible := True;
+
+    AttFileGB.Visible := True;
+    Splitter2.Visible := True;
+    ScanDuplexCB.Visible := True; //雙面掃描
+  end
+  Else if FMode = 'FSCAN' then
+  begin
+    Panel1.Visible := True;
+    //Panel6.Visible := True;
+  end
+  Else
+  begin
+    Panel18.Visible := True;
+    Panel1.Visible := True;
+    Panel6.Visible := True;
+    Panel21.Visible := True;
+    Panel23.Visible := True;
+    AttFileGB.Visible := True;
+    Splitter2.Visible := True;
+  end;
+  DisplayMode(1,1,1,Panel9);
+  Application.ProcessMessages;
+  StatusBar1.Panels[0].Text := 'Ver'+GetCurrentVersionNo;
+  StatusBar1.Panels[1].Text := 'Login User:'+FUserName;
+  {$IFDEF Test}
+    StatusBar1.Panels[0].Text := StatusBar1.Panels[0].Text+'(test)';
+  {$ENDIF}
+    StatusBar1.Panels[0].Text := StatusBar1.Panels[0].Text;
+
+  if FPrintyn = 'Y' then
+    PrtLB.Visible := True;
+
+  initParameter;  //20170222 針對新加的parameter 作初始化參數
+  InitScrollRec;
+  If FUrl = '' then
+  begin
+    Showmessage(_Msg('URL cannot be empty,please contact system administrator'));
+    Exit;
+  end;
+  if FUrl[length(FUrl)]<>'/' then
+    FUrl := FUrl + '/';
+  //20221028 把語言檔改放至 Local目錄裡,才不會有些文字來不及使用
+  LngPath := GetLocalAppDir(Handle)+'MPS\CB_IMGPS\';
+  Str2Dir(LngPath);
+  ////下載語言檔/////  20170218 先拿調以便測試
+  If not DownLanguage Then
+  begin
+    Showmessage('Language File error!!'+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+
+  InitialLanguage(Self);  //載入多國語言
+
+
+  if FWork_no='' then
+  begin
+    Showmessage(_Msg('業務別不能為空白,請洽詢程式人員'));
+    Exit;
+  end;
+
+  if CaseIDLength = 0 then
+  begin
+    Showmessage(_Msg('案件編號長度限制不能為空白,請洽詢程式人員'));
+    //Exit;  //測試時不退出
+  end;
+
+  //********清單區********
+
+  Doc_Inf_List := TStringList.Create;  //Doc_Inf 清單   Docno + 版本為key
+  DM_FORM_INF_List := TStringList.Create;  //DM_FORM_INF 清單   Docno + 版本為key
+  FORM_INF_List := TStringList.Create; //FORM_INF的清單
+  CHECK_RULE_INF_List := TStringList.Create;  //CHECK_RULE_INF  清單
+  MEMO_INF_List := TStringList.Create;  //MEMO_INF 清單
+  WORK_INF_List := TStringList.Create;  //WORK_INF 清單
+  LASTEST_FORM_INF_List := TStringList.Create;  // LASTEST_FORM_INF 清單
+  FindResult := TStringlist.Create;  //找SQLData的結果
+
+  OMRFileList := TStringList.Create; //要OMR檢核的文件(只檢查每種Form的第一頁)
+  FormCode_PageSize := TStringList.Create; //文件的預設大小  FormCode_Height_Width
+  DocNo_NeedDoc := TStringList.Create; //有Docno時要相依的文件   DocNo_相依文件_相依文件
+  DocNo_NoDoc := TStringList.Create; //有Docno時互斥的文件   DocNo_互斥文件_互斥文件
+  DocNo_VerinCase := TStringList.Create; //案件裡的DocNo+版本的清單
+  CaseDocNoList := TStringlist.Create;  //案件裡的DocNo清單
+  CaseDocNo_CopiesList := TStringlist.Create; //案件裡的DocNo份數清單
+  CaseList := TStringList.Create;    //記錄掃瞄案件的順序
+  Context_DocnoList := TStringlist.Create; //案件裡的檔案Docno清單
+  ContextList := TStringlist.Create; //案件裡的檔案清單
+  AttContextList := TStringlist.Create; //案件裡的附加檔案清單
+  NoSaveBarCodeList := TStringlist.Create; //不儲存的條碼清單
+  FormID_List := TStringlist.Create;  //FormID清單
+  DocNo_List := TStringlist.Create; //DocNo清單
+  NowShowFileList := TStringlist.Create;  //目前顯示的影像清單
+  NowSelectFileList := TStringlist.Create; //目前被點選的影像清單
+  Cust_DocNoList := TStringlist.Create; //自行定義的文件名稱
+  IN_WH_DocNoList := TStringlist.Create; //入庫的文件清單
+  GuideFormIDList := TStringlist.Create; //要當導引頁表單清單
+  DivPageFormIDList := TStringList.Create; //要當分案頁表單清單
+  LastInitFormidList :=TStringList.Create;
+  LastAddFormidList := TStringList.Create;
+  SampleFormIDList := TStringList.Create;//20170627 加入
+  ExistImgList := TStringList.Create;  //20170724 新增
+  reSizeExistImgList :=TStringList.Create; //20171012 新增
+  //********清單區********
+
+  ShowText := _Msg('資料載入中,請稍候');
+  DataLoading(True,True);
+
+  IF not GetServerDate Then
+  begin
+    Showmessage(_Msg('取主機時間時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+
+  if FMode='SAMPLESCAN' then
+  begin
+    IF not GetSampleInf Then  //取已存在sample
+    begin
+      Showmessage(_Msg('取存在範本資訊時,網路發生錯誤!!')+HttpErrStr);
+      DataLoading(False,False);
+      Exit;
+    end;
+  end;
+
+
+
+//ShowMessage('GetServerDate  '+ServerDate+' , '+ServerTime);
+  ////下載系統資訊////
+  IF not GetSetInf1 Then  //取DOC_INF  文件資訊
+  begin
+    Showmessage(_Msg('取文件資訊時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+//ShowMessage('GetSetInf1');
+  //showmessage(self.Doc_Inf_List.Text);
+  IF not GetSetInf2 Then  //取DM_FORM_INF     相依互斥資訊
+  begin
+    Showmessage(_Msg('取相依互斥資訊時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+//ShowMessage('GetSetInf2');
+  //Showmessage(self.Doc_Inf_List.Text);
+  IF not GetSetInf3 Then   //取FORM_INF  表單資訊
+  begin
+    Showmessage(_Msg('取表單資訊時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+//ShowMessage('GetSetInf3');
+  IF not GetSetInf4 Then   //取CHECK_RULE_INF   檢核規則資訊
+  begin
+    Showmessage(_Msg('取檢核規則資訊時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+  //showmessage(self.CHECK_RULE_INF_List.Text);
+//ShowMessage('GetSetInf4');
+  IF not GetSetInf5 Then   //取MEMO_INF   常用片語資訊
+  begin
+    Showmessage(_Msg('取常用片語資訊時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+//ShowMessage('GetSetInf5');
+  //showmessage(self.MEMO_INF_List.Text);
+  IF not GetSetInf6 Then   //取WORK_INF   系統參數資訊
+  begin
+    Showmessage(_Msg('取系統參數資訊時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+//ShowMessage('GetSetInf6');
+  //showmessage(FORM_INF_List.Text);
+  IF not GetSetInf7 Then   //取LASTES_FORM_INF   系統參數資訊
+  begin
+    Showmessage(_Msg('取最新版FORMID參數資訊時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+//ShowMessage('GetSetInf7');
+  //Showmessage(LASTEST_FORM_INF_List.Text);
+  SetFormID_DocNo;  //將FormID及Docno抽出塞入List裡  20130403增加
+  SetIn_WH_DocNo; //將要入庫的DocNo抽出來另存入list裡
+  GetDefScanIni; //取得掃描預設值及相關設定
+
+  ////下載系統資訊/////
+  if ImagePath = '' then
+  begin
+    Showmessage(_Msg('本機暫存路徑不得為空白'));
+    DataLoading(False,False);
+    Panel1.Enabled := False;
+    Panel2.Enabled := False;
+    Exit;
+  end;
+  initkscan;
+  if ImagePath[Length(ImagePath)] <> '\' then
+    ImagePath := ImagePath + '\';
+//ShowMessage('ImagePath='+ImagePath);
+  //CheckXmlPath := ImagePath+'OMRSITE\'+FWork_No;
+  CheckXmlPath := ImagePath+'OMRSITE\';  // 20200612 發現影像平台是取回所有業務的設定,所以不能有業務別目錄
+//ShowMessage('CheckXmlPath='+CheckXmlPath);
+  //SitePath := ImagePath+'Site\'+FWork_No+'\';
+  SitePath := ImagePath+'Site\';  // 20200612 發現影像平台是取回所有業務的設定,所以不能有業務別目錄
+  //LngPath := ImagePath; //改放至上面取Local目錄
+  SamplePath := ImagePath+'Sample\'+FWork_No+'\';
+  ImagePath := ImagePath + 'Scantemp\';
+//ShowMessage('AA  ImagePath='+ImagePath);
+  ScaniniPath :=ImagePath+FWork_No+'\'+FUserUnit +'\';
+//ShowMessage('ScaniniPath='+ScaniniPath);
+  ImagePath := ImagePath + FWork_No+'\'+FUserUnit+'\'+FMode+'\';
+  ImagePath := StringReplace(ImagePath, '\\', '\',[rfReplaceAll, rfIgnoreCase]);
+//ShowMessage('BB  ImagePath='+ImagePath);
+  ImageSavePath := ImagePath;
+  str2dir(CheckXmlPath);
+  str2dir(SitePath);
+  str2dir(ImagePath);
+  str2dir(SamplePath);
+  Del_Sub_NothingPath(ImagePath);  //清掉案件目錄是空的
+
+
+  LogFile1.LogFile:=LngPath+'IMGPSCheck.log';
+
+  ReduceLogFile;
+
+  LogFile1.LogToFile(logTimeString+'OCX取表data結束');
+
+  ShowText := _Msg('資料載入中,請稍候');
+  DataLoading(True,True);
+
+//  if not CheckAvailable Then   //檢查授權  20170218 說不用了
+//  begin
+//    DataLoading(False,False);
+//    Panel1.Enabled := False;
+//    Panel2.Enabled := False;
+//    Exit;
+//  end;
+
+//Button3Click(Self);
+//ShowMessage('CheckAvailable');
+  ShowText := _Msg('資料載入中,請稍候');
+  DataLoading(True,True);
+
+
+  StatusBar1.Panels[1].Text := _Msg('登入人員:')+FUserName;
+  //FCaseID:='20150302180133';//測試用
+  ////下載語言檔/////
+//ShowMessage('OOOO');
+
+  if (FMode = 'RSCAN')  or (FMode = 'DSCAN') or (FMode = 'ESCAN') or (FMode = 'FSCAN') then //重掃件及異動件要只能掃指定編號的件
+  begin
+    _Deltree(ImagePath);
+    str2dir(ImagePath);
+    ImageSavePath := ImagePath;
+    str2dir(ImageSavePath);
+    MkDir(ImageSavePath+FCaseID);
+    CreateEmptyCase(ImageSavePath,FCaseID);
+    MkDir(ImageSavePath+FCaseID+'\Download');
+    IF (FMode = 'ESCAN') or (FMode = 'DSCAN') then  //異動件先下載影像
+    begin
+      ShowText := _Msg('案件下載中,請稍候');
+      DataLoading(True,True);
+      If not DownLoadImage(ImageSavePath+FCaseID+'\Download\',FCaseID) Then
+      begin
+        Showmessage(FCaseID+_msg('載入異動影像時,網路發生錯誤')+DownFileErrStr);
+        DataLoading(False,False);
+        Exit;
+      end;
+
+      {If not Down_Img(ImageSavePath+FCaseID+'\Download\',FCaseID) then
+      begin
+        Showmessage(FCaseID+_msg('載入異動影像時,網路發生錯誤')+HttpErrStr);
+        DataLoading(False,False);
+        Exit;
+      end;}
+//Showmessage(ImageSavePath+FCaseID+'\Download\'+#10#13+ImageSavePath+FCaseID+'\');
+      Download2Case(ImageSavePath+FCaseID+'\Download\',ImageSavePath+FCaseID+'\');
+//Showmessage('aaa');
+      //Download2Case('C:\Users\Hong\Downloads\沒有括號\',ImageSavePath+FCaseID+'\');
+      if (FIs_OldCase = 'Y') then
+      begin
+        if (FWork_no='HLN') then
+          ErrFormtoCurrentForm(FCaseID,'10000001011112A','11000001011112A');  //換掉錯的FormID
+        //if not FileExists(ImageSavePath+FCaseID+'\CaseDocNo_Copies.dat') then   //這個會在Download2Case時一律產生所以不能有這行 20141013
+        OldCasetoNewCase(FCaseID);
+        //ErrFormtoCurrentForm(FCaseID,'11B00005011312A','11000001011112A');  //換掉錯的FormID
+        //LoadImgFile;
+      end;
+//      if (FIs_OldCase = 'Y') and (FWork_no='HLN') then   //77版的
+//      begin
+//        ErrFormtoCurrentForm(FCaseID,'10000001011112A','11000001011112A');  //換掉錯的FormID
+//        if not FileExists(ImageSavePath+FCaseID+'\CaseDocNo_Copies.dat') then
+//          OldCasetoNewCase(FCaseID);
+//        //ErrFormtoCurrentForm(FCaseID,'11B00005011312A','11000001011112A');  //換掉錯的FormID
+//        //LoadImgFile;
+//      end;
+      Create_Cust_DocDir(FCaseID); //產生外面傳入的文件
+      if FMode='ESCAN' then
+        LastInitFormidListCreate(ImageSavePath+FCaseID+'\Download\');
+    end;
+  end;
+
+//ShowMessage('GetOMRCheckSet前');
+  ////下載檢核XML//////
+  IF not GetOMRCheckSet Then
+  begin
+    Showmessage(_Msg('下載檢核定位檔案時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+  ////下載檢核XML/////
+//ShowMessage('GetOMRCheckSet後來');
+  ////下載登打設定/////
+  IF not GetKeyinSet Then
+  begin
+    Showmessage(_Msg('下載登打定位檔案時,網路發生錯誤!!')+HttpErrStr);
+    DataLoading(False,False);
+    Exit;
+  end;
+  ////下載登打設定/////
+//ShowMessage('GetKeyinSet');
+  if ScanDenialHint <> '' then   //有設定提示字串就秀在右上角
+  begin
+    DenialTimeLb.Visible := True;
+    DenialTimeLb.Caption := Format(ScanDenialHint,[ScanDenialTime]);
+  end;
+//ShowMessage(IntToStr(ScanDpi));
+  R_W_Scanini('R'); //掃瞄設定的ini
+//ShowMessage(IntToStr(ScanDpi));
+//ShowMessage('停掉DataLoading');
+//DataLoading(False,False);
+  ScanDuplexCB.Checked := ScanDuplex;
+  if FMode <> 'SAMPLESCAN' then
+    LoadImgFile;
+  if (FMode = 'RSCAN') or (FMode = 'ESCAN') or (FMode = 'FSCAN') then
+  begin
+    if TreeView1.Items.Count > 0 then
+    begin
+      TreeView1.Selected := NewTreeNode.Item[0];
+      TreeView1click(self);
+    end;
+  end;
+  InitialOk := True;
+
+  {AttFileGB.Visible := True; //附加電子檔窗  //20120207楊玉說不在這加電子檔先拿掉
+  Splitter2.Visible := True;
+  AttFileGB.Visible := False; //附加電子檔窗
+  Splitter2.Visible := False; }
+//ShowMessage('ImageSavePath='+ImageSavePath);
+  DataLoading(False,False);
+
+  LogFile1.LogToFile(logTimeString+'OCX初始化結束');
+  LogFile1.LogToFile(logTimeString+'FUrl='+FUrl+
+	',FCaseID='+FCaseID+
+	',FMode='+FMode+
+	',FModeName='+FModeName+
+	',FWork_no='+FWork_no+
+	',FUserID='+FUserID+
+	',FUserName='+FUserName+
+	',FUserUnit='+FUserUnit+
+	',FData='+FData+
+	',FVerify='+FVerify+
+	',FReWrite='+FReWrite+
+	',FLanguage='+FLanguage+
+	',FLoanDoc_Value='+FLoanDoc_Value+
+	',FLoanDoc_Enable='+FLoanDoc_Enable+
+	',FUseProxy='+FUseProxy+
+	',FC_DocNoList='+FC_DocNoList+
+	',FC_DocNameList='+FC_DocNameList+
+	',FFixFileList='+FFixFileList+
+	',FIs_In_Wh='+FIs_In_Wh+
+	',FOldCaseInfo='+FOldCaseInfo+
+	',FPrintyn='+FPrintyn+
+	',FIs_OldCase='+FIs_OldCase+
+	',FCustDocYN='+FCustDocYN);
+  LogFile1.LogToFile(logTimeString+'FImgDPI='+IntToStr(FImgDPI)+
+    ',FScanColor='+    IntToStr(FScanColor)+
+    ',FFileSizeLimit='+  IntToStr(FFileSizeLimit)+
+    ',FCaseNoLength='+ IntToStr(FCaseNoLength)+
+    ',FImgDelete='+FImgDelete+
+    ',FIsExternal='+FIsExternal+
+    ',FWH_category='+FWH_category+
+    ',FCheck_main_form='+FCheck_main_form+
+    ',FMaxUploadSize='+FMaxUploadSize);
+
+end;
+
+
+{ ==============================================================================
+  方法名稱:Timer2Timer
+  引用相依:
+  方法描述:處理進度條或提示文字的動態點點動畫。每觸發一次就會在 ShowText 後方增
+            加一個點,模擬載入中的視覺效果。
+============================================================================== }
+procedure TCB_IMGPSScanX.Timer2Timer(Sender: TObject);
+begin
+  IF Panel22.Caption = ShowText+'......' Then
+    Panel22.Caption := ShowText
+  Else
+    Panel22.Caption := Panel22.Caption + '.';
+  Application.ProcessMessages;
+end;
+
+

--
Gitblit v1.8.0