コード例 #1
0
        public async void UpdatePOObject(POIntertekOutput poobject, MMSProductEvent product, POSkus posku)
        {
            try
            {
                var prodhierarchy = _lookUpService.GetProductHierarchy(product.SubClass).Result;

                //check if exists
                if (poobject.POSkus != null && poobject.POSkus.Count > 0 && poobject.POSkus.Exists(y => y.SKU == posku.SKU))
                {
                    var poskutobeupdated = poobject.POSkus.Find(y => y.SKU == posku.SKU);

                    poskutobeupdated.POProduct.ClassCode      = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Class;
                    poskutobeupdated.POProduct.DepartmentName = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Description;
                    poskutobeupdated.POProduct.ClassName      = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Description;
                    poskutobeupdated.POProduct.DepartmentCode = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Department;
                    poskutobeupdated.POProduct.ClassShortDesc = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.ShortDesc;

                    poskutobeupdated.POProduct.HTSCode            = product.HTSCode;
                    poskutobeupdated.POProduct.Country            = product.ProductVendors.Find(y => y.Sku == product.Sku)?.CountryOfOrigin;
                    poskutobeupdated.POProduct.SkuDesc            = product.SkuDesc;
                    poskutobeupdated.POProduct.MasterPackQuantity = product.ProductVendors.Find(y => y.Sku == product.Sku)?.MasterPackQuantity;

                    // Product Flags
                    poskutobeupdated.POProduct.ProductFlagsOutput.IntlSafetyTransitTestRequired = !string.IsNullOrEmpty((product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.IntlSafetyTransitTestRequired)?.FlagValue.ConvertToString())) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.IntlSafetyTransitTestRequired).FlagValue.ConvertToString() : "N";
                    poskutobeupdated.POProduct.ProductFlagsOutput.IsChildClothCostume           = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.IsChildClothCostume)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.IsChildClothCostume).FlagValue.ConvertToString() : "N";
                    poskutobeupdated.POProduct.ProductFlagsOutput.IsGlassDishAdultJewelry       = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.IsGlassDishAdultJewelry)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.IsGlassDishAdultJewelry).FlagValue.ConvertToString() : "N";
                    poskutobeupdated.POProduct.ProductFlagsOutput.NonPaintTestingRequired       = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.NonPaintTestingRequired)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.NonPaintTestingRequired).FlagValue.ConvertToString() : "N";
                    poskutobeupdated.POProduct.ProductFlagsOutput.RandomInspectionRequired      = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.RandomInspectionRequired)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.RandomInspectionRequired).FlagValue.ConvertToString() : "N";
                    poskutobeupdated.POProduct.ProductFlagsOutput.CPSIATestingRequired          = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.CPSIATestingRequired)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.CPSIATestingRequired).FlagValue.ConvertToString() : "N";
                    poskutobeupdated.POProduct.ProductFlagsOutput.Sku = product.Sku;
                }
                else
                {
                    POProductFlagsOutput productFlagsOutput = new POProductFlagsOutput
                    {
                        Sku = product.Sku,
                        IntlSafetyTransitTestRequired = !string.IsNullOrEmpty((product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.IntlSafetyTransitTestRequired)?.FlagValue.ConvertToString())) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.IntlSafetyTransitTestRequired).FlagValue.ConvertToString() : "N",
                        IsChildClothCostume           = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.IsChildClothCostume)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.IsChildClothCostume).FlagValue.ConvertToString() : "N",
                        IsGlassDishAdultJewelry       = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.IsGlassDishAdultJewelry)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.IsGlassDishAdultJewelry).FlagValue.ConvertToString() : "N",
                        NonPaintTestingRequired       = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.NonPaintTestingRequired)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.NonPaintTestingRequired).FlagValue.ConvertToString() : "N",
                        RandomInspectionRequired      = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.RandomInspectionRequired)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.RandomInspectionRequired).FlagValue.ConvertToString() : "N",
                        CPSIATestingRequired          = !string.IsNullOrEmpty(product?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.CPSIATestingRequired)?.FlagValue.ConvertToString()) ? product.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.CPSIATestingRequired).FlagValue.ConvertToString() : "N",
                    };
                    POProductOutput poProductOutput = new POProductOutput
                    {
                        ClassCode      = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Class,
                        DepartmentName = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Department,
                        ClassName      = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Description,
                        ClassShortDesc = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.ShortDesc,
                        DepartmentCode = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Department,

                        HTSCode            = product.HTSCode,
                        Country            = product.ProductVendors?.Find(y => y.Sku == product.Sku)?.CountryOfOrigin,
                        MasterPackQuantity = !string.IsNullOrEmpty(product.ProductVendors?.Find(y => y.Sku == product.Sku)?.MasterPackQuantity) ? product.ProductVendors?.Find(y => y.Sku == product.Sku)?.MasterPackQuantity : "0",
                        SkuDesc            = product.SkuDesc,
                        SKU = product.Sku,
                        //Product Flags
                        ProductFlagsOutput = productFlagsOutput
                    };
                    POIntertekSKUOutput POSkusOutput = new POIntertekSKUOutput
                    {
                        PONumber            = posku.PONumber.ToString(),
                        BuyQuantity         = posku.BuyQuantity.HasValue? posku.BuyQuantity.Value.ToString():"0",
                        CreateDate          = posku.CreateDate.Value.Date.ToString("yyyyMMdd"),
                        DutyCost            = posku.DutyCost.HasValue ? Math.Round(posku.DutyCost.GetValueOrDefault(), 2).ToString() :"0",
                        FirstCost           = posku.FirstCost.HasValue ? Math.Round(posku.FirstCost.GetValueOrDefault(), 2).ToString() : "0",
                        SKU                 = posku.SKU,
                        DutyPctOfFOB        = posku.DutyPctOfFOB.HasValue? Math.Round(posku.DutyPctOfFOB.GetValueOrDefault(), 2).ToString():"0",
                        EstimatedLandedCost = posku.EstimatedLandedCost.HasValue ? Math.Round(posku.EstimatedLandedCost.GetValueOrDefault(), 2).ToString() : "0",
                        MasterPackCubicFeet = posku.MasterPackCubicFeet.HasValue? Math.Round(posku.MasterPackCubicFeet.GetValueOrDefault(), 2).ToString():"0",
                        PrepackId           = posku.PrepackId,
                        ApprovalLetter      = posku.ApprovalLetter.HasValue ? (posku.ApprovalLetter.Value == true ? "Y" : "N") : "N",
                        StatusCode          = posku.StatusCode,
                        POProduct           = poProductOutput,
                    };

                    if (poobject.POSkus == null)
                    {
                        poobject.POSkus = new System.Collections.Generic.List <POIntertekSKUOutput>();
                    }
                    poobject.POSkus.Add(POSkusOutput);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "UpdatePOObject - Failed Updating IntertekPO: {Reason}", ex.Message);
            }
        }
コード例 #2
0
        public async void UpdatePOObject(POAPLLOutput poobject, MMSProductEvent product, POSkus posku)
        {
            try
            {
                var prodhierarchy = _lookUpService.GetProductHierarchy(product.SubClass).Result;

                //check if exists
                if (poobject.POSkus != null && poobject.POSkus.Count > 0 && poobject.POSkus.Exists(y => y.POProduct.Sku == posku.SKU))
                {
                    var poskutobeupdated = poobject.POSkus.Find(y => y.POProduct.Sku == posku.SKU);

                    poskutobeupdated.POProduct.CountryOfOrigin = product.ProductVendors.Find(y => y.Sku == product.Sku && y.SubVendor == poobject.SubVendorNumber)?.CountryOfOrigin;
                    poskutobeupdated.POProduct.CasePackQty     = product.ProductVendors.Find(y => y.Sku == product.Sku && y.SubVendor == poobject.SubVendorNumber)?.MasterPackQuantity.ToString();
                    poskutobeupdated.POProduct.VendorName      = product.ProductVendors.Find(y => y.Sku == product.Sku && y.SubVendor == poobject.SubVendorNumber)?.SubVendor;

                    poskutobeupdated.POProduct.ClassCode      = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Class;
                    poskutobeupdated.POProduct.DepartmentName = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Description;
                    poskutobeupdated.POProduct.ClassName      = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Description;
                    poskutobeupdated.POProduct.DepartmentCode = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Department;

                    poskutobeupdated.POProduct.ItemDescription = product?.SkuDesc;
                    poskutobeupdated.POProduct.TariffCode      = product?.HTSCode;
                    // poskutobeupdated.ActivityCode = "U";
                }
                else
                {
                    POProductOutput poProductOutput = new POProductOutput
                    {
                        CountryOfOrigin = product.ProductVendors.Find(y => y.Sku == product.Sku && y.SubVendor == poobject.SubVendorNumber)?.CountryOfOrigin,
                        CasePackQty     = product.ProductVendors.Find(y => y.Sku == product.Sku && y.SubVendor == poobject.SubVendorNumber)?.MasterPackQuantity.ToString(),
                        VendorName      = product.ProductVendors.Find(y => y.Sku == product.Sku && y.SubVendor == poobject.SubVendorNumber)?.SubVendor,

                        ClassCode      = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Class,
                        DepartmentName = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Description,
                        ClassName      = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Description,
                        DepartmentCode = prodhierarchy.Find(y => y.SubClass == product.SubClass)?.Department,

                        ItemDescription = product?.SkuDesc,

                        TariffCode = product?.HTSCode,
                    };
                    POSkusOutput POSkusOutput = new POSkusOutput
                    {
                        PONumber          = posku.PONumber.ToString(),
                        ItemNumber        = posku.SKU,
                        ItemQty           = posku.BuyQuantity.HasValue ? posku.BuyQuantity.ToString() : "0",
                        ItemTotalQuantity = posku.BuyQuantity.HasValue ? posku.BuyQuantity.ToString() : "0",
                        UnitCost          = Math.Round(posku.FirstCost.GetValueOrDefault(), 2).ToString(),
                        POProduct         = poProductOutput,
                        //ActivityCode = "A",
                    };
                    if (poobject.POSkus == null)
                    {
                        poobject.POSkus = new System.Collections.Generic.List <POSkusOutput>();
                    }
                    poobject.POSkus.Add(POSkusOutput);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "UpdatePOObject - Failed Updating APLPO: {Reason}", ex.Message);
            }
        }
コード例 #3
0
        public async Task <POContempoOutput> UpdatePOObject(POContempoOutput poobject, MMSProductEvent product, POSkus posku)
        {
            try
            {
                var prodhierarchy = await _lookUpService.GetProductHierarchy(product.SubClass);

                var productlabelcode = await _lookUpService.GetProductLabelDescription(product.LabelType);

                //check if exists
                if (poobject.POSkus != null && poobject.POSkus.Count > 0 && poobject.POSkus.Exists(y => y.SKU == posku.SKU) &&
                    (product?.Department == "JEP" || product?.Department == "JSF") && product?.SubClass != "JOSAC")
                {
                    var poskutobeupdated = poobject.POSkus.Find(y => y.SKU == posku.SKU);
                    poskutobeupdated.POProduct.Class           = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Class;
                    poskutobeupdated.POProduct.CountryOfOrigin = product?.ProductVendors?.Find(y => y.Sku == product.Sku && y.SubVendor == poobject.SubVendor)?.CountryOfOrigin;
                    poskutobeupdated.POProduct.SubClass        = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.SubClass;
                    poskutobeupdated.POProduct.APVendor        = posku.POProduct?.APVendor;
                    poskutobeupdated.POProduct.VendorSKUCode   = product?.ProductVendors?.Find(y => y.Sku == product.Sku && y.SubVendor == poobject.SubVendor)?.VendorSkuCode;
                    poskutobeupdated.POProduct.ClassLevelDesc  = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Description;
                    poskutobeupdated.POProduct.Size            = posku.POProduct?.Size;
                    poskutobeupdated.POProduct.LabelType       = product?.LabelType;
                    //TODO
                    //This LabelDescription value should be populated from "MMSProductEvent" ProductVendors objects labeldescription
                    //For now, it is coming from database so that we know the value is populating.
                    poskutobeupdated.POProduct.LabelDescription  = productlabelcode?.Description;
                    poskutobeupdated.POProduct.SkuDesc           = product?.SkuDescShrt;
                    poskutobeupdated.POProduct.SubClassLevelDesc = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.SubclassDescription;
                    poskutobeupdated.POProduct.RetailPrice       = posku.GetRetailPrice();
                    //Update CreateDate value once it is available in POSkus object
                    poskutobeupdated.CreateDate   = posku.CreateDate != null ? posku.CreateDate.Value : new DateTime?();
                    poskutobeupdated.ModifiedDate = posku.ModifiedDate != null ? posku.ModifiedDate.Value : new DateTime?();
                }
                else
                {
                    if ((product?.Department == "JEP" || product?.Department == "JSF") && product?.SubClass != "JOSAC")
                    {
                        POContempoProductOutput poProductOutput = new POContempoProductOutput
                        {
                            LabelType = product?.LabelType,
                            //TODO - need to figure out how we're getting these from MMS
                            //This LabelDescription value should be populated from "MMSProductEvent" ProductVendors objects labeldescription
                            //For now, it is coming from database so that we know the value is populating.
                            LabelDescription  = productlabelcode?.Description,
                            Class             = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Class,
                            CountryOfOrigin   = posku.POProduct?.CountryOfOrigin,
                            SubClass          = prodhierarchy.Find(y => y.SubClass == product?.SubClass)?.SubClass,
                            APVendor          = posku.POProduct?.APVendor,
                            VendorSKUCode     = product?.ProductVendors?.Find(y => y.Sku == product?.Sku && y.SubVendor == poobject.SubVendor)?.VendorSkuCode,
                            ClassLevelDesc    = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Description,
                            Size              = posku.POProduct?.Size,
                            SkuDesc           = product?.SkuDescShrt,
                            SubClassLevelDesc = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.SubclassDescription,
                            RetailPrice       = posku.GetRetailPrice()
                        };
                        POContempoSkuOutput POSkusOutput = new POContempoSkuOutput
                        {
                            SKU        = posku.SKU,
                            BuyQuanity = posku.BuyQuantity != null?Convert.ToInt32(posku.BuyQuantity) : 0,
                                             POProduct = poProductOutput,
                                             //Update CreateDate value once it is available in POSkus object
                                             CreateDate   = posku.CreateDate != null ? posku.CreateDate.Value : new DateTime?(),
                                             ModifiedDate = posku.ModifiedDate != null ? posku.ModifiedDate.Value : new DateTime?(),
                                             StatusCode   = posku.StatusCode,
                        };

                        if (poobject.POSkus == null)
                        {
                            poobject.POSkus = new System.Collections.Generic.List <POContempoSkuOutput>();
                        }
                        poobject.POSkus.Add(POSkusOutput);
                    }
                }
                return(poobject);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "UpdatePOObject - Failed Updating ContempoPO: {Reason}", ex.Message);
                return(null);
            }
        }
コード例 #4
0
        public async Task <POFineLineOutput> UpdatePOObject(POFineLineOutput poobject, MMSProductEvent product, POSkus posku)
        {
            try
            {
                var prodhierarchy = await _lookUpService.GetProductHierarchy(product.SubClass);

                var productlabel = await _lookUpService.GetProductLabelDescription(product.LabelType);

                //check if exists
                if (poobject.POSkus != null && poobject.POSkus.Count > 0 && poobject.POSkus.Exists(y => y.SKUNumber == posku.SKU))
                {
                    var poskutobeupdated = poobject.POSkus.Find(y => y.SKUNumber == posku.SKU);
                    poskutobeupdated.POProduct.SKUDescription    = product?.SkuDescShrt;
                    poskutobeupdated.POProduct.SubClassID        = product?.SubClass;
                    poskutobeupdated.POProduct.TicketType        = productlabel?.Code;
                    poskutobeupdated.POProduct.TicketDescription = productlabel?.Description;
                    poskutobeupdated.POProduct.VendorNumber      = posku.POProduct?.APVendor;
                    poskutobeupdated.POProduct.Size                = product?.Size;
                    poskutobeupdated.POProduct.ISOCountryCode      = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.CountryOfOrigin;
                    poskutobeupdated.POProduct.ClassID             = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Class;
                    poskutobeupdated.POProduct.ClassDescription    = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Description;
                    poskutobeupdated.POProduct.VendorStyleNumber   = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.VendorSkuCode;
                    poskutobeupdated.POProduct.SubClassDescription = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.SubclassDescription;
                    poskutobeupdated.POProduct.SubVendorNumber     = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.SubVendor;
                    poskutobeupdated.POProduct.TicketRetail        = posku.GetRetailPrice();
                    return(poobject);
                }
                else
                {
                    POFineLineProductOutput poFLProductOutput = new POFineLineProductOutput
                    {
                        VendorNumber        = posku.POProduct?.APVendor,
                        SubVendorNumber     = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.SubVendor,
                        SKUDescription      = product?.SkuDescShrt,
                        VendorStyleNumber   = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.VendorSkuCode,
                        TicketType          = productlabel?.Code,
                        TicketDescription   = productlabel?.Description,
                        ClassID             = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Class,
                        ClassDescription    = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Description,
                        SubClassID          = product?.SubClass,
                        SubClassDescription = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.SubclassDescription,
                        Size           = product?.Size,
                        ISOCountryCode = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.CountryOfOrigin,
                        TicketRetail   = posku.GetRetailPrice()
                    };
                    POFineLineSkuOutput POFLSkusOutput = new POFineLineSkuOutput
                    {
                        SKUNumber               = posku.SKU,
                        PurchaseOrderDate       = posku.CreateDate != null ? posku.CreateDate.Value : new DateTime?(),
                        PurchaseOrderReviseDate = posku.ModifiedDate != null ? posku.ModifiedDate.Value : new DateTime?(),
                        OrderQuantity           = posku.BuyQuantity != null?Convert.ToInt32(posku.BuyQuantity) : 0,
                        POProduct               = poFLProductOutput,
                        StatusCode              = posku.StatusCode,
                    };

                    if (poobject.POSkus == null)
                    {
                        poobject.POSkus = new System.Collections.Generic.List <POFineLineSkuOutput>();
                    }
                    poobject.POSkus.Add(POFLSkusOutput);
                    return(poobject);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "UpdatePOObject - Failed Updating FineLinePO: {Reason} -- {PONumber} -- {Sku }", ex.Message, poobject.PurchaseOrder, posku.SKU);
                return(null);
            }
        }