예제 #1
0
        public void BindData(RecordResultCollection data)
        {
            List <DataItem> dataSource = new List <DataItem>();

            try
            {
                data.GroupBy(p => p.TempFullPath).ForEach(p =>
                {
                    RecordResultCollection collection = new RecordResultCollection();
                    p.ForEach(f =>
                    {
                        collection.Add((RecordResult)f);
                    });

                    dataSource.Add(new DataItem()
                    {
                        Key        = p.Key.Split('/').Last(),
                        Collection = collection
                    });
                });
            }
            catch (Exception)
            {
                throw new Exception("获取实体数据失败!");
            }

            rpt_Entities.DataSource = dataSource;
            rpt_Entities.DataBind();
        }
        public RecordResultCollection GetData(string tCode)
        {
            //Saplocalhost.WebServiceConnectSAP srv = new Saplocalhost.WebServiceConnectSAP();
            var       srv   = new Saplocalhost.WebServiceConnectSAPSoapClient();
            DataTable table = srv.GetEntityDefine(tCode);
            RecordResultCollection resultList = new RecordResultCollection();

            var parentRows = table.Select();
            int sortNumber = 0;

            foreach (var item in parentRows)
            {
                sortNumber++;
                RecordResult result = new RecordResult();
                result.SortNo        = sortNumber;
                result.EntityName    = Convert.ToString(item["实体名"]);
                result.EntityDesc    = Convert.ToString(item["实体描述"]);
                result.DefaultValue  = Convert.ToString(item["默认值"]);
                result.IsMasterTable = Convert.ToString(item["主子标识"]) == "主" ? true : false;
                result.FieldName     = Convert.ToString(item["字段名"]);
                FieldTypeEnum type = new FieldTypeEnum();
                switch (Convert.ToString(item["字段类型"]).ToLower())
                {
                case "string":
                    type = FieldTypeEnum.String;
                    break;

                case "int":
                    type = FieldTypeEnum.Int;
                    break;

                case "bool":
                    type = FieldTypeEnum.Bool;
                    break;

                case "datetime":
                    type = FieldTypeEnum.DateTime;
                    break;

                case "decimal":
                    type = FieldTypeEnum.Decimal;
                    break;
                }
                result.FieldType = type;

                result.FieldDesc = Convert.ToString(item["字段描述"]);

                result.FieldLength = int.Parse(Convert.ToString(item["字段长度"]));

                resultList.Add(result);
            }
            return(resultList);
        }
예제 #3
0
        public RecordResultCollection ConvertTableToRecordResult(DataTable table)
        {
            var resultList = new RecordResultCollection();

            var parentRows = table.Select("", "全路径 asc");
            int sortNumber = 0;

            foreach (var item in parentRows)
            {
                sortNumber++;
                var result = new RecordResult();

                result.SortNo       = sortNumber;
                result.EntityName   = Convert.ToString(item["实体名"]);
                result.EntityDesc   = Convert.ToString(item["实体名"]);
                result.TempFullPath = Convert.ToString(item["全路径"]);
                result.DefaultValue = Convert.ToString(item["默认值"]);
                //result.IsMasterTable = Convert.ToString(item["主子标识"]) == "主" ? true : false;
                result.FieldName = Convert.ToString(item["字段名"]);
                int fileLenth = Convert.ToInt32(item["字段长度"]);
                result.FieldType     = SAPFileMapping.SAPFiledTypeToUEPFiledType(Convert.ToString(item["字段类型"]), ref fileLenth);
                item["字段长度"]         = fileLenth;
                result.FieldDesc     = Convert.ToString(item["字段描述"]);
                result.FieldLength   = int.Parse(Convert.ToString(item["字段长度"]));
                result.DecimalLength = int.Parse(Convert.ToString(item["字段小数长度"]));
                result.IsStruct      = item["字段类型"].ToString().Equals("STRUCTURE");

                if (table.Columns.Contains("参数标识"))
                {
                    switch (item["参数标识"].ToString())
                    {
                    case "输入":
                        result.ParamDirection = ParamDirectionEnum.Import;
                        break;

                    case "输出":
                        result.ParamDirection = ParamDirectionEnum.Export;
                        break;

                    default:
                        result.ParamDirection = ParamDirectionEnum.NotKnown;
                        break;
                    }
                }

                resultList.Add(result);
            }
            return(resultList);
        }
예제 #4
0
        /// <summary>
        /// 生成模拟数据
        /// </summary>
        /// <returns></returns>
        private RecordResultCollection GetMockData()
        {
            RecordResultCollection result = new RecordResultCollection();

            //主表
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-KUNNR", FieldType = FieldTypeEnum.String, FieldDesc = "客户", FieldLength = 255, SortNo = 1
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-OIC_MOT", FieldType = FieldTypeEnum.String, FieldDesc = "运输方式", FieldLength = 255, SortNo = 2
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-BUKRS", FieldType = FieldTypeEnum.String, FieldDesc = "公司代码", FieldLength = 255, SortNo = 3
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-VKORG", FieldType = FieldTypeEnum.String, FieldDesc = "销售主题", FieldLength = 255, SortNo = 4
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-CZDAT", FieldType = FieldTypeEnum.String, FieldDesc = "单据日期", FieldLength = 255, SortNo = 5
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-VTWEG", FieldType = FieldTypeEnum.String, FieldDesc = "销售方式", FieldLength = 255, SortNo = 6
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-VKBUR", FieldType = FieldTypeEnum.String, FieldDesc = "销售部门", FieldLength = 255, SortNo = 7
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-YSHHS", FieldType = FieldTypeEnum.String, FieldDesc = "提货方式", FieldLength = 255, SortNo = 8
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-NAME", FieldType = FieldTypeEnum.String, FieldDesc = ""
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521", EntityDesc = "销售订单", IsMasterTable = true, FieldName = "ZR5_SS02-RID_XJXS", FieldType = FieldTypeEnum.String, FieldDesc = ""
            });

            //子表
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521_Items1", EntityDesc = "销售订单详细", IsMasterTable = false, FieldName = "ZR5_SS02P-MATNR", FieldType = FieldTypeEnum.String, FieldDesc = "油品代码", FieldLength = 255, SortNo = 9
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521_Items1", EntityDesc = "销售订单详细", IsMasterTable = false, FieldName = "ZR5_SS02P-KWMENG", FieldType = FieldTypeEnum.String, FieldDesc = "数量", FieldLength = 255, SortNo = 10
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521_Items1", EntityDesc = "销售订单详细", IsMasterTable = false, FieldName = "ZR5_SS02P-WERKS", FieldType = FieldTypeEnum.String, FieldDesc = "业务单元代码", FieldLength = 255, SortNo = 11
            });
            result.Add(new Dynamics.Objects.RecordResult()
            {
                EntityName = "ZR521_Items1", EntityDesc = "销售订单详细", IsMasterTable = false, FieldName = "ZR5_SS02P-LGORT", FieldType = FieldTypeEnum.String, FieldDesc = "库存地点代码", FieldLength = 255, SortNo = 12
            });

            return(result);
        }