scheduler-node-models 1.2.42 → 1.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/general/report.d.ts +1 -1
- package/package.json +2 -3
- package/scheduler/ingest/excelRowIngest.d.ts +22 -0
- package/scheduler/ingest/excelRowIngest.js +145 -0
- package/scheduler/ingest/index.d.ts +1 -0
- package/scheduler/ingest/index.js +1 -0
- package/scheduler/ingest/sapIngest.js +6 -2
- package/general/reportStyle.d.ts +0 -0
- package/general/reportStyle.js +0 -1
- package/metrics/reports/drawSummary.d.ts +0 -24
- package/metrics/reports/drawSummary.js +0 -311
- package/metrics/reports/index.d.ts +0 -5
- package/metrics/reports/index.js +0 -21
- package/metrics/reports/missionDay.d.ts +0 -8
- package/metrics/reports/missionDay.js +0 -23
- package/metrics/reports/missionSummary.d.ts +0 -25
- package/metrics/reports/missionSummary.js +0 -421
- package/metrics/reports/missionType.d.ts +0 -20
- package/metrics/reports/missionType.js +0 -314
- package/metrics/reports/outageDay.d.ts +0 -8
- package/metrics/reports/outageDay.js +0 -23
- package/scheduler/reports/chargeStatus.d.ts +0 -66
- package/scheduler/reports/chargeStatus.js +0 -752
- package/scheduler/reports/cofsReports.d.ts +0 -11
- package/scheduler/reports/cofsReports.js +0 -36
- package/scheduler/reports/enterpriseSchedule.d.ts +0 -18
- package/scheduler/reports/enterpriseSchedule.js +0 -159
- package/scheduler/reports/index.d.ts +0 -6
- package/scheduler/reports/index.js +0 -22
- package/scheduler/reports/leaveReport.d.ts +0 -52
- package/scheduler/reports/leaveReport.js +0 -755
- package/scheduler/reports/leaves.d.ts +0 -24
- package/scheduler/reports/leaves.js +0 -110
- package/scheduler/reports/scheduleReport.d.ts +0 -17
- package/scheduler/reports/scheduleReport.js +0 -311
package/general/report.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scheduler-node-models",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.44",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -16,14 +16,13 @@
|
|
|
16
16
|
"description": "",
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/adm-zip": "^0.5.7",
|
|
19
|
-
"@types/bcrypt": "^6.0.0",
|
|
20
19
|
"@types/exceljs": "^0.5.3",
|
|
21
20
|
"@types/nodemailer": "^7.0.0",
|
|
22
21
|
"typescript": "^5.9.2"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
25
24
|
"adm-zip": "^0.5.16",
|
|
26
|
-
"bcrypt": "^
|
|
25
|
+
"bcrypt-ts": "^7.1.0",
|
|
27
26
|
"exceljs": "^4.4.0",
|
|
28
27
|
"mongodb": "^6.18.0",
|
|
29
28
|
"nodemailer": "^7.0.5"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ISite, Site } from "../sites";
|
|
2
|
+
import { ITeam, Team } from "../teams";
|
|
3
|
+
import { ExcelRow } from "./excelRow";
|
|
4
|
+
import { LaborCode } from "../labor";
|
|
5
|
+
export declare class ExcelRowIngest {
|
|
6
|
+
files: File[];
|
|
7
|
+
team: Team;
|
|
8
|
+
site: Site;
|
|
9
|
+
company: string;
|
|
10
|
+
docDate: Date;
|
|
11
|
+
constructor(date: Date, files?: File[], team?: ITeam, site?: ISite, company?: string);
|
|
12
|
+
Process(): Promise<ExcelRow[]>;
|
|
13
|
+
processFile(file: File): Promise<ExcelRow[]>;
|
|
14
|
+
/**
|
|
15
|
+
* This function is used to provide a list of labor codes for a particular date and
|
|
16
|
+
* for site and company
|
|
17
|
+
* @param date A date object used in comparison to get forecast, which contains a list
|
|
18
|
+
* of laborcodes the employee can be assigned against.
|
|
19
|
+
* @returns A list of labor codes that can be assigned to an employee.
|
|
20
|
+
*/
|
|
21
|
+
getForecast(date: Date): Promise<LaborCode[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExcelRowIngest = void 0;
|
|
4
|
+
const exceljs_1 = require("@zurmokeeper/exceljs");
|
|
5
|
+
const sites_1 = require("../sites");
|
|
6
|
+
const teams_1 = require("../teams");
|
|
7
|
+
const excelRow_1 = require("./excelRow");
|
|
8
|
+
const labor_1 = require("../labor");
|
|
9
|
+
class ExcelRowIngest {
|
|
10
|
+
files;
|
|
11
|
+
team;
|
|
12
|
+
site;
|
|
13
|
+
company;
|
|
14
|
+
docDate;
|
|
15
|
+
constructor(date, files, team, site, company) {
|
|
16
|
+
this.files = (files) ? files : [];
|
|
17
|
+
this.team = (team) ? new teams_1.Team(team) : new teams_1.Team();
|
|
18
|
+
this.site = (site) ? new sites_1.Site(site) : new sites_1.Site();
|
|
19
|
+
this.company = (company) ? company : '';
|
|
20
|
+
this.docDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), 1));
|
|
21
|
+
}
|
|
22
|
+
async Process() {
|
|
23
|
+
const result = [];
|
|
24
|
+
if (this.files.length > 0) {
|
|
25
|
+
const allfiles = this.files.map(async (file, f) => {
|
|
26
|
+
const results = await this.processFile(file);
|
|
27
|
+
result.push(...results);
|
|
28
|
+
});
|
|
29
|
+
await Promise.allSettled(allfiles);
|
|
30
|
+
}
|
|
31
|
+
result.sort((a, b) => a.compareTo(b));
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
async processFile(file) {
|
|
35
|
+
const result = [];
|
|
36
|
+
// get the company password from the team database object's company list
|
|
37
|
+
let password = '';
|
|
38
|
+
// create test patterns for hours, if value doesn't match the hours pattern, it will
|
|
39
|
+
// be assumed to be a leave code
|
|
40
|
+
const hPattern = "^[0-9]{1,2}(\.[0-9]+)?$";
|
|
41
|
+
const hourRE = new RegExp(hPattern);
|
|
42
|
+
// convert the file into a buffer to allow the exceljs library to create an excel
|
|
43
|
+
// document to read through.
|
|
44
|
+
const filereader = file.stream().getReader();
|
|
45
|
+
const fileDataU8 = [];
|
|
46
|
+
while (true) {
|
|
47
|
+
const { done, value } = await filereader.read();
|
|
48
|
+
if (done)
|
|
49
|
+
break;
|
|
50
|
+
fileDataU8.push(...value);
|
|
51
|
+
}
|
|
52
|
+
const fileBinary = Buffer.from(fileDataU8);
|
|
53
|
+
const workbook = new exceljs_1.Workbook();
|
|
54
|
+
await workbook.xlsx.load(fileBinary.buffer, { password: password });
|
|
55
|
+
const worksheet = workbook.getWorksheet(1);
|
|
56
|
+
if (worksheet) {
|
|
57
|
+
worksheet.eachRow((row, r) => {
|
|
58
|
+
const name = row.getCell(1).toString().trim();
|
|
59
|
+
if (name !== '' && name !== 'Name' && name.toLowerCase() !== 'remarks') {
|
|
60
|
+
if (this.site.employees) {
|
|
61
|
+
this.site.employees.forEach(emp => {
|
|
62
|
+
if (emp.name.getLastFirst().toLowerCase() === name.toLowerCase()) {
|
|
63
|
+
for (let c = 3; c < 34; c++) {
|
|
64
|
+
async () => {
|
|
65
|
+
const colDate = new Date(this.docDate.getTime() + (24 * 3600000 * (c - 3)));
|
|
66
|
+
// Step through the days of the month to create the excel rows to add
|
|
67
|
+
// for this employee
|
|
68
|
+
const sValue = row.getCell(c).toString().trim();
|
|
69
|
+
if (sValue !== '') {
|
|
70
|
+
if (hourRE.test(sValue)) {
|
|
71
|
+
// test for value being an hours, if true find out which labor code
|
|
72
|
+
// to use, then create the excel row and add to the database.
|
|
73
|
+
let laborcode = new labor_1.LaborCode();
|
|
74
|
+
const laborcodes = await this.getForecast(colDate);
|
|
75
|
+
emp.assignments.forEach(asgmt => {
|
|
76
|
+
if (asgmt.useAssignment(colDate)) {
|
|
77
|
+
asgmt.laborcodes.forEach(alc => {
|
|
78
|
+
laborcodes.forEach(flc => {
|
|
79
|
+
if (flc.chargeNumber === alc.chargenumber
|
|
80
|
+
&& flc.extension === alc.extension) {
|
|
81
|
+
laborcode.chargeNumber = flc.chargeNumber;
|
|
82
|
+
laborcode.extension = flc.extension;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
if (laborcode.chargeNumber !== '') {
|
|
89
|
+
const eRow = new excelRow_1.ExcelRow();
|
|
90
|
+
eRow.date = new Date(colDate);
|
|
91
|
+
eRow.employee = emp.companyinfo.employeeid;
|
|
92
|
+
eRow.chargeNumber = laborcode.chargeNumber;
|
|
93
|
+
eRow.extension = laborcode.extension;
|
|
94
|
+
eRow.premium = '1';
|
|
95
|
+
eRow.hours = Number(sValue);
|
|
96
|
+
result.push(eRow);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// this will be a leave code, so find out which to use, then
|
|
101
|
+
// create the excel row with the employee's standard workday.
|
|
102
|
+
this.team.workcodes.forEach(wc => {
|
|
103
|
+
if (wc.isLeave && wc.altcode
|
|
104
|
+
&& sValue.toLowerCase() === wc.altcode) {
|
|
105
|
+
const eRow = new excelRow_1.ExcelRow();
|
|
106
|
+
eRow.date = new Date(colDate);
|
|
107
|
+
eRow.employee = emp.companyinfo.employeeid;
|
|
108
|
+
eRow.code = wc.id;
|
|
109
|
+
eRow.hours = emp.getStandardWorkday(colDate);
|
|
110
|
+
result.push(eRow);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
result.sort((a, b) => a.compareTo(b));
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* This function is used to provide a list of labor codes for a particular date and
|
|
128
|
+
* for site and company
|
|
129
|
+
* @param date A date object used in comparison to get forecast, which contains a list
|
|
130
|
+
* of laborcodes the employee can be assigned against.
|
|
131
|
+
* @returns A list of labor codes that can be assigned to an employee.
|
|
132
|
+
*/
|
|
133
|
+
async getForecast(date) {
|
|
134
|
+
const laborcodes = [];
|
|
135
|
+
this.site.forecasts.forEach(fcst => {
|
|
136
|
+
if (fcst.use(date, this.company)) {
|
|
137
|
+
fcst.laborCodes.forEach(lc => {
|
|
138
|
+
laborcodes.push(new labor_1.LaborCode(lc));
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return laborcodes;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.ExcelRowIngest = ExcelRowIngest;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SAPIngest = void 0;
|
|
4
4
|
const teams_1 = require("../teams");
|
|
5
5
|
const excelRow_1 = require("./excelRow");
|
|
6
|
-
const exceljs_1 = require("exceljs");
|
|
6
|
+
const exceljs_1 = require("@zurmokeeper/exceljs");
|
|
7
7
|
class SAPIngest {
|
|
8
8
|
files;
|
|
9
9
|
team;
|
|
@@ -82,7 +82,11 @@ class SAPIngest {
|
|
|
82
82
|
eRow.extension = sValue;
|
|
83
83
|
break;
|
|
84
84
|
case 'hours':
|
|
85
|
-
|
|
85
|
+
const hPattern = "^[0-9]{1,2}(\.[0-9]+)?$";
|
|
86
|
+
const hourRE = new RegExp(hPattern);
|
|
87
|
+
if (hourRE.test(sValue)) {
|
|
88
|
+
eRow.hours = Number(sValue);
|
|
89
|
+
}
|
|
86
90
|
break;
|
|
87
91
|
case 'charge number desc':
|
|
88
92
|
eRow.description = sValue;
|
package/general/reportStyle.d.ts
DELETED
|
File without changes
|
package/general/reportStyle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Workbook } from "exceljs";
|
|
2
|
-
import { Mission } from "../mission";
|
|
3
|
-
import { Outage } from "../outage";
|
|
4
|
-
import { GeneralTypes, SystemInfo } from "../systemdata";
|
|
5
|
-
import { User } from "../../users";
|
|
6
|
-
import { Report } from '../../general';
|
|
7
|
-
export declare class DrawSummary extends Report {
|
|
8
|
-
private reportType;
|
|
9
|
-
private start;
|
|
10
|
-
private end;
|
|
11
|
-
private dailyReports;
|
|
12
|
-
private missions;
|
|
13
|
-
private outages;
|
|
14
|
-
private systeminfo;
|
|
15
|
-
private fonts;
|
|
16
|
-
private fills;
|
|
17
|
-
private borders;
|
|
18
|
-
private alignments;
|
|
19
|
-
constructor(type: GeneralTypes, start: Date, end: Date, missions: Mission[], outages: Outage[], systemInfo: SystemInfo, daily?: boolean);
|
|
20
|
-
create(user: User): Workbook;
|
|
21
|
-
createStyles(): void;
|
|
22
|
-
createMissionSummary(workbook: Workbook): void;
|
|
23
|
-
createOutageSummary(workbook: Workbook): void;
|
|
24
|
-
}
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DrawSummary = void 0;
|
|
4
|
-
const exceljs_1 = require("exceljs");
|
|
5
|
-
const mission_1 = require("../mission");
|
|
6
|
-
const outage_1 = require("../outage");
|
|
7
|
-
const general_1 = require("../../general");
|
|
8
|
-
const missionDay_1 = require("./missionDay");
|
|
9
|
-
const outageDay_1 = require("./outageDay");
|
|
10
|
-
class DrawSummary extends general_1.Report {
|
|
11
|
-
reportType;
|
|
12
|
-
start;
|
|
13
|
-
end;
|
|
14
|
-
dailyReports;
|
|
15
|
-
missions;
|
|
16
|
-
outages;
|
|
17
|
-
systeminfo;
|
|
18
|
-
fonts;
|
|
19
|
-
fills;
|
|
20
|
-
borders;
|
|
21
|
-
alignments;
|
|
22
|
-
constructor(type, start, end, missions, outages, systemInfo, daily) {
|
|
23
|
-
super();
|
|
24
|
-
this.reportType = type;
|
|
25
|
-
this.start = new Date(start);
|
|
26
|
-
this.end = new Date(end);
|
|
27
|
-
this.missions = missions;
|
|
28
|
-
this.outages = outages;
|
|
29
|
-
this.systeminfo = systemInfo;
|
|
30
|
-
this.dailyReports = (daily) ? daily : false;
|
|
31
|
-
this.fonts = new Map();
|
|
32
|
-
this.fills = new Map();
|
|
33
|
-
this.borders = new Map();
|
|
34
|
-
this.alignments = new Map();
|
|
35
|
-
}
|
|
36
|
-
create(user) {
|
|
37
|
-
const workbook = new exceljs_1.Workbook();
|
|
38
|
-
workbook.creator = user.getFullName();
|
|
39
|
-
workbook.created = new Date();
|
|
40
|
-
const delta = Math.floor((this.end.getTime() - this.start.getTime()) / (24 * 3600000));
|
|
41
|
-
if (delta == 1 && delta > 7) {
|
|
42
|
-
this.dailyReports = false;
|
|
43
|
-
}
|
|
44
|
-
this.createStyles();
|
|
45
|
-
this.createMissionSummary(workbook);
|
|
46
|
-
return workbook;
|
|
47
|
-
}
|
|
48
|
-
createStyles() {
|
|
49
|
-
// set fonts
|
|
50
|
-
this.fonts.set("bold14", { bold: true, size: 14, color: { argb: 'ffffffff' } });
|
|
51
|
-
this.fonts.set("bold12", { bold: true, size: 12, color: { argb: 'ff000000' } });
|
|
52
|
-
this.fonts.set("nobold10", { bold: false, size: 10, color: { argb: 'ff000000' } });
|
|
53
|
-
this.fonts.set("bold9", { bold: true, size: 9, color: { argb: 'ff000000' } });
|
|
54
|
-
this.fonts.set("nobold9", { bold: false, size: 9, color: { argb: 'ff000000' } });
|
|
55
|
-
this.fonts.set('notnorm', { bold: false, size: 9, color: { argb: 'ff0070c0' } });
|
|
56
|
-
// set fills
|
|
57
|
-
this.fills.set('black', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ff000000' } });
|
|
58
|
-
this.fills.set('white', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ffffffff' } });
|
|
59
|
-
this.fills.set('odd', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ffd3d3d3' } });
|
|
60
|
-
this.fills.set('even', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ffffffff' } });
|
|
61
|
-
// set borders
|
|
62
|
-
this.borders.set('blackthin', {
|
|
63
|
-
top: { style: 'thin', color: { argb: 'ff000000' } },
|
|
64
|
-
left: { style: 'thin', color: { argb: 'ff000000' } },
|
|
65
|
-
bottom: { style: 'thin', color: { argb: 'ff000000' } },
|
|
66
|
-
right: { style: 'thin', color: { argb: 'ff000000' } }
|
|
67
|
-
});
|
|
68
|
-
this.borders.set('blackthinNoRight', {
|
|
69
|
-
top: { style: 'thin', color: { argb: 'ff000000' } },
|
|
70
|
-
left: { style: 'thin', color: { argb: 'ff000000' } },
|
|
71
|
-
bottom: { style: 'thin', color: { argb: 'ff000000' } },
|
|
72
|
-
right: { style: 'thin', color: { argb: 'ffffffff' } }
|
|
73
|
-
});
|
|
74
|
-
this.borders.set('blackthinNoLeft', {
|
|
75
|
-
top: { style: 'thin', color: { argb: 'ff000000' } },
|
|
76
|
-
left: { style: 'thin', color: { argb: 'ffffffff' } },
|
|
77
|
-
bottom: { style: 'thin', color: { argb: 'ff000000' } },
|
|
78
|
-
right: { style: 'thin', color: { argb: 'ff000000' } }
|
|
79
|
-
});
|
|
80
|
-
// set alignments
|
|
81
|
-
this.alignments.set('center', { horizontal: 'center', vertical: 'middle', wrapText: true });
|
|
82
|
-
this.alignments.set('leftctr', { horizontal: 'left', vertical: 'middle', wrapText: true });
|
|
83
|
-
this.alignments.set('rightctr', { horizontal: 'right', vertical: 'middle', wrapText: true });
|
|
84
|
-
}
|
|
85
|
-
createMissionSummary(workbook) {
|
|
86
|
-
// set up the mission days from the missions provided
|
|
87
|
-
const days = [];
|
|
88
|
-
this.missions.forEach(msn => {
|
|
89
|
-
let found = false;
|
|
90
|
-
days.forEach((md, day) => {
|
|
91
|
-
if (md.use(msn.missionDate)) {
|
|
92
|
-
found = true;
|
|
93
|
-
md.missions.push(new mission_1.Mission(msn));
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
if (!found) {
|
|
97
|
-
const day = new missionDay_1.MissionDay(new Date(msn.missionDate));
|
|
98
|
-
day.missions.push(new mission_1.Mission(msn));
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
days.sort((a, b) => a.compareTo(b));
|
|
102
|
-
const label = 'DRAW Missions';
|
|
103
|
-
const sheet = workbook.addWorksheet(label);
|
|
104
|
-
sheet.pageSetup.showGridLines = false;
|
|
105
|
-
for (let i = 0; i < 10; i++) {
|
|
106
|
-
if (i !== 1) {
|
|
107
|
-
sheet.getColumn(i).width = 8.43;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
sheet.getColumn(i).width = 75.0;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// add header
|
|
114
|
-
let nRow = 2;
|
|
115
|
-
let style = {
|
|
116
|
-
border: this.borders.get('blackthin'),
|
|
117
|
-
fill: this.fills.get('black'),
|
|
118
|
-
font: this.fonts.get('bold14'),
|
|
119
|
-
alignment: this.alignments.get('center')
|
|
120
|
-
};
|
|
121
|
-
this.setCell(sheet, this.getCellID("B", nRow), this.getCellID("B", nRow), style, "DRAW Mission Summary");
|
|
122
|
-
days.forEach(day => {
|
|
123
|
-
nRow += 2;
|
|
124
|
-
style = {
|
|
125
|
-
border: this.borders.get('blackthin'),
|
|
126
|
-
fill: this.fills.get('white'),
|
|
127
|
-
font: this.fonts.get('nobold10'),
|
|
128
|
-
alignment: this.alignments.get('leftctr')
|
|
129
|
-
};
|
|
130
|
-
this.setCell(sheet, this.getCellID("B", nRow), this.getCellID("B", nRow), style, this.getDateString(day.missionDate));
|
|
131
|
-
if (day.missions.length === 0) {
|
|
132
|
-
style = {
|
|
133
|
-
border: this.borders.get('blackthin'),
|
|
134
|
-
fill: this.fills.get('white'),
|
|
135
|
-
font: this.fonts.get('nobold10'),
|
|
136
|
-
alignment: this.alignments.get('center')
|
|
137
|
-
};
|
|
138
|
-
this.setCell(sheet, this.getCellID("B", nRow + 1), this.getCellID("B", nRow + 1), style, "No missions scheduled for this date");
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
day.missions.sort((a, b) => a.compareTo(b));
|
|
142
|
-
day.missions.forEach((msn, m) => {
|
|
143
|
-
let showMission = '';
|
|
144
|
-
let u2Text = '';
|
|
145
|
-
let sensorOutage = 0;
|
|
146
|
-
let groundOutage = 0;
|
|
147
|
-
let partialHB = -1;
|
|
148
|
-
let partialLB = -1;
|
|
149
|
-
let sensorComments = msn.comments;
|
|
150
|
-
let executeMinutes = 0;
|
|
151
|
-
if (this.systeminfo.platforms) {
|
|
152
|
-
this.systeminfo.platforms.forEach(plat => {
|
|
153
|
-
if (msn.platformID.toLowerCase() === plat.id.toLowerCase()) {
|
|
154
|
-
msn.sensors.forEach(mSen => {
|
|
155
|
-
plat.sensors.forEach(sen => {
|
|
156
|
-
if (mSen.sensorID.toLowerCase() === sen.id.toLowerCase()
|
|
157
|
-
&& sen.use(msn.exploitation, this.reportType)) {
|
|
158
|
-
sensorOutage = mSen.sensorOutage.totalOutageMinutes;
|
|
159
|
-
groundOutage = mSen.groundOutage;
|
|
160
|
-
sensorComments = sensorComments.trim();
|
|
161
|
-
if (sensorComments !== '') {
|
|
162
|
-
sensorComments += ', ';
|
|
163
|
-
}
|
|
164
|
-
sensorComments += mSen.comments;
|
|
165
|
-
executeMinutes = mSen.executedMinutes + mSen.additionalMinutes;
|
|
166
|
-
switch (sen.id.toLowerCase()) {
|
|
167
|
-
case "pme3":
|
|
168
|
-
case "pme4":
|
|
169
|
-
showMission = "- CWS/" + sen.id + ": Ket " + mSen.kitNumber
|
|
170
|
-
+ ` was Code ${mSen.finalCode}`;
|
|
171
|
-
u2Text = ` with ${sen.association} and ${msn.communications}`;
|
|
172
|
-
break;
|
|
173
|
-
case "pme9":
|
|
174
|
-
showMission = `DDSA/PME9: Kit ${mSen.kitNumber}`
|
|
175
|
-
+ ` was Code ${mSen.finalCode}`;
|
|
176
|
-
break;
|
|
177
|
-
case "pme12":
|
|
178
|
-
showMission = `- CICS/PME12: Kit ${mSen.kitNumber} was Code `
|
|
179
|
-
+ `${mSen.finalCode}`;
|
|
180
|
-
partialHB = mSen.sensorOutage.partialHBOutageMinutes;
|
|
181
|
-
partialLB = mSen.sensorOutage.partialLBOutageMinutes;
|
|
182
|
-
case "imint":
|
|
183
|
-
showMission = "- CWS/IMINT Sensor";
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
if (showMission !== '') {
|
|
192
|
-
let text = `This mission on ${this.getDateString(msn.missionDate)} was `
|
|
193
|
-
+ `${msn.platformID} `;
|
|
194
|
-
if (msn.tailNumber !== '') {
|
|
195
|
-
text += ` using Article ${msn.tailNumber}`;
|
|
196
|
-
}
|
|
197
|
-
text += u2Text;
|
|
198
|
-
if (msn.exploitation.toLowerCase() === 'primary') {
|
|
199
|
-
text += `\n\r- Primary exploiting DGS was DGS-${msn.primaryDCGS}`;
|
|
200
|
-
}
|
|
201
|
-
if (!msn.cancelled && !msn.indefDelay && !msn.aborted) {
|
|
202
|
-
text += "\n\r" + showMission;
|
|
203
|
-
}
|
|
204
|
-
else if (msn.cancelled) {
|
|
205
|
-
text += "\n\r- Mission Cancelled";
|
|
206
|
-
}
|
|
207
|
-
else if (msn.aborted) {
|
|
208
|
-
text += "\n\r- Mission Aborted";
|
|
209
|
-
}
|
|
210
|
-
else if (msn.indefDelay) {
|
|
211
|
-
text += "\n\r- Mission Indefinite Delay";
|
|
212
|
-
}
|
|
213
|
-
if (msn.exploitation.toLowerCase() === 'primary'
|
|
214
|
-
&& !msn.cancelled && !msn.aborted && !msn.indefDelay) {
|
|
215
|
-
text += `\n\r- Ground Outages: ${groundOutage} mins.`
|
|
216
|
-
+ `\n\r- Sensor Outages: ${sensorOutage} mins.`;
|
|
217
|
-
if (partialHB > 0) {
|
|
218
|
-
text += `\n\r- Partial HB Outages: ${partialHB} mins.`;
|
|
219
|
-
}
|
|
220
|
-
if (partialLB > 0) {
|
|
221
|
-
text += `\n\r- Partial LB Outages: ${partialLB} mins`;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
if (sensorComments !== '') {
|
|
225
|
-
text += `\n\r- Comments: ${sensorComments}`;
|
|
226
|
-
}
|
|
227
|
-
text = text.trim();
|
|
228
|
-
const textrows = text.split('\n\r');
|
|
229
|
-
sheet.getRow(nRow + m + 1).height = (textrows.length * 13.0);
|
|
230
|
-
this.setCell(sheet, this.getCellID("B", nRow + m + 1), this.getCellID("B", nRow + m + 1), style, text);
|
|
231
|
-
this.setCell(sheet, this.getCellID("C", nRow + m + 1), this.getCellID("C", nRow + m + 1), style, this.getTimeString(executeMinutes));
|
|
232
|
-
this.setCell(sheet, this.getCellID("D", nRow + m + 1), this.getCellID("D", nRow + m + 1), style, this.getTimeString(executeMinutes - (sensorOutage + groundOutage)));
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
nRow += day.missions.length;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
createOutageSummary(workbook) {
|
|
240
|
-
const days = [];
|
|
241
|
-
this.outages.forEach(outage => {
|
|
242
|
-
let found = false;
|
|
243
|
-
days.forEach(day => {
|
|
244
|
-
if (day.use(outage.outageDate)) {
|
|
245
|
-
found = true;
|
|
246
|
-
day.outages.push(new outage_1.Outage(outage));
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
if (!found) {
|
|
250
|
-
const day = new outageDay_1.OutageDay(new Date(outage.outageDate));
|
|
251
|
-
day.outages.push(new outage_1.Outage(outage));
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
days.sort((a, b) => a.compareTo(b));
|
|
255
|
-
const label = 'DRAW Outage';
|
|
256
|
-
const sheet = workbook.addWorksheet(label);
|
|
257
|
-
sheet.pageSetup.showGridLines = false;
|
|
258
|
-
const widths = [8.43, 11.0, 11.0, 12.0, 8.0, 110.0, 8.43, 8.43, 8.43, 8.43];
|
|
259
|
-
widths.forEach((width, w) => {
|
|
260
|
-
sheet.getColumn(w).width = width;
|
|
261
|
-
});
|
|
262
|
-
let nRow = 2;
|
|
263
|
-
let style = {
|
|
264
|
-
border: this.borders.get('blackthin'),
|
|
265
|
-
fill: this.fills.get('black'),
|
|
266
|
-
font: this.fonts.get('bold14'),
|
|
267
|
-
alignment: this.alignments.get('center')
|
|
268
|
-
};
|
|
269
|
-
this.setCell(sheet, this.getCellID("B", nRow), this.getCellID("B", nRow), style, "DATE");
|
|
270
|
-
this.setCell(sheet, this.getCellID("C", nRow), this.getCellID("C", nRow), style, "SYSTEM");
|
|
271
|
-
this.setCell(sheet, this.getCellID("D", nRow), this.getCellID("D", nRow), style, "SUBSYSTEM");
|
|
272
|
-
this.setCell(sheet, this.getCellID("E", nRow), this.getCellID("E", nRow), style, "Outage (Mins)");
|
|
273
|
-
this.setCell(sheet, this.getCellID("F", nRow), this.getCellID("F", nRow), style, "PROBLEM(S)/RESOLUTION(S)");
|
|
274
|
-
nRow++;
|
|
275
|
-
days.forEach((day, d) => {
|
|
276
|
-
style = {
|
|
277
|
-
border: this.borders.get('blackthin'),
|
|
278
|
-
fill: this.fills.get((nRow % 2 === 0) ? 'even' : 'odd'),
|
|
279
|
-
font: this.fonts.get('nobold10'),
|
|
280
|
-
alignment: this.alignments.get('center')
|
|
281
|
-
};
|
|
282
|
-
this.setCell(sheet, this.getCellID("B", nRow), this.getCellID("B", nRow), style, this.getDateString(day.outageDate));
|
|
283
|
-
if (day.outages.length === 0) {
|
|
284
|
-
style.alignment = this.alignments.get('leftctr');
|
|
285
|
-
this.setCell(sheet, this.getCellID("C", nRow), this.getCellID("F", nRow), style, "NSTR");
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
day.outages.forEach((outage, out) => {
|
|
289
|
-
style = {
|
|
290
|
-
border: this.borders.get('blackthin'),
|
|
291
|
-
fill: this.fills.get(((nRow + out) % 2 === 0) ? 'even' : 'odd'),
|
|
292
|
-
font: this.fonts.get('nobold10'),
|
|
293
|
-
alignment: this.alignments.get('center')
|
|
294
|
-
};
|
|
295
|
-
if (out > 0) {
|
|
296
|
-
this.setCell(sheet, this.getCellID("B", nRow + out), this.getCellID("B", nRow + out), style, '');
|
|
297
|
-
}
|
|
298
|
-
this.setCell(sheet, this.getCellID("C", nRow + out), this.getCellID("C", nRow + out), style, outage.groundSystem.toUpperCase());
|
|
299
|
-
this.setCell(sheet, this.getCellID("D", nRow + out), this.getCellID("D", nRow + out), style, outage.groundSystem.toUpperCase());
|
|
300
|
-
this.setCell(sheet, this.getCellID("E", nRow + out), this.getCellID("E", nRow + out), style, outage.subSystem.toUpperCase());
|
|
301
|
-
style.alignment = this.alignments.get('leftctr');
|
|
302
|
-
this.setCell(sheet, this.getCellID("F", nRow + out), this.getCellID("F", nRow + out), style, `PROBLEM(s): ${outage.problem}\rRESOLUTION(s): ${outage.fixAction}`);
|
|
303
|
-
sheet.getRow(nRow + out).height = 26.0;
|
|
304
|
-
});
|
|
305
|
-
nRow += day.outages.length - 1;
|
|
306
|
-
}
|
|
307
|
-
nRow++;
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
exports.DrawSummary = DrawSummary;
|
package/metrics/reports/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./missionDay"), exports);
|
|
18
|
-
__exportStar(require("./missionSummary"), exports);
|
|
19
|
-
__exportStar(require("./missionType"), exports);
|
|
20
|
-
__exportStar(require("./outageDay"), exports);
|
|
21
|
-
__exportStar(require("./drawSummary"), exports);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MissionDay = void 0;
|
|
4
|
-
class MissionDay {
|
|
5
|
-
missionDate;
|
|
6
|
-
missions;
|
|
7
|
-
constructor(date) {
|
|
8
|
-
this.missionDate = new Date(date);
|
|
9
|
-
this.missions = [];
|
|
10
|
-
}
|
|
11
|
-
compareTo(other) {
|
|
12
|
-
if (other) {
|
|
13
|
-
return (this.missionDate.getTime() < other.missionDate.getTime()) ? -1 : 1;
|
|
14
|
-
}
|
|
15
|
-
return -1;
|
|
16
|
-
}
|
|
17
|
-
use(date) {
|
|
18
|
-
return (this.missionDate.getFullYear() === date.getFullYear()
|
|
19
|
-
&& this.missionDate.getMonth() === date.getMonth()
|
|
20
|
-
&& this.missionDate.getDate() === date.getDate());
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.MissionDay = MissionDay;
|