From 2eea00a047ded1eb4706e02e453aadc22a88b9e7 Mon Sep 17 00:00:00 2001
From: doom4ster <doom4ster@gmail.com>
Date: 星期五, 28 七月 2017 14:03:17 +0800
Subject: [PATCH] CB_IMGPSScan.cab ver2.0.1.24  掃瞄完後的影像開起抗鋸齒

---
 CB_IMGPSScanImp.pas |  226 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 193 insertions(+), 33 deletions(-)

diff --git a/CB_IMGPSScanImp.pas b/CB_IMGPSScanImp.pas
index 46e6fc7..4794b82 100644
--- a/CB_IMGPSScanImp.pas
+++ b/CB_IMGPSScanImp.pas
@@ -145,7 +145,6 @@
     ISB2: TImageScrollBox;
     imgp1: TPanel;
     lb1: TLabel;
-    ISB1: TImageScrollBox;
     Memo1: TMemo;
     Display1: TMemo;
     Panel22: TPanel;
@@ -255,6 +254,8 @@
     ISB_BW: TImageScrollBox;
     N1: TMenuItem;
     N2: TMenuItem;
+    ISB1: TImageScrollBox;
+    Label3: TLabel;
     procedure ActiveFormCreate(Sender: TObject);
     procedure Panel9Resize(Sender: TObject);
     procedure ISB1Click(Sender: TObject);
@@ -485,6 +486,7 @@
     LastInitFormidList:TStringList;
     LastAddFormidList:TstringList;
     SampleFormIDList:TStringList; //20170627 已存在範本的formid
+    ExistImgList:TStringList;  //20170724  已經存在的影像list for ESCAN  //Img的完整路徑
     //********清單區********
 
     //********顯示區********
@@ -832,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;
@@ -1201,6 +1204,54 @@
   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;
 begin
   inherited Initialize;
@@ -1261,7 +1312,7 @@
 
 procedure TCB_IMGPSScanX.ISB1Enter(Sender: TObject);
 begin
-  ISB1.SetFocus;
+  //ISB1.SetFocus;
 end;
 
 procedure TCB_IMGPSScanX.ISB1ImageMouseDown(Sender: TObject; Button: TMouseButton;
@@ -1270,7 +1321,7 @@
   p : Integer;
 begin
   DisplayISB := TImageScrollBox(Sender);
-  DisplayISB.SetFocus;
+  //DisplayISB.SetFocus;
   Shape1.Left := TPanel(TImageScrollBox(Sender).Parent).Left - Seg;
   Shape1.Top := TPanel(TImageScrollBox(Sender).Parent).Top - Seg;
   P := strtoint(copy(DisplayISB.Name,4,1)) + ScrollBar1.Position-2;
@@ -1303,12 +1354,19 @@
 procedure TCB_IMGPSScanX.ISB1ImageMouseMove(Sender: TObject; Shift: TShiftState;
   X, Y: Integer);
 begin
-   Edit1.SetFocus;
+   //Edit1.SetFocus;
   //TImageScrollBox(Sender).SetFocus;
   if TImageScrollBox(Sender).FileName = '' then
+  begin
+//ShowMessage('AAA');
+Label3.Caption:='FileName='+TImageScrollBox(Sender).FileName+'  time='+FormatDateTime('yyyy/mm/dd HH:MM:SS', now);
     TImageScrollBox(Sender).MouseMode := mmUser
+  end
   Else
+  begin
+Label3.Caption:='FileName='+TImageScrollBox(Sender).FileName;
     ViewMouseMode(NowClick);
+  end;
 end;
 
 procedure TCB_IMGPSScanX.ISB1ImageMouseUp(Sender: TObject; Button: TMouseButton;
@@ -1564,6 +1622,7 @@
   LastInitFormidList.Free;
   LastAddFormidList.Free;
   SampleFormIDList.Free;
+  ExistImgList.Free;
   //********清單區********
   if FEvents <> nil then FEvents.OnDestroy;
 end;
@@ -2117,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;
@@ -2593,12 +2654,14 @@
         ShowText :=_Msg('檔案加入中,請稍候('+inttostr(i)+'/'+inttostr(P)+')');
         DataLoading(True,True);
         ISB.LoadFromFile(FName,i);
+//ISB.SaveToFile('C:\OCX\aaaaaa'+IntToStr(i)+'.tif');
         DeskewImg(ISB.Graphic);
+//ISB.SaveToFile('C:\OCX\bbbbbb'+IntToStr(i)+'.tif');
         if (TreeView1.Selected = NewTreeNode) or (TreeView1.Selected = MyTreeNode1) then
         begin
           SaveFilename := '';
           MpsGetBarcode(ISB.Graphic,MpsBarcodeinf);
-          for n := 1 to MpsBarcodeinf.Count-1  do
+          for n := 1 to MpsBarcodeinf.Count  do
           begin
             if MpsBarcodeinf.r180[n] <> 0 then  //依條碼角度轉影像
             begin
@@ -2663,6 +2726,17 @@
             SaveFilename:= Add_Zoo(ContextList.Count+1,3)+ext
           Else
             SaveFilename := Add_Zoo(ContextList.Count+1,3)+'_'+SaveFilename+ext;
+
+          for n := 1 to MpsBarcodeinf.Count  do
+          begin
+            if MpsBarcodeinf.r180[n] <> 0 then  //依條碼角度轉影像
+            begin
+              Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]);
+              MpsGetBarcode(ISB.Graphic,MpsBarcodeinf);
+              Break;
+            end;
+          end;
+          //Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]);  //20170705 加入有條碼就轉正
           ISB.SaveToFile(SavePath+SaveFilename);
 
           SetContextList('A',-1,CaseID,DocDir,SaveFilename);
@@ -2691,6 +2765,17 @@
             SaveFilename := Add_Zoo(ContextList.Count+1,3)+'_'+NowFormCode+ext
           else
             SaveFilename := Add_Zoo(ContextList.Count+1,3)+ext;
+
+          for n := 1 to MpsBarcodeinf.Count  do
+          begin
+            if MpsBarcodeinf.r180[n] <> 0 then  //依條碼角度轉影像
+            begin
+              Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]);
+              MpsGetBarcode(ISB.Graphic,MpsBarcodeinf);
+              Break;
+            end;
+          end;
+          //Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]); //20170705 加入有條碼就轉正
           ISB.SaveToFile(SavePath+SaveFilename);
           ContextList.Add(SaveFilename);
           ContextList.SaveToFile(SavePath+'Context.dat');
@@ -3264,6 +3349,8 @@
     if FMode='ESCAN' then
     begin
       PM101.Visible := False;
+      PM108.Visible := False;
+      PM110.Visible := False;
     end;
   end;
 
@@ -3324,17 +3411,29 @@
 
 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;  //刪除
-  if ((NowDocNo = 'Attach') or (NowDocNo = 'S_Attach')) and (FCustDocYN <> 'N') then
-    PM602.Visible := True;  //自行定義文件名稱
-  //PM603.Visible := True;  //掃描替換此頁
-  PM604.Visible := True;  //歪斜矯正
-  PM601.Visible := True;  //歸類
   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;  //自行定義文件名稱
+    //PM603.Visible := True;  //掃描替換此頁
+    PM604.Visible := True;  //歪斜矯正
+    PM601.Visible := True;  //歸類
+    PM605.Visible := True;  //刪除
+  end;
 
   if CheckSelectImg_UseCase(DisplayPath,NowCaseNo) then //選擇的影像不可有引用的
   begin
@@ -3346,6 +3445,17 @@
     PM601.Enabled := True;  //歸類
     PM605.Enabled := True;  //刪除
   end;
+
+  if FMode='ESCAN' then
+  begin
+    PM605.Enabled:=False;
+  end;
+
+  if FImgDelete='Y' then
+  begin
+    PM605.Enabled:=True;
+  end;
+
 end;
 
 procedure TCB_IMGPSScanX.PrePageBtnClick(Sender: TObject);
@@ -3657,7 +3767,7 @@
   //CreateFormID_FormName(DisplayPath);  //產生FormID_FormName.dat
   //CreateDocNo_DocName(DisplayPath); //產生DocNo_Name.dat
   //Showmessage(CreateDocNo_Info(DisplayPath));  //產生 Docno,份數,頁數;Docno,份數,頁數 的回傳字串
-
+  lb1.Caption:='AAAAAAAAAAA';
   //Showmessage(CreateDocnoFrom_Info(NowCaseno));
   //Showmessage(self.CreateCustDocNoFrom_Info(NowCaseno));
 
@@ -3693,6 +3803,11 @@
     'FIsExternal='+    FIsExternal+#10#13+
     'FCheck_main_form='+    FCheck_main_form);
 
+ { ShowMessage('UpLPoint='+IntToStr(UpLPoint.X)+','+IntToStr(UpLPoint.Y)+#10#13+
+    'UpRPoint='+IntToStr(UpRPoint.X)+','+IntToStr(UpRPoint.Y)+#10#13+
+    'DownLPoint='+IntToStr(DownLPoint.X)+','+IntToStr(DownLPoint.Y)+#10#13+
+    'DownRPoint='+IntToStr(DownRPoint.X)+','+IntToStr(DownRPoint.Y));
+  }
 end;
 
 procedure TCB_IMGPSScanX.Button4Click(Sender: TObject);
@@ -3703,6 +3818,8 @@
   //Showmessage(self.Doc_Inf_List.Text);
   //LoadImgFile;
   //LoadImgFile1;
+  //ISB1.MouseMode:=mmAmplifier;
+
   str:='';
   for I := 1 to 11 do // 看 OMRErrInfo 的內容
   begin
@@ -3719,6 +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');
@@ -3739,6 +3858,7 @@
   ScanInfo.Graphic := TTiffGraphic.Create;
   try
     ISB := nil; //規零
+//ShowMessage(IntToStr(ScanDpi));
     Scanner.RequestedXDpi := ScanDpi;
     Scanner.RequestedYDpi := ScanDpi;
     Scanner.RequestedImageFormat := ScanColor;
@@ -4061,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
 
@@ -4072,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
@@ -4461,21 +4584,39 @@
   W,H : Integer;
 begin
   Result := 0;
+//ShowMessage('GetSiteOMR');
+
   IF (ImageScrollBox1.FileName <> FileName) and (FileName <> '') then
   begin
+//ShowMessage('11111'+ImageScrollBox1.FileName+#10#13+FileName);
     ImageScrollBox1.LoadFromFile(FileName,1);
-    FindPoint(ImageScrollBox1.Graphic,UpLPoint,UpRPoint,DownLPoint,'NONE');
+{
+ShowMessage('UpLPoint='+IntToStr(UpLPoint.X)+','+IntToStr(UpLPoint.Y)+#10#13+
+'UpRPoint='+IntToStr(UpRPoint.X)+','+IntToStr(UpRPoint.Y)+#10#13+
+'DownLPoint='+IntToStr(DownLPoint.X)+','+IntToStr(DownLPoint.Y)+#10#13+
+'DownRPoint='+IntToStr(DownRPoint.X)+','+IntToStr(DownRPoint.Y));
+    FindPoint(ImageScrollBox1.Graphic,UpLPoint,UpRPoint,DownLPoint,'');
+ShowMessage('UpLPoint='+IntToStr(UpLPoint.X)+','+IntToStr(UpLPoint.Y)+#10#13+
+'UpRPoint='+IntToStr(UpRPoint.X)+','+IntToStr(UpRPoint.Y)+#10#13+
+'DownLPoint='+IntToStr(DownLPoint.X)+','+IntToStr(DownLPoint.Y)+#10#13+
+'DownRPoint='+IntToStr(DownRPoint.X)+','+IntToStr(DownRPoint.Y));
+}
     ClearLine(ISB_BW.Graphic,bt);
     ISB_BW.Redraw(True);
     Application.ProcessMessages;
   end;
   If ImageScrollBox1.FileName <> '' Then
   begin
+
+//ShowMessage('22222'+ImageScrollBox1.FileName);
     Xdpi := ImagescrollBox1.Graphic.XDotsPerInch;
     Ydpi := ImagescrollBox1.Graphic.YDotsPerInch;
     H := ImageScrollBox1.Graphic.Height;
     W := ImageScrollBox1.Graphic.Width;
+//ShowMessage('Xdpi='+IntToStr(Xdpi)+#10#13+'Ydpi='+IntToStr(Ydpi)+#10#13+'H='+IntToStr(H)+#10#13+'W='+IntToStr(W)+#10#13);
+//ShowMessage('Site='+Site);
     OMRRect := CM_Str2Rect(Site,Xdpi,UpLPoint);
+//ShowMessage(IntToStr(OMRRect.Left)+#10#13+IntToStr(OMRRect.top)+#10#13+IntToStr(OMRRect.Right)+#10#13+IntToStr(OMRRect.Bottom));
     if OMRRect.Left < 0 then
       OMRRect.Left := 0;
     if OMRRect.Top < 0  then
@@ -4486,6 +4627,7 @@
       OMRRect.Bottom := ImageScrollBox1.Graphic.Height;
 
     result := Get_OMR(ISB_BW.Graphic,OMRRect);
+//ShowMessage('result='+IntToStr(result));
   end;
 end;
 
@@ -4527,7 +4669,7 @@
           DeviceDeleteSize := ini.ReadInteger('DeviceDelete','Size_New',Def_DeviceDeleteSize);
           ScannerReverse := ini.ReadBool('Scanner','Reverse',Def_ScannerReverse);
           BoardClear := ini.ReadBool('Scanner','BoardClear',Def_BoardClear);
-          ScanDpi := ini.ReadInteger('Scanner','Dpi',Def_ScanDpi);
+          //ScanDpi := ini.ReadInteger('Scanner','Dpi',Def_ScanDpi);
           //ScanDuplex := ini.ReadBool('Scanner','Duplex',Def_ScanDuplex);
           ScanRotate := ini.ReadInteger('Scanner','ScanRotate',Def_ScanRotate);
           ScanDeskew := ini.ReadBool('Scanner','ScanDeskew',Def_ScanDeskew);
@@ -4541,7 +4683,7 @@
           ini.WriteInteger('DeviceDelete','Size_New',DeviceDeleteSize);
           ini.WriteBool('Scanner','Reverse',ScannerReverse);
           ini.WriteBool('Scanner','BoardClear',BoardClear);
-          ini.ReadInteger('Scanner','Dpi',ScanDpi);
+          //ini.ReadInteger('Scanner','Dpi',ScanDpi);
           //ini.WriteBool('Scanner','Duplex',ScanDuplex);
           ini.WriteInteger('Scanner','ScanRotate',ScanRotate);
           ini.WriteBool('Scanner','ScanDeskew',ScanDeskew);
@@ -4770,6 +4912,7 @@
   Md : TMouseMode;
   ISB : TImageScrollBox;
 begin
+//ShowMessage(IntToStr(v));
   case v of
    -1 : Md := TMouseMode(mmUser);
     0 : Md := TMouseMode(mmAmplifier);
@@ -4784,6 +4927,7 @@
   begin
     ISB := TImageScrollBox(FindComponent('ISB'+inttostr(i)));
     ISB.MouseMode := TMouseMode(Md);
+    //Label3.Caption:='v='+IntToStr(v)+'  time'+FormatDateTime('yyyy/mm/dd HH:MM:SS', now);
   end;
 end;
 
@@ -7640,6 +7784,7 @@
   ErrlistForm : TErrlistForm;
   S : TStringlist;
   UpFormID : String;
+  Anchor : String;
 begin
   ShowText := _Msg('處理檢核失敗中,請稍候');
   DataLoading(True,True);
@@ -8569,7 +8714,7 @@
   end;
 end;
 
-Function TCB_IMGPSScanX.Case2Mask(SoPath,DePath:String):Boolean;//產生遮罩影像
+Function TCB_IMGPSScanX.Case2Mask(SoPath,DePath:String):Boolean;//產生遮罩影像  20170639 發現沒用到
 var
   XT : TXMLTool;
   i : Integer;
@@ -10189,6 +10334,12 @@
       end;
     end;}
 
+    if FMode='ESCAN' then
+    begin
+      InitExistImgList(DeDir);
+    end;
+
+
   finally
   iFileList.Free;
   FileList.Free;
@@ -10652,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') then  //簽署章件會換主FormID,先跳過
+            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
@@ -10780,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]);
@@ -10844,6 +10997,8 @@
                       SiteRec := SiteRec+'@'+Site;
                     //有填就ok
                     //Showmessage(ColCName +','+ inttostr(OMRMpsV1.GetSiteOMR(ImageSavePath+CaseID+'\upload\'+OMRFile,Site))+','+inttostr(Pixel + SafePixel));
+//SafePixel:=90000;
+//ShowMessage(ColEName+' '+ColCName+'   圖像實際點數='+IntToStr(GetSiteOMR(ImageSavePath+CaseID+'\upload\'+OMRFile,Site,Bt))+' 設定點數='+IntToStr( (Pixel + SafePixel)));
                     if GetSiteOMR(ImageSavePath+CaseID+'\upload\'+OMRFile,Site,Bt) > (Pixel + SafePixel)  then
                     begin
                       //Showmessage('oh');
@@ -11461,7 +11616,7 @@
        begin
          inc(Ct);
          ISB := TImageScrollBox(FindComponent(ISBName+intToStr(Ct)));
-         ISB.AntiAliased := False;
+         ISB.AntiAliased := True;
          if ISB.ZoomPercent > 100  then
            ISB.AntiAliased := False;
          ISB.LoadFromFile(Path+iDocNo+'\'+ContextList.Strings[n],1);
@@ -13080,6 +13235,7 @@
   i: Integer;
 begin
   Timer1.Enabled := False;
+
   //Showmessage('a');
   //self.FIs_OldCase := 'Y';
   PageLVclear := True;
@@ -13190,6 +13346,7 @@
   LastInitFormidList :=TStringList.Create;
   LastAddFormidList := TStringList.Create;
   SampleFormIDList := TStringList.Create;//20170627 加入
+  ExistImgList := TStringList.Create;  //20170724 新增
   //********清單區********
 
   ShowText := _Msg('資料載入中,請稍候');
@@ -13287,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);
@@ -13403,8 +13565,9 @@
     DenialTimeLb.Visible := True;
     DenialTimeLb.Caption := Format(ScanDenialHint,[ScanDenialTime]);
   end;
-
+//ShowMessage(IntToStr(ScanDpi));
   R_W_Scanini('R'); //掃瞄設定的ini
+//ShowMessage(IntToStr(ScanDpi));
   ScanDuplexCB.Checked := ScanDuplex;
   if FMode <> 'SAMPLESCAN' then
     LoadImgFile;
@@ -13422,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);
@@ -13547,7 +13708,7 @@
           begin
             ShowText := CaseID+_Msg('檢核中,請稍候');
             DataLoading(True,True);
-            If not OMRCheckCase(CaseID) then
+            If not OMRCheckCase(CaseID) then  //進檢核
             begin
               Inc(CheckErrCount);
               Continue;
@@ -13564,8 +13725,7 @@
       ShowText := CaseID+_Msg('資料上傳中,請稍候');
       DataLoading(True,True);
 //ShowMessage('NNNNN');
-//ShowMessage('退出');
-//Exit;
+//ShowMessage('退出');DataLoading(False,False);Exit;
       If Not TransCaseID(TransPath,CaseID,True) Then  //傳送案件
       begin
         DataLoading(False,False);

--
Gitblit v1.8.0