pengliangyang 2 yıl önce
ebeveyn
işleme
f72d044955
9 değiştirilmiş dosya ile 113 ekleme ve 26 silme
  1. +3
    -1
      BPASmartClient.CustomResource/Pages/View/PromptView.xaml
  2. +0
    -8
      BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml
  3. +4
    -0
      BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
  4. +17
    -4
      DosingSystem/Model/DeviceCurrentStatus.cs
  5. +11
    -8
      DosingSystem/View/HardwareStatusView.xaml
  6. +1
    -0
      DosingSystem/View/NewRecipeView.xaml
  7. +5
    -0
      DosingSystem/View/NewRecipeView.xaml.cs
  8. +44
    -0
      DosingSystem/ViewModel/HardwareStatusViewModel.cs
  9. +28
    -5
      DosingSystem/ViewModel/NewRecipeViewModel.cs

+ 3
- 1
BPASmartClient.CustomResource/Pages/View/PromptView.xaml Dosyayı Görüntüle

@@ -10,6 +10,7 @@
Height="200"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
@@ -54,7 +55,7 @@
Name="infoType"
Grid.Column="1"
VerticalAlignment="Top"
FontSize="16"
FontSize="15"
Foreground="DeepSkyBlue" />
<TextBlock
Name="icon"
@@ -69,6 +70,7 @@
Grid.Column="2"
Margin="10,0,0,0"
VerticalAlignment="Top"
FontSize="15"
Foreground="DeepSkyBlue"
Text="警告:"
TextWrapping="Wrap" />


+ 0
- 8
BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml Dosyayı Görüntüle

@@ -102,27 +102,19 @@
</Grid>
</Viewbox>
<ControlTemplate.Triggers>
<!--<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="#FFd2e7f4" />
</Trigger>-->

<!-- 控件选中 -->
<Trigger Property="IsChecked" Value="true">
<!--<Setter Property="Foreground" Value="#ff1002E9" />-->
<Setter TargetName="ell" Property="HorizontalAlignment" Value="Right" />
<Setter TargetName="border2" Property="Background" Value="#00c2f4" />
<Setter TargetName="tb" Property="Text" Value="关" />
<Setter TargetName="tb" Property="Margin" Value="0,0,15,0" />
<!--<Setter TargetName="ell" Property="Fill" Value="#ff1002E9"/>-->
</Trigger>

<!-- 控件未选中 -->
<Trigger Property="IsChecked" Value="false">
<!--<Setter Property="Foreground" Value="#ff2AB2E7" />-->
<Setter TargetName="border2" Property="Background" Value="gray" />
<Setter TargetName="tb" Property="Text" Value="开" />
<Setter TargetName="tb" Property="Margin" Value="15,0,0,0" />
<!--<Setter TargetName="ell" Property="Fill" Value="#ddd"/>-->
</Trigger>

<!-- 鼠标进入 -->


+ 4
- 0
BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs Dosyayı Görüntüle

@@ -1,6 +1,7 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -97,6 +98,9 @@ namespace BPASmartClient.Model
public float UpLimtWeightFeedback { get { return _mUpLimtWeightFeedback; } set { _mUpLimtWeightFeedback = value; OnPropertyChanged(); } }
private float _mUpLimtWeightFeedback;




/// <summary>
/// 原料设备执行状态
/// 1:等待配料


+ 17
- 4
DosingSystem/Model/DeviceCurrentStatus.cs Dosyayı Görüntüle

@@ -17,13 +17,26 @@ namespace BPASmartClient.DosingSystem
private double _mWeight;

/// <summary>
/// 是否正在下料
/// 重量设置
/// </summary>
public bool IsLayOff { get { return _mIsLayOff; } set { _mIsLayOff = value; OnPropertyChanged(); } }
private bool _mIsLayOff;
public float SetWeight { get { return _mSetWeight; } set { _mSetWeight = value; OnPropertyChanged(); } }
private float _mSetWeight;

///// <summary>
///// 下料控制
///// </summary>
//public bool IsLayOff { get { return _mIsLayOff; } set { _mIsLayOff = value; OnPropertyChanged(); } }
//private bool _mIsLayOff;

/// <summary>
/// 下料控制
/// </summary>
public bool BaitingControl { get { return _mBaitingControl; } set { _mBaitingControl = value; OnPropertyChanged(); } }
private bool _mBaitingControl;


/// <summary>
/// 设备是否在线
/// 设备运行状态
/// </summary>
public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } }
private bool _mRunStatus;


+ 11
- 8
DosingSystem/View/HardwareStatusView.xaml Dosyayı Görüntüle

@@ -31,6 +31,7 @@
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding TopDeviceCurrentStatuses}"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
@@ -46,7 +47,7 @@
<ListView.ItemTemplate>
<DataTemplate>
<Border Margin="5" Background="Transparent">
<Grid Height="270" Background="Transparent">
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
@@ -130,7 +131,7 @@
Text="到位检测" />
</StackPanel>

<StackPanel Grid.Column="1">
<StackPanel Name="skp" Grid.Column="1">
<ToggleButton
Width="80"
Height="30"
@@ -138,8 +139,10 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
Command="{Binding DataContext.RecipeControlCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding}"
FontSize="20"
IsChecked="{Binding IsLayOff}"
IsChecked="{Binding BaitingControl}"
Style="{StaticResource SwitchToggleButtonStyle}" />
<TextBlock
Margin="0,5,0,0"
@@ -157,7 +160,7 @@
Stretch="Fill"
Visibility="{Binding IsOpen, Converter={StaticResource BoolToVisibilityConvert}}" />

<Image Source="/BPASmartClient.CustomResource;component/Image/荧光/29.png" Visibility="{Binding IsLayOff, Converter={StaticResource BoolToVisibilityConvert}}" />
<Image Source="/BPASmartClient.CustomResource;component/Image/荧光/29.png" Visibility="{Binding BaitingControl, Converter={StaticResource BoolToVisibilityConvert}}" />

<Image
Grid.RowSpan="2"
@@ -183,7 +186,7 @@
CaretBrush="#009dff"
FontSize="20"
Foreground="#009dff"
Text="{Binding Weight}" />
Text="{Binding SetWeight}" />

</Grid>
</Grid>
@@ -426,7 +429,7 @@
VerticalAlignment="Center"
Background="Transparent"
FontSize="20"
IsChecked="{Binding IsLayOff}"
IsChecked="{Binding BaitingControl}"
Style="{StaticResource SwitchToggleButtonStyle}" />
<TextBlock
Margin="0,5,0,0"
@@ -444,7 +447,7 @@
Stretch="Fill"
Visibility="{Binding IsOpen, Converter={StaticResource BoolToVisibilityConvert}}" />

<Image Source="/BPASmartClient.CustomResource;component/Image/荧光/29.png" Visibility="{Binding IsLayOff, Converter={StaticResource BoolToVisibilityConvert}}" />
<Image Source="/BPASmartClient.CustomResource;component/Image/荧光/29.png" Visibility="{Binding BaitingControl, Converter={StaticResource BoolToVisibilityConvert}}" />

<Image
Grid.RowSpan="2"
@@ -470,7 +473,7 @@
CaretBrush="#009dff"
FontSize="20"
Foreground="#009dff"
Text="{Binding Weight}" />
Text="{Binding SetWeight}" />

</Grid>
</Grid>


+ 1
- 0
DosingSystem/View/NewRecipeView.xaml Dosyayı Görüntüle

@@ -223,6 +223,7 @@
IsEditable="False"
ItemsSource="{Binding DataContext.RawMaterialNames, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
SelectedIndex="{Binding SelectIndex}"
SelectionChanged="cb_SelectionChanged"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding RawMaterialName}" />



+ 5
- 0
DosingSystem/View/NewRecipeView.xaml.cs Dosyayı Görüntüle

@@ -28,5 +28,10 @@ namespace BPASmartClient.DosingSystem.View
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView", true);
this.Unloaded += (o, s) => { Json<LocaPar>.Save(); };
}

private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ActionManage.GetInstance.SendAsync("原料选择修改", (sender as ComboBox).SelectedValue);
}
}
}

+ 44
- 0
DosingSystem/ViewModel/HardwareStatusViewModel.cs Dosyayı Görüntüle

@@ -54,11 +54,53 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
}
}
StatusUpdate(TopDeviceCurrentStatuses);
StatusUpdate(BottomDeviceCurrentStatuses);
OnDetection = GlobalDevice.PlcData.OnDetection;
UnderDetection = GlobalDevice.PlcData.UnderDetection;
ConveyerBeltStatus = GlobalDevice.MotorControlFeedback > 0;
Thread.Sleep(100);
}), "输送带料仓状态监控");

RecipeControlCommand = new RelayCommand<object>((o) =>
{
if (o != null && o is DeviceCurrentStatus currentStatus)
{
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == currentStatus.DeviceName);
if (res != null)
{
DeviceInquire.GetInstance.GetDevice(res.IpAddress).Start(currentStatus.SetWeight);
}
}
});
}

private void StatusUpdate(ObservableCollection<DeviceCurrentStatus> devices)
{
if (devices == null) return;
for (int i = 0; i < devices.Count; i++)
{
if (devices.ElementAt(i).BaitingControl)
{
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == devices.ElementAt(i).DeviceName);
if (res != null)
{
var runStatus = DeviceInquire.GetInstance.GetDevice(res.IpAddress).deviceStatus.RunStatus;
if (runStatus == 3)
{
if (TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == devices.ElementAt(i).DeviceName) != null)
{
TopDeviceCurrentStatuses.ElementAt(i).BaitingControl = false;
}
else if (BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == devices.ElementAt(i).DeviceName) != null)
{
BottomDeviceCurrentStatuses.ElementAt(i).BaitingControl = false;
}
DeviceInquire.GetInstance.GetDevice(res.IpAddress).StatusReset();
}
}
}
}
}

public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; }
@@ -69,6 +111,8 @@ namespace BPASmartClient.DosingSystem.ViewModel

public RelayCommand<object> ConveyerBeltControlCommand { get; set; }

public RelayCommand<object> RecipeControlCommand { get; set; }

/// <summary>
/// 输送带状态
/// </summary>


+ 28
- 5
DosingSystem/ViewModel/NewRecipeViewModel.cs Dosyayı Görüntüle

@@ -5,8 +5,6 @@ using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using System.Collections.ObjectModel;

using BPA.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Model;
using BPASmartClient.CustomResource.UserControls.MessageShow;
@@ -18,6 +16,16 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public NewRecipeViewModel()
{
ActionManage.GetInstance.RegisterAsync(new Action<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
if (RawMaterials.FirstOrDefault(p => p.RawMaterialName == o.ToString()) != null)
{
App.Current.Dispatcher.Invoke(() => { MessageNotify.GetInstance.ShowDialog("单前原料和其它原料重复,请重新选择!", DialogType.Warning); });
}
}
}), "原料选择修改");
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is RecipeModel rm)
@@ -35,13 +43,20 @@ namespace BPASmartClient.DosingSystem.ViewModel

AddCommand = new RelayCommand(() =>
{
if (RawMaterials.Count >= DeviceInquire.GetInstance.devices.Count)
{
MessageNotify.GetInstance.ShowDialog("原材料不足!");
return;
}
p:
string guid = Guid.NewGuid().ToString();
if (RawMaterials.FirstOrDefault(p => p.RawMaterialId == guid) == null)
{
int index = RawMaterials.Count;//<= 0 ? 0 : RawMaterials.Count - 1;
RawMaterials.Add(new RawMaterialModel()
{
RawMaterialId = guid
RawMaterialId = guid,
SelectIndex = index
});
}
else goto p;
@@ -58,7 +73,14 @@ namespace BPASmartClient.DosingSystem.ViewModel

SaveCommand = new RelayCommand(() =>
{
if (string.IsNullOrEmpty(RecipeName)) { ErrorInfo = "请输入配方名称"; return; }
if (string.IsNullOrEmpty(RecipeName)) { MessageNotify.GetInstance.ShowDialog("请输入配方名称!", DialogType.Warning); ErrorInfo = "请输入配方名称"; return; }

var tempRes = RawMaterials.GroupBy(p => p.RawMaterialName);
if (tempRes.Count() != RawMaterials.Count)
{
MessageNotify.GetInstance.ShowDialog("单前原料和其它原料重复,请重新选择!", DialogType.Warning);
return;
}

//编辑配方
if (Index >= 0 && Index < Json<LocaPar>.Data.Recipes.Count)
@@ -67,6 +89,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (res >= 0 && res != Index)
{
ErrorInfo = "配方名称已经存在!";
MessageNotify.GetInstance.ShowDialog("配方名称已经存在!", DialogType.Warning);
return;
}
Json<LocaPar>.Data.Recipes.ElementAt(Index).RecipeName = RecipeName;
@@ -93,6 +116,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName) != null)
{
ErrorInfo = "配方名称已存在!";
MessageNotify.GetInstance.ShowDialog("配方名称已经存在!", DialogType.Warning);
return;
}

@@ -168,7 +192,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
}



private string RecipCode = string.Empty;

public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }


Yükleniyor…
İptal
Kaydet