You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
314 lines
9.2 KiB
TypeScript
314 lines
9.2 KiB
TypeScript
import { Injectable } from "@angular/core";
|
|
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
|
|
import { ConnectorService } from "src/app/hmg-common/services/connector/connector.service";
|
|
import { Observable } from "rxjs";
|
|
import { WorkListBodyRequest } from "../models/NotificationBodyReq";
|
|
import { EITNotificatonBodyResponse } from "../models/EITNotificationBodyRes";
|
|
import { AbsenceNotificatonBodyResponse } from "../models/AbsenceNotificationBodyRes";
|
|
import { WorkListButtonRequest } from "../models/NotificationButtonReq";
|
|
import { NotificatonButtonResponse } from "../models/NotificationButtonRes";
|
|
import { WorklistsubmitterInfoResponse } from "../models/WorklistsubmitterInfoRes";
|
|
import { WorkListSubmitterInfoRequest } from "../models/WorklistsubmitterInfoReq";
|
|
import { WorkListActionRequest } from "../models/NotificationActionReq";
|
|
import { PONotificatonBodyResponse } from "../models/PONotificationBodyRes";
|
|
import { MONotificatonBodyResponse } from "../models/MONotificationBodyRes";
|
|
import { PRNotificatonBodyResponse } from "../models/PRNotificationBodyRes";
|
|
import { StaticInjector } from "@angular/core/src/di/injector";
|
|
import { POItemHistoryRes } from "../models/POItemHistoryRes";
|
|
import { MOItemHistoryRes } from "../models/MOItemHistoryRes";
|
|
import { QuotationAnalysisResponse } from '../models/quotationAnalysisRes';
|
|
import { Request } from 'src/app/hmg-common/services/models/request';
|
|
import { LoginModel } from '../../authentication/models/LoginModel';
|
|
import { itgRequest } from '../models/itgFormDetailsRequest';
|
|
|
|
@Injectable()
|
|
export class WorklistMainService {
|
|
public static getEITNotificationBody =
|
|
"Services/ERP.svc/REST/GET_EIT_NOTIFICATION_BODY";
|
|
public static getAbsenceNotificationBody =
|
|
"Services/ERP.svc/REST/GET_ABSENCE_NOTIFICATION_BODY";
|
|
public static getPoNotificationBody =
|
|
"Services/ERP.svc/REST/GET_PO_NOTIFICATION_BODY";
|
|
public static getMONotificationBody =
|
|
"Services/ERP.svc/REST/GET_MO_NOTIFICATION_BODY";
|
|
public static getPRNotificationBody =
|
|
"Services/ERP.svc/REST/GET_PR_NOTIFICATION_BODY";
|
|
public static getPOItemHistory = "Services/ERP.svc/REST/GET_PO_ITEM_HISTORY";
|
|
public static getMOItemHistory = "Services/ERP.svc/REST/GET_MO_ITEM_HISTORY";
|
|
public static getNotificationButtons =
|
|
"Services/ERP.svc/REST/GET_NOTIFICATION_BUTTONS";
|
|
public static getUserInfo = "Services/ERP.svc/REST/Get_UserInformation";
|
|
public static getNotificationAction =
|
|
"Services/ERP.svc/REST/NOTIFICATION_ACTIONS";
|
|
public static getNotificationRespondAtt =
|
|
"Services/ERP.svc/REST/NOTIFICATION_GET_RESPOND_ATTRIBUTES";
|
|
public static getQutationAnalysisUrl =
|
|
"Services/ERP.svc/REST/GET_QUOTATION_ANALYSIS";
|
|
public static getITGFormTaskCount =
|
|
'Services/COCWS.svc/REST/ITGGetTaskCountRequestType';
|
|
public static getITGFormTaskDetails =
|
|
'Services/COCWS.svc/REST/ITGFormsPendingTasks';
|
|
public static getITGFormDetails =
|
|
'Services/COCWS.svc/REST/ITGGetFormDetials';
|
|
|
|
|
|
|
|
constructor(
|
|
public api: ConnectorService,
|
|
public authService: AuthenticationService
|
|
) { }
|
|
|
|
public getEITNotificationBody(
|
|
WorkListBodyRequest: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<EITNotificatonBodyResponse> {
|
|
const request = WorkListBodyRequest;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getEITNotificationBody,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getAbsencesNotificationBody(
|
|
WorkListBodyRequest: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<AbsenceNotificatonBodyResponse> {
|
|
const request = WorkListBodyRequest;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getAbsenceNotificationBody,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getMONotificationBody(
|
|
WorkListBodyRequest: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<MONotificatonBodyResponse> {
|
|
const request = WorkListBodyRequest;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getMONotificationBody,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getPRNotificationBody(
|
|
WorkListBodyRequest: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<PRNotificatonBodyResponse> {
|
|
const request = WorkListBodyRequest;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getPRNotificationBody,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getPONotificationBody(
|
|
WorkListBodyRequest: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<PONotificatonBodyResponse> {
|
|
const request = WorkListBodyRequest;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getPoNotificationBody,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getPOItemHistory(
|
|
POItemHistoryReq: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<POItemHistoryRes> {
|
|
const request = POItemHistoryReq;
|
|
this.authService.authenticateRequest(request);
|
|
// this.authService.setPublicFields(request);
|
|
|
|
return this.api.post(
|
|
WorklistMainService.getPOItemHistory,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getMOItemHistory(
|
|
MOItemHistoryReq: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<MOItemHistoryRes> {
|
|
const request = MOItemHistoryReq;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getMOItemHistory,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getQutationAnalysis(
|
|
qutationAnalysis: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<QuotationAnalysisResponse> {
|
|
const request = qutationAnalysis;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getQutationAnalysisUrl,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getNotificationButtons(
|
|
WorkListButtonRequest: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<NotificatonButtonResponse> {
|
|
const request = WorkListButtonRequest;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getNotificationButtons,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getSubmitterInfo(
|
|
worklistsubmitterInfoObj: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<WorklistsubmitterInfoResponse> {
|
|
const request = worklistsubmitterInfoObj;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getUserInfo,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public actionButton(
|
|
WorkListActionRequest: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<any> {
|
|
const request = WorkListActionRequest;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getNotificationAction,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public notificationResponseAttr(
|
|
notifiResAttRequest: any,
|
|
onError?: any,
|
|
errorLabel?: string
|
|
): Observable<any> {
|
|
const request = notifiResAttRequest;
|
|
this.authService.authenticateRequest(request);
|
|
return this.api.post(
|
|
WorklistMainService.getNotificationRespondAtt,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
public getITGCount( onError?: any, errorLabel?: string, isPostNoLoad = false): Observable<any> {
|
|
const request = new Request();
|
|
this.authService.authenticateRequest(request);
|
|
if (isPostNoLoad) {
|
|
return this.api.postNoLoad(
|
|
WorklistMainService.getITGFormTaskCount,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
} else {
|
|
return this.api.post(
|
|
WorklistMainService.getITGFormTaskCount,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
}
|
|
|
|
public getITGFormDetails(request: itgRequest, onError?: any, errorLabel?: string): Observable<any> {
|
|
this.authService.authenticateRequest(request);
|
|
request.EmployeeNumber = request.P_USER_NAME;
|
|
console.log(request);
|
|
return this.api.post(
|
|
WorklistMainService.getITGFormDetails,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
|
|
|
|
public getITGDetails( onError?: any, errorLabel?: string, isPostNoLoad = false): Observable<any> {
|
|
const request = new Request();
|
|
console.log(request);
|
|
this.authService.authenticateRequest(request);
|
|
if (isPostNoLoad) {
|
|
return this.api.postNoLoad(
|
|
WorklistMainService.getITGFormTaskDetails,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
} else {
|
|
return this.api.post(
|
|
WorklistMainService.getITGFormTaskDetails,
|
|
request,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
public getITGActionRequest(itgrequest:itgRequest,actionURL:string, onError?: any, errorLabel?: string): Observable<any> {
|
|
this.authService.authenticateRequest(itgrequest);
|
|
itgrequest.EmployeeNumber = itgrequest.P_USER_NAME;
|
|
console.log(itgrequest);
|
|
console.log(actionURL);
|
|
return this.api.postItg(
|
|
actionURL,
|
|
itgrequest,
|
|
onError,
|
|
errorLabel
|
|
);
|
|
}
|
|
|
|
|
|
}
|