QueueSystem.GetJobGroupWaitTimeSimple 方法
決定專案與時程表佇列以處理指定的工作群組剩餘的預期的時間上限。
命名空間: WebSvcQueueSystem
組件: ProjectServerServices (在 ProjectServerServices.dll 中)
語法
'宣告
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/GetJobGroupWaitTimeSimple", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/", _
ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetJobGroupWaitTimeSimple ( _
trackingID As Guid _
) As Integer
'用途
Dim instance As QueueSystem
Dim trackingID As Guid
Dim returnValue As Integer
returnValue = instance.GetJobGroupWaitTimeSimple(trackingID)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/GetJobGroupWaitTimeSimple", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/",
ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/QueueSystem/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public int GetJobGroupWaitTimeSimple(
Guid trackingID
)
參數
trackingID
類型:System.Guid追蹤指派給多個工作的 GUID (JobGroupGUID)。
傳回值
類型:System.Int32
預期以相同的trackingID的所有工作,才可完成的秒數。
備註
之工作的預期的等待時間才大約,根據類似類型的工作的平均等待時間。GetJobGroupWaitTime還需考慮工作已在佇列和工作相互關聯優先順序的位置。
PSI 方法使用的專案或時程表佇列名稱開始使用佇列,例如QueueCreateProject和QueueUpdateTimesheet。若要設定的 PSI 方法使用的專案或時程表佇列追蹤 GUID,新增您使用的佇列方法呼叫每個 PSI Web 服務的 SOAP 標頭的追蹤 GUID。
Project Server 權限
權限 |
描述 |
---|---|
可讓使用者管理 Project Server 佇列。通用權限。 |
範例
下列程序示範如何修改 [Project Web 服務的WebRequest方法。
下列範例會將GetExpectedGroupWaitTime方法是在名為QueueSystemUtilities類別。此方法會傳回QueueProjectPublish方法與相關的所有佇列工作的預期的等待時間。trackingGuid參數會指定群組中的工作。QueueSystemWS是QueueSystem Web 參考 (英文) 任意名稱。
public int GetAllExpectedGroupWaitTime(QueueSystemWS.QueueSystem q,
Guid trackingGuid)
{
int wait = q.GetJobGroupWaitTime(trackingGuid, msgType);
return wait;
}
下列程式碼片段會 PSI 方法的一般呼叫其中Project物件新增至 SOAP 標題中的追蹤 GUID 在先前程序中所述。
using System.Threading;
using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
private static QueueSystemWS.QueueSystem queueSystem =
new QueueSystemWS.QueueSystem();
private static QueueSystemUtils queueSystemUtils = new QueueSystemUtils();
. . .
ProjectWS.ProjectDataSet dsProject =
new ProjectWS.ProjectDataSet();
ProjectWS.ProjectDataSet.ProjectRow projectRow =
dsProject.Project.NewProjectRow();
Guid projectGuid = Guid.NewGuid();
projectRow.PROJ_UID = projectGuid;
projectRow.PROJ_NAME = "Name of Project";
projectRow.PROJ_TYPE =
Convert.ToInt32(PSLibrary.Project.ProjectType.Project);
dsProject.Project.AddProjectRow(projectRow);
// Create the queue job and tracking GUIDs, and then set the tracking
// GUID for SOAP calls to the derived Project object.
Guid jobGuid = Guid.NewGuid();
Guid trackingGuid = Guid.NewGuid();
SomeNameSpace.ProjectWS.ProjectDerived.SetTrackingGuid(trackingGuid);
bool validateOnly = false;
// Create and save project to the Draft database.
projectDerived.QueueCreateProject(jobGuid, dsProject, validateOnly);
// Wait a few seconds, or create a WaitForQueue method.
Thread.Sleep(3000);
ProjectWS.ProjectRelationsDataSet dsProjectRelations =
new ProjectWS.ProjectRelationsDataSet();
jobGuid = Guid.NewGuid();
string wssUrl = "" // Default SharePoint project workspace,
bool fullPublish = true;
// Publish the project to the Published database.
dsProjectRelations = projectDerived.QueuePublish(jobGuid, projectGuid, fullPublish, wssUrl);
// Try various wait times to see the effect of additional queue jobs
// spawned by QueuePublish.
Thread.Sleep(500);
QueueSystemWS.QueueMsgType msgType = QueueSystemWS.QueueMsgType.ReportingProjectPublish;
int jobGroupWaitTime = queueSystemUtils.GetAllExpectedGroupWaitTime(queueSystem, trackingGuid);
string waitTime = "After QueuePublish:\t\t" + jobGroupWaitTime.ToString() + " seconds for all related jobs";
QueueCreateProject和QueuePublish通話使用相同的 tracking SOAP 標頭設ProjectDerived物件的 GUID。QueuePublish方法會產生額外的佇列工作,例如已發佈的專案資料傳送到報表資料庫。jobGroupWaitTime值顯示這兩個佇列中目前存在的所有相關工作的預期的等待時間。