Ejemplo n.º 1
0
        public void AddItem(ProductSkuInfo productSkuInfo, decimal quantity, decimal weight, decimal price, string productNumber, Guid positionID, string remark = "", Guid?purchaseOrderItemID = null)
        {
            if (productNumber == null)
            {
                productNumber = string.Empty;
            }
            DeliveryVoucherItem newDeliveryVoucherItem = new DeliveryVoucherItem();

            newDeliveryVoucherItem.DeliveryVoucher   = this;
            newDeliveryVoucherItem.DeliveryVoucherID = this.ID;
            newDeliveryVoucherItem.Remark            = remark;
            newDeliveryVoucherItem.ProductSkuInfo    = productSkuInfo;
            newDeliveryVoucherItem.Quantity          = quantity;
            newDeliveryVoucherItem.Weight            = weight;
            newDeliveryVoucherItem.Price             = price;
            if (productSkuInfo.PricingMethod == PricingMethod.PricingByQuantity)
            {
                newDeliveryVoucherItem.Amount = quantity * price;
            }
            else
            {
                newDeliveryVoucherItem.Amount = weight * price;
            }
            newDeliveryVoucherItem.ProductNumber       = productNumber;
            newDeliveryVoucherItem.PositionID          = positionID;
            newDeliveryVoucherItem.PurchaseOrderItemID = purchaseOrderItemID;
            RefreshAmount(newDeliveryVoucherItem);
            Items.Add(newDeliveryVoucherItem);
        }
Ejemplo n.º 2
0
        public void UpdateItem(Guid itemID, ProductSkuInfo productSkuInfo, decimal quantity, decimal weight, decimal price, string productNumber, Guid positionID, string remark = "", Guid?purchaseOrderItemID = null)
        {
            DeliveryVoucherItem item = this.Items.FirstOrDefault(p => p.ID == itemID);

            if (item != null)
            {
                if (productNumber == null)
                {
                    productNumber = string.Empty;
                }
                //item.Product = product;
                item.ProductSkuInfo = productSkuInfo;
                item.Remark         = remark;
                item.Quantity       = quantity;
                item.Weight         = weight;
                item.ProductNumber  = productNumber;
                item.PositionID     = positionID;
                item.Price          = price;
                //item.Amount = price * pricingQuantity;
                item.PurchaseOrderItemID = purchaseOrderItemID;

                RefreshAmount(item);
            }
            else
            {
                throw new DomainException("无此ID");
            }
        }
Ejemplo n.º 3
0
        public void RemoveItem(Guid itemID)
        {
            DeliveryVoucherItem item = Items.FirstOrDefault(p => p.ID == itemID);

            if (item == null)
            {
                throw new DomainException("无此ID");
            }
            Items.Remove(item);
        }
Ejemplo n.º 4
0
 private void RefreshAmount(DeliveryVoucherItem item)
 {
     this.TotalAmount = this.TotalAmount - item.Amount;
     if (item.ProductSkuInfo.PricingMethod == PricingMethod.PricingByQuantity)
     {
         item.Amount = item.Quantity * item.Price;
     }
     else
     {
         item.Amount = item.Weight * item.Price;
     }
     this.TotalAmount = this.TotalAmount + item.Amount;
 }
Ejemplo n.º 5
0
 private void RefreshAmount(DeliveryVoucherItem item)
 {
     this.TotalAmount = this.TotalAmount - item.Amount;
     if (item.ProductSkuInfo.PricingMethod == PricingMethod.PricingByQuantity)
         item.Amount = item.Quantity * item.Price;
     else
         item.Amount = item.Weight * item.Price;
     this.TotalAmount = this.TotalAmount + item.Amount;
 }
Ejemplo n.º 6
0
 public void AddItem(ProductSkuInfo productSkuInfo, decimal quantity, decimal weight, decimal price, string productNumber, Guid positionID, string remark = "", Guid? purchaseOrderItemID = null)
 {
     if (productNumber == null)
         productNumber = string.Empty;
     DeliveryVoucherItem newDeliveryVoucherItem = new DeliveryVoucherItem();
     newDeliveryVoucherItem.DeliveryVoucher = this;
     newDeliveryVoucherItem.DeliveryVoucherID = this.ID;
     newDeliveryVoucherItem.Remark = remark;
     newDeliveryVoucherItem.ProductSkuInfo = productSkuInfo;
     newDeliveryVoucherItem.Quantity = quantity;
     newDeliveryVoucherItem.Weight = weight;
     newDeliveryVoucherItem.Price = price;
     if (productSkuInfo.PricingMethod == PricingMethod.PricingByQuantity)
         newDeliveryVoucherItem.Amount = quantity * price;
     else
         newDeliveryVoucherItem.Amount = weight * price;
     newDeliveryVoucherItem.ProductNumber = productNumber;
     newDeliveryVoucherItem.PositionID = positionID;
     newDeliveryVoucherItem.PurchaseOrderItemID = purchaseOrderItemID;
     RefreshAmount(newDeliveryVoucherItem);
     Items.Add(newDeliveryVoucherItem);
 }