@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,25 @@
|
|
|
1
|
+
import { MaterialSummaryAndCompletedData } from "../../cell-status/material-summary.js";
|
|
2
|
+
import { PartCycleData } from "../../cell-status/station-cycles.js";
|
|
3
|
+
import { HashMap } from "@seedtactics/immutable-collections";
|
|
4
|
+
import { SelectedAnalysisPeriod } from "../../network/load-specific-month.js";
|
|
5
|
+
interface StationDataTableProps {
|
|
6
|
+
readonly points: ReadonlyMap<string, ReadonlyArray<PartCycleData>>;
|
|
7
|
+
readonly matsById: HashMap<number, MaterialSummaryAndCompletedData>;
|
|
8
|
+
readonly current_date_zoom: {
|
|
9
|
+
start: Date;
|
|
10
|
+
end: Date;
|
|
11
|
+
} | undefined;
|
|
12
|
+
readonly set_date_zoom_range: ((p: {
|
|
13
|
+
zoom?: {
|
|
14
|
+
start: Date;
|
|
15
|
+
end: Date;
|
|
16
|
+
};
|
|
17
|
+
}) => void) | undefined;
|
|
18
|
+
readonly period: SelectedAnalysisPeriod;
|
|
19
|
+
readonly showWorkorderAndInspect: boolean;
|
|
20
|
+
readonly hideMedian?: boolean;
|
|
21
|
+
readonly defaultSortDesc?: boolean;
|
|
22
|
+
readonly emptyMessage?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: import("react").NamedExoticComponent<StationDataTableProps>;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2019, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { memo, useState } from "react";
|
|
35
|
+
import { Table } from "@mui/material";
|
|
36
|
+
import { format_cycle_inspection } from "../../data/results.cycles.js";
|
|
37
|
+
import { DataTableHead, DataTableActions, DataTableBody, useColSort, useTablePage, } from "./DataTable.js";
|
|
38
|
+
import { addDays, addHours, addMonths } from "date-fns";
|
|
39
|
+
import { Menu } from "@mui/material";
|
|
40
|
+
import { MenuItem } from "@mui/material";
|
|
41
|
+
import { materialDialogOpen } from "../../cell-status/material-details.js";
|
|
42
|
+
import { LazySeq, mkCompareByProperties, } from "@seedtactics/immutable-collections";
|
|
43
|
+
import { useSetAtom } from "jotai";
|
|
44
|
+
var ColumnId;
|
|
45
|
+
(function (ColumnId) {
|
|
46
|
+
ColumnId[ColumnId["Date"] = 0] = "Date";
|
|
47
|
+
ColumnId[ColumnId["Part"] = 1] = "Part";
|
|
48
|
+
ColumnId[ColumnId["Station"] = 2] = "Station";
|
|
49
|
+
ColumnId[ColumnId["Pallet"] = 3] = "Pallet";
|
|
50
|
+
ColumnId[ColumnId["Serial"] = 4] = "Serial";
|
|
51
|
+
ColumnId[ColumnId["Workorder"] = 5] = "Workorder";
|
|
52
|
+
ColumnId[ColumnId["Operation"] = 6] = "Operation";
|
|
53
|
+
ColumnId[ColumnId["Inspection"] = 7] = "Inspection";
|
|
54
|
+
ColumnId[ColumnId["ElapsedMin"] = 8] = "ElapsedMin";
|
|
55
|
+
ColumnId[ColumnId["ActiveMin"] = 9] = "ActiveMin";
|
|
56
|
+
ColumnId[ColumnId["MedianElapsed"] = 10] = "MedianElapsed";
|
|
57
|
+
ColumnId[ColumnId["MedianDeviation"] = 11] = "MedianDeviation";
|
|
58
|
+
})(ColumnId || (ColumnId = {}));
|
|
59
|
+
function buildColumns(matIds) {
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
id: ColumnId.Date,
|
|
63
|
+
numeric: false,
|
|
64
|
+
label: "Date",
|
|
65
|
+
getDisplay: (c) => c.endTime.toLocaleString(),
|
|
66
|
+
getForSort: (c) => c.endTime.getTime(),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: ColumnId.Part,
|
|
70
|
+
numeric: false,
|
|
71
|
+
label: "Part",
|
|
72
|
+
getDisplay: (c) => c.part +
|
|
73
|
+
"-" +
|
|
74
|
+
LazySeq.of(c.material)
|
|
75
|
+
.map((m) => m.proc)
|
|
76
|
+
.distinctAndSortBy((p) => p)
|
|
77
|
+
.toRArray()
|
|
78
|
+
.join(":"),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: ColumnId.Station,
|
|
82
|
+
numeric: false,
|
|
83
|
+
label: "Station",
|
|
84
|
+
getDisplay: (c) => c.stationGroup + " " + c.stationNumber.toString(),
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: ColumnId.Operation,
|
|
88
|
+
numeric: false,
|
|
89
|
+
label: "Operation",
|
|
90
|
+
getDisplay: (c) => c.operation,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: ColumnId.Pallet,
|
|
94
|
+
numeric: false,
|
|
95
|
+
label: "Pallet",
|
|
96
|
+
getDisplay: (c) => c.pallet.toString(),
|
|
97
|
+
getForSort: (c) => c.pallet,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: ColumnId.Serial,
|
|
101
|
+
numeric: false,
|
|
102
|
+
label: "Serial",
|
|
103
|
+
getDisplay: (c) => c.material
|
|
104
|
+
.filter((m) => m.serial)
|
|
105
|
+
.map((m) => m.serial)
|
|
106
|
+
.join(", "),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: ColumnId.Workorder,
|
|
110
|
+
numeric: false,
|
|
111
|
+
label: "Workorder",
|
|
112
|
+
getDisplay: (c) => c.material
|
|
113
|
+
.filter((m) => m.workorder)
|
|
114
|
+
.map((m) => m.workorder)
|
|
115
|
+
.join(", "),
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: ColumnId.Inspection,
|
|
119
|
+
numeric: false,
|
|
120
|
+
label: "Inspection",
|
|
121
|
+
getDisplay: (c) => format_cycle_inspection(c, matIds),
|
|
122
|
+
getForSort: (c) => {
|
|
123
|
+
return LazySeq.of(c.material)
|
|
124
|
+
.collect((m) => matIds.get(m.id))
|
|
125
|
+
.flatMap((m) => m.signaledInspections)
|
|
126
|
+
.distinct()
|
|
127
|
+
.toSortedArray((x) => x)
|
|
128
|
+
.join(",");
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: ColumnId.ElapsedMin,
|
|
133
|
+
numeric: true,
|
|
134
|
+
label: "Elapsed Min",
|
|
135
|
+
getDisplay: (c) => (c.elapsedMinsPerMaterial * c.material.length).toFixed(1),
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: ColumnId.ActiveMin,
|
|
139
|
+
numeric: true,
|
|
140
|
+
label: "Target Min",
|
|
141
|
+
getDisplay: (c) => c.activeMinutes.toFixed(1),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: ColumnId.MedianElapsed,
|
|
145
|
+
numeric: true,
|
|
146
|
+
label: "Median Elapsed Min",
|
|
147
|
+
getDisplay: (c) => c.medianCycleMinutes.toFixed(1),
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: ColumnId.MedianDeviation,
|
|
151
|
+
numeric: true,
|
|
152
|
+
label: "Median Deviation",
|
|
153
|
+
getDisplay: (c) => c.MAD_aboveMinutes.toFixed(1),
|
|
154
|
+
},
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
function extractData(points, columns, currentZoom, orderBy, order) {
|
|
158
|
+
let getData;
|
|
159
|
+
for (const col of columns) {
|
|
160
|
+
if (col.id === orderBy) {
|
|
161
|
+
getData = col.getForSort || col.getDisplay;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (getData === undefined) {
|
|
165
|
+
getData = columns[0].getForSort || columns[0].getDisplay;
|
|
166
|
+
}
|
|
167
|
+
const getDataC = getData;
|
|
168
|
+
const data = LazySeq.of(points.values()).flatMap((x) => x);
|
|
169
|
+
const arr = currentZoom
|
|
170
|
+
? data.filter((p) => p.endTime >= currentZoom.start && p.endTime <= currentZoom.end).toMutableArray()
|
|
171
|
+
: data.toMutableArray();
|
|
172
|
+
return arr.sort(mkCompareByProperties(order === "desc" ? { desc: getDataC } : { asc: getDataC }, order === "desc" ? { desc: (a) => a.endTime.getTime() } : { asc: (a) => a.endTime.getTime() }));
|
|
173
|
+
}
|
|
174
|
+
function useZoom(props) {
|
|
175
|
+
let zoom;
|
|
176
|
+
const setZoomRange = props.set_date_zoom_range;
|
|
177
|
+
if (setZoomRange) {
|
|
178
|
+
if (props.period.type === "Last30") {
|
|
179
|
+
zoom = {
|
|
180
|
+
type: "Last30Days",
|
|
181
|
+
set_days_back: (numDaysBack) => {
|
|
182
|
+
if (numDaysBack) {
|
|
183
|
+
const now = new Date();
|
|
184
|
+
setZoomRange({ zoom: { start: addDays(now, -numDaysBack), end: addHours(now, 1) } });
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
setZoomRange({ zoom: undefined });
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
zoom = {
|
|
194
|
+
type: "ZoomIntoRange",
|
|
195
|
+
default_date_range: [props.period.month, addMonths(props.period.month, 1)],
|
|
196
|
+
current_date_zoom: props.current_date_zoom,
|
|
197
|
+
set_date_zoom_range: (z) => setZoomRange({ zoom: z }),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
zoom,
|
|
203
|
+
zoomRange: props.current_date_zoom,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
export default memo(function StationDataTable(props) {
|
|
207
|
+
const columns = buildColumns(props.matsById);
|
|
208
|
+
const sort = useColSort(ColumnId.Date, columns);
|
|
209
|
+
const tpage = useTablePage();
|
|
210
|
+
const zoom = useZoom(props);
|
|
211
|
+
const [detailMenu, setDetailMenu] = useState(null);
|
|
212
|
+
const setMatToShow = useSetAtom(materialDialogOpen);
|
|
213
|
+
const allData = extractData(props.points, columns, props.current_date_zoom, sort.orderBy, sort.order);
|
|
214
|
+
const totalDataLength = allData.length;
|
|
215
|
+
const pageData = allData.slice(tpage.page * tpage.rowsPerPage, (tpage.page + 1) * tpage.rowsPerPage);
|
|
216
|
+
const filteredColumns = columns.filter((c) => {
|
|
217
|
+
if (!props.showWorkorderAndInspect && c.id === ColumnId.Workorder) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
if (!props.showWorkorderAndInspect && c.id === ColumnId.Inspection) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
if (props.hideMedian && c.id === ColumnId.MedianElapsed) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
if (props.hideMedian && c.id === ColumnId.MedianDeviation) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
});
|
|
231
|
+
return (_jsxs("div", { children: [_jsxs(Table, { children: [_jsx(DataTableHead, { columns: filteredColumns, sort: sort, showDetailsCol: true }), _jsx(DataTableBody, { columns: filteredColumns, pageData: pageData, rowsPerPage: tpage.rowsPerPage, onClickDetails: (e, row) => {
|
|
232
|
+
if (row.material.length === 0)
|
|
233
|
+
return;
|
|
234
|
+
if (row.material.length === 1) {
|
|
235
|
+
setMatToShow({ type: "LogMat", logMat: row.material[0] });
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
setDetailMenu({ anchorEl: e.currentTarget, material: row.material });
|
|
239
|
+
}
|
|
240
|
+
}, emptyMessage: props.emptyMessage })] }), _jsx(DataTableActions, { zoom: zoom.zoom, tpage: tpage, count: totalDataLength }), _jsx(Menu, { anchorEl: detailMenu?.anchorEl, keepMounted: true, open: detailMenu !== null, onClose: () => setDetailMenu(null), children: detailMenu != null
|
|
241
|
+
? detailMenu.material.map((mat, idx) => (_jsx(MenuItem, { onClick: () => {
|
|
242
|
+
setMatToShow({ type: "LogMat", logMat: mat });
|
|
243
|
+
setDetailMenu(null);
|
|
244
|
+
}, children: mat.serial || "Material" }, idx)))
|
|
245
|
+
: undefined })] }));
|
|
246
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ToolReplacementPage: import("react").NamedExoticComponent<object>;
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2022, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { Box, FormControl, IconButton, MenuItem, Select, Stack, Table, Tooltip, Typography, } from "@mui/material";
|
|
35
|
+
import { ImportExport } from "@mui/icons-material";
|
|
36
|
+
import { createContext, memo, useContext, useMemo } from "react";
|
|
37
|
+
import { selectedAnalysisPeriod } from "../../network/load-specific-month.js";
|
|
38
|
+
import { last30ToolReplacements, specificMonthToolReplacements, } from "../../cell-status/tool-replacements.js";
|
|
39
|
+
import { copyTableToClipboard, DataTableActions, DataTableBody, DataTableHead, useColSort, useTablePage, useTableZoomForPeriod, } from "./DataTable.js";
|
|
40
|
+
import { OrderedMap } from "@seedtactics/immutable-collections";
|
|
41
|
+
import { scaleLinear, scaleTime } from "d3-scale";
|
|
42
|
+
import { addDays, addMonths, startOfToday } from "date-fns";
|
|
43
|
+
import { Tooltip as ChartTooltip } from "../ChartTooltip.js";
|
|
44
|
+
import { localPoint } from "../../util/chart-helpers.js";
|
|
45
|
+
import { useSetTitle } from "../routes.js";
|
|
46
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
47
|
+
import { useResizeDetector } from "react-resize-detector";
|
|
48
|
+
function tool_replacements_with_station_and_date(zoom, allReplacements, station) {
|
|
49
|
+
const zoomRange = zoom?.zoomRange;
|
|
50
|
+
if (station) {
|
|
51
|
+
const rsForStat = allReplacements.get(station) ?? OrderedMap.empty();
|
|
52
|
+
return rsForStat
|
|
53
|
+
.valuesToAscLazySeq()
|
|
54
|
+
.transform((x) => zoomRange ? x.filter((rs) => rs.time >= zoomRange.start && rs.time <= zoomRange.end) : x)
|
|
55
|
+
.flatMap((rs) => rs.replacements.map((r) => ({ ...r, station, time: rs.time })));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return allReplacements.toAscLazySeq().flatMap(([station, rsByStat]) => rsByStat
|
|
59
|
+
.valuesToAscLazySeq()
|
|
60
|
+
.transform((x) => zoomRange ? x.filter((rs) => rs.time >= zoomRange.start && rs.time <= zoomRange.end) : x)
|
|
61
|
+
.flatMap((rs) => rs.replacements.map((r) => ({ ...r, station, time: rs.time }))));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function tool_summary(zoom, allReplacements, station, sortOn) {
|
|
65
|
+
return tool_replacements_with_station_and_date(zoom, allReplacements, station)
|
|
66
|
+
.groupBy((r) => r.tool)
|
|
67
|
+
.map(([tool, replacements]) => {
|
|
68
|
+
let totalUse = 0;
|
|
69
|
+
let maxUse = null;
|
|
70
|
+
let totalCnt = 0;
|
|
71
|
+
let maxCnt = null;
|
|
72
|
+
for (const r of replacements) {
|
|
73
|
+
const u = r.type === "ReplaceBeforeCycleStart" ? r.useAtReplacement : r.totalUseAtBeginningOfCycle;
|
|
74
|
+
if (u && (maxUse === null || u > maxUse)) {
|
|
75
|
+
maxUse = u;
|
|
76
|
+
}
|
|
77
|
+
if (u)
|
|
78
|
+
totalUse += u;
|
|
79
|
+
const c = r.type === "ReplaceBeforeCycleStart" ? r.cntAtReplacement : r.totalCntAtBeginningOfCycle;
|
|
80
|
+
if (c && (maxCnt === null || c > maxCnt)) {
|
|
81
|
+
maxCnt = c;
|
|
82
|
+
}
|
|
83
|
+
if (c)
|
|
84
|
+
totalCnt += c;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
tool,
|
|
88
|
+
numReplacements: replacements.length,
|
|
89
|
+
totalUseOfAllReplacements: totalUse,
|
|
90
|
+
totalCntOfAllReplacements: totalCnt,
|
|
91
|
+
maxY: maxUse ?? maxCnt ?? 1,
|
|
92
|
+
yAxisType: maxUse === null ? "Count" : "Time",
|
|
93
|
+
replacements,
|
|
94
|
+
};
|
|
95
|
+
})
|
|
96
|
+
.toSortedArray(sortOn);
|
|
97
|
+
}
|
|
98
|
+
function replacementToYVal(row, r) {
|
|
99
|
+
const def = row.maxY / 2;
|
|
100
|
+
if (r.type === "ReplaceBeforeCycleStart") {
|
|
101
|
+
if (row.yAxisType === "Time") {
|
|
102
|
+
return r.useAtReplacement ?? def;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return r.cntAtReplacement ?? def;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
if (row.yAxisType === "Time") {
|
|
110
|
+
return r.totalUseAtBeginningOfCycle ?? def;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
return r.totalCntAtBeginningOfCycle ?? def;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
var SummaryColumnId;
|
|
118
|
+
(function (SummaryColumnId) {
|
|
119
|
+
SummaryColumnId[SummaryColumnId["Tool"] = 0] = "Tool";
|
|
120
|
+
SummaryColumnId[SummaryColumnId["NumReplacements"] = 1] = "NumReplacements";
|
|
121
|
+
SummaryColumnId[SummaryColumnId["AvgUseAtReplacement"] = 2] = "AvgUseAtReplacement";
|
|
122
|
+
SummaryColumnId[SummaryColumnId["AvgCntAtReplacement"] = 3] = "AvgCntAtReplacement";
|
|
123
|
+
SummaryColumnId[SummaryColumnId["Graph"] = 4] = "Graph";
|
|
124
|
+
})(SummaryColumnId || (SummaryColumnId = {}));
|
|
125
|
+
const decimalFormat = Intl.NumberFormat(undefined, {
|
|
126
|
+
maximumFractionDigits: 1,
|
|
127
|
+
});
|
|
128
|
+
const CurZoomContext = createContext({
|
|
129
|
+
start: new Date(),
|
|
130
|
+
end: new Date(),
|
|
131
|
+
});
|
|
132
|
+
function ReplacementTooltip({ tooltip }) {
|
|
133
|
+
return (_jsxs(Stack, { spacing: 0.5, children: [_jsxs("div", { children: ["Tool: ", tooltip.r.tool] }), _jsxs("div", { children: ["Pocket: ", tooltip.r.pocket] }), _jsxs("div", { children: ["Time: ", tooltip.r.time.toLocaleString()] }), _jsxs("div", { children: ["Station: ", tooltip.r.station.group, " #", tooltip.r.station.num] }), tooltip.r.type === "ReplaceBeforeCycleStart" ? (_jsxs(_Fragment, { children: [tooltip.r.useAtReplacement !== null ? (_jsxs("div", { children: ["Minutes at replacement: ", decimalFormat.format(tooltip.r.useAtReplacement)] })) : undefined, tooltip.r.cntAtReplacement !== null ? (_jsxs("div", { children: ["Count at replacement: ", decimalFormat.format(tooltip.r.cntAtReplacement)] })) : undefined] })) : (_jsxs(_Fragment, { children: [tooltip.r.totalUseAtBeginningOfCycle !== null ? (_jsxs("div", { children: ["Minutes at beginning of cycle: ", decimalFormat.format(tooltip.r.totalUseAtBeginningOfCycle)] })) : undefined, tooltip.r.totalUseAtEndOfCycle !== null ? (_jsxs("div", { children: ["Minutes at end of cycle: ", decimalFormat.format(tooltip.r.totalUseAtEndOfCycle)] })) : undefined, tooltip.r.totalCntAtBeginningOfCycle !== null ? (_jsxs("div", { children: ["Count at beginning of cycle: ", decimalFormat.format(tooltip.r.totalCntAtBeginningOfCycle)] })) : undefined, tooltip.r.totalCntAtEndOfCycle !== null ? (_jsxs("div", { children: ["Count at end of cycle: ", decimalFormat.format(tooltip.r.totalCntAtEndOfCycle)] })) : undefined] }))] }));
|
|
134
|
+
}
|
|
135
|
+
function Replacements({ row, tooltip, timeScale, yScale, }) {
|
|
136
|
+
const [t, setTooltip] = useAtom(tooltip);
|
|
137
|
+
return (_jsx("g", { children: row.replacements.map((r, i) => (_jsx("circle", { cx: timeScale(r.time), cy: yScale(replacementToYVal(row, r)), r: r === t?.r ? 4 : 2, onMouseEnter: (e) => setTooltip({ top: 0, left: localPoint(e)?.x ?? 0, r }), fill: "black" }, i))) }));
|
|
138
|
+
}
|
|
139
|
+
const ReplacementGraph = memo(function ReplacementGraph({ row }) {
|
|
140
|
+
const zoom = useContext(CurZoomContext);
|
|
141
|
+
const tooltip = useMemo(() => atom(null), []);
|
|
142
|
+
const setTooltip = useSetAtom(tooltip);
|
|
143
|
+
const { ref: chartRef, width: chartWidth } = useResizeDetector({
|
|
144
|
+
refreshMode: "debounce",
|
|
145
|
+
refreshRate: 100,
|
|
146
|
+
handleHeight: false,
|
|
147
|
+
});
|
|
148
|
+
const timeScale = scaleTime()
|
|
149
|
+
.domain([zoom.start, zoom.end])
|
|
150
|
+
.range([0, chartWidth ?? 1000]);
|
|
151
|
+
const yScale = scaleLinear().domain([0, row.maxY]).range([33, 3]);
|
|
152
|
+
const avgUse = row.numReplacements === 0 ? null : yScale(row.totalUseOfAllReplacements / row.numReplacements);
|
|
153
|
+
return (_jsxs("div", { ref: chartRef, style: { position: "relative", width: "100%", height: "35px" }, children: [_jsxs("svg", { height: "35", width: chartWidth ?? 1000, onMouseLeave: () => setTooltip(null), children: [avgUse !== null ? (_jsx("line", { x1: "0", y1: avgUse, x2: chartWidth ?? 1000, y2: avgUse, stroke: "red", strokeWidth: 0.5 })) : undefined, _jsx(Replacements, { row: row, tooltip: tooltip, timeScale: timeScale, yScale: yScale })] }), _jsx(ChartTooltip, { atom: tooltip, TooltipContent: ReplacementTooltip, chartHeight: 35, chartWidth: chartWidth ?? 1000 })] }));
|
|
154
|
+
});
|
|
155
|
+
const summaryColumns = [
|
|
156
|
+
{
|
|
157
|
+
id: SummaryColumnId.Tool,
|
|
158
|
+
numeric: false,
|
|
159
|
+
label: "Tool",
|
|
160
|
+
getDisplay: (c) => c.tool,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: SummaryColumnId.NumReplacements,
|
|
164
|
+
numeric: true,
|
|
165
|
+
label: "Num Replacements",
|
|
166
|
+
getDisplay: (c) => c.numReplacements.toString(),
|
|
167
|
+
getForSort: (c) => c.numReplacements,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: SummaryColumnId.AvgUseAtReplacement,
|
|
171
|
+
numeric: true,
|
|
172
|
+
label: "Avg Use (min) at Replacement",
|
|
173
|
+
getDisplay: (c) => decimalFormat.format(c.totalUseOfAllReplacements / c.numReplacements),
|
|
174
|
+
getForSort: (c) => c.totalUseOfAllReplacements / c.numReplacements,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: SummaryColumnId.AvgCntAtReplacement,
|
|
178
|
+
numeric: true,
|
|
179
|
+
label: "Avg Use (count) at Replacement",
|
|
180
|
+
getDisplay: (c) => decimalFormat.format(c.totalCntOfAllReplacements / c.numReplacements),
|
|
181
|
+
getForSort: (c) => c.totalCntOfAllReplacements / c.numReplacements,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: SummaryColumnId.Graph,
|
|
185
|
+
numeric: false,
|
|
186
|
+
ignoreDuringExport: true,
|
|
187
|
+
label: "All Replacements",
|
|
188
|
+
getDisplay: () => "",
|
|
189
|
+
expanded: true,
|
|
190
|
+
Cell: ReplacementGraph,
|
|
191
|
+
},
|
|
192
|
+
];
|
|
193
|
+
const SummaryTable = memo(function ReplacementTable(props) {
|
|
194
|
+
const period = useAtomValue(selectedAnalysisPeriod);
|
|
195
|
+
const tpage = useTablePage();
|
|
196
|
+
const zoom = useTableZoomForPeriod(period);
|
|
197
|
+
const sort = useColSort(SummaryColumnId.Tool, summaryColumns);
|
|
198
|
+
const allReplacements = useAtomValue(period.type === "Last30" ? last30ToolReplacements : specificMonthToolReplacements);
|
|
199
|
+
const allSorted = useMemo(() => tool_summary(zoom, allReplacements, props.station, sort.sortOn), [zoom, allReplacements, props.station, sort]);
|
|
200
|
+
const pageData = tpage
|
|
201
|
+
? allSorted.slice(tpage.page * tpage.rowsPerPage, (tpage.page + 1) * tpage.rowsPerPage)
|
|
202
|
+
: allSorted;
|
|
203
|
+
const zoomRange = zoom?.zoomRange ??
|
|
204
|
+
(period.type === "Last30"
|
|
205
|
+
? { start: addDays(startOfToday(), -29), end: addDays(startOfToday(), 1) }
|
|
206
|
+
: { start: period.month, end: addMonths(period.month, 1) });
|
|
207
|
+
return (_jsx("div", { children: _jsxs(CurZoomContext.Provider, { value: zoomRange, children: [_jsxs(Table, { children: [_jsx(DataTableHead, { columns: summaryColumns, sort: sort, showDetailsCol: false }), _jsx(DataTableBody, { columns: summaryColumns, pageData: pageData, rowsPerPage: tpage.rowsPerPage })] }), _jsx(DataTableActions, { tpage: tpage, zoom: zoom.zoom, count: allSorted.length })] }) }));
|
|
208
|
+
});
|
|
209
|
+
var AllReplacementColumnId;
|
|
210
|
+
(function (AllReplacementColumnId) {
|
|
211
|
+
AllReplacementColumnId[AllReplacementColumnId["Date"] = 0] = "Date";
|
|
212
|
+
AllReplacementColumnId[AllReplacementColumnId["Station"] = 1] = "Station";
|
|
213
|
+
AllReplacementColumnId[AllReplacementColumnId["Tool"] = 2] = "Tool";
|
|
214
|
+
AllReplacementColumnId[AllReplacementColumnId["Pocket"] = 3] = "Pocket";
|
|
215
|
+
AllReplacementColumnId[AllReplacementColumnId["Between"] = 4] = "Between";
|
|
216
|
+
AllReplacementColumnId[AllReplacementColumnId["UseAtReplacement"] = 5] = "UseAtReplacement";
|
|
217
|
+
AllReplacementColumnId[AllReplacementColumnId["UseAtEndOfCycle"] = 6] = "UseAtEndOfCycle";
|
|
218
|
+
AllReplacementColumnId[AllReplacementColumnId["CntAtReplacement"] = 7] = "CntAtReplacement";
|
|
219
|
+
AllReplacementColumnId[AllReplacementColumnId["CntAtEndOfCycle"] = 8] = "CntAtEndOfCycle";
|
|
220
|
+
})(AllReplacementColumnId || (AllReplacementColumnId = {}));
|
|
221
|
+
const allReplacementsColumns = [
|
|
222
|
+
{
|
|
223
|
+
id: AllReplacementColumnId.Date,
|
|
224
|
+
numeric: false,
|
|
225
|
+
label: "Date",
|
|
226
|
+
getDisplay: (c) => c.time.toLocaleString(),
|
|
227
|
+
getForSort: (c) => c.time.getTime(),
|
|
228
|
+
getForExport: (c) => c.time.toISOString(),
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: AllReplacementColumnId.Station,
|
|
232
|
+
numeric: false,
|
|
233
|
+
label: "Machine",
|
|
234
|
+
getDisplay: (c) => c.station.group + " #" + c.station.num.toString(),
|
|
235
|
+
getForSort: (c) => c.station,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: AllReplacementColumnId.Tool,
|
|
239
|
+
numeric: false,
|
|
240
|
+
label: "Tool",
|
|
241
|
+
getDisplay: (c) => c.tool,
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
id: AllReplacementColumnId.Pocket,
|
|
245
|
+
numeric: true,
|
|
246
|
+
label: "Pocket",
|
|
247
|
+
getDisplay: (c) => (c.pocket === -1 ? "" : c.pocket.toString()),
|
|
248
|
+
getForSort: (c) => c.pocket,
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
id: AllReplacementColumnId.Between,
|
|
252
|
+
numeric: false,
|
|
253
|
+
label: "Type",
|
|
254
|
+
getDisplay: (c) => (c.type === "ReplaceBeforeCycleStart" ? "Between Cycles" : "During Cycle"),
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
id: AllReplacementColumnId.UseAtReplacement,
|
|
258
|
+
numeric: true,
|
|
259
|
+
label: "Use At Replacement / Start of Cycle (min)",
|
|
260
|
+
getDisplay: (c) => {
|
|
261
|
+
const use = c.type === "ReplaceBeforeCycleStart" ? c.useAtReplacement : c.totalUseAtBeginningOfCycle;
|
|
262
|
+
if (use !== null && use !== undefined) {
|
|
263
|
+
return decimalFormat.format(use);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
return "";
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
getForSort: (c) => c.type === "ReplaceBeforeCycleStart" ? c.useAtReplacement : c.totalUseAtBeginningOfCycle,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
id: AllReplacementColumnId.UseAtEndOfCycle,
|
|
273
|
+
numeric: true,
|
|
274
|
+
label: "Use At End of Cycle (min)",
|
|
275
|
+
getDisplay: (c) => {
|
|
276
|
+
if (c.type === "ReplaceBeforeCycleStart")
|
|
277
|
+
return "";
|
|
278
|
+
const use = c.totalUseAtEndOfCycle;
|
|
279
|
+
if (use !== null && use !== undefined) {
|
|
280
|
+
return decimalFormat.format(use);
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
return "";
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
getForSort: (c) => (c.type === "ReplaceBeforeCycleStart" ? 0 : c.totalUseAtEndOfCycle),
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
id: AllReplacementColumnId.CntAtReplacement,
|
|
290
|
+
numeric: true,
|
|
291
|
+
label: "Use At Replacement / Start of Cycle (count)",
|
|
292
|
+
getDisplay: (c) => {
|
|
293
|
+
const use = c.type === "ReplaceBeforeCycleStart" ? c.cntAtReplacement : c.totalCntAtBeginningOfCycle;
|
|
294
|
+
if (use !== null && use !== undefined) {
|
|
295
|
+
return decimalFormat.format(use);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
return "";
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
getForSort: (c) => c.type === "ReplaceBeforeCycleStart" ? c.cntAtReplacement : c.totalCntAtBeginningOfCycle,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: AllReplacementColumnId.CntAtEndOfCycle,
|
|
305
|
+
numeric: true,
|
|
306
|
+
label: "Use At End of Cycle (count)",
|
|
307
|
+
getDisplay: (c) => {
|
|
308
|
+
if (c.type === "ReplaceBeforeCycleStart")
|
|
309
|
+
return "";
|
|
310
|
+
const use = c.totalCntAtEndOfCycle;
|
|
311
|
+
if (use !== null && use !== undefined) {
|
|
312
|
+
return decimalFormat.format(use);
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
return "";
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
getForSort: (c) => (c.type === "ReplaceBeforeCycleStart" ? 0 : c.totalCntAtEndOfCycle),
|
|
319
|
+
},
|
|
320
|
+
];
|
|
321
|
+
const AllReplacementTable = memo(function ReplacementTable(props) {
|
|
322
|
+
const period = useAtomValue(selectedAnalysisPeriod);
|
|
323
|
+
const tpage = useTablePage();
|
|
324
|
+
const zoom = useTableZoomForPeriod(period);
|
|
325
|
+
const sort = useColSort(AllReplacementColumnId.Date, allReplacementsColumns);
|
|
326
|
+
const allReplacements = useAtomValue(period.type === "Last30" ? last30ToolReplacements : specificMonthToolReplacements);
|
|
327
|
+
const allSorted = useMemo(() => tool_replacements_with_station_and_date(zoom, allReplacements, props.station).toSortedArray(sort.sortOn), [sort, zoom, allReplacements, props.station]);
|
|
328
|
+
const pageData = tpage
|
|
329
|
+
? allSorted.slice(tpage.page * tpage.rowsPerPage, (tpage.page + 1) * tpage.rowsPerPage)
|
|
330
|
+
: allSorted;
|
|
331
|
+
return (_jsxs("div", { children: [_jsxs(Table, { children: [_jsx(DataTableHead, { columns: allReplacementsColumns, sort: sort, showDetailsCol: false }), _jsx(DataTableBody, { columns: allReplacementsColumns, pageData: pageData })] }), _jsx(DataTableActions, { tpage: tpage, zoom: zoom.zoom, count: allSorted.length })] }));
|
|
332
|
+
});
|
|
333
|
+
function copyToClipboard(replacements, displayType) {
|
|
334
|
+
if (displayType === "summary") {
|
|
335
|
+
const r = tool_summary(undefined, replacements, undefined, (r) => r.tool);
|
|
336
|
+
copyTableToClipboard(summaryColumns, r);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
const r = tool_replacements_with_station_and_date(undefined, replacements, undefined).toSortedArray((r) => r.tool, (r) => r.time);
|
|
340
|
+
copyTableToClipboard(allReplacementsColumns, r);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const ChooseMachine = memo(function ChooseMachineSelect(props) {
|
|
344
|
+
const period = useAtomValue(selectedAnalysisPeriod);
|
|
345
|
+
const replacements = useAtomValue(period.type === "Last30" ? last30ToolReplacements : specificMonthToolReplacements);
|
|
346
|
+
const machines = Array.from(replacements.keys());
|
|
347
|
+
const selMachineIdx = props.station !== null ? machines.indexOf(props.station) : -1;
|
|
348
|
+
return (_jsxs(_Fragment, { children: [_jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, value: selMachineIdx, style: { marginLeft: "1em" }, onChange: (e) => {
|
|
349
|
+
const v = e.target.value;
|
|
350
|
+
if (v === -1) {
|
|
351
|
+
props.setSelectedStation(null);
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
props.setSelectedStation(machines[v]);
|
|
355
|
+
}
|
|
356
|
+
}, children: [_jsx(MenuItem, { value: -1, children: _jsx("em", { children: "Any Machine" }) }), machines.map((n, idx) => (_jsx(MenuItem, { value: idx, children: _jsx("div", { style: { display: "flex", alignItems: "center" }, children: _jsxs("span", { style: { marginRight: "1em" }, children: [n.group, " #", n.num] }) }) }, idx)))] }) }), _jsx(Tooltip, { title: "Copy to Clipboard", children: _jsx(IconButton, { onClick: () => copyToClipboard(replacements, props.displayType), style: { height: "25px", paddingTop: 0, paddingBottom: 0 }, size: "large", children: _jsx(ImportExport, {}) }) })] }));
|
|
357
|
+
});
|
|
358
|
+
const selectedMachineAtom = atom(null);
|
|
359
|
+
const selectedType = atom("summary");
|
|
360
|
+
export const ToolReplacementPage = memo(function ToolReplacementCard() {
|
|
361
|
+
useSetTitle("Tool Replacements");
|
|
362
|
+
const [selectedMachine, setSelectedMachine] = useAtom(selectedMachineAtom);
|
|
363
|
+
const [type, setType] = useAtom(selectedType);
|
|
364
|
+
return (_jsxs(Box, { paddingLeft: "24px", paddingRight: "24px", paddingTop: "10px", children: [_jsxs(Box, { component: "nav", sx: {
|
|
365
|
+
display: "flex",
|
|
366
|
+
minHeight: "2.5em",
|
|
367
|
+
alignItems: "center",
|
|
368
|
+
maxWidth: "calc(100vw - 24px - 24px)",
|
|
369
|
+
}, children: [_jsx(Typography, { variant: "subtitle1", children: "Tool Replacements" }), _jsx(Box, { flexGrow: 1 }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, value: type, style: { marginLeft: "1em" }, onChange: (e) => setType(e.target.value), children: [_jsx(MenuItem, { value: "summary", children: "Summary" }), _jsx(MenuItem, { value: "details", children: "Details" })] }) }), _jsx(ChooseMachine, { station: selectedMachine, setSelectedStation: setSelectedMachine, displayType: type })] }), _jsx("main", { children: type === "summary" ? (_jsx(SummaryTable, { station: selectedMachine })) : (_jsx(AllReplacementTable, { station: selectedMachine })) })] }));
|
|
370
|
+
});
|