@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,312 @@
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, memo, useCallback } from "react";
35
+ import { Table, Box } from "@mui/material";
36
+ import { styled } from "@mui/material/styles";
37
+ import { TableHead } from "@mui/material";
38
+ import { TableCell } from "@mui/material";
39
+ import { TableRow } from "@mui/material";
40
+ import { TableBody } from "@mui/material";
41
+ import { Button } from "@mui/material";
42
+ import { Tooltip } from "@mui/material";
43
+ import { Typography } from "@mui/material";
44
+ import { Dialog } from "@mui/material";
45
+ import { DialogTitle } from "@mui/material";
46
+ import { DialogContent } from "@mui/material";
47
+ import { TextField } from "@mui/material";
48
+ import { DialogActions } from "@mui/material";
49
+ import { Fab } from "@mui/material";
50
+ import { IconButton } from "@mui/material";
51
+ import { CircularProgress } from "@mui/material";
52
+ import { Add as AddIcon, AssignmentReturn as AssignIcon, KeyboardArrowDown as KeyboardArrowDownIcon, Edit as EditIcon, KeyboardArrowUp as KeyboardArrowUpIcon, } from "@mui/icons-material";
53
+ import { SortableInProcMaterial, PartIdenticon, MultiMaterial, InProcMaterial, DragOverlayInProcMaterial, MaterialDialog, } from "./Material.js";
54
+ import * as api from "../../network/api.js";
55
+ import { selectQueueData, extractJobRawMaterial } from "../../data/queue-material.js";
56
+ import { LazySeq } from "@seedtactics/immutable-collections";
57
+ import { currentOperator } from "../../data/operators.js";
58
+ import { JobDetails } from "./JobDetails.js";
59
+ import { fmsInformation } from "../../network/server-settings.js";
60
+ import { addWorkorderComment, currentStatus, setJobComment } from "../../cell-status/current-status.js";
61
+ import { Collapse } from "@mui/material";
62
+ import { inProcessQueues, rawMaterialQueues } from "../../cell-status/names.js";
63
+ import { SortableRegion } from "./Whiteboard.js";
64
+ import { useSetTitle } from "../routes.js";
65
+ import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
66
+ import { bulkAddCastingToQueue, BulkAddCastingWithoutSerialDialog, MultiMaterialDialog, } from "./BulkRawMaterial.js";
67
+ import { AddBySerialDialog, enterSerialForNewMaterialDialog } from "../ManualSerialEntry.js";
68
+ import { materialDialogOpen } from "../../cell-status/material-details.js";
69
+ import { PrintLabelButton } from "./PrintedLabel.js";
70
+ import { AddToQueueButton, AddToQueueMaterialDialogCt } from "./QueuesAddMaterial.js";
71
+ import { QuarantineMatButton } from "./QuarantineButton.js";
72
+ import { AddByBarcodeDialog, scanBarcodeToAddToQueueDialog } from "../BarcodeScanning.js";
73
+ import { InvalidateCycleDialogButton, InvalidateCycleDialogContent, } from "./InvalidateCycle.js";
74
+ const JobTableRow = styled(TableRow, { shouldForwardProp: (prop) => prop.toString()[0] !== "$" })(({ $noBorderBottom, $highlightedRow, $noncompletedRow }) => ({
75
+ ...($noBorderBottom && {
76
+ "& > *": {
77
+ borderBottom: "unset",
78
+ },
79
+ }),
80
+ backgroundColor: $highlightedRow ? "#FF8A65" : $noncompletedRow ? "#E0E0E0" : undefined,
81
+ }));
82
+ const highlightedComments = [/\bhold\b/, /\bmissing\b/, /\bwait\b/, /\bwaiting\b/, /\bnone\b/];
83
+ function highlightRow(j) {
84
+ const comment = j.comment;
85
+ if (!comment || comment === "")
86
+ return false;
87
+ return LazySeq.of(highlightedComments).some((r) => r.test(comment));
88
+ }
89
+ function RawMaterialJobRow(props) {
90
+ const allowEditQty = (useAtomValue(fmsInformation).allowEditJobPlanQuantityFromQueuesPage ?? null) != null;
91
+ const [open, setOpen] = useState(false);
92
+ const j = props.job;
93
+ const highlRow = highlightRow(j.job);
94
+ return (_jsxs(_Fragment, { children: [_jsxs(JobTableRow, { "$noBorderBottom": true, "$highlightedRow": highlRow, "$noncompletedRow": j.remainingToStart - j.assignedRaw > 0, children: [_jsx(TableCell, { children: _jsxs(Box, { sx: {
95
+ display: "flex",
96
+ alignItems: "center",
97
+ }, children: [_jsx(Box, { sx: { mr: "0.2em" }, children: _jsx(PartIdenticon, { part: j.job.partName, size: 25 }) }), _jsx("div", { children: _jsx(Typography, { variant: "body2", component: "span", display: "block", children: j.job.unique }) })] }) }), _jsx(TableCell, { children: j.startingTime ? j.startingTime.toLocaleString() : "" }), _jsx(TableCell, { children: j.rawMatName === j.job.partName ? (j.rawMatName) : (_jsxs(Box, { sx: {
98
+ display: "flex",
99
+ alignItems: "center",
100
+ }, children: [_jsx(Box, { sx: { mr: "0.2em" }, children: _jsx(PartIdenticon, { part: j.rawMatName, size: 25 }) }), _jsx(Typography, { variant: "body2", display: "block", children: j.rawMatName })] })) }), _jsxs(TableCell, { children: [j.job.comment, _jsx(Tooltip, { title: "Edit", children: _jsx(IconButton, { size: "small", onClick: () => props.editNote(j.job), children: _jsx(EditIcon, {}) }) })] }), _jsxs(TableCell, { align: "right", children: [j.job.cycles ?? 0, allowEditQty ? (_jsx(Tooltip, { title: "Edit", children: _jsx(IconButton, { size: "small", onClick: () => props.editQty(j), children: _jsx(EditIcon, {}) }) })) : undefined] }), _jsx(TableCell, { align: "right", children: j.remainingToStart }), _jsx(TableCell, { align: "right", children: j.assignedRaw }), _jsx(TableCell, { align: "right", children: _jsx(Tooltip, { title: j.remainingToStart > 0 || j.assignedRaw > 0 ? `${j.remainingToStart} - ${j.assignedRaw}` : "", children: _jsx("span", { children: Math.max(j.remainingToStart - j.assignedRaw, 0) }) }) }), _jsx(TableCell, { align: "right", children: j.availableUnassigned }), _jsx(TableCell, { children: _jsx(Tooltip, { title: "Show Details", children: _jsx(IconButton, { size: "small", onClick: () => setOpen(!open), children: open ? _jsx(KeyboardArrowUpIcon, {}) : _jsx(KeyboardArrowDownIcon, {}) }) }) })] }), _jsx(JobTableRow, { "$highlightedRow": highlRow, "$noncompletedRow": j.remainingToStart - j.assignedRaw > 0, children: _jsx(TableCell, { sx: { pb: "0", pt: "0" }, colSpan: 10, children: _jsx(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: _jsx(JobDetails, { job: j.job, checkAnalysisMonth: false }) }) }) })] }));
101
+ }
102
+ function RawMaterialJobTable(props) {
103
+ const currentSt = useAtomValue(currentStatus);
104
+ const jobs = useMemo(() => extractJobRawMaterial(currentSt.jobs, currentSt.material, props.queue), [currentSt, props.queue]);
105
+ if (jobs.length === 0)
106
+ return null;
107
+ return (_jsxs(Table, { size: "small", children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Job" }), _jsx(TableCell, { children: "Starting Time" }), _jsx(TableCell, { children: "Material" }), _jsx(TableCell, { children: "Note" }), _jsx(TableCell, { align: "right", children: "Planned Quantity" }), _jsx(TableCell, { align: "right", children: "Remaining To Start" }), _jsx(TableCell, { align: "right", children: "Assigned Raw Material" }), _jsx(TableCell, { align: "right", children: "Required" }), _jsx(TableCell, { align: "right", children: "Available Unassigned" }), _jsx(TableCell, {})] }) }), _jsx(TableBody, { children: jobs.map((j, idx) => (_jsx(RawMaterialJobRow, { job: j, editNote: props.editNote, editQty: props.editQty }, idx))) })] }));
108
+ }
109
+ const RawMaterialWorkorderRow = memo(function RawMaterialWorkorderRow({ workorder, inProc, }) {
110
+ const setDialog = useSetAtom(workorderCommentDialogAtom);
111
+ return (_jsxs(TableRow, { children: [_jsx(TableCell, { children: workorder.workorderId }), _jsx(TableCell, { children: _jsxs(Box, { sx: {
112
+ display: "flex",
113
+ alignItems: "center",
114
+ }, children: [_jsx(Box, { sx: { mr: "0.2em" }, children: _jsx(PartIdenticon, { part: workorder.part, size: 25 }) }), _jsx(Typography, { variant: "body2", display: "block", children: workorder.part })] }) }), _jsxs(TableCell, { children: [workorder.comments && workorder.comments.length > 0
115
+ ? workorder.comments[workorder.comments.length - 1].comment
116
+ : "", _jsx(Tooltip, { title: "Edit", children: _jsx(IconButton, { size: "small", onClick: () => setDialog(workorder), children: _jsx(EditIcon, {}) }) })] }), _jsx(TableCell, { children: workorder.dueDate.toLocaleDateString() }), _jsx(TableCell, { children: workorder.priority }), _jsx(TableCell, { children: workorder.plannedQuantity }), _jsx(TableCell, { children: workorder.completedQuantity }), _jsx(TableCell, { children: inProc }), _jsx(TableCell, { children: Math.max(0, workorder.plannedQuantity - workorder.completedQuantity - inProc) })] }));
117
+ });
118
+ const RawMaterialWorkorderTable = memo(function RawMaterialWorkorderTable() {
119
+ const curSt = useAtomValue(currentStatus);
120
+ if (!curSt.workorders || curSt.workorders.length === 0)
121
+ return null;
122
+ const sorted = LazySeq.of(curSt.workorders).sortBy((w) => w.dueDate.getTime(), (w) => w.priority);
123
+ const inProcByWorkorder = LazySeq.of(curSt.material)
124
+ .filter((m) => !!m.workorderId && m.workorderId !== "")
125
+ .toLookupMap((m) => m.workorderId ?? "", (m) => m.partName, () => 1, (a, b) => a + b);
126
+ return (_jsxs(Table, { size: "small", children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Workorder" }), _jsx(TableCell, { children: "Part" }), _jsx(TableCell, { children: "Comment" }), _jsx(TableCell, { children: "Due Date" }), _jsx(TableCell, { children: "Priority" }), _jsx(TableCell, { children: "Planned Qty" }), _jsx(TableCell, { children: "Completed Qty" }), _jsx(TableCell, { children: "In Process" }), _jsx(TableCell, { children: "Remaining To Assign" })] }) }), _jsx(TableBody, { children: sorted.map((w) => (_jsx(RawMaterialWorkorderRow, { workorder: w, inProc: inProcByWorkorder.get(w.workorderId)?.get(w.part) ?? 0 }, `${w.workorderId}-${w.part}`))) })] }));
127
+ });
128
+ export const EditNoteDialog = memo(function EditNoteDialog(props) {
129
+ const [note, setNote] = useState(null);
130
+ const setComment = useSetAtom(setJobComment);
131
+ function close() {
132
+ props.closeDialog();
133
+ setNote(null);
134
+ }
135
+ function save() {
136
+ if (note === null || props.job === null || note === props.job.comment)
137
+ return;
138
+ setComment(props.job.unique, note);
139
+ close();
140
+ }
141
+ return (_jsx(Dialog, { open: props.job !== null, onClose: close, children: props.job !== null ? (_jsxs(_Fragment, { children: [_jsx(DialogTitle, { children: _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx("div", { children: _jsx(PartIdenticon, { part: props.job.partName, size: 40 }) }), _jsxs("div", { style: { marginLeft: "1em", flexGrow: 1 }, children: ["Edit Note For ", props.job.unique] })] }) }), _jsx(DialogContent, { children: _jsx(TextField, { variant: "outlined", fullWidth: true, autoFocus: true, value: note === null ? props.job.comment || "" : note, onChange: (e) => setNote(e.target.value), onKeyDown: (e) => {
142
+ if (e.keyCode === 13 && note !== null) {
143
+ save();
144
+ e.preventDefault();
145
+ }
146
+ } }) }), _jsxs(DialogActions, { children: [_jsx(Button, { color: "primary", disabled: note === null, onClick: save, children: "Save Note" }), _jsx(Button, { color: "primary", onClick: close, children: "Cancel" })] })] })) : undefined }));
147
+ });
148
+ const EditJobPlanQtyDialog = memo(function EditJobPlanQtyProps(props) {
149
+ const [running, setRunning] = useState(false);
150
+ const [newQty, setNewQty] = useState(null);
151
+ const allowEditQtyUrl = useAtomValue(fmsInformation).allowEditJobPlanQuantityFromQueuesPage ?? null;
152
+ function close() {
153
+ if (running)
154
+ return;
155
+ props.closeDialog();
156
+ setNewQty(null);
157
+ }
158
+ async function setQty() {
159
+ if (allowEditQtyUrl === null || props.job === null || newQty == null || isNaN(newQty)) {
160
+ return;
161
+ }
162
+ setRunning(true);
163
+ try {
164
+ await fetch(allowEditQtyUrl, {
165
+ method: "PUT",
166
+ headers: new Headers({
167
+ "Content-Type": "application/json",
168
+ }),
169
+ body: JSON.stringify({
170
+ Unique: props.job.job.unique,
171
+ Quantity: newQty,
172
+ }),
173
+ });
174
+ props.closeDialog();
175
+ setNewQty(null);
176
+ }
177
+ finally {
178
+ setRunning(false);
179
+ }
180
+ }
181
+ return (_jsx(Dialog, { open: allowEditQtyUrl != null && props.job !== null, onClose: close, children: props.job !== null ? (_jsxs(_Fragment, { children: [_jsx(DialogTitle, { children: _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx("div", { children: _jsx(PartIdenticon, { part: props.job.job.partName, size: 40 }) }), _jsxs("div", { style: { marginLeft: "1em", flexGrow: 1 }, children: ["Edit Planned Quantity For ", props.job.job.unique] })] }) }), _jsxs(DialogContent, { children: [_jsxs("p", { children: [props.job.job.cycles, " currently planned, ", props.job.remainingToStart, " remaining to start"] }), _jsx(TextField, { variant: "outlined", fullWidth: true, autoFocus: true, inputProps: {
182
+ style: { textAlign: "right" },
183
+ min: (props.job.job.cycles ?? 0) - props.job.remainingToStart,
184
+ }, type: "number", value: newQty === null ? "" : newQty, onChange: (e) => setNewQty(parseInt(e.target.value)) })] }), _jsxs(DialogActions, { children: [_jsxs(Button, { color: "primary", disabled: running || newQty === null || isNaN(newQty), onClick: () => void setQty(), children: [running ? _jsx(CircularProgress, { size: 10 }) : undefined, "Set Quantity"] }), _jsx(Button, { color: "primary", disabled: running, onClick: close, children: "Cancel" })] })] })) : undefined }));
185
+ });
186
+ const workorderCommentDialogAtom = atom(null);
187
+ function WorkorderCommentDialog() {
188
+ const [workorder, setWorkorder] = useAtom(workorderCommentDialogAtom);
189
+ const [comment, setComment] = useState(null);
190
+ const addComment = useSetAtom(addWorkorderComment);
191
+ function close() {
192
+ setWorkorder(null);
193
+ setComment(null);
194
+ }
195
+ function save() {
196
+ if (workorder && comment && comment !== "") {
197
+ addComment({ workorder: workorder.workorderId, comment: comment });
198
+ }
199
+ close();
200
+ }
201
+ return (_jsx(Dialog, { open: workorder !== null, onClose: close, children: workorder !== null ? (_jsxs(_Fragment, { children: [_jsx(DialogTitle, { children: _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx("div", { children: _jsx(PartIdenticon, { part: workorder.part, size: 40 }) }), _jsxs("div", { style: { marginLeft: "1em", flexGrow: 1 }, children: ["Add Comment For ", workorder.workorderId] })] }) }), _jsxs(DialogContent, { children: [_jsx("ul", { children: (workorder.comments ?? []).map((c, idx) => (_jsx("li", { children: _jsxs(Typography, { variant: "body1", children: [c.timeUTC.toLocaleString(), ": ", c.comment] }) }, idx))) }), _jsx(TextField, { variant: "outlined", sx: { mt: "1em" }, fullWidth: true, autoFocus: true, value: comment, onChange: (e) => setComment(e.target.value), onKeyDown: (e) => {
202
+ if (e.key === "Enter" && comment !== null && comment !== "") {
203
+ save();
204
+ e.preventDefault();
205
+ }
206
+ } })] }), _jsxs(DialogActions, { children: [_jsx(Button, { color: "primary", onClick: save, children: "Save Comment" }), _jsx(Button, { color: "primary", onClick: close, children: "Cancel" })] })] })) : undefined }));
207
+ }
208
+ const AddMaterialButtons = memo(function AddMaterialButtons(props) {
209
+ const fmsInfo = useAtomValue(fmsInformation);
210
+ const setBulkAddCastings = useSetAtom(bulkAddCastingToQueue);
211
+ const setAddBySerial = useSetAtom(enterSerialForNewMaterialDialog);
212
+ const setAddByBarcode = useSetAtom(scanBarcodeToAddToQueueDialog);
213
+ if (!fmsInfo.addToQueueButton || fmsInfo.addToQueueButton === api.AddToQueueButton.DoNotShow) {
214
+ return null;
215
+ }
216
+ function click() {
217
+ switch (fmsInfo.addToQueueButton) {
218
+ case api.AddToQueueButton.DoNotShow:
219
+ return;
220
+ case api.AddToQueueButton.AddBulkUnassigned:
221
+ if (props.rawMatQueue) {
222
+ setBulkAddCastings(props.label);
223
+ }
224
+ else {
225
+ setAddBySerial(props.label);
226
+ }
227
+ break;
228
+ case api.AddToQueueButton.LookupExistingSerial:
229
+ setAddBySerial(props.label);
230
+ return;
231
+ case api.AddToQueueButton.ManualBarcodeScan:
232
+ setAddByBarcode(props.label);
233
+ return;
234
+ }
235
+ }
236
+ if (props.rawMatQueue) {
237
+ return (_jsx(Tooltip, { title: "Add Raw Material", children: _jsx(Fab, { color: "secondary", onClick: click, size: "large", style: { marginBottom: "-30px", zIndex: 1 }, children: _jsx(AddIcon, {}) }) }));
238
+ }
239
+ else if (props.inProcQueue) {
240
+ return (_jsx(Tooltip, { title: "Add Material", children: _jsx(Fab, { color: "secondary", onClick: click, size: "medium", style: { marginBottom: "-30px", zIndex: 1 }, children: _jsx(AssignIcon, { fontSize: "inherit" }) }) }));
241
+ }
242
+ else {
243
+ return null;
244
+ }
245
+ });
246
+ function usePossibleQueuesForAdd(queueNames) {
247
+ const toShow = useAtomValue(materialDialogOpen);
248
+ if (toShow && toShow.type === "AddMatWithEnteredSerial") {
249
+ if (queueNames.includes(toShow.toQueue)) {
250
+ return [toShow.toQueue];
251
+ }
252
+ else {
253
+ return [];
254
+ }
255
+ }
256
+ else if (toShow && toShow.type === "Barcode" && toShow.toQueue) {
257
+ if (queueNames.includes(toShow.toQueue)) {
258
+ return [toShow.toQueue];
259
+ }
260
+ else {
261
+ return [];
262
+ }
263
+ }
264
+ else {
265
+ return queueNames;
266
+ }
267
+ }
268
+ const QueuedMaterialDialog = memo(function QueuedMaterialDialog({ queueNames, }) {
269
+ const [addMatSt, setAddMatSt] = useState({
270
+ toQueue: null,
271
+ enteredOperator: null,
272
+ newMaterialTy: null,
273
+ });
274
+ const [invalidateSt, setInvalidateSt] = useState(null);
275
+ const onClose = useCallback(() => {
276
+ setAddMatSt({ toQueue: null, enteredOperator: null, newMaterialTy: null });
277
+ setInvalidateSt(null);
278
+ }, []);
279
+ queueNames = usePossibleQueuesForAdd(queueNames);
280
+ return (_jsx(MaterialDialog, { allowNote: true, onClose: onClose, highlightProcsGreaterOrEqualTo: invalidateSt?.process ?? undefined, extraDialogElements: _jsxs(_Fragment, { children: [_jsx(InvalidateCycleDialogContent, { st: invalidateSt, setState: setInvalidateSt }), _jsx(AddToQueueMaterialDialogCt, { queueNames: queueNames, st: addMatSt, setState: setAddMatSt })] }), buttons: _jsxs(_Fragment, { children: [_jsx(PrintLabelButton, {}), _jsx(QuarantineMatButton, { onClose: onClose }), _jsx(InvalidateCycleDialogButton, { onClose: onClose, st: invalidateSt, setState: setInvalidateSt }), _jsx(AddToQueueButton, { st: addMatSt, queueNames: queueNames, onClose: onClose })] }) }));
281
+ });
282
+ export const Queues = (props) => {
283
+ const operator = useAtomValue(currentOperator);
284
+ const currentSt = useAtomValue(currentStatus);
285
+ const rawMatQueues = useAtomValue(rawMaterialQueues);
286
+ const inProcQueues = useAtomValue(inProcessQueues);
287
+ const data = useMemo(() => selectQueueData(props.queues, currentSt, rawMatQueues, inProcQueues), [currentSt, props.queues, rawMatQueues, inProcQueues]);
288
+ const hasJobs = !LazySeq.ofObject(currentSt.jobs).isEmpty();
289
+ const [changeNoteForJob, setChangeNoteForJob] = useState(null);
290
+ const closeChangeNoteDialog = useCallback(() => setChangeNoteForJob(null), []);
291
+ const [editQtyForJob, setEditQtyForJob] = useState(null);
292
+ const closeEditJobQtyDialog = useCallback(() => setEditQtyForJob(null), []);
293
+ const [multiMaterialDialog, setMultiMaterialDialog] = useState(null);
294
+ const closeMultiMatDialog = useCallback(() => setMultiMaterialDialog(null), []);
295
+ return (_jsxs(Box, { sx: {
296
+ padding: "8px",
297
+ width: "100%",
298
+ }, children: [data.map((region, idx) => (_jsx("div", { style: idx < data.length - 1 ? { borderBottom: "1px solid black" } : undefined, children: _jsx(SortableRegion, { matIds: region.material.map((m) => m.materialID), direction: "rect", queueName: region.label, renderDragOverlay: (mat) => (_jsx(DragOverlayInProcMaterial, { mat: mat, hideEmptySerial: true, displayJob: hasJobs && region.rawMaterialQueue, fsize: "normal" })), children: _jsxs(Box, { minHeight: "134px", children: [_jsxs(Box, { display: "flex", margin: "4px", children: [_jsx(Typography, { variant: "h4", flexGrow: 1, children: region.label }), region.free ? undefined : (_jsx(AddMaterialButtons, { label: region.label, rawMatQueue: region.rawMaterialQueue, inProcQueue: region.inProcQueue }))] }), _jsxs(Box, { justifyContent: "flex-start", display: "flex", flexWrap: "wrap", children: [region.material.map((m, matIdx) => (_jsx(SortableInProcMaterial, { mat: m, hideEmptySerial: true, fsize: "normal", displayJob: hasJobs && region.rawMaterialQueue }, matIdx))), region.groupedRawMat && region.groupedRawMat.length > 0
299
+ ? region.groupedRawMat.map((matGroup, idx) => matGroup.material.length === 1 ? (_jsx(InProcMaterial, { mat: matGroup.material[0], hideEmptySerial: true, fsize: "normal", displayJob: hasJobs && region.rawMaterialQueue }, idx)) : (_jsx(MultiMaterial, { partOrCasting: matGroup.partOrCasting, assignedJobUnique: matGroup.assignedJobUnique, material: matGroup.material, fsize: "normal", onOpen: () => setMultiMaterialDialog(matGroup.material) }, idx)))
300
+ : undefined, region.rawMaterialQueue ? (hasJobs ? (_jsx(RawMaterialJobTable, { queue: region.label, editNote: setChangeNoteForJob, editQty: setEditQtyForJob })) : (_jsx(RawMaterialWorkorderTable, {}))) : undefined] })] }) }) }, idx))), _jsx(QueuedMaterialDialog, { queueNames: props.queues }), _jsx(AddBySerialDialog, {}), _jsx(AddByBarcodeDialog, {}), _jsx(BulkAddCastingWithoutSerialDialog, {}), _jsx(EditNoteDialog, { job: changeNoteForJob, closeDialog: closeChangeNoteDialog }), _jsx(EditJobPlanQtyDialog, { job: editQtyForJob, closeDialog: closeEditJobQtyDialog }), _jsx(WorkorderCommentDialog, {}), _jsx(MultiMaterialDialog, { material: multiMaterialDialog, closeDialog: closeMultiMatDialog, operator: operator })] }));
301
+ };
302
+ export default function QueuesPage(props) {
303
+ useSetTitle("Queues");
304
+ return (_jsx(Box, { component: "main", sx: {
305
+ backgroundColor: "#F8F8F8",
306
+ minHeight: {
307
+ xs: "calc(100vh - 64px - 32px)",
308
+ sm: "calc(100vh - 64px - 40px)",
309
+ md: "calc(100vh - 64px)",
310
+ },
311
+ }, children: _jsx(Queues, { ...props }) }));
312
+ }
@@ -0,0 +1,30 @@
1
+ export type AddMaterialState = {
2
+ readonly toQueue: string | null;
3
+ readonly enteredOperator: string | null;
4
+ readonly newMaterialTy: NewMaterialToQueueType | null;
5
+ };
6
+ type NewMaterialToQueueType = {
7
+ readonly kind: "JobAndProc";
8
+ readonly jobUnique: string;
9
+ readonly last_proc: number;
10
+ readonly workorder: string | null;
11
+ } | {
12
+ readonly kind: "RawMat";
13
+ readonly rawMatName: string;
14
+ };
15
+ export declare function PromptForQueue({ selectedQueue, setSelectedQueue, queueNames, }: {
16
+ selectedQueue: string | null;
17
+ setSelectedQueue: (queue: string) => void;
18
+ queueNames: ReadonlyArray<string>;
19
+ }): import("react/jsx-runtime").JSX.Element;
20
+ export declare function AddToQueueMaterialDialogCt({ st, queueNames, setState, }: {
21
+ st: AddMaterialState;
22
+ queueNames: ReadonlyArray<string>;
23
+ setState: (st: AddMaterialState) => void;
24
+ }): import("react/jsx-runtime").JSX.Element | null;
25
+ export declare function AddToQueueButton({ st: { enteredOperator, newMaterialTy, toQueue }, queueNames, onClose, }: {
26
+ st: AddMaterialState;
27
+ queueNames: ReadonlyArray<string>;
28
+ onClose: () => void;
29
+ }): import("react/jsx-runtime").JSX.Element | null;
30
+ export {};
@@ -0,0 +1,248 @@
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 { useState, Fragment, useEffect, useRef } from "react";
35
+ import { Button, Collapse, List, ListItem, ListItemButton, ListItemIcon, ListItemText, TextField, Tooltip, Typography, styled, } from "@mui/material";
36
+ import { ExpandMore as ExpandMoreIcon } from "@mui/icons-material";
37
+ import { PartIdenticon, WorkorderFromBarcode } from "./Material.js";
38
+ import * as api from "../../network/api.js";
39
+ import * as matDetails from "../../cell-status/material-details.js";
40
+ import { usePossibleNewMaterialTypes, } from "../../data/queue-material.js";
41
+ import { currentOperator } from "../../data/operators.js";
42
+ import { fmsInformation } from "../../network/server-settings.js";
43
+ import { useAddNewCastingToQueue } from "../../cell-status/material-details.js";
44
+ import { useAtomValue, useSetAtom } from "jotai";
45
+ function useAllowAddToQueue(queueNames) {
46
+ const existingMat = useAtomValue(matDetails.materialInDialogInfo);
47
+ const inProcMat = useAtomValue(matDetails.inProcessMaterialInDialog);
48
+ const possibleNewMats = useAtomValue(matDetails.barcodePotentialNewMaterial);
49
+ const curInQueueOnScreen = inProcMat !== null &&
50
+ inProcMat.location.type === api.LocType.InQueue &&
51
+ inProcMat.location.currentQueue &&
52
+ queueNames.includes(inProcMat.location.currentQueue);
53
+ if (curInQueueOnScreen)
54
+ return false;
55
+ if (inProcMat?.location.type === api.LocType.OnPallet)
56
+ return false;
57
+ if (inProcMat?.action.type === api.ActionType.Loading)
58
+ return false;
59
+ if (existingMat === null && !possibleNewMats) {
60
+ return false;
61
+ }
62
+ return true;
63
+ }
64
+ const ExpandMore = styled(ExpandMoreIcon, { shouldForwardProp: (prop) => prop.toString()[0] !== "$" })(({ theme, $expandedOpen }) => ({
65
+ transform: $expandedOpen ? "rotate(0deg)" : "rotate(-90deg)",
66
+ transition: theme.transitions.create("transform", {
67
+ duration: theme.transitions.duration.shortest,
68
+ }),
69
+ }));
70
+ function SelectRawMaterial({ newMaterialTy, setNewMaterialTy, castings, indent, }) {
71
+ return (_jsx(List, { sx: indent ? (theme) => ({ pl: theme.spacing(4) }) : undefined, children: castings.map((casting) => (_jsx(ListItem, { children: _jsxs(ListItemButton, { selected: newMaterialTy?.kind === "RawMat" && newMaterialTy?.rawMatName === casting.casting, onClick: () => setNewMaterialTy({ kind: "RawMat", rawMatName: casting.casting }), children: [_jsx(ListItemIcon, { children: _jsx(PartIdenticon, { part: casting.casting }) }), _jsx(ListItemText, { primary: casting.casting, primaryTypographyProps: { variant: "h4" }, secondary: casting.message ?? undefined })] }) }, casting.casting))) }));
72
+ }
73
+ function SelectJob({ newMaterialTy, setNewMaterialTy, curCollapse, setCurCollapse, indent, jobs, }) {
74
+ return (_jsx(List, { sx: indent ? (theme) => ({ pl: theme.spacing(4) }) : undefined, children: jobs.map((j, idx) => j.machinedProcs.length === 1 ? (_jsx("div", { children: _jsx(ListItem, { children: _jsxs(ListItemButton, { alignItems: "flex-start", selected: newMaterialTy?.kind === "JobAndProc" &&
75
+ newMaterialTy?.jobUnique === j.jobUnique &&
76
+ newMaterialTy?.last_proc === j.machinedProcs[0].lastProc, onClick: () => setNewMaterialTy({
77
+ kind: "JobAndProc",
78
+ jobUnique: j.jobUnique,
79
+ last_proc: j.machinedProcs[0].lastProc,
80
+ workorder: j.workorder,
81
+ }), children: [j.job ? (_jsx(ListItemIcon, { children: _jsx(PartIdenticon, { part: j.job.partName }) })) : undefined, _jsx(ListItemText, { primary: (j.job?.partName ?? "") + " (" + j.jobUnique + ")", slotProps: { primary: { variant: "h4" } }, secondary: _jsxs(Typography, { variant: "body2", children: [j.machinedProcs[0].lastProc === 0
82
+ ? "Raw Material"
83
+ : "Last machined process " + j.machinedProcs[0].lastProc.toString(), ", ", j.job?.routeStartUTC.toLocaleDateString() ?? "", ", ", j.machinedProcs[0].details] }) })] }) }) }, idx)) : (_jsxs(Fragment, { children: [_jsx(ListItem, { children: _jsxs(ListItemButton, { onClick: () => {
84
+ if (newMaterialTy)
85
+ setNewMaterialTy(null);
86
+ setCurCollapse(curCollapse && curCollapse.kind === "Job" && curCollapse.unique === j.jobUnique
87
+ ? null
88
+ : { kind: "Job", unique: j.jobUnique });
89
+ }, children: [_jsx(ListItemIcon, { children: _jsx(ExpandMore, { "$expandedOpen": curCollapse !== null && curCollapse.kind === "Job" && curCollapse.unique === j.jobUnique }) }), j.job ? (_jsx(ListItemIcon, { children: _jsx(PartIdenticon, { part: j.job.partName }) })) : undefined, _jsx(ListItemText, { primary: (j.job?.partName ?? "") + " (" + j.jobUnique + ")", slotProps: { primary: { variant: "h4" } }, secondary: j.job?.routeStartUTC.toLocaleDateString() })] }) }), _jsx(Collapse, { in: curCollapse !== null && curCollapse.kind === "Job" && curCollapse.unique === j.jobUnique, timeout: "auto", children: j.machinedProcs.map((p, idx) => (_jsx("div", { children: _jsx(ListItem, { sx: (theme) => ({ pl: theme.spacing(indent ? 8 : 4) }), children: _jsx(ListItemButton, { selected: newMaterialTy?.kind === "JobAndProc" &&
90
+ newMaterialTy?.jobUnique === j.jobUnique &&
91
+ newMaterialTy?.last_proc === p.lastProc, onClick: () => setNewMaterialTy({
92
+ kind: "JobAndProc",
93
+ jobUnique: j.jobUnique,
94
+ last_proc: p.lastProc,
95
+ workorder: j.workorder,
96
+ }), children: _jsx(ListItemText, { primary: p.lastProc === 0 ? "Raw Material" : "Last machined process " + p.lastProc.toString(), secondary: p.details }) }) }) }, idx))) })] }, idx))) }));
97
+ }
98
+ function SelectRawMatAndJob({ newMaterialTy, options, setNewMaterialTy, curCollapse, setCurCollapse, }) {
99
+ return (_jsxs(List, { children: [_jsx(ListItem, { children: _jsxs(ListItemButton, { onClick: () => {
100
+ if (newMaterialTy)
101
+ setNewMaterialTy(null);
102
+ setCurCollapse(curCollapse && curCollapse.kind === "RawMat" ? null : { kind: "RawMat" });
103
+ }, children: [_jsx(ListItemIcon, { children: _jsx(ExpandMore, { "$expandedOpen": curCollapse !== null && curCollapse.kind === "RawMat" }) }), _jsx(ListItemText, { primary: "Raw Material" })] }) }), _jsx(Collapse, { in: curCollapse !== null && curCollapse.kind === "RawMat", timeout: "auto", children: _jsx(SelectRawMaterial, { castings: options.castings, newMaterialTy: newMaterialTy, setNewMaterialTy: setNewMaterialTy, indent: true }) }), _jsx(ListItem, { children: _jsxs(ListItemButton, { onClick: () => {
104
+ if (newMaterialTy)
105
+ setNewMaterialTy(null);
106
+ setCurCollapse(curCollapse && (curCollapse.kind === "AllJobs" || curCollapse.kind === "Job")
107
+ ? null
108
+ : { kind: "AllJobs" });
109
+ }, children: [_jsx(ListItemIcon, { children: _jsx(ExpandMore, { "$expandedOpen": curCollapse !== null && (curCollapse.kind === "AllJobs" || curCollapse.kind === "Job") }) }), _jsx(ListItemText, { primary: "Specify Job" })] }) }), _jsx(Collapse, { in: curCollapse !== null && (curCollapse.kind === "AllJobs" || curCollapse.kind === "Job"), timeout: "auto", children: _jsx(SelectJob, { newMaterialTy: newMaterialTy, jobs: options.jobs, setNewMaterialTy: setNewMaterialTy, curCollapse: curCollapse, setCurCollapse: setCurCollapse, indent: true }) })] }));
110
+ }
111
+ function PromptForMaterialType({ newMaterialTy, setNewMaterialTy, toQueue, }) {
112
+ const serial = useAtomValue(matDetails.serialInMaterialDialog);
113
+ const existingMat = useAtomValue(matDetails.materialInDialogInfo);
114
+ const [curCollapse, setCurCollapse] = useState(null);
115
+ const materialTypes = usePossibleNewMaterialTypes(toQueue);
116
+ if (existingMat)
117
+ return null;
118
+ if (serial === null)
119
+ return null;
120
+ if (toQueue === null)
121
+ return null;
122
+ if (materialTypes.castings.length === 0 && materialTypes.jobs.length === 0) {
123
+ return _jsxs("div", { children: ["No jobs are currently scheduled for ", toQueue] });
124
+ }
125
+ if (materialTypes.jobs.length === 0) {
126
+ return (_jsx(SelectRawMaterial, { newMaterialTy: newMaterialTy, setNewMaterialTy: setNewMaterialTy, castings: materialTypes.castings }));
127
+ }
128
+ if (materialTypes.castings.length === 0) {
129
+ return (_jsx(SelectJob, { jobs: materialTypes.jobs, newMaterialTy: newMaterialTy, setNewMaterialTy: setNewMaterialTy, curCollapse: curCollapse, setCurCollapse: setCurCollapse }));
130
+ }
131
+ return (_jsx(SelectRawMatAndJob, { options: materialTypes, newMaterialTy: newMaterialTy, setNewMaterialTy: setNewMaterialTy, curCollapse: curCollapse, setCurCollapse: setCurCollapse }));
132
+ }
133
+ export function PromptForQueue({ selectedQueue, setSelectedQueue, queueNames, }) {
134
+ const ref = useRef(null);
135
+ useEffect(() => {
136
+ ref.current?.scrollIntoView({
137
+ behavior: "smooth",
138
+ block: "end",
139
+ });
140
+ }, [ref]);
141
+ return (_jsxs("div", { ref: ref, children: [_jsx("p", { children: "Select a queue" }), _jsx(List, { children: queueNames.map((q, idx) => (_jsx(ListItemButton, { selected: q === selectedQueue, onClick: () => setSelectedQueue(q), children: q }, idx))) })] }));
142
+ }
143
+ function PromptForOperator({ enteredOperator, setEnteredOperator, }) {
144
+ const fmsInfo = useAtomValue(fmsInformation);
145
+ if (!fmsInfo.requireOperatorNamePromptWhenAddingMaterial)
146
+ return null;
147
+ return (_jsx("div", { style: { marginLeft: "1em" }, children: _jsx(TextField, { fullWidth: true, label: "Operator", value: enteredOperator || "", required: true, onChange: (e) => setEnteredOperator(e.target.value) }) }));
148
+ }
149
+ export function AddToQueueMaterialDialogCt({ st, queueNames, setState, }) {
150
+ const allowAdd = useAllowAddToQueue(queueNames);
151
+ if (!allowAdd) {
152
+ return null;
153
+ }
154
+ return (_jsxs(_Fragment, { children: [_jsx(WorkorderFromBarcode, {}), queueNames.length > 1 ? (_jsx(PromptForQueue, { selectedQueue: st.toQueue, setSelectedQueue: (q) => {
155
+ setState({
156
+ toQueue: q,
157
+ newMaterialTy: null,
158
+ enteredOperator: st.enteredOperator,
159
+ });
160
+ }, queueNames: queueNames })) : undefined, _jsx(PromptForMaterialType, { newMaterialTy: st.newMaterialTy, toQueue: queueNames.length > 1 ? st.toQueue : (queueNames[0] ?? null), setNewMaterialTy: (ty) => setState({ ...st, newMaterialTy: ty }) }), _jsx(PromptForOperator, { enteredOperator: st.enteredOperator, setEnteredOperator: (o) => setState({ ...st, enteredOperator: o }) })] }));
161
+ }
162
+ export function AddToQueueButton({ st: { enteredOperator, newMaterialTy, toQueue }, queueNames, onClose, }) {
163
+ const fmsInfo = useAtomValue(fmsInformation);
164
+ const operator = useAtomValue(currentOperator);
165
+ const setMatToShow = useSetAtom(matDetails.materialDialogOpen);
166
+ const newSerial = useAtomValue(matDetails.serialInMaterialDialog);
167
+ const newWorkorder = useAtomValue(matDetails.workorderInMaterialDialog);
168
+ const existingMat = useAtomValue(matDetails.materialInDialogInfo);
169
+ const inProcMat = useAtomValue(matDetails.inProcessMaterialInDialog);
170
+ const lastProcMat = useAtomValue(matDetails.materialInDialogLargestUsedProcess);
171
+ const [addExistingMat, addingExistingMat] = matDetails.useAddExistingMaterialToQueue();
172
+ const [addNewMat, addingNewMat] = matDetails.useAddNewMaterialToQueue();
173
+ const [addNewCasting, addingNewCasting] = useAddNewCastingToQueue();
174
+ const allowAdd = useAllowAddToQueue(queueNames);
175
+ if (!allowAdd) {
176
+ return null;
177
+ }
178
+ if (toQueue === null && queueNames.length === 1) {
179
+ toQueue = queueNames[0];
180
+ }
181
+ let addProcMsg = "";
182
+ if (existingMat !== null) {
183
+ if (lastProcMat && lastProcMat.process >= lastProcMat.totalNumProcesses) {
184
+ return null;
185
+ }
186
+ else {
187
+ const lastProc = lastProcMat?.process ?? 0;
188
+ addProcMsg = " To Run Process " + (lastProc + 1).toString();
189
+ }
190
+ }
191
+ else {
192
+ if (newMaterialTy?.kind === "JobAndProc" && newMaterialTy?.last_proc !== undefined) {
193
+ addProcMsg = " To Run Process " + (newMaterialTy.last_proc + 1).toString();
194
+ }
195
+ if (newMaterialTy?.kind === "RawMat" && newMaterialTy?.rawMatName) {
196
+ addProcMsg = " As " + newMaterialTy.rawMatName;
197
+ }
198
+ }
199
+ let withSerialMsg = "";
200
+ if (!existingMat && newSerial && newSerial !== "") {
201
+ withSerialMsg = " With Serial " + newSerial;
202
+ }
203
+ const curQueue = inProcMat?.location.currentQueue ?? null;
204
+ return (_jsx(_Fragment, { children: _jsx(Tooltip, { title: toQueue === null
205
+ ? "Select a queue to add the material to"
206
+ : fmsInfo.requireOperatorNamePromptWhenAddingMaterial &&
207
+ (enteredOperator === null || enteredOperator === "")
208
+ ? "Please enter an operator name"
209
+ : "", children: _jsx("span", { children: _jsx(Button, { color: "primary", disabled: toQueue === null ||
210
+ addingExistingMat === true ||
211
+ addingNewMat === true ||
212
+ addingNewCasting === true ||
213
+ (existingMat === null && newMaterialTy === null) ||
214
+ (fmsInfo.requireOperatorNamePromptWhenAddingMaterial &&
215
+ (enteredOperator === null || enteredOperator === "")), onClick: () => {
216
+ if (existingMat) {
217
+ addExistingMat({
218
+ materialId: existingMat.materialID,
219
+ queue: toQueue ?? "",
220
+ queuePosition: -1,
221
+ operator: enteredOperator ?? operator,
222
+ });
223
+ }
224
+ else if (newMaterialTy && newMaterialTy.kind === "JobAndProc" && newMaterialTy.jobUnique) {
225
+ addNewMat({
226
+ jobUnique: newMaterialTy.jobUnique,
227
+ lastCompletedProcess: newMaterialTy.last_proc,
228
+ serial: newSerial ?? undefined,
229
+ workorder: newWorkorder ?? newMaterialTy?.workorder,
230
+ queue: toQueue ?? "",
231
+ queuePosition: -1,
232
+ operator: enteredOperator ?? operator,
233
+ });
234
+ }
235
+ else if (newMaterialTy && newMaterialTy.kind === "RawMat" && newMaterialTy.rawMatName) {
236
+ addNewCasting({
237
+ casting: newMaterialTy.rawMatName,
238
+ quantity: 1,
239
+ queue: toQueue ?? "",
240
+ serials: newSerial ? [newSerial] : undefined,
241
+ workorder: newWorkorder,
242
+ operator: enteredOperator ?? operator,
243
+ });
244
+ }
245
+ setMatToShow(null);
246
+ onClose();
247
+ }, children: toQueue === null ? ("Add to Queue") : (_jsxs("span", { children: [curQueue !== null ? `Move From ${curQueue} To` : "Add To", " ", toQueue, withSerialMsg, addProcMsg] })) }) }) }) }));
248
+ }
@@ -0,0 +1,2 @@
1
+ export declare function SignalInspectionButton(): import("react/jsx-runtime").JSX.Element | null;
2
+ export declare const SelectInspTypeDialog: import("react").NamedExoticComponent<object>;