@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.
Files changed (298) hide show
  1. package/README.md +37 -0
  2. package/dist/cell-status/buffers.d.ts +36 -0
  3. package/dist/cell-status/buffers.js +127 -0
  4. package/dist/cell-status/current-status.d.ts +30 -0
  5. package/dist/cell-status/current-status.js +200 -0
  6. package/dist/cell-status/estimated-cycle-times.d.ts +41 -0
  7. package/dist/cell-status/estimated-cycle-times.js +257 -0
  8. package/dist/cell-status/inspections.d.ts +55 -0
  9. package/dist/cell-status/inspections.js +213 -0
  10. package/dist/cell-status/loading.d.ts +26 -0
  11. package/dist/cell-status/loading.js +112 -0
  12. package/dist/cell-status/material-details.d.ts +116 -0
  13. package/dist/cell-status/material-details.js +422 -0
  14. package/dist/cell-status/material-summary.d.ts +52 -0
  15. package/dist/cell-status/material-summary.js +312 -0
  16. package/dist/cell-status/names.d.ts +19 -0
  17. package/dist/cell-status/names.js +134 -0
  18. package/dist/cell-status/pallet-cycles.d.ts +24 -0
  19. package/dist/cell-status/pallet-cycles.js +78 -0
  20. package/dist/cell-status/rebookings.d.ts +30 -0
  21. package/dist/cell-status/rebookings.js +139 -0
  22. package/dist/cell-status/scheduled-jobs.d.ts +18 -0
  23. package/dist/cell-status/scheduled-jobs.js +94 -0
  24. package/dist/cell-status/sim-day-usage.d.ts +14 -0
  25. package/dist/cell-status/sim-day-usage.js +54 -0
  26. package/dist/cell-status/sim-production.d.ts +22 -0
  27. package/dist/cell-status/sim-production.js +91 -0
  28. package/dist/cell-status/sim-station-use.d.ts +25 -0
  29. package/dist/cell-status/sim-station-use.js +71 -0
  30. package/dist/cell-status/station-cycles.d.ts +34 -0
  31. package/dist/cell-status/station-cycles.js +145 -0
  32. package/dist/cell-status/tool-replacements.d.ts +44 -0
  33. package/dist/cell-status/tool-replacements.js +155 -0
  34. package/dist/cell-status/tool-usage.d.ts +25 -0
  35. package/dist/cell-status/tool-usage.js +95 -0
  36. package/dist/components/App.d.ts +15 -0
  37. package/dist/components/App.js +549 -0
  38. package/dist/components/AxisAndGrid.d.ts +51 -0
  39. package/dist/components/AxisAndGrid.js +47 -0
  40. package/dist/components/BarcodeScanning.d.ts +6 -0
  41. package/dist/components/BarcodeScanning.js +150 -0
  42. package/dist/components/ChartTooltip.d.ts +28 -0
  43. package/dist/components/ChartTooltip.js +95 -0
  44. package/dist/components/ChooseMode.d.ts +18 -0
  45. package/dist/components/ChooseMode.js +136 -0
  46. package/dist/components/ChooseOperator.d.ts +1 -0
  47. package/dist/components/ChooseOperator.js +93 -0
  48. package/dist/components/ErrorsAndLoading.d.ts +9 -0
  49. package/dist/components/ErrorsAndLoading.js +55 -0
  50. package/dist/components/LoadingIcon.d.ts +1 -0
  51. package/dist/components/LoadingIcon.js +48 -0
  52. package/dist/components/LogEntry.d.ts +16 -0
  53. package/dist/components/LogEntry.js +365 -0
  54. package/dist/components/ManualSerialEntry.d.ts +5 -0
  55. package/dist/components/ManualSerialEntry.js +91 -0
  56. package/dist/components/MonthSelect.d.ts +6 -0
  57. package/dist/components/MonthSelect.js +67 -0
  58. package/dist/components/Navigation.d.ts +23 -0
  59. package/dist/components/Navigation.js +120 -0
  60. package/dist/components/VerboseLogging.d.ts +1 -0
  61. package/dist/components/VerboseLogging.js +47 -0
  62. package/dist/components/analysis/AnalysisSelectToolbar.d.ts +1 -0
  63. package/dist/components/analysis/AnalysisSelectToolbar.js +55 -0
  64. package/dist/components/analysis/BufferChart.d.ts +1 -0
  65. package/dist/components/analysis/BufferChart.js +139 -0
  66. package/dist/components/analysis/CostPerPiece.d.ts +2 -0
  67. package/dist/components/analysis/CostPerPiece.js +175 -0
  68. package/dist/components/analysis/CycleChart.d.ts +42 -0
  69. package/dist/components/analysis/CycleChart.js +281 -0
  70. package/dist/components/analysis/DataTable.d.ts +83 -0
  71. package/dist/components/analysis/DataTable.js +215 -0
  72. package/dist/components/analysis/EfficiencyPage.d.ts +2 -0
  73. package/dist/components/analysis/EfficiencyPage.js +138 -0
  74. package/dist/components/analysis/HeatChart.d.ts +22 -0
  75. package/dist/components/analysis/HeatChart.js +161 -0
  76. package/dist/components/analysis/InspectionDataTable.d.ts +10 -0
  77. package/dist/components/analysis/InspectionDataTable.js +148 -0
  78. package/dist/components/analysis/InspectionSankey.d.ts +12 -0
  79. package/dist/components/analysis/InspectionSankey.js +140 -0
  80. package/dist/components/analysis/PalletCycleCards.d.ts +1 -0
  81. package/dist/components/analysis/PalletCycleCards.js +137 -0
  82. package/dist/components/analysis/PartCycleCards.d.ts +2 -0
  83. package/dist/components/analysis/PartCycleCards.js +331 -0
  84. package/dist/components/analysis/QualityPage.d.ts +1 -0
  85. package/dist/components/analysis/QualityPage.js +49 -0
  86. package/dist/components/analysis/ScheduleHistory.d.ts +3 -0
  87. package/dist/components/analysis/ScheduleHistory.js +108 -0
  88. package/dist/components/analysis/StationDataTable.d.ts +25 -0
  89. package/dist/components/analysis/StationDataTable.js +246 -0
  90. package/dist/components/analysis/ToolReplacements.d.ts +1 -0
  91. package/dist/components/analysis/ToolReplacements.js +370 -0
  92. package/dist/components/operations/AllMaterial.d.ts +5 -0
  93. package/dist/components/operations/AllMaterial.js +267 -0
  94. package/dist/components/operations/ChartRangeEdit.d.ts +4 -0
  95. package/dist/components/operations/ChartRangeEdit.js +148 -0
  96. package/dist/components/operations/CloseoutReport.d.ts +2 -0
  97. package/dist/components/operations/CloseoutReport.js +172 -0
  98. package/dist/components/operations/CompletedParts.d.ts +2 -0
  99. package/dist/components/operations/CompletedParts.js +286 -0
  100. package/dist/components/operations/CurrentWorkorders.d.ts +3 -0
  101. package/dist/components/operations/CurrentWorkorders.js +368 -0
  102. package/dist/components/operations/Dashboard.d.ts +2 -0
  103. package/dist/components/operations/Dashboard.js +90 -0
  104. package/dist/components/operations/OEEChart.d.ts +10 -0
  105. package/dist/components/operations/OEEChart.js +173 -0
  106. package/dist/components/operations/Outliers.d.ts +4 -0
  107. package/dist/components/operations/Outliers.js +69 -0
  108. package/dist/components/operations/ProgramHighlight.d.ts +1 -0
  109. package/dist/components/operations/ProgramHighlight.js +9 -0
  110. package/dist/components/operations/Programs.d.ts +5 -0
  111. package/dist/components/operations/Programs.js +363 -0
  112. package/dist/components/operations/Rebookings.d.ts +1 -0
  113. package/dist/components/operations/Rebookings.js +213 -0
  114. package/dist/components/operations/RecentCycleChart.d.ts +4 -0
  115. package/dist/components/operations/RecentCycleChart.js +240 -0
  116. package/dist/components/operations/RecentProduction.d.ts +2 -0
  117. package/dist/components/operations/RecentProduction.js +213 -0
  118. package/dist/components/operations/RecentSchedules.d.ts +12 -0
  119. package/dist/components/operations/RecentSchedules.js +180 -0
  120. package/dist/components/operations/RecentStationCycles.d.ts +4 -0
  121. package/dist/components/operations/RecentStationCycles.js +159 -0
  122. package/dist/components/operations/ShiftSettings.d.ts +6 -0
  123. package/dist/components/operations/ShiftSettings.js +134 -0
  124. package/dist/components/operations/SimDayUsage.d.ts +1 -0
  125. package/dist/components/operations/SimDayUsage.js +133 -0
  126. package/dist/components/operations/ToolReport.d.ts +3 -0
  127. package/dist/components/operations/ToolReport.js +233 -0
  128. package/dist/components/operations/WorkorderGantt.d.ts +1 -0
  129. package/dist/components/operations/WorkorderGantt.js +124 -0
  130. package/dist/components/quality/QualityMaterial.d.ts +2 -0
  131. package/dist/components/quality/QualityMaterial.js +169 -0
  132. package/dist/components/quality/QualityPaths.d.ts +1 -0
  133. package/dist/components/quality/QualityPaths.js +53 -0
  134. package/dist/components/quality/RecentFailedInspections.d.ts +1 -0
  135. package/dist/components/quality/RecentFailedInspections.js +123 -0
  136. package/dist/components/routes.d.ts +170 -0
  137. package/dist/components/routes.js +301 -0
  138. package/dist/components/station-monitor/BulkRawMaterial.d.ts +11 -0
  139. package/dist/components/station-monitor/BulkRawMaterial.js +251 -0
  140. package/dist/components/station-monitor/Closeout.d.ts +5 -0
  141. package/dist/components/station-monitor/Closeout.js +162 -0
  142. package/dist/components/station-monitor/CustomStationMonitorDialog.d.ts +1 -0
  143. package/dist/components/station-monitor/CustomStationMonitorDialog.js +55 -0
  144. package/dist/components/station-monitor/Inspection.d.ts +8 -0
  145. package/dist/components/station-monitor/Inspection.js +164 -0
  146. package/dist/components/station-monitor/InvalidateCycle.d.ts +33 -0
  147. package/dist/components/station-monitor/InvalidateCycle.js +262 -0
  148. package/dist/components/station-monitor/JobDetails.d.ts +7 -0
  149. package/dist/components/station-monitor/JobDetails.js +108 -0
  150. package/dist/components/station-monitor/LoadStation.d.ts +10 -0
  151. package/dist/components/station-monitor/LoadStation.js +450 -0
  152. package/dist/components/station-monitor/Material.d.ts +77 -0
  153. package/dist/components/station-monitor/Material.js +489 -0
  154. package/dist/components/station-monitor/MoveMaterialArrows.d.ts +11 -0
  155. package/dist/components/station-monitor/MoveMaterialArrows.js +118 -0
  156. package/dist/components/station-monitor/PrintedLabel.d.ts +29 -0
  157. package/dist/components/station-monitor/PrintedLabel.js +166 -0
  158. package/dist/components/station-monitor/QuarantineButton.d.ts +4 -0
  159. package/dist/components/station-monitor/QuarantineButton.js +184 -0
  160. package/dist/components/station-monitor/Queues.d.ts +23 -0
  161. package/dist/components/station-monitor/Queues.js +312 -0
  162. package/dist/components/station-monitor/QueuesAddMaterial.d.ts +30 -0
  163. package/dist/components/station-monitor/QueuesAddMaterial.js +248 -0
  164. package/dist/components/station-monitor/SelectInspType.d.ts +2 -0
  165. package/dist/components/station-monitor/SelectInspType.js +99 -0
  166. package/dist/components/station-monitor/SelectWorkorder.d.ts +4 -0
  167. package/dist/components/station-monitor/SelectWorkorder.js +100 -0
  168. package/dist/components/station-monitor/StationToolbar.d.ts +3 -0
  169. package/dist/components/station-monitor/StationToolbar.js +168 -0
  170. package/dist/components/station-monitor/SystemOverview.d.ts +46 -0
  171. package/dist/components/station-monitor/SystemOverview.js +439 -0
  172. package/dist/components/station-monitor/Whiteboard.d.ts +10 -0
  173. package/dist/components/station-monitor/Whiteboard.js +67 -0
  174. package/dist/data/all-material-bins.d.ts +45 -0
  175. package/dist/data/all-material-bins.js +224 -0
  176. package/dist/data/chart-times.d.ts +20 -0
  177. package/dist/data/chart-times.js +99 -0
  178. package/dist/data/cost-per-piece.d.ts +32 -0
  179. package/dist/data/cost-per-piece.js +183 -0
  180. package/dist/data/current-cycles.d.ts +13 -0
  181. package/dist/data/current-cycles.js +144 -0
  182. package/dist/data/inspection-sankey.d.ts +15 -0
  183. package/dist/data/inspection-sankey.js +147 -0
  184. package/dist/data/move-arrows.d.ts +48 -0
  185. package/dist/data/move-arrows.js +217 -0
  186. package/dist/data/operators.d.ts +2 -0
  187. package/dist/data/operators.js +44 -0
  188. package/dist/data/part-summary.d.ts +17 -0
  189. package/dist/data/part-summary.js +107 -0
  190. package/dist/data/path-lookup.d.ts +13 -0
  191. package/dist/data/path-lookup.js +107 -0
  192. package/dist/data/queue-material.d.ts +46 -0
  193. package/dist/data/queue-material.js +256 -0
  194. package/dist/data/results.bufferchart.d.ts +10 -0
  195. package/dist/data/results.bufferchart.js +90 -0
  196. package/dist/data/results.completed-parts.d.ts +26 -0
  197. package/dist/data/results.completed-parts.js +181 -0
  198. package/dist/data/results.cycles.d.ts +86 -0
  199. package/dist/data/results.cycles.js +454 -0
  200. package/dist/data/results.inspection.d.ts +36 -0
  201. package/dist/data/results.inspection.js +188 -0
  202. package/dist/data/results.oee.d.ts +40 -0
  203. package/dist/data/results.oee.js +330 -0
  204. package/dist/data/results.schedules.d.ts +23 -0
  205. package/dist/data/results.schedules.js +157 -0
  206. package/dist/data/tools-programs.d.ts +78 -0
  207. package/dist/data/tools-programs.js +376 -0
  208. package/dist/index.d.ts +1 -0
  209. package/dist/index.js +60 -0
  210. package/dist/network/api.d.ts +1390 -0
  211. package/dist/network/api.js +4971 -0
  212. package/dist/network/backend-mock.d.ts +11 -0
  213. package/dist/network/backend-mock.js +512 -0
  214. package/dist/network/backend.d.ts +57 -0
  215. package/dist/network/backend.js +77 -0
  216. package/dist/network/load-specific-month.d.ts +13 -0
  217. package/dist/network/load-specific-month.js +77 -0
  218. package/dist/network/server-settings.d.ts +12 -0
  219. package/dist/network/server-settings.js +92 -0
  220. package/dist/network/websocket.d.ts +4 -0
  221. package/dist/network/websocket.js +165 -0
  222. package/dist/renderer.d.ts +8 -0
  223. package/dist/renderer.js +55 -0
  224. package/dist/seedtactics-logo.d.ts +2 -0
  225. package/dist/seedtactics-logo.js +4 -0
  226. package/dist/util/chart-colors.d.ts +1 -0
  227. package/dist/util/chart-colors.js +116 -0
  228. package/dist/util/chart-helpers.d.ts +3 -0
  229. package/dist/util/chart-helpers.js +51 -0
  230. package/dist/util/parseISODuration.d.ts +4 -0
  231. package/dist/util/parseISODuration.js +40 -0
  232. package/docs/client-efficiency.md +355 -0
  233. package/docs/client-engineering.md +54 -0
  234. package/docs/client-launch.md +55 -0
  235. package/docs/client-operations.md +88 -0
  236. package/docs/client-quality.md +74 -0
  237. package/docs/client-sales.md +61 -0
  238. package/docs/client-scanners.md +41 -0
  239. package/docs/client-station-monitor.md +149 -0
  240. package/docs/client-tools-programs.md +74 -0
  241. package/docs/improve-fms.md +141 -0
  242. package/docs/makino.md +40 -0
  243. package/docs/material-quarantine.md +82 -0
  244. package/docs/material-tracking.md +236 -0
  245. package/docs/mazak.md +115 -0
  246. package/docs/niigata.md +228 -0
  247. package/docs/operator-procedures.md +106 -0
  248. package/docs/part-instructions.md +63 -0
  249. package/docs/screenshots/insight-all-material.png +0 -0
  250. package/docs/screenshots/insight-analysis-pallets.png +0 -0
  251. package/docs/screenshots/insight-analysis-part-completed.png +0 -0
  252. package/docs/screenshots/insight-analysis-sankey.png +0 -0
  253. package/docs/screenshots/insight-analysis-station-oee.png +0 -0
  254. package/docs/screenshots/insight-buffer-occupancy.png +0 -0
  255. package/docs/screenshots/insight-choose-analysis-month.png +0 -0
  256. package/docs/screenshots/insight-closeout.png +0 -0
  257. package/docs/screenshots/insight-cost-percentages.png +0 -0
  258. package/docs/screenshots/insight-dashboard.png +0 -0
  259. package/docs/screenshots/insight-event-custom-view.jpg +0 -0
  260. package/docs/screenshots/insight-event-viewer.jpg +0 -0
  261. package/docs/screenshots/insight-inspection.png +0 -0
  262. package/docs/screenshots/insight-load-station-details.png +0 -0
  263. package/docs/screenshots/insight-load-station.png +0 -0
  264. package/docs/screenshots/insight-loadcycle-graph.png +0 -0
  265. package/docs/screenshots/insight-loadstation-small.jpg +0 -0
  266. package/docs/screenshots/insight-machinecycle-graph.png +0 -0
  267. package/docs/screenshots/insight-machinecycle-table.png +0 -0
  268. package/docs/screenshots/insight-machinecycles.png +0 -0
  269. package/docs/screenshots/insight-machinehours.png +0 -0
  270. package/docs/screenshots/insight-machineoutliers.png +0 -0
  271. package/docs/screenshots/insight-monthly-schedules.png +0 -0
  272. package/docs/screenshots/insight-operations-material.png +0 -0
  273. package/docs/screenshots/insight-operations-overview.png +0 -0
  274. package/docs/screenshots/insight-operations-reports.png +0 -0
  275. package/docs/screenshots/insight-part-cost.png +0 -0
  276. package/docs/screenshots/insight-program-report.png +0 -0
  277. package/docs/screenshots/insight-quality-material-details.png +0 -0
  278. package/docs/screenshots/insight-quality-material.png +0 -0
  279. package/docs/screenshots/insight-quality-quarantine.png +0 -0
  280. package/docs/screenshots/insight-quality-sankey.png +0 -0
  281. package/docs/screenshots/insight-quality-similar-paths.png +0 -0
  282. package/docs/screenshots/insight-queue-details.png +0 -0
  283. package/docs/screenshots/insight-queues-jobs-table.png +0 -0
  284. package/docs/screenshots/insight-queues.png +0 -0
  285. package/docs/screenshots/insight-sim-day-usage.png +0 -0
  286. package/docs/screenshots/insight-station-system-overview-buttons.png +0 -0
  287. package/docs/screenshots/insight-station-system-overview.png +0 -0
  288. package/docs/screenshots/insight-system-overview.png +0 -0
  289. package/docs/screenshots/insight-tool-replacements.png +0 -0
  290. package/docs/screenshots/insight-tool-report.png +0 -0
  291. package/docs/screenshots/insight-toolbar-btns.png +0 -0
  292. package/docs/screenshots/insight-workorder-gantt.png +0 -0
  293. package/docs/screenshots/insight-workorders.png +0 -0
  294. package/docs/security.md +131 -0
  295. package/docs/server-config.md +56 -0
  296. package/docs/server-errors.md +44 -0
  297. package/package.json +90 -0
  298. package/src/index.ts +65 -0
@@ -0,0 +1,368 @@
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 { memo, useState, useMemo, Suspense, useTransition } from "react";
35
+ import { Box, Button, CircularProgress, Dialog, DialogActions, DialogContent, DialogTitle, FormControl, keyframes, List, ListItem, ListItemButton, ListItemText, ListSubheader, MenuItem, Select, Stack, styled, TableSortLabel, TextField, } from "@mui/material";
36
+ import { IconButton } from "@mui/material";
37
+ import { Tooltip } from "@mui/material";
38
+ import { Typography } from "@mui/material";
39
+ import { Table } from "@mui/material";
40
+ import { TableRow } from "@mui/material";
41
+ import { TableCell } from "@mui/material";
42
+ import { TableHead } from "@mui/material";
43
+ import { TableBody } from "@mui/material";
44
+ import { MaterialDialog, PartIdenticon } from "../station-monitor/Material.js";
45
+ import { KeyboardArrowDown as KeyboardArrowDownIcon, KeyboardArrowUp as KeyboardArrowUpIcon, ImportExport, MoreHoriz, Warning as WarningIcon, Check, ErrorOutline, SavedSearch, Search, Clear, Loop, } from "@mui/icons-material";
46
+ import { Collapse } from "@mui/material";
47
+ import { addWorkorderComment, currentStatus } from "../../cell-status/current-status.js";
48
+ import { LazySeq } from "@seedtactics/immutable-collections";
49
+ import { currentRoute, RouteLocation, useSetTitle } from "../routes.js";
50
+ import { WorkorderSerialCloseout } from "../../network/api.js";
51
+ import { durationToMinutes } from "../../util/parseISODuration.js";
52
+ import { materialDialogOpen, materialInDialogInfo, useCompleteCloseout, } from "../../cell-status/material-details.js";
53
+ import copy from "copy-to-clipboard";
54
+ import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
55
+ import { atomWithStorage } from "jotai/utils";
56
+ import { WorkorderGantt } from "./WorkorderGantt.js";
57
+ import { SelectWorkorderDialog, selectWorkorderDialogOpen } from "../station-monitor/SelectWorkorder.js";
58
+ import { LogBackend } from "../../network/backend.js";
59
+ const currentWorkorderIdToSearch = atom((get) => {
60
+ const r = get(currentRoute);
61
+ if (r.route === RouteLocation.Operations_CurrentWorkorders) {
62
+ return r.workorder ?? null;
63
+ }
64
+ else {
65
+ return null;
66
+ }
67
+ }, (get, set, workId) => {
68
+ const r = get(currentRoute);
69
+ if (r.route === RouteLocation.Operations_CurrentWorkorders) {
70
+ if (workId === "") {
71
+ workId = null;
72
+ }
73
+ set(currentRoute, {
74
+ route: RouteLocation.Operations_CurrentWorkorders,
75
+ workorder: workId ?? undefined,
76
+ });
77
+ }
78
+ });
79
+ const recentSearchedWorkorders = atomWithStorage("recentSearchedWorkorders", []);
80
+ const currentSearchedWorkorder = atom(async (get, { signal }) => {
81
+ const workId = get(currentWorkorderIdToSearch);
82
+ if (workId === null) {
83
+ return null;
84
+ }
85
+ return (await LogBackend.getActiveWorkorder(workId, signal)) ?? [];
86
+ });
87
+ const WorkorderTableRow = styled(TableRow)({
88
+ "& > *": {
89
+ borderBottom: "unset !important",
90
+ },
91
+ });
92
+ const numFormat = new Intl.NumberFormat(undefined, { maximumFractionDigits: 1 });
93
+ const WorkorderDetails = memo(function WorkorderDetails({ workorder, }) {
94
+ const setMatToShow = useSetAtom(materialDialogOpen);
95
+ const setCommentDialog = useSetAtom(workorderCommentDialogAtom);
96
+ const stationNames = LazySeq.ofObject(workorder.activeStationTime ?? {})
97
+ .concat(LazySeq.ofObject(workorder.elapsedStationTime ?? {}))
98
+ .map(([st]) => st)
99
+ .distinctAndSortBy((s) => s);
100
+ function show(wmat) {
101
+ setMatToShow({
102
+ type: "MatSummary",
103
+ summary: {
104
+ ...wmat,
105
+ partName: workorder.part,
106
+ },
107
+ });
108
+ }
109
+ return (_jsxs(Stack, { direction: "row", flexWrap: "wrap", justifyContent: "space-around", ml: "1em", mr: "1em", children: [_jsx("div", { children: _jsxs(Table, { size: "small", stickyHeader: true, children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Serial" }), _jsx(TableCell, { children: "Quarantine?" }), _jsx(TableCell, { sx: { whiteSpace: "nowrap" }, children: "Inspect Failed?" }), _jsx(TableCell, { sx: { whiteSpace: "nowrap" }, children: "Close Out" }), _jsx(TableCell, { padding: "checkbox" })] }) }), _jsx(TableBody, { children: (workorder.material ?? []).map((s) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: s.serial ?? "" }), _jsx(TableCell, { sx: { textAlign: "center" }, padding: "checkbox", children: s.quarantined ? _jsx(SavedSearch, { fontSize: "inherit" }) : "" }), _jsx(TableCell, { sx: { textAlign: "center" }, padding: "checkbox", children: s.inspectionFailed ? _jsx(ErrorOutline, { fontSize: "inherit" }) : "" }), _jsx(TableCell, { sx: { textAlign: "center" }, padding: "checkbox", children: s.closeout === WorkorderSerialCloseout.None ? ("") : s.closeout === WorkorderSerialCloseout.ClosedOut ? (_jsx(Check, { fontSize: "inherit" })) : (_jsx(ErrorOutline, { fontSize: "inherit" })) }), _jsx(TableCell, { padding: "checkbox", children: _jsx(IconButton, { onClick: () => show(s), size: "large", children: _jsx(MoreHoriz, { fontSize: "inherit" }) }) })] }, s.materialID))) })] }) }), _jsx("div", { children: _jsxs(Table, { size: "small", children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Station" }), _jsx(TableCell, { children: "Active Minutes" }), _jsx(TableCell, { children: "Elapsed Minutes" })] }) }), _jsx(TableBody, { children: stationNames.map((st) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: st }), _jsx(TableCell, { children: numFormat.format(durationToMinutes(workorder.activeStationTime?.[st] ?? 0)) }), _jsx(TableCell, { children: numFormat.format(durationToMinutes(workorder.elapsedStationTime?.[st] ?? 0)) })] }, st))) })] }) }), _jsxs("div", { children: [_jsxs(Table, { size: "small", children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Time" }), _jsx(TableCell, { children: "Comment" })] }) }), _jsx(TableBody, { children: (workorder.comments ?? []).map((c, idx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: c.timeUTC.toLocaleString(undefined, {
110
+ year: "numeric",
111
+ month: "numeric",
112
+ day: "numeric",
113
+ hour: "numeric",
114
+ minute: "numeric",
115
+ }) }), _jsx(TableCell, { children: c.comment })] }, idx))) })] }), _jsx(Button, { sx: { mt: "0.5em" }, onClick: () => setCommentDialog(workorder), children: "Add Comment" })] })] }));
116
+ });
117
+ function utcDateOnlyToString(d) {
118
+ if (d) {
119
+ return new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate())).toLocaleDateString();
120
+ }
121
+ else {
122
+ return "";
123
+ }
124
+ }
125
+ function isAbnormal(m) {
126
+ if (m.closeout === WorkorderSerialCloseout.ClosedOut) {
127
+ return false;
128
+ }
129
+ return m.quarantined || m.inspectionFailed || m.closeout === WorkorderSerialCloseout.CloseOutFailed;
130
+ }
131
+ function WorkorderRow({ workorder, showSim, }) {
132
+ const [open, setOpen] = useState(false);
133
+ const colCnt = showSim ? 10 : 8;
134
+ return (_jsxs(_Fragment, { children: [_jsxs(WorkorderTableRow, { children: [_jsx(TableCell, { children: workorder.workorderId }), _jsx(TableCell, { children: _jsxs(Box, { sx: {
135
+ display: "flex",
136
+ alignItems: "center",
137
+ }, children: [_jsx(Box, { sx: { mr: "0.2em" }, children: _jsx(PartIdenticon, { part: workorder.part, size: 25 }) }), _jsx("div", { children: _jsx(Typography, { variant: "body2", component: "span", display: "block", children: workorder.part }) })] }) }), _jsx(TableCell, { children: workorder.dueDate === null ? "" : workorder.dueDate.toLocaleDateString() }), _jsx(TableCell, { align: "right", children: workorder.priority }), _jsx(TableCell, { align: "right", children: workorder.plannedQuantity }), _jsx(TableCell, { align: "right", children: workorder.material?.length ?? 0 }), _jsx(TableCell, { align: "right", children: workorder.material?.filter(isAbnormal).length ?? 0 }), _jsx(TableCell, { align: "right", children: workorder.completedQuantity }), showSim ? (_jsxs(_Fragment, { children: [_jsx(TableCell, { align: "right", children: utcDateOnlyToString(workorder.simulatedStart) }), _jsx(TableCell, { align: "right", children: utcDateOnlyToString(workorder.simulatedFilled) })] })) : undefined, _jsx(TableCell, { children: _jsx(Tooltip, { title: "Show Details", children: _jsx(IconButton, { size: "small", onClick: () => setOpen(!open), children: open ? _jsx(KeyboardArrowUpIcon, {}) : _jsx(KeyboardArrowDownIcon, {}) }) }) })] }), _jsx(TableRow, { children: _jsx(TableCell, { sx: { pb: "0", pt: "0" }, colSpan: colCnt, children: _jsx(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: _jsx(WorkorderDetails, { workorder: workorder }) }) }) })] }));
138
+ }
139
+ var SortColumn;
140
+ (function (SortColumn) {
141
+ SortColumn[SortColumn["WorkorderId"] = 0] = "WorkorderId";
142
+ SortColumn[SortColumn["Part"] = 1] = "Part";
143
+ SortColumn[SortColumn["PlannedQty"] = 2] = "PlannedQty";
144
+ SortColumn[SortColumn["DueDate"] = 3] = "DueDate";
145
+ SortColumn[SortColumn["Priority"] = 4] = "Priority";
146
+ SortColumn[SortColumn["CompletedQty"] = 5] = "CompletedQty";
147
+ SortColumn[SortColumn["AssignedQty"] = 6] = "AssignedQty";
148
+ SortColumn[SortColumn["AbnormalQty"] = 7] = "AbnormalQty";
149
+ SortColumn[SortColumn["SimulatedStart"] = 8] = "SimulatedStart";
150
+ SortColumn[SortColumn["SimulatedFilled"] = 9] = "SimulatedFilled";
151
+ })(SortColumn || (SortColumn = {}));
152
+ function sortWorkorders(workorders, sortBy, order) {
153
+ let sortCol;
154
+ switch (sortBy) {
155
+ case SortColumn.WorkorderId:
156
+ sortCol = (j) => j.workorderId;
157
+ break;
158
+ case SortColumn.Part:
159
+ sortCol = (j) => j.part;
160
+ break;
161
+ case SortColumn.PlannedQty:
162
+ sortCol = (j) => j.plannedQuantity;
163
+ break;
164
+ case SortColumn.DueDate:
165
+ sortCol = (j) => j.dueDate.getTime();
166
+ break;
167
+ case SortColumn.Priority:
168
+ sortCol = (j) => j.priority;
169
+ break;
170
+ case SortColumn.CompletedQty:
171
+ sortCol = (j) => j.completedQuantity;
172
+ break;
173
+ case SortColumn.AbnormalQty:
174
+ sortCol = (j) => j.material?.filter(isAbnormal).length ?? 0;
175
+ break;
176
+ case SortColumn.AssignedQty:
177
+ sortCol = (j) => j.material?.length ?? 0;
178
+ break;
179
+ case SortColumn.SimulatedStart:
180
+ sortCol = (j) => j.simulatedStart?.getTime() ?? null;
181
+ break;
182
+ case SortColumn.SimulatedFilled:
183
+ sortCol = (j) => j.simulatedFilled?.getTime() ?? null;
184
+ break;
185
+ }
186
+ return LazySeq.of(workorders).toSortedArray(order === "asc" ? { asc: sortCol } : { desc: sortCol });
187
+ }
188
+ function WorkorderRows({ sortBy, order, showSim, }) {
189
+ const currentSt = useAtomValue(currentStatus);
190
+ const searched = useAtomValue(currentSearchedWorkorder);
191
+ const sorted = useMemo(() => sortWorkorders(searched ?? currentSt.workorders ?? [], sortBy, order), [currentSt.workorders, sortBy, order, searched]);
192
+ if (searched && searched.length === 0) {
193
+ return (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: showSim ? 10 : 8, children: "No workorders found" }) }));
194
+ }
195
+ else {
196
+ return (_jsx(_Fragment, { children: sorted.map((workorder) => (_jsx(WorkorderRow, { workorder: workorder, showSim: showSim }, `${workorder.workorderId}-${workorder.part}`))) }));
197
+ }
198
+ }
199
+ function copyWorkordersToClipboard(workorders, showSim) {
200
+ let table = "<table>\n<thead><tr>";
201
+ table += "<th>Workorder</th>";
202
+ table += "<th>Part</th>";
203
+ table += "<th>Due Date</th>";
204
+ table += "<th>Priority</th>";
205
+ table += "<th>Planned Qty</th>";
206
+ table += "<th>Completed Qty</th>";
207
+ if (showSim) {
208
+ table += "<th>Simulated Start</th>";
209
+ table += "<th>Simulated Filled</th>";
210
+ }
211
+ table += "<th>Serials</th>";
212
+ table += "<th>Active Time (mins)</th>";
213
+ table += "<th>Elapsed Time (mins)</th>";
214
+ table += "</tr></thead>\n<tbody>\n";
215
+ for (const w of workorders) {
216
+ table += "<tr>";
217
+ table += `<td>${w.workorderId}</td>`;
218
+ table += `<td>${w.part}</td>`;
219
+ table += `<td>${w.dueDate === null ? "" : w.dueDate.toLocaleDateString()}</td>`;
220
+ table += `<td>${w.priority}</td>`;
221
+ table += `<td>${w.plannedQuantity}</td>`;
222
+ table += `<td>${w.completedQuantity}</td>`;
223
+ if (showSim) {
224
+ table += `<td>${utcDateOnlyToString(w.simulatedStart)}</td>`;
225
+ table += `<td>${utcDateOnlyToString(w.simulatedFilled)}</td>`;
226
+ }
227
+ table += `<td>${(w.material ?? []).map((w) => w.serial ?? "").join(";")}</td>`;
228
+ table += `<td>${LazySeq.ofObject(w.activeStationTime ?? {})
229
+ .map(([st, t]) => `${st}: ${durationToMinutes(t)}`)
230
+ .toRArray()
231
+ .join(";")}</td>`;
232
+ table += `<td>${LazySeq.ofObject(w.elapsedStationTime ?? {})
233
+ .map(([st, t]) => `${st}: ${durationToMinutes(t)}`)
234
+ .toRArray()
235
+ .join(";")}</td>`;
236
+ table += "</tr>\n";
237
+ }
238
+ table += "</tbody></table>\n";
239
+ copy(table);
240
+ }
241
+ function SortColHeader(props) {
242
+ return (_jsxs(TableCell, { align: props.align, sortDirection: props.sortBy === props.col ? props.order : false, children: [_jsx(Tooltip, { title: "Sort", enterDelay: 300, children: _jsx(TableSortLabel, { active: props.sortBy === props.col, direction: props.order, onClick: () => {
243
+ if (props.col === props.sortBy) {
244
+ props.setOrder(props.order === "asc" ? "desc" : "asc");
245
+ }
246
+ else {
247
+ props.setSortBy(props.col);
248
+ props.setOrder("asc");
249
+ }
250
+ }, children: props.children }) }), props.extraIcon] }));
251
+ }
252
+ const tableOrGantt = atom("table");
253
+ const SimulatedWarning = memo(function SimulatedWarning({ showSim }) {
254
+ const [selected, setSelected] = useAtom(tableOrGantt);
255
+ return (_jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "flex-end", alignItems: "center", children: [showSim ? (_jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", flexGrow: 1, children: [_jsx(WarningIcon, { fontSize: "small" }), _jsx(Typography, { variant: "caption", children: "Projected dates are estimates" })] })) : undefined, _jsx(FormControl, { size: "small", children: _jsxs(Select, { variant: "outlined", value: selected, onChange: (e) => setSelected(e.target.value), children: [_jsx(MenuItem, { value: "table", children: "Table" }), _jsx(MenuItem, { value: "gantt", children: "Gantt" })] }) })] }));
256
+ });
257
+ const rotateKeyframes = keyframes `
258
+ 0% {
259
+ transform: rotate(0deg);
260
+ }
261
+ 100% {
262
+ transform: rotate(360deg);
263
+ }
264
+ `;
265
+ const RotatingLoadingIcon = styled(Loop)(() => ({
266
+ animation: `${rotateKeyframes} 1.5s linear infinite`,
267
+ }));
268
+ function WorkorderSearchButton() {
269
+ const [open, setOpen] = useState(false);
270
+ const [loading, startTrans] = useTransition();
271
+ const [searchWorkId, setSearchWorkId] = useAtom(currentWorkorderIdToSearch);
272
+ const [curWorkId, setCurWorkId] = useState(null);
273
+ const [prevSearches, setPrevSearches] = useAtom(recentSearchedWorkorders);
274
+ function search(workId) {
275
+ if (workId !== null && workId !== "") {
276
+ startTrans(() => {
277
+ setSearchWorkId(workId);
278
+ });
279
+ setOpen(false);
280
+ setCurWorkId(null);
281
+ setPrevSearches((prev) => {
282
+ const n = prev.filter((w) => w !== workId);
283
+ n.unshift(workId);
284
+ return n.slice(0, 5);
285
+ });
286
+ }
287
+ }
288
+ return (_jsxs(_Fragment, { children: [loading ? (_jsx(Tooltip, { title: "Searching.... Click to cancel", children: _jsx(IconButton, { size: "small", onClick: () => setSearchWorkId(null), children: _jsx(RotatingLoadingIcon, { fontSize: "inherit" }) }) })) : searchWorkId ? (_jsx(Tooltip, { title: "Clear Search", children: _jsx(IconButton, { size: "small", onClick: () => setSearchWorkId(null), children: _jsx(Clear, { fontSize: "inherit" }) }) })) : (_jsx(Tooltip, { title: "Search", children: _jsx(IconButton, { size: "small", onClick: (e) => {
289
+ setOpen(true);
290
+ e.currentTarget.blur();
291
+ }, children: _jsx(Search, { fontSize: "inherit" }) }) })), _jsxs(Dialog, { open: open, onClose: () => setOpen(false), children: [_jsx(DialogTitle, { children: "Search Workorder" }), _jsxs(DialogContent, { children: [_jsx(TextField, { variant: "outlined", fullWidth: true, autoFocus: true, sx: { mt: "0.5em", minWidth: "15em" }, label: "Workorder ID", value: curWorkId ?? "", onChange: (e) => setCurWorkId(e.target.value), onKeyDown: (e) => {
292
+ if (e.key === "Enter") {
293
+ search(curWorkId);
294
+ e.preventDefault();
295
+ }
296
+ } }), prevSearches.length > 0 ? (_jsx(_Fragment, { children: _jsx(List, { dense: true, sx: { mt: "1em" }, subheader: _jsx(ListSubheader, { children: "Previous Searches" }), children: prevSearches.map((w) => (_jsx(ListItem, { onClick: () => search(w), children: _jsx(ListItemButton, { children: _jsx(ListItemText, { primary: w }) }) }, w))) }) })) : undefined] }), _jsxs(DialogActions, { children: [_jsx(Button, { color: "primary", onClick: () => search(curWorkId), children: "Search" }), _jsx(Button, { color: "secondary", onClick: () => setOpen(false), children: "Cancel" })] })] })] }));
297
+ }
298
+ const WorkorderHeader = memo(function WorkorderHeader(props) {
299
+ const sort = {
300
+ sortBy: props.sortBy,
301
+ setSortBy: props.setSortBy,
302
+ order: props.order,
303
+ setOrder: props.setOrder,
304
+ };
305
+ return (_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(SortColHeader, { align: "left", col: SortColumn.WorkorderId, ...sort, extraIcon: props.disableSearch ? undefined : _jsx(WorkorderSearchButton, {}), children: "Workorder" }), _jsx(SortColHeader, { align: "left", col: SortColumn.Part, ...sort, children: "Part" }), _jsx(SortColHeader, { align: "left", col: SortColumn.DueDate, ...sort, children: "Due Date" }), _jsx(SortColHeader, { align: "right", col: SortColumn.Priority, ...sort, children: "Priority" }), _jsx(SortColHeader, { align: "right", col: SortColumn.PlannedQty, ...sort, children: "Planned Quantity" }), _jsx(SortColHeader, { align: "right", col: SortColumn.AssignedQty, ...sort, children: "Started Quantity" }), _jsx(SortColHeader, { align: "right", col: SortColumn.AbnormalQty, ...sort, children: "Abnormal Quantity" }), _jsx(SortColHeader, { align: "right", col: SortColumn.CompletedQty, ...sort, children: "Completed Quantity" }), props.showSim ? (_jsxs(_Fragment, { children: [_jsx(SortColHeader, { align: "right", col: SortColumn.SimulatedStart, ...sort, children: "Projected Start" }), _jsx(SortColHeader, { align: "right", col: SortColumn.SimulatedFilled, ...sort, children: "Projected Filled" })] })) : undefined, _jsx(TableCell, { children: _jsx(Tooltip, { title: "Copy to Clipboard", children: _jsx(IconButton, { style: { height: "25px", paddingTop: 0, paddingBottom: 0 }, size: "large", onClick: () => copyWorkordersToClipboard(props.workorders, props.showSim), children: _jsx(ImportExport, {}) }) }) })] }) }));
306
+ });
307
+ const workorderCommentDialogAtom = atom(null);
308
+ function WorkorderCommentDialog() {
309
+ const [workorder, setWorkorder] = useAtom(workorderCommentDialogAtom);
310
+ const [comment, setComment] = useState(null);
311
+ const addComment = useSetAtom(addWorkorderComment);
312
+ function close() {
313
+ setWorkorder(null);
314
+ setComment(null);
315
+ }
316
+ function save() {
317
+ if (workorder && comment && comment !== "") {
318
+ addComment({ workorder: workorder.workorderId, comment: comment });
319
+ }
320
+ close();
321
+ }
322
+ return (_jsx(Dialog, { open: workorder !== null, onClose: close, children: workorder !== null ? (_jsxs(_Fragment, { children: [_jsx(DialogTitle, { children: _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx("div", { children: _jsx(PartIdenticon, { part: workorder.part, size: 40 }) }), _jsxs("div", { style: { marginLeft: "1em", flexGrow: 1 }, children: ["Add Comment For ", workorder.workorderId] })] }) }), _jsx(DialogContent, { children: _jsx(TextField, { variant: "outlined", sx: { mt: "1em" }, fullWidth: true, autoFocus: true, value: comment, onChange: (e) => setComment(e.target.value), onKeyDown: (e) => {
323
+ if (e.key === "Enter" && comment !== null && comment !== "") {
324
+ save();
325
+ e.preventDefault();
326
+ }
327
+ } }) }), _jsxs(DialogActions, { children: [_jsx(Button, { color: "primary", onClick: save, children: "Save Comment" }), _jsx(Button, { color: "primary", onClick: close, children: "Cancel" })] })] })) : undefined }));
328
+ }
329
+ function SearchingWorkorder() {
330
+ const [workId, setWorkId] = useAtom(currentWorkorderIdToSearch);
331
+ return (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 10, children: _jsxs(Stack, { direction: "column", mt: "3em", flex: "flex", alignItems: "center", width: "100%", children: [_jsxs(Stack, { direction: "row", spacing: "3", children: [_jsx(CircularProgress, {}), workId && workId !== "" ? (_jsxs(Typography, { variant: "h6", children: ["Searching for workorder ", workId] })) : (_jsx(Typography, { variant: "h6", children: "Searching" }))] }), _jsx(Button, { onClick: () => setWorkId(null), children: "Cancel" })] }) }) }));
332
+ }
333
+ function WorkorderTable({ showSim, disableSearch, }) {
334
+ const [sortBy, setSortBy] = useState(SortColumn.WorkorderId);
335
+ const [order, setOrder] = useState("asc");
336
+ const currentSt = useAtomValue(currentStatus);
337
+ return (_jsxs(Table, { stickyHeader: true, children: [_jsx(WorkorderHeader, { workorders: currentSt?.workorders ?? [], sortBy: sortBy, setSortBy: setSortBy, showSim: showSim, order: order, setOrder: setOrder, disableSearch: disableSearch }), _jsx(TableBody, { children: _jsx(Suspense, { fallback: _jsx(SearchingWorkorder, {}), children: _jsx(WorkorderRows, { sortBy: sortBy, order: order, showSim: showSim }) }) })] }));
338
+ }
339
+ function WorkSerialButtons() {
340
+ const setWorkorderDialogOpen = useSetAtom(selectWorkorderDialogOpen);
341
+ const mat = useAtomValue(materialInDialogInfo);
342
+ const [complete, isCompleting] = useCompleteCloseout();
343
+ const setToShow = useSetAtom(materialDialogOpen);
344
+ if (mat === null || mat.materialID < 0) {
345
+ return null;
346
+ }
347
+ function closeout(failed) {
348
+ if (mat === null)
349
+ return;
350
+ complete({
351
+ mat,
352
+ operator: "Manager",
353
+ failed,
354
+ });
355
+ setToShow(null);
356
+ }
357
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { color: "primary", disabled: isCompleting, onClick: () => closeout(true), children: "Fail CloseOut" }), _jsx(Button, { color: "primary", disabled: isCompleting, onClick: () => closeout(false), children: "Pass CloseOut" }), _jsx(Button, { color: "primary", onClick: () => setWorkorderDialogOpen(true), children: "Change Workorder" })] }));
358
+ }
359
+ const WorkSerialDialog = memo(function WorkSerialDialog() {
360
+ return _jsx(MaterialDialog, { buttons: _jsx(WorkSerialButtons, {}) });
361
+ });
362
+ export const CurrentWorkordersPage = memo(function RecentWorkordersPage({ disableSearch, }) {
363
+ useSetTitle("Workorders");
364
+ const currentSt = useAtomValue(currentStatus);
365
+ const display = useAtomValue(tableOrGantt);
366
+ const showSim = useMemo(() => currentSt.workorders?.some((w) => !!w.simulatedStart || !!w.simulatedFilled) ?? false, [currentSt.workorders]);
367
+ return (_jsxs(Box, { component: "main", padding: "24px", children: [showSim ? _jsx(SimulatedWarning, { showSim: showSim }) : undefined, display === "table" ? (_jsx(WorkorderTable, { showSim: showSim, disableSearch: disableSearch })) : (_jsx(WorkorderGantt, {})), _jsx(WorkorderCommentDialog, {}), _jsx(WorkSerialDialog, {}), _jsx(SelectWorkorderDialog, {})] }));
368
+ });
@@ -0,0 +1,2 @@
1
+ export declare function ScrollableDashboard(): import("react/jsx-runtime").JSX.Element;
2
+ export default function Dashboard(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,90 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ /* Copyright (c) 2022, John Lenz
3
+
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright
10
+ notice, this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above
13
+ copyright notice, this list of conditions and the following
14
+ disclaimer in the documentation and/or other materials provided
15
+ with the distribution.
16
+
17
+ * Neither the name of John Lenz, Black Maple Software, SeedTactics,
18
+ nor the names of other contributors may be used to endorse or
19
+ promote products derived from this software without specific
20
+ prior written permission.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+ */
34
+ import { memo } from "react";
35
+ import { Box, LinearProgress, Typography } from "@mui/material";
36
+ import { currentStatus } from "../../cell-status/current-status.js";
37
+ import { LazySeq } from "@seedtactics/immutable-collections";
38
+ import { RecentCycleChart } from "./RecentCycleChart.js";
39
+ import { useSetTitle } from "../routes.js";
40
+ import { useAtomValue } from "jotai";
41
+ import { useResizeDetector } from "react-resize-detector";
42
+ const pctFormat = new Intl.NumberFormat(undefined, { style: "percent", minimumFractionDigits: 1 });
43
+ function countExpectedAtNow() {
44
+ const now = new Date();
45
+ return (p) => {
46
+ if (!p.simulatedProduction)
47
+ return 0;
48
+ let lastCnt = 0;
49
+ for (const sim of p.simulatedProduction) {
50
+ if (sim.timeUTC > now)
51
+ break;
52
+ lastCnt = sim.quantity;
53
+ }
54
+ return lastCnt;
55
+ };
56
+ }
57
+ const CompletedParts = memo(function CompletedParts() {
58
+ const currentSt = useAtomValue(currentStatus);
59
+ const completed = LazySeq.ofObject(currentSt.jobs).sumBy(([, j]) => LazySeq.of(j.completed ?? []).sumBy((c) => LazySeq.of(c).sumBy((d) => d)));
60
+ const simulated = LazySeq.ofObject(currentSt.jobs)
61
+ .flatMap(([, j]) => j.procsAndPaths)
62
+ .flatMap((p) => p.paths)
63
+ .sumBy(countExpectedAtNow());
64
+ const planned = LazySeq.ofObject(currentSt.jobs).sumBy(([, j]) => (j.cycles ?? 0) * j.procsAndPaths.length);
65
+ return (_jsx(Box, { sx: { maxWidth: "60em", ml: "auto", mr: "auto", pt: "1em" }, children: _jsxs(Box, { sx: {
66
+ display: "grid",
67
+ gridTemplateColumns: "auto 1fr auto",
68
+ gridColumnGap: "0.5em",
69
+ alignItems: "center",
70
+ }, children: [_jsx(Box, { sx: { gridRow: 1, gridColumn: 1 }, children: _jsxs(Typography, { variant: "body2", children: ["Completed Parts: ", completed, "/", planned] }) }), _jsx(Box, { sx: { gridRow: 1, gridColumn: 2 }, children: _jsx(LinearProgress, { variant: "determinate", value: (completed / planned) * 100, color: "secondary" }) }), _jsx(Box, { sx: { gridRow: 1, gridColumn: 3 }, children: _jsx(Typography, { variant: "body2", children: pctFormat.format(completed / planned) }) }), _jsx(Box, { sx: { gridRow: 2, gridColumn: 1 }, children: _jsxs(Typography, { variant: "body2", children: ["Simulated Parts: ", simulated, "/", planned] }) }), _jsx(Box, { sx: { gridRow: 2, gridColumn: 2 }, children: _jsx(LinearProgress, { variant: "determinate", value: (simulated / planned) * 100, color: "secondary" }) }), _jsx(Box, { sx: { gridRow: 2, gridColumn: 3 }, children: _jsx(Typography, { variant: "body2", children: pctFormat.format(simulated / planned) }) })] }) }));
71
+ });
72
+ function FillViewportDashboard() {
73
+ const { ref, width, height } = useResizeDetector({
74
+ refreshMode: "debounce",
75
+ refreshRate: 100,
76
+ });
77
+ return (_jsxs("main", { style: { height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [_jsx("div", { children: _jsx(CompletedParts, {}) }), _jsx("div", { ref: ref, style: { flexGrow: 1, overflow: "hidden", margin: "8px" }, children: width && height && _jsx(RecentCycleChart, { width: width, height: height }) })] }));
78
+ }
79
+ export function ScrollableDashboard() {
80
+ const { ref, width } = useResizeDetector({
81
+ refreshMode: "debounce",
82
+ refreshRate: 100,
83
+ handleHeight: false,
84
+ });
85
+ return (_jsxs("main", { style: { padding: "8px" }, children: [_jsx(CompletedParts, {}), _jsx("div", { ref: ref, style: { overflow: "hidden" }, children: width && _jsx(RecentCycleChart, { width: width, height: 500 }) })] }));
86
+ }
87
+ export default function Dashboard() {
88
+ useSetTitle("Dashboard");
89
+ return (_jsxs("div", { children: [_jsx(Box, { sx: { display: { xs: "none", md: "block" } }, children: _jsx(FillViewportDashboard, {}) }), _jsx(Box, { sx: { display: { xs: "block", md: "none" } }, children: _jsx(ScrollableDashboard, {}) })] }));
90
+ }
@@ -0,0 +1,10 @@
1
+ import { OEEBarSeries, OEEType } from "../../data/results.oee.js";
2
+ export declare function OEEChart({ points }: {
3
+ points: ReadonlyArray<OEEBarSeries>;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ export declare const OEETable: import("react").NamedExoticComponent<{
6
+ points: ReadonlyArray<OEEBarSeries>;
7
+ }>;
8
+ export declare function StationOEEPage({ ty }: {
9
+ readonly ty: OEEType;
10
+ }): import("react/jsx-runtime").JSX.Element;