@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,286 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /* Copyright (c) 2025, 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, useMemo, useState } from "react";
35
+ import { Box, Button, Stack, TableSortLabel, IconButton, Tooltip, Typography, Table, TableRow, TableCell, TableHead, TableBody, Toolbar, Select, MenuItem, InputBase, styled, } from "@mui/material";
36
+ import { MaterialDialog, PartIdenticon } from "../station-monitor/Material.js";
37
+ import { FirstPage as FirstPageIcon, KeyboardArrowLeft, KeyboardArrowRight, LastPage as LastPageIcon, KeyboardArrowDown as KeyboardArrowDownIcon, KeyboardArrowUp as KeyboardArrowUpIcon, ImportExport, MoreHoriz, Check, ErrorOutline, SavedSearch, HelpOutline, } from "@mui/icons-material";
38
+ import { Collapse } from "@mui/material";
39
+ import { LazySeq, mkCompareByProperties } from "@seedtactics/immutable-collections";
40
+ import { AppLink, RouteLocation, useSetTitle } from "../routes.js";
41
+ import { materialDialogOpen, materialInDialogInfo, useCompleteCloseout, } from "../../cell-status/material-details.js";
42
+ import copy from "copy-to-clipboard";
43
+ import { useAtomValue, useSetAtom } from "jotai";
44
+ import { SelectWorkorderDialog, selectWorkorderDialogOpen } from "../station-monitor/SelectWorkorder.js";
45
+ import { last30PartSummary, last30PartSummaryRange } from "../../data/part-summary.js";
46
+ import { Last30ChartRangeToolbar } from "./ChartRangeEdit.js";
47
+ const numFormat = new Intl.NumberFormat(undefined, { maximumFractionDigits: 1 });
48
+ const partColCount = 6;
49
+ function sortPartSummary(parts, col, order) {
50
+ let sortCol;
51
+ switch (col) {
52
+ case "PartName":
53
+ sortCol = (j) => j.part;
54
+ break;
55
+ case "CompletedQty":
56
+ sortCol = (j) => j.completedQty;
57
+ break;
58
+ case "AbnormalQty":
59
+ sortCol = (j) => j.abnormalQty;
60
+ break;
61
+ case "Workorders":
62
+ sortCol = (j) => j.workorders.lookupMin()?.[0] ?? null;
63
+ break;
64
+ case "Elapsed":
65
+ sortCol = (j) => j.stationMins
66
+ .toAscLazySeq()
67
+ .filter(([_, stat]) => !stat.isLoadUnload)
68
+ .sumBy(([, t]) => t.elapsed);
69
+ break;
70
+ case "Active":
71
+ sortCol = (j) => j.stationMins
72
+ .toAscLazySeq()
73
+ .filter(([_, stat]) => !stat.isLoadUnload)
74
+ .sumBy(([_, t]) => t.active);
75
+ break;
76
+ case "Median":
77
+ sortCol = (j) => j.stationMins
78
+ .toAscLazySeq()
79
+ .filter(([_, stat]) => !stat.isLoadUnload)
80
+ .sumBy(([_, t]) => t.medianElapsed);
81
+ break;
82
+ }
83
+ const sorted = [...parts];
84
+ sorted.sort(mkCompareByProperties(order === "asc" ? { asc: sortCol } : { desc: sortCol }));
85
+ return sorted;
86
+ }
87
+ const completedDateFormat = new Intl.DateTimeFormat(undefined, {
88
+ month: "short",
89
+ day: "numeric",
90
+ hour: "numeric",
91
+ minute: "2-digit",
92
+ });
93
+ function sortMaterial(material, col, order) {
94
+ let sortCol;
95
+ switch (col) {
96
+ case "Serial":
97
+ sortCol = (j) => j.serial ?? null;
98
+ break;
99
+ case "CompletedDate":
100
+ sortCol = (j) => j.last_unload_time ?? null;
101
+ break;
102
+ case "Workorder":
103
+ sortCol = (j) => j.workorderId ?? null;
104
+ break;
105
+ case "Quarantined":
106
+ sortCol = (j) => j.currently_quarantined ?? null;
107
+ break;
108
+ case "InspectFailed":
109
+ sortCol = (j) => LazySeq.ofObject(j.completedInspections ?? {}).some(([, insp]) => insp.success === false) ? -1 : 0;
110
+ break;
111
+ case "CloseOut":
112
+ sortCol = (j) => (j.closeout_failed === undefined ? 1 : j.closeout_failed === true ? -1 : 0);
113
+ break;
114
+ }
115
+ const sorted = [...material];
116
+ sorted.sort(mkCompareByProperties(order === "asc" ? { asc: sortCol } : { desc: sortCol }));
117
+ return sorted;
118
+ }
119
+ function SortColHeader(props) {
120
+ return (_jsxs(TableCell, { align: props.align, sortDirection: props.sortBy === props.col ? props.order : false, sx: props.noWhitespaceWrap ? { whiteSpace: "nowrap" } : undefined, children: [_jsx(Tooltip, { title: "Sort", enterDelay: 300, children: _jsx(TableSortLabel, { active: props.sortBy === props.col, direction: props.order, onClick: () => {
121
+ if (props.col === props.sortBy) {
122
+ props.setOrder(props.order === "asc" ? "desc" : "asc");
123
+ }
124
+ else {
125
+ props.setSortBy(props.col);
126
+ props.setOrder("asc");
127
+ }
128
+ }, children: props.children }) }), props.extraIcon] }));
129
+ }
130
+ const WorkorderLink = memo(function WorkorderLink({ workorderId, }) {
131
+ if (!workorderId || workorderId === "") {
132
+ return _jsx("span", {});
133
+ }
134
+ else {
135
+ return (_jsx(AppLink, { to: { route: RouteLocation.Operations_CurrentWorkorders, workorder: workorderId }, children: workorderId }));
136
+ }
137
+ });
138
+ function MaterialTable({ material }) {
139
+ const setMatToShow = useSetAtom(materialDialogOpen);
140
+ const [sortCol, setSortCol] = useState("Serial");
141
+ const [order, setOrder] = useState("asc");
142
+ const sortedMats = useMemo(() => sortMaterial(material, sortCol, order), [material, sortCol, order]);
143
+ const sort = {
144
+ sortBy: sortCol,
145
+ setSortBy: setSortCol,
146
+ order: order,
147
+ setOrder: setOrder,
148
+ };
149
+ const [rowsPerPage, setRowsPerPage] = useState(10);
150
+ const [page, setPage] = useState(0);
151
+ const curPage = sortedMats.slice(page * rowsPerPage, (page + 1) * rowsPerPage);
152
+ return (_jsxs(_Fragment, { children: [_jsxs(Table, { size: "small", children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(SortColHeader, { col: "Serial", ...sort, children: "Serial" }), _jsx(SortColHeader, { col: "CompletedDate", ...sort, children: "Completed" }), _jsx(SortColHeader, { col: "Workorder", ...sort, children: "Workorder" }), _jsx(SortColHeader, { col: "Quarantined", ...sort, children: "Quarantine?" }), _jsx(SortColHeader, { col: "InspectFailed", noWhitespaceWrap: true, ...sort, children: "Inspect Failed?" }), _jsx(SortColHeader, { col: "CloseOut", noWhitespaceWrap: true, ...sort, children: "Close Out" }), _jsx(TableCell, { padding: "checkbox" })] }) }), _jsxs(TableBody, { children: [curPage.map((s) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: s.serial ?? "" }), _jsx(TableCell, { children: s.last_unload_time ? completedDateFormat.format(s.last_unload_time) : "" }), _jsx(TableCell, { children: _jsx(WorkorderLink, { workorderId: s.workorderId }) }), _jsx(TableCell, { sx: { textAlign: "center" }, padding: "checkbox", children: s.currently_quarantined ? _jsx(SavedSearch, { fontSize: "inherit" }) : "" }), _jsx(TableCell, { sx: { textAlign: "center" }, padding: "checkbox", children: LazySeq.ofObject(s.completedInspections ?? {}).some(([, insp]) => insp.success === false) ? (_jsx(ErrorOutline, { fontSize: "inherit" })) : ("") }), _jsx(TableCell, { sx: { textAlign: "center" }, padding: "checkbox", children: s.closeout_completed === undefined ? ("") : s.closeout_failed === false ? (_jsx(Check, { fontSize: "inherit" })) : (_jsx(ErrorOutline, { fontSize: "inherit" })) }), _jsx(TableCell, { padding: "checkbox", children: _jsx(IconButton, { onClick: () => setMatToShow({
153
+ type: "MatSummary",
154
+ summary: s,
155
+ }), size: "large", children: _jsx(MoreHoriz, { fontSize: "inherit" }) }) })] }, s.materialID))), LazySeq.ofRange(0, rowsPerPage - curPage.length).map((i) => (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 7, children: "\u00A0" }) }, i)))] })] }), _jsxs(Toolbar, { variant: "dense", sx: { mb: "0.5em" }, children: [_jsx(Typography, { color: "textSecondary", variant: "caption", children: "Rows per page:" }), _jsx(Select, { style: { marginLeft: 8, marginRight: "1em" }, value: rowsPerPage, SelectDisplayProps: { style: { color: "rgba(0, 0, 0, 0.54)" } }, input: _jsx(InputBase, {}), onChange: (evt) => {
156
+ const rpp = evt.target.value;
157
+ setRowsPerPage(rpp);
158
+ const maxPage = Math.ceil(material.length / rpp) - 1;
159
+ if (page > maxPage) {
160
+ setPage(maxPage);
161
+ }
162
+ }, children: [10, 15, 20, 50].map((rowsPerPageOption) => (_jsx(MenuItem, { value: rowsPerPageOption, children: rowsPerPageOption }, rowsPerPageOption))) }), _jsx(Typography, { color: "textSecondary", variant: "caption", children: `${material.length === 0 ? 0 : page * rowsPerPage + 1}-${Math.min(material.length, (page + 1) * rowsPerPage)} of ${material.length}` }), _jsx(IconButton, { onClick: () => setPage(0), disabled: page === 0, "aria-label": "First Page", size: "large", children: _jsx(FirstPageIcon, {}) }), _jsx(IconButton, { onClick: () => setPage(page - 1), disabled: page === 0, "aria-label": "Previous Page", size: "large", children: _jsx(KeyboardArrowLeft, {}) }), _jsx(IconButton, { onClick: () => setPage(page + 1), disabled: page >= Math.ceil(material.length / rowsPerPage) - 1, "aria-label": "Next Page", size: "large", children: _jsx(KeyboardArrowRight, {}) }), _jsx(IconButton, { onClick: () => setPage(Math.max(0, Math.ceil(material.length / rowsPerPage) - 1)), disabled: page >= Math.ceil(material.length / rowsPerPage) - 1, "aria-label": "Last Page", size: "large", children: _jsx(LastPageIcon, {}) })] })] }));
163
+ }
164
+ const PartDetails = memo(function PartDetails({ part }) {
165
+ return (_jsxs(Stack, { direction: "row", flexWrap: "wrap", justifyContent: "space-around", ml: "1em", mr: "1em", children: [_jsx(Box, { sx: { width: "60em", overflow: "auto" }, children: _jsx(MaterialTable, { material: part.mats }) }), _jsx(Box, { sx: { width: "40em", overflow: "auto" }, children: _jsxs(Table, { size: "small", children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Station" }), _jsx(TableCell, { children: "Active Hours" }), _jsx(TableCell, { children: "Elapsed Hours" }), _jsx(TableCell, { children: "Total Median Hours" })] }) }), _jsx(TableBody, { children: part.stationMins.toAscLazySeq().map(([st, times]) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: st }), _jsx(TableCell, { children: numFormat.format(times.active / 60) }), _jsx(TableCell, { children: numFormat.format(times.elapsed / 60) }), _jsx(TableCell, { children: numFormat.format(times.medianElapsed / 60) })] }, st))) })] }) })] }));
166
+ });
167
+ const PartTableRow = styled(TableRow)({
168
+ "& > *": {
169
+ borderBottom: "unset !important",
170
+ },
171
+ });
172
+ const PartRow = memo(function PartRow({ part }) {
173
+ const [open, setOpen] = useState(false);
174
+ return (_jsxs(_Fragment, { children: [_jsxs(PartTableRow, { children: [_jsx(TableCell, { children: _jsxs(Box, { sx: {
175
+ display: "flex",
176
+ alignItems: "center",
177
+ }, children: [_jsx(Box, { sx: { mr: "0.2em" }, children: _jsx(PartIdenticon, { part: part.part, size: 25 }) }), _jsx("div", { children: _jsx(Typography, { variant: "body2", component: "span", display: "block", children: part.part }) })] }) }), _jsx(TableCell, { align: "right", children: part.completedQty }), _jsx(TableCell, { align: "right", children: part.abnormalQty }), _jsx(TableCell, { align: "right", children: numFormat.format(part.stationMins
178
+ .toAscLazySeq()
179
+ .filter(([_, stat]) => !stat.isLoadUnload)
180
+ .sumBy(([_, t]) => t.active) / 60) }), _jsx(TableCell, { align: "right", children: numFormat.format(part.stationMins
181
+ .toAscLazySeq()
182
+ .filter(([_, stat]) => !stat.isLoadUnload)
183
+ .sumBy(([, t]) => t.elapsed) / 60) }), _jsx(TableCell, { align: "right", children: numFormat.format(part.stationMins
184
+ .toAscLazySeq()
185
+ .filter(([_, stat]) => !stat.isLoadUnload)
186
+ .sumBy(([, t]) => t.medianElapsed) / 60) }), _jsx(TableCell, { align: "left", children: part.workorders.size <= 1 ? (_jsx(WorkorderLink, { workorderId: part.workorders.lookupMin() ?? null })) : part.workorders.size === 2 ? (_jsxs("span", { children: [_jsx(WorkorderLink, { workorderId: part.workorders.lookupMin() }), " &", " ", _jsx(WorkorderLink, { workorderId: part.workorders.lookupMax() })] })) : (`${part.workorders.size} workorders`) }), _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: partColCount + 1, children: _jsx(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: _jsx(PartDetails, { part: part }) }) }) })] }));
187
+ });
188
+ function CopyToClipboardBtn({ partsAtom }) {
189
+ const parts = useAtomValue(partsAtom);
190
+ return (_jsx(Tooltip, { title: "Copy to Clipboard", children: _jsx(IconButton, { style: { height: "25px", paddingTop: 0, paddingBottom: 0 }, size: "large", onClick: () => copyPartsToClipboard(parts), children: _jsx(ImportExport, {}) }) }));
191
+ }
192
+ function MedianHelpTooltip() {
193
+ return (_jsx(Tooltip, { title: "Total Median Hours are calculated by taking the median cycle time (excluding outliers) and adding up for each piece of material.", children: _jsx("span", { style: { verticalAlign: "middle", marginLeft: "0.5em", fontSize: 16 }, children: _jsx(HelpOutline, { fontSize: "inherit" }) }) }));
194
+ }
195
+ function TimeCuttoffHelpTooltip() {
196
+ return (_jsx(Tooltip, { title: "The entire cycle time is credited at the time the cycle completes, so it may be that a day has more than 24 hours of credited time for example.", children: _jsx("span", { style: { verticalAlign: "middle", marginLeft: "0.5em", fontSize: 16 }, children: _jsx(HelpOutline, { fontSize: "inherit" }) }) }));
197
+ }
198
+ function AbnormalHelpTooltip() {
199
+ return (_jsx(Tooltip, { title: "An abnormal part is one which was quarantined, had a failed inspection, or was explicitly marked as failing closeout. A successful closeout overrides this and will never be an abnormal part.", children: _jsx("span", { style: { verticalAlign: "middle", marginLeft: "0.5em", fontSize: 16 }, children: _jsx(HelpOutline, { fontSize: "inherit" }) }) }));
200
+ }
201
+ const PartHeader = memo(function PartHeader({ partsAtom, order, setOrder, sortBy, setSortBy, }) {
202
+ const sort = {
203
+ sortBy: sortBy,
204
+ setSortBy: setSortBy,
205
+ order: order,
206
+ setOrder: setOrder,
207
+ };
208
+ return (_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(SortColHeader, { align: "left", col: "PartName", ...sort, children: "Part" }), _jsx(SortColHeader, { align: "right", col: "CompletedQty", ...sort, children: "Completed Quantity" }), _jsx(SortColHeader, { align: "right", col: "AbnormalQty", ...sort, extraIcon: _jsx(AbnormalHelpTooltip, {}), children: "Abnormal Quantity" }), _jsx(SortColHeader, { align: "right", col: "Active", ...sort, extraIcon: _jsx(TimeCuttoffHelpTooltip, {}), children: "Active Hours" }), _jsx(SortColHeader, { align: "right", col: "Elapsed", ...sort, extraIcon: _jsx(TimeCuttoffHelpTooltip, {}), children: "Elapsed Hours" }), _jsx(SortColHeader, { align: "right", col: "Median", ...sort, extraIcon: _jsx(MedianHelpTooltip, {}), children: "Total Median Hours" }), _jsx(SortColHeader, { align: "left", col: "Workorders", ...sort, children: "Workorders" }), _jsx(TableCell, { children: _jsx(CopyToClipboardBtn, { partsAtom: partsAtom }) })] }) }));
209
+ });
210
+ const CompletedPartsTable = memo(function CompletedPartsTable({ partsAtom, }) {
211
+ const parts = useAtomValue(partsAtom);
212
+ const [sortBy, setSortBy] = useState("PartName");
213
+ const [order, setOrder] = useState("asc");
214
+ const sorted = sortPartSummary(parts, sortBy, order);
215
+ return (_jsxs(Table, { stickyHeader: true, children: [_jsx(PartHeader, { partsAtom: partsAtom, sortBy: sortBy, setSortBy: setSortBy, order: order, setOrder: setOrder }), _jsx(TableBody, { children: sorted.map((part) => (_jsx(PartRow, { part: part }, part.part))) })] }));
216
+ });
217
+ function CompPartsMatDialogBtns() {
218
+ const setWorkorderDialogOpen = useSetAtom(selectWorkorderDialogOpen);
219
+ const mat = useAtomValue(materialInDialogInfo);
220
+ const [complete, isCompleting] = useCompleteCloseout();
221
+ const setToShow = useSetAtom(materialDialogOpen);
222
+ if (mat === null || mat.materialID < 0) {
223
+ return null;
224
+ }
225
+ function closeout(failed) {
226
+ if (mat === null)
227
+ return;
228
+ complete({
229
+ mat,
230
+ operator: "Manager",
231
+ failed,
232
+ });
233
+ setToShow(null);
234
+ }
235
+ 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" })] }));
236
+ }
237
+ const CompletedPartsMaterialDialog = memo(function CompletedPartsMaterialDialog() {
238
+ return _jsx(MaterialDialog, { buttons: _jsx(CompPartsMatDialogBtns, {}) });
239
+ });
240
+ export function RecentCompletedPartsPage() {
241
+ useSetTitle("Completed Parts");
242
+ return (_jsxs(Box, { component: "main", padding: "24px", children: [_jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", justifyContent: "space-between", children: [_jsx("span", { children: "Completed Parts" }), _jsx(Last30ChartRangeToolbar, { chartAtom: last30PartSummaryRange })] }), _jsx(CompletedPartsTable, { partsAtom: last30PartSummary }), _jsx(CompletedPartsMaterialDialog, {}), _jsx(SelectWorkorderDialog, {})] }));
243
+ }
244
+ function copyPartsToClipboard(parts) {
245
+ let table = "<table>\n<thead><tr>";
246
+ table += "<th>Part</th>";
247
+ table += "<th>Completed Qty</th>";
248
+ table += "<th>Abnormal Qty</th>";
249
+ table += "<th>Workorders</th>";
250
+ table += "<th>Active Machine Time (mins)</th>";
251
+ table += "<th>Elapsed Machine Time (mins)</th>";
252
+ table += "<th>Total Median Machine Time (mins)</th>";
253
+ table += "<th>Active L/U Time (mins)</th>";
254
+ table += "<th>Elapsed L/U Time (mins)</th>";
255
+ table += "<th>Total Median L/U Time (mins)</th>";
256
+ table += "</tr></thead>\n<tbody>\n";
257
+ for (const p of parts) {
258
+ table += "<tr>";
259
+ table += `<td>${p.part}</td>`;
260
+ table += `<td>${p.completedQty}</td>`;
261
+ table += `<td>${p.abnormalQty}</td>`;
262
+ table += `<td>${p.workorders.toAscLazySeq().toRArray().join(";")}</td>`;
263
+ for (const lul of [false, true]) {
264
+ const stats = p.stationMins
265
+ .toAscLazySeq()
266
+ .filter(([_, stat]) => stat.isLoadUnload === lul)
267
+ .toRArray();
268
+ if (stats.length === 0) {
269
+ table += `<td>0</td><td>0</td><td>0</td>`;
270
+ }
271
+ else if (stats.length === 1) {
272
+ table += `<td>${stats[0][1].active}</td>`;
273
+ table += `<td>${stats[0][1].elapsed}</td>`;
274
+ table += `<td>${stats[0][1].medianElapsed}</td>`;
275
+ }
276
+ else {
277
+ table += `<td>${stats.map(([st, t]) => `${st}: ${t.active}`).join(";")}</td>`;
278
+ table += `<td>${stats.map(([st, t]) => `${st}: ${t.elapsed}`).join(";")}</td>`;
279
+ table += `<td>${stats.map(([st, t]) => `${st}: ${t.medianElapsed}`).join(";")}</td>`;
280
+ }
281
+ }
282
+ table += "</tr>\n";
283
+ }
284
+ table += "</tbody></table>\n";
285
+ copy(table, { format: "text/html" });
286
+ }
@@ -0,0 +1,3 @@
1
+ export declare const CurrentWorkordersPage: import("react").NamedExoticComponent<{
2
+ disableSearch?: boolean;
3
+ }>;