@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,301 @@
|
|
|
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 { LazySeq } from "@seedtactics/immutable-collections";
|
|
34
|
+
import { createElement, useEffect } from "react";
|
|
35
|
+
import "urlpattern-polyfill";
|
|
36
|
+
import { materialDialogOpen } from "../cell-status/material-details.js";
|
|
37
|
+
import { atom, useAtomValue, useSetAtom } from "jotai";
|
|
38
|
+
import { Link } from "@mui/material";
|
|
39
|
+
export var RouteLocation;
|
|
40
|
+
(function (RouteLocation) {
|
|
41
|
+
RouteLocation["ChooseMode"] = "/";
|
|
42
|
+
RouteLocation["Station_LoadMonitor"] = "/station/loadunload/:num";
|
|
43
|
+
RouteLocation["Station_InspectionMonitor"] = "/station/inspection";
|
|
44
|
+
RouteLocation["Station_InspectionMonitorWithType"] = "/station/inspection/:type";
|
|
45
|
+
RouteLocation["Station_Closeout"] = "/station/closeout";
|
|
46
|
+
RouteLocation["Station_Queues"] = "/station/queues";
|
|
47
|
+
RouteLocation["Station_Overview"] = "/station/overview";
|
|
48
|
+
RouteLocation["Operations_Dashboard"] = "/operations";
|
|
49
|
+
RouteLocation["Operations_LoadOutliers"] = "/operations/load-outliers";
|
|
50
|
+
RouteLocation["Operations_LoadHours"] = "/operations/load-hours";
|
|
51
|
+
RouteLocation["Operations_LoadCycles"] = "/operations/load-cycles";
|
|
52
|
+
RouteLocation["Operations_MachineOutliers"] = "/operations/machine-outliers";
|
|
53
|
+
RouteLocation["Operations_MachineHours"] = "/operations/machine-hours";
|
|
54
|
+
RouteLocation["Operations_MachineCycles"] = "/operations/machine-cycles";
|
|
55
|
+
RouteLocation["Operations_SystemOverview"] = "/operations/system-overview";
|
|
56
|
+
RouteLocation["Operations_AllMaterial"] = "/operations/material";
|
|
57
|
+
RouteLocation["Operations_RecentSchedules"] = "/operations/recent-schedules";
|
|
58
|
+
RouteLocation["Operations_CurrentWorkorders"] = "/operations/current-workorders";
|
|
59
|
+
RouteLocation["Operations_Production"] = "/operations/recent-production";
|
|
60
|
+
RouteLocation["Operations_Tools"] = "/operations/tools";
|
|
61
|
+
RouteLocation["Operations_Programs"] = "/operations/programs";
|
|
62
|
+
RouteLocation["Operations_Quality"] = "/operations/quality";
|
|
63
|
+
RouteLocation["Operations_Inspections"] = "/operations/inspections";
|
|
64
|
+
RouteLocation["Operations_CloseoutReport"] = "/operations/closeout";
|
|
65
|
+
RouteLocation["Operations_Rebookings"] = "/analysis/rebookings";
|
|
66
|
+
RouteLocation["Operations_Parts"] = "/operations/parts";
|
|
67
|
+
RouteLocation["Engineering_Cycles"] = "/engineering";
|
|
68
|
+
RouteLocation["Engineering_Hours"] = "/engineering/hours";
|
|
69
|
+
RouteLocation["Engineering_Outliers"] = "/engineering/outliers";
|
|
70
|
+
RouteLocation["Quality_Dashboard"] = "/quality";
|
|
71
|
+
RouteLocation["Quality_Paths"] = "/quality/paths";
|
|
72
|
+
RouteLocation["Quality_Quarantine"] = "/quality/quarantine";
|
|
73
|
+
RouteLocation["Tools_Dashboard"] = "/tools";
|
|
74
|
+
RouteLocation["Tools_Programs"] = "/tools/programs";
|
|
75
|
+
RouteLocation["Analysis_Buffers"] = "/analysis/buffers";
|
|
76
|
+
RouteLocation["Analysis_StationOEE"] = "/analysis/station-oee";
|
|
77
|
+
RouteLocation["Analysis_PartsCompleted"] = "/analysis/parts-completed";
|
|
78
|
+
RouteLocation["Analysis_MachineCycles"] = "/analysis/machine-cycles";
|
|
79
|
+
RouteLocation["Analysis_LoadCycles"] = "/analysis/load-cycles";
|
|
80
|
+
RouteLocation["Analysis_PalletCycles"] = "/analysis/pallet-cycles";
|
|
81
|
+
RouteLocation["Analysis_Schedules"] = "/analysis/schedules";
|
|
82
|
+
RouteLocation["Analysis_Quality"] = "/analysis/quality";
|
|
83
|
+
RouteLocation["Analysis_ToolReplacements"] = "/analysis/tool-replacements";
|
|
84
|
+
RouteLocation["Analysis_CostPercents"] = "/analysis/cost-percents";
|
|
85
|
+
RouteLocation["Analysis_CostPerPiece"] = "/analysis/cost";
|
|
86
|
+
RouteLocation["Sales_Dashboard"] = "/sales";
|
|
87
|
+
RouteLocation["Sales_ProjectedUsage"] = "/sales/projected-usage";
|
|
88
|
+
RouteLocation["VerboseLogging"] = "/logging";
|
|
89
|
+
RouteLocation["Client_Custom"] = "/client/:custom+";
|
|
90
|
+
})(RouteLocation || (RouteLocation = {}));
|
|
91
|
+
const patterns = LazySeq.ofObject(RouteLocation)
|
|
92
|
+
.map(([, loc]) => [loc, new URLPattern(loc, location.origin)])
|
|
93
|
+
// redirects from old URLs
|
|
94
|
+
.append([
|
|
95
|
+
RouteLocation.Operations_RecentSchedules,
|
|
96
|
+
new URLPattern("/operations/completed", location.origin),
|
|
97
|
+
])
|
|
98
|
+
.append([RouteLocation.Station_Closeout, new URLPattern("/station/wash", location.origin)])
|
|
99
|
+
.toRArray();
|
|
100
|
+
function routeToUrl(route) {
|
|
101
|
+
switch (route.route) {
|
|
102
|
+
case RouteLocation.Station_LoadMonitor:
|
|
103
|
+
if (route.queues.length > 0 || route.completed) {
|
|
104
|
+
const params = new URLSearchParams();
|
|
105
|
+
for (const q of route.queues) {
|
|
106
|
+
params.append("queue", q);
|
|
107
|
+
}
|
|
108
|
+
if (route.completed) {
|
|
109
|
+
params.append("completed", "t");
|
|
110
|
+
}
|
|
111
|
+
return `/station/loadunload/${route.loadNum}?${params.toString()}`;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
return `/station/loadunload/${route.loadNum}`;
|
|
115
|
+
}
|
|
116
|
+
case RouteLocation.Station_InspectionMonitorWithType:
|
|
117
|
+
return `/station/inspection/${encodeURIComponent(route.inspType)}`;
|
|
118
|
+
case RouteLocation.Station_Queues:
|
|
119
|
+
if (route.queues.length > 0) {
|
|
120
|
+
const params = new URLSearchParams();
|
|
121
|
+
for (const q of route.queues) {
|
|
122
|
+
params.append("queue", q);
|
|
123
|
+
}
|
|
124
|
+
return `/station/queues?${params.toString()}`;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return `/station/queues`;
|
|
128
|
+
}
|
|
129
|
+
case RouteLocation.Operations_CurrentWorkorders:
|
|
130
|
+
if (route.workorder) {
|
|
131
|
+
const params = new URLSearchParams();
|
|
132
|
+
params.append("workorder", route.workorder);
|
|
133
|
+
return `/operations/current-workorders?${params.toString()}`;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return `/operations/current-workorders`;
|
|
137
|
+
}
|
|
138
|
+
case RouteLocation.Client_Custom:
|
|
139
|
+
return "/client/" + route.custom.map((r) => encodeURIComponent(r)).join("/");
|
|
140
|
+
default:
|
|
141
|
+
return route.route;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function urlToRoute(url) {
|
|
145
|
+
for (const [route, pattern] of patterns) {
|
|
146
|
+
const groups = pattern.exec(url.origin + url.pathname)?.pathname?.groups;
|
|
147
|
+
if (groups) {
|
|
148
|
+
switch (route) {
|
|
149
|
+
case RouteLocation.Station_LoadMonitor:
|
|
150
|
+
return {
|
|
151
|
+
route,
|
|
152
|
+
loadNum: parseInt(groups["num"] ?? "1"),
|
|
153
|
+
queues: url.searchParams.getAll("queue"),
|
|
154
|
+
completed: url.searchParams.has("completed"),
|
|
155
|
+
};
|
|
156
|
+
case RouteLocation.Station_InspectionMonitorWithType: {
|
|
157
|
+
const inspType = groups["type"];
|
|
158
|
+
if (inspType) {
|
|
159
|
+
return {
|
|
160
|
+
route: RouteLocation.Station_InspectionMonitorWithType,
|
|
161
|
+
inspType,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return { route: RouteLocation.Station_InspectionMonitor };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
case RouteLocation.Station_Queues: {
|
|
169
|
+
return {
|
|
170
|
+
route: RouteLocation.Station_Queues,
|
|
171
|
+
queues: url.searchParams.getAll("queue"),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
case RouteLocation.Operations_CurrentWorkorders: {
|
|
175
|
+
const workorder = url.searchParams.get("workorder");
|
|
176
|
+
return {
|
|
177
|
+
route: RouteLocation.Operations_CurrentWorkorders,
|
|
178
|
+
workorder: workorder ?? undefined,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
case RouteLocation.Client_Custom:
|
|
182
|
+
return {
|
|
183
|
+
route: RouteLocation.Client_Custom,
|
|
184
|
+
custom: groups?.["custom"]?.split("/")?.map((s) => decodeURIComponent(s)) ?? [],
|
|
185
|
+
};
|
|
186
|
+
default:
|
|
187
|
+
return { route };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return { route: RouteLocation.ChooseMode };
|
|
192
|
+
}
|
|
193
|
+
const currentRouteLocation = atom(urlToRoute(new URL(location.href)));
|
|
194
|
+
export const isDemoAtom = atom(false);
|
|
195
|
+
export const currentRoute = atom((get) => get(currentRouteLocation), (get, set, to) => {
|
|
196
|
+
const demo = get(isDemoAtom);
|
|
197
|
+
set(currentRouteLocation, to);
|
|
198
|
+
set(materialDialogOpen, null);
|
|
199
|
+
if (!demo) {
|
|
200
|
+
history.pushState(null, "", routeToUrl(to));
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
export function AppLink({ to, children }) {
|
|
204
|
+
const setRoute = useSetAtom(currentRoute);
|
|
205
|
+
return createElement(Link, {
|
|
206
|
+
href: routeToUrl(to),
|
|
207
|
+
onClick: (e) => {
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
e.stopPropagation();
|
|
210
|
+
setRoute(to);
|
|
211
|
+
},
|
|
212
|
+
}, children);
|
|
213
|
+
}
|
|
214
|
+
export function useWatchHistory() {
|
|
215
|
+
const isDemo = useAtomValue(isDemoAtom);
|
|
216
|
+
const setCurRoute = useSetAtom(currentRouteLocation);
|
|
217
|
+
// check for changes in history (back, forwards)
|
|
218
|
+
useEffect(() => {
|
|
219
|
+
if (isDemo)
|
|
220
|
+
return;
|
|
221
|
+
function updateRoute() {
|
|
222
|
+
setCurRoute(urlToRoute(new URL(location.href)));
|
|
223
|
+
}
|
|
224
|
+
addEventListener("popstate", updateRoute);
|
|
225
|
+
return () => removeEventListener("popstate", updateRoute);
|
|
226
|
+
}, [isDemo, setCurRoute]);
|
|
227
|
+
}
|
|
228
|
+
export function useIsDemo() {
|
|
229
|
+
return useAtomValue(isDemoAtom);
|
|
230
|
+
}
|
|
231
|
+
export function useSetTitle(title) {
|
|
232
|
+
const demo = useIsDemo();
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
document.title = title + " - FMS Insight";
|
|
235
|
+
}, [demo, title]);
|
|
236
|
+
}
|
|
237
|
+
export function helpUrl(r) {
|
|
238
|
+
switch (r.route) {
|
|
239
|
+
case RouteLocation.Station_LoadMonitor:
|
|
240
|
+
case RouteLocation.Station_InspectionMonitor:
|
|
241
|
+
case RouteLocation.Station_InspectionMonitorWithType:
|
|
242
|
+
case RouteLocation.Station_Closeout:
|
|
243
|
+
case RouteLocation.Station_Queues:
|
|
244
|
+
case RouteLocation.Station_Overview:
|
|
245
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-station-monitor";
|
|
246
|
+
case RouteLocation.Operations_Dashboard:
|
|
247
|
+
case RouteLocation.Operations_LoadOutliers:
|
|
248
|
+
case RouteLocation.Operations_LoadHours:
|
|
249
|
+
case RouteLocation.Operations_LoadCycles:
|
|
250
|
+
case RouteLocation.Operations_SystemOverview:
|
|
251
|
+
case RouteLocation.Operations_AllMaterial:
|
|
252
|
+
case RouteLocation.Operations_RecentSchedules:
|
|
253
|
+
case RouteLocation.Operations_CurrentWorkorders:
|
|
254
|
+
case RouteLocation.Operations_CloseoutReport:
|
|
255
|
+
case RouteLocation.Operations_Production:
|
|
256
|
+
case RouteLocation.Operations_Rebookings:
|
|
257
|
+
case RouteLocation.Operations_Parts:
|
|
258
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-operations";
|
|
259
|
+
case RouteLocation.Operations_MachineOutliers:
|
|
260
|
+
case RouteLocation.Operations_MachineHours:
|
|
261
|
+
case RouteLocation.Operations_MachineCycles:
|
|
262
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-engineering";
|
|
263
|
+
case RouteLocation.Operations_Quality:
|
|
264
|
+
case RouteLocation.Operations_Inspections:
|
|
265
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-quality";
|
|
266
|
+
case RouteLocation.Operations_Tools:
|
|
267
|
+
case RouteLocation.Operations_Programs:
|
|
268
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-tools-programs";
|
|
269
|
+
case RouteLocation.Engineering_Cycles:
|
|
270
|
+
case RouteLocation.Engineering_Outliers:
|
|
271
|
+
case RouteLocation.Engineering_Hours:
|
|
272
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-engineering";
|
|
273
|
+
case RouteLocation.Quality_Dashboard:
|
|
274
|
+
case RouteLocation.Quality_Paths:
|
|
275
|
+
case RouteLocation.Quality_Quarantine:
|
|
276
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-quality";
|
|
277
|
+
case RouteLocation.Tools_Dashboard:
|
|
278
|
+
case RouteLocation.Tools_Programs:
|
|
279
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-tools-programs";
|
|
280
|
+
case RouteLocation.Analysis_Schedules:
|
|
281
|
+
case RouteLocation.Analysis_Buffers:
|
|
282
|
+
case RouteLocation.Analysis_StationOEE:
|
|
283
|
+
case RouteLocation.Analysis_PartsCompleted:
|
|
284
|
+
case RouteLocation.Analysis_MachineCycles:
|
|
285
|
+
case RouteLocation.Analysis_LoadCycles:
|
|
286
|
+
case RouteLocation.Analysis_PalletCycles:
|
|
287
|
+
case RouteLocation.Analysis_Quality:
|
|
288
|
+
case RouteLocation.Analysis_CostPercents:
|
|
289
|
+
case RouteLocation.Analysis_ToolReplacements:
|
|
290
|
+
case RouteLocation.Analysis_CostPerPiece:
|
|
291
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-efficiency";
|
|
292
|
+
case RouteLocation.Sales_Dashboard:
|
|
293
|
+
case RouteLocation.Sales_ProjectedUsage:
|
|
294
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-sales";
|
|
295
|
+
case RouteLocation.ChooseMode:
|
|
296
|
+
case RouteLocation.VerboseLogging:
|
|
297
|
+
case RouteLocation.Client_Custom:
|
|
298
|
+
default:
|
|
299
|
+
return "https://www.seedtactics.com/docs/fms-insight/client-launch";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as api from "../../network/api.js";
|
|
2
|
+
export declare const bulkAddCastingToQueue: import("jotai").PrimitiveAtom<string | null> & {
|
|
3
|
+
init: string | null;
|
|
4
|
+
};
|
|
5
|
+
export declare const BulkAddCastingWithoutSerialDialog: import("react").NamedExoticComponent<object>;
|
|
6
|
+
export interface MultiMaterialDialogProps {
|
|
7
|
+
readonly material: ReadonlyArray<Readonly<api.IInProcessMaterial>> | null;
|
|
8
|
+
readonly closeDialog: () => void;
|
|
9
|
+
readonly operator: string | null;
|
|
10
|
+
}
|
|
11
|
+
export declare const MultiMaterialDialog: import("react").NamedExoticComponent<MultiMaterialDialogProps>;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2023, 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 { useState, memo, useRef, useEffect, useMemo } from "react";
|
|
35
|
+
import { Button, Stack, Table, TableBody, TableCell, TableHead, TableRow, ListItemText, ListItemIcon, MenuItem, Dialog, DialogActions, DialogContent, DialogTitle, CircularProgress, TextField, } from "@mui/material";
|
|
36
|
+
import { useReactToPrint } from "react-to-print";
|
|
37
|
+
import { MaterialDetailTitle, PartIdenticon } from "./Material.js";
|
|
38
|
+
import * as api from "../../network/api.js";
|
|
39
|
+
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
40
|
+
import { extractJobRawMaterial, loadRawMaterialEvents } from "../../data/queue-material.js";
|
|
41
|
+
import { currentOperator } from "../../data/operators.js";
|
|
42
|
+
import { PrintedLabel, PrintOnClientButton } from "./PrintedLabel.js";
|
|
43
|
+
import { fmsInformation } from "../../network/server-settings.js";
|
|
44
|
+
import { currentStatus } from "../../cell-status/current-status.js";
|
|
45
|
+
import { useAddNewCastingToQueue, usePrintLabel } from "../../cell-status/material-details.js";
|
|
46
|
+
import { castingNames } from "../../cell-status/names.js";
|
|
47
|
+
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
48
|
+
import { JobsBackend } from "../../network/backend.js";
|
|
49
|
+
import { LogEntries } from "../LogEntry.js";
|
|
50
|
+
export const bulkAddCastingToQueue = atom(null);
|
|
51
|
+
const waitingForMaterialAssignmentDialog = atom(null);
|
|
52
|
+
function WaitingForMaterialDialog() {
|
|
53
|
+
const [waiting, setWaiting] = useAtom(waitingForMaterialAssignmentDialog);
|
|
54
|
+
const st = useAtomValue(currentStatus);
|
|
55
|
+
const printRef = useRef(null);
|
|
56
|
+
const printStarted = useRef(false);
|
|
57
|
+
const print = useReactToPrint({
|
|
58
|
+
contentRef: printRef,
|
|
59
|
+
onAfterPrint: () => setWaiting(null),
|
|
60
|
+
ignoreGlobalStyles: true,
|
|
61
|
+
});
|
|
62
|
+
let materialToPrint = waiting ? st.material.filter((m) => waiting.materialIds.has(m.materialID)) : null;
|
|
63
|
+
if (materialToPrint?.length !== waiting?.materialIds.size) {
|
|
64
|
+
materialToPrint = null;
|
|
65
|
+
}
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (waiting === null) {
|
|
68
|
+
if (printStarted.current) {
|
|
69
|
+
printStarted.current = false;
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (printStarted.current || materialToPrint === null)
|
|
74
|
+
return;
|
|
75
|
+
print();
|
|
76
|
+
printStarted.current = true;
|
|
77
|
+
}, [waiting, materialToPrint, printStarted, print]);
|
|
78
|
+
console.log(waiting, materialToPrint);
|
|
79
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Dialog, { open: waiting !== null, children: [_jsx(DialogTitle, { children: "Waiting for Material Assignment" }), _jsx(DialogContent, { children: materialToPrint === null ? (waiting === null ? (_jsx("div", {})) : (_jsxs(Stack, { direction: "column", spacing: 2, mt: "0.5em", mb: "0.5em", children: [_jsx(CircularProgress, { color: "secondary" }), _jsx("div", { children: "Waiting for material assignment. This could take a while if a download is currently in progress." })] }))) : (_jsx("div", { children: "Printing..." })) }), _jsx(DialogActions, { children: _jsx(Button, { color: "primary", onClick: () => setWaiting(null), children: "Cancel" }) })] }), _jsx("div", { style: { display: "none" }, children: _jsx("div", { ref: printRef, children: _jsx(PrintedLabel, { materialName: waiting?.selectedCasting, material: materialToPrint, operator: waiting?.operator, oneJobPerPage: true }) }) })] }));
|
|
80
|
+
}
|
|
81
|
+
function JobsForCasting({ casting, queue }) {
|
|
82
|
+
const currentSt = useAtomValue(currentStatus);
|
|
83
|
+
const jobs = useMemo(() => extractJobRawMaterial(currentSt.jobs, currentSt.material, queue).filter((j) => j.rawMatName === casting), [currentSt.jobs, currentSt.material, casting, queue]);
|
|
84
|
+
if (jobs.length === 0)
|
|
85
|
+
return null;
|
|
86
|
+
return (_jsxs(Table, { size: "small", children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Job" }), _jsx(TableCell, { align: "right", children: "Plan" }), _jsx(TableCell, { align: "right", children: "Remaining" }), _jsx(TableCell, { align: "right", children: "Assigned" }), _jsx(TableCell, { align: "right", children: "Required" }), _jsx(TableCell, { align: "right", children: "Available" })] }) }), _jsxs(TableBody, { children: [jobs.map((j, idx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: j.job.unique }), _jsx(TableCell, { align: "right", children: j.job.cycles }), _jsx(TableCell, { align: "right", children: j.remainingToStart }), _jsx(TableCell, { align: "right", children: j.assignedRaw }), _jsx(TableCell, { align: "right", children: Math.max(j.remainingToStart - j.assignedRaw, 0) }), _jsx(TableCell, { align: "right", children: j.availableUnassigned })] }, idx))), jobs.length >= 2 ? (_jsxs(TableRow, { children: [_jsx(TableCell, { children: "Total" }), _jsx(TableCell, { align: "right", children: LazySeq.of(jobs).sumBy((j) => j.job.cycles) }), _jsx(TableCell, { align: "right", children: LazySeq.of(jobs).sumBy((j) => j.remainingToStart) }), _jsx(TableCell, { align: "right", children: LazySeq.of(jobs).sumBy((j) => j.assignedRaw) }), _jsx(TableCell, { align: "right", children: LazySeq.of(jobs).sumBy((j) => Math.max(j.remainingToStart - j.assignedRaw, 0)) }), _jsx(TableCell, { align: "right", children: LazySeq.of(jobs).sumBy((j) => j.availableUnassigned) })] })) : undefined] })] }));
|
|
87
|
+
}
|
|
88
|
+
export const BulkAddCastingWithoutSerialDialog = memo(function BulkAddCastingWithoutSerialDialog() {
|
|
89
|
+
const [queue, setQueue] = useAtom(bulkAddCastingToQueue);
|
|
90
|
+
const operator = useAtomValue(currentOperator);
|
|
91
|
+
const fmsInfo = useAtomValue(fmsInformation);
|
|
92
|
+
const printOnAdd = fmsInfo.usingLabelPrinterForSerials && fmsInfo.useClientPrinterForLabels;
|
|
93
|
+
const [addNewCasting] = useAddNewCastingToQueue();
|
|
94
|
+
const setWaitingToPrint = useSetAtom(waitingForMaterialAssignmentDialog);
|
|
95
|
+
const [selectedCasting, setSelectedCasting] = useState(null);
|
|
96
|
+
const [enteredQty, setQty] = useState(null);
|
|
97
|
+
const [enteredOperator, setEnteredOperator] = useState(null);
|
|
98
|
+
const [adding, setAdding] = useState(false);
|
|
99
|
+
const currentSt = useAtomValue(currentStatus);
|
|
100
|
+
const historicCastNames = useAtomValue(castingNames);
|
|
101
|
+
const castings = useMemo(() => LazySeq.ofObject(currentSt.jobs)
|
|
102
|
+
.flatMap(([, j]) => j.procsAndPaths[0].paths)
|
|
103
|
+
.filter((p) => p.casting !== undefined && p.casting !== "")
|
|
104
|
+
.map((p) => ({ casting: p.casting, cnt: 1 }))
|
|
105
|
+
.concat(LazySeq.of(historicCastNames).map((c) => ({ casting: c, cnt: 0 })))
|
|
106
|
+
.buildOrderedMap((c) => c.casting, (old, c) => (old === undefined ? c.cnt : old + c.cnt))
|
|
107
|
+
.toAscLazySeq(), [currentSt.jobs, historicCastNames]);
|
|
108
|
+
function close() {
|
|
109
|
+
setQueue(null);
|
|
110
|
+
setSelectedCasting(null);
|
|
111
|
+
setEnteredOperator(null);
|
|
112
|
+
setAdding(false);
|
|
113
|
+
setQty(null);
|
|
114
|
+
}
|
|
115
|
+
function add() {
|
|
116
|
+
if (queue !== null &&
|
|
117
|
+
selectedCasting !== null &&
|
|
118
|
+
enteredQty !== null &&
|
|
119
|
+
!isNaN(enteredQty) &&
|
|
120
|
+
enteredQty > 0) {
|
|
121
|
+
addNewCasting({
|
|
122
|
+
casting: selectedCasting,
|
|
123
|
+
quantity: enteredQty,
|
|
124
|
+
queue: queue,
|
|
125
|
+
workorder: null,
|
|
126
|
+
operator: fmsInfo.requireOperatorNamePromptWhenAddingMaterial ? enteredOperator : operator,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
close();
|
|
130
|
+
}
|
|
131
|
+
function addAndPrint() {
|
|
132
|
+
if (queue !== null && selectedCasting !== null && enteredQty !== null && !isNaN(enteredQty)) {
|
|
133
|
+
setAdding(true);
|
|
134
|
+
addNewCasting({
|
|
135
|
+
casting: selectedCasting,
|
|
136
|
+
quantity: enteredQty,
|
|
137
|
+
queue: queue,
|
|
138
|
+
operator: operator,
|
|
139
|
+
workorder: null,
|
|
140
|
+
onNewMaterial: (mats) => {
|
|
141
|
+
setWaitingToPrint({
|
|
142
|
+
selectedCasting: selectedCasting,
|
|
143
|
+
operator: fmsInfo.requireOperatorNamePromptWhenAddingMaterial ? enteredOperator : operator,
|
|
144
|
+
materialIds: new Set(mats.map((m) => m.materialID)),
|
|
145
|
+
});
|
|
146
|
+
close();
|
|
147
|
+
},
|
|
148
|
+
onError: () => {
|
|
149
|
+
close();
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Dialog, { open: queue !== null, onClose: () => close(), maxWidth: "md", children: [_jsx(DialogTitle, { children: "Add Raw Material" }), _jsx(DialogContent, { children: _jsxs(Stack, { direction: "column", spacing: 2, mt: "0.5em", children: [_jsx(TextField, { style: { minWidth: "15em" }, value: selectedCasting || "", onChange: (e) => setSelectedCasting(e.target.value), select: true, fullWidth: true, label: "Raw Material", slotProps: {
|
|
155
|
+
select: {
|
|
156
|
+
renderValue: selectedCasting === null
|
|
157
|
+
? undefined
|
|
158
|
+
: () => (_jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx("div", { style: { marginRight: "0.5em" }, children: _jsx(PartIdenticon, { part: selectedCasting, size: 25 }) }), _jsx("div", { children: selectedCasting })] })),
|
|
159
|
+
},
|
|
160
|
+
}, children: castings.map(([casting, jobCnt], idx) => (_jsxs(MenuItem, { value: casting, children: [_jsx(ListItemIcon, { children: _jsx(PartIdenticon, { part: casting }) }), _jsx(ListItemText, { primary: casting, slotProps: { primary: { variant: "h4" } }, secondary: jobCnt === 0
|
|
161
|
+
? "Not used by any current jobs"
|
|
162
|
+
: `Used by ${jobCnt} current job${jobCnt > 1 ? "s" : ""}` })] }, idx))) }), _jsx(TextField, { fullWidth: true, type: "number", label: "Quantity", disabled: selectedCasting === null, slotProps: { htmlInput: { min: "1" } }, value: enteredQty === null || isNaN(enteredQty) || enteredQty <= 0 ? "" : enteredQty, onChange: (e) => setQty(parseInt(e.target.value)) }), fmsInfo.requireOperatorNamePromptWhenAddingMaterial ? (_jsx(TextField, { fullWidth: true, label: "Operator", value: enteredOperator || "", onChange: (e) => setEnteredOperator(e.target.value) })) : undefined, selectedCasting !== null && queue !== null ? (_jsx(JobsForCasting, { casting: selectedCasting, queue: queue })) : undefined] }) }), _jsxs(DialogActions, { children: [printOnAdd ? (_jsxs(Button, { color: "primary", disabled: adding ||
|
|
163
|
+
selectedCasting === null ||
|
|
164
|
+
enteredQty === null ||
|
|
165
|
+
isNaN(enteredQty) ||
|
|
166
|
+
(fmsInfo.requireOperatorNamePromptWhenAddingMaterial &&
|
|
167
|
+
(enteredOperator === null || enteredOperator === "")), onClick: addAndPrint, children: [adding ? _jsx(CircularProgress, { size: 10 }) : undefined, "Add ", enteredQty !== null && !isNaN(enteredQty) ? enteredQty.toString() + " " : "", "to ", queue] })) : (_jsxs(Button, { color: "primary", disabled: selectedCasting === null ||
|
|
168
|
+
enteredQty === null ||
|
|
169
|
+
isNaN(enteredQty) ||
|
|
170
|
+
(fmsInfo.requireOperatorNamePromptWhenAddingMaterial &&
|
|
171
|
+
(enteredOperator === null || enteredOperator === "")), onClick: add, children: ["Add ", enteredQty !== null && !isNaN(enteredQty) ? enteredQty.toString() + " " : "", "to ", queue] })), _jsx(Button, { color: "primary", disabled: adding && printOnAdd, onClick: close, children: "Cancel" })] })] }), _jsx(WaitingForMaterialDialog, {})] }));
|
|
172
|
+
});
|
|
173
|
+
export const MultiMaterialDialog = memo(function MultiMaterialDialog(props) {
|
|
174
|
+
const fmsInfo = useAtomValue(fmsInformation);
|
|
175
|
+
const jobs = useAtomValue(currentStatus).jobs;
|
|
176
|
+
const [printLabel, printingLabel] = usePrintLabel();
|
|
177
|
+
const [loading, setLoading] = useState(false);
|
|
178
|
+
const [events, setEvents] = useState([]);
|
|
179
|
+
const [showRemove, setShowRemove] = useState(false);
|
|
180
|
+
const [removeCnt, setRemoveCnt] = useState(NaN);
|
|
181
|
+
const [lastOperator, setLastOperator] = useState(undefined);
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
if (props.material === null)
|
|
184
|
+
return;
|
|
185
|
+
let isSubscribed = true;
|
|
186
|
+
setLoading(true);
|
|
187
|
+
loadRawMaterialEvents(props.material)
|
|
188
|
+
.then((events) => {
|
|
189
|
+
if (isSubscribed) {
|
|
190
|
+
setEvents(events);
|
|
191
|
+
let operator;
|
|
192
|
+
for (const e of events) {
|
|
193
|
+
if (e.type === api.LogType.AddToQueue && e.details?.["operator"] !== undefined) {
|
|
194
|
+
operator = e.details["operator"];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
setLastOperator(operator);
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
.catch(console.error)
|
|
201
|
+
.finally(() => setLoading(false));
|
|
202
|
+
return () => {
|
|
203
|
+
isSubscribed = false;
|
|
204
|
+
};
|
|
205
|
+
}, [props.material]);
|
|
206
|
+
const rawMatName = useMemo(() => {
|
|
207
|
+
if (!props.material || props.material.length === 0)
|
|
208
|
+
return undefined;
|
|
209
|
+
const uniq = props.material[0].jobUnique;
|
|
210
|
+
if (!uniq || uniq === "" || !jobs[uniq])
|
|
211
|
+
return undefined;
|
|
212
|
+
return LazySeq.of(jobs[uniq].procsAndPaths[0].paths)
|
|
213
|
+
.filter((p) => p.casting !== undefined && p.casting !== "")
|
|
214
|
+
.head()?.casting;
|
|
215
|
+
}, [props.material, jobs]);
|
|
216
|
+
function close() {
|
|
217
|
+
props.closeDialog();
|
|
218
|
+
setShowRemove(false);
|
|
219
|
+
setRemoveCnt(NaN);
|
|
220
|
+
setLoading(false);
|
|
221
|
+
setEvents([]);
|
|
222
|
+
}
|
|
223
|
+
function remove() {
|
|
224
|
+
if (showRemove) {
|
|
225
|
+
if (!isNaN(removeCnt)) {
|
|
226
|
+
setLoading(true);
|
|
227
|
+
JobsBackend.bulkRemoveMaterialFromQueues(props.operator, LazySeq.of(props.material || [])
|
|
228
|
+
.take(removeCnt)
|
|
229
|
+
.map((m) => m.materialID)
|
|
230
|
+
.toRArray())
|
|
231
|
+
.catch(console.error)
|
|
232
|
+
.finally(close);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
setShowRemove(true);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const mat1 = props.material?.[0];
|
|
240
|
+
return (_jsxs(Dialog, { open: props.material !== null, onClose: close, maxWidth: "md", children: [_jsx(DialogTitle, { children: mat1 && props.material && props.material.length > 0 ? (_jsx(MaterialDetailTitle, { partName: mat1.partName, subtitle: props.material.length.toString() +
|
|
241
|
+
(mat1.jobUnique && mat1.jobUnique !== "" ? " assigned to " + mat1.jobUnique : " unassigned") })) : ("Material") }), _jsxs(DialogContent, { children: [loading ? _jsx(CircularProgress, { color: "secondary" }) : _jsx(LogEntries, { entries: events, copyToClipboard: true }), showRemove && props.material ? (_jsx("div", { style: { marginTop: "1em" }, children: _jsx(TextField, { type: "number", variant: "outlined", fullWidth: true, label: "Quantity to Remove", slotProps: { htmlInput: { min: "1", max: props.material.length.toString() } }, value: isNaN(removeCnt) ? "" : removeCnt, onChange: (e) => setRemoveCnt(parseInt(e.target.value)) }) })) : undefined] }), _jsxs(DialogActions, { children: [props.material && props.material.length > 0 && fmsInfo.usingLabelPrinterForSerials ? (fmsInfo.useClientPrinterForLabels ? (_jsx(PrintOnClientButton, { mat: props.material || [], materialName: rawMatName, operator: lastOperator })) : (_jsx(Button, { color: "primary", disabled: printingLabel, onClick: () => props.material && props.material.length > 0
|
|
242
|
+
? printLabel({
|
|
243
|
+
materialId: props.material[0].materialID,
|
|
244
|
+
proc: 0,
|
|
245
|
+
})
|
|
246
|
+
: void 0, children: "Print Label" }))) : undefined, _jsx(Button, { color: "primary", onClick: remove, disabled: loading || (showRemove && isNaN(removeCnt)), children: loading && showRemove
|
|
247
|
+
? "Removing..."
|
|
248
|
+
: showRemove && !isNaN(removeCnt)
|
|
249
|
+
? `Remove ${removeCnt} material`
|
|
250
|
+
: "Remove Material" }), _jsx(Button, { color: "primary", onClick: close, children: "Close" })] })] }));
|
|
251
|
+
});
|