From c12083614dded208bd51f753a67277b2c128af27 Mon Sep 17 00:00:00 2001
From: doom4ster <doom4ster@gmail.com>
Date: 星期四, 04 一月 2018 15:09:37 +0800
Subject: [PATCH] CB_IMGPSScan.cab ver2.0.1.63 修正掃瞄壓縮比無效的問題 匯入時灰階與彩色都能辨條碼
---
CB_IMGPSScanImp.pas | 1412 ++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 1,059 insertions(+), 353 deletions(-)
diff --git a/CB_IMGPSScanImp.pas b/CB_IMGPSScanImp.pas
index 8f64685..ddc6977 100644
--- a/CB_IMGPSScanImp.pas
+++ b/CB_IMGPSScanImp.pas
@@ -14,7 +14,7 @@
ExtCtrls, ComCtrls, Menus, StdCtrls, Gauges, EnImgScr, PJMenuSpeedButtons,
Buttons, ImgList, SBSimpleSSL, SBHTTPSClient, SBWinCertStorage, SBX509,
SBCustomCertStorage, SBUtils,mpsBarco,BarcodesFinder,HTTPApp,ErrList,
- Xmltool,inifiles,printers,IdHashMessageDigest, idHash;
+ Xmltool,inifiles,printers,IdHashMessageDigest, idHash, LogFile;
var
Ch_WriteNote : Boolean;
@@ -256,6 +256,8 @@
N2: TMenuItem;
ISB1: TImageScrollBox;
Label3: TLabel;
+ LogFile1: TLogFile;
+ ScanGrayCB: TCheckBox;
procedure ActiveFormCreate(Sender: TObject);
procedure Panel9Resize(Sender: TObject);
procedure ISB1Click(Sender: TObject);
@@ -371,6 +373,9 @@
procedure ImageScrollBox1NewGraphic(const Graphic: TDibGraphic);
procedure SmoothCBClick(Sender: TObject);
procedure N1Click(Sender: TObject);
+ procedure TreeView1MouseEnter(Sender: TObject);
+ procedure ScrollBox1MouseEnter(Sender: TObject);
+ procedure ScanGrayCBClick(Sender: TObject);
private
{ Private declarations }
HotKeyId1,HotKeyId2,HotKeyId3,HotKeyId4 :Integer;
@@ -488,6 +493,7 @@
LastAddFormidList:TstringList;
SampleFormIDList:TStringList; //20170627 已存在範本的formid
ExistImgList:TStringList; //20170724 已經存在的影像list for ESCAN //Img的完整路徑
+ reSizeExistImgList:TstringList; //20171012被縮放的舊圖MD5存入
//********清單區********
//********顯示區********
@@ -562,6 +568,8 @@
NowDivPageFormID:String;
FirstDocDir : String;
+ FMaxUploadSize:String;// 上傳zip大小限制
+ FJpgCompression:integer;// 20171211 jpg to tif 的壓縮率
Draging : Boolean;
@@ -840,7 +848,11 @@
function ISExistImg(const filename:string):boolean; //20170809 確認是否存在原有影像
procedure _DelTreeForExistImg(ASourceDir:String); //2017 刪除前確認 有舊影像嗎
function DocNoIsExistImg(DocNopath: String): boolean; //2017 刪除前確認 有舊影像嗎
- function CheckCaseAttach_OK: Boolean; //2017 確認是否有未歸類文件
+ function CheckCaseAttach_OK: Boolean;
+ function DeleteDocNoFileForESCAN(Path, DocNo: String): Boolean; //2017 確認是否有未歸類文件
+ function CheckRequiredColumnValues(workno,caseno:String) :Boolean; //20171003 此大類下此案是否檢核必填
+ function logTimeString :String;
+ procedure ReduceLogFile ;
protected
{ Protected declarations }
procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
@@ -1018,32 +1030,89 @@
end;
procedure TCB_IMGPSScanX.WMMOUSEWHEEL(var message: TWMMouseWheel);
+var
+ I: Integer;
+ iISB : TImageScrollBox;
begin
inherited;
+ //lb1.Caption:=IntToStr(message.Keys);
+ if (message.WheelDelta = WHEEL_DELTA) Then
+ begin
- if (message.WheelDelta = WHEEL_DELTA) Then begin
- if Edit1.Focused then
- begin
- ScrollBox1.VertScrollBar.Increment := 50;
- ScrollBox1.Perform(WM_VSCROLL, SB_LINEUP, 0);
- end
- else if DisplayISB.Focused then
- begin
- DisplayISB.VertScrollBar.Increment := 50;
- DisplayISB.Perform(WM_VSCROLL, SB_LINEUP, 0);
- end;
- end else if (message.WheelDelta = -WHEEL_DELTA) then begin
- if Edit1.Focused then
- begin
- ScrollBox1.VertScrollBar.Increment := 50;
- ScrollBox1.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
- end
- else if DisplayISB.Focused then
- begin
- DisplayISB.VertScrollBar.Increment := 50;
- DisplayISB.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
- end;
+ if ScrollBox1.Focused then
+ begin
+ ScrollBox1.VertScrollBar.Increment := 50;
+ ScrollBox1.Perform(WM_VSCROLL,SB_Lineup,0);
+ end;
+ if DisplayISB <> nil then
+ begin
+ if (DisplayISB.Focused) and (message.Keys=0) then
+ begin
+ DisplayISB.VertScrollBar.Increment := 50;
+ DisplayISB.Perform(WM_VSCROLL,SB_Lineup,0);
+ end;
+
+ if (DisplayISB.Focused) and (message.Keys=50) then
+ begin
+ DisplayISB.ZoomMode := zmPercent;
+ if DisplayISB.ZoomPercent < 90 then
+ DisplayISB.ZoomPercent := DisplayISB.ZoomPercent+10;
+ end;
+
+ end;
+ i:=0;
+ while FindComponent(ISBName+inttostr(i)) <> nil do
+ begin
+ iISB := TImageScrollBox(FindComponent(ISBName+inttostr(i)));
+ if iISB.Focused then
+ begin
+ ScrollBox1.VertScrollBar.Increment := 50;
+ ScrollBox1.Perform(WM_VSCROLL,SB_Lineup,0);
+ end;
+ inc(i);
+ end;
+
+ end
+ else if (message.WheelDelta = -WHEEL_DELTA) then
+ begin
+
+ if ScrollBox1.Focused then
+ begin
+ ScrollBox1.VertScrollBar.Increment := 50;
+ ScrollBox1.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
+ end;
+ if DisplayISB <> nil then
+ begin
+ if (DisplayISB.Focused) and (message.Keys=0) then
+ begin
+ DisplayISB.VertScrollBar.Increment := 50;
+ DisplayISB.Perform(WM_VSCROLL,SB_LINEDOWN,0);
+ end;
+ if (DisplayISB.Focused) and (message.Keys=50) then
+ begin
+ DisplayISB.ZoomMode := zmPercent;
+ if DisplayISB.ZoomPercent > 10 then
+ DisplayISB.ZoomPercent := DisplayISB.ZoomPercent-10;
+ end;
+
+
+ end;
+
+ i:=0;
+ while FindComponent(ISBName+inttostr(i)) <> nil do
+ begin
+ iISB := TImageScrollBox(FindComponent(ISBName+inttostr(i)));
+ if iISB.Focused then
+ begin
+ ScrollBox1.VertScrollBar.Increment := 50;
+ ScrollBox1.Perform(WM_VSCROLL,SB_Lineup,0);
+ end;
+ inc(i);
+ end;
+
end;
+
+
end;
procedure TCB_IMGPSScanX.WNoteBtnClick(Sender: TObject);
@@ -1217,53 +1286,24 @@
ST1,ST2,ST3,ST4:TStringList;
i,j,k:Integer;
begin
-//ShowMessage('casepath='+casepath);
+
ST1:=TStringList.Create;
ST2:=TStringList.Create;
ST3:=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; }
ExistImgList.Clear;
ST1.LoadFromFile(casepath+'Download\Context.dat');
for I := 0 to ST1.Count - 1 do
begin
+LogFile1.LogToFile(logTimeString+casepath+'Download\'+ST1.Strings[i]+',MD5='+LoadFileGetMD5(casepath+'Download\'+ST1.Strings[i]));
ExistImgList.Add(LoadFileGetMD5(casepath+'Download\'+ST1.Strings[i])) ;
end;
+LogFile1.LogToFile(logTimeString+'ExistImgList.text'+ExistImgList.CommaText);
ST1.Free;
ST2.Free;
ST3.Free;
-//ShowMessage('ExistImgList='+ExistImgList.Text);
+
end;
procedure TCB_IMGPSScanX.Initialize;
@@ -1307,6 +1347,7 @@
NowPage := p+1;
PageLV.ItemIndex := P;
end;
+ //DisplayISB.SetFocus;
end;
procedure TCB_IMGPSScanX.ISB1EndScroll(Sender: TObject);
@@ -1326,7 +1367,7 @@
procedure TCB_IMGPSScanX.ISB1Enter(Sender: TObject);
begin
- //ISB1.SetFocus;
+ ISB1.SetFocus;
end;
procedure TCB_IMGPSScanX.ISB1ImageMouseDown(Sender: TObject; Button: TMouseButton;
@@ -1335,7 +1376,8 @@
p : Integer;
begin
DisplayISB := TImageScrollBox(Sender);
- //DisplayISB.SetFocus;
+ if NowClick<>0 then
+ 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;
@@ -1370,17 +1412,25 @@
begin
//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;
+
+ ISB1.AlwaysShowAnnotations := False;
+
+// 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;
@@ -1637,7 +1687,14 @@
LastAddFormidList.Free;
SampleFormIDList.Free;
ExistImgList.Free;
+ reSizeExistImgList.Free;
//********清單區********
+ if (FMode = 'DSCAN') or (FMode = 'ESCAN') then //重掃件及異動件要只能掃指定編號的件
+ begin
+ if ImagePath<>'' then
+ _Deltree(ImagePath);
+ end;
+
if FEvents <> nil then FEvents.OnDestroy;
end;
@@ -1965,8 +2022,10 @@
iISB : TImageScrollBox;
GoAtt : Boolean;
AttLv : Integer;
+ ST1 :TStringList;
begin
PreNode2Name := '';
+ ST1:=TStringList.Create;
if TreeView1.Selected.Parent = MyTreeNode1 then
PreNode2Name:= GetNode2Name(MyTreeNode2);
ShowText := _Msg('文件歸類中,請稍候');
@@ -1981,6 +2040,7 @@
try
InitialLanguage(DocListForm); //載入多國語言
//InitialLanguage(PatchDlg); //載入多國語言
+ DocListForm.CheckBox1.Visible:=False;
for i := 1 to FORM_INF_List.Count - 1 do
begin
FormID := GetSQLData(FORM_INF_List,'T1.FORM_ID',i);
@@ -2006,23 +2066,48 @@
begin
if (Components[i] is TShape) and (copy(Components[i].Name,1,2)='SP') then
begin
- //Showmessage(Components[i].Name);
iISBName := ShapeName2PreViewISBName(TShape(Components[i]));
iISB := TImageScrollBox(FindComponent(iISBName));
OldName := ExtractFileName(iISB.FileName);
Ext := ExtractFileExt(OldName);
- FormID := DocListForm.DocLV.Selected.Caption;
- DocNo := FormCode2DocNo(FormID);
+
+ if DocListForm.CheckBox1.Checked then
+ begin
+ FormID := DocListForm.Edit1.Text;
+ DocNo := GetNewCustomDocNo(DisplayPath,FormID);
+ end
+ else
+ begin
+ FormID := DocListForm.DocLV.Selected.Caption;
+ DocNo := FormCode2DocNo(FormID);
+ end;
+
+
if DocNoDir2DocNo(Path2DocDir(ExtractFilePath(iISB.FileName),NowCaseno)) = DocNo then
DocDir := Path2DocDir(ExtractFilePath(iISB.FileName),NowCaseNo)
Else
DocDir := FindLastestDocDir(NowCaseno,DocNo);
//ShowMessage('DocNoNeedDiv(DocNo)='+BoolToStr(DocNoNeedDiv(DocNo),true));
+//ShowMessage('DocDir='+DocDir);
if DocNoNeedDiv(DocNo) then //要分份數
begin
if ((FormCode2Page(FormID) = '01') and (GetDocDir_Page(NowCaseno,DocDir)>0)) or (DocDir = '') then
+ begin
DocDir := DocNo2DocNoDir(ImageSavePath + NowCaseno+'\',DocNo);
+ end
+ else
+ begin //20171016 真對補件影響 所加的判斷
+ ST1.Clear;
+ if FileExists(ImageSavePath + NowCaseno+'\'+DocDir+'\Context.dat') then
+ begin
+ ST1.LoadFromFile(ImageSavePath + NowCaseno+'\'+DocDir+'\Context.dat');
+ if ISExistImg(ImageSavePath + NowCaseno+'\'+DocDir+'\'+ST1.Strings[0]) then
+ begin
+ DocDir := DocNo2DocNoDir(ImageSavePath + NowCaseno+'\',DocNo);
+ end;
+ end;
+ end;
end
Else //不分份數
begin
@@ -2056,6 +2141,7 @@
//ReNameContext(iISB.FileName,OldName,NewName);
end;
end;
+//ShowMessage('KKKK');
ReSortFileName(ExtractFilePath(iISB.FileName));
DrawDocItem2(MytreeNode1,NowCaseno);
ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄
@@ -2070,6 +2156,7 @@
finally
DataLoading(False,False);
DocListForm.Free;
+ ST1.Free;
end;
end;
@@ -2489,10 +2576,19 @@
If Messagedlg(Format(_Msg('文件(%s)是否刪除?'),[DocNo2DocName(NowCaseno,NowDocNo)]),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit;
ClearView(1);
Application.ProcessMessages;
-
- _DelTree(ImageSavePath+NowCaseno+'\'+NowDocDir);
+//ShowMessage(NowDocDir);
+ if (Length(NowDocDir)=8) or (NowDocDir=AttName) then
+ begin
+//ShowMessage('DeleteDocNoFileForESCAN');
+ DeleteDocNoFileForESCAN(ImageSavePath+NowCaseno+'\'+NowDocDir,NowDocDir);
+ end
+ else
+ begin
+ _DelTree(ImageSavePath+NowCaseno+'\'+NowDocDir);
+ SetDocNoList('D',-1,NowCaseNo,NowDocDir,'');
+ end;
SetUseCase('D',ImageSavePath+NowCaseno+'\',NowDocDir,'','');
- SetDocNoList('D',-1,NowCaseNo,NowDocDir,'');
+
if (Copy(NowDocNo,1,5)='ZZZZZ') then //20140703 刪除自定文件時要刪ini檔資料
DeleteCustomDocDir(ImageSavePath+NowCaseno+'\',NowDocDir);
@@ -2505,7 +2601,6 @@
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);
@@ -2625,195 +2720,357 @@
end;
end;
-procedure TCB_IMGPSScanX.PM104Click(Sender: TObject);
-var
- i,n,m,ii,P,v,v1,page,imageCount : Integer;
- FName : String;
- CaseID,DocNo,FormID :String;
- DocDir :String;
- SavePath,SaveFilename:String;
- ISB : TImageScrollBox;
- FileRec:TSearchrec;
-begin
+
+Procedure TCB_IMGPSScanX.PM104Click(Sender: TObject);
+Var
+ i, n, m, ii, P, v, v1, page, imageCount: Integer;
+ FName: String;
+ CaseID, DocNo, FormID: String;
+ DocDir: String;
+ SavePath, SaveFilename: String;
+ ISB: TImageScrollBox;
+ FileRec: TSearchrec;
+
+ iGraphic, iGraphic_First, iGraphic_sec: TTiffGraphic;
+ iRect : TRect;
+ JpgGr : TJpegGraphic;
+ SaveStream : TFileStream;
+ SaveStreamA:TFileStream;
+ SaveStreamB:TFileStream;
+ cooom:integer;
+Begin
OpenDialog1.Filter := 'Image files|*.TIF;*.JPG';
- if OpenDialog1.Execute then
- begin
+ If OpenDialog1.Execute Then
+ Begin
ISB := TImageScrollBox.Create(self);
- try
- ShowText :=_Msg('檔案加入中,請稍候');
- DataLoading(True,True);
- if TreeView1.Selected = nil then Exit;
- FName := OpenDialog1.FileName;
+try
+ ShowText := _Msg('檔案加入中,請稍候');
+ DataLoading(True, True);
+ If TreeView1.Selected = Nil Then
+ Exit;
+ FName := OpenDialog1.FileName;
- FindFirst(FName,faAnyfile,FileRec);
- //ShowMessage(IntToStr(FILEREC.Size)+','+IntToStr(FFileSizeLimit));
- if FFileSizeLimit=0 then
- begin
- FFileSizeLimit:=5*1024;
- end;
- if FILEREC.Size > FFileSizeLimit*1024 then //檢查檔案大小
- begin
- ShowMessage(Format('%.3f',[FILEREC.Size / 1024])+' KB, file size over limit.');
- FindClose(FILEREC);
- DataLoading(false,false);
- exit;
- end;
+ FindFirst(FName, faAnyfile, FileRec);
- FindClose(FILEREC);
- CaseID := NowCaseno ;
- imageCount := 0;
- P := ISB.ImageCountFromFile(OpenDialog1.FileName);
- for I := 1 to P do
+ If FFileSizeLimit = 0 Then
+ Begin
+ FFileSizeLimit := 5 * 1024;
+ End;
+//FFileSizeLimit:=20*5*1024;
+//ShowMessage(IntToStr(FileRec.Size)+','+IntToStr(FFileSizeLimit * 1024));
+ If FileRec.Size > FFileSizeLimit * 1024 Then // 檢查檔案大小
+ Begin
+ ShowMessage(Format('目前檔案大小為 %.3f MB', [FileRec.Size / (1024*1024)]) +
+ ',已超過單一檔案匯入限制'+Format('%.1f',[FFileSizeLimit/1024])+'MB');
+ FindClose(FileRec);
+ DataLoading(false, false);
+ Exit;
+ End;
+ //MessageDlg()
+ //cooom:=StrToInt(InputBox('輸入百分比','輸入百分比',''));
+ cooom:=FJpgCompression;//20171211彩色tif採jpg壓縮的比例
+
+ FindClose(FileRec);
+ CaseID := NowCaseno;
+ imageCount := 0;
+ P := ISB.ImageCountFromFile(OpenDialog1.FileName);
+ For i := 1 To P Do
+ Begin
+ ShowText := _Msg('檔案加入中,請稍候(' + inttostr(i) + '/' + inttostr(P) + ')');
+ DataLoading(True, True);
+ ISB.LoadFromFile(FName, i);
+ DeskewImg(ISB.Graphic);
+
+
+ ISB_BW.Graphic.Assign(ISB.Graphic); //20180104
+ If ISB.Graphic.ImageFormat <> ifBlackWhite Then //20180104
begin
- 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
+ ConvertToBW(ISB_BW.Graphic);
+ end;
+ ///ISB_BW.SaveToFile('KKKKKKKK.tif');
+
+ iGraphic_First := TTiffGraphic.Create;
+ iGraphic_sec := TTiffGraphic.Create;
+
+ iGraphic_First.Assign(ISB.Graphic);
+ //ShowMessage(IntToStr(iGraphic_First.Palette.palNumEntries)); //彩色 會為0 黑白 為2
+
+ MpsGetBarcode(ISB_BW.Graphic, MpsBarcodeinf); //判斷A3 有用FormID 所以要先辨條碼
+ //有必要的話先把影像轉正 再開始切圖
+ If CheckNeedCrop(iGraphic_First) Then
+ Begin
+ // 先取右邊的影像
+ iRect.Left := ISB.Graphic.Width Div 2;
+ iRect.Right := ISB.Graphic.Width;
+ iRect.Top := 0;
+ iRect.Bottom := ISB.Graphic.Height;
+ CropImg(iGraphic_First, iRect);
+
+ iGraphic_sec.Assign(ISB.Graphic);
+ // 再取左邊的影像
+ iRect.Left := 0;
+ iRect.Right := ISB.Graphic.Width Div 2;
+ iRect.Top := 0;
+ iRect.Bottom := ISB.Graphic.Height;
+ CropImg(iGraphic_sec, iRect);
+ End;
+
+ iGraphic := iGraphic_First;
+
+ While Not iGraphic.IsEmpty Do
+ Begin
+ If (TreeView1.Selected = NewTreeNode) Or
+ (TreeView1.Selected = MyTreeNode1) Then
+ Begin
SaveFilename := '';
- MpsGetBarcode(ISB.Graphic,MpsBarcodeinf);
- for n := 1 to MpsBarcodeinf.Count do
+ ISB_BW.Graphic.Assign(iGraphic); //20180104
+ If iGraphic.ImageFormat <> ifBlackWhite Then //20180104
begin
- if MpsBarcodeinf.r180[n] <> 0 then //依條碼角度轉影像
- begin
- Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]);
- MpsGetBarcode(ISB.Graphic,MpsBarcodeinf);
- Break;
- end;
+ ConvertToBW(ISB_BW.Graphic);
end;
- FormID := BarCode2FormID; //取出FormID
+ MpsGetBarcode(ISB_BW.Graphic, MpsBarcodeinf);
+//ShowMessage(IntToStr(MpsBarcodeinf.Count));
+ For n := 1 To MpsBarcodeinf.Count Do
+ Begin
+ If MpsBarcodeinf.r180[n] <> 0 Then // 依條碼角度轉影像
+ Begin
+ Rotate(iGraphic, MpsBarcodeinf.r180[n]);
+ MpsGetBarcode(iGraphic, MpsBarcodeinf);
+ Break;
+ End;
+ End;
+ FormID := BarCode2FormID;
+//ShowMessage('FormID='+FormID);
+ // 取出FormID
SaveFilename := FormID;
- if (TreeView1.Selected = NewTreeNode) Then
- begin
- if FindDivFormCode(FormID) Then //只找分案頁上的案件條碼
- begin
+ If (TreeView1.Selected = NewTreeNode) Then
+ Begin
+ If FindDivFormCode(FormID) Then // 只找分案頁上的案件條碼
+ Begin
imageCount := 0;
ClearView(1);
ContextList.Clear;
CaseID := BarCode2CaseID;
- if DirectoryExists(ImageSavePath + CaseID+'\') then
- begin
- _DelTree(ImageSavePath + CaseID+'\');
- SetCaseList('D',-1,CaseID);
- end;
- end;
- if CaseID = '' then
- begin
+ If DirectoryExists(ImageSavePath + CaseID + '\') Then
+ Begin
+ _DelTree(ImageSavePath + CaseID + '\');
+ SetCaseList('D', -1, CaseID);
+ End;
+ End;
+ If CaseID = '' Then
+ Begin
CaseID := GetNoNameCase(ImageSavePath);
ContextList.Clear;
- end;
- end;
- SavePath := ImageSavePath + CaseID+'\';
+ End;
+ End;
+ SavePath := ImageSavePath + CaseID + '\';
Str2Dir(SavePath);
DocNo := FormCode2DocNo(FormID);
- DocDir := FindLastestDocDir(CaseID,DocNo);
- if DocNoNeedDiv(DocNo) then //要分份數
- begin
- if ((FormCode2Page(FormID) = '01') and (GetDocDir_Page(CaseID,DocDir)>0)) or (DocDir = '') then
- DocDir := DocNo2DocNoDir(ImageSavePath + CaseID+'\',DocNo);
- end
- Else //不分份數
- begin
- if DocNo <> '' then
+ DocDir := FindLastestDocDir(CaseID, DocNo);
+ If DocNoNeedDiv(DocNo) Then // 要分份數
+ Begin
+ If ((FormCode2Page(FormID) = '01') And
+ (GetDocDir_Page(CaseID, DocDir) > 0)) Or (DocDir = '') Then
+ DocDir := DocNo2DocNoDir(ImageSavePath + CaseID + '\', DocNo);
+ End
+ Else // 不分份數
+ Begin
+ If DocNo <> '' Then
DocDir := DocNo
- else //Attach 附件
- DocDir := DocNo2DocNoDir(ImageSavePath + CaseID+'\',DocNo);
- end;
- {if ((FormCode2Page(FormID) = '01') and DocNoNeedDiv(DocNo)) or (FormID='') then //是表單第一頁且要分份
- DocDir := DocNo2DocNoDir(ImageSavePath + CaseID+'\',DocNo)
- Else if not DocNoNeedDiv(DocNo) then
- DocDir := DocNo; }
- if (not DirectoryExists(ImageSavePath + CaseID+'\'+DocDir+'\')) and (DocDir <> AttName) then
- SetDocNoList('A',-1,CaseID,DocDir,'1');
- SavePath := ImageSavePath + CaseID+'\'+DocDir+'\';
+ Else // Attach 附件
+ DocDir := DocNo2DocNoDir(ImageSavePath + CaseID + '\', DocNo);
+ End;
+
+ If (Not DirectoryExists(ImageSavePath + CaseID + '\' + DocDir + '\'))
+ And (DocDir <> AttName) Then
+ SetDocNoList('A', -1, CaseID, DocDir, '1');
+ SavePath := ImageSavePath + CaseID + '\' + DocDir + '\';
Str2Dir(SavePath);
ContextList.Clear;
- if FileExists(SavePath+'Context.dat') then
- ContextList.LoadFromFile(SavePath+'Context.dat');
+ If FileExists(SavePath + 'Context.dat') Then
+ ContextList.LoadFromFile(SavePath + 'Context.dat');
- WriteCaseIndex(ImageSavePath + CaseID+'\'); //寫入案件索引
- if SaveFilename = '' then //附件
- SaveFilename:= Add_Zoo(ContextList.Count+1,3)+ext
+ WriteCaseIndex(ImageSavePath + CaseID + '\');
+ // 寫入案件索引
+ If SaveFilename = '' Then // 附件
+ SaveFilename := Add_Zoo(ContextList.Count + 1, 3) + ext
Else
- SaveFilename := Add_Zoo(ContextList.Count+1,3)+'_'+SaveFilename+ext;
+ 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);
+ For n := 1 To MpsBarcodeinf.Count Do
+ Begin
+ If MpsBarcodeinf.r180[n] <> 0 Then // 依條碼角度轉影像
+ Begin
+ Rotate(iGraphic, MpsBarcodeinf.r180[n]);
+ MpsGetBarcode(iGraphic, MpsBarcodeinf);
Break;
- end;
- end;
- //Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]); //20170705 加入有條碼就轉正
- ISB.SaveToFile(SavePath+SaveFilename);
-
- SetContextList('A',-1,CaseID,DocDir,SaveFilename);
- if (TreeView1.Selected = NewTreeNode) Then
+ End;
+ End;
+//ShowMessage(IntToStr(iGraphic.Palette.palNumEntries));
+ if (iGraphic.Palette.palNumEntries = 0) or (iGraphic.Palette.palNumEntries = 256) then //20171130 彩色 會為0 黑白 為2 灰階256
begin
- if imageCount = 0 then
- begin
- SetCaseList('A',-1,CaseID);
- MyTreeNode1 := TreeView1.Items.AddChild(NewTreeNode,CaseID);
+ iGraphic.Compression:=tcJPEG;
+ iGraphic.JpegQuality:=cooom;
+ end;
+
+ If LowerCase(ExtractFileExt(SavePath + SaveFilename)) = '.tif' Then
+ Begin
+ If FileExists(SavePath + SaveFilename) Then
+ SaveStream := TFileStream.Create(SavePath + SaveFilename, fmOpenReadWrite)
+ Else
+ SaveStream := TFileStream.Create(SavePath + SaveFilename, fmCreate);
+ Try
+ SaveStream.Seek(0, soFromBeginning);
+ iGraphic.AppendToStream(SaveStream);
+ Finally
+ SaveStream.Free;
+ End;
+ End
+ Else If LowerCase(ExtractFileExt(SavePath + SaveFilename))
+ = '.jpg' Then
+ Begin
+ If FileExists(SavePath + SaveFilename) Then
+ DeleteFile(SavePath + SaveFilename);
+ // SaveStream := TFileStream.Create( PEFileName ,fmCreate );
+ JpgGr := TJpegGraphic.Create;
+ Try
+ JpgGr.Assign(iGraphic);
+ JpgGr.SaveQuality := 30;
+ // JpgGr.AppendToStream(SaveStream);
+ JpgGr.SaveToFile(SavePath + SaveFilename);
+ Finally
+ JpgGr.Free;
+ // SaveStream.Free;
+ End;
+ End;
+
+ SetContextList('A', -1, CaseID, DocDir, SaveFilename);
+ If (TreeView1.Selected = NewTreeNode) Then
+ Begin
+ If imageCount = 0 Then
+ Begin
+ SetCaseList('A', -1, CaseID);
+ MyTreeNode1 := TreeView1.Items.AddChild(NewTreeNode, CaseID);
MyTreeNode1.ImageIndex := 2;
MyTreeNode1.SelectedIndex := 2;
Application.ProcessMessages;
- end;
- end;
+ End;
+ End;
inc(imageCount);
- //DrawDocItem1(MytreeNode1,Doc_Inf_List,CaseID);
- //DrawDocItem(MyTreeNode1,FORM_INF_List,CaseID);
- end
- Else if TreeView1.Selected = MyTreeNode3 then
- begin
- SavePath := ImageSavePath + CaseID+'\'+NowDocDir+'\';
+ // DrawDocItem1(MytreeNode1,Doc_Inf_List,CaseID);
+ // DrawDocItem(MyTreeNode1,FORM_INF_List,CaseID);
+ End
+ Else If TreeView1.Selected = MyTreeNode3 Then
+ Begin
+ SavePath := ImageSavePath + CaseID + '\' + NowDocDir + '\';
ContextList.Clear;
- if FileExists(ImageSavePath + CaseID+'\'+NowDocDir+'\Context.dat') then
- ContextList.LoadFromFile(ImageSavePath + CaseID+'\'+NowDocDir+'\Context.dat');
- if NowFormCode <> '' then
- SaveFilename := Add_Zoo(ContextList.Count+1,3)+'_'+NowFormCode+ext
- else
- SaveFilename := Add_Zoo(ContextList.Count+1,3)+ext;
+ If FileExists(ImageSavePath + CaseID + '\' + NowDocDir +
+ '\Context.dat') Then
+ ContextList.LoadFromFile(ImageSavePath + CaseID + '\' + NowDocDir +
+ '\Context.dat');
+ If NowFormCode <> '' Then
+ 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);
+ For n := 1 To MpsBarcodeinf.Count Do
+ Begin
+ If MpsBarcodeinf.r180[n] <> 0 Then // 依條碼角度轉影像
+ Begin
+ Rotate(iGraphic, MpsBarcodeinf.r180[n]);
+ MpsGetBarcode(iGraphic, MpsBarcodeinf);
Break;
- end;
+ End;
+ End;
+
+ if (iGraphic.Palette.palNumEntries = 0) or (iGraphic.Palette.palNumEntries = 256) then //20171130 彩色 會為0 黑白 為2
+ begin
+ iGraphic.Compression:=tcJPEG;
+ iGraphic.JpegQuality:=cooom;
end;
- //Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]); //20170705 加入有條碼就轉正
- ISB.SaveToFile(SavePath+SaveFilename);
+
+ If LowerCase(ExtractFileExt(SavePath + SaveFilename)) = '.tif' Then
+ Begin
+ If FileExists(SavePath + SaveFilename) Then
+ SaveStream := TFileStream.Create(SavePath + SaveFilename,
+ fmOpenReadWrite)
+ Else
+ SaveStream := TFileStream.Create(SavePath + SaveFilename,
+ fmCreate);
+ Try
+ SaveStream.Seek(0, soFromBeginning);
+ iGraphic.AppendToStream(SaveStream);
+ Finally
+ SaveStream.Free;
+ End;
+ End
+
+ Else
+ Begin
+ If LowerCase(ExtractFileExt(SavePath + SaveFilename)) = '.jpg' Then
+ Begin
+ If FileExists(SavePath + SaveFilename) Then
+ DeleteFile(SavePath + SaveFilename);
+ // SaveStream := TFileStream.Create( PEFileName ,fmCreate );
+ JpgGr := TJpegGraphic.Create;
+ Try
+ JpgGr.Assign(iGraphic);
+ JpgGr.SaveQuality := 30;
+ // JpgGr.AppendToStream(SaveStream);
+ JpgGr.SaveToFile(SavePath + SaveFilename);
+ Finally
+ JpgGr.Free;
+ // SaveStream.Free;
+ End;
+ End;
+
+ End;
+ // ISB.SaveToFile(SavePath+SaveFilename);
ContextList.Add(SaveFilename);
- ContextList.SaveToFile(SavePath+'Context.dat');
- end;
- end;
- ClearErrini(CaseID,MyTreeNode1); //清掉檢核記錄
- if (TreeView1.Selected = MyTreeNode1) or (TreeView1.Selected = NewTreeNode) then
- begin
- LoadImgFile;
- end
- Else
- begin
- DrawDocItem2(MytreeNode1,CaseID); //長出文件名稱的樹並傳回是否有申請書的影像
- page := GetCasePage(ImageSavePath,CaseID);
- MytreeNode1.Text := Format(_Msg('%s-%d頁'),[CaseID,page]);
- end;
- NewTreeNodeRefresh;
- Application.ProcessMessages;
- DataLoading(False,False);
- finally
- ISB.Free;
- end;
- end;
+ ContextList.SaveToFile(SavePath + 'Context.dat');
+ End;
+
+ if iGraphic = iGraphic_First then
+ iGraphic := iGraphic_Sec
+ else
+ iGraphic.Assign(nil);
+
+ End //While 結束
+
+ End;
+ ClearErrini(CaseID, MyTreeNode1);
+ // 清掉檢核記錄
+ If (TreeView1.Selected = MyTreeNode1) Or
+ (TreeView1.Selected = NewTreeNode) Then
+ Begin
+ LoadImgFile;
+ End
+ Else
+ Begin
+ DrawDocItem2(MyTreeNode1, CaseID);
+ // 長出文件名稱的樹並傳回是否有申請書的影像
+ page := GetCasePage(ImageSavePath, CaseID);
+ // ShowMessage('page='+IntToStr(page));
+ MyTreeNode1.Text := Format(_Msg('%s-%d頁'), [CaseID, page]);
+ End;
+ // ShowMessage('AAAA');
+ NewTreeNodeRefresh;
+ Application.ProcessMessages;
+ DataLoading(false, false);
+
+
+finally
+ISB.Free;
end;
+
+
+ End;
+End;
+
+
procedure TCB_IMGPSScanX.PM106Click(Sender: TObject);
var
@@ -2919,11 +3176,12 @@
i : Integer;
DocListForm : TDocListForm;
OldName,NewName,Ext : String;
- NewFormID,NewFormName : String;
+ NewFormID,NewFormName,CustomDocNo : String;
begin
DocListForm := TDocListForm.Create(self);
try
- InitialLanguage(PatchDlg); //載入多國語言
+ InitialLanguage(DocListForm); //載入多國語言
+ DocListForm.CheckBox1.Visible:=True;
for i := 1 to FORM_INF_List.Count - 1 do
begin
NewFormID := GetSQLData(FORM_INF_List,'T1.FORM_ID',i);
@@ -2941,30 +3199,64 @@
end;
if DocListForm.ShowModal = mrOk then
begin
- NewFormID := DocListForm.DocLV.Selected.Caption;
- if NowFormCode <> AttName then
+ if not (DocListForm.DocLV.Selected=nil) then
+ NewFormID := DocListForm.DocLV.Selected.Caption;
+ if DocListForm.CheckBox1.Checked then
begin
- If Messagedlg(Format(_Msg('是否將"%s"的所有影像歸類成"%s"'),[FormCode2FormName(NowCaseNo,NowFormCode),FormCode2FormName(NowCaseNo,NewFormID)]),MtConfirmation,[mbyes,mbcancel],0) = mrcancel Then
+ //歸類到自訂文件
+ NewFormID:=DocListForm.Edit1.Text;
+ if Trim(DocListForm.Edit1.Text)='' then
+ begin
+ Showmessage('未輸入文件名稱');
Exit;
+ end;
+ if FindCustomDocName(DisplayPath,NewFormID) then
+ begin
+ Showmessage(Format('文件名稱:"%s"己存在',[NewFormID]));
+ Exit;
+ end;
+ if NowFormCode <> AttName then
+ begin
+ If Messagedlg(Format(_Msg('是否將"%s"的所有影像歸類成"%s"'),[FormCode2FormName(NowCaseNo,NowFormCode),NewFormID]),MtConfirmation,[mbyes,mbcancel],0) = mrcancel Then
+ Exit;
+ end
+ Else
+ begin
+ If Messagedlg(Format(_Msg('是否將"%s"的所有影像歸類成"%s"'),[_Msg('附件')+MyTreeNode3.Text,FormCode2FormName(NowCaseNo,NewFormID)]),MtConfirmation,[mbyes,mbcancel],0) = mrcancel Then
+ Exit;
+ end;
+ CustomDocNo := GetNewCustomDocNo(DisplayPath,NewFormID);
+//ShowMessage('CustomDocNo='+CustomDocNo);
+ ShowText := _Msg('歸類中,請稍侯');
+ DataLoading(True,True);
+ FormIDReplace(NowCaseNo,NowDocDir,NowFormCode,CustomDocNo+'010101A');
end
- Else
+ else
begin
- If Messagedlg(Format(_Msg('是否將"%s"的所有影像歸類成"%s"'),[_Msg('附件')+MyTreeNode3.Text,FormCode2FormName(NowCaseNo,NewFormID)]),MtConfirmation,[mbyes,mbcancel],0) = mrcancel Then
- Exit;
+ //歸類到既有文件
+ if NowFormCode <> AttName then
+ begin
+ If Messagedlg(Format(_Msg('是否將"%s"的所有影像歸類成"%s"'),[FormCode2FormName(NowCaseNo,NowFormCode),FormCode2FormName(NowCaseNo,NewFormID)]),MtConfirmation,[mbyes,mbcancel],0) = mrcancel Then
+ Exit;
+ end
+ Else
+ begin
+ If Messagedlg(Format(_Msg('是否將"%s"的所有影像歸類成"%s"'),[_Msg('附件')+MyTreeNode3.Text,FormCode2FormName(NowCaseNo,NewFormID)]),MtConfirmation,[mbyes,mbcancel],0) = mrcancel Then
+ Exit;
+ end;
+ ShowText := _Msg('歸類中,請稍侯');
+ DataLoading(True,True);
+//ShowMessage('NowDocDir='+NowDocDir);
+ FormIDReplace(NowCaseNo,NowDocDir,NowFormCode,NewFormID);
+
end;
- ShowText := _Msg('歸類中,請稍侯');
- DataLoading(True,True);
- //FormIDReplace(DisplayPath,NowFormCode,FormID);
- //ShowFileReplace(DisplayPath,FormID);
- FormIDReplace(NowCaseNo,NowDocDir,NowFormCode,NewFormID);
ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄
DrawDocItem2(MytreeNode1,NowCaseno);
- //DrawDocItem(MytreeNode1,FORM_INF_List,NowCaseno);
-
DataLoading(False,False);
TreeView1.Selected := MyTreeNode1;
TreeView1Click(self);
end;
+
finally
DocListForm.Free;
end;
@@ -3007,6 +3299,7 @@
CustomDocNo : String;
DocDir : String;
SavePath : String;
+ ST1:TStringList;
begin
if InputQuery('輸入其他文件名稱','文件名稱',CustomDocName) then
begin
@@ -3017,7 +3310,7 @@
Showmessage(Format('文件名稱:"%s"己存在',[CustomDocName]));
Exit;
end;
-
+ ST1:=TStringList.Create;
CustomDocNo := GetNewCustomDocNo(DisplayPath,CustomDocName);
DocDir := CustomDocNo;
SavePath := ImageSavePath+NowCaseNo+'\'+DocDir+'\';
@@ -3305,6 +3598,9 @@
PM101.Visible:=false;
end;
+ if FMode='ESCAN' then
+ PM101.Visible:=false;
+
if FModeName='異動件' then
begin
PM101.Visible := True;
@@ -3317,8 +3613,8 @@
PM103.Visible := True; //掃瞄器加入影像
//PM107.Visible := True; //寫備註
//PM109.Visible := True; //檢核此筆
- if FCustDocYN <> 'N' Then
- PM110.Visible := True; //新增自訂文件
+// if FCustDocYN <> 'N' Then
+// PM110.Visible := True; //新增自訂文件 20170914 先不在tree 中做自訂文件 讓user在縮圖做
PM104.Visible := True; //檔案加入影像
if (FMode = 'NSCAN') then
begin
@@ -3334,8 +3630,8 @@
PM101.Visible := True; //刪除
//PM107.Visible := True; //寫備註
//PM109.Visible := True; //檢核此筆
- if FCustDocYN <> 'N' Then
- PM110.Visible := True; //新增自訂文件
+// if FCustDocYN <> 'N' Then
+// PM110.Visible := True; //新增自訂文件
if FImgDelete='Y' then
begin
PM101.Visible:=True;
@@ -3369,8 +3665,8 @@
PM104.Visible := True; //檔案加入影像
PM108.Visible := True; //歸類
PM103.Visible := True; //掃瞄器加入影像
- if FCustDocYN <> 'N' Then
- PM110.Visible := True; //新增自訂文件
+// if FCustDocYN <> 'N' Then
+// PM110.Visible := True; //新增自訂文件
if GetFormIDPage(ContextList,NowFormCode) < 1 Then
begin
PM108.Visible := False; //歸類
@@ -3672,6 +3968,11 @@
end;
+procedure TCB_IMGPSScanX.ScrollBox1MouseEnter(Sender: TObject);
+begin
+ScrollBox1.SetFocus;
+end;
+
procedure TCB_IMGPSScanX.SelectScanBtnClick(Sender: TObject);
begin
Panel1.Enabled := False;
@@ -3819,11 +4120,11 @@
//CreateFormID_FormName(DisplayPath); //產生FormID_FormName.dat
//CreateDocNo_DocName(DisplayPath); //產生DocNo_Name.dat
//Showmessage(CreateDocNo_Info(DisplayPath)); //產生 Docno,份數,頁數;Docno,份數,頁數 的回傳字串
- lb1.Caption:='AAAAAAAAAAA';
+ //lb1.Caption:='AAAAAAAAAAA';
//Showmessage(CreateDocnoFrom_Info(NowCaseno));
//Showmessage(self.CreateCustDocNoFrom_Info(NowCaseno));
-
- initkscan;
+ //ShowMessage('FMaxUploadSize='+FMaxUploadSize);
+ //initkscan;
showmessage('FUrl='+FUrl+#10#13+
'FCaseID='+FCaseID+#10#13+
'FMode='+FMode+#10#13+
@@ -3854,7 +4155,8 @@
'FImgDelete='+ FImgDelete+#10#13+
'FIsExternal='+ FIsExternal+#10#13+
'FWH_category='+FWH_category+
- 'FCheck_main_form='+ FCheck_main_form);
+ 'FCheck_main_form='+ FCheck_main_form+#10#13+
+ 'FMaxUploadSize='+FMaxUploadSize);
//FImgDelete:='Y';
LoadImgFile;
{ ShowMessage('UpLPoint='+IntToStr(UpLPoint.X)+','+IntToStr(UpLPoint.Y)+#10#13+
@@ -3923,6 +4225,10 @@
Try
Scanner.OpenSource;
Scanner.Duplex := ScanDuplex; //雙面
+
+ if FMode='SAMPLESCAN' then
+ Scanner.Duplex:=False;
+
//Scanner.FEEDERENABLED := not ScanFlatCB.Checked; // 先拿掉平台
If ScanImgSetUse Then
begin
@@ -4035,14 +4341,14 @@
end;
end;
pScanInfo^.Graphic.Compression := tcJpeg;
- pScanInfo^.Graphic.JpegQuality := 70;
+ pScanInfo^.Graphic.JpegQuality := FJpgCompression;
end
else if pScanInfo^.Graphic.ImageFormat = ifColor256 Then
begin
//Ext := '.jpg';
ConvertToGray(pScanInfo^.Graphic);
pScanInfo^.Graphic.Compression := tcJpeg;
- pScanInfo^.Graphic.JpegQuality := 70;
+ pScanInfo^.Graphic.JpegQuality := FJpgCompression;
end
else if pScanInfo^.Graphic.ImageFormat = ifGray256 Then
begin
@@ -4060,7 +4366,13 @@
end;
end;
pScanInfo^.Graphic.Compression := tcJpeg;
- pScanInfo^.Graphic.JpegQuality := 70;
+ pScanInfo^.Graphic.JpegQuality := FJpgCompression;
+//ShowMessage(IntToStr(pScanInfo^.Graphic.JpegQuality));
+//if pScanInfo^.Graphic.Compression = tcJpeg then
+//begin
+//ShowMessage('jpg');
+//end;
+
end
else
begin
@@ -4093,6 +4405,19 @@
end;
//iGraphic.Assign(iGraphic_First);
iGraphic := iGraphic_First;
+
+ if iGraphic.ImageFormat=ifGray256 then //20180104
+ begin
+ iGraphic.Compression:=tcJPEG;
+ iGraphic.JpegQuality:=FJpgCompression;
+ end;
+ if iGraphic.ImageFormat=ifTrueColor then //20180104
+ begin
+ iGraphic.Compression:=tcJPEG;
+ iGraphic.JpegQuality:=FJpgCompression;
+ end;
+
+
while not iGraphic.IsEmpty do
begin
//Application.ProcessMessages;
@@ -4102,6 +4427,26 @@
ImageScrollBox1NewGraphic(ImageScrollBox1.Graphic);
MpsGetBarcode(ISB_BW.Graphic,MpsBarcodeinf);
+ For i := 1 To MpsBarcodeinf.Count Do
+ Begin
+ If MpsBarcodeinf.r180[i] <> 0 Then // 依條碼角度轉影像
+ Begin
+ Rotate(iGraphic, MpsBarcodeinf.r180[i]);
+ Break;
+ End;
+ End;
+
+ if iGraphic.ImageFormat=ifGray256 then //20180104 因此旋轉後變為回packbits 所以要改為jpeg
+ begin
+ iGraphic.Compression:=tcJPEG;
+ iGraphic.JpegQuality:=FJpgCompression;
+ end;
+ if iGraphic.ImageFormat=ifTrueColor then
+ begin
+ iGraphic.Compression:=tcJPEG;
+ iGraphic.JpegQuality:=FJpgCompression;
+ end;
+
PageEnd;
IF PEFileName <> '' Then
begin
@@ -4126,7 +4471,7 @@
JpgGr := TJpegGraphic.Create;
try
JpgGr.Assign(iGraphic);
- JpgGr.SaveQuality := 30;
+ JpgGr.SaveQuality := FJpgCompression;
//JpgGr.AppendToStream(SaveStream);
JpgGr.SaveToFile(PEFileName);
finally
@@ -4918,6 +5263,16 @@
begin
PARA_CONTENT := GetSQLData(WORK_INF_List,'PARA_CONTENT',i);
DivPageFormIDList.CommaText := PARA_CONTENT;
+ end
+ Else if UpperCase(GetSQLData(WORK_INF_List,'PARA_NO',i)) = 'FILE_COMPRESSION' Then //20171211 jpg to tif 壓縮比
+ begin
+ PARA_CONTENT := GetSQLData(WORK_INF_List,'PARA_CONTENT',i);
+ FJpgCompression := StrToInt(PARA_CONTENT);
+ end
+ Else if UpperCase(GetSQLData(WORK_INF_List,'PARA_NO',i)) = 'MAX_UPLOAD_SIZE' Then //取得 上傳大小的限制(MB)
+ begin
+ PARA_CONTENT := GetSQLData(WORK_INF_List,'PARA_CONTENT',i);
+ FMaxUploadSize := PARA_CONTENT;
end;
end;
ScanDuplex := Def_ScanDuplex;
@@ -5416,6 +5771,16 @@
StringtoFile(IN_WH_DocNoList.Text,'D:\121.txt');}
end;
+function TCB_IMGPSScanX.CheckRequiredColumnValues(workno, caseno:String): Boolean;
+begin
+//
+ Result:=False;
+ if (workno='HLN') and (caseno[9]='3') then
+ Result:=True;
+ if (workno='HLN') and (caseno[9]='4') then
+ Result:=True;
+end;
+
Procedure TCB_IMGPSScanX.CheckRule2OMRErrInfo; //檢核規則填入OMRErrINFo Record
var i : Integer;
CheckNo : String;
@@ -5512,10 +5877,11 @@
begin
if ISExistImg(ImageSavePath+CaseID+'\'+DocDir+'\'+FileList.Strings[i]) then
begin
- ShowMessage('有圖為非當次掃瞄,不可刪除');
- Exit;
+ //ShowMessage('有圖為非當次掃瞄,不可刪除');
+ Break;
end;
end;
+//ShowMessage(FileList.Strings[i]);
DeleteImageFile(ImageSavePath+CaseID+'\'+DocDir+'\',FileList.Strings[i],CaseID);
end;
end;
@@ -5573,6 +5939,40 @@
Cust_DocNoList.LoadFromFile(Path+'CustomDocNo.dat');
end;
+Function TCB_IMGPSScanX.DeleteDocNoFileForESCAN(Path,DocNo:String):Boolean; //刪除指定DocNo文件
+var
+ i,j,k: Integer;
+ FName : String;
+ ST1,ST2,ST3:TStringList;
+
+begin
+
+ Result := False;
+//ShowMessage(DocNo);
+ for i := ContextList.Count - 1 downto 0 do
+ begin
+ FName := ContextList.Strings[i];
+ If (DocNo = FormCode2DocNo(FileName2FormCode(FName))) or (DocNo=AttName) then
+ begin
+ if not ISExistImg(Path+'\'+FName) then
+ begin
+ DeleteFile(Path+'\'+FName);
+ ContextList.Delete(i);
+ end;
+ Result := True; //有刪到指定文件
+ end;
+ end;
+ ContextList.SaveToFile(Path+'\Context.dat');
+ ContextList.LoadFromFile(Path+'\Context.dat');
+
+ if ContextList.Count=0 then
+ begin
+ _DelTree(Path);
+ SetDocNoList('D',-1,NowCaseNo,NowDocDir,'');
+ end;
+
+end;
+
Procedure TCB_IMGPSScanX.DeleteShowFile(Path:String); //刪除顯示中的影像
var
i : Integer;
@@ -5605,13 +6005,19 @@
Function TCB_IMGPSScanX.CheckCaseDocNoPage(CaseID,DocNo,Version:String;Pages:Integer):Integer; //取案件裡的文件_版本頁數
var
i,n,Count : integer;
- S : TStringlist;
+ S, S2 : TStringlist;
FormCode,iPage : String;
+ docInt,tempInt:integer;
+ v,v2:integer;
begin
Count := 0;
+ docInt:=0;
+ tempInt:=0;
S := TStringlist.Create;
+ S2 := TStringlist.Create;
try
S.LoadFromFile(ImageSavePath+CaseID+'\upload\Context.dat');
+ S2.LoadFromFile(ImageSavePath+CaseID+'\upload\DocDir.dat'); //2017 1220 改成只承認第一份的
for I := 1 to pages do //從0到pages-1 改成 1到pages 20170316 這樣可以修改檢核的頁數問題
begin
iPage := Add_Zoo(i,2);
@@ -5625,10 +6031,29 @@
Continue;
end;
end;
+ if Length(S2.Strings[n])>8 then //2017 1220 改成只承認第一份的
+ begin
+ v:=Pos('(',S2.Strings[n]);
+ v2:=Pos(')',S2.Strings[n]);
+ tempInt:=StrToInt(Copy(S2.Strings[n],v+1,v2-v-1));
+
+ if docInt=0 then
+ begin
+ docInt:=tempInt;
+ end;
+
+ if docInt<>tempInt then
+ begin
+ Break
+ end;
+ end;
+
FormCode := FileName2FormCode(S.Strings[n]);
//Showmessage('1:'+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
+LogFile1.LogToFile(logTimeString+'CheckCaseDocNoPage caseno='+CaseID+','+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
if (version = FormCode2Version(FormCode)) and (DocNo = FormCode2DocNo(FormCode)) and (ipage = FormCode2Page(FormCode)) then
begin
+LogFile1.LogToFile(logTimeString+'CheckCaseDocNoPage caseno='+CaseID+','+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
//Showmessage(version+','+DocNo+',iPage='+iPage);
//Showmessage(inttostr(Count+1));
Inc(Count);
@@ -5638,6 +6063,7 @@
end;
finally
S.Free;
+ S2.free;
end;
Result := Count;
end;
@@ -5716,7 +6142,9 @@
SizeStr : String;
S : TStringlist;
v,v1:Integer;
+ IsRecordMD5:Boolean;
begin
+ IsRecordMD5:=False;
FormID := FileName2FormCode(FileName);
if FormID = '' then Exit;
@@ -5732,6 +6160,12 @@
begin
//ShowMessage('BBBBBBB');
ImageScrollBox1.LoadFromFile(ImageSavePath+CaseID+'\Upload\'+FileName,1);
+
+ if (FWH_category='N') and ISExistImg(ImageSavePath+CaseID+'\Upload\'+FileName) then
+ begin
+ Exit;//20171103 補件 原有的圖不作resize
+ end;
+
//FindPoint(ImageScrollBox1.Graphic,UpLPoint,UpRPoint,DownLPoint,NowW,NowH);
FindPoint(ISB_BW.Graphic,UpLPoint,UpRPoint,DownLPoint,NowW,NowH,ANCHOR);
@@ -5744,8 +6178,15 @@
IF (SizeStr <> '') and (Copy(SizeStr,1,v) <> 'ERROR') then
begin
//ShowMessage('CCCCC');
-
+ if (ISExistImg(ImageSavePath+CaseID+'\Upload\'+FileName)) and (reSizeExistImgList.IndexOf(LoadFileGetMD5(ImageSavePath+CaseID+'\Upload\'+FileName))=-1) then
+ begin
+ IsRecordMD5:=True;
+ end;
ImageScrollBox1.SaveToFile(ImageSavePath+CaseID+'\Upload\'+FileName);
+ if IsRecordMD5 then
+ begin
+ reSizeExistImgList.add(LoadFileGetMD5(ImageSavePath+CaseID+'\Upload\'+FileName));
+ end;
//showmessage(ImageSavePath+CaseID+'\Upload\'+FileName);
S := TStringlist.Create; ///20110422拿掉 換成上傳才做
if FileExists(ImageSavePath+CaseID+'\Upload\ReSize.dat') then
@@ -5828,6 +6269,8 @@
casepath:String;
filesizeInt:integer;
case_page:string;
+ Fname:String;
+ FileRec:TSearchrec;
begin
Result := True;
TransName := CaseID;
@@ -5891,7 +6334,7 @@
for I := 0 to ST1.Count - 1 do
begin
- if (Pos('_',St1.Strings[i])<>1) and (Pos('_',St1.Strings[i])<>-11) then
+ if (Pos('_',St1.Strings[i])<>1) and (Pos('_',St1.Strings[i])<>-1) then
begin
str1:=Copy(ST1.Strings[i],1,Pos('_',St1.Strings[i])-1);
ST2.Add(str1);
@@ -5945,6 +6388,26 @@
if HaveMask then
ZipMaskFile(Path,MaskPath,Path,'MaskImg.zip'); //有遮罩設定的才產生
/////壓檔////
+
+ ///檢查上傳的zip大小////
+ FName :=Path+ 'Img.zip';
+
+ FindFirst(FName, faAnyfile, FileRec);
+
+ //FMaxUploadSize
+//ShowMessage(IntToStr(FileRec.Size));
+//Result:=False;
+//exit; //目前上傳檔案大小為xxMB,已超過50MB,無法上傳 %.3f ,[FileRec.Size / 1048576]
+ If FileRec.Size > StrtoInt(FMaxUploadSize) * 1048576 Then // 檢查檔案大小
+ Begin
+ ShowMessage(Format('%s目前上傳檔案大小為%.3fMB,已超過'+FMaxUploadSize+'MB,無法上傳',[caseid,FileRec.Size / 1048576]) );
+ FindClose(FileRec);
+ Result := False;
+ Exit;
+ End;
+ FindClose(FileRec);
+ ///檢查上傳的zip大小////
+//ShowMessage('last_add_formidstr='+last_add_formidstr);
////上傳/////
SendData:='data='+HTTPEncode(UTF8Encode(FData))
+'&verify='+FVerify
@@ -5964,19 +6427,19 @@
//ShowMessage(FData+#10#13+Doc_Data);
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);
+ Showmessage(Inttostr(HttpError.HttpErrorCode)+' '+HttpError.HttpReason+'.');
Result := False;
Exit;
end;
if memo1.Lines.Strings[0] = '1' then
begin
- Showmessage(Format(_Msg('傳送案件編號(%s)檔案時,網路發生錯誤!!')+_Msg('錯誤原因:'),[CaseID])+memo1.Lines.Strings[1]);
+ Showmessage(Format(_Msg('')+_Msg(''),[CaseID])+memo1.Lines.Strings[1]+'。');
Result := False;
Exit;
end
- Else if Pos('<script type="text/javascript" src="scripts/CW00/login.js"></script>',Memo1.Lines.Text) > 0 then
+ Else if Pos('<script type="text/javascript" src="scripts/IMGPS00/login.js"></script>',Memo1.Lines.Text) > 0 then
begin
- Showmessage(Format(_Msg('傳送案件編號(%s)檔案時,網路發生錯誤!!')+_Msg('錯誤原因:')+_Msg('閒置過久或被登出,請重新登入'),[CaseID]));
+ Showmessage(Format(_Msg('')+_Msg('')+_Msg('閒置過久或被登出,請重新登入'),[CaseID]));
Result := False;
Exit;
end;
@@ -6229,11 +6692,11 @@
end;
if Memo1.Lines.Strings[0] = '1' then
begin
- HttpErrStr :=_Msg('錯誤原因:')+memo1.Lines.Strings[1];
+ HttpErrStr :=_Msg('錯誤原因:')+memo1.Lines.Strings[1]+'。';
Result := False;
Exit;
end
- Else if Pos('<script type="text/javascript" src="scripts/CW00/login.js"></script>',Memo1.Lines.Text) > 0 then
+ Else if Pos('<script type="text/javascript" src="scripts/IMGPS00/login.js"></script>',Memo1.Lines.Text) > 0 then
begin
HttpErrStr := _Msg('錯誤原因:')+_Msg('閒置過久或被登出,請重新登入');
Result := False;
@@ -6553,7 +7016,7 @@
begin
if FWH_category='N' then
begin
- if ISExistImg(Path+S.Strings[i]) then
+ if (ISExistImg(Path+S.Strings[i])) or (reSizeExistImgList.IndexOf(LoadFileGetMD5(Path+S.Strings[i]))<>-1) then
begin
Continue;
end;
@@ -6708,7 +7171,8 @@
if Index <> -1 then
begin
//SetRecordEditedDocDir('D',CaseNo,CaseDocNoList.Strings[Index]); //20140624 修改刪除文件時也記一筆異動,刪掉會無法通知前端網頁有異動
- SetRecordEditedDocDir('A',CaseNo,CaseDocNoList.Strings[Index]);
+ SetRecordEditedDocDir('A',CaseNo,CaseDocNoList.Strings[Index]); //20170912 要刪除 不然我寫不下去
+
CaseDocNoList.Delete(Index);
CaseDocNo_CopiesList.Delete(Index);
@@ -6720,7 +7184,7 @@
if DocDir = CaseDocNoList.Strings[i] then
begin
//SetRecordEditedDocDir('D',CaseNo,CaseDocNoList.Strings[i]); //20140624 修改刪除文件時也記一筆異動,刪掉會無法通知前端網頁有異動
- SetRecordEditedDocDir('A',CaseNo,CaseDocNoList.Strings[i]);
+ SetRecordEditedDocDir('A',CaseNo,CaseDocNoList.Strings[i]); //20170912 要刪除 不然我寫不下去
CaseDocNoList.Delete(i);
CaseDocNo_CopiesList.Delete(i);
Break;
@@ -6916,16 +7380,42 @@
FormID : String;
OldFile,NewFile:String;
Ext : String;
+ ST1:TStringList;
begin
+ ST1:=TStringList.Create;
OldFileList := TStringlist.Create;
NewFileList := TStringlist.Create;
try
NewDocNo := FormCode2DocNo(NewFormID);
NewDocDir := FindLastestDocDir(CaseID,NewDocNo);
if NewDocDir = '' then
- NewDocDir := NewDocNo;
+ begin
+ if DocNoNeedDiv(NewDocNo) then
+ begin
+ NewDocDir:=DocNo2DocNoDir(ImageSavePath + NowCaseno+'\',NewDocNo);
+ end
+ else
+ begin
+ NewDocDir := NewDocNo;
+ end;
+ end;
+//ShowMessage('NewDocDir='+NewDocDir);
if DocNoNeedDiv(NewDocNo) and (FormCode2Page(NewFormID)='01') then
+ begin
NewDocDir := DocNo2DocNoDir(ImageSavePath+CaseID+'\',NewDocNo);
+ end
+ else
+ begin
+ ST1.Clear;
+ if FileExists(ImageSavePath + NowCaseno+'\'+NewDocDir+'\Context.dat') then
+ begin
+ ST1.LoadFromFile(ImageSavePath + NowCaseno+'\'+NewDocDir+'\Context.dat');
+ if ISExistImg(ImageSavePath + NowCaseno+'\'+NewDocDir+'\'+ST1.Strings[0]) then
+ begin
+ NewDocDir := DocNo2DocNoDir(ImageSavePath + NowCaseno+'\',NewDocNo);
+ end;
+ end;
+ end;
if Not DirectoryExists(ImageSavePath+CaseID+'\'+NewDocDir) then
begin
MkDir(ImageSavePath+CaseID+'\'+NewDocDir);
@@ -6968,6 +7458,7 @@
finally
OldFileList.Free;
NewFileList.Free;
+ ST1.Free;
end;
end;
@@ -7207,8 +7698,8 @@
Function TCB_IMGPSScanX.GetCase_PageCount(var CaseCount,PageCount:Integer):Boolean; //取出案件的數量及頁數
var
- i,n: Integer;
- CaseList,DocList,FileList : TStringlist;
+ i,n,k: Integer;
+ CaseList,DocList,FileList,ST1 : TStringlist;
begin
Result := False;
CaseCount := 0;
@@ -7216,19 +7707,23 @@
CaseList := TStringlist.Create;
DocList := TStringlist.Create;
FileList := TStringlist.Create;
+ ST1:= TStringlist.Create;
try
ImageSavePath := ImagePath;
CaseList.Clear;
if FileExists(ImageSavePath + 'CaseList.dat') then
CaseList.LoadFromFile(ImageSavePath + 'CaseList.dat');
CaseCount := CaseCount+CaseList.Count;
+//ShowMessage('ImageSavePath='+ImageSavePath+#10#13+'CaseList.Count='+IntToStr(CaseList.Count));
for i := 0 to CaseList.Count - 1 do
begin
DocList.Clear;
If FileExists(ImageSavePath+CaseList.Strings[i]+'\CaseDocNo.dat') Then
DocList.LoadFromFile(ImageSavePath+CaseList.Strings[i]+'\CaseDocNo.dat');
+//ShowMessage('DocList='+DocList.Text);
for n := 0 to DocList.Count - 1 do
begin
+//ShowMessage(DocList.Strings[n]+','+BoolToStr(DocNoAppear(DocNoDir2DocNo(DocList.Strings[n])),true));
if not DocNoAppear(DocNoDir2DocNo(DocList.Strings[n])) then Continue;
FileList.Clear;
If FileExists(ImageSavePath+CaseList.Strings[i]+'\'+DocList.Strings[n]+'\Context.dat') Then
@@ -7240,14 +7735,41 @@
If FileExists(ImageSavePath+CaseList.Strings[i]+'\'+Attname+'\Context.dat') Then
FileList.LoadFromFile(ImageSavePath+CaseList.Strings[i]+'\'+Attname+'\Context.dat');
//Showmessage(ImageSavePath+CaseList.Strings[i]+'\'+Attname+'\Context.dat');
- //Showmessage(FileList.Text);
+//Showmessage('FileList='+FileList.Text);
PageCount := PageCount+FileList.Count;
- //Showmessage(inttostr(PageCount));
+//Showmessage('PageCount='+inttostr(PageCount));
+ if (FWH_category='N') and (FIs_In_Wh='Y') then //20170912 針對非入庫並當次掃描做頁數計算
+ begin
+ if FileExists(ImageSavePath+NowCaseno+'\EditedDocDir.dat') then
+ begin
+ ST1.LoadFromFile(ImageSavePath+NowCaseno+'\EditedDocDir.dat');
+ for n := 0 to ST1.Count - 1 do
+ begin
+ if ST1.Strings[n]=AttName then Continue;
+//ShowMessage(ST1.Strings[n]+','+BoolToStr(DocNoIs_In_WH(DocNoDir2DocNo(ST1.Strings[n])),true));
+ if not DocNoIs_In_WH(DocNoDir2DocNo(ST1.Strings[n])) then
+ begin
+
+ FileList.Clear;
+ if FileExists(ImageSavePath+CaseList.Strings[i]+'\'+ST1.Strings[n]+'\Context.dat') then
+ begin
+ FileList.LoadFromFile(ImageSavePath+CaseList.Strings[i]+'\'+ST1.Strings[n]+'\Context.dat');
+ for k := 0 to FileList.Count - 1 do
+ begin
+ if not ISExistImg(ImageSavePath+CaseList.Strings[i]+'\'+ST1.Strings[n]+'\'+FileList.Strings[k]) then
+ PageCount := PageCount+1;
+ end;
+ end;
+ end;
+ end;
+ end;
+ end;
end;
Finally
CaseList.Free;
DocList.Free;
FileList.Free;
+ ST1.Free
end;
Result := True;
end;
@@ -7320,8 +7842,12 @@
if Path = '' then Exit;
S := TStringlist.Create;
try
- S.Add(Case_loandoc);
- S.SaveToFile(Path+'CaseIndex.dat');
+ try
+ S.Add(Case_loandoc);
+ S.SaveToFile(Path+'CaseIndex.dat');
+ except on E: Exception do
+ end;
+
finally
S.Free;
end;
@@ -7355,6 +7881,27 @@
end;
+
+procedure TCB_IMGPSScanX.ReduceLogFile; //20171011 必免log檔掌太大
+var
+ ST1:TStringlist;
+ I:integer;
+begin
+ ST1:=TStringList.Create;
+ if FileExists(LngPath+'IMGPSCheck.log') then
+ begin
+ ST1.LoadFromFile(LngPath+'IMGPSCheck.log');
+ if ST1.count>100000 then
+ begin
+ for I := 0 to 10000 do
+ begin
+ ST1.Delete(0);
+ end;
+ ST1.SaveToFile(LngPath+'IMGPSCheck.log');
+ end;
+ end;
+ ST1.Free;
+end;
Procedure TCB_IMGPSScanX.ClearCaseIndex;
begin
@@ -7646,6 +8193,33 @@
begin
ScanDuplex := ScanDuplexCB.Checked;
//R_W_ScanIni('W'); //user要求改成預設後不能改
+end;
+
+procedure TCB_IMGPSScanX.ScanGrayCBClick(Sender: TObject);
+begin
+
+ if ScanGrayCB.Checked then
+ begin
+ ScanColor:=ifGray256;
+ end
+ else
+ begin
+ if FScanColor = 0 then
+ begin
+ ScanColor := ifBlackWhite;
+ end;
+
+ if FScanColor = 1 then
+ begin
+ ScanColor := ifGray256 ;
+ end;
+
+ if FScanColor = 2 then
+ begin
+ ScanColor := ifTrueColor ;
+ end;
+ end;
+
end;
Function TCB_IMGPSScanX.GetFormatID(CaseID: string):String;
@@ -7954,7 +8528,16 @@
end;
CaseHelpBtn.Visible := False;
LoadImgFile;
- Showmessage(NowCaseNo+_Msg('傳送完成'));
+ if (FMode='NSCAN') or (FMode='DSCAN') then
+ begin
+ Showmessage(NowCaseNo+_Msg('影像上傳完成。此案已進入下一流程。'));
+ end;
+
+ if FMode='ESCAN' then
+ begin
+ Showmessage(NowCaseNo+_Msg('影像已補件完成。'));
+ end;
+
DataLoading(False,False);
end
Else
@@ -8044,6 +8627,7 @@
CaseDocNo_CopiesList := TStringlist.Create;
StrList := TStringlist.Create;
ST1:=TStringList.Create;
+LogFile1.LogToFile(logTimeString+'產文件樹開始');
try
CaseNode.ImageIndex := 1;
CaseNode.SelectedIndex := 1;
@@ -8064,7 +8648,8 @@
FileList.LoadFromFile(ImageSavePath+Caseno+'\'+CaseDocNoList.Strings[i]+'\Context.dat');
iDocNo := DocNoDir2DocNo(CaseDocNoList.Strings[i]);
ST1.Clear;
-//ShowMessage(FileList.Text);
+
+LogFile1.LogToFile(logTimeString+'FileList.Text='+FileList.CommaText);
if (FWH_category='N') and (FIs_In_Wh='Y') then
begin
for n := 0 to FileList.Count - 1 do
@@ -8084,11 +8669,9 @@
end;
end;
-
+LogFile1.LogToFile(logTimeString+'WH_category='+FWH_category+',Is_In_Wh='+FIs_In_Wh+',FileList.Text='+FileList.CommaText);
if FileList.Count=0 then Continue;
-
-//Showmessage('aaa '+FileList.Text);
DocNoCopies := Strtoint(CaseDocNo_CopiesList.Strings[i]);
DocNoPage := FileList.Count;
iDocNo := DocNoDir2DocNo(CaseDocNoList.Strings[i]);
@@ -8107,6 +8690,7 @@
//DocNode := TreeView1.Items.AddChild(CaseNode,Format('%s{%s}-%d'+_msg('頁'),[CaseDocNoList.Strings[i],DocNo2DocName(Caseno,iDocNo),DocNoPage]));
//DocNode := TreeView1.Items.AddChild(CaseNode,Format('%s{%s}-%d'+_msg('份'),[CaseDocNoList.Strings[i],DocNo2DocName(Caseno,iDocNo),DocNoCopies]));
+//ShowMessage('iDocNo='+iDocNo);
DocNode := TreeView1.Items.AddChild(CaseNode,Format('%s{%s}-%d'+_msg('份'),[DocNo2DocName(Caseno,iDocNo),CaseDocNoList.Strings[i],DocNoCopies]));
if GetUseCase('F',ImageSavePath+Caseno+'\',CaseDocNoList.Strings[i]) <> '' Then
@@ -8265,7 +8849,7 @@
end;
end;
end;
-
+LogFile1.LogToFile(logTimeString+'產文件樹結束');
Finally
FileList.Free;
CaseDocNoList.Free;
@@ -8383,9 +8967,9 @@
if PrintForm.CheckListBox1.Checked[i] then
begin
if S = '' then
- S := S+FileList.Strings[i]
+ S := S+PrintForm.CheckListBox1.Items[i]
Else
- S := S+#13+FileList.Strings[i];
+ S := S+#13+PrintForm.CheckListBox1.Items[i];
end;
end;
if S = '' then
@@ -8571,7 +9155,7 @@
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
+ if (Pos('_',St1.Strings[i])<>1) and (Pos('_',St1.Strings[i])<>-1) then
begin
str1:=Copy(ST1.Strings[i],1,Pos('_',St1.Strings[i])-1);
LastInitFormidList.Add(str1);
@@ -8798,6 +9382,11 @@
end;
end;
+function TCB_IMGPSScanX.logTimeString: String;
+begin
+Result:=FormatDateTime('yyyymmdd hh:mm:ss',now) +' caseNo='+NowCaseno+' ';
+end;
+
Function TCB_IMGPSScanX.FindDivFormCode(FormCode:String):Boolean; //找有沒有分案的條碼
var
i : Integer;
@@ -9015,6 +9604,8 @@
end;
end;
+
+//ShowMessage('FormIDCount='+IntToStr(FormIDCount)+#10#13+'MpsBarcodeinf.count='+IntToStr(MpsBarcodeinf.count));
if FormIDCount = 2 then
begin
Result := True;
@@ -9040,6 +9631,12 @@
DocNo := 'ZZZZZ'+Add_Zoo(Ct,3);
if FIs_In_Wh <> 'Y' then //不是入庫文件
DocNo := 'YYYYY'+Add_Zoo(Ct,3);
+
+ if (FMode='ESCAN') and (FWH_category='N') then //20170914 補件下改成非入庫的自定文件
+ begin
+ DocNo := 'YYYYY'+Add_Zoo(Ct,3);
+ end;
+
FormID := DocNo+'010101A';
ini.WriteInteger('CustomCount','Count',Ct);
ini.WriteString(DocNo,'FormID',FormID);
@@ -10793,6 +11390,7 @@
begin
If FindSQLData(Doc_Inf_List,'DOC_U_DESC','DOC_NO',DocNo,0,FindResult) Then
begin
+//ShowMessage(FindResult.Text);
Result := GetFindResult('DOC_U_DESC');
end;
end;
@@ -10970,9 +11568,12 @@
S.LoadFromFile(ImageSavePath + CaseID+'\upload\Context.dat');
for i := 0 to S.Count - 1 do
begin
+LogFile1.LogToFile(logTimeString+S.Strings[i]+' ISExistImg='+BoolToStr(ISExistImg(ImageSavePath+CaseID+'\upload\'+S.Strings[i]),true));
+LogFile1.LogToFile(logTimeString+S.Strings[i]+' reSizeExistImgList='+BoolToStr(reSizeExistImgList.IndexOf(LoadFileGetMD5(ImageSavePath+CaseID+'\upload\'+S.Strings[i]))<>-1,true));
if FWH_category='N' then
begin
- if ISExistImg(ImageSavePath+CaseID+'\upload\'+S.Strings[i]) then
+ if (ISExistImg(ImageSavePath+CaseID+'\upload\'+S.Strings[i]))
+ or (reSizeExistImgList.IndexOf(LoadFileGetMD5(ImageSavePath+CaseID+'\upload\'+S.Strings[i]))<>-1) then
begin
Continue;
end;
@@ -11058,6 +11659,7 @@
end;
//ShowMessage('MainFormID='+MainFormID);
+LogFile1.LogToFile(logTimeString+' '+FModeName+' '+CaseID+' '+'MainFormID='+MainFormID);
if MainFormID = ''then
begin
//20131203 yuu說不檢查這個,先拿掉 20170315 楷琳說未歸類要擋 20170726 因此有檢查必要FormID 所以 可以拿掉
@@ -11078,6 +11680,8 @@
//////主要非主要文件//////
DistinctDocinCase(ImageSavePath+CaseID+'\upload\');
//ShowMessage(DocNo_VerinCase.Text);
+//DocNo_VerinCase.Add('31A00101_1706A');
+LogFile1.LogToFile(logTimeString+' '+CaseID+' '+'DocNo_VerinCase.Text='+DocNo_VerinCase.Text);
if ModeNeedCheck(OMRErrInfo[1].Mode,FMode) then //是否要檢核
begin
for i := 0 to DocNo_VerinCase.Count - 1 do
@@ -11088,6 +11692,8 @@
MainVersion :=Copy(DocNo_VerinCase.Strings[i],v+1,v1-v); //FormCode2Version(MainFormID);
MainFormPage := GetDataDocNoPage(MainDocNo,MainVersion); //資料庫記錄主文件頁數
CaseFormPage := CheckCaseDocNoPage(CaseID,MainDocNo,MainVersion,MainFormPage); //案件主文件的頁數
+LogFile1.LogToFile(logTimeString+CaseID+',MainDocNo='+MainDocNo+',MainVersion='+MainVersion+',MainFormPage='+IntToStr(MainFormPage)+',CaseFormPage='+IntToStr(CaseFormPage));
+ //CheckFirstDocNoPage
IF (MainFormPage > 0) and (MainFormPage <> CaseFormPage) then
begin
ErrStr:=MainDocNo+Format(OMRErrInfo[1].Info,[Inttostr(MainFormPage),Inttostr(CaseFormPage)]); //主要文件需有XX頁僅附XX頁
@@ -11098,7 +11704,7 @@
end;
end;
//////主要非主要文件/////
- //showmessage(MainFormID);
+//showmessage(MainFormID);
MainDocNo := FormCode2DocNo(MainFormID);
MainVersion := FormCode2Version(MainFormID);
if FindSQLData(DM_FORM_INF_List,'DEPE_FORM_ID,MUTEX_FORM_ID','MAIN_FORM_ID,DOC_VERSION',MainDocNo+','+MainVersion,0,FindResult) then
@@ -11159,7 +11765,7 @@
end;
end;
//////互斥文件/////
- end;
+ end; //MainFormID結束
//end;
List.LoadFromFile(ImageSavePath + CaseID+'\upload\Context.dat');
for i := 0 to List.Count - 1 do
@@ -11199,13 +11805,17 @@
end;
//if AllCheck then
//begin
- //////最大頁數/////
+ //////最大頁數///
+LogFile1.LogToFile(logTimeString+'最大頁數A段 '+CaseID+' '+'OMRFileList.Text='+OMRFileList.Text);
DistinctFormCode(CaseID);
if ModeNeedCheck(OMRErrInfo[10].Mode,FMode) then //是否要檢核
begin
//ShowMessage('AAA'+OMRFileList.Text);
+LogFile1.LogToFile(logTimeString+'最大頁數B段 '+CaseID+' '+'OMRFileList.Text='+OMRFileList.Text);
For i := 0 to OMRFileList.Count - 1 do
begin
+ if FModeName='異動件' then Continue;
+
if FWH_category='N' then
begin
if ISExistImg(ImageSavePath+CaseID+'\upload\'+OMRFileList.Strings[i]) then
@@ -11236,15 +11846,12 @@
ValueXT := TXmltool.Create;
Try
//ShowMessage('必填'+OMRFileList.Text);
+LogFile1.LogToFile(logTimeString+'必填 '+CaseID+' '+'OMRFileList.Text='+OMRFileList.Text);
For i := 0 to OMRFileList.Count - 1 do
begin
-// if FWH_category='N' then
-// begin
-// if ISExistImg(ImageSavePath+CaseID+'\upload\'+OMRFileList.Strings[i]) then
-// begin
-// Continue;
-// end;
-// end;
+//ShowMessage('OMRFileList.Strings['+IntToStr(i)+']'+OMRFileList.Strings[i]);
+ if CheckRequiredColumnValues(FWork_NO,CaseID) then Continue;
+
OMRFile := OMRFileList.Strings[i];
OMRFormCode := FileName2FormCode(OMRFileList.Strings[i]);
OMRFormName := FormCode2FormName(CaseID,OMRFormCode);
@@ -11253,10 +11860,12 @@
ImageReSize_FormID(CaseID,OMRFile);
////依十字定位點縮放///
//Display1.Lines.Add('OMRFile='+OMRFile+',OMRFormCode='+OMRFormCode+',OMRFormName='+OMRFormName);
+LogFile1.LogToFile(logTimeString+'OMRFile='+OMRFile+',OMRFormCode='+OMRFormCode+',OMRFormName='+OMRFormName);
+//ShowMessage('KKKKK');
if not FileExists(CheckXmlPath+OMRFormCode+'.xml') then //沒有Xml就不用檢核
Continue;
-
+//ShowMessage('11638 OMRFileList.Strings['+IntToStr(i)+']'+OMRFileList.Strings[i]);
XT := TXmltool.Create(CheckXmlPath+OMRFormCode+'.xml');
RelaXT := TXmltool.Create;
//ShowMessage('ModeNeedCheck='+BoolToStr(ModeNeedCheck(OMRErrInfo[4].Mode,FMode),true));
@@ -11309,7 +11918,7 @@
Until not XT.SubNodes['/form/settype1/'].Next ;
end;
//*******必填********
-
+//ShowMessage('11692 OMRFileList.Strings['+IntToStr(i)+']'+OMRFileList.Strings[i]);
//if AllCheck then
//begin
//*******有值相關文件的欄位也要有值*******
@@ -11348,10 +11957,16 @@
Anchor1 := FormID2Anchor(RelaFormCode);
RelaXT.LoadFromFile(CheckXmlPath+RelaFormCode+'.xml');
Display1.Lines.Add(RelaFile+','+RelaFormName);
- ISB8.LoadFromFile(ImageSavePath+CaseID+'\upload\'+RelaFile,1); //20170815
- ISB8W:= ISB8.Graphic.Width;
- ISB8H:= ISB8.Graphic.Height;
- FindPoint(ISB8.Graphic,UpLPoint,UpRPoint,DownLPoint,ISB8W,ISB8H,ANCHOR); //20170815 抓相關然欄位所在圖檔的定位
+//ShowMessage(RelaFile);
+//ShowMessage(ImageSavePath+CaseID+'\upload\'+RelaFile);
+ if RelaFile<>'' then
+ begin
+ ISB8.LoadFromFile(ImageSavePath+CaseID+'\upload\'+RelaFile,1); //20170815
+ ISB8W:= ISB8.Graphic.Width;
+ ISB8H:= ISB8.Graphic.Height;
+ FindPoint(ISB8.Graphic,UpLPoint,UpRPoint,DownLPoint,ISB8W,ISB8H,ANCHOR); //20170815 抓相關然欄位所在圖檔的定位
+ end;
+
OMROK := False;
//OMROK := False;
//if RelaXT.SubNodes['/form/settype2/'].First then
@@ -11405,6 +12020,7 @@
Until not XT.SubNodes['/form/settype3/'].Next ;
end;
//*******有值相關文件的欄位也要有值*******
+//ShowMessage('11788 OMRFileList.Strings['+IntToStr(i)+']'+OMRFileList.Strings[i]);
//*******有值相關文件的欄位不能有值*******
if ModeNeedCheck(OMRErrInfo[11].Mode,FMode) then //是否要檢核
@@ -11444,10 +12060,15 @@
RelaFormName := FormCode2FormName(CaseID,RelaFormCode);
Anchor1 := FormID2Anchor(RelaFormCode);
RelaXT.LoadFromFile(CheckXmlPath+RelaFormCode+'.xml');
- ISB8.LoadFromFile(ImageSavePath+CaseID+'\upload\'+RelaFile,1); //20170815
- ISB8W:= ISB8.Graphic.Width;
- ISB8H:= ISB8.Graphic.Height;
- FindPoint(ISB8.Graphic,UpLPoint,UpRPoint,DownLPoint,ISB8W,ISB8H,ANCHOR); //20170815 抓相關然欄位所在圖檔的定位
+
+ if RelaFile<>'' then
+ begin
+ ISB8.LoadFromFile(ImageSavePath+CaseID+'\upload\'+RelaFile,1); //20170815
+ ISB8W:= ISB8.Graphic.Width;
+ ISB8H:= ISB8.Graphic.Height;
+ FindPoint(ISB8.Graphic,UpLPoint,UpRPoint,DownLPoint,ISB8W,ISB8H,ANCHOR); //20170815 抓相關然欄位所在圖檔的定位
+ end;
+
OMROK := False;
//OMROK := False;
//if RelaXT.SubNodes['/form/settype2/'].First then
@@ -11505,7 +12126,7 @@
end;
//*******有值相關文件的欄位不能有值*******
-
+//ShowMessage('11889 OMRFileList.Strings['+IntToStr(i)+']'+OMRFileList.Strings[i]);
//*******有值相依文件*******
if ModeNeedCheck(OMRErrInfo[5].Mode,FMode) then //是否要檢核
@@ -11668,6 +12289,7 @@
RelaXT.Free;
end;
end;
+ //必填迴圈結束
Finally
ValueXT.Free;
end;
@@ -12194,6 +12816,7 @@
ISB : TImageScrollBox;
Panel : TPanel;
i,W,H : Integer;
+ myDate : TDateTime;
begin
FreePreViewISB;
ScrollBox1.HorzScrollBar.Visible := False;
@@ -12201,32 +12824,38 @@
H := 250;
for I := 1 to Count do
begin
- Panel := TPanel.Create(Self);
- Panel.Name := 'M_Pl'+inttostr(i);
- Panel.Left := 4;
- Panel.Top := (i-1)*H+(6*i);
- Panel.Height := H;
- Panel.Width := W;
- Panel.Parent := ScrollBox1;
- Panel.Caption :='';
- ISB := TImageScrollBox.Create(Self);
- ISB.Name := ISBName+inttostr(i);
- ISB.Parent := Panel;
- ISB.Align := alClient;
- ISB.ZoomMode := zmFullPage;
- ISB.DragMode := dmAutomatic;
- ISB.MouseMode := mmuser;
- ISB.OnImageClick := ISBClick;
- ISB.OnImageMouseMove := ISBMouseMove;
- ISB.PopupMenu := PopupMenu6;
- ISB.OnImageMouseDown := ISBImageMouseDown;
- ISB.OnImageMouseUp := ISBImageMouseUp;
- //ISB.OnStartDrag := ISBStartDrag;
- ISB.OnEndDrag := ISBEndDrag;
-// ISB.OnImageDragDrop := ISBDragDrop;
-// ISB.OnImageDragOver := ISBDragOver;
- ISB.OnDragDrop := ISBDragDrop;
- ISB.OnDragOver := ISBDragOver;
+
+ if FindComponent('M_Pl'+inttostr(i))=nil then
+ begin
+ Panel := TPanel.Create(Self);
+ Panel.Name := 'M_Pl'+inttostr(i);//FormatDateTime('yyyymmddhhnnsszzz', now)
+ Panel.Left := 4;
+ Panel.Top := (i-1)*H+(6*i);
+ Panel.Height := H;
+ Panel.Width := W;
+ Panel.Parent := ScrollBox1;
+ Panel.Caption :='';
+
+ if FindComponent(ISBName+inttostr(i))=nil then
+ begin
+ ISB := TImageScrollBox.Create(Self);
+ ISB.Name := ISBName+inttostr(i);
+ ISB.Parent := Panel;
+ ISB.Align := alClient;
+ ISB.ZoomMode := zmFullPage;
+ ISB.DragMode := dmAutomatic;
+ ISB.MouseMode := mmuser;
+ ISB.OnImageClick := ISBClick;
+ ISB.OnImageMouseMove := ISBMouseMove;
+ ISB.PopupMenu := PopupMenu6;
+ ISB.OnImageMouseDown := ISBImageMouseDown;
+ ISB.OnImageMouseUp := ISBImageMouseUp;
+ ISB.OnEndDrag := ISBEndDrag;
+ ISB.OnDragDrop := ISBDragDrop;
+ ISB.OnDragOver := ISBDragOver;
+ end;
+ end;
+
end;
end;
@@ -12235,25 +12864,29 @@
var
i : Integer;
begin
+try
For i:= ComponentCount -1 downto 0 do
begin
- IF Components[i] is TImageScrollBox Then
+ IF (Components[i] is TImageScrollBox) and (Components[i]<>nil) Then
begin
IF Pos(ISBName,Components[i].Name) > 0 Then
Components[i].Free;
end
- Else If Components[i] is TPanel Then
+ Else If (Components[i] is TPanel) and (Components[i]<>nil) Then
begin
IF Pos('M_Pl',Components[i].Name) > 0 Then
Components[i].Free;
end
- Else If Components[i] is TShape Then
+ Else If (Components[i] is TShape) and (Components[i]<>nil) Then
begin
IF Pos('SP',Components[i].Name) > 0 Then
Components[i].Free;
end;
end;
Application.ProcessMessages;
+except on E: Exception do
+end;
+
//showmessage(inttostr(Count));
end;
@@ -12413,7 +13046,7 @@
Procedure TCB_IMGPSScanX.ISBMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
- Edit1.SetFocus;
+ //Edit1.SetFocus;
if Draging then
begin
if not (TShape(FindComponent('SP'+Copy(TImageScrollBox(Sender).Name,length(ISBName)+1,length(TImageScrollBox(Sender).Name)-length(ISBName)))) = nil) then
@@ -13321,7 +13954,7 @@
//ShowMessage(Memo1.Lines.Text);
IF memo1.Lines.Strings[0] <> '0' Then
begin
- HttpErrStr := _Msg('錯誤原因:')+memo1.Lines.Strings[1];
+ HttpErrStr := _Msg('')+memo1.Lines.Strings[1]+'。';
Result := -1;
Exit;
end
@@ -13329,7 +13962,7 @@
begin
if (memo1.Lines.Count < 2) then
begin
- HttpErrStr := _Msg('錯誤原因:')+'OCX:Index Count error';
+ HttpErrStr := _Msg('')+'OCX:Index Count error';
Result := -1;
Exit;
end
@@ -13343,7 +13976,7 @@
Result := 1
Else
begin
- HttpErrStr := _Msg('錯誤原因:')+'OCX:Value error';
+ HttpErrStr := _Msg('')+'OCX:Value error';
Result := -1;
Exit;
end;
@@ -13594,6 +14227,8 @@
PageLVclear := True;
InitialOk := False;
+ FMaxUploadSize:='10';
+ FJpgCompression:=50;
//FMode := 'DSCAN' ;
//FIs_In_Wh := 'Y';
if FIs_In_Wh = 'Y' then
@@ -13700,6 +14335,7 @@
LastAddFormidList := TStringList.Create;
SampleFormIDList := TStringList.Create;//20170627 加入
ExistImgList := TStringList.Create; //20170724 新增
+ reSizeExistImgList :=TStringList.Create; //20171012 新增
//********清單區********
ShowText := _Msg('資料載入中,請稍候');
@@ -13818,7 +14454,11 @@
Del_Sub_NothingPath(ImagePath); //清掉案件目錄是空的
+ LogFile1.LogFile:=LngPath+'IMGPSCheck.log';
+ ReduceLogFile;
+
+ LogFile1.LogToFile(logTimeString+'OCX取表data結束');
ShowText := _Msg('資料載入中,請稍候');
DataLoading(True,True);
@@ -13858,7 +14498,7 @@
MkDir(ImageSavePath+FCaseID);
CreateEmptyCase(ImageSavePath,FCaseID);
MkDir(ImageSavePath+FCaseID+'\Download');
- IF (FMode = 'ESCAN') then //異動件先下載影像
+ IF (FMode = 'ESCAN') or (FMode = 'DSCAN') then //異動件先下載影像
begin
ShowText := _Msg('案件下載中,請稍候');
DataLoading(True,True);
@@ -13890,7 +14530,8 @@
// //LoadImgFile;
// end;
Create_Cust_DocDir(FCaseID); //產生外面傳入的文件
- LastInitFormidListCreate(ImageSavePath+FCaseID+'\Download\');
+ if FMode='ESCAN' then
+ LastInitFormidListCreate(ImageSavePath+FCaseID+'\Download\');
end;
end;
@@ -13943,6 +14584,40 @@
//ShowMessage('ImageSavePath='+ImageSavePath);
DataLoading(False,False);
+ LogFile1.LogToFile(logTimeString+'OCX初始化結束');
+ LogFile1.LogToFile(logTimeString+'FUrl='+FUrl+
+ ',FCaseID='+FCaseID+
+ ',FMode='+FMode+
+ ',FModeName='+FModeName+
+ ',FWork_no='+FWork_no+
+ ',FUserID='+FUserID+
+ ',FUserName='+FUserName+
+ ',FUserUnit='+FUserUnit+
+ ',FData='+FData+
+ ',FVerify='+FVerify+
+ ',FReWrite='+FReWrite+
+ ',FLanguage='+FLanguage+
+ ',FLoanDoc_Value='+FLoanDoc_Value+
+ ',FLoanDoc_Enable='+FLoanDoc_Enable+
+ ',FUseProxy='+FUseProxy+
+ ',FC_DocNoList='+FC_DocNoList+
+ ',FC_DocNameList='+FC_DocNameList+
+ ',FFixFileList='+FFixFileList+
+ ',FIs_In_Wh='+FIs_In_Wh+
+ ',FOldCaseInfo='+FOldCaseInfo+
+ ',FPrintyn='+FPrintyn+
+ ',FIs_OldCase='+FIs_OldCase+
+ ',FCustDocYN='+FCustDocYN);
+ LogFile1.LogToFile(logTimeString+'FImgDPI='+IntToStr(FImgDPI)+
+ ',FScanColor='+ IntToStr(FScanColor)+
+ ',FFileSizeLimit='+ IntToStr(FFileSizeLimit)+
+ ',FCaseNoLength='+ IntToStr(FCaseNoLength)+
+ ',FImgDelete='+FImgDelete+
+ ',FIsExternal='+FIsExternal+
+ ',FWH_category='+FWH_category+
+ ',FCheck_main_form='+FCheck_main_form+
+ ',FMaxUploadSize='+FMaxUploadSize);
+
end;
procedure TCB_IMGPSScanX.Timer2Timer(Sender: TObject);
@@ -13965,6 +14640,7 @@
AreaStr : String;
S : TStringlist;
CheckStr : String;
+ uploadMsg:String;//20171122 新增 配合不同mode下要秀不能上傳訊息
begin
IF not InitialOk Then
begin
@@ -13976,10 +14652,10 @@
DisplayPath := '';
ClearCaseIndex;
RejectCase := False;
-
+ uploadMsg:='';
if not CheckCaseID_OK then //檢查是否有未配號的案件
begin
- Showmessage(_Msg('尚有未配號案件,無法上傳'));
+ Showmessage(_Msg('尚有「無案件編號」之案件,無法上傳'));
Exit;
end;
@@ -14045,7 +14721,7 @@
end;
if CaseTrans = -1 then //失敗
begin
- Showmessage(_Msg('詢問案件可否傳送時,網路發生錯誤!!')+HttpErrStr);
+ Showmessage(_Msg('')+HttpErrStr+'.');
DataLoading(False,False);
LoadImgFile;
Exit;
@@ -14098,13 +14774,30 @@
end;
end;
DataLoading(False,False);
- TransMsg := Format(_Msg('成功件%d件'),[SuccessCount]);
+ TransMsg := Format(_Msg('成功件【%d】件'),[SuccessCount]);
if ReCasecount > 0 then
- TransMsg := TransMsg + #13#10 + Format(_Msg('無法上傳件%d件'),[ReCasecount]);
+ TransMsg := TransMsg + #13#10 + Format(_Msg('無法上傳件【%d】件'),[ReCasecount]);
if CheckErrCount > 0 then
- TransMsg := TransMsg + #13#10 + Format(_Msg('檢核失敗件%d件'),[CheckErrCount]);
+ TransMsg := TransMsg + #13#10 + Format(_Msg('檢核失敗件【%d】件,請先點選「案件編號」,再點選「問號」查看錯誤原因'),[CheckErrCount]);
- Showmessage(_Msg('傳送完成')+#13#10+TransMsg);
+
+ if (FMode = 'DSCAN') and (SuccessCount = 1) then
+ begin
+ uploadMsg:=NowCaseNo+_Msg('影像上傳完成。此案已進入下一流程');
+ end;
+ if (FMode='ESCAN') and (FModeName='補件掃描') and (SuccessCount = 1) then
+ begin
+ uploadMsg:=NowCaseNo+_Msg('影像已補件完成');
+ end;
+//ShowMessage('uploadMsg='+uploadMsg);
+ if uploadMsg<>'' then
+ begin
+ ShowMessage(uploadMsg);
+ end
+ else
+ begin
+ Showmessage(_Msg('傳送完成')+#13#10+TransMsg);
+ end;
LoadImgFile;
if (FMode = 'ESCAN') and (SuccessCount = 1) then
@@ -14139,7 +14832,6 @@
NowDocNo := '';
NowFormCode := '';
NowFormName := '';
-
NowPage := 0;
NowShowFileList.Clear;
StatusBar1.Panels[2].Text := '';
@@ -14559,13 +15251,26 @@
procedure TCB_IMGPSScanX.TreeView1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
- TreeView1Click(nil);
+ IF TreeView1.Selected.Parent <> nil Then
+ begin
+ TreeView1Click(nil);
+ end
+ else
+ begin
+ ClearView(1);
+ end;
+
+end;
+
+procedure TCB_IMGPSScanX.TreeView1MouseEnter(Sender: TObject);
+begin
+TreeView1.SetFocus;
end;
procedure TCB_IMGPSScanX.TreeView1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
- TreeView1.SetFocus;
+ //TreeView1.SetFocus;
{UnRegisterHotKey(Handle, HotKeyId1);
UnRegisterHotKey(Handle, HotKeyId2); }
end;
@@ -14873,6 +15578,7 @@
procedure TCB_IMGPSScanX.Set_filesizelimit(const Value: WideString);
begin
//ShowMessage(Value);
+ FFileSizeLimit:=0;
if Value ='' then
begin
FFileSizeLimit := 5*1024;
--
Gitblit v1.8.0