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 | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 207 insertions(+), 15 deletions(-) diff --git a/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs b/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs index 14e6574..fa86893 100644 --- a/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs +++ b/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; +using System.Windows.Interop; namespace PdmSwPlugin.Common.Entity.Pdm { @@ -36,10 +37,13 @@ public int level { get; set; } public int drawingType { get; set; } + public bool HistoryData = false; + public ModelDoc2 doc { get; set; } 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; @@ -81,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 { @@ -113,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; } @@ -144,6 +176,8 @@ private int? _checkRuleResult = 0; + public bool isHidden; + public int? checkRuleResult { get => _checkRuleResult; @@ -152,9 +186,21 @@ public bool checkRuleOk => checkRuleResult == 1 || checkRuleResult == 3; + private bool _HistoryData = false; + public bool HistoryData + { + get => _HistoryData; + set => RaiseAndSetIfChanged(ref _HistoryData, value); + } + + public List<string> errMessages { get; set; } public Dictionary<string, string> allProperties { get; set; } + + /// <summary> + /// 涓篢rue璇存槑娌℃湁宸ョ▼鍥� + /// </summary> } [Serializable] @@ -183,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; @@ -193,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; @@ -205,10 +259,6 @@ public string checkUserId => BomInfo?.checkUserId; public string checkUserName => BomInfo?.checkUserName; - #region 瑙勫垯妫�鏌ョ浉鍏冲瓧娈� - - #endregion - #region 鍥剧焊瀹℃牳鐩稿叧瀛楁 public string drawStatus => BomInfo?.status; public string requestUserId => BomInfo?.requestUserId; @@ -216,15 +266,159 @@ public string auditUserId => BomInfo?.auditUserId; public string auditUser => BomInfo?.auditUser; - public bool inBom + /// <summary> + /// 鏄惁鏄巻鍙插浘绾� + /// </summary> + public bool IsHistoryData => _drawInfo?.HistoryData == true; + /// <summary> + /// 鏄惁璺宠繃瑙勫垯妫�鏌� + /// </summary> + public bool skipCheck => produceWay == "妯$粍" || ExcludeFromBOM || component?.IsVirtual == true; + /// <summary> + /// 鍥剧焊鏄惁鍙戠敓鍙樻洿 闈炲巻鍙插浘绾哥湅2D鍥綧D5 鍘嗗彶鍥剧焊鐪嬩竴鑷存�ф鏌ユ病閫氳繃 + /// </summary> + 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 : (isHidden ? 2 : _drawInfo?.checkRuleResult); + /// <summary> + /// 妫�鏌ユ槸鍚K + /// </summary> + public bool checkRuleOk => _drawInfo != null && _drawInfo.checkRuleOk; + /// <summary> + /// 鏄惁涓嶅湪鐗╂枡鏄庣粏琛ㄤ腑 + /// </summary> + public bool ExcludeFromBOM { get => component == null ? false : component.ExcludeFromBOM; set { InBomChanged?.Invoke(this, value); - // RaiseAndSetIfChanged(ref _inBom, value); } } + + public List<string> ErrorMsgs; + + /// <summary> + /// 鏄惁闇�瑕佸鏍� + /// </summary> + public bool NeedAudit + { + get + { + // 鎵句笉鍒版枃妗g殑涓嶅鏍� + if (lost) 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; + 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); + //} + } + } + + /// <summary> + /// 鏄惁闇�瑕佺粓姝㈡鍏�/瀵煎叆 + /// </summary> + /// <returns></returns> + public string NeedStopCheckIn() + { + 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) + { + bool err = false; + string msg = $"鍘嗗彶鍥剧焊銆恵partModel}銆�"; + if (localDocChanged && !noDrw) + { + err = true; + msg += "鍙樻洿鍚庢湭閲嶆柊瀹℃牳;"; + } + if ((drawStatus == "rejected" || drawStatus == "submitted" || drawStatus == "resubmitted") && BomInfo.inKeeDeeDb != true) + { + err = true; + msg += "鏈�氳繃瀹℃牳"; + } + + if (isHidden) + { + err = true; + msg += "琚殣钘�;"; + } + if (noDrw) + { + err = true; + msg += "鏈壘鍒板伐绋嬪浘"; + } + return err ? msg : null; + } + if (!IsHistoryData) + { + bool error = false; + string msg = $"銆恵partModel}銆�"; + if (!skipCheck && !checkRuleOk) + { + error = true; + msg += "鏈�氳繃瑙勫垯妫�鏌�;"; + } + if (!skipCheck && isHidden) + { + error = true; + msg += "琚殣钘�;"; + } + if (produceWay == "鍔犲伐浠�" && drawStatus != "completed" && BomInfo.inKeeDeeDb != true) + { + error = true; + msg += "鏈�氳繃瀹℃牳;"; + } + if (produceWay == "鍔犲伐浠�" && drawStatus == "completed" && localDocChanged && !noDrw) + { + error = true; + msg += "鍥剧焊鍙樻洿鍚庢湭閲嶆柊瀹℃牳"; + } + if (noDrw) + { + error = true; + msg += "鏈壘鍒板伐绋嬪浘"; + } + return error ? msg : null; + } + return null; + } + public void UpdateInBom(bool value) { @@ -430,14 +624,13 @@ if (e.PropertyName == "checkRuleResult") { RaisePropertyChanged("checkRuleResult"); + RaisePropertyChanged("localDocChanged"); + } + else if (e.PropertyName == "HistoryData") + { + RaisePropertyChanged("IsHistoryData"); } } - - // 妯$粍 涓嶅湪鐗╂枡鏄庣粏琛� 宸℃璺宠繃妫�鏌� - public bool skipCheck => produceWay == "妯$粍" || inBom || component?.IsVirtual == true; - public int? checkRuleResult => skipCheck ? 3 : _drawInfo?.checkRuleResult; - - public bool checkRuleOk => _drawInfo != null && _drawInfo.checkRuleOk; public string d3Md5 => _drawInfo == null ? null : _drawInfo.d3Md5; public string d2Md5 => _drawInfo == null ? null : _drawInfo.d2Md5; @@ -458,14 +651,13 @@ public bool checkBoxEnabled => !(xcChild || (lost == true) || produceWay == "鏍囧噯浠�" || (produceWay == "妯$粍" && drawingType == (int)swDocumentTypes_e.swDocPART) - || (inBom && drawingType == (int)swDocumentTypes_e.swDocPART) + || (ExcludeFromBOM && drawingType == (int)swDocumentTypes_e.swDocPART) // BomInfo.jgj == "鏍囧噯浠�" //|| component?.IsVirtual == true ); public bool d3Changed => localD3Md5 != _drawInfo?.d3Md5; - public bool auditedMd5Changed => localD2Md5 != _drawInfo?.d2Md5; //localD3Md5 != _drawInfo?.d3Md5; public int order { get; set; } -- Gitblit v1.9.1