/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, ToolInfoEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
/// <summary> /// 新增工器具 /// </summary> /// <param name="path"></param> /// <param name="name"></param> /// <returns></returns> public ActionResult AddTool(string typeid, ToolInfoEntity model) { var user = OperatorProvider.Provider.Current(); // model.ID = Guid.NewGuid().ToString(); model.TypeId = typeid; model.OutDate = DateTime.Now; model.RegDate = DateTime.Now; model.ValiDate = DateTime.Now; model.RegPersonName = user.UserName; model.RegPersonId = user.UserId; return(View(model)); }
/// <summary> /// 提交 /// </summary> /// <param name="id"></param> /// <param name="model"></param> /// <returns></returns> public ActionResult Sub(string id, ToolInfoEntity model) { if (string.IsNullOrEmpty(id)) { model.ID = Guid.NewGuid().ToString(); model.CurrentNumber = model.Total; ibll.SaveForm(string.Empty, model); } else { ibll.SaveForm(id, model); } return(RedirectToAction("ToolList", new { id = model.TypeId })); }
/// <summary> /// 借用 /// </summary> /// <param name="id">工具id</param> /// <returns></returns> public ActionResult Borrow(string id) { var user = OperatorProvider.Provider.Current(); ToolInfoEntity t = ibll.GetEntity(id); ToolBorrowEntity b = new ToolBorrowEntity(); if (!string.IsNullOrEmpty(t.CurrentNumber)) { if (t.CurrentNumber != "0") { t.CurrentNumber = (Convert.ToInt32(t.CurrentNumber) - 1).ToString(); ibll.SaveForm(t.ID, t); b.ID = Guid.NewGuid().ToString(); b.IsGood = ""; b.Remark = ""; b.ToolName = t.Name; b.ToolSpec = t.Spec; b.BorrwoPerson = user.UserName; b.BorrwoPersonId = user.UserId; b.BorrwoDate = DateTime.Now; b.BackDate = null; b.TypeId = t.ID; b.BZId = user.DeptId; tbll.SaveForm(string.Empty, b); return(Success("0", new { typeid = t.TypeId })); } else { return(Success("1")); } } else { return(Success("1")); } }
public ActionResult Back(string id, string isgood, string state) { var user = OperatorProvider.Provider.Current(); ToolBorrowEntity tb = tbll.GetEntity(id); ToolInfoEntity t = ibll.GetEntity(tb.TypeId); if (!string.IsNullOrEmpty(state)) { //state = state.Substring(0, state.Length - 1); } t.IsGood = isgood; t.State = state; if (!string.IsNullOrEmpty(t.CurrentNumber)) { t.CurrentNumber = (Convert.ToInt32(t.CurrentNumber) + 1).ToString(); //更新工具当前数量 } ibll.SaveForm(t.ID, t); tb.BackDate = DateTime.Now; tb.IsGood = isgood; tb.Remark = state; tbll.SaveForm(tb.ID, tb); return(Success("0")); }
public ActionResult ToolEdit(string id) { ToolInfoEntity model = ibll.GetEntity(id); return(View(model)); }