import{a as p}from"./chunk-ZDBU37AE.js";import{g as f}from"./chunk-V64RF3DS.js";import{$b as S,H as a,_b as o,fd as c,p as n,rd as P,v as l}from"./chunk-ATD4AEXQ.js";import{_c as m,ca as g,fa as s}from"./chunk-BXH3QC5E.js";var k=(()=>{class i{printLPSFacade;toastMessageService;loggingService;translateService;constructor(e,r,t,h){this.printLPSFacade=e,this.toastMessageService=r,this.loggingService=t,this.translateService=h}handlePrinterCallPackingNote(e){let r=this.getPrintDeliveryNoteRequest(e);this.printLPSFacade.print(r,a.DELIVERY_NOTE).subscribe({next:t=>{t.errorCode===l.OK?this.toastMessageService.showToastPanel(c.getSuccessDefaultConfig().withMessage(this.translateService.instant("MSG_NOTE_PRINTED",{noteNumber:e}))):this.handlePrintErrorMessage(this.getPackingNoteErrorMessage(e,`${t.errorCode}: ${t.detailMessage}`))},error:t=>{this.handlePrintErrorMessage(this.getPackingNoteErrorMessage(e,t))}})}getPrintDeliveryNoteRequest(e){return{noteNr:e,dialogCode:n.PACKING_STATUS,sysUser:o.getSystemUser()?.userName,buCode:o.getBusinessUnit()?.code,wsCode:o.getWorkstation()?.code,printerName:S.getPrinterName(n.PACKING_STATUS,a.DELIVERY_NOTE),reportName:a.DELIVERY_NOTE,isParked:!1,reprint:!0,suppressBulkPutUp:!1}}getPackingNoteErrorMessage(e,r){return this.translateService.instant("MSG_ERROR_NOTE_NOT_PRINTED",{noteNumber:e,error:r})}handlePrintErrorMessage(e){this.loggingService.error(e),this.toastMessageService.showToastPanel(c.getErrorDefaultConfig().withMessage(e))}static \u0275fac=function(r){return new(r||i)(s(p),s(P),s(f),s(m))};static \u0275prov=g({token:i,factory:i.\u0275fac})}return i})();export{k as a};
