From 5aeab4b08cf5ccbcbb897a76811aec3cefb0d898 Mon Sep 17 00:00:00 2001 From: ashwaq Date: Tue, 10 Mar 2020 12:18:29 +0300 Subject: [PATCH] add MO item History --- .../services/common/common.service.ts | 5 + .../item-history/item-history.component.html | 2 +- .../mo-item-history.component.html | 226 ++++++++++++++++++ .../mo-item-history.component.scss | 20 ++ .../mo-item-history.component.spec.ts | 27 +++ .../mo-item-history.component.ts | 123 ++++++++++ .../app/notification/notification.module.ts | 10 +- .../service/work-list.main.service.ts | 2 +- .../worklist-main-mr.component.html | 19 ++ .../worklist-main-mr.component.ts | 53 +++- Mohem/src/assets/localization/i18n.json | 4 + 11 files changed, 486 insertions(+), 5 deletions(-) create mode 100644 Mohem/src/app/notification/mo-item-history/mo-item-history.component.html create mode 100644 Mohem/src/app/notification/mo-item-history/mo-item-history.component.scss create mode 100644 Mohem/src/app/notification/mo-item-history/mo-item-history.component.spec.ts create mode 100644 Mohem/src/app/notification/mo-item-history/mo-item-history.component.ts diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index 17992c66..792c5131 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1171,6 +1171,11 @@ public getMonthNameAr(value: number): string { public openItemHistoryPage() { this.nav.navigateForward(['/notification/item-history-PO']); } + + public openMOItemHistoryPage(){ + this.nav.navigateForward(["/notification/item-history-MO"]); + + } public openQutationAnalysisPage() { this.nav.navigateForward(['/notification/qutation-analysis-PO']); } diff --git a/Mohem/src/app/notification/item-history/item-history.component.html b/Mohem/src/app/notification/item-history/item-history.component.html index 1ac2132a..f462abf7 100644 --- a/Mohem/src/app/notification/item-history/item-history.component.html +++ b/Mohem/src/app/notification/item-history/item-history.component.html @@ -1,5 +1,5 @@ - + {{ts.trPK('worklistMain','ITEM_HIS')}} diff --git a/Mohem/src/app/notification/mo-item-history/mo-item-history.component.html b/Mohem/src/app/notification/mo-item-history/mo-item-history.component.html new file mode 100644 index 00000000..cc1a2b58 --- /dev/null +++ b/Mohem/src/app/notification/mo-item-history/mo-item-history.component.html @@ -0,0 +1,226 @@ + + + + + {{ts.trPK('worklistMain','ITEM_HIS')}} + + + + + + + + + + + + + +
+

{{ 'general, empty' | translate}}

+
+ + + + +
+ + + + + + + + + + + + +
+ + {{itemHistory.REQUEST_NUMBER}} +
+ + + + +
+ + {{itemHistory.UNIT_OF_MEASURE}} +
+
+ + + + +
+ + {{itemHistory.QUANTITY}} +
+ + + + +
+ + {{itemHistory.DATE_REQUIRED}} + +
+
+ + + + + +
+ + {{itemHistory.LINE_STATUS_DIS}} +
+ + + + + +
+ + {{itemHistory.STATUS_DATE}} +
+ +
+ + + + + +
+ + {{itemHistory.TRANSACTION_TYPE_NAME}} +
+ + + + + +
+ + {{itemHistory.ORGANIZATION_NAME}} +
+ +
+ + + + + +
+ + {{itemHistory.ORGANIZATION_CODE}} +
+ + + + + +
+ + {{itemHistory.OPERATING_UNIT_NAME}} +
+ +
+ + + + + +
+ + {{itemHistory.FROM_SUBINVENTORY_CODE}} +
+ + + + + +
+ + {{itemHistory.FROM_LOCATOR}} +
+ +
+ + + + + +
+ + {{itemHistory.TO_SUBINVENTORY_CODE}} +
+ + + + + +
+ + {{itemHistory.TO_LOCATOR}} +
+ +
+ + + + + +
+ + {{itemHistory.SHIP_TO_LOCATION}} +
+ + +
+
+ +
+ +
+
+ + + + + +
\ No newline at end of file diff --git a/Mohem/src/app/notification/mo-item-history/mo-item-history.component.scss b/Mohem/src/app/notification/mo-item-history/mo-item-history.component.scss new file mode 100644 index 00000000..95c01568 --- /dev/null +++ b/Mohem/src/app/notification/mo-item-history/mo-item-history.component.scss @@ -0,0 +1,20 @@ +.itemeHistoryist { + background: #f0efef; + padding: 6px; + /* margin-top: 20px; */ + /* width: 100%;*/ +} +ion-label.labelValue.sc-ion-label-ios-h.sc-ion-label-ios-s.ios.hydrated, +ion-label.labelValue.sc-ion-label-md-h.sc-ion-label-md-s.md.hydrated +{ + white-space: pre-wrap !important; + --color: initial; + display: block; + color: var(--color); + font-family: var(--ion-font-family,inherit); + font-size: inherit; + text-overflow: ellipsis; + overflow: hidden; + -webkit-box-sizing: border-box; + box-sizing: border-box +} \ No newline at end of file diff --git a/Mohem/src/app/notification/mo-item-history/mo-item-history.component.spec.ts b/Mohem/src/app/notification/mo-item-history/mo-item-history.component.spec.ts new file mode 100644 index 00000000..00e6b861 --- /dev/null +++ b/Mohem/src/app/notification/mo-item-history/mo-item-history.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { MoItemHistoryComponent } from './mo-item-history.component'; + +describe('MoItemHistoryComponent', () => { + let component: MoItemHistoryComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ MoItemHistoryComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MoItemHistoryComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/notification/mo-item-history/mo-item-history.component.ts b/Mohem/src/app/notification/mo-item-history/mo-item-history.component.ts new file mode 100644 index 00000000..f67d319d --- /dev/null +++ b/Mohem/src/app/notification/mo-item-history/mo-item-history.component.ts @@ -0,0 +1,123 @@ +import { Component, OnInit } from '@angular/core'; +import { WorklistMainService } from '../service/work-list.main.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { ModalController } from '@ionic/angular'; +import { WorklistService } from '../service/worklist.service'; +import { MOItemHistoryReq } from '../models/MOItemHistoryReq'; +import { MOItemHistoryRes } from '../models/MOItemHistoryRes'; + +@Component({ + selector: 'app-mo-item-history', + templateUrl: './mo-item-history.component.html', + styleUrls: ['./mo-item-history.component.scss'], +}) +export class MoItemHistoryComponent implements OnInit { + getPassMOInfo: any; + itemHistoryRes: any; + IsReachEnd: boolean = false; + P_PAGE_NUM: number = 1; + P_PAGE_LIMIT: number = 50; + MOItemHistoryReq: any; + + constructor( + public worklistMainService: WorklistMainService, + private cs: CommonService, + private ts: TranslatorService, + public worklistService: WorklistService + ) { + this.getPassMOInfo = this.cs.sharedService.getSharedData('passMOReq'); + + this.MOItemHistoryReq = new MOItemHistoryReq(); + this.MOItemHistoryReq.P_PAGE_NUM = this.P_PAGE_NUM; + this.MOItemHistoryReq.P_PAGE_LIMIT = this.P_PAGE_LIMIT; + this.MOItemHistoryReq.P_ITEM_ID= this.getPassMOInfo.P_ITEM_ID; + this.MOItemHistoryReq.P_ORG_ID= this.getPassMOInfo.P_ORG_ID; + + } + + ngOnInit() { + + this.getMOItemHistory(this.getPassMOInfo.P_ITEM_ID,this.getPassMOInfo.P_ORG_ID); + + + + } + + getMOItemHistory(itemID ,orgID) { + console.log(itemID); + this.IsReachEnd = false; + const request = new MOItemHistoryReq(); + request.P_ITEM_ID = parseInt(itemID); + request.P_PAGE_LIMIT = 100; + request.P_PAGE_NUM = 1; + request.P_ORG_ID= parseInt(orgID); + + + + this.worklistMainService.getMOItemHistory(request). + subscribe((result: MOItemHistoryRes) => { + + this.handleItemHistoryResult(result); + }); + } + + + handleItemHistoryResult(result) { + if (this.cs.validResponse(result)) { + if (this.cs.hasData(result.GetMoItemHistoryList)) { + this.itemHistoryRes = result.GetMoItemHistoryList; + this.P_PAGE_NUM++; + this.MOItemHistoryReq.P_PAGE_NUM = this.P_PAGE_NUM; + let lastItemIndex = this.itemHistoryRes.length - 1; + if (result.GetMoItemHistoryList[lastItemIndex]) { + let lastitem = result.GetMoItemHistoryList[lastItemIndex]; + if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) { + this.IsReachEnd = true; + } else { + this.IsReachEnd = false; + } + } + } + + + } + +} + + +doInfinite(infiniteScroll) { + if (!this.IsReachEnd) { + // this.POItemHistoryReq.P_PAGE_NUM = this.P_PAGE_NUM; + this.worklistMainService.getMOItemHistory(this.MOItemHistoryReq). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.GetMoItemHistoryList != undefined) { + this.MOItemHistoryReq.P_PAGE_NUM=this.P_PAGE_NUM++; + (result.GetMoItemHistoryList).forEach(element => { + if (element.ROW_NUM == element.NO_OF_ROWS) { + this.IsReachEnd = true; + } else { + this.IsReachEnd = false; + } + this.itemHistoryRes.push(element); + }, (Error) => console.log(Error), () => infiniteScroll.target.complete()); + }// if list length >0 + else { + this.IsReachEnd = true; + } + }// if response == 1 + //this.pageNum++; + infiniteScroll.target.complete(); + + }); + } else { + if (infiniteScroll) + infiniteScroll.target.complete(); + } +}//end infiniteScroll + + + + +} diff --git a/Mohem/src/app/notification/notification.module.ts b/Mohem/src/app/notification/notification.module.ts index caa8cc34..4935cb92 100644 --- a/Mohem/src/app/notification/notification.module.ts +++ b/Mohem/src/app/notification/notification.module.ts @@ -31,6 +31,7 @@ import { WorkListMainItgComponent } from './work-list-main-itg/work-list-main-it // import { WorklistMainComponent } from './worklist-main/worklist-main.component'; import {MoreActionModalComponent} from './more-action-modal/more-action-modal.component' import { WorkListReplacementItgComponent } from './work-list-replacement-itg/work-list-replacement-itg.component'; +import { MoItemHistoryComponent } from './mo-item-history/mo-item-history.component'; const routes: Routes = [ @@ -114,7 +115,11 @@ const routes: Routes = [ { path: 'worklist-replacement-itg', component: WorkListReplacementItgComponent - } + }, + { + path: 'item-history-MO', + component: MoItemHistoryComponent + } ] } ]; @@ -148,7 +153,8 @@ const routes: Routes = [ WorklistMainMRComponent, WorklistAdvancedSearchComponent, WorkListMainItgComponent, - WorkListReplacementItgComponent + WorkListReplacementItgComponent, + MoItemHistoryComponent // WorklistMainComponent ], entryComponents: [ diff --git a/Mohem/src/app/notification/service/work-list.main.service.ts b/Mohem/src/app/notification/service/work-list.main.service.ts index 720f5c1e..3b55cffd 100644 --- a/Mohem/src/app/notification/service/work-list.main.service.ts +++ b/Mohem/src/app/notification/service/work-list.main.service.ts @@ -34,7 +34,7 @@ export class WorklistMainService { 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 = "GET_MO_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"; diff --git a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.html b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.html index e4f7e7a5..5d633db5 100644 --- a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.html +++ b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.html @@ -408,6 +408,25 @@ + + + + +
+ + +
+ + +
+
+ + diff --git a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts index edffe2f5..15585a23 100644 --- a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts +++ b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts @@ -31,6 +31,8 @@ import { ApplyActionModalComponent } from '../apply-action-modal/apply-action-mo import { MoreActionModalComponent } from '../more-action-modal/more-action-modal.component'; import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/work-list-replacement-roll.component'; import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component'; +import { MOItemHistoryRes } from '../models/MOItemHistoryRes'; +import { MOItemHistoryReq } from '../models/MOItemHistoryReq'; @Component({ selector: 'app-worklist-main-mr', @@ -99,6 +101,7 @@ export class WorklistMainMRComponent implements OnInit { approveDis: boolean = false; rejectDis: boolean = false; requestDis: boolean = false; + public static PASS_MO_REQ = "passMOReq"; @@ -233,7 +236,7 @@ export class WorklistMainMRComponent implements OnInit { } handleWorkListBodyResult(result, Type) { - this.notificationBodyRes = {}; + this.notificationBodyRes = []; if (this.common.validResponse(result)) { this.pInformation = result.P_INFORMATION; this.pQuestion = result.P_QUESTION; @@ -1026,4 +1029,52 @@ export class WorklistMainMRComponent implements OnInit { } + getMOItemHistory(itemID ,orgID) { + console.log(itemID); + this.IsReachEnd = false; + const request = new MOItemHistoryReq(); + request.P_ITEM_ID = parseInt(itemID); + request.P_PAGE_LIMIT = 100; + request.P_PAGE_NUM = 1; + request.P_ORG_ID= parseInt(orgID); + + + + this.worklistMainService.getMOItemHistory(request). + subscribe((result: MOItemHistoryRes) => { + // this.common.sharedService.setSharedData( + // result.GetItemHistoryList, + // WorklistMainPoComponent.ItemHistoryList + // ); + this.common.sharedService.setSharedData( + request, + WorklistMainMRComponent.PASS_MO_REQ + ); + //open page + // this.common.openItemHistoryPage(); + this.handleItemHistoryResult(result); + }); + } + + + handleItemHistoryResult(result) { + if (this.common.validResponse(result)) { + if (this.common.hasData(result.GetMoItemHistoryList)) { + this.common.openMOItemHistoryPage(); + + } + } + else { + this.common.presentAlert( + this.ts.trPK("general", "empty") + ); + } + + } + + } + + + + diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 33d6dac0..79891a78 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -2184,6 +2184,10 @@ "line_details":{ "en": "Line Details", "ar":"Line Details" + }, + "request_number":{ + "en": "Request Number", + "ar":"Request Number" } },