{ ============================================================================== 方法名稱:PM401Click 引用相依:GetNoNameCase, Str2Dir, RenameFile, SaveToFile, FileExists, LoadFrom File 方法描述:影像列表右鍵選單功能:從指定頁面分出新案。確認使用者選取的分案起點(不 能為第一頁)後,取得新的流水案號並建立目錄。將原案件中該頁碼之後的所有 影像檔案更名並搬移至新案目錄,同步更新原案與新案的 Context.dat 與 Cas eIndex.dat。完成後重新載入影像列表並提示完成。 ============================================================================== } procedure TCB_IMGPSScanX.PM401Click(Sender: TObject); var i : Integer; FromIndex : Integer; CaseID : String; NewPath : String; OldName,NewName:String; S : TStringlist; begin S := TStringlist.Create; try FromIndex := PageLv.ItemIndex; if FromIndex = 0 then begin Showmessage(_Msg('不能從第1頁分案')); Exit; end; If MessageDlg(Format(_Msg('是否確定從%d頁分出新案'),[PageLV.ItemIndex+1]),Mtconfirmation,[mbyes,mbcancel],0) = mrcancel Then Exit; ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 CaseID := GetNoNameCase(ImageSavePath); NewPath := ImageSavePath + CaseID+'\'; Str2Dir(NewPath); for i := FromIndex to ContextList.Count - 1 do begin OldName := ContextList.Strings[i]; //NewName := Add_Zoo(S.Count+1,3)+Copy(OldName,4,length(OldName)-3); NewName := Add_Zoo(S.Count+1,3)+FileName2NoQuene_Filename(OldName); ReNameFile(DisplayPath+OldName,NewPath+NewName); S.Add(NewName); S.SaveToFile(NewPath+'Context.dat'); end; for i := ContextList.Count - 1 downto FromIndex do begin ContextList.Delete(i); ContextList.SaveToFile(DisplayPath+'Context.dat'); end; SetCaseList('I',MyTreeNode1.IndexOf(MyTreeNode2)+1,CaseID); if FileExists(DisplayPath+'CaseIndex.dat') then //把原經辦代號取出來再寫入新件裡 begin S.LoadFromFile(DisplayPath+'CaseIndex.dat'); end; DisplayPath := ''; ClearCaseIndex; WriteCaseIndex(NewPath); finally S.Free; end; LoadImgFile; Showmessage(_Msg('分案完成')); end; { ============================================================================== 方法名稱:PM402Click 引用相依: 方法描述:將影像列表(PageLV)中的所有項目設為選取狀態。 ============================================================================== } procedure TCB_IMGPSScanX.PM402Click(Sender: TObject); var i : Integer; begin for i := 0 to PageLV.Items.Count - 1 do begin PageLV.Items.Item[i].Selected := True; end; end; { ============================================================================== 方法名稱:PM403Click 引用相依: 方法描述:將影像列表(PageLV)中的所有項目設為取消選取狀態。 ============================================================================== } procedure TCB_IMGPSScanX.PM403Click(Sender: TObject); var i : Integer; begin for i := 0 to PageLV.Items.Count - 1 do begin PageLV.Items.Item[i].Selected := False; end; end; { ============================================================================== 方法名稱:PM404Click 引用相依: 方法描述:影像列表右鍵選單功能:文件歸類。開啟 TDocListForm 顯示可用的表單清單供 使用者選擇。確認後根據當前 TreeView 的選取層級(案件級別、文件級別或特 定表單),呼叫 PageReplaceFormID 將影像重新歸類至選定的表單類型。歸類完 成後重新繪製樹狀結構並清空檢核記錄,最後回到原先選取的節點。 ============================================================================== } procedure TCB_IMGPSScanX.PM404Click(Sender: TObject); var i : Integer; DocListForm : TDocListForm; OldName,NewName,Ext : String; FormID,FormName : String; PreNode2Name : String; begin PreNode2Name := ''; if TreeView1.Selected.Parent = MyTreeNode1 then PreNode2Name:= GetNode2Name(MyTreeNode2); ShowText := _Msg('文件歸類中,請稍候'); DataLoading(True,True); DocListForm := TDocListForm.Create(self); try InitialLanguage(PatchDlg); //載入多國語言 for i := 1 to FORM_INF_List.Count - 1 do begin FormID := GetSQLData(FORM_INF_List,'T1.FORM_ID',i); FormName := GetSQLData(FORM_INF_List,'T1.FORM_DESC',i); if (FormID <> NowFormCode) and FormIDExists(FormID,True,0) then begin DocListForm.FormIDList.Add(FormID+'#@#'+FormName); With DocListForm.DocLV.Items.Add do begin Caption := FormID; SubItems.Add(FormName); end; end; end; if DocListForm.ShowModal = mrOk then begin FormID := DocListForm.DocLV.Selected.Caption; if (TreeView1.Selected.Level=1) then begin PageReplaceFormID(DisplayPath,'ALL',FormID); end Else if (TreeView1.Selected.Level=2) and (NowFormCode = '') then PageReplaceFormID(DisplayPath,'',FormID) Else begin PageReplaceFormID(DisplayPath,NowFormCode,FormID); end; //DrawDocItem(MytreeNode1,FORM_INF_List,NowCaseno); //DrawDocItem1(MytreeNode1,Doc_Inf_List,NowCaseno); //201408280改 DrawDocItem2(MytreeNode1,NowCaseno); ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 //Showmessage(_Msg('歸類完成')); //20101103 User要求拿掉 if PreNode2Name <> '' then // 回到原本點選的文件節點上 begin for i := 0 to MyTreeNode1.Count - 1 do begin if GetNode2Name(MyTreeNode1.Item[i]) = PreNode2Name then begin TreeView1.Selected := MyTreeNode1.Item[i]; Break; end; end; end; TreeView1click(self); end; finally DocListForm.Free; DataLoading(False,False); end; end; { ============================================================================== 方法名稱:PM601Click 引用相依:FileExists, LoadFromFile, DirectoryExists, CopyFile, SaveToFile, Del eteImageFile, RenameFile, ReSortFileName 方法描述:縮圖瀏覽區右鍵選單功能:文件歸類。針對所有被選取(由 Shape 標記)的影像, 開啟 TDocListForm 選擇目標表單。核心邏輯包含:判斷目標文件是否需要區分 份數、自動產生新的文件目錄或沿用既有目錄、根據檔案序號產生新檔名、執行 檔案複製並更新 ContextList。最後刪除原檔案、重新排序原目錄並重新繪製樹 狀結構。 ============================================================================== } procedure TCB_IMGPSScanX.PM601Click(Sender: TObject); var i : Integer; DocListForm : TDocListForm; OldName,NewName,Ext : String; FormID,FormName,DocNo,DocDir : String; PreNode2Name : String; iFormID : String; iISBName : String; iISB : TImageScrollBox; GoAtt : Boolean; AttLv : Integer; ST1 :TStringList; begin PreNode2Name := ''; ST1:=TStringList.Create; if TreeView1.Selected.Parent = MyTreeNode1 then PreNode2Name:= GetNode2Name(MyTreeNode2); ShowText := _Msg('文件歸類中,請稍候'); LogFile1.LogToFile(logTimeString+'縮圖 歸類開始'); DataLoading(True,True); GoAtt := False; if (MytreeNode2 <> nil) and (Pos('Attach',MyTreeNode2.Text)>0) then begin AttLv := TreeView1.Selected.Level; GoAtt := True; end; DocListForm := TDocListForm.Create(self); 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); FormName := GetSQLData(FORM_INF_List,'T1.FORM_DESC',i); DocNo := GetSQLData(FORM_INF_List,'T1.DOC_NO',i)+GetSQLData(FORM_INF_List,'T1.DOC_VERSION',i); if not FormIDAppear(FormID) then Continue; //20170816 先秀全部 //Showmessage(FORM_INF_List.Text); //showmessage(inttostr(FORM_INF_List.Count)+#13+inttostr(self.Doc_Inf_List.Count)); if (FormID <> FileName2FormCode(DisplayISB.FileName)) and FormIDExists(FormID,False,i) then begin DocListForm.FormIDList.Add(FormID+'#@#'+FormName); With DocListForm.DocLV.Items.Add do begin Caption := FormID; SubItems.Add(FormName); end; end; end; if DocListForm.ShowModal = mrOk then begin for i := 0 to ComponentCount -1 do begin if (Components[i] is TShape) and (copy(Components[i].Name,1,2)='SP') then begin iISBName := ShapeName2PreViewISBName(TShape(Components[i])); iISB := TImageScrollBox(FindComponent(iISBName)); OldName := ExtractFileName(iISB.FileName); Ext := ExtractFileExt(OldName); 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 (ST1.Count > 0) and ISExistImg(ImageSavePath + NowCaseno+'\'+DocDir+'\'+ST1.Strings[0]) then //20181210 多增加判斷ST1>0 否則會有機會出現List out of bound Hong begin DocDir := DocNo2DocNoDir(ImageSavePath + NowCaseno+'\',DocNo); end; end; end; end Else //不分份數 begin if DocNo <> '' then DocDir := DocNo else //Attach 附件 DocDir := DocNo2DocNoDir(ImageSavePath + NowCaseno+'\',DocNo); end; if (not DirectoryExists(ImageSavePath + NowCaseno+'\'+DocDir+'\')) and (DocDir <> AttName) then SetDocNoList('A',-1,NowCaseno,DocDir,'1'); {if DocDir = '' then begin DocDir := DocNo; if DocNoNeedDiv(DocNo) then DocDir:=DocNo2DocNoDir(ImageSavePath+NowCaseno+'\',DocNo); SetDocNoList('A',-1,NowCaseno,DocDir); end; } LogFile1.LogToFile(logTimeString+'縮圖 FormID='+FormID); if Not DirectoryExists(ImageSavePath+NowCaseno+'\'+DocDir) then Mkdir(ImageSavePath+NowCaseno+'\'+DocDir); ContextList.Clear; if FileExists(ImageSavePath+NowCaseno+'\'+DocDir+'\Context.dat') then ContextList.LoadFromFile(ImageSavePath+NowCaseno+'\'+DocDir+'\Context.dat'); NewName := Add_Zoo(ContextList.Count+1,3)+'_'+FormID+Ext; CopyFile(PWideChar(iISB.FileName),PwideChar(ImageSavePath+NowCaseno+'\'+DocDir+'\'+NewName),False); {ContextList.Add(NewName); ContextList.SaveToFile(ImageSavePath+NowCaseno+'\'+DocDir+'\Context.dat'); } SetContextList('A',-1,NowCaseNo,DocDir,NewName); DeleteImageFile(ExtractFilePath(iISB.FileName),ExtractFileName(iISB.FileName),NowCaseNo); //RenameFile(iISB.FileName,ImageSavePath+NowCaseno+'\'+DocDir+'\'+NewName); //ReNameContext(iISB.FileName,OldName,NewName); end; end; //ShowMessage('KKKK'); ReSortFileName(ExtractFilePath(iISB.FileName)); DrawDocItem2(MytreeNode1,NowCaseno); ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 if GoAtt then begin GotoAttach(AttLv); end; TreeView1click(self); end; finally DataLoading(False,False); DocListForm.Free; ST1.Free; end; end; { ============================================================================== 方法名稱:PM602Click 引用相依:Str2Dir, FileExists, LoadFromFile, CopyFile, SaveToFile, DeleteImage File, ReSortFileName 方法描述:縮圖瀏覽區右鍵選單功能:歸類至自定義文件。彈出對話框要求使用者輸入新文 件名稱,檢核名稱是否重複後產生新的自定義文件編號。接著將所有選取的影像 複製到新建立的文件目錄下,更新 ContextList並刪除原檔案。最後重新排序並 刷新樹狀顯示。 ============================================================================== } procedure TCB_IMGPSScanX.PM602Click(Sender: TObject); var FileList:TStringlist; SavePath : String; DocDir : String; CustomDocName : String; CustomDocNo : String; i : Integer; OldName,NewName,Ext : String; FormID,FormName,DocNo : String; PreNode2Name : String; iFormID : String; iISBName : String; iISB : TImageScrollBox; GoAtt : Boolean; AttLv : Integer; begin GoAtt := False; if (MytreeNode2 <> nil) and (Pos('Attach',MyTreeNode2.Text)>0) then begin AttLv := TreeView1.Selected.Level; GoAtt := True; end; if InputQuery(_Msg('輸入其他文件名稱'),_Msg('文件名稱'),CustomDocName) then begin if FindCustomDocName(DisplayPath,CustomDocName) then begin Showmessage(Format(_Msg('文件名稱:"%s"己存在'),[CustomDocName])); Exit; end; CustomDocNo := GetNewCustomDocNo(DisplayPath,CustomDocName); end; if CustomDocNo = '' then Exit; DocDir := CustomDocNo; LogFile1.LogToFile(logTimeString+'縮圖 歸類自訂文件 DocDir='+DocDir); SavePath := ImageSavePath+NowCaseNo+'\'+DocDir+'\'; Str2Dir(SavePath); SetDocNoList('A',-1,NowCaseNo,DocDir,'1'); FileList := TStringlist.Create; try FileList.Clear; if FileExists(SavePath+'Context.dat') then FileList.LoadFromFile(SavePath+'Context.dat'); for i := 0 to ComponentCount -1 do begin if (Components[i] is TShape) and (copy(Components[i].Name,1,2)='SP') then begin iISBName := ShapeName2PreViewISBName(TShape(Components[i])); iISB := TImageScrollBox(FindComponent(iISBName)); OldName := ExtractFileName(iISB.FileName); Ext := ExtractFileExt(OldName); NewName := Add_Zoo(FileList.Count+1,3)+'_'+GetCustomFormID(ImageSavePath+NowCaseNo+'\',CustomDocNo)+ext; //Showmessage(iISB.FileName+#13+ImageSavePath+NowCaseno+'\'+DocDir+'\'+NewName); CopyFile(PWideChar(iISB.FileName),PwideChar(ImageSavePath+NowCaseno+'\'+DocDir+'\'+NewName),False); SetContextList('A',-1,NowCaseno,DocDir,NewName); FileList.Add(NewName); {FileList.Add(NewName); FileList.SaveToFile(ImageSavePath+NowCaseno+'\'+DocDir+'\Context.dat');} DeleteImageFile(ExtractFilePath(iISB.FileName),ExtractFileName(iISB.FileName),NowCaseNo); end; end; finally FileList.Free; end; ReSortFileName(ExtractFilePath(iISB.FileName)); DrawDocItem2(MytreeNode1,NowCaseno); ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 if GoAtt then begin GotoAttach(AttLv); end; TreeView1click(self); MyTreeNode1.Expand(True); end; { ============================================================================== 方法名稱:PM604Click 引用相依:DeskewImg, SaveToFile, LoadFromFile 方法描述:縮圖瀏覽區右鍵選單功能:自動去偏斜(Deskew)。遍歷所有選取的影像元件,對 其 Graphic 執行 DeskewImg 操作,重新繪製並將結果存回原檔案。 ============================================================================== } procedure TCB_IMGPSScanX.PM604Click(Sender: TObject); var i : Integer; iISBName : String; iISB : TImageScrollBox; begin //Showmessage(inttostr(ComponentCount)); for i := 0 to ComponentCount -1 do 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)); DeskewImg(iISB.Graphic); iISB.Redraw(True); iISB.SaveToFile(iISB.FileName); DisplayISB.LoadFromFile(DisplayISB.FileName,1); end; end; //TreeView1Click(nil); end; { ============================================================================== 方法名稱:PM605Click 引用相依:DeleteImageFile, ReSortFileName 方法描述:縮圖瀏覽區右鍵選單功能:刪除影像。在使用者確認後,遍歷所有選取的影像元 件,呼叫 DeleteImageFile 刪除實際檔案。刪除完成後,執行檔案重新排序(ReS ortFileName),更新樹狀結構上的頁數統計文字,並刷新顯示。 ============================================================================== } procedure TCB_IMGPSScanX.PM605Click(Sender: TObject); var i : Integer; iISBName,OldName : String; iISB : TImageScrollBox; begin if MessageDlg(_Msg('是否確定刪除??'),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit; for i := 0 to ComponentCount -1 do 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)); //ShowMessage('iISB.FileName='+iISB.FileName); //ShowMessage(ExtractFilePath(iISB.FileName)+','+ExtractFileName(iISB.FileName)+','+NowCaseNo); // if (FMode = 'ESCAN') and (FModeName<>'異動件') then // begin // if ISExistImg(iISB.FileName) then // begin // ShowMessage(_Msg('此圖為非當次掃瞄,不可刪除')); // Exit; // end; // end; LogFile1.LogToFile(logTimeString+'縮圖刪除 iISB.FileName='+iISB.FileName); DeleteImageFile(ExtractFilePath(iISB.FileName),ExtractFileName(iISB.FileName),NowCaseNo); end; end; //ShowMessage('iISB.FileName='+iISB.FileName); ReSortFileName(ExtractFilePath(iISB.FileName)); DrawDocItem2(MytreeNode1,NowCaseno); MyTreeNode1.Text := Format(_Msg('%s-%d頁'),[NowCaseno,GetCasePage(ImageSavePath,NowCaseNo)]); NewTreeNodeRefresh; ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 TreeView1click(self); end; { ============================================================================== 方法名稱:PM101Click 引用相依:_DelTree, DirectoryExists, DeleteDocNoFile 方法描述:處理樹狀結構(TreeView)的右鍵刪除選單。根據選取的節點類型(新掃瞄件、案 件、文件或表單)執行不同範圍的刪除:包含刪除實體目錄、清空影像清單、更新 案件索引及檢核記錄。針對異動模式(ESCAN),若刪除後無影像則會重建空案件 以維持結構。 ============================================================================== } procedure TCB_IMGPSScanX.PM101Click(Sender: TObject); var P,v,v1,v2,ln,i : Integer; iDocDir,iDocNo : String; begin LogFile1.LogToFile(logTimeString+'Tree 按下刪除'); if TreeView1.Selected = NewTreeNode then //全刪 //新掃描件 begin LogFile1.LogToFile(logTimeString+'Tree 全部刪除'); If Messagedlg(_Msg('是否刪除所有案件?'),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit; clearView(1); Application.ProcessMessages; _DelTree(ImageSavePath); if (FMode = 'ESCAN') then begin MkDir(ImageSavePath+FCaseID); CreateEmptyCase(ImageSavePath,FCaseID); end; LoadImgFile; Showmessage(_Msg('刪除完成')); end Else if TreeView1.Selected = MyTreeNode1 then //案件編號 begin LogFile1.LogToFile(logTimeString+'Tree 案件編號刪除 NowCaseno='+NowCaseno); If Messagedlg(Format(_Msg('編號(%s)是否刪除?'),[NowCaseno]),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit; clearView(1); Application.ProcessMessages; if (FMode = 'ESCAN') then begin for i := 0 to MyTreeNode1.Count - 1 do begin MyTreenode2 := MyTreeNode1.Item[i]; v := Posend('{',MyTreenode2.Text); v1 := Posend('}',MyTreenode2.Text); v2 := posend('-',MyTreenode2.Text); ln := length(MyTreenode2.Text); iDocDir := Copy(MyTreeNode2.Text,v+1,v1-v-1); iDocNo := DocNoDir2DocNo(iDocDir); _DelTree(ImageSavePath+NowCaseno+'\'+iDocDir); SetUseCase('D',ImageSavePath+NowCaseno+'\',iDocDir,'',''); SetDocNoList('D',-1,NowCaseNo,iDocDir,''); if (Copy(iDocNo,1,5)='ZZZZZ') then //20140703 刪除自定文件時要刪ini檔資料 DeleteCustomDocDir(ImageSavePath+NowCaseno+'\',iDocDir); end end Else begin _DelTree(DisplayPath); SetCaseList('D',NewTreeNode.IndexOf(MyTreeNode1),''); end; ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 if (FMode = 'ESCAN') then begin if not DirectoryExists(ImageSavePath+FCaseID) then begin MkDir(ImageSavePath+FCaseID); CreateEmptyCase(ImageSavePath,FCaseID); end; end; LoadImgFile; end Else if TreeView1.Selected = MyTreeNode2 then //文件層 begin If Messagedlg(Format(_Msg('文件(%s)是否刪除?'),[DocNo2DocName(NowCaseno,NowDocNo)]),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit; ClearView(1); Application.ProcessMessages; //ShowMessage(NowDocDir); LogFile1.LogToFile(logTimeString+'Tree 文件層號刪除 NowDocDir='+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,'',''); if (Copy(NowDocNo,1,5)='ZZZZZ') then //20140703 刪除自定文件時要刪ini檔資料 DeleteCustomDocDir(ImageSavePath+NowCaseno+'\',NowDocDir); DrawDocItem2(MytreeNode1,NowCaseno); MytreeNode1.Text := Format(_Msg('%s-%d頁'),[NowCaseno,GetCasePage(ImageSavePath,NowCaseNo)]); ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 NewTreeNodeRefresh; end Else if TreeView1.Selected = MyTreeNode3 then //FormID層 begin If Messagedlg(Format(_Msg('文件(%s)是否刪除?'),[NowFormName]),mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit; LogFile1.LogToFile(logTimeString+'Tree FormID層號刪除 NowFormCode='+NowFormCode); DeleteFormCodeFile(NowCaseNo,NowDocDir,NowFormCode); SetRecordEditedDocDir('A',NowCaseNo,NowDocDir); DrawDocItem2(MytreeNode1,NowCaseno); MytreeNode1.Text := Format(_Msg('%s-%d頁'),[NowCaseno,GetCasePage(ImageSavePath,NowCaseNo)]); ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 NewTreeNodeRefresh; end; end; { ============================================================================== 方法名稱:PM102Click 引用相依:DirectoryExists, RenameFile 方法描述:處理「修改案件編號」右鍵選單。彈出輸入盒要求輸入新編號並驗證長度與是否 重複。確認修改後,先清空當前影像顯示,接著執行磁碟目錄更名並更新案件清 單文字。最後重新繪製該案件的文件樹狀結構並提示完成。 ============================================================================== } procedure TCB_IMGPSScanX.PM102Click(Sender: TObject); var NewCaseID,ShowNewCaseID,ShowNowCaseID : String; i,P,v : Integer; InputOk : Boolean; begin VMode := 0; GoViewMode; ISB1.ZoomMode := zmFitWidth; NewCaseID := InputBox(_Msg('修改案件編號'),_Msg('新案件編號'),''); ShowNewCaseID := NewCaseID; ShowNowCaseID := NowCaseno; if NewCaseID = '' then Exit; IF Length(NewCaseID)<>CaseIDLength Then begin Showmessage(_Msg('輸入格式錯誤')); Exit; end; if DirectoryExists(ImageSavePath+NewCaseID) then begin Showmessage(NewCaseID+_Msg('己存在,無法修改')); Exit; end; if Messagedlg(Format(_Msg('是否將%s改為%s'),[ShowNowCaseID,ShowNewCaseID]),Mtconfirmation,[mbyes,mbcancel],0) = mrcancel then Exit; ClearView(1); RenameFile(ImageSavePath+NowCaseno,ImageSavePath+NewCaseID); SetCaseList('E',NewTreeNode.IndexOf(MyTreeNode1),NewCaseID); //P := ContextList.Count; MytreeNode1.Text := Format(_Msg('%s-%d頁'),[NewCaseID,GetCasePage(ImageSavePath,NewCaseID)]); //DrawDocItem(MyTreeNode1,FORM_INF_List,NewCaseID); DrawDocItem2(MytreeNode1,NewCaseID); Showmessage(_Msg('修改完成')); end; { ============================================================================== 方法名稱:PM103Click 引用相依: 方法描述:處理樹狀結構的「掃瞄/追加掃瞄」右鍵選單。根據選取的節點層級,決定是啟動 全新的案件掃瞄程序(NewScanBtnClick)或是針對現有案件進行追加掃瞄(AddS canBtnclick),並在日誌中記錄操作行為。 ============================================================================== } procedure TCB_IMGPSScanX.PM103Click(Sender: TObject); begin if TreeView1.Selected = nil then Exit; {if Treeview1.Selected = NewTreeNode then begin ShowMessage('AAAAA'); end; if Treeview1.Selected = MyTreeNode1 then begin ShowMessage('BBBBB'); end; if Treeview1.Selected = MyTreeNode2 then begin ShowMessage('CCCCC'); end; if Treeview1.Selected = MyTreeNode3 then begin ShowMessage('DDDDD'); end; } if (Treeview1.Selected = NewTreeNode) {or (Treeview1.Selected = MyTreeNode1)} then begin //ShowMessage('NewScanBtnClick'); LogFile1.LogToFile(logTimeString+'Tree NewScanBtnClick'); NewScanBtnClick(self) end Else begin //ShowMessage('AddScanBtnclick'); LogFile1.LogToFile(logTimeString+'Tree AddScanBtnclick'); AddScanBtnclick(self); end; end; { ============================================================================== 方法名稱:PM104Click 引用相依:TTiffGraphic, TJpegGraphic, FJpgCompression, DeskewImg, ConvertToBW, MpsGetBarcode, Rotate, CheckNeedCrop, CropImg, ifBlackWhite, tcGrou p4, ifColor25, ConvertToGray, tcJpeg, ifTrueColor, ifGray256, SaveQu ality, FindFirst, LoadFromFile, SaveToFile, DirectoryExists, _DelTre e, GetNoNameCase, Str2Dir, FileExists 方法描述:處理「匯入影像檔案」右鍵選單。開啟檔案對話框選取 TIF/JPG/PNG 檔,並檢查 檔案大小是否超過限制。核心流程包含:計算總頁數、逐頁載入、執行自動去偏斜 (Deskew)、條碼辨識以判斷 FormID、處理 A3 切圖(左右分割)、將影像轉換為對 應格式(黑白轉 TIF G4,彩色/灰階轉 JPG)並寫入磁碟,最後更新索引、樹狀結 構與頁數統計。 ============================================================================== } 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;*.PNG'; If OpenDialog1.Execute Then Begin ISB := TImageScrollBox.Create(self); try ShowText := _Msg('檔案加入中,請稍候'); LogFile1.LogToFile(logTimeString+'檔案加入中開始'); DataLoading(True, True); If TreeView1.Selected = Nil Then Exit; FName := OpenDialog1.FileName; FindFirst(FName, faAnyfile, FileRec); 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(_Msg('目前檔案大小為 %.3f MB,已超過單一檔案匯入限制%1.f MB'),[FileRec.Size / (1024*1024),FFileSizeLimit/1024])); {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 := Format(_Msg('檔案加入中,請稍候(%d/%d)'),[i,p]); //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 ConvertToBW(ISB_BW.Graphic); end; ///ISB_BW.SaveToFile('KKKKKKKK.tif'); iGraphic_First := TTiffGraphic.Create; iGraphic_sec := TTiffGraphic.Create; //ShowMessage(IntToStr(iGraphic_First.Palette.palNumEntries)); //彩色 會為0 黑白 為2 MpsGetBarcode(ISB_BW.Graphic, MpsBarcodeinf); //判斷A3 有用FormID 所以要先辨條碼 For n := 1 To MpsBarcodeinf.Count Do Begin If (MpsBarcodeinf.r180[n] <> 0) and (Length(MpsBarcodeinf.Text[n])=FormIDLength) Then // 依條碼角度轉影像 Begin Rotate(ISB.Graphic, MpsBarcodeinf.r180[n]); //MpsGetBarcode(iGraphic_First, MpsBarcodeinf); Break; End; End; iGraphic_First.Assign(ISB.Graphic); //有必要的話先把影像轉正 再開始切圖 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; ISB.Graphic.Clear; //20220711 Hong 覺得ISB後面沒有到了,先清掉減少記憶體使用 iGraphic := iGraphic_First; While Not iGraphic.IsEmpty Do Begin If (TreeView1.Selected = NewTreeNode) Or (TreeView1.Selected = MyTreeNode1) Then Begin SaveFilename := ''; ISB_BW.Graphic.Assign(iGraphic); //20180104 If iGraphic.ImageFormat <> ifBlackWhite Then //20180104 begin ConvertToBW(ISB_BW.Graphic); end; MpsGetBarcode(ISB_BW.Graphic, MpsBarcodeinf); //ShowMessage(IntToStr(MpsBarcodeinf.Count)); For n := 1 To MpsBarcodeinf.Count Do Begin If (MpsBarcodeinf.r180[n] <> 0) and (Length(MpsBarcodeinf.Text[n])=FormIDLength) Then // 依條碼角度轉影像 Begin Rotate(iGraphic, MpsBarcodeinf.r180[n]); MpsGetBarcode(ISB_BW.Graphic, MpsBarcodeinf); Break; End; End; //ShowMessage('XXX '+IntToStr(MpsBarcodeinf.Count)); FormID := BarCode2FormID; //ShowMessage('FormID='+FormID); // 取出FormID SaveFilename := FormID; 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 CaseID := GetNoNameCase(ImageSavePath); ContextList.Clear; End; End; SavePath := ImageSavePath + CaseID + '\'; Str2Dir(SavePath); DocNo := FormCode2DocNo(FormID); DocDir := FindLastestDocDir(CaseID, DocNo); if (FMode='ESCAN') and (FModeName=_Msg('補件掃描')) then begin DocDir := FindLastestDocDirForPage(CaseID, DocNo,FormID); //ShowMessage('DocDir='+DocDir); end; If DocNoNeedDiv(DocNo) Then // 要分份數 Begin If ((FormCode2Page(FormID) = '01') And (GetDocDir_Page(CaseID, DocDir) > 0)) Or (DocDir = '') Then begin DocDir := DocNo2DocNoDir(ImageSavePath + CaseID + '\', DocNo); end; End Else // 不分份數 Begin If DocNo <> '' Then DocDir := DocNo 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'); WriteCaseIndex(ImageSavePath + CaseID + '\'); // 寫入案件索引 If SaveFilename = '' Then // 附件 SaveFilename := Add_Zoo(ContextList.Count + 1, 3) + ext Else SaveFilename := Add_Zoo(ContextList.Count + 1, 3) + '_' + SaveFilename + ext; For n := 1 To MpsBarcodeinf.Count Do Begin If (MpsBarcodeinf.r180[n] <> 0) and (Length(MpsBarcodeinf.Text[n])=FormIDLength) Then // 依條碼角度轉影像 Begin Rotate(iGraphic, MpsBarcodeinf.r180[n]); MpsGetBarcode(ISB_BW.Graphic, MpsBarcodeinf); Break; End; End; //ShowMessage(IntToStr(iGraphic.Palette.palNumEntries)); if iGraphic.ImageFormat = ifBlackWhite then //20200806 出現無法匯入,是因color256無法壓JPEG,待報會後再開啟 begin SaveFilename := changefileext(SaveFilename,'.tif'); //20240320 Hong 調整黑白存tif iGraphic.Compression:=tcGroup4; end else if iGraphic.ImageFormat= ifColor256 then begin SaveFilename := changefileext(SaveFilename,'.jpg'); //20240320 Hong 調整Color256存jpg ConverttoGray(iGraphic); iGraphic.Compression:=tcJPEG; iGraphic.JpegQuality:=cooom; end else if (iGraphic.ImageFormat = ifTrueColor) or (iGraphic.ImageFormat = ifGray256) then begin SaveFilename := changefileext(SaveFilename,'.jpg'); //20240320 Hong 調整彩色灰階存jpg iGraphic.Compression:=tcJPEG; iGraphic.JpegQuality:=cooom; end else begin iGraphic.Compression:=tcLZW; end; {if (iGraphic.Palette.palNumEntries = 0) or (iGraphic.Palette.palNumEntries = 256) then //20171130 彩色 會為0 黑白 為2 灰階256 //20200806拿掉 begin 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; 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 + '\'; 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; 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; if (iGraphic.Palette.palNumEntries = 0) or (iGraphic.Palette.palNumEntries = 256) then //20171130 彩色 會為0 黑白 為2 begin 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 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 := cooom; // 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; 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; iGraphic_First.Free; iGraphic_sec.Free; end; End; End; { ============================================================================== 方法名稱:PM106Click 引用相依:CopyFile, LoadFromFile, SaveToFile 方法描述:處理「複製文件」右鍵選單。開啟對話框供使用者選擇來源文件與目標案件。使用 者確認後,遍歷目標案件並將符合條件的來源影像複製到目標目錄下,同步產生 新的序號檔名、更新目標案件的 Context.dat 並清空其檢核記錄。 ============================================================================== } procedure TCB_IMGPSScanX.PM106Click(Sender: TObject); var i,n,x,v,v1 : Integer; CopyFormID,Copy2Caseno,CopyFileName : String; S : TStringlist; begin ShowText := _Msg('複製文件中,請稍候'); DataLoading(True,True); DocCopyForm := TDocCopyForm.Create(Self); S := TStringlist.Create; try InitialLanguage(DocCopyForm); //載入多國語言 DocCopyForm.CopyFromGB.Caption := NowCaseno+DocCopyForm.CopyFromGB.Caption; IF NewTreenode.Count = 1 Then begin Showmessage(_Msg('沒有其他可複製的文件')); Exit; end; For i := 0 to MyTreeNode1.Count -1 do begin v := Pos('-',MyTreeNode1.Item[i].Text); v1 := pos('{',MyTreeNode1.Item[i].Text); if V1 > 0 then begin CopyFormID := Copy(MyTreeNode1.Item[i].Text,1,v-1); DocCopyForm.CheckListBox1.Items.Add(CopyFormID); end; end; For i := 0 to NewTreenode.Count -1 do begin v := Posend('-',NewTreeNode.Item[i].Text); Copy2Caseno := Copy(NewTreeNode.Item[i].Text,1,v-1); IF Copy2Caseno <> NowCaseno Then begin DocCopyForm.CheckListBox2.Items.Add(Copy2Caseno); end; end; if DocCopyForm.ShowModal = mrok then begin If MessageDlg(_Msg('是否確定要將勾選的文件複製到勾選的編號裡?'),MtConfirmation,[Mbyes,mbcancel],0) = mrCancel Then Exit; ShowText := _Msg('複製中,請稍候'); DataLoading(True,True); For i := 0 to DocCopyForm.CheckListBox2.Count -1 do begin IF DocCopyForm.CheckListBox2.Checked[i] Then begin S.Clear; Copy2Caseno := DocCopyForm.CheckListBox2.Items.Strings[i]; ClearErrini(Copy2Caseno,MyTreeNode1); //清掉檢核記錄 S.LoadFromFile(ImageSavePath + Copy2Caseno +'\Context.dat'); For n := 0 to DocCopyForm.CheckListBox1.Count -1 do //文件 begin If DocCopyForm.CheckListBox1.Checked[n] Then begin //v:= Posend('{',DocCopyForm.CheckContextList.Strings[n]); //v1 := Posend('}',DocCopyForm.CheckContextList.Strings[n]); //CopyFormID := Copy(DocCopyForm.CheckContextList.Strings[n],1,v-1); CopyFormID := DocCopyForm.CheckListBox1.Items.Strings[n]; IF v = 0 Then CopyFormID := ''; For x := 0 to ContextList.Count -1 do begin //Showmessage(CopyFormCode); //IF CopyFormID <> '' then //有文件代號 // begin if FileName2FormCode(ContextList.Strings[x])=CopyFormID then begin //CopyFileName := Add_Zoo(S.Count+1,3)+ Copy(ContextList.Strings[x],4,length(ContextList.Strings[x])-3); CopyFileName := Add_Zoo(S.Count+1,3)+ FileName2NoQuene_Filename(ContextList.Strings[x]); CopyFile(PWideChar(DisplayPath+ContextList.Strings[x]),PWidechar(ImageSavePath + Copy2Caseno+'\'+CopyFileName),False); S.Add(CopyFileName); S.SaveToFile(ImageSavePath + Copy2Caseno +'\Context.dat'); end; // end end; end; end; end; end; DataLoading(False,False); Showmessage(_Msg('複製完成!!')); LoadImgFile; end; finally DocCopyForm.Free; DataLoading(False,False); S.Free; end; end; { ============================================================================== 方法名稱:PM107Click 引用相依: 方法描述:觸發右鍵選單中的備註點擊事件。 ============================================================================== } procedure TCB_IMGPSScanX.PM107Click(Sender: TObject); begin WNoteBtnClick(nil); end; { ============================================================================== 方法名稱:PM108Click 引用相依: 方法描述:處理樹狀結構的「文件歸類」右鍵選單。開啟對話框顯示表單清單,使用者可選擇 歸類至既有文件或新增自定義文件。若為自定義,則驗證名稱後取得新編號。隨 後執行 FormIDReplace 搬移影像檔案、更新索引、清空檢核記錄並刷新樹狀結 構顯示。 ============================================================================== } procedure TCB_IMGPSScanX.PM108Click(Sender: TObject); var i : Integer; DocListForm : TDocListForm; OldName,NewName,Ext : String; NewFormID,NewFormName,CustomDocNo : String; begin DocListForm := TDocListForm.Create(self); try LogFile1.LogToFile(logTimeString+'Tree 歸類開始'); 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); NewFormName := GetSQLData(FORM_INF_List,'T1.FORM_DESC',i); if not FormIDAppear(NewFormID) then Continue; //20170816 先秀全部的 if (NewFormID <> FileName2FormCode(DisplayISB.FileName)) and FormIDExists(NewFormID,False,i) then begin DocListForm.FormIDList.Add(NewFormID+'#@#'+NewFormName); With DocListForm.DocLV.Items.Add do begin Caption := NewFormID; SubItems.Add(GetSQLData(FORM_INF_List,'T1.FORM_DESC',i)); end; end; end; if DocListForm.ShowModal = mrOk then begin if not (DocListForm.DocLV.Selected=nil) then NewFormID := DocListForm.DocLV.Selected.Caption; if DocListForm.CheckBox1.Checked then begin //歸類到自訂文件 NewFormID:=DocListForm.Edit1.Text; if Trim(DocListForm.Edit1.Text)='' then begin Showmessage(_Msg('未輸入文件名稱')); Exit; end; if FindCustomDocName(DisplayPath,NewFormID) then begin Showmessage(Format(_Msg('文件名稱:"%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); LogFile1.LogToFile(logTimeString+'Tree 歸類到自訂文件 CustomDocNo='+CustomDocNo); ShowText := _Msg('歸類中,請稍侯'); DataLoading(True,True); FormIDReplace(NowCaseNo,NowDocDir,NowFormCode,CustomDocNo+'010101A'); end else begin //歸類到既有文件 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); LogFile1.LogToFile(logTimeString+'Tree 歸類到既有文件 NewFormID='+NewFormID); FormIDReplace(NowCaseNo,NowDocDir,NowFormCode,NewFormID); end; ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 DrawDocItem2(MytreeNode1,NowCaseno); DataLoading(False,False); TreeView1.Selected := MyTreeNode1; TreeView1Click(self); end; finally DocListForm.Free; end; end; { ============================================================================== 方法名稱:PM109Click 引用相依:SaveToFile 方法描述:處理「案件 OMR 檢核」右鍵選單。清空當前顯示並開啟檢核進度,呼叫 OMRCheck Case 對案件執行光學劃記辨識檢核。若檢核成功則建立 OMRCheckOk.dat 標記 檔,最後重新載入影像、刷新樹狀結構並提示檢核完成。 ============================================================================== } procedure TCB_IMGPSScanX.PM109Click(Sender: TObject); var S : TStringlist; CaseID : String; begin //if TreeView1.Selected = nil then Exit; //if TreeView1.Selected = NewTreeNode then Exit; CaseID := NowCaseno; S := TStringlist.Create; try ClearView(1); ShowText := CaseID+_Msg('檢核中,請稍候'); DataLoading(True,True); ShowText := CaseID+_Msg('檢核中,請稍候'); DataLoading(True,True); If OMRCheckCase(CaseID) then //有成功 begin S.Add('Y'); S.SaveToFile(ImageSavePath+CaseID+'\OMRCheckOk.dat'); end; //MyTreeNode2ReFresh(CaseID); LoadImgFile; TreeView1Click(nil); DataLoading(False,False); finally S.Free; end; Showmessage(_Msg('檢核完成')); end; { ============================================================================== 方法名稱:PM110Click 引用相依:Str2Dir 方法描述:處理「新增其他文件」右鍵選單。彈出對話框要求輸入自定義名稱,驗證無誤後產 生新的文件編號並在案件目錄下建立實體子目錄。隨後將新目錄加入清單並重 新繪製樹狀結構,最後自動展開新建立的節點。 ============================================================================== } procedure TCB_IMGPSScanX.PM110Click(Sender: TObject); var CustomDocName : String; CustomDocNo : String; DocDir : String; SavePath : String; ST1:TStringList; begin if InputQuery(_Msg('輸入其他文件名稱'),_Msg('文件名稱'),CustomDocName) then begin if CustomDocName <> '' then begin if FindCustomDocName(DisplayPath,CustomDocName) then begin Showmessage(Format('文件名稱:"%s"己存在',[CustomDocName])); Exit; end; ST1:=TStringList.Create; CustomDocNo := GetNewCustomDocNo(DisplayPath,CustomDocName); DocDir := CustomDocNo; SavePath := ImageSavePath+NowCaseNo+'\'+DocDir+'\'; Str2Dir(SavePath); SetDocNoList('A',-1,NowCaseNo,DocDir,'1'); DrawDocItem2(MytreeNode1,NowCaseno); MyTreeNode1.Expand(True); end; end; end; { ============================================================================== 方法名稱:PM111Click 引用相依: 方法描述:處理「修改文件份數」右鍵選單。取得當前份數並供使用者修改(範圍 1-9999)。 若份數有變動則執行驗證(如分份文件限制),確認後更新 SetDocDirCopies 設 定並標記文件已編輯,最後刷新樹狀結構統計。 ============================================================================== } procedure TCB_IMGPSScanX.PM111Click(Sender: TObject); var oldCopies,NewCopies : Integer; copies : String; begin oldCopies := GetDocDirCopies(NowCaseno,NowDocDir); try NewCopies := Strtoint(inputBox(_Msg('修改份數'),_Msg('請輸入修改後的份數'),inttostr(oldCopies))); except Showmessage(_Msg('輸入錯誤')); Exit; end; if (NewCopies <= 0) and (NewCopies >= 10000) then begin Showmessage(_Msg('輸入範圍錯誤')); Exit; end; if (oldCopies <> NewCopies) and (NewCopies > 0) and (NewCopies < 10000) then begin if DocNoNeedDiv(NowDocNo) and (NewCopies = 1) and (MessageDlg(_Msg('修改至1份後此文件將無法再進行份數修改,是否確定??'),mtConfirmation,[mbyes,mbcancel],0)= mrcancel) then Exit; SetDocDirCopies(NowCaseno,NowDocDir,NewCopies); SetRecordEditedDocDir('A',NowCaseNo,NowDocDir); DrawDocItem2(MytreeNode1,NowCaseno); Showmessage(_Msg('修改完成')); end; end; { ============================================================================== 方法名稱:PM301Click 引用相依:ifBlackWhite 方法描述:將掃瞄模式設定為黑白(ifBlackWhite)並指定副檔名為 .tif。 ============================================================================== } procedure TCB_IMGPSScanX.PM301Click(Sender: TObject); begin ScanColor := ifBlackWhite; ScanDpi := Def_ScanDpi; Ext := '.tif'; PM301.Checked := True; end; { ============================================================================== 方法名稱:PM302Click 引用相依:ifGray256 方法描述:將掃瞄模式設定為灰階(ifGray256)並指定副檔名為 .jpg。 ============================================================================== } procedure TCB_IMGPSScanX.PM302Click(Sender: TObject); begin ScanColor := ifGray256; Ext := '.jpg'; ScanDpi := 200; //Ext := '.tif'; PM302.Checked := True; end; { ============================================================================== 方法名稱:PM303Click 引用相依:ifTrueColor 方法描述:將掃瞄模式設定為全彩(ifTrueColor)並指定副檔名為 .jpg。 ============================================================================== } procedure TCB_IMGPSScanX.PM303Click(Sender: TObject); begin ScanColor := ifTrueColor; Ext := '.jpg'; //20130326 yuu說理賠改存jpg ScanDpi := 200; //Ext := '.tif'; PM303.Checked := True; end; { ============================================================================== 方法名稱:PM501Click 引用相依: 方法描述:將影像縮放模式設為「符合寬度」並開啟反鋸齒。 ============================================================================== } procedure TCB_IMGPSScanX.PM501Click(Sender: TObject); begin DisplayISB.ZoomMode := zmFitWidth; DisplayISB.AntiAliased := True; SetScrollData(DisplayISB,DisplayISB.HorzScrollBar.Position,DisplayISB.VertScrollBar.Position,DisplayISB.ZoomPercent); end; { ============================================================================== 方法名稱:PM502Click 引用相依: 方法描述:將影像縮放模式設為「符合高度」並開啟反鋸齒。 ============================================================================== } procedure TCB_IMGPSScanX.PM502Click(Sender: TObject); begin DisplayISB.ZoomMode := zmFitHeight; DisplayISB.AntiAliased := True; SetScrollData(DisplayISB,DisplayISB.HorzScrollBar.Position,DisplayISB.VertScrollBar.Position,DisplayISB.ZoomPercent); end; { ============================================================================== 方法名稱:PM503Click 引用相依: 方法描述:將影像縮放模式設為「符合頁面」並開啟反鋸齒。 ============================================================================== } procedure TCB_IMGPSScanX.PM503Click(Sender: TObject); begin DisplayISB.ZoomMode := zmFittoPage; DisplayISB.AntiAliased := True; SetScrollData(DisplayISB,DisplayISB.HorzScrollBar.Position,DisplayISB.VertScrollBar.Position,DisplayISB.ZoomPercent); end; { ============================================================================== 方法名稱:PM504Click 引用相依: 方法描述:將影像縮放模式設為「原始大小」並開啟反鋸齒。 ============================================================================== } procedure TCB_IMGPSScanX.PM504Click(Sender: TObject); begin DisplayISB.ZoomMode := zmOriginalSize; DisplayISB.AntiAliased := True; SetScrollData(DisplayISB,DisplayISB.HorzScrollBar.Position,DisplayISB.VertScrollBar.Position,DisplayISB.ZoomPercent); end; { ============================================================================== 方法名稱:PM505Click 引用相依:StatrTwainScan 方法描述:處理「掃瞄替換此頁」右鍵選單。檢查當前影像後,設定掃瞄模式為 smReplace 並指定儲存路徑與檔名為當前顯示之影像。啟動 StatrTwainScan 掃瞄以覆蓋 原檔案,完成後清空該案件的檢核記錄。 ============================================================================== } procedure TCB_IMGPSScanX.PM505Click(Sender: TObject); begin if DisplayISB.FileName = '' then Exit; Panel1.Enabled := False; Panel2.Enabled := False; ScanMode := smReplace; ScanInfo.ImageCount := 0; ScanPath := DisplayPath; ScanCaseno := ''; ScanSaveFilename := ExtractFileName(DisplayISB.FileName); Try StatrTwainScan; Except Panel1.Enabled := True; Panel2.Enabled := True; end; Panel1.Enabled := True; Panel2.Enabled := True; ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 end; { ============================================================================== 方法名稱:PM507Click 引用相依:RenameFile 方法描述:處理影像區域的「文件歸類」右鍵選單。彈出對話框供使用者選取目標表單,隨後 根據選取的 FormID 產生新的序號檔名。執行 RenameFile 進行實際更名並同 步更新 Context.dat。最後重新整理樹狀結構、清空檢核記錄並使焦點回到原文 件節點。 ============================================================================== } procedure TCB_IMGPSScanX.PM507Click(Sender: TObject); var i : Integer; DocListForm : TDocListForm; OldName,NewName,Ext : String; FormID,FormName,DocNo : String; PreNode2Name : String; iFormID : String; begin PreNode2Name := ''; if TreeView1.Selected.Parent = MyTreeNode1 then PreNode2Name:= GetNode2Name(MyTreeNode2); ShowText := _Msg('文件歸類中,請稍候'); DataLoading(True,True); DocListForm := TDocListForm.Create(self); try InitialLanguage(PatchDlg); //載入多國語言 for i := 1 to FORM_INF_List.Count - 1 do begin FormID := GetSQLData(FORM_INF_List,'T1.FORM_ID',i); FormName := GetSQLData(FORM_INF_List,'T1.FORM_DESC',i); DocNo := GetSQLData(FORM_INF_List,'T1.DOC_NO',i)+GetSQLData(FORM_INF_List,'T1.DOC_VERSION',i); //Showmessage(FORM_INF_List.Text); //showmessage(inttostr(FORM_INF_List.Count)+#13+inttostr(self.Doc_Inf_List.Count)); if (FormID <> FileName2FormCode(DisplayISB.FileName)) and FormIDExists(FormID,False,i) then begin DocListForm.FormIDList.Add(FormID+'#@#'+FormName); With DocListForm.DocLV.Items.Add do begin Caption := FormID; SubItems.Add(FormName); end; end; end; if DocListForm.ShowModal = mrOk then begin OldName := ExtractFileName(DisplayISB.FileName); Ext := ExtractFileExt(OldName); //NewName := Copy(OldName,1,3)+'_'+TransRealFormID(DocListForm.DocLV.Selected.Caption)+Ext; NewName := Add_Zoo(FileName2ScanPage(OldName),3)+'_'+DocListForm.DocLV.Selected.Caption+Ext; RenameFile(DisplayPath+OldName,DisplayPath+NewName); ReNameContext(DisplayPath,OldName,NewName); //DrawDocItem1(MytreeNode1,Doc_Inf_List,NowCaseno); //201408280改 DrawDocItem2(MytreeNode1,NowCaseno); //DrawDocItem(MytreeNode1,FORM_INF_List,NowCaseno); ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 if PreNode2Name <> '' then // 回到原本點選的文件節點上 begin for i := 0 to MyTreeNode1.Count - 1 do begin if GetNode2Name(MyTreeNode1.Item[i]) = PreNode2Name then begin TreeView1.Selected := MyTreeNode1.Item[i]; Break; end; end; end; TreeView1click(self); //Showmessage(_Msg('歸類完成')); //20101103 User要求拿掉 end; finally DataLoading(False,False); DocListForm.Free; end; end; { ============================================================================== 方法名稱:PM508Click 引用相依:_DelTree, SaveToFile, ReSortFileName, LoadFromFile, FileExists 方法描述:處理影像區域的「刪除影像」右鍵選單。若案件僅剩一張影像則詢問是否刪除整 個案件目錄。否則,在確認後從影像清單中移除該項目、刪除實體檔案並呼叫 Re SortFileName 重新排序。最後刷新樹狀統計文字、清空檢核記錄並更新顯示。 ============================================================================== } procedure TCB_IMGPSScanX.PM508Click(Sender: TObject); var P : Integer; inx:Integer; begin if DisplayISB.FileName = '' then Exit; if (ContextList.Count = 1) and ((FMode = 'NSCAN') or (FMode = 'ASCAN') or (FMode = 'DSCAN') or (FMode = 'ISCAN') or (FMode = 'SSCAN') or (FMode = 'MSCAN') or (FMode = 'RI_SCAN')) then begin if Messagedlg(Format(_Msg('刪除後(%s)案件無影像,將刪除此案件,是否確定刪除?'),[NowCaseno]),mtconfirmation,[mbyes,mbcancel],0) = mrCancel then Exit; _DelTree(DisplayPath); SetCaseList('D',NewTreeNode.IndexOf(MyTreeNode1),''); LoadImgFile; end Else begin if Messagedlg(_Msg('是否確定刪除?'),mtconfirmation,[mbyes,mbcancel],0) = mrCancel then Exit; inx := ContextList.IndexOf(ExtractFileName(DisplayISB.FileName)); ContextList.Delete(inx); ContextList.SaveToFile(ImageSavePath + NowCaseno+'\Context.dat'); Context_DocnoList.Delete(inx); Context_DocnoList.SaveToFile(ImageSavePath + NowCaseno+'\Context_DocNo.dat'); DeleteFile(DisplayISB.FileName); ReSortFileName(DisplayPath); ContextList.LoadFromFile(ImageSavePath + NowCaseno+'\Context.dat'); Context_DocnoList.LoadFromFile(ImageSavePath + NowCaseno+'\Context_DocNo.dat'); if FileExists(ImageSavePath + NowCaseno+'\CustomDocNo.dat') then Cust_DocNoList.LoadFromFile(ImageSavePath + NowCaseno+'\CustomDocNo.dat'); //DrawDocItem1(MytreeNode1,Doc_Inf_List,NowCaseno); //201408280改 DrawDocItem2(MytreeNode1,NowCaseno); //DrawDocItem(MytreeNode1,FORM_INF_List,NowCaseno); P := ContextList.Count; MytreeNode1.Text := Format(_Msg('%s-%d頁'),[NowCaseno,p]); ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 NewTreeNodeRefresh; TreeView1Click(self); end; //Showmessage(_Msg('刪除完成')); //20101101 User要求拿掉 end; { ============================================================================== 方法名稱:PM509Click 引用相依: 方法描述:觸發「從此分案」功能,內部轉呼叫 PM401Click。 ============================================================================== } procedure TCB_IMGPSScanX.PM509Click(Sender: TObject); begin PM401Click(nil); end; { ============================================================================== 方法名稱:PM510Click 引用相依:DeskewImg, SaveToFile 方法描述:對當前 Graphic 執行去偏斜處理後存回原檔案。 ============================================================================== } procedure TCB_IMGPSScanX.PM510Click(Sender: TObject); begin DeskewImg(DisplayISB.Graphic); DisplayISB.SaveToFile(DisplayISB.FileName); ClearErrini(NowCaseno,MyTreeNode1); //清掉檢核記錄 end; { ============================================================================== 方法名稱:PopupMenu1Popup 引用相依: 方法描述:處理樹狀結構右鍵選單彈出時的動態項目控制。根據選取節點的層級(根、案件、 文件、表單)與系統模式(如 FMode、FImgDelete 權限等)動態設定各項選單(刪 除、修改、掃瞄加入、歸類、檢核等)的可見度與可用性。例如在文件層會受影像引 用狀態限制刪除功能。 ============================================================================== } procedure TCB_IMGPSScanX.PopupMenu1Popup(Sender: TObject); begin PM101.Visible := False; //刪除 PM102.Visible := False; //修改案件編號 PM103.Visible := False; //掃瞄器加入影像 PM104.Visible := False; //檔案加入影像 PM106.Visible := False; //複製文件至其他編號 PM107.Visible := False; //寫備註 PM108.Visible := False; //歸類 PM109.Visible := False; //檢核此筆 PM110.Visible := False; //新增自訂文件 PM111.Visible := False; //修改份數 if (FMode = 'SAMPLESCAN') then Exit; if TreeView1.Selected = nil then Exit; if TreeView1.Selected = NewTreeNode then //新掃瞄件 begin if (FMode = 'NSCAN') then begin //ShowMessage('AAAA'); PM101.Visible := True; //刪除 PM103.Visible := True; //掃瞄器加入影像 PM104.Visible := True; //檔案加入影像 end; if FModeName=_Msg('異動件') then begin PM101.Visible := True; end; // if FMode='ESCAN' then // begin // PM101.Visible := True; // end; end Else if TreeView1.Selected = MyTreeNode1 then //案件層 begin PM101.Visible := True; //刪除 if FImgDelete='Y' then begin PM101.Visible:=True; end; if FImgDelete='N' then begin PM101.Visible:=false; end; if FMode='ESCAN' then PM101.Visible:=false; if FModeName=_Msg('異動件') then begin PM101.Visible := True; end; if not CaseDelete_Enable(NowCaseno) then // PM101.Enabled := False else PM101.Enabled := True; PM103.Visible := True; //掃瞄器加入影像 //PM107.Visible := True; //寫備註 //PM109.Visible := True; //檢核此筆 // if FCustDocYN <> 'N' Then // PM110.Visible := True; //新增自訂文件 20170914 先不在tree 中做自訂文件 讓user在縮圖做 PM104.Visible := True; //檔案加入影像 if (FMode = 'NSCAN') then begin PM102.Visible := True; //修改案件編號 end; // if FMode='ESCAN' then // begin // PM101.Visible := True; // end; end Else if TreeView1.Selected = MyTreeNode2 then //文件層 begin PM101.Visible := True; //刪除 //PM107.Visible := True; //寫備註 //PM109.Visible := True; //檢核此筆 // if FCustDocYN <> 'N' Then // PM110.Visible := True; //新增自訂文件 if FImgDelete='Y' then begin PM101.Visible:=True; end; if FImgDelete='N' then begin PM101.Visible:=false; end; if FModeName=_Msg('異動件') then begin PM101.Visible := True; end; if GetUseCase('T',DisplayPath,NowDocDir) <> '' then //沒有被引用走的 PM101.Enabled := False //刪除 Else PM101.Enabled := True; //刪除 if ((GetDocDirCopies(NowCaseno,NowDocDir) > 1) or (not DocNoNeedDiv(NowDocNo)) or (Copy(NowDocNo,1,5)='ZZZZZ')) and (NowDocNo<> 'Attach') and (NowDocNo<> 'S_Attach') then PM111.Visible := True; //修改份數 if (FMode = 'NSCAN') then PM102.Visible := True; //修改案件編號 // if FMode='ESCAN' then // begin // PM101.Visible := True; // end; end Else if TreeView1.Selected = MyTreeNode3 then //表單層 begin PM101.Visible := True; //刪除 PM104.Visible := True; //檔案加入影像 PM108.Visible := True; //歸類 PM103.Visible := True; //掃瞄器加入影像 // if FCustDocYN <> 'N' Then // PM110.Visible := True; //新增自訂文件 if GetFormIDPage(ContextList,NowFormCode) < 1 Then begin PM108.Visible := False; //歸類 end; if FImgDelete='Y' then begin PM101.Visible:=True; end; if FImgDelete='N' then begin PM101.Visible:=false; end; if FModeName=_Msg('異動件') then begin PM101.Visible := True; end; if GetUseCase('T',DisplayPath,NowDocDir) <> '' then //被引用走的 begin PM101.Enabled := False; //刪除 PM104.Enabled := False; //檔案加入影像 PM108.Enabled := False; //歸類 end Else begin PM101.Enabled := True; //刪除 PM104.Enabled := True; //檔案加入影像 PM108.Enabled := True; //歸類 end; if (FMode = 'NSCAN') then begin PM102.Visible := True; //修改案件編號 end; end; end; { ============================================================================== 方法名稱:PopupMenu4Popup 引用相依: 方法描述:處理影像列表右鍵選單彈出邏輯。僅在樹狀結構選取文件或表單層級時顯示全 選、取消全選及歸類功能,並特別判斷「分出新案」在非重掃模式下才可見。 ============================================================================== } procedure TCB_IMGPSScanX.PopupMenu4Popup(Sender: TObject); begin PM401.Visible := False; PM402.Visible := False; PM403.Visible := False; PM404.Visible := False; if FMode = 'SAMPLESCAN' then Exit; if (TreeView1.Selected.Level =2) or (TreeView1.Selected.Level =3) then begin PM402.Visible := True; PM403.Visible := True; PM404.Visible := True; end; PM401.Visible := True; if (TreeView1.Selected <> MyTreeNode2) or (FMode = 'RSCAN') then PM401.Visible := False; end; { ============================================================================== 方法名稱:PopupMenu5Popup 引用相依: 方法描述:處理影像顯示區域右鍵選單彈出邏輯。當有載入影像時啟用各類縮放選單項目, 並根據樹狀選取層級與掃瞄模式決定是否顯示「分出新案」功能。 ============================================================================== } procedure TCB_IMGPSScanX.PopupMenu5Popup(Sender: TObject); begin PM501.Visible := False; PM502.Visible := False; PM503.Visible := False; PM504.Visible := False; PM505.Visible := False; PM506.Visible := False; PM507.Visible := False; PM508.Visible := False; PM509.Visible := False; PM510.Visible := False; if FMode = 'SAMPLESCAN' then Exit; if (DisplayISB.FileName <> '') then begin PM501.Visible := True; PM502.Visible := True; PM503.Visible := True; PM504.Visible := True; //PM505.Visible := True; //PM506.Visible := True; //PM507.Visible := True; //PM508.Visible := True; //PM509.Visible := True; //PM510.Visible := True; end; if (TreeView1.Selected <> MyTreeNode2) or (FMode = 'RSCAN') or (FMode = 'ESCAN') then PM509.Visible := False; end; { ============================================================================== 方法名稱:PopupMenu6Popup 引用相依: 方法描述:處理縮圖區右鍵選單彈出邏輯。動態設定歸類、自定義文件及刪除項目的可見度 。若選取附件目錄則開啟特殊功能。同時根據權限設定與影像引用狀態(UseCase )限制歸類與刪除功能的可用性。 ============================================================================== } procedure TCB_IMGPSScanX.PopupMenu6Popup(Sender: TObject); begin PM601.Visible := True; //歸類 PM602.Visible := True; //自行定義文件名稱 PM603.Visible := False; //掃描替換此頁 PM604.Visible := False; //歪斜矯正 PM605.Visible := True; //刪除 // if FMode='ESCAN' then // begin // PM601.Visible := False; //歸類 // PM602.Visible := False; //自行定義文件名稱 // PM603.Visible := False; //掃描替換此頁 // PM604.Visible := False; //歪斜矯正 // PM605.Visible := False; //刪除 // end; if ((NowDocNo = 'Attach') or (NowDocNo = 'S_Attach')) and (FCustDocYN <> 'N') then begin PM602.Visible := True; //自行定義文件名稱 //PM603.Visible := True; //掃描替換此頁 PM604.Visible := True; //歪斜矯正 PM601.Visible := True; //歸類 PM605.Visible := True; //刪除 end; if FModeName<>_Msg('異動件') then begin if (FImgDelete='Y') then begin PM605.Enabled:=True; end; if FImgDelete='N' then begin PM605.Enabled:=false; end; end; if CheckSelectImg_UseCase(DisplayPath,NowCaseNo) then //選擇的影像不可有引用的 begin PM601.Enabled := False; //歸類 PM605.Enabled := False; //刪除 end; end;