Beispiel #1
0
        public override void OnSetBusinessInfo(SetBusinessInfoArgs e)
        {
            new ExtensionPresenter(this);

            base.OnSetBusinessInfo(e);
            // 创建当前单据元数据副本,避免直接修改原始元数据,并发时串账
            FormMetadata currmetadata = (FormMetadata)ObjectUtils.CreateCopy(
                this.View.OpenParameter.FormMetaData);

            _currBusinessInfo = currmetadata.BusinessInfo;
            _currLayoutInfo   = currmetadata.GetLayoutInfo();

            // 取单据头的元数据模型
            currEntityKey = "FBillHead";
            currEntity    = _currBusinessInfo.GetEntity(currEntityKey);

            // 取配置字段的模板,动态添加的字段,是基于模板字段的一个分身
            modelTextField      = _currBusinessInfo.GetField("FModelText");      //文本模板
            modelDecimalField   = _currBusinessInfo.GetField("FModelDecimal");   //小数模板
            modelF8Field        = _currBusinessInfo.GetField("FModelF8");        //F8模板
            modelAssistantField = _currBusinessInfo.GetField("FModelAssistant"); //辅助资料模板


            var simpleExtension = this.View.OpenParameter.GetCustomParameter("simpleExtension") as DynamicObject;

            presenter.GenerateByJson(simpleExtension["FExtension"] as string);

            _currBusinessInfo.GetDynamicObjectType(true);
            e.BusinessInfo     = _currBusinessInfo;
            e.BillBusinessInfo = _currBusinessInfo;
        }
Beispiel #2
0
        public override void OnSetBusinessInfo(SetBusinessInfoArgs e)
        {
            base.OnSetBusinessInfo(e);

            FormMetadata currmetadata = (FormMetadata)ObjectUtils.CreateCopy(this.View.OpenParameter.FormMetaData);

            _currBusinessInfo = currmetadata.BusinessInfo;
            _currLayoutInfo   = currmetadata.GetLayoutInfo();
            // 获取单据体表格的元数据及布局
            string entityKey = "FEntity";
            Entity entity    = _currBusinessInfo.GetEntity(entityKey);
            //EntityAppearance entityApp = _currLayoutInfo.GetEntityAppearance(entityKey);

            string FSDate = this.View.OpenParameter.GetCustomParameter("FSDate") == null ? "" :
                            this.View.OpenParameter.GetCustomParameter("FSDate").ToString();
            string FEDate = this.View.OpenParameter.GetCustomParameter("FEDate") == null ? "" :
                            this.View.OpenParameter.GetCustomParameter("FEDate").ToString();
            string FOrgId = this.View.OpenParameter.GetCustomParameter("FOrgId") == null ? "0" :
                            this.View.OpenParameter.GetCustomParameter("FOrgId").ToString();
            string FDeptID = this.View.OpenParameter.GetCustomParameter("FDeptID") == null ? "0" :
                             this.View.OpenParameter.GetCustomParameter("FDeptID").ToString();
            string FAccountId = this.View.OpenParameter.GetCustomParameter("FAccountId") == null ? "0" :
                                this.View.OpenParameter.GetCustomParameter("FAccountId").ToString();

            string sql = string.Format(@"EXEC proc_czly_AccountDept @SDt='{0}', @EDt='{1}', 
@FOrgId='{2}', @FDeptId='{3}', @FAccountId='{4}'",
                                       FSDate, FEDate, FOrgId, FDeptID, FAccountId);


            Field textField    = _currBusinessInfo.GetField("FField");
            Field decimalField = _currBusinessInfo.GetField("FDecimal");

            //var textApp = _currLayoutInfo.GetEntityAppearance("FField");

            entityData = DBUtils.ExecuteDataSet(this.Context, sql).Tables[0];

            // 获取生成的费用项目列
            sql = string.Format(@"EXEC proc_czly_AccountOrg @SDt='{0}', @EDt='{1}', 
@FOrgId='{2}', @FDeptId='{3}', @FAccountId='{4}'",
                                FSDate, FEDate, FOrgId, FDeptID, FAccountId);
            costItems = DBUtils.ExecuteDataSet(this.Context, sql).Tables[0];

            for (int i = 0; i < entityData.Columns.Count; i++)
            {
                string name = "FField_" + (i + 1).ToString();
                //Field field = new Field();
                Field field;
                if (i == 0)
                {
                    field = (Field)ObjectUtils.CreateCopy(textField);
                }
                else
                {
                    field = (Field)ObjectUtils.CreateCopy(decimalField);
                    // 增加合计列
                    GroupSumColumn sumColumn = new GroupSumColumn();
                    sumColumn.FieldKey  = name;
                    sumColumn.Precision = -1;
                    sumColumn.SumType   = 1;
                    entity.GroupColumnInfo.AddGroupSumColumn(sumColumn);
                }

                field.DynamicProperty = null;
                //field.ElementType = ElementType.BarItemElementType_TextField;
                field.Entity       = entity;
                field.EntityKey    = entityKey;
                field.Key          = name;
                field.FieldName    = name;
                field.PropertyName = name;
                field.Name         = new LocaleValue(name);
                _currBusinessInfo.Add(field);
            }

            _currBusinessInfo.Remove(textField);
            _currBusinessInfo.Remove(decimalField);
            // 强制要求重新构建单据的ORM模型
            _currBusinessInfo.GetDynamicObjectType(true);

            // 输出动态调整后的单据逻辑元数据模型(BusinessInfo)
            e.BusinessInfo     = _currBusinessInfo;
            e.BillBusinessInfo = _currBusinessInfo;
        }
Beispiel #3
0
 public override void OnSetBusinessInfo(SetBusinessInfoArgs e)
 {
     base.OnSetBusinessInfo(e);
 }