Index: ProScan/UI/PalletScherm.pas =================================================================== diff -u -r676 -r679 --- ProScan/UI/PalletScherm.pas (.../PalletScherm.pas) (revision 676) +++ ProScan/UI/PalletScherm.pas (.../PalletScherm.pas) (revision 679) @@ -20,8 +20,10 @@ procedure edtPalletKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure btnGenereerTbpClick(Sender: TObject); + procedure btnOnderdelenClick(Sender: TObject); procedure FormActivate(Sender: TObject); private + procedure ResetPopups; procedure SetContext; procedure SetModus(GescandeInput: string); function ValideerPalletCode(GescandeInput: string): boolean; @@ -50,20 +52,19 @@ 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 - if (UiContext.MoetTbpCodeGenereren = true) then - edtPallet.Text := '000000'; // Kleine hack om hieronder een foute statuscode te geven - 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 @@ -89,20 +90,11 @@ finally fZoekViaPalletCodeResponse.Free; end; - //popups resetten - UiContext.IsDirecteLeveringPopupGetoond := false; - UiContext.IsWegwerpPalletPopupGetoond := false; - UiContext.IsSSTPopupGetoond := false; - UiContext.IsExportPopupGetoond := false; - UiContext.IsBlumXsPopupGetoond := 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; @@ -116,7 +108,7 @@ result := false; if (UiContext.MoetTbpCodeGenereren) then begin - result := true; + result := true; end else begin fAgent := TAgent.Create(UiContext); fValideerPalletCodeResponse := fAgent.ValideerPalletCode(edtPallet.Text); @@ -136,6 +128,15 @@ end; end; +procedure TfmPalletScherm.ResetPopups; +begin + UiContext.IsDirecteLeveringPopupGetoond := false; + UiContext.IsWegwerpPalletPopupGetoond := false; + UiContext.IsSSTPopupGetoond := false; + UiContext.IsExportPopupGetoond := false; + UiContext.IsBlumXsPopupGetoond := false; + UiContext.InternVhossId := ''; +end; procedure TfmPalletScherm.btnGenereerTbpClick(Sender: TObject); begin @@ -146,6 +147,14 @@ actVolgendeExecute(Self); end; +procedure TfmPalletScherm.btnOnderdelenClick(Sender: TObject); +begin + inherited; + Self.ModalResult := mrOnderdelen; + PostMessage(Self.Handle,WM_Close,0,0); + (Self.Parent.Parent As TfmProScanHoofdscherm).NavigeerNaar(Self.ModalResult); +end; + procedure TfmPalletScherm.edtPalletKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin @@ -193,3 +202,4 @@ end; end. +