Beispiel #1
0
        public override void OnSetLayoutInfo(SetLayoutInfoArgs e)
        {
            base.OnSetLayoutInfo(e);
            // 获取单据体表格的元数据及布局
            string entityKey = "FEntity";
            //Entity entity = _currBusinessInfo.GetEntity(entityKey);
            EntityAppearance entityApp = _currLayoutInfo.GetEntityAppearance(entityKey);
            Entity           entity    = entityApp.Entity;
            var textApp    = _currLayoutInfo.GetFieldAppearance("FField");
            var decimalApp = _currLayoutInfo.GetFieldAppearance("FDecimal");

            for (int i = 0; i < entityData.Columns.Count; i++)
            {
                string name = "FField_" + (i + 1).ToString();
                //FieldAppearance field = new FieldAppearance();
                FieldAppearance field;
                if (i == 0)
                {
                    field = (FieldAppearance)ObjectUtils.CreateCopy(textApp);
                }
                else
                {
                    field = (FieldAppearance)ObjectUtils.CreateCopy(decimalApp);
                    //添加合计列
                    GroupSumColumn sumColumn = new GroupSumColumn();
                    sumColumn.FieldKey  = name;
                    sumColumn.Precision = -1;
                    sumColumn.SumType   = 1;
                    entity.GroupColumnInfo.AddGroupSumColumn(sumColumn);
                }
                field.Key      = name;
                field.Caption  = new LocaleValue(entityData.Columns[i].ColumnName);
                field.Field    = _currBusinessInfo.GetField(name);
                field.Tabindex = i + 1;
                _currLayoutInfo.Add(field);
            }

            _currLayoutInfo.Remove(textApp);
            _currLayoutInfo.Remove(decimalApp);

            entityApp.Layoutinfo.Sort();
            e.LayoutInfo = _currLayoutInfo;

            EntryGrid grid = this.View.GetControl <EntryGrid>("FEntity");

            grid.SetCustomPropertyValue("AllowLayoutSetting", false);
            grid.CreateDyanmicList(_currLayoutInfo.GetEntityAppearance("FEntity"));
            this.View.SendDynamicFormAction(this.View);
        }