Пример #1
0
        /// <summary>
        /// Get Next Inventory List Supply
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnListInventorySupplyByNextToken_Click(object sender, RoutedEventArgs e)
        {
            string SellerId           = CommonValue.strMerchantId;
            string MarketplaceId      = CommonValue.strMarketplaceId;
            string AccessKeyId        = CommonValue.strAccessKeyId;
            string SecretKeyId        = CommonValue.strSecretKeyId;
            string ApplicationVersion = CommonValue.strApplicationVersion;
            string ApplicationName    = CommonValue.strApplicationName;
            string MWSAuthToken       = CommonValue.strMWSAuthToken;
            string strbuff            = string.Empty;

            FBAInventoryServiceMWSConfig config = new FBAInventoryServiceMWSConfig();

            config.ServiceURL = CommonValue.strServiceURL;

            FBAInventoryServiceMWSClient client = new FBAInventoryServiceMWSClient(
                AccessKeyId,
                SecretKeyId,
                ApplicationName,
                ApplicationVersion,
                config);
            ListInventorySupplyRequest request = new ListInventorySupplyRequest();

            request.SellerId           = SellerId;
            request.Marketplace        = MarketplaceId;
            request.MWSAuthToken       = MWSAuthToken;
            request.QueryStartDateTime = DateTime.Now.AddMonths(1);
            request.ResponseGroup      = "Detailed";

            ListInventorySupplyResponse response = client.ListInventorySupply(request);

            if (response.IsSetListInventorySupplyResult())
            {
                ListInventorySupplyResult listInventorySupplyResult = response.ListInventorySupplyResult;
                if (listInventorySupplyResult.IsSetInventorySupplyList())
                {
                    if (listInventorySupplyResult.NextToken != null)
                    {
                        ListInventorySupplyByNextTokenRequest request1 = new ListInventorySupplyByNextTokenRequest();
                        request1.SellerId     = SellerId;
                        request1.Marketplace  = MarketplaceId;
                        request1.MWSAuthToken = MWSAuthToken;
                        request1.NextToken    = listInventorySupplyResult.NextToken;

                        ListInventorySupplyByNextTokenResponse response1 = client.ListInventorySupplyByNextToken(request1);
                        if (response1.IsSetListInventorySupplyByNextTokenResult())
                        {
                            ListInventorySupplyByNextTokenResult listInventorySupplyByNextTokenResult = response1.ListInventorySupplyByNextTokenResult;
                            if (listInventorySupplyByNextTokenResult.IsSetInventorySupplyList())
                            {
                                InventorySupplyList    inventorySupplyList = listInventorySupplyByNextTokenResult.InventorySupplyList;
                                List <InventorySupply> memberList          = inventorySupplyList.member;
                                if (memberList.Count > 0)
                                {
                                    foreach (InventorySupply member in memberList)
                                    {
                                        if (member.IsSetTotalSupplyQuantity())
                                        {
                                            strbuff += "Amount:" + member.TotalSupplyQuantity;
                                        }
                                    }
                                }
                                else
                                {
                                    strbuff = "Not find next stock information.";
                                }
                            }
                        }
                    }
                }
            }
            txtListInventorySupplyByNextToken.Text = strbuff;
        }
Пример #2
0
        /// <summary>
        /// Continues pagination over a resultset of inventory data for inventory
        /// items.
        ///
        /// This operation is used in conjunction with ListUpdatedInventorySupply.
        /// Please refer to documentation for that operation for further details.
        ///
        /// </summary>
        /// <param name="service">Instance of FBAInventoryServiceMWS service</param>
        /// <param name="request">ListInventorySupplyByNextTokenRequest request</param>
        public static void InvokeListInventorySupplyByNextToken(FBAInventoryServiceMWS service, ListInventorySupplyByNextTokenRequest request)
        {
            try
            {
                ListInventorySupplyByNextTokenResponse response = service.ListInventorySupplyByNextToken(request);


                Console.WriteLine("Service Response");
                Console.WriteLine("=============================================================================");
                Console.WriteLine();

                Console.WriteLine("        ListInventorySupplyByNextTokenResponse");
                if (response.IsSetListInventorySupplyByNextTokenResult())
                {
                    Console.WriteLine("            ListInventorySupplyByNextTokenResult");
                    ListInventorySupplyByNextTokenResult listInventorySupplyByNextTokenResult = response.ListInventorySupplyByNextTokenResult;
                    if (listInventorySupplyByNextTokenResult.IsSetInventorySupplyList())
                    {
                        Console.WriteLine("                InventorySupplyList");
                        InventorySupplyList    inventorySupplyList = listInventorySupplyByNextTokenResult.InventorySupplyList;
                        List <InventorySupply> memberList          = inventorySupplyList.member;
                        foreach (InventorySupply member in memberList)
                        {
                            Console.WriteLine("                    member");
                            if (member.IsSetSellerSKU())
                            {
                                Console.WriteLine("                        SellerSKU");
                                Console.WriteLine("                            {0}", member.SellerSKU);
                            }
                            if (member.IsSetFNSKU())
                            {
                                Console.WriteLine("                        FNSKU");
                                Console.WriteLine("                            {0}", member.FNSKU);
                            }
                            if (member.IsSetASIN())
                            {
                                Console.WriteLine("                        ASIN");
                                Console.WriteLine("                            {0}", member.ASIN);
                            }
                            if (member.IsSetCondition())
                            {
                                Console.WriteLine("                        Condition");
                                Console.WriteLine("                            {0}", member.Condition);
                            }
                            if (member.IsSetTotalSupplyQuantity())
                            {
                                Console.WriteLine("                        TotalSupplyQuantity");
                                Console.WriteLine("                            {0}", member.TotalSupplyQuantity);
                            }
                            if (member.IsSetInStockSupplyQuantity())
                            {
                                Console.WriteLine("                        InStockSupplyQuantity");
                                Console.WriteLine("                            {0}", member.InStockSupplyQuantity);
                            }
                            if (member.IsSetEarliestAvailability())
                            {
                                Console.WriteLine("                        EarliestAvailability");
                                Timepoint earliestAvailability = member.EarliestAvailability;
                                if (earliestAvailability.IsSetTimepointType())
                                {
                                    Console.WriteLine("                            TimepointType");
                                    Console.WriteLine("                                {0}", earliestAvailability.TimepointType);
                                }
                                if (earliestAvailability.IsSetDateTime())
                                {
                                    Console.WriteLine("                            DateTime");
                                    Console.WriteLine("                                {0}", earliestAvailability.DateTime);
                                }
                            }
                            if (member.IsSetSupplyDetail())
                            {
                                Console.WriteLine("                        SupplyDetail");
                                InventorySupplyDetailList    supplyDetail = member.SupplyDetail;
                                List <InventorySupplyDetail> member1List  = supplyDetail.member;
                                foreach (InventorySupplyDetail member1 in member1List)
                                {
                                    Console.WriteLine("                            member");
                                    if (member1.IsSetQuantity())
                                    {
                                        Console.WriteLine("                                Quantity");
                                        Console.WriteLine("                                    {0}", member1.Quantity);
                                    }
                                    if (member1.IsSetSupplyType())
                                    {
                                        Console.WriteLine("                                SupplyType");
                                        Console.WriteLine("                                    {0}", member1.SupplyType);
                                    }
                                    if (member1.IsSetEarliestAvailableToPick())
                                    {
                                        Console.WriteLine("                                EarliestAvailableToPick");
                                        Timepoint earliestAvailableToPick = member1.EarliestAvailableToPick;
                                        if (earliestAvailableToPick.IsSetTimepointType())
                                        {
                                            Console.WriteLine("                                    TimepointType");
                                            Console.WriteLine("                                        {0}", earliestAvailableToPick.TimepointType);
                                        }
                                        if (earliestAvailableToPick.IsSetDateTime())
                                        {
                                            Console.WriteLine("                                    DateTime");
                                            Console.WriteLine("                                        {0}", earliestAvailableToPick.DateTime);
                                        }
                                    }
                                    if (member1.IsSetLatestAvailableToPick())
                                    {
                                        Console.WriteLine("                                LatestAvailableToPick");
                                        Timepoint latestAvailableToPick = member1.LatestAvailableToPick;
                                        if (latestAvailableToPick.IsSetTimepointType())
                                        {
                                            Console.WriteLine("                                    TimepointType");
                                            Console.WriteLine("                                        {0}", latestAvailableToPick.TimepointType);
                                        }
                                        if (latestAvailableToPick.IsSetDateTime())
                                        {
                                            Console.WriteLine("                                    DateTime");
                                            Console.WriteLine("                                        {0}", latestAvailableToPick.DateTime);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (listInventorySupplyByNextTokenResult.IsSetNextToken())
                    {
                        Console.WriteLine("                NextToken");
                        Console.WriteLine("                    {0}", listInventorySupplyByNextTokenResult.NextToken);
                    }
                }
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        Console.WriteLine("                RequestId");
                        Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }
            }
            catch (FBAInventoryServiceMWSException ex)
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
            }
        }
Пример #3
0
        public DataSet InvokeListInventorySupplyByNextToken(FBAInventoryServiceMWS.FBAInventoryServiceMWS service, ListInventorySupplyByNextTokenRequest request)
        {
            try
            {
                ListInventorySupplyByNextTokenResponse response = service.ListInventorySupplyByNextToken(request);

                if (response.IsSetListInventorySupplyByNextTokenResult())
                {
                    ListInventorySupplyByNextTokenResult listInventorySupplyByNextTokenResult = response.ListInventorySupplyByNextTokenResult;
                    if (listInventorySupplyByNextTokenResult.IsSetInventorySupplyList())
                    {
                        InventorySupplyList    inventorySupplyList = listInventorySupplyByNextTokenResult.InventorySupplyList;
                        List <InventorySupply> memberList          = inventorySupplyList.member;
                        foreach (InventorySupply member in memberList)
                        {
                            int InboundCount  = 0;
                            int InStockCount  = 0;
                            int TransferCount = 0;
                            //Console.WriteLine("                    member");
                            DataRow InventoryRow = InventorySupplyTable.NewRow();
                            InventoryRow["FNSKU"]     = "N/A";
                            InventoryRow["SellerSKU"] = "N/A";
                            InventoryRow["ASIN"]      = "N/A";
                            InventoryRow["Inbound"]   = InboundCount;
                            InventoryRow["InStock"]   = InStockCount;
                            InventoryRow["Transfer"]  = TransferCount;
                            if (member.IsSetSellerSKU())
                            {
                                InventoryRow["SellerSKU"] = member.SellerSKU;
                                //Console.WriteLine("                        SellerSKU");
                                //Console.WriteLine("                            {0}", member.SellerSKU);
                            }
                            if (member.IsSetFNSKU())
                            {
                                InventoryRow["FNSKU"] = member.FNSKU;
                                //Console.WriteLine("                        FNSKU");
                                //Console.WriteLine("                            {0}", member.FNSKU);
                            }
                            if (member.IsSetASIN())
                            {
                                InventoryRow["ASIN"] = member.ASIN;
                                //Console.WriteLine("                        ASIN");
                                // Console.WriteLine("                            {0}", member.ASIN);
                            }
                            if (member.IsSetCondition())
                            {
                                //Console.WriteLine("                        Condition");
                                //Console.WriteLine("                            {0}", member.Condition);
                            }
                            if (member.IsSetTotalSupplyQuantity())
                            {
                                //InventoryRow["TotalSupplyQuantity"] = member.TotalSupplyQuantity;
                                //Console.WriteLine("                        TotalSupplyQuantity");
                                //Console.WriteLine("                            {0}", member.TotalSupplyQuantity);
                            }
                            if (member.IsSetInStockSupplyQuantity())
                            {
                                //InventoryRow["InStockSupplyQuantity"] = member.InStockSupplyQuantity;
                                //Console.WriteLine("                        InStockSupplyQuantity");
                                //Console.WriteLine("                            {0}", member.InStockSupplyQuantity);
                            }
                            if (member.IsSetEarliestAvailability())
                            {
                                //Console.WriteLine("                        EarliestAvailability");
                                Timepoint earliestAvailability = member.EarliestAvailability;
                                if (earliestAvailability.IsSetTimepointType())
                                {
                                    //Console.WriteLine("                            TimepointType");
                                    //Console.WriteLine("                                {0}", earliestAvailability.TimepointType);
                                }
                                if (earliestAvailability.IsSetDateTime())
                                {
                                    //Console.WriteLine("                            DateTime");
                                    //Console.WriteLine("                                {0}", earliestAvailability.DateTime);
                                }
                            }
                            if (member.IsSetSupplyDetail())
                            {
                                //Console.WriteLine("                        SupplyDetail");
                                InventorySupplyDetailList    supplyDetail = member.SupplyDetail;
                                List <InventorySupplyDetail> member1List  = supplyDetail.member;
                                foreach (InventorySupplyDetail member1 in member1List)
                                {
                                    //Console.WriteLine("                            member");
                                    if (member1.IsSetQuantity())
                                    {
                                        if (member1.SupplyType == "InStock")
                                        {
                                            InStockCount += Int32.Parse(member1.Quantity.ToString());
                                        }
                                        if (member1.SupplyType == "Inbound")
                                        {
                                            InboundCount += Int32.Parse(member1.Quantity.ToString());
                                        }
                                        if (member1.SupplyType == "Transfer")
                                        {
                                            TransferCount += Int32.Parse(member1.Quantity.ToString());
                                        }
                                        //InventoryRow[member1.SupplyType] = member1.Quantity;
                                        //Console.WriteLine("                                Quantity");
                                        //Console.WriteLine("                                    {0}", member1.Quantity);
                                    }
                                    if (member1.IsSetSupplyType())
                                    {
                                        //Console.WriteLine("                                SupplyType");
                                        //Console.WriteLine("                                    {0}", member1.SupplyType);
                                    }
                                    if (member1.IsSetEarliestAvailableToPick())
                                    {
                                        //Console.WriteLine("                                EarliestAvailableToPick");
                                        //Timepoint earliestAvailableToPick = member1.EarliestAvailableToPick;
                                        //if (earliestAvailableToPick.IsSetTimepointType())
                                        //{
                                        //    Console.WriteLine("                                    TimepointType");
                                        //    Console.WriteLine("                                        {0}", earliestAvailableToPick.TimepointType);
                                        //}
                                        //if (earliestAvailableToPick.IsSetDateTime())
                                        //{
                                        //    Console.WriteLine("                                    DateTime");
                                        //    Console.WriteLine("                                        {0}", earliestAvailableToPick.DateTime);
                                        //}
                                    }
                                    if (member1.IsSetLatestAvailableToPick())
                                    {
                                        //Console.WriteLine("                                LatestAvailableToPick");
                                        //Timepoint latestAvailableToPick = member1.LatestAvailableToPick;
                                        //if (latestAvailableToPick.IsSetTimepointType())
                                        //{
                                        //    Console.WriteLine("                                    TimepointType");
                                        //    Console.WriteLine("                                        {0}", latestAvailableToPick.TimepointType);
                                        //}
                                        //if (latestAvailableToPick.IsSetDateTime())
                                        //{
                                        //    Console.WriteLine("                                    DateTime");
                                        //    Console.WriteLine("                                        {0}", latestAvailableToPick.DateTime);
                                        //}
                                    }
                                }
                            }//end of foreach member1 list

                            InventoryRow["Inbound"]  = InboundCount;
                            InventoryRow["InStock"]  = InStockCount;
                            InventoryRow["Transfer"] = TransferCount;

                            InventorySupplyTable.Rows.Add(InventoryRow);
                        } // end of foreach member list
                    }
                    if (listInventorySupplyByNextTokenResult.IsSetNextToken())
                    {
                        Console.WriteLine("                NextToken");
                        Console.WriteLine("                    {0}", listInventorySupplyByNextTokenResult.NextToken);
                        request.NextToken = listInventorySupplyByNextTokenResult.NextToken;
                        InvokeListInventorySupplyByNextToken(service, request);
                    }
                }
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        //Console.WriteLine("                RequestId");
                        //Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }
            }
            catch (FBAInventoryServiceMWSException ex)
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
            }

            return(InventorySupplyDataSet);
        }