; Voorbereiding voor montage en verpakken van gemonteerde Tandembox laden ; De gezaagde bodems en rug worden ingescand in de volgorde dat zij op de kar geplaatst worden. ; Er wordt een lijst gemaakt per kar. ; Deze lijst wordt dan doorgegeven naar dit programma die dan de verdere verwerking doet. ; - Lijst met onderdelen, fronten voor binnenladen, verpakkingkarton ; - later : Transfer order voor de ontbrekende onderdelen #include BL.Derde.KlantSpecifiek #include BL.Derde.LevSpecifiek #define PrepKeys $LB("MON","LOS","BULK","BIN","RUGB","VPK","VPZ") #define PrepKeysFrontOnly $LB("BIN") #define PrepKeysBulkOnly $LB("BULK") #define PrepTranslate $LB("Montage","Losse onderdelen V1","Losse onderdelen BULK","Front binnenlade","Rug BEUK","Omvouwkarton","Zijwanden") #define PrepKeyPageBreak $LB("BULK","BIN","VPK") HADTBXPrep New Arr ;Do AddToelevering(.Arr,268464) Do AddToelevering(.Arr,271057) Do Print(.Arr,"Toelevering : "_271057,,"BULK") Quit PrintToelevering(TOENr,Dev) New Arr Do AddToelevering(.Arr,TOENr) Do Print(.Arr,"Toelevering : "_TOENr,.Dev,"BULK") Quit AddFabKey(Arr,GlobRef) New FabKey,TOENr,TLNr,Qty,PRNr Set FabKey="" For Set FabKey=$O(@GlobRef@(FabKey)) Quit:FabKey="" Do . Set TOENr=$P(FabKey,";") . Set TLNr=^TO("IU",TOENr,$P(FabKey,";",2)) . Set Qty=$P(^KTO(6332,TOENr,TLNr),D,3) . Set PRNr=$P(^KTO(6332,TOENr,TLNr),D,2) . Do Add(.Arr,TOENr,PRNr,Qty) Quit AddToelevering(Arr,TOENr) New TLNr,PRNr,Qty Set TLNr=100 For Set TLNr=$O(^KTO(6332,TOENr,TLNr)) Quit:TLNr="" Do . Set PRNr=$P(^KTO(6332,TOENr,TLNr),D,2) . Set Qty=$P(^KTO(6332,TOENr,TLNr),D,3) . Quit:PRNr'?4.7N||'$L($P($G(^KPR(PRNr,"G")),D,1)) . Do Add(.Arr,TOENr,PRNr,Qty) . ;w PRNr," ",$P(^KPR(PRNr,0),D),! Quit ; Toevoegen van een scankey (Toelevering+Dossier) ; Arr via .Local doorgeven ; Opgelet : Volgorde is belangrijk AddScanKey(Arr,ScanKey,Qty) New Dossier,PRNr Set Dossier=$E(ScanKey,7,99) Set PRNr=$G(^KPR3("T",Dossier)) Quit:PRNr'?4.7N ; Ongeldig product Do Add(.Arr,$E(TOENr,1,6),PRNr,Qty) Quit ; Toevoegen van een product aan de array ; De Arr is opgebouwd als Arr(VolgNr)=$LB(Toelevering,Product,Aantal) ; Opgelet : Volgorde is belangrijk Add(Arr,TOENr,PRNr,Qty) Set Arr($I(Arr))=$LB(TOENr,PRNr,Qty) Quit ; Toevoegen van de product array ; Via Arr via .Local doorgeven ; De Arr is opgebouwd als Arr(VolgNr)=$LB(Toelevering,Product,Aantal) ; KarCode is een string met de naam/nummer van de kar ; Dev is optioneel, indien niet mee gegeven dan wordt dit gevraagd (TELNET) Print(Arr,SubTitel,Dev,PrepOnly) New I,FabrPrepList,FrontOnly,PLD,MemTOENr,Groep,Lijst Set FabrPrepList=$S($L($G(PrepOnly)):$LB(PrepOnly),1:$$$PrepKeys) Set FrontOnly=$G(PrepOnly)="BIN" ; Groeperen Kill Groep Set Groep=0 For I=1:1:$LL(FabrPrepList) Do . Do Groep($LI(FabrPrepList,I),.Arr,.Groep,FrontOnly) Quit:$D(Groep)=1 ; Niets af te drukken ; Converteren naar lijst Kill Lijst For I=1:1:$LL(FabrPrepList) Do . Do Convert($LI(FabrPrepList,I),.Groep,.Lijst) ;zw Lijst ; Afdrukken Do INIT^vhLISTO("HADTBX","FABRPREP",.PLD) Kill MemTOENr Set PLD(5)=78 Set PLD(10)="CBLIJST^"_$ZN Set PLD(11)="HALUX Tandembox - voorbereiding"_D_$G(SubTitel) Do PRINT^OUTPUT(.PLD,"P","S") Quit CBLIJST(Ref) New Profiel,Fmt,Rec,ScheidingsCode,TOENr,MemTOENr Quit:$L(Ref)=1 "" ; Header,Footer Set Rec=@Ref Set ScheidingsCode=$P(Rec,D) If ScheidingsCode="" Do . Set TOENr=$P(Rec,D,10) . If $D(MemTOENr),TOENr'="" Do . . If MemTOENr'="",MemTOENr'=TOENr Do . . . Set Fmt=$S(FrontOnly:"PB\;1",1:"BR\;1") ; Verschillende toelevering dus break . . Else Do . . .Set Fmt=";1" ; Standaard lijn . . Set MemTOENr=TOENr . Else Do . . Set Fmt=";1" ; Standaard lijn Else Do . If ScheidingsCode="BULK"!$G(FrontOnly) Set MemTOENr="" . Else Kill MemTOENr . Set Fmt=$S($P(Rec,D,2)="":"PB\",1:"BR\") ; Blanko lijn of pagebreak . Set Fmt=Fmt_";2\BL" ; Afdruk code en extra blanko lijn Quit Fmt Convert(FabrPrep,Groep,Lijst) New SortKey1,SortKey2,Cnt,Reverse,EindFormat,HalfFormat Quit:$D(Groep(FabrPrep))<10 ; Geen subnodes Set Lijst($I(Lijst))=FabrPrep_D_D_"*** "_$LI($$$PrepTranslate,$LF($$$PrepKeys,FabrPrep))_" ***" Set:$LF($$$PrepKeyPageBreak,FabrPrep)&&(Lijst>1) $P(Lijst(Lijst),D,2)="" Set (SortKey1,SortKey2)="" Set Cnt=0 For Set SortKey1=$O(Groep(FabrPrep,SortKey1)) Quit:SortKey1="" Do . Set:Cnt Lijst($I(Lijst))="" . Set Cnt=Cnt+1 . Set Reverse=$LI(Groep(FabrPrep,SortKey1),1)="E" . Set:Reverse EindFormat=$$EindFormat(Groep(FabrPrep,SortKey1)) . Set:'Reverse HalfFormat=$$HalfFormat(Groep(FabrPrep,SortKey1)) . For Set SortKey2=$O(Groep(FabrPrep,SortKey1,SortKey2)) Quit:SortKey2="" Do . . Set:'Reverse EindFormat=$$EindFormat(Groep(FabrPrep,SortKey1,SortKey2)) . . Set:Reverse HalfFormat=$$HalfFormat(Groep(FabrPrep,SortKey1,SortKey2)) . . ; 1 : Scheidingscode . . ; 2 : IdentNr . . ; 3 : KortTekst . . ; 4 : Qty . . ; 5 : NettoDim . . ; 6 : IsWerkVloer . . Set $P(Lijst($I(Lijst)),D,2)=HalfFormat ; Eerste steeds leeg . . ; 10 : TOENr . . ; 11 : DossierID . . ; 12 : Qty . . ; 13 : NettoDim . . Set $P(Lijst(Lijst),D,10)=EindFormat . . Set:'Reverse HalfFormat="" . . Set:Reverse EindFormat="" Quit HalfFormat(List) New PRNr,Qty,NettoDim,IsWerkVloer,IdentNr,KortTekst Set PRNr=$LI(List,2) Set Qty=$LG(List,3) Set NettoDim=$LG(List,4) Set IsWerkVloer=$LG(List,5) Set IdentNr=$P($G(^KPR(PRNr,2)),D,25) Set KortTekst=$P($G(^KPR(PRNr,0),"*onbekend "_PRNr_"*"),D) Quit IdentNr_D_KortTekst_D_Qty_D_NettoDim_D_IsWerkVloer EindFormat(List) New PRNr,Qty,NettoDim,TOENr,DossierID,isInkorten Set PRNr=$LG(List,2) Set Qty=$LG(List,3) Set NettoDim=$LG(List,4) Set TOENr=$LG(List,5) Set isInkorten=$LG(List,6) Set DossierID=$S(PRNr?4.7N:$P($G(^KPR(PRNr,"G")),D,1),1:"") Quit TOENr_D_DossierID_D_Qty_D_NettoDim_D_isInkorten ; MONT,LOS : Sortering op KorttekstHalfFabr+NettoDim,Toelev+DossierEindProd ; LOSBULK : Sortering op Toelev+KortTekstHalfFabr+NettoDim,DossierEindProd ; BIN, VPK : Sortering op ZaagVolgNr, KortTekstHalfFabr (omgekeerde gegevens hoger node eindprod, lagere node halffabr) Groep(FabrPrep,Arr,Groep,FrontOnly) New ZaagVolgNr,TOENr,EindPRNr,DossierID,Qty,isBulk,BSKey,BSRec,FabrPrep2,HalfPRNr,NettoDim,HalfQty New isWerkVloer,SortKey1,SortKey2,Data1,Data2 Set ZaagVolgNr="" For Set ZaagVolgNr=$O(Arr(ZaagVolgNr)) Quit:ZaagVolgNr="" Do . Set TOENr=$LG(Arr(ZaagVolgNr),1) . Set EindPRNr=$LG(Arr(ZaagVolgNr),2) . Set DossierID=$P($G(^KPR(EindPRNr,"G")),D,1) . Quit:DossierID="" . Set Qty=$LG(Arr(ZaagVolgNr),3) . Set isBulk=$$isBulk(EindPRNr) . Do BuildPRBSCache(EindPRNr,.PRBS) . . Set API = ##class(DOM.DomeinContext).Instance().GeefProductAPI() . Set Product = API.GeefProduct(EindPRNr) . . Set BSKey="" . For Set BSKey=$O(PRBS(BSKey)) Quit:BSKey="" Do . . Set BSRec=PRBS(BSKey) . . Set FabrPrep2=$P(BSRec,D,19) . . Set:isBulk&&(FabrPrep2="LOS") FabrPrep2="BULK" . . Quit:FabrPrep'=FabrPrep2 . . Quit:$P(BSRec,D,3)'="H" . . Set HalfPRNr=$P(BSRec,D) . . Quit:HalfPRNr'?4.7N . . Quit:$$CheckLosDedecker^MRPRES(TOENr,EindPRNr,BSRec) ; losse onderdelen worden door DeDecker als Proforma besteld - PV 04/03/2010 . . Set NettoDim=$P($G(PRBS(BSKey,"D")),D) ; Netto dimensie . . Set HalfQty=$P(BSRec,D,2) . . If ($IsObject(Product) && Product.%Extends("DOM.PM.TBXProduct.TBXLade")) Do . . . // kijk voor in te korten zaken . . . Set Inkorten=$$isInkorten(Product,BSKey,.InkortDim,.PRBS) . . . If Inkorten,$G(InkortDim) Set NettoDim=InkortDim . . . // Eventueel hoeveelheden verdubbelen bij V1 verpakkingen . . . Set HalfQty = $$bepaalHoeveelheid(Product,BSKey,HalfQty) . . . . . . . If (FabrPrep="MON")||(FabrPrep="LOS")||(FabrPrep="BULK")||(FabrPrep="VPZ")||((FabrPrep="BIN")&&$G(FrontOnly)&&0) Do . . . Set isWerkVloer=$$isWerkVloer(HalfPRNr) . . . ;Quit:$G(FrontOnly)&&(BSKey'["PRFRP") ; Alleen frontplaat voor binnenlade bij FrontOnly . . . If ((FabrPrep="MON")||(FabrPrep="LOS"))&&isWerkVloer Quit . . . ;Set SortKey1=$S(FabrPrep="BULK":TOENr_";",1:"")_$$SORTKEY^PRODUKT(HalfPRNr)_";"_NettoDim . . . Set SortKey1=$S(FabrPrep="BULK"!FrontOnly:TOENr_";",1:"")_$$SORTKEY^PRODUKT(HalfPRNr)_";"_NettoDim . . . Set SortKey2=$S(FabrPrep="VPZ":"*",1:TOENr_";"_DossierID) . . . . . . Set Data1=$G(Groep(FabrPrep,SortKey1),$LB("H",HalfPRNr,,NettoDim)) . . . ;If FabrPrep="BULK" Set $LI(Data1,5)='isWerkVloer . . . Set $LI(Data1,5)='isWerkVloer . . . Set $LI(Data1,3)=$LG(Data1,3)+(HalfQty*Qty) . . . Set Groep(FabrPrep,SortKey1)=Data1 . . . . . . Set Data2=$G(Groep(FabrPrep,SortKey1,SortKey2),$LB("E",EindPRNr,,NettoDim,TOENr)) . . . Set $LI(Data2,3)=$LG(Data2,3)+(Qty) . . . Set $LI(Data2,6)=Inkorten . . . Set Groep(FabrPrep,SortKey1,SortKey2)=$S(FabrPrep="VPZ":"",1:Data2) . . . . Else If (FabrPrep="BIN")||(FabrPrep="VPK")||(FabrPrep="RUGB") Do . . . Quit:(FabrPrep="VPK")&&(BSKey'["PRVPOD") ; Alleen omvouw karton bij verpakking . . . Set SortKey1=(1000+ZaagVolgNr)_";"_DossierID . . . If FabrPrep="BIN" Set SortKey1=TOENr_";"_DossierID . . . Set SortKey2=$$SORTKEY^PRODUKT(HalfPRNr) . . . . . . Set Data1=$G(Groep(FabrPrep,SortKey1),$LB("E",EindPRNr,Qty,,TOENr)) . . . Set Groep(FabrPrep,SortKey1)=Data1 . . . . . . Set Data2=$G(Groep(FabrPrep,SortKey1,SortKey2),$LB("H",HalfPRNr,,NettoDim)) . . . Set $LI(Data1,5)='$$isWerkVloer(HalfPRNr) . . . Set $LI(Data2,3)=$LG(Data2,3)+(HalfQty*Qty) . . . Set Groep(FabrPrep,SortKey1,SortKey2)=Data2 Quit BuildPRBSCache(MPRNr,PRBS) Kill PRBS Merge PRBS=^PRBS("BS",MPRNr) Set API = ##class(DOM.DomeinContext).Instance().GeefProductAPI() Set Tandembox = API.GeefProduct(MPRNr) If ($IsObject(Tandembox) && Tandembox.%Extends("DOM.PM.TBXProduct.TBXLade")) Do . If '$D(PRBS("PRAKLI.001")) Do ; Er zijn geen separate afdekkappen, dus toevoegen . . ;Toevoegen AFDEKKAP ZAA.xxx . . If '$LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"NMAK")) Do ; Niet meeleveren afdekkap . . . If (Tandembox.GeefZijkantDesign() = ##class(DOM.PM.enu.TBXZijkantDesign).A()) Do . . . . Set Kleur=$LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"KL")) ; Kleur lade . . . . Set HPRNr=$CASE(Kleur,"SW":472015,"BZ":471997,"IN":472252,:478609) . . . . Set BSRec=HPRNr_"\2\H" ; ZAA 532 en ZAA5329 (inox) . . . . Set $P(BSRec,D,19)="LOS" . . . . Set PRBS("PRAKLI.001")=BSRec . . . Else If (Tandembox.GeefZijkantDesign() = ##class(DOM.PM.enu.TBXZijkantDesign).F()) Do . . . . Set BSRec="74660\2\H" ; ZAA 330C . . . . Set $P(BSRec,D,19)="LOS" . . . . Set PRBS("PRAKLI.001")=BSRec . . . Else Do ; standard . . . . Set BSRec="472251\2\H" ; ZAA 330C.BT (nieuwe rechthoekige afdekkap met Blum ingedrukt . . . . Set $P(BSRec,D,19)="LOS" . . . . Set PRBS("PRAKLI.001")=BSRec . . . . ;Set BSRec="24665\1\H" ; ZAA 230N LI . . . . ;Set $P(BSRec,D,19)="LOS" . . . . ;Set PRBS("PRAKLI.001")=BSRec . . . . ;Set BSRec="24666\1\H" ; ZAA 230N RE . . . . ;Set $P(BSRec,D,19)="LOS" . . . . ;Set PRBS("PRAKRE.001")=BSRec . ;Toevoegen STEUN K-ZARGE T54.3300 . If $D(PRBS("PRLALI.001"))&&'$D(PRBS("PRLARE.001")) Do ; Linkse zonder rechtse -> V1 . . If ($LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"ZW"))="K")&&($LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"LT"))="L") Do . . . Set BSRec="126100\2\H" ;T54.3300 . . . Set $P(BSRec,D,19)="LOS" . . . Set PRBS("PRXPOSK.001")=BSRec Quit BuildPRBSCacheOld(MPRNr,PRBS) ;old PV 24/11/2009 Kill PRBS Merge PRBS=^PRBS("BS",MPRNr) If $D(PRBS("PRLALI.001"))&&'$D(PRBS("PRLARE.001")) Do ; Linkse zonder rechtse -> V1 . ;Toevoegen AFDEKKAP ZAA.xxx . If '$LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"NMAK")) Do ; Niet meeleveren afdekkap . . If $LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"DC"))="I" Do ; I-design . . . Set Kleur=$LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"KL")) ; Kleur lade . . . Set HPRNr=$CASE(Kleur,"SW":371667,"BZ":378174,"IN":372975,:462984) . . . Set BSRec=HPRNr_"\2\H" ; ZAA 532 en ZAA5329 (inox) . . . Set $P(BSRec,D,19)="LOS" . . . Set PRBS("PRAKLI.001")=BSRec . . Else If $LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"DC"))="F" Do ; F-design . . . Set BSRec="74660\2\H" ; ZAA 330C . . . Set $P(BSRec,D,19)="LOS" . . . Set PRBS("PRAKLI.001")=BSRec . . Else Do ; standard . . . Set BSRec="472251\2\H" ; ZAA 330C.BT (nieuwe rechthoekige afdekkap met Blum ingedrukt . . . Set $P(BSRec,D,19)="LOS" . . . Set PRBS("PRAKLI.001")=BSRec . . . ;Set BSRec="24665\1\H" ; ZAA 230N LI . . . ;Set $P(BSRec,D,19)="LOS" . . . ;Set PRBS("PRAKLI.001")=BSRec . . . ;Set BSRec="24666\1\H" ; ZAA 230N RE . . . ;Set $P(BSRec,D,19)="LOS" . . . ;Set PRBS("PRAKRE.001")=BSRec . ;Toevoegen STEUN K-ZARGE T54.3300 . If ($LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"ZW"))="K")&&($LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",MPRNr,"LT"))="L") Do . . Set BSRec="126100\2\H" ;T54.3300 . . Set $P(BSRec,D,19)="LOS" . . Set PRBS("PRXPOSK.001")=BSRec Quit ; Verpakking = K:Kist,P:Pallet, C:CommissieZonderOnderdelen of O:CommisieMetOnderdelen, A:VHossZonderOnderdelen of B:VHossMetOnderdelen, Y:ProboxZonderOnderdelen of X:ProboxMetOnderdelen isBulk(PRNr) Quit "S;Z"'[$LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",PRNr,"VERPAK")) ; Niet stuksverpakt met of zonder onderdelen ; Nakijken of het halffabr in voorraad op de werkvloer ligt isWerkVloer(PRNr) New Rec15,Rec2 Set Rec15=$G(^KPR(PRNr,15)) Set Rec2=^KPR(PRNr,2) If '+$P(Rec2,D,15) Quit 1 ; Alle voorraad op de werkvloer ;If $P(Rec15,D,11)="W" Quit 1 If $P(Rec15,D,5)'="" Quit 1 ; Er wordt voorraad gehouden op de werkvloer, de goederen liggen ook in het automatisch mag Quit 0 ; Er wordt geen voorraad gehouden op de werkvloer alleen degene die nodig zijn voor productie ; Nakijken of er moet ingekort worden ; InkortDim als .Local oproepen ; PRBS als .Local oproepen isInkorten(TandemBox,BSKey,InkortDim,PRBS) New Found,HFPRNr Set InkortDim="" If ((BSKey["PRSB.")&&'$D(PRBS("PRSS.001")))||(BSKey["PRSS.") Do Quit 1 ; stabilisator set of stabilisator stang (laatste alleen voor laden bredere dan 1200 . Set InkortDim=$LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",TandemBox.GeefPRNr(),"IB"))-86 ; Lengte berekenen van de stabilisator stang Else If BSKey["PRRL." Do Quit Found ; reling . Set Found = TandemBox.BevatInTeKortenReling() . If Found Do . . Set InkortDim = ##class(DOM.PM.Maatwerk.TBX.HalffabrikaatUtils).GeefRelingLengteNaInkorten(TandemBox.GeefPRNr(),TandemBox.GeefReling().GeefPRNr()) Else If (BSKey["PRRLADAPT.") Do Quit Found ; tussenreling . Set Found=(TandemBox.BevatTussenReling() && TandemBox.BevatInTeKortenReling()) . If Found Do . . Set InkortDim = ##class(DOM.PM.Maatwerk.TBX.HalffabrikaatUtils).GeefRelingLengteNaInkorten(TandemBox.GeefPRNr(),TandemBox.GeefTussenReling().GeefPRNr()) Else If (BSKey["PRBXKG.")||(BSKey["PRBXKGSTRK.") Do Quit Found ; boxsideglas . Set Found = TandemBox.BevatInTeKortenZijkantGlas() . If Found Do . . Set InkortDim=$LG(##class(Prod.Kenmerk.DataDefinitie).Get("TBX",TandemBox.GeefPRNr(),"LD"))-60 Quit 0 bepaalHoeveelheid(TandemBox,BSKey,BouwsteenHoeveelheid) Set Hoeveelheid = BouwsteenHoeveelheid If (BSKey["PRBXKG.")||(BSKey["PRBXKGSTRK.") { // Voor boxkapglas is de hoeveelheid te picken glazen altijd 2, onafhankelijk van wat in de bouwsteen staat Set Hoeveelheid = 2 } Quit Hoeveelheid