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