truflow 0.0.189 → 0.0.191
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/dist/API/Allmoxy/IContact.d.ts +57 -0
- package/dist/Helpers/IOrders/IMoveOrder.d.ts +1 -1
- package/dist/Helpers/IZapier/index.d.ts +7 -6
- package/dist/IAutomation.d.ts +197 -0
- package/dist/IDailyTotal.d.ts +6 -0
- package/dist/IExporter.d.ts +1 -0
- package/dist/IExpress.d.ts +2 -0
- package/dist/IExpress.js +1 -0
- package/dist/IInventory.d.ts +35 -0
- package/dist/IMailCache.d.ts +13 -0
- package/dist/INotification.d.ts +9 -0
- package/dist/IOrder.d.ts +1 -1
- package/dist/IScannerActivity.d.ts +54 -0
- package/dist/IScannerActivity.js +2 -0
- package/dist/ISchedule.d.ts +147 -0
- package/dist/ISchedule.js +2 -0
- package/dist/ISetting.d.ts +32 -2
- package/dist/ISupplier.d.ts +10 -6
- package/dist/IUser.d.ts +2 -0
- package/dist/Inventory/IInventoryTransfer.d.ts +122 -0
- package/dist/Inventory/IInventoryTransfer.js +2 -0
- package/dist/Inventory/ILocation.d.ts +9 -0
- package/dist/{IInventoryLocation.d.ts → Inventory/ISelectFieldDefinition.d.ts} +20 -34
- package/dist/Inventory/ISelectFieldDefinition.js +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package-lock.json +2180 -0
- package/package.json +15 -5
- package/src/Helpers/IOrders/IMoveOrder.ts +1 -1
- package/src/Helpers/IZapier/index.ts +9 -6
- package/src/IAutomation.ts +264 -0
- package/src/IDailyTotal.ts +7 -0
- package/src/IExporter.ts +1 -0
- package/src/IExpress.ts +1 -0
- package/src/IIntegration.ts +1 -0
- package/src/IInventory.ts +38 -0
- package/src/IMailCache.ts +14 -0
- package/src/INotification.ts +21 -0
- package/src/IOrder.ts +1 -1
- package/src/ISchedule.ts +162 -0
- package/src/ISetting.ts +50 -2
- package/src/ISupplier.ts +12 -6
- package/src/IUser.ts +2 -0
- package/src/Inventory/IInventoryTransfer.ts +108 -0
- package/src/Inventory/ILocation.ts +17 -0
- package/src/Inventory/ISelectFieldDefinition.ts +29 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +4 -1
- package/dist/ILocation.d.ts +0 -75
- /package/dist/{IInventoryLocation.js → API/Allmoxy/IContact.js} +0 -0
- /package/dist/{ILocation.js → IAutomation.js} +0 -0
package/src/ISchedule.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import mongoose, { Document } from "mongoose";
|
|
2
|
+
|
|
3
|
+
// Filter condition for matching Allmoxy products/attributes
|
|
4
|
+
export interface IScheduleFilterCondition {
|
|
5
|
+
field: "product" | "attribute";
|
|
6
|
+
productId?: number;
|
|
7
|
+
attributeName?: string;
|
|
8
|
+
operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Enhanced filter condition for view-level filtering
|
|
13
|
+
export interface IViewFilterCondition {
|
|
14
|
+
id?: string; // Unique identifier for the filter condition
|
|
15
|
+
fieldType: "standard" | "customField" | "date" | "attribute"; // Type of field being filtered
|
|
16
|
+
fieldName: string; // Field name (e.g., "status", "shipDate", custom field name, or attribute name)
|
|
17
|
+
operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "in" | "notIn" | "isEmpty" | "isNotEmpty" | "between";
|
|
18
|
+
value?: any; // Filter value(s) - can be string, number, array for "in"/"notIn", or object with {start, end} for "between"
|
|
19
|
+
label?: string; // Display label for the field
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Sort configuration for filters
|
|
23
|
+
export interface IFilterSortCondition {
|
|
24
|
+
fieldType: "standard" | "customField" | "date" | "attribute"; // Type of field being sorted
|
|
25
|
+
fieldName: string; // Field name to sort by
|
|
26
|
+
direction: "asc" | "desc"; // Sort direction
|
|
27
|
+
order: number; // Priority order (lower number = higher priority)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Saved filter configuration
|
|
31
|
+
export interface ISavedViewFilter {
|
|
32
|
+
_id?: mongoose.Types.ObjectId;
|
|
33
|
+
name: string; // Name of the saved filter
|
|
34
|
+
conditions: IViewFilterCondition[]; // Array of filter conditions
|
|
35
|
+
conditionOperator: "and" | "or"; // How to combine conditions
|
|
36
|
+
description?: string; // Optional description
|
|
37
|
+
sortConditions?: IFilterSortCondition[]; // Sort conditions (applied after filtering)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// A filter group - conditions are combined based on conditionOperator
|
|
41
|
+
export interface IScheduleFilterGroup {
|
|
42
|
+
conditions: IScheduleFilterCondition[];
|
|
43
|
+
conditionOperator?: "and" | "or";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Column/Stage configuration for the schedule
|
|
47
|
+
export interface IScheduleColumn {
|
|
48
|
+
_id?: mongoose.Types.ObjectId;
|
|
49
|
+
name: string;
|
|
50
|
+
machineId: mongoose.Types.ObjectId;
|
|
51
|
+
offsetDays: number; // Days offset from the base date (ship date or start date)
|
|
52
|
+
order: number; // Display order of this column
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Display column configuration - controls order and visibility of all columns
|
|
56
|
+
export interface IScheduleDisplayColumn {
|
|
57
|
+
type: "orderNumber" | "company" | "product" | "quantity" | "shipDate" | "startDate" | "status" | "attribute" | "stage" | "customField";
|
|
58
|
+
stageColumnId?: mongoose.Types.ObjectId; // Reference to the stage column if type is "stage"
|
|
59
|
+
attributeName?: string; // Reference to the attribute if type is "attribute"
|
|
60
|
+
customFieldName?: string; // Reference to the custom field name if type is "customField"
|
|
61
|
+
order: number;
|
|
62
|
+
visible: boolean; // Whether column is visible in the schedule view
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Additional attribute with optional display condition
|
|
66
|
+
export interface IScheduleAdditionalAttribute {
|
|
67
|
+
attributeName: string;
|
|
68
|
+
label?: string; // Optional custom label for display
|
|
69
|
+
// Optional condition - if specified, attribute only displays when condition is met
|
|
70
|
+
displayCondition?: {
|
|
71
|
+
operator: "equals" | "notEquals" | "contains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
|
|
72
|
+
value: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Schedule View - different ways to view the same schedule data
|
|
77
|
+
export interface IScheduleView {
|
|
78
|
+
_id?: mongoose.Types.ObjectId;
|
|
79
|
+
name: string;
|
|
80
|
+
layoutType: "table" | "kanban" | "gantt";
|
|
81
|
+
// Display column configuration (for table layout)
|
|
82
|
+
displayColumns?: IScheduleDisplayColumn[];
|
|
83
|
+
// Sorting configuration
|
|
84
|
+
sortField?: string; // Can be "shipDate", "startDate", "status", or a column ID
|
|
85
|
+
sortDirection?: "asc" | "desc";
|
|
86
|
+
// Additional attributes to show (beyond filter attributes)
|
|
87
|
+
additionalAttributes?: (string | IScheduleAdditionalAttribute)[]; // Array of attribute names or attribute configs
|
|
88
|
+
combineAdditionalAttributes?: boolean; // Whether to show all additional attributes in one column (like matched attributes)
|
|
89
|
+
// Product grouping configuration
|
|
90
|
+
groupByMatchingAttributes?: boolean; // Whether to group products with matching filter attributes in the same order
|
|
91
|
+
isDefault?: boolean; // Whether this is the default view
|
|
92
|
+
// Saved filters for this view
|
|
93
|
+
savedFilters?: ISavedViewFilter[];
|
|
94
|
+
// ID of the default filter to apply
|
|
95
|
+
defaultFilterId?: mongoose.Types.ObjectId;
|
|
96
|
+
// Currently active filter (not saved, just for UI state)
|
|
97
|
+
activeFilterId?: mongoose.Types.ObjectId;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Custom field definition for schedule entries
|
|
101
|
+
export interface IScheduleCustomField {
|
|
102
|
+
_id?: mongoose.Types.ObjectId;
|
|
103
|
+
name: string; // Internal field name (e.g., "drill_specs_confirmed")
|
|
104
|
+
label: string; // Display label (e.g., "Drill Specs Confirmed")
|
|
105
|
+
fieldType: "boolean" | "select" | "text" | "number"; // Type of field
|
|
106
|
+
options?: string[]; // Options for select fields (e.g., ["in process", "stuck", "completed"])
|
|
107
|
+
defaultValue?: string | boolean | number; // Default value for new entries
|
|
108
|
+
required?: boolean; // Whether field is required
|
|
109
|
+
order?: number; // Display order
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// The main Schedule configuration
|
|
113
|
+
export interface ILeanSchedule {
|
|
114
|
+
_id: mongoose.Types.ObjectId;
|
|
115
|
+
name: string;
|
|
116
|
+
description?: string;
|
|
117
|
+
enabled: boolean;
|
|
118
|
+
// Filter configuration - groups are ORed together
|
|
119
|
+
filterGroups: IScheduleFilterGroup[];
|
|
120
|
+
groupOperator: "and" | "or";
|
|
121
|
+
// Column/Stage configuration
|
|
122
|
+
columns: IScheduleColumn[];
|
|
123
|
+
// Views for this schedule
|
|
124
|
+
views?: IScheduleView[];
|
|
125
|
+
// Custom fields for this schedule
|
|
126
|
+
customFields?: IScheduleCustomField[];
|
|
127
|
+
// Base date field to calculate offsets from
|
|
128
|
+
baseDateField: "shipDate" | "startDate";
|
|
129
|
+
// Legacy fields (kept for backward compatibility, will be migrated to default view)
|
|
130
|
+
displayColumns?: IScheduleDisplayColumn[];
|
|
131
|
+
hidePastShipDates?: boolean;
|
|
132
|
+
hideShippedOrders?: boolean;
|
|
133
|
+
showShipDate?: boolean;
|
|
134
|
+
showStartDate?: boolean;
|
|
135
|
+
defaultSortField?: string;
|
|
136
|
+
defaultSortDirection?: "asc" | "desc";
|
|
137
|
+
createdAt?: Date;
|
|
138
|
+
updatedAt?: Date;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export type ISchedule = ILeanSchedule & Document;
|
|
142
|
+
|
|
143
|
+
// Schedule Entry - the actual scheduled dates for an order product
|
|
144
|
+
export interface IScheduleEntryDate {
|
|
145
|
+
columnId: mongoose.Types.ObjectId;
|
|
146
|
+
date: string; // ISO date string
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ILeanScheduleEntry {
|
|
150
|
+
_id: mongoose.Types.ObjectId;
|
|
151
|
+
scheduleId: mongoose.Types.ObjectId;
|
|
152
|
+
orderId: number;
|
|
153
|
+
orderProductId: string;
|
|
154
|
+
dates: IScheduleEntryDate[];
|
|
155
|
+
notes?: string;
|
|
156
|
+
status?: string; // Legacy status field
|
|
157
|
+
customStatus?: { [key: string]: any }; // Custom status fields (key-value pairs)
|
|
158
|
+
createdAt?: Date;
|
|
159
|
+
updatedAt?: Date;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export type IScheduleEntry = ILeanScheduleEntry & Document;
|
package/src/ISetting.ts
CHANGED
|
@@ -25,20 +25,63 @@ export interface ILeanHoliday extends ILeanSetting {
|
|
|
25
25
|
recurs?: string;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export type AttributeFilterOperator =
|
|
29
|
+
| "equals"
|
|
30
|
+
| "notEquals"
|
|
31
|
+
| "contains"
|
|
32
|
+
| "notContains"
|
|
33
|
+
| "startsWith"
|
|
34
|
+
| "endsWith";
|
|
35
|
+
|
|
36
|
+
export interface IAttributeFilter {
|
|
37
|
+
attributeName: string;
|
|
38
|
+
operator?: AttributeFilterOperator;
|
|
39
|
+
value: any;
|
|
40
|
+
}
|
|
41
|
+
|
|
28
42
|
export interface ILeanLimit extends ILeanSetting {
|
|
29
43
|
name: string;
|
|
30
44
|
rpd: string;
|
|
31
|
-
|
|
45
|
+
capacity: string;
|
|
32
46
|
enabled: boolean;
|
|
33
47
|
products?: [
|
|
34
48
|
{
|
|
35
49
|
name: string;
|
|
50
|
+
allmoxyProductId?: number;
|
|
36
51
|
sheetGroupingAttribute?: string;
|
|
37
52
|
grainedProduct?: boolean;
|
|
38
53
|
grainedProductAttribute?: string;
|
|
54
|
+
attributeFilters?: IAttributeFilter[];
|
|
55
|
+
priority?: number;
|
|
39
56
|
}
|
|
40
57
|
];
|
|
41
58
|
nestable?: boolean;
|
|
59
|
+
visibleOnDashboard?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface IMachinePathStep {
|
|
63
|
+
machine: mongoose.Types.ObjectId;
|
|
64
|
+
offsetDays: number;
|
|
65
|
+
_id?: mongoose.Types.ObjectId;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Production Line is the new name for Limits, with additional path configuration
|
|
69
|
+
export interface ILeanProductionLine extends ILeanLimit {
|
|
70
|
+
// Machine path: ordered list of machines with timing offsets
|
|
71
|
+
machinePath?: IMachinePathStep[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Machine or Station in the production facility
|
|
75
|
+
export interface ILeanMachine extends ILeanSetting {
|
|
76
|
+
name: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
type: "machine" | "station";
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
// Optional capacity or throughput metrics
|
|
81
|
+
dailyCapacity?: number;
|
|
82
|
+
// Optional location or area information
|
|
83
|
+
location?: string;
|
|
84
|
+
visibleOnDashboard?: boolean;
|
|
42
85
|
}
|
|
43
86
|
|
|
44
87
|
export interface ILeanOrderFlag extends ILeanSetting {
|
|
@@ -51,7 +94,7 @@ export interface ILeanOrderFlag extends ILeanSetting {
|
|
|
51
94
|
export interface ILeanSorting extends ILeanSetting {
|
|
52
95
|
headerList?: string[];
|
|
53
96
|
itemList: string[];
|
|
54
|
-
usage: "totals-groups" | "
|
|
97
|
+
usage: "totals-groups" | "production-lines" | "machines";
|
|
55
98
|
}
|
|
56
99
|
|
|
57
100
|
export interface ICalculation {
|
|
@@ -68,6 +111,7 @@ export interface ILeanTotalsGroup extends ILeanSetting {
|
|
|
68
111
|
calculations?: ICalculation[];
|
|
69
112
|
dailyLimit?: number;
|
|
70
113
|
buffer?: number;
|
|
114
|
+
visibleOnDashboard?: boolean;
|
|
71
115
|
}
|
|
72
116
|
|
|
73
117
|
export interface ILeanKeyValue extends ILeanSetting {
|
|
@@ -92,3 +136,7 @@ export type ISorting = ILeanSorting & Document;
|
|
|
92
136
|
export type ITotalsGroup = ILeanTotalsGroup & Document;
|
|
93
137
|
|
|
94
138
|
export type IKeyValue = ILeanKeyValue & Document;
|
|
139
|
+
|
|
140
|
+
export type IProductionLine = ILeanProductionLine & Document;
|
|
141
|
+
|
|
142
|
+
export type IMachine = ILeanMachine & Document;
|
package/src/ISupplier.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import mongoose, { Document } from "mongoose";
|
|
2
2
|
|
|
3
|
+
export interface ISupplierContact {
|
|
4
|
+
_id?: mongoose.Types.ObjectId;
|
|
5
|
+
name: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
role?: string;
|
|
9
|
+
notifyOnVMIPurchase?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
export interface ISupplier {
|
|
4
13
|
_id: mongoose.Types.ObjectId;
|
|
5
14
|
name: string;
|
|
6
15
|
code: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
phone?: string;
|
|
10
|
-
address?: string;
|
|
11
|
-
contactPerson?: string;
|
|
12
|
-
};
|
|
16
|
+
// Contacts array for multiple contacts
|
|
17
|
+
contacts?: ISupplierContact[];
|
|
13
18
|
notes?: string;
|
|
14
19
|
active: boolean;
|
|
20
|
+
allowedInventoryTypes?: mongoose.Types.ObjectId[];
|
|
15
21
|
createdAt: Date;
|
|
16
22
|
updatedAt: Date;
|
|
17
23
|
}
|
package/src/IUser.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose, { Document } from "mongoose";
|
|
2
|
+
import { NotificationTag } from "./INotification";
|
|
2
3
|
|
|
3
4
|
export type IUser = ILeanUser & Document;
|
|
4
5
|
|
|
@@ -11,6 +12,7 @@ export interface ILeanUser {
|
|
|
11
12
|
permissions: any[];
|
|
12
13
|
groups: any[];
|
|
13
14
|
pushSubscriptions?: PushSubscription[];
|
|
15
|
+
pushNotificationTags?: NotificationTag[]; // Tags user wants to receive push notifications for
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export interface PushSubscription {
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Single item in a bulk transfer
|
|
5
|
+
*/
|
|
6
|
+
export interface ITransferItem {
|
|
7
|
+
itemId: Types.ObjectId; // Reference to InventoryItem
|
|
8
|
+
fromLocation: Types.ObjectId;
|
|
9
|
+
fromLocationPath?: {
|
|
10
|
+
rackId?: Types.ObjectId;
|
|
11
|
+
shelfId?: Types.ObjectId;
|
|
12
|
+
binId?: Types.ObjectId;
|
|
13
|
+
};
|
|
14
|
+
toLocation: Types.ObjectId;
|
|
15
|
+
toLocationPath?: {
|
|
16
|
+
rackId?: Types.ObjectId;
|
|
17
|
+
shelfId?: Types.ObjectId;
|
|
18
|
+
binId?: Types.ObjectId;
|
|
19
|
+
};
|
|
20
|
+
quantity?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Inventory transfer - records movement of inventory between locations
|
|
25
|
+
* Supports both single and bulk transfers
|
|
26
|
+
*/
|
|
27
|
+
export interface IInventoryTransfer {
|
|
28
|
+
_id: Types.ObjectId;
|
|
29
|
+
// Single transfer fields (backward compatibility)
|
|
30
|
+
itemId?: Types.ObjectId; // Reference to InventoryItem
|
|
31
|
+
fromLocation?: Types.ObjectId; // Reference to Location
|
|
32
|
+
fromLocationPath?: {
|
|
33
|
+
rackId?: Types.ObjectId;
|
|
34
|
+
shelfId?: Types.ObjectId;
|
|
35
|
+
binId?: Types.ObjectId;
|
|
36
|
+
};
|
|
37
|
+
toLocation?: Types.ObjectId; // Reference to Location
|
|
38
|
+
toLocationPath?: {
|
|
39
|
+
rackId?: Types.ObjectId;
|
|
40
|
+
shelfId?: Types.ObjectId;
|
|
41
|
+
binId?: Types.ObjectId;
|
|
42
|
+
};
|
|
43
|
+
quantity?: number; // Optional: if only transferring part of the item
|
|
44
|
+
|
|
45
|
+
// Bulk transfer fields
|
|
46
|
+
items?: ITransferItem[]; // For bulk transfers
|
|
47
|
+
isBulk?: boolean; // Flag to indicate bulk transfer
|
|
48
|
+
|
|
49
|
+
notes?: string;
|
|
50
|
+
status: "pending" | "completed" | "cancelled";
|
|
51
|
+
initiatedBy: Types.ObjectId; // Reference to User
|
|
52
|
+
completedBy?: Types.ObjectId; // Reference to User
|
|
53
|
+
completedAt?: Date;
|
|
54
|
+
createdAt: Date;
|
|
55
|
+
updatedAt: Date;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type IInventoryTransferDocument = IInventoryTransfer & Document;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Count session item - tracks counting of a single inventory item
|
|
62
|
+
*/
|
|
63
|
+
export interface ICountSessionItem {
|
|
64
|
+
itemId: Types.ObjectId; // Reference to InventoryItem
|
|
65
|
+
expectedLocation?: Types.ObjectId;
|
|
66
|
+
expectedLocationPath?: {
|
|
67
|
+
rackId?: Types.ObjectId;
|
|
68
|
+
shelfId?: Types.ObjectId;
|
|
69
|
+
binId?: Types.ObjectId;
|
|
70
|
+
};
|
|
71
|
+
actualLocation?: Types.ObjectId;
|
|
72
|
+
actualLocationPath?: {
|
|
73
|
+
rackId?: Types.ObjectId;
|
|
74
|
+
shelfId?: Types.ObjectId;
|
|
75
|
+
binId?: Types.ObjectId;
|
|
76
|
+
};
|
|
77
|
+
expectedQuantity?: number;
|
|
78
|
+
countedQuantity?: number;
|
|
79
|
+
status: "pending" | "counted" | "discrepancy" | "resolved";
|
|
80
|
+
scannedAt?: Date;
|
|
81
|
+
notes?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Inventory counting session - guides users through rack-by-rack counting
|
|
86
|
+
*/
|
|
87
|
+
export interface IInventoryCountSession {
|
|
88
|
+
_id: Types.ObjectId;
|
|
89
|
+
name: string;
|
|
90
|
+
locationId: Types.ObjectId; // Reference to Location
|
|
91
|
+
racks: Types.ObjectId[]; // Array of rack IDs to count
|
|
92
|
+
shelves?: Types.ObjectId[]; // Optional: Array of shelf IDs for granular counting
|
|
93
|
+
bins?: Types.ObjectId[]; // Optional: Array of bin IDs for most granular counting
|
|
94
|
+
currentRackIndex: number; // Which rack we're currently counting
|
|
95
|
+
currentRackId?: Types.ObjectId;
|
|
96
|
+
items: ICountSessionItem[];
|
|
97
|
+
totalExpectedItems: number;
|
|
98
|
+
status: "not_started" | "in_progress" | "completed" | "cancelled";
|
|
99
|
+
startedBy: Types.ObjectId; // Reference to User
|
|
100
|
+
startedAt?: Date;
|
|
101
|
+
completedBy?: Types.ObjectId;
|
|
102
|
+
completedAt?: Date;
|
|
103
|
+
notes?: string;
|
|
104
|
+
createdAt: Date;
|
|
105
|
+
updatedAt: Date;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type IInventoryCountSessionDocument = IInventoryCountSession & Document;
|
|
@@ -19,18 +19,28 @@ export interface ILocationComponentBase {
|
|
|
19
19
|
export interface IBin extends ILocationComponentBase {
|
|
20
20
|
capacity?: number;
|
|
21
21
|
currentStock?: number;
|
|
22
|
+
// For merged bins: array of bin IDs that are merged into one logical bin
|
|
23
|
+
mergedWith?: Types.ObjectId[];
|
|
24
|
+
// If this bin is merged into another, reference the primary bin
|
|
25
|
+
mergedInto?: Types.ObjectId;
|
|
26
|
+
// Array of inventory type IDs that can be stored in this bin
|
|
27
|
+
allowedInventoryTypes?: Types.ObjectId[];
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
export interface IShelf extends ILocationComponentBase {
|
|
25
31
|
bins: IBin[];
|
|
26
32
|
capacity?: number;
|
|
27
33
|
currentStock?: number;
|
|
34
|
+
// Array of inventory type IDs that can be stored in this shelf
|
|
35
|
+
allowedInventoryTypes?: Types.ObjectId[];
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
export interface IRack extends ILocationComponentBase {
|
|
31
39
|
shelves: IShelf[];
|
|
32
40
|
capacity?: number;
|
|
33
41
|
currentStock?: number;
|
|
42
|
+
// Array of inventory type IDs that can be stored in this rack
|
|
43
|
+
allowedInventoryTypes?: Types.ObjectId[];
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
export interface ILocationMethods {
|
|
@@ -48,6 +58,13 @@ export interface ILocation extends Omit<Document, '_id'>, ILocationComponentBase
|
|
|
48
58
|
capacity?: number;
|
|
49
59
|
currentStock?: number;
|
|
50
60
|
isActive: boolean;
|
|
61
|
+
// Array of inventory type IDs that can be stored in this location
|
|
62
|
+
allowedInventoryTypes?: Types.ObjectId[];
|
|
63
|
+
// VMI (Vendor Managed Inventory) configuration
|
|
64
|
+
isVMI?: boolean;
|
|
65
|
+
allowedSuppliers?: Types.ObjectId[]; // Suppliers allowed to manage VMI inventory at this location
|
|
66
|
+
// Transfer restrictions: controls direction of inventory movement
|
|
67
|
+
transferRestriction?: "bidirectional" | "inbound_only" | "outbound_only";
|
|
51
68
|
}
|
|
52
69
|
|
|
53
70
|
export interface ILocationPath {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Document, Types } from "mongoose";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Select field definition option
|
|
5
|
+
*/
|
|
6
|
+
export interface ISelectOption {
|
|
7
|
+
key: string; // Unique key for the option (e.g., "4_4_MAPLE")
|
|
8
|
+
value: string; // Display value (e.g., "4/4 Maple")
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Source type for select field data
|
|
13
|
+
*/
|
|
14
|
+
export type SelectFieldSource = "table";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Select field definition - defines a reusable select field with its options
|
|
18
|
+
*/
|
|
19
|
+
export interface ISelectFieldDefinition {
|
|
20
|
+
_id: Types.ObjectId;
|
|
21
|
+
name: string; // Display name (e.g., "Material Types", "Finish Options")
|
|
22
|
+
description?: string;
|
|
23
|
+
source: SelectFieldSource; // Where the data comes from
|
|
24
|
+
options: ISelectOption[]; // Options array
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
updatedAt: Date;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type ISelectFieldDefinitionDocument = ISelectFieldDefinition & Document;
|
package/src/index.ts
CHANGED
|
@@ -30,5 +30,9 @@ export * from "./Classes/IRoute";
|
|
|
30
30
|
export * from "./IApplication";
|
|
31
31
|
export * from "./IQualityControl";
|
|
32
32
|
export * from "./Inventory/ILocation";
|
|
33
|
+
export * from "./Inventory/ISelectFieldDefinition";
|
|
34
|
+
export * from "./Inventory/IInventoryTransfer";
|
|
33
35
|
export * from "./IInventory";
|
|
34
36
|
export * from "./ISupplier";
|
|
37
|
+
export * from "./ISchedule";
|
|
38
|
+
export * from "./IAutomation";
|
package/tsconfig.json
CHANGED
package/dist/ILocation.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
-
/// <reference types="mongoose/types/callback" />
|
|
3
|
-
/// <reference types="mongoose/types/collection" />
|
|
4
|
-
/// <reference types="mongoose/types/connection" />
|
|
5
|
-
/// <reference types="mongoose/types/cursor" />
|
|
6
|
-
/// <reference types="mongoose/types/document" />
|
|
7
|
-
/// <reference types="mongoose/types/error" />
|
|
8
|
-
/// <reference types="mongoose/types/expressions" />
|
|
9
|
-
/// <reference types="mongoose/types/helpers" />
|
|
10
|
-
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
-
/// <reference types="mongoose/types/indexes" />
|
|
12
|
-
/// <reference types="mongoose/types/models" />
|
|
13
|
-
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
-
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
-
/// <reference types="mongoose/types/populate" />
|
|
16
|
-
/// <reference types="mongoose/types/query" />
|
|
17
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
-
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
-
/// <reference types="mongoose/types/session" />
|
|
20
|
-
/// <reference types="mongoose/types/types" />
|
|
21
|
-
/// <reference types="mongoose/types/utility" />
|
|
22
|
-
/// <reference types="mongoose/types/validation" />
|
|
23
|
-
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
-
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import { Document, Model, Types } from "mongoose";
|
|
26
|
-
/**
|
|
27
|
-
* Base interface for location components with common fields
|
|
28
|
-
*/
|
|
29
|
-
export interface ILocationComponentBase {
|
|
30
|
-
_id: Types.ObjectId;
|
|
31
|
-
name: string;
|
|
32
|
-
code: string;
|
|
33
|
-
status: number;
|
|
34
|
-
createdBy: string;
|
|
35
|
-
createdById: number;
|
|
36
|
-
createdDate: Date;
|
|
37
|
-
updatedBy: string;
|
|
38
|
-
updatedById: number;
|
|
39
|
-
updatedDate: Date;
|
|
40
|
-
}
|
|
41
|
-
export interface IBin extends ILocationComponentBase {
|
|
42
|
-
capacity?: number;
|
|
43
|
-
currentStock?: number;
|
|
44
|
-
}
|
|
45
|
-
export interface IShelf extends ILocationComponentBase {
|
|
46
|
-
bins: IBin[];
|
|
47
|
-
capacity?: number;
|
|
48
|
-
currentStock?: number;
|
|
49
|
-
}
|
|
50
|
-
export interface IRack extends ILocationComponentBase {
|
|
51
|
-
shelves: IShelf[];
|
|
52
|
-
capacity?: number;
|
|
53
|
-
currentStock?: number;
|
|
54
|
-
}
|
|
55
|
-
export interface ILocationMethods {
|
|
56
|
-
generateUniqueCode(prefix: string): Promise<string>;
|
|
57
|
-
}
|
|
58
|
-
export interface ILocationModel extends Model<ILocation, {}, ILocationMethods> {
|
|
59
|
-
generateUniqueCode(prefix: string): Promise<string>;
|
|
60
|
-
}
|
|
61
|
-
export interface ILocation extends Omit<Document, '_id'>, ILocationComponentBase {
|
|
62
|
-
type: "warehouse" | "shed" | "other";
|
|
63
|
-
description?: string;
|
|
64
|
-
racks: IRack[];
|
|
65
|
-
capacity?: number;
|
|
66
|
-
currentStock?: number;
|
|
67
|
-
isActive: boolean;
|
|
68
|
-
}
|
|
69
|
-
export interface ILocationPath {
|
|
70
|
-
locationId: Types.ObjectId;
|
|
71
|
-
rackId?: Types.ObjectId;
|
|
72
|
-
shelfId?: Types.ObjectId;
|
|
73
|
-
binId?: Types.ObjectId;
|
|
74
|
-
path: string;
|
|
75
|
-
}
|
|
File without changes
|
|
File without changes
|