Beispiel #1
0
 public string SaveHXreturn([FromBody] ExpenseAllRequestModel ExpenseAllData)
 {
     if (ExpenseAllData.ExpenseMst == null || ExpenseAllData.ExpenseMst.PhId == 0)
     {
         return(DCHelper.ErrorMessage("参数传递有误!"));
     }
     try
     {
         CommonResult savedresult = new CommonResult();
         savedresult = ExpenseMstService.SaveHXreturn(ExpenseAllData.ExpenseMst.PhId, ExpenseAllData.ExpenseMst.FPlayamount);
         return(DataConverterHelper.SerializeObject(savedresult));
     }
     catch (Exception ex)
     {
         return(DCHelper.ErrorMessage(ex.Message));
     }
 }
        public string GetBudgetProcessCtrl([FromUri] ProjectMstModel param)
        {
            if (string.IsNullOrEmpty(param.FDeclarationUnit))
            {
                return(DCHelper.ErrorMessage("申报单位为空!"));
            }
            if (string.IsNullOrEmpty(param.FBudgetDept))
            {
                return(DCHelper.ErrorMessage("预算部门为空!"));
            }
            if (string.IsNullOrEmpty(param.FYear))
            {
                return(DCHelper.ErrorMessage("年度为空!"));
            }

            var processStatus = BudgetProcessCtrlService.FindBudgetProcessCtrl(param.FDeclarationUnit, param.FBudgetDept, param.FYear);

            return(DataConverterHelper.SerializeObject(processStatus));
        }
Beispiel #3
0
        public string GetGHSubjectInfo([FromUri] GHSubjectRequestModel param)
        {
            if (param.PhId == 0)
            {
                return(DCHelper.ErrorMessage("主键不能为空!"));
            }
            try
            {
                //主表主键
                string tabtype = param.tabtype; //Tab类型
                switch (tabtype)
                {
                case "ghsubject":
                    var findedresultghsubject = GHSubjectService.Find(param.PhId);
                    return(DataConverterHelper.SerializeObject(findedresultghsubject));

                case "subjectmst":
                    var findedresultsubjectmst = GHSubjectService.FindSubjectMstByForeignKey(param.PhId);
                    foreach (var item in findedresultsubjectmst.Data)
                    {
                        if (!string.IsNullOrEmpty(item.FProjCode) || !string.IsNullOrEmpty(item.FProjName))
                        {
                            item.FSubjectCode = "";
                            item.FSubjectName = "";
                        }
                    }
                    return(DCHelper.ModelListToJson <SubjectMstModel>(findedresultsubjectmst.Data, findedresultsubjectmst.Data.Count));

                case "subjectmstbudgetdtl":
                    var findedresultsubjectmstbudgetdtl = GHSubjectService.FindSubjectMstBudgetDtlByForeignKey(param.PhId);
                    return(DCHelper.ModelListToJson <SubjectMstBudgetDtlModel>(findedresultsubjectmstbudgetdtl.Data, findedresultsubjectmstbudgetdtl.Data.Count));

                default:
                    Common.Model.Results.FindedResult findedresultother = new Common.Model.Results.FindedResult();
                    return(DataConverterHelper.SerializeObject(findedresultother));
                }
            }
            catch (Exception ex)
            {
                return(DCHelper.ErrorMessage(ex.Message));
            }
        }
        public string GetBudgetProcessCtrlDistinctList([FromUri] BudgetProcessCtrlRequestModel param)
        {
            if (string.IsNullOrEmpty(param.UserId))
            {
                return(DCHelper.ErrorMessage("用户编码不能为空!"));
            }
            try
            {
                //string query = System.Web.HttpContext.Current.Request.Params["FOcode"];//查询条件
                string query = "";//查询条件
                SUP.Common.DataEntity.DataStoreParam storeparam = new SUP.Common.DataEntity.DataStoreParam();
                var result = BudgetProcessCtrlService.GetBudgetProcessCtrlDistinctList(storeparam, query, param.UserId);

                return(DCHelper.ModelListToJson <BudgetProcessCtrlModel>(result.Results, (Int32)result.TotalItems));
                //return DataConverterHelper.EntityListToJson<BudgetProcessCtrlModel>(result.Results, (Int32)result.TotalItems);
            }
            catch (Exception ex)
            {
                return(DCHelper.ErrorMessage(ex.Message));
            }
        }
Beispiel #5
0
 public string PostSaveHX([FromBody] BaseInfoModel <List <ExpenseHxModel> > param)
 {
     if (param.infoData == null)
     {
         return(DCHelper.ErrorMessage("保存的数据不能为空!"));
     }
     try
     {
         var addinfo    = new List <ExpenseHxModel>();
         var updateinfo = new List <ExpenseHxModel>();
         var deleteinfo = new List <string>();
         foreach (ExpenseHxModel a in param.infoData)
         {
             if (a.PhId == 0)
             {
                 a.PersistentState = PersistentState.Added;
                 addinfo.Add(a);
             }
             else
             {
                 if (a.PersistentState == PersistentState.Deleted)
                 {
                     deleteinfo.Add(a.PhId.ToString());
                 }
                 else
                 {
                     a.PersistentState = PersistentState.Modified;
                     updateinfo.Add(a);
                 }
             }
         }
         CommonResult savedresult = new CommonResult();
         savedresult = ExpenseMstService.SaveHX(addinfo, updateinfo, deleteinfo);
         return(DataConverterHelper.SerializeObject(savedresult));
     }
     catch (Exception ex)
     {
         return(DCHelper.ErrorMessage(ex.Message));
     }
 }
Beispiel #6
0
 public string GetExpenseAllModel([FromUri] ExpenseAllRequestModel param)
 {
     if (param.ExpensePhId == 0)
     {
         return(DCHelper.ErrorMessage("用款计划主键不能为空!"));
     }
     try
     {
         var result = this.ExpenseMstService.GetExpenseAllModel(param.ExpensePhId);
         var data   = new
         {
             Status = ResponseStatus.Success,
             Msg    = "数据获取成功",
             Data   = result
         };
         return(DataConverterHelper.SerializeObject(data));
     }
     catch (Exception ex)
     {
         return(DCHelper.ErrorMessage(ex.Message));
     }
 }
 public string PostUpdateAccountMst([FromBody] BaseInfoModel <YsAccountMstModel> param)
 {
     if (param.infoData == null)
     {
         return(DCHelper.ErrorMessage("参数传递不能修改!"));
     }
     try
     {
         SavedResult <Int64> savedResult = this.YsAccountMstService.UpdateAccountMst(param.infoData);
         if (savedResult != null && savedResult.SaveRows > 0)
         {
             return(DCHelper.SuccessMessage("保存成功!"));
         }
         else
         {
             return(DCHelper.ErrorMessage("保存失败!"));
         }
     }
     catch (Exception ex)
     {
         return(DCHelper.ErrorMessage(ex.Message));
     }
 }
Beispiel #8
0
 public string PostBudget([FromBody] BaseListModel param)
 {
     //if (param.FPhIds == null || param.FPhIds.Count <= 0)
     //{
     //    return DCHelper.ErrorMessage("生成收入预算集合不能为空!");
     //}
     if (param.FPhId == 0)
     {
         return(DCHelper.ErrorMessage("生成预算信息不能为空!"));
     }
     if (param.uid == 0)
     {
         return(DCHelper.ErrorMessage("生成预算人员信息不能为空!"));
     }
     try
     {
         var result = this.YsIncomeMstService.SaveBudget(param.FPhId, param.uid);
         return(DataConverterHelper.SerializeObject(result));
     }
     catch (Exception ex)
     {
         return(DCHelper.ErrorMessage(ex.Message));
     }
 }
Beispiel #9
0
        public string GetYsIncome([FromUri] BaseListModel param)
        {
            if (param.orgid == 0 || string.IsNullOrEmpty(param.orgCode))
            {
                return(DCHelper.ErrorMessage("组织信息不能为空!"));
            }
            if (string.IsNullOrEmpty(param.Year))
            {
                return(DCHelper.ErrorMessage("年度信息不能为空!"));
            }
            try
            {
                //存主信息
                YsIncomeMstModel ysIncomeMst = new YsIncomeMstModel();
                //预算部门集合(收入归属)
                IList <OrganizeModel> organizes = new List <OrganizeModel>();
                organizes = this.YsIncomeMstService.GetAllOrganize();
                //存明细信息
                IList <YsIncomeDtlModel> ysIncomeDtls = new List <YsIncomeDtlModel>();
                var ysIncomeMsts = this.YsIncomeMstService.Find(t => t.FOrgID == param.orgid && t.FYear == param.Year).Data;
                if (ysIncomeMsts != null && ysIncomeMsts.Count > 0)
                {
                    ysIncomeMst  = ysIncomeMsts[0];
                    ysIncomeDtls = this.YsIncomeMstService.FindYsIncomeDtlByForeignKey(ysIncomeMsts[0].PhId).Data;
                }
                else
                {
                    ysIncomeMst.FOrgID   = param.orgid;
                    ysIncomeMst.FOrgcode = param.orgCode;
                    ysIncomeMst.FYear    = param.Year;
                    //预算科目的基本信息
                    IList <BudgetAccountsModel> budgetAccounts = new List <BudgetAccountsModel>();
                    budgetAccounts = this.BudgetAccountsService.Find(t => t.PhId > 0).Data;

                    if (budgetAccounts == null || budgetAccounts.Count <= 0)
                    {
                        return(DCHelper.ErrorMessage("预算科目基础配置信息为空!"));
                    }
                    //获取该组织的所对应的所有预算科目
                    IList <CorrespondenceSettingsModel> correspondenceSettingss = new List <CorrespondenceSettingsModel>();
                    correspondenceSettingss = this.CorrespondenceSettingsService.Find(t => t.Dylx == "02" && t.Dwdm == param.orgid.ToString()).Data;
                    if (correspondenceSettingss != null && correspondenceSettingss.Count > 0)
                    {
                        foreach (var corr in correspondenceSettingss)
                        {
                            YsIncomeDtlModel ysIncomeDtl = new YsIncomeDtlModel();
                            ysIncomeDtl.FSubjectCode   = corr.Dydm;
                            ysIncomeDtl.FSubjectname   = budgetAccounts.ToList().Find(t => t.KMDM == corr.Dydm) == null ? "" : budgetAccounts.ToList().Find(t => t.KMDM == corr.Dydm).KMMC;
                            ysIncomeDtl.FProcessStatus = "";//进度控制暂定
                            ysIncomeDtls.Add(ysIncomeDtl);
                        }
                    }
                    else
                    {
                        return(DCHelper.ErrorMessage("此单位对应的预算科目信息为空!"));
                    }
                }
                if (ysIncomeDtls != null && ysIncomeDtls.Count > 0)
                {
                    foreach (var dtl in ysIncomeDtls)
                    {
                        if (ysIncomeDtls.ToList().Find(t => t.FSubjectCode.StartsWith(dtl.FSubjectCode) && t.FSubjectCode != dtl.FSubjectCode) == null)
                        {
                            dtl.IsLast = 1;
                        }
                        if (organizes != null && organizes.Count > 0)
                        {
                            dtl.FBudgetName = organizes.ToList().Find(t => t.OCode == dtl.FBudgetcode) == null ? "" : organizes.ToList().Find(t => t.OCode == dtl.FBudgetcode).OName;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(param.Search) && ysIncomeDtls != null && ysIncomeDtls.Count > 0)
                {
                    ysIncomeDtls = ysIncomeDtls.ToList().FindAll(t => (t.FSubjectCode.Contains(param.Search) || t.FSubjectname.Contains(param.Search)));
                }
                var data = new
                {
                    Status = ResponseStatus.Success,
                    Msg    = "获取成功!",
                    Mst    = ysIncomeMst,
                    Dtls   = ysIncomeDtls.OrderBy(t => t.FSubjectCode).ToList()
                };
                return(DataConverterHelper.SerializeObject(data));
            }
            catch (Exception ex)
            {
                return(DCHelper.ErrorMessage(ex.Message));
            }
        }
Beispiel #10
0
 public string PostSave([FromBody] AllYsIncomeRequestModel param)
 {
     if (param.YsIncomeMst == null || param.YsIncomeDtls == null || param.YsIncomeDtls.Count <= 0)
     {
         return(DCHelper.ErrorMessage("传递的收入预算信息不能为空!"));
     }
     if (param.orgid == 0 || param.YsIncomeMst.FOrgID == 0)
     {
         return(DCHelper.ErrorMessage("组织信息不能为空!"));
     }
     if (string.IsNullOrEmpty(param.Year) || string.IsNullOrEmpty(param.YsIncomeMst.FYear))
     {
         return(DCHelper.ErrorMessage("年度信息不能为空!"));
     }
     try
     {
         if (param.YsIncomeMst.FApproval != 0 || param.YsIncomeMst.FIsbudget != 0)
         {
             return(DCHelper.ErrorMessage("只有待送审,未生成预算的收入预算可以进行修改!"));
         }
         IList <YsIncomeDtlModel> ysIncomeDtls = new List <YsIncomeDtlModel>();
         //先进行数据调整
         if (param.YsIncomeMst.PhId == 0)
         {
             param.YsIncomeMst.FDeclareTime    = DateTime.Now;
             param.YsIncomeMst.PersistentState = PersistentState.Added;
             foreach (var dtl in param.YsIncomeDtls)
             {
                 if (dtl.PhId == 0)
                 {
                     if (dtl.PersistentState == PersistentState.Deleted)
                     {
                         continue;
                     }
                     dtl.PersistentState = PersistentState.Added;
                 }
                 else
                 {
                     if (dtl.PersistentState != PersistentState.Deleted)
                     {
                         dtl.PersistentState = PersistentState.Modified;
                     }
                 }
                 ysIncomeDtls.Add(dtl);
             }
         }
         else
         {
             param.YsIncomeMst.FDeclareTime = DateTime.Now;
             //没打上删除标记的都是修改
             if (param.YsIncomeMst.PersistentState != PersistentState.Deleted)
             {
                 param.YsIncomeMst.PersistentState = PersistentState.Modified;
                 foreach (var dtl in param.YsIncomeDtls)
                 {
                     if (dtl.PhId == 0)
                     {
                         if (dtl.PersistentState == PersistentState.Deleted)
                         {
                             continue;
                         }
                         dtl.PersistentState = PersistentState.Added;
                     }
                     else
                     {
                         if (dtl.PersistentState != PersistentState.Deleted)
                         {
                             dtl.PersistentState = PersistentState.Modified;
                         }
                     }
                     ysIncomeDtls.Add(dtl);
                 }
             }
             else
             {
                 foreach (var dtl in param.YsIncomeDtls)
                 {
                     if (dtl.PhId == 0)
                     {
                         continue;
                     }
                     dtl.PersistentState = PersistentState.Deleted;
                     ysIncomeDtls.Add(dtl);
                 }
             }
         }
         param.YsIncomeMst.FDeclareAmount = ysIncomeDtls.ToList().FindAll(t => t.PersistentState != PersistentState.Deleted).Sum(t => t.FBudgetamount);
         SavedResult <long> savedResult = new SavedResult <long>();
         savedResult = this.YsIncomeMstService.SaveYsIncome(param.YsIncomeMst, ysIncomeDtls);
         return(DataConverterHelper.SerializeObject(savedResult));
     }
     catch (Exception ex)
     {
         return(DCHelper.ErrorMessage(ex.Message));
     }
 }
        public string GetDescriptionDocx([FromUri] BaseListModel parameter)
        {
            if (parameter == null)
            {
                return(DCHelper.ErrorMessage("请求参数为空!"));
            }

            if (parameter.orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id为空!"));
            }

            if (parameter.uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id为空!"));
            }

            if (String.IsNullOrEmpty(parameter.Year))
            {
                return(DCHelper.ErrorMessage("年度为空!"));
            }
            //value来判断是年初,年中,年末预算说明说
            if (String.IsNullOrEmpty(parameter.value))
            {
                return(DCHelper.ErrorMessage("判断年初,年中,年末的value条件为空!"));
            }
            //查询预算主表对象,获取预算说明书
            string description = "";

            try
            {
                IList <YsAccountMstModel> mstModels = YsAccountMstService.Find(t => t.Orgid == parameter.orgid && t.Uyear == parameter.Year).Data;
                if (mstModels != null && mstModels.Count > 0)
                {
                    if ("1".Equals(parameter.value))
                    {
                        description = mstModels[0].DescriptionStart;
                    }
                    else if ("2".Equals(parameter.value))
                    {
                        description = mstModels[0].DescriptionMiddle;
                    }
                    else if ("3".Equals(parameter.value))
                    {
                        description = mstModels[0].DescriptionEnd;
                    }
                }
                else
                {
                    description = "";
                }
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage("预算主表对象失败!"));
            }

            FileStream fs     = null;
            FileStream output = null;

            try
            {
                string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".docx";
                string filePath = HostingEnvironment.MapPath("~/DownLoadFiles/SubjectBudget");
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                File.Copy(HostingEnvironment.MapPath("~" + "/DownLoadFiles/template/预算说明书.docx"), filePath + "/" + filename, true);

                fs = new FileStream(filePath + "/" + filename, FileMode.Open, FileAccess.Read);

                XWPFDocument document = new XWPFDocument(fs);
                foreach (var para in document.Paragraphs)
                {
                    string oldContext = para.ParagraphText;
                    if (String.IsNullOrEmpty(oldContext))
                    {
                        continue;
                    }
                    string context = para.ParagraphText;
                    if (context.Contains("{$date}"))
                    {
                        context = context.Replace("{$date}", DateTime.Now.ToString("yyyy/MM/dd"));
                    }
                    if (context.Contains("{$content}"))
                    {
                        context = context.Replace("{$content}", description);
                    }

                    if (oldContext != context)
                    {
                        para.ReplaceText(oldContext, context);
                    }
                }
                output = new FileStream(filePath + "/" + filename, FileMode.Create);
                document.Write(output);
                fs.Close();
                fs.Dispose();
                output.Close();
                output.Dispose();

                return(DataConverterHelper.SerializeObject(new { path = filePath, filename = filename }));
            }
            catch (Exception e)
            {
                if (fs != null)
                {
                    fs.Close();
                    fs.Dispose();
                }
                if (output != null)
                {
                    output.Close();
                    output.Dispose();
                }
                return(DCHelper.ErrorMessage("导出预算说明书失败!" + e.Message));
            }
        }
        public string GetYearStartCover([FromUri] BaseListModel parameter)
        {
            if (parameter == null)
            {
                return(DCHelper.ErrorMessage("请求参数为空!"));
            }

            if (parameter.orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id为空!"));
            }

            if (parameter.uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id为空!"));
            }

            if (String.IsNullOrEmpty(parameter.Year))
            {
                return(DCHelper.ErrorMessage("年度为空!"));
            }
            //value来判断是年初,年中,年末预算说明说
            if (String.IsNullOrEmpty(parameter.value))
            {
                return(DCHelper.ErrorMessage("判断年初,年中,年末的value条件为空!"));
            }

            //获取组织和用户信息
            User2Model    userModel     = new User2Model();
            OrganizeModel organizeModel = new OrganizeModel();

            try
            {
                userModel = this.BudgetMstService.GetUser(parameter.uid);
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage("获取用户信息失败!"));
            }

            try
            {
                organizeModel = this.BudgetMstService.GetOrganize(parameter.orgid);
            }
            catch (Exception e)
            {
                return(DCHelper.ErrorMessage("获取组织信息失败!"));
            }
            FileStream fs     = null;
            FileStream output = null;

            try
            {
                string title    = "";
                string content1 = "";
                string content2 = "";
                if ("1".Equals(parameter.value))
                {
                    title    = "预算表";
                    content1 = "预算说明书";
                    content2 = "经费收支预算表";
                }
                else if ("2".Equals(parameter.value))
                {
                    title    = "预算表(年中调整)";
                    content1 = "预算说明书(年中调整)";
                    content2 = "经费收支预算表(年中调整)";
                }
                else if ("3".Equals(parameter.value))
                {
                    title    = "决算表";
                    content1 = "决算说明书";
                    content2 = "经费决算预算表";
                }

                string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".docx";
                string filePath = HostingEnvironment.MapPath("~/DownLoadFiles/SubjectBudget");
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                File.Copy(HostingEnvironment.MapPath("~" + "/DownLoadFiles/template/预算封面.docx"), filePath + "/" + filename, true);

                fs = new FileStream(filePath + "/" + filename, FileMode.Open, FileAccess.Read);

                XWPFDocument document = new XWPFDocument(fs);
                foreach (var para in document.Paragraphs)
                {
                    string oldContext = para.ParagraphText;
                    if (String.IsNullOrEmpty(oldContext))
                    {
                        continue;
                    }
                    string context = para.ParagraphText;
                    if (context.Contains("{$date}"))
                    {
                        context = context.Replace("{$date}", DateTime.Now.ToString("yyyy/MM/dd"));
                    }
                    if (context.Contains("{$chairman}"))
                    {
                        context = context.Replace("{$chairman}", userModel.UserName);
                    }
                    if (context.Contains("{$treasurer}"))
                    {
                        context = context.Replace("{$treasurer}", userModel.UserName);
                    }
                    if (context.Contains("{$maker}"))
                    {
                        context = context.Replace("{$maker}", userModel.UserName);
                    }
                    if (context.Contains("{$checker}"))
                    {
                        context = context.Replace("{$checker}", "");
                    }
                    if (context.Contains("{$year}"))
                    {
                        context = context.Replace("{$year}", DateTime.Now.Year.ToString());
                    }
                    if (context.Contains("{$month}"))
                    {
                        context = context.Replace("{$month}", DateTime.Now.Month.ToString());
                    }
                    if (context.Contains("{$day}"))
                    {
                        context = context.Replace("{$day}", DateTime.Now.Day.ToString());
                    }
                    if (context.Contains("{$title}"))
                    {
                        context = context.Replace("{$title}", title);
                    }
                    if (context.Contains("{$content1}"))
                    {
                        context = context.Replace("{$content1}", content1);
                    }
                    if (context.Contains("{$content2}"))
                    {
                        context = context.Replace("{$content2}", content2);
                    }

                    if (oldContext != context)
                    {
                        para.ReplaceText(oldContext, context);
                    }
                }
                output = new FileStream(filePath + "/" + filename, FileMode.Create);
                document.Write(output);
                fs.Close();
                fs.Dispose();
                output.Close();
                output.Dispose();

                return(DataConverterHelper.SerializeObject(new { path = filePath, filename = filename }));
            }
            catch (Exception ex)
            {
                if (fs != null)
                {
                    fs.Close();
                    fs.Dispose();
                }
                if (output != null)
                {
                    output.Close();
                    output.Dispose();
                }
                return(DCHelper.ErrorMessage("导出年初申报的封面失败!" + ex.Message));
            }
        }
        public string PostSaveAccountList([FromBody] BaseInfoModel <YsAccountMstModel> param)
        {
            if (param.uid == 0)
            {
                return(DCHelper.ErrorMessage("用户id不能为空!"));
            }
            if (param.orgid == 0)
            {
                return(DCHelper.ErrorMessage("组织id不能为空!"));
            }
            if (param.infoData == null)
            {
                return(DCHelper.ErrorMessage("参数传递有误!"));
            }
            try
            {
                if (param.infoData.YsAccounts != null && param.infoData.YsAccounts.Count > 0)
                {
                    IList <YsAccountModel> ysAccounts = new List <YsAccountModel>();
                    foreach (var acc in param.infoData.YsAccounts)
                    {
                        ysAccounts.Add(acc);
                        GetYsAccountsChilds(acc, ysAccounts);
                    }
                    if (ysAccounts != null && ysAccounts.Count > 0)
                    {
                        //后端重新算一遍数据(防止前端传入错误数据)
                        foreach (var ysAcc in ysAccounts)
                        {
                            if (ysAcc.SUBJECTCODE == "4BNHJSR")
                            {
                                ysAcc.FINALACCOUNTSTOTAL  = ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3) == null ? 0 : ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3).Sum(t => t.FINALACCOUNTSTOTAL);
                                ysAcc.BUDGETTOTAL         = ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3) == null ? 0 : ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3).Sum(t => t.BUDGETTOTAL);
                                ysAcc.ADJUSTMENT          = ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3) == null ? 0 : ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3).Sum(t => t.ADJUSTMENT);
                                ysAcc.APPROVEDBUDGETTOTAL = ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3) == null ? 0 : ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3).Sum(t => t.APPROVEDBUDGETTOTAL);
                                ysAcc.ThisaccountsTotal   = ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3) == null ? 0 : ysAccounts.ToList().FindAll(t => (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).StartsWith("4") && (t.SUBJECTCODE == null ? "" : t.SUBJECTCODE).Length == 3).Sum(t => t.ThisaccountsTotal);
                            }
                            if (ysAcc.SUBJECTCODE == "5QM1")
                            {
                                ysAcc.FINALACCOUNTSTOTAL  = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR").FINALACCOUNTSTOTAL) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC").FINALACCOUNTSTOTAL);
                                ysAcc.BUDGETTOTAL         = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR").BUDGETTOTAL) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC").BUDGETTOTAL);
                                ysAcc.ADJUSTMENT          = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR").ADJUSTMENT) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC").ADJUSTMENT);
                                ysAcc.APPROVEDBUDGETTOTAL = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR").APPROVEDBUDGETTOTAL) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC").APPROVEDBUDGETTOTAL);
                                ysAcc.ThisaccountsTotal   = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "4BNHJSR").ThisaccountsTotal) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5BNHJZC").ThisaccountsTotal);
                            }
                            if (ysAcc.SUBJECTCODE == "5QM6")
                            {
                                ysAcc.FINALACCOUNTSTOTAL = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1").FINALACCOUNTSTOTAL) + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2").FINALACCOUNTSTOTAL)
                                                           + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3").FINALACCOUNTSTOTAL) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4").FINALACCOUNTSTOTAL)
                                                           - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5").FINALACCOUNTSTOTAL);
                                ysAcc.BUDGETTOTAL = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1").BUDGETTOTAL) + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2").BUDGETTOTAL)
                                                    + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3").BUDGETTOTAL) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4").BUDGETTOTAL)
                                                    - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5").BUDGETTOTAL);
                                ysAcc.ADJUSTMENT = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1").ADJUSTMENT) + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2").ADJUSTMENT)
                                                   + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3").ADJUSTMENT) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4").ADJUSTMENT)
                                                   - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5").ADJUSTMENT);
                                ysAcc.APPROVEDBUDGETTOTAL = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1").APPROVEDBUDGETTOTAL) + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2").APPROVEDBUDGETTOTAL)
                                                            + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3").APPROVEDBUDGETTOTAL) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4").APPROVEDBUDGETTOTAL)
                                                            - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5").APPROVEDBUDGETTOTAL);
                                ysAcc.ThisaccountsTotal = (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM1").ThisaccountsTotal) + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM2").ThisaccountsTotal)
                                                          + (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM3").ThisaccountsTotal) - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM4").ThisaccountsTotal)
                                                          - (ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5") == null ? 0 : ysAccounts.ToList().Find(t => t.SUBJECTCODE == "5QM5").ThisaccountsTotal);
                            }

                            if (ysAcc.BUDGETTOTAL == 0)
                            {
                                ysAcc.BudgetComplete = 100;
                            }
                            else
                            {
                                ysAcc.BudgetComplete = ysAcc.APPROVEDBUDGETTOTAL / ysAcc.BUDGETTOTAL * 100;
                            }
                            if (ysAcc.APPROVEDBUDGETTOTAL == 0)
                            {
                                ysAcc.COMPLETE = 100;
                            }
                            else
                            {
                                ysAcc.COMPLETE = ysAcc.ThisaccountsTotal / ysAcc.APPROVEDBUDGETTOTAL * 100;
                            }
                        }
                    }
                    param.infoData.YsAccounts = ysAccounts;
                }
                //if ("1".Equals(param.value))
                //{
                //    if(param.infoData.VerifyStart == 1)
                //    {
                //        return DCHelper.ErrorMessage("年初申报数据已上报,不能修改!");
                //    }
                //}
                //else if ("2".Equals(param.value))
                //{
                //    if (param.infoData.VerifyMiddle == 1)
                //    {
                //        return DCHelper.ErrorMessage("年中调整数据已上报,不能修改!");
                //    }
                //}
                //else if ("3".Equals(param.value))
                //{
                //    if (param.infoData.VerifyEnd == 1)
                //    {
                //        return DCHelper.ErrorMessage("年末决算数据已上报,不能修改!");
                //    }
                //}
                SavedResult <long> savedResult = new SavedResult <long>();
                savedResult = this.YsAccountMstService.SaveYsAccount(param.infoData, param.orgid, param.orgCode, param.Year, param.uid, param.value);
                return(DataConverterHelper.SerializeObject(savedResult));
            }
            catch (Exception ex)
            {
                return(DCHelper.ErrorMessage(ex.Message));
            }
        }
Beispiel #14
0
        public string GetExpenseMstList([FromUri] ExpenseListRequestModel param)
        {
            //string clientJsonQuery = System.Web.HttpContext.Current.Request.Params["queryfilter"];//查询条件
            //Dictionary<string, object> dicWhere = DataConverterHelper.ConvertToDic(clientJsonQuery);//查询条件转Dictionary

            //var userId = System.Web.HttpContext.Current.Request.Params["userId"];
            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            /*var dicWhereDept = new Dictionary<string, object>();
             * new CreateCriteria(dicWhereDept)
             *  .Add(ORMRestrictions<string>.Eq("Dwdm", param.UserCode)).Add(ORMRestrictions<string>.Eq("Dylx", "97")); //闭区间
             * var deptList = CorrespondenceSettingsService.Find(dicWhereDept);
             * List<string> deptL = new List<string>();
             * for (var i = 0; i < deptList.Data.Count; i++)
             * {
             *  deptL.Add(deptList.Data[i].Dydm);
             * }
             * new CreateCriteria(dicWhere)
             *     .Add(ORMRestrictions<IList<String>>.In("FBudgetDept", deptL));*/

            new CreateCriteria(dicWhere)
            .Add(ORMRestrictions <string> .Eq("FDeclarationDept", param.FDeclarationDept));
            if (param.FApprovestatus.Count > 0)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <List <string> > .In("FApprovestatus", param.FApprovestatus));
            }
            if (param.FStartdate != null)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.DateTime?> .Ge("FDateofdeclaration", param.FStartdate));
            }
            if (param.FEnddate != null)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.DateTime?> .Le("FDateofdeclaration", param.FEnddate));
            }
            if (param.MinAmount != 0)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.Decimal> .Ge("FSurplusamount", param.MinAmount));
            }
            if (param.MaxAmount != 0)
            {
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions <System.Decimal> .Le("FSurplusamount", param.MaxAmount));
            }
            if (!string.IsNullOrEmpty(param.searchValue))
            {
                var dic1 = new Dictionary <string, object>();
                var dic2 = new Dictionary <string, object>();
                new CreateCriteria(dic1)
                .Add(ORMRestrictions <String> .Like("FPerformevaltype", param.searchValue));
                new CreateCriteria(dic2)
                .Add(ORMRestrictions <String> .Like("FProjname", param.searchValue));
                new CreateCriteria(dicWhere)
                .Add(ORMRestrictions.Or(dic1, dic2));
            }
            //根据单据号进行排序
            var result = ExpenseMstService.LoadWithPage(param.PageIndex, param.PageSize, dicWhere, new string[] { "FPerformevaltype Desc" });

            if (param.ProcPhid != 0)
            {
                var expenseList = ExpenseMstService.Find(dicWhere, new string[] { "FPerformevaltype Desc" }).Data;
                if (expenseList != null && expenseList.Count > 0)
                {
                    List <string> orgList = expenseList.ToList().Select(t => t.FBudgetDept).Distinct().ToList();
                    if (orgList != null && orgList.Count > 0)
                    {
                        var procList = this.GAppvalProcService.Find(t => orgList.Contains(t.OrgCode)).Data;
                        if (procList != null && procList.Count > 0)
                        {
                            //可以选取相同审批流的打上标记
                            foreach (var res in expenseList)
                            {
                                if (res.FApprovestatus == "1" && procList.ToList().Find(t => t.OrgCode == res.FBudgetDept && t.PhId == param.ProcPhid) != null)
                                {
                                    res.BatchPracBz = 1;
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            expenseList = expenseList.ToList().FindAll(t => t.BatchPracBz == 1);
                        }
                    }
                }

                result.Results    = expenseList.Skip((param.PageIndex - 1) * param.PageSize).Take(param.PageSize).ToList();
                result.TotalItems = expenseList.Count;
            }

            return(DCHelper.ModelListToJson <ExpenseMstModel>(result.Results, (Int32)result.TotalItems));
        }
Beispiel #15
0
        public async Task <string> PostSave2()
        {
            List <QtAttachmentModel> attachmentModels    = new List <QtAttachmentModel>();
            List <QtAttachmentModel> oldattachmentModels = new List <QtAttachmentModel>();
            //具体数据对象
            long expensePhid = 0;

            //判断form表单类型是否正确
            if (!Request.Content.IsMimeMultipartContent())
            {
                var data1 = new
                {
                    Status = ResponseStatus.Error,
                    Msg    = "请求数据不是multipart/form-data类型",
                    Data   = ""
                };
                return(DataConverterHelper.SerializeObject(data1));
            }
            //I6WebAppInfo i6AppInfo = (I6WebAppInfo)HttpContext.Current.Session["NGWebAppInfo"] ?? null;
            //获取AppInfo值 头部信息记录
            var base64EncodedBytes = Convert.FromBase64String(HttpContext.Current.Request.Headers.GetValues("AppInfo").First());
            var jsonText           = Encoding.UTF8.GetString(base64EncodedBytes);
            var AppInfo            = JsonConvert.DeserializeObject <AppInfoBase>(jsonText);


            //如果路径不存在,创建路径
            var    root     = System.Web.Hosting.HostingEnvironment.MapPath("~/UpLoadFiles/ExpenseMst/");
            string date     = DateTime.Now.ToString("yyyy-MM-dd");
            string filePath = Path.Combine(root, date);

            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }

            var multipartMemoryStreamProvider = await Request.Content.ReadAsMultipartAsync();

            var contentsList = multipartMemoryStreamProvider.Contents;

            foreach (var content in contentsList)
            {
                //通过判断fileName是否为空,是否为文件
                if (!string.IsNullOrEmpty(content.Headers.ContentDisposition.FileName))
                {
                    //处理文件名字符串
                    string fileName = content.Headers.ContentDisposition.FileName.Replace("\"", string.Empty);
                    using (Stream stream = await content.ReadAsStreamAsync())
                    {
                        //文件如果大于100MB  提示不允许
                        if (stream.Length > 104857600)
                        {
                            return(DCHelper.ErrorMessage("上传的文件不能大于100MB!"));
                        }
                        byte[] bytes = new byte[stream.Length];
                        stream.Read(bytes, 0, bytes.Length);
                        stream.Seek(0, SeekOrigin.Begin);

                        //获取对应文件后缀名
                        string extension = Path.GetExtension(fileName);
                        //获取文件名
                        string b_name = Path.GetFileName(fileName);

                        //修改文件名
                        string newFileName = Guid.NewGuid().ToString("N") + extension;
                        string uploadPath  = Path.Combine(filePath, newFileName);

                        //保存文件
                        MemoryStream ms = new MemoryStream(bytes);
                        FileStream   fs = new FileStream(uploadPath, FileMode.Create);
                        ms.WriteTo(fs);
                        ms.Close();
                        fs.Close();

                        string b_urlpath = "/UpLoadFiles/ExpenseMst/" + date + "/" + newFileName;

                        QtAttachmentModel attachmentModel = new QtAttachmentModel();
                        attachmentModel.BName           = b_name;
                        attachmentModel.BSize           = decimal.Round((decimal)stream.Length / 1024, 2);
                        attachmentModel.BTable          = "YS3_EXPENSEMST";
                        attachmentModel.BType           = extension;
                        attachmentModel.BUrlpath        = b_urlpath;
                        attachmentModel.PersistentState = PersistentState.Added;
                        attachmentModels.Add(attachmentModel);
                    }
                }
                else
                {
                    //获取键值对值,并通过反射获取对象中的属性
                    string key   = content.Headers.ContentDisposition.Name.Replace("\"", string.Empty);
                    string value = await content.ReadAsStringAsync();

                    //取项目主键
                    //projectPhid = long.Parse(value);
                    //取用款计划主键
                    if (key == "PhId")
                    {
                        expensePhid = long.Parse(value);
                    }
                    else if (key == "OldAttachments")
                    {
                        var value2 = JsonConvert.DeserializeObject <List <QtAttachmentModel> >(value);
                        oldattachmentModels = value2;
                    }
                    ////取用款计划主键
                    //expensePhid = long.Parse(value);
                }
            }

            if (expensePhid <= 0)
            {
                return(DCHelper.ErrorMessage("用款计划保存附件失败!"));
            }
            try
            {
                SavedResult <long> savedResult = new SavedResult <long>();
                //原有的附件要删除
                IList <QtAttachmentModel> oldAttachments = new List <QtAttachmentModel>();
                oldAttachments = this.QtAttachmentService.Find(t => t.BTable == "YS3_EXPENSEMST" && t.RelPhid == expensePhid).Data;
                if (oldAttachments != null && oldAttachments.Count > 0)
                {
                    foreach (var oldAtt in oldAttachments)
                    {
                        oldAtt.PersistentState = PersistentState.Deleted;
                    }
                    this.QtAttachmentService.Save <long>(oldAttachments, "");
                }
                if (attachmentModels != null && attachmentModels.Count > 0)
                {
                    foreach (var att in attachmentModels)
                    {
                        att.RelPhid         = expensePhid;
                        att.BTable          = "YS3_EXPENSEMST";
                        att.PersistentState = PersistentState.Added;
                    }
                    //savedResult = this.QtAttachmentService.Save<long>(attachmentModels, "");
                }
                if (oldattachmentModels != null && oldattachmentModels.Count > 0)
                {
                    foreach (var oldAtt in oldattachmentModels)
                    {
                        oldAtt.RelPhid         = expensePhid;
                        oldAtt.BTable          = "YS3_EXPENSEMST";
                        oldAtt.PersistentState = PersistentState.Added;
                        attachmentModels.Add(oldAtt);
                    }
                }
                if (attachmentModels != null && attachmentModels.Count > 0)
                {
                    savedResult = this.QtAttachmentService.Save <long>(attachmentModels, "");
                }
                return(DataConverterHelper.SerializeObject(savedResult));
            }
            catch (Exception ex)
            {
                return(DCHelper.ErrorMessage(ex.Message));
            }
        }