|
@@ -1,6 +1,6 @@
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
|
import { _HttpClient, ModalHelper } from '@delon/theme';
|
|
|
-import { STColumn, STComponent } from '@delon/abc';
|
|
|
+import { STColumn, STComponent, XlsxService } from '@delon/abc';
|
|
|
import { SFSchema } from '@delon/form';
|
|
|
import { NzDrawerService, NzNotificationService } from 'ng-zorro-antd';
|
|
|
import { FbsWorkshopDispatchListAddComponent } from '../add/add.component';
|
|
@@ -8,6 +8,7 @@ import { FbsWorkshopDispatchList } from 'app/entity/fbs/fbs-workshop-dispatch-li
|
|
|
import { FbsWorkshopDispatchListUpdateComponent } from '../update/update.component';
|
|
|
import { FbsWorkshopDispatchListViewComponent } from '../view/view.component';
|
|
|
import { FbsWorkshopDispatchListService } from 'app/services/fbs/fbs-workshop-dispatch-list.service';
|
|
|
+import { DatePipe } from '@angular/common';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-fbs-workshop-dispatch-list-list',
|
|
@@ -17,7 +18,9 @@ export class FbsWorkshopDispatchListListComponent implements OnInit {
|
|
|
constructor(
|
|
|
private nzDrawerService: NzDrawerService,
|
|
|
private fbsWorkshopDispatchListService: FbsWorkshopDispatchListService,
|
|
|
- private nzNotificationService: NzNotificationService
|
|
|
+ private nzNotificationService: NzNotificationService,
|
|
|
+ private datePipe: DatePipe,
|
|
|
+ private xlsx: XlsxService
|
|
|
) {}
|
|
|
|
|
|
ngOnInit() {
|
|
@@ -37,8 +40,8 @@ export class FbsWorkshopDispatchListListComponent implements OnInit {
|
|
|
/**
|
|
|
* 查询按钮
|
|
|
*/
|
|
|
- query(){
|
|
|
- this.fbsWorkshopDispatchList.pageNo=1;
|
|
|
+ query() {
|
|
|
+ this.fbsWorkshopDispatchList.pageNo = 1;
|
|
|
//主数据刷新
|
|
|
this.getList();
|
|
|
}
|
|
@@ -53,15 +56,103 @@ export class FbsWorkshopDispatchListListComponent implements OnInit {
|
|
|
/**
|
|
|
* 主数据查询
|
|
|
*/
|
|
|
- getList(){
|
|
|
- this.isLoading=true
|
|
|
- this.fbsWorkshopDispatchListService.list(this.fbsWorkshopDispatchList).then((response)=>{
|
|
|
- if(response.success){//查询成功
|
|
|
- this.dataList=response.result.records;//表格数据
|
|
|
- this.page=response.result;//分页数据
|
|
|
- this.isLoading=false;
|
|
|
+ getList() {
|
|
|
+ this.isLoading = true;
|
|
|
+ //时间格式化
|
|
|
+ this.fbsWorkshopDispatchList.start = this.datePipe.transform(this.fbsWorkshopDispatchList.start, 'yyyy-MM-dd');
|
|
|
+ this.fbsWorkshopDispatchList.end = this.datePipe.transform(this.fbsWorkshopDispatchList.end, 'yyyy-MM-dd');
|
|
|
+ this.fbsWorkshopDispatchListService.list(this.fbsWorkshopDispatchList).then(response => {
|
|
|
+ if (response.success) {
|
|
|
+ //查询成功
|
|
|
+ this.dataList = response.result.records; //表格数据
|
|
|
+ this.getEfficiency(this.dataList); //计算效率
|
|
|
+ this.page = response.result; //分页数据
|
|
|
+ this.isLoading = false;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出
|
|
|
+ */
|
|
|
+ exportLoading=false;
|
|
|
+ export() {
|
|
|
+ this.exportLoading=true;
|
|
|
+ //时间格式化
|
|
|
+ // this.fbsWorkshopDispatchList.start = this.datePipe.transform(this.fbsWorkshopDispatchList.start, 'yyyy-MM-dd');
|
|
|
+ // this.fbsWorkshopDispatchList.end = this.datePipe.transform(this.fbsWorkshopDispatchList.end, 'yyyy-MM-dd');
|
|
|
+ let fbsWorkshopDispatchList = new FbsWorkshopDispatchList();
|
|
|
+ fbsWorkshopDispatchList.pageSize = 20000;
|
|
|
+ fbsWorkshopDispatchList.start = this.datePipe.transform(this.fbsWorkshopDispatchList.start, 'yyyy-MM-dd');
|
|
|
+ fbsWorkshopDispatchList.end = this.datePipe.transform(this.fbsWorkshopDispatchList.end, 'yyyy-MM-dd');
|
|
|
+ this.fbsWorkshopDispatchListService.list(fbsWorkshopDispatchList).then(response => {
|
|
|
+ if (response.success) {
|
|
|
+ //查询成功
|
|
|
+ let dataList= response.result.records; //表格数据
|
|
|
+ this.getEfficiency(dataList); //计算效率
|
|
|
+ let data = [];
|
|
|
+ let title = [
|
|
|
+ ['姓名'], // 姓名
|
|
|
+ ['日期'], // 日期
|
|
|
+ ['生产订单号'], // 生产订单号
|
|
|
+ ['物料'], // 物料
|
|
|
+ ['任务数量'], // 任务数量
|
|
|
+ ['标准工时'], // 标准工时
|
|
|
+ ['完成数量'], // 完成数量
|
|
|
+ ['完成工时'], // 完成工时
|
|
|
+ ['达成率'], // 达成率
|
|
|
+ ['生产效率'], // 生产效率
|
|
|
+ ];
|
|
|
+ data.push(title);
|
|
|
+ dataList.forEach(element => {
|
|
|
+ let row = [];
|
|
|
+ row.push(element.name);
|
|
|
+ row.push(element.date);
|
|
|
+ row.push(element.productionOrderNumberName);
|
|
|
+ row.push(element.product);
|
|
|
+ row.push(element.numberOfTasks);
|
|
|
+ row.push(element.standardWorkingHours);
|
|
|
+ row.push(element.latestCompletedQuantity);
|
|
|
+ row.push(element.manHoursCompleted);
|
|
|
+ row.push(element.numberEfficiency+"%");
|
|
|
+ row.push(element.workingHoursEfficiency+"%");
|
|
|
+ data.push(row);
|
|
|
+ });
|
|
|
+ // 导出
|
|
|
+ this.xlsx.export({
|
|
|
+ sheets: [
|
|
|
+ {
|
|
|
+ data: data,
|
|
|
+ name: '派工单导出',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ filename: '派工单导出.xlsx',
|
|
|
+ });
|
|
|
+ this.exportLoading=false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算效率
|
|
|
+ */
|
|
|
+ getEfficiency(dataList) {
|
|
|
+ dataList.forEach(element => {
|
|
|
+ let numberOfTasks = element.numberOfTasks; //任务数量
|
|
|
+ let standardWorkingHours = element.standardWorkingHours; //标准工时
|
|
|
+ let latestCompletedQuantity = element.latestCompletedQuantity; //完成数量
|
|
|
+ let manHoursCompleted = element.manHoursCompleted; //完成工时
|
|
|
+ if (latestCompletedQuantity && Number(latestCompletedQuantity) !== 0) {
|
|
|
+ element.numberEfficiency = ((Number(latestCompletedQuantity) / Number(numberOfTasks)) * 100).toFixed(0);
|
|
|
+ } else {
|
|
|
+ element.numberEfficiency = 0;
|
|
|
+ }
|
|
|
+ if (manHoursCompleted && Number(manHoursCompleted) !== 0) {
|
|
|
+ element.workingHoursEfficiency = ((Number(manHoursCompleted) / Number(standardWorkingHours)) * 100).toFixed(0);
|
|
|
+ } else {
|
|
|
+ element.workingHoursEfficiency = 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -97,7 +188,7 @@ export class FbsWorkshopDispatchListListComponent implements OnInit {
|
|
|
nzWidth: window.innerWidth,
|
|
|
nzBodyStyle: { height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom': '53px' },
|
|
|
nzContentParams: {
|
|
|
- id:item.id
|
|
|
+ id: item.id,
|
|
|
},
|
|
|
});
|
|
|
}
|
|
@@ -113,7 +204,7 @@ export class FbsWorkshopDispatchListListComponent implements OnInit {
|
|
|
nzWidth: window.innerWidth,
|
|
|
nzBodyStyle: { height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom': '53px' },
|
|
|
nzContentParams: {
|
|
|
- id:item.id
|
|
|
+ id: item.id,
|
|
|
},
|
|
|
});
|
|
|
|
|
@@ -130,13 +221,13 @@ export class FbsWorkshopDispatchListListComponent implements OnInit {
|
|
|
* 删除按钮
|
|
|
*/
|
|
|
delete(item) {
|
|
|
- this.fbsWorkshopDispatchListService.deleteAndChild(item.id).then((response)=>{
|
|
|
- if(response.success){
|
|
|
- this.nzNotificationService.success("删除成功","");
|
|
|
- this.getList();//刷新
|
|
|
- }else{
|
|
|
- this.nzNotificationService.warning("删除失败","");
|
|
|
+ this.fbsWorkshopDispatchListService.deleteAndChild(item.id).then(response => {
|
|
|
+ if (response.success) {
|
|
|
+ this.nzNotificationService.success('删除成功', '');
|
|
|
+ this.getList(); //刷新
|
|
|
+ } else {
|
|
|
+ this.nzNotificationService.warning('删除失败', '');
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
}
|