| | |
| | | function CheckRequiredColumnValues(workno,caseno:String) :Boolean; //20171003 此大類下此案是否檢核必填 |
| | | function logTimeString :String; |
| | | procedure ReduceLogFile ; |
| | | function FindLastestDocDirForPage(CaseID, DocNo, formid: String): String; |
| | | function OMRErrini2ListForLog(CaseID: String):String; |
| | | protected |
| | | { Protected declarations } |
| | | procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override; |
| | |
| | | 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 |
| | |
| | | |
| | | //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 |
| | |
| | | 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; |
| | |
| | | end; |
| | | if CustomDocNo = '' then Exit; |
| | | DocDir := CustomDocNo; |
| | | LogFile1.LogToFile(logTimeString+'縮圖 歸類自訂文件 DocDir='+DocDir); |
| | | SavePath := ImageSavePath+NowCaseNo+'\'+DocDir+'\'; |
| | | Str2Dir(SavePath); |
| | | SetDocNoList('A',-1,NowCaseNo,DocDir,'1'); |
| | |
| | | // Exit; |
| | | // end; |
| | | // end; |
| | | |
| | | LogFile1.LogToFile(logTimeString+'縮圖刪除 iISB.FileName='+iISB.FileName); |
| | | DeleteImageFile(ExtractFilePath(iISB.FileName),ExtractFileName(iISB.FileName),NowCaseNo); |
| | | end; |
| | | end; |
| | |
| | | Showmessage(_msg('資訊尚未下載完成,請稍候或重新進入')); |
| | | Exit; |
| | | end; |
| | | LogFile1.LogToFile(logTimeString+'掃瞄開始'); |
| | | if (FMode = 'RSCAN') or (FMode = 'ESCAN') or (FMode = 'DSCAN') then |
| | | begin |
| | | if NewTreeNode.Count > 0 then |
| | |
| | | ContextList.Clear; |
| | | Try |
| | | StatrTwainScan; |
| | | LogFile1.LogToFile(logTimeString+'掃瞄結束'); |
| | | Except |
| | | Panel1.Enabled := True; |
| | | Panel2.Enabled := True; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | ClearView(1); |
| | | Application.ProcessMessages; |
| | | //ShowMessage(NowDocDir); |
| | | LogFile1.LogToFile(logTimeString+'Tree 文件層號刪除 NowDocDir='+NowDocDir); |
| | | if (Length(NowDocDir)=8) or (NowDocDir=AttName) then |
| | | begin |
| | | //ShowMessage('DeleteDocNoFileForESCAN'); |
| | |
| | | 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); |
| | |
| | | Result:=False; |
| | | ST:=TStringList.Create; |
| | | ST.loadFromfile(DocNopath+'\Context.dat'); |
| | | //ShowMessage(ST.Text); |
| | | for I := 0 to ST.Count - 1 do |
| | | begin |
| | | if ISExistImg(DocNopath+ST.Strings[i]) then |
| | |
| | | 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; |
| | |
| | | ISB := TImageScrollBox.Create(self); |
| | | try |
| | | ShowText := _Msg('檔案加入中,請稍候'); |
| | | LogFile1.LogToFile(logTimeString+'檔案加入中開始'); |
| | | DataLoading(True, True); |
| | | If TreeView1.Selected = Nil Then |
| | | Exit; |
| | |
| | | |
| | | DocNo := FormCode2DocNo(FormID); |
| | | DocDir := FindLastestDocDir(CaseID, DocNo); |
| | | if (FMode='ESCAN') and (FModeName='補件掃描') 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 |
| | |
| | | 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:=DocListForm.Edit1.Text; |
| | | |
| | | if Trim(DocListForm.Edit1.Text)='' then |
| | | begin |
| | | Showmessage('未輸入文件名稱'); |
| | |
| | | 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'); |
| | |
| | | ShowText := _Msg('歸類中,請稍侯'); |
| | | DataLoading(True,True); |
| | | //ShowMessage('NowDocDir='+NowDocDir); |
| | | LogFile1.LogToFile(logTimeString+'Tree 歸類到既有文件 NewFormID='+NewFormID); |
| | | FormIDReplace(NowCaseNo,NowDocDir,NowFormCode,NewFormID); |
| | | |
| | | end; |
| | |
| | | iGraphic.JpegQuality:=FJpgCompression; |
| | | end; |
| | | |
| | | |
| | | //ShowMessage('WTF'); |
| | | while not iGraphic.IsEmpty do |
| | | begin |
| | | //Application.ProcessMessages; |
| | |
| | | iGraphic.Compression:=tcJPEG; |
| | | iGraphic.JpegQuality:=FJpgCompression; |
| | | end; |
| | | |
| | | PageEnd; |
| | | IF PEFileName <> '' Then |
| | | begin |
| | |
| | | Str2Dir(ScanPath); |
| | | |
| | | ScanDocDir := FindLastestDocDir(ScanCaseno,DocNo); |
| | | //ShowMessage('AA ScanDocDir='+ScanDocDir); |
| | | |
| | | //ShowMessage('BB ScanDocDir='+ScanDocDir); |
| | | if DocNoNeedDiv(DocNo)then //要分份數 |
| | | begin |
| | | //Showmessage(DocNo+#13+FormCode2Page(FormID)+#13+inttostr(GetDocDir_Page(ScanCaseno,ScanDocDir))+#13+ScanDocDir); |
| | |
| | | FormID := NowGuideFormID; |
| | | DocNo := FormCode2DocNo(FormID); |
| | | ScanDocDir := FindLastestDocDir(ScanCaseno,DocNo); |
| | | //ShowMessage('ScanDocDir='+ScanDocDir); |
| | | |
| | | if (FMode='ESCAN') and (FModeName='補件掃描') then //20180207 加入的特殊邏輯 |
| | | begin |
| | | ScanDocDir := FindLastestDocDirForPage(ScanCaseno, DocNo,FormID); |
| | | end; |
| | | |
| | | if (DocNoNeedDiv(DocNo)) then //要分份數 |
| | | begin |
| | | if TreeView1.Selected = MyTreeNode1 then //20170421 掃瞄插頁時選則在案號上才要分份數 選在FormID上就不分份數 |
| | |
| | | begin |
| | | ShowText := _Msg('處理檢核失敗中,請稍候'); |
| | | DataLoading(True,True); |
| | | LogFile1.LogToFile(logTimeString+'處理檢核失敗中開始'); |
| | | ErrlistForm := TErrlistForm.Create(Self); |
| | | RejectCase := False; |
| | | S := TStringlist.Create; |
| | | try |
| | | InitialLanguage(ErrlistForm); |
| | | Application.ProcessMessages; |
| | | ErrlistForm.LogFile1.LogFile:=LogFile1.LogFile; |
| | | ErrlistForm.DeleteBt.Caption := ErrlistForm.DeleteBt.Caption+'(&D)'; |
| | | ErrlistForm.iniPath := ImageSavePath + NowCaseNo+'\upload\'; |
| | | OMRErrini2List(NowCaseno,ErrlistForm); |
| | |
| | | FileList.Free; |
| | | end; |
| | | end; |
| | | |
| | | Function TCB_IMGPSScanX.FindLastestDocDirForPage(CaseID,DocNo,formid:String):String; //找出最新的DocDir 20180207 排除隱藏的資料夾 |
| | | var |
| | | i,j:integer; |
| | | DocNoList,FileList : TStringlist; |
| | | Imglist: TStringlist; |
| | | DirIsHide:Boolean; |
| | | begin |
| | | Result := ''; |
| | | DocNoList := TStringlist.Create; |
| | | FileList := TStringlist.Create; |
| | | imglist := TStringlist.Create; |
| | | try |
| | | if FileExists(ImageSavePath+CaseID+'\CaseDocNo.dat') then |
| | | DocNoList.LoadFromFile(ImageSavePath+CaseID+'\CaseDocNo.dat'); |
| | | |
| | | for i := DocNoList.Count-1 downto 0 do |
| | | begin |
| | | if Copy(DocNoList.Strings[i],1,length(DocNo)) = DocNo then |
| | | begin |
| | | //ShowMessage(ImageSavePath+CaseID+'\'+DocNoList.Strings[i]); |
| | | if not DocNoIsExistImg(ImageSavePath+CaseID+'\'+DocNoList.Strings[i]+'\') then |
| | | begin |
| | | //ShowMessage('DDDDD'); |
| | | Result := ''; |
| | | Break; |
| | | end |
| | | else |
| | | begin |
| | | Result := DocNoList.Strings[i]; |
| | | Break; |
| | | end; |
| | | end; |
| | | end; |
| | | finally |
| | | DocNoList.Free; |
| | | FileList.Free; |
| | | imglist.Free; |
| | | end; |
| | | |
| | | end; |
| | | |
| | | |
| | | Procedure TCB_IMGPSScanX.Create_Cust_DocDir(CaseID:String); //產生外面傳入的文件代號及自定文件 |
| | | var |
| | |
| | | end; |
| | | end; |
| | | |
| | | function TCB_IMGPSScanX.OMRErrini2ListForLog(CaseID: String): String; |
| | | var |
| | | ini : Tinifile; |
| | | Errcount : Integer; |
| | | Del : Boolean; |
| | | i,j : Integer; |
| | | ST,CaseList:TStringList; |
| | | |
| | | begin |
| | | Result:=''; |
| | | //CaseList.dat |
| | | ST:=TStringList.Create; |
| | | CaseList:=TStringList.Create; |
| | | CaseList.LoadFromFile(ImageSavePath+'CaseList.dat'); |
| | | for I := 0 to CaseList.Count - 1 do |
| | | begin |
| | | ini := Tinifile.Create(ImageSavePath + CaseList.Strings[i]+'\upload\Checkerr.ini'); |
| | | try |
| | | Errcount := ini.ReadInteger('OMRCount','Count',0); |
| | | |
| | | for j := 1 to ErrCount do |
| | | begin |
| | | Del := ini.ReadBool(inttostr(j),'Del',False); //是否被移除了 |
| | | if Not Del then |
| | | begin |
| | | ST.Add(ini.ReadString(inttostr(j),'Reason','')) ; |
| | | end; |
| | | end; |
| | | finally |
| | | ini.Free; |
| | | end; |
| | | end; |
| | | Result:=ST.Text; |
| | | ST.Free; |
| | | CaseList.Free; |
| | | end; |
| | | |
| | | |
| | | Function TCB_IMGPSScanX.DownLanguage:Boolean; //下載多國語言檔 |
| | | begin |
| | | Result := True; // http://192.168.0.101:8080/fbnp/servlet/CWC01?act=getservertime |
| | |
| | | Showmessage(_msg('資訊尚未下載完成,請稍候或重新進入')); |
| | | Exit; |
| | | end; |
| | | LogFile1.LogToFile(logTimeString+'按下上傳'); |
| | | ClearView(1); |
| | | CaseHelpBtn.Visible := False; |
| | | DisplayPath := ''; |
| | |
| | | if ReCasecount > 0 then |
| | | TransMsg := TransMsg + #13#10 + Format(_Msg('無法上傳件【%d】件'),[ReCasecount]); |
| | | if CheckErrCount > 0 then |
| | | begin |
| | | TransMsg := TransMsg + #13#10 + Format(_Msg('檢核失敗件【%d】件,請先點選「案件編號」,再點選「問號」查看錯誤原因'),[CheckErrCount]); |
| | | |
| | | LogFile1.LogToFile(logTimeString+'檢核失敗原因:'+OMRErrini2ListForLog('')); |
| | | end; |
| | | |
| | | if (FMode = 'DSCAN') and (SuccessCount = 1) then |
| | | begin |