From 43a0207d207390abdeeb3ab9155eebf03edd7b1a Mon Sep 17 00:00:00 2001
From: chr <chr@mailcom>
Date: 星期一, 21 四月 2025 09:28:01 +0800
Subject: [PATCH] 优化;

---
 PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs |  154 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 120 insertions(+), 34 deletions(-)

diff --git a/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs b/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs
index d8f53e0..fa86893 100644
--- a/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs
+++ b/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs
@@ -43,6 +43,7 @@
         public Component2 component { get; set; }
 
         public bool lost { get; set; } = false;
+        public bool isHidden { get; set; } = false;
         public bool suppressed { get; set; } = false;
         public bool lightWeight { get; set; } = false;
 
@@ -84,6 +85,14 @@
             set => RaiseAndSetIfChanged(ref _status, value);
         }
 
+        private bool? _inKeeDeeDb;
+
+        public bool? inKeeDeeDb
+        {
+            get => _inKeeDeeDb;
+            set => RaiseAndSetIfChanged(ref _inKeeDeeDb, value);
+        }
+
         private string _auditId;
         public string auditId
         {
@@ -116,6 +125,26 @@
     public class DrawInfo : NotifyBase
     {
         /// <summary>
+        /// true璇存槑娌℃湁宸ョ▼鍥�
+        /// </summary>
+        public bool _noDrw = false;
+
+        public bool noDrw
+        {
+            get => _noDrw;
+            set => RaiseAndSetIfChanged(ref _noDrw, value);
+        }
+
+        public bool _inKeeDeeDb = false;
+
+        private bool _isSpecial;
+        public bool isSpecial
+        {
+            get => _isSpecial;
+            set => RaiseAndSetIfChanged(ref _isSpecial, value);
+        }
+
+        /// <summary>
         /// 3Dmd5
         /// </summary>
         public string d3Md5 { get; set; }
@@ -147,6 +176,8 @@
 
         private int? _checkRuleResult = 0;
 
+        public bool isHidden;
+
         public int? checkRuleResult
         {
             get => _checkRuleResult;
@@ -166,6 +197,10 @@
         public List<string> errMessages { get; set; }
 
         public Dictionary<string, string> allProperties { get; set; }
+
+        /// <summary>
+        /// 涓篢rue璇存槑娌℃湁宸ョ▼鍥�
+        /// </summary>
     }
 
     [Serializable]
@@ -194,6 +229,11 @@
             set => RaiseAndSetIfChanged(ref _treeId, value);
         }
 
+        /// <summary>
+        /// true璇存槑娌℃湁宸ョ▼鍥�
+        /// </summary>
+        public bool noDrw => (_drawInfo?.noDrw == true);
+
         public string id => BomInfo?.id;
         public string name => BomInfo?.name;
         public string partNo => BomInfo?.partNo;
@@ -204,7 +244,10 @@
         public Dictionary<string, string> properties => BomInfo?.properties;
         public string d3FilePath => BomInfo?.d3FilePath;
         public string filePath => BomInfo?.filePath;
-        public bool lost => BomInfo?.lost == true;
+        public bool lost => BomInfo?.lost == true || isHidden;
+
+        public bool isHidden = false;
+
         public bool suppressed => BomInfo?.suppressed == true;
         public bool lightWeight => BomInfo?.lightWeight == true;
 
@@ -215,10 +258,6 @@
         public int? checkStatus => BomInfo?.checkStatus;
         public string checkUserId => BomInfo?.checkUserId;
         public string checkUserName => BomInfo?.checkUserName;
-
-        #region 瑙勫垯妫�鏌ョ浉鍏冲瓧娈�
-
-        #endregion
 
         #region 鍥剧焊瀹℃牳鐩稿叧瀛楁
         public string drawStatus => BomInfo?.status;
@@ -238,12 +277,19 @@
         /// <summary>
         /// 鍥剧焊鏄惁鍙戠敓鍙樻洿 闈炲巻鍙插浘绾哥湅2D鍥綧D5 鍘嗗彶鍥剧焊鐪嬩竴鑷存�ф鏌ユ病閫氳繃
         /// </summary>
-        public bool localDocChanged => (!IsHistoryData && localD2Md5 != _drawInfo?.d2Md5)
-            || (IsHistoryData && _drawInfo?.checkRuleResult == 2); //localD3Md5 != _drawInfo?.d3Md5;
+        public bool localDocChanged
+        {
+            get
+            {
+                //if (!IsHistoryData) return localD2Md5 != _drawInfo?.d2Md5; //(!IsHistoryData && localD2Md5 != _drawInfo?.d2Md5)
+                //return (IsHistoryData && _drawInfo?.checkRuleResult == 2);
+                return false;
+            }
+        }
         /// <summary>
         /// 瑙勫垯妫�鏌ョ粨鏋�
         /// </summary>
-        public int? checkRuleResult => (IsHistoryData || skipCheck) ? 3 : _drawInfo?.checkRuleResult;
+        public int? checkRuleResult => (IsHistoryData || skipCheck) ? 3 : (isHidden ? 2 : _drawInfo?.checkRuleResult);
         /// <summary>
         /// 妫�鏌ユ槸鍚K
         /// </summary>
@@ -260,6 +306,8 @@
             }
         }
 
+        public List<string> ErrorMsgs;
+
         /// <summary>
         /// 鏄惁闇�瑕佸鏍�
         /// </summary>
@@ -269,24 +317,31 @@
             {
                 // 鎵句笉鍒版枃妗g殑涓嶅鏍�
                 if (lost) return false;
-                // 涓嶅湪鐗╂枡鏄庣粏琛ㄤ腑涓嶅鏍�
-                if (ExcludeFromBOM) return false;
-                // 妯$粍涓嶅鏍�
-                if (produceWay == "妯$粍") return false;
-                // 寰呭鏍哥殑涓嶅啿绐佹彁浜�
+                // 璺宠繃妫�鏌ョ殑涓嶅
+                if (skipCheck) return false;
+                // 杩涘叆绯荤粺鐨勪笉瀹℃牳
+                if (BomInfo.inKeeDeeDb == true) return false;
+                // 涓嶅湪BOM鏄庣粏琛ㄤ腑涓嶆彁浜�
+                if (component.ExcludeFromBOM) return false;
+                //if (_drawInfo.isSpecial) return false;
+                // 寰呭鏍哥殑涓嶉噸澶嶆彁浜�
                 if (drawStatus == "submitted" || drawStatus == "resubmitted") return false;
-                if (IsHistoryData)
-                {
-                    // 鍘嗗彶鍥剧焊鍙鏍镐竴鑷存�т笉閫氳繃鐨� 鍜岃椹冲洖鐨�
-                    return _drawInfo.checkRuleResult == 2 || drawStatus == "rejected";
-                }
-                else
-                {
-                    // 闈炲巻鍙插浘绾稿彧瀹℃牳 鍏佽瀹℃牳鐨勫姞宸ヤ欢
-                    return produceWay == "鍔犲伐浠�"
-                            && (drawStatus != "submitted" && drawStatus != "resubmitted")
-                            && (drawStatus != "completed" || localDocChanged);
-                }
+                return produceWay == "鍔犲伐浠�" && (drawStatus != "submitted" && drawStatus != "resubmitted")
+                            && (drawStatus != "completed");
+
+                /// 浠ュ墠杩樿鍒嗗浘绾稿彉鏇达紝鐜板湪涓嶅紕浜�
+                //if (IsHistoryData)
+                //{
+                //    // 鍘嗗彶鍥剧焊鍙鏍镐竴鑷存�т笉閫氳繃鐨� 鍜岃椹冲洖鐨�
+                //    return _drawInfo.checkRuleResult == 2 || drawStatus == "rejected";
+                //}
+                //else
+                //{
+                //    // 闈炲巻鍙插浘绾稿彧瀹℃牳 鍏佽瀹℃牳鐨勫姞宸ヤ欢
+                //    return produceWay == "鍔犲伐浠�"
+                //            && (drawStatus != "submitted" && drawStatus != "resubmitted")
+                //            && (drawStatus != "completed" || localDocChanged);
+                //}
             }
         }
 
@@ -296,18 +351,39 @@
         /// <returns></returns>
         public string NeedStopCheckIn()
         {
-            if (produceWay == "妯$粍") return null;
-            if (ExcludeFromBOM) return null;
+            if (skipCheck) return null;
+            /// 2025-03-12 淇敼閲戣澏鎻掍欢鎷︽埅闂
+            if (produceWay == "鏍囧噯浠�") return null;
+            if (drawInfo.isSpecial) return null;
+            /// 2025-03-12 淇敼閲戣澏鎻掍欢鎷︽埅闂 END
+
+            if (BomInfo.inKeeDeeDb == true) return null;
             if (IsHistoryData)
             {
-                if (localDocChanged)
+                bool err = false;
+                string msg = $"鍘嗗彶鍥剧焊銆恵partModel}銆�";
+                if (localDocChanged && !noDrw)
                 {
-                    return $"鍘嗗彶鍥剧焊銆恵partModel}銆戝彉鏇村悗鏈噸鏂板鏍�";
+                    err = true;
+                    msg += "鍙樻洿鍚庢湭閲嶆柊瀹℃牳;";
                 }
-                else if (drawStatus == "rejected" || drawStatus == "submitted" || drawStatus == "resubmitted")
+                if ((drawStatus == "rejected" || drawStatus == "submitted" || drawStatus == "resubmitted") && BomInfo.inKeeDeeDb != true)
                 {
-                    return $"鍘嗗彶鍥剧焊銆恵partModel}銆戞湭閫氳繃瀹℃牳";
+                    err = true;
+                    msg += "鏈�氳繃瀹℃牳";
                 }
+
+                if (isHidden)
+                {
+                    err = true;
+                    msg += "琚殣钘�;";
+                }
+                if (noDrw)
+                {
+                    err = true;
+                    msg += "鏈壘鍒板伐绋嬪浘";
+                }
+                return err ? msg : null;
             }
             if (!IsHistoryData)
             {
@@ -316,18 +392,28 @@
                 if (!skipCheck && !checkRuleOk)
                 {
                     error = true;
-                    msg += "鏈�氳繃瑙勫垯妫�鏌�";
+                    msg += "鏈�氳繃瑙勫垯妫�鏌�;";
                 }
-                if (produceWay == "鍔犲伐浠�" && drawStatus != "completed")
+                if (!skipCheck && isHidden)
+                {
+                    error = true;
+                    msg += "琚殣钘�;";
+                }
+                if (produceWay == "鍔犲伐浠�" && drawStatus != "completed" && BomInfo.inKeeDeeDb != true)
                 {
                     error = true;
                     msg += "鏈�氳繃瀹℃牳;";
                 }
-                if (produceWay == "鍔犲伐浠�" && drawStatus == "completed" && localDocChanged)
+                if (produceWay == "鍔犲伐浠�" && drawStatus == "completed" && localDocChanged && !noDrw)
                 {
                     error = true;
                     msg += "鍥剧焊鍙樻洿鍚庢湭閲嶆柊瀹℃牳";
                 }
+                if (noDrw)
+                {
+                    error = true;
+                    msg += "鏈壘鍒板伐绋嬪浘";
+                }
                 return error ? msg : null;
             }
             return null;

--
Gitblit v1.9.1