diff --git a/Sinvo.EplanHpD.Plugin.Service/Model/LectotypeLine.cs b/Sinvo.EplanHpD.Plugin.Service/Model/LectotypeLine.cs index b5808c1..d8b82de 100644 --- a/Sinvo.EplanHpD.Plugin.Service/Model/LectotypeLine.cs +++ b/Sinvo.EplanHpD.Plugin.Service/Model/LectotypeLine.cs @@ -58,6 +58,9 @@ namespace Sinvo.EplanHpD.Plugin.Service.Model [SugarColumn(IsNullable = true)] public bool IsChecked { get; set; } + [SugarColumn(IsNullable = true)] + public bool IsComplete { get; set; } + [SugarColumn(IsIgnore = true)] public virtual ICollection SubLines { get; set; } } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs index e17f4bd..091f060 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs @@ -110,6 +110,7 @@ namespace Sinvo.EplanHpD.Plugin.Service IsLectotype = line.IsLectotype, CableModel = line.CableModel, IsChecked = line.IsChecked, + IsComplete = line.IsComplete, SubLines = GetSubLines(line.LectotypeLineId) }).OrderBy(it => it.CurrentLine).ToList(); return viewModel; @@ -127,7 +128,8 @@ namespace Sinvo.EplanHpD.Plugin.Service SeqNo = subLine.SeqNo, CableModel = subLine.CableModel, CableType = subLine.CableType, - IsChecked = subLine.IsChecked + IsChecked = subLine.IsChecked, + LectotypeLineId = subLine.LectotypeLineId }).ToList(); } @@ -264,7 +266,7 @@ namespace Sinvo.EplanHpD.Plugin.Service int changeCount = db.Updateable() .Where(mt => mt.MotorUniqueFlag == motorUniqueFlag && mt.LectotypeLineId == lineId) - .SetColumns(it => it.IsChecked == true) + .SetColumns(it => it.IsComplete == true) .ExecuteCommand(); db.CommitTran(); diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml index e7c1582..5ba4c47 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml @@ -327,7 +327,7 @@ @@ -368,6 +368,18 @@ + + diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs index b4f6645..0a9211a 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs @@ -407,6 +407,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI } } + /// + /// 跳转到布线助手 + /// private void ToLayout() { ViewModel.ClearNotSavedLectotypeList(); @@ -419,6 +422,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI window.Show(); this.Close(); } + /// + /// 窗口关闭中事件 + /// + /// + /// private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if(ViewModel.GetNotSavedLectotypeList() != null && ViewModel.GetNotSavedLectotypeList().Any()) diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs index 90d6b58..79a0b46 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs @@ -455,12 +455,15 @@ public class CableLectotypeViewModel : INotifyPropertyChanged LineCount = line.LineCount, CurrentLine = line.CurrentLine, Motor = line.Motor, - IsLectotype = line.IsLectotype, + IsLectotype = line.IsLectotype, + IsComplete = line.IsComplete, SubLines = line.SubLines.Select(subLine => new LectotypeLineModel { SeqNo = subLine.SeqNo, CableModel = subLine.CableModel, - CableType = subLine.CableType + CableType = subLine.CableType, + IsChecked = subLine.IsChecked, + LectotypeLineId = subLine.LectotypeLineId }).ToList() }).ToList()); diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LayoutHelperViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LayoutHelperViewModel.cs index 922af0a..cb806b5 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LayoutHelperViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LayoutHelperViewModel.cs @@ -329,8 +329,12 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel { subLine.IsChecked = true; //cableLectotypeViewModel.SaveToDb(); - SetSubLineAndSave(subLine.LectotypeLineId); - return SubLines.All(it => it.IsChecked); + bool allDone = SubLines.All(it => it.IsChecked); + if (allDone) + { + SetSubLineAndSave(SelectedLine.LectotypeLineId); + } + return allDone; } else { diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs index 5f55752..a863077 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs @@ -617,7 +617,11 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged Motors = motorsData; return Task.CompletedTask; } - + /// + /// 获取电机品牌 + /// + /// + /// private string GetMotorBrand(string motorName) { switch (motorName) @@ -630,6 +634,11 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged return Brands.UNKNOWN; } } + /// + /// 去除电机型号中的多余信息 + /// + /// + /// private string UnStuffMotorName(string motorName) { if (motorName.Contains("&")) @@ -649,6 +658,9 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged return motorName; } } + /// + /// 选中线时 + /// private void OnSelectedItemChange() { if (this.SelectedItem != null) @@ -674,7 +686,11 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged DetailsShowMode = DataGridRowDetailsVisibilityMode.Collapsed; } } - + /// + /// 获取BOM + /// + /// + /// public bool GetBom(string cableModel) { var line = Wires.FirstOrDefault(it => it.CableModelNo == cableModel); @@ -709,11 +725,19 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged return false; } } + /// + /// 导出BOM清单 + /// + /// + /// public void ExportBomList(string targetPath, string cableModel) { MotorExcelHelper.Instance.SaveBomListToExcel(targetPath, LineBoms, cableModel); } - + /// + /// 导出线材清单 + /// + /// public void ExportLines(string targetPath) { int seq = 1; @@ -732,21 +756,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged public void RemoveNotSavedLectotype(Dictionary value) { value.ForEach(it => NotSavedLectotypeList.Remove(it.Key)); - } - - internal async Task CheckSaved() - { - if(NotSavedLectotypeList != null && NotSavedLectotypeList.Any()) - { - var isContinue = false; - - return isContinue; - } - else - { - return false; - } - } + } internal Dictionary GetNotSavedLectotypeList() {