using WX.CRM.Common; using WX.CRM.IBLL.Cache; using WX.CRM.IBLL.Util; using WX.CRM.Model.Entity; using WX.CRM.Model.QueryMap; using WX.CRM.WebHelper; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace WX.CRM.WEB.Controllers.DeptRpt { public class OrdMemoController : BaseController { icache_ord_memo_bl memoBiz; public OrdMemoController(icache_ord_memo_bl _memoBiz) { memoBiz = _memoBiz; } public ActionResult Index() { ToolBar tool = new ToolBar(); string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.推送工单查询, userRightId); tool.AllowButton(toolbtn); tool.AddOtherButton("Other1", "导出", "icon-export", "export_click", true); ViewBag.ToolBar = tool; Pager pager = new Pager() { page = 1, rows = 10 }; string tableId = "tablist"; Table tab = new Table(tableId); tab.AddHeadCol("MEMOID", "", "工单编号"); tab.AddHeadCol("RESID", "", "客户ID"); tab.AddHeadCol("NAME", "", "客户姓名"); tab.AddHeadCol("BUSINESSID", "", "业务类型"); tab.AddHeadCol("MEMOCONTENTID", "", "工单内容"); //tab.AddHeadCol("MEMOTYPEID", "", "工单大类"); //tab.AddHeadCol("MEMOSUBTYPEID", "", "工单小类"); //tab.AddHeadCol("INNERUSERID", "", "受理人"); tab.AddHeadCol("CTIME", "", "受理时间"); tab.AddHeadCol("CALLTIME", "", "开始时间"); tab.AddHeadRow(); ViewBag.gridTable = tab.GetTable() + Pagination.GetPage(pager, tableId, "10,20,30"); ViewBag.inneruserid = UserId; ViewBag.userGroupId = userGroupId; ViewBag.saleDeptId = saleDeptId; ViewBag.roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId); return View(); } [HttpPost] public JsonResult GetMemoQueryHtml(Pager pager, string columns) { string memoId = Request.Form["memoId"]; string stime = Request.Form["stime"]; string etime = Request.Form["etime"]; string BusinessType = Request.Form["BusinessType"]; string MemoType = Request.Form["MemoType"]??"0"; string MemoSubtype = Request.Form["MemoSubtype"]??"0"; string saleDeptId = Request.Form["saleDeptId"]; string groupId = Request.Form["groupId"]; string userId = Request.Form["userId"]; string customerid = Request.Form["customerId"]; List list = new List(); Int32 mtypeid = -1; if (!string.IsNullOrEmpty(BusinessType)) mtypeid = Convert.ToInt32(BusinessType); list = memoBiz.GetList(ref pager, customerid, mtypeid, memoId, stime, etime, Convert.ToDecimal(MemoType), Convert.ToDecimal(MemoSubtype), saleDeptId, groupId, userId); Table table = new Table(columns, true); table.gridPager = pager; ICACHE_Q ui = DataCacheHelper.GetCache(); List memoTypeList = ui.GetList_MemoType();//缓存读取 工单大类数据 List memoSubTypeList = ui.GetList_MemoSubType();//缓存读取 获取所有工单小类数据 ORD_MEMOTYPE memotype = null; ORD_MEMOSUBTYPE memosubType = null; foreach (ORD_MemoQuery model in list) { table.AddCol(table.tdLeft5, "", model.MEMOID); table.AddCol(table.tdLeft5, "", "" + model.RESID + ""); table.AddCol(model.CNAME); table.AddCol(Handler.MethodRsource.GetMemoBusinessName(Convert.ToInt32(BusinessType), Convert.ToInt32(model.BUSINESSID))); table.AddCol(model.STRCONTENT); //memotype = memoTypeList.FirstOrDefault(m => m.TYPEID == model.MEMOTYPEID); //table.AddCol(table.tdLeft5, "", memotype == null ? "" : memotype.TYPENAME); //memosubType = memoSubTypeList.FirstOrDefault(m => m.SUBTYPEID == model.MEMOSUBTYPEID); //table.AddCol(table.tdLeft5, "", memosubType == null ? "" : memosubType.TYPENAME); //table.AddCol(table.tdLeft5, "", InnerUserHelper.Instance.EidAndName(model.INNERUSERID)); table.AddCol(model.CTIME); table.AddCol(model.CALLTIME); table.AddRow(); } var json = new { totalPages = pager.totalPages, totalRows = pager.totalRows, rowsList = table.GetRows() }; return Json(json, JsonRequestBehavior.AllowGet); } #region 客户编号导出 public FileResult ResourceIDExport() { string memoId = Request.QueryString["memoId"]; string stime = Request.QueryString["stime"]; string etime = Request.QueryString["etime"]; string BusinessType = Request.QueryString["BusinessType"]; string MemoType = Request.QueryString["MemoType"]??"0"; string MemoSubtype = Request.QueryString["MemoSubtype"]??"0"; string saleDeptId = Request.QueryString["saleDeptId"]; string groupId = Request.QueryString["groupId"]; string userId = Request.QueryString["userId"]; string customerid = Request["customerId"]; List list = new List(); Int32 mtypeid = -1; if (!string.IsNullOrEmpty(BusinessType)) mtypeid = Convert.ToInt32(BusinessType); list = memoBiz.GetMemoResId(customerid, mtypeid, memoId, stime, etime, Convert.ToDecimal(MemoType), Convert.ToDecimal(MemoSubtype), saleDeptId, groupId, userId); return File(ExcelHelper.ExportListObjectToExcel(list, "客户编号", "工单综合查询", null), "application/ms-excel", PageRequest.GetDlownLoadName("客户编号" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls")); } #endregion } }