From bcdfe569b7581938e0d42160defd76d5efcbdb96 Mon Sep 17 00:00:00 2001
From: doom4ster <doom4ster@gmail.com>
Date: 星期五, 30 六月 2017 22:59:56 +0800
Subject: [PATCH] CB_IMGPSScan.cab ver2.0.1.18  修正 檢核失敗 時顯示的必填欄位的提示色塊消失的問題

---
 CB_IMGPSScanImp.dcu |    0 
 ErrList.dcu         |    0 
 CB_IMGPSScan.ocx    |    0 
 ErrList.pas         |  108 +++++++++++++++++++++++++--
 CB_IMGPSScan.dproj  |    4 
 CB_IMGPSScan.res    |    0 
 CB_IMGPSScanImp.pas |   44 +++++++++--
 ErrList.dfm         |   25 ++----
 8 files changed, 147 insertions(+), 34 deletions(-)

diff --git a/CB_IMGPSScan.dproj b/CB_IMGPSScan.dproj
index 8bbd35a..7141ba5 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">15</VersionInfo>
+						<VersionInfo Name="Build">18</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.15</VersionInfoKeys>
+						<VersionInfoKeys Name="FileVersion">2.0.1.18</VersionInfoKeys>
 						<VersionInfoKeys Name="InternalName"/>
 						<VersionInfoKeys Name="LegalCopyright"/>
 						<VersionInfoKeys Name="LegalTrademarks"/>
diff --git a/CB_IMGPSScan.ocx b/CB_IMGPSScan.ocx
index 032d653..422b399 100644
--- a/CB_IMGPSScan.ocx
+++ b/CB_IMGPSScan.ocx
Binary files differ
diff --git a/CB_IMGPSScan.res b/CB_IMGPSScan.res
index 3ac9e22..4873e5f 100644
--- a/CB_IMGPSScan.res
+++ b/CB_IMGPSScan.res
Binary files differ
diff --git a/CB_IMGPSScanImp.dcu b/CB_IMGPSScanImp.dcu
index 86ef42b..82baff9 100644
--- a/CB_IMGPSScanImp.dcu
+++ b/CB_IMGPSScanImp.dcu
Binary files differ
diff --git a/CB_IMGPSScanImp.pas b/CB_IMGPSScanImp.pas
index 46e6fc7..e17222c 100644
--- a/CB_IMGPSScanImp.pas
+++ b/CB_IMGPSScanImp.pas
@@ -3693,6 +3693,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);
@@ -3739,6 +3744,7 @@
   ScanInfo.Graphic := TTiffGraphic.Create;
   try
     ISB := nil; //規零
+//ShowMessage(IntToStr(ScanDpi));
     Scanner.RequestedXDpi := ScanDpi;
     Scanner.RequestedYDpi := ScanDpi;
     Scanner.RequestedImageFormat := ScanColor;
@@ -4461,21 +4467,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 +4510,7 @@
       OMRRect.Bottom := ImageScrollBox1.Graphic.Height;
 
     result := Get_OMR(ISB_BW.Graphic,OMRRect);
+//ShowMessage('result='+IntToStr(result));
   end;
 end;
 
@@ -4527,7 +4552,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 +4566,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);
@@ -7640,6 +7665,7 @@
   ErrlistForm : TErrlistForm;
   S : TStringlist;
   UpFormID : String;
+  Anchor : String;
 begin
   ShowText := _Msg('處理檢核失敗中,請稍候');
   DataLoading(True,True);
@@ -8569,7 +8595,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;
@@ -10655,7 +10681,7 @@
           //20131203 yuu說不檢查這個,先拿掉   20170315 楷琳說未歸類要擋
           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);
@@ -10844,6 +10870,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');
@@ -13403,8 +13431,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;
@@ -13564,8 +13593,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);
diff --git a/ErrList.dcu b/ErrList.dcu
index cce0795..540f2ef 100644
--- a/ErrList.dcu
+++ b/ErrList.dcu
Binary files differ
diff --git a/ErrList.dfm b/ErrList.dfm
index fd39be9..76444a0 100644
--- a/ErrList.dfm
+++ b/ErrList.dfm
@@ -160,7 +160,6 @@
             Top = 3
             Width = 29
             Height = 23
-            DoubleBuffered = True
             Enabled = False
             Glyph.Data = {
               76010000424D7601000000000000760000002800000020000000100000000100
@@ -176,7 +175,6 @@
               3333333333333333333333333333333333333333333333333333333333333333
               3333333333333333333333333333333333333333333333333333}
             NumGlyphs = 2
-            ParentDoubleBuffered = False
             TabOrder = 0
             OnClick = SitePreBtClick
           end
@@ -185,7 +183,6 @@
             Top = 3
             Width = 29
             Height = 23
-            DoubleBuffered = True
             Enabled = False
             Glyph.Data = {
               76010000424D7601000000000000760000002800000020000000100000000100
@@ -201,7 +198,6 @@
               3333333333773333333333333333333333333333333333333333333333333333
               3333333333333333333333333333333333333333333333333333}
             NumGlyphs = 2
-            ParentDoubleBuffered = False
             TabOrder = 1
             OnClick = SiteNextBtClick
           end
@@ -219,10 +215,6 @@
           MouseHandlerOwnership = True
           Align = alClient
           TabOrder = 1
-          ExplicitLeft = 168
-          ExplicitTop = 72
-          ExplicitWidth = 100
-          ExplicitHeight = 100
         end
       end
       object Panel6: TPanel
@@ -258,7 +250,6 @@
             Top = 3
             Width = 31
             Height = 23
-            DoubleBuffered = True
             Enabled = False
             Glyph.Data = {
               76010000424D7601000000000000760000002800000020000000100000000100
@@ -274,7 +265,6 @@
               3333333333333333333333333333333333333333333333333333333333333333
               3333333333333333333333333333333333333333333333333333}
             NumGlyphs = 2
-            ParentDoubleBuffered = False
             TabOrder = 0
             OnClick = RelaPreBtClick
           end
@@ -283,7 +273,6 @@
             Top = 3
             Width = 31
             Height = 23
-            DoubleBuffered = True
             Enabled = False
             Glyph.Data = {
               76010000424D7601000000000000760000002800000020000000100000000100
@@ -299,7 +288,6 @@
               3333333333773333333333333333333333333333333333333333333333333333
               3333333333333333333333333333333333333333333333333333}
             NumGlyphs = 2
-            ParentDoubleBuffered = False
             TabOrder = 1
             OnClick = RelaNextBtClick
           end
@@ -317,10 +305,6 @@
           MouseHandlerOwnership = True
           Align = alClient
           TabOrder = 1
-          ExplicitLeft = 104
-          ExplicitTop = 128
-          ExplicitWidth = 100
-          ExplicitHeight = 100
         end
       end
     end
@@ -404,6 +388,15 @@
         Visible = False
         OnClick = EnforceBtClick
       end
+      object Button1: TButton
+        Left = 296
+        Top = 10
+        Width = 75
+        Height = 25
+        Caption = 'Button1'
+        TabOrder = 7
+        OnClick = Button1Click
+      end
     end
   end
   object Timer1: TTimer
diff --git a/ErrList.pas b/ErrList.pas
index 1c6a7e6..0947599 100644
--- a/ErrList.pas
+++ b/ErrList.pas
@@ -5,7 +5,7 @@
 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, OleCtrls, Menus, StdCtrls, Buttons, ComCtrls, ExtCtrls,inifiles,
-  iisUnit,iis_ImageProcess, EnImgScr,mpsBarco,BarcodesFinder;
+  iisUnit,iis_ImageProcess, EnImgScr,mpsBarco,BarcodesFinder, EnMisc, EnDiGrph;
 
 type
   TErrlistForm = class(TForm)
@@ -38,6 +38,7 @@
     ImageScrollBox1: TImageScrollBox;
     ImageScrollBox2: TImageScrollBox;
     ImageScrollBox3: TImageScrollBox;
+    Button1: TButton;
     procedure ExitBtClick(Sender: TObject);
     procedure ImmediateBtClick(Sender: TObject);
     procedure FormCreate(Sender: TObject);
@@ -60,6 +61,7 @@
     procedure Timer1Timer(Sender: TObject);
     procedure RejectBtClick(Sender: TObject);
     procedure EnforceBtClick(Sender: TObject);
+    procedure Button1Click(Sender: TObject);
   private
     { Private declarations }
     Siteidx : Integer;
@@ -86,11 +88,22 @@
     DownRPoint_Rela : Tpoint;  //�k�U�誺�Q�r�I
     //********�Q�r�w���I��T********
 
+    ISB_BW: TImageScrollBox;
+    SP1:TShape;//20170630 �s�[
+    SP2:TShape;//20170630 �s�[
+    SP3:TShape;//20170630 �s�[
+    SP4:TShape;//20170630 �s�[
+    SP5:TShape;//20170630 �s�[
+    SP6:TShape;//20170630 �s�[
+    SP7:TShape;//20170630 �s�[
+    SP8:TShape;//20170630 �s�[
+
     procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;
     Procedure ShowOMRErr(Idx:Integer); //�e���W�q�XOMR�ˮ֥���
     Procedure ShowRelaOMRErr(Relaidx:Integer); //�e���W�q�X���YOMR�ˮ֥���
     Procedure GetOMRErrini(Index:String); //���ˮ֥���ini
-    Procedure InitialData;  //��_����������A
+    Procedure InitialData;
+    procedure ImageScrollBox1NewGraphic(const Graphic: TDibGraphic);  //��_����������A
   public
     { Public declarations }
     iniPath : String;
@@ -147,6 +160,14 @@
   end;
   RejectCase := True;
   ModalResult := mrOK;
+end;
+
+procedure TErrlistForm.Button1Click(Sender: TObject);
+begin
+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 TErrlistForm.DeleteBtClick(Sender: TObject);
@@ -280,12 +301,38 @@
   PostMessage(Handle,WM_ACTIVATE,WA_CLICKACTIVE,0);
   SiteList := TStringlist.Create;
   RelaSiteList := TStringlist.Create;
+  ISB_BW:=TImageScrollBox.Create(Self);
+  SP1:= TShape.Create(self);
+  SP1.Name := 'SP1';
+  SP2:= TShape.Create(self);
+  SP2.Name := 'SP2';
+  SP3:= TShape.Create(self);
+  SP3.Name := 'SP3';
+  SP4:= TShape.Create(self);
+  SP4.Name := 'SP4';
+  SP5:= TShape.Create(self);
+  SP5.Name := 'SP5';
+  SP6:= TShape.Create(self);
+  SP6.Name := 'SP6';
+  SP7:= TShape.Create(self);
+  SP7.Name := 'SP7';
+  SP8:= TShape.Create(self);
+  SP8.Name := 'SP8';
 end;
 
 procedure TErrlistForm.FormDestroy(Sender: TObject);
 begin
   SiteList.Free;
   RelaSiteList.Free;
+  ISB_BW.Free;
+  SP1.Free;
+  SP2.Free;
+  SP3.Free;
+  SP4.Free;
+  SP5.Free;
+  SP6.Free;
+  SP7.Free;
+  SP8.Free;
 end;
 
 procedure TErrlistForm.ImmediateBtClick(Sender: TObject);
@@ -339,6 +386,10 @@
   FileName,Site : String;
   RelaFileName,RelaSite : String;
   Anchor,Anchor1 : String;
+
+
+  SizeStr : String;
+  NowW,NowH : Integer;
 begin
   ini := Tinifile.Create(iniPath+'Checkerr.ini');
   try
@@ -379,11 +430,23 @@
 
     if FileName <> '' then  //���n��ܼv��
     begin
-      //if MpsViewX1.FileName <> FileName then
-      //begin
-        ImageScrollBox1.LoadFromFile(FileName,1);
-        FindPoint(ImageScrollBox1.Graphic,UpLPoint,UpRPoint,DownLPoint,'');
-      //end;
+      ImageScrollBox1.LoadFromFile(FileName,1);
+
+      //FindPoint(ImageScrollBox1.Graphic,UpLPoint,UpRPoint,DownLPoint,'NONE');
+
+      //======================
+      ImageScrollBox1.LoadFromFile(FileName,1);
+      ImageScrollBox1NewGraphic(ImageScrollBox1.Graphic);
+      FindPoint(ISB_BW.Graphic,UpLPoint,UpRPoint,DownLPoint,NowW,NowH,ANCHOR);
+      ImageResize(ImageScrollBox1.Graphic,ISB_BW.Graphic.Width,ISB_BW.Graphic.Height);
+      FindPoint(ISB_BW.Graphic,UpLPoint,UpRPoint,DownLPoint,NowW,NowH,ANCHOR);
+      //==========================
+
+{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)); }
+
       ShowOMRErr(Siteidx);
     end;
     if (RelaFileName <> '') and FileExists(RelaFileName) then //�����Y�v��
@@ -407,12 +470,41 @@
 var
   Site : String;
   iRect : TRect;
+  SP:TShape;
 begin
   if Idx > SiteList.Count then Exit;
   Site := SiteList.Strings[Idx-1];
+//ShowMessage('Site'+Site);
   //Site := TranslationRect(Site,MpsViewX1.GetImageDpi,'VIEW');
   iRect := CM_Str2Rect(Site,ImageScrollBox1.Graphic.XDotsPerInch,UpLPoint);
-  ShowKeyinRect(ImageScrollBox1,iRect);
+//ShowMessage('Idx='+IntToStr(Idx));
+//ShowMessage(IntToStr(iRect.Left)+','+IntToStr(iRect.Top)+','+IntToStr(iRect.Right)+','+IntToStr(iRect.Bottom));
+  SP := TShape(FindComponent('SP'+inttostr(Idx))); //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;
+  //ImageScrollBox1.Redraw(True);
+
+  //ShowKeyinRect(ImageScrollBox1,iRect);
+  SetKeyinRect_New(ImageScrollBox1,Site,'','',UpLPoint,UpRPoint,sp);
+end;
+
+procedure TErrlistForm.ImageScrollBox1NewGraphic(const Graphic: TDibGraphic);
+begin
+  IF ImageScrollBox1.Graphic.Empty Then Exit;
+  ISB_BW.Graphic.Assign(ImageScrollBox1.Graphic);
+  If ImageScrollBox1.Graphic.ImageFormat <> ifBlackWhite Then
+  begin
+    ConvertToBW(ISB_BW.Graphic);
+  end;
 end;
 
 Procedure TErrlistForm.ShowRelaOMRErr(RelaIdx:Integer); //�e���W�q�X���YOMR�ˮ֥���

--
Gitblit v1.8.0