private List <long> GetPermissionOrg(string formId) { BusinessObject bizObject = new BusinessObject { Id = formId, PermissionControl = this.View.ParentFormView.BillBusinessInfo.GetForm().SupportPermissionControl, SubSystemId = this.View.ParentFormView.Model.SubSytemId }; return(PermissionServiceHelper.GetPermissionOrg(base.Context, bizObject, "6e44119a58cb4a8e86f6c385e14a17ad")); }
public override void AfterCreateSqlBuilderParameter(SqlBuilderParameterArgs e) { base.AfterCreateSqlBuilderParameter(e); e.sqlBuilderParameter.IsIsolationOrg = true; var orgs = PermissionServiceHelper.GetUserOrg(this.Context); var list = new List <long>(); orgs.ForEach(org => list.Add(org.Id)); e.sqlBuilderParameter.IsolationOrgList = list; }
public ServiceResult Invoke() { var result = new ServiceResult <List <UserOrgInfoOutput> >(); try { var infos = PermissionServiceHelper.GetUserOrg(this.KDContext.Session.AppContext); result.Code = (int)ResultCode.Success; result.Message = ResultCode.Success.ToString(); result.Data = infos.Select(db => new UserOrgInfoOutput { Id = db.Id, Number = db.Number, Name = db.Name }).ToList(); } catch (Exception ex) { result.Code = (int)ResultCode.Fail; result.Message = ex.Message; } return(result); }
public override void AfterCreateNewData(EventArgs e) { long personID = 0; base.AfterCreateNewData(e); string formId = "BD_Department";//部门FORMID Kingdee.BOS.Core.Metadata.FormMetadata formMetaData = MetaDataServiceHelper.GetFormMetaData(this.View.Context, formId); List <long> OrgIds = new List <long>(); OrgIds.Add(this.Context.CurrentOrganizationInfo.ID); DataRuleFilterParamenter filterParameter = new DataRuleFilterParamenter(formId) { PermissionItemId = Kingdee.BOS.Core.Permission.PermissionConst.View,//查看权限项 SubSystemId = formMetaData.BusinessInfo.GetForm().SubsysId, BusinessInfo = formMetaData.BusinessInfo, IsLookUp = true,//是否基础资料权限 bzIsolateOrgIds = OrgIds, //OrgId = this.Context.CurrentOrganizationInfo.ID, ParentFormId = "PAEZ_DisPlayShow"//货架陈列展示FORMID }; DataRuleFilterObject filterObject = PermissionServiceHelper.LoadDataRuleFilter(this.View.Context, filterParameter);//获取权限过滤条件 Kingdee.BOS.Core.SqlBuilder.QueryBuilderParemeter queryParameter = new Kingdee.BOS.Core.SqlBuilder.QueryBuilderParemeter { FormId = formId, BusinessInfo = formMetaData.BusinessInfo, PermissionItemId = Kingdee.BOS.Core.Permission.PermissionConst.View, FilterClauseWihtKey = filterObject.FilterString,//过滤条件 }; Kingdee.BOS.Orm.DataEntity.DynamicObject[] stockObjects = BusinessDataServiceHelper.Load(this.View.Context, formMetaData.BusinessInfo.GetDynamicObjectType(), queryParameter); if (stockObjects.Count() > 0) { string strSql = string.Format(@"/*dialect*/SELECT FLINKOBJECT FROM T_SEC_USER WHERE FUSERID = {0}", this.View.Context.UserId); personID = DBUtils.ExecuteScalar <long>(this.View.Context, strSql, 0, null); if (personID > 0) { string searchSql = string.Format(@"SELECT COUNT(1) FROM USER_TABLES WHERE TABLE_NAME = 'TABLE{0}'", personID); int num = DBUtils.ExecuteScalar <int>(this.View.Context, searchSql, 0, null); if (num > 0) { string dropSql = string.Format(@"/*dialect*/drop table TABLE{0}", personID); DBUtils.Execute(this.View.Context, dropSql); } string createSql = string.Format(@"/*dialect*/create table TABLE{0} ( DEPTID NUMBER(10) not null, DEPTNAME NVARCHAR2(255) not null )", personID); DBUtils.Execute(this.View.Context, createSql); object[] stockId = (from c in stockObjects select c[0]).ToArray(); string ids = string.Join(",", stockId); string insertSql = string.Format(@"/*dialect*/INSERT INTO TABLE{0} SELECT DEPT.FDEPTID,DEPTL.FNAME FROM T_BD_DEPARTMENT DEPT INNER JOIN T_BD_DEPARTMENT_L DEPTL ON DEPT.FDEPTID = DEPTL.FDEPTID WHERE DEPT.FDEPTID IN ({1})", personID, ids); DBUtils.Execute(this.View.Context, insertSql); } } JSONObject webobj = new JSONObject(); webobj["source"] = string.Format(@"http://221.180.255.112:9000/taoli/action2/delivery_deliveryLinebMapWeb.action?orgID={0}&orgName={1}&personID={2}", this.View.Context.CurrentOrganizationInfo.ID, this.View.Context.CurrentOrganizationInfo.Name, personID); webobj["height"] = 545; webobj["width"] = 810; webobj["isweb"] = true; //是否新弹出一个浏览器窗口(or选项卡)打开网页地址 webobj["title"] = "金蝶官网"; this.View.AddAction("ShowKDWebbrowseForm", webobj); this.View.SendDynamicFormAction(this.View); this.View.Close(); }
public static IRptParams CreateFromSysReportFilterScheme(this IRptParams rpt, Context ctx, FormMetadata reportMetadata, Func <ICommonFilterModelService, string> schemeSelector) { //字段比较条件元数据。 var filterMetadata = FormMetaDataCache.GetCachedFilterMetaData(ctx); //账表元数据。 var reportFormId = reportMetadata.BusinessInfo.GetForm().Id; //过滤条件元数据。 var reportFilterFormId = reportMetadata.BusinessInfo.GetForm().FilterObject; var reportFilterMetadata = FormMetaDataCache.GetCachedFormMetaData(ctx, reportFilterFormId); var reportFilterServiceProvider = reportFilterMetadata.BusinessInfo.GetForm().GetFormServiceProvider(); //过滤方案元数据。 var schemeFormId = FormIdConst.BOS_FilterScheme; var schemeMetadata = FormMetaDataCache.GetCachedFormMetaData(ctx, schemeFormId); //用户参数元数据。 var parameterDataFormId = reportMetadata.BusinessInfo.GetForm().ParameterObjectId; var parameterDataMetadata = FormMetaDataCache.GetCachedFormMetaData(ctx, parameterDataFormId); var model = new SysReportFilterModel(); model.SetContext(ctx, reportFilterMetadata.BusinessInfo, reportFilterServiceProvider); model.FormId = reportFilterFormId; model.FilterObject.FilterMetaData = filterMetadata; model.InitFieldList(reportMetadata, reportFilterMetadata); model.GetSchemeList(); //方案加载,返回选中的过滤方案主键。 schemeSelector = schemeSelector != null ? schemeSelector : s => { model.LoadDefaultScheme(); return(string.Empty); }; var schemeId = schemeSelector(model); //打开参数,暂时不指定任何项。 var openParameter = new Dictionary <string, object>(); //如果指定了过滤方案,则根据过滤方案查找创建用户。 long userId = -1L; if (!string.IsNullOrWhiteSpace(schemeId)) { var schemeBusinessInfo = schemeMetadata.BusinessInfo.GetSubBusinessInfo(new List <string> { "FUserID" }); userId = BusinessDataServiceHelper.LoadSingle(ctx, schemeId, schemeBusinessInfo.GetDynamicObjectType()) .FieldProperty <long>(schemeBusinessInfo.GetField("FUserID")); }//end if //加载用户参数数据包。 var parameterData = UserParamterServiceHelper.Load(ctx, parameterDataMetadata.BusinessInfo, userId, reportFormId, KeyConst.USERPARAMETER_KEY); IRptParams p = new RptParams(); p.CustomParams.Add(KeyConst.OPENPARAMETER_KEY, openParameter); p.FormId = reportFilterFormId; p.StartRow = 1; p.EndRow = int.MaxValue;//StartRow和EndRow是报表数据分页的起始行数和截至行数,一般取所有数据,所以EndRow取int最大值。 p.FilterParameter = model.GetFilterParameter(); p.FilterFieldInfo = model.FilterFieldInfo; p.BaseDataTempTable.AddRange(PermissionServiceHelper.GetBaseDataTempTable(ctx, reportFormId)); p.ParameterData = parameterData; return(p); }//end static method
public override void CreateNewData(BizDataEventArgs e) { DynamicObjectType dynamicObjectType = this.Model.BillBusinessInfo.GetDynamicObjectType(); Entity entity = this.View.BusinessInfo.Entrys[1]; DynamicObjectType dt = entity.DynamicObjectType; DynamicObject dataEntity = new DynamicObject(dynamicObjectType) { ["CloseDate"] = DateTime.Now.Date }; DynamicObjectCollection objects = entity.DynamicProperty.GetValue <DynamicObjectCollection>(dataEntity); BusinessObject bizObject = new BusinessObject { Id = "STK_Account", PermissionControl = 1, SubSystemId = "STK" }; List <long> valList = PermissionServiceHelper.GetPermissionOrg(base.Context, bizObject, this.isOpenAccount ? "4cc4dea42de6441ebeb21c509358d73d" : "1046d14017fd45dbaff9b1fe4affe0c6"); if ((valList == null) || (valList.Count < 1)) { e.BizDataObject = dataEntity; } else { Dictionary <string, object> batchStockDate = StockServiceHelper.GetBatchStockDate(base.Context, valList); if ((batchStockDate == null) || (batchStockDate.Keys.Count < 1)) { e.BizDataObject = dataEntity; } else { valList.Clear(); foreach (string str in batchStockDate.Keys) { valList.Add(Convert.ToInt64(str)); } List <SelectorItemInfo> list2 = new List <SelectorItemInfo> { new SelectorItemInfo("FORGID"), new SelectorItemInfo("FName"), new SelectorItemInfo("FNumber"), new SelectorItemInfo("FDescription") }; string str2 = this.GetInFilter(" FORGID", valList) + $" AND FDOCUMENTSTATUS = 'C' AND FFORBIDSTATUS = 'A' AND (FORGFUNCTIONS like'%103%') AND EXISTS(SELECT 1 FROM T_BAS_SYSTEMPROFILE BSP WHERE BSP.FCATEGORY = 'STK' AND BSP.FORGID = FORGID AND BSP.FACCOUNTBOOKID = 0 AND BSP.FKEY = 'IsInvEndInitial' AND BSP.FVALUE = '1') {(this.isOpenAccount ? "AND EXISTS(SELECT 1 FROM T_STK_CLOSEPROFILE SCP WHERE SCP.FCATEGORY = 'STK' AND SCP.FORGID = FORGID )" : "")} "; QueryBuilderParemeter para = new QueryBuilderParemeter { FormId = "ORG_Organizations", SelectItems = list2, FilterClauseWihtKey = str2, OrderByClauseWihtKey = "", IsolationOrgList = null, RequiresDataPermission = true }; DynamicObjectCollection source = QueryServiceHelper.GetDynamicObjectCollection(base.Context, para, null); DataTable stockOrgAcctLastCloseDate = CommonServiceHelper.GetStockOrgAcctLastCloseDate(base.Context, ""); Dictionary <long, DateTime> dictionary2 = new Dictionary <long, DateTime>(); foreach (DataRow row in stockOrgAcctLastCloseDate.Rows) { if (!(row["FCLOSEDATE"] is DBNull) && !string.IsNullOrWhiteSpace(row["FCLOSEDATE"].ToString())) { dictionary2[Convert.ToInt64(row["FORGID"])] = Convert.ToDateTime(row["FCLOSEDATE"]); } } int num = 0; if ((source != null) && (source.Count <DynamicObject>() > 0)) { foreach (DynamicObject obj4 in source) { long key = Convert.ToInt64(obj4["FORGID"]); DynamicObject item = new DynamicObject(dt) { ["Check"] = true, ["StockOrgNo"] = obj4["FNumber"].ToString(), ["StockOrgName"] = ((obj4["FName"] == null) || string.IsNullOrEmpty(obj4["FName"].ToString())) ? "" : obj4["FName"].ToString(), ["StockOrgDesc"] = ((obj4["FDescription"] == null) || string.IsNullOrEmpty(obj4["FDescription"].ToString())) ? "" : obj4["FDescription"].ToString(), ["StockOrgID"] = obj4["FORGID"].ToString(), ["Result"] = "", ["RetFlag"] = false, ["Seq"] = num++ }; if (dictionary2.ContainsKey(key)) { item["LastCloseDate"] = dictionary2[key]; } objects.Add(item); } } e.BizDataObject = dataEntity; } } }