From e4b3e3e6e218c42f633aeee5365909bd0bde3c79 Mon Sep 17 00:00:00 2001
From: doom4ster <doom4ster@gmail.com>
Date: 星期一, 14 八月 2017 17:24:07 +0800
Subject: [PATCH] CB_IMGPSScan.cab ver2.0.1.31 修正 檢核相關視窗定位

---
 CB_IMGPSScanImp.dcu |    0 
 ErrList.dcu         |    0 
 CB_IMGPSScan.ocx    |    0 
 ErrList.pas         |   20 ++++++
 CB_IMGPSScan.dproj  |    4 
 CB_IMGPSScan.res    |    0 
 CB_IMGPSScanImp.pas |  144 +++++++++++++++++++++++++++++++-----------------
 7 files changed, 113 insertions(+), 55 deletions(-)

diff --git a/CB_IMGPSScan.dproj b/CB_IMGPSScan.dproj
index 49e0a8a..263ae3a 100644
--- a/CB_IMGPSScan.dproj
+++ b/CB_IMGPSScan.dproj
@@ -95,7 +95,7 @@
 						<VersionInfo Name="MajorVer">2</VersionInfo>
 						<VersionInfo Name="MinorVer">0</VersionInfo>
 						<VersionInfo Name="Release">1</VersionInfo>
-						<VersionInfo Name="Build">29</VersionInfo>
+						<VersionInfo Name="Build">31</VersionInfo>
 						<VersionInfo Name="Debug">False</VersionInfo>
 						<VersionInfo Name="PreRelease">False</VersionInfo>
 						<VersionInfo Name="Special">False</VersionInfo>
@@ -107,7 +107,7 @@
 					<VersionInfoKeys>
 						<VersionInfoKeys Name="CompanyName"/>
 						<VersionInfoKeys Name="FileDescription"/>
-						<VersionInfoKeys Name="FileVersion">2.0.1.29</VersionInfoKeys>
+						<VersionInfoKeys Name="FileVersion">2.0.1.31</VersionInfoKeys>
 						<VersionInfoKeys Name="InternalName"/>
 						<VersionInfoKeys Name="LegalCopyright"/>
 						<VersionInfoKeys Name="LegalTrademarks"/>
diff --git a/CB_IMGPSScan.ocx b/CB_IMGPSScan.ocx
index 3b7085e..a1bc5e0 100644
--- a/CB_IMGPSScan.ocx
+++ b/CB_IMGPSScan.ocx
Binary files differ
diff --git a/CB_IMGPSScan.res b/CB_IMGPSScan.res
index ee2ab4b..2289e7d 100644
--- a/CB_IMGPSScan.res
+++ b/CB_IMGPSScan.res
Binary files differ
diff --git a/CB_IMGPSScanImp.dcu b/CB_IMGPSScanImp.dcu
index e159337..026625c 100644
--- a/CB_IMGPSScanImp.dcu
+++ b/CB_IMGPSScanImp.dcu
Binary files differ
diff --git a/CB_IMGPSScanImp.pas b/CB_IMGPSScanImp.pas
index 9f5eb1f..87cd59f 100644
--- a/CB_IMGPSScanImp.pas
+++ b/CB_IMGPSScanImp.pas
@@ -836,7 +836,9 @@
     function GetSampleInf: Boolean;
     procedure InitExistImgList(casepath:String);
     function LoadFileGetMD5(const filename:string):string; //20170809 取的檔案的MD5
-    function ISExistImg(const filename:string):boolean; //20170809 確認是否存在原有影像
+    function ISExistImg(const filename:string):boolean;  //20170809 確認是否存在原有影像
+    procedure _DelTreeForExistImg(ASourceDir:String);   //2017 刪除前確認 有舊影像嗎
+    function DocNoIsExistImg(DocNopath: String): boolean;     //2017 刪除前確認 有舊影像嗎
   protected
     { Protected declarations }
     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
@@ -2186,6 +2188,15 @@
       iISB := TImageScrollBox(FindComponent(iISBName));
 //ShowMessage('iISB.FileName='+iISB.FileName);
 //ShowMessage(ExtractFilePath(iISB.FileName)+','+ExtractFileName(iISB.FileName)+','+NowCaseNo);
+      if (FMode = 'ESCAN') and (FModeName<>'異動件') then
+      begin
+        if ISExistImg(iISB.FileName) then
+        begin
+          ShowMessage(_Msg('此圖為非當次掃瞄,不可刪除'));
+          Exit;
+        end;
+      end;
+
       DeleteImageFile(ExtractFilePath(iISB.FileName),ExtractFileName(iISB.FileName),NowCaseNo);
     end;
   end;
@@ -2413,11 +2424,17 @@
 begin
   if TreeView1.Selected = NewTreeNode then  //全刪  //新掃描件
   begin
+    if (FMode = 'ESCAN') then
+    begin
+      ShowMessage(_Msg('補件不可刪除全案影像'));
+      Exit;
+    end;
+
     If Messagedlg(_Msg('是否刪除所有案件?'),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit;
     clearView(1);
     Application.ProcessMessages;
     _DelTree(ImageSavePath);
-    if (FMode = 'ESCAN') then
+    if (FMode = 'ESCAN') and (FModeName<>'異動件') then
     begin
       MkDir(ImageSavePath+FCaseID);
       CreateEmptyCase(ImageSavePath,FCaseID);
@@ -2427,6 +2444,11 @@
   end
   Else if TreeView1.Selected = MyTreeNode1 then       //案件編號
   begin
+    if (FMode = 'ESCAN') and (FModeName<>'異動件') then
+    begin
+      ShowMessage(_Msg('補件不可刪除全案影像'));
+      Exit;
+    end;
     If Messagedlg(Format(_Msg('編號(%s)是否刪除?'),[NowCaseno]),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit;
     clearView(1);
     Application.ProcessMessages;
@@ -2471,6 +2493,15 @@
     If Messagedlg(Format(_Msg('文件(%s)是否刪除?'),[DocNo2DocName(NowCaseno,NowDocNo)]),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit;
     ClearView(1);
     Application.ProcessMessages;
+    if (FMode = 'ESCAN') and (FModeName<>'異動件') then
+    begin
+      if not DocNoIsExistImg(ImageSavePath+NowCaseno+'\'+NowDocDir+'\') then
+      begin
+        ShowMessage(_Msg('有圖為非當次掃瞄,不可刪除'));
+        Exit;
+      end;
+    end;
+
     _DelTree(ImageSavePath+NowCaseno+'\'+NowDocDir);
     SetUseCase('D',ImageSavePath+NowCaseno+'\',NowDocDir,'','');
     SetDocNoList('D',-1,NowCaseNo,NowDocDir,'');
@@ -2482,34 +2513,12 @@
     ClearErrini(NowCaseno,MyTreeNode1);  //清掉檢核記錄
     NewTreeNodeRefresh;
 
-    {if (FMode <>'ESCAN') and (ContextList.Count = NowShowFileList.Count) then
-    begin
-      if Messagedlg(_Msg('刪除後將無影像,案件將刪除,是否確定?'),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit;
-      _DelTree(DisplayPath);
-      SetCaseList('D',NewTreeNode.IndexOf(MyTreeNode1),'');
-      if (FMode = 'ESCAN') then
-      begin
-        MkDir(ImageSavePath+FCaseID);
-        CreateEmptyCase(ImageSavePath,FCaseID);
-      end;
-      LoadImgFile;
-    end
-    Else
-    begin
-      DeleteShowFile(DisplayPath);
-      DrawDocItem1(MytreeNode1,Doc_Inf_List,NowCaseno);
-      P := ContextList.Count;
-      MytreeNode1.Text := Format(_Msg('%s-%d頁'),[NowCaseno,p]);
-      ClearErrini(NowCaseno,MyTreeNode1);  //清掉檢核記錄
-      NewTreeNodeRefresh;
-    end;
-    Showmessage(_Msg('刪除完成')); }
-
-    //Showmessage(_Msg('刪除完成'));  //20101102 User要求拿掉
   end
   Else if TreeView1.Selected = MyTreeNode3 then       //FormID層
   begin
     If Messagedlg(Format(_Msg('文件(%s)是否刪除?'),[NowFormName]),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit;
+
+
     DeleteFormCodeFile(NowCaseNo,NowDocDir,NowFormCode);
     SetRecordEditedDocDir('A',NowCaseNo,NowDocDir);
     DrawDocItem2(MytreeNode1,NowCaseno);
@@ -2517,30 +2526,39 @@
     ClearErrini(NowCaseno,MyTreeNode1);  //清掉檢核記錄
     NewTreeNodeRefresh;
 
-    {if (FMode <>'ESCAN') and (ContextList.Count = NowShowFileList.Count) then
-    begin
-      if Messagedlg(_Msg('刪除後將無影像,案件將刪除,是否確定?'),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit;
-      _DelTree(DisplayPath);
-      SetCaseList('D',NewTreeNode.IndexOf(MyTreeNode1),'');
-      if (FMode = 'ESCAN') then
-      begin
-        MkDir(ImageSavePath+FCaseID);
-        CreateEmptyCase(ImageSavePath,FCaseID);
-      end;
-      LoadImgFile;
-    end
-    Else
-    begin
-      DeleteShowFile(DisplayPath);
-      DrawDocItem1(MytreeNode1,Doc_Inf_List,NowCaseno);
-      P := ContextList.Count;
-      MytreeNode1.Text := Format(_Msg('%s-%d頁'),[NowCaseno,p]);
-      ClearErrini(NowCaseno,MyTreeNode1);  //清掉檢核記錄
-      NewTreeNodeRefresh;
-    end;
-    Showmessage(_Msg('刪除完成'));
-    //Showmessage(_Msg('刪除完成'));   //20101102 User要求拿掉 }
   end;
+end;
+
+function TCB_IMGPSScanX.DocNoIsExistImg(DocNopath:String):boolean;
+var
+  i:integer;
+  ST:TStringList;
+begin
+  Result:=False;
+  ST:=TStringList.Create;
+  ST.loadFromfile(DocNopath+'\Context.dat');
+//ShowMessage(ST.Text);
+  for I := 0 to ST.Count - 1 do
+  begin
+    if ISExistImg(DocNopath+ST.Strings[i]) then
+    begin
+
+      Result:=False;
+      Exit;
+      Break;
+    end;
+  end;
+  Result:=True;
+
+
+end;
+
+procedure TCB_IMGPSScanX._DelTreeForExistImg(ASourceDir:String);
+var
+  i:integer;
+  ST:TStringList;
+begin
+
 end;
 
 procedure TCB_IMGPSScanX.PM102Click(Sender: TObject);
@@ -3848,7 +3866,7 @@
     'FImgDelete='+    FImgDelete+#10#13+
     'FIsExternal='+    FIsExternal+#10#13+
     'FCheck_main_form='+    FCheck_main_form);
-
+    //FImgDelete:='Y';
  { 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+
@@ -5458,6 +5476,8 @@
   FileList:TStringlist;
   DocDir : String;
 begin
+  
+
   DeleteFile(Path+FileName);
   DocDir := Path2DocDir(Path,CaseID);
   SetContextList('D',-1,CaseID,DocDir,FileName);
@@ -5496,6 +5516,14 @@
     begin
       if FileName2FormCode(FileList.Strings[i]) = FormID then
       begin
+        if (FMode = 'ESCAN') and (FModeName<>'異動件') then
+        begin
+          if ISExistImg(ImageSavePath+CaseID+'\'+DocDir+'\'+FileList.Strings[i]) then
+          begin
+            ShowMessage('有圖為非當次掃瞄,不可刪除');
+            Exit;
+          end;
+        end;
         DeleteImageFile(ImageSavePath+CaseID+'\'+DocDir+'\',FileList.Strings[i],CaseID);
       end;
     end;
@@ -11075,7 +11103,7 @@
                     //有填就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)));
+Display1.Lines.Add(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');
@@ -11117,6 +11145,7 @@
                 else
                   SiteRec := SiteRec+'@'+Site;
                 Pixel := XT.Node['/form/settype3/'+ColEName+'/'].Attributes['pixel'];
+Display1.Lines.Add(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
                   ////有填寫////
@@ -11155,6 +11184,7 @@
                               RelaSiteRec := RelaSiteRec+'@'+RelaSite;
                             if  FileExists(ImageSavePath+CaseID+'\upload\'+RelaFile) then
                             begin
+Display1.Lines.Add(ColEName+' '+ColCName+'   圖像實際點數='+IntToStr(GetSiteOMR(ImageSavePath+CaseID+'\upload\'+OMRFile,Site,Bt))+' 設定點數='+IntToStr( (Pixel + SafePixel)));
                               if GetSiteOMR(ImageSavePath+CaseID+'\upload\'+RelaFile,RelaSite,Bt) > (RelaPixel + SafePixel)  then
                               begin
                                 OMROK := True;
@@ -11205,6 +11235,7 @@
                 else
                   SiteRec := SiteRec+'@'+Site;
                 Pixel := XT.Node['/form/settype8/'+ColEName+'/'].Attributes['pixel'];
+ Display1.Lines.Add(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
@@ -11245,6 +11276,8 @@
                             RelaSiteRec := RelaSiteRec+'@'+RelaSite;
                           if  FileExists(ImageSavePath+CaseID+'\upload\'+RelaFile) then
                           begin
+ Display1.Lines.Add(ColEName+' '+ColCName+'   圖像實際點數='+IntToStr(GetSiteOMR(ImageSavePath+CaseID+'\upload\'+OMRFile,Site,Bt))+' 設定點數='+IntToStr( (Pixel + SafePixel)));
+
                             if GetSiteOMR(ImageSavePath+CaseID+'\upload\'+RelaFile,RelaSite,Bt) > (RelaPixel + SafePixel)  then
                             begin
                               inc(OMROkCount);
@@ -11296,6 +11329,8 @@
                 else
                   SiteRec := SiteRec+'@'+Site;
                 Pixel := XT.Node['/form/settype4/'+ColEName+'/'].Attributes['pixel'];
+ Display1.Lines.Add(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
                   ////有填寫////
@@ -11340,6 +11375,8 @@
                 else
                   SiteRec := SiteRec+'@'+Site;
                 Pixel := XT.Node['/form/settype5/'+ColEName+'/'].Attributes['pixel'];
+ Display1.Lines.Add(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
                   ////有填寫////
@@ -11384,6 +11421,9 @@
                   SiteRec := Site
                 else
                   SiteRec := SiteRec+'@'+Site;
+
+ Display1.Lines.Add(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
                   ////有填寫////
@@ -11414,6 +11454,8 @@
                     OMRValue := XT.Node['/form/settype7/'+ColEName+'/'+nodename+'/'].Attributes['getvalue'];
 
                     //有填就ok
+ Display1.Lines.Add(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
                       ValueXT['/content/'+ColEName+'/@savevalue'] := OMRValue;  //有填就換成設定的值
diff --git a/ErrList.dcu b/ErrList.dcu
index c839058..5e9d4ab 100644
--- a/ErrList.dcu
+++ b/ErrList.dcu
Binary files differ
diff --git a/ErrList.pas b/ErrList.pas
index f4b82eb..a7ef3c0 100644
--- a/ErrList.pas
+++ b/ErrList.pas
@@ -464,10 +464,12 @@
       //if MpsViewX2.FileName <> RelaFileName then
       //begin
         ImageScrollBox2.LoadFromFile(RelaFileName,1);
-        FindPoint(ImageScrollBox2.Graphic,UpLPoint_Rela,UpRPoint_Rela,DownLPoint_Rela,'');
+        //FindPoint(ImageScrollBox2.Graphic,UpLPoint_Rela,UpRPoint_Rela,DownLPoint_Rela,'');
+        FindPoint(ImageScrollBox2.Graphic,UpLPoint,UpRPoint,DownLPoint,NowW,NowH,ANCHOR);
         //GetFFPoint(MpsViewX2,RelaFileName); //��FreeForm���Q�r�I���
 
       //end;
+
       ShowRelaOMRErr(RelaSiteIdx);
     end;
 
@@ -521,12 +523,26 @@
 var
   Site : String;
   iRect : TRect;
+  SP:TShape;
 begin
   if RelaIdx > RelaSiteList.Count then Exit;
 
+  SP := TShape(FindComponent('SP'+inttostr(RelaIdx+1))); //20170327 �b�j�餤�n�ϥΦh�վB�n
+  SP.Brush.Color :=$00FEFAAD;
+  SP.Parent := ImageScrollBox1;
+  SP.Pen.Style := psSolid;
+  SP.Pen.Color := $00FEFAAD;
+  SP.Pen.Width := 1;
+  SP.Pen.Mode := pmMask;
+  SP.Left := iRect.Left;
+  SP.Top := iRect.Top;
+  SP.Width := iRect.Right-iRect.Left;
+  SP.Height := iRect.Bottom-iRect.Top;
+
   Site := RelaSiteList.Strings[RelaIdx-1];
   iRect := CM_Str2Rect(Site,ImageScrollBox1.Graphic.XDotsPerInch,UpLPoint_Rela);
-  ShowKeyinRect(ImageScrollBox2,iRect);
+  //ShowKeyinRect(ImageScrollBox2,iRect);
+  SetKeyinRect_New(ImageScrollBox2,Site,'','',UpLPoint,UpRPoint,sp);
 end;
 
 procedure TErrlistForm.SiteNextBtClick(Sender: TObject);

--
Gitblit v1.8.0