mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#1224 PCL// Bei Änderung des Status erscheint Fehlermeldung
This commit is contained in:
@@ -2,14 +2,9 @@
|
||||
<div class="printer-modal">
|
||||
<div class="header">
|
||||
<h1>Wählen Sie einen Drucker aus</h1>
|
||||
<lib-icon
|
||||
(click)="closeModal()"
|
||||
height="21px"
|
||||
class="close-icon"
|
||||
name="close"
|
||||
alt="close"
|
||||
></lib-icon>
|
||||
<lib-icon (click)="closeModal()" height="21px" class="close-icon" name="close" alt="close"></lib-icon>
|
||||
</div>
|
||||
<span *ngIf="errorMessage" class="error-message isa-font-color-warning">{{ errorMessage }}</span>
|
||||
<ng-container *ngIf="!error">
|
||||
<div class="body">
|
||||
<app-dropdown
|
||||
@@ -23,21 +18,12 @@
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div>
|
||||
<app-button
|
||||
[primary]="true"
|
||||
[load]="true"
|
||||
[disabled]="!loaded"
|
||||
(action)="emitPrint()"
|
||||
#printBtn
|
||||
>Drucken</app-button
|
||||
>
|
||||
<app-button [primary]="true" [load]="true" [disabled]="!loaded" (action)="emitPrint()" #printBtn>Drucken </app-button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="error">
|
||||
<span class="error-message isa-font-color-warning">{{
|
||||
errorMessage
|
||||
}}</span>
|
||||
<span class="error-message isa-font-color-warning">{{ errorMessage }}</span>
|
||||
</ng-container>
|
||||
</div>
|
||||
</app-modal>
|
||||
|
||||
@@ -8,11 +8,16 @@ import { PrinterSelectionComponent } from '../../../components/printer-selection
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ShelfAbholfachEtikettService {
|
||||
constructor(
|
||||
private printerService: PrintService,
|
||||
private omsPrintService: OMSPrintService,
|
||||
private appService: AppService
|
||||
) {}
|
||||
constructor(private printerService: PrintService, private omsPrintService: OMSPrintService, private appService: AppService) {}
|
||||
|
||||
async openSelectPrinterDialog(printerComponent: PrinterSelectionComponent, errorMessage?: string) {
|
||||
printerComponent.openDialog();
|
||||
printerComponent.setError(errorMessage);
|
||||
const printer = await printerComponent.print.pipe(takeUntil(printerComponent.closed), take(1)).toPromise();
|
||||
printerComponent.closeModal();
|
||||
|
||||
return printer;
|
||||
}
|
||||
|
||||
public async print(
|
||||
orderItemSubsetIds: number[],
|
||||
@@ -25,40 +30,31 @@ export class ShelfAbholfachEtikettService {
|
||||
data.statusObs$.next(true);
|
||||
}
|
||||
|
||||
const print = (printer?: string) =>
|
||||
const print = (printerStr?: string) =>
|
||||
this.omsPrintService
|
||||
.OMSPrintAbholfachetikettResponse({
|
||||
data: orderItemSubsetIds,
|
||||
printer,
|
||||
printer: printerStr,
|
||||
})
|
||||
.toPromise();
|
||||
|
||||
let printer: string;
|
||||
|
||||
if (this.appService.isIPadEnv()) {
|
||||
data.printerComponent.openDialog();
|
||||
printer = await data.printerComponent.print
|
||||
.pipe(takeUntil(data.printerComponent.closed), take(1))
|
||||
.toPromise();
|
||||
data.printerComponent.closeModal();
|
||||
printer = await this.openSelectPrinterDialog(data.printerComponent);
|
||||
}
|
||||
|
||||
if (!printer) {
|
||||
printer = await this.getDefaultPrinter();
|
||||
printer = (await this.getDefaultPrinter()) || (await this.openSelectPrinterDialog(data.printerComponent));
|
||||
}
|
||||
|
||||
try {
|
||||
print(printer);
|
||||
} catch (error) {
|
||||
console.log('Printing Abholfachetikett Failed');
|
||||
data.printerComponent.openDialog();
|
||||
setTimeout(
|
||||
() =>
|
||||
data.printerComponent.setError(
|
||||
error.message || 'Drucken des Abholfachetiketts fehlgeschlagen'
|
||||
),
|
||||
1500
|
||||
);
|
||||
printer = await this.openSelectPrinterDialog(data.printerComponent, 'Drucken des Abholfachetiketts fehlgeschlagen.');
|
||||
if (!!printer) {
|
||||
print(printer);
|
||||
}
|
||||
} finally {
|
||||
if (data.statusObs$ && data.statusObs$.next) {
|
||||
data.statusObs$.next(false);
|
||||
|
||||
Reference in New Issue
Block a user