Index: /trunk/grails-app/controllers/InventoryItemController.groovy =================================================================== --- /trunk/grails-app/controllers/InventoryItemController.groovy (revision 174) +++ /trunk/grails-app/controllers/InventoryItemController.groovy (revision 175) @@ -27,5 +27,5 @@ if(inventoryItemInstance) { try { - inventoryItemInstance.delete() + inventoryItemInstance.delete(flush:true) flash.message = "InventoryItem ${params.id} deleted" redirect(action:list) @@ -77,5 +77,5 @@ else { flash.message = "InventoryItem not found with id ${params.id}" - redirect(action:edit,id:params.id) + redirect(action:list) } } Index: /trunk/grails-app/controllers/InventoryItemDetailedController.groovy =================================================================== --- /trunk/grails-app/controllers/InventoryItemDetailedController.groovy (revision 174) +++ /trunk/grails-app/controllers/InventoryItemDetailedController.groovy (revision 175) @@ -48,5 +48,5 @@ if(inventoryItemInstance) { try { - inventoryItemInstance.delete() + inventoryItemInstance.delete(flush:true) flash.message = "InventoryItem ${params.id} deleted" redirect(action:search) @@ -103,5 +103,5 @@ else { flash.message = "InventoryItem not found with id ${params.id}" - redirect(action:edit,id:params.id) + redirect(action:search) } } Index: /trunk/grails-app/controllers/InventoryLocationController.groovy =================================================================== --- /trunk/grails-app/controllers/InventoryLocationController.groovy (revision 175) +++ /trunk/grails-app/controllers/InventoryLocationController.groovy (revision 175) @@ -0,0 +1,99 @@ +import org.codehaus.groovy.grails.plugins.springsecurity.Secured + +class InventoryLocationController extends BaseAppAdminController { + + def index = { redirect(action:list,params:params) } + + // the delete, save and update actions only accept POST requests + static allowedMethods = [delete:'POST', save:'POST', update:'POST'] + + def list = { + params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) + [ inventoryLocationInstanceList: InventoryLocation.list( params ), inventoryLocationInstanceTotal: InventoryLocation.count() ] + } + + def show = { + def inventoryLocationInstance = InventoryLocation.get( params.id ) + + if(!inventoryLocationInstance) { + flash.message = "InventoryLocation not found with id ${params.id}" + redirect(action:list) + } + else { return [ inventoryLocationInstance : inventoryLocationInstance ] } + } + + def delete = { + def inventoryLocationInstance = InventoryLocation.get( params.id ) + if(inventoryLocationInstance) { + try { + inventoryLocationInstance.delete(flush:true) + flash.message = "InventoryLocation ${params.id} deleted" + redirect(action:list) + } + catch(org.springframework.dao.DataIntegrityViolationException e) { + flash.message = "InventoryLocation ${params.id} could not be deleted" + redirect(action:show,id:params.id) + } + } + else { + flash.message = "InventoryLocation not found with id ${params.id}" + redirect(action:list) + } + } + + def edit = { + def inventoryLocationInstance = InventoryLocation.get( params.id ) + + if(!inventoryLocationInstance) { + flash.message = "InventoryLocation not found with id ${params.id}" + redirect(action:list) + } + else { + return [ inventoryLocationInstance : inventoryLocationInstance ] + } + } + + def update = { + def inventoryLocationInstance = InventoryLocation.get( params.id ) + if(inventoryLocationInstance) { + if(params.version) { + def version = params.version.toLong() + if(inventoryLocationInstance.version > version) { + + inventoryLocationInstance.errors.rejectValue("version", "inventoryLocation.optimistic.locking.failure", "Another user has updated this InventoryLocation while you were editing.") + render(view:'edit',model:[inventoryLocationInstance:inventoryLocationInstance]) + return + } + } + inventoryLocationInstance.properties = params + if(!inventoryLocationInstance.hasErrors() && inventoryLocationInstance.save()) { + flash.message = "InventoryLocation ${params.id} updated" + redirect(action:show,id:inventoryLocationInstance.id) + } + else { + render(view:'edit',model:[inventoryLocationInstance:inventoryLocationInstance]) + } + } + else { + flash.message = "InventoryLocation not found with id ${params.id}" + redirect(action:list) + } + } + + def create = { + def inventoryLocationInstance = new InventoryLocation() + inventoryLocationInstance.properties = params + return ['inventoryLocationInstance':inventoryLocationInstance] + } + + def save = { + def inventoryLocationInstance = new InventoryLocation(params) + if(!inventoryLocationInstance.hasErrors() && inventoryLocationInstance.save()) { + flash.message = "InventoryLocation ${inventoryLocationInstance.id} created" + redirect(action:show,id:inventoryLocationInstance.id) + } + else { + render(view:'create',model:[inventoryLocationInstance:inventoryLocationInstance]) + } + } +} Index: /trunk/grails-app/controllers/InventoryLocationDetailedController.groovy =================================================================== --- /trunk/grails-app/controllers/InventoryLocationDetailedController.groovy (revision 175) +++ /trunk/grails-app/controllers/InventoryLocationDetailedController.groovy (revision 175) @@ -0,0 +1,99 @@ +import org.codehaus.groovy.grails.plugins.springsecurity.Secured + +class InventoryLocationDetailedController extends BaseController { + + def index = { redirect(action:list,params:params) } + + // the delete, save and update actions only accept POST requests + static allowedMethods = [delete:'POST', save:'POST', update:'POST'] + + def list = { + params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) + [ inventoryLocationInstanceList: InventoryLocation.list( params ), inventoryLocationInstanceTotal: InventoryLocation.count() ] + } + + def show = { + def inventoryLocationInstance = InventoryLocation.get( params.id ) + + if(!inventoryLocationInstance) { + flash.message = "InventoryLocation not found with id ${params.id}" + redirect(action:list) + } + else { return [ inventoryLocationInstance : inventoryLocationInstance ] } + } + + def delete = { + def inventoryLocationInstance = InventoryLocation.get( params.id ) + if(inventoryLocationInstance) { + try { + inventoryLocationInstance.delete(flush:true) + flash.message = "InventoryLocation ${params.id} deleted" + redirect(action:list) + } + catch(org.springframework.dao.DataIntegrityViolationException e) { + flash.message = "InventoryLocation ${params.id} could not be deleted" + redirect(action:show,id:params.id) + } + } + else { + flash.message = "InventoryLocation not found with id ${params.id}" + redirect(action:list) + } + } + + def edit = { + def inventoryLocationInstance = InventoryLocation.get( params.id ) + + if(!inventoryLocationInstance) { + flash.message = "InventoryLocation not found with id ${params.id}" + redirect(action:list) + } + else { + return [ inventoryLocationInstance : inventoryLocationInstance ] + } + } + + def update = { + def inventoryLocationInstance = InventoryLocation.get( params.id ) + if(inventoryLocationInstance) { + if(params.version) { + def version = params.version.toLong() + if(inventoryLocationInstance.version > version) { + + inventoryLocationInstance.errors.rejectValue("version", "inventoryLocation.optimistic.locking.failure", "Another user has updated this InventoryLocation while you were editing.") + render(view:'edit',model:[inventoryLocationInstance:inventoryLocationInstance]) + return + } + } + inventoryLocationInstance.properties = params + if(!inventoryLocationInstance.hasErrors() && inventoryLocationInstance.save()) { + flash.message = "InventoryLocation ${params.id} updated" + redirect(action:show,id:inventoryLocationInstance.id) + } + else { + render(view:'edit',model:[inventoryLocationInstance:inventoryLocationInstance]) + } + } + else { + flash.message = "InventoryLocation not found with id ${params.id}" + redirect(action:list) + } + } + + def create = { + def inventoryLocationInstance = new InventoryLocation() + inventoryLocationInstance.properties = params + return ['inventoryLocationInstance':inventoryLocationInstance] + } + + def save = { + def inventoryLocationInstance = new InventoryLocation(params) + if(!inventoryLocationInstance.hasErrors() && inventoryLocationInstance.save()) { + flash.message = "InventoryLocation ${inventoryLocationInstance.id} created" + redirect(action:show,id:inventoryLocationInstance.id) + } + else { + render(view:'create',model:[inventoryLocationInstance:inventoryLocationInstance]) + } + } +} Index: /trunk/grails-app/controllers/InventoryMovementController.groovy =================================================================== --- /trunk/grails-app/controllers/InventoryMovementController.groovy (revision 174) +++ /trunk/grails-app/controllers/InventoryMovementController.groovy (revision 175) @@ -27,5 +27,5 @@ if(inventoryMovementInstance) { try { - inventoryMovementInstance.delete() + inventoryMovementInstance.delete(flush:true) flash.message = "InventoryMovement ${params.id} deleted" redirect(action:list) @@ -77,5 +77,5 @@ else { flash.message = "InventoryMovement not found with id ${params.id}" - redirect(action:edit,id:params.id) + redirect(action:list) } } Index: /trunk/grails-app/controllers/InventoryMovementDetailedController.groovy =================================================================== --- /trunk/grails-app/controllers/InventoryMovementDetailedController.groovy (revision 175) +++ /trunk/grails-app/controllers/InventoryMovementDetailedController.groovy (revision 175) @@ -0,0 +1,65 @@ +import org.codehaus.groovy.grails.plugins.springsecurity.Secured + +class InventoryMovementDetailedController extends BaseController { + + def index = { redirect(action:list,params:params) } + + // the delete, save and update actions only accept POST requests + static allowedMethods = [delete:'POST', save:'POST'] + + def list = { + flash.message = flash.message + redirect(controller:"taskDetailed", action:"search") + } + + def show = { + def inventoryMovementInstance = InventoryMovement.get( params.id ) + + if(!inventoryMovementInstance) { + flash.message = "InventoryMovement not found with id ${params.id}" + redirect(action:list) + } + else { return [ inventoryMovementInstance : inventoryMovementInstance ] } + } + + def delete = { + def inventoryMovementInstance = InventoryMovement.get( params.id ) + if(inventoryMovementInstance) { + try { + def taskId = inventoryMovementInstance.task?.id + inventoryMovementInstance.delete(flush:true) + flash.message = "InventoryMovement ${params.id} deleted" + redirect(controller:"taskDetailed", action:"show", id:taskId) + } + catch(org.springframework.dao.DataIntegrityViolationException e) { + flash.message = "InventoryMovement ${params.id} could not be deleted" + redirect(action:show,id:params.id) + } + } + else { + flash.message = "InventoryMovement not found with id ${params.id}" + redirect(action:list) + } + } + + def create = { + if(!params.task?.id) { + flash.message = "Please select a task, then the Inventory tab." + redirect(controller:"taskDetailed", action:"search") + } + def inventoryMovementInstance = new InventoryMovement() + inventoryMovementInstance.properties = params + return ['inventoryMovementInstance':inventoryMovementInstance] + } + + def save = { + def inventoryMovementInstance = new InventoryMovement(params) + if(!inventoryMovementInstance.hasErrors() && inventoryMovementInstance.save()) { + flash.message = "Inventory Movement for ${inventoryMovementInstance.inventoryItem.name} created." + redirect(controller:"taskDetailed", action:"show", id: params.task.id) + } + else { + render(view:'create',model:[inventoryMovementInstance:inventoryMovementInstance]) + } + } +} Index: /trunk/grails-app/controllers/InventoryStoreController.groovy =================================================================== --- /trunk/grails-app/controllers/InventoryStoreController.groovy (revision 174) +++ /trunk/grails-app/controllers/InventoryStoreController.groovy (revision 175) @@ -27,5 +27,5 @@ if(inventoryStoreInstance) { try { - inventoryStoreInstance.delete() + inventoryStoreInstance.delete(flush:true) flash.message = "InventoryStore ${params.id} deleted" redirect(action:list) @@ -77,5 +77,5 @@ else { flash.message = "InventoryStore not found with id ${params.id}" - redirect(action:edit,id:params.id) + redirect(action:list) } } Index: unk/grails-app/controllers/StoreLocationController.groovy =================================================================== --- /trunk/grails-app/controllers/StoreLocationController.groovy (revision 174) +++ (revision ) @@ -1,99 +1,0 @@ -import org.codehaus.groovy.grails.plugins.springsecurity.Secured - -class StoreLocationController extends BaseAppAdminController { - - def index = { redirect(action:list,params:params) } - - // the delete, save and update actions only accept POST requests - static allowedMethods = [delete:'POST', save:'POST', update:'POST'] - - def list = { - params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) - [ storeLocationInstanceList: StoreLocation.list( params ), storeLocationInstanceTotal: StoreLocation.count() ] - } - - def show = { - def storeLocationInstance = StoreLocation.get( params.id ) - - if(!storeLocationInstance) { - flash.message = "StoreLocation not found with id ${params.id}" - redirect(action:list) - } - else { return [ storeLocationInstance : storeLocationInstance ] } - } - - def delete = { - def storeLocationInstance = StoreLocation.get( params.id ) - if(storeLocationInstance) { - try { - storeLocationInstance.delete() - flash.message = "StoreLocation ${params.id} deleted" - redirect(action:list) - } - catch(org.springframework.dao.DataIntegrityViolationException e) { - flash.message = "StoreLocation ${params.id} could not be deleted" - redirect(action:show,id:params.id) - } - } - else { - flash.message = "StoreLocation not found with id ${params.id}" - redirect(action:list) - } - } - - def edit = { - def storeLocationInstance = StoreLocation.get( params.id ) - - if(!storeLocationInstance) { - flash.message = "StoreLocation not found with id ${params.id}" - redirect(action:list) - } - else { - return [ storeLocationInstance : storeLocationInstance ] - } - } - - def update = { - def storeLocationInstance = StoreLocation.get( params.id ) - if(storeLocationInstance) { - if(params.version) { - def version = params.version.toLong() - if(storeLocationInstance.version > version) { - - storeLocationInstance.errors.rejectValue("version", "storeLocation.optimistic.locking.failure", "Another user has updated this StoreLocation while you were editing.") - render(view:'edit',model:[storeLocationInstance:storeLocationInstance]) - return - } - } - storeLocationInstance.properties = params - if(!storeLocationInstance.hasErrors() && storeLocationInstance.save()) { - flash.message = "StoreLocation ${params.id} updated" - redirect(action:show,id:storeLocationInstance.id) - } - else { - render(view:'edit',model:[storeLocationInstance:storeLocationInstance]) - } - } - else { - flash.message = "StoreLocation not found with id ${params.id}" - redirect(action:edit,id:params.id) - } - } - - def create = { - def storeLocationInstance = new StoreLocation() - storeLocationInstance.properties = params - return ['storeLocationInstance':storeLocationInstance] - } - - def save = { - def storeLocationInstance = new StoreLocation(params) - if(!storeLocationInstance.hasErrors() && storeLocationInstance.save()) { - flash.message = "StoreLocation ${storeLocationInstance.id} created" - redirect(action:show,id:storeLocationInstance.id) - } - else { - render(view:'create',model:[storeLocationInstance:storeLocationInstance]) - } - } -} Index: unk/grails-app/controllers/StoreLocationDetailedController.groovy =================================================================== --- /trunk/grails-app/controllers/StoreLocationDetailedController.groovy (revision 174) +++ (revision ) @@ -1,99 +1,0 @@ -import org.codehaus.groovy.grails.plugins.springsecurity.Secured - -class StoreLocationDetailedController extends BaseController { - - def index = { redirect(action:list,params:params) } - - // the delete, save and update actions only accept POST requests - static allowedMethods = [delete:'POST', save:'POST', update:'POST'] - - def list = { - params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) - [ storeLocationInstanceList: StoreLocation.list( params ), storeLocationInstanceTotal: StoreLocation.count() ] - } - - def show = { - def storeLocationInstance = StoreLocation.get( params.id ) - - if(!storeLocationInstance) { - flash.message = "StoreLocation not found with id ${params.id}" - redirect(action:list) - } - else { return [ storeLocationInstance : storeLocationInstance ] } - } - - def delete = { - def storeLocationInstance = StoreLocation.get( params.id ) - if(storeLocationInstance) { - try { - storeLocationInstance.delete() - flash.message = "StoreLocation ${params.id} deleted" - redirect(action:list) - } - catch(org.springframework.dao.DataIntegrityViolationException e) { - flash.message = "StoreLocation ${params.id} could not be deleted" - redirect(action:show,id:params.id) - } - } - else { - flash.message = "StoreLocation not found with id ${params.id}" - redirect(action:list) - } - } - - def edit = { - def storeLocationInstance = StoreLocation.get( params.id ) - - if(!storeLocationInstance) { - flash.message = "StoreLocation not found with id ${params.id}" - redirect(action:list) - } - else { - return [ storeLocationInstance : storeLocationInstance ] - } - } - - def update = { - def storeLocationInstance = StoreLocation.get( params.id ) - if(storeLocationInstance) { - if(params.version) { - def version = params.version.toLong() - if(storeLocationInstance.version > version) { - - storeLocationInstance.errors.rejectValue("version", "storeLocation.optimistic.locking.failure", "Another user has updated this StoreLocation while you were editing.") - render(view:'edit',model:[storeLocationInstance:storeLocationInstance]) - return - } - } - storeLocationInstance.properties = params - if(!storeLocationInstance.hasErrors() && storeLocationInstance.save()) { - flash.message = "StoreLocation ${params.id} updated" - redirect(action:show,id:storeLocationInstance.id) - } - else { - render(view:'edit',model:[storeLocationInstance:storeLocationInstance]) - } - } - else { - flash.message = "StoreLocation not found with id ${params.id}" - redirect(action:edit,id:params.id) - } - } - - def create = { - def storeLocationInstance = new StoreLocation() - storeLocationInstance.properties = params - return ['storeLocationInstance':storeLocationInstance] - } - - def save = { - def storeLocationInstance = new StoreLocation(params) - if(!storeLocationInstance.hasErrors() && storeLocationInstance.save()) { - flash.message = "StoreLocation ${storeLocationInstance.id} created" - redirect(action:show,id:storeLocationInstance.id) - } - else { - render(view:'create',model:[storeLocationInstance:storeLocationInstance]) - } - } -} Index: unk/grails-app/controllers/StoredItemController.groovy =================================================================== --- /trunk/grails-app/controllers/StoredItemController.groovy (revision 174) +++ (revision ) @@ -1,99 +1,0 @@ -import org.codehaus.groovy.grails.plugins.springsecurity.Secured - -class StoredItemController extends BaseAppAdminController { - - def index = { redirect(action:list,params:params) } - - // the delete, save and update actions only accept POST requests - static allowedMethods = [delete:'POST', save:'POST', update:'POST'] - - def list = { - params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) - [ storedItemInstanceList: StoredItem.list( params ), storedItemInstanceTotal: StoredItem.count() ] - } - - def show = { - def storedItemInstance = StoredItem.get( params.id ) - - if(!storedItemInstance) { - flash.message = "StoredItem not found with id ${params.id}" - redirect(action:list) - } - else { return [ storedItemInstance : storedItemInstance ] } - } - - def delete = { - def storedItemInstance = StoredItem.get( params.id ) - if(storedItemInstance) { - try { - storedItemInstance.delete() - flash.message = "StoredItem ${params.id} deleted" - redirect(action:list) - } - catch(org.springframework.dao.DataIntegrityViolationException e) { - flash.message = "StoredItem ${params.id} could not be deleted" - redirect(action:show,id:params.id) - } - } - else { - flash.message = "StoredItem not found with id ${params.id}" - redirect(action:list) - } - } - - def edit = { - def storedItemInstance = StoredItem.get( params.id ) - - if(!storedItemInstance) { - flash.message = "StoredItem not found with id ${params.id}" - redirect(action:list) - } - else { - return [ storedItemInstance : storedItemInstance ] - } - } - - def update = { - def storedItemInstance = StoredItem.get( params.id ) - if(storedItemInstance) { - if(params.version) { - def version = params.version.toLong() - if(storedItemInstance.version > version) { - - storedItemInstance.errors.rejectValue("version", "storedItem.optimistic.locking.failure", "Another user has updated this StoredItem while you were editing.") - render(view:'edit',model:[storedItemInstance:storedItemInstance]) - return - } - } - storedItemInstance.properties = params - if(!storedItemInstance.hasErrors() && storedItemInstance.save()) { - flash.message = "StoredItem ${params.id} updated" - redirect(action:show,id:storedItemInstance.id) - } - else { - render(view:'edit',model:[storedItemInstance:storedItemInstance]) - } - } - else { - flash.message = "StoredItem not found with id ${params.id}" - redirect(action:edit,id:params.id) - } - } - - def create = { - def storedItemInstance = new StoredItem() - storedItemInstance.properties = params - return ['storedItemInstance':storedItemInstance] - } - - def save = { - def storedItemInstance = new StoredItem(params) - if(!storedItemInstance.hasErrors() && storedItemInstance.save()) { - flash.message = "StoredItem ${storedItemInstance.id} created" - redirect(action:show,id:storedItemInstance.id) - } - else { - render(view:'create',model:[storedItemInstance:storedItemInstance]) - } - } -} Index: unk/grails-app/controllers/StoredItemDetailedController.groovy =================================================================== --- /trunk/grails-app/controllers/StoredItemDetailedController.groovy (revision 174) +++ (revision ) @@ -1,99 +1,0 @@ -import org.codehaus.groovy.grails.plugins.springsecurity.Secured - -class StoredItemDetailedController extends BaseController { - - def index = { redirect(action:list,params:params) } - - // the delete, save and update actions only accept POST requests - static allowedMethods = [delete:'POST', save:'POST', update:'POST'] - - def list = { - params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) - [ storedItemInstanceList: StoredItem.list( params ), storedItemInstanceTotal: StoredItem.count() ] - } - - def show = { - def storedItemInstance = StoredItem.get( params.id ) - - if(!storedItemInstance) { - flash.message = "StoredItem not found with id ${params.id}" - redirect(action:list) - } - else { return [ storedItemInstance : storedItemInstance ] } - } - - def delete = { - def storedItemInstance = StoredItem.get( params.id ) - if(storedItemInstance) { - try { - storedItemInstance.delete() - flash.message = "StoredItem ${params.id} deleted" - redirect(action:list) - } - catch(org.springframework.dao.DataIntegrityViolationException e) { - flash.message = "StoredItem ${params.id} could not be deleted" - redirect(action:show,id:params.id) - } - } - else { - flash.message = "StoredItem not found with id ${params.id}" - redirect(action:list) - } - } - - def edit = { - def storedItemInstance = StoredItem.get( params.id ) - - if(!storedItemInstance) { - flash.message = "StoredItem not found with id ${params.id}" - redirect(action:list) - } - else { - return [ storedItemInstance : storedItemInstance ] - } - } - - def update = { - def storedItemInstance = StoredItem.get( params.id ) - if(storedItemInstance) { - if(params.version) { - def version = params.version.toLong() - if(storedItemInstance.version > version) { - - storedItemInstance.errors.rejectValue("version", "storedItem.optimistic.locking.failure", "Another user has updated this StoredItem while you were editing.") - render(view:'edit',model:[storedItemInstance:storedItemInstance]) - return - } - } - storedItemInstance.properties = params - if(!storedItemInstance.hasErrors() && storedItemInstance.save()) { - flash.message = "StoredItem ${params.id} updated" - redirect(action:show,id:storedItemInstance.id) - } - else { - render(view:'edit',model:[storedItemInstance:storedItemInstance]) - } - } - else { - flash.message = "StoredItem not found with id ${params.id}" - redirect(action:edit,id:params.id) - } - } - - def create = { - def storedItemInstance = new StoredItem() - storedItemInstance.properties = params - return ['storedItemInstance':storedItemInstance] - } - - def save = { - def storedItemInstance = new StoredItem(params) - if(!storedItemInstance.hasErrors() && storedItemInstance.save()) { - flash.message = "StoredItem ${storedItemInstance.id} created" - redirect(action:show,id:storedItemInstance.id) - } - else { - render(view:'create',model:[storedItemInstance:storedItemInstance]) - } - } -} Index: /trunk/grails-app/controllers/TaskDetailedController.groovy =================================================================== --- /trunk/grails-app/controllers/TaskDetailedController.groovy (revision 174) +++ /trunk/grails-app/controllers/TaskDetailedController.groovy (revision 175) @@ -182,6 +182,8 @@ def subTaskInstanceList = Task.findAllByParentTask(taskInstance, params) - def subTaskInstanceTotal = Task.countByParentTask(taskInstance) + def subTaskInstanceTotal = Task.countByParentTask(taskInstance) def showTaskTab = new String("true") + + def inventoryMovementList = InventoryMovement.findAllByTask(taskInstance, [max:100, sort:"id", order:"desc", offset:0]) def taskProcedureInstance = TaskProcedure.get(taskInstance.taskProcedure?.id) @@ -190,13 +192,12 @@ taskProcedureExits = false } -// else { - params.order = "asc" - params.sort = "procedureStepNumber" - def maintenanceActionList = MaintenanceAction.findAllByTaskProcedure(taskProcedureInstance, params) -// } - + + params.order = "asc" + params.sort = "procedureStepNumber" + def maintenanceActionList = MaintenanceAction.findAllByTaskProcedure(taskProcedureInstance, params) + def taskRecurringScheduleInstance = TaskRecurringSchedule.get(taskInstance.taskRecurringSchedule?.id) def taskRecurringScheduleExits= new Boolean("true") - if(!taskRecurringScheduleInstance) { + if(!taskRecurringScheduleInstance) { taskRecurringScheduleExits = false } @@ -213,5 +214,6 @@ maintenanceActionList: maintenanceActionList, taskRecurringScheduleInstance: taskRecurringScheduleInstance, - taskRecurringScheduleExits: taskRecurringScheduleExits] + taskRecurringScheduleExits: taskRecurringScheduleExits, + inventoryMovementList: inventoryMovementList] } } Index: /trunk/grails-app/domain/InventoryItem.groovy =================================================================== --- /trunk/grails-app/domain/InventoryItem.groovy (revision 174) +++ /trunk/grails-app/domain/InventoryItem.groovy (revision 175) @@ -3,8 +3,11 @@ InventoryType inventoryType UnitOfMeasure unitOfMeasure + InventoryLocation inventoryLocation + Period averageDeliveryPeriod String name String description = "" String manufacturersPartNumber String suppliersPartNumber + Integer unitsInStock = 0 Integer reorderPoint Integer recommendedReorderPoint @@ -16,5 +19,4 @@ static hasMany = [alternateItems: InventoryItem, spareFor: Asset, - storedItems: StoredItem, inventoryMovements: InventoryMovement, manufacturers: Manufacturer, @@ -24,17 +26,19 @@ static constraints = { - name(unique:true, blank:false, maxSize:75) + name(unique:true, blank:false, maxSize:50) description() + unitsInStock(min:0) + unitOfMeasure() reorderPoint() enableReorder() + recommendedReorderPoint(nullable:true) isActive() isObsolete() inventoryGroup() inventoryType() - unitOfMeasure() manufacturersPartNumber(blank:true, nullable:true) suppliersPartNumber(blank:true, nullable:true) - recommendedReorderPoint(nullable:true) averageDeliveryTime(nullable:true) + averageDeliveryPeriod(nullable:true) } Index: /trunk/grails-app/domain/InventoryLocation.groovy =================================================================== --- /trunk/grails-app/domain/InventoryLocation.groovy (revision 175) +++ /trunk/grails-app/domain/InventoryLocation.groovy (revision 175) @@ -0,0 +1,18 @@ +class InventoryLocation { + + InventoryStore inventoryStore + String name + Boolean isActive = true + + static hasMany = [inventoryItems: InventoryItem] + +// static belongsTo = [InventoryStore] + + static constraints = { + name(maxSize:50) + } + + String toString() { + "${this.name}" + } +} Index: /trunk/grails-app/domain/InventoryMovement.groovy =================================================================== --- /trunk/grails-app/domain/InventoryMovement.groovy (revision 174) +++ /trunk/grails-app/domain/InventoryMovement.groovy (revision 175) @@ -1,14 +1,16 @@ +import java.text.SimpleDateFormat + class InventoryMovement { InventoryItem inventoryItem InventoryMovementType inventoryMovementType Task task - String quantity + Integer quantity Date date = new Date() - static belongsTo = [InventoryItem] +// static belongsTo = [inventoryItem] static constraints = { inventoryItem() - quantity() + quantity(min:1) inventoryMovementType() task(nullable:true) @@ -16,4 +18,7 @@ } - String toString() {"${this.quantity}"} + String toString() { + def date = new SimpleDateFormat("EEE, dd-MMM-yyyy").format(this.date) + "${this.quantity} ${inventoryMovementType.name} on ${date}" + } } Index: /trunk/grails-app/domain/InventoryStore.groovy =================================================================== --- /trunk/grails-app/domain/InventoryStore.groovy (revision 174) +++ /trunk/grails-app/domain/InventoryStore.groovy (revision 175) @@ -6,5 +6,5 @@ Boolean isActive = true - static hasMany = [storeLocations: StoreLocation] + static hasMany = [inventoryLocations: InventoryLocation] static belongsTo = [Site] Index: unk/grails-app/domain/StoreLocation.groovy =================================================================== --- /trunk/grails-app/domain/StoreLocation.groovy (revision 174) +++ (revision ) @@ -1,18 +1,0 @@ -class StoreLocation { - - InventoryStore inventoryStore - String bin - Boolean isActive = true - - static hasMany = [storedItems: StoredItem] - - static belongsTo = [InventoryStore] - - static constraints = { - bin(maxSize:50) - } - - String toString() { - "${this.bin}" - } -} Index: unk/grails-app/domain/StoredItem.groovy =================================================================== --- /trunk/grails-app/domain/StoredItem.groovy (revision 174) +++ (revision ) @@ -1,16 +1,0 @@ -class StoredItem { - - InventoryItem inventoryItem - StoreLocation storeLocation - Integer quantity = 0 - - static belongsTo = [InventoryItem] - - static constraints = { - quantity(min:0) - } - - String toString() { - "${this.quantity} item(s) at ${storeLocation} in ${storeLocation.inventoryStore}" - } -} Index: /trunk/grails-app/i18n/messages.properties =================================================================== --- /trunk/grails-app/i18n/messages.properties (revision 174) +++ /trunk/grails-app/i18n/messages.properties (revision 175) @@ -112,4 +112,5 @@ fp.property.text.isScheduled=Scheduled fp.property.text.isApproved=Approved +fp.property.text.isObsolete=Obsolete fp.property.text.taskGroup.name=Group fp.property.text.taskPriority.name=Priority @@ -120,3 +121,7 @@ fp.property.text.leadPerson.firstName=Lead Person (First Name) fp.property.text.taskType.name=Type +fp.property.text.inventoryLocation.name=Location +fp.property.text.spareFor.name=Spare For +fp.property.text.supplier.name=Supplier +fp.property.text.manufacturer.name=Manufacturer Index: /trunk/grails-app/services/CreateDataService.groovy =================================================================== --- /trunk/grails-app/services/CreateDataService.groovy (revision 174) +++ /trunk/grails-app/services/CreateDataService.groovy (revision 175) @@ -37,4 +37,6 @@ createBaseUnitsOfMeasure() createBasePeriods() + createBaseSupplierType() + createBaseManufacturerType() // Tasks createBaseTaskStatus() @@ -45,4 +47,5 @@ // Inventory createBaseInventoryTypes() + createBaseInventoryMovementTypes() createBaseMaintenancePolicies() // Assets @@ -60,4 +63,6 @@ createDemoSites() createDemoDepartments() + createDemoSuppliers() + createDemoManufacturers() // Tasks createDemoTaskGroups() /// @todo: Perhaps this should be BaseData? @@ -68,8 +73,7 @@ // Inventory createDemoInventoryStores() /// @todo: Perhaps a 'createQuickStartData' method? - createDemoStoreLocations() + createDemoInventoryLocations() createDemoInventoryGroups() /// @todo: Perhaps a 'createQuickStartData' method? createDemoInventoryItems() - createDemoStoredItems() // Assets createDemoLifePlan() @@ -310,4 +314,69 @@ } + def createBaseSupplierType() { + + // SupplierType + def supplierTypeInstance + + // SupplierType #1 + supplierTypeInstance = new SupplierType(name: "OEM", + description: "Original equipment supplier") + saveAndTest(supplierTypeInstance) + + // SupplierType #2 + supplierTypeInstance = new SupplierType(name: "Local", + description: "Local supplier") + saveAndTest(supplierTypeInstance) + } + + def createBaseManufacturerType() { + + // ManufacturerType + def manufacturerTypeInstance + + // ManufacturerType #1 + manufacturerTypeInstance = new ManufacturerType(name: "OEM", + description: "Original equipment manufacturer") + saveAndTest(manufacturerTypeInstance) + + // ManufacturerType #2 + manufacturerTypeInstance = new ManufacturerType(name: "Alternate", + description: "Not original equipment manufacturer") + saveAndTest(manufacturerTypeInstance) + + } + + def createDemoSuppliers() { + + // Supplier + def supplierInstance + + // Supplier #1 + supplierInstance = new Supplier(name: "OEM Distributors", + supplierType: SupplierType.get(1)) + saveAndTest(supplierInstance) + + // Supplier #2 + supplierInstance = new Supplier(name: "Mex Holdings", + supplierType: SupplierType.get(2)) + saveAndTest(supplierInstance) + } + + def createDemoManufacturers() { + + // Manufacturer + def manufacturerInstance + + // Manufacturer #1 + manufacturerInstance = new Manufacturer(name: "OEM Manufacturer", + manufacturerType: ManufacturerType.get(1)) + saveAndTest(manufacturerInstance) + + // Manufacturer #2 + manufacturerInstance = new Manufacturer(name: "Laser Cutting Services Pty", + manufacturerType: ManufacturerType.get(2)) + saveAndTest(manufacturerInstance) + } + /********************* START OF TASK @@ -587,14 +656,14 @@ } - def createDemoStoreLocations() { - - //StoreLocation - def storeLocation - - storeLocation = new StoreLocation(inventoryStore: InventoryStore.get(1), bin: "A1-2") - saveAndTest(storeLocation) - - storeLocation = new StoreLocation(inventoryStore: InventoryStore.get(1), bin: "C55") - saveAndTest(storeLocation) + def createDemoInventoryLocations() { + + // InventoryLocation + def inventoryLocation + + inventoryLocation = new InventoryLocation(inventoryStore: InventoryStore.get(1), name: "A1-2") + saveAndTest(inventoryLocation) + + inventoryLocation = new InventoryLocation(inventoryStore: InventoryStore.get(1), name: "C55") + saveAndTest(inventoryLocation) } @@ -631,4 +700,22 @@ inventoryTypeInstance = new InventoryType(name: "Repairable") saveAndTest(inventoryTypeInstance) + } + + def createBaseInventoryMovementTypes() { + + // InventoryMovementType + def inventoryMovementTypeInstance + + // InventoryMovementType #1 + inventoryMovementTypeInstance = new InventoryMovementType(name: "Used") + saveAndTest(inventoryMovementTypeInstance) + + // InventoryMovementType #2 + inventoryMovementTypeInstance = new InventoryMovementType(name: "Repaired") + saveAndTest(inventoryMovementTypeInstance) + + // InventoryMovementType #3 + inventoryMovementTypeInstance = new InventoryMovementType(name: "Purchased") + saveAndTest(inventoryMovementTypeInstance) } @@ -642,6 +729,8 @@ inventoryType: InventoryType.get(1), unitOfMeasure: UnitOfMeasure.get(2), + inventoryLocation: InventoryLocation.get(1), name: "J-Rope", description: "Twine wound J-Rope", + unitsInStock: 2, reorderPoint: 0) saveAndTest(inventoryItemInstance) @@ -651,7 +740,9 @@ inventoryType: InventoryType.get(1), unitOfMeasure: UnitOfMeasure.get(2), + inventoryLocation: InventoryLocation.get(1), name: "L-Rope", description: "Twine wound L-Rope", alternateItems: InventoryItem.get(1), + unitsInStock: 2, reorderPoint: 0) saveAndTest(inventoryItemInstance) @@ -661,6 +752,8 @@ inventoryType: InventoryType.get(1), unitOfMeasure: UnitOfMeasure.get(1), + inventoryLocation: InventoryLocation.get(2), name: "2305-2RS", description: "Bearing 25x62x24mm double row self aligning ball", + unitsInStock: 3, reorderPoint: 2) saveAndTest(inventoryItemInstance) @@ -670,6 +763,8 @@ inventoryType: InventoryType.get(1), unitOfMeasure: UnitOfMeasure.get(1), + inventoryLocation: InventoryLocation.get(2), name: "L1592-K10", description: "10kW contactor", + unitsInStock: 4, reorderPoint: 0) saveAndTest(inventoryItemInstance) @@ -679,44 +774,10 @@ inventoryType: InventoryType.get(1), unitOfMeasure: UnitOfMeasure.get(1), + inventoryLocation: InventoryLocation.get(2), name: "6205-ZZ", description: "Bearing 25x52x15mm single row ball shielded", + unitsInStock: 5, reorderPoint: 2) saveAndTest(inventoryItemInstance) - } - - def createDemoStoredItems() { - - //StoredItem - def storedItemInstance - - //StoredItem #1 - storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(1), - storeLocation: StoreLocation.get(1), - quantity: 8) - saveAndTest(storedItemInstance) - - //StoredItem #2 - storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(1), - storeLocation: StoreLocation.get(2), - quantity: 4) - saveAndTest(storedItemInstance) - - //StoredItem #3 - storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(2), - storeLocation: StoreLocation.get(1), - quantity: 2) - saveAndTest(storedItemInstance) - - //StoredItem #4 - storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(3), - storeLocation: StoreLocation.get(1), - quantity: 2) - saveAndTest(storedItemInstance) - - //StoredItem #5 - storedItemInstance = new StoredItem(inventoryItem: InventoryItem.get(4), - storeLocation: StoreLocation.get(1), - quantity: 30) - saveAndTest(storedItemInstance) } Index: /trunk/grails-app/views/inventoryItem/create.gsp =================================================================== --- /trunk/grails-app/views/inventoryItem/create.gsp (revision 174) +++ /trunk/grails-app/views/inventoryItem/create.gsp (revision 175) @@ -32,5 +32,5 @@
+ + | ++ + | +
+ + | +
+ |
+
+ + | +
+ |
+
Index: /trunk/grails-app/views/inventoryItemDetailed/show.gsp =================================================================== --- /trunk/grails-app/views/inventoryItemDetailed/show.gsp (revision 174) +++ /trunk/grails-app/views/inventoryItemDetailed/show.gsp (revision 175) @@ -41,4 +41,19 @@ + +
+ +
+
- -
+ +
+
- -
- -
@@ -190,5 +200,5 @@
Index: /trunk/grails-app/views/inventoryLocation/create.gsp =================================================================== --- /trunk/grails-app/views/inventoryLocation/create.gsp (revision 175) +++ /trunk/grails-app/views/inventoryLocation/create.gsp (revision 175) @@ -0,0 +1,65 @@ + + + +
+ + +
+ +
+