Example #1
0
 public RedirectToRouteResult MoveItemAddDB(WarehouseMoveItem model)
 {
     if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证
         return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" });
     WarehouseMoveItem item = new WarehouseMoveItem
     {
         SkuID = model.SkuID,
         OldShelf = model.OldShelf,
         NewShelf = model.NewShelf,
         Quantity = model.Quantity,
         TrackLot = model.TrackLot,
         MoveID = model.MoveID
     };
     ///移货位数量不能大于移库单总数量判断
     //////
     /////
     dbEntity.WarehouseMoveItems.Add(item);
     dbEntity.SaveChanges();
     WarehouseMoving moving = (from s in dbEntity.WarehouseMovings.Include("MoveItems")
                                   where s.Gid == item.MoveID
                                    && !s.Deleted
                                   select s).Single();
     moving.Total = moving.MoveItems.Select(i => i.Quantity).Sum();
     dbEntity.SaveChanges();
     whBll = new WarehouseBLL(dbEntity);
     whBll.InventoryByWarehouseSku(moving.OldWhID, item.SkuID);
     whBll.InventoryByWarehouseSku(moving.NewWhID, item.SkuID);
     return RedirectToAction("MovingEdit", new { moveID = model.MoveID });
 }
Example #2
0
 public ActionResult MoveItemEditDB(WarehouseMoveItem model)
 {
     if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证
         return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" });
     WarehouseMoveItem item = dbEntity.WarehouseMoveItems.Include("Moving").SingleOrDefault(i => i.Gid == model.Gid);
     if (item == null || item.Deleted)
     {
         return Error("记录不存在", Url.Action("MovingEdit", new { moveID = model.MoveID }));
     }
     if (item.Moving.Mstatus == (byte)ModelEnum.MovingStatus.CONFIRMED)
     {
         return Error("已确认,不能编辑", Url.Action("MovingEdit", new { moveID = item.MoveID }));
     }
     item.SkuID = model.SkuID;
     item.OldShelf = model.OldShelf;
     item.NewShelf = model.NewShelf;
     item.Quantity = model.Quantity;
     item.TrackLot = model.TrackLot;
     dbEntity.SaveChanges();
     WarehouseMoving moving = (from s in dbEntity.WarehouseMovings.Include("MoveItems")
                               where s.Gid == item.MoveID
                                && !s.Deleted
                               select s).Single();
     moving.Total = moving.MoveItems.Select(i => i.Quantity).Sum();
     dbEntity.SaveChanges();
     whBll = new WarehouseBLL(dbEntity);
     whBll.InventoryByWarehouseSku(moving.OldWhID, item.SkuID);
     whBll.InventoryByWarehouseSku(moving.NewWhID, item.SkuID);
     return RedirectToAction("MovingEdit", new { moveID = item.MoveID });
 }
Example #3
0
        /// <summary>
        /// 添加移库明细
        /// </summary>
        /// <param name="moveID">移库单Id</param>
        /// <returns></returns>
        public ActionResult MoveItemAdd(Guid moveID)
        {
            if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证
                return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" });
            WarehouseMoving mov = dbEntity.WarehouseMovings.Find(moveID);
            if (mov == null || mov.Deleted)
            {
                return Error("记录不存在", Url.Action("Moving"));
            }
            else
            {
                List<WarehouseShelf> oldShelves = mov.OldWarehouse.Shelves.ToList();
                List<WarehouseShelf> newShelves = mov.NewWarehouse.Shelves.ToList();
                WarehouseMoveItem model = new WarehouseMoveItem
                {
                    OldShelf = oldShelves.First().Gid,
                    NewShelf = newShelves.First().Gid,
                    MoveID = moveID,
                    Moving = mov,
                    Quantity = 1
                };
                #region 旧仓库下拉框
                List<SelectListItem> ddlOldShelves = (from shelf in oldShelves
                                                      select new SelectListItem
                                                      {
                                                          Text = shelf.Name,
                                                          Value = shelf.Gid.ToString()
                                                      }).ToList();
                ViewBag.OldShelves = ddlOldShelves;

                #endregion 旧仓库下拉框
                #region 新仓库下拉框
                List<SelectListItem> ddlNewShelves = (from shelf in newShelves
                                                      select new SelectListItem
                                                      {
                                                          Text = shelf.Name,
                                                          Value = shelf.Gid.ToString()
                                                      }).ToList();
                ViewBag.NewShelves = ddlNewShelves;

                #endregion 新仓库下拉框
                return View(model);
            }
        }