Index: ProScan/UI/PalletScherm.pas =================================================================== diff -u -r436 -r474 --- ProScan/UI/PalletScherm.pas (.../PalletScherm.pas) (revision 436) +++ ProScan/UI/PalletScherm.pas (.../PalletScherm.pas) (revision 474) @@ -50,6 +50,7 @@ fZoekViaPalletCodeResponse: ZoekViaPalletCodeResponse; fZoekViaToeleveringResponse: ZoekViaToeleveringResponse; fPalletGevalideerd: boolean; + fAgent: TAgent; begin SetModus(edtPallet.Text); @@ -59,7 +60,9 @@ //checken of pallet in gebruik is indien het vorige geslaagd is if fPalletGevalideerd and not(UiContext.Modus = modusKAD) and not(UiContext.Modus = modusVHOSS ) then begin - fZoekViaPalletCodeResponse := TAgent.Create(UiContext).ZoekViaPalletCode(edtPallet.Text); + fAgent := TAgent.Create(UiContext); + fZoekViaPalletCodeResponse := fAgent.ZoekViaPalletCode(edtPallet.Text); + fAgent.Free; try if fZoekViaPalletCodeResponse.Header.Status = '200' then begin UiContext.Toelevering := fZoekViaPalletCodeResponse.DnaCodes[0].Toelevering; @@ -69,7 +72,9 @@ Self.ModalResult := mrDnaCode; end else begin //enkel leegmaken indien de huidige toelevering al compleet is - fZoekViaToeleveringResponse := TAgent.Create(UiContext).ZoekViaToelevering(UiContext.Toelevering); + fAgent := TAgent.Create(UiContext); + fZoekViaToeleveringResponse := fAgent.ZoekViaToelevering(UiContext.Toelevering); + fAgent.Free; if fZoekViaToeleveringResponse.AantalInToelevering = fZoekViaToeleveringResponse.AantalReedsGescand then UiContext.Toelevering := ''; Self.ModalResult := mrDnaCode; @@ -96,10 +101,13 @@ function TfmPalletScherm.ValideerPalletCode(GescandeInput: string): boolean; var fValideerPalletCodeResponse: ValideerPalletCodeResponse; + fAgent: TAgent; begin // pallet code valideren result := false; - fValideerPalletCodeResponse := TAgent.Create(UiContext).ValideerPalletCode(edtPallet.Text); + fAgent := TAgent.Create(UiContext); + fValideerPalletCodeResponse := fAgent.ValideerPalletCode(edtPallet.Text); + fAgent.Free; try if fValideerPalletCodeResponse.Header.Status <> '200' then begin Self.ModalResult := mrPallet; @@ -117,9 +125,12 @@ procedure TfmPalletScherm.btnGenereerTbpClick(Sender: TObject); var fGeefVolgendeTbpCodeResponse: GeefVolgendeTbpCodeResponse; + fAgent: TAgent; begin inherited; - fGeefVolgendeTbpCodeResponse := TAgent.Create(UiContext).GeefVolgendeTbpCode(); + fAgent := TAgent.Create(UiContext); + fGeefVolgendeTbpCodeResponse := fAgent.GeefVolgendeTbpCode(); + fAgent.Free; try if fGeefVolgendeTbpCodeResponse.Header.Status <> '200' then begin Self.ModalResult := mrPallet;