Ejemplo n.º 1
0
 /// <summary>
 /// 提交审批(通过/不通过)
 /// </summary>
 /// <param name="BillNo"></param>
 /// <returns></returns>
 public string SubmitWorkFlowList(string AssignmentID, string ActionName, string Remark = "", string ApprovalPost = "", string ActiveID = "")
 {
     try
     {
         var employee = Marisfrolg.Public.Common.GetEmployeeInfo();
         //if ((ApprovalPost.Contains("总经办") || ApprovalPost.Contains("出纳")) && ActionName == "0")
         //{
         //    ActionName = "2";
         //}
         try
         {
             WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
             Dictionary <string, string> dic   = new Dictionary <string, string>();
             dic.Add("Action", ActionName);
             dic.Add("Remark", Remark);
             if (!string.IsNullOrEmpty(ActiveID))
             {
                 dic.Add("NextActivityID", ActiveID);
             }
             proxy.ProcessWorkFlow("", AssignmentID, dic, employee.EmployeeNo);
             return("Yes");
         }
         catch (Exception ex)
         {
             return("");
         }
     }
     catch (Exception ex)
     {
         Logger.Write("提交审批失败:" + ex.ToString() + "," + System.Reflection.MethodBase.GetCurrentMethod().Name);
     }
     return("");
 }
Ejemplo n.º 2
0
        /// <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("");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 提供给修改流程人员的接口
        /// </summary>
        /// <param name="BillNo"></param>
        /// <param name="Type"></param>
        /// <param name="WorkFlowID"></param>
        /// <returns></returns>
        public string GetTransferData(string BillNo, out string WorkFlowID)
        {
            string Object_id = string.Empty;

            if (BillNo.Contains("FB"))
            {
                WorkFlowID = MongoDBHelper.FeeBill.Find(c => c.BillNo == BillNo).Project(x => x.WorkFlowID).FirstOrDefault();
                if (string.IsNullOrEmpty(WorkFlowID))
                {
                    WorkFlowID = MongoDBHelper.RefundBill.Find(c => c.BillNo == BillNo).Project(x => x.WorkFlowID).FirstOrDefault();
                }
            }
            else if (BillNo.Contains("FT"))
            {
                WorkFlowID = MongoDBHelper.NoticeBill.Find(c => c.BillNo == BillNo).Project(x => x.WorkFlowID).FirstOrDefault();
            }
            else if (BillNo.Contains("JS"))
            {
                WorkFlowID = MongoDBHelper.BorrowBill.Find(c => c.BillNo == BillNo).Project(x => x.WorkFlowID).FirstOrDefault();
            }
            else
            {

                WorkFlowID = MongoDBHelper.RefundBill.Find(c => c.BillNo == BillNo).Project(x => x.WorkFlowID).FirstOrDefault();
            }

            WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
            List<WorkFlowEngine.WorkFlowTable> model = proxy.GetWorkFlowTable(WorkFlowID);

            var St_1 = model.Where(c => c.ActivityStatus == "1").FirstOrDefault();
            if (St_1 != null)
            {
                var St_2 = St_1.TableLinkList.Where(c => c.UserList.Count > 0).FirstOrDefault();
                if (St_2 != null)
                {
                    Object_id = St_2.UserList[0]._id.ToString();
                }
            }
            return Object_id;
        }
Ejemplo n.º 4
0
        public string CreateRefundBill(RefundBillModel postRefundBill)
        {
            this.Request.Url.AbsoluteUri.ToString();
            string result = "Fail";
            //费用报销单还款

            var obj = GetBrandFromCosterCenterNew(postRefundBill.PersonInfo.CostCenter);

            if (postRefundBill.RefundType.ToUpper() == "FEEBILL")
            {
                //检查
                if (string.IsNullOrEmpty(postRefundBill.COST_ACCOUNT))
                {
                    result = "成本中心为空";
                    return(result);
                }

                if (postRefundBill.Items == null || postRefundBill.Items.Count < 1)
                {
                    result = "缺少报销项";
                    return(result);
                }
                else
                {
                    postRefundBill.RealRefundMoney = postRefundBill.Items.Sum(all => all.money) + postRefundBill.Items.Sum(all => all.taxmoney);
                }
                if (postRefundBill.Photos == null || postRefundBill.Photos.Count < 1)
                {
                    result = "缺少发票照片";
                    return(result);
                }

                foreach (var item in postRefundBill.Items)
                {
                    var value = DbContext.FEE_ACCOUNT.Where(c => c.NAME == item.name || c.OLDNAME == item.name).Select(c => c.IS_MARKET).FirstOrDefault();
                    if (value == null)
                    {
                        item.IsMarket = 0;
                    }
                    else
                    {
                        item.IsMarket = Convert.ToInt32(item.IsMarket);
                    }
                }

                if (postRefundBill.PersonInfo.IsHeadOffice == 0)
                {
                    var DicModel = DbContext.FEE_ACCOUNT_DICTIONARY.Where(c => c.CODE == postRefundBill.BillsType && c.BRAND == obj.NAME).FirstOrDefault();
                    if (DicModel != null)
                    {
                        if (DicModel.PARTBRAND == 1)
                        {
                            if (postRefundBill.PersonInfo.Brand == null || postRefundBill.PersonInfo.Brand.Count < 1)
                            {
                                result = "记账品牌至少选择一项!";
                                return(result);
                            }
                            int brandcount = 0;
                            foreach (var item in postRefundBill.PersonInfo.Brand)
                            {
                                if (DicModel.BRANDLIST.Contains(item))
                                {
                                    brandcount++;
                                }
                            }
                            if (brandcount >= 2)
                            {
                                result = DicModel.BRANDLIST + "只能选择一项!";
                                return(result);
                            }
                        }
                    }

                    //增加店柜品牌属性
                    if (!string.IsNullOrEmpty(postRefundBill.PersonInfo.ShopCode))
                    {
                        postRefundBill.ShopLogo = DbContext.SHOP.Where(c => c.CODE == postRefundBill.PersonInfo.ShopCode).Select(x => x.SHOPLOGO).FirstOrDefault();
                    }
                }
            }
            //现金还款
            else
            {
                if (postRefundBill.RealRefundMoney < 0)
                {
                    result = "还款金额错误";
                    return(result);
                }
            }
            try
            {
                var BorrowModel = new BorrowBill().GetBillModel(postRefundBill.BorrowBillNo);
                //费用还款可以还款超出欠款额度,只须拆成两单
                if (postRefundBill.RealRefundMoney > BorrowModel.SurplusMoney && postRefundBill.RefundType.ToUpper() != "FEEBILL")
                {
                    result = "还款金额超出";
                    return(result);
                }
                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();

                string MaxNumber = string.Empty;

                if (postRefundBill.RefundType.ToUpper() == "CASH")
                {
                    postRefundBill.BillsType = "HK1";
                    MaxNumber = new RefundBill().GenerateMaxBillNo();
                }
                else
                {
                    MaxNumber = new FeeBill().GenerateMaxBillNo();
                }

                var lable = PublicDemand(postRefundBill.PersonInfo.IsHeadOffice, postRefundBill.BillsType, postRefundBill.PersonInfo.DepartmentCode, obj, postRefundBill.Items, postRefundBill.SpecialAttribute, postRefundBill.DepartmentName);

                //PackClass PackString = new PackClass() { Creator = postRefundBill.Creator, BillsType = postRefundBill.BillsType, Brand = postRefundBill.PersonInfo.Brand, CompanyCode = postRefundBill.PersonInfo.CompanyCode, CostCenter = postRefundBill.PersonInfo.CostCenter, Department = postRefundBill.PersonInfo.Department, DepartmentCode = postRefundBill.PersonInfo.DepartmentCode, IsHeadOffice = postRefundBill.PersonInfo.IsHeadOffice, Items = postRefundBill.Items == null ? null : postRefundBill.Items.Select(x => x.name).ToList() };

                //Dictionary<string, string> dic = new Dictionary<string, string>();

                //string pack = Public.JsonSerializeHelper.SerializeToJson(PackString);

                //dic.Add("pack", pack);

                //string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                Dictionary <string, string> dic = new Dictionary <string, string>();
                string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                try
                {
                    string sql = " insert into FEE_BILLNO (BILLNO) values('" + MaxNumber + "')";
                    int    num = DbContext.Database.ExecuteSqlCommand(sql);
                    if (num < 1)
                    {
                        DeleteInvalidBillNo(MaxNumber);
                        result = "服务器繁忙!请重新提交";
                        return(result);
                    }
                }
                catch
                {
                    result = "服务器繁忙!请重新提交";
                    return(result);
                }

                string objectID = string.Empty;

                try
                {
                    objectID = proxy.NewWorkFlowInstance(lable.CODE, postRefundBill.Creator, MaxNumber, dicString);
                }
                catch
                {
                    DeleteInvalidBillNo(MaxNumber);
                    result = "服务内部出错,请联系数控中心";
                    return(result);
                }

                postRefundBill.CreateTime = DateTime.Now;
                postRefundBill.Status     = 0;
                postRefundBill.WorkFlowID = objectID;
                postRefundBill.BillsItems = postRefundBill.Items;
                postRefundBill.BillNo     = MaxNumber;

                new RefundBill().CreateRefundBill(postRefundBill);

                result = MaxNumber;
            }
            catch
            {
                result = "Fail";
            }


            return(result);
        }
Ejemplo n.º 5
0
        public string EditRefundBillContent(RefundBillModel postRefundBill)
        {
            this.Request.Url.AbsoluteUri.ToString();
            string result = "Fail";
            var    obj    = GetBrandFromCosterCenterNew(postRefundBill.PersonInfo.CostCenter);

            if (postRefundBill.RefundType.ToUpper() == "FEEBILL")
            {
                if (string.IsNullOrEmpty(postRefundBill.COST_ACCOUNT))
                {
                    result = "成本中心为空";
                    return(result);
                }

                if (postRefundBill.Items == null || postRefundBill.Items.Count < 1)
                {
                    result = "缺少报销项";
                    return(result);
                }
                else
                {
                    postRefundBill.RealRefundMoney = postRefundBill.Items.Sum(all => all.money) + postRefundBill.Items.Sum(all => all.taxmoney);
                }
                if (postRefundBill.Photos == null || postRefundBill.Photos.Count < 1)
                {
                    result = "缺少发票照片";
                    return(result);
                }

                var DicModel = DbContext.FEE_ACCOUNT_DICTIONARY.Where(c => c.CODE == postRefundBill.BillsType && c.BRAND == obj.NAME).FirstOrDefault();
                if (postRefundBill.PersonInfo.IsHeadOffice == 0)
                {
                    if (DicModel != null)
                    {
                        if (DicModel.PARTBRAND == 1)
                        {
                            if (postRefundBill.PersonInfo.Brand == null || postRefundBill.PersonInfo.Brand.Count < 1)
                            {
                                result = "记账品牌至少选择一项!";
                                return(result);
                            }
                            int brandcount = 0;
                            foreach (var item in postRefundBill.PersonInfo.Brand)
                            {
                                if (DicModel.BRANDLIST.Contains(item))
                                {
                                    brandcount++;
                                }
                            }
                            if (brandcount >= 2)
                            {
                                result = DicModel.BRANDLIST + "只能选择一项!";
                                return(result);
                            }
                        }
                    }
                }
            }
            //现金还款
            else
            {
                if (postRefundBill.RealRefundMoney < 0)
                {
                    result = "还款金额错误";
                    return(result);
                }
            }
            try
            {
                var BorrowModel = new BorrowBill().GetBillModel(postRefundBill.BorrowBillNo);
                //费用还款可以还款超出欠款额度,只须拆成两单
                if (postRefundBill.RealRefundMoney > BorrowModel.SurplusMoney && postRefundBill.RefundType.ToUpper() != "FEEBILL")
                {
                    result = "还款金额超出";
                    return(result);
                }

                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                if (postRefundBill.RefundType.ToUpper() == "CASH")
                {
                    postRefundBill.BillsType = "HK1";
                }

                var lable = PublicDemand(postRefundBill.PersonInfo.IsHeadOffice, postRefundBill.BillsType, postRefundBill.PersonInfo.DepartmentCode, obj, postRefundBill.Items, postRefundBill.SpecialAttribute, postRefundBill.DepartmentName);

                Dictionary <string, string> dic = new Dictionary <string, string>();

                string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                var    oldModel = new RefundBill().GetBillModel(postRefundBill.BillNo);
                string objectID = proxy.NewWorkFlowInstance(lable.CODE, postRefundBill.Creator, oldModel.BillNo, dicString);


                postRefundBill.BillNo         = oldModel.BillNo;
                postRefundBill.Id             = oldModel.Id;
                postRefundBill.WorkFlowID     = objectID;
                postRefundBill.CreateTime     = oldModel.CreateTime;
                postRefundBill.Status         = oldModel.Status;
                postRefundBill.ApprovalPost   = oldModel.ApprovalPost;
                postRefundBill.ApprovalStatus = oldModel.ApprovalStatus;
                postRefundBill.ApprovalTime   = oldModel.ApprovalTime;
                postRefundBill.BillsItems     = postRefundBill.Items;

                string status = new RefundBill().EditRefundBill(postRefundBill);
                if (status != "Success")
                {
                    result = "编辑失败";
                    return(result);
                }

                result = "Success";
            }
            catch
            {
                result = "Fail";
            }


            return(result);
        }
Ejemplo n.º 6
0
        public string CreateNoticeBill(NoticeBillModel postbill)
        {
            this.Request.Url.AbsoluteUri.ToString();

            string result = "Fail";

            //检查
            if (string.IsNullOrEmpty(postbill.COST_ACCOUNT))
            {
                result = "成本中心为空";
                return(result);
            }

            if (postbill.Items == null || postbill.Items.Count < 1)
            {
                result = "缺少报销项";
                return(result);
            }
            else
            {
                postbill.TotalMoney = postbill.Items.Sum(all => all.money) + postbill.Items.Sum(all => all.taxmoney);
            }
            if (postbill.Photos == null || postbill.Photos.Count < 1)
            {
                result = "缺少发票照片";
                return(result);
            }
            if (postbill.ProviderInfo == null || string.IsNullOrEmpty(postbill.ProviderInfo.BankName) || string.IsNullOrEmpty(postbill.ProviderInfo.BankNo) || string.IsNullOrEmpty(postbill.ProviderInfo.ProviderName))
            {
                result = "供应商信息缺失";
                return(result);
            }

            int Grade = GetSubjectCode(postbill.PersonInfo.CompanyCode, postbill.ProviderInfo.ProviderName);

            if (Grade != 3)
            {
                //验证支行的准确性
                var ResultInfo = GetSubbranchBankCode(postbill.ProviderInfo.BankName);
                if (string.IsNullOrEmpty(ResultInfo))
                {
                    result = "支行数据错误,输入关键地名选择提示支行勿手工录入";
                    return(result);
                }
                postbill.ProviderInfo.SubbranchBankCode = ResultInfo;
            }

            foreach (var item in postbill.Items)
            {
                var value = DbContext.FEE_ACCOUNT.Where(c => c.NAME == item.name || c.OLDNAME == item.name).Select(c => c.IS_MARKET).FirstOrDefault();
                if (value == null)
                {
                    item.IsMarket = 0;
                }
                else
                {
                    item.IsMarket = Convert.ToInt32(item.IsMarket);
                }
            }

            var obj = GetBrandFromCosterCenterNew(postbill.PersonInfo.CostCenter);

            if (postbill.PersonInfo.IsHeadOffice == 0)
            {
                var DicModel = DbContext.FEE_ACCOUNT_DICTIONARY.Where(c => c.CODE == postbill.BillsType && c.BRAND == obj.NAME).FirstOrDefault();
                if (DicModel != null)
                {
                    if (DicModel.PARTBRAND == 1)  //分品牌
                    {
                        if (postbill.PersonInfo.Brand == null || postbill.PersonInfo.Brand.Count < 1)
                        {
                            result = "记账品牌至少选择一项!";
                            return(result);
                        }
                        int brandcount = 0;
                        foreach (var item in postbill.PersonInfo.Brand)
                        {
                            if (DicModel.BRANDLIST.Contains(item))
                            {
                                brandcount++;
                            }
                        }
                        if (brandcount >= 2)
                        {
                            result = DicModel.BRANDLIST + "只能选择一项!";
                            return(result);
                        }
                    }
                }

                //增加店柜品牌属性
                if (!string.IsNullOrEmpty(postbill.PersonInfo.ShopCode))
                {
                    postbill.ShopLogo = DbContext.SHOP.Where(c => c.CODE == postbill.PersonInfo.ShopCode).Select(x => x.SHOPLOGO).FirstOrDefault();
                }
            }
            try
            {
                SpecialAttribute Spe = new SpecialAttribute()
                {
                    Funds = postbill.SpecialAttribute.Funds, Agent = postbill.SpecialAttribute.Agent, Check = postbill.SpecialAttribute.Check
                };

                var lable = PublicDemand(postbill.PersonInfo.IsHeadOffice, postbill.BillsType, postbill.PersonInfo.DepartmentCode, obj, postbill.Items, Spe, postbill.DepartmentName);


                //PackClass PackString = new PackClass() { Creator = postbill.Creator, BillsType = postbill.BillsType, Brand = postbill.PersonInfo.Brand, CompanyCode = postbill.PersonInfo.CompanyCode, CostCenter = postbill.PersonInfo.CostCenter, Department = postbill.PersonInfo.Department, DepartmentCode = postbill.PersonInfo.DepartmentCode, IsHeadOffice = postbill.PersonInfo.IsHeadOffice, Items = postbill.Items.Select(x => x.name).ToList(), IsUrgent = postbill.IsUrgent };

                //Dictionary<string, string> dic = new Dictionary<string, string>();

                //string pack = Public.JsonSerializeHelper.SerializeToJson(PackString);

                //dic.Add("pack", pack);

                //string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                Dictionary <string, string> dic = new Dictionary <string, string>();
                string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                string MaxNumber = new NoticeBill().GenerateMaxBillNo();



                try
                {
                    string sql = " insert into FEE_BILLNO (BILLNO) values('" + MaxNumber + "')";
                    int    num = DbContext.Database.ExecuteSqlCommand(sql);
                    if (num < 1)
                    {
                        DeleteInvalidBillNo(MaxNumber);
                        result = "服务器繁忙!请重新提交";
                        return(result);
                    }
                }
                catch
                {
                    result = "服务器繁忙!请重新提交";
                    return(result);
                }

                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                string objectID = string.Empty;
                try
                {
                    objectID = proxy.NewWorkFlowInstance(lable.CODE, postbill.Creator, MaxNumber, dicString);
                }
                catch
                {
                    DeleteInvalidBillNo(MaxNumber);
                    result = "服务内部出错,请联系数控中心";
                    return(result);
                }

                CommitPorviderInfo(postbill.ProviderInfo, postbill.Creator);
                postbill.CreateTime = DateTime.Now;
                postbill.Status     = 0;
                postbill.WorkFlowID = objectID;
                postbill.BillsItems = postbill.Items;
                postbill.BillNo     = MaxNumber;
                new NoticeBill().CreateNoticeBill(postbill);
                result = MaxNumber;
            }
            catch
            {
                result = "Fail";
            }
            return(result);
        }
Ejemplo n.º 7
0
        public string EditNoticeBillContent(NoticeBillModel postbill)
        {
            this.Request.Url.AbsoluteUri.ToString();

            string result = "Fail";

            if (string.IsNullOrEmpty(postbill.COST_ACCOUNT))
            {
                result = "成本中心为空";
                return(result);
            }

            if (postbill.Items == null || postbill.Items.Count < 1)
            {
                result = "缺少报销项";
                return(result);
            }
            else
            {
                postbill.TotalMoney = postbill.Items.Sum(all => all.money) + postbill.Items.Sum(all => all.taxmoney);
            }
            if (postbill.Photos == null || postbill.Photos.Count < 1)
            {
                result = "缺少发票照片";
                return(result);
            }
            if (postbill.ProviderInfo == null || string.IsNullOrEmpty(postbill.ProviderInfo.BankName) || string.IsNullOrEmpty(postbill.ProviderInfo.BankNo) || string.IsNullOrEmpty(postbill.ProviderInfo.ProviderName))
            {
                result = "供应商信息缺失";
                return(result);
            }
            int Grade = GetSubjectCode(postbill.PersonInfo.CompanyCode, postbill.ProviderInfo.ProviderName);

            if (Grade != 3)
            {
                //验证支行的准确性
                var ResultInfo = GetSubbranchBankCode(postbill.ProviderInfo.BankName);
                if (string.IsNullOrEmpty(ResultInfo))
                {
                    result = "支行数据错误,输入关键地名选择提示支行勿手工录入";
                    return(result);
                }
                postbill.ProviderInfo.SubbranchBankCode = ResultInfo;
            }

            var obj = GetBrandFromCosterCenterNew(postbill.PersonInfo.CostCenter);

            if (postbill.PersonInfo.IsHeadOffice == 0)
            {
                var DicModel = DbContext.FEE_ACCOUNT_DICTIONARY.Where(c => c.CODE == postbill.BillsType && c.BRAND == obj.NAME).FirstOrDefault();
                if (DicModel != null)
                {
                    if (DicModel.PARTBRAND == 1)  //分品牌
                    {
                        if (postbill.PersonInfo.Brand == null || postbill.PersonInfo.Brand.Count < 1)
                        {
                            result = "记账品牌至少选择一项!";
                            return(result);
                        }
                        int brandcount = 0;
                        foreach (var item in postbill.PersonInfo.Brand)
                        {
                            if (DicModel.BRANDLIST.Contains(item))
                            {
                                brandcount++;
                            }
                        }
                        if (brandcount >= 2)
                        {
                            result = DicModel.BRANDLIST + "只能选择一项!";
                            return(result);
                        }
                    }
                }
            }
            try
            {
                SpecialAttribute Spe = new SpecialAttribute()
                {
                    Funds = postbill.SpecialAttribute.Funds, Agent = postbill.SpecialAttribute.Agent, Check = postbill.SpecialAttribute.Check
                };

                var lable = PublicDemand(postbill.PersonInfo.IsHeadOffice, postbill.BillsType, postbill.PersonInfo.DepartmentCode, obj, postbill.Items, Spe, postbill.DepartmentName);

                Dictionary <string, string> dic = new Dictionary <string, string>();

                string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                var oldModel = new NoticeBill().GetBillModel(postbill.BillNo);
                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                string objectID = proxy.NewWorkFlowInstance(lable.CODE, postbill.Creator, oldModel.BillNo, dicString);

                CommitPorviderInfo(postbill.ProviderInfo, postbill.Creator);


                postbill.BillNo         = oldModel.BillNo;
                postbill.Id             = oldModel.Id;
                postbill.WorkFlowID     = objectID;
                postbill.CreateTime     = oldModel.CreateTime;
                postbill.Status         = oldModel.Status;
                postbill.ApprovalPost   = oldModel.ApprovalPost;
                postbill.ApprovalStatus = oldModel.ApprovalStatus;
                postbill.ApprovalTime   = oldModel.ApprovalTime;
                postbill.BillsItems     = postbill.Items;

                string status = new NoticeBill().EditNoticeBill(postbill);
                if (status != "Success")
                {
                    result = "编辑失败";
                    return(result);
                }

                result = "Success";
            }
            catch
            {
                result = "Fail";
            }
            return(result);
        }
Ejemplo n.º 8
0
        public string EditFeeBillContent(FeeBillModel postFeeBill)
        {
            this.Request.Url.AbsoluteUri.ToString();

            string result = "Fail";

            //检查
            if (string.IsNullOrEmpty(postFeeBill.COST_ACCOUNT))
            {
                result = "成本中心为空";
                return(result);
            }

            if (postFeeBill.Items == null || postFeeBill.Items.Count < 1)
            {
                result = "缺少报销项";
                return(result);
            }
            else
            {
                postFeeBill.TotalMoney = postFeeBill.Items.Sum(all => all.money) + postFeeBill.Items.Sum(all => all.taxmoney);
            }
            if (postFeeBill.Photos == null || postFeeBill.Photos.Count < 1)
            {
                result = "缺少发票照片";
                return(result);
            }
            if (postFeeBill.SpecialAttribute.MarketDebt != 1 && postFeeBill.SpecialAttribute.BankDebt != 1 && postFeeBill.SpecialAttribute.Cash != 1)
            {
                if (postFeeBill.CollectionInfo == null || string.IsNullOrEmpty(postFeeBill.CollectionInfo.CardCode) || string.IsNullOrEmpty(postFeeBill.CollectionInfo.Name) || string.IsNullOrEmpty(postFeeBill.CollectionInfo.SubbranchBank) || string.IsNullOrEmpty(postFeeBill.CollectionInfo.SubbranchBankCode))
                {
                    result = "收款信息缺失";
                    return(result);
                }
            }
            else
            {
                postFeeBill.CollectionInfo = new CollectionInfo();
            }


            var obj = PublicGetCosterCenter(postFeeBill.PersonInfo.IsHeadOffice, postFeeBill.PersonInfo.CostCenter);

            if (postFeeBill.PersonInfo.IsHeadOffice == 0)
            {
                var DicModel = DbContext.FEE_ACCOUNT_DICTIONARY.Where(c => c.CODE == postFeeBill.BillsType && c.BRAND == obj.NAME).FirstOrDefault();
                if (DicModel != null)
                {
                    if (DicModel.PARTBRAND == 1)  //分品牌
                    {
                        if (postFeeBill.PersonInfo.Brand == null || postFeeBill.PersonInfo.Brand.Count < 1)
                        {
                            result = "记账品牌至少选择一项!";
                            return(result);
                        }
                        int brandcount = 0;
                        foreach (var item in postFeeBill.PersonInfo.Brand)
                        {
                            if (DicModel.BRANDLIST.Contains(item))
                            {
                                brandcount++;
                            }
                        }
                        if (brandcount >= 2)
                        {
                            result = DicModel.BRANDLIST + "只能选择一项!";
                            return(result);
                        }
                    }
                }
            }
            try
            {
                var lable = PublicDemand(postFeeBill.PersonInfo.IsHeadOffice, postFeeBill.BillsType, postFeeBill.PersonInfo.DepartmentCode, obj, postFeeBill.Items, postFeeBill.SpecialAttribute, postFeeBill.DepartmentName);

                Dictionary <string, string> dic = new Dictionary <string, string>();

                string dicString = Public.JsonSerializeHelper.SerializeToJson(dic);

                var oldModel = new FeeBill().GetBillModel(postFeeBill.BillNo);
                WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                string objectID = proxy.NewWorkFlowInstance(lable.CODE, postFeeBill.Creator, oldModel.BillNo, dicString);

                postFeeBill.BillNo         = oldModel.BillNo;
                postFeeBill.Id             = oldModel.Id;
                postFeeBill.WorkFlowID     = objectID;
                postFeeBill.CreateTime     = oldModel.CreateTime;
                postFeeBill.Status         = oldModel.Status;
                postFeeBill.ApprovalPost   = oldModel.ApprovalPost;
                postFeeBill.ApprovalStatus = oldModel.ApprovalStatus;
                postFeeBill.ApprovalTime   = oldModel.ApprovalTime;
                postFeeBill.BillsItems     = postFeeBill.Items;


                string status = new FeeBill().EditFeeBill(postFeeBill);
                if (status != "Success")
                {
                    result = "编辑失败";
                    return(result);
                }
                result = "Success";
            }
            catch
            {
                result = "Fail";
            }


            return(result);
        }
Ejemplo n.º 9
0
        public List<FlowInstance> GetWorkFlowListPlus(string BillNo, int Type)
        {
            string WorkFlowID = "";
            try
            {
                switch (Type)
                {
                    //费用报销单
                    case 1:
                        WorkFlowID = MongoDBHelper.FeeBill.Find(c => c.BillNo == BillNo).Project(x => x.WorkFlowID).Single();
                        break;
                    //付款通知书
                    case 2:
                        WorkFlowID = MongoDBHelper.NoticeBill.Find(c => c.BillNo == BillNo).Project(x => x.WorkFlowID).Single();
                        break;
                    //借款单
                    case 3:
                        WorkFlowID = MongoDBHelper.BorrowBill.Find(c => c.BillNo == BillNo).Project(x => x.WorkFlowID).Single();
                        break;
                    //还款单 
                    case 4:
                        WorkFlowID = MongoDBHelper.RefundBill.Find(c => c.BillNo == BillNo).Project(x => x.WorkFlowID).Single();
                        break;
                    default:
                        break;
                }

                List<FlowInstance> Instance = new List<FlowInstance>();
                if (!string.IsNullOrEmpty(WorkFlowID))
                {
                    #region 旧方法
                    #endregion

                    //ActivityStatus节点状态: 0初始化,1开始,2结束
                    //LinkKeyword  任务分配的关键词  0:拒绝   1:同意    2:驳回    3:初始化    4:null   (按钮的显示)
                    //AssignmentKeyword   操作状态  0初始化 1结束 
                    //Status   0拒绝 1同意 2驳回
                    WorkFlowProxy.WorkFlowProxy proxy = new WorkFlowProxy.WorkFlowProxy();
                    List<WorkFlowEngine.WorkFlowTable> model = proxy.GetWorkFlowTable(WorkFlowID);
                    if (model != null && model.Count > 0)
                    {
                        foreach (var item in model)
                        {
                            FlowInstance SingeModel = new FlowInstance();
                            if (item.Name != "开始" && item.Name != "结束" && item.Name != "重新提交")
                            {
                                SingeModel.Description = item.Name;
                                SingeModel.PersonName = new List<string>();
                                SingeModel.KeyWord = new List<int>();
                                SingeModel.StringTime = new List<string>();
                                SingeModel.Remark = "";
                                SingeModel.AuditList = new List<string>();
                                if (item.ActivityStatus == "2" || (item.ActivityStatus == "1" && item.TableLinkList.Where(c => c.UserList.Where(p => p.Status == "2" || p.Status == "1") != null) != null))
                                {
                                    if (item.TableLinkList != null && item.TableLinkList.Count > 0)
                                    {
                                        SingeModel.ActiveID = item.ActivityID;

                                        foreach (var item1 in item.TableLinkList)
                                        {
                                            if (!string.IsNullOrEmpty(item1.AssignmentKeyword) && item1.AssignmentKeyword == "1")
                                            {
                                                if (item1.UserList != null && item1.UserList.Count > 0)
                                                {
                                                    foreach (var item2 in item1.UserList)
                                                    {
                                                        SingeModel.PersonName.Add(item2.UserCode);
                                                        SingeModel.KeyWord.Add(Convert.ToInt32(item2.Status));
                                                        SingeModel.StringTime.Add(item2.DateTime.ToString("yyyy-MM-dd"));
                                                        SingeModel.Remark = item2.Remark;
                                                    }
                                                }
                                            }
                                            else if (!string.IsNullOrEmpty(item1.AssignmentKeyword) && item1.AssignmentKeyword == "0")
                                            {
                                                if (item1.UserList != null && item1.UserList.Count > 0)
                                                {
                                                    foreach (var item2 in item1.UserList)
                                                    {
                                                        if (item2.Status == "1" || item2.Status == "2")
                                                        {
                                                            SingeModel.PersonName.Add(item2.UserCode);
                                                            SingeModel.KeyWord.Add(Convert.ToInt32(item2.Status));
                                                            SingeModel.StringTime.Add(item2.DateTime.ToString("yyyy-MM-dd"));
                                                            SingeModel.Remark = item2.Remark;
                                                        }
                                                        if (item2.Status == "3")
                                                        {
                                                            SingeModel.AuditList.Add(item2.UserCode);
                                                        }
                                                        SingeModel.NodeState = item.ActivityStatus;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                Instance.Add(SingeModel);
                            }
                        }
                    }
                }
                return Instance;
            }
            catch (Exception ex)
            {
                Marisfrolg.Public.Logger.Write("获取列表数据失败:" + ex.ToString() + "," + string.Format("WorkFlowID为:{0},BillNo为{1},type为:{2}", WorkFlowID, BillNo, Type));
            }
            return null;
        }
Ejemplo n.º 10
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("");
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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("[]");
        }