| | |
| | | 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 確認是否有未歸類文件 |
| | | protected |
| | | { Protected declarations } |
| | | procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override; |
| | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | |
| | | 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; |
| | | 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 |
| | | 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 |
| | | 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; |
| | | |
| | | 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); |
| | | // ISB.SaveToFile('C:\OCX\aaaaaa'+IntToStr(i)+'.tif'); |
| | | DeskewImg(ISB.Graphic); |
| | | // ISB.SaveToFile('C:\OCX\bbbbbb'+IntToStr(i)+'.tif'); |
| | | |
| | | iGraphic_First := TTiffGraphic.Create; |
| | | iGraphic_sec := TTiffGraphic.Create; |
| | | |
| | | iGraphic_First.Assign(ISB.Graphic); |
| | | MpsGetBarcode(ISB.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 |
| | | begin |
| | | if MpsBarcodeinf.r180[n] <> 0 then //依條碼角度轉影像 |
| | | begin |
| | | Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]); |
| | | MpsGetBarcode(ISB.Graphic,MpsBarcodeinf); |
| | | MpsGetBarcode(iGraphic, 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; |
| | | FormID := BarCode2FormID; //取出FormID |
| | | End; |
| | | End; |
| | | FormID := BarCode2FormID; |
| | | // 取出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); |
| | | 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); |
| | | 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; |
| | | |
| | | // Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]); //20170705 加入有條碼就轉正 |
| | | // ISB.SaveToFile(SavePath+SaveFilename); |
| | | |
| | | 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; |
| | | //Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]); //20170705 加入有條碼就轉正 |
| | | ISB.SaveToFile(SavePath+SaveFilename); |
| | | End; |
| | | End; |
| | | // Rotate(ISB.Graphic,MpsBarcodeinf.r180[n]); //20170705 加入有條碼就轉正 |
| | | |
| | | 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 |
| | |
| | | PM101.Visible:=false; |
| | | end; |
| | | |
| | | if FMode='ESCAN' then |
| | | PM101.Visible:=false; |
| | | |
| | | if FModeName='異動件' then |
| | | begin |
| | | PM101.Visible := True; |
| | |
| | | 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 |
| | |
| | | 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; |
| | |
| | | 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; //歸類 |
| | |
| | | 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; |
| | |
| | | Context_DocnoList.LoadFromFile(Path+'Context_DocNo.dat'); |
| | | if FileExists(Path+'CustomDocNo.dat') then |
| | | 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); //刪除顯示中的影像 |
| | |
| | | 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); |
| | | |
| | |
| | | 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; |
| | |
| | | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | end; |
| | | |
| | | end; |
| | | |
| | | //ShowMessage('FormIDCount='+IntToStr(FormIDCount)+#10#13+'MpsBarcodeinf.count='+IntToStr(MpsBarcodeinf.count)); |
| | | if FormIDCount = 2 then |
| | | begin |
| | | Result := True; |
| | |
| | | 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); |
| | |
| | | ISB : TImageScrollBox; |
| | | Panel : TPanel; |
| | | i,W,H : Integer; |
| | | myDate : TDateTime; |
| | | begin |
| | | FreePreViewISB; |
| | | ScrollBox1.HorzScrollBar.Visible := False; |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | NowDocNo := ''; |
| | | NowFormCode := ''; |
| | | NowFormName := ''; |
| | | |
| | | NowPage := 0; |
| | | NowShowFileList.Clear; |
| | | StatusBar1.Panels[2].Text := ''; |
| | |
| | | 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.TreeView1MouseMove(Sender: TObject; Shift: TShiftState; |