@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.
- package/README.md +37 -0
- package/dist/cell-status/buffers.d.ts +36 -0
- package/dist/cell-status/buffers.js +127 -0
- package/dist/cell-status/current-status.d.ts +30 -0
- package/dist/cell-status/current-status.js +200 -0
- package/dist/cell-status/estimated-cycle-times.d.ts +41 -0
- package/dist/cell-status/estimated-cycle-times.js +257 -0
- package/dist/cell-status/inspections.d.ts +55 -0
- package/dist/cell-status/inspections.js +213 -0
- package/dist/cell-status/loading.d.ts +26 -0
- package/dist/cell-status/loading.js +112 -0
- package/dist/cell-status/material-details.d.ts +116 -0
- package/dist/cell-status/material-details.js +422 -0
- package/dist/cell-status/material-summary.d.ts +52 -0
- package/dist/cell-status/material-summary.js +312 -0
- package/dist/cell-status/names.d.ts +19 -0
- package/dist/cell-status/names.js +134 -0
- package/dist/cell-status/pallet-cycles.d.ts +24 -0
- package/dist/cell-status/pallet-cycles.js +78 -0
- package/dist/cell-status/rebookings.d.ts +30 -0
- package/dist/cell-status/rebookings.js +139 -0
- package/dist/cell-status/scheduled-jobs.d.ts +18 -0
- package/dist/cell-status/scheduled-jobs.js +94 -0
- package/dist/cell-status/sim-day-usage.d.ts +14 -0
- package/dist/cell-status/sim-day-usage.js +54 -0
- package/dist/cell-status/sim-production.d.ts +22 -0
- package/dist/cell-status/sim-production.js +91 -0
- package/dist/cell-status/sim-station-use.d.ts +25 -0
- package/dist/cell-status/sim-station-use.js +71 -0
- package/dist/cell-status/station-cycles.d.ts +34 -0
- package/dist/cell-status/station-cycles.js +145 -0
- package/dist/cell-status/tool-replacements.d.ts +44 -0
- package/dist/cell-status/tool-replacements.js +155 -0
- package/dist/cell-status/tool-usage.d.ts +25 -0
- package/dist/cell-status/tool-usage.js +95 -0
- package/dist/components/App.d.ts +15 -0
- package/dist/components/App.js +549 -0
- package/dist/components/AxisAndGrid.d.ts +51 -0
- package/dist/components/AxisAndGrid.js +47 -0
- package/dist/components/BarcodeScanning.d.ts +6 -0
- package/dist/components/BarcodeScanning.js +150 -0
- package/dist/components/ChartTooltip.d.ts +28 -0
- package/dist/components/ChartTooltip.js +95 -0
- package/dist/components/ChooseMode.d.ts +18 -0
- package/dist/components/ChooseMode.js +136 -0
- package/dist/components/ChooseOperator.d.ts +1 -0
- package/dist/components/ChooseOperator.js +93 -0
- package/dist/components/ErrorsAndLoading.d.ts +9 -0
- package/dist/components/ErrorsAndLoading.js +55 -0
- package/dist/components/LoadingIcon.d.ts +1 -0
- package/dist/components/LoadingIcon.js +48 -0
- package/dist/components/LogEntry.d.ts +16 -0
- package/dist/components/LogEntry.js +365 -0
- package/dist/components/ManualSerialEntry.d.ts +5 -0
- package/dist/components/ManualSerialEntry.js +91 -0
- package/dist/components/MonthSelect.d.ts +6 -0
- package/dist/components/MonthSelect.js +67 -0
- package/dist/components/Navigation.d.ts +23 -0
- package/dist/components/Navigation.js +120 -0
- package/dist/components/VerboseLogging.d.ts +1 -0
- package/dist/components/VerboseLogging.js +47 -0
- package/dist/components/analysis/AnalysisSelectToolbar.d.ts +1 -0
- package/dist/components/analysis/AnalysisSelectToolbar.js +55 -0
- package/dist/components/analysis/BufferChart.d.ts +1 -0
- package/dist/components/analysis/BufferChart.js +139 -0
- package/dist/components/analysis/CostPerPiece.d.ts +2 -0
- package/dist/components/analysis/CostPerPiece.js +175 -0
- package/dist/components/analysis/CycleChart.d.ts +42 -0
- package/dist/components/analysis/CycleChart.js +281 -0
- package/dist/components/analysis/DataTable.d.ts +83 -0
- package/dist/components/analysis/DataTable.js +215 -0
- package/dist/components/analysis/EfficiencyPage.d.ts +2 -0
- package/dist/components/analysis/EfficiencyPage.js +138 -0
- package/dist/components/analysis/HeatChart.d.ts +22 -0
- package/dist/components/analysis/HeatChart.js +161 -0
- package/dist/components/analysis/InspectionDataTable.d.ts +10 -0
- package/dist/components/analysis/InspectionDataTable.js +148 -0
- package/dist/components/analysis/InspectionSankey.d.ts +12 -0
- package/dist/components/analysis/InspectionSankey.js +140 -0
- package/dist/components/analysis/PalletCycleCards.d.ts +1 -0
- package/dist/components/analysis/PalletCycleCards.js +137 -0
- package/dist/components/analysis/PartCycleCards.d.ts +2 -0
- package/dist/components/analysis/PartCycleCards.js +331 -0
- package/dist/components/analysis/QualityPage.d.ts +1 -0
- package/dist/components/analysis/QualityPage.js +49 -0
- package/dist/components/analysis/ScheduleHistory.d.ts +3 -0
- package/dist/components/analysis/ScheduleHistory.js +108 -0
- package/dist/components/analysis/StationDataTable.d.ts +25 -0
- package/dist/components/analysis/StationDataTable.js +246 -0
- package/dist/components/analysis/ToolReplacements.d.ts +1 -0
- package/dist/components/analysis/ToolReplacements.js +370 -0
- package/dist/components/operations/AllMaterial.d.ts +5 -0
- package/dist/components/operations/AllMaterial.js +267 -0
- package/dist/components/operations/ChartRangeEdit.d.ts +4 -0
- package/dist/components/operations/ChartRangeEdit.js +148 -0
- package/dist/components/operations/CloseoutReport.d.ts +2 -0
- package/dist/components/operations/CloseoutReport.js +172 -0
- package/dist/components/operations/CompletedParts.d.ts +2 -0
- package/dist/components/operations/CompletedParts.js +286 -0
- package/dist/components/operations/CurrentWorkorders.d.ts +3 -0
- package/dist/components/operations/CurrentWorkorders.js +368 -0
- package/dist/components/operations/Dashboard.d.ts +2 -0
- package/dist/components/operations/Dashboard.js +90 -0
- package/dist/components/operations/OEEChart.d.ts +10 -0
- package/dist/components/operations/OEEChart.js +173 -0
- package/dist/components/operations/Outliers.d.ts +4 -0
- package/dist/components/operations/Outliers.js +69 -0
- package/dist/components/operations/ProgramHighlight.d.ts +1 -0
- package/dist/components/operations/ProgramHighlight.js +9 -0
- package/dist/components/operations/Programs.d.ts +5 -0
- package/dist/components/operations/Programs.js +363 -0
- package/dist/components/operations/Rebookings.d.ts +1 -0
- package/dist/components/operations/Rebookings.js +213 -0
- package/dist/components/operations/RecentCycleChart.d.ts +4 -0
- package/dist/components/operations/RecentCycleChart.js +240 -0
- package/dist/components/operations/RecentProduction.d.ts +2 -0
- package/dist/components/operations/RecentProduction.js +213 -0
- package/dist/components/operations/RecentSchedules.d.ts +12 -0
- package/dist/components/operations/RecentSchedules.js +180 -0
- package/dist/components/operations/RecentStationCycles.d.ts +4 -0
- package/dist/components/operations/RecentStationCycles.js +159 -0
- package/dist/components/operations/ShiftSettings.d.ts +6 -0
- package/dist/components/operations/ShiftSettings.js +134 -0
- package/dist/components/operations/SimDayUsage.d.ts +1 -0
- package/dist/components/operations/SimDayUsage.js +133 -0
- package/dist/components/operations/ToolReport.d.ts +3 -0
- package/dist/components/operations/ToolReport.js +233 -0
- package/dist/components/operations/WorkorderGantt.d.ts +1 -0
- package/dist/components/operations/WorkorderGantt.js +124 -0
- package/dist/components/quality/QualityMaterial.d.ts +2 -0
- package/dist/components/quality/QualityMaterial.js +169 -0
- package/dist/components/quality/QualityPaths.d.ts +1 -0
- package/dist/components/quality/QualityPaths.js +53 -0
- package/dist/components/quality/RecentFailedInspections.d.ts +1 -0
- package/dist/components/quality/RecentFailedInspections.js +123 -0
- package/dist/components/routes.d.ts +170 -0
- package/dist/components/routes.js +301 -0
- package/dist/components/station-monitor/BulkRawMaterial.d.ts +11 -0
- package/dist/components/station-monitor/BulkRawMaterial.js +251 -0
- package/dist/components/station-monitor/Closeout.d.ts +5 -0
- package/dist/components/station-monitor/Closeout.js +162 -0
- package/dist/components/station-monitor/CustomStationMonitorDialog.d.ts +1 -0
- package/dist/components/station-monitor/CustomStationMonitorDialog.js +55 -0
- package/dist/components/station-monitor/Inspection.d.ts +8 -0
- package/dist/components/station-monitor/Inspection.js +164 -0
- package/dist/components/station-monitor/InvalidateCycle.d.ts +33 -0
- package/dist/components/station-monitor/InvalidateCycle.js +262 -0
- package/dist/components/station-monitor/JobDetails.d.ts +7 -0
- package/dist/components/station-monitor/JobDetails.js +108 -0
- package/dist/components/station-monitor/LoadStation.d.ts +10 -0
- package/dist/components/station-monitor/LoadStation.js +450 -0
- package/dist/components/station-monitor/Material.d.ts +77 -0
- package/dist/components/station-monitor/Material.js +489 -0
- package/dist/components/station-monitor/MoveMaterialArrows.d.ts +11 -0
- package/dist/components/station-monitor/MoveMaterialArrows.js +118 -0
- package/dist/components/station-monitor/PrintedLabel.d.ts +29 -0
- package/dist/components/station-monitor/PrintedLabel.js +166 -0
- package/dist/components/station-monitor/QuarantineButton.d.ts +4 -0
- package/dist/components/station-monitor/QuarantineButton.js +184 -0
- package/dist/components/station-monitor/Queues.d.ts +23 -0
- package/dist/components/station-monitor/Queues.js +312 -0
- package/dist/components/station-monitor/QueuesAddMaterial.d.ts +30 -0
- package/dist/components/station-monitor/QueuesAddMaterial.js +248 -0
- package/dist/components/station-monitor/SelectInspType.d.ts +2 -0
- package/dist/components/station-monitor/SelectInspType.js +99 -0
- package/dist/components/station-monitor/SelectWorkorder.d.ts +4 -0
- package/dist/components/station-monitor/SelectWorkorder.js +100 -0
- package/dist/components/station-monitor/StationToolbar.d.ts +3 -0
- package/dist/components/station-monitor/StationToolbar.js +168 -0
- package/dist/components/station-monitor/SystemOverview.d.ts +46 -0
- package/dist/components/station-monitor/SystemOverview.js +439 -0
- package/dist/components/station-monitor/Whiteboard.d.ts +10 -0
- package/dist/components/station-monitor/Whiteboard.js +67 -0
- package/dist/data/all-material-bins.d.ts +45 -0
- package/dist/data/all-material-bins.js +224 -0
- package/dist/data/chart-times.d.ts +20 -0
- package/dist/data/chart-times.js +99 -0
- package/dist/data/cost-per-piece.d.ts +32 -0
- package/dist/data/cost-per-piece.js +183 -0
- package/dist/data/current-cycles.d.ts +13 -0
- package/dist/data/current-cycles.js +144 -0
- package/dist/data/inspection-sankey.d.ts +15 -0
- package/dist/data/inspection-sankey.js +147 -0
- package/dist/data/move-arrows.d.ts +48 -0
- package/dist/data/move-arrows.js +217 -0
- package/dist/data/operators.d.ts +2 -0
- package/dist/data/operators.js +44 -0
- package/dist/data/part-summary.d.ts +17 -0
- package/dist/data/part-summary.js +107 -0
- package/dist/data/path-lookup.d.ts +13 -0
- package/dist/data/path-lookup.js +107 -0
- package/dist/data/queue-material.d.ts +46 -0
- package/dist/data/queue-material.js +256 -0
- package/dist/data/results.bufferchart.d.ts +10 -0
- package/dist/data/results.bufferchart.js +90 -0
- package/dist/data/results.completed-parts.d.ts +26 -0
- package/dist/data/results.completed-parts.js +181 -0
- package/dist/data/results.cycles.d.ts +86 -0
- package/dist/data/results.cycles.js +454 -0
- package/dist/data/results.inspection.d.ts +36 -0
- package/dist/data/results.inspection.js +188 -0
- package/dist/data/results.oee.d.ts +40 -0
- package/dist/data/results.oee.js +330 -0
- package/dist/data/results.schedules.d.ts +23 -0
- package/dist/data/results.schedules.js +157 -0
- package/dist/data/tools-programs.d.ts +78 -0
- package/dist/data/tools-programs.js +376 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +60 -0
- package/dist/network/api.d.ts +1390 -0
- package/dist/network/api.js +4971 -0
- package/dist/network/backend-mock.d.ts +11 -0
- package/dist/network/backend-mock.js +512 -0
- package/dist/network/backend.d.ts +57 -0
- package/dist/network/backend.js +77 -0
- package/dist/network/load-specific-month.d.ts +13 -0
- package/dist/network/load-specific-month.js +77 -0
- package/dist/network/server-settings.d.ts +12 -0
- package/dist/network/server-settings.js +92 -0
- package/dist/network/websocket.d.ts +4 -0
- package/dist/network/websocket.js +165 -0
- package/dist/renderer.d.ts +8 -0
- package/dist/renderer.js +55 -0
- package/dist/seedtactics-logo.d.ts +2 -0
- package/dist/seedtactics-logo.js +4 -0
- package/dist/util/chart-colors.d.ts +1 -0
- package/dist/util/chart-colors.js +116 -0
- package/dist/util/chart-helpers.d.ts +3 -0
- package/dist/util/chart-helpers.js +51 -0
- package/dist/util/parseISODuration.d.ts +4 -0
- package/dist/util/parseISODuration.js +40 -0
- package/docs/client-efficiency.md +355 -0
- package/docs/client-engineering.md +54 -0
- package/docs/client-launch.md +55 -0
- package/docs/client-operations.md +88 -0
- package/docs/client-quality.md +74 -0
- package/docs/client-sales.md +61 -0
- package/docs/client-scanners.md +41 -0
- package/docs/client-station-monitor.md +149 -0
- package/docs/client-tools-programs.md +74 -0
- package/docs/improve-fms.md +141 -0
- package/docs/makino.md +40 -0
- package/docs/material-quarantine.md +82 -0
- package/docs/material-tracking.md +236 -0
- package/docs/mazak.md +115 -0
- package/docs/niigata.md +228 -0
- package/docs/operator-procedures.md +106 -0
- package/docs/part-instructions.md +63 -0
- package/docs/screenshots/insight-all-material.png +0 -0
- package/docs/screenshots/insight-analysis-pallets.png +0 -0
- package/docs/screenshots/insight-analysis-part-completed.png +0 -0
- package/docs/screenshots/insight-analysis-sankey.png +0 -0
- package/docs/screenshots/insight-analysis-station-oee.png +0 -0
- package/docs/screenshots/insight-buffer-occupancy.png +0 -0
- package/docs/screenshots/insight-choose-analysis-month.png +0 -0
- package/docs/screenshots/insight-closeout.png +0 -0
- package/docs/screenshots/insight-cost-percentages.png +0 -0
- package/docs/screenshots/insight-dashboard.png +0 -0
- package/docs/screenshots/insight-event-custom-view.jpg +0 -0
- package/docs/screenshots/insight-event-viewer.jpg +0 -0
- package/docs/screenshots/insight-inspection.png +0 -0
- package/docs/screenshots/insight-load-station-details.png +0 -0
- package/docs/screenshots/insight-load-station.png +0 -0
- package/docs/screenshots/insight-loadcycle-graph.png +0 -0
- package/docs/screenshots/insight-loadstation-small.jpg +0 -0
- package/docs/screenshots/insight-machinecycle-graph.png +0 -0
- package/docs/screenshots/insight-machinecycle-table.png +0 -0
- package/docs/screenshots/insight-machinecycles.png +0 -0
- package/docs/screenshots/insight-machinehours.png +0 -0
- package/docs/screenshots/insight-machineoutliers.png +0 -0
- package/docs/screenshots/insight-monthly-schedules.png +0 -0
- package/docs/screenshots/insight-operations-material.png +0 -0
- package/docs/screenshots/insight-operations-overview.png +0 -0
- package/docs/screenshots/insight-operations-reports.png +0 -0
- package/docs/screenshots/insight-part-cost.png +0 -0
- package/docs/screenshots/insight-program-report.png +0 -0
- package/docs/screenshots/insight-quality-material-details.png +0 -0
- package/docs/screenshots/insight-quality-material.png +0 -0
- package/docs/screenshots/insight-quality-quarantine.png +0 -0
- package/docs/screenshots/insight-quality-sankey.png +0 -0
- package/docs/screenshots/insight-quality-similar-paths.png +0 -0
- package/docs/screenshots/insight-queue-details.png +0 -0
- package/docs/screenshots/insight-queues-jobs-table.png +0 -0
- package/docs/screenshots/insight-queues.png +0 -0
- package/docs/screenshots/insight-sim-day-usage.png +0 -0
- package/docs/screenshots/insight-station-system-overview-buttons.png +0 -0
- package/docs/screenshots/insight-station-system-overview.png +0 -0
- package/docs/screenshots/insight-system-overview.png +0 -0
- package/docs/screenshots/insight-tool-replacements.png +0 -0
- package/docs/screenshots/insight-tool-report.png +0 -0
- package/docs/screenshots/insight-toolbar-btns.png +0 -0
- package/docs/screenshots/insight-workorder-gantt.png +0 -0
- package/docs/screenshots/insight-workorders.png +0 -0
- package/docs/security.md +131 -0
- package/docs/server-config.md +56 -0
- package/docs/server-errors.md +44 -0
- package/package.json +90 -0
- package/src/index.ts +65 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { IInProcessMaterial, ILogEntry, ILogMaterial, IMaterialDetails, IActiveWorkorder, IScannedPotentialNewMaterial } from "../network/api.js";
|
|
2
|
+
export type MaterialToShowInfo = {
|
|
3
|
+
readonly materialID: number;
|
|
4
|
+
readonly partName: string;
|
|
5
|
+
readonly serial?: string;
|
|
6
|
+
readonly workorderId?: string;
|
|
7
|
+
};
|
|
8
|
+
export type MaterialToShow = {
|
|
9
|
+
readonly type: "InProcMat";
|
|
10
|
+
readonly inproc: Readonly<IInProcessMaterial>;
|
|
11
|
+
} | {
|
|
12
|
+
readonly type: "MatSummary";
|
|
13
|
+
readonly summary: MaterialToShowInfo;
|
|
14
|
+
} | {
|
|
15
|
+
readonly type: "MatDetails";
|
|
16
|
+
readonly details: Readonly<IMaterialDetails>;
|
|
17
|
+
} | {
|
|
18
|
+
readonly type: "LogMat";
|
|
19
|
+
readonly logMat: Readonly<ILogMaterial>;
|
|
20
|
+
} | {
|
|
21
|
+
readonly type: "Barcode";
|
|
22
|
+
readonly barcode: string;
|
|
23
|
+
readonly toQueue: string | null;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "ManuallyEnteredSerial";
|
|
26
|
+
readonly serial: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: "AddMatWithEnteredSerial";
|
|
29
|
+
readonly serial: string;
|
|
30
|
+
readonly toQueue: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const materialDialogOpen: import("jotai").WritableAtom<MaterialToShow | null, [mat: MaterialToShow | null], void>;
|
|
33
|
+
export declare const barcodePotentialNewMaterial: import("jotai").Atom<Promise<Readonly<IScannedPotentialNewMaterial> | null>>;
|
|
34
|
+
export declare const materialInDialogInfo: import("jotai").Atom<Promise<MaterialToShowInfo | null>>;
|
|
35
|
+
export declare const inProcessMaterialInDialog: import("jotai").Atom<Promise<IInProcessMaterial | null>>;
|
|
36
|
+
export declare const serialInMaterialDialog: import("jotai").Atom<Promise<string | null>>;
|
|
37
|
+
export declare const workorderInMaterialDialog: import("jotai").Atom<Promise<string | null>>;
|
|
38
|
+
export declare const materialInDialogEvents: import("jotai").Atom<readonly Readonly<ILogEntry>[]>;
|
|
39
|
+
export type LargestUsedProces = {
|
|
40
|
+
readonly process: number;
|
|
41
|
+
readonly totalNumProcesses: number;
|
|
42
|
+
};
|
|
43
|
+
export declare const materialInDialogLargestUsedProcess: import("jotai").Atom<Promise<LargestUsedProces | null>>;
|
|
44
|
+
export interface MaterialToShowInspections {
|
|
45
|
+
readonly signaledInspections: ReadonlyArray<string>;
|
|
46
|
+
readonly completedInspections: ReadonlyArray<string>;
|
|
47
|
+
}
|
|
48
|
+
export declare const materialInDialogInspections: import("jotai").Atom<MaterialToShowInspections>;
|
|
49
|
+
export declare const possibleWorkordersForMaterialInDialog: import("jotai").Atom<Promise<readonly IActiveWorkorder[]>>;
|
|
50
|
+
export interface ForceInspectionData {
|
|
51
|
+
readonly mat: MaterialToShowInfo;
|
|
52
|
+
readonly inspType: string;
|
|
53
|
+
readonly inspect: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare function useForceInspection(): [(data: ForceInspectionData) => void, boolean];
|
|
56
|
+
export interface CompleteInspectionData {
|
|
57
|
+
readonly mat: MaterialToShowInfo;
|
|
58
|
+
readonly inspType: string;
|
|
59
|
+
readonly success: boolean;
|
|
60
|
+
readonly operator: string | null;
|
|
61
|
+
}
|
|
62
|
+
export declare function useCompleteInspection(): [(data: CompleteInspectionData) => void, boolean];
|
|
63
|
+
export interface CompleteCloseoutData {
|
|
64
|
+
readonly mat: MaterialToShowInfo;
|
|
65
|
+
readonly operator: string | null;
|
|
66
|
+
readonly failed: boolean;
|
|
67
|
+
}
|
|
68
|
+
export declare function useCompleteCloseout(): [(d: CompleteCloseoutData) => void, boolean];
|
|
69
|
+
export declare function useAssignWorkorder(): [(mat: MaterialToShowInfo, workorder: string) => void, boolean];
|
|
70
|
+
export interface AddNoteData {
|
|
71
|
+
readonly matId: number;
|
|
72
|
+
readonly process: number;
|
|
73
|
+
readonly operator: string | null;
|
|
74
|
+
readonly notes: string;
|
|
75
|
+
}
|
|
76
|
+
export declare function useAddNote(): [(data: AddNoteData) => void, boolean];
|
|
77
|
+
export interface PrintLabelData {
|
|
78
|
+
readonly materialId: number;
|
|
79
|
+
readonly proc: number;
|
|
80
|
+
}
|
|
81
|
+
export declare function usePrintLabel(): [(data: PrintLabelData) => void, boolean, boolean];
|
|
82
|
+
export declare function useRemoveFromQueue(): [(matId: number, operator: string | null) => void, boolean];
|
|
83
|
+
export declare function useSignalForQuarantine(): [
|
|
84
|
+
(matId: number, operator: string | null, reason: string) => void,
|
|
85
|
+
boolean
|
|
86
|
+
];
|
|
87
|
+
export interface AddExistingMaterialToQueueData {
|
|
88
|
+
readonly materialId: number;
|
|
89
|
+
readonly queue: string;
|
|
90
|
+
readonly queuePosition: number;
|
|
91
|
+
readonly operator: string | null;
|
|
92
|
+
}
|
|
93
|
+
export declare function useAddExistingMaterialToQueue(): [(d: AddExistingMaterialToQueueData) => void, boolean];
|
|
94
|
+
export interface AddNewMaterialToQueueData {
|
|
95
|
+
readonly jobUnique: string;
|
|
96
|
+
readonly lastCompletedProcess: number;
|
|
97
|
+
readonly queue: string;
|
|
98
|
+
readonly queuePosition: number;
|
|
99
|
+
readonly serial?: string;
|
|
100
|
+
readonly operator: string | null;
|
|
101
|
+
readonly workorder: string | null;
|
|
102
|
+
readonly onNewMaterial?: (mat: Readonly<IInProcessMaterial>) => void;
|
|
103
|
+
readonly onError?: (reason: any) => void;
|
|
104
|
+
}
|
|
105
|
+
export declare function useAddNewMaterialToQueue(): [(d: AddNewMaterialToQueueData) => void, boolean];
|
|
106
|
+
export interface AddNewCastingToQueueData {
|
|
107
|
+
readonly casting: string;
|
|
108
|
+
readonly quantity: number;
|
|
109
|
+
readonly queue: string;
|
|
110
|
+
readonly serials?: ReadonlyArray<string>;
|
|
111
|
+
readonly workorder: string | null;
|
|
112
|
+
readonly operator: string | null;
|
|
113
|
+
readonly onNewMaterial?: (mats: ReadonlyArray<Readonly<IInProcessMaterial>>) => void;
|
|
114
|
+
readonly onError?: (reason: any) => void;
|
|
115
|
+
}
|
|
116
|
+
export declare function useAddNewCastingToQueue(): [(d: AddNewCastingToQueueData) => void, boolean];
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
/* Copyright (c) 2022, 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 { JobsBackend, LogBackend, OtherLogBackends, FmsServerBackend } from "../network/backend.js";
|
|
34
|
+
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
35
|
+
import { LogType, NewInspectionCompleted, NewCloseout, QueuePosition, } from "../network/api.js";
|
|
36
|
+
import { useCallback, useState } from "react";
|
|
37
|
+
import { currentStatus } from "./current-status.js";
|
|
38
|
+
import { atom, useSetAtom } from "jotai";
|
|
39
|
+
import { loadable } from "jotai/utils";
|
|
40
|
+
import { isLogEntryInvalidated } from "../components/LogEntry.js";
|
|
41
|
+
import { currentRoute, RouteLocation } from "../components/routes.js";
|
|
42
|
+
const matToShow = atom(null);
|
|
43
|
+
export const materialDialogOpen = atom((get) => get(matToShow), (_, set, mat) => {
|
|
44
|
+
if (mat === null) {
|
|
45
|
+
set(matToShow, null);
|
|
46
|
+
set(extraLogEventsFromUpdates, []);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
set(matToShow, mat);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
//--------------------------------------------------------------------------------
|
|
53
|
+
// Material Details
|
|
54
|
+
//--------------------------------------------------------------------------------
|
|
55
|
+
const barcodeMaterialDetail = atom(async (get) => {
|
|
56
|
+
const toShow = get(matToShow);
|
|
57
|
+
if (toShow && toShow.type === "Barcode") {
|
|
58
|
+
const route = get(currentRoute);
|
|
59
|
+
const queues = toShow.toQueue
|
|
60
|
+
? [toShow.toQueue]
|
|
61
|
+
: route.route === RouteLocation.Station_LoadMonitor
|
|
62
|
+
? route.queues
|
|
63
|
+
: route.route === RouteLocation.Station_Queues
|
|
64
|
+
? route.queues
|
|
65
|
+
: null;
|
|
66
|
+
return await FmsServerBackend.parseBarcode(toShow.barcode, queues);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export const barcodePotentialNewMaterial = atom(async (get) => {
|
|
73
|
+
return (await get(barcodeMaterialDetail))?.potentialNewMaterial ?? null;
|
|
74
|
+
});
|
|
75
|
+
export const materialInDialogInfo = atom(async (get) => {
|
|
76
|
+
const curMat = get(matToShow);
|
|
77
|
+
if (curMat === null)
|
|
78
|
+
return null;
|
|
79
|
+
switch (curMat.type) {
|
|
80
|
+
case "InProcMat":
|
|
81
|
+
return curMat.inproc;
|
|
82
|
+
case "MatSummary":
|
|
83
|
+
return curMat.summary;
|
|
84
|
+
case "MatDetails":
|
|
85
|
+
return curMat.details;
|
|
86
|
+
case "LogMat":
|
|
87
|
+
return {
|
|
88
|
+
materialID: curMat.logMat.id,
|
|
89
|
+
partName: curMat.logMat.part,
|
|
90
|
+
serial: curMat.logMat.serial,
|
|
91
|
+
workorderId: curMat.logMat.workorder,
|
|
92
|
+
};
|
|
93
|
+
case "Barcode": {
|
|
94
|
+
const mat = await get(barcodeMaterialDetail);
|
|
95
|
+
if (mat?.existingMaterial && mat.existingMaterial.materialID >= 0) {
|
|
96
|
+
return mat.existingMaterial;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
case "ManuallyEnteredSerial":
|
|
103
|
+
case "AddMatWithEnteredSerial": {
|
|
104
|
+
return (await LogBackend.materialForSerial(curMat.serial))?.[0] ?? null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
export const inProcessMaterialInDialog = atom(async (get) => {
|
|
109
|
+
const status = get(currentStatus);
|
|
110
|
+
const toShow = get(matToShow);
|
|
111
|
+
if (toShow === null)
|
|
112
|
+
return null;
|
|
113
|
+
if (toShow.type === "InProcMat")
|
|
114
|
+
return toShow.inproc;
|
|
115
|
+
const matId = (await get(materialInDialogInfo))?.materialID ?? null;
|
|
116
|
+
return matId !== null && matId >= 0 ? (status.material.find((m) => m.materialID === matId) ?? null) : null;
|
|
117
|
+
});
|
|
118
|
+
export const serialInMaterialDialog = atom(async (get) => {
|
|
119
|
+
const toShow = get(matToShow);
|
|
120
|
+
if (toShow === null)
|
|
121
|
+
return null;
|
|
122
|
+
switch (toShow.type) {
|
|
123
|
+
case "InProcMat":
|
|
124
|
+
return toShow.inproc.serial ?? null;
|
|
125
|
+
case "MatSummary":
|
|
126
|
+
return toShow.summary.serial ?? null;
|
|
127
|
+
case "MatDetails":
|
|
128
|
+
return toShow.details.serial ?? null;
|
|
129
|
+
case "LogMat":
|
|
130
|
+
return toShow.logMat.serial ?? null;
|
|
131
|
+
case "Barcode": {
|
|
132
|
+
const barcodeMat = await get(barcodeMaterialDetail);
|
|
133
|
+
return barcodeMat?.existingMaterial?.serial ?? barcodeMat?.potentialNewMaterial?.serial ?? null;
|
|
134
|
+
}
|
|
135
|
+
case "ManuallyEnteredSerial":
|
|
136
|
+
case "AddMatWithEnteredSerial":
|
|
137
|
+
return toShow.serial;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
export const workorderInMaterialDialog = atom(async (get) => {
|
|
141
|
+
const toShow = get(matToShow);
|
|
142
|
+
if (toShow === null)
|
|
143
|
+
return null;
|
|
144
|
+
switch (toShow.type) {
|
|
145
|
+
case "InProcMat":
|
|
146
|
+
return toShow.inproc.workorderId ?? null;
|
|
147
|
+
case "MatSummary":
|
|
148
|
+
return toShow.summary.workorderId ?? null;
|
|
149
|
+
case "MatDetails":
|
|
150
|
+
return toShow.details.workorder ?? null;
|
|
151
|
+
case "LogMat":
|
|
152
|
+
return toShow.logMat.workorder ?? null;
|
|
153
|
+
case "Barcode": {
|
|
154
|
+
const barcodeMat = await get(barcodeMaterialDetail);
|
|
155
|
+
return barcodeMat?.existingMaterial?.workorder ?? barcodeMat?.potentialNewMaterial?.workorder ?? null;
|
|
156
|
+
}
|
|
157
|
+
case "ManuallyEnteredSerial":
|
|
158
|
+
case "AddMatWithEnteredSerial":
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
//--------------------------------------------------------------------------------
|
|
163
|
+
// Events
|
|
164
|
+
//--------------------------------------------------------------------------------
|
|
165
|
+
const extraLogEventsFromUpdates = atom([]);
|
|
166
|
+
const localMatEvents = atom(async (get, { signal }) => {
|
|
167
|
+
const mat = await get(materialInDialogInfo);
|
|
168
|
+
if (mat === null) {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
else if (mat.materialID >= 0) {
|
|
172
|
+
return await LogBackend.logForMaterial(mat.materialID, signal);
|
|
173
|
+
}
|
|
174
|
+
else if (mat.serial && mat.serial !== "") {
|
|
175
|
+
return await LogBackend.logForSerial(mat.serial);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
const localMatEventsLoadable = loadable(localMatEvents);
|
|
182
|
+
const otherMatEvents = atom(async (get, { signal }) => {
|
|
183
|
+
const serial = await get(serialInMaterialDialog);
|
|
184
|
+
if (serial === null || serial === "")
|
|
185
|
+
return [];
|
|
186
|
+
const evts = [];
|
|
187
|
+
for (const b of OtherLogBackends) {
|
|
188
|
+
evts.push.apply(await b.logForSerial(serial, signal));
|
|
189
|
+
}
|
|
190
|
+
return evts;
|
|
191
|
+
});
|
|
192
|
+
const otherMatEventsLoadable = loadable(otherMatEvents);
|
|
193
|
+
export const materialInDialogEvents = atom((get) => {
|
|
194
|
+
const localEvts = get(localMatEventsLoadable);
|
|
195
|
+
const otherEvts = get(otherMatEventsLoadable);
|
|
196
|
+
const evtsFromUpdate = get(extraLogEventsFromUpdates);
|
|
197
|
+
return LazySeq.of(localEvts.state === "hasData" ? localEvts.data : [])
|
|
198
|
+
.concat(otherEvts.state === "hasData" ? otherEvts.data : [])
|
|
199
|
+
.sortBy((e) => e.endUTC.getTime(), (e) => e.counter)
|
|
200
|
+
.concat(evtsFromUpdate)
|
|
201
|
+
.toRArray();
|
|
202
|
+
});
|
|
203
|
+
export const materialInDialogLargestUsedProcess = atom(async (get) => {
|
|
204
|
+
const info = await get(materialInDialogInfo);
|
|
205
|
+
if (info === null)
|
|
206
|
+
return null;
|
|
207
|
+
const evts = get(materialInDialogEvents);
|
|
208
|
+
const maxEvt = LazySeq.of(evts)
|
|
209
|
+
.filter((e) => !isLogEntryInvalidated(e) &&
|
|
210
|
+
(e.type === LogType.LoadUnloadCycle ||
|
|
211
|
+
e.type === LogType.MachineCycle ||
|
|
212
|
+
e.type === LogType.AddToQueue))
|
|
213
|
+
.flatMap((e) => e.material)
|
|
214
|
+
.filter((e) => e.id === info.materialID)
|
|
215
|
+
.maxBy((e) => e.proc);
|
|
216
|
+
if (maxEvt) {
|
|
217
|
+
return { process: maxEvt.proc, totalNumProcesses: maxEvt.numproc };
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
export const materialInDialogInspections = atom((get) => {
|
|
224
|
+
const curMat = get(matToShow);
|
|
225
|
+
const evts = get(materialInDialogEvents);
|
|
226
|
+
if (curMat === null) {
|
|
227
|
+
return { signaledInspections: [], completedInspections: [] };
|
|
228
|
+
}
|
|
229
|
+
const inspTypes = new Set(curMat.type === "InProcMat" ? curMat.inproc.signaledInspections : []);
|
|
230
|
+
const completedTypes = new Set();
|
|
231
|
+
evts.forEach((e) => {
|
|
232
|
+
switch (e.type) {
|
|
233
|
+
case LogType.Inspection:
|
|
234
|
+
if (e.result.toLowerCase() === "true" || e.result === "1") {
|
|
235
|
+
const itype = (e.details || {}).InspectionType;
|
|
236
|
+
if (itype) {
|
|
237
|
+
inspTypes.add(itype);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
case LogType.InspectionForce:
|
|
242
|
+
if (e.result.toLowerCase() === "true" || e.result === "1") {
|
|
243
|
+
inspTypes.add(e.program);
|
|
244
|
+
}
|
|
245
|
+
break;
|
|
246
|
+
case LogType.InspectionResult:
|
|
247
|
+
completedTypes.add(e.program);
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
return {
|
|
252
|
+
signaledInspections: LazySeq.of(inspTypes).toSortedArray((x) => x),
|
|
253
|
+
completedInspections: LazySeq.of(completedTypes).toSortedArray((x) => x),
|
|
254
|
+
};
|
|
255
|
+
});
|
|
256
|
+
//--------------------------------------------------------------------------------
|
|
257
|
+
// Workorders
|
|
258
|
+
//--------------------------------------------------------------------------------
|
|
259
|
+
export const possibleWorkordersForMaterialInDialog = atom(async (get) => {
|
|
260
|
+
const mat = await get(materialInDialogInfo);
|
|
261
|
+
if (mat === null || mat.partName === "")
|
|
262
|
+
return [];
|
|
263
|
+
const works = get(currentStatus)?.workorders ?? [];
|
|
264
|
+
return LazySeq.of(works)
|
|
265
|
+
.filter((w) => w.part === mat.partName)
|
|
266
|
+
.toSortedArray((w) => w.dueDate.getTime(), (w) => -w.priority);
|
|
267
|
+
});
|
|
268
|
+
export function useForceInspection() {
|
|
269
|
+
const [updating, setUpdating] = useState(false);
|
|
270
|
+
const setExtraLogEvts = useSetAtom(extraLogEventsFromUpdates);
|
|
271
|
+
const callback = useCallback((data) => {
|
|
272
|
+
setUpdating(true);
|
|
273
|
+
LogBackend.setInspectionDecision(data.mat.materialID, data.inspType, 1, data.inspect)
|
|
274
|
+
.then((evt) => setExtraLogEvts((evts) => [...evts, evt]))
|
|
275
|
+
.catch(console.log)
|
|
276
|
+
.finally(() => setUpdating(false));
|
|
277
|
+
}, [setExtraLogEvts]);
|
|
278
|
+
return [callback, updating];
|
|
279
|
+
}
|
|
280
|
+
export function useCompleteInspection() {
|
|
281
|
+
const [updating, setUpdating] = useState(false);
|
|
282
|
+
const callback = useCallback((data) => {
|
|
283
|
+
setUpdating(true);
|
|
284
|
+
LogBackend.recordInspectionCompleted(new NewInspectionCompleted({
|
|
285
|
+
materialID: data.mat.materialID,
|
|
286
|
+
process: 1,
|
|
287
|
+
inspectionLocationNum: 1,
|
|
288
|
+
inspectionType: data.inspType,
|
|
289
|
+
success: data.success,
|
|
290
|
+
active: "PT0S",
|
|
291
|
+
elapsed: "PT0S",
|
|
292
|
+
extraData: data.operator ? { operator: data.operator } : undefined,
|
|
293
|
+
}))
|
|
294
|
+
.catch(console.log)
|
|
295
|
+
.finally(() => setUpdating(false));
|
|
296
|
+
}, []);
|
|
297
|
+
return [callback, updating];
|
|
298
|
+
}
|
|
299
|
+
export function useCompleteCloseout() {
|
|
300
|
+
const [updating, setUpdating] = useState(false);
|
|
301
|
+
const callback = useCallback((d) => {
|
|
302
|
+
setUpdating(true);
|
|
303
|
+
LogBackend.recordCloseoutCompleted(new NewCloseout({
|
|
304
|
+
materialID: d.mat.materialID,
|
|
305
|
+
process: 1,
|
|
306
|
+
locationNum: 1,
|
|
307
|
+
closeoutType: "",
|
|
308
|
+
active: "PT0S",
|
|
309
|
+
elapsed: "PT0S",
|
|
310
|
+
extraData: d.operator ? { operator: d.operator } : undefined,
|
|
311
|
+
failed: d.failed,
|
|
312
|
+
}))
|
|
313
|
+
.catch(console.log)
|
|
314
|
+
.finally(() => setUpdating(false));
|
|
315
|
+
}, []);
|
|
316
|
+
return [callback, updating];
|
|
317
|
+
}
|
|
318
|
+
export function useAssignWorkorder() {
|
|
319
|
+
const [updating, setUpdating] = useState(false);
|
|
320
|
+
const setExtraLogEvts = useSetAtom(extraLogEventsFromUpdates);
|
|
321
|
+
const callback = useCallback((mat, workorder) => {
|
|
322
|
+
setUpdating(true);
|
|
323
|
+
LogBackend.setWorkorder(mat.materialID, 1, workorder)
|
|
324
|
+
.then((evt) => setExtraLogEvts((evts) => [...evts, evt]))
|
|
325
|
+
.catch(console.log)
|
|
326
|
+
.finally(() => setUpdating(false));
|
|
327
|
+
}, [setExtraLogEvts]);
|
|
328
|
+
return [callback, updating];
|
|
329
|
+
}
|
|
330
|
+
export function useAddNote() {
|
|
331
|
+
const [updating, setUpdating] = useState(false);
|
|
332
|
+
const setExtraLogEvts = useSetAtom(extraLogEventsFromUpdates);
|
|
333
|
+
const callback = useCallback((data) => {
|
|
334
|
+
setUpdating(true);
|
|
335
|
+
LogBackend.recordOperatorNotes(data.matId, data.process, data.operator, data.notes)
|
|
336
|
+
.then((evt) => setExtraLogEvts((evts) => [...evts, evt]))
|
|
337
|
+
.catch(console.log)
|
|
338
|
+
.finally(() => setUpdating(false));
|
|
339
|
+
}, [setExtraLogEvts]);
|
|
340
|
+
return [callback, updating];
|
|
341
|
+
}
|
|
342
|
+
export function usePrintLabel() {
|
|
343
|
+
const [updating, setUpdating] = useState(false);
|
|
344
|
+
const [printed, setPrinted] = useState(false);
|
|
345
|
+
const callback = useCallback((d) => {
|
|
346
|
+
setUpdating(true);
|
|
347
|
+
FmsServerBackend.printLabel(d.materialId, d.proc)
|
|
348
|
+
.catch(console.log)
|
|
349
|
+
.finally(() => {
|
|
350
|
+
setUpdating(false);
|
|
351
|
+
setPrinted(true);
|
|
352
|
+
});
|
|
353
|
+
}, []);
|
|
354
|
+
return [callback, updating, printed];
|
|
355
|
+
}
|
|
356
|
+
export function useRemoveFromQueue() {
|
|
357
|
+
const [updating, setUpdating] = useState(false);
|
|
358
|
+
const callback = useCallback((matId, operator) => {
|
|
359
|
+
setUpdating(true);
|
|
360
|
+
JobsBackend.removeMaterialFromAllQueues(matId, operator ?? undefined)
|
|
361
|
+
.catch(console.log)
|
|
362
|
+
.finally(() => setUpdating(false));
|
|
363
|
+
}, []);
|
|
364
|
+
return [callback, updating];
|
|
365
|
+
}
|
|
366
|
+
export function useSignalForQuarantine() {
|
|
367
|
+
const [updating, setUpdating] = useState(false);
|
|
368
|
+
const callback = useCallback((matId, operator, reason) => {
|
|
369
|
+
setUpdating(true);
|
|
370
|
+
JobsBackend.signalMaterialForQuarantine(matId, operator, reason === "" ? undefined : reason)
|
|
371
|
+
.catch(console.log)
|
|
372
|
+
.finally(() => setUpdating(false));
|
|
373
|
+
}, []);
|
|
374
|
+
return [callback, updating];
|
|
375
|
+
}
|
|
376
|
+
export function useAddExistingMaterialToQueue() {
|
|
377
|
+
const [updating, setUpdating] = useState(false);
|
|
378
|
+
const callback = useCallback((d) => {
|
|
379
|
+
setUpdating(true);
|
|
380
|
+
JobsBackend.setMaterialInQueue(d.materialId, d.operator, new QueuePosition({
|
|
381
|
+
queue: d.queue,
|
|
382
|
+
position: d.queuePosition,
|
|
383
|
+
}))
|
|
384
|
+
.catch(console.log)
|
|
385
|
+
.finally(() => setUpdating(false));
|
|
386
|
+
}, []);
|
|
387
|
+
return [callback, updating];
|
|
388
|
+
}
|
|
389
|
+
export function useAddNewMaterialToQueue() {
|
|
390
|
+
const [updating, setUpdating] = useState(false);
|
|
391
|
+
const callback = useCallback((d) => {
|
|
392
|
+
setUpdating(true);
|
|
393
|
+
JobsBackend.addUnprocessedMaterialToQueue(d.jobUnique, d.lastCompletedProcess, d.queue, d.queuePosition, d.operator, d.workorder, d.serial || "")
|
|
394
|
+
.then((m) => {
|
|
395
|
+
if (d.onNewMaterial && m) {
|
|
396
|
+
d.onNewMaterial(m);
|
|
397
|
+
}
|
|
398
|
+
else if (d.onError) {
|
|
399
|
+
d.onError("No material returned");
|
|
400
|
+
}
|
|
401
|
+
}, d.onError)
|
|
402
|
+
.catch(console.log)
|
|
403
|
+
.finally(() => setUpdating(false));
|
|
404
|
+
}, []);
|
|
405
|
+
return [callback, updating];
|
|
406
|
+
}
|
|
407
|
+
export function useAddNewCastingToQueue() {
|
|
408
|
+
const [updating, setUpdating] = useState(false);
|
|
409
|
+
const callback = useCallback((d) => {
|
|
410
|
+
setUpdating(true);
|
|
411
|
+
JobsBackend.addUnallocatedCastingToQueue(d.casting, d.queue, d.quantity, d.operator, d.workorder, [
|
|
412
|
+
...(d.serials || []),
|
|
413
|
+
])
|
|
414
|
+
.then((ms) => {
|
|
415
|
+
if (d.onNewMaterial)
|
|
416
|
+
d.onNewMaterial(ms);
|
|
417
|
+
}, d.onError)
|
|
418
|
+
.catch(console.log)
|
|
419
|
+
.finally(() => setUpdating(false));
|
|
420
|
+
}, []);
|
|
421
|
+
return [callback, updating];
|
|
422
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IInProcessMaterial, ILogEntry } from "../network/api.js";
|
|
2
|
+
import type { ServerEventAndTime } from "./loading.js";
|
|
3
|
+
import { HashMap, HashSet } from "@seedtactics/immutable-collections";
|
|
4
|
+
import { Atom } from "jotai";
|
|
5
|
+
export interface MaterialSummary {
|
|
6
|
+
readonly materialID: number;
|
|
7
|
+
readonly jobUnique: string;
|
|
8
|
+
readonly partName: string;
|
|
9
|
+
readonly startedProcess1: boolean;
|
|
10
|
+
readonly serial?: string;
|
|
11
|
+
readonly workorderId?: string;
|
|
12
|
+
readonly signaledInspections: ReadonlyArray<string>;
|
|
13
|
+
readonly quarantineAfterUnload: boolean | null | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface MaterialSummaryAndCompletedData extends MaterialSummary {
|
|
16
|
+
readonly numProcesses?: number;
|
|
17
|
+
readonly unloaded_processes?: {
|
|
18
|
+
[process: number]: Date;
|
|
19
|
+
};
|
|
20
|
+
readonly last_unload_time?: Date;
|
|
21
|
+
readonly completed_last_proc_machining?: boolean;
|
|
22
|
+
readonly completed_inspect_time?: Date;
|
|
23
|
+
readonly closeout_completed?: Date;
|
|
24
|
+
readonly closeout_failed?: boolean;
|
|
25
|
+
readonly completedInspections?: {
|
|
26
|
+
[key: string]: {
|
|
27
|
+
time: Date;
|
|
28
|
+
success: boolean;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
readonly currently_quarantined?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface MaterialSummaryFromEvents extends MaterialSummaryAndCompletedData {
|
|
34
|
+
readonly last_event: Date;
|
|
35
|
+
}
|
|
36
|
+
export interface MatSummaryState {
|
|
37
|
+
readonly matsById: HashMap<number, MaterialSummaryFromEvents>;
|
|
38
|
+
readonly matIdsForJob: HashMap<string, HashSet<number>>;
|
|
39
|
+
}
|
|
40
|
+
export declare const last30MaterialSummary: Atom<MatSummaryState>;
|
|
41
|
+
export declare const specificMonthMaterialSummary: Atom<MatSummaryState>;
|
|
42
|
+
export declare function inproc_mat_to_summary(mat: Readonly<IInProcessMaterial>): MaterialSummary;
|
|
43
|
+
export declare const setLast30MatSummary: import("jotai").WritableAtom<null, [log: readonly Readonly<ILogEntry>[]], void> & {
|
|
44
|
+
init: null;
|
|
45
|
+
};
|
|
46
|
+
export declare const updateLast30MatSummary: import("jotai").WritableAtom<null, [ServerEventAndTime], void> & {
|
|
47
|
+
init: null;
|
|
48
|
+
};
|
|
49
|
+
export declare const setSpecificMonthMatSummary: import("jotai").WritableAtom<null, [log: readonly Readonly<ILogEntry>[]], void> & {
|
|
50
|
+
init: null;
|
|
51
|
+
};
|
|
52
|
+
export {};
|