/// <summary> /// 新建商品的时候需要初始化库存, /// 但是有的商品是以前建立的,目前商品转换的时候计算成本也需要初始化库存。 /// </summary> /// <param name="productSysNo"></param> private static void InitInventory(int productSysNo) { int n = SecKillDA.CountInventoryByProductSysNo(productSysNo); if (n <= 0) { SecKillDA.InitInventory(productSysNo); } List <InventoryEntity> inventorylist = new List <InventoryEntity>(); inventorylist = SecKillDA.GetInventorySysNoList(productSysNo); if (inventorylist != null && inventorylist.Count > 0) { foreach (InventoryEntity inventory in inventorylist) { SecKillDA.InitInventoryStock(productSysNo, inventory.InventorySysNo); } } }