@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,144 @@
|
|
|
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 { addSeconds } from "date-fns";
|
|
35
|
+
import { isOutlierAbove, PartAndStationOperation, splitElapsedTimeAmongChunk, } from "../cell-status/estimated-cycle-times.js";
|
|
36
|
+
import { stat_name_and_num } from "../cell-status/station-cycles.js";
|
|
37
|
+
import { ActionType } from "../network/api.js";
|
|
38
|
+
import { durationToMinutes, durationToSeconds } from "../util/parseISODuration.js";
|
|
39
|
+
function machiningCurrentCycles(currentSt, estimated, palToLoc) {
|
|
40
|
+
return LazySeq.of(currentSt.material)
|
|
41
|
+
.collect((m) => {
|
|
42
|
+
if (m.action.type !== ActionType.Machining)
|
|
43
|
+
return null;
|
|
44
|
+
if (!m.location.palletNum)
|
|
45
|
+
return null;
|
|
46
|
+
const loc = palToLoc.get(m.location.palletNum);
|
|
47
|
+
if (!loc)
|
|
48
|
+
return null;
|
|
49
|
+
return { mat: m, loc };
|
|
50
|
+
})
|
|
51
|
+
.groupBy(({ loc }) => loc.group, ({ loc }) => loc.num)
|
|
52
|
+
.map(([[statGroup, statNum], mats]) => {
|
|
53
|
+
// all mats currently machining at the same station should all have the same part and program
|
|
54
|
+
const stats = estimated.get(new PartAndStationOperation(mats[0].mat.partName, statGroup, mats[0].mat.action.program ?? ""));
|
|
55
|
+
const elapsedSec = durationToSeconds(mats[0].mat.action.elapsedMachiningTime ?? "PT0S");
|
|
56
|
+
const remainingSec = durationToSeconds(mats[0].mat.action.expectedRemainingMachiningTime ?? "PT0S");
|
|
57
|
+
return {
|
|
58
|
+
station: stat_name_and_num(statGroup, statNum),
|
|
59
|
+
start: addSeconds(currentSt.timeOfCurrentStatusUTC, -elapsedSec),
|
|
60
|
+
expectedEnd: addSeconds(currentSt.timeOfCurrentStatusUTC, remainingSec),
|
|
61
|
+
isOutlier: stats ? isOutlierAbove(stats, elapsedSec / 60 / mats.length) : false,
|
|
62
|
+
parts: [{ part: mats[0].mat.partName, oper: mats[0].mat.action.program ?? "" }],
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function loadCurrentCycles(currentSt, estimated, palToLoc) {
|
|
67
|
+
return LazySeq.of(currentSt.material)
|
|
68
|
+
.collect((m) => {
|
|
69
|
+
if (m.action.type === ActionType.UnloadToCompletedMaterial ||
|
|
70
|
+
m.action.type === ActionType.UnloadToInProcess) {
|
|
71
|
+
if (!m.location.palletNum)
|
|
72
|
+
return null;
|
|
73
|
+
const loc = palToLoc.get(m.location.palletNum);
|
|
74
|
+
if (!loc)
|
|
75
|
+
return null;
|
|
76
|
+
return { mat: m, material: [m], proc: m.process, path: m.path, loc };
|
|
77
|
+
}
|
|
78
|
+
else if (m.action.type === ActionType.Loading) {
|
|
79
|
+
if (!m.action.loadOntoPalletNum)
|
|
80
|
+
return null;
|
|
81
|
+
const loc = palToLoc.get(m.action.loadOntoPalletNum);
|
|
82
|
+
if (!loc)
|
|
83
|
+
return null;
|
|
84
|
+
return {
|
|
85
|
+
mat: m,
|
|
86
|
+
material: [m],
|
|
87
|
+
proc: m.action.processAfterLoad ?? m.process,
|
|
88
|
+
path: m.action.pathAfterLoad ?? m.path,
|
|
89
|
+
loc,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
})
|
|
94
|
+
.map((m) => {
|
|
95
|
+
const job = currentSt.jobs[m.mat.jobUnique];
|
|
96
|
+
const pathData = job?.procsAndPaths?.[m.proc - 1]?.paths?.[m.path - 1];
|
|
97
|
+
if (m.mat.action.type === ActionType.Loading) {
|
|
98
|
+
return { ...m, expectedLoadSecs: durationToSeconds(pathData?.expectedLoadTime ?? "PT0S") };
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return { ...m, expectedLoadSecs: durationToSeconds(pathData?.expectedUnloadTime ?? "PT0S") };
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
.groupBy(({ loc }) => loc.group, ({ loc }) => loc.num)
|
|
105
|
+
.map(([[statGroup, statNum], mats]) => {
|
|
106
|
+
const matsWithTime = splitElapsedTimeAmongChunk(mats, (m) => durationToMinutes(m.mat.action.elapsedLoadUnloadTime ?? "PT0S"), (m) => m.expectedLoadSecs / 60);
|
|
107
|
+
let outlier = false;
|
|
108
|
+
let expectedSecs = 0;
|
|
109
|
+
for (const { cycle: m, elapsedForSingleMaterialMinutes } of matsWithTime) {
|
|
110
|
+
const stats = estimated.get(new PartAndStationOperation(m.mat.partName, statGroup, m.mat.action.type === ActionType.Loading
|
|
111
|
+
? "LOAD-" + m.proc.toString()
|
|
112
|
+
: "UNLOAD-" + m.proc.toString()));
|
|
113
|
+
if (stats && isOutlierAbove(stats, elapsedForSingleMaterialMinutes)) {
|
|
114
|
+
outlier = true;
|
|
115
|
+
}
|
|
116
|
+
if (m.expectedLoadSecs > 0) {
|
|
117
|
+
expectedSecs += m.expectedLoadSecs;
|
|
118
|
+
}
|
|
119
|
+
else if (stats?.expectedCycleMinutesForSingleMat) {
|
|
120
|
+
expectedSecs += stats.expectedCycleMinutesForSingleMat * 60;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const elapsedSec = durationToSeconds(mats[0].mat.action.elapsedLoadUnloadTime ?? "PT0S");
|
|
124
|
+
return {
|
|
125
|
+
station: stat_name_and_num(statGroup, statNum),
|
|
126
|
+
start: addSeconds(currentSt.timeOfCurrentStatusUTC, -elapsedSec),
|
|
127
|
+
expectedEnd: addSeconds(currentSt.timeOfCurrentStatusUTC, -elapsedSec + expectedSecs),
|
|
128
|
+
isOutlier: outlier,
|
|
129
|
+
parts: LazySeq.of(mats)
|
|
130
|
+
.distinctAndSortBy((m) => m.mat.partName, (m) => m.proc, (m) => (m.mat.action.type === ActionType.Loading ? "LOAD" : "UNLOAD"))
|
|
131
|
+
.map((m) => ({
|
|
132
|
+
part: m.mat.partName + "-" + m.proc.toString(),
|
|
133
|
+
oper: m.mat.action.type === ActionType.Loading ? "LOAD" : "UNLOAD",
|
|
134
|
+
}))
|
|
135
|
+
.toRArray(),
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
export function currentCycles(currentSt, estimated) {
|
|
140
|
+
const palToLoc = LazySeq.ofObject(currentSt.pallets).buildHashMap(([, p]) => p.palletNum, (_old, [, pal]) => pal.currentPalletLocation);
|
|
141
|
+
return machiningCurrentCycles(currentSt, estimated, palToLoc)
|
|
142
|
+
.concat(loadCurrentCycles(currentSt, estimated, palToLoc))
|
|
143
|
+
.toRArray();
|
|
144
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InspectionLogEntry } from "../cell-status/inspections.js";
|
|
2
|
+
export interface SankeyNode {
|
|
3
|
+
readonly unique: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SankeyLink {
|
|
7
|
+
readonly source: number;
|
|
8
|
+
readonly target: number;
|
|
9
|
+
readonly value: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SankeyDiagram {
|
|
12
|
+
readonly nodes: Array<SankeyNode>;
|
|
13
|
+
readonly links: Array<SankeyLink>;
|
|
14
|
+
}
|
|
15
|
+
export declare function inspectionDataToSankey(d: Iterable<InspectionLogEntry>): SankeyDiagram;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* Copyright (c) 2018, 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 { InspectionLogResultType } from "../cell-status/inspections.js";
|
|
34
|
+
import { hashValues, LazySeq } from "@seedtactics/immutable-collections";
|
|
35
|
+
class NodeR {
|
|
36
|
+
constructor(unique, name) {
|
|
37
|
+
this.unique = unique;
|
|
38
|
+
this.name = name;
|
|
39
|
+
}
|
|
40
|
+
compare(other) {
|
|
41
|
+
const cmp = this.unique.localeCompare(other.unique);
|
|
42
|
+
if (cmp === 0) {
|
|
43
|
+
return this.name.localeCompare(other.name);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return cmp;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
hash() {
|
|
50
|
+
return hashValues(this.unique, this.name);
|
|
51
|
+
}
|
|
52
|
+
toString() {
|
|
53
|
+
return `{unique: ${this.unique}}, name: ${this.name}}`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
class Edge {
|
|
57
|
+
constructor(from, to) {
|
|
58
|
+
this.from = from;
|
|
59
|
+
this.to = to;
|
|
60
|
+
}
|
|
61
|
+
compare(other) {
|
|
62
|
+
const cmp = this.from.compare(other.from);
|
|
63
|
+
if (cmp === 0) {
|
|
64
|
+
return this.to.compare(other.to);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return cmp;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
hash() {
|
|
71
|
+
return hashValues(this.from, this.to);
|
|
72
|
+
}
|
|
73
|
+
toString() {
|
|
74
|
+
return `{from: ${this.from.toString()}}, to: ${this.to.toString()}}`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function edgesForPath(actualPath, toInspect, result) {
|
|
78
|
+
let path = "";
|
|
79
|
+
let prevNode = new NodeR("", "raw");
|
|
80
|
+
const edges = [];
|
|
81
|
+
for (const proc of actualPath) {
|
|
82
|
+
for (const stop of proc.stops) {
|
|
83
|
+
const cur = "P" + proc.pallet + ",M" + stop.stationNum.toString();
|
|
84
|
+
path += "->" + cur;
|
|
85
|
+
const nextNode = new NodeR(path, cur);
|
|
86
|
+
edges.push(new Edge(prevNode, nextNode));
|
|
87
|
+
prevNode = nextNode;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (toInspect && result !== undefined) {
|
|
91
|
+
if (result) {
|
|
92
|
+
edges.push(new Edge(prevNode, new NodeR("@@success", "success")));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
edges.push(new Edge(prevNode, new NodeR("@@failed", "failed")));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
edges.push(new Edge(prevNode, new NodeR("@@uninspected", "uninspected")));
|
|
100
|
+
}
|
|
101
|
+
return edges;
|
|
102
|
+
}
|
|
103
|
+
export function inspectionDataToSankey(d) {
|
|
104
|
+
const matIdToInspResult = LazySeq.of(d)
|
|
105
|
+
.filter((e) => e.result.type === InspectionLogResultType.Completed)
|
|
106
|
+
.toRMap((e) => [
|
|
107
|
+
e.materialID,
|
|
108
|
+
e.result.type === InspectionLogResultType.Completed ? e.result.success : false,
|
|
109
|
+
]);
|
|
110
|
+
// create all the edges, likely with duplicate edges between nodes
|
|
111
|
+
const edges = LazySeq.of(d).flatMap((c) => {
|
|
112
|
+
if (c.result.type === InspectionLogResultType.Triggered) {
|
|
113
|
+
return edgesForPath(c.result.actualPath, c.result.toInspect, matIdToInspResult.get(c.materialID) ?? false);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
// extract the nodes and assign an index
|
|
120
|
+
const nodes = edges
|
|
121
|
+
.flatMap((e) => [e.from, e.to])
|
|
122
|
+
.distinctBy((x) => x)
|
|
123
|
+
.map((node, idx) => ({ idx, node }));
|
|
124
|
+
// create the sankey nodes to return
|
|
125
|
+
const sankeyNodes = nodes
|
|
126
|
+
.map((s) => ({
|
|
127
|
+
unique: s.node.unique,
|
|
128
|
+
name: s.node.name,
|
|
129
|
+
}))
|
|
130
|
+
.toMutableArray();
|
|
131
|
+
// create a map from NodeR to index
|
|
132
|
+
const nodesToIdx = nodes.toHashMap((n) => [n.node, n.idx], (i1, _) => i1);
|
|
133
|
+
// create the sankey links to return by counting Edges between nodes
|
|
134
|
+
const sankeyLinks = edges
|
|
135
|
+
.toHashMap((e) => [e, 1], (c1, c2) => c1 + c2)
|
|
136
|
+
.toLazySeq()
|
|
137
|
+
.map(([link, value]) => ({
|
|
138
|
+
source: nodesToIdx.get(link.from),
|
|
139
|
+
target: nodesToIdx.get(link.to),
|
|
140
|
+
value,
|
|
141
|
+
}))
|
|
142
|
+
.toMutableArray();
|
|
143
|
+
return {
|
|
144
|
+
nodes: sankeyNodes,
|
|
145
|
+
links: sankeyLinks,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as api from "../network/api.js";
|
|
2
|
+
import { HashMap } from "@seedtactics/immutable-collections";
|
|
3
|
+
export declare enum MoveMaterialNodeKindType {
|
|
4
|
+
Material = 0,
|
|
5
|
+
FreeMaterialZone = 1,
|
|
6
|
+
CompletedCollapsedMaterialZone = 2,
|
|
7
|
+
CompletedExpandedMaterialZone = 3,
|
|
8
|
+
PalletFaceZone = 4,
|
|
9
|
+
QueueZone = 5
|
|
10
|
+
}
|
|
11
|
+
export type MoveMaterialNodeKind = {
|
|
12
|
+
readonly type: MoveMaterialNodeKindType.Material;
|
|
13
|
+
readonly material: Readonly<api.IInProcessMaterial> | null;
|
|
14
|
+
} | {
|
|
15
|
+
readonly type: MoveMaterialNodeKindType.FreeMaterialZone;
|
|
16
|
+
} | {
|
|
17
|
+
readonly type: MoveMaterialNodeKindType.CompletedCollapsedMaterialZone;
|
|
18
|
+
} | {
|
|
19
|
+
readonly type: MoveMaterialNodeKindType.CompletedExpandedMaterialZone;
|
|
20
|
+
} | {
|
|
21
|
+
readonly type: MoveMaterialNodeKindType.PalletFaceZone;
|
|
22
|
+
readonly face: number;
|
|
23
|
+
} | {
|
|
24
|
+
readonly type: MoveMaterialNodeKindType.QueueZone;
|
|
25
|
+
readonly queue: string;
|
|
26
|
+
};
|
|
27
|
+
export type MoveMaterialIdentifier = string;
|
|
28
|
+
export declare function uniqueIdForNodeKind(kind: MoveMaterialNodeKind): MoveMaterialIdentifier;
|
|
29
|
+
export declare function memoPropsForNodeKind(kind: MoveMaterialNodeKind): ReadonlyArray<unknown>;
|
|
30
|
+
export type AllMoveMaterialNodes<T> = HashMap<MoveMaterialIdentifier, MoveMaterialNodeKind & {
|
|
31
|
+
readonly elem: T;
|
|
32
|
+
}>;
|
|
33
|
+
export type MoveMaterialArrow = {
|
|
34
|
+
readonly fromX: number;
|
|
35
|
+
readonly fromY: number;
|
|
36
|
+
readonly toX: number;
|
|
37
|
+
readonly toY: number;
|
|
38
|
+
readonly curveDirection: number;
|
|
39
|
+
};
|
|
40
|
+
export type MoveMaterialElemRect = {
|
|
41
|
+
readonly left: number;
|
|
42
|
+
readonly top: number;
|
|
43
|
+
readonly width: number;
|
|
44
|
+
readonly height: number;
|
|
45
|
+
readonly bottom: number;
|
|
46
|
+
readonly right: number;
|
|
47
|
+
};
|
|
48
|
+
export declare function computeArrows(container: MoveMaterialElemRect | null | undefined, allNodes: AllMoveMaterialNodes<MoveMaterialElemRect>): ReadonlyArray<MoveMaterialArrow>;
|
|
@@ -0,0 +1,217 @@
|
|
|
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 * as api from "../network/api.js";
|
|
34
|
+
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
35
|
+
export var MoveMaterialNodeKindType;
|
|
36
|
+
(function (MoveMaterialNodeKindType) {
|
|
37
|
+
MoveMaterialNodeKindType[MoveMaterialNodeKindType["Material"] = 0] = "Material";
|
|
38
|
+
MoveMaterialNodeKindType[MoveMaterialNodeKindType["FreeMaterialZone"] = 1] = "FreeMaterialZone";
|
|
39
|
+
MoveMaterialNodeKindType[MoveMaterialNodeKindType["CompletedCollapsedMaterialZone"] = 2] = "CompletedCollapsedMaterialZone";
|
|
40
|
+
MoveMaterialNodeKindType[MoveMaterialNodeKindType["CompletedExpandedMaterialZone"] = 3] = "CompletedExpandedMaterialZone";
|
|
41
|
+
MoveMaterialNodeKindType[MoveMaterialNodeKindType["PalletFaceZone"] = 4] = "PalletFaceZone";
|
|
42
|
+
MoveMaterialNodeKindType[MoveMaterialNodeKindType["QueueZone"] = 5] = "QueueZone";
|
|
43
|
+
})(MoveMaterialNodeKindType || (MoveMaterialNodeKindType = {}));
|
|
44
|
+
export function uniqueIdForNodeKind(kind) {
|
|
45
|
+
switch (kind.type) {
|
|
46
|
+
case MoveMaterialNodeKindType.Material:
|
|
47
|
+
return "Material-" + (kind.material?.materialID ?? -1).toString();
|
|
48
|
+
case MoveMaterialNodeKindType.FreeMaterialZone:
|
|
49
|
+
return "FreeMaterialZone";
|
|
50
|
+
case MoveMaterialNodeKindType.CompletedCollapsedMaterialZone:
|
|
51
|
+
return "CompletedCollapsedMaterialZone";
|
|
52
|
+
case MoveMaterialNodeKindType.CompletedExpandedMaterialZone:
|
|
53
|
+
return "CompletedExpandedMaterialZone";
|
|
54
|
+
case MoveMaterialNodeKindType.PalletFaceZone:
|
|
55
|
+
return "PalletFaceZone-" + kind.face.toString();
|
|
56
|
+
case MoveMaterialNodeKindType.QueueZone:
|
|
57
|
+
return "QueueZone-" + kind.queue;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export function memoPropsForNodeKind(kind) {
|
|
61
|
+
switch (kind.type) {
|
|
62
|
+
case MoveMaterialNodeKindType.Material:
|
|
63
|
+
return [kind.type, kind.material];
|
|
64
|
+
case MoveMaterialNodeKindType.FreeMaterialZone:
|
|
65
|
+
case MoveMaterialNodeKindType.CompletedCollapsedMaterialZone:
|
|
66
|
+
case MoveMaterialNodeKindType.CompletedExpandedMaterialZone:
|
|
67
|
+
return [kind.type, null];
|
|
68
|
+
case MoveMaterialNodeKindType.PalletFaceZone:
|
|
69
|
+
return [kind.type, kind.face];
|
|
70
|
+
case MoveMaterialNodeKindType.QueueZone:
|
|
71
|
+
return [kind.type, kind.queue];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function groupMatByKind(allNodes) {
|
|
75
|
+
let freeMaterial;
|
|
76
|
+
let completedMaterial;
|
|
77
|
+
const faces = new Map();
|
|
78
|
+
const queues = new Map();
|
|
79
|
+
const material = new Array();
|
|
80
|
+
for (const node of allNodes.values()) {
|
|
81
|
+
switch (node.type) {
|
|
82
|
+
case MoveMaterialNodeKindType.FreeMaterialZone:
|
|
83
|
+
freeMaterial = node.elem;
|
|
84
|
+
break;
|
|
85
|
+
case MoveMaterialNodeKindType.CompletedCollapsedMaterialZone:
|
|
86
|
+
case MoveMaterialNodeKindType.CompletedExpandedMaterialZone:
|
|
87
|
+
completedMaterial = node.elem;
|
|
88
|
+
break;
|
|
89
|
+
case MoveMaterialNodeKindType.PalletFaceZone:
|
|
90
|
+
faces.set(node.face, node.elem);
|
|
91
|
+
break;
|
|
92
|
+
case MoveMaterialNodeKindType.QueueZone:
|
|
93
|
+
queues.set(node.queue, node.elem);
|
|
94
|
+
break;
|
|
95
|
+
case MoveMaterialNodeKindType.Material:
|
|
96
|
+
if (node.material) {
|
|
97
|
+
material.push([node.elem, node.material]);
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return { freeMaterial, completedMaterial, faces, queues, material };
|
|
103
|
+
}
|
|
104
|
+
export function computeArrows(container, allNodes) {
|
|
105
|
+
if (!container) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const byKind = groupMatByKind(allNodes);
|
|
109
|
+
if (!byKind.completedMaterial) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
const arrows = [];
|
|
113
|
+
const faceDestUsed = new Map();
|
|
114
|
+
const queueDestUsed = new Map();
|
|
115
|
+
let lastFreeUsed = 0;
|
|
116
|
+
for (const [rect, mat] of LazySeq.of(byKind.material).sortBy(([rect]) => rect.left, ([rect]) => rect.top)) {
|
|
117
|
+
switch (mat.action.type) {
|
|
118
|
+
case api.ActionType.UnloadToCompletedMaterial:
|
|
119
|
+
case api.ActionType.UnloadToInProcess:
|
|
120
|
+
if (mat.action.type === api.ActionType.UnloadToCompletedMaterial &&
|
|
121
|
+
(!mat.action.unloadIntoQueue || mat.action.unloadIntoQueue === "")) {
|
|
122
|
+
arrows.push({
|
|
123
|
+
fromX: rect.right,
|
|
124
|
+
fromY: rect.top + rect.height / 2,
|
|
125
|
+
toY: rect.top + rect.height / 2,
|
|
126
|
+
toX: byKind.completedMaterial ? byKind.completedMaterial.left + 2 : container.right - 10,
|
|
127
|
+
curveDirection: 1,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
let dest;
|
|
132
|
+
let lastSlotUsed;
|
|
133
|
+
if (mat.action.unloadIntoQueue) {
|
|
134
|
+
dest = byKind.queues.get(mat.action.unloadIntoQueue);
|
|
135
|
+
lastSlotUsed = queueDestUsed.get(mat.action.unloadIntoQueue) ?? 0;
|
|
136
|
+
queueDestUsed.set(mat.action.unloadIntoQueue, lastSlotUsed + 1);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
dest = byKind.freeMaterial;
|
|
140
|
+
lastSlotUsed = lastFreeUsed;
|
|
141
|
+
lastFreeUsed += 1;
|
|
142
|
+
}
|
|
143
|
+
arrows.push({
|
|
144
|
+
fromX: rect.left,
|
|
145
|
+
fromY: rect.top + rect.height / 2,
|
|
146
|
+
toX: dest !== undefined ? dest.right - 5 : container.left + 2,
|
|
147
|
+
toY: dest !== undefined ? dest.top + 20 * (lastSlotUsed + 1) : rect.top + rect.height / 2,
|
|
148
|
+
curveDirection: 1,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
case api.ActionType.Loading:
|
|
153
|
+
if (mat.action.loadOntoFace) {
|
|
154
|
+
if (mat.location.type === api.LocType.OnPallet) {
|
|
155
|
+
if (mat.location.palletNum === mat.action.loadOntoPalletNum &&
|
|
156
|
+
mat.location.face === mat.action.loadOntoFace) {
|
|
157
|
+
// reclamp
|
|
158
|
+
arrows.push({
|
|
159
|
+
fromX: rect.right,
|
|
160
|
+
fromY: rect.top + (rect.height * 3) / 4,
|
|
161
|
+
toX: rect.left + (rect.width * 7) / 8,
|
|
162
|
+
toY: rect.bottom,
|
|
163
|
+
curveDirection: -1,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
// move to different face
|
|
168
|
+
const face = byKind.faces.get(mat.action.loadOntoFace);
|
|
169
|
+
if (face) {
|
|
170
|
+
if (mat.action.loadOntoFace < (mat.location.face ?? 0)) {
|
|
171
|
+
arrows.push({
|
|
172
|
+
fromX: rect.left,
|
|
173
|
+
fromY: rect.top + rect.height / 2,
|
|
174
|
+
toX: rect.left,
|
|
175
|
+
toY: face.bottom + 20,
|
|
176
|
+
curveDirection: -1,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
arrows.push({
|
|
181
|
+
fromX: rect.left,
|
|
182
|
+
fromY: rect.top + rect.height / 2,
|
|
183
|
+
toX: rect.left,
|
|
184
|
+
toY: face.top - 20,
|
|
185
|
+
curveDirection: 1,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
// loading from queues or free Material
|
|
193
|
+
const face = byKind.faces.get(mat.action.loadOntoFace);
|
|
194
|
+
if (face !== undefined) {
|
|
195
|
+
const faceSpotsUsed = faceDestUsed.get(mat.action.loadOntoFace) ?? 0;
|
|
196
|
+
faceDestUsed.set(mat.action.loadOntoFace, faceSpotsUsed + 1);
|
|
197
|
+
arrows.push({
|
|
198
|
+
fromX: rect.right,
|
|
199
|
+
fromY: rect.top + rect.height / 2,
|
|
200
|
+
toX: face.left + 20,
|
|
201
|
+
toY: face.top + 50 + 20 * faceSpotsUsed,
|
|
202
|
+
curveDirection: -1,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return arrows.map((arr) => ({
|
|
211
|
+
fromX: arr.fromX - container.left,
|
|
212
|
+
fromY: arr.fromY - container.top,
|
|
213
|
+
toX: arr.toX - container.left,
|
|
214
|
+
toY: arr.toY - container.top,
|
|
215
|
+
curveDirection: arr.curveDirection,
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const allOperators: import("jotai").WritableAtom<readonly string[], [readonly string[] | typeof import("jotai/utils").RESET | ((prev: readonly string[]) => readonly string[] | typeof import("jotai/utils").RESET)], void>;
|
|
2
|
+
export declare const currentOperator: import("jotai").WritableAtom<string | null, [newVal: string | null], void>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* Copyright (c) 2020, John Lenz
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above
|
|
12
|
+
copyright notice, this list of conditions and the following
|
|
13
|
+
disclaimer in the documentation and/or other materials provided
|
|
14
|
+
with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
17
|
+
nor the names of other contributors may be used to endorse or
|
|
18
|
+
promote products derived from this software without specific
|
|
19
|
+
prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
22
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
24
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
25
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
29
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
import { fmsInformation } from "../network/server-settings.js";
|
|
34
|
+
import { atomWithStorage } from "jotai/utils";
|
|
35
|
+
import { atom } from "jotai";
|
|
36
|
+
const selectedOperator = atomWithStorage("current-operator", null);
|
|
37
|
+
export const allOperators = atomWithStorage("operators", []);
|
|
38
|
+
export const currentOperator = atom((get) => {
|
|
39
|
+
const selected = get(selectedOperator);
|
|
40
|
+
const fmsInfo = get(fmsInformation);
|
|
41
|
+
return fmsInfo.user ? fmsInfo.user.profile.name || fmsInfo.user.profile.sub || null : selected;
|
|
42
|
+
}, (_, set, newVal) => {
|
|
43
|
+
set(selectedOperator, newVal);
|
|
44
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OrderedMap, OrderedSet } from "@seedtactics/immutable-collections";
|
|
2
|
+
import { MaterialSummaryAndCompletedData } from "../cell-status/material-summary";
|
|
3
|
+
export type PartSummary = {
|
|
4
|
+
readonly part: string;
|
|
5
|
+
readonly completedQty: number;
|
|
6
|
+
readonly abnormalQty: number;
|
|
7
|
+
readonly stationMins: OrderedMap<string, {
|
|
8
|
+
readonly isLoadUnload: boolean;
|
|
9
|
+
readonly active: number;
|
|
10
|
+
readonly elapsed: number;
|
|
11
|
+
readonly medianElapsed: number;
|
|
12
|
+
}>;
|
|
13
|
+
readonly mats: ReadonlyArray<MaterialSummaryAndCompletedData>;
|
|
14
|
+
readonly workorders: OrderedSet<string>;
|
|
15
|
+
};
|
|
16
|
+
export declare const last30PartSummaryRange: import("./chart-times").Last30ChartRangeAtom;
|
|
17
|
+
export declare const last30PartSummary: import("jotai").Atom<readonly PartSummary[]>;
|