/// <summary> /// 获取我审批的任务 /// </summary> /// <param name="Type">任务类型</param> /// <returns></returns> public string GetMyProcessCount(string Type) { try { var employee = Marisfrolg.Public.Common.GetEmployeeInfo(); WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy(); Dictionary <string, WorkFlowEngine.WorkFlowInstance> dic = new Dictionary <string, WorkFlowEngine.WorkFlowInstance>(); string result = proxy.GetWorkFlowTaskList(employee.EmployeeNo, "", ref dic); if (!string.IsNullOrEmpty(result) && dic.Count > 0) { List <MongoDB.Bson.ObjectId> Mylist = dic.Select(c => c.Value).Select(c => c._id).ToList(); List <string> WorkFlowList = new List <string>(); foreach (var item in Mylist) { WorkFlowList.Add(item.ToString()); } switch (Type) { //未审批的费用报销单 case "费用报销单": var FeeModel = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); return(FeeModel.Count.ToString()); //未审批的付款通知书 case "付款通知书": var NoticeModel = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); return(NoticeModel.Count.ToString()); //未审批的借款单 case "借款单": var BorrowModel = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); return(BorrowModel.Count.ToString()); //未审批的借款单 case "还款单": var RefundModel = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); return(RefundModel.Count.ToString()); default: break; } } return(""); } catch (Exception ex) { WriteLog.WebGuiInLog("获取我审批的任务" + ex.ToString(), "首页控制器GetMyProcessCount", ""); } return(""); }
/// <summary> /// 获取我审批的任务 /// </summary> /// <param name="Type">任务类型</param> /// <returns></returns> public string GetMyProcess(string Type) { try { var employee = Marisfrolg.Public.Common.GetEmployeeInfo(); WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy(); Dictionary <string, WorkFlowEngine.WorkFlowInstance> dic = new Dictionary <string, WorkFlowEngine.WorkFlowInstance>(); string result = proxy.GetWorkFlowTaskList(employee.EmployeeNo, "", ref dic); if (!string.IsNullOrEmpty(result) && dic.Count > 0) { List <MongoDB.Bson.ObjectId> Mylist = dic.Select(c => c.Value).Select(c => c._id).ToList(); List <string> WorkFlowList = new List <string>(); foreach (var item in Mylist) { WorkFlowList.Add(item.ToString()); } switch (Type) { //未审批的费用报销单 case "费用报销单": var FeeModel = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); List <Marisfrolg.Fee.Models.FeeBillModelRef> RefList = new List <Models.FeeBillModelRef>(); foreach (var item in FeeModel) { Marisfrolg.Fee.Models.FeeBillModelRef RefModel = new Models.FeeBillModelRef(); RefModel = item.MapTo <FeeBillModel, FeeBillModelRef>(); MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID); RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); RefList.Add(RefModel); } return(RefList.Count == 0 ? "" : Public.JsonSerializeHelper.SerializeToJson(RefList)); //未审批的付款通知书 case "付款通知书": var NoticeModel = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); List <Marisfrolg.Fee.Models.NoticeBillModelRef> NoticeRefList = new List <Models.NoticeBillModelRef>(); foreach (var item in NoticeModel) { Marisfrolg.Fee.Models.NoticeBillModelRef RefModel = new Models.NoticeBillModelRef(); RefModel = item.MapTo <NoticeBillModel, NoticeBillModelRef>(); MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID); RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); NoticeRefList.Add(RefModel); } return(NoticeRefList.Count == 0 ? "" : Public.JsonSerializeHelper.SerializeToJson(NoticeRefList)); //未审批的借款单 case "借款单": var BorrowModel = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); List <Marisfrolg.Fee.Models.BorrowBillModelRef> BorrowRefList = new List <Models.BorrowBillModelRef>(); foreach (var item in BorrowModel) { Marisfrolg.Fee.Models.BorrowBillModelRef RefModel = new Models.BorrowBillModelRef(); RefModel = item.MapTo <BorrowBillModel, BorrowBillModelRef>(); MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID); RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); BorrowRefList.Add(RefModel); } return(BorrowRefList.Count == 0 ? "" : Public.JsonSerializeHelper.SerializeToJson(BorrowRefList)); //未审批的借款单 case "还款单": var RefundModel = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); List <Marisfrolg.Fee.Models.RefundBillModelRef> RefundRefList = new List <Models.RefundBillModelRef>(); foreach (var item in RefundModel) { Marisfrolg.Fee.Models.RefundBillModelRef RefModel = new Models.RefundBillModelRef(); RefModel = item.MapTo <RefundBillModel, RefundBillModelRef>(); MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID); RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); RefModel.TotalMoney = RefModel.RealRefundMoney; RefundRefList.Add(RefModel); } return(RefundRefList.Count == 0 ? "" : Public.JsonSerializeHelper.SerializeToJson(RefundRefList)); default: break; } } return(""); } catch (Exception ex) { WriteLog.WebGuiInLog("获取我审批的任务" + ex.ToString(), "首页控制器GetMyProcess", ""); } return(""); }
public string GetMyProcess(int Type, int Time, string TimeValue1 = "", string TimeValue2 = "") { DateTime startTime = new DateTime(1999, 1, 1); DateTime endTime = new DateTime(2999, 1, 1); //创建日期 switch (Time) { //全部 case 1: break; //当天 case 2: startTime = DateTime.Now.Date; break; //本周 case 3: startTime = DateTime.Now.Date.AddDays(1 - Convert.ToInt32(DateTime.Now.Date.DayOfWeek.ToString("d"))); endTime = DateTime.Now.Date.AddDays(1 - Convert.ToInt32(DateTime.Now.Date.DayOfWeek.ToString("d"))).AddDays(7); break; //本月 case 4: startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1); break; //上月 case 5: startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-1); endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); break; //自定义 case 6: startTime = TimeValue1 == "" ? startTime : Convert.ToDateTime(TimeValue1); endTime = TimeValue2 == "" ? endTime : Convert.ToDateTime(TimeValue2); break; default: break; } try { var employee = Marisfrolg.Public.Common.GetEmployeeInfo(); WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy(); Dictionary <string, WorkFlowEngine.WorkFlowInstance> dic = new Dictionary <string, WorkFlowEngine.WorkFlowInstance>(); string result = proxy.GetWorkFlowTaskList(employee.EmployeeNo, "", ref dic); if (!string.IsNullOrEmpty(result) && dic.Count > 0) { List <MongoDB.Bson.ObjectId> Mylist = dic.Select(c => c.Value).Select(c => c._id).ToList(); List <string> WorkFlowList = new List <string>(); foreach (var item in Mylist) { WorkFlowList.Add(item.ToString()); } switch (Type) { case 0: List <FeeBillModelRef> TempData = new List <FeeBillModelRef>(); var list1 = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); foreach (var item in list1) { FeeBillModelRef Temp = new FeeBillModelRef() { PersonInfo = new PersonInfo() { Department = item.PersonInfo.Department, Brand = item.PersonInfo.Brand, Shop = item.PersonInfo.Shop }, BillNo = item.BillNo, PageName = "FeeBill", Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, CreateTime = item.CreateTime, Creator = item.Creator, PostString = item.PostString }; MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(item.WorkFlowID); Temp.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); if (Temp.PostString != null) { Temp.AuditTime = Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? Temp.CreateTime : Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time; Temp.CostTime = Math.Round((DateTime.Now - Temp.AuditTime).TotalDays, 2); } TempData.Add(Temp); } var list2 = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); foreach (var item in list2) { FeeBillModelRef Temp = new FeeBillModelRef() { PersonInfo = new PersonInfo() { Department = item.PersonInfo.Department, Brand = item.PersonInfo.Brand, Shop = item.PersonInfo.Shop }, BillNo = item.BillNo, PageName = "NoticeBill", Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, CreateTime = item.CreateTime, Creator = item.Creator, PostString = item.PostString }; MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(item.WorkFlowID); Temp.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); if (Temp.PostString != null) { Temp.AuditTime = Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? Temp.CreateTime : Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time; Temp.CostTime = Math.Round((DateTime.Now - Temp.AuditTime).TotalDays, 2); } TempData.Add(Temp); } var list3 = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); foreach (var item in list3) { FeeBillModelRef Temp = new FeeBillModelRef() { PersonInfo = new PersonInfo() { Department = item.PersonInfo.Department, Brand = item.PersonInfo.Brand, Shop = item.PersonInfo.Shop }, BillNo = item.BillNo, PageName = "BorrowBill", Owner = item.Owner, TotalMoney = item.TotalMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, CreateTime = item.CreateTime, Creator = item.Creator, PostString = item.PostString }; MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(item.WorkFlowID); Temp.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); if (Temp.PostString != null) { Temp.AuditTime = Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? Temp.CreateTime : Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time; Temp.CostTime = Math.Round((DateTime.Now - Temp.AuditTime).TotalDays, 2); } TempData.Add(Temp); } var list4 = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); foreach (var item in list4) { FeeBillModelRef Temp = new FeeBillModelRef() { PersonInfo = new PersonInfo() { Department = item.PersonInfo.Department, Brand = item.PersonInfo.Brand, Shop = item.PersonInfo.Shop }, BillNo = item.BillNo, PageName = "RefundBill", Owner = item.Owner, TotalMoney = item.RealRefundMoney, StringTime = item.CreateTime.ToString("yyyy-MM-dd"), ApprovalTime = item.ApprovalTime, ApprovalPost = item.ApprovalPost, ApprovalStatus = item.ApprovalStatus, CreateTime = item.CreateTime, Creator = item.Creator, PostString = item.PostString }; MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(item.WorkFlowID); Temp.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); if (Temp.PostString != null) { Temp.AuditTime = Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? Temp.CreateTime : Temp.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time; Temp.CostTime = Math.Round((DateTime.Now - Temp.AuditTime).TotalDays, 2); } TempData.Add(Temp); } TempData = TempData.Where(c => c.CreateTime.Date >= startTime.Date && c.CreateTime.Date <= endTime.Date).OrderByDescending(c => c.CreateTime).ToList(); return(Public.JsonSerializeHelper.SerializeToJson(TempData)); //未审批的费用报销单 case 1: var FeeModel = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); List <Marisfrolg.Fee.Models.FeeBillModelRef> RefList = new List <Models.FeeBillModelRef>(); foreach (var item in FeeModel) { Marisfrolg.Fee.Models.FeeBillModelRef RefModel = new Models.FeeBillModelRef(); RefModel = item.MapTo <FeeBillModel, FeeBillModelRef>(); MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID); RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); RefModel.StringTime = RefModel.CreateTime.ToString("yyyy-MM-dd"); RefModel.PageName = "FeeBill"; if (RefModel.PostString != null) { RefModel.AuditTime = RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? RefModel.CreateTime : RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time; RefModel.CostTime = Math.Round((DateTime.Now - RefModel.AuditTime).TotalDays, 2); } RefList.Add(RefModel); } RefList = RefList.Where(c => c.CreateTime.Date >= startTime.Date && c.CreateTime.Date <= endTime.Date).OrderByDescending(c => c.CreateTime).ToList(); return(Public.JsonSerializeHelper.SerializeToJson(RefList)); //未审批的付款通知书 case 2: var NoticeModel = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); List <Marisfrolg.Fee.Models.NoticeBillModelRef> NoticeRefList = new List <Models.NoticeBillModelRef>(); foreach (var item in NoticeModel) { Marisfrolg.Fee.Models.NoticeBillModelRef RefModel = new Models.NoticeBillModelRef(); RefModel = item.MapTo <NoticeBillModel, NoticeBillModelRef>(); MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID); RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); RefModel.StringTime = RefModel.CreateTime.ToString("yyyy-MM-dd"); RefModel.PageName = "NoticeBill"; if (RefModel.PostString != null) { RefModel.AuditTime = RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? RefModel.CreateTime : RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time; RefModel.CostTime = Math.Round((DateTime.Now - RefModel.AuditTime).TotalDays, 2); } NoticeRefList.Add(RefModel); } NoticeRefList = NoticeRefList.Where(c => c.CreateTime >= startTime && c.CreateTime < endTime).OrderByDescending(c => c.CreateTime).ToList(); return(Public.JsonSerializeHelper.SerializeToJson(NoticeRefList)); //未审批的借款单 case 3: var BorrowModel = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); List <Marisfrolg.Fee.Models.BorrowBillModelRef> BorrowRefList = new List <Models.BorrowBillModelRef>(); foreach (var item in BorrowModel) { Marisfrolg.Fee.Models.BorrowBillModelRef RefModel = new Models.BorrowBillModelRef(); RefModel = item.MapTo <BorrowBillModel, BorrowBillModelRef>(); MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID); RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); RefModel.StringTime = RefModel.CreateTime.ToString("yyyy-MM-dd"); RefModel.PageName = "BorrowBill"; if (RefModel.PostString != null) { RefModel.AuditTime = RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? RefModel.CreateTime : RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time; RefModel.CostTime = Math.Round((DateTime.Now - RefModel.AuditTime).TotalDays, 2); } BorrowRefList.Add(RefModel); } BorrowRefList = BorrowRefList.Where(c => c.CreateTime.Date >= startTime.Date && c.CreateTime.Date <= endTime.Date).OrderByDescending(c => c.CreateTime).ToList(); return(Public.JsonSerializeHelper.SerializeToJson(BorrowRefList)); //未审批的借款单 case 4: var RefundModel = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(employee.EmployeeNo, WorkFlowList); List <Marisfrolg.Fee.Models.RefundBillModelRef> RefundRefList = new List <Models.RefundBillModelRef>(); foreach (var item in RefundModel) { Marisfrolg.Fee.Models.RefundBillModelRef RefModel = new Models.RefundBillModelRef(); RefModel = item.MapTo <RefundBillModel, RefundBillModelRef>(); MongoDB.Bson.ObjectId id = MongoDB.Bson.ObjectId.Parse(RefModel.WorkFlowID); RefModel.AssignmentID = dic.Where(c => c.Value._id == id).Select(c => c.Key).FirstOrDefault(); RefModel.TotalMoney = RefModel.RealRefundMoney; RefModel.StringTime = RefModel.CreateTime.ToString("yyyy-MM-dd"); RefModel.PageName = "RefundBill"; if (RefModel.PostString != null) { RefModel.AuditTime = RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault() == null ? RefModel.CreateTime : RefModel.PostString.Where(c => !string.IsNullOrEmpty(c.JobNumber)).LastOrDefault().Time; RefModel.CostTime = Math.Round((DateTime.Now - RefModel.AuditTime).TotalDays, 2); } RefundRefList.Add(RefModel); } RefundRefList = RefundRefList.Where(c => c.CreateTime.Date >= startTime.Date && c.CreateTime.Date <= endTime.Date).OrderByDescending(c => c.CreateTime).ToList(); return(Public.JsonSerializeHelper.SerializeToJson(RefundRefList)); default: break; } } return("[]"); } catch (Exception ex) { Logger.Write("获取未办结单据列表数据失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name); } return("[]"); }