105040 Update 调整选择线段类型逻辑
This commit is contained in:
parent
5d8eb5d05a
commit
e825595117
|
@ -24,7 +24,10 @@ namespace Sinvo.EplanHpD.Plugin.Service.Model
|
||||||
public string AxisNo { get; set; }
|
public string AxisNo { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsNullable = true)]
|
[SugarColumn(IsNullable = true)]
|
||||||
public string CableType { get; set; }
|
public string CableTypePrimary { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public string CableTypeSecond { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsNullable = true)]
|
[SugarColumn(IsNullable = true)]
|
||||||
public int EncoderLineParagraph { get; set; }
|
public int EncoderLineParagraph { get; set; }
|
||||||
|
|
|
@ -82,7 +82,8 @@ namespace Sinvo.EplanHpD.Plugin.Service
|
||||||
},
|
},
|
||||||
CableConnectionType = (ConnectionType)Enum.Parse(typeof(ConnectionType), cableLectotype.CableConnectionType.ToString()),
|
CableConnectionType = (ConnectionType)Enum.Parse(typeof(ConnectionType), cableLectotype.CableConnectionType.ToString()),
|
||||||
AxisNo = cableLectotype.AxisNo,
|
AxisNo = cableLectotype.AxisNo,
|
||||||
CableType = cableLectotype.CableType,
|
CableTypePrimary = cableLectotype.CableTypePrimary,
|
||||||
|
CableTypeSecond = cableLectotype.CableTypeSecond,
|
||||||
EncoderLineParagraph = cableLectotype.EncoderLineParagraph,
|
EncoderLineParagraph = cableLectotype.EncoderLineParagraph,
|
||||||
PowerLineParagraph = cableLectotype.PowerLineParagraph,
|
PowerLineParagraph = cableLectotype.PowerLineParagraph,
|
||||||
CableModelStr = cableLectotype.CableModelStr,
|
CableModelStr = cableLectotype.CableModelStr,
|
||||||
|
@ -127,6 +128,14 @@ namespace Sinvo.EplanHpD.Plugin.Service
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ClearSubLines(string motorOccId)
|
||||||
|
{
|
||||||
|
var changeCount = DBHelper.DB.Deleteable<LectotypeLine>()
|
||||||
|
.Where(sl => sl.MotorId == motorOccId)
|
||||||
|
.ExecuteCommand();
|
||||||
|
return changeCount > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public bool SaveMotorLectotypeData(string motorOccId, CableLectotypeViewModel data)
|
public bool SaveMotorLectotypeData(string motorOccId, CableLectotypeViewModel data)
|
||||||
{
|
{
|
||||||
var db = DBHelper.DB;
|
var db = DBHelper.DB;
|
||||||
|
@ -163,8 +172,10 @@ namespace Sinvo.EplanHpD.Plugin.Service
|
||||||
CableLectotypeId = Guid.NewGuid().ToString(),
|
CableLectotypeId = Guid.NewGuid().ToString(),
|
||||||
MotorId = motor.OccPartId,
|
MotorId = motor.OccPartId,
|
||||||
CableConnectionType = (int)data.CableConnectionType,
|
CableConnectionType = (int)data.CableConnectionType,
|
||||||
|
|
||||||
AxisNo = data.AxisNo,
|
AxisNo = data.AxisNo,
|
||||||
CableType = data.CableType,
|
CableTypePrimary = data.CableTypePrimary,
|
||||||
|
CableTypeSecond = data.CableTypeSecond,
|
||||||
EncoderLineParagraph = data.EncoderLineParagraph,
|
EncoderLineParagraph = data.EncoderLineParagraph,
|
||||||
PowerLineParagraph = data.PowerLineParagraph,
|
PowerLineParagraph = data.PowerLineParagraph,
|
||||||
CableModelStr = data.CableModelStr,
|
CableModelStr = data.CableModelStr,
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||||
{
|
{
|
||||||
public static class LectotypeManager
|
public static class LectotypeManager
|
||||||
{
|
{
|
||||||
|
public static string CURRENT_DOC_ID = "";
|
||||||
|
|
||||||
public class LectotypeViewModelFactory
|
public class LectotypeViewModelFactory
|
||||||
{
|
{
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
Text="{Binding AxisNo, Mode=TwoWay}" />
|
Text="{Binding AxisNo, Mode=TwoWay}" />
|
||||||
|
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
<hc:SimpleStackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
<!--<hc:SimpleStackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Width="100"
|
Width="100"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
SelectedIndex="0"
|
SelectedIndex="0"
|
||||||
SelectedValue="{Binding CableType}"
|
SelectedValue="{Binding CableType}"
|
||||||
SelectedValuePath="ItemValue" />
|
SelectedValuePath="ItemValue" />
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>-->
|
||||||
<!--<hc:SimpleStackPanel Margin="0,10,0,0" Orientation="Vertical">
|
<!--<hc:SimpleStackPanel Margin="0,10,0,0" Orientation="Vertical">
|
||||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||||
<TextBlock Width="100" Text="编码器线长度:" VerticalAlignment="Center"/>
|
<TextBlock Width="100" Text="编码器线长度:" VerticalAlignment="Center"/>
|
||||||
|
@ -148,25 +148,44 @@
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
</hc:SimpleStackPanel>-->
|
</hc:SimpleStackPanel>-->
|
||||||
<hc:SimpleStackPanel Margin="0,10" Orientation="Vertical">
|
<hc:SimpleStackPanel Margin="0,10" Orientation="Vertical">
|
||||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
<hc:SimpleStackPanel VerticalAlignment="Stretch" Orientation="Horizontal">
|
||||||
<TextBlock
|
<hc:SimpleStackPanel
|
||||||
Width="100"
|
Width="200"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="编码器线段数:" />
|
Orientation="Horizontal">
|
||||||
|
<hc:ComboBox
|
||||||
|
Width="153"
|
||||||
|
DisplayMemberPath="ItemName"
|
||||||
|
ItemsSource="{Binding CableTypes}"
|
||||||
|
SelectedIndex="0"
|
||||||
|
SelectedValue="{Binding CableTypePrimary}"
|
||||||
|
SelectedValuePath="ItemValue" />
|
||||||
|
<TextBlock VerticalAlignment="Center" Text="段数:" />
|
||||||
|
</hc:SimpleStackPanel>
|
||||||
<hc:TextBox
|
<hc:TextBox
|
||||||
Width="263"
|
Width="163"
|
||||||
Height="30"
|
Height="30"
|
||||||
IsEnabled="{Binding IsEnableParagraph}"
|
IsEnabled="{Binding IsEnableParagraph}"
|
||||||
IsReadOnly="False"
|
IsReadOnly="False"
|
||||||
Text="{Binding EncoderLineParagraph, Mode=TwoWay}" />
|
Text="{Binding EncoderLineParagraph, Mode=TwoWay}" />
|
||||||
</hc:SimpleStackPanel>
|
</hc:SimpleStackPanel>
|
||||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||||
<TextBlock
|
<hc:SimpleStackPanel
|
||||||
Width="100"
|
Width="200"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="动力线段数:" />
|
Orientation="Horizontal">
|
||||||
|
<hc:ComboBox
|
||||||
|
Width="153"
|
||||||
|
DisplayMemberPath="ItemName"
|
||||||
|
IsEnabled="{Binding IsEnableParagraph}"
|
||||||
|
ItemsSource="{Binding CableTypes}"
|
||||||
|
SelectedIndex="0"
|
||||||
|
SelectedValue="{Binding CableTypeSecond}"
|
||||||
|
SelectedValuePath="ItemValue" />
|
||||||
|
<TextBlock VerticalAlignment="Center" Text="段数:" />
|
||||||
|
</hc:SimpleStackPanel>
|
||||||
<hc:TextBox
|
<hc:TextBox
|
||||||
Width="263"
|
Width="163"
|
||||||
Height="30"
|
Height="30"
|
||||||
IsEnabled="{Binding IsEnableParagraph}"
|
IsEnabled="{Binding IsEnableParagraph}"
|
||||||
IsReadOnly="False"
|
IsReadOnly="False"
|
||||||
|
@ -287,7 +306,7 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTemplateColumn Header="是否布线完成">
|
<!--<DataGridTemplateColumn Header="是否布线完成">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
|
@ -297,7 +316,7 @@
|
||||||
IsEnabled="True" />
|
IsEnabled="True" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>-->
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Binding="{Binding CableModelNo}"
|
Binding="{Binding CableModelNo}"
|
||||||
Header="型号"
|
Header="型号"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
using EPLAN.Harness.Core.Controls;
|
||||||
using EPLAN.Harness.Core.Tasks;
|
using EPLAN.Harness.Core.Tasks;
|
||||||
using EPLAN.Harness.Graphics;
|
using EPLAN.Harness.Graphics;
|
||||||
|
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
|
||||||
|
using EPLAN.Harness.ProjectCore;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
using Sinvo.EplanHpD.Plugin.Service;
|
using Sinvo.EplanHpD.Plugin.Service;
|
||||||
using Sinvo.EplanHpD.Plugin.WPFUI.Common;
|
using Sinvo.EplanHpD.Plugin.WPFUI.Common;
|
||||||
|
@ -15,6 +18,8 @@ using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using static Sinvo.EplanHpD.Plugin.WPFUI.Utils.LectotypeManager;
|
using static Sinvo.EplanHpD.Plugin.WPFUI.Utils.LectotypeManager;
|
||||||
|
using System.Linq;
|
||||||
|
using EPLAN.Harness.ProjectCore.Occurrences;
|
||||||
|
|
||||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
||||||
{
|
{
|
||||||
|
@ -142,5 +147,29 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void ToMotorSource(string motorId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(LectotypeManager.CURRENT_DOC_ID)) return;
|
||||||
|
var doc = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(designer => designer.ID == LectotypeManager.CURRENT_DOC_ID);
|
||||||
|
var part = doc.GetOccurrenceByID(motorId);
|
||||||
|
//var cable = doc.GetOccurrenceByName(cableName, typeof(OccCableForked));
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
doc.SelectSet.Clear();
|
||||||
|
var oriOcc = SelfControler<BaseOccurrence>.FindInstance(part.ID);
|
||||||
|
oriOcc.SetVisibility(true, null);
|
||||||
|
doc.SelectSet.Add(oriOcc);
|
||||||
|
|
||||||
|
doc.FitToSelectSet();
|
||||||
|
doc.SelectSet.OnSelectionChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
FlexMessageBox.Error(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,32 +48,47 @@
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
Panel.ZIndex="99" />
|
Panel.ZIndex="99" />
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<hc:SimpleStackPanel Grid.Row="0" Orientation="Horizontal">
|
<Grid Grid.Row="0" Grid.RowSpan="2">
|
||||||
<!--<TextBlock FontSize="14" TextWrapping="Wrap">
|
<Grid.RowDefinitions>
|
||||||
<Run Text="选中的电机:" />
|
<RowDefinition Height="15" />
|
||||||
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding SelectMotorModel}" />
|
<RowDefinition Height="30" />
|
||||||
</TextBlock>-->
|
</Grid.RowDefinitions>
|
||||||
<TextBlock
|
<Grid.ColumnDefinitions>
|
||||||
Margin="0,0,0,0"
|
<ColumnDefinition Width="*" />
|
||||||
FontSize="14"
|
<ColumnDefinition Width="80" />
|
||||||
TextWrapping="Wrap">
|
</Grid.ColumnDefinitions>
|
||||||
<Run Text="当前布线的电机:" />
|
<hc:SimpleStackPanel Grid.Row="0" Orientation="Horizontal">
|
||||||
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding Motor.MotorModelStr}" />
|
<!--<TextBlock FontSize="14" TextWrapping="Wrap">
|
||||||
<Run Text=" " />
|
<Run Text="选中的电机:" />
|
||||||
<Run Text="轴号:" />
|
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding SelectMotorModel}" />
|
||||||
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding SelectedLine.AxisNo}" />
|
</TextBlock>-->
|
||||||
</TextBlock>
|
<TextBlock
|
||||||
</hc:SimpleStackPanel>
|
Margin="0,0,0,0"
|
||||||
<StackPanel Grid.Row="1" VerticalAlignment="Center">
|
FontSize="14"
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="14">
|
TextWrapping="Wrap">
|
||||||
<Run Text="当前线段:" />
|
<Run Text="当前布线的电机:" />
|
||||||
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding SelectedLine.CableConnectionClass}" />
|
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding Motor.MotorModelStr}" />
|
||||||
<Run Text=" " />
|
<Run Text=" " />
|
||||||
<Run Text="当前线类型:" />
|
<Run Text="轴号:" />
|
||||||
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding SelectedLine.CableType}" />
|
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding SelectedLine.AxisNo}" />
|
||||||
|
</TextBlock>
|
||||||
</TextBlock>
|
</hc:SimpleStackPanel>
|
||||||
</StackPanel>
|
<StackPanel Grid.Row="1" VerticalAlignment="Center">
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="14">
|
||||||
|
<Run Text="当前线段:" />
|
||||||
|
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding SelectedLine.CableConnectionClass}" />
|
||||||
|
<Run Text=" " />
|
||||||
|
<Run Text="当前线类型:" />
|
||||||
|
<Run Foreground="{StaticResource DangerBrush}" Text="{Binding SelectedLine.CableType}" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
<Button
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.RowSpan="2"
|
||||||
|
Grid.Column="1"
|
||||||
|
Content="转到电机"
|
||||||
|
Style="{StaticResource ButtonPrimary}" />
|
||||||
|
</Grid>
|
||||||
<ListView
|
<ListView
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
hc:GridViewAttach.ColumnHeaderHeight="10"
|
hc:GridViewAttach.ColumnHeaderHeight="10"
|
||||||
|
@ -106,7 +121,7 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</GridViewColumn.CellTemplate>
|
</GridViewColumn.CellTemplate>
|
||||||
</GridViewColumn>
|
</GridViewColumn>
|
||||||
<GridViewColumn Width="230" Header="操作">
|
<!--<GridViewColumn Width="230" Header="操作">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Button
|
<Button
|
||||||
|
@ -116,7 +131,7 @@
|
||||||
Tag="{Binding CableModel}" />
|
Tag="{Binding CableModel}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</GridViewColumn.CellTemplate>
|
</GridViewColumn.CellTemplate>
|
||||||
</GridViewColumn>
|
</GridViewColumn>-->
|
||||||
</GridView>
|
</GridView>
|
||||||
</ListView.View>
|
</ListView.View>
|
||||||
</ListView>
|
</ListView>
|
||||||
|
|
|
@ -312,7 +312,7 @@
|
||||||
|
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="整理后的数据">
|
<TabItem Header="多芯线数据">
|
||||||
<!--
|
<!--
|
||||||
RowDetailsVisibilityChanged="LettotypeListView_RowDetailsVisibilityChanged"
|
RowDetailsVisibilityChanged="LettotypeListView_RowDetailsVisibilityChanged"
|
||||||
RowDetailsVisibilityMode="{Binding DetailsShowMode}"
|
RowDetailsVisibilityMode="{Binding DetailsShowMode}"
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
//_docId = docId;
|
//_docId = docId;
|
||||||
|
LectotypeManager.CURRENT_DOC_ID = docId;
|
||||||
this.DataContext = ViewModel = new LectotypeViewModel(docId);
|
this.DataContext = ViewModel = new LectotypeViewModel(docId);
|
||||||
Application.Current.SetMainWindow(this);
|
Application.Current.SetMainWindow(this);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private const string MESSAGE_KEY = "CableLectotypeMessage";
|
private const string MESSAGE_KEY = "CableLectotypeMessage";
|
||||||
private readonly MotorExcelHelper motorExcelHelper = MotorExcelHelper.Instance;
|
private readonly MotorExcelHelper motorExcelHelper = MotorExcelHelper.Instance;
|
||||||
|
private MotorLectotypeService motorService = new MotorLectotypeService();
|
||||||
|
|
||||||
private Dictionary<string,Dictionary<int,int>> CableTypeIndexs = new Dictionary<string, Dictionary<int, int>>
|
private Dictionary<string,Dictionary<int,int>> CableTypeIndexs = new Dictionary<string, Dictionary<int, int>>
|
||||||
{
|
{
|
||||||
|
@ -33,27 +34,35 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Cablerator()
|
public void Cablerator()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
SelectedLines?.Clear();
|
||||||
if (string.IsNullOrEmpty(Motor.MotorPower))
|
if (string.IsNullOrEmpty(Motor.MotorPower))
|
||||||
{
|
{
|
||||||
ShowWarning("电机功率不能为空!");
|
ShowWarning("电机功率不能为空!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (EncoderLineParagraph == 0 || PowerLineParagraph == 0)
|
if(IsEnableParagraph)
|
||||||
{
|
if (EncoderLineParagraph == 0 || PowerLineParagraph == 0)
|
||||||
ShowWarning("段数不能为零!");
|
{
|
||||||
return;
|
ShowWarning("段数不能为零!");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(AxisNo))
|
if (string.IsNullOrEmpty(AxisNo))
|
||||||
{
|
{
|
||||||
ShowWarning("轴号不能为空!");
|
ShowWarning("轴号不能为空!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(CableType))
|
if (string.IsNullOrEmpty(CableTypePrimary))
|
||||||
{
|
{
|
||||||
ShowWarning("请选择线材类型!");
|
ShowWarning("请选择线材类型!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (CableTypePrimary.Equals(CableTypeSecond))
|
||||||
|
{
|
||||||
|
ShowWarning("不能选择同样的线段类型!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
int seqNo = 1;
|
int seqNo = 1;
|
||||||
var LectotypeList = new List<LectotypeLineModel>();
|
var LectotypeList = new List<LectotypeLineModel>();
|
||||||
var line = new LectotypeLineModel
|
var line = new LectotypeLineModel
|
||||||
|
@ -67,7 +76,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
//DriverInterface = DriverInterface,
|
//DriverInterface = DriverInterface,
|
||||||
//DriverModel = DriverModel,
|
//DriverModel = DriverModel,
|
||||||
CableConnectionClass = CableConnectionType == ConnectionType.FullParagraph ? "前段" : "直通",
|
CableConnectionClass = CableConnectionType == ConnectionType.FullParagraph ? "前段" : "直通",
|
||||||
CableType = CableType,
|
CableType = Motor.Brand == Brands.ANCHUAN ? CableTypePrimary : $"{CableTypePrimary}+{CableTypeSecond}",
|
||||||
//IsFlexibility = IsFlexibility,
|
//IsFlexibility = IsFlexibility,
|
||||||
//PowerLineLength = PowerLineLength,
|
//PowerLineLength = PowerLineLength,
|
||||||
//EncoderLineLength = EncoderLineLength,
|
//EncoderLineLength = EncoderLineLength,
|
||||||
|
@ -98,16 +107,16 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
// 安川第一条线不合并,所以需要再次添加另一个类型的线
|
// 安川第一条线不合并,所以需要再次添加另一个类型的线
|
||||||
if (Motor.Brand == Brands.ANCHUAN)
|
if (Motor.Brand == Brands.ANCHUAN)
|
||||||
{
|
{
|
||||||
var index = CableTypeIndexs[CableType];
|
//var index = CableTypeIndexs[CableTypePrimary];
|
||||||
var secLineCableType = "";
|
//var secLineCableType = "";
|
||||||
var flag = index.Keys.First() + index.Values.First();
|
//var flag = index.Keys.First() + index.Values.First();
|
||||||
if (CableType.Contains("刹车") && flag != 1)
|
//if (CableTypePrimary.Contains("刹车") && flag != 1)
|
||||||
{
|
//{
|
||||||
// 动力线 or 动力刹车线
|
// // 动力线 or 动力刹车线
|
||||||
flag = 0;
|
// flag = 0;
|
||||||
}
|
//}
|
||||||
//else
|
////else
|
||||||
secLineCableType = CableTypeIndexs.Keys.ToList()[flag];
|
//secLineCableType = CableTypeIndexs.Keys.ToList()[flag];
|
||||||
|
|
||||||
var secLine = new LectotypeLineModel
|
var secLine = new LectotypeLineModel
|
||||||
{
|
{
|
||||||
|
@ -120,7 +129,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
//DriverInterface = DriverInterface,
|
//DriverInterface = DriverInterface,
|
||||||
//DriverModel = DriverModel,
|
//DriverModel = DriverModel,
|
||||||
CableConnectionClass = CableConnectionType == ConnectionType.FullParagraph ? "前段" : "直通",
|
CableConnectionClass = CableConnectionType == ConnectionType.FullParagraph ? "前段" : "直通",
|
||||||
CableType = secLineCableType,
|
CableType = CableTypeSecond,
|
||||||
//IsFlexibility = IsFlexibility,
|
//IsFlexibility = IsFlexibility,
|
||||||
//PowerLineLength = PowerLineLength,
|
//PowerLineLength = PowerLineLength,
|
||||||
//EncoderLineLength = EncoderLineLength,
|
//EncoderLineLength = EncoderLineLength,
|
||||||
|
@ -162,7 +171,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
//DrawingNo = DrawingNo,
|
//DrawingNo = DrawingNo,
|
||||||
//CableModelNo = CableModelNo,
|
//CableModelNo = CableModelNo,
|
||||||
CableConnectionClass = cableConnectionType,
|
CableConnectionClass = cableConnectionType,
|
||||||
CableType = CableType.Contains("刹车") ? "动力刹车线" : "动力线",
|
CableType = CableTypeSecond,
|
||||||
LineCount = PowerLineParagraph,
|
LineCount = PowerLineParagraph,
|
||||||
//PowerLineLength = PowerLineLength,
|
//PowerLineLength = PowerLineLength,
|
||||||
//CurrentLineNumber = i,
|
//CurrentLineNumber = i,
|
||||||
|
@ -198,7 +207,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
//DrawingNo = DrawingNo,
|
//DrawingNo = DrawingNo,
|
||||||
//CableModelNo = CableModelNo,
|
//CableModelNo = CableModelNo,
|
||||||
CableConnectionClass = cableConnectionType,
|
CableConnectionClass = cableConnectionType,
|
||||||
CableType = "编码器线",
|
CableType = CableTypePrimary,
|
||||||
LineCount = EncoderLineParagraph,
|
LineCount = EncoderLineParagraph,
|
||||||
//PowerLineLength = PowerLineLength,
|
//PowerLineLength = PowerLineLength,
|
||||||
//CurrentLineNumber = i,
|
//CurrentLineNumber = i,
|
||||||
|
@ -263,7 +272,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return types.Where(it => it.ItemFlag == "否").ToList();
|
return types.Where(it => it.ItemFlag == "否").ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
@ -314,18 +323,13 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
_cableConnectionType = value;
|
_cableConnectionType = value;
|
||||||
OnPropertyChanged(nameof(CableConnectionType));
|
OnPropertyChanged(nameof(CableConnectionType));
|
||||||
|
|
||||||
if (_cableConnectionType == ConnectionType.Passthrough)
|
IsEnableParagraph = !(_cableConnectionType == ConnectionType.Passthrough);
|
||||||
|
PowerLineParagraph = 0;
|
||||||
|
EncoderLineParagraph = 0;
|
||||||
|
if (!IsEnableParagraph)
|
||||||
{
|
{
|
||||||
IsEnableParagraph = false;
|
|
||||||
PowerLineParagraph = 1;
|
|
||||||
EncoderLineParagraph = 1;
|
EncoderLineParagraph = 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
IsEnableParagraph = true;
|
|
||||||
PowerLineParagraph = 3;
|
|
||||||
EncoderLineParagraph = 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,17 +343,26 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
OnPropertyChanged(nameof(AxisNo));
|
OnPropertyChanged(nameof(AxisNo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string _cableType;
|
private string _cableTypePrimary;
|
||||||
public string CableType
|
public string CableTypePrimary
|
||||||
{
|
{
|
||||||
get { return _cableType; }
|
get { return _cableTypePrimary; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_cableType = value;
|
_cableTypePrimary = value;
|
||||||
OnPropertyChanged(nameof(CableType));
|
OnPropertyChanged(nameof(CableTypePrimary));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _cableTypeSecond;
|
||||||
|
public string CableTypeSecond
|
||||||
|
{
|
||||||
|
get { return _cableTypeSecond; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_cableTypeSecond = value;
|
||||||
|
OnPropertyChanged(nameof(CableTypeSecond));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _encoderLineParagraph;
|
private int _encoderLineParagraph;
|
||||||
public int EncoderLineParagraph
|
public int EncoderLineParagraph
|
||||||
{
|
{
|
||||||
|
@ -395,10 +408,10 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
|
|
||||||
|
|
||||||
public bool SaveToDb()
|
public bool SaveToDb()
|
||||||
{
|
{
|
||||||
var service = new MotorLectotypeService();
|
//var service = new MotorLectotypeService();
|
||||||
// 查找或添加 Motor
|
// 查找或添加 Motor
|
||||||
return service.SaveMotorLectotypeData(Motor.OccPartId, this);
|
return motorService.SaveMotorLectotypeData(Motor.OccPartId, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
@ -417,7 +430,8 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
||||||
Motor = viewModel.Motor;
|
Motor = viewModel.Motor;
|
||||||
CableConnectionType = viewModel.CableConnectionType;
|
CableConnectionType = viewModel.CableConnectionType;
|
||||||
AxisNo = viewModel.AxisNo;
|
AxisNo = viewModel.AxisNo;
|
||||||
CableType = viewModel.CableType;
|
CableTypePrimary = viewModel.CableTypePrimary;
|
||||||
|
CableTypeSecond = viewModel.CableTypeSecond;
|
||||||
EncoderLineParagraph = viewModel.EncoderLineParagraph;
|
EncoderLineParagraph = viewModel.EncoderLineParagraph;
|
||||||
PowerLineParagraph = viewModel.PowerLineParagraph;
|
PowerLineParagraph = viewModel.PowerLineParagraph;
|
||||||
CableModelStr = viewModel.CableModelStr;
|
CableModelStr = viewModel.CableModelStr;
|
||||||
|
|
Loading…
Reference in New Issue