pengliangyang vor 2 Jahren
Ursprung
Commit
5b769a1fe0
34 geänderte Dateien mit 374 neuen und 127 gelöschten Zeilen
  1. +33
    -0
      BPASmartClient.CustomResource/Converters/CountIsVisiableConvert.cs
  2. +2
    -2
      BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml
  3. +1
    -0
      DosingSystem/App.xaml
  4. +7
    -7
      DosingSystem/App.xaml.cs
  5. +1
    -2
      DosingSystem/BPASmartClient.DosingSystem.csproj
  6. +2
    -2
      DosingSystem/Model/CylinderStatusModel.cs
  7. +2
    -2
      DosingSystem/Model/DeviceCurrentStatus.cs
  8. +2
    -2
      DosingSystem/Model/DeviceInquire.cs
  9. +2
    -2
      DosingSystem/Model/OutletInfoModel.cs
  10. +2
    -2
      DosingSystem/Model/RecipeModel.cs
  11. +2
    -2
      DosingSystem/Model/RecipeProcess.cs
  12. +2
    -2
      DosingSystem/Model/StockStatusModel.cs
  13. +3
    -3
      DosingSystem/Model/ViewModelBase.cs
  14. +52
    -0
      DosingSystem/Model/par/BasePar.cs
  15. +4
    -25
      DosingSystem/Model/par/DevicePar.cs
  16. +2
    -2
      DosingSystem/Model/par/DeviceParModel.cs
  17. +22
    -1
      DosingSystem/Service/SiemensDevice.cs
  18. +141
    -8
      DosingSystem/View/CommParSetView.xaml
  19. +3
    -1
      DosingSystem/View/CommParSetView.xaml.cs
  20. +8
    -5
      DosingSystem/View/ManualControlView.xaml
  21. +3
    -0
      DosingSystem/View/ManualControlView.xaml.cs
  22. +0
    -2
      DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
  23. +7
    -9
      DosingSystem/ViewModel/CommparSetViewModel.cs
  24. +2
    -4
      DosingSystem/ViewModel/DeviceListViewModel.cs
  25. +2
    -2
      DosingSystem/ViewModel/DeviceMaterialParViewModel.cs
  26. +3
    -3
      DosingSystem/ViewModel/HardwareStatusViewModel.cs
  27. +43
    -14
      DosingSystem/ViewModel/ManualControlViewModel.cs
  28. +2
    -2
      DosingSystem/ViewModel/NewMaterialViewModel.cs
  29. +7
    -7
      DosingSystem/ViewModel/NewOutletViewModel.cs
  30. +2
    -2
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  31. +2
    -2
      DosingSystem/ViewModel/OutletManagementViewModel.cs
  32. +2
    -4
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  33. +3
    -3
      DosingSystem/ViewModel/RecipeSettingsViewModel.cs
  34. +3
    -3
      DosingSystem/ViewModel/StockControViewModel.cs

+ 33
- 0
BPASmartClient.CustomResource/Converters/CountIsVisiableConvert.cs Datei anzeigen

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace BPASmartClient.CustomResource.Converters
{
public class CountIsVisiableConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
var count = value?.GetType()?.GetProperty("Count")?.GetValue(value);
if (count != null && count is int tempCount)
{
if (tempCount > 0) return Visibility.Visible;
}
}
return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

+ 2
- 2
BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml Datei anzeigen

@@ -12,10 +12,10 @@
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center">

<Canvas
Background="Transparent"
Width="{Binding ElementName=br, Path=ActualWidth}"
Height="{Binding ElementName=br, Path=ActualHeight}"
Margin="5">
Margin="5"
Background="Transparent">

<Rectangle
Canvas.Top="20"


+ 1
- 0
DosingSystem/App.xaml Datei anzeigen

@@ -26,6 +26,7 @@
<con:StatusConverter x:Key="StatusConverter" />
<con:StringToIconConverter x:Key="StringToIconConverter" />
<con:BoolToVisibilityConvert x:Key="BoolToVisibilityConvert" />
<con:CountIsVisiableConvert x:Key="CountIsVisiableConvert" />
</ResourceDictionary>

<ResourceDictionary>


+ 7
- 7
DosingSystem/App.xaml.cs Datei anzeigen

@@ -128,13 +128,13 @@ namespace BPASmartClient.DosingSystem
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.ManualControlView"
});
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "料仓控制",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.StockControlView"
});
//ManualControl.Add(new SubMenumodel()
//{
// SubMenuName = "料仓控制",
// SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
// AssemblyName = "BPASmartClient.DosingSystem",
// ToggleWindowPath = "View.StockControlView"
//});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe622;",


+ 1
- 2
DosingSystem/BPASmartClient.DosingSystem.csproj Datei anzeigen

@@ -16,9 +16,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.17" />
<PackageReference Include="BPA.Helper" Version="1.0.19" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>



+ 2
- 2
DosingSystem/Model/CylinderStatusModel.cs Datei anzeigen

@@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.DosingSystem
{
public class CylinderStatusModel : ObservableObject
public class CylinderStatusModel : NotifyBase
{
/// <summary>
/// 气缸原点信号


+ 2
- 2
DosingSystem/Model/DeviceCurrentStatus.cs Datei anzeigen

@@ -4,11 +4,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.DosingSystem
{
public class DeviceCurrentStatus : ObservableObject
public class DeviceCurrentStatus : NotifyBase
{
/// <summary>
/// 当前料仓重量反馈


+ 2
- 2
DosingSystem/Model/DeviceInquire.cs Datei anzeigen

@@ -111,8 +111,8 @@ namespace BPASmartClient.DosingSystem

public void Init()
{
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.Address)) IPSegment = Json<DevicePar>.Data.Address;
else Json<DevicePar>.Data.Address = IPSegment;
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.BaseParModel.NetworkSegAddress)) IPSegment = Json<DevicePar>.Data.BaseParModel.NetworkSegAddress;
else Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = IPSegment;
TestData();
IpAddressLines();
DeviceDataInit();


+ 2
- 2
DosingSystem/Model/OutletInfoModel.cs Datei anzeigen

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;

namespace BPASmartClient.DosingSystem
@@ -11,7 +11,7 @@ namespace BPASmartClient.DosingSystem
/// <summary>
/// 出料口信息
/// </summary>
public class OutletInfoModel : ObservableObject
public class OutletInfoModel : NotifyBase
{
/// <summary>
/// 出料口名称


+ 2
- 2
DosingSystem/Model/RecipeModel.cs Datei anzeigen

@@ -6,14 +6,14 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.DosingSystem
{
/// <summary>
/// 配方模块
/// </summary>
public class RecipeModel : ObservableObject
public class RecipeModel : NotifyBase
{
[Newtonsoft.Json.JsonIgnore]
public bool IsEnable { get { return _mIsEnable; } set { _mIsEnable = value; OnPropertyChanged(); } }


+ 2
- 2
DosingSystem/Model/RecipeProcess.cs Datei anzeigen

@@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.DosingSystem
{
public class RecipeProcess : ObservableObject
public class RecipeProcess : NotifyBase
{
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
private string _mRawMaterialName;


+ 2
- 2
DosingSystem/Model/StockStatusModel.cs Datei anzeigen

@@ -1,4 +1,4 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +7,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem
{
public class StockStatusModel : ObservableObject
public class StockStatusModel : NotifyBase
{
/// <summary>
/// 料仓物料重量


+ 3
- 3
DosingSystem/Model/ViewModelBase.cs Datei anzeigen

@@ -3,13 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System.Collections.ObjectModel;

namespace BPASmartClient.DosingSystem
{
public class ViewModelBase : ObservableObject
public class ViewModelBase : NotifyBase
{
public int Index { get; set; } = -1;
public RelayCommand AddCommand { get; set; }//添加


+ 52
- 0
DosingSystem/Model/par/BasePar.cs Datei anzeigen

@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;

namespace BPASmartClient.DosingSystem
{
/// <summary>
/// 基础参数
/// </summary>
public class BasePar : NotifyBase
{
/// <summary>
/// 设备扫描网段
/// </summary>
public string NetworkSegAddress { get { return _mNetworkSegAddress; } set { _mNetworkSegAddress = value; OnPropertyChanged(); } }
private string _mNetworkSegAddress = "192.168.0.";

/// <summary>
/// 输送带设备 PLC IP 地址
/// </summary>
public string DeviceAddress { get { return _mDeviceAddress; } set { _mDeviceAddress = value; OnPropertyChanged(); } }
private string _mDeviceAddress = "192.168.0.1";

/// <summary>
/// 输送带数量
/// </summary>
public int ConveyerBeltCount { get { return _mConveyerBeltCount; } set { _mConveyerBeltCount = value; OnPropertyChanged(); } }
private int _mConveyerBeltCount = 0;

/// <summary>
/// 升降气缸数量
/// </summary>
public int LiftCylinderCount { get { return _mLiftCylinderCount; } set { _mLiftCylinderCount = value; OnPropertyChanged(); } }
private int _mLiftCylinderCount = 0;

/// <summary>
/// 阻挡气缸数量
/// </summary>
public int BlockCylinderCount { get { return _mBlockCylinderCount; } set { _mBlockCylinderCount = value; OnPropertyChanged(); } }
private int _mBlockCylinderCount = 0;

/// <summary>
/// 托盘气缸数量
/// </summary>
public int PalletCylinderCount { get { return _mPalletCylinderCount; } set { _mPalletCylinderCount = value; OnPropertyChanged(); } }
private int _mPalletCylinderCount = 0;

}
}

+ 4
- 25
DosingSystem/Model/par/DevicePar.cs Datei anzeigen

@@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using BPA.Helper;

namespace BPASmartClient.DosingSystem
{
public class DevicePar
public class DevicePar : NotifyBase
{
/// <summary>
/// 配料设备参数
@@ -17,30 +17,9 @@ namespace BPASmartClient.DosingSystem

public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } = new ObservableCollection<OutletInfoModel>();

/// <summary>
/// 设备扫描网段
/// </summary>
public string Address { get; set; } = string.Empty;

/// <summary>
/// 设备端口号
/// </summary>
public int Port { get; set; } = 502;

/// <summary>
/// 升降气缸数量
/// </summary>
public int LiftCylinderCount { get; set; }

/// <summary>
/// 阻挡气缸数量
/// </summary>
public int BlockCylinderCount { get; set; }

/// <summary>
/// 托盘气缸数量
/// </summary>
public int PalletCylinderCount { get; set; }
public BasePar BaseParModel { get { return _mBaseParModel; } set { _mBaseParModel = value; OnPropertyChanged(); } }
private BasePar _mBaseParModel = new BasePar();

}
}

+ 2
- 2
DosingSystem/Model/par/DeviceParModel.cs Datei anzeigen

@@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.DosingSystem
{
public class DeviceParModel : ObservableObject
public class DeviceParModel : NotifyBase
{
/// <summary>
/// 原料名称


+ 22
- 1
DosingSystem/Service/SiemensDevice.cs Datei anzeigen

@@ -36,12 +36,33 @@ namespace BPASmartClient.DosingSystem

ThreadManage.GetInstance().StartLong(new Action(() =>
{
GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);
GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);//获取PLC到上位机的数据
Thread.Sleep(50);
}), "读取输送线设备数据", true);

}

public string GetSiemensBitSingleAdd(string Prefix, int num, int StartAdd = 0)
{
if (num > 0)
{
string Add = string.Empty;
var FirstAdd = num / 8;
var EndAdd = (num % 8);
if (EndAdd == 0)
{
FirstAdd--;
EndAdd = 7;
}
else EndAdd--;
Add = $"{Prefix}{FirstAdd + StartAdd}.{EndAdd}";
return Add;
}
return default;


}



}


+ 141
- 8
DosingSystem/View/CommParSetView.xaml Datei anzeigen

@@ -22,24 +22,157 @@
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Width="120"
Grid.Column="3"
Width="120"
Height="30"
HorizontalAlignment="Left"
Margin="5,0,5,0"
HorizontalAlignment="Left"
Command="{Binding SaveCommand}"
Content="保存参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

<Grid Grid.ColumnSpan="4" Grid.Row="1">
<WrapPanel Grid.Row="1" Grid.ColumnSpan="4">

<Grid Width="350" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="0,0,2,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="配料设备网段:" />

<TextBox
Grid.Column="1"
Width="170"
Height="35"
HorizontalAlignment="Right"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding CommBaseParModel.NetworkSegAddress, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

<Grid Width="350" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="0,0,2,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="输送带PLC地址:" />

<TextBox
Grid.Column="1"
Width="170"
Height="35"
HorizontalAlignment="Right"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding CommBaseParModel.DeviceAddress, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

<Grid Width="350" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="0,0,2,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="升降气缸数量:" />

<TextBox
Grid.Column="1"
Width="170"
Height="35"
HorizontalAlignment="Right"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding CommBaseParModel.LiftCylinderCount, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

<Grid Width="350" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="0,0,2,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="阻挡气缸数量:" />

<TextBox
Grid.Column="1"
Width="170"
Height="35"
HorizontalAlignment="Right"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding CommBaseParModel.BlockCylinderCount, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

<Grid Width="350" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="0,0,2,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="托盘气缸数量:" />

<TextBox
Grid.Column="1"
Width="170"
Height="35"
HorizontalAlignment="Right"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding CommBaseParModel.PalletCylinderCount, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

<Grid Width="350" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="0,0,2,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="输送带数量:" />

<TextBox
Grid.Column="1"
Width="170"
Height="35"
HorizontalAlignment="Right"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding CommBaseParModel.ConveyerBeltCount, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

</WrapPanel>

<Grid
Grid.Row="1"
Grid.ColumnSpan="4"
Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
@@ -60,7 +193,7 @@
Margin="10,0,0,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="配料设备网段地址:" />
Text="配料设备网段:" />

<TextBox
Grid.Column="1"


+ 3
- 1
DosingSystem/View/CommParSetView.xaml.cs Datei anzeigen

@@ -1,4 +1,5 @@
using System;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -23,6 +24,7 @@ namespace BPASmartClient.DosingSystem.View
public CommParSetView()
{
InitializeComponent();
this.Unloaded += (o, e) => { Json<DevicePar>.Save(); };
}
}
}

+ 8
- 5
DosingSystem/View/ManualControlView.xaml Datei anzeigen

@@ -52,14 +52,15 @@
<UserControl.DataContext>
<vm:ManualControlViewModel />
</UserControl.DataContext>
<ScrollViewer>
<ScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Disabled">
<StackPanel Margin="8">

<!--#region 升降气缸-->
<Grid
Name="cy"
Grid.Row="0"
Margin="5">
Margin="5"
Visibility="{Binding cylinderModels, Converter={StaticResource CountIsVisiableConvert}}">
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=cy, Path=ActualWidth}"
@@ -90,7 +91,7 @@
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
<WrapPanel ScrollViewer.HorizontalScrollBarVisibility="Disabled" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

@@ -161,7 +162,8 @@
<Grid
Name="zd"
Grid.Row="1"
Margin="5">
Margin="5"
Visibility="{Binding BlockCylinders, Converter={StaticResource CountIsVisiableConvert}}">
<pry:ImageBorder Width="{Binding ElementName=zd, Path=ActualWidth}" Height="{Binding ElementName=zd, Path=ActualHeight}" />
<StackPanel>
<Grid Height="40">
@@ -259,7 +261,8 @@
<Grid
Name="tp"
Grid.Row="2"
Margin="5">
Margin="5"
Visibility="{Binding PalletCylinders, Converter={StaticResource CountIsVisiableConvert}}">
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=tp, Path=ActualWidth}"


+ 3
- 0
DosingSystem/View/ManualControlView.xaml.cs Datei anzeigen

@@ -24,6 +24,9 @@ namespace BPASmartClient.DosingSystem.View
{
InitializeComponent();
this.SizeChanged += ManualControlView_SizeChanged;
this.cy.Height = this.list1.ActualHeight + 40;
this.zd.Height = this.list2.ActualHeight + 40;
this.tp.Height = this.list3.ActualHeight + 40;
}

private void ManualControlView_SizeChanged(object sender, SizeChangedEventArgs e)


+ 0
- 2
DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs Datei anzeigen

@@ -4,8 +4,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.DosingSystem.ViewModel


+ 7
- 9
DosingSystem/ViewModel/CommparSetViewModel.cs Datei anzeigen

@@ -6,20 +6,18 @@ using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.DosingSystem.ViewModel
{
public class CommparSetViewModel : ObservableObject
public class CommparSetViewModel : NotifyBase
{
public CommparSetViewModel()
{
SaveCommand = new RelayCommand(() =>
{
if (!string.IsNullOrEmpty(Address))
if (!string.IsNullOrEmpty(CommBaseParModel.NetworkSegAddress))
{
var res = Address.Split(".");
var res = CommBaseParModel.NetworkSegAddress.Split(".");
if (res != null)
{
StringBuilder sb = new StringBuilder();
@@ -29,18 +27,18 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
sb.Append($"{res[i]}.");
}
Json<DevicePar>.Data.Address = sb.ToString();
Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = sb.ToString();
Json<DevicePar>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"参数保存成功!");
}
}
}
});
Address = Json<DevicePar>.Data.Address;
CommBaseParModel = Json<DevicePar>.Data.BaseParModel;
}

public string Address { get { return _mAddress; } set { _mAddress = value; OnPropertyChanged(); } }
private string _mAddress;
public BasePar CommBaseParModel { get { return _mCommBaseParModel; } set { _mCommBaseParModel = value; OnPropertyChanged(); } }
private BasePar _mCommBaseParModel;

public RelayCommand SaveCommand { get; set; }



+ 2
- 4
DosingSystem/ViewModel/DeviceListViewModel.cs Datei anzeigen

@@ -3,12 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.View;


@@ -36,7 +34,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
public ObservableCollection<Devices> devices { get; set; }
}

public class Devices : ObservableObject
public class Devices : NotifyBase
{
public string IpAddress { get { return _mIpAddress; } set { _mIpAddress = value; OnPropertyChanged(); } }
private string _mIpAddress;


+ 2
- 2
DosingSystem/ViewModel/DeviceMaterialParViewModel.cs Datei anzeigen

@@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;
using System.Diagnostics;


+ 3
- 3
DosingSystem/ViewModel/HardwareStatusViewModel.cs Datei anzeigen

@@ -3,17 +3,17 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;


namespace BPASmartClient.DosingSystem.ViewModel
{
public class HardwareStatusViewModel : ObservableObject
public class HardwareStatusViewModel : NotifyBase
{
public HardwareStatusViewModel()
{


+ 43
- 14
DosingSystem/ViewModel/ManualControlViewModel.cs Datei anzeigen

@@ -3,63 +3,86 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System.Collections.ObjectModel;

namespace BPASmartClient.DosingSystem.ViewModel
{
public class ManualControlViewModel : ObservableObject
public class ManualControlViewModel : NotifyBase
{
public ManualControlViewModel()
{
for (int i = 0; i < Json<DevicePar>.Data.LiftCylinderCount; i++)
for (int i = 0; i < Json<DevicePar>.Data.BaseParModel.LiftCylinderCount; i++)
{
cylinderModels.Add(new CylinderModel()
{
Name = $"升降气缸 {i + 1}",
LeftTog = false,
RightTog = false,
Num = i + 1,
});
}

for (int i = 0; i < Json<DevicePar>.Data.BlockCylinderCount; i++)
for (int i = 0; i < Json<DevicePar>.Data.BaseParModel.BlockCylinderCount; i++)
{
BlockCylinders.Add(new CylinderModel()
{
Name = $"阻挡气缸 {i + 1}",
LeftTog = false,
RightTog = false,
Num = i + 1,
});
}

for (int i = 0; i < Json<DevicePar>.Data.PalletCylinderCount; i++)
for (int i = 0; i < Json<DevicePar>.Data.BaseParModel.PalletCylinderCount; i++)
{
PalletCylinders.Add(new CylinderModel()
{
Name = $"托盘气缸 {i + 1}",
LeftTog = false,
RightTog = false,
Num = i + 1,
});
}

Open = new RelayCommand<object>((o) =>
{
int index = Array.FindIndex(cylinderModels.ToArray(), p => p.Name == o.ToString());
cylinderModels.ElementAt(index).LeftTog = true;
cylinderModels.ElementAt(index).RightTog = false;
if (o != null)
{
if (o.ToString().Contains("升降气缸"))
{
int index = Array.FindIndex(cylinderModels.ToArray(), p => p.Name == o.ToString());
if (index >= 0 && index < cylinderModels.Count)
{
cylinderModels.ElementAt(index).Control = !cylinderModels.ElementAt(index).Control;
var addRes = SiemensDevice.GetInstance.GetSiemensBitSingleAdd("DB5.DBX", cylinderModels.ElementAt(index).Num);
SiemensDevice.GetInstance.MySiemens.Write(addRes, cylinderModels.ElementAt(index).Control);
}
}
}
});


Close = new RelayCommand<object>((o) =>
{
int index = Array.FindIndex(cylinderModels.ToArray(), p => p.Name == o.ToString());
cylinderModels.ElementAt(index).LeftTog = false;
cylinderModels.ElementAt(index).RightTog = true;
if (o != null)
{
if (o.ToString().Contains("升降气缸"))
{
int index = Array.FindIndex(cylinderModels.ToArray(), p => p.Name == o.ToString());
if (index >= 0 && index < cylinderModels.Count)
{
cylinderModels.ElementAt(index).Control = !cylinderModels.ElementAt(index).Control;
var addRes = SiemensDevice.GetInstance.GetSiemensBitSingleAdd("DB5.DBX", cylinderModels.ElementAt(index).Num);
SiemensDevice.GetInstance.MySiemens.Write(addRes, cylinderModels.ElementAt(index).Control);
}
}
}
});
}



/// <summary>
/// 升降气缸
/// </summary>
@@ -81,7 +104,7 @@ namespace BPASmartClient.DosingSystem.ViewModel

}

public class CylinderModel : ObservableObject
public class CylinderModel : NotifyBase
{

public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } }
@@ -93,7 +116,13 @@ namespace BPASmartClient.DosingSystem.ViewModel
public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } }
private string _mName;

public bool Control { get { return _mControl; } set { _mControl = value; OnPropertyChanged(); } }
private bool _mControl;

/// <summary>
/// 气缸默认编号
/// </summary>
public int Num { get; set; }

}
}

+ 2
- 2
DosingSystem/ViewModel/NewMaterialViewModel.cs Datei anzeigen

@@ -1,8 +1,8 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPA.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;


+ 7
- 7
DosingSystem/ViewModel/NewOutletViewModel.cs Datei anzeigen

@@ -5,8 +5,8 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;

namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -55,8 +55,8 @@ namespace BPASmartClient.DosingSystem.ViewModel
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).OutletLoc = OutletLoc;
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).SiloInfos.Clear();
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).SiloInfos = SileNames;
//Control.GetInstance.OperationLog($"{OutletName} 编辑完成");
}
//Control.GetInstance.OperationLog($"{OutletName} 编辑完成");
}
else
{
var res = Json<DevicePar>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == OutletName);
@@ -78,8 +78,8 @@ namespace BPASmartClient.DosingSystem.ViewModel
OutletName = OutletName,
SiloInfos = SileNames
});
//Control.GetInstance.OperationLog($"{OutletName} 添加成功");
}
//Control.GetInstance.OperationLog($"{OutletName} 添加成功");
}
ActionManage.GetInstance.Send("NewOutletViewClose");
});
RemoveCommand = new RelayCommand<object>((o) =>
@@ -105,7 +105,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}


public class RawMaterialInfo : ObservableObject
public class RawMaterialInfo : NotifyBase
{

public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }


+ 2
- 2
DosingSystem/ViewModel/NewRecipeViewModel.cs Datei anzeigen

@@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Model;


+ 2
- 2
DosingSystem/ViewModel/OutletManagementViewModel.cs Datei anzeigen

@@ -6,8 +6,8 @@ using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.DosingSystem.View;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;

namespace BPASmartClient.DosingSystem.ViewModel
{


+ 2
- 4
DosingSystem/ViewModel/RecipeControlViewModel.cs Datei anzeigen

@@ -3,12 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls.MessageShow;
@@ -19,7 +17,7 @@ using System.Diagnostics;

namespace BPASmartClient.DosingSystem.ViewModel
{
public class RecipeControlViewModel : ObservableObject
public class RecipeControlViewModel : NotifyBase
{
ConcurrentQueue<string> RecipeNames = new ConcurrentQueue<string>();



+ 3
- 3
DosingSystem/ViewModel/RecipeSettingsViewModel.cs Datei anzeigen

@@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.View;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.Model;
@@ -20,7 +20,7 @@ using BPASmartClient.Model;

namespace BPASmartClient.DosingSystem.ViewModel
{
public class RecipeSettingsViewModel : ObservableObject
public class RecipeSettingsViewModel : NotifyBase
{
public RecipeSettingsViewModel()
{


+ 3
- 3
DosingSystem/ViewModel/StockControViewModel.cs Datei anzeigen

@@ -5,12 +5,12 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;

namespace BPASmartClient.DosingSystem.ViewModel
{
public class StockControViewModel : ObservableObject
public class StockControViewModel : NotifyBase
{
public StockControViewModel()
{


Laden…
Abbrechen
Speichern