Index: ProScan/UI/DnaCodeSchermVoorOnderdelen.dfm =================================================================== diff -u --- ProScan/UI/DnaCodeSchermVoorOnderdelen.dfm (revision 0) +++ ProScan/UI/DnaCodeSchermVoorOnderdelen.dfm (revision 680) @@ -0,0 +1,193 @@ +inherited fmDnaCodeSchermVoorOnderdelen: TfmDnaCodeSchermVoorOnderdelen + Caption = 'fmDnaCodeSchermVoorOnderdelen' + OnActivate = FormActivate + ExplicitWidth = 480 + ExplicitHeight = 640 + PixelsPerInch = 96 + TextHeight = 19 + object lblToeleveringData: TLabel [0] + Left = 8 + Top = 135 + Width = 147 + Height = 39 + Alignment = taCenter + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -27 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + end + object lblScancode: TLabel [1] + Left = 108 + Top = 40 + Width = 109 + Height = 19 + Caption = 'Scan DNA code' + end + object lblHuidigePalletData: TLabel [2] + Left = 153 + Top = 135 + Width = 165 + Height = 39 + Alignment = taCenter + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -27 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + end + object lblLaatstGescandData: TLabel [3] + Left = 315 + Top = 135 + Width = 147 + Height = 39 + Alignment = taCenter + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -27 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + end + object lblAantalGescand: TLabel [4] + Left = 8 + Top = 212 + Width = 58 + Height = 39 + Alignment = taRightJustify + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -32 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + end + object lblTotaalAantal: TLabel [5] + Left = 90 + Top = 212 + Width = 63 + Height = 39 + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -32 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + end + object lblSlash: TLabel [6] + Left = 72 + Top = 212 + Width = 12 + Height = 39 + AutoSize = False + Caption = '/' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -32 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + end + object imgDirecteLevering: TImage [7] + Left = 311 + Top = 219 + Width = 32 + Height = 32 + Visible = False + end + object lblScanPallet: TLabel [8] + Left = 121 + Top = 296 + Width = 252 + Height = 39 + Caption = 'Onderdelen pallet' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -32 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + end + object imgWegwerpPallet: TImage [9] + Left = 349 + Top = 219 + Width = 32 + Height = 32 + Visible = False + end + object imgToelevering: TImage [10] + Left = 48 + Top = 65 + Width = 64 + Height = 64 + end + object imgPallet: TImage [11] + Left = 201 + Top = 65 + Width = 64 + Height = 64 + end + object imgLaatstGescand: TImage [12] + Left = 355 + Top = 65 + Width = 64 + Height = 64 + end + object imgExport: TImage [13] + Left = 387 + Top = 219 + Width = 32 + Height = 32 + Visible = False + end + object lblAantalOpPallet: TLabel [14] + Left = 184 + Top = 180 + Width = 100 + Height = 85 + Alignment = taCenter + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -80 + Font.Name = 'Tahoma' + Font.Style = [fsBold] + ParentFont = False + end + object imgBlumXs: TImage [15] + Left = 425 + Top = 219 + Width = 32 + Height = 32 + Visible = False + end + object btnInfo: TButton [18] + Left = 68 + Top = 408 + Width = 345 + Height = 81 + Caption = 'Meer info' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -32 + Font.Name = 'Tahoma' + Font.Style = [] + ImageIndex = 1 + Images = ImagesScherm.ilAlgemeen64 + ParentFont = False + TabOrder = 2 + OnClick = btnInfoClick + end + inherited alAlgemeen: TActionList + inherited actPallet: TAction + OnExecute = actPalletExecute + end + end +end Index: ProScan/UI/DnaCodeSchermVoorOnderdelen.pas =================================================================== diff -u --- ProScan/UI/DnaCodeSchermVoorOnderdelen.pas (revision 0) +++ ProScan/UI/DnaCodeSchermVoorOnderdelen.pas (revision 680) @@ -0,0 +1,300 @@ +unit DnaCodeSchermVoorOnderdelen; + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, DrieKnoppenScherm, Vcl.ActnList, + Vcl.StdCtrls, DnaCodeService, AfdrukService, Vcl.ExtCtrls, Images, Vcl.Imaging.pngimage, System.StrUtils; + +type + TfmDnaCodeSchermVoorOnderdelen = class(TfmDrieKnoppenScherm) + lblToeleveringData: TLabel; + lblScancode: TLabel; + lblHuidigePalletData: TLabel; + lblLaatstGescandData: TLabel; + lblAantalGescand: TLabel; + lblTotaalAantal: TLabel; + lblSlash: TLabel; + imgDirecteLevering: TImage; + lblScanPallet: TLabel; + imgWegwerpPallet: TImage; + btnInfo: TButton; + imgToelevering: TImage; + imgPallet: TImage; + imgLaatstGescand: TImage; + imgExport: TImage; + imgBlumXs: TImage; + lblAantalOpPallet: TLabel; + procedure FormShow(Sender: TObject); + procedure actPalletExecute(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure btnInfoClick(Sender: TObject); + procedure FormActivate(Sender: TObject); + private + fImagesScherm: TImagesScherm; + procedure ToeleveringDataOphalen(); + function BepaalAantalLadesOpHuidigePallet: integer; + procedure ZetIcoontjesBovenaan; + procedure ZetInfoIcoontjeZichtbaar; + procedure DrukProboxEtiketAfIndienNodig; + function GeefAantalOpPallet(Palletcode: String): integer; + public + end; + +var + fmDnaCodeSchermVoorOnderdelen: TfmDnaCodeSchermVoorOnderdelen; + +implementation + +uses + UiContext, Agent, CommonFunctions, ProScanMain, Datasnap.DBClient, Data.DB, + OnvolledigeToeleveringScherm; + +{$R *.dfm} + +procedure TfmDnaCodeSchermVoorOnderdelen.FormActivate(Sender: TObject); +begin + inherited; + ActiveControl := edtDnaCode; +end; + +procedure TfmDnaCodeSchermVoorOnderdelen.FormCreate(Sender: TObject); +begin + inherited; + fImagesScherm := TImagesScherm.Create(self); +end; + +procedure TfmDnaCodeSchermVoorOnderdelen.FormShow(Sender: TObject); +begin + btnLinksOnder.Action := actPallet; + btnRechtsOnder.Action := actAfronden; + edtDnaCode.Text := ''; + lblHuidigePalletData.Caption := UiContext.Pallet; + lblToeleveringData.Caption := UiContext.Toelevering; + lblAantalGescand.Caption := ''; + lblTotaalAantal.Caption := ''; + lblAantalOpPallet.Caption := IntToStr(GeefAantalOpPallet(UiContext.Pallet)); + btnInfo.Visible := false; + fImagesScherm.ilAlgemeen64.GetIcon(8, imgToelevering.Picture.Icon); + fImagesScherm.ilAlgemeen64.GetIcon(9, imgPallet.Picture.Icon); + fImagesScherm.ilAlgemeen64.GetIcon(10, imgLaatstGescand.Picture.Icon); + fImagesScherm.ilAlgemeen32.GetIcon(5, imgWegwerpPallet.Picture.Icon); + fImagesScherm.ilAlgemeen32.GetIcon(3, imgDirecteLevering.Picture.Icon); + fImagesScherm.ilAlgemeen32.GetIcon(4, imgExport.Picture.Icon); + fImagesScherm.ilAlgemeen32.GetIcon(6, imgBlumXs.Picture.Icon); + + if (not (UiContext.Toelevering = '')) then + ToeleveringDataOphalen() + else begin + imgDirecteLevering.Visible := false; + imgWegwerpPallet.Visible := false; + imgExport.Visible := false; + imgBlumXs.Visible := false; + end; + ZetIcoontjesBovenaan; + edtDnaCode.SetFocus; + inherited; +end; + +procedure TfmDnaCodeSchermVoorOnderdelen.actPalletExecute(Sender: TObject); +var + fAantalLadesOpHuidigePallet: integer; + fIsDirecteLevering: boolean; +begin + inherited; + Self.ModalResult := mrPallet; + + PostMessage(Self.Handle,WM_Close,0,0); + (Self.Parent.Parent As TfmProScanHoofdscherm).NavigeerNaar(Self.ModalResult); +end; + +function TfmDnaCodeSchermVoorOnderdelen.BepaalAantalLadesOpHuidigePallet: integer; +var + fZoekViaPalletCodeResponse: ZoekViaPalletCodeResponse; + fZoekAlleVhossLadesBijDnaCodeResponse: ZoekAlleVhossLadesBijDnaCodeResponse; + fAgent: TAgent; +begin + result := 0; + if UiContext.LaatsteDnaCode = '' then + exit; + + if UiContext.Pallet = '' then begin + result := 0; + end else if StartsText('O1',UiContext.Pallet) then begin + fAgent := TAgent.Create(UiContext); + fZoekAlleVhossLadesBijDnaCodeResponse := fAgent.ZoekAlleVhossLadesBijDnaCode(UiContext.LaatsteDnaCode); + fAgent.Free; + 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; + end else begin + fAgent := TAgent.Create(UiContext); + fZoekViaPalletCodeResponse := fAgent.ZoekViaPalletCode(UiContext.Pallet); + fAgent.Free; + 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; + +procedure TfmDnaCodeSchermVoorOnderdelen.btnInfoClick(Sender: TObject); +begin + inherited; + if UiContext.Modus = modusVHOSS then begin + UiContext.InfoLogSchermToonGescand := true; + Self.ModalResult := mrInfoLog; + end else begin + if UiContext.Toelevering = '' then + Self.ModalResult := mrDnaCode + else begin + UiContext.InfoLogSchermToonGescand := true; + Self.ModalResult := mrInfoLog; + end; + end; + PostMessage(Self.Handle,WM_Close,0,0); + (Self.Parent.Parent As TfmProScanHoofdscherm).NavigeerNaar(Self.ModalResult); +end; + +procedure TfmDnaCodeSchermVoorOnderdelen.ToeleveringDataOphalen; +var + Response: ZoekViaToeleveringResponse; + fAgent: TAgent; +begin + fAgent := TAgent.Create(UiContext); + Response := fAgent.ZoekViaToelevering(UiContext.Toelevering); + fAgent.Free; + try + if Response.Header.Status <> '200' then begin + ToonPopupScherm(Response.Header.Omschrijving, 'Probeer opnieuw') + end else begin + UiContext.Toelevering := Response.DnaCodes[0].Toelevering; + lblAantalGescand.Caption := IntToStr(Response.AantalReedsGescand); + lblTotaalAantal.Caption := IntToStr(Response.AantalInToelevering); + ZetInfoIcoontjeZichtbaar; + ZetIcoontjesBovenaan; + // VerwerkMogelijkePopups(Response.DnaCodes, UiContext.Toelevering); + Self.ModalResult := mrDnaCode; + end; + finally + Response.Free; + end; +end; + +procedure TfmDnaCodeSchermVoorOnderdelen.ZetIcoontjesBovenaan; +begin + if UiContext.Pallet = '' then begin + lblHuidigePalletData.Caption := ''; + imgPallet.Visible := false; + end else begin + lblHuidigePalletData.Caption := UiContext.Pallet; + imgPallet.Visible := true; + end; + if UiContext.Toelevering = '' then begin + lblToeleveringData.Caption := ''; + imgToelevering.Visible := false; + end else begin + lblToeleveringData.Caption := UiContext.Toelevering; + imgToelevering.Visible := true; + end; + if UiContext.LaatsteDnaCode = '' then begin + lblLaatstGescandData.Caption := ''; + imgLaatstGescand.Visible := false; + end else begin + lblLaatstGescandData.Caption := Copy(UiContext.LaatsteDnaCode,5,3); + imgLaatstGescand.Visible := true; + end; +end; + +procedure TfmDnaCodeSchermVoorOnderdelen.ZetInfoIcoontjeZichtbaar; +begin + if (UiContext.Modus = modusVHOSS) and (UiContext.Pallet <> '') then + btnInfo.Visible := true; + if (UiContext.Modus = modusDefault) and (UiContext.Toelevering <> '') then + btnInfo.Visible := true; +end; + +procedure TfmDnaCodeSchermVoorOnderdelen.DrukProboxEtiketAfIndienNodig; +var + fProboxAfdrukkenResponse: ProboxEtiketAfdrukkenResponse; + fZoekViaPalletCodeResponse: ZoekViaPalletCodeResponse; + DnaCodesStringList: TStringList; + DnaCodes: ArrayOfDnaCodeDnaCode; + ii: integer; + fAgent: TAgent; +begin + if not (System.StrUtils.LeftStr(UiContext.Pallet,3) = 'TBP') then + exit; + + fAgent := TAgent.Create(UiContext); + fZoekViaPalletCodeResponse := fAgent.ZoekViaPalletCode(UiContext.Pallet); + fAgent.Free; + try + if fZoekViaPalletCodeResponse.Header.Status = '200' then begin + DnaCodes := fZoekViaPalletCodeResponse.DnaCodes; + end else begin + Self.ModalResult := mrHome; + ToonPopupScherm(fZoekViaPalletCodeResponse.Header.Omschrijving, 'Bel planning'); + end; + + DnaCodesStringList := TStringList.Create(); + ii := 0; + while ii < length(DnaCodes) do begin + DnaCodesStringList.Add(DnaCodes[ii].DnaCode); + ii := ii + 1; + end; + + fAgent := TAgent.Create(UiContext); + fProboxAfdrukkenResponse := fAgent.ProboxEtiketAfdrukken(DnaCodesStringList); + fAgent.Free; + try + if fProboxAfdrukkenResponse.Header.Status <> '200' then begin + Self.ModalResult := mrHome; + ToonPopupScherm(fProboxAfdrukkenResponse.Header.Omschrijving, 'Bel planning') + end else begin + UiContext.LaatstAfgedrukteDnaCodes.Clear; + UiContext.LaatstAfgedrukteDnaCodes := DnaCodesStringList; + + Self.ModalResult := mrPallet; + end; + finally + fProboxAfdrukkenResponse.Free; + end; + finally + fZoekViaPalletCodeResponse.Free; + end; +end; + +function TfmDnaCodeSchermVoorOnderdelen.GeefAantalOpPallet(PalletCode: string): integer; +var + fAgent: TAgent; + fZoekViaPalletCodeResponse: ZoekViaPalletCodeResponse; + fAantal: integer; +begin + if (UiContext.MoetTbpCodeGenereren = true) then begin + fAantal := 0; + end else begin + fAgent := TAgent.Create(UiContext); + fZoekViaPalletCodeResponse := fAgent.ZoekViaPalletCode(PalletCode); + fAgent.Free; + fAantal := length(fZoekViaPalletCodeResponse.DnaCodes); + fZoekViaPalletCodeResponse.Free; + end; + Result := fAantal; +end; + +end.