From b111f71b6da6aab15250192f97b0e5ace6c05df6 Mon Sep 17 00:00:00 2001
From: doom4ster <doom4ster@gmail.com>
Date: 星期三, 26 七月 2017 11:30:36 +0800
Subject: [PATCH] CB_IMGPSScan.cab ver2.0.1.23 檢核不檔無主FormID 因為server會檢查必要FromID

---
 CB_IMGPSScanImp.dcu |    0 
 CB_IMGPSScan.ocx    |    0 
 CB_IMGPSScan.dproj  |    4 +-
 CB_IMGPSScan.res    |    0 
 CB_IMGPSScanImp.pas |  113 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 ErrList.dfm         |    1 
 6 files changed, 100 insertions(+), 18 deletions(-)

diff --git a/CB_IMGPSScan.dproj b/CB_IMGPSScan.dproj
index a5a440e..0bc6216 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">22</VersionInfo>
+						<VersionInfo Name="Build">23</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.22</VersionInfoKeys>
+						<VersionInfoKeys Name="FileVersion">2.0.1.23</VersionInfoKeys>
 						<VersionInfoKeys Name="InternalName"/>
 						<VersionInfoKeys Name="LegalCopyright"/>
 						<VersionInfoKeys Name="LegalTrademarks"/>
diff --git a/CB_IMGPSScan.ocx b/CB_IMGPSScan.ocx
index 34c0cf4..dc4b1f4 100644
--- a/CB_IMGPSScan.ocx
+++ b/CB_IMGPSScan.ocx
Binary files differ
diff --git a/CB_IMGPSScan.res b/CB_IMGPSScan.res
index 2376753..9347acb 100644
--- a/CB_IMGPSScan.res
+++ b/CB_IMGPSScan.res
Binary files differ
diff --git a/CB_IMGPSScanImp.dcu b/CB_IMGPSScanImp.dcu
index fbff670..4d11bcf 100644
--- a/CB_IMGPSScanImp.dcu
+++ b/CB_IMGPSScanImp.dcu
Binary files differ
diff --git a/CB_IMGPSScanImp.pas b/CB_IMGPSScanImp.pas
index 6841dcf..c77f289 100644
--- a/CB_IMGPSScanImp.pas
+++ b/CB_IMGPSScanImp.pas
@@ -486,6 +486,7 @@
     LastInitFormidList:TStringList;
     LastAddFormidList:TstringList;
     SampleFormIDList:TStringList; //20170627 已存在範本的formid
+    ExistImgList:TStringList;  //20170724  已經存在的影像list for ESCAN  //Img的完整路徑
     //********清單區********
 
     //********顯示區********
@@ -833,6 +834,7 @@
     function checkFormCodeIsCustom(path,formcode:string):boolean;
     function ISDivPageFormID(FormID: String): Boolean;
     function GetSampleInf: Boolean;
+    procedure InitExistImgList(casepath:String);
   protected
     { Protected declarations }
     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
@@ -1200,6 +1202,54 @@
   EnableImage(6 ,Sender);
   NowClick := 6;}
   PM605Click(nil);
+end;
+
+procedure TCB_IMGPSScanX.InitExistImgList(casepath: String);
+var
+  ST1,ST2,ST3,ST4:TStringList;
+  i,j,k:Integer;
+begin
+//ShowMessage('casepath='+casepath);
+  ST1:=TStringList.Create;
+  ST2:=TStringList.Create;
+  ST3:=TStringList.Create;
+  ST4:=TStringList.Create;
+//FImgDelete:='Y';
+  if FileExists(casepath+'CaseDocNo.dat') then
+  begin
+    ST1.LoadFromFile(casepath+'CaseDocNo.dat');
+    for I := 0 to ST1.Count - 1 do
+    begin
+      ST2.LoadFromFile(casepath+ST1.Strings[i]+'\Context.dat');
+      for j := 0 to ST2.Count - 1 do
+      begin
+        ExistImgList.Add(casepath+ST1.Strings[i]+'\'+ST2.Strings[j])
+      end;
+    end;
+  end;
+
+  if FileExists(casepath+'S_Attach\Context.dat') then
+  begin
+    ST3.LoadFromFile(casepath+'S_Attach\Context.dat');
+    for I := 0 to ST3.Count - 1 do
+    begin
+      ExistImgList.Add(casepath+'S_Attach\'+ST3.Strings[i])
+    end;
+  end;
+
+  if FileExists(casepath+'Attach\Context.dat') then
+  begin
+    ST3.LoadFromFile(casepath+'Attach\Context.dat');
+    for I := 0 to ST3.Count - 1 do
+    begin
+      ExistImgList.Add(casepath+'Attach\'+ST3.Strings[i])
+    end;
+  end;
+
+  ST1.Free;
+  ST2.Free;
+  ST3.Free;
+//ShowMessage('ExistImgList='+ExistImgList.Text);
 end;
 
 procedure TCB_IMGPSScanX.Initialize;
@@ -1572,6 +1622,7 @@
   LastInitFormidList.Free;
   LastAddFormidList.Free;
   SampleFormIDList.Free;
+  ExistImgList.Free;
   //********清單區********
   if FEvents <> nil then FEvents.OnDestroy;
 end;
@@ -2125,6 +2176,8 @@
       //Showmessage(Components[i].Name);
       iISBName := ShapeName2PreViewISBName(TShape(Components[i]));
       iISB := TImageScrollBox(FindComponent(iISBName));
+//ShowMessage('iISB.FileName='+iISB.FileName);
+//ShowMessage(ExtractFilePath(iISB.FileName)+','+ExtractFileName(iISB.FileName)+','+NowCaseNo);
       DeleteImageFile(ExtractFilePath(iISB.FileName),ExtractFileName(iISB.FileName),NowCaseNo);
     end;
   end;
@@ -3296,6 +3349,8 @@
     if FMode='ESCAN' then
     begin
       PM101.Visible := False;
+      PM108.Visible := False;
+      PM110.Visible := False;
     end;
   end;
 
@@ -3356,11 +3411,21 @@
 
 procedure TCB_IMGPSScanX.PopupMenu6Popup(Sender: TObject);
 begin
-  PM601.Visible := False;  //歸類
-  PM602.Visible := False;  //自行定義文件名稱
+  PM601.Visible := True;  //歸類
+  PM602.Visible := True;  //自行定義文件名稱
   PM603.Visible := False;  //掃描替換此頁
   PM604.Visible := False;  //歪斜矯正
-  PM605.Visible := False;  //刪除
+  PM605.Visible := True;  //刪除
+
+  if FMode='ESCAN' then
+  begin
+    PM601.Visible := False;  //歸類
+    PM602.Visible := False;  //自行定義文件名稱
+    PM603.Visible := False;  //掃描替換此頁
+    PM604.Visible := False;  //歪斜矯正
+    PM605.Visible := False;  //刪除
+  end;
+
   if ((NowDocNo = 'Attach') or (NowDocNo = 'S_Attach')) and (FCustDocYN <> 'N') then
   begin
     PM602.Visible := True;  //自行定義文件名稱
@@ -3753,9 +3818,9 @@
   //Showmessage(self.Doc_Inf_List.Text);
   //LoadImgFile;
   //LoadImgFile1;
-  ISB1.MouseMode:=mmAmplifier;
+  //ISB1.MouseMode:=mmAmplifier;
 
- { str:='';
+  str:='';
   for I := 1 to 11 do // 看 OMRErrInfo 的內容
   begin
   str:=str+BoolToStr(OMRErrInfo[i].Display,true)+','
@@ -3771,7 +3836,8 @@
   ShowMessage('WORK_INF_List='+WORK_INF_List.Text)          ;
   ShowMessage('LASTEST_FORM_INF_List='+LASTEST_FORM_INF_List.Text)   ;
   ShowMessage('SampleFormIDList='+SampleFormIDList.Text);
-  }
+  ShowMessage('ExistImgList='+ExistImgList.Text);
+
 //  SampleFormIDList.Add('31A00101011706A');
 //  SampleFormIDList.Add('31A00101021706A');
 //  SampleFormIDList.Add('31A00101031706A');
@@ -4115,6 +4181,9 @@
             FormID := NowGuideFormID;
           DocNo := FormCode2DocNo(FormID);
 //ShowMessage('FormID='+FormID);
+//ShowMessage('ISDivPageFormID(FormID)='+BoolToStr(ISDivPageFormID(FormID),true));
+//ShowMessage('FindDivFormCode(FormID)='+BoolToStr(FindDivFormCode(FormID),true));
+//ShowMessage('A NowDivPageFormID='+NowDivPageFormID+#10#13+'FormID='+FormID+#10#13+'ScanCaseno='+ScanCaseno);
           if (FormID <>'') and FindDivFormCode(FormID) and (NowDivPageFormID <> '')  Then  //只找分案頁上的案件條碼
           begin
 
@@ -4126,7 +4195,7 @@
             ScanCaseno := BarCode2CaseID; //取出案件編號
             NowGuideFormID := '';
             NowDivPageFormID :='';
-//ShowMessage('NowGuideFormID='+NowGuideFormID+#10#13+'FormID='+FormID+#10#13+'ScanCaseno='+ScanCaseno);
+//ShowMessage('B NowGuideFormID='+NowGuideFormID+#10#13+'FormID='+FormID+#10#13+'ScanCaseno='+ScanCaseno);
           end;
           if ScanCaseno = '' then //一開始都沒找到
           begin
@@ -10265,6 +10334,12 @@
       end;
     end;}
 
+    if FMode='ESCAN' then
+    begin
+      InitExistImgList(DeDir);
+    end;
+
+
   finally
   iFileList.Free;
   FileList.Free;
@@ -10728,17 +10803,18 @@
 //ShowMessage('MainFormID='+MainFormID);
         if MainFormID = ''then
         begin
-          //20131203 yuu說不檢查這個,先拿掉   20170315 楷琳說未歸類要擋
-          if FCheck_main_form='Y' then
+          //20131203 yuu說不檢查這個,先拿掉   20170315 楷琳說未歸類要擋  20170726 因此有檢查必要FormID  所以 可以拿掉
+          {if FCheck_main_form='Y' then
           begin
             if (FMode <> 'SSCAN') AND (FMode<>'ESCAN') then  //簽署章件會換主FormID,先跳過 20170629 ESCAN 也不檢查
             begin
               ErrStr:=_Msg('找不到分案文件');   //找不到主文件
               OMRErr2ini(CaseID,ErrStr,'','','','','','',False,False,True);
               CaseOk := false;
+//ShowMessage('AAAAA');
             end;
           end;
-
+          }
         end
         Else
         begin
@@ -10856,6 +10932,7 @@
       DistinctFormCode(CaseID);
       if ModeNeedCheck(OMRErrInfo[10].Mode,FMode) then //是否要檢核
       begin
+//ShowMessage(OMRFileList.Text);
         For i := 0 to OMRFileList.Count - 1 do
         begin
           FormCode := FileName2FormCode(OMRFileList.Strings[i]);
@@ -13269,6 +13346,7 @@
   LastInitFormidList :=TStringList.Create;
   LastAddFormidList := TStringList.Create;
   SampleFormIDList := TStringList.Create;//20170627 加入
+  ExistImgList := TStringList.Create;  //20170724 新增
   //********清單區********
 
   ShowText := _Msg('資料載入中,請稍候');
@@ -13366,14 +13444,19 @@
   initkscan;
   if ImagePath[Length(ImagePath)] <> '\' then
     ImagePath := ImagePath + '\';
+//ShowMessage('ImagePath='+ImagePath);
   CheckXmlPath := ImagePath+'OMRSITE\'+FWork_No;
+//ShowMessage('CheckXmlPath='+CheckXmlPath);
   SitePath := ImagePath+'Site\'+FWork_No+'\';
   LngPath := ImagePath;
   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+'\';
-//ShowMessage('ImagePath='+ImagePath);
+  ImagePath := StringReplace(ImagePath, '\\', '\',[rfReplaceAll, rfIgnoreCase]);
+//ShowMessage('BB  ImagePath='+ImagePath);
   ImageSavePath := ImagePath;
   str2dir(CheckXmlPath);
   str2dir(SitePath);
@@ -13502,11 +13585,9 @@
   Splitter2.Visible := True;
   AttFileGB.Visible := False; //附加電子檔窗
   Splitter2.Visible := False; }
-
+//ShowMessage('ImageSavePath='+ImageSavePath);
   DataLoading(False,False);
-//ShowMessage('初始話執行完成');
-//ShowMessage('GuideFormIDList='+GuideFormIDList.Text);
-//ShowMessage('DivPageFormIDList='+DivPageFormIDList.Text);
+
 end;
 
 procedure TCB_IMGPSScanX.Timer2Timer(Sender: TObject);
@@ -13627,7 +13708,7 @@
           begin
             ShowText := CaseID+_Msg('檢核中,請稍候');
             DataLoading(True,True);
-            If not OMRCheckCase(CaseID) then
+            If not OMRCheckCase(CaseID) then  //進檢核
             begin
               Inc(CheckErrCount);
               Continue;
diff --git a/ErrList.dfm b/ErrList.dfm
index 76444a0..a85f3f9 100644
--- a/ErrList.dfm
+++ b/ErrList.dfm
@@ -395,6 +395,7 @@
         Height = 25
         Caption = 'Button1'
         TabOrder = 7
+        Visible = False
         OnClick = Button1Click
       end
     end

--
Gitblit v1.8.0