Index: ProScan/UI/PalletScherm.pas =================================================================== diff -u -r626 -r697 --- ProScan/UI/PalletScherm.pas (.../PalletScherm.pas) (revision 626) +++ ProScan/UI/PalletScherm.pas (.../PalletScherm.pas) (revision 697) @@ -3,7 +3,7 @@ interface uses - Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, System.IniFiles, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, DrieKnoppenScherm, Vcl.ActnList, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Imaging.pngimage; @@ -23,6 +23,7 @@ private procedure SetContext; procedure SetModus(GescandeInput: string); + procedure ResetPopups; function ValideerPalletCode(GescandeInput: string): boolean; public { Public declarations } @@ -34,7 +35,7 @@ implementation uses - DnaCodeService, UiContext, Agent, ProScanMain, StrUtils, CommonFunctions; + DnaCodeService, QRcodeNaarKenmerkenService, UiContext, Agent, ProScanMain, StrUtils, CommonFunctions; {$R *.dfm} @@ -49,23 +50,25 @@ var fZoekViaPalletCodeResponse: ZoekViaPalletCodeResponse; fZoekViaToeleveringResponse: ZoekViaToeleveringResponse; - fPalletGevalideerd: boolean; fAgent: TAgent; begin SetModus(edtPallet.Text); - fPalletGevalideerd := false; - if not (UiContext.Modus = modusKAD) then - fPalletGevalideerd := ValideerPalletCode(edtPallet.Text); - - //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 - fAgent := TAgent.Create(UiContext); + if (UiContext.MoetTbpCodeGenereren = true) then begin + ResetPopups; + Self.ModalResult := mrDnaCode; + end else if (UiContext.Modus = modusKAD) then begin + Self.ModalResult := mrDnaCode; + end else if (UiContext.Modus = modusVHOSS) then begin + Self.ModalResult := mrDnaCode; + end else if (ValideerPalletCode(edtPallet.Text) = true) then begin + 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; + SetContext; if fZoekViaPalletCodeResponse.MeerdereToeleveringenToegestaan then Self.ModalResult := mrBestaandePallet else @@ -77,28 +80,20 @@ fZoekViaToeleveringResponse := fAgent.ZoekViaToelevering(UiContext.Toelevering); if fZoekViaToeleveringResponse.AantalInToelevering = fZoekViaToeleveringResponse.AantalReedsGescand then UiContext.Toelevering := ''; + fZoekViaToeleveringResponse.Free; finally fAgent.Free; - fZoekViaToeleveringResponse.Free; end; Self.ModalResult := mrDnaCode; end; finally fZoekViaPalletCodeResponse.Free; end; - //popups resetten - UiContext.IsDirecteLeveringPopupGetoond := false; - UiContext.IsWegwerpPalletPopupGetoond := false; - UiContext.IsSSTPopupGetoond := false; - UiContext.IsExportPopupGetoond := false; - UiContext.InternVhossId := ''; - end else if (UiContext.Modus = modusKAD) then begin - Self.ModalResult := mrDnaCode; - end else if (UiContext.Modus = modusVHOSS) then begin - Self.ModalResult := mrDnaCode; + ResetPopups; end else begin Self.ModalResult := mrPallet; end; + PostMessage(Self.Handle,WM_Close,0,0); (Self.Parent.Parent As TfmProScanHoofdscherm).NavigeerNaar(Self.ModalResult); end; @@ -110,45 +105,47 @@ begin // pallet code valideren result := false; - fAgent := TAgent.Create(UiContext); - fValideerPalletCodeResponse := fAgent.ValideerPalletCode(edtPallet.Text); - fAgent.Free; - try - if fValideerPalletCodeResponse.Header.Status <> '200' then begin - Self.ModalResult := mrPallet; - ToonPopupScherm(fValideerPalletCodeResponse.Header.Omschrijving, 'Probeer opnieuw'); - edtPallet.Text := ''; - SetContext; - end else begin - result := true; + + if (UiContext.MoetTbpCodeGenereren) then begin + result := true; + end else begin + fAgent := TAgent.Create(UiContext); + fValideerPalletCodeResponse := fAgent.ValideerPalletCode(edtPallet.Text); + fAgent.Free; + try + if fValideerPalletCodeResponse.Header.Status <> '200' then begin + Self.ModalResult := mrPallet; + ToonPopupScherm(fValideerPalletCodeResponse.Header.Omschrijving, 'Probeer opnieuw'); + edtPallet.Text := ''; + SetContext; + end else begin + result := true; + end; + finally + fValideerPalletCodeResponse.Free; end; - finally - fValideerPalletCodeResponse.Free; end; end; +procedure TfmPalletScherm.ResetPopups; +begin + UiContext.IsDirecteLeveringPopupGetoond := false; + UiContext.IsWegwerpPalletPopupGetoond := false; + UiContext.IsSSTPopupGetoond := false; + UiContext.IsExportPopupGetoond := false; + UiContext.IsBlumXsPopupGetoond := false; + UiContext.IsKartonnenPalletPopupGetoond := false; + UiContext.InternVhossId := ''; +end; + + procedure TfmPalletScherm.btnGenereerTbpClick(Sender: TObject); -var - fGeefVolgendeTbpCodeResponse: GeefVolgendeTbpCodeResponse; - fAgent: TAgent; begin inherited; - fAgent := TAgent.Create(UiContext); - fGeefVolgendeTbpCodeResponse := fAgent.GeefVolgendeTbpCode(); - fAgent.Free; - try - if fGeefVolgendeTbpCodeResponse.Header.Status <> '200' then begin - Self.ModalResult := mrPallet; - ToonPopupScherm(fGeefVolgendeTbpCodeResponse.Header.Omschrijving, 'Probeer opnieuw'); - edtPallet.Text := ''; - end else begin - edtPallet.Text := fGeefVolgendeTbpCodeResponse.VolgendeTbpCode; - UiContext.Toelevering := ''; - end; - SetContext; - finally - fGeefVolgendeTbpCodeResponse.Free; - end; + edtPallet.Text := ''; + UiContext.Toelevering := ''; + UiContext.Pallet := ''; + UiContext.MoetTbpCodeGenereren := true; actVolgendeExecute(Self); end; @@ -176,6 +173,7 @@ btnRechtsOnder.Action := actVolgende; edtPallet.Text := ''; edtPallet.SetFocus; + UiContext.MoetTbpCodeGenereren := false; SetContext; inherited; end;