public ActionResult OutItemEditDB(WarehouseOutItem model)
 {
     if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证
         return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" });
     if (model.Quantity == 0m)
     {
         return Error("数量必须大于0", Url.Action("StockOutEdit", new { outID = model.OutID }));
     }
     WarehouseOutItem temp;
     temp = (from o in dbEntity.WarehouseOutItems
             where o.Gid == model.Gid
                 && !o.Deleted
             select o).SingleOrDefault();
     if (temp == null)
     {
         return Error("记录不存在", Url.Action("StockOutEdit", new { outID = model.OutID }));
     }
     temp.TrackLot = model.TrackLot;
     temp.Quantity = model.Quantity;
     temp.ShelfID = model.ShelfID;
     dbEntity.SaveChanges();
     WarehouseStockOut stockOut = (from s in dbEntity.WarehouseStockOuts.Include("StockOutItems")
                                   where s.Gid == temp.OutID
                                    && !s.Deleted
                                   select s).Single();
     stockOut.Total = stockOut.StockOutItems.Select(item => item.Quantity).Sum();
     dbEntity.SaveChanges();
     whBll = new WarehouseBLL(dbEntity);
     whBll.InventoryByWarehouseSku(stockOut.WhID, model.SkuID);
     return RedirectToAction("StockOutEdit", new { temp.OutID });
 }
 public StockOutSku(WarehouseOutItem oOutItem, OrderItem oOderItem)
 {
     this.oOutItem = oOutItem;
     this.oOderItem = oOderItem;
 }
        /// <summary>
        /// 出库记录明细添加
        /// </summary>
        /// <param name="outID">要添加书库记录明细的出库单GUID</param>
        /// <returns>出库记录明细添加页面</returns>
        public ActionResult OutItemAdd(Guid outID)
        {
            if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证
                return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" });
            WarehouseStockOut stockOut = dbEntity.WarehouseStockOuts.Find(outID);
            if (stockOut == null || stockOut.Deleted) 
            {
                return Error("记录不存在", Url.Action("StockOut"));
            }
            WarehouseOutItem model = new WarehouseOutItem
            {
                OutID = outID,
                StockOut = stockOut
            };
            #region 货架下拉框数据
            var shelves = (from shelf in dbEntity.WarehouseShelves
                           where shelf.WhID == stockOut.WhID
                              && shelf.Deleted == false
                           select new { Code = shelf.Code, Gid = shelf.Gid }).ToList();
            List<SelectListItem> list = (from shelf in shelves
                                         select new SelectListItem
                                         {
                                             Text = shelf.Code,
                                             Value = shelf.Gid.ToString()
                                         }).ToList();
            ViewBag.Shelf = list;

            #endregion 货架下拉框数据
            return View(model);
        }