---
title: "在庫管理方法"
slug: "inventory-service-methods"
abstract: ""
---
# 在庫管理方法

サービスプロバイダーは、Connectパイプラインとのやり取りを容易にするために設計されたラッパーオブジェクトです。プロバイダーはConnectパイプラインを呼び出す以外のロジックを実装しません。すべてのビジネスロジックはパイプラインプロセッサ内で実装されています。

インベントリサービスプロバイダーには、インベントリデータとやり取りするための以下の方法が含まれています。

## GetStockInformationメソッド

**名前:**

GetStockInformation

**説明:**

ECSから異なるレベルの在庫情報を取得します。  
  
GetStockInformationパイプラインに電話する。

**使用方法:**

指定された製品リストに必要な在庫情報が必要な場合にSitecoreから呼び出します。

**署名:**

GetStockInformationResult GetStockInformation(GetStockInformationRequest request)

**入力:**

**ショップネーム** **– 文字列。必須**  
  
店の名前だ。

**製品一覧。必須**  
  
InventoryProductのリスト。製品か製品バリアントかはECSでの実装次第です。

**詳細レベル – StockDetailsLevel。必須**  
  
StockDetailsLevelクラスは、GetStockInformation サービスメソッドの要求パラメータとして、要求される在庫の詳細レベルを示す強型型の要求パラメータとして使われます。

**場所 – 文字列。任意**  
  
在庫情報が保管されている特定の倉庫や中央保管場所です。  
  
デフォルトは中央ストレージです。

**顧客ID – 文字列。オプション**  
  
在庫情報が実際の顧客に依存している場合の顧客のIDです。

**IncludeBundledItemsInventory – bool、必須**  
  
フラグはバンドルにのみ有効で、デフォルト値はfalseです。すべてのバンドルアイテムおよびそのバリアントの在庫情報を返す際に使ってください。

**出力:**

**リスト StockInformation –** StockInformationオブジェクトの一覧

**SystemMessages** **\- 外部システムからのメッセージの収集。**

使用例:

var inventoryService = new InventoryServiceProvider();
var request = new GetStockInformationRequest("shopname", new List<InventoryProduct>
 {
 new InventoryProduct
 {
 ProductId = "product\_1"
 },
 new InventoryProduct
 {
 ProductId = "product\_2"
 },
 new InventoryProduct
 { ProductId = "product\_3" }
 },
 StockDetailsLevel.StatusAndAvailability);
var result = inventoryService.GetStockInformation(request);
## GetPreOrderableInformationメソッド

**名前:**

**GetPreOrderableInformation**

**説明:**

予約可能な情報を取得する。

**使用方法:**

Sitecoreから電話をかけてきました。

**署名:**

Result Name(Request request)

**入力:**

**ショップネーム – ストリング。必須**  
  
店の名前だ。

**製品 - List<\*\* インベントリ商品\*\*>。必須**  
  
InventoryProductのリスト。

**ビジターID – 文字列。オプション**  
  
訪問者/連絡先または顧客のID。

**出力:**

**OrderableInformation – リスト**  
  
特定の製品の情報を持つ強型付けのオブジェクトのリスト。

**SystemMessages** **\- 外部システムからのメッセージの収集。**

使用例:

var inventoryService = new InventoryServiceProvider();
var request = new GetPreOrderableInformationRequest("shopname",
 new List<InventoryProduct>
 {
 new InventoryProduct
 {
 ProductId = "product\_1"
 },
 new InventoryProduct
 {
 ProductId = "product\_2"
 },
 new InventoryProduct
 { ProductId = "product\_3" }
 });
var result = inventoryService.GetPreOrderableInformation(request);
## GetBackOrderableInformationメソッド

**名前:**

GetBackOrderableInformationメソッド

**説明:**

バックオーダー可能な情報を得る。

**使用方法:**

Sitecoreから電話をかけてきました。

**署名:**

Result Name(Request request)

**入力:**

**ショップネーム – ストリング。必須**  
  
店の名前だ。

**製品 - List<\*\* インベントリ商品\*\*>。必須**  
  
InventoryProductのリスト。

**ビジターID – 文字列。オプション**  
  
訪問者/連絡先または顧客のID。

**出力:**

**OrderableInformation – リスト**  
  
特定の製品の情報を持つ強型付けのオブジェクトのリスト。

**SystemMessages** **\- 外部システムからのメッセージの収集。**

使用例:

var inventoryService = new InventoryServiceProvider();
var request = new GetBackOrderableInformationRequest("shopname",
 new List<InventoryProduct>
 {
 new InventoryProduct
 {
 ProductId = "product\_1"
 },
 new InventoryProduct
 {
 ProductId = "product\_2"
 },
 new InventoryProduct
 { ProductId = "product\_3" }
 });
var result = inventoryService.GetBackOrderableInformation(request);
## VisitedProductStockStatusメソッド

**名前:**

VisitedProductStockStatus

**説明:**

顧客が商品詳細ページを訪れた場合に電話をかけられます。

**使用方法:**

Sitecoreから呼び出されました

**署名:**

VisitedProductStockStatusResult VisitedProductStockStatus (VisitedProductStockStatusRequest request)

**入力:**

\*\*店名 –\*\*文字列。必須。  
  
店の名前だ。

\*\*株式情報 -\*\*株式情報。必須。  
  
以前に電話で取得した株式情報 GetStockInformation\`\`.

**場所 – 文字列。任意**  
  
在庫情報が保管されている特定の倉庫や中央保管場所です。  
  
デフォルトは中央ストレージです。

**出力:**

**SystemMessages** **\- 外部システムからのメッセージの収集。**

使用例:

var inventoryService = new InventoryServiceProvider();
var stockInfo = new StockInformation
{
 Product = new InventoryProduct
 {
 ProductId = "product\_1"
 },
 Status = StockStatus.BackOrderable
};
var request = new VisitedProductStockStatusRequest("shopname", stockInfo);
var result = inventoryService.VisitedProductStockStatus(request);
## ProductsAreBackInstock方式

**名前:**

商品が在庫が戻っています

**説明:**

製品が在庫に戻った際にリモートで呼び出せるように公開されるメソッド。対応する ProductsAreBackInStock パイプラインを実行します。

**使用方法:**

ECSから電話がかかってきました。

**署名:**

ProductsAreBackInStockResult ProductsAreBackInStock(ProductsAreBackInStockRequest request)

**入力:**

**店名 – ストリング。必須**  
  
これはこの名称に関連する店の名前です。

\*\*製品 – list<\*\* InventoryProduct>。 **必須**  
  
在庫情報が更新された製品を示すInventoryProductのリスト。

**出力:**

**SystemMessages** **\- 外部システムからのメッセージの収集。**

使用例:

var inventoryService = new InventoryServiceProvider();
var request = new ProductsAreBackInStockRequest("shopname",
 new List<InventoryProduct>
 {
 new InventoryProduct
 {
 ProductId = "product\_1"
 },
 new InventoryProduct
 {
 ProductId = "product\_2"
 },
 new InventoryProduct
 { ProductId = "product\_3" }
 });
var result = inventoryService.ProductsAreBackInStock(request);
## GetBackInStockInformationメソッド

**名前:**

GetBackInStockInformation

**説明:**

この方法はECSから最新の在庫情報を取得するために用いられます。  
  
このメソッドは通常、 ProductsAreBackInStock メソッドがリモートで呼び出されたため呼び出され、その場合はパイプラインが暗黙的に呼び出されます。  
  
GetStockInformation法とGetBackInStockInformation法の違いは、まず特定の場所と特定の顧客の在庫情報を検索するのに対し、後者は顧客の文脈を無視してすべての店舗の在庫情報を取得する点です。

**使用方法:**

Sitecoreから呼び出されました

**署名:**

GetBackInStockInformationResult GetBackInStockInformation (GetBackInStockInformationRequest request)

**入力:**

**店名 – ストリング。必須**  
  
これはこの名称に関連する店の名前です。

**製品 – list<\*\* 在庫製品\*\*>。オプション**  
  
最新の在庫情報を得るためのInventoryProductのリスト。  
  
リストが空の場合、例えばリストが提供されない場合、更新された製品の在庫情報の更新はECSが返します。

**出力:**

**StockInformationUpdatesリスト。必須**  
  
StockInformationUpdateのオブジェクトのリストで、それぞれが商品を示すものと、商品が在庫が戻っている場所のリスト(いつ(在庫日)か、そしてカウントのリストで、後者2つはオプションの値です。

**SystemMessages** **\- 外部システムからのメッセージの収集。**

使用例:

var inventoryService = new InventoryServiceProvider();
var request = new GetBackInStockInformationRequest("shopname")
{
 Products = new List<InventoryProduct>
 {
 new InventoryProduct
 {
 ProductId = "product\_1"
 },
 new InventoryProduct
 {
 ProductId = "product\_2"
 },
 new InventoryProduct
 {
 ProductId = "product\_3"
 }
 }
};
var result = inventoryService.GetBackInStockInformation(request);
## GetStockLocationsメソッド

**名前:**

**GetStockLocations**

**説明:**

ECSからすべての在庫場所を取得します。

**使用方法:**

ECS内の在庫リストが必要な場合、Sitecoreから呼び出し。

**署名:**

GetStockLocationsResult GetStockLocations(GetStockLocationsRequest request)

**入力:**

**ショップネーム – 文字列。**  
  
店の名前だ。

**CustomerID** \*\*–\*\***string** **。****オプション**  
  
在庫の所在地リストが必要な顧客のID。

**出力:**

**List StockLocations** – StockLocationオブジェクトのリスト。

**SystemMessages -** 外部システムからのメッセージの収集。

使用例:

var provider = (InventoryServiceProvider)Factory.CreateObject("inventoryServiceProvider", true);
var request = new GetStockLocationsRequest("StarterKit");
var result = provider.GetStockLocations(request);
if (result.Success)
{
 foreach (var stockLocation in result.StockLocations)
 {
 // handle stock location
 }
}
## GetProductStockLocationsメソッド

**名前:**

**商品****在庫の入手場所**

**説明:**

特定の製品についてECSからすべての在庫位置を取得します。

**使用方法:**

ECSで製品の在庫リストが必要な場合、Sitecoreから電話をかけられます。

**署名:**

GetProductStockLocationsResult GetProductStockLocations( GetProductStockLocationsRequest request)

**入力:**

**ショップネーム – 文字列。**  
  
店の名前だ。

**CustomerID – 文字列。オプション**  
  
在庫の所在地リストが必要な顧客のID。

**ProductId(文字列)です。**  
  
調べるための商品のID。

**出力:**

**List<Stock****情報****\> 株式****情報\*\***–\*\* 各場所ごとのStockInformationオブジェクトの一覧。

**SystemMessages -** 外部システムからのメッセージの収集。

使用例:

var provider = (InventoryServiceProvider)Factory.CreateObject("inventoryServiceProvider", true);
var request = new GetProductStockLocationsRequest("StarterKit", "6");
var result = provider.GetProductStockLocations(request);
if (result.Success)
{
 foreach (var stockInfo in result.StockInformation)
 {
 // handle location stock information.
 }
}