public JsonResult GetCGDH(string CGDMC) { var mxModel = T_CGDDomain.GetInstance().GetAllModels <int>(p => p.ISSH == 1 && p.IsFinish != 1 && (string.IsNullOrEmpty(CGDMC) || p.CGDMC.Contains(CGDMC))).OrderByDescending(p => p.CGDH).ToList(); var result1 = ""; StringBuilder result = new StringBuilder(); result.Append("[[\"\",\"请选择\"]"); if (mxModel == null) { result.Append("]"); result1 = result.ToString(); } else { foreach (var item in mxModel) { result.Append(",["); result.Append("\"" + item.CGDH + "\","); result.Append("\"" + item.CGDH + "\""); result.Append("]"); } result.Append("]"); result1 = result.ToString(); } return(Json(result1)); }
public void Delete(System.Int32 id) { //var rCode = GetRoleCode(); var temp = T_CGDDomain.GetInstance().GetModelById(id); if (temp != null) { if (temp.ISSH == 1) { Response.Write("{\"statusCode\":\"300\", \"message\":\"已审批通过的数据不能删除!\"}"); return; } //如果采购单未被使用,超级管理员可删除。否则,任何人不能删除 Expression <Func <T_YSD, bool> > where = p => (p.CGDH == temp.CGDH); var lst = T_YSDDomain.GetInstance().GetAllModels <int>(where); if (lst != null && lst.Count > 0) { Response.Write("{\"statusCode\":\"300\", \"message\":\"该采购单已存在验收单,不能删除!\"}"); return; } } int result = T_CGDDomain.GetInstance().Delete(id); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_CGD/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult Save(System.Int32 id, string tag) { T_CGDModels model = new T_CGDModels(); model.DataModel = new T_CGD(); CurUser = Session["UserModel"] as SysUser; //id是否为0,区分增加和修改功能 if (id != 0) { model.CGMXList = T_CGMXDomain.GetInstance().GetT_CGMXByCgid(id); model.DataModel = T_CGDDomain.GetInstance().GetModelById(id); } else { model.DataModel.CGDH = T_CGDDomain.GetInstance().GetCgOrderNum("CP", CurUser); model.DataModel.CGCJR = CurUser.UserAccount; model.DataModel.CGCJRQ = DateTime.Now; } //加载产品列表 //T_YLCPModels ylcpmode = new T_YLCPModels(); //ylcpmode.DataModel = ylcpmode.DataModel ?? new T_YLCP(); //ylcpmode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpmode.DataModel); //ViewData["YLCP"] = new SelectList(ylcpmode.DataList, "CPID", "CPMC"); //加载企业列表 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"); //获取用户信息(包含单位ID) SysUser UserModel = Session["UserModel"] as SysUser; //获取本企业下的人员列表 T_Person person = new T_Person(); if (UserModel.UserCompanyID != null) { person.PsQYID = (int)UserModel.UserCompanyID; } ViewBag.Persons = new SelectList(T_PersonDomain.GetInstance().GetAllT_Person(person), "PsMZ", "PsMZ"); //Expression<Func<T_PackingUnit, bool>> where = PredicateBuilder.True<T_PackingUnit>(); //ViewBag.PackingUnit = new SelectList(T_PackingUnitDomain.GetInstance().GetAllModels<int>(where), "PUName", "PUName"); model.Tag = tag; model.RoleCode = GetRoleCode(); return(View("~/Views/T_CGD/Save.cshtml", model)); }
public int SaveTPrice(int id, string tPrice, string dhid) { int result = 0; try { double d = 0; double.TryParse(tPrice, out d); result = T_CGDDomain.GetInstance().SaveTPrice(id, d, dhid); } catch { } return(result); }
public ActionResult Save(System.Int32 id, string tag) { T_CGMXModels model = new T_CGMXModels(); model.DataModel = new T_CGMX(); Int32 did = id; if (tag != "Add") { model.DataModel = T_CGMXDomain.GetInstance().GetModelById(id); did = model.DataModel.CGID; } //加载产品列表 T_YLCPModels ylcpmode = new T_YLCPModels(); ylcpmode.DataModel = ylcpmode.DataModel ?? new T_YLCP(); ylcpmode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpmode.DataModel); ViewData["YLCP"] = new SelectList(ylcpmode.DataList, "CPID", "CPMC"); //加载企业列表 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"); //加载采购单列表 T_CGDModels cgdQymode = new T_CGDModels(); cgdQymode.DataModel = cgdQymode.DataModel ?? new T_CGD(); T_CGD cgd = T_CGDDomain.GetInstance().GetModelById(did); cgdQymode.DataList = new List <T_CGD>(); cgdQymode.DataList.Add(cgd); ViewData["CGD"] = new SelectList(cgdQymode.DataList, "CGID", "CGDMC"); //if (id != 0) //{ // model.DataModel = T_CGMXDomain.GetInstance().GetModelById(id); //} model.Tag = tag; return(View("~/Views/T_CGMX/Save.cshtml", model)); }
public ActionResult Save(System.Int32 id, string tag) { SysUser sysUser = Session["UserModel"] as SysUser; //采购单列表 T_CGDModels cgdQymode = new T_CGDModels(); cgdQymode.DataModel = cgdQymode.DataModel ?? new T_CGD(); //cgdQymode.DataList = T_CGDDomain.GetInstance().GetAllT_CGD(cgdQymode.DataModel).Where(p => p.ISSH == 1 && p.IsFinish == 0).OrderByDescending(p => p.CGDH).ToList(); cgdQymode.DataList = T_CGDDomain.GetInstance().GetAllT_CGD(cgdQymode.DataModel).Where(p => p.ISSH == 1 && p.IsFinish != 1).OrderByDescending(p => p.CGDH).ToList(); ViewData["CGD"] = new SelectList(cgdQymode.DataList, "CGDH", "CGDH"); //加载企业列表 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"); //获取本企业下的人员列表 T_Person person = new T_Person(); person.PsQYID = (int)sysUser.UserCompanyID; ViewBag.Persons = new SelectList(T_PersonDomain.GetInstance().GetAllT_Person(person), "PsMZ", "PsMZ"); T_YSDModels model = new T_YSDModels(); model.DataModel = new T_YSD(); if (id != 0) { model.DataModel = T_YSDDomain.GetInstance().GetModelById(id); model.YSMXList = T_YSMXDomain.GetInstance().GetT_YSMXByYsid(id); } else { model.DataModel.YSDH = T_YSDDomain.GetInstance().GetYsOrderNum("YS", sysUser); model.DataModel.YSCJR = sysUser.UserAccount; model.DataModel.YSCJRQ = DateTime.Now; } model.Tag = tag; model.RoleCode = GetRoleCode(); return(View("~/Views/T_YSD/Save.cshtml", model)); }
public ActionResult CGDSPIndex(System.Int32 id, string tag) { T_CGDModels model = new T_CGDModels(); model.DataModel = new T_CGD(); T_CGMX cgmodel = new T_CGMX(); if (id != 0) { model.DataModel = T_CGDDomain.GetInstance().GetModelById(id); model.CGMXList = T_CGMXDomain.GetInstance().GetAllT_CGMX(cgmodel); if (model.CGMXList.Count > 0) { model.CGMXList = model.CGMXList.Where(p => p.CGID == id).ToList(); } } model.Tag = tag; return(View("~/Views/T_CGD/CGDSPIndex.cshtml", model)); }
public void through(T_CGDModels model, int id) { int result = 0; try { Int32 cgid = model.DataModel.CGID; result = T_CGDDomain.GetInstance().Sh(cgid, id); } catch { } Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_CGD/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public void NCGSave(T_YSDModels model) { int result = 0; try { if (model.Tag == "Add") { model.DataModel.IsFinish = 0; model.DataModel.IsCGFinish = 0; model.DataModel.IsCGYS = 1; //model.DataModel.IsTHFinish = 0; var temp = T_YSDDomain.GetInstance().GetAllModels <string>(p => p.YSDH == model.DataModel.YSDH).FirstOrDefault(); if (temp != null && temp.YSID != 0) { var CurUser1 = Session["UserModel"] as SysUser; model.DataModel.YSDH = T_YSDDomain.GetInstance().GetYsOrderNum("YS", CurUser1); } result = T_YSDDomain.GetInstance().AddModel(model.DataModel); } else if (model.Tag == "Edit") { result = T_YSDDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.YSID); } if (model.DataModel.IsCGFinish == 1) { T_CGDDomain.GetInstance().UpdateFinish(model.DataModel.CGDH); } } catch { } Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_YSD/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult Index(T_CGDModels evalModel) { SysUser UserModel = Session["UserModel"] as SysUser; try { ViewData["shUserId"] = UserModel.UserId; evalModel.currentPage = int.Parse(Request["pageNum"].ToString()); } catch { } string strCGPerson = "请选择"; 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_CGD(); if (Request["strCGPerson"] != null) { strCGPerson = Request["strCGPerson"].ToString(); if (!String.IsNullOrEmpty(strCGPerson)) { evalModel.DataModel.CGPERSON = strCGPerson; } } var strCGDMC = ""; if (Request["strCGDMC"] != null) { strCGDMC = Request["strCGDMC"].ToString(); if (!String.IsNullOrEmpty(strCGDMC)) { evalModel.DataModel.CGDMC = strCGDMC; } } var cpId = 0; if (Request["strCGCPMC"] != null) { string str = Request["strCGCPMC"].ToString(); if (!String.IsNullOrEmpty(str)) { cpId = Convert.ToInt32(str); } ViewData["strCGCPMC"] = str; } var supId = 0; if (Request["strCGSupQY"] != null) { string str = Request["strCGSupQY"].ToString(); if (!String.IsNullOrEmpty(str)) { supId = Convert.ToInt32(str); } ViewData["strCGSupQY"] = str; } var cusId = 0; if (Request["strCusQY"] != null) { string str = Request["strCusQY"].ToString(); if (!String.IsNullOrEmpty(str)) { cusId = Convert.ToInt32(str); } ViewData["strCusQY"] = str; } //获取本企业下的人员列表 T_Person person = new T_Person(); person.PsQYID = (int)UserModel.UserCompanyID; ViewBag.Persons = new SelectList(T_PersonDomain.GetInstance().GetAllT_Person(person), "PsMZ", "PsMZ"); ViewData["strCGPerson"] = strCGPerson; T_YLCPModels ylcpQymode = new T_YLCPModels(); ylcpQymode.DataModel = ylcpQymode.DataModel ?? new T_YLCP(); ylcpQymode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpQymode.DataModel).Where(p => p.CPStatus == 1).ToList(); ViewData["YLCP"] = new SelectList(ylcpQymode.DataList, "CPID", "CPMC"); 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["SupQYList"] = new SelectList(supmode.DataList, "SupID", "SupMC"); evalModel.DataList = T_CGDDomain.GetInstance().PageT_CGD(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, cpId, supId, cusId, out pagecount, out resultCount); evalModel.resultCount = resultCount; return(View("~/Views/T_CGD/Index.cshtml", evalModel)); }
/// <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()); }
public string ExportExcelPR(System.Int32 id) { //获取需要打印的数据 T_RKD ckdinfo = new T_RKD(); List <T_RKD> list = T_RKDDomain.GetInstance().GetListModelById(id); if (list.Count > 0) { ckdinfo = list[0]; } //验收单号 string rkysdh = ckdinfo.YSDH; //供货企业名称 T_RKMX rkdinfo = new T_RKMX(); List <T_RKMX> rkmxList = T_RKMXDomain.GetInstance().GetListModelById(id); if (rkmxList.Count > 0) { rkdinfo = rkmxList[0]; } string ghqy = rkdinfo.T_SupQY == null ? "" : rkdinfo.T_SupQY.SupMC; //命名导出表格的StringBuilder变量 StringBuilder sHtml = new StringBuilder(string.Empty); //打印表头 sHtml.Append("<table border=\"0\" width=\"100%\">"); // sHtml.Append("<tr height=\"40\"><td colspan=\"12\" align=\"center\" style='font-size:24px'><b>入库单" + "</b></td></tr>"); sHtml.Append("<tr height=\"40\"><td colspan=\"6\" align=\"left\">供货企业:" + ghqy + "</td><td align=\"center\" colspan=\"4\">日期:" + DateTime.Now.ToString("yyyy-MM-dd") + "</td><td align=\"right\" colspan=\"2\">入库单号:" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + "</td></tr>"); sHtml.Append("</table>"); sHtml.Append("<table border=\"1\" width=\"100%\" style='border-collapse:collapse;border:1px solid black;'>"); // width=\"100%\" sHtml.Append("<tr height=\"30\" align=\"center\" ><td>产品名称</td><td>产品规格</td><td>生产厂家</td><td>生产日期</td><td>单位</td><td>数量</td><td>单价</td>" + "<td>金额</td><td>产品批号</td><td>产品有效期</td><td>经营许可证号</td><td>注册证号</td></tr>"); //合计 double total = 0.0; for (int i = 0; i < rkmxList.Count; i++) { T_RKMX rkmx = rkmxList[i]; //产品名称 string cpName = rkmx.T_YLCP.CPMC; //规格 string cpGg = rkmx.T_YLCP.CPGG ?? ""; //单位 string cpDw = rkmx.T_YLCP.CPDW ?? ""; //数量 double cpDj = rkmx.CPNUM ?? 0; //产品批号 string scPh = rkmx.CPPH ?? ""; //产品有效期 string yxq = ""; if (rkmx.CPYXQ != null) { yxq = rkmx.CPYXQ.Value.ToString("yyyyMMdd"); } var scrq = ""; if (rkmx.CPSCRQ != null) { scrq = rkmx.CPSCRQ.Value.ToString("yyyyMMdd"); } //生产企业 string cpScqy = rkdinfo.T_SupQY1 == null ? "" : rkdinfo.T_SupQY1.SupMC; //单价 double cpPrice = Math.Round(rkmx.T_YLCP.CPPrice ?? 0.0, 2); //产品总价 double rowTotal = Math.Round(cpDj * cpPrice, 2); total = total + rowTotal; //注册证号 string cpzczh = rkmx.T_YLCP.CPZCZ; //经营许可证号 string xkzbh = rkmx.T_SupQY.SupXKZBH; sHtml.Append("<tr height=\"30\" align=\"center\"><td>" + cpName + "</td><td>" + cpGg + "</td><td>" + cpScqy + "</td><td>" + scrq + "</td><td>" + cpDw + "</td><td>" + cpDj.ToString() + "</td><td>" + cpPrice.ToString("0.00") + "</td><td>" + rowTotal.ToString("0.00") + "</td><td>" + scPh + "</td><td>" + yxq + "</td><td>" + xkzbh + "</td><td>" + cpzczh + "</td></tr>"); } //打印表尾 sHtml.Append("<tr height=\"40\" align=\"center\"><td colspan=\"5\">合计金额:(大写)" + MoneySmallToBig(total.ToString()) + "</td><td colspan=\"7\">(小写)" + total.ToString("0.00") + "</td></tr>"); sHtml.Append("</table>"); sHtml.Append("<table border=\"0\" width=\"100%\">"); // width =\"100%\" Expression <Func <T_YSD, bool> > where = p => p.YSDH == ckdinfo.YSDH; var ysd = T_YSDDomain.GetInstance().GetAllModels <int>(where).FirstOrDefault(); var cgdModel = new T_CGD(); if (ysd != null && ysd.YSID != 0 && !string.IsNullOrEmpty(ysd.CGDH)) { Expression <Func <T_CGD, bool> > where1 = p => p.CGDH == ysd.CGDH; cgdModel = T_CGDDomain.GetInstance().GetAllModels <int>(where1).FirstOrDefault(); } sHtml.Append("<tr height=\"40\" align=\"center\"><td colspan=\"2\" align=\"left\">制单人: " + ckdinfo.RKCJR + "</td><td align=\"left\" colspan=\"4\">审核人: " + cgdModel.SHR + "</td><td align=\"left\" colspan=\"3\">采购员: " + cgdModel.CGPERSON + "</td><td align=\"left\" colspan=\"3\">质检员: </td></tr>"); sHtml.Append("</table>"); return(sHtml.ToString()); }