public override void LoadCurrentProductInventoryInfo() { //Init Inventory if NOT EXISTED InitProductInventory(); this.StockInventoryCurrentInfo = _productInventoryDA.GetProductInventoryInfoByStock(this.CurrentAdjustItemInfo.ProductSysNo, SourceStockSysNo); this.TargetStockInventoryCurrentInfo = _productInventoryDA.GetProductInventoryInfoByStock(this.CurrentAdjustItemInfo.ProductSysNo, TargetStockSysNo); this.TotalInventoryCurrentInfo = _productInventoryDA.GetProductTotalInventoryInfo(this.CurrentAdjustItemInfo.ProductSysNo); this.StockInventoryAdjustInfo = new ProductInventoryInfo() { ProductSysNo = this.CurrentAdjustItemInfo.ProductSysNo, StockSysNo = SourceStockSysNo }; this.TotalInventoryAdjustInfo = new ProductInventoryInfo() { ProductSysNo = this.CurrentAdjustItemInfo.ProductSysNo }; this.TargetStockInventoryAdjustInfo = new ProductInventoryInfo() { ProductSysNo = this.CurrentAdjustItemInfo.ProductSysNo, StockSysNo = TargetStockSysNo }; ProcessOriginAdjustQuantity(); }
/// <summary> /// 更新商品渠道总仓各项库存数量(复写更新) /// </summary> /// <param name="inventoryInfo"></param> /// <returns></returns> public virtual void UpdateProductTotalInventoryInfo(ProductInventoryInfo inventoryInfo) { DataCommand cmd = DataCommandManager.GetDataCommand("Inventory_UpdateProductTotalInventory"); cmd.SetParameterValue <ProductInventoryInfo>(inventoryInfo); cmd.ExecuteNonQuery(); }
/// <summary> /// 更新商品渠道仓库各项库存数量(增量更新) /// </summary> /// <param name="inventoryInfo"></param> /// <returns></returns> public virtual void AdjustProductStockInventoryInfo(ProductInventoryInfo inventoryInfo) { DataCommand cmd = DataCommandManager.GetDataCommand("Inventory_AdjustProductInventoryByStock"); cmd.SetParameterValue <ProductInventoryInfo>(inventoryInfo); cmd.ExecuteNonQuery(); }
/// <summary> /// 更新商品渠道仓库各项库存数量(增量更新) /// </summary> /// <param name="inventoryInfo"></param> /// <returns></returns> public static void AdjustProductTotalInventoryInfo(ProductInventoryInfo inventoryInfo) { DataCommand cmd = DataCommandManager.GetDataCommand("Inventory_AdjustProductTotalInventory"); cmd.SetParameterValue <ProductInventoryInfo>(inventoryInfo); cmd.ExecuteNonQuery(); }
public static ProductInventoryInfo GetProductInventoryByProductSysNO(int productSysNo) { DataCommand command = DataCommandManager.GetDataCommand("GetProductInventoryByProductSysNO"); command.SetParameterValue("@ItemSysNumber", productSysNo); ProductInventoryInfo inventoryInfo = command.ExecuteEntity <ProductInventoryInfo>(); return(inventoryInfo); }
/// <summary> /// 设置商品分仓库预留库存 /// </summary> /// <param name="ProductID">商品编号</param> /// <param name="StockSysNo">渠道仓库编号</param> /// <param name="ReservedQty">预留库存</param> /// <returns></returns> public virtual void AdjustProductReservedQty(int productSysNo, int stockSysNo, int reservedQty) { //TODO: Call AdjustProductInventoryInfo MKT_CountDown/SetReservedQty ProductInventoryInfo inventoryAdjustInfo = new ProductInventoryInfo() { ProductSysNo = productSysNo, StockSysNo = stockSysNo, ReservedQty = reservedQty, AvailableQty = -reservedQty }; AdjustProductInventoryInfo(inventoryAdjustInfo); }
public override void PreCheckProductInventoryInfo() { SetCheckAvailableQtyGreaterThanZeroFlag(); ProductInventoryInfo stockInventoryAfterAdjust = PreCalculateInventoryAfterAdjust(this.StockInventoryCurrentInfo, this.StockInventoryAdjustInfo); ProductInventoryInfo targetStockInventoryAfterAdjust = PreCalculateInventoryAfterAdjust(this.TargetStockInventoryCurrentInfo, this.TargetStockInventoryAdjustInfo); ProductInventoryInfo totalInventoryAfterAdjust = PreCalculateInventoryAfterAdjust(this.TotalInventoryCurrentInfo, this.TotalInventoryAdjustInfo); this.PreCheckGeneralRules(stockInventoryAfterAdjust); this.PreCheckGeneralRules(targetStockInventoryAfterAdjust); this.PreCheckGeneralRules(totalInventoryAfterAdjust); this.PreCheckSpecialRules(); }
/// <summary> /// Provides the view with data regarding a location's inventory of a specific product /// as well as a list of other location's inventory that have the product. /// </summary> /// <param name="id">Id of the product</param> /// <param name="locationId">Location's specific id</param> /// <returns> /// A view with data on a location's product and several other location's invenories /// with this product. /// </returns> public async Task <IActionResult> ShowProduct(int?id, int?locationId) { if (id == null || locationId == null) { return(NotFound()); } ProductInventoryInfo pII = await productRepo.GetProductInventoryInfo(id ?? -1, locationId ?? -1); if (pII == null) { return(NotFound()); } return(View(pII)); }
public virtual List <ProductInventoryInfo> GetWarehouseProducts(ProcessType processType, int productSysNo, string shippedWarehouse) { //(1)业务模式2,3,5,6 直接取 reg.ShipedWarehouse (2)业务模式1 取 配置] int realStockSysNo = Convert.ToInt32(AppSettingManager.GetSetting("RMA", "StockSysNo")); if (processType == ProcessType.MET) { realStockSysNo = Convert.ToInt32(shippedWarehouse); } List <ProductInventoryInfo> result = new List <ProductInventoryInfo>(); ProductInventoryInfo item = ExternalDomainBroker.GetProductInventoryInfo(productSysNo, realStockSysNo); if (item != null) { result.Add(item); } return(result); }
public virtual MKTProductDetailMsg LoadMKTProductDetail(string sysNo) { int id = Convert.ToInt32(sysNo); MKTProductDetailMsg msg = new MKTProductDetailMsg(); ProductInfo product = ObjectFactory <CountdownAppService> .Instance.GetProductInfo(id); ProductInventoryInfo inventory = ObjectFactory <CountdownAppService> .Instance.GetProductTotalInventoryInfo(id); DateTime?lastPoDate = ObjectFactory <CountdownAppService> .Instance.GetLastPoDate(id); ProductSalesTrendInfo salesTrendInfo = ObjectFactory <CountdownAppService> .Instance.GetProductTotalSalesTrendInfo(id); decimal grossMarginRate = ObjectFactory <CountdownAppService> .Instance.GetProductCurrentMarginRate(product); if (product != null) { msg.ProductSysNo = product.SysNo; msg.ProductName = product.ProductName; msg.UnitCost = product.ProductPriceInfo.UnitCost; msg.Price = product.ProductPriceInfo.CurrentPrice; msg.Point = product.ProductPriceInfo.Point; } if (inventory != null) { msg.AvailableQty = inventory.AvailableQty + inventory.VirtualQty + inventory.ConsignQty;//q4s msg.AccountQty = inventory.AccountQty; msg.ReservedQty = inventory.ReservedQty; msg.CurrentReservedQty = 0; msg.GrossMarginRate = grossMarginRate; msg.JDPrice = 0.00m; } if (salesTrendInfo != null) { msg.W1 = salesTrendInfo.W1.Value; msg.W2 = salesTrendInfo.W2.Value; msg.W3 = salesTrendInfo.W3.Value; msg.W4 = salesTrendInfo.W4.Value; msg.M1 = salesTrendInfo.M1.Value; msg.M2 = salesTrendInfo.M2.Value; msg.M3 = salesTrendInfo.M3.Value; } msg.LastPurchaseDate = lastPoDate; return(msg); }
/// <summary> /// 根据商品编号获取所有SKU库存 by lijibo /// </summary> /// <param name="productNos"></param> /// <param name="NoSize"></param> /// <returns></returns> public Dictionary <string, int> GetProductsInventoryNew(string productNos) { var reslut = new Dictionary <string, int>(); string[] productNoArray = productNos.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var q = GetWfsSkuCollectionByProductNosNew(productNoArray);// DapperUtil.Query<WfsSku>("ComBeziWfs_WfsSku_SelectByProductNos", new { ProductNos = productNoArray }).ToList(); var lst = new List <ProductInventoryInfo>(); foreach (var wfsSku in q) { var product = new ProductInventoryInfo(); product.SkuNo = wfsSku.SkuNo; product.ProductNo = wfsSku.ProductNo; lst.Add(product); } var skus = lst.Select( p => new SkuDto { SkuNo = p.SkuNo, SkuType = p.SkuType, StockFlag = StockFlag.Normal, ProductNo = p.ProductNo }). ToList(); StockWebService.StockWebService stock = new StockWebService.StockWebService(); var inv = GetSkuInventoryQuantity(skus); // 按商品编号进行分组 var q2 = from p in inv group p by p.ProductNo into g select g; foreach (var gg in q2) { var productNo = gg.Select(x => x.ProductNo).FirstOrDefault(); var inventory = gg.Sum(x => x.Quantity); if (productNo != null) { reslut.Add(productNo, inventory); } } return(reslut); }
public virtual ProductInventoryInfo PreCalculateInventoryAfterAdjust(ProductInventoryInfo currentInfo, ProductInventoryInfo adjustInfo) { return(new ProductInventoryInfo() { AllocatedQty = currentInfo.AllocatedQty + adjustInfo.AllocatedQty, AccountQty = currentInfo.AccountQty + adjustInfo.AccountQty, AvailableQty = currentInfo.AvailableQty + adjustInfo.AvailableQty, ConsignQty = currentInfo.ConsignQty + adjustInfo.ConsignQty, VirtualQty = currentInfo.VirtualQty + adjustInfo.VirtualQty, OrderQty = currentInfo.OrderQty + adjustInfo.OrderQty, PurchaseQty = currentInfo.PurchaseQty + adjustInfo.PurchaseQty, ReservedQty = currentInfo.ReservedQty + adjustInfo.ReservedQty, ShiftQty = currentInfo.ShiftQty + adjustInfo.ShiftQty, ShiftInQty = currentInfo.ShiftInQty + adjustInfo.ShiftInQty, ShiftOutQty = currentInfo.ShiftOutQty + adjustInfo.ShiftOutQty, ChannelQty = currentInfo.ChannelQty + adjustInfo.ChannelQty, StockInfo = currentInfo.StockInfo != null ? new StockInfo() { SysNo = currentInfo.StockInfo.SysNo } : null }); }
public static bool ObjectsAreEqual(this IEnumerable <ProductInventoryInfo> items, ProductInventoryInfo obj2) { return(items.Any(productInventoryInfo => ObjectsAreEqual <ProductInventoryInfo>(productInventoryInfo, obj2))); }
private void PreCheckGeneralRules(ProductInventoryInfo inventoryInfo, ref bool isNeedCompareAvailableQtyAndAccountQty) { string commError = "不能将可用库存调整为负数,也不能使可卖数量为负数,可卖数量=可用库存+虚拟库存+代销库存."; #region 检查库存量是否小于0 if (invenoryType == (int)ProductInventoryType.Company || invenoryType == (int)ProductInventoryType.GetShopInventory || invenoryType == (int)ProductInventoryType.TwoDoor) { return; } if (inventoryInfo.AccountQty < 0) { throw new BizException("财务库存不能小于0!"); } if (this.CheckAvailableQtyGreaterThanZero && inventoryInfo.AvailableQty < 0) { throw new BizException(commError); } if (inventoryInfo.OrderQty < 0) { throw new BizException("已订购数量不能小于0!"); } if (inventoryInfo.ConsignQty < 0) { throw new BizException(commError); } if (inventoryInfo.AllocatedQty < 0) { throw new BizException("已分配库存不能小于0!"); } #endregion 检查库存量是否小于0 #region 检查相关库存量之间的逻辑规则 if (inventoryInfo.AvailableQty + inventoryInfo.VirtualQty + inventoryInfo.ConsignQty < 0) { throw new BizException(commError); } if (inventoryInfo.StockInfo != null && inventoryInfo.StockInfo.SysNo.HasValue) { //if product is in MKT's Stock, need not run this way //var mktStockList = AppSettingManager.GetSetting("Inventory", "MKTVirtualInventory").Split(',').Select(p => int.Parse(p));泰隆修改,将泰隆自己仓库配置起来 var realStockList = AppSettingManager.GetSetting("Inventory", "RealInventory").Split(',').Select(p => int.Parse(p)); if (!realStockList.Contains(inventoryInfo.StockInfo.SysNo.Value)) { isNeedCompareAvailableQtyAndAccountQty = false; } } if (isNeedCompareAvailableQtyAndAccountQty && inventoryInfo.AvailableQty > inventoryInfo.AccountQty) { throw new BizException("财务库存不能小于可用库存!"); } //@IsDCOrder=0 && Product PromotionType='DC' //if (inventoryInfo.OrderQty < inventoryInfo.ReservedQty) //{ // result.Append("?"); //} #endregion 检查相关库存量之间的逻辑规则 }
public virtual void PreCheckGeneralRules(ProductInventoryInfo inventoryInfo) { bool isNeedCompareAvailableQtyAndAccountQty = true; PreCheckGeneralRules(inventoryInfo, ref isNeedCompareAvailableQtyAndAccountQty); }
/// <summary> /// 获取赠品所有信息 /// </summary> /// <param name="sysNo"></param> /// <returns></returns> public virtual SaleGiftInfo Load(int?sysNo) { SaleGiftInfo info = _processor.Load(sysNo); if (info.ProductCondition != null) { foreach (SaleGift_RuleSetting setting in info.ProductCondition) { if (setting.RelBrand != null && setting.RelBrand.SysNo.HasValue) { var brandName = ExternalDomainBroker.GetBrandInfoBySysNo(setting.RelBrand.SysNo.Value); if (brandName != null && brandName.BrandNameLocal != null) { setting.RelBrand.Name = brandName.BrandNameLocal.Content; } } if (setting.RelC3 != null && setting.RelC3.SysNo.HasValue) { var categoryName = ExternalDomainBroker.GetCategory3Info(setting.RelC3.SysNo.Value); if (categoryName != null && categoryName.CategoryName != null) { setting.RelC3.Name = categoryName.CategoryName.Content; } } if (setting.RelProduct != null && setting.RelProduct.ProductSysNo.HasValue) { ProductInfo product = ExternalDomainBroker.GetProductInfo(setting.RelProduct.ProductSysNo.Value); if (product != null) { setting.RelProduct.ProductName = product.ProductName; setting.RelProduct.ProductID = product.ProductID; //获取商品可用库存,代销库存,毛利率等接口 ProductInventoryInfo inventory = ExternalDomainBroker.GetProductTotalInventoryInfo(product.SysNo); setting.RelProduct.AvailableQty = inventory.AvailableQty; setting.RelProduct.ConsignQty = inventory.ConsignQty; setting.RelProduct.VirtualQty = inventory.VirtualQty; setting.RelProduct.UnitCost = product.ProductPriceInfo.UnitCost; setting.RelProduct.CurrentPrice = product.ProductPriceInfo.CurrentPrice; } } } foreach (SaleGift_RuleSetting setting in info.ProductCondition) { if (setting.RelProduct.ProductSysNo.HasValue) { ProductInfo product = ExternalDomainBroker.GetProductInfo(setting.RelProduct.ProductSysNo.Value); if (product != null) { int minBuyQty = setting.RelProduct.MinQty.HasValue ? (setting.RelProduct.MinQty.Value == 0 ? 1 : setting.RelProduct.MinQty.Value) : 1; setting.RelProduct.GrossMarginRate = ObjectFactory <GrossMarginProcessor> .Instance.GetSaleGift_SaleItemGrossMarginRate(product, minBuyQty, sysNo.Value, info); } } } } if (info.GiftItemList != null) { foreach (RelProductAndQty giftItem in info.GiftItemList) { ProductInfo product = ExternalDomainBroker.GetProductInfo(giftItem.ProductSysNo.Value); if (product == null) { continue; } giftItem.ProductName = product.ProductName;; giftItem.ProductID = product.ProductID; //获取商品可用库存,代销库存,毛利率等接口 ProductInventoryInfo inventory = ExternalDomainBroker.GetProductTotalInventoryInfo(product.SysNo); if (inventory == null) { continue; } giftItem.AvailableQty = inventory.AvailableQty; giftItem.ConsignQty = inventory.ConsignQty; giftItem.VirtualQty = inventory.VirtualQty; giftItem.GrossMarginRate = ObjectFactory <GrossMarginProcessor> .Instance.GetSaleGift_GiftItemGrossMarginRate(product, info.DisCountType.Value); giftItem.UnitCost = product.ProductPriceInfo.UnitCost; giftItem.CurrentPrice = product.ProductPriceInfo.CurrentPrice; } } return(info); }
/// <summary> /// 设置商品分仓库预留库存 /// </summary> /// <param name="ProductID">商品编号</param> /// <param name="StockSysNo">渠道仓库编号</param> /// <param name="ReservedQty">预留库存</param> /// <returns></returns> public virtual void AdjustProductInventoryInfo(ProductInventoryInfo inventoryAdjustInfo) { productInventoryDA.AdjustProductStockInventoryInfo(inventoryAdjustInfo); productInventoryDA.AdjustProductTotalInventoryInfo(inventoryAdjustInfo); }
protected bool Equals(ProductInventoryInfo other) { return(ProductName == other.ProductName); }