예제 #1
0
        /// <summary>
        ///  根据单号获取实体对象
        /// </summary>
        /// <param name="BillNo">单号</param>
        /// <param name="type">单据类型</param>
        /// <returns></returns>
        public string GetDataFromBillNo(string BillNo, int Type)
        {
            try
            {
                switch (Type)
                {
                //费用报销单
                case 1:
                    Models.FeeBillModel    FeeModel    = new Marisfrolg.Fee.BLL.FeeBill().GetBillModel(BillNo);
                    Models.FeeBillModelRef FeeRefModel = new Models.FeeBillModelRef();
                    FeeRefModel            = FeeModel.MapTo <Models.FeeBillModel, Models.FeeBillModelRef>();
                    FeeRefModel.StringTime = FeeRefModel.CreateTime.ToString("yyyy-MM-dd");
                    FeeRefModel.PageName   = "FeeBill";
                    return(FeeRefModel == null ? "" : Public.JsonSerializeHelper.SerializeToJson(FeeRefModel));

                //付款通知书
                case 2:
                    Models.NoticeBillModel    NoticeModel    = new Marisfrolg.Fee.BLL.NoticeBill().GetBillModel(BillNo);
                    Models.NoticeBillModelRef NoticeRefModel = new Models.NoticeBillModelRef();
                    NoticeRefModel            = NoticeModel.MapTo <Models.NoticeBillModel, Models.NoticeBillModelRef>();
                    NoticeRefModel.StringTime = NoticeModel.CreateTime.ToString("yyyy-MM-dd");
                    NoticeRefModel.PageName   = "Notice";
                    return(NoticeRefModel == null ? "" : Public.JsonSerializeHelper.SerializeToJson(NoticeRefModel));

                //借款单
                case 3:
                    Models.BorrowBillModel    BorrowModel    = new Marisfrolg.Fee.BLL.BorrowBill().GetBillModel(BillNo);
                    Models.BorrowBillModelRef BorrowRefModel = new Models.BorrowBillModelRef();
                    BorrowRefModel            = BorrowModel.MapTo <Models.BorrowBillModel, Models.BorrowBillModelRef>();
                    BorrowRefModel.StringTime = BorrowModel.CreateTime.ToString("yyyy-MM-dd");
                    BorrowRefModel.PageName   = "BorrowBill";
                    return(BorrowRefModel == null ? "" : Public.JsonSerializeHelper.SerializeToJson(BorrowRefModel));

                //还款单
                case 4:
                    Models.RefundBillModel    RefundModel    = new Marisfrolg.Fee.BLL.RefundBill().GetBillModel(BillNo);
                    Models.RefundBillModelRef RefundRefModel = new Models.RefundBillModelRef();
                    RefundRefModel            = RefundModel.MapTo <Models.RefundBillModel, Models.RefundBillModelRef>();
                    RefundRefModel.StringTime = RefundModel.CreateTime.ToString("yyyy-MM-dd");
                    RefundRefModel.PageName   = "RefundBill";
                    RefundRefModel.TotalMoney = RefundModel.RealRefundMoney;
                    return(RefundRefModel == null ? "" : Public.JsonSerializeHelper.SerializeToJson(RefundRefModel));

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.Write("获取列表数据失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return("");
        }
예제 #2
0
        /// <summary>
        /// 获取打印列表
        /// </summary>
        /// <param name="Type">单据类型</param>
        /// <param name="Time">时间</param>
        /// <param name="Page">页码数</param>
        /// <returns></returns>
        public string GetPrintList(int Type, int Time, int Page = 1)
        {
            try
            {
                InfoList list = new InfoList();
                list.pageSize = 10;
                int    totalNumber = 0;
                object ModelList   = null;
                //时间区间控制
                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;

                default:
                    break;
                }
                //根据不同的单据类型调用不同的方法取值
                switch (Type)
                {
                //费用报销单
                case 1:
                    List <Models.FeeBillModel>    FeeBill     = new Marisfrolg.Fee.BLL.FeeBill().GetBillForPrint(startTime, endTime, Page, list.pageSize, out totalNumber);
                    List <Models.FeeBillModelRef> FeeBillList = new List <Models.FeeBillModelRef>();
                    foreach (var item in FeeBill)
                    {
                        Models.FeeBillModelRef FeeModel = new Models.FeeBillModelRef();
                        FeeModel            = item.MapTo <Models.FeeBillModel, Models.FeeBillModelRef>();
                        FeeModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        FeeBillList.Add(FeeModel);
                    }
                    ModelList = FeeBillList;
                    break;

                //付款通知书
                case 2:
                    List <Models.NoticeBillModel>    NoticeBill     = new Marisfrolg.Fee.BLL.NoticeBill().GetBillForPrint(startTime, endTime, Page, list.pageSize, out totalNumber);
                    List <Models.NoticeBillModelRef> NoticeBillList = new List <Models.NoticeBillModelRef>();
                    foreach (var item in NoticeBill)
                    {
                        Models.NoticeBillModelRef NoticeModel = new Models.NoticeBillModelRef();
                        NoticeModel            = item.MapTo <Models.NoticeBillModel, Models.NoticeBillModelRef>();
                        NoticeModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        NoticeBillList.Add(NoticeModel);
                    }
                    ModelList = NoticeBillList;
                    break;

                //借款单(所有的借款记录,不论是否还清)
                case 3:
                    List <Models.BorrowBillModel>    BorrowBill     = new Marisfrolg.Fee.BLL.BorrowBill().GetBillForPrint(startTime, endTime, Page, list.pageSize, out totalNumber);
                    List <Models.BorrowBillModelRef> BorrowBillList = new List <Models.BorrowBillModelRef>();
                    foreach (var item in BorrowBill)
                    {
                        Models.BorrowBillModelRef BorrowModel = new Models.BorrowBillModelRef();
                        BorrowModel            = item.MapTo <Models.BorrowBillModel, Models.BorrowBillModelRef>();
                        BorrowModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        BorrowBillList.Add(BorrowModel);
                    }
                    ModelList = BorrowBillList;
                    break;

                //还款单(加载还款记录)
                case 4:
                    List <Models.RefundBillModel>    RefundBill     = new Marisfrolg.Fee.BLL.RefundBill().GetBillForPrint(startTime, endTime, Page, list.pageSize, out totalNumber);
                    List <Models.RefundBillModelRef> RefundBillList = new List <Models.RefundBillModelRef>();
                    foreach (var item in RefundBill)
                    {
                        Models.RefundBillModelRef RefundModel = new Models.RefundBillModelRef();
                        RefundModel            = item.MapTo <Models.RefundBillModel, Models.RefundBillModelRef>();
                        RefundModel.StringTime = item.CreateTime.ToString("yyyy-MM-dd");
                        RefundModel.TotalMoney = RefundModel.RealRefundMoney;
                        RefundBillList.Add(RefundModel);
                    }
                    ModelList = RefundBillList;
                    break;

                default:
                    break;
                }

                double value = (double)totalNumber / list.pageSize;
                list.totalPages  = Math.Ceiling(value);
                list.currentPage = Page;
                list.info        = ModelList;
                return(Public.JsonSerializeHelper.SerializeToJson(list));
            }
            catch (Exception ex)
            {
                Logger.Write("获取打印列表数据失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return("");
        }
예제 #3
0
        /// <summary>
        /// 获取我审批过的单据
        /// </summary>
        /// <param name="Type">单据类型</param>
        /// <param name="Time">时间</param>
        /// <param name="EmployeeNo">工号</param>
        /// <returns></returns>
        public object GetApprovalData(int Type, int Time, string EmployeeNo, string departmentID, string StartTime, string EndTime)
        {
            try
            {
                var TempTime1 = DateTime.Now.Date;
                var TempTime2 = DateTime.Now.Date;
                if (Time == 6)
                {
                    TempTime1 = StartTime == "" ? new DateTime(1999, 1, 1) : Convert.ToDateTime(StartTime);
                    TempTime2 = EndTime == "" ? new DateTime(2999, 1, 1) : Convert.ToDateTime(EndTime);
                }
                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                List <WorkFlowInstance>     dic   = new List <WorkFlowInstance>();
                string objectID = proxy.GetWorkFlowListByUserId(EmployeeNo, TempTime1, TempTime2, ref dic);

                if (!string.IsNullOrEmpty(objectID) && dic.Count > 0)
                {
                    List <TempTime> Mylist = new List <TempTime>();
                    foreach (var item in dic)
                    {
                        TempTime Tmp = new TempTime();
                        Tmp.Id = item._id;
                        if (item.Assignments == null)
                        {
                            item.Assignments = new List <Assignment>();
                        }
                        var model = item.Assignments.Where(c => (c.Keyword == 12002 || c.Keyword == 12003 || c.Keyword == 12005) && c.UserCode == EmployeeNo).ToList();
                        if (model != null && model.Count > 0)
                        {
                            Tmp.Time = model.Select(c => c.updatetime).LastOrDefault();
                            Mylist.Add(Tmp);
                        }
                    }
                    List <string> WorkFlowList = new List <string>();
                    foreach (var item in Mylist)
                    {
                        WorkFlowList.Add(item.Id.ToString());
                    }

                    switch (Type)
                    {
                    //获取所有单据(不分类型)
                    case 0:
                        List <FeeBillModelRef> AllModel = new List <FeeBillModelRef>();
                        var Temp1 = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        var Temp2 = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        var Temp3 = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        var Temp4 = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(EmployeeNo, WorkFlowList);
                        foreach (var item1 in Temp1)
                        {
                            FeeBillModelRef TempModel = new FeeBillModelRef()
                            {
                                BillNo = item1.BillNo, PageName = "费用报销单", Creator = item1.Creator, Owner = item1.Owner, TotalMoney = item1.TotalMoney, StringTime = item1.CreateTime.ToString("yyyy-MM-dd"), CreateTime = item1.CreateTime, PersonInfo = new PersonInfo()
                                {
                                    DepartmentCode = item1.PersonInfo.DepartmentCode, Department = item1.PersonInfo.Department
                                }
                            };
                            var Id = MongoDB.Bson.ObjectId.Parse(item1.WorkFlowID);
                            TempModel.ExamineTime = Mylist.Where(c => c.Id == Id).Select(x => x.Time).FirstOrDefault();
                            AllModel.Add(TempModel);
                        }
                        foreach (var item2 in Temp2)
                        {
                            FeeBillModelRef TempModel = new FeeBillModelRef()
                            {
                                BillNo = item2.BillNo, PageName = "付款通知书", Creator = item2.Creator, Owner = item2.Owner, TotalMoney = item2.TotalMoney, StringTime = item2.CreateTime.ToString("yyyy-MM-dd"), CreateTime = item2.CreateTime, PersonInfo = new PersonInfo()
                                {
                                    DepartmentCode = item2.PersonInfo.DepartmentCode, Department = item2.PersonInfo.Department
                                }
                            };
                            var Id = MongoDB.Bson.ObjectId.Parse(item2.WorkFlowID);
                            TempModel.ExamineTime = Mylist.Where(c => c.Id == Id).Select(x => x.Time).FirstOrDefault();
                            AllModel.Add(TempModel);
                        }
                        foreach (var item3 in Temp3)
                        {
                            FeeBillModelRef TempModel = new FeeBillModelRef()
                            {
                                BillNo = item3.BillNo, PageName = "借款单", Creator = item3.Creator, Owner = item3.Owner, TotalMoney = item3.TotalMoney, StringTime = item3.CreateTime.ToString("yyyy-MM-dd"), CreateTime = item3.CreateTime, PersonInfo = new PersonInfo()
                                {
                                    DepartmentCode = item3.PersonInfo.DepartmentCode, Department = item3.PersonInfo.Department
                                }
                            };
                            var Id = MongoDB.Bson.ObjectId.Parse(item3.WorkFlowID);
                            TempModel.ExamineTime = Mylist.Where(c => c.Id == Id).Select(x => x.Time).FirstOrDefault();
                            AllModel.Add(TempModel);
                        }
                        foreach (var item4 in Temp4)
                        {
                            FeeBillModelRef TempModel = new FeeBillModelRef()
                            {
                                BillNo = item4.BillNo, PageName = item4.RefundType.ToUpper() == "CASH" ? "现金还款" : "费用单还款", Creator = item4.Creator, Owner = item4.Owner, TotalMoney = item4.RealRefundMoney, StringTime = item4.CreateTime.ToString("yyyy-MM-dd"), CreateTime = item4.CreateTime, PersonInfo = new PersonInfo()
                                {
                                    DepartmentCode = item4.PersonInfo.DepartmentCode, Department = item4.PersonInfo.Department
                                }
                            };
                            var Id = MongoDB.Bson.ObjectId.Parse(item4.WorkFlowID);
                            TempModel.ExamineTime = Mylist.Where(c => c.Id == Id).Select(x => x.Time).FirstOrDefault();
                            AllModel.Add(TempModel);
                        }
                        if (departmentID == "0")
                        {
                            AllModel = AllModel.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            AllModel = AllModel.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }

                        return(AllModel.OrderByDescending(c => c.ExamineTime).ToList());

                    //未审批的费用报销单
                    case 1:
                        var FeeModel = new Marisfrolg.Fee.BLL.FeeBill().GetMyProcess(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.StringTime  = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName    = "费用报销单";
                            RefModel.ExamineTime = Mylist.Where(c => c.Id == id).Select(x => x.Time).FirstOrDefault();
                            RefList.Add(RefModel);
                        }
                        if (departmentID == "0")
                        {
                            RefList = RefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            RefList = RefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }
                        return(RefList.OrderByDescending(c => c.ExamineTime).ToList());

                    //未审批的付款通知书
                    case 2:
                        var NoticeModel = new Marisfrolg.Fee.BLL.NoticeBill().GetMyProcess(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.StringTime  = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName    = "付款通知书";
                            RefModel.ExamineTime = Mylist.Where(c => c.Id == id).Select(x => x.Time).FirstOrDefault();
                            NoticeRefList.Add(RefModel);
                        }
                        if (departmentID == "0")
                        {
                            NoticeRefList = NoticeRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            NoticeRefList = NoticeRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }
                        return(NoticeRefList.OrderByDescending(c => c.ExamineTime).ToList());

                    //未审批的借款单
                    case 3:
                        var BorrowModel = new Marisfrolg.Fee.BLL.BorrowBill().GetMyProcess(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.StringTime  = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName    = "借款单";
                            RefModel.ExamineTime = Mylist.Where(c => c.Id == id).Select(x => x.Time).FirstOrDefault();
                            BorrowRefList.Add(RefModel);
                        }
                        if (departmentID == "0")
                        {
                            BorrowRefList = BorrowRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            BorrowRefList = BorrowRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }
                        return(BorrowRefList.OrderByDescending(c => c.ExamineTime).ToList());

                    //未审批的借款单
                    case 4:
                        var RefundModel = new Marisfrolg.Fee.BLL.RefundBill().GetMyProcess(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.TotalMoney  = RefModel.RealRefundMoney;
                            RefModel.StringTime  = RefModel.CreateTime.ToString("yyyy-MM-dd");
                            RefModel.PageName    = RefModel.RefundType.ToUpper() == "CASH" ? "现金还款" : "费用单还款";
                            RefModel.ExamineTime = Mylist.Where(c => c.Id == id).Select(x => x.Time).FirstOrDefault();
                            RefundRefList.Add(RefModel);
                        }
                        if (departmentID == "0")
                        {
                            RefundRefList = RefundRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2).ToList();
                        }
                        else
                        {
                            RefundRefList = RefundRefList.Where(c => c.ExamineTime.Date >= TempTime1 && c.ExamineTime.Date <= TempTime2 && c.PersonInfo.DepartmentCode == departmentID).ToList();
                        }
                        return(RefundRefList.OrderBy(c => c.ExamineTime).ToList());

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write("获取我审批过的单据失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return(null);
        }
예제 #4
0
        /// <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("");
        }
예제 #5
0
        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("[]");
        }