123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- import { Component, OnInit, ViewChild } from '@angular/core';
- import { _HttpClient, ModalHelper } from '@delon/theme';
- import { STColumn, STComponent, XlsxService } from '@delon/abc';
- import { SFSchema } from '@delon/form';
- import { FbsWorkingStatistics } from 'app/entity/fbs/fbs-working-statistics';
- import { FbsWorkingStatisticsService } from 'app/services/fbs/fbs-working-statistics.service';
- import { FbsPersonnelService } from 'app/services/fbs/fbs-personnel.service';
- import { DatePipe } from '@angular/common';
- import { NzNotificationService, NzModalService } from 'ng-zorro-antd';
- import { FbsScanCodeUpdateTimeComponent } from '../update-time/update-time.component';
- @Component({
- selector: 'app-fbs-scan-code-list',
- templateUrl: './list.component.html',
- })
- export class FbsScanCodeListComponent implements OnInit {
- constructor(
- private fbsWorkingStatisticsService: FbsWorkingStatisticsService,
- private fbsPersonnelService: FbsPersonnelService,
- private datePipe: DatePipe,
- private nzNotificationService: NzNotificationService,
- private nzModalService: NzModalService,
- private xlsx: XlsxService
- ) {}
- ngOnInit() {
- this.getList();
- this.getProperList();
- this.getTotalList();
- }
- dataList = []; //表格数据
- isLoading = false; //表格加载
- //分页参数
- page = {
- total: 0,
- current: 0,
- size: 0,
- };
- fbsWorkingStatistics: FbsWorkingStatistics = {}; //派工单对象
- /**
- * 查询按钮
- */
- query() {
- this.fbsWorkingStatistics.pageNo = 1;
- //主数据刷新
- this.getList();
- //计算各个合计
- this.getTotalList();
- }
- // 按页码查询
- pageIndexChange(event) {
- this.fbsWorkingStatistics.pageNo = event;
- //主数据刷新
- this.getList();
- }
- /**
- * 主数据查询
- */
- getList() {
- this.isLoading = true;
- //时间格式化
- this.fbsWorkingStatistics.start = this.datePipe.transform(this.fbsWorkingStatistics.start, 'yyyy-MM-dd');
- this.fbsWorkingStatistics.end = this.datePipe.transform(this.fbsWorkingStatistics.end, 'yyyy-MM-dd');
- this.fbsWorkingStatisticsService.list(this.fbsWorkingStatistics).then(response => {
- if (response.success) {
- //查询成功
- this.dataList = response.result.records; //表格数据
- this.page = response.result; //分页数据
- // this.getTotal();//查询总计//计算各个合计
- this.getTotalList();
- this.isLoading = false;
- }
- });
- }
- /**
- * 计算各个总计
- */
- getTotalList() {
- this.fbsWorkingStatistics.start = this.datePipe.transform(this.fbsWorkingStatistics.start, 'yyyy-MM-dd');
- this.fbsWorkingStatistics.end = this.datePipe.transform(this.fbsWorkingStatistics.end, 'yyyy-MM-dd');
- let fbsWorkingStatistics = JSON.parse(JSON.stringify(this.fbsWorkingStatistics));
- fbsWorkingStatistics.pageSize = -1;
- this.fbsWorkingStatisticsService.list(fbsWorkingStatistics).then(response => {
- if (response.success) {
- //查询成功
- let dataList = response.result.records; //表格数据
- this.getTotal(dataList); //查询总计
- this.isLoading = false;
- }
- });
- }
- /**
- * 初始化总计变量
- */
- totalList: any = {};
- initializationTotal() {
- this.totalList = {
- workingHoursTotal: 0,
- qualifiedNumberTotal: 0,
- };
- }
- /**
- * 计算工时、数量总计
- */
- getTotal(dataList) {
- this.initializationTotal();
- dataList.forEach(element => {
- this.totalList.workingHoursTotal += Number(element.workingHours);
- this.totalList.qualifiedNumberTotal += Number(element.qualifiedNumber);
- });
- this.totalList.workingHoursTotal = this.totalList.workingHoursTotal.toFixed(1);
- this.totalList.qualifiedNumberTotal = this.totalList.qualifiedNumberTotal.toFixed(1);
- }
- /**
- * 初始化人员下拉数据集合
- */
- properList = [];
- getProperList() {
- // this.fbsWorkshopDispatchListService.getPerAndDerp().then((response)=>{
- // this.properList=response.result
- // })
- this.fbsPersonnelService.list({ pageSize: 1000 }).then(response => {
- this.properList = response.result.records;
- });
- }
- update(item) {
- const modal = this.nzModalService.create({
- nzTitle: '修改',
- nzWidth: '50%',
- nzContent: FbsScanCodeUpdateTimeComponent,
- nzComponentParams: {
- id: item.id,
- },
- nzFooter: [
- {
- //取消
- label: '取消',
- type: 'default',
- onClick: model => {
- model.close();
- },
- },
- {
- label: '保存',
- type: 'primary',
- onClick: model => {
- // model.save().then(()=>{
- // this.getList()
- // })
- model.save().then(() => {
- this.fbsWorkingStatisticsService.updateTime(model.fbsWorkingStatistics).then(response => {
- if (response.success) {
- this.nzNotificationService.success('修改成功', '');
- //刷新list列表
- model.close();
- this.getList();
- this.isLoading = false;
- } else {
- this.nzNotificationService.error('修改失败', response.message);
- this.isLoading = false;
- }
- });
- });
- },
- },
- ],
- });
- }
- /**
- * 取消报工
- */
- cancelWorkReport(item){
- if(!item.rueck&&!item.rmzhl){
- this.nzNotificationService.warning('SAP确认号与计数器为空,不能取消报工', '');
- return;
- }
- this.fbsWorkingStatisticsService.cancelWorkReport(item).then(response=>{
- if (response.success) {
- this.nzNotificationService.success('取消成功', '');
- //刷新list列表
- this.getList();
- this.isLoading = false;
- } else {
- this.nzNotificationService.error('取消失败', response.message);
- this.isLoading = false;
- }
- })
- }
- view() {}
- /**
- * 导出
- */
- exportLoading=false;
- export() {
- this.exportLoading=true;
- //时间格式化
- // this.fbsWorkingStatistics.start = this.datePipe.transform(this.fbsWorkingStatistics.start, 'yyyy-MM-dd');
- // this.fbsWorkingStatistics.end = this.datePipe.transform(this.fbsWorkingStatistics.end, 'yyyy-MM-dd');
- let fbsWorkingStatistics =JSON.parse(JSON.stringify(this.fbsWorkingStatistics));
- fbsWorkingStatistics.pageNo=1
- fbsWorkingStatistics.pageSize = -1;
- this.fbsWorkingStatisticsService.list(fbsWorkingStatistics).then(response => {
- if (response.success) {
- //查询成功
- let dataList = response.result.records; //表格数据
- let data=[];
- //设置导出头
- let title=[
- ['项目编号'],
- ['项目名称'],
- ['人员编码'],
- ['姓名'],
- ['订单编号'],
- ['物料编码'],
- ['物料名称'],
- ['工艺流程'],
- ['上岗时间'],
- ['下岗时间'],
- ['扫码信息'],
- ['工时'],
- ['完成数量']
- ]
- data.push(title);
- //添加导出行数据
- if(dataList){
- dataList.forEach(element => {
- let row=[];
- row.push(element.costItemCode)
- row.push(element.projectName)
- row.push(element.personnelCode)
- row.push(element.personnelName)
- row.push(element.orderNumber)
- row.push(element.materielCode)
- row.push(element.materielName)
- row.push(element.fbsTechnologicalProcessItemName)
- row.push(element.firstTime)
- row.push(element.finalTime)
- row.push(element.finalInfo)
- row.push(element.workingHours)
- row.push(element.qualifiedNumber)
- data.push(row)
- });
- data.push([
- '总计',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- this.totalList.workingHoursTotal,
- this.totalList.qualifiedNumberTotal
- ])
- }
- // 导出
- this.xlsx.export({
- sheets: [
- {
- data: data,
- name: '扫码记录',
- },
- ],
- filename: '扫码记录.xlsx',
- });
- this.exportLoading = false;
- }
- });
- }
- reportExportLoading=false
- reportExport(){
- this.reportExportLoading=true;
- let fbsWorkingStatistics =JSON.parse(JSON.stringify(this.fbsWorkingStatistics));
- this.fbsWorkingStatisticsService.getReportExport(fbsWorkingStatistics).then(response => {
- if (response.success) {
- //查询成功
- let dataList = response.result; //表格数据
- let data=[];
- //设置导出头
- let title=[
- ['项目编号'],
- ['项目名称'],
- ['原价代码'],
- ['WBS元素'],
- ['WBS元素描述'],
- ['报工WBS'],
- ['网络号'],
- ['网络活动号'],
- ['完工成度'],
- ['过账日期'],
- ['正常工时'],
- ['单位'],
- ['完工数量']
- ]
- data.push(title);
- //添加导出行数据
- if(dataList){
- dataList.forEach(element => {
- let row=[];
- row.push(element.costItemCode)
- row.push(element.projectName)
- row.push(element.originalPriceCode)
- row.push(element.wbsElement)
- row.push(element.wbsElementDescription)
- row.push(element.workReportWbs)
- row.push(element.workReportNetwork)
- row.push(element.workReportingActivities)
- row.push(element.speedOfProgress)
- row.push(this.datePipe.transform(fbsWorkingStatistics.end, 'yyyyMMdd'))
- row.push(element.workingHours)
- row.push('H')
- row.push(element.qualifiedNumber)
- data.push(row)
- });
- }
- // 导出
- this.xlsx.export({
- sheets: [
- {
- data: data,
- name: '报表导出',
- },
- ],
- filename: '报表导出.xlsx',
- });
- this.reportExportLoading = false;
- }else{
- this.nzNotificationService.error('导出失败', response.message);
- this.reportExportLoading = false;
- }
- })
- }
-
- }
|