@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,137 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } 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 { addMonths, addDays, startOfToday } from "date-fns";
35
+ import { Box, FormControl, Typography } from "@mui/material";
36
+ import { Select } from "@mui/material";
37
+ import { MenuItem } from "@mui/material";
38
+ import { Tooltip } from "@mui/material";
39
+ import { IconButton } from "@mui/material";
40
+ import { ImportExport } from "@mui/icons-material";
41
+ import { selectedAnalysisPeriod } from "../../network/load-specific-month.js";
42
+ import { CycleChart } from "./CycleChart.js";
43
+ import { copyPalletCyclesToClipboard } from "../../data/results.cycles.js";
44
+ import { isDemoAtom, useSetTitle } from "../routes.js";
45
+ import { last30PalletCycles, specificMonthPalletCycles, } from "../../cell-status/pallet-cycles.js";
46
+ import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
47
+ import { atomWithDefault } from "jotai/utils";
48
+ import { LazySeq } from "@seedtactics/immutable-collections";
49
+ import { PartIdenticon } from "../station-monitor/Material.js";
50
+ import { materialDialogOpen } from "../../cell-status/material-details.js";
51
+ import { useCallback } from "react";
52
+ const selectedPalletAtom = atomWithDefault((get) => (get(isDemoAtom) ? 3 : undefined));
53
+ const selectedPartAtom = atom(undefined);
54
+ const zoomDateRangeAtom = atom(undefined);
55
+ const yZoomAtom = atom(null);
56
+ const filteredPoints = atom((get) => {
57
+ const selPal = get(selectedPalletAtom);
58
+ const selPart = get(selectedPartAtom);
59
+ if (!selPal && !selPart)
60
+ return new Map();
61
+ const period = get(selectedAnalysisPeriod);
62
+ const palletCycles = get(period.type === "Last30" ? last30PalletCycles : specificMonthPalletCycles);
63
+ if (selPal) {
64
+ // Pick out the single pallet and optionally filter it by part
65
+ let cyclesForPal = palletCycles.get(selPal)?.valuesToLazySeq() ?? LazySeq.of([]);
66
+ if (selPart) {
67
+ cyclesForPal = cyclesForPal.filter((c) => c.mats.some((m) => m.part === selPart.part && m.proc === selPart.proc));
68
+ }
69
+ return new Map([[selPal.toString(), Array.from(cyclesForPal)]]);
70
+ }
71
+ else if (selPart) {
72
+ // go through all the pallets, filter each by part, and keep those that have any cycles
73
+ return LazySeq.of(palletCycles)
74
+ .collect(([pal, cycles]) => {
75
+ const cyclesForPart = cycles
76
+ .valuesToLazySeq()
77
+ .filter((c) => c.mats.some((m) => m.part === selPart.part && m.proc === selPart.proc))
78
+ .toRArray();
79
+ if (cyclesForPart.length > 0) {
80
+ return [pal, cyclesForPart];
81
+ }
82
+ else {
83
+ return null;
84
+ }
85
+ })
86
+ .toRMap(([pal, cycles]) => [pal.toString(), cycles]);
87
+ }
88
+ else {
89
+ return new Map();
90
+ }
91
+ });
92
+ const allPartNames = atom((get) => {
93
+ const period = get(selectedAnalysisPeriod);
94
+ const palletCycles = get(period.type === "Last30" ? last30PalletCycles : specificMonthPalletCycles);
95
+ return LazySeq.of(palletCycles)
96
+ .flatMap(([, cycles]) => cycles)
97
+ .flatMap(([, c]) => c.mats)
98
+ .distinctAndSortBy((m) => m.part, (m) => m.proc)
99
+ .map((m) => ({ part: m.part, proc: m.proc }))
100
+ .toRArray();
101
+ });
102
+ export function PalletCycleChart() {
103
+ useSetTitle("Pallet Cycles");
104
+ const [selectedPallet, setSelectedPallet] = useAtom(selectedPalletAtom);
105
+ const [selectedPart, setSelectedPart] = useAtom(selectedPartAtom);
106
+ const [zoomDateRange, setZoomRange] = useAtom(zoomDateRangeAtom);
107
+ const [yZoom, setYZoom] = useAtom(yZoomAtom);
108
+ const period = useAtomValue(selectedAnalysisPeriod);
109
+ const defaultDateRange = period.type === "Last30"
110
+ ? [addDays(startOfToday(), -29), addDays(startOfToday(), 1)]
111
+ : [period.month, addMonths(period.month, 1)];
112
+ const palletCycles = useAtomValue(period.type === "Last30" ? last30PalletCycles : specificMonthPalletCycles);
113
+ const points = useAtomValue(filteredPoints);
114
+ const partNames = useAtomValue(allPartNames);
115
+ const setMatToShow = useSetAtom(materialDialogOpen);
116
+ const extraPalletTooltip = useCallback(function extraPalletTooltip(point) {
117
+ const palC = point;
118
+ return palC.mats.map((mat) => ({
119
+ title: mat.part + "-" + mat.proc,
120
+ value: mat.serial ?? "",
121
+ link: mat.serial ? () => setMatToShow({ type: "LogMat", logMat: mat }) : undefined,
122
+ }));
123
+ }, [setMatToShow]);
124
+ return (_jsxs(Box, { paddingLeft: "24px", paddingRight: "24px", paddingTop: "10px", children: [_jsxs(Box, { component: "nav", sx: {
125
+ display: "flex",
126
+ minHeight: "2.5em",
127
+ alignItems: "center",
128
+ maxWidth: "calc(100vw - 24px - 24px)",
129
+ }, children: [_jsx(Typography, { variant: "subtitle1", children: "Pallet Cycles" }), _jsx(Box, { flexGrow: 1 }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, displayEmpty: true, value: selectedPallet ?? -1, onChange: (e) => setSelectedPallet(e.target.value === -1 ? undefined : e.target.value), children: [_jsx(MenuItem, { value: -1, children: _jsx("em", { children: "Any Pallet" }) }, 0), palletCycles
130
+ .keysToLazySeq()
131
+ .sortBy((x) => x)
132
+ .map((n) => (_jsx(MenuItem, { value: n, children: _jsx("div", { style: { display: "flex", alignItems: "center" }, children: _jsx("span", { style: { marginRight: "1em" }, children: n }) }) }, n)))] }) }), partNames.length > 0 ? (_jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, displayEmpty: true, value: selectedPart
133
+ ? partNames.findIndex((o) => selectedPart.part === o.part && selectedPart.proc === o.proc)
134
+ : -1, style: { marginLeft: "1em" }, onChange: (e) => {
135
+ setSelectedPart(e.target.value === -1 ? undefined : partNames[e.target.value]);
136
+ }, children: [_jsx(MenuItem, { value: -1, children: _jsx("em", { children: "Any Part" }) }, 0), partNames.map((n, idx) => (_jsx(MenuItem, { value: idx, children: _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx(PartIdenticon, { part: n.part, size: 20 }), _jsxs("span", { style: { marginRight: "1em" }, children: [n.part, "-", n.proc] })] }) }, idx)))] }) })) : undefined, _jsx(Tooltip, { title: "Copy to Clipboard", children: _jsx(IconButton, { onClick: () => copyPalletCyclesToClipboard(palletCycles), style: { height: "25px", paddingTop: 0, paddingBottom: 0 }, size: "large", children: _jsx(ImportExport, {}) }) })] }), _jsx("main", { children: _jsx(CycleChart, { points: points, series_label: "Pallet", default_date_range: defaultDateRange, current_date_zoom: zoomDateRange, set_date_zoom_range: (z) => setZoomRange(z.zoom), yZoom: yZoom, setYZoom: setYZoom, extra_tooltip: extraPalletTooltip }) })] }));
137
+ }
@@ -0,0 +1,2 @@
1
+ export declare function PartMachineCycleChart(): import("react/jsx-runtime").JSX.Element;
2
+ export declare function PartLoadStationCycleChart(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,331 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } 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 { useCallback, useMemo } from "react";
35
+ import { addMonths, addDays, startOfToday } from "date-fns";
36
+ import { Box, FormControl, Typography } from "@mui/material";
37
+ import { Select } from "@mui/material";
38
+ import { MenuItem } from "@mui/material";
39
+ import { Tooltip } from "@mui/material";
40
+ import { IconButton } from "@mui/material";
41
+ import { ImportExport } from "@mui/icons-material";
42
+ import { selectedAnalysisPeriod } from "../../network/load-specific-month.js";
43
+ import { CycleChart } from "./CycleChart.js";
44
+ import * as matDetails from "../../cell-status/material-details.js";
45
+ import { filterStationCycles, FilterAnyMachineKey, copyCyclesToClipboard, plannedOperationMinutes, loadOccupancyCycles, FilterAnyLoadKey, emptyStationCycles, } from "../../data/results.cycles.js";
46
+ import { PartIdenticon } from "../station-monitor/Material.js";
47
+ import StationDataTable from "./StationDataTable.js";
48
+ import { useSetTitle, isDemoAtom } from "../routes.js";
49
+ import { last30MaterialSummary, specificMonthMaterialSummary } from "../../cell-status/material-summary.js";
50
+ import { last30EstimatedCycleTimes, PartAndStationOperation, specificMonthEstimatedCycleTimes, } from "../../cell-status/estimated-cycle-times.js";
51
+ import { last30StationCycles, specificMonthStationCycles } from "../../cell-status/station-cycles.js";
52
+ import { LazySeq, OrderedMap } from "@seedtactics/immutable-collections";
53
+ import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
54
+ import { atomWithDefault } from "jotai/utils";
55
+ const dateTimeFormat = new Intl.DateTimeFormat(undefined, {
56
+ weekday: "short",
57
+ month: "short",
58
+ day: "numeric",
59
+ hour: "numeric",
60
+ minute: "2-digit",
61
+ });
62
+ function DisplayDateRange({ range }) {
63
+ const period = useAtomValue(selectedAnalysisPeriod);
64
+ if (!range)
65
+ return null;
66
+ const start = "start" in range ? range.start : range[0];
67
+ const end = "end" in range ? range.end : range[1];
68
+ if (period.type === "SpecificMonth") {
69
+ return start.toDateString() + " to " + end.toDateString();
70
+ }
71
+ else {
72
+ return dateTimeFormat.format(start) + " to " + dateTimeFormat.format(end);
73
+ }
74
+ }
75
+ // --------------------------------------------------------------------------------
76
+ // Machine Cycles
77
+ // --------------------------------------------------------------------------------
78
+ const machineShowGraph = atom(true);
79
+ const machineSelectedPart = atomWithDefault((get) => get(isDemoAtom) ? { part: "aaa", proc: 2 } : undefined);
80
+ const machineSelectedMachine = atom(FilterAnyMachineKey);
81
+ const machineSelectedOperation = atom(undefined);
82
+ const machineSelectedPallet = atom(undefined);
83
+ const machineZoomDateRangeRecent = atom(undefined);
84
+ const machineZoomDateRangeByMonth = atom(OrderedMap.empty());
85
+ const machineZoomDateRange = atom((get) => {
86
+ const period = get(selectedAnalysisPeriod);
87
+ if (period.type === "Last30") {
88
+ return get(machineZoomDateRangeRecent);
89
+ }
90
+ else {
91
+ return get(machineZoomDateRangeByMonth).get(period.month);
92
+ }
93
+ }, (get, set, zoom) => {
94
+ const period = get(selectedAnalysisPeriod);
95
+ if (period.type === "Last30") {
96
+ set(machineZoomDateRangeRecent, zoom);
97
+ }
98
+ else {
99
+ set(machineZoomDateRangeByMonth, (prev) => prev.alter(period.month, () => zoom));
100
+ }
101
+ });
102
+ const machineYZoom = atom(null);
103
+ export function PartMachineCycleChart() {
104
+ useSetTitle("Machine Cycles");
105
+ const setMatToShow = useSetAtom(matDetails.materialDialogOpen);
106
+ const extraStationCycleTooltip = useCallback(function extraStationCycleTooltip(point) {
107
+ const partC = point;
108
+ const ret = [];
109
+ for (const mat of partC.material) {
110
+ ret.push({
111
+ title: mat.serial ? mat.serial : "Material",
112
+ value: "Open Card",
113
+ link: () => setMatToShow({ type: "LogMat", logMat: mat }),
114
+ });
115
+ }
116
+ return ret;
117
+ }, [setMatToShow]);
118
+ // values which user can select to be filtered on
119
+ const period = useAtomValue(selectedAnalysisPeriod);
120
+ const estimatedCycleTimes = useAtomValue(period.type === "Last30" ? last30EstimatedCycleTimes : specificMonthEstimatedCycleTimes);
121
+ const matSummary = useAtomValue(period.type === "Last30" ? last30MaterialSummary : specificMonthMaterialSummary);
122
+ // filter/display state
123
+ const [showGraph, setShowGraph] = useAtom(machineShowGraph);
124
+ const [selectedPart, setSelectedPart] = useAtom(machineSelectedPart);
125
+ const [selectedMachine, setSelectedMachine] = useAtom(machineSelectedMachine);
126
+ const [selectedOperation, setSelectedOperation] = useAtom(machineSelectedOperation);
127
+ const [selectedPallet, setSelectedPallet] = useAtom(machineSelectedPallet);
128
+ const [zoomDateRange, setZoomRange] = useAtom(machineZoomDateRange);
129
+ const [yZoom, setYZoom] = useAtom(machineYZoom);
130
+ // calculate points
131
+ const defaultDateRange = period.type === "Last30"
132
+ ? [addDays(startOfToday(), -29), addDays(startOfToday(), 1)]
133
+ : [period.month, addMonths(period.month, 1)];
134
+ const cycles = useAtomValue(period.type === "Last30" ? last30StationCycles : specificMonthStationCycles);
135
+ const points = useMemo(() => {
136
+ if (selectedPart) {
137
+ if (selectedOperation) {
138
+ return filterStationCycles(cycles.valuesToLazySeq(), {
139
+ partAndProc: selectedPart,
140
+ pallet: selectedPallet,
141
+ operation: selectedOperation,
142
+ });
143
+ }
144
+ else {
145
+ return filterStationCycles(cycles.valuesToLazySeq(), {
146
+ partAndProc: selectedPart,
147
+ pallet: selectedPallet,
148
+ station: FilterAnyMachineKey,
149
+ });
150
+ }
151
+ }
152
+ else {
153
+ if (selectedPallet || selectedMachine !== FilterAnyMachineKey) {
154
+ return filterStationCycles(cycles.valuesToLazySeq(), {
155
+ pallet: selectedPallet,
156
+ station: selectedMachine,
157
+ });
158
+ }
159
+ else {
160
+ return emptyStationCycles(cycles.valuesToLazySeq());
161
+ }
162
+ }
163
+ }, [selectedPart, selectedPallet, selectedMachine, selectedOperation, cycles]);
164
+ // If we have selected a part and there is only one operation, default to it.
165
+ const curOperation = selectedPart
166
+ ? (selectedOperation ??
167
+ (points.allMachineOperations.length === 1 ? points.allMachineOperations[0] : undefined))
168
+ : undefined;
169
+ const plannedMinutes = useMemo(() => {
170
+ if (curOperation) {
171
+ return plannedOperationMinutes(points, false);
172
+ }
173
+ else {
174
+ return undefined;
175
+ }
176
+ }, [points, curOperation]);
177
+ return (_jsxs(Box, { paddingLeft: "24px", paddingRight: "24px", paddingTop: "10px", children: [_jsxs(Box, { component: "nav", sx: {
178
+ display: "flex",
179
+ minHeight: "2.5em",
180
+ alignItems: "center",
181
+ maxWidth: "calc(100vw - 24px - 24px)",
182
+ }, children: [_jsxs(Typography, { variant: "subtitle1", children: ["Machine Cycles for ", _jsx(DisplayDateRange, { range: zoomDateRange ?? defaultDateRange })] }), _jsx(Box, { flexGrow: 1 }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, value: showGraph ? "graph" : "table", onChange: (e) => setShowGraph(e.target.value === "graph"), children: [_jsx(MenuItem, { value: "graph", children: "Graph" }, "graph"), _jsx(MenuItem, { value: "table", children: "Table" }, "table")] }) }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, displayEmpty: true, value: selectedPart
183
+ ? points.allPartAndProcNames.findIndex((o) => selectedPart.part === o.part && selectedPart.proc === o.proc)
184
+ : -1, style: { marginLeft: "1em" }, onChange: (e) => {
185
+ setSelectedPart(e.target.value === -1 ? undefined : points.allPartAndProcNames[e.target.value]);
186
+ setSelectedOperation(undefined);
187
+ }, children: [_jsx(MenuItem, { value: -1, children: _jsx("em", { children: "Any Part" }) }, 0), points.allPartAndProcNames.map((n, idx) => (_jsx(MenuItem, { value: idx, children: _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx(PartIdenticon, { part: n.part, size: 20 }), _jsxs("span", { style: { marginRight: "1em" }, children: [n.part, "-", n.proc] })] }) }, idx)))] }) }), _jsx(FormControl, { size: "small", children: _jsx(Select, { autoWidth: true, displayEmpty: true, value: selectedPart
188
+ ? curOperation
189
+ ? points.allMachineOperations.findIndex((o) => curOperation.compare(o) === 0)
190
+ : -1
191
+ : selectedMachine, style: { marginLeft: "1em" }, onChange: (e) => {
192
+ if (selectedPart) {
193
+ setSelectedOperation(points.allMachineOperations[e.target.value]);
194
+ }
195
+ else {
196
+ setSelectedMachine(e.target.value);
197
+ }
198
+ }, children: selectedPart
199
+ ? [
200
+ ...(points.allMachineOperations.length !== 1
201
+ ? [
202
+ _jsx(MenuItem, { value: -1, children: _jsx("em", { children: "Any Operation" }) }, -1),
203
+ ]
204
+ : []),
205
+ ...points.allMachineOperations.map((oper, idx) => (_jsxs(MenuItem, { value: idx, children: [oper.statGroup, " ", oper.operation] }, idx))),
206
+ ]
207
+ : [
208
+ _jsx(MenuItem, { value: FilterAnyMachineKey, children: _jsx("em", { children: "Any Machine" }) }, -1),
209
+ points.allMachineNames.map((n) => (_jsx(MenuItem, { value: n, children: _jsx("div", { style: { display: "flex", alignItems: "center" }, children: _jsx("span", { style: { marginRight: "1em" }, children: n }) }) }, n))),
210
+ ] }) }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, displayEmpty: true, value: selectedPallet || "", style: { marginLeft: "1em" }, onChange: (e) => setSelectedPallet(e.target.value === "" ? undefined : e.target.value), children: [_jsx(MenuItem, { value: "", children: _jsx("em", { children: "Any Pallet" }) }, 0), points.allPalletNames.map((n) => (_jsx(MenuItem, { value: n, children: _jsx("div", { style: { display: "flex", alignItems: "center" }, children: _jsx("span", { style: { marginRight: "1em" }, children: n }) }) }, n)))] }) }), points.data.size > 0 ? (_jsx(Tooltip, { title: "Copy to Clipboard", children: _jsx(IconButton, { onClick: () => copyCyclesToClipboard(points, matSummary.matsById, zoomDateRange), style: { height: "25px", paddingTop: 0, paddingBottom: 0 }, size: "large", children: _jsx(ImportExport, {}) }) })) : undefined] }), _jsx("main", { children: showGraph ? (_jsx(CycleChart, { points: points.data, series_label: points.seriesLabel, default_date_range: defaultDateRange, extra_tooltip: extraStationCycleTooltip, current_date_zoom: zoomDateRange, set_date_zoom_range: (z) => setZoomRange(z.zoom), yZoom: yZoom, setYZoom: setYZoom, stats: curOperation ? estimatedCycleTimes.get(curOperation) : undefined, partCntPerPoint: curOperation ? LazySeq.of(points.data).head()?.[1]?.[0]?.material?.length : undefined, plannedTimeMinutes: plannedMinutes })) : (_jsx(StationDataTable, { points: points.data, matsById: matSummary.matsById, period: period, current_date_zoom: zoomDateRange, set_date_zoom_range: (z) => setZoomRange(z.zoom), showWorkorderAndInspect: true, emptyMessage: selectedPart || selectedPallet || selectedOperation
211
+ ? "No Cycles"
212
+ : "Select part, station, or pallet to see cycles." })) })] }));
213
+ }
214
+ const loadShowGraph = atom(true);
215
+ const loadSelectedPart = atomWithDefault((get) => get(isDemoAtom) ? { part: "aaa", proc: 2 } : undefined);
216
+ const loadSelectedOperation = atomWithDefault((get) => get(isDemoAtom) ? "LoadOp" : "LULOccupancy");
217
+ const loadSelectedLoad = atom(FilterAnyLoadKey);
218
+ const loadSelectedPallet = atom(undefined);
219
+ const loadZoomDateRangeRecent = atom(undefined);
220
+ const loadZoomDateRangeByMonth = atom(OrderedMap.empty());
221
+ const loadZoomDateRange = atom((get) => {
222
+ const period = get(selectedAnalysisPeriod);
223
+ if (period.type === "Last30") {
224
+ return get(loadZoomDateRangeRecent);
225
+ }
226
+ else {
227
+ return get(loadZoomDateRangeByMonth).get(period.month);
228
+ }
229
+ }, (get, set, zoom) => {
230
+ const period = get(selectedAnalysisPeriod);
231
+ if (period.type === "Last30") {
232
+ set(loadZoomDateRangeRecent, zoom);
233
+ }
234
+ else {
235
+ set(loadZoomDateRangeByMonth, (prev) => prev.alter(period.month, () => zoom));
236
+ }
237
+ });
238
+ const loadYZoom = atom(null);
239
+ export function PartLoadStationCycleChart() {
240
+ useSetTitle("L/U Cycles");
241
+ const setMatToShow = useSetAtom(matDetails.materialDialogOpen);
242
+ const extraLoadCycleTooltip = useCallback(function extraLoadCycleTooltip(point) {
243
+ const partC = point;
244
+ const ret = [];
245
+ if (partC.operations) {
246
+ for (const mat of partC.operations) {
247
+ ret.push({
248
+ title: (mat.mat.serial ? mat.mat.serial : "Material") + " " + mat.operation,
249
+ value: "Open Card",
250
+ link: () => setMatToShow({ type: "LogMat", logMat: mat.mat }),
251
+ });
252
+ }
253
+ }
254
+ return ret;
255
+ }, [setMatToShow]);
256
+ const period = useAtomValue(selectedAnalysisPeriod);
257
+ const [showGraph, setShowGraph] = useAtom(loadShowGraph);
258
+ const [selectedPart, setSelectedPart] = useAtom(loadSelectedPart);
259
+ const [selectedOperation, setSelectedOperation] = useAtom(loadSelectedOperation);
260
+ const [selectedLoadStation, setSelectedLoadStation] = useAtom(loadSelectedLoad);
261
+ const [selectedPallet, setSelectedPallet] = useAtom(loadSelectedPallet);
262
+ const [zoomDateRange, setZoomRange] = useAtom(loadZoomDateRange);
263
+ const [yZoom, setYZoom] = useAtom(loadYZoom);
264
+ const curOperation = useMemo(() => selectedPart && selectedOperation === "LoadOp"
265
+ ? new PartAndStationOperation(selectedPart.part, "L/U", "LOAD" + "-" + selectedPart.proc.toString())
266
+ : selectedPart && selectedOperation === "UnloadOp"
267
+ ? new PartAndStationOperation(selectedPart.part, "L/U", "UNLOAD" + "-" + selectedPart.proc.toString())
268
+ : null, [selectedPart, selectedOperation]);
269
+ const defaultDateRange = period.type === "Last30"
270
+ ? [addDays(startOfToday(), -29), addDays(startOfToday(), 1)]
271
+ : [period.month, addMonths(period.month, 1)];
272
+ const cycles = useAtomValue(period.type === "Last30" ? last30StationCycles : specificMonthStationCycles);
273
+ const matSummary = useAtomValue(period.type === "Last30" ? last30MaterialSummary : specificMonthMaterialSummary);
274
+ const estimatedCycleTimes = useAtomValue(period.type === "Last30" ? last30EstimatedCycleTimes : specificMonthEstimatedCycleTimes);
275
+ const points = useMemo(() => {
276
+ if (selectedPart || selectedPallet || selectedLoadStation !== FilterAnyLoadKey) {
277
+ if (curOperation) {
278
+ return filterStationCycles(cycles.valuesToLazySeq(), {
279
+ operation: curOperation,
280
+ pallet: selectedPallet,
281
+ station: selectedLoadStation,
282
+ });
283
+ }
284
+ else if (showGraph) {
285
+ return loadOccupancyCycles(cycles.valuesToLazySeq(), {
286
+ partAndProc: selectedPart,
287
+ pallet: selectedPallet,
288
+ station: selectedLoadStation,
289
+ });
290
+ }
291
+ else {
292
+ return filterStationCycles(cycles.valuesToLazySeq(), {
293
+ partAndProc: selectedPart,
294
+ pallet: selectedPallet,
295
+ station: selectedLoadStation,
296
+ });
297
+ }
298
+ }
299
+ else {
300
+ return emptyStationCycles(cycles.valuesToLazySeq());
301
+ }
302
+ }, [selectedPart, selectedPallet, curOperation, selectedLoadStation, cycles, showGraph]);
303
+ const plannedMinutes = useMemo(() => {
304
+ if (selectedOperation === "LoadOp" || selectedOperation === "UnloadOp") {
305
+ return plannedOperationMinutes(points, true);
306
+ }
307
+ else {
308
+ return undefined;
309
+ }
310
+ }, [points, selectedOperation]);
311
+ return (_jsxs(Box, { paddingLeft: "24px", paddingRight: "24px", paddingTop: "10px", children: [_jsxs(Box, { component: "nav", sx: {
312
+ display: "flex",
313
+ minHeight: "2.5em",
314
+ alignItems: "center",
315
+ maxWidth: "calc(100vw - 24px - 24px)",
316
+ }, children: [_jsxs(Typography, { variant: "subtitle1", children: ["Load/Unload Cycles for ", _jsx(DisplayDateRange, { range: zoomDateRange ?? defaultDateRange })] }), _jsx(Box, { flexGrow: 1 }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, value: showGraph ? "graph" : "table", onChange: (e) => setShowGraph(e.target.value === "graph"), children: [_jsx(MenuItem, { value: "graph", children: "Graph" }, "graph"), _jsx(MenuItem, { value: "table", children: "Table" }, "table")] }) }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, displayEmpty: true, value: selectedPart
317
+ ? points.allPartAndProcNames.findIndex((o) => selectedPart.part === o.part && selectedPart.proc === o.proc)
318
+ : -1, style: { marginLeft: "1em" }, onChange: (e) => {
319
+ if (e.target.value === -1) {
320
+ setSelectedPart(undefined);
321
+ setSelectedOperation("LULOccupancy");
322
+ }
323
+ else {
324
+ setSelectedPart(e.target.value === -1 ? undefined : points.allPartAndProcNames[e.target.value]);
325
+ }
326
+ }, children: [_jsx(MenuItem, { value: -1, children: _jsx("em", { children: "Any Part" }) }, 0), points.allPartAndProcNames.map((n, idx) => (_jsx(MenuItem, { value: idx, children: _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx(PartIdenticon, { part: n.part, size: 20 }), _jsxs("span", { style: { marginRight: "1em" }, children: [n.part, "-", n.proc] })] }) }, idx)))] }) }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, displayEmpty: true, value: selectedOperation, style: { marginLeft: "1em" }, onChange: (e) => setSelectedOperation(e.target.value), children: [_jsx(MenuItem, { value: "LULOccupancy", children: "L/U Occupancy" }), selectedPart ? _jsx(MenuItem, { value: "LoadOp", children: "Load Operation (estimated)" }) : undefined, selectedPart ? _jsx(MenuItem, { value: "UnloadOp", children: "Unload Operation (estimated)" }) : undefined] }) }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, displayEmpty: true, value: selectedLoadStation, style: { marginLeft: "1em" }, onChange: (e) => {
327
+ setSelectedLoadStation(e.target.value);
328
+ }, children: [_jsx(MenuItem, { value: FilterAnyLoadKey, children: _jsx("em", { children: "Any Station" }) }, -1), points.allLoadStationNames.map((n) => (_jsx(MenuItem, { value: n, children: _jsx("div", { style: { display: "flex", alignItems: "center" }, children: _jsx("span", { style: { marginRight: "1em" }, children: n }) }) }, n)))] }) }), _jsx(FormControl, { size: "small", children: _jsxs(Select, { autoWidth: true, displayEmpty: true, value: selectedPallet || "", style: { marginLeft: "1em" }, onChange: (e) => setSelectedPallet(e.target.value === "" ? undefined : e.target.value), children: [_jsx(MenuItem, { value: "", children: _jsx("em", { children: "Any Pallet" }) }, 0), points.allPalletNames.map((n) => (_jsx(MenuItem, { value: n, children: _jsx("div", { style: { display: "flex", alignItems: "center" }, children: _jsx("span", { style: { marginRight: "1em" }, children: n }) }) }, n)))] }) }), points.data.size > 0 ? (_jsx(Tooltip, { title: "Copy to Clipboard", children: _jsx(IconButton, { onClick: () => copyCyclesToClipboard(points, matSummary.matsById, zoomDateRange, selectedOperation === "LULOccupancy"), style: { height: "25px", paddingTop: 0, paddingBottom: 0 }, size: "large", children: _jsx(ImportExport, {}) }) })) : undefined] }), _jsx("main", { children: showGraph ? (_jsx(CycleChart, { points: points.data, series_label: points.seriesLabel, default_date_range: defaultDateRange, extra_tooltip: extraLoadCycleTooltip, current_date_zoom: zoomDateRange, set_date_zoom_range: (z) => setZoomRange(z.zoom), yZoom: yZoom, setYZoom: setYZoom, stats: curOperation ? estimatedCycleTimes.get(curOperation) : undefined, plannedTimeMinutes: plannedMinutes })) : (_jsx(StationDataTable, { points: points.data, matsById: matSummary.matsById, period: period, current_date_zoom: zoomDateRange, set_date_zoom_range: (z) => setZoomRange(z.zoom), showWorkorderAndInspect: true, hideMedian: selectedOperation === "LULOccupancy", emptyMessage: selectedPart || selectedPallet
329
+ ? "No Cycles"
330
+ : "Select part, operation, or pallet to see cycles." })) })] }));
331
+ }
@@ -0,0 +1 @@
1
+ export declare function AnalysisQualityPage(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ import { 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 { addMonths, addDays, startOfToday } from "date-fns";
35
+ import { selectedAnalysisPeriod } from "../../network/load-specific-month.js";
36
+ import { InspectionSankey } from "./InspectionSankey.js";
37
+ import { last30Inspections, specificMonthInspections } from "../../cell-status/inspections.js";
38
+ import { useSetTitle } from "../routes.js";
39
+ import { useAtomValue } from "jotai";
40
+ export function AnalysisQualityPage() {
41
+ useSetTitle("Quality");
42
+ const period = useAtomValue(selectedAnalysisPeriod);
43
+ const inspectionlogs = useAtomValue(period.type === "Last30" ? last30Inspections : specificMonthInspections);
44
+ const zoomType = period.type === "Last30" ? "Last30Days" : "ZoomIntoRange";
45
+ const default_date_range = period.type === "Last30"
46
+ ? [addDays(startOfToday(), -29), addDays(startOfToday(), 1)]
47
+ : [period.month, addMonths(period.month, 1)];
48
+ return (_jsx(InspectionSankey, { subtitle: "Inspection decisions grouped by path", inspectionlogs: inspectionlogs, zoomType: zoomType, default_date_range: default_date_range }));
49
+ }
@@ -0,0 +1,3 @@
1
+ import { ReactNode } from "react";
2
+ export declare function ScheduleTable(): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ScheduleHistory(): ReactNode;
@@ -0,0 +1,108 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { useState, useMemo } from "react";
35
+ import { last30Jobs, specificMonthJobs } from "../../cell-status/scheduled-jobs.js";
36
+ import { selectedAnalysisPeriod } from "../../network/load-specific-month.js";
37
+ import { last30MaterialSummary, specificMonthMaterialSummary } from "../../cell-status/material-summary.js";
38
+ import { DataTableActions, DataTableHead, useColSort, useTablePage, useTableZoomForPeriod, } from "./DataTable.js";
39
+ import { buildScheduledJobs } from "../../data/results.schedules.js";
40
+ import { LazySeq } from "@seedtactics/immutable-collections";
41
+ import { Box, Collapse, IconButton, Table, TableBody, TableCell, Tooltip } from "@mui/material";
42
+ import { KeyboardArrowDown as KeyboardArrowDownIcon, KeyboardArrowUp as KeyboardArrowUpIcon, } from "@mui/icons-material";
43
+ import { JobDetailRow, JobTableRow } from "../operations/RecentSchedules.js";
44
+ import { JobDetails } from "../station-monitor/JobDetails.js";
45
+ import { PartIdenticon } from "../station-monitor/Material.js";
46
+ import { useSetTitle } from "../routes.js";
47
+ import { useAtomValue } from "jotai";
48
+ var ScheduleCols;
49
+ (function (ScheduleCols) {
50
+ ScheduleCols[ScheduleCols["Date"] = 0] = "Date";
51
+ ScheduleCols[ScheduleCols["Part"] = 1] = "Part";
52
+ ScheduleCols[ScheduleCols["Scheduled"] = 2] = "Scheduled";
53
+ ScheduleCols[ScheduleCols["Removed"] = 3] = "Removed";
54
+ ScheduleCols[ScheduleCols["Completed"] = 4] = "Completed";
55
+ })(ScheduleCols || (ScheduleCols = {}));
56
+ const cols = [
57
+ {
58
+ id: ScheduleCols.Date,
59
+ label: "Date",
60
+ numeric: false,
61
+ getDisplay: (j) => j.routeStartTime.toLocaleString(),
62
+ getForSort: (j) => j.routeStartTime.getTime(),
63
+ getForExport: (j) => j.routeStartTime.toISOString(),
64
+ },
65
+ { id: ScheduleCols.Part, label: "Part", numeric: false, getDisplay: (j) => j.partName },
66
+ {
67
+ id: ScheduleCols.Scheduled,
68
+ label: "Scheduled",
69
+ numeric: true,
70
+ getDisplay: (j) => j.scheduledQty.toString(),
71
+ getForSort: (j) => j.scheduledQty,
72
+ },
73
+ {
74
+ id: ScheduleCols.Removed,
75
+ label: "Removed",
76
+ numeric: true,
77
+ getDisplay: (j) => j.decrementedQty.toString(),
78
+ getForSort: (j) => j.decrementedQty,
79
+ },
80
+ {
81
+ id: ScheduleCols.Completed,
82
+ label: "Completed",
83
+ numeric: true,
84
+ getDisplay: (j) => j.completedQty.toString(),
85
+ },
86
+ ];
87
+ function JobRow({ job }) {
88
+ const [open, setOpen] = useState(false);
89
+ return (_jsxs(_Fragment, { children: [_jsxs(JobTableRow, { children: [cols.map((col) => (_jsx(TableCell, { align: col.numeric ? "right" : "left", children: col.id === ScheduleCols.Part ? (_jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [_jsx(Box, { sx: { mr: "0.2em" }, children: _jsx(PartIdenticon, { part: job.partName, size: 25 }) }), _jsx("div", { children: job.partName })] })) : (col.getDisplay(job)) }, col.id))), _jsx(TableCell, { children: _jsx(Tooltip, { title: "Show Details", children: _jsx(IconButton, { size: "small", onClick: () => setOpen(!open), children: open ? _jsx(KeyboardArrowUpIcon, {}) : _jsx(KeyboardArrowDownIcon, {}) }) }) })] }), _jsx(JobDetailRow, { children: _jsx(TableCell, { sx: { pb: "0", pt: "0" }, colSpan: cols.length + 1, children: _jsx(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: _jsx(JobDetails, { job: job.inProcJob ? job.inProcJob : job.historicJob, checkAnalysisMonth: true }) }) }) })] }));
90
+ }
91
+ export function ScheduleTable() {
92
+ const period = useAtomValue(selectedAnalysisPeriod);
93
+ const tpage = useTablePage();
94
+ const zoom = useTableZoomForPeriod(period);
95
+ const sort = useColSort(ScheduleCols.Date, cols);
96
+ const matIds = useAtomValue(period.type === "Last30" ? last30MaterialSummary : specificMonthMaterialSummary);
97
+ const schJobs = useAtomValue(period.type === "Last30" ? last30Jobs : specificMonthJobs);
98
+ const jobs = useMemo(() => buildScheduledJobs(zoom.zoomRange, matIds.matsById, schJobs, null), [zoom, matIds.matsById, schJobs]);
99
+ const page = useMemo(() => LazySeq.of(jobs)
100
+ .sortBy(sort.sortOn)
101
+ .drop(tpage.page * tpage.rowsPerPage)
102
+ .take(tpage.rowsPerPage), [jobs, sort, tpage]);
103
+ return (_jsxs("div", { children: [_jsxs(Table, { stickyHeader: true, children: [_jsx(DataTableHead, { columns: cols, sort: sort, showDetailsCol: true, copyToClipboardRows: jobs }), _jsx(TableBody, { children: page.map((j, jIdx) => (_jsx(JobRow, { job: j }, j.historicJob?.unique ?? j.inProcJob?.unique ?? jIdx))) })] }), _jsx(DataTableActions, { tpage: tpage, zoom: zoom.zoom, count: jobs.length })] }));
104
+ }
105
+ export function ScheduleHistory() {
106
+ useSetTitle("Scheduled Jobs");
107
+ return (_jsx(_Fragment, { children: _jsx("main", { style: { padding: "24px" }, children: _jsx(ScheduleTable, {}) }) }));
108
+ }