Beispiel #1
0
        public void UpdateItem(Guid itemID, ProductSkuInfo productSkuInfo, decimal quantity, decimal weight, decimal price, string productNumber, Guid positionID, string remark = "", Guid?purchaseOrderItemID = null)
        {
            WarehouseVoucherItem 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.AuxiliaryQuantity = weight;
                item.ProductNumber     = productNumber;
                item.PositionID        = positionID;
                item.Price             = price;
                //item.Amount = price * pricingQuantity;
                item.PurchaseOrderItemID = purchaseOrderItemID;
                item.Amount = price * quantity;
                //RefreshAmount(item);
            }
            else
            {
                throw new DomainException("无此ID");
            }
        }
Beispiel #2
0
        public void RemoveItem(Guid itemID)
        {
            WarehouseVoucherItem item = Items.FirstOrDefault(p => p.ID == itemID);

            if (item == null)
            {
                throw new DomainException("无此ID");
            }
            Items.Remove(item);
        }
Beispiel #3
0
        public void AddItem(ProductSkuInfo productSkuInfo, decimal quantity, decimal auxiliaryQuantity, decimal price, string productNumber, Guid positionID, string remark = "", Guid?purchaseOrderItemID = null)
        {
            if (productNumber == null)
            {
                productNumber = string.Empty;
            }
            if (productNumber != string.Empty)
            {
                if (ProductNumberIsExist(productNumber))
                {
                    throw new DomainException("已存在同样产品编号");
                }
            }
            WarehouseVoucherItem newWarehouseVoucherItem = new WarehouseVoucherItem();

            newWarehouseVoucherItem.WarehouseVoucher   = this;
            newWarehouseVoucherItem.WarehouseVoucherID = this.ID;
            newWarehouseVoucherItem.Remark             = remark;
            newWarehouseVoucherItem.ProductSkuInfo     = ProductSkuInfo.Create(productSkuInfo.SkuID, productSkuInfo.Name, productSkuInfo.PricingMethod);
            newWarehouseVoucherItem.Quantity           = quantity;
            //newWarehouseVoucherItem.UnitID = unitID;
            newWarehouseVoucherItem.AuxiliaryQuantity = auxiliaryQuantity;
            newWarehouseVoucherItem.Price             = price;
            newWarehouseVoucherItem.Amount            = quantity * price;
            //if (productSkuInfo.PricingMethod == PricingMethod.PricingByQuantity)
            //    newWarehouseVoucherItem.Amount = quantity * price;
            //else
            //    newWarehouseVoucherItem.Amount = weight * price;
            //newWarehouseVoucherItem.Amount = pricingQuantity * price;
            newWarehouseVoucherItem.ProductNumber       = productNumber;
            newWarehouseVoucherItem.PositionID          = positionID;
            newWarehouseVoucherItem.PurchaseOrderItemID = purchaseOrderItemID;

            Items.Add(newWarehouseVoucherItem);
            RefreshTotalAmount();
        }
Beispiel #4
0
 private void RefreshAmount(WarehouseVoucherItem 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;
 }
Beispiel #5
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;
     if (productNumber != string.Empty)
         if (ProductNumberIsExist(productNumber))
             throw new DomainException("已存在同样产品编号");
     WarehouseVoucherItem newWarehouseVoucherItem = new WarehouseVoucherItem();
     newWarehouseVoucherItem.WarehouseVoucher = this;
     newWarehouseVoucherItem.WarehouseVoucherID = this.ID;
     newWarehouseVoucherItem.Remark = remark;
     newWarehouseVoucherItem.ProductSkuInfo = productSkuInfo;
     newWarehouseVoucherItem.Quantity = quantity;
     //newWarehouseVoucherItem.UnitID = unitID;
     newWarehouseVoucherItem.Weight = weight;
     newWarehouseVoucherItem.Price = price;
     if (productSkuInfo.PricingMethod == PricingMethod.PricingByQuantity)
         newWarehouseVoucherItem.Amount = quantity * price;
     else
         newWarehouseVoucherItem.Amount = weight * price;
     //newWarehouseVoucherItem.Amount = pricingQuantity * price;
     newWarehouseVoucherItem.ProductNumber = productNumber;
     newWarehouseVoucherItem.PositionID = positionID;
     newWarehouseVoucherItem.PurchaseOrderItemID = purchaseOrderItemID;
     RefreshAmount(newWarehouseVoucherItem);
     Items.Add(newWarehouseVoucherItem);
 }