--- dao/DelphiScanner/Main.pas 2015/12/04 14:07:48 2790 +++ dao/DelphiScanner/Main.pas 2015/12/04 15:39:20 2791 @@ -25,7 +25,8 @@ ParentForm, LabelPrint, Configuration, - Vcl.Imaging.pngimage + Vcl.Imaging.pngimage, + Generics.Collections ; @@ -104,6 +105,7 @@ PanelManglendePakker5: TPanel; PanelManglendePakker6: TPanel; menuIndlevering: TMenuItem; + chkForstorTilDirekte: TCheckBox; @@ -3086,6 +3088,10 @@ BtnEKLoverforsel.Enabled := true; InitLillePakke(); ListBox1.Items.Clear; + + chkForstorTilDirekte.Checked := false; + chkForstorTilDirekte.Enabled := false; + if BladhusSted = 0 then begin IndlesScanningLogFil(); @@ -3117,6 +3123,10 @@ ListBox1.Items.Clear; ListBox2.Items.Clear; BtnEKLoverforsel.Enabled := false; + + chkForstorTilDirekte.Checked := false; + chkForstorTilDirekte.Enabled := false; + InitLillePakke(); end; @@ -3143,6 +3153,10 @@ ListBox1.Items.Clear; ListBox2.Items.Clear; BtnEKLoverforsel.Enabled := false; + + chkForstorTilDirekte.Checked := false; + chkForstorTilDirekte.Enabled := false; + InitLillePakke(); end; @@ -3174,6 +3188,10 @@ BtnEKLoverforsel.Enabled := false; IdFTP1.Passive := true; IdFTP1.PassiveUseControlHost := true; + + chkForstorTilDirekte.Checked := false; + chkForstorTilDirekte.Enabled := true; + if (BladhusSted = 0) or (BladhusSted = 2) or (BladhusSted = 3) then begin IndlesScanningLogFil(); @@ -3209,6 +3227,9 @@ BtnEKLoverforsel.Enabled := true; + chkForstorTilDirekte.Checked := false; + chkForstorTilDirekte.Enabled := true; + InitLillePakke(); IndlesScanningLogFil(); if BladhusSted = 0 then @@ -3244,6 +3265,11 @@ BtnDownloadKontrolfil.Enabled := false; BtnOpdaterListen.Enabled := true; BtnEKLoverforsel.Enabled := false; + + chkForstorTilDirekte.Checked := false; + chkForstorTilDirekte.Enabled := false; + + InitLillePakke(); IndlesScanningLogFil(); if BladhusSted = 0 then @@ -3291,6 +3317,11 @@ BtnDownloadKontrolfil.Enabled := false; BtnOpdaterListen.Enabled := true; BtnEKLoverforsel.Enabled := false; + + chkForstorTilDirekte.Checked := false; + chkForstorTilDirekte.Enabled := false; + + InitLillePakke(); IndlesScanningLogFil(); if BladhusSted = 0 then @@ -4034,7 +4065,12 @@ stregkode, modtagernavn, modtageradresse, kommentar : string; pakketype, tjekkodestatus : String; pakketypeix, antalLiniefelter, antalFelterFundet, linienr : Integer; - pakketyper : TStrings; + //pakketyper : TStrings; + pakketyper : TDictionary; + tmpAntal : Integer; + + + antlin : Integer; antlinIdag, antlinSenere : Integer; @@ -4042,8 +4078,10 @@ XmlFelter : TStrings; begin + + XmlFelter := TStringList.Create; - pakketyper := TStringList.Create; + pakketyper := TDictionary.Create; linienr := 0; ListBox2.Clear; ListBox1.Items.Insert(0,TimeToStr(now) + ': ' + 'Henter oversigt over pakker der endnu ikke er modtaget'); @@ -4058,6 +4096,8 @@ StedKode := Sted; end; + Application.Processmessages; //Ugly Hack to improve User Experience when switching modes + if (Scanningtype = '7') then @@ -4144,6 +4184,9 @@ SetLength(stregkoderMedTjekkodeArray, 0); // reset fra tidligere brug SetLength(stregkoderMedTjekkodeArray, antlin); // sæt antal elementer i array + + Application.Processmessages; //Ugly Hack to improve User Experience when switching modes + logTekst := 'Der er ' + IntToStr(antlin) + ' pakker, der endnu ikke er modtaget'; if (antlinSenere > 0) then begin @@ -4179,10 +4222,13 @@ if not VarIsNull(Node.NodeValue) then pakketype := Node.NodeValue; antalFelterFundet := antalFelterFundet + 1; - if (pakketyper.values[pakketype] <> '') then - pakketyper.values[pakketype] := IntToStr(StrToInt(pakketyper.values[pakketype]) + 1) + if ( pakketyper.ContainsKey(pakketype) ) then + begin + pakketyper.TryGetValue(pakketype, tmpAntal); + pakketyper.AddOrSetValue(pakketype, tmpAntal + 1); + end else - pakketyper.values[pakketype] := '1'; + pakketyper.Add(pakketype, 1); end; if Node.NodeName = 'TjekkodeStatus' then begin if not VarIsNull(Node.NodeValue) then @@ -4217,13 +4263,19 @@ end; end; end; - for pakketypeix := 0 to pakketyper.Count-1 do - begin - ListBox1.Items.Insert(0,TimeToStr(now) + ': ' + ' '+pakketyper[pakketypeix]+' pakke(r) ikke modtaget'); - end; - // Free up the list object + + for pakketype in pakketyper.Keys do + begin + pakketyper.TryGetValue(pakketype, tmpAntal); + ListBox1.Items.Insert(0,TimeToStr(now) + ': ' + pakketype + ' ' + IntToStr(tmpAntal) + ' pakke(r) ikke modtaget'); + end; + + // Free up the dictionary object pakketyper.Free; + + + // ListBox1.Items.Insert(0,TimeToStr(now) + ': ' + 'Der er '+IntToStr(antlin)+' pakker, der endnu ikke er modtaget.'); logTekst := 'Der er ' + IntToStr(antlin) + ' pakker, der endnu ikke er modtaget'; if (antlinSenere > 0) then