示例#1
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");
            }
        }
示例#2
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);
 }
示例#3
0
 public void AddItem(ProductSkuInfo productSkuInfo, decimal quantity, decimal weight, decimal price, string productNumber, Position position, string remark = "", Guid? purchaseOrderItemID = null)
 {
     AddItem(productSkuInfo, quantity, weight, price, productNumber, position.ID, remark, purchaseOrderItemID);
 }
示例#4
0
        public void AddItem(ProductSkuInfo productSkuInfo, decimal quantity, decimal weight, decimal price)
        {
            PurchaseOrderItem newPurchaseOrderItem = new PurchaseOrderItem();
            //newPurchaseOrderItem.ProductID = product.ProductID;
            newPurchaseOrderItem.Quantity = quantity;
            newPurchaseOrderItem.Weight = weight;
            newPurchaseOrderItem.Price = price;
            //newPurchaseOrderItem.PricingMethod = pricingMethod;

            if (productSkuInfo.PricingMethod == PricingMethod.PricingByQuantity)
                newPurchaseOrderItem.Amount = newPurchaseOrderItem.Price * newPurchaseOrderItem.Quantity;
            else
                newPurchaseOrderItem.Amount = newPurchaseOrderItem.Price * newPurchaseOrderItem.Weight;
            //newPurchaseOrderItem.Amount = newPurchaseOrderItem.Price * newPurchaseOrderItem.PricingQuantity;
            newPurchaseOrderItem.PurchaseOrderID = this.ID;
            newPurchaseOrderItem.PurchaseOrder = this;

            newPurchaseOrderItem.ProductSkuInfo = productSkuInfo;

            Items.Add(newPurchaseOrderItem);
            this.TotalQuantity += newPurchaseOrderItem.Quantity;
            this.TotalAmount += newPurchaseOrderItem.Amount;
            this.TotalWeight += newPurchaseOrderItem.Weight;
        }
示例#5
0
 public void UpdateItem(Guid itemID, ProductSkuInfo productSkuInfo, decimal quantity, decimal weight, decimal price)
 {
     PurchaseOrderItem item = this.Items.FirstOrDefault(p => p.ID == itemID);
     if (item != null)
     {
         item.PurchaseOrder = this;
         item.PurchaseOrderID = this.ID;
         //item.ProductID = product.ProductID;
         item.Price = price;
         item.ProductSkuInfo = productSkuInfo;
         this.TotalQuantity += (quantity - item.Quantity);
         item.Quantity = quantity;
         this.TotalWeight += (weight - item.Weight);
         item.Weight = weight;
         if (productSkuInfo.PricingMethod == PricingMethod.PricingByQuantity)
         {
             this.TotalAmount += (quantity * price - item.Amount);
             item.Amount = item.Price * item.Quantity;
         }
         else
         {
             this.TotalAmount += (weight * price - item.Amount);
             item.Amount = item.Price * item.Weight;
         }
     }
     else
     {
         throw new DomainException("无此ID");
     }
 }
示例#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;
     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);
 }