F
Freddyq999
Hello all,
I'm having difficulties creating an assignment for a cost resource in PSI.
The version of Projectserver I am using is 2007 Beta 2 TR.
I do the following steps to import costs from an ERP system:
1) Call ReadProject to get all the project details.
2) Call CheckoutProject.
3) Create as task with a fixed duration of exactly the whole project's
duration.
ProjectDataSet.TaskRow task = null;
try
{
task = m_dsProject.Task.NewTaskRow();
DateTime projStart =
((ProjectDataSet.ProjectRow)m_dsProject.Project.Rows[0]).PROJ_INFO_START_DATE
;
DateTime projEnd =
((ProjectDataSet.ProjectRow)m_dsProject.Project.Rows[0]).PROJ_INFO_FINISH_DATE;
task.PROJ_UID = m_ProjUID;
task.TASK_UID = Guid.NewGuid();
task.TASK_NAME = "ProjectCost ERP";
task.TASK_IS_MILESTONE = false;
task.TASK_LEVELING_CAN_SPLIT = false;
task.TASK_LEVELING_ADJUSTS_ASSN = false;
task.TASK_IS_EFFORT_DRIVEN = false;
task.TASK_TYPE = 1; // fixed duration
task.TASK_DUR_IS_EST = false;
task.TASK_DUR = (int)((TimeSpan)(projEnd -
projStart)).TotalDays * 4800 + 4800;
task.TASK_DUR_FMT = (int)PSLib.Task.DurationFormat.Day;
task.TASK_IS_CRITICAL = false;
task.TASK_START_DATE = projStart;
task.TASK_IGNORES_RES_CAL = true;
task.TASK_LEVELING_ADJUSTS_ASSN = false;
task.AddPosition = (int)PSLib.Task.AddPositionType.First;
task.SetAddAfterTaskUIDNull();
m_dsProject.Task.AddTaskRow(task);
}
4) Create an assignment linked to this task for an enterprise cost
resource.
Currently I am using fixed values. These values show up when you
create such an assignment using MS Project Professional and then call
ReadProject() and GetXml() using some other utility.
(I use ProjTool from the 2007 SDK)
ProjectDataSet.AssignmentRow assn = null;
try
{
assn = m_dsProject.Assignment.NewAssignmentRow();
assn.PROJ_UID = m_ProjUID;
assn.TASK_UID = taskUID;
assn.ASSN_UID = Guid.NewGuid();
assn.RES_UID = resourceUID;
assn.ASSN_ACT_START = new DateTime (2006, 7, 3, 8, 0, 0);
assn.ASSN_ACT_FINISH = new DateTime (2006,07,06, 17,00,00);
assn.ASSN_WORK_CONTOUR= 0;
assn.ASSN_DELAY = 0;
assn.ASSN_LEVELING_DELAY= 0;
assn.ASSN_COST_RATE_TABLE = 0;
assn.ASSN_UNITS =3.125;
assn.ASSN_WORK=60;
assn.ASSN_ACT_WORK=60;
assn.ASSN_REG_WORK=60;
assn.ASSN_OVT_WORK=0;
assn.ASSN_REM_WORK=0;
assn.ASSN_ACT_OVT_WORK=0;
assn.ASSN_REM_OVT_WORK=0;
assn.ASSN_START_DATE= assn.ASSN_ACT_START;
assn.ASSN_FINISH_DATE = assn.ASSN_ACT_FINISH;
assn.ASSN_RESUME_DATE= assn.ASSN_ACT_FINISH;
assn.ASSN_STOP_DATE= assn.ASSN_ACT_FINISH;
assn.ASSN_COST =10;
assn.ASSN_ACT_COST=10;
assn.ASSN_ACT_OVT_COST=0;
assn.ASSN_REM_COST=0;
assn.ASSN_REM_OVT_COST=0;
assn.ASSN_OVT_COST=0;
assn.ASSN_PCT_WORK_COMPLETE=100;
assn.ASSN_ACWP=0;
assn.ASSN_BCWP=0;
assn.ASSN_BCWS=0;
assn.ASSN_BOOKING_TYPE=0;
assn.ASSN_DEMAND_REQ=0;
assn.ASSN_MATERIAL_RATE_FMT=0;
assn.ASSN_DELAY_FMT=7;
assn.ASSN_START_VAR=0;
assn.ASSN_FINISH_VAR=0;
assn.ASSN_HAS_LINKED_FIELDS=false;
assn.WASSN_LOCKDOWN_BY_MANAGER=false;
assn.ASSN_IS_CONFIRMED=false;
assn.ASSN_IS_PUBLISHED=true;
assn.ASSN_IS_OVERALLOCATED=false;
assn.ASSN_RES_TYPE=false;
assn.ASSN_RESPONSE_PENDING=false;
assn.ASSN_UPDATE_NEEDED=false;
assn.ASSN_BUDGET_COST=0;
assn.ASSN_BUDGET_WORK=0;
assn.ASSN_COST_VAR=0;
assn.ASSN_SV=0;
assn.ASSN_VAC=0;
assn.ASSN_WORK_VAR=0;
m_dsProject.Assignment.AddAssignmentRow(assn);
}
5) Call QueueAddToProject() for any data having DataRowState.Added and
wait for the queue to process the request.
6) Call QueueUpdateProject() for any data having DataRowState.Modified
and wait for the queue to process the request.
7) Call QueuePublishProject() and wait for the queue to process the
request.
8) Call QueueCheckinProject() wait for the queue to process the request.
If I then open the project in MS Project, the task has a duration of 0 and
the assignment is there but it does not show any costs. The Queue does not
give any more hints as all jobs have been completed successfully.
If I ommit Step 4) (Create the assignment), the task I created will show the
values I would expect. So obviously something is wrong with the values I
supply for the assignment.
Has anyone seen this problem and knows how to solve it ?
Cheers,
Alfred
I'm having difficulties creating an assignment for a cost resource in PSI.
The version of Projectserver I am using is 2007 Beta 2 TR.
I do the following steps to import costs from an ERP system:
1) Call ReadProject to get all the project details.
2) Call CheckoutProject.
3) Create as task with a fixed duration of exactly the whole project's
duration.
ProjectDataSet.TaskRow task = null;
try
{
task = m_dsProject.Task.NewTaskRow();
DateTime projStart =
((ProjectDataSet.ProjectRow)m_dsProject.Project.Rows[0]).PROJ_INFO_START_DATE
;
DateTime projEnd =
((ProjectDataSet.ProjectRow)m_dsProject.Project.Rows[0]).PROJ_INFO_FINISH_DATE;
task.PROJ_UID = m_ProjUID;
task.TASK_UID = Guid.NewGuid();
task.TASK_NAME = "ProjectCost ERP";
task.TASK_IS_MILESTONE = false;
task.TASK_LEVELING_CAN_SPLIT = false;
task.TASK_LEVELING_ADJUSTS_ASSN = false;
task.TASK_IS_EFFORT_DRIVEN = false;
task.TASK_TYPE = 1; // fixed duration
task.TASK_DUR_IS_EST = false;
task.TASK_DUR = (int)((TimeSpan)(projEnd -
projStart)).TotalDays * 4800 + 4800;
task.TASK_DUR_FMT = (int)PSLib.Task.DurationFormat.Day;
task.TASK_IS_CRITICAL = false;
task.TASK_START_DATE = projStart;
task.TASK_IGNORES_RES_CAL = true;
task.TASK_LEVELING_ADJUSTS_ASSN = false;
task.AddPosition = (int)PSLib.Task.AddPositionType.First;
task.SetAddAfterTaskUIDNull();
m_dsProject.Task.AddTaskRow(task);
}
4) Create an assignment linked to this task for an enterprise cost
resource.
Currently I am using fixed values. These values show up when you
create such an assignment using MS Project Professional and then call
ReadProject() and GetXml() using some other utility.
(I use ProjTool from the 2007 SDK)
ProjectDataSet.AssignmentRow assn = null;
try
{
assn = m_dsProject.Assignment.NewAssignmentRow();
assn.PROJ_UID = m_ProjUID;
assn.TASK_UID = taskUID;
assn.ASSN_UID = Guid.NewGuid();
assn.RES_UID = resourceUID;
assn.ASSN_ACT_START = new DateTime (2006, 7, 3, 8, 0, 0);
assn.ASSN_ACT_FINISH = new DateTime (2006,07,06, 17,00,00);
assn.ASSN_WORK_CONTOUR= 0;
assn.ASSN_DELAY = 0;
assn.ASSN_LEVELING_DELAY= 0;
assn.ASSN_COST_RATE_TABLE = 0;
assn.ASSN_UNITS =3.125;
assn.ASSN_WORK=60;
assn.ASSN_ACT_WORK=60;
assn.ASSN_REG_WORK=60;
assn.ASSN_OVT_WORK=0;
assn.ASSN_REM_WORK=0;
assn.ASSN_ACT_OVT_WORK=0;
assn.ASSN_REM_OVT_WORK=0;
assn.ASSN_START_DATE= assn.ASSN_ACT_START;
assn.ASSN_FINISH_DATE = assn.ASSN_ACT_FINISH;
assn.ASSN_RESUME_DATE= assn.ASSN_ACT_FINISH;
assn.ASSN_STOP_DATE= assn.ASSN_ACT_FINISH;
assn.ASSN_COST =10;
assn.ASSN_ACT_COST=10;
assn.ASSN_ACT_OVT_COST=0;
assn.ASSN_REM_COST=0;
assn.ASSN_REM_OVT_COST=0;
assn.ASSN_OVT_COST=0;
assn.ASSN_PCT_WORK_COMPLETE=100;
assn.ASSN_ACWP=0;
assn.ASSN_BCWP=0;
assn.ASSN_BCWS=0;
assn.ASSN_BOOKING_TYPE=0;
assn.ASSN_DEMAND_REQ=0;
assn.ASSN_MATERIAL_RATE_FMT=0;
assn.ASSN_DELAY_FMT=7;
assn.ASSN_START_VAR=0;
assn.ASSN_FINISH_VAR=0;
assn.ASSN_HAS_LINKED_FIELDS=false;
assn.WASSN_LOCKDOWN_BY_MANAGER=false;
assn.ASSN_IS_CONFIRMED=false;
assn.ASSN_IS_PUBLISHED=true;
assn.ASSN_IS_OVERALLOCATED=false;
assn.ASSN_RES_TYPE=false;
assn.ASSN_RESPONSE_PENDING=false;
assn.ASSN_UPDATE_NEEDED=false;
assn.ASSN_BUDGET_COST=0;
assn.ASSN_BUDGET_WORK=0;
assn.ASSN_COST_VAR=0;
assn.ASSN_SV=0;
assn.ASSN_VAC=0;
assn.ASSN_WORK_VAR=0;
m_dsProject.Assignment.AddAssignmentRow(assn);
}
5) Call QueueAddToProject() for any data having DataRowState.Added and
wait for the queue to process the request.
6) Call QueueUpdateProject() for any data having DataRowState.Modified
and wait for the queue to process the request.
7) Call QueuePublishProject() and wait for the queue to process the
request.
8) Call QueueCheckinProject() wait for the queue to process the request.
If I then open the project in MS Project, the task has a duration of 0 and
the assignment is there but it does not show any costs. The Queue does not
give any more hints as all jobs have been completed successfully.
If I ommit Step 4) (Create the assignment), the task I created will show the
values I would expect. So obviously something is wrong with the values I
supply for the assignment.
Has anyone seen this problem and knows how to solve it ?
Cheers,
Alfred