public string GetMovingTypeName(byte type) { List<ListItem> mTypeList = new WarehouseMoving().MoveTypeList; string name = (from item in mTypeList where item.Value == type.ToString() select item.Text).Single(); return name; }
public ActionResult MovingEditDB(WarehouseMoving model) { if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证 return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" }); WarehouseMoving mov = dbEntity.WarehouseMovings.Find(model.Gid); if (mov == null || mov.Deleted) { return Error("记录不存在", Url.Action("Moving")); } if(mov.Mstatus == (byte)ModelEnum.MovingStatus.CONFIRMED) { return Error("已确认,不能编辑", Url.Action("Moving")); } mov.Mtype = model.Mtype; mov.ShipID = model.ShipID; mov.Reason = model.Reason; mov.Remark = model.Remark; dbEntity.SaveChanges(); return RedirectToAction("Moving"); }
/// <summary> /// 添加移库记录 /// </summary> /// <returns></returns> public ActionResult MovingAdd() { if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证 return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" }); List<WarehouseInformation> warehouses = GetPriWarehouses(); WarehouseInformation firstWH = warehouses.First(); //第一个仓库 WarehouseMoving model = new WarehouseMoving { OldWhID = firstWH.Gid, NewWhID = firstWH.Gid, Mtype = (byte)ModelEnum.MovingType.FOR_SHELF, ShipID = null, }; #region 仓库下拉框 List<SelectListItem> ddlWarehouse = GetWarehouseSelectList(warehouses); ViewBag.WarehouseList = ddlWarehouse; #endregion 仓库下拉框 #region 移库类型数据 List<SelectListItem> ddlMtype = (from item in model.MoveTypeList select new SelectListItem { Text = item.Text, Value = item.Value }).ToList(); ViewBag.MtypeList = ddlMtype; #endregion 移库类型数据 return View(model); }
public ActionResult MovingAddDB(WarehouseMoving model) { if (!base.CheckPrivilege("EnablePrepare"))//制表权限验证 return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" }); Guid orgID = dbEntity.WarehouseInformations.SingleOrDefault(item => item.Gid == model.OldWhID).aParent.Value; if (orgID == Guid.Empty) { return Error("组织不存在", Url.Action("Moving")); } WarehouseMoving newMove = new WarehouseMoving { OrgID = orgID, Prepared = CurrentSession.UserID, OldWhID = model.OldWhID, NewWhID = model.NewWhID, Mtype = model.Mtype, ShipID = (model.Mtype == (byte)ModelEnum.MovingType.FOR_SHELF) ? null : model.ShipID, Reason = model.Reason, Remark = model.Remark }; dbEntity.WarehouseMovings.Add(newMove); dbEntity.SaveChanges(); return RedirectToAction("MovingEdit", new { moveID = newMove.Gid }); }
public ActionResult Moving() { // 权限验证 if (!base.CheckPrivilege()) return RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" }); WarehouseMoving temp = new WarehouseMoving(); List<SelectListItem> list = base.GetSelectList(temp.MoveStatusList); list.Add(new SelectListItem { Text = "全部", Value = "255" }); ViewBag.MStatus = list; list = base.GetSelectList(temp.MoveTypeList); list.Add(new SelectListItem { Text = "全部", Value = "255" }); ViewBag.MType = list; return View(); }