수색…


소개

이 항목에서는 스크린 기반 API를 통해 Acumatica ERP에서 레코드를 내보내는 방법을 보여줍니다. Acumatica ERP의 스크린 기반 API는 SOAP 인터페이스 만 제공합니다. 개발 플랫폼에서 SOAP 웹 서비스에 대한 지원이 제한적이라면 SOAP 및 REST 인터페이스를 모두 제공하는 계약 기반 API를 고려하십시오. Screen-Based API에 대한 자세한 내용은 Acumatica ERP Documentation을 참조하십시오.

비고

이 주제에서 제공되는 모든 샘플은 Screen-Based API Wrapper를 사용하여 작성되었습니다. 클라이언트 애플리케이션이 Acumatica ERP 애플리케이션의 UI 변경 사항에 의존하지 않게하려면 Acumatica ERP 문서에 설명 된 화면 기반 API 래퍼를 사용해야합니다

단일 기본 키가있는 입력 양식에서 데이터 내보내기

재고 항목 화면 (IN.20.25.00)은 데이터를 내보내는 Acumatica ERP의 가장 자주 사용되는 데이터 입력 양식 중 하나입니다. 인벤토리 ID재고 항목 화면의 유일한 기본 키입니다. 여기에 이미지 설명을 입력하십시오.

데이터 입력 폼에서 레코드를 내보내려면 SOAP 요청은 항상 ServiceCommands.Every[Key] 명령으로 시작해야합니다. 여기서 [Key] 는 기본 키 이름으로 바뀝니다.

단일 웹 서비스 호출에서 모든 재고 항목을 내보내려면

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/AcumaticaERP/Soap/IN202500.asmx";
context.Login(username, password);
try
{
    Content stockItemsSchema = PX.Soap.Helper.GetSchema<Content>(context);
    Field lastModifiedField = new Field
    {
        ObjectName = stockItemsSchema.StockItemSummary.InventoryID.ObjectName,
        FieldName = "LastModifiedDateTime"
    };
    var commands = new Command[]
    {
        stockItemsSchema.StockItemSummary.ServiceCommands.EveryInventoryID,
        stockItemsSchema.StockItemSummary.InventoryID,
        stockItemsSchema.StockItemSummary.Description,
        stockItemsSchema.GeneralSettingsItemDefaults.ItemClass,
        stockItemsSchema.GeneralSettingsUnitOfMeasureBaseUnit.BaseUnit,
        lastModifiedField
    };
    var items = context.Export(commands, null, 0, false, false);
}
finally
{
    context.Logout();
}

어떤 ERP 애플리케이션에서든 데이터의 시간이 길어지면 크기가 커지는 경향이 있습니다. 단일 웹 서비스 호출에서 Acumatica ERP 인스턴스의 모든 레코드를 내보내는 경우 조만간 시간 초과 오류가 발생할 수 있습니다. 시간 초과를 늘리는 것은 가능한 일회성이지만 장기적으로 좋은 해결책은 아닙니다. 이 문제를 해결할 수있는 가장 좋은 방법은 재고 항목을 여러 레코드로 묶어서 내보내는 것입니다.

재고 항목을 10 개 레코드의 일괄 처리로 내보내려면

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/AcumaticaERP/Soap/IN202500.asmx";
context.Login(username, password);
try
{
    Content stockItemsSchema = PX.Soap.Helper.GetSchema<Content>(context);
    Field lastModifiedField = new Field
    {
        ObjectName = stockItemsSchema.StockItemSummary.InventoryID.ObjectName,
        FieldName = "LastModifiedDateTime"
    };
    var commands = new Command[]
    {
        stockItemsSchema.StockItemSummary.ServiceCommands.EveryInventoryID,
        stockItemsSchema.StockItemSummary.InventoryID,
        stockItemsSchema.StockItemSummary.Description,
        stockItemsSchema.GeneralSettingsItemDefaults.ItemClass,
        stockItemsSchema.GeneralSettingsUnitOfMeasureBaseUnit.BaseUnit,
        lastModifiedField
    };
    var items = context.Export(commands, null, 10, false, false);

    while (items.Length == 10)
    {
        var filters = new Filter[]
        {
            new Filter
            {
                Field = stockItemsSchema.StockItemSummary.InventoryID,
                Condition = FilterCondition.Greater,
                Value = items[items.Length - 1][0]
            }
        };
        items = context.Export(commands, filters, 10, false, false);
    }
}
finally
{
    context.Logout();
}

단일 호출 방식과 일괄 처리 방식 간의 내보내기에는 두 가지 주요 차이점이 있습니다.

  • 단일 호출 방식에서는 내보내기 명령의 topCount 매개 변수가 항상 0 으로 설정되었습니다.

  • 일괄 적으로 레코드를 내보낼 때 필터 배열이 보충 한 topCount 매개 변수가 다음 결과 집합을 요청하기 위해 일괄 처리의 크기가 구성됩니다.

복합 기본 키가있는 입력 양식에서 데이터 내보내기

판매 주문 화면 (SO.30.10.00)은 복합 기본 키가있는 데이터 입력 양식의 완벽한 예입니다. 판매 주문 화면의 기본 키는 주문 유형주문 번호 로 구성됩니다. 여기에 이미지 설명을 입력하십시오.

Screen-Based API를 통해 복합 기본 키를 사용하여 판매 주문 화면 또는 다른 데이터 입력 양식에서 데이터를 내보내는 2 단계 전략을 권장합니다.

  • 1 단계에서 Acumatica ERP 응용 프로그램에서 이전에 생성 된 모든 유형의 주문을 요청합니다

  • 두 번째 단계는 단일 통화 또는 일괄 처리로 각 유형의 주문을 독립적으로 내보내는 것입니다.

기존 주문의 모든 유형을 요청하려면 다음 단계를 따르세요.

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/AcumaticaERP/Soap/SO301000.asmx";
context.Login(username, password);
try
{
    Content orderSchema = PX.Soap.Helper.GetSchema<Content>(context);
    var commands = new Command[]
    {
        orderSchema.OrderSummary.ServiceCommands.EveryOrderType,
        orderSchema.OrderSummary.OrderType,
    };

    var types = context.Export(commands, null, 1, false, false);
}
finally
{
    context.Logout();
}

위의 SOAP 호출에서 Export 명령의 topCount 매개 변수가 1 설정되어 있는지 확인합니다. 이 요청의 목적은 Acumatica ERP 응용 프로그램에서 이전에 생성 된 모든 유형의 주문을 가져오고 데이터를 내보내는 것이 아닙니다.

일괄 적으로 각 유형의 레코드를 독립적으로 내보내려면 다음을 수행하십시오.

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/AcumaticaERP/Soap/SO301000.asmx";
context.Login(username, password);
try
{
    Content orderSchema = PX.Soap.Helper.GetSchema<Content>(context);
    var commands = new Command[]
    {
        orderSchema.OrderSummary.ServiceCommands.EveryOrderType,
        orderSchema.OrderSummary.OrderType,
    };
    var types = context.Export(commands, null, 1, false, false);

    for (int i = 0; i < types.Length; i++)
    {
        commands = new Command[]
        {
            new Value
            {
                LinkedCommand = orderSchema.OrderSummary.OrderType,
                Value = types[i][0]
            },
            orderSchema.OrderSummary.ServiceCommands.EveryOrderNbr,
            orderSchema.OrderSummary.OrderType,
            orderSchema.OrderSummary.OrderNbr,
            orderSchema.OrderSummary.Customer,
            orderSchema.OrderSummary.CustomerOrder,
            orderSchema.OrderSummary.Date,
            orderSchema.OrderSummary.OrderedQty,
            orderSchema.OrderSummary.OrderTotal
        };
        var orders = context.Export(commands, null, 100, false, false);
        while (orders.Length == 100)
        {
            var filters = new Filter[]
            {
                new Filter
                {
                    Field = orderSchema.OrderSummary.OrderNbr,
                    Condition = FilterCondition.Greater,
                    Value = orders[orders.Length - 1][1]
                }
            };
            orders = context.Export(commands, filters, 100, false, false);
        }
    }
}
finally
{
    context.Logout();
}

위의 샘플은 Acumatica ERP의 모든 판매 주문을 100 개 레코드로 내보내는 방법을 보여줍니다. 각 유형의 판매 주문을 독립적으로 내보내려면 SOAP 명령은 항상 내보내려는 주문 유형을 결정하는 Value 명령으로 시작해야합니다. 첫 번째 키 값을 설정하는 데 사용 된 값 명령이 ServiceCommands.Every[Key] 명령을 실행 한 후 [Key] 가 두 번째 키의 이름으로 바뀝니다.

특정 유형의 레코드를 내보내려면 다음과 같이하십시오.

특정 유형의 판매 주문을 내 보내야 할 경우 SOAP 요청 시작 부분에 Value 명령을 사용하여 주문 유형을 명시 적으로 정의한 다음 단일 호출 방식 또는 일괄 처리 방식으로 내보낼 수 있습니다.

하나의 호출로 IN 유형의 모든 판매 오더를 내보내려면

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/AcumaticaERP/Soap/SO301000.asmx";
context.Login(username, password);
try
{
    Content orderSchema = PX.Soap.Helper.GetSchema<Content>(context);
    var commands = new Command[]
    {
        new Value
        {
            LinkedCommand = orderSchema.OrderSummary.OrderType,
            Value = "IN"
        },
        orderSchema.OrderSummary.ServiceCommands.EveryOrderNbr,
        orderSchema.OrderSummary.OrderType,
        orderSchema.OrderSummary.OrderNbr,
        orderSchema.OrderSummary.Customer,
        orderSchema.OrderSummary.CustomerOrder,
        orderSchema.OrderSummary.Date,
        orderSchema.OrderSummary.OrderedQty,
        orderSchema.OrderSummary.OrderTotal
    };
    var orders = context.Export(commands, null, 0, false, false);
}
finally
{
    context.Logout();
}


Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow