import { Component, Injector, ViewChild, OnInit } from '@angular/core'; import { appModuleAnimation } from '@shared/animations/routerTransition'; import { AppComponentBase } from '@shared/common/app-component-base'; import { SubAppServiceProxy, SubAppDto, RackTypeServiceProxy, WaferAreaServiceProxy } from '@shared/service-proxies/service-proxies'; import { Table } from 'primeng/components/table/table'; import * as _ from 'lodash'; import { LazyLoadEvent } from 'primeng/api'; import { Paginator } from 'primeng/primeng'; import { FileDownloadService } from '@shared/utils/file-download.service'; import { SelfHttp } from '@app/shared/common/utils/selfHttp.service'; import { WaferHttp } from '@app/shared/common/utils/waferhttp.service'; import { WaferAreaLookupTableModalComponent } from '@app/shared/lookup/waferAreaLookup/waferArea-lookup-table-modal.component'; import { WaferAreaSerarchInputDto } from '../waferarea/waferarea.model'; import { GetWaferForViewDto, WaferSendOutDto } from '../wafersendout/wafersendout.model'; @Component({ templateUrl: './wafercancelsend.component.html', animations: [appModuleAnimation()] }) export class WaferCancelSendComponent extends AppComponentBase implements OnInit { @ViewChild('dataTable') dataTable: Table; @ViewChild('paginator') paginator: Paginator; @ViewChild('waferAreaLookupTableModal') waferAreaLookupTableModal: WaferAreaLookupTableModalComponent; advancedFiltersAreShown = false; //Filters filterText = ''; code = ''; controllot = ''; waferAreaSerarchInputDto = new WaferAreaSerarchInputDto(); selectWafers: Array = new Array(); waferSendOut: WaferSendOutDto = new WaferSendOutDto(); fromCode: string; toCode: string; selectArea: string; checklocation: string; userName: string; constructor( injector: Injector, private _waferAreaService: WaferAreaServiceProxy, private _fileDownloadService: FileDownloadService, private waferHttp: WaferHttp ) { super(injector); } ngOnInit(): void { } getAll(): void { let data = { filter: this.filterText }; if (this.filterText === '') { this.message.error('扫入资料不能为空!'); return; } this.waferHttp.get('api/WaferTraceManage/WaferCancelSendOutSelect', data, res => { console.log(888, res); this.primengTableHelper.records = res; this.selectWafers = res; if (res.length > 0) { } else { this.message.error('扫入资料无发料信息!'); } }); } cancelSendOutConfirm() { if (this.selectWafers.length === 0) { this.message.error('请选择Wafer!'); return; } this.waferSendOut.waferList = this.selectWafers.map(a => a.WAFERID); this.waferSendOut.fromArea = this.fromCode; this.waferSendOut.toArea = this.toCode; this.waferSendOut.userId = this.appSession.getShownLoginName(); this.userName = this.selectWafers[0].USERNAME; let self = this; if (this.appSession.getShownLoginName() !== this.userName ) { this.message.error('当前登录人员不是发料人员,无法取消发料!'); return; } self.message.confirm('当前选中Wafer' + this.selectWafers.length + '片(共' + this.primengTableHelper.records.length + '片),确定取消发料吗?', isConfirmed => { if (isConfirmed) { this.cancelSendOut(); } } ); } cancelSendOut() { this.waferHttp.post('api/WaferTraceManage/WaferCancelSendout', this.waferSendOut, res => { this.notify.info(this.l('取消发料成功!')); this.filterText = ''; this.primengTableHelper.records = []; } ); } }