添加 IsComplete 属性,更新注释和方法逻辑
在 LectotypeLine.cs 中添加 IsComplete 属性并标记为可空。 在 MotorLectotypeService.cs 中更新映射和 SetColumns 方法。 在 CableLectotypeUserControl.xaml 中修改 CheckBox 绑定和注释 GridViewColumn。 在 LectotypeWindow.xaml.cs 中添加 ToLayout 和 Window_Closing 方法的注释。 在 CableLectotypeViewModel.cs 中更新映射和 LectotypeLineModel。 在 LayoutHelperViewModel.cs 中修改 SetSubLineAndSave 方法逻辑。 在 LectotypeViewModel.cs 中添加多个方法的注释,删除 CheckSaved 方法。
This commit is contained in:
parent
ab5345b1b8
commit
d5c03a1248
|
@ -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; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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())
|
||||||
|
|
|
@ -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());
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -734,20 +758,6 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
|
||||||
value.ForEach(it => NotSavedLectotypeList.Remove(it.Key));
|
value.ForEach(it => NotSavedLectotypeList.Remove(it.Key));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<bool> CheckSaved()
|
|
||||||
{
|
|
||||||
if(NotSavedLectotypeList != null && NotSavedLectotypeList.Any())
|
|
||||||
{
|
|
||||||
var isContinue = false;
|
|
||||||
|
|
||||||
return isContinue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Dictionary<string, string> GetNotSavedLectotypeList()
|
internal Dictionary<string, string> GetNotSavedLectotypeList()
|
||||||
{
|
{
|
||||||
return NotSavedLectotypeList;
|
return NotSavedLectotypeList;
|
||||||
|
|
Loading…
Reference in New Issue