예제 #1
0
        public ActionResult Add(Epm_MeetingFileReport model)
        {
            Result <int> result = new Result <int>();

            string fileDataJson = Request.Form["fileDataJsonFile"];//获取上传文件json字符串

            if (!string.IsNullOrEmpty(fileDataJson))
            {
                model.TzAttachs = JsonConvert.DeserializeObject <List <Epm_TzAttachs> >(fileDataJson);//将文件信息json字符
            }

            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request)))
            {
                result = proxy.AddMeetingFileReport(model);
            }
            return(Json(result.ToResultView()));
        }
        ///<summary>
        ///添加:
        ///</summary>
        /// <param name="model">要添加的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> AddMeetingFileReport(Epm_MeetingFileReport model)
        {
            Result <int> result = new Result <int>();

            try
            {
                int  rows    = 0;
                bool isAdd   = false;
                var  meeting = DataOperateBusiness <Epm_MeetingFileReport> .Get().GetList(t => t.ProjectId == model.ProjectId && t.State != (int)PreProjectState.ApprovalFailure && t.State != (int)PreProjectState.Discarded).FirstOrDefault();

                if (meeting == null)
                {
                    isAdd   = true;
                    meeting = new Epm_MeetingFileReport();
                    SetCreateUser(meeting);
                }
                meeting.ProjectId = model.ProjectId;
                meeting.State     = model.State;
                SetCurrentUser(meeting);

                //上传附件
                AddFilesBytzTable(meeting, model.TzAttachs);

                var projectInfo = DataOperateBusiness <Epm_TzProjectProposal> .Get().GetModel(model.ProjectId);

                //特许经营项目性质的项目审批到项目批复完成就结束了,不生成工程模块的内容,不用写到机器人表里
                if (projectInfo.Nature != "XMXZTXJY")
                {
                    #region   会材料上报流程申请
                    var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow");
                    if (model.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1")
                    {
                        TzMeetingFileReportWorkFlowView view = new TzMeetingFileReportWorkFlowView();
                        var project = DataOperateBusiness <Epm_TzProjectProposal> .Get().GetModel(model.ProjectId);

                        view.ProjectName   = project.ProjectName;
                        view.StationName   = project.StationName;
                        view.NatureName    = project.NatureName;
                        view.Position      = project.Position;
                        view.ApplyTime     = string.Format("{0:yyyy-MM-dd}", project.ApplyTime);
                        view.CompanyName   = project.CompanyName;
                        view.PredictMoney  = project.PredictMoney.ToString();
                        view.OilSalesTotal = project.OilSalesTotal.ToString();
                        view.CNGY          = model.CNG.ToString();
                        view.LNGQ          = model.LNG.ToString();
                        var baseUser = DataOperateBasic <Base_User> .Get().GetModel(meeting.CreateUserId);

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

                        view.hr_sqr = baseUser.ObjeId;
                        //上传附件
                        if (model.TzAttachs != null && model.TzAttachs.Any())
                        {
                            //string baseFaleUrl = System.Configuration.ConfigurationManager.AppSettings.Get("XtDownloadUrl");
                            //foreach (var item in model.TzAttachs)
                            //{
                            //    string fileUrl = string.Format("{0}?fileId={1}&type={2}", baseFaleUrl, item.Id, item.TypeNo);
                            //    view.Temp_TzAttachs = fileUrl + '|' + view.Temp_TzAttachs;

                            //}

                            //if (view.Temp_TzAttachs != null)
                            //{
                            //    view.Temp_TzAttachs = view.Temp_TzAttachs.Substring(0, view.Temp_TzAttachs.Length - 1);
                            //}
                            view.Temp_TzAttachs = XtWorkFlowSubmitService.CreateXtAttachPath(model.TzAttachs);
                        }

                        meeting.WorkFlowId = XtWorkFlowService.CreateMeetingFileReportWorkFlow(view);
                    }
                    #endregion
                }

                if (isAdd)
                {
                    rows = DataOperateBusiness <Epm_MeetingFileReport> .Get().Add(meeting);
                }
                else
                {
                    rows = DataOperateBusiness <Epm_MeetingFileReport> .Get().Update(meeting);
                }


                result.Data = rows;
                result.Flag = EResultFlag.Success;
                //WriteLog(AdminModule.MeetingFileReport.GetText(), SystemRight.Add.GetText(), "新增: " + model.Id);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "AddMeetingFileReport");
            }
            return(result);
        }
        ///<summary>
        ///修改:
        ///</summary>
        /// <param name="model">要修改的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> UpdateMeetingFileReport(Epm_MeetingFileReport model)
        {
            Result <int> result = new Result <int>();

            try
            {
                #region   会材料上报流程申请     暂时注释  勿删!!!
                var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow");
                if (model.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1")
                {
                    TzMeetingFileReportWorkFlowView view = new TzMeetingFileReportWorkFlowView();
                    var project = DataOperateBusiness <Epm_TzProjectProposal> .Get().GetModel(model.ProjectId);

                    view.ProjectName   = project.ProjectName;
                    view.StationName   = project.StationName;
                    view.NatureName    = project.NatureName;
                    view.Position      = project.Position;
                    view.ApplyTime     = project.ApplyTime.ToString();
                    view.CompanyName   = project.CompanyName;
                    view.PredictMoney  = project.ProjectCode;
                    view.OilSalesTotal = project.OilSalesTotal.ToString();
                    view.CNGY          = model.CNG.ToString();
                    view.LNGQ          = model.LNG.ToString();
                    var baseUser = DataOperateBasic <Base_User> .Get().GetModel(model.CreateUserId);

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

                    view.hr_sqr = baseUser.ObjeId;
                    //上传附件
                    if (model.TzAttachs != null && model.TzAttachs.Any())
                    {
                        //string baseFaleUrl = System.Configuration.ConfigurationManager.AppSettings.Get("XtDownloadUrl");
                        //foreach (var item in model.TzAttachs)
                        //{
                        //    //string fileUrl = string.Format("{0}?fileId={1}&type={2}", baseFaleUrl, item.Id, item.TypeNo);
                        //    //view.Temp_TzAttachs = fileUrl + '|' + view.Temp_TzAttachs;
                        //    string fileUrl = XtWorkFlowService.GetXtAttachPaht(item.FilePath);
                        //    view.Temp_TzAttachs = fileUrl + '|' + view.Temp_TzAttachs;
                        //}

                        //if (view.Temp_TzAttachs != null)
                        //{
                        //    view.Temp_TzAttachs = view.Temp_TzAttachs.Substring(0, view.Temp_TzAttachs.Length - 1);
                        //}
                        view.Temp_TzAttachs = XtWorkFlowSubmitService.CreateXtAttachPath(model.TzAttachs);
                    }

                    model.WorkFlowId = XtWorkFlowService.CreateMeetingFileReportWorkFlow(view);
                }
                #endregion

                var rows = DataOperateBusiness <Epm_MeetingFileReport> .Get().Update(model);

                result.Data = rows;
                result.Flag = EResultFlag.Success;
                //WriteLog(AdminModule.MeetingFileReport.GetText(), SystemRight.Modify.GetText(), "修改: " + model.Id);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "UpdateMeetingFileReport");
            }
            return(result);
        }
        /// <summary>
        /// 修改项目评审记录状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public Result <int> UpdateTzProjectReveiewsState(List <long> ids, string state)
        {
            Result <int> result = new Result <int>();

            try
            {
                foreach (var item in ids)
                {
                    var model = DataOperateBusiness <Epm_TzProjectReveiews> .Get().GetList(t => t.ProjectId == item).FirstOrDefault();

                    if (model != null)
                    {
                        //SetCurrentUser(model);
                        model.State = (int)state.ToEnumReq <PreProjectState>();
                        var rows = DataOperateBusiness <Epm_TzProjectReveiews> .Get().Update(model);

                        //若状态为已审批,生成下一阶段数据
                        if (model.State == (int)PreProjectState.ApprovalSuccess)
                        {
                            //生成上会材料上报信息
                            Epm_MeetingFileReport meetingFileReport = new Epm_MeetingFileReport();
                            meetingFileReport.ProjectId = model.ProjectId;
                            meetingFileReport.State     = (int)PreProjectState.WaitSubmitted;
                            AddMeetingFileReport(meetingFileReport);
                        }

                        result.Data = rows;
                        result.Flag = EResultFlag.Success;


                        #region 地区公司方案审核
                        var project = DataOperateBusiness <Epm_TzProjectProposal> .Get().GetModel(model.ProjectId);

                        string houstAddress = System.Configuration.ConfigurationManager.AppSettings.Get("RPAPath");
                        #region 生成RPA表数据
                        RPA_CompanyProjectReveiews rPACompanyReveiews = new RPA_CompanyProjectReveiews();

                        rPACompanyReveiews.ProjectName    = project.ProjectName;
                        rPACompanyReveiews.Address        = model.Address;
                        rPACompanyReveiews.Attendees      = model.Attendees;
                        rPACompanyReveiews.ReveiewDate    = model.ReveiewDate;
                        rPACompanyReveiews.HostUser       = model.HostUser;
                        rPACompanyReveiews.username       = "******";
                        rPACompanyReveiews.WriteMark      = 0;
                        rPACompanyReveiews.WriteResult    = 0;
                        rPACompanyReveiews.FollowOperate  = "";
                        rPACompanyReveiews.ConclusionName = model.ConclusionCode == "XMPSJL1" ? "同意" : model.ConclusionCode == "XMPSJL2" ? "原则同意" : model.ConclusionCode == "XMPSJL3" ? "不同意" : "";
                        rPACompanyReveiews.InvitedExperts = model.InvitedExperts;

                        var rcfileList = GetFilesByTZTable("Epm_TzProjectReveiews", model.Id).Data;
                        for (int i = 0; i < rcfileList.Count; i++)
                        {
                            rPACompanyReveiews.FilePath += houstAddress + "?path=" + rcfileList[i].FilePath + ",";
                        }
                        rPACompanyReveiews.FileNumber = rcfileList.Count;

                        SetCreateUser(rPACompanyReveiews);
                        SetCurrentUser(rPACompanyReveiews);
                        DataOperateBusiness <RPA_CompanyProjectReveiews> .Get().Add(rPACompanyReveiews);

                        #endregion
                        #region 生成OMADS表数据
                        OMADS_CompanyProjectReveiews oMADSCompanyReveiews = new OMADS_CompanyProjectReveiews();

                        oMADSCompanyReveiews.ProjectName    = project.ProjectName;
                        oMADSCompanyReveiews.Address        = model.Address;
                        oMADSCompanyReveiews.Attendees      = model.Attendees;
                        oMADSCompanyReveiews.ReveiewDate    = model.ReveiewDate;
                        oMADSCompanyReveiews.HostUser       = model.HostUser;
                        oMADSCompanyReveiews.username       = "******";
                        oMADSCompanyReveiews.WriteMark      = 0;
                        oMADSCompanyReveiews.WriteResult    = 0;
                        oMADSCompanyReveiews.FollowOperate  = "";
                        oMADSCompanyReveiews.ConclusionName = model.ConclusionCode == "XMPSJL1" ? "同意" : model.ConclusionCode == "XMPSJL2" ? "原则同意" : model.ConclusionCode == "XMPSJL3" ? "不同意" : "";
                        oMADSCompanyReveiews.InvitedExperts = model.InvitedExperts;
                        var ocfileList = GetFilesByTZTable("Epm_TzProjectReveiews", model.Id).Data;
                        for (int i = 0; i < ocfileList.Count; i++)
                        {
                            oMADSCompanyReveiews.FilePath += houstAddress + "?path=" + ocfileList[i].FilePath + ",";
                        }
                        oMADSCompanyReveiews.FileNumber = ocfileList.Count;

                        SetCreateUser(oMADSCompanyReveiews);
                        SetCurrentUser(oMADSCompanyReveiews);
                        DataOperateBusiness <OMADS_CompanyProjectReveiews> .Get().Add(oMADSCompanyReveiews);

                        #endregion
                        #region 生成TEMP表数据
                        TEMP_CompanyProjectReveiews tEMPCompanyReveiews = new TEMP_CompanyProjectReveiews();

                        tEMPCompanyReveiews.ProjectName    = project.ProjectName;
                        tEMPCompanyReveiews.Address        = model.Address;
                        tEMPCompanyReveiews.Attendees      = model.Attendees;
                        tEMPCompanyReveiews.ReveiewDate    = model.ReveiewDate;
                        tEMPCompanyReveiews.HostUser       = model.HostUser;
                        tEMPCompanyReveiews.username       = "******";
                        tEMPCompanyReveiews.WriteMark      = 0;
                        tEMPCompanyReveiews.WriteResult    = 0;
                        tEMPCompanyReveiews.FollowOperate  = "";
                        tEMPCompanyReveiews.ConclusionName = model.ConclusionCode == "XMPSJL1" ? "同意" : model.ConclusionCode == "XMPSJL2" ? "原则同意" : model.ConclusionCode == "XMPSJL3" ? "不同意" : "";
                        tEMPCompanyReveiews.InvitedExperts = model.InvitedExperts;
                        var tcfileList = GetFilesByTZTable("Epm_TzProjectReveiews", model.Id).Data;
                        for (int i = 0; i < tcfileList.Count; i++)
                        {
                            tEMPCompanyReveiews.FilePath += houstAddress + "?path=" + tcfileList[i].FilePath + ",";
                        }
                        tEMPCompanyReveiews.FileNumber = tcfileList.Count;

                        SetCreateUser(tEMPCompanyReveiews);
                        SetCurrentUser(tEMPCompanyReveiews);
                        DataOperateBusiness <TEMP_CompanyProjectReveiews> .Get().Add(tEMPCompanyReveiews);

                        #endregion
                        #endregion

                        #region 板块公司方案审查审核
                        #region 生成RPA表数据
                        RPA_BoardCompanyReveiews rPABoardReveiews = new RPA_BoardCompanyReveiews();

                        rPABoardReveiews.ProjectName   = project.ProjectName;
                        rPABoardReveiews.Address       = model.Address;
                        rPABoardReveiews.Attendees     = model.Attendees;
                        rPABoardReveiews.ReveiewDate   = model.ReveiewDate;
                        rPABoardReveiews.HostUser      = model.HostUser;
                        rPABoardReveiews.username      = "******";
                        rPABoardReveiews.WriteMark     = 0;
                        rPABoardReveiews.WriteResult   = 0;
                        rPABoardReveiews.FollowOperate = "";

                        var rbfileList = GetFilesByTZTable("Epm_TzProjectReveiews", model.Id).Data;
                        for (int i = 0; i < rbfileList.Count; i++)
                        {
                            rPABoardReveiews.FilePath += houstAddress + "?path=" + rbfileList[i].FilePath + ",";
                        }
                        rPABoardReveiews.FileNumber = rbfileList.Count;

                        SetCreateUser(rPABoardReveiews);
                        SetCurrentUser(rPABoardReveiews);
                        DataOperateBusiness <RPA_BoardCompanyReveiews> .Get().Add(rPABoardReveiews);

                        #endregion
                        #region 生成OMADS表数据
                        OMADS_BoardCompanyReveiews oMADSBoardReveiews = new OMADS_BoardCompanyReveiews();

                        oMADSBoardReveiews.ProjectName   = project.ProjectName;
                        oMADSBoardReveiews.Address       = model.Address;
                        oMADSBoardReveiews.Attendees     = model.Attendees;
                        oMADSBoardReveiews.ReveiewDate   = model.ReveiewDate;
                        oMADSBoardReveiews.HostUser      = model.HostUser;
                        oMADSBoardReveiews.username      = "******";
                        oMADSBoardReveiews.WriteMark     = 0;
                        oMADSBoardReveiews.WriteResult   = 0;
                        oMADSBoardReveiews.FollowOperate = "";

                        var obfileList = GetFilesByTZTable("Epm_TzProjectReveiews", model.Id).Data;
                        for (int i = 0; i < obfileList.Count; i++)
                        {
                            oMADSBoardReveiews.FilePath += houstAddress + "?path=" + obfileList[i].FilePath + ",";
                        }
                        oMADSBoardReveiews.FileNumber = obfileList.Count;

                        SetCreateUser(oMADSBoardReveiews);
                        SetCurrentUser(oMADSBoardReveiews);
                        DataOperateBusiness <OMADS_BoardCompanyReveiews> .Get().Add(oMADSBoardReveiews);

                        #endregion
                        #region 生成TEMP表数据
                        TEMP_BoardCompanyReveiews tEMPBoardReveiews = new TEMP_BoardCompanyReveiews();

                        tEMPBoardReveiews.ProjectName   = project.ProjectName;
                        tEMPBoardReveiews.Address       = model.Address;
                        tEMPBoardReveiews.Attendees     = model.Attendees;
                        tEMPBoardReveiews.ReveiewDate   = model.ReveiewDate;
                        tEMPBoardReveiews.HostUser      = model.HostUser;
                        tEMPBoardReveiews.username      = "******";
                        tEMPBoardReveiews.WriteMark     = 0;
                        tEMPBoardReveiews.WriteResult   = 0;
                        tEMPBoardReveiews.FollowOperate = "";

                        var tbfileList = GetFilesByTZTable("Epm_TzProjectReveiews", model.Id).Data;
                        for (int i = 0; i < tbfileList.Count; i++)
                        {
                            tEMPBoardReveiews.FilePath += houstAddress + "?path=" + tbfileList[i].FilePath + ",";
                        }
                        tEMPBoardReveiews.FileNumber = tbfileList.Count;

                        SetCreateUser(tEMPBoardReveiews);
                        SetCurrentUser(tEMPBoardReveiews);
                        DataOperateBusiness <TEMP_BoardCompanyReveiews> .Get().Add(tEMPBoardReveiews);

                        #endregion
                        #endregion
                    }
                    else
                    {
                        throw new Exception("该项目评审记录信息不存在");
                    }
                }
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "UpdateTzProjectReveiewsState");
            }
            return(result);
        }
예제 #5
0
 public MeetingFileReportView()
 {
     MeetingFileReport = new Epm_MeetingFileReport();
     TzProjectProposal = new Epm_TzProjectProposal();
 }