public void XSSave(T_THDModels model) { int result = 0; try { if (model.Tag == "Add") { model.DataModel.FLAG = 2; result = T_THDDomain.GetInstance().AddModel(model.DataModel); } else if (model.Tag == "Edit") { model.DataModel.FLAG = 2; result = T_THDDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.THID); } } catch { } Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_THD/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult Save(System.Int32 id, string tag) { //加载企业列表 T_SupQYModels supmode = new T_SupQYModels(); supmode.DataModel = supmode.DataModel ?? new T_SupQY(); supmode.DataList = T_SupQYDomain.GetInstance().GetAllT_SupQY(supmode.DataModel).Where(p => p.SupStatus == 1).ToList(); ViewData["SupID"] = new SelectList(supmode.DataList, "SupID", "SupMC"); Expression <Func <T_YSD, bool> > where = PredicateBuilder.True <T_YSD>(); where = where.And(p => p.IsTHFinish != 1); var yslist = T_YSDDomain.GetInstance().GetAllModels <int>(where); ViewData["YSD"] = new SelectList(yslist, "YSID", "YSDH"); T_THDModels model = new T_THDModels(); model.DataModel = new T_THD(); var CurUser = Session["UserModel"] as SysUser; //获取本企业下的人员列表 T_Person person = new T_Person(); if (CurUser.UserCompanyID != null) { person.PsQYID = (int)CurUser.UserCompanyID; } ViewBag.Persons = new SelectList(T_PersonDomain.GetInstance().GetAllT_Person(person), "PsMZ", "PsMZ"); //加载仓库列表 T_CKModels ckmode = new T_CKModels(); ckmode.DataModel = ckmode.DataModel ?? new T_CK(); ckmode.DataList = T_CKDomain.GetInstance().GetAllT_CK(ckmode.DataModel); ViewData["CK"] = new SelectList(ckmode.DataList, "CKID", "CKMC"); if (id != 0) { model.DataModel = T_THDDomain.GetInstance().GetModelById(id); model.THMXList = T_THMXDomain.GetInstance().GetT_THMXByYsid(id); if (model.DataModel.YSID != null && model.DataModel.YSID != 0) { var temp = T_YSDDomain.GetInstance().GetModelById(model.DataModel.YSID); if (temp != null) { model.YSDH = temp.YSDH; } } } else { model.DataModel.THDH = T_THDDomain.GetInstance().GetTHOrderNum("TH", CurUser); model.DataModel.THCJR = CurUser.UserAccount; model.DataModel.THCJRQ = DateTime.Now; } model.Tag = tag; model.RoleCode = GetRoleCode(); return(View("~/Views/T_THD/Save.cshtml", model)); }
public void Delete(System.Int32 id) { //var rCode = GetRoleCode(); //var temp = T_YSDDomain.GetInstance().GetModelById(id); //if (temp != null) //{ // Response.Write("{\"statusCode\":\"300\", \"message\":\"该数据不能删除!\"}"); // return; //} var ysdModel = new T_YSD(); if (id != 0) { ysdModel = T_YSDDomain.GetInstance().GetModelById(id); if (ysdModel != null) { //如果验收单未被使用,可删除。否则,任何人不能删除 Expression <Func <T_RKD, bool> > where = p => (p.YSDH == ysdModel.YSDH); var lst = T_RKDDomain.GetInstance().GetAllModels <int>(where); if (lst != null && lst.Count > 0) { Response.Write("{\"statusCode\":\"300\", \"message\":\"该验收单已存在入库单,不能删除!\"}"); return; } Expression <Func <T_THD, bool> > whereTHD = p => (p.YSID == ysdModel.YSID); var lstTHD = T_THDDomain.GetInstance().GetAllModels <int>(whereTHD); if (lstTHD != null && lstTHD.Count > 0) { Response.Write("{\"statusCode\":\"300\", \"message\":\"该验收单已存在退货单,不能删除!\"}"); return; } if (!string.IsNullOrEmpty(ysdModel.YSBG)) { string filePath = Path.Combine(Server.MapPath("~/UploadFiles/"), "购货商资料", ysdModel.YSBG); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } } } } int result = T_YSDDomain.GetInstance().Delete(id); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_YSD/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult Index(T_THDModels evalModel) { try { evalModel.currentPage = int.Parse(Request["pageNum"].ToString()); } catch { } string order = ""; try { order = Request["orderField"].ToString(); } catch { } if (order.Trim() == "${param.orderField}") { order = ""; } int pagesize = Convert.ToInt32(evalModel.pageSize); int pagecount = Convert.ToInt32(evalModel.pagecount); int currentPage = Convert.ToInt32(evalModel.currentPage); evalModel.DataModel = evalModel.DataModel ?? new T_THD(); if (Request["strTHMC"] != null) { string str = Request["strTHMC"].ToString(); if (!String.IsNullOrEmpty(str)) { evalModel.DataModel.THMC = str; } } if (Request["strTHSQPerson"] != null) { string str = Request["strTHSQPerson"].ToString(); if (!String.IsNullOrEmpty(str)) { evalModel.DataModel.SQR = str; } ViewData["strTHSQPerson"] = str; } //获取本企业下的人员列表 SysUser UserModel = Session["UserModel"] as SysUser; T_Person person = new T_Person(); person.PsQYID = (int)UserModel.UserCompanyID; ViewBag.Persons = new SelectList(T_PersonDomain.GetInstance().GetAllT_Person(person), "PsMZ", "PsMZ"); evalModel.DataList = T_THDDomain.GetInstance().PageT_THD(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount).ToList(); evalModel.resultCount = resultCount; return(View("~/Views/T_THD/Index.cshtml", evalModel)); }
public ActionResult Save(System.Int32 id, string tag) { //加载退货单企业列表 T_THDModels thdQymode = new T_THDModels(); thdQymode.DataModel = thdQymode.DataModel ?? new T_THD(); thdQymode.DataList = T_THDDomain.GetInstance().GetAllT_THD(thdQymode.DataModel); ViewData["THD"] = new SelectList(thdQymode.DataList, "THID", "THMC"); //加载购买商商企业列表 T_YLCPModels cpmode = new T_YLCPModels(); cpmode.DataModel = cpmode.DataModel ?? new T_YLCP(); cpmode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(cpmode.DataModel).Where(p => p.CPStatus == Convert.ToInt32("1")).ToList(); ViewData["YLCP"] = new SelectList(cpmode.DataList, "CPID", "CPMC"); //加载购买商商企业列表 T_CKModels ckmode = new T_CKModels(); ckmode.DataModel = ckmode.DataModel ?? new T_CK(); ckmode.DataList = T_CKDomain.GetInstance().GetAllT_CK(ckmode.DataModel); ViewData["CK"] = new SelectList(ckmode.DataList, "CKID", "CKMC"); T_THMXModels model = new T_THMXModels(); model.DataModel = new T_THMX(); if (id != 0) { model.DataModel = T_THMXDomain.GetInstance().GetModelById(id); } model.Tag = tag; return(View("~/Views/T_THMX/Save.cshtml", model)); }
public void Save(T_THDModels model) { int result = 0; try { if (model.Tag == "Add") { model.DataModel.FLAG = 1; model.DataModel.ISSH = 0; var temp = T_THDDomain.GetInstance().GetAllModels <string>(p => p.THDH == model.DataModel.THDH).FirstOrDefault(); if (temp != null && temp.THID != 0) { var CurUser1 = Session["UserModel"] as SysUser; model.DataModel.THDH = T_THDDomain.GetInstance().GetTHOrderNum("TH", CurUser1); } result = T_THDDomain.GetInstance().AddModel(model.DataModel); } else if (model.Tag == "Edit") { model.DataModel.FLAG = 1; result = T_THDDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.THID); } } catch { } Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_THD/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public void through(T_THDModels model, int id) { int result = 0; try { Int32 cgid = model.DataModel.THID; result = T_THDDomain.GetInstance().Sh(cgid, id); if (id == 1 && model.DataModel.IsFinish == 1 && model.DataModel.YSID != 0) //IsFinish=1表示该退货单对应的验收单已经完结 { T_YSDDomain.GetInstance().UpdateFinish((int)model.DataModel.YSID); } } catch { } Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_THD/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public void Delete(System.Int32 id) { var temp = T_THDDomain.GetInstance().GetModelById(id); if (temp != null) { if (temp.ISSH == 1) { Response.Write("{\"statusCode\":\"300\", \"message\":\"已审批通过的数据不能删除!\"}"); return; } } int result = T_THDDomain.GetInstance().Delete(id); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_THD/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
/// <summary> /// 获取提示信息 /// </summary> public string GetTipInfo() { var strHtml = new StringBuilder(); Expression <Func <ActivityInfo, bool> > whereActivityInfo = p => (p.EndTime != null && DateTime.Now <= p.EndTime.Value); whereActivityInfo = whereActivityInfo.And(p => p.StartTime != null && DateTime.Now >= p.StartTime.Value); var ActivityInfoCount = ActivityInfoDomain.GetInstance().GetAllModels <int>(whereActivityInfo).Count; //有效的公告数量 var AlarmCount = T_BJDDomain.GetInstance().GetCount(); //报警数量 if (AlarmCount > 0) { strHtml.Append(string.Format(strTemplete, "alarmManage", "/T_BJD/Index/", "预警通知", AlarmCount, "报警")); } if (ActivityInfoCount > 0) { strHtml.Append(string.Format(strTemplete, "ActivityInfoManage", "/ActivityInfo/Index/", "公告管理", ActivityInfoCount, "公告")); } var RoleCode = GetRoleCode(); if (RoleCode == "2") { #region Expression <Func <T_SupQY, bool> > whereSupQY = p => p.SupStatus == 0; var SupQYCount = T_SupQYDomain.GetInstance().GetAllModels <int>(whereSupQY).Count; //待审批的供货企业数量 Expression <Func <T_YLCP, bool> > whereYLCP = p => p.CPStatus == 0; var YLCPCount = T_YLCPDomain.GetInstance().GetAllModels <int>(whereYLCP).Count; //待审批的医疗产品数量 Expression <Func <T_CusQY, bool> > whereCusQY = p => p.CusStatus == 0; var CusQYCount = T_CusQYDomain.GetInstance().GetAllModels <int>(whereCusQY).Count; //待审批的购货企业数量 Expression <Func <T_CGD, bool> > whereCGD = p => p.ISSH == 0; var CGDCount = T_CGDDomain.GetInstance().GetAllModels <int>(whereCGD).Count; //待审批的采购单数量 Expression <Func <T_RKD, bool> > whereRKD = p => p.ISSH == 0; var RKDCount = T_RKDDomain.GetInstance().GetAllModels <int>(whereRKD).Count; //待审批的入库单数量 Expression <Func <T_XSD, bool> > whereXSD = p => p.XSFLAG == 0; var XSDCount = T_XSDDomain.GetInstance().GetAllModels <int>(whereXSD).Count; //待审批的销售单数量 Expression <Func <T_SHD, bool> > whereSHD = p => p.ISSH == 0; var SHDCount = T_SHDDomain.GetInstance().GetAllModels <int>(whereSHD).Count; //待审批的损耗单数量 Expression <Func <T_THD, bool> > whereTHD = p => p.ISSH == 0; var THHDCount = T_THDDomain.GetInstance().GetAllModels <int>(whereTHD).Count; //待审批的退货单数量 if (SupQYCount > 0) { strHtml.Append(string.Format(strTemplete, "SupQYManage", "/T_SupQY/Index/", "供货企业", SupQYCount, "供货企业待审批")); } if (YLCPCount > 0) { strHtml.Append(string.Format(strTemplete, "YLCPManage", "/T_YLCP/Index/", "产品信息", YLCPCount, "产品待审批")); } if (CusQYCount > 0) { strHtml.Append(string.Format(strTemplete, "CusQYManage", "/T_CusQY/Index/", "购货企业", CusQYCount, "购货企业待审批")); } if (CGDCount > 0) { strHtml.Append(string.Format(strTemplete, "CGDManage", "/T_CGD/Index/", "采购管理", CGDCount, "采购单待审批")); } if (RKDCount > 0) { strHtml.Append(string.Format(strTemplete, "RKDManage", "/T_RKD/Index/", "入库管理", RKDCount, "入库单待审批")); } if (XSDCount > 0) { strHtml.Append(string.Format(strTemplete, "XSDManage", "/T_XSD/Index/", "销售管理", XSDCount, "销售单待审批")); } if (SHDCount > 0) { strHtml.Append(string.Format(strTemplete, "SHDManage", "/T_SHD/Index/", "损耗管理", SHDCount, "损耗单待审批")); } if (THHDCount > 0) { strHtml.Append(string.Format(strTemplete, "THDManage", "/T_THD/Index/", "退货管理", THHDCount, "退货单待审批")); } #endregion } return(strHtml.ToString()); }