1 | class InventoryItem { |
---|
2 | InventoryGroup inventoryGroup |
---|
3 | InventoryType inventoryType |
---|
4 | UnitOfMeasure unitOfMeasure |
---|
5 | InventoryLocation inventoryLocation |
---|
6 | Picture picture |
---|
7 | Supplier preferredSupplier |
---|
8 | String name |
---|
9 | String description = "" |
---|
10 | String comment = "" |
---|
11 | BigDecimal estimatedUnitPriceAmount |
---|
12 | Currency estimatedUnitPriceCurrency |
---|
13 | String suppliersPartNumber |
---|
14 | Integer unitsInStock = 0 |
---|
15 | Integer reorderPoint |
---|
16 | Integer reorderQuantity |
---|
17 | boolean isActive = true |
---|
18 | boolean isObsolete = false |
---|
19 | boolean enableReorderListing = true |
---|
20 | |
---|
21 | static mapping = { |
---|
22 | picture cascade: 'all-delete-orphan', lazy: true, inverse: true |
---|
23 | } |
---|
24 | |
---|
25 | static hasMany = [spareFor: Asset, |
---|
26 | inventoryMovements: InventoryMovement, |
---|
27 | alternateSuppliers: Supplier] |
---|
28 | |
---|
29 | // static belongsTo = [] |
---|
30 | |
---|
31 | static constraints = { |
---|
32 | picture(nullable:true) |
---|
33 | name(unique:true, blank:false, maxSize:50) |
---|
34 | description(maxSize:255) |
---|
35 | comment(maxSize:500) |
---|
36 | unitsInStock(min:0) |
---|
37 | unitOfMeasure() |
---|
38 | estimatedUnitPriceAmount(nullable:true, max: new BigDecimal(1000000000000)) |
---|
39 | estimatedUnitPriceCurrency(nullable:true) |
---|
40 | reorderPoint() |
---|
41 | enableReorderListing() |
---|
42 | reorderQuantity(nullable:true) |
---|
43 | isActive() |
---|
44 | isObsolete() |
---|
45 | inventoryGroup() |
---|
46 | inventoryType() |
---|
47 | suppliersPartNumber(blank:true, nullable:true) |
---|
48 | preferredSupplier(nullable:true) |
---|
49 | } |
---|
50 | |
---|
51 | String toString() {"${this.name}"} |
---|
52 | |
---|
53 | static searchable = { |
---|
54 | only = ['name', 'description', 'comment', 'isActive', 'isObsolete', 'inventoryLocation', 'inventoryGroup', 'spareFor'] |
---|
55 | //name boost: 1.5 |
---|
56 | inventoryLocation component: true |
---|
57 | inventoryGroup component: true |
---|
58 | spareFor component: true |
---|
59 | } |
---|
60 | |
---|
61 | } |
---|