Changeset 720 for trunk/grails-app/services/InventoryCsvService.groovy
- Timestamp:
- Nov 25, 2010, 9:08:43 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/InventoryCsvService.groovy
r719 r720 59 59 "inventoryGroup", "inventoryType", 60 60 "suppliersPartNumber", "preferredSupplier", "alternateSuppliers", 61 " alternateItems", "spareFor"]61 "spareFor"] 62 62 63 63 def siteInstance … … 67 67 def supplierTypeUnknown = SupplierType.get(1) 68 68 def spareForInstance 69 def alternateItemInstance70 69 def inventoryTypeInstance 71 70 def unitOfMeasureInstance … … 85 84 86 85 def tempSpareFor = [] 87 def tempAlternateItems = []88 86 89 87 def nextLine = { … … 289 287 290 288 inventoryParams.alternateSuppliers.add(alternateSupplierInstance) 291 }292 293 // AlternateItems.294 tempAlternateItems = parseInputList(inventoryParams.alternateItems)295 inventoryParams.alternateItems = []296 297 for(tempAlternateItem in tempAlternateItems) {298 tempAlternateItem = WordUtils.capitalize(tempAlternateItem)299 alternateItemInstance = InventoryItem.findByName(tempAlternateItem)300 if(!alternateItemInstance) {301 alternateItemInstance = new InventoryItem(name: tempAlternateItem,302 description: "Generated from alternateItems during import, details may not be correct.",303 reorderPoint: 0,304 inventoryGroup: inventoryGroupInstance,305 inventoryType: inventoryTypeInstance,306 unitOfMeasure: unitOfMeasureInstance,307 inventoryLocation: inventoryLocationInstance)308 if(!alternateItemInstance.save()) {309 log.error "Failed to create alternateItems on line: " + lineNumber310 return fail(code: "inventory.import.failure", args: [lineNumber, logFileLink])311 }312 }313 314 inventoryParams.alternateItems.add(alternateItemInstance)315 289 } 316 290
Note: See TracChangeset
for help on using the changeset viewer.