@seedtactics/insight-client 16.4.0
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/README.md +37 -0
- package/dist/cell-status/buffers.d.ts +36 -0
- package/dist/cell-status/buffers.js +127 -0
- package/dist/cell-status/current-status.d.ts +30 -0
- package/dist/cell-status/current-status.js +200 -0
- package/dist/cell-status/estimated-cycle-times.d.ts +41 -0
- package/dist/cell-status/estimated-cycle-times.js +257 -0
- package/dist/cell-status/inspections.d.ts +55 -0
- package/dist/cell-status/inspections.js +213 -0
- package/dist/cell-status/loading.d.ts +26 -0
- package/dist/cell-status/loading.js +112 -0
- package/dist/cell-status/material-details.d.ts +116 -0
- package/dist/cell-status/material-details.js +422 -0
- package/dist/cell-status/material-summary.d.ts +52 -0
- package/dist/cell-status/material-summary.js +312 -0
- package/dist/cell-status/names.d.ts +19 -0
- package/dist/cell-status/names.js +134 -0
- package/dist/cell-status/pallet-cycles.d.ts +24 -0
- package/dist/cell-status/pallet-cycles.js +78 -0
- package/dist/cell-status/rebookings.d.ts +30 -0
- package/dist/cell-status/rebookings.js +139 -0
- package/dist/cell-status/scheduled-jobs.d.ts +18 -0
- package/dist/cell-status/scheduled-jobs.js +94 -0
- package/dist/cell-status/sim-day-usage.d.ts +14 -0
- package/dist/cell-status/sim-day-usage.js +54 -0
- package/dist/cell-status/sim-production.d.ts +22 -0
- package/dist/cell-status/sim-production.js +91 -0
- package/dist/cell-status/sim-station-use.d.ts +25 -0
- package/dist/cell-status/sim-station-use.js +71 -0
- package/dist/cell-status/station-cycles.d.ts +34 -0
- package/dist/cell-status/station-cycles.js +145 -0
- package/dist/cell-status/tool-replacements.d.ts +44 -0
- package/dist/cell-status/tool-replacements.js +155 -0
- package/dist/cell-status/tool-usage.d.ts +25 -0
- package/dist/cell-status/tool-usage.js +95 -0
- package/dist/components/App.d.ts +15 -0
- package/dist/components/App.js +549 -0
- package/dist/components/AxisAndGrid.d.ts +51 -0
- package/dist/components/AxisAndGrid.js +47 -0
- package/dist/components/BarcodeScanning.d.ts +6 -0
- package/dist/components/BarcodeScanning.js +150 -0
- package/dist/components/ChartTooltip.d.ts +28 -0
- package/dist/components/ChartTooltip.js +95 -0
- package/dist/components/ChooseMode.d.ts +18 -0
- package/dist/components/ChooseMode.js +136 -0
- package/dist/components/ChooseOperator.d.ts +1 -0
- package/dist/components/ChooseOperator.js +93 -0
- package/dist/components/ErrorsAndLoading.d.ts +9 -0
- package/dist/components/ErrorsAndLoading.js +55 -0
- package/dist/components/LoadingIcon.d.ts +1 -0
- package/dist/components/LoadingIcon.js +48 -0
- package/dist/components/LogEntry.d.ts +16 -0
- package/dist/components/LogEntry.js +365 -0
- package/dist/components/ManualSerialEntry.d.ts +5 -0
- package/dist/components/ManualSerialEntry.js +91 -0
- package/dist/components/MonthSelect.d.ts +6 -0
- package/dist/components/MonthSelect.js +67 -0
- package/dist/components/Navigation.d.ts +23 -0
- package/dist/components/Navigation.js +120 -0
- package/dist/components/VerboseLogging.d.ts +1 -0
- package/dist/components/VerboseLogging.js +47 -0
- package/dist/components/analysis/AnalysisSelectToolbar.d.ts +1 -0
- package/dist/components/analysis/AnalysisSelectToolbar.js +55 -0
- package/dist/components/analysis/BufferChart.d.ts +1 -0
- package/dist/components/analysis/BufferChart.js +139 -0
- package/dist/components/analysis/CostPerPiece.d.ts +2 -0
- package/dist/components/analysis/CostPerPiece.js +175 -0
- package/dist/components/analysis/CycleChart.d.ts +42 -0
- package/dist/components/analysis/CycleChart.js +281 -0
- package/dist/components/analysis/DataTable.d.ts +83 -0
- package/dist/components/analysis/DataTable.js +215 -0
- package/dist/components/analysis/EfficiencyPage.d.ts +2 -0
- package/dist/components/analysis/EfficiencyPage.js +138 -0
- package/dist/components/analysis/HeatChart.d.ts +22 -0
- package/dist/components/analysis/HeatChart.js +161 -0
- package/dist/components/analysis/InspectionDataTable.d.ts +10 -0
- package/dist/components/analysis/InspectionDataTable.js +148 -0
- package/dist/components/analysis/InspectionSankey.d.ts +12 -0
- package/dist/components/analysis/InspectionSankey.js +140 -0
- package/dist/components/analysis/PalletCycleCards.d.ts +1 -0
- package/dist/components/analysis/PalletCycleCards.js +137 -0
- package/dist/components/analysis/PartCycleCards.d.ts +2 -0
- package/dist/components/analysis/PartCycleCards.js +331 -0
- package/dist/components/analysis/QualityPage.d.ts +1 -0
- package/dist/components/analysis/QualityPage.js +49 -0
- package/dist/components/analysis/ScheduleHistory.d.ts +3 -0
- package/dist/components/analysis/ScheduleHistory.js +108 -0
- package/dist/components/analysis/StationDataTable.d.ts +25 -0
- package/dist/components/analysis/StationDataTable.js +246 -0
- package/dist/components/analysis/ToolReplacements.d.ts +1 -0
- package/dist/components/analysis/ToolReplacements.js +370 -0
- package/dist/components/operations/AllMaterial.d.ts +5 -0
- package/dist/components/operations/AllMaterial.js +267 -0
- package/dist/components/operations/ChartRangeEdit.d.ts +4 -0
- package/dist/components/operations/ChartRangeEdit.js +148 -0
- package/dist/components/operations/CloseoutReport.d.ts +2 -0
- package/dist/components/operations/CloseoutReport.js +172 -0
- package/dist/components/operations/CompletedParts.d.ts +2 -0
- package/dist/components/operations/CompletedParts.js +286 -0
- package/dist/components/operations/CurrentWorkorders.d.ts +3 -0
- package/dist/components/operations/CurrentWorkorders.js +368 -0
- package/dist/components/operations/Dashboard.d.ts +2 -0
- package/dist/components/operations/Dashboard.js +90 -0
- package/dist/components/operations/OEEChart.d.ts +10 -0
- package/dist/components/operations/OEEChart.js +173 -0
- package/dist/components/operations/Outliers.d.ts +4 -0
- package/dist/components/operations/Outliers.js +69 -0
- package/dist/components/operations/ProgramHighlight.d.ts +1 -0
- package/dist/components/operations/ProgramHighlight.js +9 -0
- package/dist/components/operations/Programs.d.ts +5 -0
- package/dist/components/operations/Programs.js +363 -0
- package/dist/components/operations/Rebookings.d.ts +1 -0
- package/dist/components/operations/Rebookings.js +213 -0
- package/dist/components/operations/RecentCycleChart.d.ts +4 -0
- package/dist/components/operations/RecentCycleChart.js +240 -0
- package/dist/components/operations/RecentProduction.d.ts +2 -0
- package/dist/components/operations/RecentProduction.js +213 -0
- package/dist/components/operations/RecentSchedules.d.ts +12 -0
- package/dist/components/operations/RecentSchedules.js +180 -0
- package/dist/components/operations/RecentStationCycles.d.ts +4 -0
- package/dist/components/operations/RecentStationCycles.js +159 -0
- package/dist/components/operations/ShiftSettings.d.ts +6 -0
- package/dist/components/operations/ShiftSettings.js +134 -0
- package/dist/components/operations/SimDayUsage.d.ts +1 -0
- package/dist/components/operations/SimDayUsage.js +133 -0
- package/dist/components/operations/ToolReport.d.ts +3 -0
- package/dist/components/operations/ToolReport.js +233 -0
- package/dist/components/operations/WorkorderGantt.d.ts +1 -0
- package/dist/components/operations/WorkorderGantt.js +124 -0
- package/dist/components/quality/QualityMaterial.d.ts +2 -0
- package/dist/components/quality/QualityMaterial.js +169 -0
- package/dist/components/quality/QualityPaths.d.ts +1 -0
- package/dist/components/quality/QualityPaths.js +53 -0
- package/dist/components/quality/RecentFailedInspections.d.ts +1 -0
- package/dist/components/quality/RecentFailedInspections.js +123 -0
- package/dist/components/routes.d.ts +170 -0
- package/dist/components/routes.js +301 -0
- package/dist/components/station-monitor/BulkRawMaterial.d.ts +11 -0
- package/dist/components/station-monitor/BulkRawMaterial.js +251 -0
- package/dist/components/station-monitor/Closeout.d.ts +5 -0
- package/dist/components/station-monitor/Closeout.js +162 -0
- package/dist/components/station-monitor/CustomStationMonitorDialog.d.ts +1 -0
- package/dist/components/station-monitor/CustomStationMonitorDialog.js +55 -0
- package/dist/components/station-monitor/Inspection.d.ts +8 -0
- package/dist/components/station-monitor/Inspection.js +164 -0
- package/dist/components/station-monitor/InvalidateCycle.d.ts +33 -0
- package/dist/components/station-monitor/InvalidateCycle.js +262 -0
- package/dist/components/station-monitor/JobDetails.d.ts +7 -0
- package/dist/components/station-monitor/JobDetails.js +108 -0
- package/dist/components/station-monitor/LoadStation.d.ts +10 -0
- package/dist/components/station-monitor/LoadStation.js +450 -0
- package/dist/components/station-monitor/Material.d.ts +77 -0
- package/dist/components/station-monitor/Material.js +489 -0
- package/dist/components/station-monitor/MoveMaterialArrows.d.ts +11 -0
- package/dist/components/station-monitor/MoveMaterialArrows.js +118 -0
- package/dist/components/station-monitor/PrintedLabel.d.ts +29 -0
- package/dist/components/station-monitor/PrintedLabel.js +166 -0
- package/dist/components/station-monitor/QuarantineButton.d.ts +4 -0
- package/dist/components/station-monitor/QuarantineButton.js +184 -0
- package/dist/components/station-monitor/Queues.d.ts +23 -0
- package/dist/components/station-monitor/Queues.js +312 -0
- package/dist/components/station-monitor/QueuesAddMaterial.d.ts +30 -0
- package/dist/components/station-monitor/QueuesAddMaterial.js +248 -0
- package/dist/components/station-monitor/SelectInspType.d.ts +2 -0
- package/dist/components/station-monitor/SelectInspType.js +99 -0
- package/dist/components/station-monitor/SelectWorkorder.d.ts +4 -0
- package/dist/components/station-monitor/SelectWorkorder.js +100 -0
- package/dist/components/station-monitor/StationToolbar.d.ts +3 -0
- package/dist/components/station-monitor/StationToolbar.js +168 -0
- package/dist/components/station-monitor/SystemOverview.d.ts +46 -0
- package/dist/components/station-monitor/SystemOverview.js +439 -0
- package/dist/components/station-monitor/Whiteboard.d.ts +10 -0
- package/dist/components/station-monitor/Whiteboard.js +67 -0
- package/dist/data/all-material-bins.d.ts +45 -0
- package/dist/data/all-material-bins.js +224 -0
- package/dist/data/chart-times.d.ts +20 -0
- package/dist/data/chart-times.js +99 -0
- package/dist/data/cost-per-piece.d.ts +32 -0
- package/dist/data/cost-per-piece.js +183 -0
- package/dist/data/current-cycles.d.ts +13 -0
- package/dist/data/current-cycles.js +144 -0
- package/dist/data/inspection-sankey.d.ts +15 -0
- package/dist/data/inspection-sankey.js +147 -0
- package/dist/data/move-arrows.d.ts +48 -0
- package/dist/data/move-arrows.js +217 -0
- package/dist/data/operators.d.ts +2 -0
- package/dist/data/operators.js +44 -0
- package/dist/data/part-summary.d.ts +17 -0
- package/dist/data/part-summary.js +107 -0
- package/dist/data/path-lookup.d.ts +13 -0
- package/dist/data/path-lookup.js +107 -0
- package/dist/data/queue-material.d.ts +46 -0
- package/dist/data/queue-material.js +256 -0
- package/dist/data/results.bufferchart.d.ts +10 -0
- package/dist/data/results.bufferchart.js +90 -0
- package/dist/data/results.completed-parts.d.ts +26 -0
- package/dist/data/results.completed-parts.js +181 -0
- package/dist/data/results.cycles.d.ts +86 -0
- package/dist/data/results.cycles.js +454 -0
- package/dist/data/results.inspection.d.ts +36 -0
- package/dist/data/results.inspection.js +188 -0
- package/dist/data/results.oee.d.ts +40 -0
- package/dist/data/results.oee.js +330 -0
- package/dist/data/results.schedules.d.ts +23 -0
- package/dist/data/results.schedules.js +157 -0
- package/dist/data/tools-programs.d.ts +78 -0
- package/dist/data/tools-programs.js +376 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +60 -0
- package/dist/network/api.d.ts +1390 -0
- package/dist/network/api.js +4971 -0
- package/dist/network/backend-mock.d.ts +11 -0
- package/dist/network/backend-mock.js +512 -0
- package/dist/network/backend.d.ts +57 -0
- package/dist/network/backend.js +77 -0
- package/dist/network/load-specific-month.d.ts +13 -0
- package/dist/network/load-specific-month.js +77 -0
- package/dist/network/server-settings.d.ts +12 -0
- package/dist/network/server-settings.js +92 -0
- package/dist/network/websocket.d.ts +4 -0
- package/dist/network/websocket.js +165 -0
- package/dist/renderer.d.ts +8 -0
- package/dist/renderer.js +55 -0
- package/dist/seedtactics-logo.d.ts +2 -0
- package/dist/seedtactics-logo.js +4 -0
- package/dist/util/chart-colors.d.ts +1 -0
- package/dist/util/chart-colors.js +116 -0
- package/dist/util/chart-helpers.d.ts +3 -0
- package/dist/util/chart-helpers.js +51 -0
- package/dist/util/parseISODuration.d.ts +4 -0
- package/dist/util/parseISODuration.js +40 -0
- package/docs/client-efficiency.md +355 -0
- package/docs/client-engineering.md +54 -0
- package/docs/client-launch.md +55 -0
- package/docs/client-operations.md +88 -0
- package/docs/client-quality.md +74 -0
- package/docs/client-sales.md +61 -0
- package/docs/client-scanners.md +41 -0
- package/docs/client-station-monitor.md +149 -0
- package/docs/client-tools-programs.md +74 -0
- package/docs/improve-fms.md +141 -0
- package/docs/makino.md +40 -0
- package/docs/material-quarantine.md +82 -0
- package/docs/material-tracking.md +236 -0
- package/docs/mazak.md +115 -0
- package/docs/niigata.md +228 -0
- package/docs/operator-procedures.md +106 -0
- package/docs/part-instructions.md +63 -0
- package/docs/screenshots/insight-all-material.png +0 -0
- package/docs/screenshots/insight-analysis-pallets.png +0 -0
- package/docs/screenshots/insight-analysis-part-completed.png +0 -0
- package/docs/screenshots/insight-analysis-sankey.png +0 -0
- package/docs/screenshots/insight-analysis-station-oee.png +0 -0
- package/docs/screenshots/insight-buffer-occupancy.png +0 -0
- package/docs/screenshots/insight-choose-analysis-month.png +0 -0
- package/docs/screenshots/insight-closeout.png +0 -0
- package/docs/screenshots/insight-cost-percentages.png +0 -0
- package/docs/screenshots/insight-dashboard.png +0 -0
- package/docs/screenshots/insight-event-custom-view.jpg +0 -0
- package/docs/screenshots/insight-event-viewer.jpg +0 -0
- package/docs/screenshots/insight-inspection.png +0 -0
- package/docs/screenshots/insight-load-station-details.png +0 -0
- package/docs/screenshots/insight-load-station.png +0 -0
- package/docs/screenshots/insight-loadcycle-graph.png +0 -0
- package/docs/screenshots/insight-loadstation-small.jpg +0 -0
- package/docs/screenshots/insight-machinecycle-graph.png +0 -0
- package/docs/screenshots/insight-machinecycle-table.png +0 -0
- package/docs/screenshots/insight-machinecycles.png +0 -0
- package/docs/screenshots/insight-machinehours.png +0 -0
- package/docs/screenshots/insight-machineoutliers.png +0 -0
- package/docs/screenshots/insight-monthly-schedules.png +0 -0
- package/docs/screenshots/insight-operations-material.png +0 -0
- package/docs/screenshots/insight-operations-overview.png +0 -0
- package/docs/screenshots/insight-operations-reports.png +0 -0
- package/docs/screenshots/insight-part-cost.png +0 -0
- package/docs/screenshots/insight-program-report.png +0 -0
- package/docs/screenshots/insight-quality-material-details.png +0 -0
- package/docs/screenshots/insight-quality-material.png +0 -0
- package/docs/screenshots/insight-quality-quarantine.png +0 -0
- package/docs/screenshots/insight-quality-sankey.png +0 -0
- package/docs/screenshots/insight-quality-similar-paths.png +0 -0
- package/docs/screenshots/insight-queue-details.png +0 -0
- package/docs/screenshots/insight-queues-jobs-table.png +0 -0
- package/docs/screenshots/insight-queues.png +0 -0
- package/docs/screenshots/insight-sim-day-usage.png +0 -0
- package/docs/screenshots/insight-station-system-overview-buttons.png +0 -0
- package/docs/screenshots/insight-station-system-overview.png +0 -0
- package/docs/screenshots/insight-system-overview.png +0 -0
- package/docs/screenshots/insight-tool-replacements.png +0 -0
- package/docs/screenshots/insight-tool-report.png +0 -0
- package/docs/screenshots/insight-toolbar-btns.png +0 -0
- package/docs/screenshots/insight-workorder-gantt.png +0 -0
- package/docs/screenshots/insight-workorders.png +0 -0
- package/docs/security.md +131 -0
- package/docs/server-config.md +56 -0
- package/docs/server-errors.md +44 -0
- package/package.json +90 -0
- package/src/index.ts +65 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SimStationUse } from "../cell-status/sim-station-use.js";
|
|
2
|
+
import { PartCycleData } from "../cell-status/station-cycles.js";
|
|
3
|
+
import { HashMap } from "@seedtactics/immutable-collections";
|
|
4
|
+
export declare class DayAndStation {
|
|
5
|
+
readonly day: Date;
|
|
6
|
+
readonly station: string;
|
|
7
|
+
constructor(day: Date, station: string);
|
|
8
|
+
compare(other: DayAndStation): number;
|
|
9
|
+
hash(): number;
|
|
10
|
+
toString(): string;
|
|
11
|
+
adjustDay(f: (d: Date) => Date): DayAndStation;
|
|
12
|
+
}
|
|
13
|
+
export declare function binActiveCyclesByDayAndStat(cycles: Iterable<PartCycleData>): HashMap<DayAndStation, number>;
|
|
14
|
+
export declare function binOccupiedCyclesByDayAndStat(cycles: Iterable<PartCycleData>): HashMap<DayAndStation, number>;
|
|
15
|
+
export declare function binDowntimeToDayAndStat(simUses: Iterable<SimStationUse>): HashMap<DayAndStation, number>;
|
|
16
|
+
export declare function binSimStationUseByDayAndStat(simUses: Iterable<SimStationUse>): HashMap<DayAndStation, number>;
|
|
17
|
+
export interface OEEBarPoint {
|
|
18
|
+
readonly x: string;
|
|
19
|
+
readonly y: number;
|
|
20
|
+
readonly plannedHours: number;
|
|
21
|
+
readonly plannedOee: number;
|
|
22
|
+
readonly actualOee: number;
|
|
23
|
+
readonly station: string;
|
|
24
|
+
readonly day: Date;
|
|
25
|
+
}
|
|
26
|
+
export interface OEEBarSeries {
|
|
27
|
+
readonly station: string;
|
|
28
|
+
readonly points: ReadonlyArray<OEEBarPoint>;
|
|
29
|
+
}
|
|
30
|
+
export type OEEType = "labor" | "machine";
|
|
31
|
+
export declare function buildOeeSeries(start: Date, end: Date, ty: OEEType, cycles: Iterable<PartCycleData>, statUse: Iterable<SimStationUse>): ReadonlyArray<OEEBarSeries>;
|
|
32
|
+
export interface HeatmapClipboardPoint {
|
|
33
|
+
readonly x: Date;
|
|
34
|
+
readonly y: string;
|
|
35
|
+
readonly label: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function buildOeeHeatmapTable(yTitle: string, points: ReadonlyArray<HeatmapClipboardPoint>): string;
|
|
38
|
+
export declare function copyOeeHeatmapToClipboard(yTitle: string, points: ReadonlyArray<HeatmapClipboardPoint>): void;
|
|
39
|
+
export declare function buildOeeTable(series: Iterable<OEEBarSeries>): string;
|
|
40
|
+
export declare function copyOeeToClipboard(series: Iterable<OEEBarSeries>): void;
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/* Copyright (c) 2020, John Lenz
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above
|
|
12
|
+
copyright notice, this list of conditions and the following
|
|
13
|
+
disclaimer in the documentation and/or other materials provided
|
|
14
|
+
with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
17
|
+
nor the names of other contributors may be used to endorse or
|
|
18
|
+
promote products derived from this software without specific
|
|
19
|
+
prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
22
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
24
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
25
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
29
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
import { startOfDay, addSeconds, addDays, max, min, differenceInMinutes } from "date-fns";
|
|
34
|
+
import copy from "copy-to-clipboard";
|
|
35
|
+
import { chunkCyclesWithSimilarEndTime } from "../cell-status/estimated-cycle-times.js";
|
|
36
|
+
import { stat_name_and_num } from "../cell-status/station-cycles.js";
|
|
37
|
+
import { hashValues, LazySeq } from "@seedtactics/immutable-collections";
|
|
38
|
+
// --------------------------------------------------------------------------------
|
|
39
|
+
// Actual
|
|
40
|
+
// --------------------------------------------------------------------------------
|
|
41
|
+
export class DayAndStation {
|
|
42
|
+
constructor(day, station) {
|
|
43
|
+
this.day = day;
|
|
44
|
+
this.station = station;
|
|
45
|
+
}
|
|
46
|
+
compare(other) {
|
|
47
|
+
const cmp = this.day.getTime() - other.day.getTime();
|
|
48
|
+
if (cmp !== 0)
|
|
49
|
+
return cmp;
|
|
50
|
+
return this.station.localeCompare(other.station);
|
|
51
|
+
}
|
|
52
|
+
hash() {
|
|
53
|
+
return hashValues(this.day, this.station);
|
|
54
|
+
}
|
|
55
|
+
toString() {
|
|
56
|
+
return `{day: ${this.day.toISOString()}}, station: ${this.station}}`;
|
|
57
|
+
}
|
|
58
|
+
adjustDay(f) {
|
|
59
|
+
return new DayAndStation(f(this.day), this.station);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function splitTimeToDays(startTime, endTime, mins) {
|
|
63
|
+
const startDay = startOfDay(startTime);
|
|
64
|
+
const endDay = startOfDay(endTime);
|
|
65
|
+
if (startDay.getTime() === endDay.getTime()) {
|
|
66
|
+
return [
|
|
67
|
+
{
|
|
68
|
+
day: startDay,
|
|
69
|
+
value: mins,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const vals = [];
|
|
75
|
+
const totalRange = endTime.getTime() - startTime.getTime();
|
|
76
|
+
for (let day = startDay; day <= endDay; day = addDays(day, 1)) {
|
|
77
|
+
const s = max([day, startTime]);
|
|
78
|
+
const e = min([addDays(day, 1), endTime]);
|
|
79
|
+
const pct = (e.getTime() - s.getTime()) / totalRange;
|
|
80
|
+
vals.push({
|
|
81
|
+
day,
|
|
82
|
+
value: mins * pct,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return vals;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function binCycles(cycles, f) {
|
|
89
|
+
return chunkCyclesWithSimilarEndTime(LazySeq.of(cycles), (c) => stat_name_and_num(c.stationGroup, c.stationNumber), (c) => c.endTime)
|
|
90
|
+
.flatMap(([statNameAndNum, cyclesForStat]) => cyclesForStat
|
|
91
|
+
.flatMap((chunk) => {
|
|
92
|
+
// sum elapsed time for chunk and subtract from end time to get start time
|
|
93
|
+
const elapForChunkMins = LazySeq.of(chunk).sumBy((c) => c.elapsedMinsPerMaterial * c.material.length);
|
|
94
|
+
const startTime = addSeconds(chunk[0].endTime, -elapForChunkMins * 60);
|
|
95
|
+
// sum value for chunk
|
|
96
|
+
const valForChunk = LazySeq.of(chunk).sumBy((c) => f(c));
|
|
97
|
+
return splitTimeToDays(startTime, chunk[0].endTime, valForChunk);
|
|
98
|
+
})
|
|
99
|
+
.map((s) => ({
|
|
100
|
+
...s,
|
|
101
|
+
statNameAndNum,
|
|
102
|
+
})))
|
|
103
|
+
.buildHashMap((p) => new DayAndStation(p.day, p.statNameAndNum), (old, p) => p.value + (old ?? 0));
|
|
104
|
+
}
|
|
105
|
+
export function binActiveCyclesByDayAndStat(cycles) {
|
|
106
|
+
return binCycles(cycles, (c) => c.activeMinutes);
|
|
107
|
+
}
|
|
108
|
+
export function binOccupiedCyclesByDayAndStat(cycles) {
|
|
109
|
+
return binCycles(cycles, (c) => c.elapsedMinsPerMaterial * c.material.length);
|
|
110
|
+
}
|
|
111
|
+
// --------------------------------------------------------------------------------
|
|
112
|
+
// Planned
|
|
113
|
+
// --------------------------------------------------------------------------------
|
|
114
|
+
function mergeSortedIntervals(intervals) {
|
|
115
|
+
const merged = [];
|
|
116
|
+
for (const i of intervals) {
|
|
117
|
+
if (merged.length === 0) {
|
|
118
|
+
merged.push(i);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
const last = merged[merged.length - 1];
|
|
122
|
+
if (i.start <= last.end) {
|
|
123
|
+
merged[merged.length - 1] = {
|
|
124
|
+
start: last.start,
|
|
125
|
+
end: max([last.end, i.end]),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
merged.push(i);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return merged;
|
|
134
|
+
}
|
|
135
|
+
export function binDowntimeToDayAndStat(simUses) {
|
|
136
|
+
return LazySeq.of(simUses)
|
|
137
|
+
.filter((simUse) => simUse.plannedDown)
|
|
138
|
+
.toLookupOrderedMap((simUse) => simUse.station, (simUse) => simUse.start)
|
|
139
|
+
.toAscLazySeq()
|
|
140
|
+
.flatMap(([station, uses]) => mergeSortedIntervals(uses.valuesToAscLazySeq()).flatMap((simUse) => splitTimeToDays(simUse.start, simUse.end, differenceInMinutes(simUse.end, simUse.start)).map((x) => ({
|
|
141
|
+
...x,
|
|
142
|
+
station: station,
|
|
143
|
+
}))))
|
|
144
|
+
.toHashMap((s) => [new DayAndStation(s.day, s.station), s.value], (v1, v2) => v1 + v2);
|
|
145
|
+
}
|
|
146
|
+
export function binSimStationUseByDayAndStat(simUses) {
|
|
147
|
+
const downtimes = LazySeq.of(simUses)
|
|
148
|
+
.filter((simUse) => simUse.plannedDown)
|
|
149
|
+
.toLookupOrderedMap((simUse) => simUse.station, (simUse) => simUse.start)
|
|
150
|
+
.mapValues((uses) => mergeSortedIntervals(uses.valuesToAscLazySeq()));
|
|
151
|
+
return LazySeq.of(simUses)
|
|
152
|
+
.filter((simUse) => !simUse.plannedDown)
|
|
153
|
+
.toLookupOrderedMap((simUse) => simUse.station, (simUse) => simUse.start)
|
|
154
|
+
.toAscLazySeq()
|
|
155
|
+
.flatMap(([station, uses]) => {
|
|
156
|
+
const sorted = mergeSortedIntervals(uses.valuesToAscLazySeq());
|
|
157
|
+
const down = downtimes.get(station) ?? [];
|
|
158
|
+
for (let downIdx = 0, sortedIdx = 0; sortedIdx < sorted.length;) {
|
|
159
|
+
if (downIdx < down.length && down[downIdx].end <= sorted[sortedIdx].start) {
|
|
160
|
+
downIdx++;
|
|
161
|
+
}
|
|
162
|
+
else if (downIdx < down.length && down[downIdx].start < sorted[sortedIdx].end) {
|
|
163
|
+
// Downtime overlaps the interval, need to split
|
|
164
|
+
// Several cases, depending on the start and end of the intervals
|
|
165
|
+
const simStart = sorted[sortedIdx].start;
|
|
166
|
+
const simEnd = sorted[sortedIdx].end;
|
|
167
|
+
const downStart = down[downIdx].start;
|
|
168
|
+
const downEnd = down[downIdx].end;
|
|
169
|
+
if (downStart <= simStart && downEnd >= simEnd) {
|
|
170
|
+
// down: |-----------|
|
|
171
|
+
// sim: |-----|
|
|
172
|
+
// downtime removes the whole chunk
|
|
173
|
+
sorted.splice(sortedIdx, 1);
|
|
174
|
+
// don't increment sortedIdx, since we removed it
|
|
175
|
+
// don't increment downIdx since a future sim might overlap
|
|
176
|
+
}
|
|
177
|
+
else if (downStart <= simStart) {
|
|
178
|
+
// down: |-----------|
|
|
179
|
+
// sim: |--------------|
|
|
180
|
+
sorted[sortedIdx] = {
|
|
181
|
+
start: downEnd,
|
|
182
|
+
end: simEnd,
|
|
183
|
+
};
|
|
184
|
+
downIdx += 1;
|
|
185
|
+
// don't increment simIdx, since a future downtime might overlap and so still need to check
|
|
186
|
+
}
|
|
187
|
+
else if (downEnd >= simEnd) {
|
|
188
|
+
// down: |-----------|
|
|
189
|
+
// sim: |----------|
|
|
190
|
+
sorted[sortedIdx] = {
|
|
191
|
+
start: simStart,
|
|
192
|
+
end: downStart,
|
|
193
|
+
};
|
|
194
|
+
sortedIdx += 1;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
// down: |-----------|
|
|
198
|
+
// sim: |---------------------|
|
|
199
|
+
sorted[sortedIdx] = {
|
|
200
|
+
start: simStart,
|
|
201
|
+
end: downStart,
|
|
202
|
+
};
|
|
203
|
+
sorted.splice(sortedIdx + 1, 0, { start: downEnd, end: simEnd });
|
|
204
|
+
downIdx++; // increment downIdx since we used this downtime
|
|
205
|
+
// increment simIdx only by 1 so that we check the remaining end of the sim time
|
|
206
|
+
// we just split
|
|
207
|
+
sortedIdx++;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
// No downtimes overlapping, don't need to edit
|
|
212
|
+
sortedIdx++;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return sorted.flatMap((simUse) => splitTimeToDays(simUse.start, simUse.end, differenceInMinutes(simUse.end, simUse.start)).map((x) => ({
|
|
216
|
+
...x,
|
|
217
|
+
station: station,
|
|
218
|
+
})));
|
|
219
|
+
})
|
|
220
|
+
.toHashMap((s) => [new DayAndStation(s.day, s.station), s.value], (v1, v2) => v1 + v2);
|
|
221
|
+
}
|
|
222
|
+
export function buildOeeSeries(start, end, ty, cycles, statUse) {
|
|
223
|
+
const filteredCycles = LazySeq.of(cycles).filter((e) => (ty === "labor") === e.isLabor && e.endTime >= start && e.endTime <= end);
|
|
224
|
+
const actualBins = binActiveCyclesByDayAndStat(filteredCycles);
|
|
225
|
+
const filteredStatUse = LazySeq.of(statUse).filter((e) => (ty === "labor") === e.station.startsWith("L/U") && e.end >= start && e.start <= end);
|
|
226
|
+
const downtimes = binDowntimeToDayAndStat(filteredStatUse);
|
|
227
|
+
const plannedBins = binSimStationUseByDayAndStat(filteredStatUse);
|
|
228
|
+
const series = [];
|
|
229
|
+
const statNames = actualBins
|
|
230
|
+
.keysToLazySeq()
|
|
231
|
+
.concat(plannedBins.keysToLazySeq())
|
|
232
|
+
.map((e) => e.station)
|
|
233
|
+
.distinct()
|
|
234
|
+
.toSortedArray((x) => x);
|
|
235
|
+
for (const stat of statNames) {
|
|
236
|
+
const points = [];
|
|
237
|
+
for (let d = start; d < end; d = addDays(d, 1)) {
|
|
238
|
+
const dAndStat = new DayAndStation(d, stat);
|
|
239
|
+
const actual = actualBins.get(dAndStat);
|
|
240
|
+
const planned = plannedBins.get(dAndStat);
|
|
241
|
+
const down = downtimes.get(dAndStat) ?? 0;
|
|
242
|
+
points.push({
|
|
243
|
+
x: d.toLocaleDateString(),
|
|
244
|
+
y: (actual ?? 0) / 60,
|
|
245
|
+
plannedHours: (planned ?? 0) / 60,
|
|
246
|
+
actualOee: down < 24 * 60 ? (actual ?? 0) / (24 * 60 - down) : 0,
|
|
247
|
+
plannedOee: down < 24 * 60 ? (planned ?? 0) / (24 * 60 - down) : 0,
|
|
248
|
+
station: stat,
|
|
249
|
+
day: d,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
series.push({
|
|
253
|
+
station: stat,
|
|
254
|
+
points: points,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
return series;
|
|
258
|
+
}
|
|
259
|
+
class HeatmapClipboardCell {
|
|
260
|
+
constructor(x, y) {
|
|
261
|
+
this.x = x;
|
|
262
|
+
this.y = y;
|
|
263
|
+
}
|
|
264
|
+
compare(other) {
|
|
265
|
+
const cmp = this.x - other.x;
|
|
266
|
+
if (cmp !== 0)
|
|
267
|
+
return cmp;
|
|
268
|
+
return this.y.localeCompare(other.y);
|
|
269
|
+
}
|
|
270
|
+
hash() {
|
|
271
|
+
return hashValues(this.x, this.y);
|
|
272
|
+
}
|
|
273
|
+
toString() {
|
|
274
|
+
return `{x: ${new Date(this.x).toISOString()}, y: ${this.y}}`;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
export function buildOeeHeatmapTable(yTitle, points) {
|
|
278
|
+
const cells = LazySeq.of(points).toHashMap((p) => [new HeatmapClipboardCell(p.x.getTime(), p.y), p], (_, c) => c);
|
|
279
|
+
const days = LazySeq.of(points)
|
|
280
|
+
.map((p) => p.x.getTime())
|
|
281
|
+
.distinct()
|
|
282
|
+
.toSortedArray((x) => x);
|
|
283
|
+
const rows = LazySeq.of(points)
|
|
284
|
+
.map((p) => p.y)
|
|
285
|
+
.distinct()
|
|
286
|
+
.toSortedArray((x) => x);
|
|
287
|
+
let table = "<table>\n<thead><tr><th>" + yTitle + "</th>";
|
|
288
|
+
for (const x of days) {
|
|
289
|
+
table += "<th>" + new Date(x).toDateString() + "</th>";
|
|
290
|
+
}
|
|
291
|
+
table += "</tr></thead>\n<tbody>\n";
|
|
292
|
+
for (const y of rows) {
|
|
293
|
+
table += "<tr><th>" + y + "</th>";
|
|
294
|
+
for (const x of days) {
|
|
295
|
+
const cell = cells.get(new HeatmapClipboardCell(x, y));
|
|
296
|
+
if (cell !== undefined) {
|
|
297
|
+
table += "<td>" + cell.label + "</td>";
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
table += "<td></td>";
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
table += "</tr>\n";
|
|
304
|
+
}
|
|
305
|
+
table += "</tbody>\n</table>";
|
|
306
|
+
return table;
|
|
307
|
+
}
|
|
308
|
+
export function copyOeeHeatmapToClipboard(yTitle, points) {
|
|
309
|
+
copy(buildOeeHeatmapTable(yTitle, points));
|
|
310
|
+
}
|
|
311
|
+
export function buildOeeTable(series) {
|
|
312
|
+
let table = "<table>\n<thead><tr>";
|
|
313
|
+
table += "<th>Day</th><th>Station</th><th>Actual Hours</th><th>Planned Hours</th>";
|
|
314
|
+
table += "</tr></thead>\n<tbody>\n";
|
|
315
|
+
for (const s of series) {
|
|
316
|
+
for (const pt of s.points) {
|
|
317
|
+
table += "<tr>";
|
|
318
|
+
table += "<td>" + pt.day.toLocaleDateString() + "</td>";
|
|
319
|
+
table += "<td>" + pt.station + "</td>";
|
|
320
|
+
table += "<td>" + pt.y.toFixed(1) + "</td>";
|
|
321
|
+
table += "<td>" + pt.plannedHours.toFixed(1) + "</td>";
|
|
322
|
+
table += "</tr>\n";
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
table += "</tbody>\n</table>";
|
|
326
|
+
return table;
|
|
327
|
+
}
|
|
328
|
+
export function copyOeeToClipboard(series) {
|
|
329
|
+
copy(buildOeeTable(series));
|
|
330
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MaterialSummaryAndCompletedData } from "../cell-status/material-summary.js";
|
|
2
|
+
import { ICurrentStatus, IHistoricJob, IActiveJob } from "../network/api.js";
|
|
3
|
+
import { HashMap } from "@seedtactics/immutable-collections";
|
|
4
|
+
export interface ScheduledJobDisplay {
|
|
5
|
+
readonly partName: string;
|
|
6
|
+
readonly comment: string | null | undefined;
|
|
7
|
+
readonly routeStartTime: Date;
|
|
8
|
+
readonly historicJob: Readonly<IHistoricJob> | null;
|
|
9
|
+
readonly inProcJob: Readonly<IActiveJob> | null;
|
|
10
|
+
readonly casting: string;
|
|
11
|
+
readonly scheduledQty: number;
|
|
12
|
+
readonly decrementedQty: number;
|
|
13
|
+
readonly completedQty: number;
|
|
14
|
+
readonly inProcessQty: number;
|
|
15
|
+
readonly remainingQty: number;
|
|
16
|
+
readonly darkRow: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function buildScheduledJobs(zoom: {
|
|
19
|
+
readonly start: Date;
|
|
20
|
+
readonly end: Date;
|
|
21
|
+
} | undefined, matIds: HashMap<number, MaterialSummaryAndCompletedData>, schJobs: HashMap<string, Readonly<IHistoricJob>>, currentSt: Readonly<ICurrentStatus> | null): ReadonlyArray<ScheduledJobDisplay>;
|
|
22
|
+
export declare function buildScheduledJobsTable(jobs: ReadonlyArray<ScheduledJobDisplay>, showMaterial: boolean): string;
|
|
23
|
+
export declare function copyScheduledJobsToClipboard(jobs: ReadonlyArray<ScheduledJobDisplay>, showMaterial: boolean): void;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/* Copyright (c) 2022, John Lenz
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above
|
|
12
|
+
copyright notice, this list of conditions and the following
|
|
13
|
+
disclaimer in the documentation and/or other materials provided
|
|
14
|
+
with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
17
|
+
nor the names of other contributors may be used to endorse or
|
|
18
|
+
promote products derived from this software without specific
|
|
19
|
+
prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
22
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
24
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
25
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
29
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
import copy from "copy-to-clipboard";
|
|
34
|
+
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
35
|
+
export function buildScheduledJobs(zoom, matIds, schJobs, currentSt) {
|
|
36
|
+
const completedMats = LazySeq.of(matIds)
|
|
37
|
+
.flatMap(([matId, summary]) => LazySeq.ofObject(summary.unloaded_processes ?? {}).map(([proc, _]) => ({
|
|
38
|
+
matId: matId,
|
|
39
|
+
proc: parseInt(proc),
|
|
40
|
+
uniq: summary.jobUnique,
|
|
41
|
+
})))
|
|
42
|
+
.toLookupMap((m) => m.uniq, (m) => m.proc, () => 1, (a, b) => a + b);
|
|
43
|
+
const result = new Map();
|
|
44
|
+
if (currentSt) {
|
|
45
|
+
for (const [uniq, curJob] of LazySeq.ofObject(currentSt.jobs)) {
|
|
46
|
+
const casting = LazySeq.of(curJob.procsAndPaths[0]?.paths ?? [])
|
|
47
|
+
.collect((p) => (p.casting === "" ? null : p.casting))
|
|
48
|
+
.head();
|
|
49
|
+
result.set(uniq, {
|
|
50
|
+
partName: curJob.partName,
|
|
51
|
+
comment: curJob.comment,
|
|
52
|
+
routeStartTime: curJob.routeStartUTC,
|
|
53
|
+
historicJob: null,
|
|
54
|
+
inProcJob: curJob,
|
|
55
|
+
casting: casting ?? "",
|
|
56
|
+
scheduledQty: curJob.cycles ?? 0,
|
|
57
|
+
decrementedQty: LazySeq.of(curJob.decrements || []).sumBy((d) => d.quantity),
|
|
58
|
+
completedQty: LazySeq.of(curJob.completed?.[curJob.completed?.length - 1] ?? []).sumBy((c) => c),
|
|
59
|
+
inProcessQty: 0,
|
|
60
|
+
remainingQty: curJob.remainingToStart ?? 0,
|
|
61
|
+
darkRow: false,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
for (const [uniq, schJob] of schJobs) {
|
|
66
|
+
const displayJob = result.get(uniq);
|
|
67
|
+
if (displayJob) {
|
|
68
|
+
displayJob.historicJob = schJob;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (!zoom || (schJob.routeStartUTC >= zoom.start && schJob.routeStartUTC <= zoom.end)) {
|
|
72
|
+
const casting = LazySeq.of(schJob.procsAndPaths[0]?.paths ?? [])
|
|
73
|
+
.collect((p) => (p.casting === "" ? null : p.casting))
|
|
74
|
+
.head();
|
|
75
|
+
result.set(uniq, {
|
|
76
|
+
partName: schJob.partName,
|
|
77
|
+
comment: schJob.comment,
|
|
78
|
+
routeStartTime: schJob.routeStartUTC,
|
|
79
|
+
historicJob: schJob,
|
|
80
|
+
inProcJob: null,
|
|
81
|
+
casting: casting ?? "",
|
|
82
|
+
scheduledQty: schJob.cycles ?? 0,
|
|
83
|
+
decrementedQty: LazySeq.of(schJob.decrements || []).sumBy((d) => d.quantity),
|
|
84
|
+
completedQty: completedMats.get(uniq)?.get(schJob.procsAndPaths.length) ?? 0,
|
|
85
|
+
inProcessQty: 0,
|
|
86
|
+
darkRow: false,
|
|
87
|
+
remainingQty: 0,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (currentSt) {
|
|
93
|
+
for (const mat of currentSt.material) {
|
|
94
|
+
if (mat.jobUnique) {
|
|
95
|
+
const job = result.get(mat.jobUnique);
|
|
96
|
+
if (job) {
|
|
97
|
+
job.inProcessQty += 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const sorted = Array.from(result.values()).sort((j1, j2) => {
|
|
103
|
+
// sort starting time high to low, then by part
|
|
104
|
+
const timeDiff = j2.routeStartTime.getTime() - j1.routeStartTime.getTime();
|
|
105
|
+
if (timeDiff == 0) {
|
|
106
|
+
return j1.partName.localeCompare(j2.partName);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
return timeDiff;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
let lastSchId = null;
|
|
113
|
+
let curDark = true;
|
|
114
|
+
for (const job of sorted) {
|
|
115
|
+
if (lastSchId != (job.historicJob?.scheduleId ?? job.inProcJob?.scheduleId ?? null)) {
|
|
116
|
+
curDark = !curDark;
|
|
117
|
+
lastSchId = job.historicJob?.scheduleId ?? job.inProcJob?.scheduleId ?? null;
|
|
118
|
+
}
|
|
119
|
+
job.darkRow = curDark;
|
|
120
|
+
}
|
|
121
|
+
return sorted;
|
|
122
|
+
}
|
|
123
|
+
// --------------------------------------------------------------------------------
|
|
124
|
+
// Clipboard
|
|
125
|
+
// --------------------------------------------------------------------------------
|
|
126
|
+
export function buildScheduledJobsTable(jobs, showMaterial) {
|
|
127
|
+
let table = "<table>\n<thead><tr>";
|
|
128
|
+
table += "<th>Date</th>";
|
|
129
|
+
table += "<th>Part</th>";
|
|
130
|
+
if (showMaterial) {
|
|
131
|
+
table += "<th>Material</th>";
|
|
132
|
+
}
|
|
133
|
+
table += "<th>Note</th>";
|
|
134
|
+
table += "<th>Scheduled</th>";
|
|
135
|
+
table += "<th>Removed</th>";
|
|
136
|
+
table += "<th>Completed</th>";
|
|
137
|
+
table += "<th>In Process</th>";
|
|
138
|
+
table += "</tr></thead>\n<tbody>\n";
|
|
139
|
+
for (const s of jobs) {
|
|
140
|
+
table += "<tr><td>" + s.routeStartTime.toString() + "</td>";
|
|
141
|
+
table += "<td>" + s.partName + "</td>";
|
|
142
|
+
if (showMaterial) {
|
|
143
|
+
table += "<td>" + (s.casting ?? s.partName) + "</td>";
|
|
144
|
+
}
|
|
145
|
+
table += "<td>" + (s.comment ?? "") + "</td>";
|
|
146
|
+
table += "<td>" + s.scheduledQty.toFixed(0) + "</td>";
|
|
147
|
+
table += "<td>" + s.decrementedQty.toFixed(0) + "</td>";
|
|
148
|
+
table += "<td>" + s.completedQty.toFixed(0) + "</td>";
|
|
149
|
+
table += "<td>" + s.inProcessQty.toFixed(0) + "</td>";
|
|
150
|
+
table += "</tr>\n";
|
|
151
|
+
}
|
|
152
|
+
table += "</tbody>\n</table>";
|
|
153
|
+
return table;
|
|
154
|
+
}
|
|
155
|
+
export function copyScheduledJobsToClipboard(jobs, showMaterial) {
|
|
156
|
+
copy(buildScheduledJobsTable(jobs, showMaterial));
|
|
157
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ICurrentStatus, IHistoricJob, IProgramInCellController, IToolInMachine } from "../network/api.js";
|
|
2
|
+
import { ProgramToolUseInSingleCycle, ToolUsage } from "../cell-status/tool-usage.js";
|
|
3
|
+
import { EstimatedCycleTimes, PartAndStationOperation, StatisticalCycleTime } from "../cell-status/estimated-cycle-times.js";
|
|
4
|
+
import { HashMap, OrderedSet } from "@seedtactics/immutable-collections";
|
|
5
|
+
export type ToolInMachine = {
|
|
6
|
+
readonly machineName: string;
|
|
7
|
+
readonly pocket: number;
|
|
8
|
+
readonly serial?: string;
|
|
9
|
+
readonly currentUseMinutes: number | null;
|
|
10
|
+
readonly lifetimeMinutes: number | null;
|
|
11
|
+
readonly remainingMinutes: number | null;
|
|
12
|
+
readonly currentUseCnt: number | null;
|
|
13
|
+
readonly lifetimeCnt: number | null;
|
|
14
|
+
readonly remainingCnt: number | null;
|
|
15
|
+
};
|
|
16
|
+
export type PartToolUsage = {
|
|
17
|
+
readonly partAndProg: PartAndStationOperation;
|
|
18
|
+
readonly quantity: number;
|
|
19
|
+
readonly scheduledUseMinutes: number;
|
|
20
|
+
readonly scheduledUseCnt: number;
|
|
21
|
+
readonly machines: OrderedSet<string>;
|
|
22
|
+
};
|
|
23
|
+
export type ToolReport = {
|
|
24
|
+
readonly toolName: string;
|
|
25
|
+
readonly machines: ReadonlyArray<ToolInMachine>;
|
|
26
|
+
readonly parts: ReadonlyArray<PartToolUsage>;
|
|
27
|
+
readonly estimatedToolCounts: boolean;
|
|
28
|
+
};
|
|
29
|
+
declare global {
|
|
30
|
+
interface Window {
|
|
31
|
+
bmsToolReportOverridePartQuantity?: number;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export declare function calcToolReport(currentSt: Readonly<ICurrentStatus>, toolsInMach: ReadonlyArray<Readonly<IToolInMachine>>, usage: ToolUsage): ReadonlyArray<ToolReport>;
|
|
35
|
+
export declare const toolReportRefreshTime: import("jotai").WritableAtom<Date | null, [Date], Promise<void>>;
|
|
36
|
+
export declare const machinesWithTools: import("jotai").Atom<readonly string[]>;
|
|
37
|
+
export declare const currentToolReport: import("jotai").Atom<readonly ToolReport[] | null>;
|
|
38
|
+
export declare const toolReportHasSerial: import("jotai").Atom<boolean>;
|
|
39
|
+
export declare const toolReportEstimatedToolCounts: import("jotai").Atom<boolean>;
|
|
40
|
+
export declare function useCopyToolReportToClipboard(): () => void;
|
|
41
|
+
export interface CellControllerProgram {
|
|
42
|
+
readonly programName: string;
|
|
43
|
+
readonly cellControllerProgramName: string;
|
|
44
|
+
readonly comment: string | null;
|
|
45
|
+
readonly revision: number | null;
|
|
46
|
+
readonly partName: string | null;
|
|
47
|
+
readonly statisticalCycleTime: StatisticalCycleTime | null;
|
|
48
|
+
readonly toolUse: ProgramToolUseInSingleCycle | null;
|
|
49
|
+
readonly plannedMins: number | null;
|
|
50
|
+
}
|
|
51
|
+
export interface ProgramReport {
|
|
52
|
+
readonly time: Date;
|
|
53
|
+
readonly programs: ReadonlyArray<CellControllerProgram>;
|
|
54
|
+
readonly hasRevisions: boolean;
|
|
55
|
+
readonly cellNameDifferentFromProgName: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare function calcProgramReport(usage: ToolUsage, cycleTimes: EstimatedCycleTimes, jobs: HashMap<string, Readonly<IHistoricJob>> | null, progsInCellCtrl: ReadonlyArray<Readonly<IProgramInCellController>>, progsToShow: ReadonlySet<string> | null): ProgramReport;
|
|
58
|
+
export declare const programFilter: import("jotai").PrimitiveAtom<"AllPrograms" | "ActivePrograms"> & {
|
|
59
|
+
init: "AllPrograms" | "ActivePrograms";
|
|
60
|
+
};
|
|
61
|
+
export declare const programReportRefreshTime: import("jotai").WritableAtom<Date | null, [Date], Promise<void>>;
|
|
62
|
+
export declare const currentProgramReport: import("jotai").Atom<ProgramReport | null>;
|
|
63
|
+
export type ProgramNameAndRevision = {
|
|
64
|
+
readonly programName: string;
|
|
65
|
+
readonly revision: number | null;
|
|
66
|
+
readonly partName: string | null;
|
|
67
|
+
};
|
|
68
|
+
export declare const programToShowContent: import("jotai").PrimitiveAtom<ProgramNameAndRevision | null> & {
|
|
69
|
+
init: ProgramNameAndRevision | null;
|
|
70
|
+
};
|
|
71
|
+
export declare const programContent: import("jotai").Atom<Promise<string>>;
|
|
72
|
+
export type ProgramHistoryRequest = {
|
|
73
|
+
readonly programName: string;
|
|
74
|
+
readonly partName: string | null;
|
|
75
|
+
};
|
|
76
|
+
export declare const programToShowHistory: import("jotai").PrimitiveAtom<ProgramHistoryRequest | null> & {
|
|
77
|
+
init: ProgramHistoryRequest | null;
|
|
78
|
+
};
|