Ignore:
Timestamp:
Oct 29, 2009, 8:30:58 PM (14 years ago)
Author:
gav
Message:

Substantial refactor of the Inventory domain.
InventoryItems can now be added to tasks, no quantity adjustments done yet.
Removed StoredItem and with it the ability to store an inventoryItem in multiple places, just too complex right now.
Svn move StoreLocation to InventoryLocation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/CreateDataService.groovy

    r164 r175  
    3737        createBaseUnitsOfMeasure()
    3838        createBasePeriods()
     39        createBaseSupplierType()
     40        createBaseManufacturerType()
    3941        // Tasks
    4042        createBaseTaskStatus()
     
    4547        // Inventory
    4648        createBaseInventoryTypes()
     49        createBaseInventoryMovementTypes()
    4750        createBaseMaintenancePolicies()
    4851        // Assets
     
    6063        createDemoSites()
    6164        createDemoDepartments()
     65        createDemoSuppliers()
     66        createDemoManufacturers()
    6267        // Tasks
    6368        createDemoTaskGroups() /// @todo: Perhaps this should be BaseData?
     
    6873        // Inventory
    6974        createDemoInventoryStores()  /// @todo: Perhaps a 'createQuickStartData' method?
    70         createDemoStoreLocations()
     75        createDemoInventoryLocations()
    7176        createDemoInventoryGroups() /// @todo: Perhaps a 'createQuickStartData' method?
    7277        createDemoInventoryItems()
    73         createDemoStoredItems()
    7478        // Assets
    7579        createDemoLifePlan()
     
    310314    }
    311315
     316    def createBaseSupplierType() {
     317
     318        // SupplierType
     319        def supplierTypeInstance
     320
     321        // SupplierType #1
     322        supplierTypeInstance = new SupplierType(name: "OEM",
     323                                                                    description: "Original equipment supplier")
     324        saveAndTest(supplierTypeInstance)
     325
     326        // SupplierType #2
     327        supplierTypeInstance = new SupplierType(name: "Local",
     328                                                                    description: "Local supplier")
     329        saveAndTest(supplierTypeInstance)
     330    }
     331
     332    def createBaseManufacturerType() {
     333
     334        // ManufacturerType
     335        def manufacturerTypeInstance
     336
     337        // ManufacturerType #1
     338        manufacturerTypeInstance = new ManufacturerType(name: "OEM",
     339                                                                        description: "Original equipment manufacturer")
     340        saveAndTest(manufacturerTypeInstance)
     341
     342        // ManufacturerType #2
     343        manufacturerTypeInstance = new ManufacturerType(name: "Alternate",
     344                                                                        description: "Not original equipment manufacturer")
     345        saveAndTest(manufacturerTypeInstance)
     346
     347    }
     348
     349    def createDemoSuppliers() {
     350
     351        // Supplier
     352        def supplierInstance
     353
     354        // Supplier #1
     355        supplierInstance = new Supplier(name: "OEM Distributors",
     356                                                                        supplierType: SupplierType.get(1))
     357        saveAndTest(supplierInstance)
     358
     359        // Supplier #2
     360        supplierInstance = new Supplier(name: "Mex Holdings",
     361                                                                        supplierType: SupplierType.get(2))
     362        saveAndTest(supplierInstance)
     363    }
     364
     365    def createDemoManufacturers() {
     366
     367        // Manufacturer
     368        def manufacturerInstance
     369
     370        // Manufacturer #1
     371        manufacturerInstance = new Manufacturer(name: "OEM Manufacturer",
     372                                                                        manufacturerType: ManufacturerType.get(1))
     373        saveAndTest(manufacturerInstance)
     374
     375        // Manufacturer #2
     376        manufacturerInstance = new Manufacturer(name: "Laser Cutting Services Pty",
     377                                                                        manufacturerType: ManufacturerType.get(2))
     378        saveAndTest(manufacturerInstance)
     379    }
     380
    312381/*********************
    313382START OF TASK
     
    587656    }
    588657
    589     def createDemoStoreLocations() {
    590 
    591         //StoreLocation
    592         def storeLocation
    593 
    594         storeLocation = new StoreLocation(inventoryStore: InventoryStore.get(1), bin: "A1-2")
    595         saveAndTest(storeLocation)
    596 
    597         storeLocation = new StoreLocation(inventoryStore: InventoryStore.get(1), bin: "C55")
    598         saveAndTest(storeLocation)
     658    def createDemoInventoryLocations() {
     659
     660        // InventoryLocation
     661        def inventoryLocation
     662
     663        inventoryLocation = new InventoryLocation(inventoryStore: InventoryStore.get(1), name: "A1-2")
     664        saveAndTest(inventoryLocation)
     665
     666        inventoryLocation = new InventoryLocation(inventoryStore: InventoryStore.get(1), name: "C55")
     667        saveAndTest(inventoryLocation)
    599668    }
    600669
     
    631700        inventoryTypeInstance = new InventoryType(name: "Repairable")
    632701        saveAndTest(inventoryTypeInstance)
     702    }
     703
     704    def createBaseInventoryMovementTypes() {
     705
     706        // InventoryMovementType
     707        def inventoryMovementTypeInstance
     708
     709        // InventoryMovementType #1
     710        inventoryMovementTypeInstance = new InventoryMovementType(name: "Used")
     711        saveAndTest(inventoryMovementTypeInstance)
     712
     713        // InventoryMovementType #2
     714        inventoryMovementTypeInstance = new InventoryMovementType(name: "Repaired")
     715        saveAndTest(inventoryMovementTypeInstance)
     716
     717        // InventoryMovementType #3
     718        inventoryMovementTypeInstance = new InventoryMovementType(name: "Purchased")
     719        saveAndTest(inventoryMovementTypeInstance)
    633720    }
    634721
     
    642729                                                                                    inventoryType: InventoryType.get(1),
    643730                                                                                    unitOfMeasure: UnitOfMeasure.get(2),
     731                                                                                    inventoryLocation: InventoryLocation.get(1),
    644732                                                                                    name: "J-Rope",
    645733                                                                                    description: "Twine wound J-Rope",
     734                                                                                    unitsInStock: 2,
    646735                                                                                    reorderPoint: 0)
    647736        saveAndTest(inventoryItemInstance)
     
    651740                                                                                    inventoryType: InventoryType.get(1),
    652741                                                                                    unitOfMeasure: UnitOfMeasure.get(2),
     742                                                                                    inventoryLocation: InventoryLocation.get(1),
    653743                                                                                    name: "L-Rope",
    654744                                                                                    description: "Twine wound L-Rope",
    655745                                                                                    alternateItems: InventoryItem.get(1),
     746                                                                                    unitsInStock: 2,
    656747                                                                                    reorderPoint: 0)
    657748        saveAndTest(inventoryItemInstance)
     
    661752                                                                                    inventoryType: InventoryType.get(1),
    662753                                                                                    unitOfMeasure: UnitOfMeasure.get(1),
     754                                                                                    inventoryLocation: InventoryLocation.get(2),
    663755                                                                                    name: "2305-2RS",
    664756                                                                                    description: "Bearing 25x62x24mm double row self aligning ball",
     757                                                                                    unitsInStock: 3,
    665758                                                                                    reorderPoint: 2)
    666759        saveAndTest(inventoryItemInstance)
     
    670763                                                                                    inventoryType: InventoryType.get(1),
    671764                                                                                    unitOfMeasure: UnitOfMeasure.get(1),
     765                                                                                    inventoryLocation: InventoryLocation.get(2),
    672766                                                                                    name: "L1592-K10",
    673767                                                                                    description: "10kW contactor",
     768                                                                                    unitsInStock: 4,
    674769                                                                                    reorderPoint: 0)
    675770        saveAndTest(inventoryItemInstance)
     
    679774                                                                                    inventoryType: InventoryType.get(1),
    680775                                                                                    unitOfMeasure: UnitOfMeasure.get(1),
     776                                                                                    inventoryLocation: InventoryLocation.get(2),
    681777                                                                                    name: "6205-ZZ",
    682778                                                                                    description: "Bearing 25x52x15mm single row ball shielded",
     779                                                                                    unitsInStock: 5,
    683780                                                                                    reorderPoint: 2)
    684781        saveAndTest(inventoryItemInstance)
    685     }
    686 
    687     def createDemoStoredItems() {
    688 
    689         //StoredItem
    690         def storedItemInstance
    691 
    692         //StoredItem #1
    693         storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(1),
    694                                                                             storeLocation: StoreLocation.get(1),
    695                                                                             quantity: 8)
    696         saveAndTest(storedItemInstance)
    697 
    698         //StoredItem #2
    699         storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(1),
    700                                                                             storeLocation: StoreLocation.get(2),
    701                                                                             quantity: 4)
    702         saveAndTest(storedItemInstance)
    703 
    704         //StoredItem #3
    705         storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(2),
    706                                                                             storeLocation: StoreLocation.get(1),
    707                                                                             quantity: 2)
    708         saveAndTest(storedItemInstance)
    709 
    710         //StoredItem #4
    711         storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(3),
    712                                                                             storeLocation: StoreLocation.get(1),
    713                                                                             quantity: 2)
    714         saveAndTest(storedItemInstance)
    715 
    716         //StoredItem #5
    717         storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(4),
    718                                                                             storeLocation: StoreLocation.get(1),
    719                                                                             quantity: 30)
    720         saveAndTest(storedItemInstance)
    721782    }
    722783
Note: See TracChangeset for help on using the changeset viewer.