From 6a2caa968cfc7c746ac46ad8521eec68e539cc3c Mon Sep 17 00:00:00 2001
From: doom4ster <doom4ster@gmail.com>
Date: 星期三, 18 十月 2017 15:55:52 +0800
Subject: [PATCH] CB_IMGPSScan.cab ver2.0.1.51  拿調縮圖右鍵歸類中的自訂文件

---
 CB_IMGPSScanImp.pas |   68 ++++++++++++++++++++++++++++++---
 1 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/CB_IMGPSScanImp.pas b/CB_IMGPSScanImp.pas
index 3d10099..44cbafa 100644
--- a/CB_IMGPSScanImp.pas
+++ b/CB_IMGPSScanImp.pas
@@ -1973,8 +1973,10 @@
   iISB : TImageScrollBox;
   GoAtt : Boolean;
   AttLv : Integer;
+  ST1 :TStringList;
 begin
   PreNode2Name := '';
+  ST1:=TStringList.Create;
   if TreeView1.Selected.Parent = MyTreeNode1 then
     PreNode2Name:= GetNode2Name(MyTreeNode2);
   ShowText := _Msg('文件歸類中,請稍候');
@@ -1989,6 +1991,7 @@
   try
     InitialLanguage(DocListForm); //載入多國語言
     //InitialLanguage(PatchDlg); //載入多國語言
+    DocListForm.CheckBox1.Visible:=False;
     for i := 1 to FORM_INF_List.Count - 1 do
     begin
       FormID :=  GetSQLData(FORM_INF_List,'T1.FORM_ID',i);
@@ -2014,23 +2017,48 @@
       begin
         if (Components[i] is TShape) and (copy(Components[i].Name,1,2)='SP') then
         begin
-          //Showmessage(Components[i].Name);
           iISBName := ShapeName2PreViewISBName(TShape(Components[i]));
           iISB := TImageScrollBox(FindComponent(iISBName));
           OldName := ExtractFileName(iISB.FileName);
           Ext := ExtractFileExt(OldName);
-          FormID := DocListForm.DocLV.Selected.Caption;
-          DocNo := FormCode2DocNo(FormID);
+
+          if DocListForm.CheckBox1.Checked then
+          begin
+            FormID := DocListForm.Edit1.Text;
+            DocNo := GetNewCustomDocNo(DisplayPath,FormID);
+          end
+          else
+          begin
+            FormID := DocListForm.DocLV.Selected.Caption;
+            DocNo := FormCode2DocNo(FormID);
+          end;
+
+
           if DocNoDir2DocNo(Path2DocDir(ExtractFilePath(iISB.FileName),NowCaseno)) = DocNo then
             DocDir := Path2DocDir(ExtractFilePath(iISB.FileName),NowCaseNo)
           Else
             DocDir := FindLastestDocDir(NowCaseno,DocNo);
 
 //ShowMessage('DocNoNeedDiv(DocNo)='+BoolToStr(DocNoNeedDiv(DocNo),true));
+//ShowMessage('DocDir='+DocDir);
           if DocNoNeedDiv(DocNo) then   //要分份數
           begin
             if ((FormCode2Page(FormID) = '01') and (GetDocDir_Page(NowCaseno,DocDir)>0)) or (DocDir = '') then
+            begin
               DocDir := DocNo2DocNoDir(ImageSavePath + NowCaseno+'\',DocNo);
+            end
+            else
+            begin //20171016  真對補件影響 所加的判斷
+              ST1.Clear;
+              if FileExists(ImageSavePath + NowCaseno+'\'+DocDir+'\Context.dat') then
+              begin
+                ST1.LoadFromFile(ImageSavePath + NowCaseno+'\'+DocDir+'\Context.dat');
+                if ISExistImg(ImageSavePath + NowCaseno+'\'+DocDir+'\'+ST1.Strings[0]) then
+                begin
+                  DocDir := DocNo2DocNoDir(ImageSavePath + NowCaseno+'\',DocNo);
+                end;
+              end;
+            end;
           end
           Else        //不分份數
           begin
@@ -2064,6 +2092,7 @@
           //ReNameContext(iISB.FileName,OldName,NewName);
         end;
       end;
+//ShowMessage('KKKK');
       ReSortFileName(ExtractFilePath(iISB.FileName));
       DrawDocItem2(MytreeNode1,NowCaseno);
       ClearErrini(NowCaseno,MyTreeNode1);  //清掉檢核記錄
@@ -2078,6 +2107,7 @@
   finally
   DataLoading(False,False);
   DocListForm.Free;
+  ST1.Free;
   end;
 
 end;
@@ -3075,6 +3105,7 @@
   DocListForm := TDocListForm.Create(self);
   try
     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);
@@ -5861,9 +5892,10 @@
         end;
         FormCode := FileName2FormCode(S.Strings[n]);
 //Showmessage('1:'+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
-LogFile1.LogToFile(logTimeString+'caseno='+CaseID+','+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
+LogFile1.LogToFile(logTimeString+'CheckCaseDocNoPage caseno='+CaseID+','+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
         if (version = FormCode2Version(FormCode)) and (DocNo = FormCode2DocNo(FormCode)) and (ipage = FormCode2Page(FormCode)) then
         begin
+LogFile1.LogToFile(logTimeString+'CheckCaseDocNoPage caseno='+CaseID+','+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
 //Showmessage(version+','+DocNo+',iPage='+iPage);
 //Showmessage(inttostr(Count+1));
           Inc(Count);
@@ -6477,7 +6509,7 @@
     Result := False;
     Exit;
   end
-  Else if Pos('<script type="text/javascript" src="scripts/CW00/login.js"></script>',Memo1.Lines.Text) > 0 then
+  Else if Pos('<script type="text/javascript" src="scripts/IMGPS00/login.js"></script>',Memo1.Lines.Text) > 0 then
   begin
     HttpErrStr := _Msg('錯誤原因:')+_Msg('閒置過久或被登出,請重新登入');
     Result := False;
@@ -7161,7 +7193,9 @@
   FormID : String;
   OldFile,NewFile:String;
   Ext : String;
+  ST1:TStringList;
 begin
+  ST1:=TStringList.Create;
   OldFileList := TStringlist.Create;
   NewFileList := TStringlist.Create;
   try
@@ -7169,8 +7203,23 @@
     NewDocDir := FindLastestDocDir(CaseID,NewDocNo);
     if NewDocDir = '' then
       NewDocDir := NewDocNo;
+//ShowMessage('NewDocDir='+NewDocDir);
     if DocNoNeedDiv(NewDocNo) and (FormCode2Page(NewFormID)='01') then
+    begin
       NewDocDir := DocNo2DocNoDir(ImageSavePath+CaseID+'\',NewDocNo);
+    end
+    else
+    begin
+      ST1.Clear;
+      if FileExists(ImageSavePath + NowCaseno+'\'+NewDocDir+'\Context.dat') then
+      begin
+        ST1.LoadFromFile(ImageSavePath + NowCaseno+'\'+NewDocDir+'\Context.dat');
+        if ISExistImg(ImageSavePath + NowCaseno+'\'+NewDocDir+'\'+ST1.Strings[0]) then
+        begin
+          NewDocDir := DocNo2DocNoDir(ImageSavePath + NowCaseno+'\',NewDocNo);
+        end;
+      end;
+    end;
     if Not DirectoryExists(ImageSavePath+CaseID+'\'+NewDocDir) then
     begin
       MkDir(ImageSavePath+CaseID+'\'+NewDocDir);
@@ -7213,6 +7262,7 @@
   finally
   OldFileList.Free;
   NewFileList.Free;
+  ST1.Free;
   end;
 end;
 
@@ -11284,9 +11334,12 @@
     S.LoadFromFile(ImageSavePath + CaseID+'\upload\Context.dat');
     for i := 0 to S.Count - 1 do
     begin
+LogFile1.LogToFile(logTimeString+S.Strings[i]+' ISExistImg='+BoolToStr(ISExistImg(ImageSavePath+CaseID+'\upload\'+S.Strings[i]),true));
+LogFile1.LogToFile(logTimeString+S.Strings[i]+' reSizeExistImgList='+BoolToStr(reSizeExistImgList.IndexOf(LoadFileGetMD5(ImageSavePath+CaseID+'\upload\'+S.Strings[i]))<>-1,true));
       if FWH_category='N' then
       begin
-        if ISExistImg(ImageSavePath+CaseID+'\upload\'+S.Strings[i]) then
+        if (ISExistImg(ImageSavePath+CaseID+'\upload\'+S.Strings[i]))
+        or  (reSizeExistImgList.IndexOf(LoadFileGetMD5(ImageSavePath+CaseID+'\upload\'+S.Strings[i]))<>-1)  then
         begin
           Continue;
         end;
@@ -11372,7 +11425,7 @@
 
         end;
 //ShowMessage('MainFormID='+MainFormID);
-LogFile1.LogToFile(logTimeString+' '+CaseID+' '+'MainFormID='+MainFormID);
+LogFile1.LogToFile(logTimeString+' '+FModeName+' '+CaseID+' '+'MainFormID='+MainFormID);
         if MainFormID = ''then
         begin
           //20131203 yuu說不檢查這個,先拿掉   20170315 楷琳說未歸類要擋  20170726 因此有檢查必要FormID  所以 可以拿掉
@@ -11526,6 +11579,7 @@
 LogFile1.LogToFile(logTimeString+'最大頁數B段 '+CaseID+' '+'OMRFileList.Text='+OMRFileList.Text);
         For i := 0 to OMRFileList.Count - 1 do
         begin
+          if FModeName='異動件' then Continue;
 
           if FWH_category='N' then
           begin

--
Gitblit v1.8.0