Example #1
0
        ///<summary>
        ///添加:
        ///</summary>
        /// <param name="model">要添加的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> AddTzDesignScheme(Epm_TzDesignScheme model)
        {
            Result <int> result = new Result <int>();

            try
            {
                int  rows  = 0;
                bool isAdd = false;
                //根据批复信息自动生成一条方案信息,如果已经存在==修改
                var reveiews = DataOperateBusiness <Epm_TzDesignScheme> .Get().GetList(t => t.ProjectId == model.ProjectId && t.State != (int)PreProjectApprovalState.ApprovalFailure && t.State != (int)PreProjectApprovalState.Closed).FirstOrDefault();

                #region receiews
                if (reveiews == null)//没有-新增
                {
                    isAdd    = true;
                    reveiews = new Epm_TzDesignScheme();
                    SetCreateUser(reveiews);
                }
                ///所属项目ID
                reveiews.ProjectId = model.ProjectId;
                ///项目编码
                reveiews.ProjectCode = model.ProjectCode;
                ///项目名称
                reveiews.ProjectName = model.ProjectName;
                ///项目批复号
                reveiews.ApprovalNo = model.ApprovalNo;
                ///项目性质(数据字典)
                reveiews.Nature = model.Nature;
                ///项目性质名称
                reveiews.NatureName = model.NatureName;
                ///项目提出日期(冗余)
                reveiews.ApplyTime = model.ApplyTime;
                //库站ID
                reveiews.StationId = model.StationId;
                ///库站协同编码
                reveiews.StationCodeXt = model.StationCodeXt;
                ///库站名称
                reveiews.StationName = model.StationName;
                ///地市公司ID
                reveiews.CompanyId = model.CompanyId;
                ///地市公司协同编码
                reveiews.CompanyCodeXt = model.CompanyCodeXt;
                ///地市公司名称
                reveiews.CompanyName = model.CompanyName;
                ///初步设计单位
                reveiews.DesignUnit = model.DesignUnit;
                ///示范/标注数据字典编码
                reveiews.StandarCode = model.StandarCode;
                ///示范名称
                reveiews.StandarName = model.StandarName;
                ///上报概算
                reveiews.Estimate = model.Estimate;
                ///总工程费用(冗余)
                reveiews.TotalInvestment = model.TotalInvestment;
                ///其它工程费用(冗余)
                reveiews.OtheInvestment = model.OtheInvestment;
                ///设计单位招标日期
                reveiews.InviteTime = model.InviteTime;
                ///设计单位负责人
                reveiews.DesignUnitCharge = model.DesignUnitCharge;
                //设计单位负责人职务
                reveiews.DesignJob = model.DesignJob;
                ///项目经理(冗余)
                reveiews.ProjectManager = model.ProjectManager;
                ///项目经理职务(冗余)
                reveiews.ProjectJob = model.ProjectJob;
                ///占地面积
                reveiews.LandArea = model.LandArea;
                ///加油机(台)
                reveiews.MachineofOilStage = model.MachineofOilStage;
                ///加气机(台)
                reveiews.MachineofGasStage = model.MachineofGasStage;
                ///储气机
                reveiews.GasWells = model.GasWells;
                ///油罐
                reveiews.OilTank = model.OilTank;
                ///罩棚面积(冗余)
                reveiews.Shelter = model.Shelter;
                ///站房面积(冗余)
                reveiews.StationRoom = model.StationRoom;
                ///便利店面积--暂时没有
                reveiews.ConvenienceRoom = model.ConvenienceRoom;
                ///批复概算投资(冗余)
                reveiews.ReleaseInvestmentAmount = model.ReleaseInvestmentAmount;
                ///其他工程内容
                reveiews.OtherProject = model.OtherProject;
                ///项目信息是否同步:是、否
                reveiews.IsSynchro = model.IsSynchro;
                ///状态:暂存、待审核、审批通过、不通过
                reveiews.State = model.State;
                ///工程费用
                reveiews.EngineeringCost = model.EngineeringCost;
                ///其它费用
                reveiews.OtherExpenses = model.OtherExpenses;
                ///土地费用
                reveiews.LandCosts = model.LandCosts;
                ///估算投资
                reveiews.PredictMoney = model.PredictMoney;
                ///地区公司
                reveiews.RegionCompany = model.RegionCompany;
                //项目类型
                reveiews.ProjectType = model.ProjectType;
                #endregion

                SetCurrentUser(reveiews);
                #region  设计方案流程申请     暂时注释  勿删!!!
                var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow");
                if (model.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1")
                {
                    TzDesignSchemeWorkFlowView view = new TzDesignSchemeWorkFlowView();

                    view.ApprovalNo              = model.ApprovalNo;
                    view.CompanyName             = model.CompanyName;
                    view.ConvenienceRoom         = model.ConvenienceRoom.ToString();
                    view.DesignJob               = model.DesignJob;
                    view.DesignUnit              = model.DesignUnit;
                    view.DesignUnitCharge        = model.DesignUnitCharge;
                    view.Estimate                = model.Estimate.ToString();
                    view.GasWells                = model.GasWells.ToString();
                    view.InviteTime              = string.Format("{0:yyyy-MM-dd}", model.InviteTime);
                    view.IsSynchro               = model.IsSynchro;
                    view.LandArea                = model.LandArea.ToString();
                    view.MachineofGasStage       = model.MachineofGasStage.ToString();
                    view.MachineofOilStage       = model.MachineofOilStage.ToString();
                    view.NatureName              = model.NatureName;
                    view.OilTank                 = model.OilTank.ToString();
                    view.OtheInvestment          = model.OtheInvestment.ToString();
                    view.OtherProject            = model.OtherProject;
                    view.PredictMoney            = model.PredictMoney.ToString();
                    view.ProjectCode             = model.ProjectCode;
                    view.ProjectJob              = model.ProjectJob;
                    view.ProjectManager          = model.ProjectManager;
                    view.ProjectName             = model.ProjectName;
                    view.ProvinceName            = model.RegionCompany;
                    view.ReleaseInvestmentAmount = model.ReleaseInvestmentAmount.ToString();
                    view.Shelter                 = model.Shelter.ToString();
                    view.StandarName             = model.StandarName;
                    view.StationName             = model.StationName;
                    view.StationRoom             = model.StationRoom.ToString();
                    view.StationTypeName         = model.ProjectType;
                    view.TotalInvestment         = model.TotalInvestment.ToString();
                    view.LandCosts               = model.LandCosts.ToString();
                    view.EngineeringCost         = model.EngineeringCost.ToString();
                    var baseUser = DataOperateBasic <Base_User> .Get().GetModel(reveiews.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);
                    }

                    reveiews.WorkFlowId = XtWorkFlowService.CreateDesignSchemeWorkFlow(view);
                }
                #endregion
                if (isAdd)
                {
                    rows = DataOperateBusiness <Epm_TzDesignScheme> .Get().Add(reveiews);
                }
                else
                {
                    rows = DataOperateBusiness <Epm_TzDesignScheme> .Get().Update(reveiews);
                }

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



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

            try
            {
                var scheme = DataOperateBusiness <Epm_TzDesignScheme> .Get().Single(p => p.ProjectId == model.ProjectId);

                if (scheme == null)
                {
                    throw new Exception("修改的数据不存在或者已被删除!");
                }
                //生成设计方案信息
                //scheme.ProjectId = model.ProjectId;
                //scheme.ProjectCode = model.ProjectCode;
                //scheme.ProjectName = model.ProjectName;
                //scheme.ApprovalNo = model.ApprovalNo;
                //scheme.Nature = model.Nature;
                //scheme.NatureName = model.NatureName;
                //scheme.ApplyTime = model.ApplyTime;
                //scheme.StationId = model.StationId;
                //scheme.StationCodeXt = model.StationCodeXt;
                //scheme.StationName = model.StationName;
                //scheme.CompanyId = model.CompanyId;
                //scheme.CompanyCodeXt = model.CompanyCodeXt;
                //scheme.CompanyName = model.CompanyName;
                //scheme.PredictMoney = model.PredictMoney;

                //scheme.DesignUnit = model.DesignUnit;
                //scheme.StandarCode = model.StandarCode;
                //scheme.StandarName = model.StandarName;
                //scheme.Estimate = model.Estimate;
                //scheme.TotalInvestment = model.TotalInvestment;
                //scheme.OtheInvestment = model.OtheInvestment;
                //scheme.InviteTime = model.InviteTime;
                //scheme.DesignUnitCharge = model.DesignUnitCharge;
                //scheme.DesignJob = model.DesignJob;
                //scheme.ProjectManager = model.ProjectManager;
                //scheme.ProjectJob = model.ProjectJob;

                //scheme.ConvenienceRoom = model.ConvenienceRoom;
                //scheme.ReleaseInvestmentAmount = model.ReleaseInvestmentAmount;
                //scheme.OtherProject = model.OtherProject;
                //scheme.IsSynchro = model.IsSynchro;


                //scheme.EngineeringCost = model.EngineeringCost;
                //scheme.OtherExpenses = model.OtherExpenses;
                //scheme.LandCosts = model.LandCosts;
                //scheme.RegionCompany = model.RegionCompany;
                //scheme.ProjectType = model.ProjectType;

                //scheme.LandArea = model.LandArea;//占地面积
                //scheme.MachineofOilStage = model.MachineofOilStage;//加油机
                //scheme.MachineofGasStage = model.MachineofGasStage;//加气机
                //scheme.GasWells = model.GasWells;//储气井
                //scheme.OilTank = model.OilTank;//油罐
                //scheme.Shelter = model.Shelter;//罩棚面积
                //scheme.StationRoom = model.StationRoom;//站房面积
                //scheme.TotalInvestment = model.TotalInvestment;//批复概算投资
                //scheme.ApprovalNo = model.ApprovalNo;//批复文号

                SetCurrentUser(model);

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

                #region  设计方案流程申请   暂时注释  勿删!!!
                var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow");
                if (model.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1")
                {
                    TzDesignSchemeWorkFlowView view = new TzDesignSchemeWorkFlowView();

                    view.ApprovalNo              = model.ApprovalNo;
                    view.CompanyName             = model.CompanyName;
                    view.ConvenienceRoom         = model.ConvenienceRoom.ToString();
                    view.DesignJob               = model.DesignJob;
                    view.DesignUnit              = model.DesignUnit;
                    view.DesignUnitCharge        = model.DesignUnitCharge;
                    view.Estimate                = model.Estimate.ToString();
                    view.GasWells                = model.GasWells.ToString();
                    view.InviteTime              = string.Format("{0:yyyy-MM-dd}", model.InviteTime);
                    view.IsSynchro               = model.IsSynchro;
                    view.LandArea                = model.LandArea.ToString();
                    view.MachineofGasStage       = model.MachineofGasStage.ToString();
                    view.MachineofOilStage       = model.MachineofOilStage.ToString();
                    view.NatureName              = model.NatureName;
                    view.OilTank                 = model.OilTank.ToString();
                    view.OtheInvestment          = model.OtheInvestment.ToString();
                    view.OtherProject            = model.OtherProject;
                    view.PredictMoney            = model.PredictMoney.ToString();
                    view.ProjectCode             = model.ProjectCode;
                    view.ProjectJob              = model.ProjectJob;
                    view.ProjectManager          = model.ProjectManager;
                    view.ProjectName             = model.ProjectName;
                    view.ProvinceName            = model.RegionCompany;
                    view.ReleaseInvestmentAmount = model.ReleaseInvestmentAmount.ToString();
                    view.Shelter                 = model.Shelter.ToString();
                    view.StandarName             = model.StandarName;
                    view.StationName             = model.StationName;
                    view.StationRoom             = model.StationRoom.ToString();
                    view.StationTypeName         = model.ProjectType;
                    view.TotalInvestment         = model.TotalInvestment.ToString();
                    view.LandCosts               = model.LandCosts.ToString();
                    view.EngineeringCost         = model.EngineeringCost.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.CreateDesignSchemeWorkFlow(view);
                }
                #endregion
                var rows = DataOperateBusiness <Epm_TzDesignScheme> .Get().Update(model);

                result.Data = rows;
                result.Flag = EResultFlag.Success;
                // WriteLog(AdminModule.TzDesignScheme.GetText(), SystemRight.Modify.GetText(), "修改: " + model.Id);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "UpdateTzDesignScheme");
            }
            return(result);
        }