public FBEntity GetDeptBudgetSum(T_FB_DEPTBUDGETAPPLYMASTER entity) { FBEntity result = null; DateTime budgetMonth = entity.BUDGETARYMONTH; QueryExpression qe = QueryExpression.Equal(FieldName_BudgetMonth, budgetMonth.ToString("yyyy-MM-dd")); QueryExpression qeStates = QueryExpression.Equal(FieldName.CheckStates, ((int)CheckStates.UnSubmit).ToString()); QueryExpression qeCompany = QueryExpression.Equal(FieldName.OwnerCompanyID, entity.OWNERCOMPANYID); qe.RelatedExpression = qeStates; qeStates.RelatedExpression = qeCompany; T_FB_DEPTBUDGETSUMMASTER sumMaster = this.InnerGetEntities <T_FB_DEPTBUDGETSUMMASTER>(qe).FirstOrDefault(); if (sumMaster == null) { sumMaster = new T_FB_DEPTBUDGETSUMMASTER(); sumMaster.DEPTBUDGETSUMMASTERID = Guid.NewGuid().ToString(); sumMaster.DEPTBUDGETSUMMASTERCODE = "自动生成"; sumMaster.CREATEUSERID = SYSTEM_USER_ID; sumMaster.CREATEUSERNAME = "******"; sumMaster.CREATEDATE = System.DateTime.Now; sumMaster.UPDATEUSERID = SYSTEM_USER_ID; sumMaster.UPDATEDATE = System.DateTime.Now; sumMaster.BUDGETARYMONTH = budgetMonth; sumMaster.CREATECOMPANYID = SYSTEM_USER_ID; sumMaster.CREATECOMPANYNAME = "系统生成"; sumMaster.CREATEDEPARTMENTID = SYSTEM_USER_ID; sumMaster.CREATEDEPARTMENTNAME = "系统生成"; sumMaster.CREATEPOSTID = SYSTEM_USER_ID; sumMaster.CREATEPOSTNAME = "系统生成"; sumMaster.OWNERCOMPANYID = entity.OWNERCOMPANYID; sumMaster.OWNERCOMPANYNAME = entity.OWNERCOMPANYNAME; sumMaster.OWNERDEPARTMENTID = SYSTEM_USER_ID; sumMaster.OWNERDEPARTMENTNAME = "系统生成"; sumMaster.OWNERPOSTID = SYSTEM_USER_ID; sumMaster.OWNERPOSTNAME = "系统生成"; sumMaster.OWNERID = SYSTEM_USER_ID; sumMaster.OWNERNAME = "系统生成"; sumMaster.SUMLEVEL = 0; //0:代表当前汇总单不走自定义汇总流程;1:代表当前汇总单走自定义汇总流程 sumMaster.CHECKSTATES = (int)CheckStates.UnSubmit; sumMaster.EDITSTATES = (int)EditStates.Actived; result = sumMaster.ToFBEntity(); result.FBEntityState = FBEntityState.Added; } else { result = sumMaster.ToFBEntity(); result.FBEntityState = FBEntityState.Modified; } return(result); }
public FBEntity GetDeptBudgetSumSet(T_FB_DEPTBUDGETSUMDETAIL entity, T_FB_SUMSETTINGSMASTER masterset) { FBEntity result = null; DateTime budgetMonth = entity.T_FB_DEPTBUDGETAPPLYMASTER.BUDGETARYMONTH; QueryExpression qe = QueryExpression.Equal(FieldName_BudgetMonth, budgetMonth.ToString("yyyy-MM-dd")); QueryExpression qeStates = QueryExpression.Equal(FieldName.CheckStates, ((int)CheckStates.UnSubmit).ToString()); QueryExpression qeCompany = QueryExpression.Equal(FieldName.OwnerCompanyID, masterset.OWNERCOMPANYID); // QueryExpression qeSumsettings = QueryExpression.Equal("SUMSETTINGSMASTERID", masterset.SUMSETTINGSMASTERID).And("PARENTID", entity.T_FB_DEPTBUDGETSUMMASTER.PARENTID); qe.RelatedExpression = qeStates; qeStates.RelatedExpression = qeCompany; // qeCompany.RelatedExpression = qeSumsettings; T_FB_DEPTBUDGETSUMMASTER sumMaster = this.InnerGetEntities <T_FB_DEPTBUDGETSUMMASTER>(qe).FirstOrDefault(); if (sumMaster == null) { Tracer.Debug("未找到二次汇总单据,生成新的二次汇总单。"); sumMaster = new T_FB_DEPTBUDGETSUMMASTER(); sumMaster.DEPTBUDGETSUMMASTERID = Guid.NewGuid().ToString(); sumMaster.DEPTBUDGETSUMMASTERCODE = "自动生成"; sumMaster.CREATEUSERID = SYSTEM_USER_ID; sumMaster.CREATEUSERNAME = "******"; sumMaster.CREATEDATE = System.DateTime.Now; sumMaster.UPDATEUSERID = SYSTEM_USER_ID; sumMaster.UPDATEDATE = System.DateTime.Now; sumMaster.BUDGETARYMONTH = budgetMonth; sumMaster.CREATECOMPANYID = SYSTEM_USER_ID; sumMaster.CREATECOMPANYNAME = "系统生成"; sumMaster.CREATEDEPARTMENTID = SYSTEM_USER_ID; sumMaster.CREATEDEPARTMENTNAME = "系统生成"; sumMaster.CREATEPOSTID = SYSTEM_USER_ID; sumMaster.CREATEPOSTNAME = "系统生成"; sumMaster.OWNERCOMPANYID = masterset.OWNERCOMPANYID; sumMaster.OWNERCOMPANYNAME = masterset.OWNERCOMPANYNAME; sumMaster.OWNERDEPARTMENTID = masterset.OWNERDEPARTMENTID; sumMaster.OWNERDEPARTMENTNAME = masterset.OWNERDEPARTMENTNAME; sumMaster.OWNERPOSTID = masterset.OWNERPOSTID; sumMaster.OWNERPOSTNAME = masterset.OWNERPOSTNAME; sumMaster.OWNERID = masterset.OWNERID; sumMaster.OWNERNAME = masterset.OWNERNAME; sumMaster.SUMSETTINGSMASTERID = masterset.SUMSETTINGSMASTERID; sumMaster.SUMLEVEL = 1; //0:代表当前汇总单不走自定义汇总流程;1:代表当前汇总单走自定义汇总流程 sumMaster.REMARK = "系统自动生成的二次预算汇总单"; sumMaster.CHECKSTATES = (int)CheckStates.UnSubmit; sumMaster.EDITSTATES = (int)EditStates.Actived; result = sumMaster.ToFBEntity(); result.FBEntityState = FBEntityState.Added; } else { Tracer.Debug("找到二次汇总单据,添加到二次汇总单中,二次汇总单号:" + sumMaster.DEPTBUDGETSUMMASTERCODE); result = sumMaster.ToFBEntity(); result.FBEntityState = FBEntityState.Modified; } return(result); }
public FBEntity GetDeptBudgetSumSet(T_FB_DEPTBUDGETSUMDETAIL entity, T_FB_SUMSETTINGSMASTER masterset) { FBEntity result = null; DateTime budgetMonth = entity.T_FB_DEPTBUDGETAPPLYMASTER.BUDGETARYMONTH; QueryExpression qe = QueryExpression.Equal(FieldName_BudgetMonth, budgetMonth.ToString("yyyy-MM-dd")); QueryExpression qeStates = QueryExpression.Equal(FieldName.CheckStates, ((int)CheckStates.UnSubmit).ToString()); QueryExpression qeCompany = QueryExpression.Equal(FieldName.OwnerCompanyID, masterset.OWNERCOMPANYID); // QueryExpression qeSumsettings = QueryExpression.Equal("SUMSETTINGSMASTERID", masterset.SUMSETTINGSMASTERID).And("PARENTID", entity.T_FB_DEPTBUDGETSUMMASTER.PARENTID); qe.RelatedExpression = qeStates; qeStates.RelatedExpression = qeCompany; // qeCompany.RelatedExpression = qeSumsettings; T_FB_DEPTBUDGETSUMMASTER sumMaster = this.InnerGetEntities<T_FB_DEPTBUDGETSUMMASTER>(qe).FirstOrDefault(); if (sumMaster == null) { Tracer.Debug("未找到二次汇总单据,生成新的二次汇总单。"); sumMaster = new T_FB_DEPTBUDGETSUMMASTER(); sumMaster.DEPTBUDGETSUMMASTERID = Guid.NewGuid().ToString(); sumMaster.DEPTBUDGETSUMMASTERCODE = "自动生成"; sumMaster.CREATEUSERID = SYSTEM_USER_ID; sumMaster.CREATEUSERNAME = "******"; sumMaster.CREATEDATE = System.DateTime.Now; sumMaster.UPDATEUSERID = SYSTEM_USER_ID; sumMaster.UPDATEDATE = System.DateTime.Now; sumMaster.BUDGETARYMONTH = budgetMonth; sumMaster.CREATECOMPANYID = SYSTEM_USER_ID; sumMaster.CREATECOMPANYNAME = "系统生成"; sumMaster.CREATEDEPARTMENTID = SYSTEM_USER_ID; sumMaster.CREATEDEPARTMENTNAME = "系统生成"; sumMaster.CREATEPOSTID = SYSTEM_USER_ID; sumMaster.CREATEPOSTNAME = "系统生成"; sumMaster.OWNERCOMPANYID = masterset.OWNERCOMPANYID; sumMaster.OWNERCOMPANYNAME = masterset.OWNERCOMPANYNAME; sumMaster.OWNERDEPARTMENTID = masterset.OWNERDEPARTMENTID; sumMaster.OWNERDEPARTMENTNAME = masterset.OWNERDEPARTMENTNAME; sumMaster.OWNERPOSTID = masterset.OWNERPOSTID; sumMaster.OWNERPOSTNAME = masterset.OWNERPOSTNAME; sumMaster.OWNERID = masterset.OWNERID; sumMaster.OWNERNAME = masterset.OWNERNAME; sumMaster.SUMSETTINGSMASTERID = masterset.SUMSETTINGSMASTERID; sumMaster.SUMLEVEL = 1; //0:代表当前汇总单不走自定义汇总流程;1:代表当前汇总单走自定义汇总流程 sumMaster.REMARK = "系统自动生成的二次预算汇总单"; sumMaster.CHECKSTATES = (int)CheckStates.UnSubmit; sumMaster.EDITSTATES = (int)EditStates.Actived; result = sumMaster.ToFBEntity(); result.FBEntityState = FBEntityState.Added; } else { Tracer.Debug("找到二次汇总单据,添加到二次汇总单中,二次汇总单号:"+sumMaster.DEPTBUDGETSUMMASTERCODE); result = sumMaster.ToFBEntity(); result.FBEntityState = FBEntityState.Modified; } return result; }
public FBEntity GetDeptBudgetSum(T_FB_DEPTBUDGETAPPLYMASTER entity) { FBEntity result = null; DateTime budgetMonth = entity.BUDGETARYMONTH; QueryExpression qe = QueryExpression.Equal(FieldName_BudgetMonth, budgetMonth.ToString("yyyy-MM-dd")); QueryExpression qeStates = QueryExpression.Equal(FieldName.CheckStates, ((int)CheckStates.UnSubmit).ToString()); QueryExpression qeCompany = QueryExpression.Equal(FieldName.OwnerCompanyID, entity.OWNERCOMPANYID); qe.RelatedExpression = qeStates; qeStates.RelatedExpression = qeCompany; T_FB_DEPTBUDGETSUMMASTER sumMaster = this.InnerGetEntities<T_FB_DEPTBUDGETSUMMASTER>(qe).FirstOrDefault(); if (sumMaster == null) { sumMaster = new T_FB_DEPTBUDGETSUMMASTER(); sumMaster.DEPTBUDGETSUMMASTERID = Guid.NewGuid().ToString(); sumMaster.DEPTBUDGETSUMMASTERCODE = "自动生成"; sumMaster.CREATEUSERID = SYSTEM_USER_ID; sumMaster.CREATEUSERNAME = "******"; sumMaster.CREATEDATE = System.DateTime.Now; sumMaster.UPDATEUSERID = SYSTEM_USER_ID; sumMaster.UPDATEDATE = System.DateTime.Now; sumMaster.BUDGETARYMONTH = budgetMonth; sumMaster.CREATECOMPANYID = SYSTEM_USER_ID; sumMaster.CREATECOMPANYNAME = "系统生成"; sumMaster.CREATEDEPARTMENTID = SYSTEM_USER_ID; sumMaster.CREATEDEPARTMENTNAME = "系统生成"; sumMaster.CREATEPOSTID = SYSTEM_USER_ID; sumMaster.CREATEPOSTNAME = "系统生成"; sumMaster.OWNERCOMPANYID = entity.OWNERCOMPANYID; sumMaster.OWNERCOMPANYNAME = entity.OWNERCOMPANYNAME; sumMaster.OWNERDEPARTMENTID = SYSTEM_USER_ID; sumMaster.OWNERDEPARTMENTNAME = "系统生成"; sumMaster.OWNERPOSTID = SYSTEM_USER_ID; sumMaster.OWNERPOSTNAME = "系统生成"; sumMaster.OWNERID = SYSTEM_USER_ID; sumMaster.OWNERNAME = "系统生成"; sumMaster.SUMLEVEL = 0; //0:代表当前汇总单不走自定义汇总流程;1:代表当前汇总单走自定义汇总流程 sumMaster.CHECKSTATES = (int)CheckStates.UnSubmit; sumMaster.EDITSTATES = (int)EditStates.Actived; result = sumMaster.ToFBEntity(); result.FBEntityState = FBEntityState.Added; } else { result = sumMaster.ToFBEntity(); result.FBEntityState = FBEntityState.Modified; } return result; }