| | |
| | | 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); |
| | | end; |
| | | SetUseCase('D',ImageSavePath+NowCaseno+'\',NowDocDir,'',''); |
| | | SetDocNoList('D',-1,NowCaseNo,NowDocDir,''); |
| | | if (Copy(NowDocNo,1,5)='ZZZZZ') then //20140703 刪除自定文件時要刪ini檔資料 |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | begin |
| | | PM101.Visible:=false; |
| | | end; |
| | | |
| | | if FMode='ESCAN' then |
| | | PM101.Visible:=false; |
| | | |
| | | if FModeName='異動件' then |
| | | begin |
| | |
| | | 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); |
| | | 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; |