Changeset 534 for trunk/grails-app
- Timestamp:
- May 16, 2010, 3:49:30 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/CreateDataService.groovy
r529 r534 63 63 createBaseAddressTypes() 64 64 createBaseContactTypes() 65 createBaseMaintenancePolicies() 65 66 createBaseInventoryItemPurchaseTypes() 67 68 // Assets 69 createBaseExtenededAttributeTypes() 70 71 // Inventory 72 createBaseInventoryTypes() 73 createBaseInventoryMovementTypes() 66 74 67 75 // Tasks … … 74 82 createBaseEntryTypes() 75 83 76 // Inventory77 createBaseInventoryTypes()78 createBaseInventoryMovementTypes()79 80 // Assets81 createBaseExtenededAttributeTypes()82 createBaseMaintenancePolicies()83 84 84 // Record that data has been created. 85 85 appConfigService.set("baseDataCreated") … … 117 117 createDemoCostCodes() 118 118 119 // Assets 120 createDemoLifePlan() 121 createDemoSections() 122 createDemoAssetTree() 123 createDemoAssetExtenedAttributes() 124 125 // Inventory 126 createDemoInventoryStores() /// @todo: Perhaps a 'createQuickStartData' method? 127 createDemoInventoryLocations() 128 createDemoInventoryGroups() /// @todo: Perhaps a 'createQuickStartData' method? 129 createDemoInventoryItems() 130 119 131 // Tasks 120 132 createDemoTasks() … … 122 134 createDemoAssignedGroups() 123 135 createDemoAssignedPersons() 124 createDemoTaskRecurringSchedules()125 126 // Inventory127 createDemoInventoryStores() /// @todo: Perhaps a 'createQuickStartData' method?128 createDemoInventoryLocations()129 createDemoInventoryGroups() /// @todo: Perhaps a 'createQuickStartData' method?130 createDemoInventoryItems()131 132 // Assets133 createDemoLifePlan()134 136 createDemoTaskProcedure() 135 137 createDemoMaintenanceActions() 136 createDemoSections() 137 createDemoAssetTree() 138 createDemoAssetExtenedAttributes() 138 createDemoTaskRecurringSchedules() 139 139 140 140 // Record that data has been created. … … 829 829 taskType:TaskType.get(1), 830 830 leadPerson:Person.get(2), 831 primaryAsset:Asset.get(4), 831 832 description:"Level sensor not working", 832 833 comment:"Has been noted as problematic, try recalibrating.", … … 841 842 taskType:TaskType.get(3), 842 843 leadPerson:Person.get(5), 844 primaryAsset:Asset.get(4), 843 845 description:"Some follow-up work", 844 846 comment:"Some help required", … … 854 856 taskType:TaskType.get(3), 855 857 leadPerson:Person.get(5), 858 primaryAsset:Asset.get(4), 856 859 description:"A Sub Task can be created from the 'Sub Task' tab.", 857 860 comment:"Some help required", … … 864 867 //Task #4 865 868 p = [taskGroup:TaskGroup.findByName("Engineering Activites"), 866 taskPriority:TaskPriority.get(2), 867 taskType:TaskType.get(2), 868 leadPerson:Person.get(4), 869 description:"Please replace sensor at next available opportunity.", 870 comment:"Nothing else has worked. So we now require the part to be replaced.", 869 taskPriority:TaskPriority.get(2), 870 taskType:TaskType.get(2), 871 leadPerson:Person.get(4), 872 primaryAsset:Asset.get(4), 873 description:"Please replace sensor at next available opportunity.", 874 comment:"Nothing else has worked. So we now require the part to be replaced.", 871 875 targetStartDate: dateUtilService.today, 872 876 targetCompletionDate: dateUtilService.oneWeekFromNow, … … 877 881 //Task #5 878 882 p = [taskGroup:TaskGroup.findByName("Production Activites"), 879 taskPriority:TaskPriority.get(2), 880 taskType:TaskType.get(3), 881 leadPerson:Person.get(6), 882 description:"Production Task", 883 comment:"Production task for specific production run or shift", 883 taskPriority:TaskPriority.get(2), 884 taskType:TaskType.get(3), 885 leadPerson:Person.get(6), 886 primaryAsset:Asset.get(1), 887 description:"Production Task", 888 comment:"Production task for specific production run or shift", 884 889 targetStartDate: dateUtilService.today - 6, 885 890 targetCompletionDate: dateUtilService.today - 6] … … 889 894 //Task #6 890 895 p = [taskGroup:TaskGroup.findByName("Engineering Activites"), 891 taskPriority:TaskPriority.get(4), 892 taskType:TaskType.get(3), 893 leadPerson:Person.get(4), 894 description:"This is a recurring preventative maintenance task.", 895 comment:"If there is a parent task specified then this is a generated sub task, if there is a recurring schedule specified then this is a parent task.", 896 taskPriority:TaskPriority.get(4), 897 taskType:TaskType.get(4), 898 leadPerson:Person.get(4), 899 primaryAsset:Asset.get(2), 900 description:"This is a recurring preventative maintenance task.", 901 comment:"If there is a parent task specified then this is a generated sub task, if there is a recurring schedule specified then this is a parent task.", 896 902 targetStartDate: dateUtilService.today, 897 903 targetCompletionDate: dateUtilService.today + 30] 898 904 899 905 taskResult = taskService.save(p) 906 taskService.approve(taskResult.taskInstance) 900 907 } 901 908 … … 947 954 comment: "Checked up on it later and sensor is dropping out intermittently, created sub task to replace sensor.", 948 955 durationMinute: 20] 956 957 entryResult = taskService.saveEntry(p) 958 959 //Entry #4 960 p = [task: Task.list()[5], 961 entryType: EntryType.get(3), 962 comment: "Recurring work done as per procedure.", 963 durationMinute: 55] 949 964 950 965 entryResult = taskService.saveEntry(p) … … 977 992 978 993 //AssignedPerson #1 979 p = [person: Person.get( 4),980 task: Task.list()[ 0],994 p = [person: Person.get(3), // Demo Manager. 995 task: Task.list()[5], 981 996 estimatedHour: 1, 982 997 estimatedMinute: 20] … … 984 999 985 1000 //AssignedPerson #2 986 p = [person: Person.get( 5),1001 p = [person: Person.get(4), // Demo User. 987 1002 task: Task.list()[0], 988 1003 estimatedHour: 3, 989 1004 estimatedMinute: 30] 990 1005 result = assignedPersonService.save(p) 1006 } 1007 1008 def createBaseMaintenancePolicies() { 1009 1010 //MaintenancePolicy 1011 def maintenancePolicyInstance 1012 1013 //MaintenancePolicy #1 1014 maintenancePolicyInstance = new MaintenancePolicy(name: "Fixed Time") 1015 saveAndTest(maintenancePolicyInstance) 1016 1017 //MaintenancePolicy #2 1018 maintenancePolicyInstance = new MaintenancePolicy(name: "Condition Based Online") 1019 saveAndTest(maintenancePolicyInstance) 1020 1021 //MaintenancePolicy #3 1022 maintenancePolicyInstance = new MaintenancePolicy(name: "Condition Based Offline") 1023 saveAndTest(maintenancePolicyInstance) 1024 1025 //MaintenancePolicy #4 1026 maintenancePolicyInstance = new MaintenancePolicy(name: "Design Out") 1027 saveAndTest(maintenancePolicyInstance) 1028 1029 //MaintenancePolicy #5 1030 maintenancePolicyInstance = new MaintenancePolicy(name: "Operate To Failure") 1031 saveAndTest(maintenancePolicyInstance) 1032 1033 //MaintenancePolicy #6 1034 maintenancePolicyInstance = new MaintenancePolicy(name: "Regulatory Requirement") 1035 saveAndTest(maintenancePolicyInstance) 1036 1037 //MaintenancePolicy #7 1038 maintenancePolicyInstance = new MaintenancePolicy(name: "Hidden Function Test") 1039 saveAndTest(maintenancePolicyInstance) 1040 } 1041 1042 def createDemoTaskProcedure() { 1043 1044 //TaskProcedure 1045 def taskProcedureInstance 1046 1047 taskProcedureInstance = new TaskProcedure(name: "Daily check") 1048 saveAndTest(taskProcedureInstance) 1049 taskProcedureInstance.addToTasks(Task.list()[0]) 1050 } 1051 1052 def createDemoMaintenanceActions() { 1053 1054 //MaintenanceAction 1055 def maintenanceActionInstance 1056 1057 //MaintenanceAction #1 1058 maintenanceActionInstance = new MaintenanceAction(description: "Check all E-stops, activate E-stops S1-S12 and ensure machine cannot run", 1059 procedureStepNumber: 10, 1060 maintenancePolicy: MaintenancePolicy.get(1), 1061 taskProcedure: TaskProcedure.get(1)) 1062 saveAndTest(maintenanceActionInstance) 1063 1064 //MaintenanceAction #2 1065 maintenanceActionInstance = new MaintenanceAction(description: "Do more pushups", 1066 procedureStepNumber: 20, 1067 maintenancePolicy: MaintenancePolicy.get(1), 1068 taskProcedure: TaskProcedure.get(1)) 1069 saveAndTest(maintenanceActionInstance) 1070 1071 //MaintenanceAction #3 1072 maintenanceActionInstance = new MaintenanceAction(description: "Ok just one more pushup", 1073 procedureStepNumber: 30, 1074 maintenancePolicy: MaintenancePolicy.get(1), 1075 taskProcedure: TaskProcedure.get(1)) 1076 saveAndTest(maintenanceActionInstance) 991 1077 } 992 1078 … … 1008 1094 1009 1095 //TaskRecurringSchedule #2 1010 taskRecurringScheduleInstance = new TaskRecurringSchedule(task: Task.list()[ 0],1096 taskRecurringScheduleInstance = new TaskRecurringSchedule(task: Task.list()[5], 1011 1097 recurEvery: 1, 1012 1098 recurPeriod: Period.get(1), … … 1229 1315 } 1230 1316 1231 def createBaseMaintenancePolicies() {1232 1233 //MaintenancePolicy1234 def maintenancePolicyInstance1235 1236 //MaintenancePolicy #11237 maintenancePolicyInstance = new MaintenancePolicy(name: "Fixed Time")1238 saveAndTest(maintenancePolicyInstance)1239 1240 //MaintenancePolicy #21241 maintenancePolicyInstance = new MaintenancePolicy(name: "Condition Based Online")1242 saveAndTest(maintenancePolicyInstance)1243 1244 //MaintenancePolicy #31245 maintenancePolicyInstance = new MaintenancePolicy(name: "Condition Based Offline")1246 saveAndTest(maintenancePolicyInstance)1247 1248 //MaintenancePolicy #41249 maintenancePolicyInstance = new MaintenancePolicy(name: "Design Out")1250 saveAndTest(maintenancePolicyInstance)1251 1252 //MaintenancePolicy #51253 maintenancePolicyInstance = new MaintenancePolicy(name: "Operate To Failure")1254 saveAndTest(maintenancePolicyInstance)1255 1256 //MaintenancePolicy #61257 maintenancePolicyInstance = new MaintenancePolicy(name: "Regulatory Requirement")1258 saveAndTest(maintenancePolicyInstance)1259 1260 //MaintenancePolicy #71261 maintenancePolicyInstance = new MaintenancePolicy(name: "Hidden Function Test")1262 saveAndTest(maintenancePolicyInstance)1263 }1264 1265 def createDemoTaskProcedure() {1266 1267 //TaskProcedure1268 def taskProcedureInstance1269 1270 taskProcedureInstance = new TaskProcedure(name: "Daily check")1271 saveAndTest(taskProcedureInstance)1272 taskProcedureInstance.addToTasks(Task.list()[0])1273 }1274 1275 def createDemoMaintenanceActions() {1276 1277 //MaintenanceAction1278 def maintenanceActionInstance1279 1280 //MaintenanceAction #11281 maintenanceActionInstance = new MaintenanceAction(description: "Check all E-stops, activate E-stops S1-S12 and ensure machine cannot run",1282 procedureStepNumber: 1,1283 maintenancePolicy: MaintenancePolicy.get(1),1284 taskProcedure: TaskProcedure.get(1))1285 saveAndTest(maintenanceActionInstance)1286 1287 //MaintenanceAction #21288 maintenanceActionInstance = new MaintenanceAction(description: "Do more pushups",1289 procedureStepNumber: 2,1290 maintenancePolicy: MaintenancePolicy.get(1),1291 taskProcedure: TaskProcedure.get(1))1292 saveAndTest(maintenanceActionInstance)1293 1294 //MaintenanceAction #31295 maintenanceActionInstance = new MaintenanceAction(description: "Ok just one more pushup",1296 procedureStepNumber: 3,1297 maintenancePolicy: MaintenancePolicy.get(1),1298 taskProcedure: TaskProcedure.get(1))1299 saveAndTest(maintenanceActionInstance)1300 }1301 1302 1317 def createDemoSections() { 1303 1318
Note: See TracChangeset
for help on using the changeset viewer.