Merge remote-tracking branch 'origin/master'

# Conflicts:
#	Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs
This commit is contained in:
SINVO\yangshunli 2025-02-08 09:50:08 +08:00
commit aaac1c51dc
7 changed files with 70 additions and 10 deletions

View File

@ -58,6 +58,9 @@ namespace Sinvo.EplanHpD.Plugin.Service.Model
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public bool IsChecked { get; set; } public bool IsChecked { get; set; }
[SugarColumn(IsNullable = true)]
public bool IsComplete { get; set; }
[SugarColumn(IsIgnore = true)] [SugarColumn(IsIgnore = true)]
public virtual ICollection<LectotypeLine> SubLines { get; set; } public virtual ICollection<LectotypeLine> SubLines { get; set; }
} }

View File

@ -110,6 +110,7 @@ namespace Sinvo.EplanHpD.Plugin.Service
IsLectotype = line.IsLectotype, IsLectotype = line.IsLectotype,
CableModel = line.CableModel, CableModel = line.CableModel,
IsChecked = line.IsChecked, IsChecked = line.IsChecked,
IsComplete = line.IsComplete,
SubLines = GetSubLines(line.LectotypeLineId) SubLines = GetSubLines(line.LectotypeLineId)
}).OrderBy(it => it.CurrentLine).ToList(); }).OrderBy(it => it.CurrentLine).ToList();
return viewModel; return viewModel;
@ -127,7 +128,8 @@ namespace Sinvo.EplanHpD.Plugin.Service
SeqNo = subLine.SeqNo, SeqNo = subLine.SeqNo,
CableModel = subLine.CableModel, CableModel = subLine.CableModel,
CableType = subLine.CableType, CableType = subLine.CableType,
IsChecked = subLine.IsChecked IsChecked = subLine.IsChecked,
LectotypeLineId = subLine.LectotypeLineId
}).ToList(); }).ToList();
} }
@ -264,7 +266,7 @@ namespace Sinvo.EplanHpD.Plugin.Service
int changeCount = db.Updateable<LectotypeLine>() int changeCount = db.Updateable<LectotypeLine>()
.Where(mt => mt.MotorUniqueFlag == motorUniqueFlag && mt.LectotypeLineId == lineId) .Where(mt => mt.MotorUniqueFlag == motorUniqueFlag && mt.LectotypeLineId == lineId)
.SetColumns(it => it.IsChecked == true) .SetColumns(it => it.IsComplete == true)
.ExecuteCommand(); .ExecuteCommand();
db.CommitTran(); db.CommitTran();

View File

@ -327,7 +327,7 @@
<CheckBox <CheckBox
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
IsChecked="{Binding IsComplete, UpdateSourceTrigger=PropertyChanged}" IsChecked="{Binding IsComplete}"
IsEnabled="False" /> IsEnabled="False" />
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
@ -368,6 +368,18 @@
</DataTemplate> </DataTemplate>
</GridViewColumn.CellTemplate> </GridViewColumn.CellTemplate>
</GridViewColumn> </GridViewColumn>
<!--<GridViewColumn Header="是否布线完成">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding IsChecked, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="False" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>-->
</GridView> </GridView>
</ListView.View> </ListView.View>
</ListView> </ListView>

View File

@ -407,6 +407,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
} }
} }
/// <summary>
/// 跳转到布线助手
/// </summary>
private void ToLayout() private void ToLayout()
{ {
ViewModel.ClearNotSavedLectotypeList(); ViewModel.ClearNotSavedLectotypeList();
@ -419,6 +422,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
window.Show(); window.Show();
this.Close(); this.Close();
} }
/// <summary>
/// 窗口关闭中事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{ {
if(ViewModel.GetNotSavedLectotypeList() != null && ViewModel.GetNotSavedLectotypeList().Any()) if(ViewModel.GetNotSavedLectotypeList() != null && ViewModel.GetNotSavedLectotypeList().Any())

View File

@ -456,11 +456,14 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
CurrentLine = line.CurrentLine, CurrentLine = line.CurrentLine,
Motor = line.Motor, Motor = line.Motor,
IsLectotype = line.IsLectotype, IsLectotype = line.IsLectotype,
IsComplete = line.IsComplete,
SubLines = line.SubLines.Select(subLine => new LectotypeLineModel SubLines = line.SubLines.Select(subLine => new LectotypeLineModel
{ {
SeqNo = subLine.SeqNo, SeqNo = subLine.SeqNo,
CableModel = subLine.CableModel, CableModel = subLine.CableModel,
CableType = subLine.CableType CableType = subLine.CableType,
IsChecked = subLine.IsChecked,
LectotypeLineId = subLine.LectotypeLineId
}).ToList() }).ToList()
}).ToList()); }).ToList());

View File

@ -329,8 +329,12 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
{ {
subLine.IsChecked = true; subLine.IsChecked = true;
//cableLectotypeViewModel.SaveToDb(); //cableLectotypeViewModel.SaveToDb();
SetSubLineAndSave(subLine.LectotypeLineId); bool allDone = SubLines.All(it => it.IsChecked);
return SubLines.All(it => it.IsChecked); if (allDone)
{
SetSubLineAndSave(SelectedLine.LectotypeLineId);
}
return allDone;
} }
else else
{ {

View File

@ -617,7 +617,11 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
Motors = motorsData; Motors = motorsData;
return Task.CompletedTask; return Task.CompletedTask;
} }
/// <summary>
/// 获取电机品牌
/// </summary>
/// <param name="motorName"></param>
/// <returns></returns>
private string GetMotorBrand(string motorName) private string GetMotorBrand(string motorName)
{ {
switch (motorName) switch (motorName)
@ -630,6 +634,11 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
return Brands.UNKNOWN; return Brands.UNKNOWN;
} }
} }
/// <summary>
/// 去除电机型号中的多余信息
/// </summary>
/// <param name="motorName"></param>
/// <returns></returns>
private string UnStuffMotorName(string motorName) private string UnStuffMotorName(string motorName)
{ {
if (motorName.Contains("&")) if (motorName.Contains("&"))
@ -649,6 +658,9 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
return motorName; return motorName;
} }
} }
/// <summary>
/// 选中线时
/// </summary>
private void OnSelectedItemChange() private void OnSelectedItemChange()
{ {
if (this.SelectedItem != null) if (this.SelectedItem != null)
@ -674,7 +686,11 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
DetailsShowMode = DataGridRowDetailsVisibilityMode.Collapsed; DetailsShowMode = DataGridRowDetailsVisibilityMode.Collapsed;
} }
} }
/// <summary>
/// 获取BOM
/// </summary>
/// <param name="cableModel"></param>
/// <returns></returns>
public bool GetBom(string cableModel) public bool GetBom(string cableModel)
{ {
var line = Wires.FirstOrDefault(it => it.CableModelNo == cableModel); var line = Wires.FirstOrDefault(it => it.CableModelNo == cableModel);
@ -709,11 +725,19 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
return false; return false;
} }
} }
/// <summary>
/// 导出BOM清单
/// </summary>
/// <param name="targetPath"></param>
/// <param name="cableModel"></param>
public void ExportBomList(string targetPath, string cableModel) public void ExportBomList(string targetPath, string cableModel)
{ {
MotorExcelHelper.Instance.SaveBomListToExcel(targetPath, LineBoms, cableModel); MotorExcelHelper.Instance.SaveBomListToExcel(targetPath, LineBoms, cableModel);
} }
/// <summary>
/// 导出线材清单
/// </summary>
/// <param name="targetPath"></param>
public void ExportLines(string targetPath) public void ExportLines(string targetPath)
{ {
int seq = 1; int seq = 1;
@ -740,6 +764,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
public void RemoveNotSavedLectotype(Dictionary<string, string> value) public void RemoveNotSavedLectotype(Dictionary<string, string> value)
{ {
value.ForEach(it => NotSavedLectotypeList.Remove(it.Key)); value.ForEach(it => NotSavedLectotypeList.Remove(it.Key));
<<<<<<< HEAD
} }
internal async Task<bool> CheckSaved() internal async Task<bool> CheckSaved()
@ -755,6 +780,9 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
return false; return false;
} }
} }
=======
}
>>>>>>> origin/master
internal Dictionary<string, string> GetNotSavedLectotypeList() internal Dictionary<string, string> GetNotSavedLectotypeList()
{ {