예제 #1
0
 public void UpdateBrandRelByPricingType()
 {
     if (AllQuotaBrandRelList.Count > 0)
     {
         var list = AllQuotaBrandRelList.Where(brandRel => !brandRel.IsDeleted).ToList();
         foreach (QuotaBrandRel brandRel in list)
         {
             AllQuotaBrandRelList.Remove(brandRel);
             if (brandRel.Id > 0)
             {
                 var newBrandRel = new QuotaBrandRel
                 {
                     Id = brandRel.Id,
                     BrandId = brandRel.BrandId,
                     SpecificationId = brandRel.SpecificationId,
                     Quantity = brandRel.Quantity,
                     Price = brandRel.Price,
                     WarehouseId = brandRel.WarehouseId,
                     IsDeleted = true
                 };
                 AllQuotaBrandRelList.Add(newBrandRel);
             }
             else
             {
                 AddQuotaBrandRelList.Remove(brandRel);
             }
         }
     }
 }
예제 #2
0
 public void DeleteQuotaBrandRel(int quotaBrandRelID)
 {
     if (AllQuotaBrandRelList.Count > 0)
     {
         List<QuotaBrandRel> quotaBrandRelList = AllQuotaBrandRelList.Where(c => c.Id == quotaBrandRelID).ToList();
         if (quotaBrandRelList.Count > 0)
         {
             QuotaBrandRel brandRel = quotaBrandRelList[0];
             AllQuotaBrandRelList.Remove(brandRel);
             if (quotaBrandRelID > 0)
             {
                 var newBrandRel = new QuotaBrandRel
                 {
                     Id = brandRel.Id,
                     BrandId = brandRel.BrandId,
                     SpecificationId = brandRel.SpecificationId,
                     Quantity = brandRel.Quantity,
                     Price = brandRel.Price,
                     WarehouseId = brandRel.WarehouseId,
                     IsDeleted = true
                 };
                 AllQuotaBrandRelList.Add(newBrandRel);
             }
             else
             {
                 AddQuotaBrandRelList.Remove(brandRel);
             }
         }
     }
 }
예제 #3
0
        /// <summary>
        /// 获取批次的信息
        /// </summary>
        /// <returns></returns>
        private Quota GetSaveQuota()
        {
            if (SelectPaymentMeanId.HasValue && SelectPaymentMeanId.Value == 0)
            {
                SelectPaymentMeanId = null;
            }
            var quota = new Quota
                            {
                                Quantity = Quantity,
                                ApproveStatus = ApproveStatus,
                                FinanceStatus = FinanceStatus == 1,
                                DeliveryStatus = DeliveryStatus == 1,
                                ImplementedDate = SignDate,
                                CommodityId = CommodityId ?? 0,
                                CommodityTypeId = CommodityTypeId ?? 0,
                                BrandId = BrandId ?? 0,
                                SpecificationId = SpecificationId ?? 0,
                                PricingType = SelectPricingType,
                                PricingStartDate = PricingStartDate,
                                PricingEndDate = PricingEndDate,
                                PricingSide = PricingSide ?? 0,
                                Premium = Premium,
                                Price = Price ?? 0,
                                PricingCurrencyId = SelectPricingCurrencyId,
                                WarehouseId = WarehouseId,
                                DeliveryDate = DeliveryDate,
                                ShipTerm = ShipTerm,
                                ExQuotaNo = ExQuotaNo,
                                VATInvoiceDate = VATInvoiceDate,
                                PaymentMeanId = SelectPaymentMeanId,
                                AutoQuotaNo = AutoContractNo//短单的对手批次号默认等于短单的对手合同号
                            };
            if (SelectPricingBasis != 0)
            {
                quota.PricingBasis = SelectPricingBasis;
            }
            quota.SettlementRate = SelectPricingType == (int)PricingType.Fixed ? SettlementRate : null;
            //多品牌
            quota.QuotaBrandRels.Clear();
            foreach (QuotaBrandRel brandRel in AllQuotaBrandRelList)
            {
                var newBrandRel = new QuotaBrandRel
                {
                    BrandId = brandRel.BrandId,
                    Id = brandRel.Id,
                    SpecificationId = (brandRel.SpecificationId == null || brandRel.SpecificationId.Value <= 0) ? null : brandRel.SpecificationId,
                    IsDeleted = brandRel.IsDeleted,
                    Quantity = brandRel.Quantity,
                    Price = brandRel.Price,
                    WarehouseId = brandRel.WarehouseId
                };
                quota.QuotaBrandRels.Add(newBrandRel);
            }

            return quota;
        }