Changeset 776 for branches/features
- Timestamp:
- Feb 4, 2011, 2:11:45 AM (14 years ago)
- Location:
- branches/features/taskProcedureRework/grails-app
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/features/taskProcedureRework/grails-app/controllers/TaskProcedureDetailedController.groovy
r775 r776 5 5 6 6 def filterService 7 def assetService 7 8 def taskProcedureService 8 9 … … 94 95 } 95 96 else { 96 return [ taskProcedureInstance : taskProcedureInstance ] 97 def assemblies = assetService.getAssemblies(taskProcedureInstance.linkedTask.primaryAsset) 98 return [ taskProcedureInstance : taskProcedureInstance, 99 assemblies: assemblies ] 97 100 } 98 101 } … … 125 128 } 126 129 127 render(view:'edit', model:[taskProcedureInstance: result.taskProcedureInstance]) 130 def assemblies = assetService.getAssemblies(result.taskProcedureInstance.linkedTask.primaryAsset) 131 render(view:'edit', model:[taskProcedureInstance: result.taskProcedureInstance, 132 assemblies: assemblies]) 128 133 } 129 134 … … 157 162 def taskProcedureInstance = new TaskProcedure() 158 163 taskProcedureInstance.properties = params 159 return ['taskProcedureInstance':taskProcedureInstance] 164 165 // Populate a maintenanceAction for each assembly. 166 def assemblies = assetService.getAssemblies(params.linkedTask.primaryAsset) 167 assemblies.eachWithIndex { assembly, i -> 168 def ma = taskProcedureInstance.maintenanceActionLazyList.get(i) 169 ma.assetSubItem = assembly 170 ma.procedureStepNumber = (i+1)*10 171 } 172 173 return ['taskProcedureInstance':taskProcedureInstance, 'assemblies': assemblies] 160 174 } 161 175 … … 181 195 } 182 196 183 render(view:'create', model:[taskProcedureInstance: result.taskProcedureInstance]) 197 def assemblies = assetService.getAssemblies(result.taskProcedureInstance.linkedTask.primaryAsset) 198 render(view:'create', model:[taskProcedureInstance: result.taskProcedureInstance, 199 assemblies: assemblies]) 184 200 } 185 201 -
branches/features/taskProcedureRework/grails-app/services/AssetService.groovy
r689 r776 22 22 } 23 23 } 24 } 25 26 /** 27 * Determines and returns a list of assemblies for an asset. 28 * This is purely a 'load from database' type method since a new hibernateSession is used. 29 * @params Asset to get the subItems for. 30 * @returns A list of the assemblies. 31 */ 32 def getAssemblies(Asset asset) { 33 def assemblies = [] 34 // Database efficiency: 35 // The asset is configured to batch fetch assetSubItems which 36 // in turn are configured to batch fetch subItems. 37 Asset.withNewSession { 38 Asset.get(asset.id).assetSubItems.each { 39 assemblies.addAll(it.subItems) 40 } 41 } 42 assemblies.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 43 return assemblies 24 44 } 25 45 -
branches/features/taskProcedureRework/grails-app/views/taskDetailed/show.gsp
r772 r776 566 566 <tr> 567 567 <th>Step</th> 568 <th> Sub Item</th>568 <th>Assembly</th> 569 569 <th>Description</th> 570 570 <th>Reasoning</th> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_maintenanceAction.gsp
r770 r776 12 12 <td valign="top" class="value ${hasErrors(bean:ma,field:'assetSubItem','errors')}"> 13 13 <g:select optionKey="id" 14 from="${ AssetSubItem.findAllByIsActive(true)}"14 from="${assemblies}" 15 15 name="maintenanceActionLazyList[${i}].assetSubItem.id" 16 16 value="${ma?.assetSubItem?.id}" -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_maintenanceActions.gsp
r770 r776 70 70 71 71 <th>Step</th> 72 <th> Sub Item</th>72 <th>Assembly</th> 73 73 <th>Description</th> 74 74 <th>Reasoning</th> … … 79 79 <tbody id="ma_wrapper"> 80 80 <g:each var="ma" in="${taskProcedureInstance.maintenanceActions}" status="i"> 81 <g:render template="maintenanceAction" model="['tp':taskProcedureInstance, 'ma': ma, 'i':i]" /> 81 <g:render template="maintenanceAction" model="['tp':taskProcedureInstance, 82 'ma': ma, 83 'i':i, 84 'assemblies': assemblies]" /> 82 85 </g:each> 83 86 </tr> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_taskProcedure.gsp
r772 r776 62 62 63 63 <br /> 64 <g:render template="maintenanceActions" model="['taskProcedureInstance': taskProcedureInstance]" /> 64 <g:render template="maintenanceActions" model="['taskProcedureInstance': taskProcedureInstance, 65 'assemblies': assemblies]" /> 65 66 <br /> 66 67 </div> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/create.gsp
r770 r776 32 32 </div> 33 33 <table style="display:none;"> 34 <g:render template="maintenanceAction" model="['tp': null, 'ma': null, 'i': '_clone']" /> 34 <g:render template="maintenanceAction" model="['tp': null, 35 'ma': null, 36 'i': '_clone', 37 'assemblies': assemblies]" /> 35 38 </table> 36 39 </body> -
branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/edit.gsp
r773 r776 35 35 </div> 36 36 <table style="display:none;"> 37 <g:render template="maintenanceAction" model="['tp': null, 'ma': null, 'i': '_clone']" /> 37 <g:render template="maintenanceAction" model="['tp': null, 38 'ma': null, 39 'i': '_clone', 40 'assemblies': assemblies]" /> 38 41 </table> 39 42 </body>
Note: See TracChangeset
for help on using the changeset viewer.