Ejemplo n.º 1
0
        /// <summary>
        ///  业务处理,更新Monthlyreport表ProcessOwn字段,添加actio表记录
        /// </summary>
        public void DisposeBusinessData()
        {
            #region  业务处理
            if (string.IsNullOrEmpty(this.BusinessID))
            {
                throw new Exception("BusinessID is null!");
            }
            else
            {
                //添加谁点击了提交审批按钮
                B_MonthlyReport ReportModel = null;

                B_SystemBatch _BatchModel = null;

                //正常的月报ID
                if (string.IsNullOrEmpty(ProType))
                {
                    ReportModel = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid());
                    //月报业务ID ,没有问题
                    if (string.IsNullOrEmpty(ReportModel.ProcessOwn))
                    {
                        ReportModel.ProcessOwn = this.CurrentUser;
                        B_MonthlyreportOperator.Instance.UpdateMonthlyreport(ReportModel);
                    }
                    B_MonthlyReportAction _bMonthlyReportAction = new B_MonthlyReportAction();
                    _bMonthlyReportAction.SystemID        = ReportModel.SystemID;
                    _bMonthlyReportAction.MonthlyReportID = ReportModel.ID;
                    _bMonthlyReportAction.FinYear         = ReportModel.FinYear;
                    _bMonthlyReportAction.FinMonth        = ReportModel.FinMonth;
                    _bMonthlyReportAction.Action          = EnumHelper.GetEnumDescription(typeof(MonthlyReportLogActionType), (int)MonthlyReportLogActionType.Submit);
                    _bMonthlyReportAction.Operator        = this.CurrentUser;
                    _bMonthlyReportAction.OperatorTime    = DateTime.Now;
                    _bMonthlyReportAction.ModifierName    = this.CurrentUser;
                    _bMonthlyReportAction.CreatorName     = this.CurrentUser;
                    B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(_bMonthlyReportAction);
                }
                else
                {
                    //批次ID获取实体

                    _BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(BusinessID.ToGuid());

                    _BatchModel.ModifierName = this.CurrentUser;
                    B_SystemBatchOperator.Instance.UpdateSystemBatch(_BatchModel);

                    B_MonthlyReportAction _bMonthlyReportAction = new B_MonthlyReportAction();
                    _bMonthlyReportAction.SystemID        = Guid.Empty;
                    _bMonthlyReportAction.MonthlyReportID = _BatchModel.ID;
                    _bMonthlyReportAction.FinYear         = _BatchModel.FinYear;
                    _bMonthlyReportAction.FinMonth        = _BatchModel.FinMonth;
                    _bMonthlyReportAction.Action          = EnumHelper.GetEnumDescription(typeof(MonthlyReportLogActionType), (int)MonthlyReportLogActionType.Submit);
                    _bMonthlyReportAction.Operator        = this.CurrentUser;
                    _bMonthlyReportAction.OperatorTime    = DateTime.Now;
                    _bMonthlyReportAction.ModifierName    = this.CurrentUser;
                    _bMonthlyReportAction.CreatorName     = this.CurrentUser;
                    B_MonthlyReportActionOperator.Instance.AddMonthlyReportAction(_bMonthlyReportAction);
                }
            }
            #endregion
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (!string.IsNullOrEmpty(HttpContext.Current.Request["SysId"]))
            {
                SysId = Guid.Parse(HttpContext.Current.Request["SysId"]);
            }

            if (!string.IsNullOrEmpty(HttpContext.Current.Request["FinYear"]))
            {
                FinYear = Convert.ToInt32(HttpContext.Current.Request["FinYear"]);
            }
            if (!string.IsNullOrEmpty(HttpContext.Current.Request["FinMonth"]))
            {
                FinMonth = Convert.ToInt32(HttpContext.Current.Request["FinMonth"]);
            }

            List <A_MonthlyReportDetail> am = A_MonthlyreportdetailOperator.Instance.GetAMonthlyreportdetailList(SysId, FinYear, FinMonth).ToList();

            if (am.Count > 0)
            {
                B_MonthlyReport BM = B_MonthlyreportOperator.Instance.GetMonthlyreport(am[0].MonthlyReportID);
                T = BM.CreateTime;
            }
            SystemModel = StaticResource.Instance[SysId, T];
            if (SystemModel.Category == 4)
            {
                DownExcelCate2();
            }
            else
            {
                DownExcelCate1();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["BusinessID"] != null)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["BusinessID"].ToString()))
                {
                    hideMonthReportID.Value = Request.QueryString["BusinessID"].ToString();
                    B_MonthlyReport bmonthReport = B_MonthlyreportOperator.Instance.GetMonthlyreport(Guid.Parse(hideMonthReportID.Value));
                    if (bmonthReport != null)
                    {
                        hideSystemID.Value    = bmonthReport.SystemID.ToString();
                        hideFinYear.Value     = bmonthReport.FinYear.ToString();
                        hideFinMonth.Value    = bmonthReport.FinMonth.ToString();
                        HideProcessCode.Value = StaticResource.Instance[bmonthReport.SystemID, bmonthReport.CreateTime].Configuration.Element("ProcessCode").Value;


                        C_System system = StaticResource.Instance.SystemList.Where(p => p.ID == bmonthReport.SystemID).FirstOrDefault();
                        if (system != null)
                        {
                            lblName.Text = system.SystemName + bmonthReport.FinYear + "-" + bmonthReport.FinMonth + lblName.Text;
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///新流程结束
        /// </summary>
        protected void OnProcessCompletedBusinessData()
        {
            if (!string.IsNullOrEmpty(this.ProType))//批次
            {
                B_SystemBatch sysBatch = B_SystemBatchOperator.Instance.GetSystemBatch(BusinessID.ToGuid());
                ExceptionHelper.TrueThrow(sysBatch == null, string.Format("cannot find the report data which id={0}", BusinessID));

                //获取批次A表中的数据
                A_SystemBatch _sysBatch = A_SystemBatchOperator.Instance.GetSystemBatch("ProSystem", sysBatch.FinYear, sysBatch.FinMonth);

                if (_sysBatch == null)
                {
                    AddBatchData(sysBatch);
                }
                else
                {
                    //先删除数据,在添加数据
                    int succeed = A_SystemBatchOperator.Instance.DeleteSystemBatch(_sysBatch);
                    ExceptionHelper.TrueThrow(succeed == 0, string.Format("批次表删除失败,批次ID:{0}", _sysBatch.ID));
                    AddBatchData(sysBatch);
                }
            }
            else
            {
                //不包含批次的
                //这里通过BusinessID 获取流程批次的信息
                B_MonthlyReport mrpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid());
                ExceptionHelper.TrueThrow(mrpt == null, string.Format("cannot find the report data which id={0}", BusinessID));

                List <B_MonthlyReportDetail> rptDetailList = B_MonthlyreportdetailOperator.Instance.GetMonthlyreportdetailList(mrpt.ID).ToList();
                mrpt.WFStatus = "Approved";
                B_MonthlyreportOperator.Instance.UpdateMonthlyreport(mrpt); //更新
                BtoAData(mrpt, rptDetailList);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取未完成数据
        /// </summary>
        /// <param name="RptModel"></param>
        /// <param name="IsReported">是否是从上报页面调用</param>
        /// <returns></returns>
        public List <DictionaryVmodel> GetMissTargetRptDataSource(ReportInstance RptModel)
        {
            //默认是走经营系统
            string InterfaceName = "*";

            C_System sys;

            if (RptModel.ReportDetails != null && RptModel.ReportDetails.Count() > 0)
            {
                B_MonthlyReport bm = B_MonthlyreportOperator.Instance.GetMonthlyreport(RptModel.ReportDetails[0].MonthlyReportID);
                sys = StaticResource.Instance[RptModel._System.ID, bm.CreateTime];
            }
            else
            {
                sys = RptModel._System;
            }



            if (sys != null)
            {
                if (sys.Category == 2)
                {
                }
                else if (sys.Category == 3)
                {
                }
                else if (sys.Category == 4)
                {
                    InterfaceName = "Directly";
                    return(this[InterfaceName].GetMissTargetRptDataSource(RptModel, sys));
                }
            }
            return(this[InterfaceName].GetMissTargetRptDataSource(RptModel, sys));
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 审批页面使用,审批页面数据不判断权限
 /// </summary>
 /// <param name="unUseful">没用,只是为了重载</param>
 /// <param name="monthReportID"></param>
 /// <param name="isAll"></param>
 public ReportInstance(Guid?monthReportID, Guid?systemBatchId, bool isAll)
 {
     if (monthReportID != null && monthReportID != Guid.Empty)
     {
         _MonthReportID = monthReportID.Value;
         B_MonthlyReport report = B_MonthlyreportOperator.Instance.GetMonthlyreport(_MonthReportID);
         _SystemID      = report.SystemID;
         _SystemBatchID = report.SystemBatchID;
         TargetPlanID   = report.TargetPlanID;
         AreaID         = report.AreaID;
         FinYear        = report.FinYear;
         FinMonth       = report.FinMonth;
     }
     else if (systemBatchId != null && monthReportID != Guid.Empty)
     {
         B_SystemBatch b_SystemBatch = B_SystemBatchOperator.Instance.GetSystemBatch(systemBatchId.Value);
         C_System      c_System      = StaticResource.Instance.SystemList.Where(x => x.GroupType == b_SystemBatch.BatchType).FirstOrDefault();
         _SystemID      = c_System.ID;
         _SystemBatchID = b_SystemBatch.ID;
         TargetPlanID   = b_SystemBatch.TargetPlanID;
         FinYear        = b_SystemBatch.FinYear;
         FinMonth       = b_SystemBatch.FinMonth;
     }
     DataSource     = "Draft";
     UserPermission = false;
     InitialData(true, isAll);
 }
        public void AddOrUpdateDataNew(List <DictionaryVmodel> ListDV, Guid MonthReportID)
        {
            List <B_MonthlyReportDetail> lstInsertMonthReportDetail = new List <B_MonthlyReportDetail>();

            foreach (DictionaryVmodel dv in ListDV)
            {
                List <B_MonthlyReportDetail> B_ReportDetails = new List <B_MonthlyReportDetail>();
                List <MonthlyReportDetail>   Listmrd         = (List <MonthlyReportDetail>)dv.ObjValue;

                Listmrd.ForEach(p => B_ReportDetails.Add(CalculationEvaluationEngine.CalculationEvaluationService.Calculation(p.ToBModel(), "")));
                lstInsertMonthReportDetail.AddRange(B_ReportDetails);
            }
            if (lstInsertMonthReportDetail.Count > 0)
            {
                //优化,批量插入
                B_MonthlyreportdetailOperator.Instance.BulkAddTargetDetail(lstInsertMonthReportDetail);
            }
            B_MonthlyReport bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(MonthReportID);

            //if (bmr != null && lstInsertMonthReportDetail.Count > 0)
            //{
            //    bmr.Status = 5;
            //    B_MonthlyreportOperator.Instance.UpdateMonthlyreport(bmr);
            //}

            //上报的时候序列化后的Json数据
            SaveJsonData(MonthReportID);
        }
Ejemplo n.º 8
0
        public B_MonthlyReport AddMR()
        {
            B_MonthlyReport bmr = new B_MonthlyReport();

            bmr.SystemID             = Guid.Parse(ddlSystem.SelectedValue);
            bmr.AreaID               = Guid.Parse(ddlAreaID.Visible ? ddlAreaID.SelectedValue : Guid.Empty.ToString());
            bmr.FinMonth             = FinMonth;
            bmr.FinYear              = FinYear;
            bmr.Status               = 2;
            bmr.WFStatus             = "Draft";
            bmr.DefaultVersionStatus = 1;
            bmr.CreateTime           = DateTime.Now;
            var targetPlanDetail = StaticResource.Instance.GetDefaultTargetPlanList(bmr.SystemID, bmr.FinYear).FirstOrDefault();

            if (targetPlanDetail != null && targetPlanDetail.TargetPlanID != null)
            {
                bmr.TargetPlanID = targetPlanDetail.TargetPlanID;
            }
            else
            {
                return(null);
            }
            bmr.ID = B_MonthlyreportOperator.Instance.AddMonthlyreport(bmr);
            return(bmr);
        }
Ejemplo n.º 9
0
        public Guid ModifyMonthTRptDescription(string rpts)
        {
            B_MonthlyReport report = JsonHelper.Deserialize <B_MonthlyReport>(rpts);

            report.Status = 5;
            return(B_MonthlyreportOperator.Instance.UpdateMonthlyreport(report));
        }
Ejemplo n.º 10
0
 private void LoadData()
 {
     if (!string.IsNullOrEmpty(Request.QueryString["BusinessID"].ToString()))
     {
         hideMonthReportID.Value = Request.QueryString["BusinessID"].ToString();
         B_MonthlyReport bmonthReport = B_MonthlyreportOperator.Instance.GetMonthlyreport(Guid.Parse(hideMonthReportID.Value));
         if (bmonthReport != null)
         {
             hideSystemID.Value    = bmonthReport.SystemID.ToString();
             hideFinYear.Value     = bmonthReport.FinYear.ToString();
             hideFinMonth.Value    = bmonthReport.FinMonth.ToString();
             hideProcessCode.Value = StaticResource.Instance[bmonthReport.SystemID, DateTime.Now].Configuration.Element("ProcessCode").Value;
             C_System system   = StaticResource.Instance.SystemList.Where(p => p.ID == bmonthReport.SystemID).FirstOrDefault();
             var      areaName = "";
             if (bmonthReport.AreaID != Guid.Empty)
             {
                 var area = StaticResource.Instance.OrgList[system.ID].Where(x => x.ID == bmonthReport.AreaID).FirstOrDefault();
                 areaName = "-" + area.CnName;
             }
             if (system != null)
             {
                 lblName.Text = system.SystemName + areaName + bmonthReport.FinYear + "-" + bmonthReport.FinMonth + lblName.Text;
             }
         }
     }
 }
        public void TransferOtherPage(Guid SystemID)
        {
            Guid sysID = SystemID;


            if (ddlMonth.SelectedValue == "")
            {
                DateTime datetime = StaticResource.Instance.GetReportDateTime();
                finMonth = datetime.Month;
                finYear  = datetime.Year;
            }
            else
            {
                finMonth = int.Parse(ddlMonth.SelectedValue);

                //年下拉
                finYear = int.Parse(ddlYear.SelectedValue);
            }

            C_System sysModel = StaticResource.Instance[sysID, DateTime.Now];

            if (chkIsLastestVersion.Checked)
            {
                B_MonthlyReport B_monthRpt = B_MonthlyreportOperator.Instance.GetMonthlyReport(sysID, finYear, finMonth);
                if (B_monthRpt != null)
                {
                    sysModel = StaticResource.Instance[sysID, B_monthRpt.CreateTime];
                }
            }
            else
            {
                A_MonthlyReport A_monthRpt = A_MonthlyreportOperator.Instance.GetAMonthlyReport(sysID, finYear, finMonth);
                if (A_monthRpt != null)
                {
                    sysModel = StaticResource.Instance[sysID, A_monthRpt.CreateTime];
                }
            }



            if (sysModel.Category == 1)
            {
                Response.Redirect("TargetRpt.aspx?_sysid=" + HttpUtility.UrlEncode(sysID.ToString()) + "&_finMonth=" + HttpUtility.UrlEncode(finMonth.ToString()) + "&_finYear=" + HttpUtility.UrlEncode(finYear.ToString()) + "&IsLastestVersion=" + chkIsLastestVersion.Checked);
            }
            else if (sysModel.Category == 2)
            {
                Response.Redirect("ProMonthReport.aspx?_sysid=" + HttpUtility.UrlEncode(sysID.ToString()) + "&_finMonth=" + HttpUtility.UrlEncode(finMonth.ToString()) + "&_finYear=" + HttpUtility.UrlEncode(finYear.ToString()) + "&IsLastestVersion=" + chkIsLastestVersion.Checked);
            }
            else if (sysModel.Category == 3)
            {
                return;
            }
            else if (sysModel.Category == 4)
            {
                Response.Redirect("TargetDirectlyRpt.aspx?_sysid=" + HttpUtility.UrlEncode(sysID.ToString()) + "&_finMonth=" + HttpUtility.UrlEncode(finMonth.ToString()) + "&_finYear=" + HttpUtility.UrlEncode(finYear.ToString()) + "&IsLastestVersion=" + chkIsLastestVersion.Checked);
            }
        }
Ejemplo n.º 12
0
        public string GetNewMonthlyreport(int FinYear, int FinMonth, string SystemID)
        {
            string          ID    = "";
            B_MonthlyReport model = B_MonthlyreportOperator.Instance.GetMonthlyReporNew(Guid.Parse(SystemID), FinYear, FinMonth);

            if (model != null)
            {
                ID = model.ID.ToString();
            }
            return(ID);
        }
Ejemplo n.º 13
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            HttpPostedFile file = context.Request.Files["FileData"];

            if (!string.IsNullOrEmpty(HttpContext.Current.Request["SysId"]))
            {
                SysId = Guid.Parse(HttpContext.Current.Request["SysId"]);
            }

            if (!string.IsNullOrEmpty(HttpContext.Current.Request["FinYear"]))
            {
                FinYear = Convert.ToInt32(HttpContext.Current.Request["FinYear"]);
            }
            if (!string.IsNullOrEmpty(HttpContext.Current.Request["FinMonth"]))
            {
                FinMonth = Convert.ToInt32(HttpContext.Current.Request["FinMonth"]);
            }
            List <A_MonthlyReportDetail> am = A_MonthlyreportdetailOperator.Instance.GetAMonthlyreportdetailList(SysId, FinYear, FinMonth).ToList();

            if (am.Count > 0)
            {
                B_MonthlyReport BM = B_MonthlyreportOperator.Instance.GetMonthlyreport(am[0].MonthlyReportID);
                T = BM.CreateTime;
            }
            SystemModel = StaticResource.Instance[SysId, T];
            //文件相对路径
            string filePath   = "UploadFile\\" + WebHelper.DateTimeNow.ToString("yyyy-MM-dd");
            string uploadpath = Path.Combine(UploadFilePath, filePath);


            string templetePath = uploadpath;
            string filePathName = Path.Combine(uploadpath, file.FileName);//合并上传文件地址

            if (Directory.Exists(uploadpath) == false)
            {
                Directory.CreateDirectory(uploadpath); //如果上传文件路径不存在,则创建该路径。
            }
            file.SaveAs(filePathName);                 //保存文件到磁盘
            string error = "";

            //UpTargetPlanDetailExcel(out error, context, filePathName); //读取上传Excel文件

            if (SystemModel.Category == 4)
            {
                UpLoadExcel2(out error, context, filePathName);
            }
            else
            {
                UpLoadExcel(out error, context, filePathName);
            }
            context.Response.Write(error);
            //context.Response.Write("Hello World");
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 获取A表的数据插入B表
        /// </summary>
        /// <param name="bmr"></param>
        public void AddBMRD(B_MonthlyReport bmr)
        {
            IList <B_MonthlyReportDetail> listBMRD = B_MonthlyreportdetailOperator.Instance.GetMonthlyreportdetailList(bmr.ID);

            bool IsExistence = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailCount(bmr.ID);

            List <B_MonthlyReportDetail> B_ReportDetails = new List <B_MonthlyReportDetail>();

            var targetPlan = StaticResource.Instance.GetDefaultTargetPlanList(Guid.Parse(ddlSystem.SelectedValue), FinYear).FirstOrDefault();

            if (targetPlan == null || targetPlan.TargetPlanID == null || targetPlan.TargetPlanID == Guid.Empty)
            {
                UserControl.SetButtonSpanStyle(-1);
                return;
            }

            var targetPlanId = targetPlan.TargetPlanID;

            if (IsExistence == false)
            {
                A_MonthlyReport AMonthlyReport = A_MonthlyreportOperator.Instance.GetAMonthlyReport(Guid.Parse(ddlSystem.SelectedValue), Guid.Empty, FinYear, FinMonth, targetPlanId);
                //如果A表有数据从A表取数据,否则取B表上一版本的数据。
                if (AMonthlyReport != null)
                {
                    //从A表获取数据插入B表
                    bmr.Description = AMonthlyReport.Description;              //月报说明
                    B_MonthlyreportOperator.Instance.UpdateMonthlyreport(bmr); //更新月报说明

                    B_ReportDetails = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetail_ByAToB(FinYear, FinMonth, AMonthlyReport.SystemID, bmr.AreaID, bmr.ID, targetPlanId);
                }
                else
                {
                    //获取B表的审批中的数据,做成草稿
                    B_MonthlyReport BMonthlyReport = B_MonthlyreportOperator.Instance.GetMonthlyReport(Guid.Parse(ddlSystem.SelectedValue), Guid.Empty, FinYear, FinMonth, bmr.ID, targetPlanId);
                    if (BMonthlyReport != null)
                    {
                        //从B表获取上一版本数据插入B表
                        B_ReportDetails = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetail_ByBToB(FinYear, FinMonth, BMonthlyReport.SystemID, BMonthlyReport.ID, bmr.ID);
                    }
                }

                //判断当前B_MonthlyReportID在明细表中是否有数据。
                if (B_ReportDetails.Count > 0)
                {
                    bmr.Status = 5;
                    B_MonthlyreportOperator.Instance.UpdateMonthlyreport(bmr);//更新月度经营表
                    //B_MonthlyreportdetailOperator.Instance.AddOrUpdateTargetDetail(B_ReportDetails, "Insert");//更新月度经营明细表
                }
            }

            UserControl.SetButtonSpanStyle(bmr.Status);
        }
Ejemplo n.º 15
0
        public B_MonthlyReport AddMR()
        {
            B_MonthlyReport bmr = new B_MonthlyReport();

            bmr.SystemID   = Guid.Parse(ddlSystem.SelectedValue);
            bmr.FinMonth   = FinMonth;
            bmr.FinYear    = FinYear;
            bmr.Status     = 2;
            bmr.WFStatus   = "Draft";
            bmr.CreateTime = DateTime.Now;
            bmr.ID         = B_MonthlyreportOperator.Instance.AddMonthlyreport(bmr);
            return(bmr);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 获取A表的数据插入B表
        /// </summary>
        /// <param name="bmr"></param>
        public void AddBMRD(B_MonthlyReport bmr)
        {
            //IList<B_MonthlyReportDetail> listBMRD = B_MonthlyreportdetailOperator.Instance.GetMonthlyreportdetailList(bmr.ID);

            var targetPlan = StaticResource.Instance.GetDefaultTargetPlanList(Guid.Parse(ddlSystem.SelectedValue), FinYear).FirstOrDefault();

            if (targetPlan == null || targetPlan.TargetPlanID == null || targetPlan.TargetPlanID == Guid.Empty)
            {
                return;
            }
            var targetPlanId = targetPlan.TargetPlanID;

            bool IsExistence = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailCount(bmr.ID);

            List <B_MonthlyReportDetail> B_ReportDetails = new List <B_MonthlyReportDetail>();

            //listBMRD.Count == 0
            Guid AreaID = Guid.Parse(ddlAreaID.Visible ? ddlAreaID.SelectedValue : Guid.Empty.ToString());

            if (IsExistence == false) // 明细里不存在数据
            {
                //A_MonthlyReport AMonthlyReport = A_MonthlyreportOperator.Instance.GetAMonthlyReport(Guid.Parse(ddlSystem.SelectedValue), FinYear, FinMonth);
                A_MonthlyReport AMonthlyReport = A_MonthlyreportOperator.Instance.GetAMonthlyReport(Guid.Parse(ddlSystem.SelectedValue), AreaID, FinYear, FinMonth, targetPlanId);
                //如果A表有数据从A表取数据,否则取B表上一版本的数据。
                if (AMonthlyReport != null)
                {
                    //从A表获取数据插入B表
                    bmr.Description = AMonthlyReport.Description;              //月报说明
                    B_MonthlyreportOperator.Instance.UpdateMonthlyreport(bmr); //更新月报说明
                    B_ReportDetails = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetail_ByAToB(FinYear, FinMonth, AMonthlyReport.SystemID, bmr.AreaID, bmr.ID, targetPlanId);
                }
                else
                {
                    //B_MonthlyReport BMonthlyReport = B_MonthlyreportOperator.Instance.GetMonthlyReport(Guid.Parse(ddlSystem.SelectedValue), FinYear, FinMonth, bmr.ID);
                    B_MonthlyReport BMonthlyReport = B_MonthlyreportOperator.Instance.GetMonthlyReport(Guid.Parse(ddlSystem.SelectedValue), AreaID, FinYear, FinMonth, bmr.ID, targetPlanId);
                    if (BMonthlyReport != null)
                    {
                        //从B表获取上一版本数据插入B表
                        B_ReportDetails = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetail_ByBToB(FinYear, FinMonth, BMonthlyReport.SystemID, BMonthlyReport.ID, bmr.ID);
                    }
                }

                //判断当前B_MonthlyReportID在明细表中是否有数据。
                if (B_ReportDetails.Count > 0)
                {
                    bmr.Status = 5;
                    B_MonthlyreportOperator.Instance.UpdateMonthlyreport(bmr); //更新月度经营表
                                                                               // B_MonthlyreportdetailOperator.Instance.AddOrUpdateTargetDetail(B_ReportDetails, "Insert");//更新月度经营明细表
                }
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 添加批次Model
        /// </summary>
        /// <returns></returns>
        public B_SystemBatch AddSystemBatch()
        {
            B_SystemBatch BatchModel = new B_SystemBatch();

            BatchModel.BatchType     = "ProSystem";
            BatchModel.FinMonth      = FinMonth;
            BatchModel.FinYear       = FinYear;
            BatchModel.WFBatchStatus = "Draft";
            BatchModel.ID            = Guid.NewGuid();

            List <V_SubReport> SubReportList = new List <V_SubReport>();
            //获取项目系统的公司
            List <C_System> ProSysList = StaticResource.Instance.SystemList.Where(p => p.GroupType == "ProSystem").OrderBy(PR => PR.Sequence).ToList();

            //循环添加B_MonthlyReport表数据
            foreach (var item in ProSysList)
            {
                B_MonthlyReport BatchMonthlyReport = new B_MonthlyReport();
                BatchMonthlyReport.SystemID      = item.ID;
                BatchMonthlyReport.FinMonth      = FinMonth;
                BatchMonthlyReport.FinYear       = FinYear;
                BatchMonthlyReport.Status        = 2;
                BatchMonthlyReport.WFStatus      = "Draft";
                BatchMonthlyReport.SystemBatchID = BatchModel.ID;
                BatchMonthlyReport.CreateTime    = DateTime.Now;
                BatchMonthlyReport.ID            = B_MonthlyreportOperator.Instance.AddMonthlyreport(BatchMonthlyReport);

                //添加数据 ,如果是当前选择的系统,isreaday==true
                if (ddlSystem.SelectedValue == item.ID.ToString())
                {
                    SubReportList.Add(new V_SubReport(item.ID, item.SystemName, BatchMonthlyReport.ID, false));
                    AddBMRD(BatchMonthlyReport);                                      // 添加明细数据
                    hideMonthReportID.Value = BatchMonthlyReport.ID.ToString();       //将新增的月报ID,存在影藏控件中
                    HiddenBatch.Value       = BatchMonthlyReport.ID.ToString();
                    MutipleUpload.LoadByBusinessID(BatchMonthlyReport.ID.ToString()); //添加附件ID
                    UserControl.SetButtonSpanStyle(BatchMonthlyReport.Status);        //设置第几步的状态
                }
                else
                {
                    //判断其它系统的提交状态
                    SubReportList.Add(new V_SubReport(item.ID, item.SystemName, BatchMonthlyReport.ID, false));
                }
            }

            BatchModel.SubReport = JsonConvert.SerializeObject(SubReportList);

            BatchModel.ID = B_SystemBatchOperator.Instance.AddSystemBatch(BatchModel);


            return(BatchModel);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 现在导出页面使用
        /// </summary>
        /// <param name="MonthReportID"></param>
        /// <param name="userPermission">是否根据用户权限控制</param>
        /// <param name="IsLatestVersion">是否是最新的版本,true:从B表中获取,false:从A表中获取</param>
        /// <param name="_DataSource">当从B表中获取时,这里有Draft:草稿状态, 或者是审批中状态 </param>
        /// <param name="IsAll">是否获取全部月报数据,月报查询true,月报上报false </param>
        public ReportInstance(Guid MonthReportID, bool userPermission, bool IsLatestVersion, string _DataSource = "Draft", bool IsAll = false)
        {
            UserPermission = userPermission;
            _MonthReportID = MonthReportID;
            B_MonthlyReport report = B_MonthlyreportOperator.Instance.GetMonthlyreport(_MonthReportID);

            _SystemID      = report.SystemID;
            _SystemBatchID = report.SystemBatchID;
            AreaID         = report.AreaID;
            FinYear        = report.FinYear;
            FinMonth       = report.FinMonth;
            DataSource     = _DataSource;
            InitialData(IsLatestVersion, IsAll);
        }
        //protected string GetDescription(Guid systemtId, int year, int month)
        //{
        //    string Description = string.Empty;
        //    C_System sysModel = StaticResource.Instance[systemtId, DateTime.Now];
        //    XElement element = sysModel.Configuration;
        //    var RptList = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailList_Approve(systemtId, year, month, Guid.Empty,,false);

        //    if (element.Elements("Report").Elements("Rgroup") != null)
        //    {
        //        Description = element.Element("Report").GetElementValue("Rgroup", "");
        //        if (!string.IsNullOrEmpty(Description))
        //        {
        //            Hashtable p = MonthDescriptionValueEngine.MonthDescriptionValueService.GetMonthDescriptionValue(RptList, systemtId, "");
        //            foreach (string key in p.Keys)
        //            {
        //                Description = Description.Replace("【" + key + "】", p[key].ToString());
        //            }
        //        }
        //    }
        //    return Description;
        //}
        public void AddMonthlyReport(B_SystemBatch batch, C_System c_System, string description)
        {
            B_MonthlyReport bmr = new B_MonthlyReport();

            bmr.ID          = batch.ID;
            bmr.SystemID    = c_System.ID;
            bmr.AreaID      = Guid.Empty;
            bmr.FinMonth    = batch.FinMonth;
            bmr.FinYear     = batch.FinYear;
            bmr.Status      = 2;
            bmr.WFStatus    = "Progress";
            bmr.CreateTime  = DateTime.Now;
            bmr.Description = description;
            bmr.ID          = B_MonthlyreportOperator.Instance.AddMonthlyreport(bmr);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 处理流程按钮事件
        /// </summary>
        /// <param name="UserLonginID"></param>
        public void ExecutionBusinessData(string UserLonginID = null)
        {
            switch (this.ExecType)
            {
            case "saveApplicationData":
                //SaveApplactionBusinessData();
                break;

            case "afterAction":
                ProcessExecuteBusinessData();
                AfterExcuteBusinessData(UserLonginID);
                if (string.IsNullOrEmpty(ProType))
                {
                    B_MonthlyReport ReportModelA = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid());

                    List <NavigatActivity1> lstna = GetProcessIntance(ReportModelA.ID.ToString(), new UserInfo {
                        UserLoginID = this.CurrentUser
                    });
                    string Json = Newtonsoft.Json.JsonConvert.SerializeObject(lstna);
                    if (ReportModelA.WFStatus == "Draft" && OperatorType == 7)
                    {
                        ReportModelA.ReportApprove = null;
                    }
                    else
                    {
                        ReportModelA.ReportApprove = Json;
                    }

                    B_MonthlyreportOperator.Instance.UpdateMonthlyreport(ReportModelA);
                }
                else
                {
                    var BacthModel = B_SystemBatchOperator.Instance.GetSystemBatch(BusinessID.ToGuid());
                    List <NavigatActivity1> lstna = GetProcessIntance(BacthModel.ID.ToString(), new UserInfo {
                        UserLoginID = this.CurrentUser
                    });
                    string Json = Newtonsoft.Json.JsonConvert.SerializeObject(lstna);
                    BacthModel.ReportApprove = Json;
                    B_SystemBatchOperator.Instance.UpdateSystemBatch(BacthModel);
                }
                break;

            case "beforeAction":
                //BeforeExcuteBusinessData();
                break;
            }
        }
        public List <C_Target> GetTargetListNew(string SystemID, int Year, int Month)
        {
            DateTime t = DateTime.Now;

            List <A_MonthlyReportDetail> AM = A_MonthlyreportdetailOperator.Instance.GetAMonthlyreportdetailList(Guid.Parse(SystemID), Year, Month).ToList();

            if (AM.Count > 0)
            {
                B_MonthlyReport BM = B_MonthlyreportOperator.Instance.GetMonthlyreport(AM[0].MonthlyReportID);
                t = BM.CreateTime;
            }

            List <C_Target> Result = StaticResource.Instance.GetTargetList(Guid.Parse(SystemID), t).ToList();

            Result = Result.Where(p => p.NeedEvaluation == true).OrderBy(s => s.Sequence).ToList();
            return(Result);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 更新B_MonthlyReport表WFStatus字段。添加审批记录
        /// </summary>
        /// <param name="strPrcessStatus"></param>
        /// <param name="OperatorType"></param>
        public void OnProcessExecuteBusinessData(string strPrcessStatus, int OperatorType)
        {
            //流程状态,0:未运行,草稿,1:运行中,2:退回,3:审批完成,4:归档,-1:作废,-2:驳回后归档
            B_MonthlyReport rpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid());

            ExceptionHelper.TrueThrow(rpt == null, string.Format("cannot find the report data which id={0}", BusinessID));
            //有效流程状态:Progress, Approved
            //4-return, 9 -withdraw
            if (OperatorType == 6 || OperatorType == 7)
            {
                if (OperatorType == 6)
                {
                    // rpt.WFStatus = "Draft";
                    rpt.WFStatus = "Progress";
                    new MonthlyReportLog().AddMonthlyReportAction((int)MonthlyReportLogActionType.Return, rpt.SystemID, rpt.FinYear, rpt.FinMonth, BusinessID.ToGuid());
                }
                else if (OperatorType == 7)
                {
                    new MonthlyReportLog().AddMonthlyReportAction((int)MonthlyReportLogActionType.Withdraw, rpt.SystemID, rpt.FinYear, rpt.FinMonth, BusinessID.ToGuid());

                    //rpt.WFStatus = "Draft";
                    rpt.WFStatus = "Progress";
                }
            }
            else if (OperatorType == 9)//9, cancel
            {
                rpt.WFStatus = "Cancel";
                new MonthlyReportLog().AddMonthlyReportAction((int)MonthlyReportLogActionType.Cancel, rpt.SystemID, rpt.FinYear, rpt.FinMonth, BusinessID.ToGuid());
            }
            else
            {
                if (rpt.WFStatus != "Approved") //这里为了避免通知节点的提交覆盖了审批完成状态,而添加的
                {
                    rpt.WFStatus = "Progress";
                    //CreatTime取流程提交时间,该时间为流程开始时间
                    rpt.CreateTime = DateTime.Now;
                    rpt.Status     = 5;
                }
                //保存月度经营上报操作状态
                new MonthlyReportLog().AddMonthlyReportAction((int)MonthlyReportLogActionType.Submit, rpt.SystemID, rpt.FinYear, rpt.FinMonth, BusinessID.ToGuid());
            }

            B_MonthlyreportOperator.Instance.UpdateMonthlyreport(rpt);
            //RegistEvent();
        }
Ejemplo n.º 23
0
        public string GetMonthTRptDescription(string rpts)
        {
            string   Description = string.Empty;
            XElement element     = null;

            B_MonthlyReport RptModel = null;

            ReportInstance rpt = JsonHelper.Deserialize <ReportInstance>(rpts);

            RptModel = rpt.LastestMonthlyReport;

            List <MonthlyReportDetail> RptList = new List <MonthlyReportDetail>();

            if (rpt.LastestMonthlyReportDetails.Count <= 0)
            {
                return("");
            }

            rpt.LastestMonthlyReportDetails.ForEach(p => RptList.Add(p.ToVModel()));

            if (rpt._System.ID != Guid.Empty)
            {
                C_System sysModel = StaticResource.Instance[rpt._System.ID, DateTime.Now];
                element = sysModel.Configuration;
                if (element.Elements("Report").Elements("Rgroup") != null)
                {
                    Description = element.Element("Report").GetElementValue("Rgroup", "");
                    if (!string.IsNullOrEmpty(Description))
                    {
                        Hashtable p = MonthDescriptionValueEngine.MonthDescriptionValueService.GetMonthDescriptionValue(RptList, rpt._System.ID, base.CurrentUserName);
                        foreach (string key in p.Keys)
                        {
                            Description = Description.Replace("【" + key + "】", p[key].ToString());
                        }

                        //首先将月度报告入库
                        RptModel.Description = Description;
                        B_MonthlyreportOperator.Instance.UpdateMonthlyreport(RptModel);
                    }
                }
            }


            return(Description);
        }
        /// <summary>
        /// 添加月度报告数据
        /// </summary>
        public void AddMonthlyReport()
        {
            HidSystemID.Value     = ddlSystem.SelectedValue;
            HideProcessCode.Value = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].Configuration.Element("ProcessCode").Value;

            B_MonthlyReport bmr = null;

            //判断当前URL是否存在BusinessID
            if (string.IsNullOrEmpty(Request["BusinessID"]))
            {
                //添加月报说明
                bmr = B_MonthlyreportOperator.Instance.GetMonthlyReportDraft(Guid.Parse(ddlSystem.SelectedValue), FinYear, FinMonth);
                if (bmr == null)
                {
                    bmr = AddMR();
                }
                else
                {
                    if (bmr.WFStatus == "Progress" || bmr.WFStatus == "Approved")
                    {
                        bmr = AddMR();
                    }
                }
                //为当前月度经营报告(bmr),插入月度经营明细数据
                AddBMRD(bmr);
                hideMonthReportID.Value = bmr.ID.ToString();
            }
            else
            {
                hideMonthReportID.Value = Request["BusinessID"];
                bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(Request["BusinessID"].ToGuid());
                ddlSystem.SelectedValue = bmr.SystemID.ToString();
                FinYear      = bmr.FinYear;
                FinMonth     = bmr.FinMonth;
                lblName.Text = "";
                lblName.Text = FinYear + "-" + FinMonth + "月度经营报告上报";
            }

            if (bmr != null)
            {
                MutipleUpload.LoadByBusinessID(bmr.ID.ToString());
                UserControl.SetButtonSpanStyle(bmr.Status);
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 获取B表的(包含草稿)详细数据
        /// </summary>
        /// <param name="SystemID"></param>
        /// <param name="Year"></param>
        /// <param name="Month"></param>
        /// <param name="MonthReportID"></param>
        /// <returns></returns>
        public IList <B_MonthlyReportDetail> GetMonthlyReportDetailListBytDraft(Guid SystemID, int Year, int Month, Guid MonthReportID)
        {
            B_MonthlyReport report = null;

            if (MonthReportID == Guid.Empty)
            {
                report = B_MonthlyreportOperator.Instance.GetLastMonthlyReportList(SystemID, Year, Month);
            }
            else
            {
                report = B_MonthlyreportOperator.Instance.GetMonthlyreport(MonthReportID);
            }
            if (report != null)
            {
                IList <B_MonthlyReportDetail> result = _bMonthlyreportdetailAdapter.GetMonthlyreportdetailList(report.ID);
                return(result);
            }
            return(new List <B_MonthlyReportDetail>());
        }
Ejemplo n.º 26
0
 public B_SystemBatch GetSysBatchByMonthReportID(string BusinessID)
 {
     if (!string.IsNullOrEmpty(BusinessID))
     {
         B_MonthlyReport MonthRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(BusinessID.ToGuid());
         if (MonthRpt != null && MonthRpt.SystemBatchID != Guid.Empty)
         {
             return(B_SystemBatchOperator.Instance.GetSystemBatch(MonthRpt.SystemBatchID));
         }
         else
         {
             return(new B_SystemBatch());
         }
     }
     else
     {
         return(new B_SystemBatch());
     }
 }
Ejemplo n.º 27
0
        public static B_MonthlyReport ToBModel(this MonthlyReport value)
        {
            B_MonthlyReport result = new B_MonthlyReport
            {
                ID            = value.ID,
                SystemID      = value.SystemID,
                Description   = value.Description,
                IsDeleted     = value.IsDeleted,
                FinMonth      = value.FinMonth,
                FinYear       = value.FinYear,
                CreateTime    = value.CreateTime,
                CreatorName   = value.CreatorName,
                ModifierName  = value.ModifierName,
                ModifyTime    = value.ModifyTime,
                Status        = value.Status,
                WFStatus      = value.WFStatus,
                SystemBatchID = value.SystemBatchID
            };

            return(result);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 添加批次Model
        /// </summary>
        /// <returns></returns>
        public B_SystemBatch AddSystemBatch(string groupType)
        {
            B_SystemBatch BatchModel = new B_SystemBatch();

            BatchModel.BatchType     = groupType;
            BatchModel.FinMonth      = FinMonth;
            BatchModel.FinYear       = FinYear;
            BatchModel.WFBatchStatus = "Draft";
            BatchModel.ID            = Guid.NewGuid();
            var defaultTarget = A_TargetplanOperator.Instance.GetDefaultTargetplanList(ddlSystem.SelectedValue.ToGuid(), DateTime.Now.Year);

            if (defaultTarget == null || defaultTarget.Count < 1)
            {
                return(null);
            }
            BatchModel.TargetPlanID = defaultTarget.FirstOrDefault().ID;
            List <V_SubReport> SubReportList = new List <V_SubReport>();
            //获取项目系统的公司
            //List<C_System> ProSysList = StaticResource.Instance.SystemList.Where(p => p.GroupType == groupType).OrderBy(PR => PR.Sequence).ToList();
            var orgList = StaticResource.Instance.OrgList[ddlSystem.SelectedValue.ToGuid()].Where(x => x.Level == 3);

            //循环添加B_MonthlyReport表数据
            foreach (var item in orgList)
            {
                B_MonthlyReport BatchMonthlyReport = new B_MonthlyReport();
                BatchMonthlyReport.SystemID             = ddlSystem.SelectedValue.ToGuid();
                BatchMonthlyReport.AreaID               = item.ID;
                BatchMonthlyReport.FinMonth             = FinMonth;
                BatchMonthlyReport.FinYear              = FinYear;
                BatchMonthlyReport.Status               = 2;
                BatchMonthlyReport.DefaultVersionStatus = 1;
                BatchMonthlyReport.WFStatus             = "Draft";
                BatchMonthlyReport.SystemBatchID        = BatchModel.ID;
                BatchMonthlyReport.CreateTime           = DateTime.Now;
                BatchMonthlyReport.DefaultVersionStatus = 1;
                BatchMonthlyReport.TargetPlanID         = BatchModel.TargetPlanID;

                BatchMonthlyReport.ID = B_MonthlyreportOperator.Instance.AddMonthlyreport(BatchMonthlyReport);

                //添加数据 ,如果是当前选择的系统,isreaday==true
                if (ddlAreaID.SelectedValue == item.ID.ToString())
                {
                    SubReportList.Add(new V_SubReport(item.ID, item.CnName, BatchMonthlyReport.ID, false));
                    AddBMRD(BatchMonthlyReport);                                      // 添加明细数据
                    hideMonthReportID.Value = BatchMonthlyReport.ID.ToString();       //将新增的月报ID,存在影藏控件中
                    HiddenBatch.Value       = BatchMonthlyReport.ID.ToString();
                    MutipleUpload.LoadByBusinessID(BatchMonthlyReport.ID.ToString()); //添加附件ID
                    UserControl.SetButtonSpanStyle(BatchMonthlyReport.Status);        //设置第几步的状态
                }
                else
                {
                    //判断其它系统的提交状态
                    SubReportList.Add(new V_SubReport(item.ID, item.CnName, BatchMonthlyReport.ID, false));
                }
            }

            BatchModel.SubReport = JsonConvert.SerializeObject(SubReportList);

            BatchModel.ID = B_SystemBatchOperator.Instance.AddSystemBatch(BatchModel);


            return(BatchModel);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 添加月度报告数据
        /// </summary>
        public void AddMonthlyReport()
        {
            HidSystemID.Value = ddlSystem.SelectedValue;
            HidAreaID.Value   = ddlAreaID.Visible ? ddlAreaID.SelectedValue : Guid.Empty.ToString();

            hiddenDis.Value = "2";
            //如果存在审批中的数据,不让重复提交
            var bmrProgress = B_MonthlyreportOperator.Instance.GetMonthlyReportModel(Guid.Parse(ddlSystem.SelectedValue), Guid.Parse(HidAreaID.Value), FinYear, FinMonth, 1, "Progress");

            if (bmrProgress != null && bmrProgress.WFStatus == "Progress")
            {
                hiddenDis.Value         = "1";
                hideMonthReportID.Value = bmrProgress.ID.ToString();
                return;
            }


            HideProcessCode.Value = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].Configuration.Element("ProcessCode").Value;

            hiddenDis.Value = "0";

            B_SystemBatch BatchModel = null; // 公用的批次 实体

            B_MonthlyReport bmr   = null;
            string          Gtypt = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].GroupType;

            if (!string.IsNullOrEmpty(Gtypt))
            {
                #region 包含在批次里的数据的业务系统

                //判断当前URL是否存在BusinessID
                if (string.IsNullOrEmpty(Request["BusinessID"]))
                {
                    B_MonthlyReport _statreRpt = null; //-状态B_MonthlyReport -

                    BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(Gtypt, FinYear, FinMonth);

                    //判断批次表中是否有数据
                    if (BatchModel == null)
                    {
                        BatchModel = AddSystemBatch(Gtypt);
                        if (BatchModel == null)
                        {
                            UserControl.SetButtonSpanStyle(2);
                            return;
                        }
                    }
                    else
                    {
                        //批次不为Null,且批次还是在审批中的。
                        //批次是草稿状态
                        List <V_SubReport> V_SubReportList = JsonConvert.DeserializeObject <List <V_SubReport> >(BatchModel.SubReport);

                        //获取上报月报的ID
                        var             subRpt   = V_SubReportList.Find(SR => SR.SystemID == ddlAreaID.SelectedValue.ToGuid());
                        B_MonthlyReport monthRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(subRpt.ReportID);
                        #region  批次存在

                        //审批进行中,是要被跳转到审批页面的,但是审批完成就需要重新开启新的流程
                        if (BatchModel.WFBatchStatus == "Progress" || monthRpt.WFStatus == "Progress")
                        {
                            //批次是草稿状态
                            //var model = V_SubReportList.Find(p => p.SystemID == ddlAreaID.SelectedValue.ToGuid());

                            //---------------------------------------------------------------------------------------------------------------------------------------------
                            //这里批次需要控制,每次审批的状态只能是唯一的
                            // 暂时注销掉  BatchModel = AddSystemBatch();

                            if (BPF.Workflow.Client.WFClientSDK.Exist(monthRpt.ID.ToString()))
                            {
                                BPF.Workflow.Object.WorkflowContext wc = BPF.Workflow.Client.WFClientSDK.GetProcess(null, monthRpt.ID.ToString());
                                if (!wc.CurrentUserHasTodoTask)
                                {
                                    hiddenDis.Value         = "1";
                                    hideMonthReportID.Value = monthRpt.ID.ToString();
                                    return;
                                    //Server.Transfer("~/BusinessReport/TargetApprove.aspx?BusinessID=" + host.BusinessID);
                                }
                                else
                                {
                                    bmr = monthRpt;
                                    hideMonthReportID.Value = monthRpt.ID.ToString();
                                }
                            }
                        }
                        else if (BatchModel.WFBatchStatus == "Approved") //如果审批是完成状态,重新生产
                        {
                            BatchModel = AddSystemBatch(Gtypt);
                        }
                        else
                        {
                            //批次是草稿状态

                            V_SubReportList.ForEach(p =>
                            {     //选择的是那个系统?
                                if (p.SystemID == Guid.Parse(ddlAreaID.SelectedValue))
                                { //根据选择的系统,将明细数据展示出来
                                    _statreRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(p.ReportID);

                                    if (_statreRpt.WFStatus == "Cancel")      //如果当前月报是作废的状态,则重新生产一个新的ID   ( 这里针对作废后,重新起一个流程)
                                    {
                                        _statreRpt.ID       = Guid.NewGuid(); //替换实体ID
                                        _statreRpt.WFStatus = "Draft";
                                        _statreRpt.Status   = 2;
                                        Guid _BRptID        = B_MonthlyreportOperator.Instance.AddMonthlyreport(_statreRpt);

                                        p.ReportID              = _BRptID;
                                        HiddenBatch.Value       = BatchModel.ID.ToString(); //批次ID不变
                                        hideMonthReportID.Value = p.ReportID.ToString();
                                    }
                                    else
                                    {
                                        //注意这里
                                        hideMonthReportID.Value = p.ReportID.ToString();
                                        HiddenBatch.Value       = p.ReportID.ToString();
                                    }

                                    AddBMRD(_statreRpt);
                                    bmr = _statreRpt;
                                    MutipleUpload.LoadByBusinessID(_statreRpt.ID.ToString());
                                }
                            });


                            //这里重新序列,将作废后,重新生成的新ID 序列化到批次里
                            BatchModel.SubReport = JsonConvert.SerializeObject(V_SubReportList);
                            B_SystemBatchOperator.Instance.UpdateSystemBatch(BatchModel);
                        }

                        #endregion
                    }
                    UserControl.SetButtonSpanStyle(bmr == null ? -1 : bmr.Status);
                }
                else
                {
                    //如果是传过来的BusinessID,就直接去查询,不做操作
                    //通过BusinessID,首先获取批次的实体,根据权限,然后在批次中寻找
                    bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(Request["BusinessID"].ToGuid());
                    ExceptionHelper.TrueThrow <ArgumentNullException>(bmr == null ? true : false, "Argument B_MonthlyReport is Null");
                    HiddenBatch.Value       = bmr.SystemBatchID.ToString();
                    hideMonthReportID.Value = bmr.ID.ToString();

                    if (bmr.SystemBatchID != Guid.Empty)
                    {
                        //BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(bmr.SystemBatchID);
                        //List<V_SubReport> rptLsit = JsonConvert.DeserializeObject<List<V_SubReport>>(BatchModel.SubReport);
                        //V_SubReport rptModel = rptLsit.Find(f => f.SystemID == ddlSystem.SelectedValue.ToGuid());
                        //hideMonthReportID.Value = rptModel.ReportID.ToString();
                        //bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(rptModel.ReportID);
                        //ExceptionHelper.TrueThrow<ArgumentNullException>(bmr == null ? true : false, "Argument B_MonthlyReport is Null");
                        MutipleUpload.LoadByBusinessID(bmr.ID.ToString());
                        UserControl.SetButtonSpanStyle(bmr.Status);
                    }
                }

                #endregion
            }
            else
            {
                //判断当前URL是否存在BusinessID
                if (string.IsNullOrEmpty(Request["BusinessID"]))
                {
                    //添加月报说明
                    // bmr = B_MonthlyreportOperator.Instance.GetMonthlyReportDraft(Guid.Parse(ddlSystem.SelectedValue), FinYear, FinMonth);
                    bmr = B_MonthlyreportOperator.Instance.GetMonthlyReportDraft(Guid.Parse(ddlSystem.SelectedValue), Guid.Parse(HidAreaID.Value), FinYear, FinMonth);
                    if (bmr == null)
                    {
                        bmr = AddMR();
                    }
                    else
                    {
                        if (bmr.WFStatus == "Progress" || bmr.WFStatus == "Approved")
                        {
                            bmr = AddMR();
                        }
                    }
                    //为当前月度经营报告(bmr),插入月度经营明细数据
                    AddBMRD(bmr);
                }
                else
                {
                    hideMonthReportID.Value = Request["BusinessID"];
                    bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(Request["BusinessID"].ToGuid());
                    ddlSystem.SelectedValue = bmr.SystemID.ToString();
                    ddlAreaID.SelectedValue = bmr.AreaID.ToString();
                    FinYear      = bmr.FinYear;
                    FinMonth     = bmr.FinMonth;
                    lblName.Text = "";
                    lblName.Text = FinYear + "-" + FinMonth + "月度经营报告上报";
                }

                if (bmr != null)
                {
                    hideMonthReportID.Value = bmr.ID.ToString();
                    MutipleUpload.LoadByBusinessID(bmr.ID.ToString());
                    UserControl.SetButtonSpanStyle(bmr.Status);
                }
                else
                {
                    hiddenDis.Value = "2";
                    UserControl.SetButtonSpanStyle(-1);
                }
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Initial the Data Source of MonthReport and MonthlyReportDetail.
        /// if IsLatestVersion is true, the data source will be B_ table  and WFStatus == Progress.
        /// otherwise, the data source is A_ atble
        /// </summary>
        /// <param name="IsLatestVersion">if the data source should be  B_ Table</param>
        void InitialData(bool IsLatestVersion, bool IsAll)
        {
            if (IsLatestVersion)
            {
                if (LastestMonthlyReport != null)
                {
                    Report = LastestMonthlyReport.ToVModel();
                    if (_MonthReportID == Guid.Empty)
                    {
                        _MonthReportID = Report.ID;
                    }
                }
                ReportDetails = new List <MonthlyReportDetail>();

                if (DataSource == "Draft")
                {
                    ReportDetails = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailList_Draft(_System.ID, FinYear, FinMonth, _MonthReportID, TargetPlanID, _SystemBatchID, IsAll);
                }
                else
                {
                    ReportDetails = B_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailList_Approve(_System.ID, FinYear, FinMonth, _MonthReportID, TargetPlanID, _SystemBatchID, IsAll);
                }

                //LastestMonthlyReportDetails.ForEach(P => ReportDetails.Add(P.ToVModel()));
            }
            else
            {
                if (ValidatedMonthlyReport != null)
                {
                    Report = ValidatedMonthlyReport.ToVModel();
                    if (_MonthReportID == Guid.Empty)
                    {
                        _MonthReportID = Report.ID;
                    }
                }
                ReportDetails = new List <MonthlyReportDetail>();
                ReportDetails = A_MonthlyreportdetailOperator.Instance.GetMonthlyReportDetailList_Result(_System.ID, FinYear, FinMonth, TargetPlanID);

                //ValidatedMonthlyReportDetails.ForEach(P => ReportDetails.Add(P.ToVModel()));
            }

            if (UserPermission)
            {
                //筛选当前用户有权限的项目公司信息(因为权限数据缺失暂时注释)
                var companyIDArray = BLL.BizBLL.S_OrganizationalActionOperator.Instance.GetUserCompanyDataNoIsDelete(_System.ID, CurrentLoginName).Select(m => m.ID).ToArray();
                if (companyIDArray.Length > 0)
                {
                    ReportDetails = ReportDetails.Where(m => companyIDArray.Contains(m.CompanyID)).ToList();
                    if (ReportDetails.Any())
                    {
                        _MonthReportID = ReportDetails[0].MonthlyReportID;
                        if (IsLatestVersion)
                        {
                            _LastestMonthlyReport = B_MonthlyreportOperator.Instance.GetMonthlyreport(ReportDetails[0].MonthlyReportID);
                            Report = LastestMonthlyReport.ToVModel();
                        }
                        else
                        {
                            _ValidatedMonthlyReport = A_MonthlyreportOperator.Instance.GetMonthlyreport(ReportDetails[0].MonthlyReportID);
                            Report = ValidatedMonthlyReport.ToVModel();
                        }
                    }
                }
                else
                {
                    ReportDetails = new List <MonthlyReportDetail>();
                }
            }
        }