@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,454 @@
1
+ /* Copyright (c) 2024, John Lenz
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above
12
+ copyright notice, this list of conditions and the following
13
+ disclaimer in the documentation and/or other materials provided
14
+ with the distribution.
15
+
16
+ * Neither the name of John Lenz, Black Maple Software, SeedTactics,
17
+ nor the names of other contributors may be used to endorse or
18
+ promote products derived from this software without specific
19
+ prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+ import * as api from "../network/api.js";
34
+ import { addMinutes, addSeconds } from "date-fns";
35
+ import { durationToMinutes } from "../util/parseISODuration.js";
36
+ import copy from "copy-to-clipboard";
37
+ import { chunkCyclesWithSimilarEndTime, PartAndStationOperation, } from "../cell-status/estimated-cycle-times.js";
38
+ import { stat_name_and_num } from "../cell-status/station-cycles.js";
39
+ import { LazySeq, OrderedSet, OrderedMap } from "@seedtactics/immutable-collections";
40
+ function extractFilterOptions(cycles, selectedPart) {
41
+ let palNames = OrderedSet.empty();
42
+ let lulNames = OrderedSet.empty();
43
+ let mcNames = OrderedSet.empty();
44
+ let partNames = OrderedMap.empty();
45
+ let oper = OrderedSet.empty();
46
+ for (const c of cycles) {
47
+ palNames = palNames.add(c.pallet);
48
+ if (c.isLabor) {
49
+ lulNames = lulNames.add(stat_name_and_num(c.stationGroup, c.stationNumber));
50
+ }
51
+ else {
52
+ mcNames = mcNames.add(stat_name_and_num(c.stationGroup, c.stationNumber));
53
+ if (selectedPart &&
54
+ c.part == selectedPart.part &&
55
+ c.material.some((m) => m.proc === selectedPart.proc)) {
56
+ oper = oper.add(PartAndStationOperation.ofPartCycle(c));
57
+ }
58
+ }
59
+ for (const m of c.material) {
60
+ partNames = partNames.alter(m.part, (old) => (old ?? OrderedSet.empty()).add(m.proc));
61
+ }
62
+ }
63
+ return {
64
+ allPalletNames: palNames.toAscLazySeq().toRArray(),
65
+ allLoadStationNames: lulNames.toAscLazySeq().toRArray(),
66
+ allMachineNames: mcNames.toAscLazySeq().toRArray(),
67
+ allPartAndProcNames: partNames
68
+ .toAscLazySeq()
69
+ .flatMap(([part, procs]) => procs.toAscLazySeq().map((proc) => ({ part: part, proc: proc })))
70
+ .toRArray(),
71
+ allMachineOperations: oper.toAscLazySeq().toRArray(),
72
+ };
73
+ }
74
+ export const FilterAnyMachineKey = "@@@_FMSInsight_FilterAnyMachineKey_@@@";
75
+ export const FilterAnyLoadKey = "@@@_FMSInsigt_FilterAnyLoadKey_@@@";
76
+ export function emptyStationCycles(allCycles) {
77
+ return {
78
+ ...extractFilterOptions(allCycles),
79
+ seriesLabel: "Station",
80
+ data: new Map(),
81
+ };
82
+ }
83
+ export function filterStationCycles(allCycles, { zoom, partAndProc, pallet, station, operation }) {
84
+ const groupByPal = partAndProc && station && station !== FilterAnyMachineKey && station !== FilterAnyLoadKey;
85
+ const groupByPart = pallet && !operation && station && station !== FilterAnyMachineKey && station !== FilterAnyLoadKey;
86
+ return {
87
+ ...extractFilterOptions(allCycles, partAndProc),
88
+ seriesLabel: groupByPal ? "Pallet" : groupByPart ? "Part" : "Station",
89
+ data: LazySeq.of(allCycles)
90
+ .filter((e) => {
91
+ if (zoom && (e.endTime < zoom.start || e.endTime > zoom.end)) {
92
+ return false;
93
+ }
94
+ if (partAndProc &&
95
+ (e.part !== partAndProc.part || !e.material.some((m) => m.proc === partAndProc.proc))) {
96
+ return false;
97
+ }
98
+ if (pallet && e.pallet !== pallet) {
99
+ return false;
100
+ }
101
+ if (station === FilterAnyMachineKey) {
102
+ if (e.isLabor) {
103
+ return false;
104
+ }
105
+ }
106
+ else if (station === FilterAnyLoadKey) {
107
+ if (!e.isLabor) {
108
+ return false;
109
+ }
110
+ }
111
+ else if (station && stat_name_and_num(e.stationGroup, e.stationNumber) !== station) {
112
+ return false;
113
+ }
114
+ if (operation && operation.compare(PartAndStationOperation.ofPartCycle(e)) !== 0) {
115
+ return false;
116
+ }
117
+ return true;
118
+ })
119
+ .toRLookup((e) => {
120
+ if (groupByPal) {
121
+ return e.pallet.toString();
122
+ }
123
+ else if (groupByPart) {
124
+ return (e.part +
125
+ "-" +
126
+ LazySeq.of(e.material)
127
+ .map((m) => m.proc)
128
+ .distinctAndSortBy((p) => p)
129
+ .toRArray()
130
+ .join(":"));
131
+ }
132
+ else {
133
+ return stat_name_and_num(e.stationGroup, e.stationNumber);
134
+ }
135
+ }, (e) => ({
136
+ ...e,
137
+ x: e.endTime,
138
+ y: e.elapsedMinsPerMaterial * e.material.length,
139
+ })),
140
+ };
141
+ }
142
+ export function loadOccupancyCycles(allCycles, { zoom, partAndProc, pallet, station }) {
143
+ const filteredCycles = LazySeq.of(allCycles).filter((e) => {
144
+ if (!station || station === FilterAnyLoadKey) {
145
+ return e.isLabor;
146
+ }
147
+ else {
148
+ return stat_name_and_num(e.stationGroup, e.stationNumber) === station;
149
+ }
150
+ });
151
+ return {
152
+ ...extractFilterOptions(allCycles, partAndProc),
153
+ seriesLabel: "Station",
154
+ data: chunkCyclesWithSimilarEndTime(filteredCycles, (c) => stat_name_and_num(c.stationGroup, c.stationNumber), (c) => c.endTime)
155
+ .map(([statNameAndNum, cyclesForStat]) => [
156
+ statNameAndNum,
157
+ LazySeq.of(cyclesForStat)
158
+ .collect((chunk) => {
159
+ const cycle = chunk.find((e) => {
160
+ if (zoom && (e.endTime < zoom.start || e.endTime > zoom.end)) {
161
+ return false;
162
+ }
163
+ if (partAndProc &&
164
+ (e.part !== partAndProc.part || !e.material.some((m) => m.proc === partAndProc.proc))) {
165
+ return false;
166
+ }
167
+ if (pallet && e.pallet !== pallet) {
168
+ return false;
169
+ }
170
+ return true;
171
+ });
172
+ if (cycle) {
173
+ return {
174
+ ...cycle,
175
+ x: cycle.endTime,
176
+ y: chunk.reduce((acc, e) => acc + e.elapsedMinsPerMaterial * e.material.length, 0),
177
+ operations: LazySeq.of(chunk)
178
+ .flatMap((e) => e.material.map((mat) => ({
179
+ mat,
180
+ operation: e.operation,
181
+ })))
182
+ .toRArray(),
183
+ };
184
+ }
185
+ else {
186
+ return null;
187
+ }
188
+ })
189
+ .toRArray(),
190
+ ])
191
+ .filter(([, e]) => e.length > 0)
192
+ .toRMap((x) => x),
193
+ };
194
+ }
195
+ export function plannedOperationMinutes(s, forSingleMat) {
196
+ let planned = null;
197
+ for (const [, cycles] of s.data) {
198
+ for (const pt of cycles) {
199
+ if (pt.material.length > 0) {
200
+ if (planned === null || planned.time < pt.x) {
201
+ const mins = forSingleMat ? pt.activeMinutes / pt.material.length : pt.activeMinutes;
202
+ planned = { time: pt.x, mins };
203
+ }
204
+ }
205
+ }
206
+ }
207
+ return planned?.mins;
208
+ }
209
+ export function recentCycles(allCycles) {
210
+ return chunkCyclesWithSimilarEndTime(allCycles, (c) => stat_name_and_num(c.stationGroup, c.stationNumber), (c) => c.endTime)
211
+ .flatMap(function* procChunk([station, chunks]) {
212
+ for (const chunk of chunks) {
213
+ // sum elapsed time for chunk and subtract from end time to get start time
214
+ const elapForChunkMins = LazySeq.of(chunk).sumBy((c) => c.elapsedMinsPerMaterial * c.material.length);
215
+ const startTime = addSeconds(chunk[0].endTime, -elapForChunkMins * 60);
216
+ const activeMins = LazySeq.of(chunk).sumBy((c) => c.activeMinutes);
217
+ yield {
218
+ station,
219
+ startTime,
220
+ endActive: activeMins > 0 ? addMinutes(startTime, activeMins) : undefined,
221
+ endOccupied: chunk[0].endTime,
222
+ outlier: chunk.some((c) => c.isOutlier),
223
+ parts: LazySeq.of(chunk)
224
+ .flatMap((c) => LazySeq.of(c.material)
225
+ .distinctBy((m) => m.proc)
226
+ .map((m) => ({ part: c.part, proc: m.proc, oper: c.operation })))
227
+ .distinctAndSortBy((c) => c.part, (c) => c.proc, (c) => c.oper)
228
+ .map((c) => ({
229
+ part: c.part + "-" + c.proc.toString(),
230
+ oper: c.oper,
231
+ }))
232
+ .toRArray(),
233
+ };
234
+ }
235
+ })
236
+ .toRArray();
237
+ }
238
+ // --------------------------------------------------------------------------------
239
+ // Clipboard
240
+ // --------------------------------------------------------------------------------
241
+ export function format_cycle_inspection(c, matsById) {
242
+ const ret = [];
243
+ const signaled = new Set();
244
+ const completed = new Set();
245
+ const success = new Set();
246
+ for (const mat of c.material) {
247
+ const summary = matsById.get(mat.id);
248
+ if (summary !== undefined) {
249
+ for (const s of summary.signaledInspections) {
250
+ signaled.add(s);
251
+ }
252
+ for (const [compInsp, details] of LazySeq.ofObject(summary.completedInspections ?? {})) {
253
+ signaled.add(compInsp);
254
+ completed.add(compInsp);
255
+ if (details.success) {
256
+ success.add(compInsp);
257
+ }
258
+ }
259
+ }
260
+ }
261
+ for (const name of LazySeq.of(signaled).toSortedArray((x) => x)) {
262
+ if (completed.has(name)) {
263
+ ret.push(name + "[" + (success.has(name) ? "success" : "failed") + "]");
264
+ }
265
+ else {
266
+ ret.push(name);
267
+ }
268
+ }
269
+ return ret.join(", ");
270
+ }
271
+ export function buildCycleTable(cycles, matsById, startD, endD, hideMedian) {
272
+ let table = "<table>\n<thead><tr>";
273
+ table += "<th>Date</th><th>Part</th><th>Station</th><th>Pallet</th>";
274
+ table += "<th>Serial</th><th>Workorder</th><th>Inspection</th>";
275
+ table += "<th>Elapsed Min</th><th>Target Min</th>";
276
+ if (!hideMedian) {
277
+ table += "<th>Median Elapsed Min</th><th>Median Deviation</th>";
278
+ }
279
+ table += "</tr></thead>\n<tbody>\n";
280
+ const filteredCycles = LazySeq.of(cycles.data)
281
+ .flatMap(([_, c]) => c)
282
+ .filter((p) => (!startD || p.endTime >= startD) && (!endD || p.endTime < endD))
283
+ .toSortedArray((a) => a.endTime.getTime());
284
+ for (const cycle of filteredCycles) {
285
+ table += "<tr>";
286
+ table +=
287
+ "<td>" +
288
+ cycle.endTime.toLocaleString(undefined, {
289
+ month: "short",
290
+ day: "numeric",
291
+ year: "numeric",
292
+ hour: "numeric",
293
+ minute: "2-digit",
294
+ }) +
295
+ "</td>";
296
+ table +=
297
+ "<td>" +
298
+ cycle.part +
299
+ "-" +
300
+ LazySeq.of(cycle.material)
301
+ .map((m) => m.proc)
302
+ .distinctAndSortBy((p) => p)
303
+ .toRArray()
304
+ .join(":") +
305
+ "</td>";
306
+ table += "<td>" + stat_name_and_num(cycle.stationGroup, cycle.stationNumber) + "</td>";
307
+ table += "<td>" + cycle.pallet.toString() + "</td>";
308
+ table +=
309
+ "<td>" +
310
+ cycle.material
311
+ .filter((m) => m.serial)
312
+ .map((m) => m.serial)
313
+ .join(",") +
314
+ "</td>";
315
+ table +=
316
+ "<td>" +
317
+ cycle.material
318
+ .filter((m) => m.workorder)
319
+ .map((m) => m.workorder)
320
+ .join(",") +
321
+ "</td>";
322
+ table += "<td>" + format_cycle_inspection(cycle, matsById) + "</td>";
323
+ table += "<td>" + (cycle.elapsedMinsPerMaterial * cycle.material.length).toFixed(1) + "</td>";
324
+ table += "<td>" + cycle.activeMinutes.toFixed(1) + "</td>";
325
+ if (!hideMedian) {
326
+ table += "<td>" + cycle.medianCycleMinutes.toFixed(1) + "</td>";
327
+ table += "<td>" + cycle.MAD_aboveMinutes.toFixed(1) + "</td>";
328
+ }
329
+ table += "</tr>\n";
330
+ }
331
+ table += "</tbody>\n</table>";
332
+ return table;
333
+ }
334
+ export function copyCyclesToClipboard(cycles, matsById, zoom, hideMedian) {
335
+ copy(buildCycleTable(cycles, matsById, zoom ? zoom.start : undefined, zoom ? zoom.end : undefined, hideMedian));
336
+ }
337
+ export function buildPalletCycleTable(points) {
338
+ let table = "<table>\n<thead><tr>";
339
+ table += "<th>Pallet</th><th>Date</th><th>Elapsed (min)</th>";
340
+ table += "</tr></thead>\n<tbody>\n";
341
+ const pals = points.keysToLazySeq().toSortedArray((x) => x);
342
+ for (const pal of pals) {
343
+ for (const cycle of points.get(pal)?.valuesToLazySeq() ?? []) {
344
+ table += "<tr>";
345
+ table += "<td>" + pal.toString() + "</td>";
346
+ table +=
347
+ "<td>" +
348
+ cycle.x.toLocaleString(undefined, {
349
+ month: "short",
350
+ day: "numeric",
351
+ year: "numeric",
352
+ hour: "numeric",
353
+ minute: "2-digit",
354
+ }) +
355
+ "</td>";
356
+ table += "<td>" + cycle.y.toFixed(1) + "</td>";
357
+ table += "</tr>\n";
358
+ }
359
+ }
360
+ table += "</tbody>\n</table>";
361
+ return table;
362
+ }
363
+ export function copyPalletCyclesToClipboard(points) {
364
+ copy(buildPalletCycleTable(points));
365
+ }
366
+ function stat_name(e) {
367
+ switch (e.type) {
368
+ case api.LogType.LoadUnloadCycle:
369
+ case api.LogType.MachineCycle:
370
+ return e.loc + " #" + e.locnum.toString();
371
+ case api.LogType.AddToQueue:
372
+ case api.LogType.RemoveFromQueue:
373
+ return e.loc;
374
+ case api.LogType.PartMark:
375
+ return "Mark";
376
+ case api.LogType.OrderAssignment:
377
+ return "Workorder";
378
+ case api.LogType.CloseOut:
379
+ return "CloseOut";
380
+ case api.LogType.Inspection: {
381
+ const inspName = (e.details || {}).InspectionType || "";
382
+ return "Signal " + inspName;
383
+ }
384
+ case api.LogType.InspectionForce:
385
+ return "Signal " + e.program;
386
+ case api.LogType.InspectionResult:
387
+ return "Inspect " + e.program;
388
+ default:
389
+ return e.loc;
390
+ }
391
+ }
392
+ function result(e) {
393
+ switch (e.type) {
394
+ case api.LogType.Inspection:
395
+ case api.LogType.InspectionForce:
396
+ case api.LogType.LoadUnloadCycle:
397
+ case api.LogType.PartMark:
398
+ case api.LogType.OrderAssignment:
399
+ return e.result;
400
+ case api.LogType.AddToQueue:
401
+ return "Add";
402
+ case api.LogType.RemoveFromQueue:
403
+ return "Remove";
404
+ case api.LogType.MachineCycle:
405
+ return e.program;
406
+ case api.LogType.InspectionResult:
407
+ if (e.result.toLowerCase() === "false") {
408
+ return "Failed";
409
+ }
410
+ else {
411
+ return "Succeeded";
412
+ }
413
+ default:
414
+ return "";
415
+ }
416
+ }
417
+ export function buildLogEntriesTable(cycles) {
418
+ let table = "<table>\n<thead><tr>";
419
+ table += "<th>Date</th><th>Part</th><th>Station</th><th>Pallet</th>";
420
+ table += "<th>Serial</th><th>Workorder</th><th>Result</th><th>Elapsed Min</th><th>Active Min</th>";
421
+ table += "</tr></thead>\n<tbody>\n";
422
+ for (const cycle of cycles) {
423
+ if (cycle.startofcycle) {
424
+ continue;
425
+ }
426
+ for (const mat of cycle.material) {
427
+ table += "<tr>";
428
+ table +=
429
+ "<td>" +
430
+ cycle.endUTC.toLocaleString(undefined, {
431
+ month: "short",
432
+ day: "numeric",
433
+ year: "numeric",
434
+ hour: "numeric",
435
+ minute: "2-digit",
436
+ }) +
437
+ "</td>";
438
+ table += "<td>" + mat.part + "-" + mat.proc.toString() + "</td>";
439
+ table += "<td>" + stat_name(cycle) + "</td>";
440
+ table += "<td>" + cycle.pal.toString() + "</td>";
441
+ table += "<td>" + (mat.serial || "") + "</td>";
442
+ table += "<td>" + (mat.workorder || "") + "</td>";
443
+ table += "<td>" + result(cycle) + "</td>";
444
+ table += "<td>" + durationToMinutes(cycle.elapsed).toFixed(1) + "</td>";
445
+ table += "<td>" + durationToMinutes(cycle.active).toFixed(1) + "</td>";
446
+ table += "</tr>\n";
447
+ }
448
+ }
449
+ table += "</tbody>\n</table>";
450
+ return table;
451
+ }
452
+ export function copyLogEntriesToClipboard(cycles) {
453
+ copy(buildLogEntriesTable(cycles));
454
+ }
@@ -0,0 +1,36 @@
1
+ import * as api from "../network/api.js";
2
+ import { InspectionLogEntry } from "../cell-status/inspections.js";
3
+ import { ToComparable } from "@seedtactics/immutable-collections";
4
+ export interface TriggeredInspectionEntry {
5
+ readonly time: Date;
6
+ readonly materialID: number;
7
+ readonly partName: string;
8
+ readonly serial?: string;
9
+ readonly workorder?: string;
10
+ readonly toInspect: boolean;
11
+ readonly path: string;
12
+ readonly failed: boolean;
13
+ }
14
+ export declare function buildPathString(procs: ReadonlyArray<Readonly<api.IMaterialProcessActualPath>>): string;
15
+ export interface InspectionsForPath {
16
+ readonly material: ReadonlyArray<TriggeredInspectionEntry>;
17
+ readonly failedCnt: number;
18
+ }
19
+ export declare function groupInspectionsByPath(entries: Iterable<InspectionLogEntry>, dateRange: {
20
+ start: Date;
21
+ end: Date;
22
+ } | undefined, sortOn: ToComparable<TriggeredInspectionEntry>): ReadonlyMap<string, InspectionsForPath>;
23
+ export interface FailedInspectionEntry {
24
+ readonly time: Date;
25
+ readonly materialID: number;
26
+ readonly serial?: string;
27
+ readonly workorder?: string;
28
+ readonly inspType: string;
29
+ readonly part: string;
30
+ }
31
+ export declare function extractFailedInspections(entries: Iterable<InspectionLogEntry>, start: Date, end: Date): ReadonlyArray<FailedInspectionEntry>;
32
+ export declare function extractPath(evts: ReadonlyArray<Readonly<api.ILogEntry>>): ReadonlyArray<Readonly<api.IMaterialProcessActualPath>>;
33
+ export declare function buildInspectionTable(part: string, inspType: string, entries: Iterable<InspectionLogEntry>): string;
34
+ export declare function copyInspectionEntriesToClipboard(part: string, inspType: string, entries: Iterable<InspectionLogEntry>): void;
35
+ export declare function buildFailedInspTable(entries: Iterable<FailedInspectionEntry>): string;
36
+ export declare function copyFailedInspectionsToClipboard(entries: Iterable<FailedInspectionEntry>): void;
@@ -0,0 +1,188 @@
1
+ /* Copyright (c) 2019, John Lenz
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above
12
+ copyright notice, this list of conditions and the following
13
+ disclaimer in the documentation and/or other materials provided
14
+ with the distribution.
15
+
16
+ * Neither the name of John Lenz, Black Maple Software, SeedTactics,
17
+ nor the names of other contributors may be used to endorse or
18
+ promote products derived from this software without specific
19
+ prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+ import * as api from "../network/api.js";
34
+ import { InspectionLogResultType } from "../cell-status/inspections.js";
35
+ import { LazySeq, mkCompareByProperties } from "@seedtactics/immutable-collections";
36
+ import copy from "copy-to-clipboard";
37
+ export function buildPathString(procs) {
38
+ const pathStrs = [];
39
+ for (const proc of procs) {
40
+ for (const stop of proc.stops) {
41
+ pathStrs.push("P" + proc.pallet.toString() + "," + "M" + stop.stationNum.toString());
42
+ }
43
+ }
44
+ return pathStrs.join(" -> ");
45
+ }
46
+ export function groupInspectionsByPath(entries, dateRange, sortOn) {
47
+ const failed = LazySeq.of(entries)
48
+ .collect((e) => {
49
+ if (e.result.type === InspectionLogResultType.Completed && !e.result.success) {
50
+ return e.materialID;
51
+ }
52
+ else {
53
+ return null;
54
+ }
55
+ })
56
+ .toRSet((e) => e);
57
+ return LazySeq.of(entries)
58
+ .collect((e) => {
59
+ if (dateRange && (e.time < dateRange.start || e.time > dateRange.end)) {
60
+ return null;
61
+ }
62
+ switch (e.result.type) {
63
+ case InspectionLogResultType.Triggered:
64
+ return {
65
+ time: e.time,
66
+ materialID: e.materialID,
67
+ partName: e.part,
68
+ serial: e.serial,
69
+ workorder: e.workorder,
70
+ toInspect: e.result.toInspect,
71
+ path: buildPathString(e.result.actualPath),
72
+ failed: failed.has(e.materialID),
73
+ };
74
+ default:
75
+ return null;
76
+ }
77
+ })
78
+ .buildHashMap((e) => e.path, (old, e) => {
79
+ const a = old ?? [];
80
+ a.push(e);
81
+ return a;
82
+ })
83
+ .mapValues((mats) => ({
84
+ material: mats.sort(mkCompareByProperties(sortOn, (e) => e.time.getTime())),
85
+ failedCnt: mats.reduce((acc, e) => acc + (e.failed ? 1 : 0), 0),
86
+ }));
87
+ }
88
+ export function extractFailedInspections(entries, start, end) {
89
+ return LazySeq.of(entries)
90
+ .collect((e) => {
91
+ if (e.time < start || e.time > end) {
92
+ return null;
93
+ }
94
+ if (e.result.type === InspectionLogResultType.Completed && !e.result.success) {
95
+ return {
96
+ time: e.time,
97
+ materialID: e.materialID,
98
+ serial: e.serial,
99
+ workorder: e.workorder,
100
+ inspType: e.inspType,
101
+ part: e.part,
102
+ };
103
+ }
104
+ else {
105
+ return null;
106
+ }
107
+ })
108
+ .toSortedArray((e) => e.time.getTime());
109
+ }
110
+ // --------------------------------------------------------------------------------
111
+ // Failed Lookup
112
+ // --------------------------------------------------------------------------------
113
+ export function extractPath(evts) {
114
+ for (const e of evts) {
115
+ if (e.type === api.LogType.Inspection) {
116
+ const pathsJson = JSON.parse((e.details || {}).ActualPath || "[]");
117
+ const paths = [];
118
+ for (const pathJson of pathsJson) {
119
+ paths.push(api.MaterialProcessActualPath.fromJS(pathJson));
120
+ }
121
+ if (paths.length > 0) {
122
+ return paths;
123
+ }
124
+ }
125
+ }
126
+ return [];
127
+ }
128
+ // --------------------------------------------------------------------------------
129
+ // Clipboard
130
+ // --------------------------------------------------------------------------------
131
+ export function buildInspectionTable(part, inspType, entries) {
132
+ let table = "<table>\n<thead><tr>";
133
+ table += "<th>Path</th><th>Date</th><th>Part</th><th>Inspection</th>";
134
+ table += "<th>Serial</th><th>Workorder</th><th>Inspected</th><th>Failed</th>";
135
+ table += "</tr></thead>\n<tbody>\n";
136
+ const groups = groupInspectionsByPath(entries, undefined, { asc: (e) => e.time.getTime() });
137
+ const paths = LazySeq.of(groups.keys()).toSortedArray((x) => x);
138
+ for (const path of paths) {
139
+ const data = groups.get(path);
140
+ if (data) {
141
+ for (const mat of data.material) {
142
+ table += "<tr>";
143
+ table += "<td>" + path + "</td>";
144
+ table +=
145
+ "<td>" +
146
+ mat.time.toLocaleString(undefined, {
147
+ month: "short",
148
+ day: "numeric",
149
+ year: "numeric",
150
+ hour: "numeric",
151
+ minute: "2-digit",
152
+ }) +
153
+ "</td>";
154
+ table += "<td>" + part + "</td>";
155
+ table += "<td>" + inspType + "</td>";
156
+ table += "<td>" + (mat.serial || "") + "</td>";
157
+ table += "<td>" + (mat.workorder || "") + "</td>";
158
+ table += "<td>" + (mat.toInspect ? "inspected" : "") + "</td>";
159
+ table += "<td>" + (mat.failed ? "failed" : "") + "</td>";
160
+ table += "</tr>\n";
161
+ }
162
+ }
163
+ }
164
+ table += "</tbody>\n</table>";
165
+ return table;
166
+ }
167
+ export function copyInspectionEntriesToClipboard(part, inspType, entries) {
168
+ copy(buildInspectionTable(part, inspType, entries));
169
+ }
170
+ export function buildFailedInspTable(entries) {
171
+ let table = "<table>\n<thead><tr>";
172
+ table += "<th>Date</th><th>Part</th><th>Inspection</th><th>Serial</th><th>Workorder</th>";
173
+ table += "</tr></thead>\n<tbody>\n";
174
+ for (const e of LazySeq.of(entries).sortBy({ desc: (x) => x.time.getTime() })) {
175
+ table += "<tr>";
176
+ table += "<td>" + e.time.toLocaleString() + "</td>";
177
+ table += "<td>" + e.part + "</td>";
178
+ table += "<td>" + e.inspType + "</td>";
179
+ table += "<td>" + (e.serial || "") + "</td>";
180
+ table += "<td>" + (e.workorder || "") + "</td>";
181
+ table += "</tr>\n";
182
+ }
183
+ table += "</tbody>\n</table>";
184
+ return table;
185
+ }
186
+ export function copyFailedInspectionsToClipboard(entries) {
187
+ copy(buildFailedInspTable(entries));
188
+ }