林豪 左 3 anos atrás
pai
commit
d8563d9a7f

+ 53 - 87
WCS_Client/Extensions/JsonExtensions.cs

@@ -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;
         }
     }

+ 6 - 12
WCS_Client/Frm/Equipment/WCS_AGVTask.cs

@@ -1,11 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
+using SqlSugar;
+using System;
 using System.Runtime.Serialization;
-using System.Text;
-using System.Threading.Tasks;
-using SqlSugar;
+
 namespace WCS_Client.Frm
 {
     [DataContract]
@@ -13,7 +9,6 @@ namespace WCS_Client.Frm
     {
         [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
         public int ID { get; set; }
- 
 
         public string AGVID { get; set; }
 
@@ -24,13 +19,13 @@ namespace WCS_Client.Frm
         public AGVTaskStatus AGVStatus { get; set; }
 
         public int Workshop { get; set; }
-  
+
         public string Station { get; set; }
 
         public string Position { get; set; }
 
         public DateTime CreateTime { get; set; }
-    
+
         public DateTime? UpdateTime { get; set; }
 
         public DateTime? AGVUpdateTime { get; set; }
@@ -39,7 +34,6 @@ namespace WCS_Client.Frm
         /// 货物数量(1.两个位置放1个货物,2.两个位置放2个货物)
         /// </summary>
         public int Goodsnum { get; set; }
-
     }
 
     public enum AGVTaskStatus
@@ -61,4 +55,4 @@ namespace WCS_Client.Frm
         入库 = 1,
         叫料 = 2
     }
-}
+}