Index: PVAX.mac.rou =================================================================== diff -u -r50299 -r50904 --- PVAX.mac.rou (.../PVAX.mac.rou) (revision 50299) +++ PVAX.mac.rou (.../PVAX.mac.rou) (revision 50904) @@ -52,22 +52,24 @@ PrijsDtl(KLNr,PRNr,SimPPL,Aantal) Set Tijd=$zh Write:'DiffOnly !,PRNr," ",$P(^KPR(PRNr,2),"\",25)," ",$P(^KPR(PRNr,0),"\"),! + If Detail - { - Set SalesPriceService=##class(AXimpl.Admin.VKP.SalesPriceService).%New() - s x =$$$ProductGet(PRNr, $$$CifPPLEUR) - Set Result=SalesPriceService.GeefPrijs(KLNr,PRNr,$G(SimPPL),$G(Aantal)) - Set it=SalesPriceService.GeefRequestIterator() + { + New SalesPriceService, Result, ResultLine + + #dim SalesPriceService As AXimpl.Admin.VKP.SalesPriceService = ##class(AXimpl.Admin.VKP.SalesPriceService).%New() + #dim Result As AXif.Dynamics.SalesPriceIn.MessageParts.ADUSalesPriceHeaderOutputDC = SalesPriceService.GeefPrijs(KLNr, PRNr, $get(SimPPL), $get(Aantal)) + #dim ResultLine As AXif.Dynamics.SalesPriceIn.MessageParts.ADUSalesPriceLineOutputDC = Result.Lines.GetAt(1) - d DumpObject^%apiOBJ(it.Next()) - d DumpObject^%apiOBJ(Result) + Do DumpObject^%apiOBJ(ResultLine) + Do DumpObject^%apiOBJ(Result) } + Set:$G(Aantal)'>0 PrijsRec=$$KLANTPR^KPRIJSADMIN(KLNr,PRNr,,.SimPPL) Set:$G(Aantal)>0 PrijsRec=$$KlantPrijs^KPRIJSADMIN(KLNr,PRNr,,,Aantal) Set:$G(Aantal)'>0 PrijsRecAX=$$KLANTPR^KPRIJSAX(KLNr,PRNr,,.SimPPL) Set:$G(Aantal)>0 PrijsRecAX=$$KlantPrijs^KPRIJSAX(KLNr,PRNr,,,Aantal) - ;Set:$G(Aantal)'>0 PrijsRecAX2=$$KLANTPR^KPRIJSAX(KLNr,PRNr,,.SimPPL) - ;Set:$G(Aantal)>0 PrijsRecAX2=$$KlantPrijs^KPRIJSAX(KLNr,PRNr,,,Aantal) + If '$G(DiffOnly)&&(KLNr=1614) ; incl BTW { Write "Admin prijs incl BTW: ",$J($P(PrijsRec,"\")*1.21,0,2),! @@ -148,16 +150,19 @@ Quit -PrijsOphalen(KLNr,PRNr,CifPPL,Aantal) - Set SalesPriceService=##class(AXimpl.Admin.VKP.SalesPriceService).%New() - s x =$$$ProductGet(PRNr, $$$CifPPLEUR) +PrijsOphalen(KLNr,PRNr,CifPPL,Aantal) Write !,KLNr," ",$P(^KKL(^KK1(KLNr),0),"\",2),! Write PRNr," ",$P(^KPR(PRNr,2),"\",25)," ",$P(^KPR(PRNr,0),"\"),! - Set Result=SalesPriceService.GeefPrijs(KLNr,PRNr,.CifPPL,.Aantal) - Set it=SalesPriceService.GeefRequestIterator() + + New SalesPriceService, Result, ResultLine + + #dim SalesPriceService As AXimpl.Admin.VKP.SalesPriceService = ##class(AXimpl.Admin.VKP.SalesPriceService).%New() + #dim Result As AXif.Dynamics.SalesPriceIn.MessageParts.ADUSalesPriceHeaderOutputDC = SalesPriceService.GeefPrijs(KLNr, PRNr, CifPPL, Aantal) + #dim ResultLine As AXif.Dynamics.SalesPriceIn.MessageParts.ADUSalesPriceLineOutputDC = Result.Lines.GetAt(1) + + ;Do DumpObject^%apiOBJ(Result.Lines.GetAt(1)) + ;Do DumpObject^%apiOBJ(Result) - ;d DumpObject^%apiOBJ(it.Next()) - ;d DumpObject^%apiOBJ(Result) Set:'$G(Aantal) PrijsRec=$$KLANTPR^KPRIJSADMIN(KLNr,PRNr,,.CifPPL) Set:$G(Aantal) PrijsRec=$$KlantPrijs^KPRIJSADMIN(KLNr,PRNr,,,Aantal) Write !,"Admin prijs: ",$P(PrijsRec,"\")," lijstprijs : ",$P(PrijsRec,"\",4),! @@ -167,7 +172,7 @@ Write !,"Admin: ",PrijsRec,! Write "AX : ",PrijsRecAX,! - q + Quit All Set DiffOnly=0 @@ -188,10 +193,12 @@ Do Klant(11409,DiffOnly) ; Do Klant(13353,DiffOnly) ; Do Klant(13604,DiffOnly) ; - Q + + Quit + Klant(KLNr,DiffOnly) Set TijdStipStartLog=$zH - s DiffOnly=0 + Set DiffOnly=0 Set Dev=$$OPEN^vhDEV("e:\AX","PrijsVGL AX "_KLNr_" - "_$TR($ZDT($H,8),":")_".txt","W") Use Dev @@ -229,79 +236,99 @@ } Do CLOSE^vhDEV(Dev) Write "ALL=",$ZH-TijdStipStartAll,! - q + + Quit KlantCheck(KLNr,DiffOnly) - Set SalesPriceService=##class(AXimpl.Admin.VKP.SalesPriceService).%New() - Do SalesPriceService.Initialisatie(KLNr) - Kill CacheId - Kill CacheCif + New ProductDataFactory, ProductDataLijst, SalesPriceService + + #dim ProductDataFactory As AXimpl.Admin.VKP.SalesPriceService.ProductDataFactory = ##class(AXimpl.Admin.VKP.SalesPriceService.ProductDataFactory).%New() + #dim ProductDataLijst As AXimpl.Admin.VKP.SalesPriceService.ProductDataLijst = ##class(AXimpl.Admin.VKP.SalesPriceService.ProductDataLijst).%New() + #dim SalesPriceService As AXimpl.Admin.VKP.SalesPriceService = ##class(AXimpl.Admin.VKP.SalesPriceService).%New() + Set PRNr=$O(^KSTKL(KLNr,0)) - Set Count=0,CountAll=0 - While PRNr + Set CountAll=0 + + While (PRNr) { - If $D(^KPR(PRNr)) && ($O(^KSTKL(KLNr,PRNr,"2016.07 "))'="") && ('$D(^KPR(PRNr,"J"_$$$LevHalux))) && ($$$PRGet($$$GenProduct)="") && ($$$PRGet($$$NONAktief)'=1) && '$$IsOrgaluxOpMaat^PRODUKT2(PRNr) { If 1||($P($$KLANTPR^KPRIJSADMIN(KLNr,PRNr),"\",8)'="K") ; GEEN KAT omdat de klantgrp op AX klant nog niet is ingevuld { - Set MessageId=SalesPriceService.VoegToeProduct(PRNr) - Set Count=Count+1 + Do ProductDataLijst.Insert(ProductDataFactory.MaakProductData(PRNr)) + Set CountAll=CountAll+1 - Set CacheId(MessageId)=PRNr - If Count=100 { - Do Compare(KLNr,SalesPriceService) + + If (ProductDataLijst.Count() = 100) { + Do Compare(KLNr, SalesPriceService, ProductDataLijst) Use 0 - Write KLNr," ",Count," ",CountAll," ",$ZH-TijdStipStartLog,! + Write KLNr, " ", ProductDataLijst.Count(), " ", CountAll, " ", $zhorolog - TijdStipStartLog, ! Use Dev - Set SalesPriceService=##class(AXimpl.Admin.VKP.SalesPriceService).%New() - Do SalesPriceService.Initialisatie(KLNr) - Set Count=0 + Set ProductDataLijst = ##class(AXimpl.Admin.VKP.SalesPriceService.ProductDataLijst).%New() Set TijdStipStartLog=$zh - Kill CacheId } } } - Set PRNr=$O(^KSTKL(KLNr,PRNr)) + Set PRNr= $O(^KSTKL(KLNr,PRNr)) } - Do:Count Compare(KLNr,SalesPriceService) + Do:(ProductDataLijst.Count()) Compare(KLNr, SalesPriceService, ProductDataLijst) + Quit CountAll -Compare(KLNr,SalesPriceService) - Do SalesPriceService.VoerUit() - Set it=SalesPriceService.GeefResultaatIterator() - While it.HasNext() - { - - Set Result=it.Next() - Set MessageId="{"_$zcvt(Result.MessageId,"U")_"}" - Set PRNr=$G(CacheId(MessageId)) - Set PrijsRec=$$KLANTPR^KPRIJSADMIN(KLNr,PRNr) - Set:SalesPriceService.PrijzenInclBTW() $P(PrijsRec,"\",1)=$J($P(PrijsRec,"\",1)*1.21,0,2) - Set Diff="" - Set:'$L(Result.ErrorTxt) Diff=$$$ExcelNum((Result.Price/Result.PriceUnit)-($P(PrijsRec,"\",1)/$P(PrijsRec,"\",11))) - If '$G(DiffOnly)||((Diff>0.01)||(Diff<-0.01))||$L(Result.ErrorTxt) - { - write Result.MessageId,*9 - Write KLNr,*9,$P(^KKL(^KK1(KLNr),0),"\",2),*9 - Write PRNr,*9,Result.ItemId,*9,$$$PRGet($$$KortTekst) - Write *9,$P(PrijsRec,"\",7),*9,$P(PrijsRec,"\",8) - Write *9,SalesPriceService.PrijzenInclBTW(),*9,$$$ExcelNum(Result.Price),*9,Result.PriceUnit - Write *9,$$$ExcelNum($P(PrijsRec,"\",1)),*9,$P(PrijsRec,"\",11) - Write *9,Diff - Write *9,Result.ErrorTxt - Write *9,$$$PRGet($$$SubGroep) - Write ! - } +Compare(KLNr, SalesPriceService, ProductDataLijst) + New Result, ResultLine, ResultLineIterator, MessageId, MessageIdFormatter, ProductNummer + + #dim Result As AXif.Dynamics.SalesPriceIn.MessageParts.ADUSalesPriceHeaderOutputDC = SalesPriceService.GeefPrijsVoorProducten(KLNr, ProductDataLijst) + #dim ResultLine As AXif.Dynamics.SalesPriceIn.MessageParts.ADUSalesPriceLineOutputDC + #dim ResultLineIterator As TECH.Iterator = ##class(TECH.ListIterator).%New(Result.Lines) + #dim MessageId As %String + #dim MessageIdFormatter As AXimpl.MessageIdFormatter = ##class(AXimpl.MessageIdFormatter).%New() + #dim ProductNummer As %String + + While (ResultLineIterator.HasNext()) { + Set ResultLine = ResultLineIterator.Next() + Set MessageId = MessageIdFormatter.Format(ResultLine.MessageId) + Set ProductNummer = ProductDataLijst.FindByMessageId(MessageId) + Set PrijsRec = $$KLANTPR^KPRIJSADMIN(KLNr, ProductNummer) + + If (Result.InclVAT) { + Set $piece(PrijsRec, "\", 1) = $justify($piece(PrijsRec, "\", 1) * 1.21, 0, 2) } + + Set Diff = "" + + If $$$Not($length(ResultLine.ErrorTxt)) { + Set Diff = $$$ExcelNum((ResultLine.Price / ResultLine.PriceUnit) - ($piece(PrijsRec, "\", 1) / $piece(PrijsRec, "\", 11))) + } + + If ($$$Not($get(DiffOnly)) || ((Diff > 0.01) || (Diff < -0.01)) || $length(ResultLine.ErrorTxt)) { + Write ResultLine.MessageId, *9 + Write KLNr, *9, $piece(^KKL(^KK1(KLNr), 0), "\", 2), *9 + Write ProductNummer, *9, ResultLine.ItemId, *9, $$$PRGet($$$KortTekst) + Write *9, $piece(PrijsRec, "\", 7), *9, $piece(PrijsRec, "\", 8) + Write *9, Result.InclVAT, *9, $$$ExcelNum(ResultLine.Price), *9, ResultLine.PriceUnit + Write *9, $$$ExcelNum($piece(PrijsRec, "\", 1)), *9, $piece(PrijsRec, "\", 11) + Write *9, Diff + Write *9, ResultLine.ErrorTxt + Write *9, $$$PRGet($$$SubGroep) + Write ! + } + } + Quit KlantSingle(KLNr) Set TijdStipStartLog=$zH Set PRNr=$O(^KSTKL(KLNr,0)) Set Count=0 - While PRNr + + New SalesPriceService, Result + + #dim SalesPriceService As AXimpl.Admin.VKP.SalesPriceService = ##class(AXimpl.Admin.VKP.SalesPriceService).%New() + #dim Result As AXif.Dynamics.SalesPriceIn.MessageParts.ADUSalesPriceHeaderOutputDC + + While (PRNr) { If ($O(^KSTKL(KLNr,PRNr,"2016.07 "))'="") && ('$D(^KPR(PRNr,"J"_$$$LevHalux))) && ($$$PRGet($$$GenProduct)="") && ($$$PRGet($$$NONAktief)'=1) && '$$IsOrgaluxOpMaat^PRODUKT2(PRNr) { @@ -310,30 +337,37 @@ } Else { Set CifPPL="" } - Set SalesPriceService=##class(AXimpl.Admin.VKP.SalesPriceService).%New() - Do SalesPriceService.Initialisatie(KLNr) - Set MessageId=SalesPriceService.VoegToeProduct(PRNr,CifPPL) - Do SalesPriceService.VoerUit() - Set it=SalesPriceService.GeefResultaatIterator() + + Set Result = SalesPriceService.GeefPrijs(KLNr, PRNr, CifPPL) Set Count=Count+1 } Set PRNr=$O(^KSTKL(KLNr,PRNr)) } - Write KLNr," #Prod:",Count," Ophalen:",$ZH-TijdStipStartLog,! + + Write KLNr, " #Prod:", Count, " Ophalen:", $zhorolog - TijdStipStartLog, ! + Quit + Multi - Set SalesPriceService=##class(AXimpl.Admin.VKP.SalesPriceService).%New() - Do SalesPriceService.Initialisatie(4810) - Do SalesPriceService.VoegToeProduct(3551) - Do SalesPriceService.VoegToeProduct(685017) - Do SalesPriceService.VoegToeProduct(675436,100) - Do SalesPriceService.VoerUit() - Set it=SalesPriceService.GeefResultaatIterator() - While it.HasNext() - { - Set Result=it.Next() - d DumpObject^%apiOBJ(Result) + New ProductDataFactory, ProductDataLijst, SalesPriceService, Result, ResultLine, ResultLineIterator + + #dim ProductDataFactory As AXimpl.Admin.VKP.SalesPriceService.ProductDataFactory = ##class(AXimpl.Admin.VKP.SalesPriceService.ProductDataFactory).%New() + #dim ProductDataLijst As AXimpl.Admin.VKP.SalesPriceService.ProductDataLijst = ##class(AXimpl.Admin.VKP.SalesPriceService.ProductDataLijst).%New() + + Do ProductDataLijst.Insert(ProductDataFactory.MaakProductData(3551)) + Do ProductDataLijst.Insert(ProductDataFactory.MaakProductData(685017)) + Do ProductDataLijst.Insert(ProductDataFactory.MaakProductData(675436, 100)) + + #dim SalesPriceService As AXimpl.Admin.VKP.SalesPriceService = ##class(AXimpl.Admin.VKP.SalesPriceService).%New() + #dim Result As AXif.Dynamics.SalesPriceIn.MessageParts.ADUSalesPriceHeaderOutputDC = SalesPriceService.GeefPrijs(4810, ProductDataLijst) + #dim ResultLineIterator As TECH.Iterator = ##class(TECH.ListIterator).%New(Result.Lines) + #dim ResultLine As AXif.Dynamics.SalesPriceIn.MessageParts.ADUSalesPriceLineOutputDC + + While (ResultLineIterator.HasNext()) { + Set ResultLine = ResultLineIterator.Next() + Do DumpObject^%apiOBJ(ResultLine) } + Quit KLANTPR Set PRNr=3551