|
@@ -1,11 +1,11 @@
|
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Converters;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
-using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Data;
|
|
|
-using System.Text.RegularExpressions;
|
|
|
+using System.Reflection;
|
|
|
+using WCS.Entity.Protocol;
|
|
|
|
|
|
namespace WCS_Client
|
|
|
{
|
|
@@ -89,108 +89,74 @@ namespace WCS_Client
|
|
|
return Json == null ? JObject.Parse("{}") : JObject.Parse(Json.Replace(" ", ""));
|
|
|
}
|
|
|
|
|
|
- public static DataTable GetAttributesDataTable(this object obj)
|
|
|
+ public static DataTable GetAttributesDataTable(this SCData obj)
|
|
|
{
|
|
|
var tb = new DataTable(obj.GetType().Name);
|
|
|
tb.Columns.Add("信号说明", typeof(string));
|
|
|
tb.Columns.Add("信号名称", typeof(string));
|
|
|
tb.Columns.Add("信号值", typeof(string));
|
|
|
- Type t = obj.GetType();
|
|
|
-
|
|
|
- //属性遍历
|
|
|
- foreach (System.Reflection.PropertyInfo pi in t.GetProperties())
|
|
|
+
|
|
|
+ foreach (PropertyInfo pi in obj.D521.GetType().GetProperties())
|
|
|
{
|
|
|
- AttributeCollection attributes = TypeDescriptor.GetProperties(t)[pi.Name].Attributes;
|
|
|
+ AttributeCollection attributes = TypeDescriptor.GetProperties(obj.D521.GetType())[pi.Name].Attributes;
|
|
|
DescriptionAttribute myAttribute = (DescriptionAttribute)attributes[typeof(DescriptionAttribute)];
|
|
|
string describle = myAttribute.Description;
|
|
|
string proname = pi.Name;
|
|
|
- var abc = pi.GetValue(obj, null);
|
|
|
+ var abc = pi.GetValue(obj.D521, null);
|
|
|
|
|
|
+ switch (proname)
|
|
|
+ {
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
var values = new object[3];
|
|
|
values[0] = describle;
|
|
|
values[1] = proname;
|
|
|
+ values[2] = abc;
|
|
|
+ tb.Rows.Add(values);
|
|
|
+ }
|
|
|
+ foreach (PropertyInfo pi in obj.D520.GetType().GetProperties())
|
|
|
+ {
|
|
|
+ AttributeCollection attributes = TypeDescriptor.GetProperties(obj.D520.GetType())[pi.Name].Attributes;
|
|
|
+ DescriptionAttribute myAttribute = (DescriptionAttribute)attributes[typeof(DescriptionAttribute)];
|
|
|
+ string describle = myAttribute.Description;
|
|
|
+ string proname = pi.Name;
|
|
|
+ var abc = pi.GetValue(obj.D520, null);
|
|
|
|
|
|
- //switch (proname)
|
|
|
- //{
|
|
|
- // case "TaskID":
|
|
|
- // values[1] = "任务号";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "TaskType":
|
|
|
- // values[1] = "任务类型";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "WorkMode":
|
|
|
- // values[1] = "运行模式";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "SystemStatus":
|
|
|
- // values[1] = "运行状态";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "StartPosition":
|
|
|
- // values[1] = "起始地址";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "PH_Status":
|
|
|
- // values[1] = "光电信号";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "DestPosition":
|
|
|
- // values[1] = "目标地址";
|
|
|
- // break;
|
|
|
-
|
|
|
- // //case "ACT_V":
|
|
|
- // // values[1] = "实际速度";
|
|
|
- // // break;
|
|
|
-
|
|
|
- // case "GOODSSTART":
|
|
|
- // values[1] = "起始地址";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "GOODSEND":
|
|
|
- // values[1] = "目标地址";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "REQUEST":
|
|
|
- // values[1] = "请求";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "RES1":
|
|
|
- // values[1] = "手动入库";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "HEIGHT":
|
|
|
- // values[1] = "高度";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "GOODSCODE":
|
|
|
- // values[1] = "货物编码";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "GOODSTYPE":
|
|
|
- // values[1] = "货物类型";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "GOODSSIZE":
|
|
|
- // values[1] = "货物尺寸";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "PH_STATUS":
|
|
|
- // values[1] = "光电信号";
|
|
|
- // break;
|
|
|
-
|
|
|
- // case "TASKNUM":
|
|
|
- // values[1] = "任务号";
|
|
|
- // break;
|
|
|
- //}
|
|
|
-
|
|
|
- //string P_regex = "^[\u4E00-\u9FA5]{0,}$";
|
|
|
- //var match = Regex.IsMatch(values[1].ToString(), P_regex, RegexOptions.IgnoreCase);
|
|
|
- //if (!match) continue;
|
|
|
+ switch (proname)
|
|
|
+ {
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ var values = new object[3];
|
|
|
+ values[0] = describle;
|
|
|
+ values[1] = proname;
|
|
|
values[2] = abc;
|
|
|
tb.Rows.Add(values);
|
|
|
}
|
|
|
+ foreach (PropertyInfo pi in obj.D537.GetType().GetProperties())
|
|
|
+ {
|
|
|
+ AttributeCollection attributes = TypeDescriptor.GetProperties(obj.D537.GetType())[pi.Name].Attributes;
|
|
|
+ DescriptionAttribute myAttribute = (DescriptionAttribute)attributes[typeof(DescriptionAttribute)];
|
|
|
+ string describle = myAttribute.Description;
|
|
|
+ string proname = "DB537" + pi.Name;
|
|
|
+ var abc = pi.GetValue(obj.D537, null);
|
|
|
+
|
|
|
+ switch (pi.Name)
|
|
|
+ {
|
|
|
+ case "TASKNUM":
|
|
|
+ describle = "任务号";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ var values = new object[3];
|
|
|
+ values[0] = describle;
|
|
|
+ values[1] = proname;
|
|
|
+ values[2] = abc;
|
|
|
+ tb.Rows.Add(values);
|
|
|
+ }
|
|
|
+
|
|
|
+ //属性遍历
|
|
|
+
|
|
|
return tb;
|
|
|
}
|
|
|
}
|