1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- /* ==============================================================================
- * 功能描述:PEPCodeConvert
- * 创 建 者:Garrett
- * 创建日期:2018/4/8 11:50:03
- * ==============================================================================*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Newtonsoft.Json.Linq;
- using SAGA.DotNetUtils.Extend;
- using SAGA.DotNetUtils.Http;
- using SAGA.MBI.Common;
- using SAGA.MBI.DataArrange;
- using SAGA.MBI.Model;
- using SAGA.MBI.RequestData;
- using SAGA.MBI.Tools;
- using SAGA.RevitUtils;
- namespace SAGA.MBI.JsonConvert
- {
- /// <summary>
- /// PEPCodeConvert
- /// </summary>
- public class PEPCodeConvert
- {
- /// <summary>
- /// 信息点的定义
- /// </summary>
- /// <param name="code"></param>
- /// <returns></returns>
- public static PropertyDefineTb GetPropertyDefineTb(string code)
- {
- List<PropertyDefineTb> tbs = MBIControl.PropertyDefineTbs;
- PropertyDefineTb tb = tbs.FirstOrDefault(t => t.Code == code);
- if (tb == null)
- {
- //暂时只处理独有的信息点
- tb = DataPlatFormSysOrEqInfos(code);
- tbs.Add(tb);
- }
- return tb;
- }
- /// <summary>
- /// 数据平台系统和设备的完整信息点
- /// </summary>
- /// <returns></returns>
- public static PropertyDefineTb DataPlatFormSysOrEqInfos(string code)
- {
- PropertyDefineTb tb = new PropertyDefineTb(code);
- try
- {
- //控制是否显示,包含自定义信息点
- var json = PEPCodeRequest.InfoCodeQuery(code);
- if (json.IsSuccessRequest())
- {
- JObject jObject = JObject.Parse(json);
- foreach (JObject subj in jObject["Content"])
- {
- PropertyDefineItem item = new PropertyDefineItem();
- item.Category = (string)subj["firstTag"];
- item.SubCategory = (string)subj["secondTag"];
- item.Name = (string)subj["infoPointName"];
- item.CodeName = (string)subj["infoPointCode"];
- item.Unit = (string)subj["unit"];
- item.Type = (string)subj["dataType"];
- item.InputType = (string)subj["inputMode"];
- item.EnumSource = subj.GetValueEx("dataSource");
- item.Remark = (string)subj["note"];
- item.Classification = (string)subj["classification"];
- item.IsShow = (bool)subj["visible"];
- item.CollectionCmptCode = DalInfoCode.GetInputType(item.InputType);
- tb.PropertyDefineItems.Add(item);
- }
- }
- }
- catch (Exception e)
- {
- MessageShow.Show(e);
- }
- return tb;
- }
- }
- }
|