From a57c1e93c86fe03088296e87f2ebc0a92a3fa2b7 Mon Sep 17 00:00:00 2001
From: doom4ster <doom4ster@gmail.com>
Date: 星期二, 27 六月 2017 15:06:56 +0800
Subject: [PATCH] CB_IMGPSScan.cab ver2.0.1.15  範本掃瞄會先問要不要取代

---
 CB_IMGPSScanImp.dcu |    0 
 CB_IMGPSScan.ocx    |    0 
 CB_IMGPSScan.dproj  |    4 +-
 CB_IMGPSScan.res    |    0 
 CB_IMGPSScanImp.pas |   70 +++++++++++++++++++++++++++++++++++
 5 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/CB_IMGPSScan.dproj b/CB_IMGPSScan.dproj
index 8c20cac..8bbd35a 100644
--- a/CB_IMGPSScan.dproj
+++ b/CB_IMGPSScan.dproj
@@ -94,7 +94,7 @@
 						<VersionInfo Name="MajorVer">2</VersionInfo>
 						<VersionInfo Name="MinorVer">0</VersionInfo>
 						<VersionInfo Name="Release">1</VersionInfo>
-						<VersionInfo Name="Build">14</VersionInfo>
+						<VersionInfo Name="Build">15</VersionInfo>
 						<VersionInfo Name="Debug">False</VersionInfo>
 						<VersionInfo Name="PreRelease">False</VersionInfo>
 						<VersionInfo Name="Special">False</VersionInfo>
@@ -106,7 +106,7 @@
 					<VersionInfoKeys>
 						<VersionInfoKeys Name="CompanyName"/>
 						<VersionInfoKeys Name="FileDescription"/>
-						<VersionInfoKeys Name="FileVersion">2.0.1.14</VersionInfoKeys>
+						<VersionInfoKeys Name="FileVersion">2.0.1.15</VersionInfoKeys>
 						<VersionInfoKeys Name="InternalName"/>
 						<VersionInfoKeys Name="LegalCopyright"/>
 						<VersionInfoKeys Name="LegalTrademarks"/>
diff --git a/CB_IMGPSScan.ocx b/CB_IMGPSScan.ocx
index 1f06bc5..032d653 100644
--- a/CB_IMGPSScan.ocx
+++ b/CB_IMGPSScan.ocx
Binary files differ
diff --git a/CB_IMGPSScan.res b/CB_IMGPSScan.res
index e4290da..3ac9e22 100644
--- a/CB_IMGPSScan.res
+++ b/CB_IMGPSScan.res
Binary files differ
diff --git a/CB_IMGPSScanImp.dcu b/CB_IMGPSScanImp.dcu
index 2f9928b..86ef42b 100644
--- a/CB_IMGPSScanImp.dcu
+++ b/CB_IMGPSScanImp.dcu
Binary files differ
diff --git a/CB_IMGPSScanImp.pas b/CB_IMGPSScanImp.pas
index 46a1807..46e6fc7 100644
--- a/CB_IMGPSScanImp.pas
+++ b/CB_IMGPSScanImp.pas
@@ -484,6 +484,7 @@
     DivPageFormIDList:TStringlist; //要當分案頁表單清單
     LastInitFormidList:TStringList;
     LastAddFormidList:TstringList;
+    SampleFormIDList:TStringList; //20170627 已存在範本的formid
     //********清單區********
 
     //********顯示區********
@@ -830,6 +831,7 @@
     procedure LastInitFormidListCreate(path:string);
     function checkFormCodeIsCustom(path,formcode:string):boolean;
     function ISDivPageFormID(FormID: String): Boolean;
+    function GetSampleInf: Boolean;
   protected
     { Protected declarations }
     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
@@ -1561,6 +1563,7 @@
   DivPageFormIDList.Free; //要當分案頁表單清單
   LastInitFormidList.Free;
   LastAddFormidList.Free;
+  SampleFormIDList.Free;
   //********清單區********
   if FEvents <> nil then FEvents.OnDestroy;
 end;
@@ -3377,6 +3380,7 @@
 var
   SampleFormID : String;
   SendData : String;
+  buttonSelected : Integer;
 begin
   ScanMode := smSample;
   ClearView(1);
@@ -3389,6 +3393,19 @@
   ShowText := _Msg('範本掃描中,請稍候');
   DataLoading(True,True);
   SampleFormID := UpperCase(InputBox(_Msg('範本檔掃瞄輸入畫面'),_Msg('請輸入文件編號'),''));
+
+  if SampleFormIDList.IndexOf(SampleFormID)<>-1 then
+  begin
+    // Show a custom dialog
+    buttonSelected := messagedlg(SampleFormID+'已有範本,是否取代?',mtCustom,
+                                [mbYes,mbCancel], 0);
+    if buttonSelected = mrCancel then
+    begin
+      DataLoading(false,false);
+      Exit;
+    end;
+  end;
+
   if SampleFormID <> '' then
   begin
     if FormIDExists(SampleFormID,False,0) then
@@ -3701,6 +3718,10 @@
   ShowMessage('MEMO_INF_List='+MEMO_INF_List.Text)         ;
   ShowMessage('WORK_INF_List='+WORK_INF_List.Text)          ;
   ShowMessage('LASTEST_FORM_INF_List='+LASTEST_FORM_INF_List.Text)   ;
+  ShowMessage('SampleFormIDList='+SampleFormIDList.Text);
+//  SampleFormIDList.Add('31A00101011706A');
+//  SampleFormIDList.Add('31A00101021706A');
+//  SampleFormIDList.Add('31A00101031706A');
 end;
 
 procedure TCB_IMGPSScanX.StatrTwainScan;
@@ -4843,6 +4864,39 @@
     ServerTime := Copy(ServerDate,9,6);
     ServerDate := Copy(ServerDate,1,8);
     Balance := GetBalance(ServerTime); //Server 跟Local的時間差
+    Result := True;
+  end
+  Else if Pos('<script type="text/javascript" src="scripts/CW00/login.js"></script>',Memo1.Lines.Text) > 0 then
+  begin
+    HttpErrStr := _Msg('錯誤原因:')+_Msg('閒置過久或被登出,請重新登入');
+    Result := False;
+    Exit;
+  end;
+
+end;
+
+Function TCB_IMGPSScanX.GetSampleInf : Boolean;
+var
+  str:String;
+begin
+  Result := False;
+  If not ProcessServlet_Get(HTTPSClient,FURL+'service/imgpsc/IMGPSC01/serversampleforocx','work_no='+FWork_no,FReWrite,Memo1,False) Then
+  begin
+    HttpErrStr := _Msg('錯誤代碼:')+inttostr(HttpError.HttpErrorCode)+','+HttpError.HttpReason;
+    Result := False;
+    Exit;
+  end;
+  IF memo1.Lines.Strings[0] = '1' Then
+  begin
+    HttpErrStr := _Msg('錯誤原因:')+memo1.Lines.Strings[1];
+    Result := False;
+    Exit;
+  end
+  Else IF memo1.Lines.Strings[0] = '0' Then
+  begin
+    str := memo1.Lines.Strings[1];
+    SampleFormIDList.CommaText:=str;
+    
     Result := True;
   end
   Else if Pos('<script type="text/javascript" src="scripts/CW00/login.js"></script>',Memo1.Lines.Text) > 0 then
@@ -13135,6 +13189,7 @@
   DivPageFormIDList := TStringList.Create; //要當分案頁表單清單
   LastInitFormidList :=TStringList.Create;
   LastAddFormidList := TStringList.Create;
+  SampleFormIDList := TStringList.Create;//20170627 加入
   //********清單區********
 
   ShowText := _Msg('資料載入中,請稍候');
@@ -13146,6 +13201,19 @@
     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  文件資訊
@@ -13496,6 +13564,8 @@
       ShowText := CaseID+_Msg('資料上傳中,請稍候');
       DataLoading(True,True);
 //ShowMessage('NNNNN');
+//ShowMessage('退出');
+//Exit;
       If Not TransCaseID(TransPath,CaseID,True) Then  //傳送案件
       begin
         DataLoading(False,False);

--
Gitblit v1.8.0