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 | 690 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 597 insertions(+), 93 deletions(-)
diff --git a/CB_IMGPSScanImp.pas b/CB_IMGPSScanImp.pas
index 898293d..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);
@@ -404,6 +405,8 @@
FFileSizeLimit:integer;//匯入單一檔案大小限 依業務別決定 以KB為單位 預設5*1024kb
FCaseNoLength:integer;//案件編號長度檢查 依業務別決定 無預設 一定要傳入
FImgDelete:string; // Y/N 有權限可在補件時刪除影像
+ FIsExternal:string;//Y/N
+ FCheck_main_form:string; //Y/N
////////傳入參數///////
//********Http參數********
@@ -479,6 +482,11 @@
NowShowFileList : TStringlist; //目前顯示的影像清單
NowSelectFileList : TStringlist; //目前被點選的影像清單
GuideFormIDList : TStringlist; //要當導引頁表單清單
+ DivPageFormIDList:TStringlist; //要當分案頁表單清單
+ LastInitFormidList:TStringList;
+ LastAddFormidList:TstringList;
+ SampleFormIDList:TStringList; //20170627 已存在範本的formid
+ ExistImgList:TStringList; //20170724 已經存在的影像list for ESCAN //Img的完整路徑
//********清單區********
//********顯示區********
@@ -550,6 +558,7 @@
Has_Authorize :String; //是否有授權書影像
AttName : String; //未歸類目錄名稱
NowGuideFormID : String;
+ NowDivPageFormID:String;
FirstDocDir : String;
@@ -646,6 +655,7 @@
Procedure CreateIn_WH(CaseID:String); //產生In_WH.dat
Function CreateDocNo_Info(CaseID:String):String; //產生保管袋文件 DocNo[tab]份數[tab]總頁數[tab]是否異動[換行]DocNo[tab]份數[tab]總頁數[tab]是否異動
Function CreateCustDocNo_Info(CaseID:String):String; //產生自訂文件 DocName[tab]份數[tab]總頁數[tab]是否異動[#13#10]DocName[tab]份數[tab]總頁數[tab]是否異動
+ //Function CreateCustDocNo_Info(path,CaseID:String):String; overload
Function CreateAttach_Info(CaseID:String):String; //產生是否有Attach Y:有 N:沒有
Function CreateDocnoFrom_Info(CaseID:String):String; //產生被引進的保管袋文件資訊 Docno[tab]份數[tab]案件編號#13#10Docno[tab]份數[tab]案件編號
Function CreateCustDocNoFrom_Info(CaseID:String):String; //產生被引進的自定文件資訊 Docno[tab]份數[tab]案件編號#13#10Docno[tab]份數[tab]案件編號
@@ -671,7 +681,7 @@
Function FindFormCodePages(CaseID,FormCode:String):Integer; //計算案件裡FormID的頁數
Function GetDataFormCodePages(FormCode:String):Integer; //取記錄的FormcID的頁數
Procedure CaseReSize(CaseID:String); //案件的影像縮放
- Procedure ImageReSize(CaseID,FileName:String); //依十字定位點做縮放
+ Procedure ImageReSize_FormID(CaseID,FileName:String); //依十字定位點做縮放
Procedure ImageReSize_tmp(FormID,FileName:String); //依十字定位點做縮放(暫存檔)
Function TransCaseID(Path,CaseID:String;MainCase:Boolean):Boolean; //傳送案件
Procedure NewTreeNodeRefresh;
@@ -820,6 +830,11 @@
procedure PaintEvent(Sender: TObject);
function GetCurrentVersionNo: String;
procedure initParameter;
+ procedure LastInitFormidListCreate(path:string);
+ 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;
@@ -935,6 +950,10 @@
procedure Set_scancolor(const Value: WideString); safecall;
function Get_imgdelete: WideString; safecall;
procedure Set_imgdelete(const Value: WideString); safecall;
+ function Get_check_main_form: WideString; safecall;
+ function Get_isExternal: WideString; safecall;
+ procedure Set_check_main_form(const Value: WideString); safecall;
+ procedure Set_isExternal(const Value: WideString); safecall;
public
{ Public declarations }
procedure Initialize; override;
@@ -1185,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;
@@ -1245,7 +1312,7 @@
procedure TCB_IMGPSScanX.ISB1Enter(Sender: TObject);
begin
- ISB1.SetFocus;
+ //ISB1.SetFocus;
end;
procedure TCB_IMGPSScanX.ISB1ImageMouseDown(Sender: TObject; Button: TMouseButton;
@@ -1254,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;
@@ -1287,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;
@@ -1544,6 +1618,11 @@
Cust_DocNoList.Free; //自行定義文件名稱
IN_WH_DocNoList.Free; //入庫的文件清單
GuideFormIDList.Free; //要當導引頁表單清單
+ DivPageFormIDList.Free; //要當分案頁表單清單
+ LastInitFormidList.Free;
+ LastAddFormidList.Free;
+ SampleFormIDList.Free;
+ ExistImgList.Free;
//********清單區********
if FEvents <> nil then FEvents.OnDestroy;
end;
@@ -2097,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;
@@ -2133,7 +2214,7 @@
Showmessage(_msg('資訊尚未下載完成,請稍候或重新進入'));
Exit;
end;
- if (FMode = 'RSCAN') or (FMode = 'ESCAN') then
+ if (FMode = 'RSCAN') or (FMode = 'ESCAN') or (FMode = 'DSCAN') then
begin
if NewTreeNode.Count > 0 then
begin
@@ -2141,6 +2222,7 @@
TreeView1click(nil);
FirstDocDir := '';
NowGuideFormID := '';
+ NowDivPageFormID :='';
AddScanBtnclick(nil);
end;
end
@@ -2156,6 +2238,7 @@
ScanPath := '';
ScanCaseno := '';
NowGuideFormID := '';
+ NowDivPageFormID :='';
ClearView(1);
ContextList.Clear;
Try
@@ -2496,10 +2579,36 @@
procedure TCB_IMGPSScanX.PM103Click(Sender: TObject);
begin
if TreeView1.Selected = nil then Exit;
+
+ {if Treeview1.Selected = NewTreeNode then
+ begin
+ ShowMessage('AAAAA');
+ end;
+ if Treeview1.Selected = MyTreeNode1 then
+ begin
+ ShowMessage('BBBBB');
+ end;
+
+ if Treeview1.Selected = MyTreeNode2 then
+ begin
+ ShowMessage('CCCCC');
+ end;
+
+ if Treeview1.Selected = MyTreeNode3 then
+ begin
+ ShowMessage('DDDDD');
+ end;
+ }
if (Treeview1.Selected = NewTreeNode) {or (Treeview1.Selected = MyTreeNode1)} then
+ begin
+//ShowMessage('NewScanBtnClick');
NewScanBtnClick(self)
+ end
Else
+ begin
+//ShowMessage('AddScanBtnclick');
AddScanBtnclick(self);
+ end;
end;
procedure TCB_IMGPSScanX.PM104Click(Sender: TObject);
@@ -2545,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
@@ -2615,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);
@@ -2643,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');
@@ -3216,6 +3349,8 @@
if FMode='ESCAN' then
begin
PM101.Visible := False;
+ PM108.Visible := False;
+ PM110.Visible := False;
end;
end;
@@ -3276,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
@@ -3298,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);
@@ -3332,6 +3490,7 @@
var
SampleFormID : String;
SendData : String;
+ buttonSelected : Integer;
begin
ScanMode := smSample;
ClearView(1);
@@ -3344,6 +3503,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
@@ -3355,13 +3527,14 @@
Showmessage(Format(_Msg('FormID:%s尚未註冊'),[SampleFormID]));
Panel1.Enabled := True;
Panel2.Enabled := True;
+ DataLoading(false,false);
Exit;
end;
SampleAnchorMode := FormID2Anchor(SampleFormID);
Panel1.Enabled := False;
Panel2.Enabled := False;
-
+//ShowMessage('AAAAA');
Try
StatrTwainScan;
Except
@@ -3594,34 +3767,47 @@
//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));
+ initkscan;
+ showmessage('FUrl='+FUrl+#10#13+
+ 'FCaseID='+FCaseID+#10#13+
+ 'FMode='+FMode+#10#13+
+ 'FModeName='+FModeName+#10#13+
+ 'FWork_no='+FWork_no+#10#13+
+ 'FUserID='+FUserID+#10#13+
+ 'FUserName='+FUserName+#10#13+
+ 'FUserUnit='+FUserUnit+#10#13+
+ 'FData='+FData+#10#13+
+ 'FVerify='+FVerify+#10#13+
+ 'FReWrite='+FReWrite+#10#13+
+ 'FLanguage='+FLanguage+#10#13+
+ 'FLoanDoc_Value='+FLoanDoc_Value+#10#13+
+ 'FLoanDoc_Enable='+FLoanDoc_Enable+#10#13+
+ 'FUseProxy='+FUseProxy+#10#13+
+ 'FC_DocNoList='+FC_DocNoList+#10#13+
+ 'FC_DocNameList='+FC_DocNameList+#10#13+
+ 'FFixFileList='+FFixFileList+#10#13+
+ 'FIs_In_Wh='+FIs_In_Wh+#10#13+
+ 'FOldCaseInfo='+FOldCaseInfo+#10#13+
+ 'FPrintyn='+FPrintyn+#10#13+
+ 'FIs_OldCase='+FIs_OldCase+#10#13+
+ 'FCustDocYN='+FCustDocYN);
+ ShowMessage('FImgDPI='+IntToStr(FImgDPI)+#10#13+
+ 'FScanColor='+ IntToStr(FScanColor)+#10#13+
+ 'FFileSizeLimit='+ IntToStr(FFileSizeLimit) +#10#13+
+ 'FCaseNoLength='+ IntToStr(FCaseNoLength) +#10#13+
+ 'FImgDelete='+ FImgDelete+#10#13+
+ 'FIsExternal='+ FIsExternal+#10#13+
+ 'FCheck_main_form='+ FCheck_main_form);
- showmessage('FUrl='+FUrl);
- showmessage('FCaseID='+FCaseID);
- showmessage('FMode='+FMode);
- showmessage('FModeName='+FModeName);
- showmessage('FWork_no='+FWork_no);
- showmessage('FUserID='+FUserID);
- showmessage('FUserName='+FUserName);
- showmessage('FUserUnit='+FUserUnit);
- showmessage('FData='+FData);
- showmessage('FVerify='+FVerify);
- showmessage('FReWrite='+FReWrite);
- showmessage('FLanguage='+FLanguage);
- showmessage('FLoanDoc_Value='+FLoanDoc_Value);
- showmessage('FLoanDoc_Enable='+FLoanDoc_Enable);
- showmessage('FUseProxy='+FUseProxy);
- showmessage('FC_DocNoList='+FC_DocNoList);
- showmessage('FC_DocNameList='+FC_DocNameList);
- showmessage('FFixFileList='+FFixFileList);
- showmessage('FIs_In_Wh='+FIs_In_Wh);
- showmessage('FOldCaseInfo='+FOldCaseInfo);
- showmessage('FPrintyn='+FPrintyn);
- showmessage('FIs_OldCase='+FIs_OldCase);
- showmessage('FCustDocYN='+FCustDocYN);
+ { 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);
@@ -3632,11 +3818,13 @@
//Showmessage(self.Doc_Inf_List.Text);
//LoadImgFile;
//LoadImgFile1;
+ //ISB1.MouseMode:=mmAmplifier;
+
str:='';
for I := 1 to 11 do // 看 OMRErrInfo 的內容
begin
- str:=str+BoolToStr(OMRErrInfo[i].Display)+','
- +BoolToStr(OMRErrInfo[i].Ignore)+','+OMRErrInfo[i].Info+','
+ str:=str+BoolToStr(OMRErrInfo[i].Display,true)+','
+ +BoolToStr(OMRErrInfo[i].Ignore,true)+','+OMRErrInfo[i].Info+','
+OMRErrInfo[i].Mode+#10#13;
end;
ShowMessage('OMRErrInfo='+str);
@@ -3647,6 +3835,12 @@
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);
+ ShowMessage('ExistImgList='+ExistImgList.Text);
+
+// SampleFormIDList.Add('31A00101011706A');
+// SampleFormIDList.Add('31A00101021706A');
+// SampleFormIDList.Add('31A00101031706A');
end;
procedure TCB_IMGPSScanX.StatrTwainScan;
@@ -3664,6 +3858,7 @@
ScanInfo.Graphic := TTiffGraphic.Create;
try
ISB := nil; //規零
+//ShowMessage(IntToStr(ScanDpi));
Scanner.RequestedXDpi := ScanDpi;
Scanner.RequestedYDpi := ScanDpi;
Scanner.RequestedImageFormat := ScanColor;
@@ -3970,17 +4165,28 @@
if FormID = '' then
begin
FormID := BarCode2FormID; //取出FormID
-
end;
- if (FormID <> '') and ISGuideFormID(FormID) then
- NowGuideFormID := FormID;
+ if (FormID <> '') and ISDivPageFormID(FormID) then
+ begin
+ NowDivPageFormID := FormID;
+ end;
+
+ if (FormID <> '') and ISGuideFormID(FormID) then
+ begin
+ NowGuideFormID := FormID;
+ end;
+//ShowMessage('NowGuideFormID='+NowGuideFormID);
if (not (FindDivFormCode(FormID))) and (NowGuideFormID <> '') {and (FormID = '')} then
FormID := NowGuideFormID;
DocNo := FormCode2DocNo(FormID);
-
- if (FormID <>'') and FindDivFormCode(FormID) Then //只找分案頁上的案件條碼
+//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
+
ScanInfo.ImageCount := 0;
ClearView(1);
ContextList.Clear;
@@ -3988,6 +4194,8 @@
ClearCaseIndex; //清掉案件索引
ScanCaseno := BarCode2CaseID; //取出案件編號
NowGuideFormID := '';
+ NowDivPageFormID :='';
+//ShowMessage('B NowGuideFormID='+NowGuideFormID+#10#13+'FormID='+FormID+#10#13+'ScanCaseno='+ScanCaseno);
end;
if ScanCaseno = '' then //一開始都沒找到
begin
@@ -4007,7 +4215,8 @@
Str2Dir(ScanPath);
ScanDocDir := FindLastestDocDir(ScanCaseno,DocNo);
- if DocNoNeedDiv(DocNo) then //要分份數
+
+ if DocNoNeedDiv(DocNo)then //要分份數
begin
//Showmessage(DocNo+#13+FormCode2Page(FormID)+#13+inttostr(GetDocDir_Page(ScanCaseno,ScanDocDir))+#13+ScanDocDir);
if ((FormCode2Page(FormID) = '01') and (GetDocDir_Page(ScanCaseno,ScanDocDir)>0)) or (ScanDocDir = '') then
@@ -4076,19 +4285,22 @@
begin
ScanSaveFilename := '';
FormID := BarCode2FormID; //取出FormID
- if (FormID <> '') and ISGuideFormID(FormID) then
+ if (FormID <> '') and ISGuideFormID(FormID) then //20170510 註解 因為DSCAN 會全擠在導引頁下
NowGuideFormID := FormID;
- //Showmessage('A:'+FormID+#13+'B:'+NowGuideFormID);
- if (NowGuideFormID <> '') {and (FormID = '')} then
+ if (NowGuideFormID <> '') {and (FormID = '')} then //20170510 註解 因為DSCAN 會全擠在導引頁下
FormID := NowGuideFormID;
DocNo := FormCode2DocNo(FormID);
ScanDocDir := FindLastestDocDir(ScanCaseno,DocNo);
- if DocNoNeedDiv(DocNo) then //要分份數
+//ShowMessage('ScanDocDir='+ScanDocDir);
+ if (DocNoNeedDiv(DocNo)) then //要分份數
begin
- if ((FormCode2Page(FormID) = '01') and (GetDocDir_Page(ScanCaseno,ScanDocDir)>0)) or (ScanDocDir = '') then
+ if TreeView1.Selected = MyTreeNode1 then //20170421 掃瞄插頁時選則在案號上才要分份數 選在FormID上就不分份數
begin
- ScanInfo.ImageCount := 0;
- ScanDocDir := DocNo2DocNoDir(ImageSavePath + ScanCaseno+'\',DocNo);
+ if ((FormCode2Page(FormID) = '01') and (GetDocDir_Page(ScanCaseno,ScanDocDir)>0)) or (ScanDocDir = '') then
+ begin
+ ScanInfo.ImageCount := 0;
+ ScanDocDir := DocNo2DocNoDir(ImageSavePath + ScanCaseno+'\',DocNo);
+ end;
end;
end
Else //不分份數
@@ -4372,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
@@ -4397,6 +4627,7 @@
OMRRect.Bottom := ImageScrollBox1.Graphic.Height;
result := Get_OMR(ISB_BW.Graphic,OMRRect);
+//ShowMessage('result='+IntToStr(result));
end;
end;
@@ -4438,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);
@@ -4452,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);
@@ -4625,6 +4856,11 @@
begin
PARA_CONTENT := GetSQLData(WORK_INF_List,'PARA_CONTENT',i);
GuideFormIDList.CommaText := PARA_CONTENT;
+ end
+ Else if UpperCase(GetSQLData(WORK_INF_List,'PARA_NO',i)) = 'DIVPAGEFORMID' Then //當分案頁的表單
+ begin
+ PARA_CONTENT := GetSQLData(WORK_INF_List,'PARA_CONTENT',i);
+ DivPageFormIDList.CommaText := PARA_CONTENT;
end;
end;
ScanDuplex := Def_ScanDuplex;
@@ -4676,6 +4912,7 @@
Md : TMouseMode;
ISB : TImageScrollBox;
begin
+//ShowMessage(IntToStr(v));
case v of
-1 : Md := TMouseMode(mmUser);
0 : Md := TMouseMode(mmAmplifier);
@@ -4690,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;
@@ -4770,6 +5008,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
@@ -5269,20 +5540,21 @@
S : TStringlist;
FormCode,iPage : String;
begin
- Count := 1;
+ Count := 0;
S := TStringlist.Create;
try
S.LoadFromFile(ImageSavePath+CaseID+'\upload\Context.dat');
- for I := 0 to pages-1 do
+ for I := 1 to pages do //從0到pages-1 改成 1到pages 20170316 這樣可以修改檢核的頁數問題
begin
iPage := Add_Zoo(i,2);
for n := 0 to S.Count - 1 do
begin
FormCode := FileName2FormCode(S.Strings[n]);
- //Showmessage('1:'+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
+//Showmessage('1:'+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
if (version = FormCode2Version(FormCode)) and (DocNo = FormCode2DocNo(FormCode)) and (ipage = FormCode2Page(FormCode)) then
begin
- //Showmessage(inttostr(Count+1));
+//Showmessage(version+','+DocNo+',iPage='+iPage);
+//Showmessage(inttostr(Count+1));
Inc(Count);
Break; //找到了...離開
end;
@@ -5345,14 +5617,14 @@
For i := 0 to S.Count -1 do
begin
FileName := S.Strings[i];
- ImageReSize(CaseID,FileName); //依十字定位點做縮放
+ ImageReSize_FormID(CaseID,FileName); //依十字定位點做縮放
end;
finally
S.Free;
end;
end;
-Procedure TCB_IMGPSScanX.ImageReSize(CaseID,FileName:String); //依十字定位點做縮放
+Procedure TCB_IMGPSScanX.ImageReSize_FormID(CaseID,FileName:String); //依十字定位點做縮放
var
FormID : String;
DH,DW : String;
@@ -5371,17 +5643,27 @@
DW := GetFindResult('T1.FORM_WIDTH');
ANCHOR := UpperCase(GetFindResult('T1.ANCHOR'));
ANCHOR := Index2Anchor(ANCHOR);
+//showmessage(FormID+#13+DH+#13+DW+#13);
+//ShowMessage('AAAAAAAAA');
if ((ANCHOR = 'ANCHOR') or (ANCHOR = 'FRAME')) and (DH <> '') and (DW <> '') then //有十字定位點
begin
+//ShowMessage('BBBBBBB');
ImageScrollBox1.LoadFromFile(ImageSavePath+CaseID+'\Upload\'+FileName,1);
//FindPoint(ImageScrollBox1.Graphic,UpLPoint,UpRPoint,DownLPoint,NowW,NowH);
FindPoint(ISB_BW.Graphic,UpLPoint,UpRPoint,DownLPoint,NowW,NowH,ANCHOR);
+
SizeStr := CheckSize(ISB_BW,UpLPoint,UpRPoint,DownLPoint,DW,DH);
+ ImageResize(ImageScrollBox1.Graphic,ISB_BW.Graphic.Width,ISB_BW.Graphic.Height);
+
+ FindPoint(ISB_BW.Graphic,UpLPoint,UpRPoint,DownLPoint,NowW,NowH,ANCHOR);
v := 5;
v1 := length(SizeStr);
IF (SizeStr <> '') and (Copy(SizeStr,1,v) <> 'ERROR') then
begin
+//ShowMessage('CCCCC');
+
ImageScrollBox1.SaveToFile(ImageSavePath+CaseID+'\Upload\'+FileName);
+//showmessage(ImageSavePath+CaseID+'\Upload\'+FileName);
S := TStringlist.Create; ///20110422拿掉 換成上傳才做
if FileExists(ImageSavePath+CaseID+'\Upload\ReSize.dat') then
S.LoadFromFile(ImageSavePath+CaseID+'\Upload\ReSize.dat');
@@ -5455,6 +5737,14 @@
Doc_Data,Doc_Data1 : String;
In_Doc1,In_Doc2 : String;
AttachYN : String; //是否有附件 Y:有 N:沒有
+
+ ST1,ST2:TStringList;
+ str1,str2:String;
+ must_formidStr :string;
+ last_add_formidstr :string;
+ casepath:String;
+ filesizeInt:integer;
+ case_page:string;
begin
Result := True;
TransName := CaseID;
@@ -5466,7 +5756,9 @@
end;
if FileExists(Path+'CustomDocNo.dat') then
Cust_DocNoList.LoadFromFile(Path+'CustomDocNo.dat');
+
Pages := ContextList.Count;
+ case_page:=IntToStr(pages);
if (FMode = 'NSCAN') or (FMode = 'ESCAN') or (FMode = 'ASCAN') or (FMode = 'DSCAN') or (FMode = 'SSCAN') or (FMode = 'MSCAN') or (FMode = 'RI_SCAN') or (FMode = 'RSCAN') then
begin
//Showmessage('1');
@@ -5500,13 +5792,75 @@
//ShowMessage('DDDDDDDDDD');
//LoanDoc := 'Y';
//產生遮罩影像
- if FWork_No = 'CW' then
- HaveMask := Case2Mask(Path,MaskPath);
+// if FWork_No = 'CW' then
+// HaveMask := Case2Mask(Path,MaskPath);
//產生遮罩影像
// S := S +#13+'5-->'+ Timetostr(now);
+ ///////必要formid 20170315 start //////////////////////////////
+ must_formidStr:='';
+ last_add_formidstr:='';
+ ST1:=TStringList.Create;
+ ST1.LoadFromFile(path+'FormCode_Name.dat');
+//ShowMessage(ST1.Text);
+ ST2:=TStringList.Create;
-//ShowMessage('壓縮前');
+ for I := 0 to ST1.Count - 1 do
+ begin
+ if (Pos('_',St1.Strings[i])<>1) and (Pos('_',St1.Strings[i])<>-11) then
+ begin
+ str1:=Copy(ST1.Strings[i],1,Pos('_',St1.Strings[i])-1);
+ if ST2.IndexOf(str1) = -1 then
+ begin
+ ST2.Add(str1);
+ must_formidStr:= must_formidStr+str1+'@#,';
+ end;
+ end;
+ end;
+ must_formidStr:=Copy(must_formidStr,1,Length(must_formidStr)-3) ;
+ for I := 0 to LastInitFormidList.Count - 1 do
+ begin
+ if ST2.IndexOf(LastInitFormidList.Strings[i]) <> -1 then
+ begin
+ ST2.Delete(ST2.IndexOf(LastInitFormidList.Strings[i]));
+ end;
+ end;
+ for I := 0 to ST2.Count - 1 do
+ begin
+ if i <> ST2.Count then
+ begin
+ last_add_formidstr:=last_add_formidstr+ST2.Strings[i]+'@#,';
+ end
+ else
+ begin
+ last_add_formidstr:=last_add_formidstr+ST2.Strings[i]
+ end;
+ end;
+ ST1.Free;
+ ST2.Free;
+ ///////必要formid 20170315 end //////////////////////////
+
+ ///保留外部影像 start///////////////////////////////
+ casepath:= Copy(Path,1,pos('Upload',path)-1);
+//ShowMessage('casepath='+casepath);
+//FIsExternal:='Y';
+ if (FMode='ESCAN') and (FIsExternal='Y') then
+ begin
+ if FileExists(casepath+'Download\FirstImg.zip') then
+ begin
+ CopyFile(PWChar(casepath+'Download\FirstImg.zip'),PWChar(path+'FirstImg.zip'),false);
+ end
+ else
+ begin
+ CopyFile(PWChar(casepath+'Download\'+CaseID+'.zip'),PWChar(path+'FirstImg.zip'),false);
+ end;
+ end;
+ ///保留外部影像 end///////////////////////////////
+
+ //file_size 計算 就先不做 20170316
+ filesizeInt:=0;
+
+
//////壓檔/////
ZipMainFile(Path,Path,'Img.zip');
if HaveMask then
@@ -5521,9 +5875,16 @@
+'&doc_data='+HTTPEncode(UTF8Encode(Doc_Data))
+'&doc_data1='+HTTPEncode(UTF8Encode(Doc_Data1))
+'&attach='+AttachYN
+ +'&case_page='+case_page
+ +'&file_size='+IntToStr(filesizeInt)
+ +'&must_formid='+must_formidStr //擁有的 formid
+ +'&last_add_formid='+last_add_formidstr //當次新加的 formid
+'&in_doc1='+HTTPEncode(UTF8Encode(In_Doc1))
+'&in_doc2='+HTTPEncode(UTF8Encode(In_Doc2));
+//ShowMessage('SendData='+SendData);
+//ShowMessage(FData+#10#13+Doc_Data);
+//exit;
if not upFile(HTTPSClient,FUrl,'service/imgpsc/IMGPSC02/caseupload',SendData,'file',Path+'Img.zip',FReWrite,Memo1,False) then
begin
Showmessage(Format(_Msg('傳送案件編號(%s)檔案時,網路發生錯誤!!'+_Msg('錯誤代碼:')),[CaseID])+Inttostr(HttpError.HttpErrorCode)+' '+HttpError.HttpReason);
@@ -5782,7 +6143,7 @@
EnCodeDateTime := En_DecryptionStr_Base64('E',ServerDate+GetBalance2Time(Balance),Mpskey);
///service/slic/SLIC04/case?data=&verify=&case_no=&file=
SendData := 'data='+HTTPEncode(UTF8Encode(FData))+'&verify='+FVerify+'&case_no='+CaseID+'&file=';
-ShowMessage(SendData);
+//ShowMessage(SendData);
if not dnFile_Get(HTTPSClient,Furl,'service/imgpsc/IMGPSC04/case',SendData,Path+CaseID+'.zip',FReWrite,Memo1,False,DownImgStatus) then
begin
HttpErrStr := _Msg('錯誤代碼:')+Inttostr(HttpError.HttpErrorCode)+' '+HttpError.HttpReason;
@@ -5801,7 +6162,7 @@
Result := False;
Exit;
end;
-ShowMessage('sssss');
+//ShowMessage('sssss');
AttPath := Path + 'AttFile\';
if FileExists(Path+CaseID+'.zip') then
begin
@@ -6362,6 +6723,27 @@
Break;
end;
end;
+end;
+
+function TCB_IMGPSScanX.checkFormCodeIsCustom(path, formcode: string): boolean;
+var
+ i:integer;
+ ini : Tmeminifile;
+ str1:String;
+begin
+//ShowMessage(path);
+ ini := Tmeminifile.Create(Path+'CustomDocNo.ini');
+ str1:=ini.ReadString(Copy(formcode,1,8),'FormID','');
+//ShowMessage('str1'+str1);
+ if str1 = formcode then
+ begin
+ Result:=True;
+ end
+ else
+ begin
+ Result := False;
+ end;
+
end;
Function TCB_IMGPSScanX.CheckCaseID_OK:Boolean; //檢查是否有未配號的案件
@@ -7017,6 +7399,12 @@
if FileExists(SoPath+'UseCase.ini') then
ZipfileList.Add(SoPath+'UseCase.ini');
+ if FileExists(SoPath+'FirstImg.zip') then//20170315 加的
+ begin
+ ZipfileList.Add(SoPath+'FirstImg.zip');
+ end;
+
+
ExeCuteZip(DePath+ZipName,SoPath,ZipFileList,False,False);
//Showmessage('111');
finally
@@ -7396,6 +7784,7 @@
ErrlistForm : TErrlistForm;
S : TStringlist;
UpFormID : String;
+ Anchor : String;
begin
ShowText := _Msg('處理檢核失敗中,請稍候');
DataLoading(True,True);
@@ -7974,6 +8363,30 @@
end;
end;
+procedure TCB_IMGPSScanX.LastInitFormidListCreate(path: string);
+var
+ i:integer;
+ ST1:TStringList;
+ str1:string;
+begin
+//ShowMessage('path='+path);
+ ST1:=TStringList.Create;
+ ST1.LoadFromFile(path+'FormCode_Name.dat');
+ for I := 0 to ST1.Count - 1 do
+ begin
+ if (Pos('_',St1.Strings[i])<>1) and (Pos('_',St1.Strings[i])<>-11) then
+ begin
+ str1:=Copy(ST1.Strings[i],1,Pos('_',St1.Strings[i])-1);
+ if LastInitFormidList.IndexOf(str1) = -1 then
+ begin
+ LastInitFormidList.Add(str1);
+ end;
+ end;
+ end;
+
+ ST1.Free;
+end;
+
procedure TCB_IMGPSScanX.LoadImgFile; //載入新件及替換件
Var
i,v,v1,m : Integer;
@@ -8301,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;
@@ -9471,6 +9884,22 @@
end;
end;
+Function TCB_IMGPSScanX.ISDivPageFormID(FormID:String):Boolean;
+var
+ i : Integer;
+begin
+ Result := False;
+
+ for i := 0 to DivPageFormIDList.Count - 1 do
+ begin
+ if FormID = DivPageFormIDList.Strings[i] then
+ begin
+ Result := True;
+ Break;
+ end;
+ end;
+end;
+
Function TCB_IMGPSScanX.CaseDelete_Enable(CaseID:String):Boolean; //案件可否被刪除
var
i : Integer;
@@ -9904,6 +10333,12 @@
CaseDocNo_CopiesList.SaveToFile(DeDir+'CaseDocNo_Copies.dat');
end;
end;}
+
+ if FMode='ESCAN' then
+ begin
+ InitExistImgList(DeDir);
+ end;
+
finally
iFileList.Free;
@@ -10365,15 +10800,21 @@
begin
end;
+//ShowMessage('MainFormID='+MainFormID);
if MainFormID = ''then
begin
- //20131203 yuu說不檢查這個,先拿掉
- {if FMode <> 'SSCAN' then //簽署章件會換主FormID,先跳過
+ //20131203 yuu說不檢查這個,先拿掉 20170315 楷琳說未歸類要擋 20170726 因此有檢查必要FormID 所以 可以拿掉
+ {if FCheck_main_form='Y' then
begin
- ErrStr:=_Msg('找不到分案文件'); //找不到主文件
- OMRErr2ini(CaseID,ErrStr,'','','','','','',False,False,True);
- CaseOk := false;
- end;}
+ 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
@@ -10471,10 +10912,12 @@
end }
/////未註冊文件/////
//////停用文件//
- {Else} IF ModeNeedCheck(OMRErrInfo[9].Mode,FMode) and (not FormIDExists(FormCode,True,0)) then //有停用的文件
+ {Else} IF ModeNeedCheck(OMRErrInfo[9].Mode,FMode) and (not FormIDExists(FormCode,True,0)) and (not checkFormCodeIsCustom(ImageSavePath + CaseID+'\upload\',FormCode)) then //有停用的文件
begin
+//ShowMessage('AAAA');
ErrStr:=Format(OMRErrInfo[9].Info,[FormCode2FormName(CaseID,FormCode)]); //有停用文件
OMRErr2ini(CaseID,ErrStr,'','','','','','',False,OMRErrInfo[9].Ignore,OMRErrInfo[9].Display);
+//ShowMessage('ErrStr='+ErrStr);
if OMRErrInfo[9].Display then
CaseOk := false;
end;
@@ -10489,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]);
@@ -10520,7 +10964,7 @@
OMRFormName := FormCode2FormName(CaseID,OMRFormCode);
Anchor := FormID2Anchor(OMRFormCode);
///依十字定位點縮放////
- ImageReSize(CaseID,OMRFile);
+ ImageReSize_FormID(CaseID,OMRFile);
////依十字定位點縮放////
if not FileExists(CheckXmlPath+OMRFormCode+'.xml') then //沒有Xml就不用檢核
Continue;
@@ -10553,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');
@@ -11170,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);
@@ -11779,6 +12225,11 @@
for I := 0 to ContextList.Count - 1 do
begin
FileFormID := FileName2FormCode(ContextList.Strings[i]);
+
+ if DivPageFormIDList.IndexOf(FileFormID)<>-1 then //20170509 跳過分案頁的formid
+ begin
+ Continue;
+ end;
if FindDivFormCode(FileFormID) then
begin
Result := FileFormID;
@@ -11959,6 +12410,7 @@
Str := '';
if Not FileExists(ImageSavePath+CaseID+'\CaseDocNo.dat') then Exit;
DocDirList.LoadFromFile(ImageSavePath+CaseID+'\CaseDocNo.dat');
+//ShowMessage(DocDirList.Text);
while DocDirList.Count > 0 do
begin
iDocDir := DocDirList.Strings[0];
@@ -12502,9 +12954,11 @@
var
SendData : String;
begin
+//Memo1.Clear;
SendData := 'data='+HTTPEncode(UTF8Encode(FData))+'&verify='+FVerify+'&case_no='+CaseID+'&work_no='+FWork_no;
- if (FMode = 'NSCAN') then
+ if (FMode = 'NSCAN') or (FMode = 'DSCAN') then
begin
+//ShowMessage('JJJJJ');
If not ProcessServlet_Get(HTTPSClient,FURL+'service/imgpsc/IMGPSC05/isnew',SendData,FReWrite,Memo1,False) Then
begin
HttpErrStr := _Msg('錯誤代碼:')+inttostr(HttpError.HttpErrorCode)+','+HttpError.HttpReason;
@@ -12512,7 +12966,8 @@
Exit;
end;
end;
-
+//ShowMessage(SendData);
+//ShowMessage(Memo1.Lines.Text);
IF memo1.Lines.Strings[0] <> '0' Then
begin
HttpErrStr := _Msg('錯誤原因:')+memo1.Lines.Strings[1];
@@ -12780,12 +13235,13 @@
i: Integer;
begin
Timer1.Enabled := False;
+
//Showmessage('a');
//self.FIs_OldCase := 'Y';
PageLVclear := True;
InitialOk := False;
- FMode := 'DSCAN' ;
+ //FMode := 'DSCAN' ;
//FIs_In_Wh := 'Y';
if FIs_In_Wh = 'Y' then
AttName := 'Attach' //入庫附件
@@ -12886,6 +13342,11 @@
Cust_DocNoList := TStringlist.Create; //自行定義的文件名稱
IN_WH_DocNoList := TStringlist.Create; //入庫的文件清單
GuideFormIDList := TStringlist.Create; //要當導引頁表單清單
+ DivPageFormIDList := TStringList.Create; //要當分案頁表單清單
+ LastInitFormidList :=TStringList.Create;
+ LastAddFormidList := TStringList.Create;
+ SampleFormIDList := TStringList.Create;//20170627 加入
+ ExistImgList := TStringList.Create; //20170724 新增
//********清單區********
ShowText := _Msg('資料載入中,請稍候');
@@ -12897,6 +13358,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 文件資訊
@@ -12970,13 +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+'\';
+ ImagePath := StringReplace(ImagePath, '\\', '\',[rfReplaceAll, rfIgnoreCase]);
+//ShowMessage('BB ImagePath='+ImagePath);
ImageSavePath := ImagePath;
str2dir(CheckXmlPath);
str2dir(SitePath);
@@ -13057,6 +13537,7 @@
// //LoadImgFile;
// end;
Create_Cust_DocDir(FCaseID); //產生外面傳入的文件
+ LastInitFormidListCreate(ImageSavePath+FCaseID+'\Download\');
end;
end;
@@ -13084,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;
@@ -13103,9 +13585,9 @@
Splitter2.Visible := True;
AttFileGB.Visible := False; //附加電子檔窗
Splitter2.Visible := False; }
-
+//ShowMessage('ImageSavePath='+ImageSavePath);
DataLoading(False,False);
-//ShowMessage('初始話執行完成');
+
end;
procedure TCB_IMGPSScanX.Timer2Timer(Sender: TObject);
@@ -13188,13 +13670,7 @@
s.Free;
end;
end;}
-
- //*******DOC必要文件檢核應該寫在這邊 START 20170222 ************
- //DocDir.dat 會含有DOC列表 所以上傳前要給檢查 有沒有少必要的DOC
- //並檢查 DOC 中 有沒有影像
-
- //*******DOC必要文件檢核應該寫在這邊 END************
- if (FMode = 'NSCAN') then
+ if (FMode = 'NSCAN') or (FMode = 'DSCAN') then //20170406 待掃瞄也要問一下
begin
/////訊問是否可上傳/////
CaseTrans := CaseAsk(CaseID);
@@ -13232,7 +13708,7 @@
begin
ShowText := CaseID+_Msg('檢核中,請稍候');
DataLoading(True,True);
- If not OMRCheckCase(CaseID) then
+ If not OMRCheckCase(CaseID) then //進檢核
begin
Inc(CheckErrCount);
Continue;
@@ -13249,6 +13725,7 @@
ShowText := CaseID+_Msg('資料上傳中,請稍候');
DataLoading(True,True);
//ShowMessage('NNNNN');
+//ShowMessage('退出');DataLoading(False,False);Exit;
If Not TransCaseID(TransPath,CaseID,True) Then //傳送案件
begin
DataLoading(False,False);
@@ -13269,6 +13746,13 @@
LoadImgFile;
if (FMode = 'ESCAN') and (SuccessCount = 1) then
+ begin
+ if FEvents <> nil Then
+ begin
+ FEvents.OnClosePage;
+ end;
+ end;
+ if (FMode = 'DSCAN') and (SuccessCount = 1) then
begin
if FEvents <> nil Then
begin
@@ -14086,7 +14570,27 @@
procedure TCB_IMGPSScanX.Set_imgdelete(const Value: WideString);
begin
+ FImgDelete:=Value;
+end;
+function TCB_IMGPSScanX.Get_check_main_form: WideString;
+begin
+
+end;
+
+function TCB_IMGPSScanX.Get_isExternal: WideString;
+begin
+
+end;
+
+procedure TCB_IMGPSScanX.Set_check_main_form(const Value: WideString);
+begin
+ FCheck_main_form := Value;
+end;
+
+procedure TCB_IMGPSScanX.Set_isExternal(const Value: WideString);
+begin
+ FIsExternal:=Value;
end;
initialization
--
Gitblit v1.8.0