2014-07-15 3 views
0

서비스가 전달되는 데이터가 AX로 전송 된 다음 서비스 클라이언트가 처리 대기를하지 않고 해당 데이터를 처리하기 위해 SysOperationFramework를 사용하는 시나리오가 있습니다.작업이 X ++ 코드로 실행 중인지 확인하십시오.

처리가 여전히 발생하는 동안 사용자가 외부 응용 프로그램에서 레코드를 열려고하면 문제가 발생합니다.

X ++에서 사용자에게 처리 할 수있는 오류를 보낼 수 있도록 현재 실행중인 작업을 확인하고 (전달 된 매개 변수를 확인하십시오) 방법이 있습니까?

답변

1

방법이 있습니다. 그렇습니다. 찾으려는 데이터는 Batch 테이블에 저장됩니다. ClassNumber 및 상태 필드가 있습니다. 상태가 실행중인 클래스와 일치하는 레코드를 선택하기 만하면됩니다. 레코드가 있으면 실행 중입니다.

매개 변수는 컨테이너의 Parameters 필드에 저장됩니다. 다음과 같이 클래스의 인스턴스를 만들고 압축을 풀면 컨테이너를 풀 수 있습니다 (컴파일하지 않고 점을 얻는 빠른 코드이지만 포인트를 얻습니다).

Batch batch; 
SysOperationServiceController sysOperationServiceController; 
YourDataContract yourDataContract; 

select batch 
    where batch.ClassNumber = YourClassNumber 
    && batch.Status == BatchStatus::Executing; 

// todo: you might have to check the type of the object before assignment 
// todo: also check if batch record has been found 
sysOperationServiceController = batch.object(); 

if (sysOperationServiceController.unpack(batch.Parameters)) 
{ 
    // todo: you might have to check the type of the object before assignment 
    yourDataContract = sysOperationServiceController.getDataContractObject('_theParemterNameOfyourDataContract'); 

    // todo: here you can read the parameters from your contract 
} 
else 
{ 
    throw error("Unpack failed"); 
} 
관련 문제