Index: vhLABEL.mac.rou =================================================================== diff -u -r59138 -r74138 --- vhLABEL.mac.rou (.../vhLABEL.mac.rou) (revision 59138) +++ vhLABEL.mac.rou (.../vhLABEL.mac.rou) (revision 74138) @@ -1,38 +1,28 @@ vhLabel ;Afdrukken etiketten via Bartender [ 11/13/2003 2:38 PM ] - #define BartenderPath "\\FOP\DROPFOLDER\HALPROD01\" - #define BartenderDebugPath "\\FOP\c$\BARTENDER\TestBestanden\" + #define BartenderPath "\\FOP_disabled\DROPFOLDER\HALPROD01\" + #define BartenderDebugPath "\\FOP_disabled\c$\BARTENDER\TestBestanden\" ; format CMulti : Local(VolgKey,ProgLabel)=Data PrintMulti(CMulti,Debug) New VolgKey,BartDevice,BartLayout,ResGroep,ResID,DebugOne,File,CGroeped,C + ; Eerst groeperen volgens DEVICE and LAYOUT Set VolgKey="" For Set VolgKey=$O(CMulti(VolgKey)) Quit:VolgKey="" Do . Set ResGroep=$G(CMulti(VolgKey,"RESGROEP")) ; Zie ^RES(ResGroep,"LBLK",ResID) . Set ResID=$G(CMulti(VolgKey,"RESID")) . Quit:(ResGroep="")||(ResID="") . Set BartLayout=$G(CMulti(VolgKey,"BARTLAYOUT")) ; bv : "OLProduct6x10" - . Set BartDevice=$G(CMulti(VolgKey,"BARTDEVICE")) ; bv : "\\FOP\OL VERPAK1 6X10" + . Set BartDevice=$G(CMulti(VolgKey,"BARTDEVICE")) ; bv : "\\FOP_disabled\OL VERPAK1 6X10" . Quit:(BartLayout="")||(BartDevice="") . Merge CGroeped(BartDevice,BartLayout,$I(CGroeped(BartDevice,BartLayout)))=CMulti(VolgKey) ; Afdrukken per DEVICE en LAYOUT Set (BartDevice,BartLayout)="" For Set BartDevice=$O(CGroeped(BartDevice)) Quit:BartDevice="" Do . For Set BartLayout=$O(CGroeped(BartDevice,BartLayout)) Quit:BartLayout="" Do - . . Set VolgNr="" - . . Set File=$$CreateFile(BartDevice,BartLayout,.Debug) - . . Set:$G(Debug) DebugOne=1 - . . For Set VolgNr=$O(CGroeped(BartDevice,BartLayout,VolgNr)) Quit:VolgNr="" Do - . . . Kill C - . . . Merge C=CGroeped(BartDevice,BartLayout,VolgNr) - . . . Set ResGroep=$G(C("RESGROEP")) ; Zie ^RES(ResGroep,"LBLK",ResID) - . . . Set ResID=$G(C("RESID")) - . . . If $G(DebugOne) Do WriteLbl(ResGroep,ResID) Set DebugOne=0 - . . . Do WriteRow(ResGroep,ResID,.C) - . . Close:File'=0 File - . . Write:File=0 ! + . . Do PrintOneFileWithTryCatch(BartDevice,BartLayout,.Debug,.CGroeped) Quit ; format C : Local(ProgLabel)=Data @@ -42,16 +32,55 @@ Set ResID=$G(C("RESID")) Quit:(ResGroep="")||(ResID="") Set BartLayout=$G(C("BARTLAYOUT")) ; bv : "OLProduct6x10" - Set BartDevice=$G(C("BARTDEVICE")) ; bv : "\\FOP\OL VERPAK1 6X10" + Set BartDevice=$G(C("BARTDEVICE")) ; bv : "\\FOP_disabled\OL VERPAK1 6X10" Quit:(BartLayout="")||(BartDevice="") "" Set File=$$CreateFile(BartDevice, BartLayout,.Debug) Quit:File="" - Do:$G(Debug) WriteLbl(ResGroep,ResID) - Do WriteRow(ResGroep,ResID,.C) - Close:File'=0 File - Write:File=0 ! + Try { + Do:$G(Debug) WriteLbl(ResGroep,ResID) + Do WriteRow(ResGroep,ResID,.C) + Close:File'=0 File + Write:File=0 ! + } + Catch { + New GecatchteException, NewException + #dim GecatchteException As TECH.Exceptions = ##class(TECH.ExceptionHandler).Catch() + Close:(File'=0) File + Set NewException = ##class(TECH.Exceptions.GeneralErrorException).%New("Fout bij PrintOne") + Do NewException.VoegToeInnerExceptie(GecatchteException) + Do ##class(TECH.ExceptionHandler).Throw(NewException) + } Quit + +PrintOneFileWithTryCatch(BartDevice,BartLayout,Debug,CGroeped) + New VolgNr,File,C,DebugOne,ResID,ResGroep + Try { + Set VolgNr="" + Set File=$$CreateFile(BartDevice,BartLayout,.Debug) + Set:$G(Debug) DebugOne=1 + For { + Set VolgNr=$O(CGroeped(BartDevice,BartLayout,VolgNr)) Quit:VolgNr="" + Kill C + Merge C=CGroeped(BartDevice,BartLayout,VolgNr) + Set ResGroep=$G(C("RESGROEP")) ; Zie ^RES(ResGroep,"LBLK",ResID) + Set ResID=$G(C("RESID")) + If $G(DebugOne) Do WriteLbl(ResGroep,ResID) Set DebugOne=0 + Do WriteRow(ResGroep,ResID,.C) + } + Close:(File'=0) File + Write:(File=0) ! + } + Catch { + New GecatchteException, NewException + #dim GecatchteException As TECH.Exceptions = ##class(TECH.ExceptionHandler).Catch() + Close:(File'=0) File + Set NewException = ##class(TECH.Exceptions.GeneralErrorException).%New("Fout bij PrintOneFileWithTryCatch") + Do NewException.VoegToeInnerExceptie(GecatchteException) + Do ##class(TECH.ExceptionHandler).Throw(NewException) + } + Quit + CreateFile(BartDevice,BartLayout,Debug) New File Set File=0 @@ -67,8 +96,8 @@ Set File=$$OPEN^vhDEV($$$BartenderPath,"Lbl"_$TR($ZH,".","_")_".TXT","W","M") Use File Set BartenderPrinter="EasyCoderPD41" - Set BartenderPrinter="//FOP/HALUX 10x10" - Set:LabelSize="5x10" BartenderPrinter="//FOP/PD41 HALUX 5x10" + Set BartenderPrinter="//FOP_disabled/HALUX 10x10" + Set:LabelSize="5x10" BartenderPrinter="//FOP_disabled/PD41 HALUX 5x10" Set BartenderPrinter=$TR(BartenderPrinter,"/","\") Set BartenderLabelType=LabelType @@ -89,6 +118,10 @@ ;Do WriteLbl(ResGroep,LabelType) Quit File +GeefWaardeVanPrintRef(PrintRef) + ; LET OP : deze functie maakt gebruik van VEEL globale variabelen !!! Dus niet zomaar verplaatsen naar ProcedureBlock methods. + Quit @PrintRef + VervangNietPrintbareKaraktersDoorSpatie(Tekst) Set Tekst = $Translate(Tekst,$Char(9)_$Char(10)_$Char(13)_$Char(0)," ") Quit Tekst @@ -126,7 +159,7 @@ . . . ;do WLIP^vhDBG(15,"Before:"_Print) . . . Set:Print["{" Print=$$REPLACE5^vhRtn1(Print,"{","$$Label^vhLABEL(""","}",""")") ; label vervangen door $$Label^vhLABEL("label") . . . ;do WLIP^vhDBG(15,"After:"_Print) - . . . Write VervangNietPrintbareKaraktersDoorSpatie(@(Print)) + . . . Write $$VervangNietPrintbareKaraktersDoorSpatie($$GeefWaardeVanPrintRef(Print)) . . Write:VolgNr