doom4ster
2017-05-10 d825d5f9944e6635747ae8817b73016d82832836
CB_IMGPSScanImp.pas
@@ -650,6 +650,7 @@
    Procedure CreateIn_WH(CaseID:String);  //產生In_WH.dat
    Function CreateDocNo_Info(CaseID:String):String; //產生保管袋文件 DocNo[tab]份數[tab]總頁數[tab]是否異動[換行]DocNo[tab]份數[tab]總頁數[tab]是否異動
    Function CreateCustDocNo_Info(CaseID:String):String; //產生自訂文件 DocName[tab]份數[tab]總頁數[tab]是否異動[#13#10]DocName[tab]份數[tab]總頁數[tab]是否異動
    //Function CreateCustDocNo_Info(path,CaseID:String):String; overload
    Function CreateAttach_Info(CaseID:String):String; //產生是否有Attach Y:有 N:沒有
    Function CreateDocnoFrom_Info(CaseID:String):String; //產生被引進的保管袋文件資訊  Docno[tab]份數[tab]案件編號#13#10Docno[tab]份數[tab]案件編號
    Function CreateCustDocNoFrom_Info(CaseID:String):String; //產生被引進的自定文件資訊  Docno[tab]份數[tab]案件編號#13#10Docno[tab]份數[tab]案件編號
@@ -2509,10 +2510,36 @@
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');
    NewScanBtnClick(self)
  end
  Else
  begin
//ShowMessage('AddScanBtnclick');
    AddScanBtnclick(self);
  end;
end;
procedure TCB_IMGPSScanX.PM104Click(Sender: TObject);
@@ -3612,7 +3639,7 @@
  //Showmessage(CreateDocnoFrom_Info(NowCaseno));
  //Showmessage(self.CreateCustDocNoFrom_Info(NowCaseno));
        initkscan;
   showmessage('FUrl='+FUrl+#10#13+
   'FCaseID='+FCaseID+#10#13+
   'FMode='+FMode+#10#13+
@@ -3995,14 +4022,17 @@
          end;
          if (FormID <> '') and ISGuideFormID(FormID) then
          begin
            NowGuideFormID := FormID;
          end;
//ShowMessage('NowGuideFormID='+NowGuideFormID);
          if (not (FindDivFormCode(FormID))) and (NowGuideFormID <> '') {and (FormID = '')} then
            FormID := NowGuideFormID;
          DocNo := FormCode2DocNo(FormID);
          if (FormID <>'') and FindDivFormCode(FormID) Then  //只找分案頁上的案件條碼
//ShowMessage('FormID='+FormID);
          if (FormID <>'') and FindDivFormCode(FormID) and (NowGuideFormID <> '')  Then  //只找分案頁上的案件條碼
          begin
            ScanInfo.ImageCount := 0;
            ClearView(1);
            ContextList.Clear;
@@ -4010,6 +4040,7 @@
            ClearCaseIndex;                //清掉案件索引
            ScanCaseno := BarCode2CaseID; //取出案件編號
            NowGuideFormID := '';
//ShowMessage('NowGuideFormID='+NowGuideFormID+#10#13+'FormID='+FormID+#10#13+'ScanCaseno='+ScanCaseno);
          end;
          if ScanCaseno = '' then //一開始都沒找到
          begin
@@ -4029,7 +4060,8 @@
          Str2Dir(ScanPath);
          ScanDocDir := FindLastestDocDir(ScanCaseno,DocNo);
          if DocNoNeedDiv(DocNo) then   //要分份數
          if DocNoNeedDiv(DocNo)then   //要分份數
          begin
            //Showmessage(DocNo+#13+FormCode2Page(FormID)+#13+inttostr(GetDocDir_Page(ScanCaseno,ScanDocDir))+#13+ScanDocDir);
            if ((FormCode2Page(FormID) = '01') and (GetDocDir_Page(ScanCaseno,ScanDocDir)>0))  or (ScanDocDir = '') then
@@ -4098,19 +4130,22 @@
      begin
        ScanSaveFilename := '';
        FormID := BarCode2FormID; //取出FormID
        if (FormID <> '') and ISGuideFormID(FormID) then
          NowGuideFormID := FormID;
        //Showmessage('A:'+FormID+#13+'B:'+NowGuideFormID);
        if (NowGuideFormID <> '') {and (FormID = '')} then
          FormID := NowGuideFormID;
//        if (FormID <> '') and ISGuideFormID(FormID) then   //20170510 註解 因為DSCAN 會全擠在導引頁下
//          NowGuideFormID := FormID;
//        if (NowGuideFormID <> '') {and (FormID = '')} then  //20170510 註解  因為DSCAN 會全擠在導引頁下
//          FormID := NowGuideFormID;
        DocNo := FormCode2DocNo(FormID);
        ScanDocDir := FindLastestDocDir(ScanCaseno,DocNo);
        if DocNoNeedDiv(DocNo) then   //要分份數
//ShowMessage('ScanDocDir='+ScanDocDir);
        if (DocNoNeedDiv(DocNo)) then   //要分份數
        begin
          if ((FormCode2Page(FormID) = '01') and (GetDocDir_Page(ScanCaseno,ScanDocDir)>0)) or (ScanDocDir = '') then
          if TreeView1.Selected = MyTreeNode1 then   //20170421 掃瞄插頁時選則在案號上才要分份數 選在FormID上就不分份數
          begin
            ScanInfo.ImageCount := 0;
            ScanDocDir := DocNo2DocNoDir(ImageSavePath + ScanCaseno+'\',DocNo);
            if ((FormCode2Page(FormID) = '01') and (GetDocDir_Page(ScanCaseno,ScanDocDir)>0)) or (ScanDocDir = '') then
            begin
              ScanInfo.ImageCount := 0;
              ScanDocDir := DocNo2DocNoDir(ImageSavePath + ScanCaseno+'\',DocNo);
            end;
          end;
        end
        Else        //不分份數
@@ -5485,6 +5520,7 @@
  last_add_formidstr :string;
  casepath:String;
  filesizeInt:integer;
  case_page:string;
begin
  Result := True;
  TransName := CaseID;
@@ -5496,7 +5532,9 @@
  end;
  if FileExists(Path+'CustomDocNo.dat') then
    Cust_DocNoList.LoadFromFile(Path+'CustomDocNo.dat');
  Pages := ContextList.Count;
  case_page:=IntToStr(pages);
  if (FMode = 'NSCAN') or (FMode = 'ESCAN') or (FMode = 'ASCAN') or (FMode = 'DSCAN') or (FMode = 'SSCAN') or (FMode = 'MSCAN') or (FMode = 'RI_SCAN') or (FMode = 'RSCAN')  then
  begin
    //Showmessage('1');
@@ -5613,12 +5651,15 @@
  +'&doc_data='+HTTPEncode(UTF8Encode(Doc_Data))
  +'&doc_data1='+HTTPEncode(UTF8Encode(Doc_Data1))
  +'&attach='+AttachYN
  +'&case_page='+case_page
  +'&file_size='+IntToStr(filesizeInt)
  +'&must_formid='+must_formidStr  //擁有的 formid
  +'&last_add_formid='+last_add_formidstr   //當次新加的 formid
  +'&in_doc1='+HTTPEncode(UTF8Encode(In_Doc1))
  +'&in_doc2='+HTTPEncode(UTF8Encode(In_Doc2));
//ShowMessage('SendData='+SendData);
//ShowMessage(FData+#10#13+Doc_Data);
//exit;
  if not upFile(HTTPSClient,FUrl,'service/imgpsc/IMGPSC02/caseupload',SendData,'file',Path+'Img.zip',FReWrite,Memo1,False) then
  begin
@@ -11933,6 +11974,10 @@
  for I := 0 to ContextList.Count - 1 do
  begin
    FileFormID := FileName2FormCode(ContextList.Strings[i]);
    if FileFormID=GuideFormIDList.Strings[0] then //20170509 跳過導引頁的formid
    begin
      Continue;
    end;
    if FindDivFormCode(FileFormID) then
    begin
      Result := FileFormID;
@@ -12113,6 +12158,7 @@
    Str := '';
    if Not FileExists(ImageSavePath+CaseID+'\CaseDocNo.dat') then Exit;
    DocDirList.LoadFromFile(ImageSavePath+CaseID+'\CaseDocNo.dat');
//ShowMessage(DocDirList.Text);
    while DocDirList.Count > 0 do
    begin
      iDocDir := DocDirList.Strings[0];
@@ -12656,9 +12702,11 @@
var
  SendData : String;
begin
//Memo1.Clear;
  SendData := 'data='+HTTPEncode(UTF8Encode(FData))+'&verify='+FVerify+'&case_no='+CaseID+'&work_no='+FWork_no;
  if (FMode = 'NSCAN') then
  if (FMode = 'NSCAN') or (FMode = 'DSCAN') then
  begin
//ShowMessage('JJJJJ');
    If not ProcessServlet_Get(HTTPSClient,FURL+'service/imgpsc/IMGPSC05/isnew',SendData,FReWrite,Memo1,False) Then
    begin
      HttpErrStr := _Msg('錯誤代碼:')+inttostr(HttpError.HttpErrorCode)+','+HttpError.HttpReason;
@@ -12666,7 +12714,8 @@
      Exit;
    end;
  end;
//ShowMessage(SendData);
//ShowMessage(Memo1.Lines.Text);
  IF memo1.Lines.Strings[0] <> '0' Then
  begin
    HttpErrStr := _Msg('錯誤原因:')+memo1.Lines.Strings[1];
@@ -13264,6 +13313,7 @@
  DataLoading(False,False);
//ShowMessage('初始話執行完成');
//ShowMessage(GuideFormIDList.Text);
end;
procedure TCB_IMGPSScanX.Timer2Timer(Sender: TObject);
@@ -13346,7 +13396,7 @@
      s.Free;
      end;
    end;}
    if (FMode = 'NSCAN') then
    if (FMode = 'NSCAN') or (FMode = 'DSCAN')  then //20170406 待掃瞄也要問一下
    begin
      /////訊問是否可上傳/////
      CaseTrans := CaseAsk(CaseID);