| | |
| | | using System.Collections.Generic; |
| | | using System.Collections.ObjectModel; |
| | | using System.IO; |
| | | using System.Windows.Interop; |
| | | |
| | | namespace PdmSwPlugin.Common.Entity.Pdm |
| | | { |
| | |
| | | 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; |
| | | |
| | |
| | | set => RaiseAndSetIfChanged(ref _status, value); |
| | | } |
| | | |
| | | private bool? _inKeeDeeDb; |
| | | |
| | | public bool? inKeeDeeDb |
| | | { |
| | | get => _inKeeDeeDb; |
| | | set => RaiseAndSetIfChanged(ref _inKeeDeeDb, value); |
| | | } |
| | | |
| | | private string _auditId; |
| | | public string auditId |
| | | { |
| | |
| | | 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; } |
| | |
| | | |
| | | private int? _checkRuleResult = 0; |
| | | |
| | | public bool isHidden; |
| | | |
| | | public int? checkRuleResult |
| | | { |
| | | get => _checkRuleResult; |
| | |
| | | |
| | | 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> |
| | | /// 为True说明没有工程图 |
| | | /// </summary> |
| | | } |
| | | |
| | | [Serializable] |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | public string checkUserId => BomInfo?.checkUserId; |
| | | public string checkUserName => BomInfo?.checkUserName; |
| | | |
| | | #region 规则检查相关字段 |
| | | |
| | | #endregion |
| | | |
| | | #region 图纸审核相关字段 |
| | | public string drawStatus => BomInfo?.status; |
| | | public string requestUserId => BomInfo?.requestUserId; |
| | |
| | | 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图MD5 历史图纸看一致性检查没通过 |
| | | /// </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> |
| | | /// 检查是否OK |
| | | /// </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 |
| | | { |
| | | // 找不到文档的不审核 |
| | | 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) |
| | | { |
| | |
| | | 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; |
| | |
| | | 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; } |
| | | |