Ejemplo n.º 1
0
        public void CreateCompanyBudgetSumDetail(T_FB_COMPANYBUDGETAPPLYMASTER entity)
        {
            if (UpdateOldDetail(entity))
            {
                return;
            }
            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;
            FBEntity fbDetail = detail.ToFBEntity();
            fbDetail.FBEntityState = FBEntityState.Added;

            FBEntity fbSumMaster = new FBEntity();
            fbSumMaster = GetCompanyBudgetSum(entity);           
            detail.T_FB_COMPANYBUDGETSUMMASTER = fbSumMaster.Entity as T_FB_COMPANYBUDGETSUMMASTER;
            fbSumMaster.AddFBEntities<T_FB_COMPANYBUDGETSUMDETAIL>(new List<FBEntity> { fbDetail });
            this.InnerSave(fbSumMaster);
        }
Ejemplo 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;
          
        }
Ejemplo n.º 3
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;
        }