/// <summary> /// 异常处理 /// </summary> /// <param name="ids"></param> /// <param name="status"></param> /// <param name="memo"></param> /// <returns></returns> public JsonResult CheckException(string ids, int status, string memo) { string[] Ids = ids.Split(','); for (int i = 0; i < Ids.Length; i++) { string guid = Ids[i]; T_Generalize model = db.T_Generalize.SingleOrDefault(s => s.Guid.Equals(guid)); if (model.IsDispose == 1) { return(Json(new { State = "Faile", Message = "该数据已处理" })); } model.IsDispose = 1; db.SaveChanges(); T_GeneralizeApprove approve = new T_GeneralizeApprove { ApproveName = UserModel.Nickname, ApproveTime = DateTime.Now, ApproveStatus = status, Memo = memo, Pid = guid }; db.T_GeneralizeApprove.Add(approve); db.SaveChanges(); } return(Json(new { State = "Success" })); }
/// <summary> /// 审核 /// </summary> /// <param name="approveIDs"></param> /// <param name="status"></param> /// <param name="memo"></param> /// <returns></returns> public JsonResult Check(string ids, int status, string memo) { using (TransactionScope sc = new TransactionScope()) { try { string[] Ids = ids.Split(','); for (int i = 0; i < Ids.Length; i++) { string guid = Ids[i]; T_Generalize model = db.T_Generalize.SingleOrDefault(s => s.Guid.Equals(guid)); model.Status = status; db.SaveChanges(); T_GeneralizeApprove approve = db.T_GeneralizeApprove.SingleOrDefault(s => !s.ApproveTime.HasValue && s.Pid == guid); approve.Memo = memo; approve.ApproveTime = DateTime.Now; approve.ApproveStatus = status; db.SaveChanges(); //同意 if (status == 1) { //如果存在下一级审核人 int step = db.T_GeneralizeApproveConfig.SingleOrDefault(s => s.ApproveUser.Equals(UserModel.Nickname)).Step; int stepLast = db.T_GeneralizeApproveConfig.OrderByDescending(s => s.Step).First().Step; if (stepLast - 1 > step) { model.Status = 0; db.SaveChanges(); T_GeneralizeApprove approveModel = new T_GeneralizeApprove { ApproveName = db.T_GeneralizeApproveConfig.OrderBy(s => s.Step).First(s => s.Step > step).ApproveUser, ApproveStatus = -1, Pid = guid }; db.T_GeneralizeApprove.Add(approveModel); db.SaveChanges(); } } } //ModularByZP(); sc.Complete(); return(Json(new { State = "Success" })); } catch (Exception ex) { return(Json(new { State = "Faile", Message = ex.Message })); } } }
public JsonResult ViewGeneralizeEditSave(T_Generalize model, string thisdate) { try { T_Generalize ge = db.T_Generalize.Find(model.ID); ge.CreateDate = Convert.ToDateTime(thisdate); ge.PlatformCode = model.PlatformCode; ge.StoreName = model.StoreName; ge.OrderNumber = model.OrderNumber; ge.ProductName = model.ProductName; ge.Cost = model.Cost; ge.CommissionCost = model.CommissionCost; ge.DKUserMessage = model.DKUserMessage; ge.AliNumber = model.AliNumber; ge.TenPay = model.TenPay; ge.BankNumber = model.BankNumber; ge.OrderType = model.OrderType; ge.PayCommissionNumber = model.PayCommissionNumber; ge.BorrowCode = model.BorrowCode; ge.Memo = model.Memo; ge.ResponsibleName = model.ResponsibleName; ge.Status = -1; db.SaveChanges(); if (model.Status == 3)//驳回 { T_GeneralizeApprove approve = new T_GeneralizeApprove(); approve.ApproveName = db.T_GeneralizeApproveConfig.First().ApproveUser; approve.ApproveStatus = -1; approve.Pid = ge.Guid; db.T_GeneralizeApprove.Add(approve); db.SaveChanges(); } //ModularByZP(); return(Json(new { State = "Success" })); } catch (Exception ex) { return(Json(new { State = "Faile", Message = ex.Message })); } }
/// <summary> /// 异常处理 /// </summary> /// <param name="ids"></param> /// <param name="status"></param> /// <param name="memo"></param> /// <returns></returns> public JsonResult Check(string CurUser, string Guid, int status, string memo) { T_Generalize model = db.T_Generalize.SingleOrDefault(s => s.Guid.Equals(Guid)); if (model.IsDispose == 1) { return(Json(new { State = "Faile", Message = "该数据已处理" })); } model.IsDispose = 1; db.SaveChanges(); T_GeneralizeApprove approve = new T_GeneralizeApprove { ApproveName = CurUser, ApproveTime = DateTime.Now, ApproveStatus = status, Memo = memo, Pid = Guid }; db.T_GeneralizeApprove.Add(approve); db.SaveChanges(); return(Json(new { State = "Success" })); }
//详情数据加载 public JsonResult GetDetail(int ID, string UserName) { T_User MOD_User = db.T_User.FirstOrDefault(a => a.Nickname == UserName); //真名 string name = MOD_User.Name; string result = ""; //主表 T_Generalize mod = db.T_Generalize.Find(ID); mainItem list = new mainItem(); list.ID = mod.ID; list.Guid = mod.Guid; list.CreateDate = mod.CreateDate; list.PlatformCode = mod.PlatformCode; list.PostUser = mod.PostUser; list.StoreName = mod.StoreName; list.OrderNumber = mod.OrderNumber; list.ProductName = mod.ProductName; list.Cost = mod.Cost; list.CommissionCost = mod.CommissionCost; list.DKUserMessage = mod.DKUserMessage; list.AliNumber = mod.AliNumber; list.BankNumber = mod.BankNumber; list.TenPay = mod.TenPay; list.IsCheck = mod.IsCheck; list.OrderType = mod.OrderType; list.PayCommissionNumber = mod.PayCommissionNumber; list.Memo = mod.Memo; list.BorrowCode = mod.BorrowCode; list.ResponsibleName = mod.ResponsibleName; list.IsSend = mod.IsSend; list.IsCancel = mod.IsCancel; list.PlatformFlag = mod.PlatformFlag; list.WarhouseName = mod.WarhouseName; list.UploadName = mod.UploadName; list.Status = mod.Status; list.IsDelete = mod.IsDelete; list.IsDispose = mod.IsDispose; string modJson = JsonConvert.SerializeObject(list, Lib.Comm.setTimeFormat()); //审核记录 IQueryable <T_GeneralizeApprove> mod_Approve = db.T_GeneralizeApprove.Where(a => a.Pid == mod.Guid); string approve = JsonConvert.SerializeObject(mod_Approve, Lib.Comm.setTimeFormat()); T_GeneralizeApprove Approve = db.T_GeneralizeApprove.FirstOrDefault(s => !s.ApproveTime.HasValue && s.Pid == mod.Guid); if (Approve == null) { Approve = db.T_GeneralizeApprove.FirstOrDefault(s => s.ApproveTime.HasValue && s.Pid == mod.Guid); } //用于判断是不是我审核 0不是 1是 int myCheck = 0; string MyApprove = db.T_GeneralizeApproveConfig.OrderByDescending(s => s.ID).First().ApproveUser == UserName ? "true" : "false"; // T_FreezeApprove MyApprove = db.T_FreezeApprove.FirstOrDefault(a => a.freezeID == ID && a.ApproveName == name && a.ApproveTime == null); if (MyApprove == "true" && mod.IsDispose != 1) { myCheck = 1; } //付款银行 List <SelectListItem> listPayBank = Lib.Comm.PayBank; string ThePaymentBank = JsonConvert.SerializeObject(listPayBank, Lib.Comm.setTimeFormat()); result += "{\"Main\":[" + modJson + "],\"Approve\":" + approve + ",\"myCheck\":\"" + myCheck + "\",\"Guid\":\"" + Approve.Pid + "\"}"; return(Json(result, JsonRequestBehavior.AllowGet)); }