Esempio n. 1
0
        public void CreateDeptBudgetSumDetail(T_FB_DEPTBUDGETAPPLYMASTER entity)
        {
            if (UpdateOldDetail(entity))
            {
                return;
            }

            T_FB_DEPTBUDGETSUMDETAIL detail = new T_FB_DEPTBUDGETSUMDETAIL();

            detail.DEPTBUDGETSUMDETAILID      = Guid.NewGuid().ToString();
            detail.CREATEUSERID               = SYSTEM_USER_ID;
            detail.CREATEDATE                 = System.DateTime.Now;
            detail.UPDATEUSERID               = SYSTEM_USER_ID;
            detail.UPDATEDATE                 = System.DateTime.Now;
            detail.T_FB_DEPTBUDGETAPPLYMASTER = entity;
            FBEntity fbDetail = detail.ToFBEntity();

            fbDetail.FBEntityState = FBEntityState.Added;

            FBEntity fbSumMaster = new FBEntity();

            fbSumMaster = GetDeptBudgetSum(entity);
            detail.T_FB_DEPTBUDGETSUMMASTER = fbSumMaster.Entity as T_FB_DEPTBUDGETSUMMASTER;
            fbSumMaster.AddFBEntities <T_FB_DEPTBUDGETSUMDETAIL>(new List <FBEntity> {
                fbDetail
            });
            this.InnerSave(fbSumMaster);
        }
Esempio n. 2
0
        //自定义汇总
        public bool CreateCompanyBudgetSumSetMaster(FBEntity fbMaster)
        {
            bool bRes = false;
            T_FB_COMPANYBUDGETSUMMASTER Master = fbMaster.Entity as T_FB_COMPANYBUDGETSUMMASTER;

            foreach (var entity in Master.T_FB_COMPANYBUDGETSUMDETAIL)
            {
                T_FB_COMPANYBUDGETSUMDETAIL detail = new T_FB_COMPANYBUDGETSUMDETAIL();

                detail.COMPANYBUDGETSUMDETAILID = Guid.NewGuid().ToString();
                detail.CREATEUSERID             = SYSTEM_USER_ID;
                detail.CREATEDATE   = System.DateTime.Now;
                detail.UPDATEUSERID = SYSTEM_USER_ID;
                detail.UPDATEDATE   = System.DateTime.Now;
                detail.T_FB_COMPANYBUDGETAPPLYMASTER = entity.T_FB_COMPANYBUDGETAPPLYMASTER;
                FBEntity fbDetail = detail.ToFBEntity();
                fbDetail.FBEntityState = FBEntityState.Added;

                List <FBEntity> fbSumMasterlist = new List <FBEntity>();

                //查找汇总节点设置 有则新增汇总记录
                FBEntity        fbSumMaster = new FBEntity();
                QueryExpression qeDetail    = QueryExpression.Equal(FieldName.OwnerCompanyID, entity.T_FB_COMPANYBUDGETAPPLYMASTER.OWNERCOMPANYID).And(FieldName.EditStates, "1");
                qeDetail.QueryType = "T_FB_SUMSETTINGSDETAIL";
                T_FB_SUMSETTINGSDETAIL detailset = GetEntities <T_FB_SUMSETTINGSDETAIL>(qeDetail).FirstOrDefault();
                T_FB_SUMSETTINGSMASTER masterset = null;
                if (detailset != null)
                {
                    QueryExpression qeMaster = QueryExpression.Equal("SUMSETTINGSMASTERID", detailset.T_FB_SUMSETTINGSMASTERReference.EntityKey.EntityKeyValues[0].Value.ToString()).And(FieldName.EditStates, "1");
                    qeMaster.QueryType = "T_FB_SUMSETTINGSMASTER";
                    masterset          = GetEntities <T_FB_SUMSETTINGSMASTER>(qeMaster).FirstOrDefault();
                    if (masterset != null)
                    {
                        fbSumMaster = GetCompanyBudgetSumSet(entity, masterset);
                        detail.T_FB_COMPANYBUDGETSUMMASTER = fbSumMaster.Entity as T_FB_COMPANYBUDGETSUMMASTER;
                        fbSumMaster.AddFBEntities <T_FB_COMPANYBUDGETSUMDETAIL>(new List <FBEntity> {
                            fbDetail
                        });
                        fbSumMasterlist.Add(fbSumMaster);
                        Master.PARENTID            = detail.T_FB_COMPANYBUDGETSUMMASTER.COMPANYBUDGETSUMMASTERID;
                        Master.SUMSETTINGSMASTERID = masterset.SUMSETTINGSMASTERID;
                        Master.SUMLEVEL            = 1; //0:代表当前汇总单不走自定义汇总流程;1:代表当前汇总单走自定义汇总流程
                        fbMaster.Entity            = Master;
                        fbMaster.FBEntityState     = FBEntityState.Modified;
                        fbSumMasterlist.Add(fbMaster);
                        this.FBEntityBLLSaveListNoTrans(fbSumMasterlist);
                        // this.InnerSave(fbSumMaster);
                    }
                }
            }

            bRes = true;
            return(bRes);
        }
Esempio n. 3
0
        protected override void OnLoadDataComplete()
        {
            var details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_COMPANYBUDGETSUMDETAIL).Name);

            List <T_FB_COMPANYBUDGETAPPLYDETAIL> listDetail = new List <T_FB_COMPANYBUDGETAPPLYDETAIL>();


            this.OrderEntity.FBEntity.OrderDetailBy <T_FB_COMPANYBUDGETAPPLYDETAIL>(item =>
            {
                return(item.T_FB_COMPANYBUDGETAPPLYMASTER.OWNERDEPARTMENTID);
            });

            details.ToList().ForEach(item =>
            {
                var cDetail = (item.Entity as T_FB_COMPANYBUDGETSUMDETAIL).T_FB_COMPANYBUDGETAPPLYDETAIL;
                item.AddFBEntities <T_FB_COMPANYBUDGETAPPLYDETAIL>(cDetail.ToFBEntityList());

                item.OrderDetailBy <T_FB_COMPANYBUDGETAPPLYDETAIL>(detail =>
                {
                    return(detail.T_FB_SUBJECT != null ? detail.T_FB_SUBJECT.SUBJECTCODE : string.Empty);
                });
                listDetail.AddRange(cDetail);
            });

            var detailSum = from item in listDetail
                            group item by item.T_FB_SUBJECT into p
                            select new V_SubjectCompanySum
            {
                T_FB_SUBJECT = p.Key,
                BUDGETMONEY  = p.Sum(sumItem => sumItem.BUDGETMONEY),
                T_FB_COMPANYBUDGETAPPLYDETAIL = listDetail.Where(de => de.T_FB_SUBJECT == p.Key).ToList()
            };
            var detailsTwo = this.OrderEntity.GetRelationFBEntities(typeof(V_SubjectCompanySum).Name);

            foreach (var ds in detailSum)
            {
                FBEntity fbDetail    = ds.ToFBEntity();
                var      listDetails = fbDetail.GetRelationFBEntities(typeof(T_FB_COMPANYBUDGETAPPLYDETAIL).Name);

                fbDetail.AddFBEntities <T_FB_COMPANYBUDGETAPPLYDETAIL>(ds.T_FB_COMPANYBUDGETAPPLYDETAIL.ToFBEntityList());

                fbDetail.OrderDetailBy <T_FB_COMPANYBUDGETAPPLYDETAIL>(item =>
                {
                    return(item.T_FB_COMPANYBUDGETAPPLYMASTER.OWNERDEPARTMENTID);
                });

                detailsTwo.Add(fbDetail);
            }
            this.OrderEntity.FBEntity.OrderDetailBy <V_SubjectCompanySum>(item =>
            {
                return(item.T_FB_SUBJECT.SUBJECTCODE);
            });
        }
Esempio n. 4
0
        protected override void OnLoadDataComplete()
        {
            var details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_DEPTBUDGETSUMDETAIL).Name);

            this.OrderEntity.FBEntity.OrderDetailBy <T_FB_DEPTBUDGETSUMDETAIL>(item =>
            {
                return(item.T_FB_DEPTBUDGETAPPLYMASTER.OWNERDEPARTMENTID);
            });

            List <T_FB_DEPTBUDGETAPPLYDETAIL> listDetail = new List <T_FB_DEPTBUDGETAPPLYDETAIL>();

            details.ToList().ForEach(item =>
            {
                var cDetail = (item.Entity as T_FB_DEPTBUDGETSUMDETAIL).T_FB_DEPTBUDGETAPPLYDETAIL;
                item.AddFBEntities <T_FB_DEPTBUDGETAPPLYDETAIL>(cDetail.ToFBEntityList());
                item.OrderDetailBy <T_FB_DEPTBUDGETAPPLYDETAIL>(detail =>
                {
                    return(detail.T_FB_SUBJECT.SUBJECTCODE);
                });
                listDetail.AddRange(cDetail);
            });

            var detailSum = from item in listDetail
                            group item by item.T_FB_SUBJECT into p
                            select new V_SubjectDepartmentSum
            {
                T_FB_SUBJECT = p.Key,
                BUDGETMONEY  = p.Sum(sumItem => sumItem.TOTALBUDGETMONEY.Value),
                T_FB_DEPTBUDGETAPPLYDETAIL = listDetail.Where(de => de.T_FB_SUBJECT == p.Key).ToList()
            };
            var detailsTwo = this.OrderEntity.GetRelationFBEntities(typeof(V_SubjectDepartmentSum).Name);

            foreach (var ds in detailSum)
            {
                FBEntity fbDetail = ds.ToFBEntity();
                fbDetail.AddFBEntities <T_FB_DEPTBUDGETAPPLYDETAIL>(ds.T_FB_DEPTBUDGETAPPLYDETAIL.ToFBEntityList());

                fbDetail.OrderDetailBy <T_FB_DEPTBUDGETAPPLYDETAIL>(item =>
                {
                    return(item.T_FB_DEPTBUDGETAPPLYMASTER.OWNERDEPARTMENTID);
                });
                detailsTwo.Add(fbDetail);
            }

            this.OrderEntity.FBEntity.OrderDetailBy <V_SubjectDepartmentSum>(item =>
            {
                return(item.T_FB_SUBJECT.SUBJECTCODE);
            });

            T_FB_DEPTBUDGETSUMMASTER master = this.OrderEntity.Entity as T_FB_DEPTBUDGETSUMMASTER;

            this.OrderMessage = "单据的截止提交时间为:" + master.BUDGETARYMONTH.AddDays(-1).ToLongDateString();
        }
Esempio n. 5
0
        /// <summary>
        /// 添加不生效岗位
        /// </summary>
        /// <param name="subjectDepartment"></param>
        /// <param name="virtualPost"></param>
        private void CreateNonActionPost(T_FB_SUBJECTDEPTMENT subjectDepartment, VirtualPost virtualPost)
        {
            ObservableCollection <FBEntity> listFBEntities = new ObservableCollection <FBEntity>();
            FBEntity fbEntityPostNew = this.CreateSubjectPost(subjectDepartment, virtualPost, "ACTIVED");

            listFBEntities.Add(fbEntityPostNew);
            FBEntity postFBEntity = virtualPost.ToFBEntity();

            postFBEntity.AddFBEntities <T_FB_SUBJECTPOST>(listFBEntities);
            OrderEntity entityPost = new OrderEntity(postFBEntity);

            EntityList.Add(entityPost);
        }
Esempio n. 6
0
        private void CreateNonActionSubjectPost(T_FB_SUBJECTDEPTMENT sd, T_FB_SUBJECTPOST post, VirtualPost virtualPost)
        {
            ObservableCollection <FBEntity> listFBEntities = new ObservableCollection <FBEntity>();

            post.ACTIVED    = 0;
            post.UPDATEDATE = DateTime.Now;
            FBEntity fbEntityPostNew = post.ToFBEntity();

            fbEntityPostNew.FBEntityState = FBEntityState.Modified;
            listFBEntities.Add(fbEntityPostNew);
            FBEntity postFBEntity = virtualPost.ToFBEntity();

            postFBEntity.AddFBEntities <T_FB_SUBJECTPOST>(listFBEntities);
            OrderEntity entityPost = new OrderEntity(postFBEntity);

            EntityList.Add(entityPost);
        }
Esempio n. 7
0
        protected void testGetPersonMoneyAssign_Click(object sender, EventArgs e)
        {
            SMT.FB.BLL.BudgetAccountBLL bll = new BudgetAccountBLL();
            var masters = bll.GetPersonMoneyAssign(this.inputASSIGNCOMPANYID.Value, this.inputOWNERID.Value, "");

            List <FBEntity> resultList = new List <FBEntity>();

            if (masters != null)
            {
                FBEntity fbResult = masters.ToFBEntity();

                //处理岗位信息一栏
                List <T_FB_PERSONMONEYASSIGNDETAIL> rlist = masters.T_FB_PERSONMONEYASSIGNDETAIL.ToList();
                // rlist = obll.UpdatePostInfo(rlist);
                //按公司、部门排序
                rlist = rlist.OrderBy(c => c.OWNERCOMPANYID).ThenBy(c => c.OWNERDEPARTMENTID).ToList();

                fbResult.AddFBEntities <T_FB_PERSONMONEYASSIGNDETAIL>(rlist.ToFBEntityList());
                resultList.Add(fbResult);
                this.GridView1.DataSource = masters.T_FB_PERSONMONEYASSIGNDETAIL.ToList();
                this.DataBind();
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 创建或获取相应岗位科目
        /// </summary>
        /// <param name="virtualPost"></param>
        /// <returns></returns>
        private OrderEntity CreatePostEntity(VirtualPost virtualPost, TreeViewItem treeViewItem, string strFlag)
        {
            ObservableCollection <FBEntity> listFBEntities = new ObservableCollection <FBEntity>();
            OrderEntity oeDepartment = dictDepartment[virtualPost.VirtualDepartment];

            // 已存在的岗位科目
            ObservableCollection <FBEntity> listOfSubjectDepartmentFB = oeDepartment.GetRelationFBEntities(typeof(T_FB_SUBJECTDEPTMENT).Name);

            // 1. 获取所有已启用的部门科目
            var itemsDepartmentActived = listOfSubjectDepartmentFB.Where(item =>
            {
                return((item.Entity as T_FB_SUBJECTDEPTMENT).ACTIVED == 1);
            });

            // 2. 遍历所有已启用的部门科目, 添加相应的岗位科目,已有科目的,则加上原有的,没有的,则新增

            foreach (FBEntity entityDepartment in itemsDepartmentActived)
            {
                T_FB_SUBJECTDEPTMENT sd = entityDepartment.Entity as T_FB_SUBJECTDEPTMENT;

                // 是否已有岗位科目的记录
                List <FBEntity> listPost = entityDepartment.GetRelationFBEntities(typeof(T_FB_SUBJECTPOST).Name, item =>
                {
                    return((item.Entity as T_FB_SUBJECTPOST).OWNERPOSTID == virtualPost.ID);
                });

                // 已有岗位科目,添加。没有,就新增
                if (listPost.Count > 0)
                {
                    T_FB_SUBJECTPOST post = listPost[0].Entity as T_FB_SUBJECTPOST;
                    if (post.ACTIVED != sd.ACTIVED)
                    {
                        listPost[0].FBEntityState = FBEntityState.Modified;
                    }
                    //岗位默认处理
                    if (post != null)
                    {
                        post = SubjectPostChanged(sd, post, strFlag);
                    }
                    listPost[0].Entity = post;
                    listFBEntities.Add(listPost[0]);
                }
                else
                {
                    //临时添加防止重复数据
                    var a = staticobpost.FirstOrDefault(item => (item.Entity as T_FB_SUBJECTPOST).OWNERPOSTID == virtualPost.ID && (item.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECT != null && (item.Entity as T_FB_SUBJECTPOST).T_FB_SUBJECT.SUBJECTID == sd.T_FB_SUBJECT.SUBJECTID);
                    if (a == null && sd.ACTIVED == 1)
                    {
                        FBEntity fbEntityPostNew = this.CreateSubjectPost(sd, virtualPost, strFlag);
                        listFBEntities.Add(fbEntityPostNew);

                        staticobpost.Add(fbEntityPostNew);
                    }
                    else
                    {
                        listFBEntities.Add(a);
                    }
                }
            }

            FBEntity postFBEntity = virtualPost.ToFBEntity();

            postFBEntity.AddFBEntities <T_FB_SUBJECTPOST>(listFBEntities);
            OrderEntity entityPost = new OrderEntity(postFBEntity);

            Binding binding = new Binding();

            binding.Path = new PropertyPath("Entity.Name");
            treeViewItem.SetBinding(TreeViewItem.HeaderProperty, binding);
            treeViewItem.DataContext = entityPost;
            EntityList.Add(entityPost);
            return(entityPost);
        }
Esempio n. 9
0
        //自定义汇总
        public bool CreateDeptBudgetSumSetMaster(FBEntity fbMaster)
        {
            bool bRes = false;
            T_FB_DEPTBUDGETSUMMASTER Master = fbMaster.Entity as T_FB_DEPTBUDGETSUMMASTER;

            Tracer.Debug("预算汇总单终审开始创建二次预算汇总单据,公司名:" + Master.OWNERCOMPANYNAME + " 单号:"
                         + Master.DEPTBUDGETSUMMASTERCODE);
            try
            {
                foreach (var entity in Master.T_FB_DEPTBUDGETSUMDETAIL)
                {
                    T_FB_DEPTBUDGETSUMDETAIL detail = new T_FB_DEPTBUDGETSUMDETAIL();

                    detail.DEPTBUDGETSUMDETAILID      = Guid.NewGuid().ToString();
                    detail.CREATEUSERID               = SYSTEM_USER_ID;
                    detail.CREATEDATE                 = System.DateTime.Now;
                    detail.UPDATEUSERID               = SYSTEM_USER_ID;
                    detail.UPDATEDATE                 = System.DateTime.Now;
                    detail.T_FB_DEPTBUDGETAPPLYMASTER = entity.T_FB_DEPTBUDGETAPPLYMASTER;
                    FBEntity fbDetail = detail.ToFBEntity();
                    fbDetail.FBEntityState = FBEntityState.Added;

                    List <FBEntity> fbSumMasterlist = new List <FBEntity>();

                    //查找汇总节点设置 有则新增汇总记录
                    FBEntity        fbSumMaster = new FBEntity();
                    QueryExpression qeDetail    = QueryExpression.Equal(FieldName.OwnerCompanyID, entity.T_FB_DEPTBUDGETAPPLYMASTER.OWNERCOMPANYID);
                    qeDetail.QueryType = "T_FB_SUMSETTINGSDETAIL";

                    QueryExpression qeDetailEdits = QueryExpression.Equal(FieldName.EditStates, "1");
                    qeDetail.RelatedExpression = qeDetailEdits;

                    T_FB_SUMSETTINGSDETAIL detailset = GetEntities <T_FB_SUMSETTINGSDETAIL>(qeDetail).FirstOrDefault();
                    T_FB_SUMSETTINGSMASTER masterset = null;
                    if (detailset != null)
                    {
                        QueryExpression qeMaster = QueryExpression.Equal("SUMSETTINGSMASTERID", detailset.T_FB_SUMSETTINGSMASTERReference.EntityKey.EntityKeyValues[0].Value.ToString());
                        qeMaster.QueryType = "T_FB_SUMSETTINGSMASTER";

                        QueryExpression qeMasterEdits = QueryExpression.Equal(FieldName.EditStates, "1");
                        qeMaster.RelatedExpression = qeMasterEdits;

                        masterset = GetEntities <T_FB_SUMSETTINGSMASTER>(qeMaster).FirstOrDefault();
                        if (masterset != null)
                        {
                            fbSumMaster = GetDeptBudgetSumSet(entity, masterset);

                            detail.T_FB_DEPTBUDGETSUMMASTER = fbSumMaster.Entity as T_FB_DEPTBUDGETSUMMASTER;
                            fbSumMaster.AddFBEntities <T_FB_DEPTBUDGETSUMDETAIL>(new List <FBEntity> {
                                fbDetail
                            });
                            fbSumMasterlist.Add(fbSumMaster);
                            //修改旧汇总单,原因不详
                            Master.PARENTID            = detail.T_FB_DEPTBUDGETSUMMASTER.DEPTBUDGETSUMMASTERID;
                            Master.SUMSETTINGSMASTERID = masterset.SUMSETTINGSMASTERID;
                            Master.UPDATEDATE          = DateTime.Now;
                            //Master.SUMLEVEL = 1; //0:代表当前汇总单不走自定义汇总流程;1:代表当前汇总单走自定义汇总流程
                            fbMaster.Entity        = Master;
                            fbMaster.FBEntityState = FBEntityState.Modified;
                            fbSumMasterlist.Add(fbMaster);
                            this.FBEntityBLLSaveListNoTrans(fbSumMasterlist);
                            //  this.InnerSave(fbSumMaster);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Tracer.Debug("创建二次汇总单异常:" + ex.ToString());
            }

            bRes = true;
            return(bRes);
        }