コード例 #1
0
        public static AxBaseException WriteCategories(int actionId)
        {
            var roles = ServiceConnector.CallOdataEndpoint <CategoryRoleDTO>("RetailEcoResCategoryHierarchyRole", "", "[ax].[ECORESCATEGORYHIERARCHYROLE]", actionId).Result;
            //if (roles != null)
            //{
            //    return roles;
            //}
            var hierarchy = ServiceConnector.CallOdataEndpoint <RetailEcoResCategoryHierarchy>("RetailEcoResCategoryHierarchy", "", "[ax].[ECORESCATEGORYHIERARCHY]", actionId).Result;
            //if (hierarchy != null)
            //{
            //    return hierarchy;
            //}

            var category = ServiceConnector.CallOdataEndpoint <RetailEcoResCategory>("RetailEcoResCategory", "", "[ax].[ECORESCATEGORY]", actionId).Result;
            //if (category != null)
            //{
            //    return category;
            //}

            var prodCat = ServiceConnector.CallOdataEndpoint <AGREcoResProductCategory>("AGREcoResProductCategories", "", "[ax].[ECORESPRODUCTCATEGORY]", actionId).Result;

            //if (prodCat != null)
            //{
            //    return prodCat;
            //}
            return(null);
        }
コード例 #2
0
        public static AxBaseException WriteLocationsAndVendors(int actionId)
        {
            //var channel = ReadRetailChannel(context);
            var channel = ServiceConnector.CallOdataEndpoint <RetailChannel>("RetailChannels",
                                                                             // "?$filter=ChannelType eq Microsoft.Dynamics.DataEntities.RetailChannelType'RetailStore'",
                                                                             "", "[ax].[RETAILCHANNELTABLE]", actionId).Result;
            //if (channel != null)
            //{
            //    return channel;
            //}

            //var assortment = ReadRetailAssortment(context);
            var assortment = ServiceConnector.CallOdataEndpoint <RetailAssortment>("RetailAssortments",
                                                                                   "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'"
                                                                                   , "[ax].[RETAILASSORTMENTTABLE]", actionId).Result;

            //if (assortment != null)
            //{
            //    return assortment;
            //}
            //var locSetup = context.Locations.ToList().GetDataReader<Location>();
            var locSetup = ServiceConnector.CallOdataEndpoint <Location>("Locations", "", "[ax].[INVENTLOCATION]", actionId).Result;
            //if (locSetup != null)
            //{
            //    return locSetup;
            //}
            //var dir = context.DirParties.ToList().GetDataReader<DirParty>();
            var dir = ServiceConnector.CallOdataEndpoint <DirParty>("DirParties", "", "[ax].[DIRPARTYTABLE]", actionId).Result;
            //if (dir != null)
            //{
            //    return dir;
            //}
            //var vendor = context.Vendors.ToList().GetDataReader<Vendor>();
            var vendor = ServiceConnector.CallOdataEndpointWithPageSize <Vendor>("Vendors", 200, "[ax].[VENDTABLE]", actionId).Result;
            //if (vendor != null)
            //{
            //    return vendor;
            //}

            var channelLines = ServiceConnector.CallOdataEndpoint <RetailAssortmentChannelLine>("RetailAssortmentChannelLines",
                                                                                                "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'", "[ax].[RETAILASSORTMENTCHANNELLINE]", actionId)
                               .Result;
            //if (channelLines != null)
            //{
            //    return channelLines;
            //}

            var productLines = ServiceConnector.CallOdataEndpoint <RetailAssortmentProductLine>("RetailAssortmentProductLines",
                                                                                                "?$filter=Status eq Microsoft.Dynamics.DataEntities.RetailAssortmentStatusType'Published'", "[ax].[RETAILASSORTMENTPRODUCTLINE]", actionId)
                               .Result;

            //if (productLines != null)
            //{
            //    return productLines;
            //}
            return(null);
        }
コード例 #3
0
ファイル: BomTransfer.cs プロジェクト: tociga/ErpConnector
        public static AxBaseException GetBom(int actionId)
        {
            var bomHeaders = ServiceConnector.CallOdataEndpoint <BillOfMaterialsHeader>("BillOfMaterialsHeaders", null, "[ax].[BillOfMaterialsHeaders]", actionId).Result;
            //if (bomHeaders != null)
            //{
            //    return bomHeaders;
            //}
            var bomLines = ServiceConnector.CallOdataEndpoint <BillOfMaterialsLine>("BillOfMaterialsLines", null, "[ax].[BillOfMaterialsLines]", actionId).Result;
            //if (bomLines != null)
            //{
            //    return bomLines;
            //}

            var bomVersion = ServiceConnector.CallOdataEndpoint <BillOfMaterialsVersion>("BillOfMaterialsVersions", null, "[ax].[BillOfMaterialsVersions]", actionId).Result;

            //if (bomVersion != null)
            //{
            //    return bomVersion;
            //}

            return(null);
        }
コード例 #4
0
        public static AxBaseException GetPriceHistory(int actionId, bool includeBAndM)
        {
            if (includeBAndM)
            {
                var openSalesPriceJournalLines = ServiceConnector.CallOdataEndpoint <OpenSalesPriceJournalLinesDTO>("OpenSalesPriceJournalLines", "", "[ax].[OpenSalesPriceJournalLines]", actionId).Result;
                //if (openSalesPriceJournalLines != null)
                //{
                //    return openSalesPriceJournalLines;
                //}

                var openPurchasePriceJournalLines = ServiceConnector.CallOdataEndpoint <OpenPurchasePriceJournalLinesDTO>("OpenPurchasePriceJournalLines", "", "[ax].[OpenPurchasePriceJournalLines]", actionId).Result;
                //if (openPurchasePriceJournalLines != null)
                //{
                //    return openPurchasePriceJournalLines;
                //}

                var bonSalesPrice = ServiceConnector.CallOdataEndpoint <BONSalesPriceDTO>("BONSalesPrices", "", "[ax].[SalesPrices]", actionId).Result;
                //if (bonSalesPrice != null)
                //{
                //    return bonSalesPrice;
                //}
            }
            return(null);
        }
コード例 #5
0
        public static AxBaseException ReadItemAttributes(bool includesFashion, bool includeBandM, int actionId)
        {
            var colorGroups = ServiceConnector.CallOdataEndpoint <VariantGroupDTO>("ProductColorGroups", "", "[ax].[ProductColorGroup]", actionId).Result;

            if (colorGroups != null)
            {
                return(colorGroups);
            }
            var sizeGroups = ServiceConnector.CallOdataEndpoint <VariantGroupDTO>("ProductSizeGroups", "", "[ax].[ProductSizeGroup]", actionId).Result;

            if (sizeGroups != null)
            {
                return(sizeGroups);
            }

            var styleGroups = ServiceConnector.CallOdataEndpoint <VariantGroupDTO>("ProductStyleGroups", "", "[ax].[ProductStyleGroup]", actionId).Result;

            if (styleGroups != null)
            {
                return(styleGroups);
            }

            if (includesFashion)
            {
                var seasonGroups = ServiceConnector.CallOdataEndpoint <VariantGroupDTO>("RetailSeasonGroups", "", "[ax].[SeasonGroup]", actionId).Result;
                if (seasonGroups != null)
                {
                    return(seasonGroups);
                }

                //var season = ServiceConnector.CallOdataEndpoint<SeasonTable>("SeasonTables", "", "[ax].[SeasonTable]", actionId).Result;
                //if (season != null)
                //{
                //    return season;
                //}
            }
            var colorGroupLines = ServiceConnector.CallOdataEndpoint <ProductColorGroupLine>("ProductColorGroupLines", "", "[ax].[ProductColorGroupLine]", actionId).Result;

            if (colorGroupLines != null)
            {
                return(colorGroupLines);
            }

            var sizeGroupLines = ServiceConnector.CallOdataEndpoint <ProductSizeGroupLine>("ProductSizeGroupLines", "", "[ax].[ProductSizeGroupLine]", actionId).Result;

            if (sizeGroupLines != null)
            {
                return(sizeGroupLines);
            }

            var styleGroupLines = ServiceConnector.CallOdataEndpoint <ProductStyleGroupLine>("ProductStyleGroupLines", "", "[ax].[ProductStyleGroupLine]", actionId).Result;

            if (styleGroupLines != null)
            {
                return(styleGroupLines);
            }

            var color = ServiceConnector.CallOdataEndpoint <ProductColor>("ProductColors", "", "[ax].[ProductColor]", actionId).Result;

            if (color != null)
            {
                return(color);
            }

            var size = ServiceConnector.CallOdataEndpoint <ProductSize>("ProductSizes", "", "[ax].[ProductSize]", actionId).Result;

            if (size != null)
            {
                return(size);
            }

            var style = ServiceConnector.CallOdataEndpoint <ProductStyle>("ProductStyles", "", "[ax].[ProductStyle]", actionId).Result;

            if (style != null)
            {
                return(style);
            }
            if (includeBandM)
            {
                var prodAttribute = ServiceConnector.CallOdataEndpoint <ProductAttribute>("ProductAttributes", "", "[ax].[ProductAttributes]", actionId).Result;
                if (prodAttribute != null)
                {
                    return(prodAttribute);
                }

                var attrValue = ServiceConnector.CallOdataEndpoint <ProductAttributeValue>("ProductAttributeValues", "", "[ax].[ProductAttributeValues]", actionId).Result;
                if (attrValue != null)
                {
                    return(attrValue);
                }

                //var ecoResValue = ServiceConnector.CallService<AGREcoResValueDTO>(actionId,  "GetValue", "AGRAttributeService", "[ax].[ECORESVALUE]", 10000);
                //if (ecoResValue != null)
                //{
                //    return ecoResValue;
                //}

                var attrViaService = UpdateProductAttributes(actionId);

                if (attrViaService != null)
                {
                    return(null);
                }
            }

            return(null);
        }
コード例 #6
0
        public static AxBaseException WriteItems(bool includeFashion, int actionId)
        {
            var productMaster = ServiceConnector.CallOdataEndpoint <ProductMasterReadDTO>("ProductMasters", "", "[ax].[ProductMaster]", actionId).Result;
            //if (productMaster != null)
            //{
            //    return productMaster;
            //}

            var releasedMasters = ServiceConnector.CallOdataEndpointWithPageSize <ReleasedProductMaster>("ReleasedProductMasters", 2000, "[ax].[ReleasedProductMaster]", actionId).Result;
            //if (releasedMasters != null)
            //{
            //    return releasedMasters;
            //}

            var distinctProducts = ServiceConnector.CallOdataEndpoint <DistinctProductsDTO>("DistinctProducts", "", "[ax].[DistinctProduct]", actionId).Result;
            //if (distinctProducts != null)
            //{
            //    return distinctProducts;
            //}
            var items = ServiceConnector.CallOdataEndpointWithPageSize <ReleasedDistinctProduct>("ReleasedDistinctProducts", 2000, "[ax].[ReleasedDistinctProducts]", actionId).Result;
            //if (items != null)
            //{
            //    return items;
            //}

            var inventDim = ServiceConnector.CallOdataEndpoint <InventDimDTO>("InventDims", "", "[ax].[INVENTDIM]", actionId).Result;
            //if (inventDim != null)
            //{
            //    return inventDim;
            //}

            var invTableModule = ServiceConnector.CallOdataEndpoint <TableModule>("TableModules", "", "[ax].[INVENTTABLEMODULE]", actionId).Result;
            //if (invTableModule != null)
            //{
            //    return invTableModule;
            //}

            var custVendExt = ServiceConnector.CallOdataEndpoint <CustVendExternalItem>("CustVendExternalItems", "", "[ax].[CUSTVENDEXTERNALITEM]", actionId).Result;
            //if (custVendExt != null)
            //{
            //    return custVendExt;
            //}

            var variants = ServiceConnector.CallOdataEndpoint <ReleasedProductVariant>("ReleasedProductVariants", "", "[ax].[ReleasedProductVariants]", actionId).Result;
            //if (variants != null)
            //{
            //    return variants;
            //}

            var combos = ServiceConnector.CallOdataEndpoint <InventDimComboDTO>("InventDimCombinations", "", "[ax].[INVENTDIMCOMBINATIONS]", actionId).Result;
            //if (combos != null)
            //{
            //    return combos;
            //}

            //var assortLookup = WriteServiceData<RetailAssortmentLookupDTO>("[ax].[RETAILASSORTMENTLOOKUP]", "GetRetailAssortmentLookup");
            //if (assortLookup != null)
            //{
            //    return assortLookup;
            //}

            var retailChannelLookup = ServiceConnector.CallService <RetailAssortmentLookupChannelGroupDTO>(actionId, "GetRetailAssortmentLookupChannelGroup", "AGRItemCustomService", "[ax].[RETAILASSORTMENTLOOKUPCHANNELGROUP]", 10000);
            //if (retailChannelLookup != null)
            //{
            //    return retailChannelLookup;
            //}

            var reqItems = ServiceConnector.CallOdataEndpoint <AGRReqItemTable>("AGRReqItemTables", "", "[ax].[REQITEMTABLE]", actionId).Result;
            //if (reqItems != null)
            //{
            //    return reqItems;
            //}



            var reqKey = ServiceConnector.CallOdataEndpoint <AGRReqSafetyKey>("AGRReqSafetyKeys", "", "[ax].[REQSAFETYKEY]", actionId).Result;
            //if (reqKey != null)
            //{
            //    return reqKey;
            //}

            var saftyLines = ServiceConnector.CallService <ReqSafetyLineDTO>(actionId, "GetSafetyLines", "AGRItemCustomService", "[ax].[REQSAFETYLINE]", 5000);
            //if (saftyLines != null)
            //{
            //    return saftyLines;
            //}

            // item_order_routes
            var itemPurchSetup = ServiceConnector.CallOdataEndpoint <ItemPurchSetup>("ItemPurchSetups", "", "[ax].[INVENTITEMPURCHSETUP]", actionId).Result;
            //if (itemPurchSetup != null)
            //{
            //    return itemPurchSetup;
            //}

            var itemInventSetup = ServiceConnector.CallOdataEndpoint <ItemInventSetup>("ItemInventSetups", "", "[ax].[INVENTITEMINVENTSETUP]", actionId).Result;
            //if (itemInventSetup != null)
            //{
            //    return itemInventSetup;
            //}

            var unitOfMeasure = ServiceConnector.CallService <UnitOfMeasureDTO>(actionId, "GetUnitOfMeasure", "AGRItemCustomService", "[ax].[UNITOFMEASURE]", 5000);
            //if (unitOfMeasure != null)
            //{
            //    return unitOfMeasure;
            //}
            var unitConv = ServiceConnector.CallService <UnitOfMeasureConversionDTO>(actionId, "GetUnitOfMeasureConversion", "AGRItemCustomService", "[ax].[UNITOFMEASURECONVERSION]", 5000);

            //if (unitConv != null)
            //{
            //    return unitConv;
            //}

            if (includeFashion)
            {
                ////var inventSeason = context.InventSeasonTables.ToList().GetDataReader<InventSeasonTable>();
                ////    DataWriter.WriteToTable<InventSeasonTable>(inventSeason, "[ax].[InventSeasonTable]");

                ////WriteServiceData<InventColorSeasonDTO>("[ax].[InventColorSeason]", "GetInventSeasonColor");
                //    var inventColorSeason = GetFromService<InventColorSeasonDTO>("AGRFashionServiceGroup", "AGRFashionService", "GetInventSeasonColor", null);
                //    if (inventColorSeason.Exception != null)
                //    {
                //        return inventColorSeason.Exception;
                //    }
                //    DataWriter.WriteToTable(inventColorSeason.value.GetDataReader(), "[ax].[InventColorSeason]");
            }
            return(null);
        }
コード例 #7
0
 public static AxBaseException PullAGROrderLines(int actionId)
 {
     return(ServiceConnector.CallOdataEndpoint <AGROrderLine>("AGROrderLines", null, "[ax].[AGROrderLine]", actionId).Result);
 }