ZBCHKPR ;KONTROLE VAN BESTANDEN (produkten) ;ZBCHK; [ 11/07/2001 11:27 AM ] ; Set (COUNT,LINE)=0 Do PR,PR1,PR2,PH,PM,PL Quit ; PRT1 ;Kontrole ^KPR PRT2 ;Fouten ^KPR PR1T1 ;Kontrole ^KPR1 PR1T2 ;Fouten ^KPR1 PR2T1 ;Kontrole ^KPR2 PR2T2 ;Fouten ^KPR2 PHT1 ;Kontrole ^KPH PHT2 ;Fouten ^KPH PMT1 ;Kontrole ^KPM PMT2 ;Fouten ^KPM PLT1 ;Kontrole ^KPL PLT2 ;Fouten ^KPL ; SC S PCC=$$COMPR^PRODUKT(PR) Q ; S1 Set COUNT=COUNT+1,^HULP($J,$P(TKB,U,7),COUNT)=R Quit ; S2 Set LINE=LINE+1 If LINE>(24-DLN) Set FP=DLN+2*100+1 Write @F,@FDL Set FP=DLN+$S(LINE<(24-DLN+1):LINE,1:(24-DLN))*100+1 Write @F,@F1,S Quit ; PR Set PR=0,S=$P($T(PRT1),U,2),R=$P($T(PRT2),U,2) Do S1,S2 Write *7 Set COUNTX=COUNT For Set PR=$O(^KPR(PR)) Quit:PR="" Do .Set PC=$P(^KPR(PR,0),D),Zr=$ZR Do SC .If '$D(^KPR1(PCC)) Set R=Zr_D_$ZR_D_"INDEX ONBEKEND" Do S1 .Else Do ..Set R=^KPR1(PCC),KortTxt=$P(R,D,2) ..If $P(R,D)'=PR Set R=Zr_D_$ZR_D_$P(R,D)_" VERSCHILLEND" Do S1 ..If PC'=KortTxt Set R=Zr_D_$ZR_D_KortTxt_" VERSCHILLEND" Do S1 .Set PID=$P(^KPR(PR,2),D,25),Zr=$ZR,PIDC=$$TRIMIDENT^vhRtn1(PID)_" " ;[IDENT] CW .If '$D(^KPR2(PIDC)) Set R=Zr_D_$ZR_D_"INDEX ONBEKEND" Do S1 .Set I="I" .For Set I=$O(^KPR(PR,I)) Quit:$E(I)'="I" Do ..Set R=^KPR(PR,I),Zr=$ZR,HG=$P(R,D),GR=$P(R,D,2),SG=$P(R,D,3) ..If '$D(^KPH(HG,GR,SG," ",PCC)) Set R=Zr_D_$ZR_D_"INDEX ONBEKEND" Do S1 ..If '$D(^KPM(" ",HG,GR,SG,PCC)) Set R=Zr_D_$ZR_D_"INDEX ONBEKEND" Do S1 ..If '$D(^KPHG1(HG)) Set R=Zr_D_$ZR_D_"HOOFDGROEP ONBEKEND" Do S1 ..If '$D(^KPGR1(GR)) Set R=Zr_D_$ZR_D_"GROEP ONBEKEND" Do S1 ..If '$D(^KPSG1(SG)) Set R=Zr_D_$ZR_D_"SUBGROEP ONBEKEND" Do S1 .Set J="J" .For Set J=$O(^KPR(PR,J)) Quit:$E(J)'="J" Do ..Set R=^KPR(PR,J),Zr=$ZR,LEV=$P(R,D)_" ",REF=$P(R,D,3)_" " ..If '$D(^KPL(LEV," ",REF,PCC)) Set R=Zr_D_$ZR_D_"INDEX ONBEKEND" Do S1 ; If COUNT=COUNTX Kill ^HULP($J,$P(TKB,U,7),COUNT) Set COUNT=COUNTX-1 ; Quit ; PR1 Set PCC=0,S=$P($T(PR1T1),U,2),R=$P($T(PR1T2),U,2) Do S1,S2 Write *7 Set COUNTX=COUNT For Set PCC=$O(^KPR1(PCC)) Quit:PCC="" Do .Set R=^KPR1(PCC),PR=$P(R,D),Pcc=$$COMPR^PRODUKT(PR),Zr=$ZR .If '$D(^KPR(PR)) Set R=Zr_D_$ZR_D_"ONBEKEND" Do S1 Quit .If PCC'=Pcc Set R=Zr_D_$ZR_D_"VERSCHILLEND" Do S1 Quit If COUNT=COUNTX Kill ^HULP($J,$P(TKB,U,7),COUNT) Set COUNT=COUNTX-1 ; Quit ; PR2 Set PIDC=0,S=$P($T(PR2T1),U,2),R=$P($T(PR2T2),U,2) Do S1,S2 Write *7 Set COUNTX=COUNT For Set PIDC=$O(^KPR2(PIDC)) Quit:PIDC="" Do .Set R=^KPR2(PIDC),PR=$P(R,D),PID=$P(R,D,2),Zr=$ZR .If '$D(^KPR(PR)) Set R=Zr_D_$ZR_D_"ONBEKEND" Do S1 Quit .If $P(^KPR(PR,2),D,25)'=PID Set R=Zr_D_$ZR_D_"VERSCHILLEND" Do S1 Quit ; If COUNT=COUNTX Kill ^HULP($J,$P(TKB,U,7),COUNT) Set COUNT=COUNTX-1 ; Quit ; PH Set HG="",S=$P($T(PHT1),U,2),R=$P($T(PHT2),U,2) Do S1,S2 Write *7 Set COUNTX=COUNT For Set HG=$O(^KPH(HG)) Quit:HG="" Do .Set GR="" .For Set GR=$O(^KPH(HG,GR)) Quit:GR="" Do ..Set SG="" ..For Set SG=$O(^KPH(HG,GR,SG)) Quit:SG="" Do ...Set PCC="" ...For Set PCC=$O(^KPH(HG,GR,SG," ",PCC)) Quit:PCC="" Do ....Set PR=^KPH(HG,GR,SG," ",PCC),Zr=$ZR ....If '$D(^KPR(PR)) Set R=Zr_D_$ZR_D_"PRODUKT ONBEKEND" Do S1 Quit ....Set PCX=PCC,PC=$P(^KPR(PR,0),D) Do SC ....If PCX'=PCC Set R=Zr_D_$ZR_D_"KORTTEKST VERSCHILLEND" Do S1 ....Set PCC=PCX,I="I",Ok=0 ....For Set I=$O(^KPR(PR,I)) Quit:$E(I)'="I"!Ok Do .....Set R=^KPR(PR,I) If $P(R,D)=HG,$P(R,D,2)=GR,$P(R,D,3)=SG Set Ok=1 Quit ....If 'Ok Set R=$D(^KPR(PR)),R=Zr_D_$ZR_D_"ONBEKEND BIJ PRODUKT" Do S1 Quit ; If COUNT=COUNTX Kill ^HULP($J,$P(TKB,U,7),COUNT) Set COUNT=COUNTX-1 ; Quit ; PM Set HG="",S=$P($T(PMT1),U,2),R=$P($T(PMT2),U,2) Do S1,S2 Write *7 Set COUNTX=COUNT For Set HG=$O(^KPM(" ",HG)) Quit:HG="" Do .Set GR="" .For Set GR=$O(^KPM(" ",HG,GR)) Quit:GR="" Do ..Set SG="" ..For Set SG=$O(^KPM(" ",HG,GR,SG)) Quit:SG="" Do ...Set PCC="" ...For Set PCC=$O(^KPM(" ",HG,GR,SG,PCC)) Quit:PCC="" Do ....Set PR=^KPM(" ",HG,GR,SG,PCC),Zr=$ZR ....If '$D(^KPR(PR)) Set R=Zr_D_$ZR_D_"PRODUKT ONBEKEND" Do S1 Quit ....Set PCX=PCC,PC=$P(^KPR(PR,0),D) Do SC ....If PCX'=PCC Set R=Zr_D_$ZR_D_"KORTTEKST VERSCHILLEND" Do S1 ....Set PCC=PCX,I="I",Ok=0 ....For Set I=$O(^KPR(PR,I)) Quit:$E(I)'="I"!Ok Do .....Set R=^KPR(PR,I) If $P(R,D)=HG,$P(R,D,2)=GR,$P(R,D,3)=SG Set Ok=1 Quit ....If 'Ok Set R=$D(^KPR(PR)),R=Zr_D_$ZR_D_"ONBEKEND BIJ PRODUKT" Do S1 Quit ; If COUNT=COUNTX Kill ^HULP($J,$P(TKB,U,7),COUNT) Set COUNT=COUNTX-1 ; Quit ; PL Set LEV="",S=$P($T(PLT1),U,2),R=$P($T(PLT2),U,2) Do S1,S2 Write *7 Set COUNTX=COUNT For Set LEV=$O(^KPL(LEV)) Quit:LEV="" Do .Set REF="" .For Set REF=$O(^KPL(LEV," ",REF)) Quit:REF="" Do ..Set PCC="" ..For Set PCC=$O(^KPL(LEV," ",REF,PCC)) Quit:PCC="" Do ...Set PR=^KPL(LEV," ",REF,PCC),Zr=$ZR ...If '$D(^KPR(PR)) Set R=Zr_D_$ZR_D_"PRODUKT ONBEKEND" Do S1 Quit ...Set PCX=PCC,PC=$P(^KPR(PR,0),D) Do SC ...If PCX'=PCC Set R=Zr_D_$ZR_D_"KORTTEKST VERSCHILLEND" Do S1 ...Set PCC=PCX,J="J",Ok=0 ...For Set J=$O(^KPR(PR,J)) Quit:$E(J)'="J"!Ok Do ....Set R=^KPR(PR,J) If $P(R,D)=$E(LEV,1,$L(LEV)-1),$P(R,D,3)=$E(REF,1,$L(REF)-1) Set Ok=1 Quit ...If 'Ok Set R=$D(^KPR(PR)),R=Zr_D_$ZR_D_"ONBEKEND BIJ PRODUKT" Do S1 Quit ; If COUNT=COUNTX Kill ^HULP($J,$P(TKB,U,7),COUNT) Set COUNT=COUNTX-1 ; Quit ; Set KortTxt=$P(^KPR(PRNr,0),D) Do wKORTTXT^zbcheck CHECKPR #define HerbouwIndexFalse 0 Do .New Check .Set Q="K" .Do ^cA604 Write !!,"*** Productbestanden ***",! Set Check = 1 ; ; ^KPR versus ^KPR1, ^KPR2, ^KPH, ^KPM, ^KPL, ^KPHG, ^KPGR, ^KPSG, Search index New PRNrFromIndex Set PRNr=0 For Set PRNr=$O(^KPR(PRNr)) Quit:PRNr="" Do . Set CompKort=$$COMPR^PRODUKT(PRNr) . Set (KortTekst,KortTxt)=$P(^KPR(PRNr,0),D),ComprKey=$$UPTRIMAN^vhRtn1(KortTekst)_" " . If '$D(^KPR1(CompKort)) Do . . Do Gefaald(.LaatsteGlobalRef) . . Write !!,"Index ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . If '$D(^Prod.SearchIndexD("K",ComprKey,PRNr)) Do . . Do Gefaald(.LaatsteGlobalRef) . . Write !!,"Index ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . If PRNr'=$P($G(^KPR1(CompKort)),D) Do . . Set PRNrFromIndex=$P($G(^KPR1(CompKort)),D) . . Do Gefaald(.LaatsteGlobalRef) . . Write !!,"Index ",LaatsteGlobalRef," product verschillend",!,?8,"Korttxt = ",KortTekst,?50,"Product '",PRNr,"' <> '",PRNrFromIndex_"'" . Set IdentNr=$P(^KPR(PRNr,2),D,25),CompIdentNr=$$TRIMIDENT^vhRtn1(IdentNr)_" " . If '$D(^KPR2(CompIdentNr)) Do . . Do Gefaald(.LaatsteGlobalRef) . . Write !!,"Index ",LaatsteGlobalRef," onbekend",!,?8,"Identnr = ",IdentNr,?50,"Product = ",PRNr . If '$D(^Prod.SearchIndexD("I",CompIdentNr,PRNr)) Do . . Do Gefaald(.LaatsteGlobalRef) . . Write !!,"Index ",LaatsteGlobalRef," onbekend",!,?8,"Identnr = ",IdentNr,?50,"Product = ",PRNr . If PRNr'=$P($G(^KPR2(CompIdentNr)),D) Do . . Set PRNrFromIndex=$P($G(^KPR2(CompIdentNr)),D) . . Do Gefaald(.LaatsteGlobalRef,$$$HerbouwIndexFalse) . . Write !!,"Index ",LaatsteGlobalRef," product verschillend",!,?8,"Identnr = ",IdentNr,?50,"Product ",PRNr," <> ",PRNrFromIndex . Set IKlas="I" . If $E($O(^KPR(PRNr,IKlas)))'="I" Do . . Do Gefaald(.LaatsteGlobalRef,$$$HerbouwIndexFalse) . . Write !!,"Index ^KPR(",PRNr,",""I"") onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . For Set IKlas=$O(^KPR(PRNr,IKlas)) Quit:$E(IKlas)'="I" Do . . Set R=^KPR(PRNr,IKlas),HoofdGr=$P(R,D),Groep=$P(R,D,2),SubGroep=$P(R,D,3) . . If '$D(^KPH(HoofdGr,Groep,SubGroep," ",CompKort)) Do . . . Do Gefaald(.LaatsteGlobalRef) . . . Write !!,"Index ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . If '$D(^KPM(" ",HoofdGr,Groep,SubGroep,CompKort)) Do . . . Kill ^KPM(" ",HoofdGr,Groep,SubGroep,CompKort) . . . Do Gefaald(.LaatsteGlobalRef) . . . Write !!,"Index ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . If '$D(^KPHG1(HoofdGr)) Do . . . Do Gefaald(.LaatsteGlobalRef) . . . Write !!,"Hoofdgroep ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . If '$D(^KPGR1(Groep)) Do . . . Do Gefaald(.LaatsteGlobalRef) . . . Write !!,"Groep ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . If '$D(^KPSG1(SubGroep)) Do . . . Do Gefaald(.LaatsteGlobalRef) . . . Write !!,"SubGroep ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . Set JLev="J" . If $E($O(^KPR(PRNr,JLev)))'="J" Do . . Do Gefaald(.LaatsteGlobalRef) . . Write !!,"Index ^KPR(",PRNr,",""J"") onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . For Set JLev=$O(^KPR(PRNr,JLev)) Quit:$E(JLev)'="J" Do . . New MerkIndex . . Set R=^KPR(PRNr,JLev),LevNr=$P(R,D)_" ",MerkIndex=$P(R,D,2)_" ",LevRef=$P(R,D,3)_" " . . S LevRefKey=$$UPTRIMAN^vhRtn1(LevRef)_" " . . If '$D(^KPL(LevNr,MerkIndex,LevRef,CompKort)) Do . . . Do Gefaald(.LaatsteGlobalRef) . . . Write !!,"Index ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . If $L(LevRefKey)>1,'$D(^Prod.SearchIndexD("LR",LevRefKey,PRNr)) Do . . . Do Gefaald(.LaatsteGlobalRef) . . . Write !!,"Index ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . Set Dossier=$P($G(^KPR(PRNr,"G")),D),DossierKey=Dossier_" " . If $L(DossierKey)>1,'$D(^Prod.SearchIndexD("D",DossierKey,PRNr)) Do . . Do Gefaald(.LaatsteGlobalRef) . . Write !!,"Index ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr ; ^KPR1 versus ^KPR Set CompKort="" If $G(Check)'=0 For Set CompKort=$O(^KPR1(CompKort)) Quit:CompKort="" Do . Set R=^KPR1(CompKort),PRNr=$P(R,D),KortTekst=$P(R,D,2),ZR=$ZR . If '$D(^KPR(PRNr)) Do Quit . . Set Check=0 . . Write !!,"^KPR1 versus ^KPR : Index ",ZR," product onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . Set InhoudKPR1 = ^KPR1(CompKort) . . Kill ^KPR1(CompKort) . . Write !,ZR_" = """_InhoudKPR1_""""_$C(9)_" => automatisch opgekuisd." . Set KortTxt=$P(^KPR(PRNr,0),D) . Set CompKortX=$$COMPR^PRODUKT(PRNr) . If CompKort'=CompKortX Do . . Kill ^KPR1(CompKort) . . Do Gefaald(.LaatsteGlobalRef) . . Write !!,"^KPR1 versus ^KPR : Index ",ZR," product foutief",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr ; ; ^KPR2 versus ^KPR Set CompIdentNr="" If $G(Check)'=0 For Set CompIdentNr=$O(^KPR2(CompIdentNr)) Quit:CompIdentNr="" Do . Set R=^KPR2(CompIdentNr),PRNr=$P(R,D),IdentNr=$P(R,D,2),ZR=$ZR . If '$D(^KPR(PRNr)) Do Quit . . Set Check=0 . . Write !!,"^KPR2 versus ^KPR : Index ",ZR," product onbekend",!,?8,"Identnr = ",IdentNr,?50,"Product = ",PRNr . Set KortTxt=$P(^KPR(PRNr,0),D) . If IdentNr'=$P(^KPR(PRNr,2),D,25) Do . . Do Gefaald(.LaatsteGlobalRef) . . Write !!,"^KPR2 versus ^KPR : Index ",ZR," product foutief",!,?8,"Identnr = ",IdentNr,?50,"Product = ",PRNr ; ; ^KPH versus ^KPR Set HoofdGroep="" If $G(Check)'=0 For Set HoofdGroep=$O(^KPH(HoofdGroep)) Quit:HoofdGroep="" Do . Set Groep="" . For Set Groep=$O(^KPH(HoofdGroep,Groep)) Quit:Groep="" Do . . Set SubGroep="" . . For Set SubGroep=$O(^KPH(HoofdGroep,Groep,SubGroep)) Quit:SubGroep="" Do . . . Set CompKort="" . . . For Set CompKort=$O(^KPH(HoofdGroep,Groep,SubGroep," ",CompKort)) Quit:CompKort="" Do . . . . Set PRNr=^KPH(HoofdGroep,Groep,SubGroep," ",CompKort),ZR=$ZR . . . . If '$D(^KPR(PRNr)) Do Quit . . . . . Set Check=0 . . . . . Write !!,"Index ",ZR," product onbekend",!,?50,"Product = ",PRNr . . . . Set (KortTxt,KortTekst)=$P(^KPR(PRNr,0),D) . . . . Set IKlas=$O(^KPR(PRNr,"I")) . . . . If $E(IKlas)'="I" Do . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"Index ",ZR," product index ""I"" onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . . . Set R=^KPR(PRNr,IKlas) . . . . If HoofdGroep'=$P(R,D)!(Groep'=$P(R,D,2))!(SubGroep'=$P(R,D,3)) Do . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"Index ",ZR," product index ""I"" verschillend - ",!,?8,HoofdGroep," - ",Groep," - ",SubGroep,?50,"Product = ",PRNr . . . . Set CompKortX=$$COMPR^PRODUKT(PRNr) . . . . If CompKort'=CompKortX Do . . . . . ;Kill ^KPH(HoofdGroep,Groep,SubGroep," ",CompKort) . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"Index ",ZR," korttekst foutief",!,?8,"Korttxt = ",KortTekst,CompKort,?29,"Product = ",PRNr . . . . If '$D(^KPHG1(HoofdGroep)) Do . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"Hoofdgroep ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . . . If '$D(^KPGR1(Groep)) Do . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"Groep ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . . . If '$D(^KPSG1(SubGroep)) Do . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"Subgroep ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr ; ; ^KPM versus ^KPR Set HoofdGroep="" If $G(Check)'=0 For Set HoofdGroep=$O(^KPM(" ",HoofdGroep)) Quit:HoofdGroep="" Do . Set Groep="" . For Set Groep=$O(^KPM(" ",HoofdGroep,Groep)) Quit:Groep="" Do . . Set SubGroep="" . . For Set SubGroep=$O(^KPM(" ",HoofdGroep,Groep,SubGroep)) Quit:SubGroep="" Do . . . Set CompKort="" . . . For Set CompKort=$O(^KPM(" ",HoofdGroep,Groep,SubGroep,CompKort)) Quit:CompKort="" Do . . . . Set PRNr=^KPM(" ",HoofdGroep,Groep,SubGroep,CompKort),ZR=$ZR . . . . If '$D(^KPR(PRNr)) Do Quit . . . . . Set Check=0 . . . . . kill ^KPM(" ",HoofdGroep,Groep,SubGroep,CompKort) . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"^KPM versus ^KPR : Index ",ZR," product onbekend",!,?50,"Product = ",PRNr . . . . Quit:('$D(^KPR(PRNr))) . . . . Set (KortTxt,KortTekst)=$P(^KPR(PRNr,0),D) . . . . Set IKlas=$O(^KPR(PRNr,"I")) . . . . If $E(IKlas)'="I" Do . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"^KPM versus ^KPR :Index ^KPR(",PRNr,",""I"") onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . . . Set R=^KPR(PRNr,IKlas) . . . . If HoofdGroep'=$P(R,D)!(Groep'=$P(R,D,2))!(SubGroep'=$P(R,D,3)) Do . . . . . Kill ^KPM(" ",HoofdGroep,Groep,SubGroep,CompKort) . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"^KPM versus ^KPR :Index ","^KPR(",PRNr,",""",IKlas,""") - ^KPM - verschillend - ",HoofdGroep," - ",Groep," - ",SubGroep . . . . . Write !,"In global : ",ZR,! . . . . Set CompKortX=$$COMPR^PRODUKT(PRNr) . . . . If CompKort'=CompKortX Do . . . . . Kill ^KPM(" ",HoofdGroep,Groep,SubGroep,CompKort) . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"^KPM versus ^KPR :Index ",ZR," korttekst foutief",!,?8,"Korttxt = ",KortTekst," compr:'",CompKort,"' herberekend:'",CompKortX,"'",?29,"Product = ",PRNr . . . . If '$D(^KPHG1(HoofdGroep)) Do . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"^KPM versus ^KPR :Hoofdroep ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . . . If '$D(^KPGR1(Groep)) Do . . . . . Kill ^KPM(" ",HoofdGroep,Groep) . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"^KPM versus ^KPR :Groep ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr . . . . If '$D(^KPSG1(SubGroep)) Do . . . . . Kill ^KPM(" ",HoofdGroep,Groep,SubGroep) . . . . . Do Gefaald(.LaatsteGlobalRef) . . . . . Write !!,"^KPM versus ^KPR :Subgroep ",LaatsteGlobalRef," onbekend",!,?8,"Korttxt = ",KortTekst,?50,"Product = ",PRNr ; ; ^KPL versus ^KPR Set LevNr="" If $G(Check)'=0 For Set LevNr=$O(^KPL(LevNr)) Quit:LevNr="" Do . Set LevRef="" . For Set LevRef=$O(^KPL(LevNr," ",LevRef)) Quit:LevRef="" Do . . Set CompKort="" . . For Set CompKort=$O(^KPL(LevNr," ",LevRef,CompKort)) Quit:CompKort="" Do . . . Set PRNr=^KPL(LevNr," ",LevRef,CompKort),ZR=$ZR . . . If '$D(^KPR(PRNr)) Do Quit . . . . Kill ^KPL(LevNr," ",LevRef,CompKort) . . . . Do Gefaald(.LaatsteGlobalRef) . . . . Write !!,"^KPL versus ^KPR : Index ",ZR," product onbekend",!,?50,"Product = ",PRNr . . . Quit:('$D(^KPR(PRNr))) . . . Set (KortTxt,KortTekst)=$P(^KPR(PRNr,0),D) . . . Set CompKortX=$$COMPR^PRODUKT(PRNr) . . . If CompKort'=CompKortX Do . . . . Kill ^KPL(LevNr," ",LevRef,CompKort) . . . . Do Gefaald(.LaatsteGlobalRef) . . . . Write !!,"^KPL versus ^KPR : Index ",ZR," korttekst foutief",!,?8,"Korttxt = ",KortTekst,CompKort,?29,"Product = ",PRNr ; ; Search index versus ^KPR If $G(Check)'=0 Do CHECKSI(.Check) Quit ; CHECK() New Set Check=1 Do CHECKPR Quit Check ; ; Search index CHECKSI(Check) New I,Type,ComprKey,PRNr,lbSI,Active,Grouping,Origine,Pool,ProductType,Saleable,Sort,StockType,FullKey,GRec,DossierNr,Alias,AlisOk New IdentNr,KortTekst,LevRef,CommAct,LinkType,StockTypeKPR,GenerischeRoutine Set Type="" For Set Type=$O(^Prod.SearchIndexD(Type)) Quit:Type="" . Set ComprKey="" . For Set ComprKey=$O(^Prod.SearchIndexD(Type,ComprKey)) Quit:ComprKey="" . . Set PRNr="" . . For Set PRNr=$O(^Prod.SearchIndexD(Type,ComprKey,PRNr)) Quit:PRNr="" . . . Set lbSI=^Prod.SearchIndexD(Type,ComprKey,PRNr),ZR=$ZR . . . If '$D(^KPR(PRNr)) Do Quit . . . . Set Check=0 . . . . Write !,ZR," - ^KPR(",PRNr,") onbekend" . . . Set Active=$LI(lbSI,2),Grouping=$LI(lbSI,3),Origine=$LI(lbSI,4),Pool=$LI(lbSI,5),ProductType=$LI(lbSI,6) . . . Set Saleable=$LI(lbSI,7),Sort=$LI(lbSI,8),StockType=$LI(lbSI,9),FullKey=$LI(lbSI,10) . . . Set Product=##class(Prod.Product).%OpenId(PRNr) . . . Set KortTekst=Product.KortTekst . . . Set IdentNr=Product.IdentNummer . . . Set DossierNr=$P($G(^KPR(PRNr,"G")),D) . . . Set LevRef=$P(^KPR(PRNr,$O(^KPR(PRNr,"J"))),D,3) . . . Set Alias="" . . . If Type="K" Do ; Korttekst . . . . Set AliasOk=0 . . . . If $E(ComprKey,1,$L(ComprKey)-1)'=$$UPTRIMAN^vhRtn1(KortTekst) Do . . . . . Set:Origine="A" Alias=##class(Prod.Kenmerk.DataDefinitie).Get("OEI",PRNr,"AliasK") . . . . . For I=1:1:$LL(Alias) Set AliasOk=$E(ComprKey,1,$L(ComprKey)-1)=$$UPTRIMAN^vhRtn1($LI(Alias,I)) Quit:AliasOk . . . . . If AliasOk Set AliasOk=I Quit . . . . . Set Check=0 . . . . . Write !,ZR," - Korttekstsleutel(Alias) verschillend" . . . . If FullKey'=KortTekst Do . . . . . If AliasOk,FullKey=$LI(Alias,AliasOk) Quit ; FullKey is gelijk aan een van de aliassen . . . . . Set Check=0 . . . . . Write !,ZR," - Korttekst verschillend",!,"Rebuild ",PRNr Kill @ZR Do BLDIND^PRODUKT2(PRNr) w " -> ok" ; cw 11.04.11 . . . Else If Type="I" Do ; Identnummer . . . . Set AliasOk=0 . . . . If $E(ComprKey,1,$L(ComprKey)-1)'=$TR(IdentNr,".","") Do . . . . . Set:Origine="A" Alias=##class(Prod.Kenmerk.DataDefinitie).Get("OEI",PRNr,"AliasI") . . . . . For I=1:1:$LL(Alias) Set AliasOk=$E(ComprKey,1,$L(ComprKey)-1)=$TR($LI(Alias,I),".","") Quit:AliasOk . . . . . If AliasOk Set AliasOk=I Quit . . . . . Set Check=0 . . . . . Write !,ZR," - Identnummersleutel(Alias) verschillend" . . . . If FullKey'=IdentNr Do . . . . . If AliasOk,FullKey=$LI(Alias,AliasOk) Quit ; FullKey is gelijk aan een van de aliassen . . . . . Set Check=0 . . . . . Write !,ZR," - Identnummer verschillend",!,$$LCVT^vhLib(Alias),!,"Rebuild ",PRNr Kill @ZR Do BLDIND^PRODUKT2(PRNr) w " -> ok" ; cw 11.04.11 . . . Else If Type="LR" Do ; Leveranciersreferentie . . . . Set AliasOk=0 . . . . If $E(ComprKey,1,$L(ComprKey)-1)'=$$UPTRIMAN^vhRtn1(LevRef) Do . . . . . Set:Origine="A" Alias=##class(Prod.Kenmerk.DataDefinitie).Get("OEI",PRNr,"AliasLR") . . . . . For I=1:1:$LL(Alias) Set AliasOk=$E(ComprKey,1,$L(ComprKey)-1)=$TR($LI(Alias,I),".","") Quit:AliasOk . . . . . If AliasOk Set AliasOk=I Quit . . . . . Set Check=0 . . . . . Write !,ZR," - LevRefsleutel(Alias) verschillend" . . . . If FullKey'=LevRef Do . . . . . If AliasOk,FullKey=$LI(Alias,AliasOk) Quit ; FullKey is gelijk aan een van de aliassen . . . . . Set Check=0 . . . . . Write !,ZR," - LevRef verschillend" . . . Else If Type="D" Do ; Dossiernummer . . . . If $E(ComprKey,1,$L(ComprKey)-1)'=DossierNr Do . . . . . Set Check=0 . . . . . Write !,ZR," - Dossiersleutel verschillend" . . . . If FullKey'=DossierNr Do . . . . . Set Check=0 . . . . . Write !,ZR," - Dossier verschillend" . . . Set CommAct=Product.NONAktief ; Commercieel actief . . . If $P("A\N\B",D,CommAct+1)'=Active Do . . . . Set Check=0 . . . . Write !,ZR," - Commercieel actief verschillend" ;,!,"Rebuild ",PRNr Kill @ZR Do BLDIND^PRODUKT2(PRNr) w " -> ok" ; cw 11.04.11 . . . Set LinkType=Product.LinkType ; Linktype . . . If $S(LinkType["H":"H",LinkType="K":"K",$E(Product.IdentNummer)=6:"K",1:"S")'=Saleable Do . . . . Set Check=0 . . . . Write !,ZR," - Linktype verschillend" . . . Set StockTypeKPR=Product.StockType ; Stocktype . . . If $S($E(IdentNr)=7:"D",StockTypeKPR="C":"C",StockTypeKPR="S":"S",1:"N")'=StockType Do . . . . Set Check=0 . . . . Write !,ZR," - Stocktype verschillend",!,"Rebuild ",PRNr Kill @ZR Do BLDIND^PRODUKT2(PRNr) w " -> ok" ; cw 11.04.11 . . . Set GenerischeRoutine=Product.GenerischeRoutine ; Producttype . . . If $S(GenerischeRoutine?3.7N:"D",$$ISORGAL^ORGALUX(PRNr):"O",1:"B")'=ProductType Do . . . . Set Check=0 . . . . Write !,ZR," - Producttype verschillend",!,"Rebuild ",PRNr Kill @ZR Do BLDIND^PRODUKT2(PRNr) w " -> ok" ; cw 11.04.11 . . . If Grouping'=Product.Klas.Sectie Do ; Grouping . . . . Set Check=0 . . . . Write !,ZR," - Groepering verschillend" . . . Set SelectPool=$LG(##class(Prod.Kenmerk.DataDefinitie).Get("OEI",PRNr,"Pool")) . . . If $S(SelectPool="KS":"KS",SelectPool="I":"IP",1:"NS")'=Pool Do . . . . Set Check=0 . . . . Write !,ZR," - Klantenpool verschillend ( "_SelectPool_" <> "_Pool_" )",!,"Rebuild ",PRNr Kill @ZR Do BLDIND^PRODUKT2(PRNr) w " -> ok" ; cw 11.04.11 Quit ; Gefaald(LaatsteGlobal,HerbouwIndex) Set HerbouwIndex = $G(HerbouwIndex,1) Set LaatsteGlobal = $ZR Set Check = 0 w ! Do wKORTTXT^zbcheck Do:(HerbouwIndex) HerbouwIndexIndienNodig(PRNr) Quit HerbouwIndexIndienNodig(PRNr) If $Data(^KPR(PRNr)){ Do REBLDIND^PRODUKT2(PRNr) write !,"==>>",$C(9),"Indexen zijn opnieuw opgebouwd voor product '"_PRNr_"'" }Else{ Write !,"==>>",$C(9),"Product '"_PRNr_"' bestaat niet meer." } New PsiService Set PsiService = ##class(BL.Prod.SearchBuildIndex).%New() Do PsiService.Init(PRNr) Do PsiService.DeleteIndex() Do PsiService.BuildIndex(1) Quit