浏览代码

mxg:添加CADID的同步更新

mengxiangge 6 年之前
父节点
当前提交
e9c0890f05

+ 50 - 0
MBI/SAGA.MBI/Common/MBIElementUtils.cs

@@ -0,0 +1,50 @@
+/* ==============================================================================
+ * 功能描述:MBIElementUtils  
+ * 创 建 者:Garrett
+ * 创建日期:2019/6/25 10:18:52
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.DotNetUtils;
+
+namespace SAGA.MBI.Common
+{
+    /// <summary>
+    /// MBIElementUtils
+    /// </summary>
+    class MBIElementUtils
+    {
+        /// <summary>
+        /// 组合形成CADID
+        /// </summary>
+        /// <param name="code"></param>
+        /// <param name="name"></param>
+        /// <returns></returns>
+        public static string GetCADID(string code, string name)
+        {
+            string result = "";
+            if (code.IsNotNullEmpty())
+            {
+                if (name.IsNotNullEmpty())
+                {
+                    result = code + ":" + name;
+                }
+                else
+                {
+                    result = code;
+                }
+            }
+            else
+            {
+                if (name.IsNotNullEmpty())
+                {
+                    result = name;
+                }
+            }
+            return result;
+        }
+    }
+}

+ 9 - 1
MBI/SAGA.MBI/Model/MEquipment.cs

@@ -70,6 +70,7 @@ namespace SAGA.MBI.Model
             {
                 m_LocalId = value;
                 NotifyPropertyChanged("LocalId");
+                NotifyPropertyChanged("CADID");
             }
         }
 
@@ -81,9 +82,16 @@ namespace SAGA.MBI.Model
             set
             {
                 m_LocalName = value;
-                RaisePropertyChanged(() => this.LocalName);
+                NotifyPropertyChanged("LocalName");
+                NotifyPropertyChanged("CADID");
             }
         }
+        private string m_CADID;
+        [Description("CADID")]
+        public string CADID
+        {
+            get { return MBIElementUtils.GetCADID(LocalId, LocalName); }
+        }
 
         #endregion CloudProperty
 

+ 10 - 1
MBI/SAGA.MBI/Model/MEquipmentPart.cs

@@ -77,9 +77,11 @@ namespace SAGA.MBI.Model
             {
                 m_LocalId = value;
                 NotifyPropertyChanged("LocalId");
+                NotifyPropertyChanged("CADID");
             }
         }
 
+
         private string m_LocalName;
         [Description("EquipLocalName")]
         public string LocalName
@@ -88,9 +90,16 @@ namespace SAGA.MBI.Model
             set
             {
                 m_LocalName = value;
-                RaisePropertyChanged(() => this.LocalName);
+                NotifyPropertyChanged("LocalName");
+                NotifyPropertyChanged("CADID");
             }
         }
+        private string m_CADID;
+        [Description("CADID")]
+        public string CADID
+        {
+            get { return MBIElementUtils.GetCADID(LocalId, LocalName); }
+        }
         #endregion Model
 
 

+ 1 - 0
MBI/SAGA.MBI/SAGA.MBI.csproj

@@ -274,6 +274,7 @@
     <Compile Include="Common\CacheAspect.cs" />
     <Compile Include="Common\EquipmentCodeMap.cs" />
     <Compile Include="Common\MailLog.cs" />
+    <Compile Include="Common\MBIElementUtils.cs" />
     <Compile Include="Common\MessageManager.cs" />
     <Compile Include="Common\PhaseUtil.cs" />
     <Compile Include="Common\RegexConstPattern.cs" />