Index: AAPClient/UI/DnaCodeScherm.pas =================================================================== diff -u -r382 -r386 --- AAPClient/UI/DnaCodeScherm.pas (.../DnaCodeScherm.pas) (revision 382) +++ AAPClient/UI/DnaCodeScherm.pas (.../DnaCodeScherm.pas) (revision 386) @@ -37,6 +37,7 @@ procedure MeldDnaCodeAf(); procedure ZetToeleveringStatus(Status: DnaCodeStatus; isDirecteLevering: boolean = false); procedure ToeleveringDataOphalen(); + procedure VhossDataOphalen(); procedure VerwerkMogelijkePopups(EersteDnaCode: DnaCode); function BepaalAantalLadesOpHuidigePallet: integer; function BepaalDirecteLevering: boolean; @@ -85,11 +86,16 @@ fImagesScherm.ilAlgemeen64.GetIcon(10, imgLaatstGescand.Picture.Icon); fImagesScherm.ilAlgemeen32.GetIcon(4, imgWegwerpPallet.Picture.Icon); fImagesScherm.ilAlgemeen32.GetIcon(3, imgDirecteLevering.Picture.Icon); - if not (UiContext.Toelevering = '') then - ToeleveringDataOphalen() - else begin - imgDirecteLevering.Visible := false; - imgWegwerpPallet.Visible := false; + + if UiContext.Modus = modusVHOSS then begin + VhossDataOphalen(); + end else begin + if (not (UiContext.Toelevering = '')) then + ToeleveringDataOphalen() + else begin + imgDirecteLevering.Visible := false; + imgWegwerpPallet.Visible := false; + end; end; ZetIcoontjesBovenaan; edtDnaCode.SetFocus; @@ -177,19 +183,33 @@ function TfmDnaCodeScherm.BepaalAantalLadesOpHuidigePallet: integer; var fZoekViaPalletCodeResponse: ZoekViaPalletCodeResponse; + fZoekAlleVhossLadesBijDnaCodeResponse: ZoekAlleVhossLadesBijDnaCodeResponse; begin result := 0; - - fZoekViaPalletCodeResponse := TAgent.Create(UiContext).ZoekViaPalletCode(UiContext.Pallet); //todo: enkel recente dingen - try - if fZoekViaPalletCodeResponse.Header.Status = '200' then begin - result := length(fZoekViaPalletCodeResponse.DnaCodes); - end else begin - ToonPopupScherm(fZoekViaPalletCodeResponse.Header.Omschrijving, 'Probeer opnieuw'); - result := 0 + if StartsText('O1',UiContext.Pallet) then begin + fZoekAlleVhossLadesBijDnaCodeResponse := TAgent.Create(UiContext).ZoekAlleVhossLadesBijDnaCode(UiContext.Pallet); + try + if fZoekAlleVhossLadesBijDnaCodeResponse.Header.Status = '200' then begin + result := length(fZoekAlleVhossLadesBijDnaCodeResponse.DnaCodes); + end else begin + ToonPopupScherm(fZoekAlleVhossLadesBijDnaCodeResponse.Header.Omschrijving, 'Probeer opnieuw'); + result := 0 + end; + finally + fZoekAlleVhossLadesBijDnaCodeResponse.Free; end; - finally - fZoekViaPalletCodeResponse.Free; + end else begin + fZoekViaPalletCodeResponse := TAgent.Create(UiContext).ZoekViaPalletCode(UiContext.Pallet); + try + if fZoekViaPalletCodeResponse.Header.Status = '200' then begin + result := length(fZoekViaPalletCodeResponse.DnaCodes); + end else begin + ToonPopupScherm(fZoekViaPalletCodeResponse.Header.Omschrijving, 'Probeer opnieuw'); + result := 0 + end; + finally + fZoekViaPalletCodeResponse.Free; + end; end; end; @@ -327,6 +347,43 @@ end; end; +procedure TfmDnaCodeScherm.VhossDataOphalen; +var + fZoekAlleVhossLadesBijDnaCodeResponse: ZoekAlleVhossLadesBijDnaCodeResponse; + fDnaCodeTeller: integer; + fAantalGescand: integer; +begin + if UiContext.LaatsteDnaCode = '' then + exit; + + fZoekAlleVhossLadesBijDnaCodeResponse := TAgent.Create(UiContext).ZoekAlleVhossLadesBijDnaCode(UiContext.LaatsteDnaCode); + try + if fZoekAlleVhossLadesBijDnaCodeResponse.Header.Status <> '200' then begin + ToonPopupScherm(fZoekAlleVhossLadesBijDnaCodeResponse.Header.Omschrijving, 'Probeer opnieuw') + end else begin + fDnaCodeTeller := 0; + fAantalGescand := 0; + while fDnaCodeTeller < length(fZoekAlleVhossLadesBijDnaCodeResponse.DnaCodes) do begin + if not (fZoekAlleVhossLadesBijDnaCodeResponse.DnaCodes[fDnaCodeTeller].ScanTijdstip = nil) then + fAantalGescand := fAantalGescand + 1; + + if fZoekAlleVhossLadesBijDnaCodeResponse.DnaCodes[fDnaCodeTeller].DnaCode = UiContext.LaatsteDnaCode then + UiContext.Toelevering := fZoekAlleVhossLadesBijDnaCodeResponse.DnaCodes[fDnaCodeTeller].Toelevering; + + fDnaCodeTeller := fDnaCodeTeller + 1; + end; + + lblAantalGescand.Caption := IntToStr(fAantalGescand); + lblTotaalAantal.Caption := IntToStr(length(fZoekAlleVhossLadesBijDnaCodeResponse.DnaCodes)); + btnInfo.Visible := true; + ZetIcoontjesBovenaan; + Self.ModalResult := mrDnaCode; + end; + finally + fZoekAlleVhossLadesBijDnaCodeResponse.Free; + end; +end; + procedure TfmDnaCodeScherm.VerwerkMogelijkePopups(EersteDnaCode: DnaCode); begin if UiContext.Modus = modusDefault then begin