Ejemplo n.º 1
0
        public Result <int> UpdateTzProjectPolit(Epm_TzProjectPolit model)
        {
            Result <int> result = new Result <int>();

            try
            {
                var Poli = DataOperateBusiness <Epm_TzProjectPolit> .Get().Single(p => p.Id == model.Id);

                SetCurrentUser(model);

                #region 协同接口
                var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow");
                if (model.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1")
                {
                    ProjectApprovalApplyView view = new ProjectApprovalApplyView();
                    view.txt_xmmc = model.ProjectName;

                    if (model.CompanyId != null)
                    {
                        var company = DataOperateBasic <Base_Company> .Get().GetModel(model.CompanyId.Value);

                        if (company == null)
                        {
                            throw new Exception("未获取到申请单位信息!");
                        }
                        view.sub_sqdw = company.ObjeId;
                    }
                    else
                    {
                        throw new Exception("请选择申请单位!");
                    }

                    view.date_kgrq   = string.Format("{0:yyyy-MM-dd}", model.StartDate);
                    view.date_jgrq   = string.Format("{0:yyyy-MM-dd}", model.EndDate);
                    view.date_ysrq   = string.Format("{0:yyyy-MM-dd}", model.AcceptDate);
                    view.date_zgrq   = string.Format("{0:yyyy-MM-dd}", model.RectFinishDate);
                    view.date_jssj   = string.Format("{0:yyyy-MM-dd}", model.FinalDate);
                    view.date_sjsj   = string.Format("{0:yyyy-MM-dd}", model.AuditDate);
                    view.txts_zlsfqq = model.FullFiles;
                    view.txt_ysyj    = model.AcceptOpinion;
                    view.date_sqrq   = string.Format("{0:yyyy-MM-dd}", DateTime.Now);

                    var baseUser = DataOperateBasic <Base_User> .Get().GetModel(model.CreateUserId);

                    if (baseUser == null)
                    {
                        throw new Exception("未找到申请人相关信息!");
                    }

                    view.hr_sqr  = baseUser.ObjeId;
                    view.file_fj = "";
                    if (model.TzAttachs.Count > 0)
                    {
                        //foreach (var item in model.TzAttachs)
                        //{
                        //    switch (item.TypeNo)
                        //    {
                        //        case "SBJJ":        // 销售企业二级单位验收主要事项表
                        //            view.file_fj = XtWorkFlowService.GetXtAttachPaht(item.FilePath);
                        //            break;
                        //        case "SGSC":        // 施工转生产界面交接确认单
                        //            view.file_sgdw = XtWorkFlowService.GetXtAttachPaht(item.FilePath);
                        //            break;
                        //        case "GCJJ":        // 工程交接证书
                        //            view.file_gcjjzs = XtWorkFlowService.GetXtAttachPaht(item.FilePath);
                        //            break;
                        //        default:
                        //            break;
                        //    }
                        //}
                        //销售企业二级单位验收主要事项表
                        var sxbTemp = model.TzAttachs.Where(p => p.TypeNo == "KGSQXSQYEJ").ToList();
                        view.file_fj = XtWorkFlowSubmitService.CreateXtAttachPath(sxbTemp);
                        //施工转生产界面交接确认单
                        var qrdTemp = model.TzAttachs.Where(p => p.TypeNo == "KGSQSGZSCJM").ToList();
                        view.file_fj = XtWorkFlowSubmitService.CreateXtAttachPath(qrdTemp);
                        //工程交接证书
                        var jjzsTemp = model.TzAttachs.Where(p => p.TypeNo == "KGSQGCJJZS").ToList();
                        view.file_fj = XtWorkFlowSubmitService.CreateXtAttachPath(jjzsTemp);
                    }

                    model.WorkFlowId = XtWorkFlowService.CreateApplyWorkFlow(view);
                }
                #endregion
                var rows = DataOperateBusiness <Epm_TzProjectPolit> .Get().Update(model);

                //上传附件
                AddFilesBytzTable(model, model.TzAttachs);
                result.Data = rows;
                result.Flag = EResultFlag.Success;
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "UpdateTzConDrawing");
            }
            return(result);
        }
Ejemplo n.º 2
0
        ///<summary>
        ///添加:
        ///</summary>
        /// <param name="model">要添加的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> AddProjectApproval(ProjectApprovalView model)
        {
            Result <int> result = new Result <int>();

            try
            {
                model.ProjectPolit = SetCreateUser(model.ProjectPolit);

                var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow");

                if (model.ProjectPolit.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1")
                {
                    ProjectApprovalApplyView view = new ProjectApprovalApplyView();
                    view.txt_xmmc = model.ProjectPolit.ProjectName;

                    if (model.ProjectPolit.CompanyId != null)
                    {
                        var company = DataOperateBasic <Base_Company> .Get().GetModel(model.ProjectPolit.CompanyId.Value);

                        if (company == null)
                        {
                            throw new Exception("未获取到申请单位信息!");
                        }
                        view.sub_sqdw = company.ObjeId;
                    }
                    else
                    {
                        throw new Exception("请选择申请单位!");
                    }

                    view.date_kgrq   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.StartDate);
                    view.date_jgrq   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.EndDate);
                    view.date_ysrq   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.AcceptDate);
                    view.date_zgrq   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.RectFinishDate);
                    view.date_jssj   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.FinalDate);
                    view.date_sjsj   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.AuditDate);
                    view.txts_zlsfqq = model.ProjectPolit.FullFiles;
                    view.txt_ysyj    = model.ProjectPolit.AcceptOpinion;
                    view.date_sqrq   = string.Format("{0:yyyy-MM-dd}", DateTime.Now);

                    var baseUser = DataOperateBasic <Base_User> .Get().GetModel(model.ProjectPolit.CreateUserId);

                    if (baseUser == null)
                    {
                        throw new Exception("未找到申请人相关信息!");
                    }

                    view.hr_sqr  = baseUser.ObjeId;
                    view.file_fj = "";

                    model.ProjectPolit       = SetCurrentUser(model.ProjectPolit);
                    model.ProjectPolit.State = 0;

                    if (model.FileList.Count > 0)
                    {
                        AddFilesByTable(model.ProjectPolit, model.FileList); //上传附件

                        foreach (var item in model.FileList)
                        {
                            switch (item.TableColumn)
                            {
                            case "SBJJ":            // 销售企业二级单位验收主要事项表
                                view.file_fj = XtWorkFlowService.GetXtAttachPaht(item.Url);
                                break;

                            case "SGSC":            // 施工转生产界面交接确认单
                                view.file_sgdw = XtWorkFlowService.GetXtAttachPaht(item.Url);
                                break;

                            case "GCJJ":            // 工程交接证书
                                view.file_gcjjzs = XtWorkFlowService.GetXtAttachPaht(item.Url);
                                break;

                            default:
                                break;
                            }
                        }
                    }

                    model.ProjectPolit.WorkFlowId = XtWorkFlowService.CreateApplyWorkFlow(view);
                }

                var rows = DataOperateBusiness <Epm_TzProjectPolit> .Get().Add(model.ProjectPolit);

                result.Data = rows;
                result.Flag = EResultFlag.Success;
                WriteLog(AdminModule.ProjectApproval.GetText(), SystemRight.Add.GetText(), "新增: " + model.ProjectPolit.Id);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "AddProjectApproval");
            }
            return(result);
        }