首次提交:添加src文件夹代码
This commit is contained in:
@@ -0,0 +1,189 @@
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Regions;
|
||||
using System.Collections.ObjectModel;
|
||||
using Unity;
|
||||
using Cowain.Bake.BLL;
|
||||
using Prism.Commands;
|
||||
using JSON = Newtonsoft.Json.JsonConvert;
|
||||
using System;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using HandyControl.Controls;
|
||||
using System.Windows;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.UI.FactoryMaintenance.ViewModels
|
||||
{
|
||||
public class DeviceManagementViewModel : ViewModelBase, INavigationAware
|
||||
{
|
||||
private bool _autoRefresh;
|
||||
public bool AutoRefresh
|
||||
{
|
||||
get { return _autoRefresh; }
|
||||
set { SetProperty(ref _autoRefresh, value); }
|
||||
}
|
||||
|
||||
private TDeviceConfig _editDevice;
|
||||
public TDeviceConfig EditDevice
|
||||
{
|
||||
get => _editDevice ?? (_editDevice = new TDeviceConfig());
|
||||
set
|
||||
{
|
||||
SetProperty(ref _editDevice, value);
|
||||
}
|
||||
}
|
||||
|
||||
private TDeviceConfig selectDevice;
|
||||
public TDeviceConfig SelectDevice
|
||||
{
|
||||
get => selectDevice ?? (selectDevice = new TDeviceConfig());
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectDevice, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ObservableCollection<TDeviceConfig> _deviceList;
|
||||
public ObservableCollection<TDeviceConfig> DeviceList
|
||||
{
|
||||
//get { return _taskList; }
|
||||
get => _deviceList ?? (_deviceList = new ObservableCollection<TDeviceConfig>());
|
||||
set { SetProperty(ref _deviceList, value); }
|
||||
}
|
||||
public DeviceManagementViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
AutoRefresh = true;
|
||||
this.PageTitle = "设备管理";
|
||||
_unityContainer = unityContainer;
|
||||
Task.Run(() => AsyncRefreshTask());
|
||||
}
|
||||
|
||||
public DelegateCommand SelectCommand => new DelegateCommand(() =>
|
||||
{
|
||||
if (SelectDevice != null && SelectDevice.Id > 0)
|
||||
{
|
||||
var json = PrettifyJson(SelectDevice.Json);
|
||||
if (json.Item1)
|
||||
{
|
||||
SelectDevice.Json = json.Item2;
|
||||
//深拷贝
|
||||
EditDevice = JSON.DeserializeObject<TDeviceConfig>(JSON.SerializeObject(SelectDevice));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public DelegateCommand VerifyCommand => new DelegateCommand(() =>
|
||||
{
|
||||
IsVerify(true);
|
||||
});
|
||||
|
||||
bool IsVerify(bool b = false)
|
||||
{
|
||||
if (PrettifyJson(EditDevice.Json).Item1)
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
Growl.Success("有效的JSON格式!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Growl.Error("不是有效的JSON格式, 请重新输入!");
|
||||
return false;
|
||||
}
|
||||
public DelegateCommand EditCommand => new DelegateCommand(() =>
|
||||
{
|
||||
if (!IsVerify())
|
||||
{
|
||||
return;
|
||||
}
|
||||
var result = HandyControl.Controls.MessageBox.Ask($@"是否确定要修改设备信息?", "操作提示");
|
||||
if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var res = _unityContainer.Resolve<DeviceConfigService>().Update(EditDevice);
|
||||
if (res > 0)
|
||||
{
|
||||
Growl.Success("设备信息修改完成!");
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Error("设备信息修改失败!");
|
||||
}
|
||||
|
||||
if (!EditDevice.Enable)
|
||||
{
|
||||
CommonCoreHelper.Instance.BlockStatusColor.Add(EditDevice); //刷新主界面的PLC状态
|
||||
}
|
||||
});
|
||||
|
||||
public async void AsyncRefreshTask()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
if (AutoRefresh)
|
||||
{
|
||||
Application.Current?.Dispatcher?.Invoke(new Action(() =>
|
||||
{
|
||||
Refresh();
|
||||
}));
|
||||
}
|
||||
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
}
|
||||
|
||||
private (bool, string) PrettifyJson(string raw)
|
||||
{
|
||||
(bool, string) result = (true, "");
|
||||
try
|
||||
{
|
||||
|
||||
result.Item2 = Newtonsoft.Json.Linq.JToken.Parse(raw).ToString(Newtonsoft.Json.Formatting.Indented);
|
||||
// 如果已经是 JSON 字符串,先解析再序列化即可
|
||||
//var doc = System.Text.Json.JsonDocument.Parse(raw);
|
||||
//return System.Text.Json.JsonSerializer.Serialize(doc.RootElement,
|
||||
// new System.Text.Json.JsonSerializerOptions
|
||||
// {
|
||||
// WriteIndented = true
|
||||
// });
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
// 万一不是合法 JSON,直接原样返回
|
||||
LogHelper.Instance.GetCurrentClassWarn($"{raw},{ex.Message}");
|
||||
result.Item1 = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
DeviceList.Clear();
|
||||
var models = _unityContainer.Resolve<DeviceConfigService>().GetAll();
|
||||
models.ForEach(x => DeviceList.Add(x));
|
||||
}
|
||||
|
||||
|
||||
void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool INavigationAware.IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void INavigationAware.OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Unity;
|
||||
using JSON = Newtonsoft.Json.JsonConvert;
|
||||
|
||||
namespace Cowain.Bake.UI.FactoryMaintenance.ViewModels
|
||||
{
|
||||
public class MomOutboundViewModel : ViewModelBase
|
||||
{
|
||||
private string batteryCode;
|
||||
public string BatteryCode
|
||||
{
|
||||
get => batteryCode;
|
||||
set => SetProperty(ref batteryCode, value);
|
||||
}
|
||||
|
||||
private string sendData;
|
||||
public string SendData
|
||||
{
|
||||
get => sendData;
|
||||
set => SetProperty(ref sendData, value);
|
||||
}
|
||||
|
||||
private string recvData;
|
||||
public string RecvData
|
||||
{
|
||||
get => recvData;
|
||||
set => SetProperty(ref recvData, value);
|
||||
}
|
||||
|
||||
public MomOutboundViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "电芯出站信息";
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
public DelegateCommand<object> SendToMomCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
List<int> batterys = new List<int>();
|
||||
TBatteryInfo battery = _unityContainer.Resolve<BatteryInfoService>().GetBatteryInfos(BatteryCode);
|
||||
|
||||
if (null == battery)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Fatal("找不到此电芯,请重新输入电芯条码!");
|
||||
return;
|
||||
}
|
||||
|
||||
batterys.Add(battery.Id);
|
||||
//此时托盘可能已经转历史盘托了
|
||||
TPalletInfo palletInfo = _unityContainer.Resolve<BLL.PalletInfoService>().GetPalletInfoOrHistory(battery.Id);
|
||||
if (null == palletInfo)
|
||||
{
|
||||
LogHelper.Instance.Error($"找不到此电芯所属托盘!", true);
|
||||
return;
|
||||
}
|
||||
|
||||
RecvData = _unityContainer.Resolve<Common.Interface.ICommonFun>().ManualMesOutUnBinding(palletInfo, battery);
|
||||
});
|
||||
|
||||
//public DelegateCommand<object> SendToMomCommand => new DelegateCommand<object>((x) =>
|
||||
//{
|
||||
// if (string.IsNullOrEmpty(SendData))
|
||||
// {
|
||||
// HandyControl.Controls.MessageBox.Fatal("发送数据为空!");
|
||||
// return;
|
||||
// }
|
||||
// //var result =_unityContainer.Resolve<Common.Interface.ICommonFun>().SendData(SendData); //发送
|
||||
// //if (null == result)
|
||||
// //{
|
||||
// // RecvData = "接收数据超时!";
|
||||
// //}
|
||||
// //else
|
||||
// //{
|
||||
// // RecvData = JSON.SerializeObject(result);
|
||||
// //}
|
||||
//});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Communication.Interface;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System.Collections.ObjectModel;
|
||||
using Unity;
|
||||
|
||||
|
||||
namespace Cowain.Bake.UI.FactoryMaintenance.ViewModels
|
||||
{
|
||||
public class PLCVarMonitorViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
IDialogService _dialogService;
|
||||
public ObservableCollection<IPLCDevice> plcList;
|
||||
public PLCVarMonitorViewModel(IUnityContainer unityContainer, IRegionManager regionManager, IDialogService dialogService)
|
||||
: base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "标签监视";
|
||||
_dialogService = dialogService;
|
||||
}
|
||||
|
||||
|
||||
public ObservableCollection<IPLCDevice> PlcList
|
||||
{
|
||||
get => plcList ?? (plcList = new ObservableCollection<IPLCDevice>());
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
// 用户信息刷新
|
||||
PlcList.Clear();
|
||||
var pList = _unityContainer.ResolveAll<IPLCDevice>();
|
||||
foreach (var item in pList)
|
||||
{
|
||||
PlcList.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
//public DelegateCommand<Variable> SelectScriptCommand => new DelegateCommand<Variable>((x) =>
|
||||
//{
|
||||
// DialogParameters param = new DialogParameters();
|
||||
// param.Add("variable", x);
|
||||
// _dialogService.ShowDialog(
|
||||
// "ScriptSelectDialog",
|
||||
// param,
|
||||
// result =>
|
||||
// {
|
||||
// if (result.Result == ButtonResult.OK)
|
||||
// {
|
||||
// this.Refresh();
|
||||
// }
|
||||
// });
|
||||
|
||||
//});
|
||||
|
||||
//public DelegateCommand<Variable> DeleteScriptCommand => new DelegateCommand<Variable>((x) =>
|
||||
//{
|
||||
// var result = HandyControl.Controls.MessageBox.Ask($@"是否确定要删除脚本关联?", "操作提示");
|
||||
// if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// IPLCService service = _unityContainer.Resolve<IPLCService>();
|
||||
// int res = service.DelectScript(x);
|
||||
// if (res > 0)
|
||||
// {
|
||||
// Growl.Success("变量删除脚本关联成功!");
|
||||
// x.ScriptName = "";
|
||||
// x.ScriptId = 0;
|
||||
// this.Refresh();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Growl.Success("变量删除脚本关联失败,Id不存在!");
|
||||
// }
|
||||
|
||||
//});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
using Cowain.Bake.Model;
|
||||
using System.Collections.ObjectModel;
|
||||
using Cowain.Bake.BLL;
|
||||
using System.Text.RegularExpressions;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Commands;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Prism.Regions;
|
||||
using Cowain.Bake.Common.Interface;
|
||||
|
||||
namespace Cowain.Bake.UI.FactoryMaintenance.ViewModels
|
||||
{
|
||||
public class SysSetupViewModel : BindableBase, INavigationAware
|
||||
{
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
private bool isAllowed;
|
||||
public bool IsAllowed
|
||||
{
|
||||
get => isAllowed;
|
||||
set => SetProperty(ref isAllowed, value);
|
||||
}
|
||||
|
||||
private TSysSetup selectedItem;
|
||||
public TSysSetup SelectedItem
|
||||
{
|
||||
get => selectedItem;
|
||||
set => SetProperty(ref selectedItem, value);
|
||||
}
|
||||
public SysSetupViewModel(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
ShowInfo();
|
||||
isAllowed = unityContainer.Resolve<UserService>().CheckPermission(ERole.Mantainer);
|
||||
}
|
||||
public DelegateCommand<object> CellEditEndingCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
Regex regex = new Regex(selectedItem.CheckRegular);
|
||||
if (!regex.IsMatch(selectedItem.ParamValue))
|
||||
{
|
||||
string oldValue = _unityContainer.Resolve<SysSetupService>().GetValueByID(selectedItem.Id);
|
||||
LogHelper.Instance.Error(selectedItem.ParamName + "的值:" + selectedItem.ParamValue + ",不正确,已回滚!", true);
|
||||
var findSelect = ParamList.Where(item => item.Id == selectedItem.Id).FirstOrDefault();
|
||||
findSelect.ParamValue = oldValue;
|
||||
}
|
||||
});
|
||||
public ObservableCollection<TSysSetup> paraList = new ObservableCollection<TSysSetup>();
|
||||
public ObservableCollection<TSysSetup> ParamList
|
||||
{
|
||||
get => paraList;
|
||||
set => SetProperty(ref paraList, value);
|
||||
}
|
||||
public DelegateCommand<object> SaveCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
var sysSetupService = _unityContainer.Resolve<SysSetupService>();
|
||||
foreach (var item in ParamList)
|
||||
{
|
||||
Regex reg = new Regex(item.CheckRegular);
|
||||
if (reg.IsMatch(item.ParamValue))
|
||||
{
|
||||
sysSetupService.UpdateValue(item.Id , item.ParamValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Instance.Error(item.ParamName + "格式不正确,不保存。", true);
|
||||
}
|
||||
}
|
||||
ShowInfo();
|
||||
HandyControl.Controls.Growl.Success("保存成功");
|
||||
_unityContainer.Resolve<ICommonFun>().SetBatteryCodeLen();
|
||||
_unityContainer.Resolve<LogService>().AddLog($@"修改参数", E_LogType.Operate.ToString());
|
||||
});
|
||||
private void ShowInfo()
|
||||
{
|
||||
ParamList.Clear();
|
||||
var sysSetupService = _unityContainer.Resolve<SysSetupService>();
|
||||
sysSetupService.GetShowParam().ForEach(item => ParamList.Add(item));
|
||||
}
|
||||
|
||||
void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool INavigationAware.IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void INavigationAware.OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.FactoryMaintenance.Views.DeviceManagementView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.ProductManagement.Views"
|
||||
xmlns:core="clr-namespace:Cowain.Bake.Common.Core;assembly=Cowain.Bake.Common"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:common="clr-namespace:Cowain.Bake.Common;assembly=Cowain.Bake.Common"
|
||||
xmlns:models="clr-namespace:Cowain.Bake.Common.Models;assembly=Cowain.Bake.Common"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<convertor:BoolToColorConverter x:Key="BoolToColorConverter"/>
|
||||
<convertor:IntToDeviceTypeConvertor x:Key="IntToDeviceTypeConvertor"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="DeviceMgm"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" SelectedItem="{Binding SelectDevice}"
|
||||
IsReadOnly="True" HorizontalScrollBarVisibility="Auto"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding DeviceList}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding SelectCommand}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="66" Binding="{Binding Id}" Header="序号"/>
|
||||
<DataGridTextColumn MinWidth="80" Binding="{Binding Name}" Header="设备名称"/>
|
||||
<DataGridTextColumn MinWidth="80" Binding="{Binding Desc}" Header="设备描述"/>
|
||||
<DataGridTemplateColumn Header="状态">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Ellipse Width="16" Height="16"
|
||||
Fill="{Binding IsConnect, Converter={StaticResource BoolToColorConverter}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn MinWidth="80" Binding="{Binding Type, Converter={StaticResource IntToDeviceTypeConvertor}}" Header="设备类型"/>
|
||||
<DataGridCheckBoxColumn Width="60" Binding="{Binding Enable}" Header="启用" IsReadOnly="True"/>
|
||||
<DataGridTextColumn MinWidth="120" Binding="{Binding Json}" Header="备注"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Grid Grid.Column="1">
|
||||
<StackPanel HorizontalAlignment="Left" Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<TextBlock Text="自动刷新:" FontSize="14" Margin="2" Width="120" FontWeight="Bold" Height="30" Background="Transparent" Foreground="Green"/>
|
||||
<CheckBox HorizontalContentAlignment="Center" Margin="2" FontSize="14"
|
||||
Width="130" Height="30" IsChecked ="{Binding AutoRefresh}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<TextBlock Text="设备描述:" FontSize="14" Margin="2" Width="120" Height="30" Background="Transparent"/>
|
||||
<hc:TextBox Margin="4" Text="{Binding EditDevice.Desc}" Width="254"
|
||||
VerticalScrollBarVisibility="Visible" AcceptsReturn="True"
|
||||
HorizontalAlignment="Left" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<TextBlock Text="是否启用:" FontSize="14" Margin="2" Width="120" Height="30" Background="Transparent"/>
|
||||
<CheckBox HorizontalContentAlignment="Center" Margin="2" FontSize="14" Width="130" Height="30" IsChecked ="{Binding EditDevice.Enable}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="2">
|
||||
<TextBlock Text="备注(Json格式):" HorizontalAlignment="Left" FontSize="14" Margin="4" Height="30" FontWeight="Bold" Background="Transparent"/>
|
||||
<TextBox Margin="4" Text="{Binding EditDevice.Json}" Height="300"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
AcceptsReturn="True"
|
||||
HorizontalAlignment="Stretch"
|
||||
FontFamily="Consolas"
|
||||
TextWrapping="NoWrap"
|
||||
Padding="6"
|
||||
FontSize="16"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="2" HorizontalAlignment="Center">
|
||||
<Button Content="验证JOSN" Style="{StaticResource ButtonSuccess}" Margin="4" Width="100" Command="{Binding VerifyCommand}"/>
|
||||
<Button Content="修改" Style="{StaticResource ButtonWarning}" Margin="4" Width="100" Command="{Binding EditCommand}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Cowain.Bake.UI.FactoryMaintenance.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DeviceManagementView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DeviceManagementView : UserControl
|
||||
{
|
||||
public DeviceManagementView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Cowain.Bake.UI/FactoryMaintenance/Views/MomOutboundView.xaml
Normal file
29
Cowain.Bake.UI/FactoryMaintenance/Views/MomOutboundView.xaml
Normal file
@@ -0,0 +1,29 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.FactoryMaintenance.Views.MomOutboundView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.FactoryMaintenance.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="360" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="12,10,10,10" HorizontalAlignment="Left" >
|
||||
<TextBlock VerticalAlignment="Center" Margin="4">电芯条码:</TextBlock>
|
||||
<TextBox Text="{Binding BatteryCode,Mode=TwoWay}" Margin="5" Width="320"/>
|
||||
<Button Content="发送出站信息" Style="{StaticResource ButtonSuccess}" Margin="20,0,0,0" Width="100" Command="{Binding SendToMomCommand}"/>
|
||||
<!--<Button Content="发送" Style="{StaticResource ButtonPrimary}" Margin="20,0,0,0" Width="60" Command="{Binding SendToMomCommand}"/>-->
|
||||
</StackPanel>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1" Grid.Row="1" Grid.RowSpan="4"/>
|
||||
<!--<TextBlock VerticalAlignment="Center" Grid.Row="1" Margin="12,0,0,0">发送信息:</TextBlock>
|
||||
<TextBox Text="{Binding SendData,Mode=TwoWay}" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Margin="10,0,10,0" Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>-->
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="1" Margin="12,0,0,0">收到信息:</TextBlock>
|
||||
<TextBox Text="{Binding RecvData,Mode=TwoWay}" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Margin="10,0,10,0" Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Cowain.Bake.UI.FactoryMaintenance.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// MomOutboundView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MomOutboundView : UserControl
|
||||
{
|
||||
public MomOutboundView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.FactoryMaintenance.Views.PLCVarMonitorView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.FactoryMaintenance.Views"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:cm="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:vc="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
x:Name="uc"
|
||||
d:DesignHeight="450" d:DesignWidth="1000"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True" >
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<cm:ScaleConverter x:Key="ScaleConverter"/>
|
||||
<vc:VarValueConverter x:Key="varConverter"/>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Cowain.Bake.Common;component/Styles/BaseResources.xaml"/>
|
||||
<ResourceDictionary Source="/Cowain.Bake.Common;component/Styles/ButtonStyles.xaml"/>
|
||||
<ResourceDictionary Source="/Cowain.Bake.Common;component/Styles/TextBoxStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="4" Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Margin="2" x:Name="plcList" ItemsSource="{Binding PlcList}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Name}" />
|
||||
<TextBlock Text="->" FontSize="11" VerticalAlignment="Center" Margin="10,0"/>
|
||||
<TextBlock Text="{Binding DeviceName}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" DockPanel.Dock="Right"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="False"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding ElementName=plcList,Path=SelectedItem.VariableList}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="状态" Binding="{Binding Quality}" />
|
||||
<DataGridTextColumn Header="变量名" Binding="{Binding Address}"/>
|
||||
<DataGridTextColumn Header="地址" Binding="{Binding VarName}" />
|
||||
<DataGridTextColumn Header="类型" Binding="{Binding VarType}" />
|
||||
<DataGridTextColumn Header="描述" Binding="{Binding VarDesc}" />
|
||||
<DataGridTextColumn Header="长度" Binding="{Binding ArrayLength}" />
|
||||
<DataGridTextColumn Header="值" Binding="{Binding Value}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<Border Grid.Row="1" Background="#EEE"/>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<TextBlock Text="连接状态:" VerticalAlignment="Center" Foreground="#FF4B4B4B" Margin="10,2,2,2"/>
|
||||
<TextBlock Text="{Binding ElementName=plcList,Path=SelectedItem.IsConnect}" Foreground="#FF4B4B4B" VerticalAlignment="Center" Margin="10,2,2,2"/>
|
||||
<TextBlock Text="读时间:" VerticalAlignment="Center" Foreground="#FF4B4B4B" Margin="10,2,2,2"/>
|
||||
<TextBlock Text="{Binding ElementName=plcList,Path=SelectedItem.ReadUseTime}" Foreground="#FF4B4B4B" VerticalAlignment="Center" Margin="10,2,2,2"/>
|
||||
<TextBlock Text="ms" VerticalAlignment="Center" Foreground="#FF4B4B4B" Margin="10,2,2,2"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Cowain.Bake.UI.FactoryMaintenance.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// PLCVarMonitor.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PLCVarMonitorView : UserControl
|
||||
{
|
||||
public PLCVarMonitorView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
Cowain.Bake.UI/FactoryMaintenance/Views/SysSetupView.xaml
Normal file
28
Cowain.Bake.UI/FactoryMaintenance/Views/SysSetupView.xaml
Normal file
@@ -0,0 +1,28 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.FactoryMaintenance.Views.SysSetupView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.FactoryMaintenance.Views"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Button Content="保存" Style="{StaticResource ButtonInfo}" Command="{Binding SaveCommand}" HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" VerticalAlignment="Top" Width="115" IsEnabled="{Binding IsAllowed}"/>
|
||||
<DataGrid HorizontalAlignment="Left" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" AutoGenerateColumns="False" ItemsSource="{Binding ParamList}" Margin="10,55,0,0" VerticalAlignment="Top" Width="780">
|
||||
<i:Interaction.Triggers >
|
||||
<i:EventTrigger EventName="CellEditEnding">
|
||||
<i:InvokeCommandAction Command="{Binding CellEditEndingCommand}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="序号" Width="100" Binding="{Binding Id}" Visibility="Hidden"/>
|
||||
<DataGridTextColumn Header="参数名称" IsReadOnly="True" Width="120" Binding="{Binding ParamCode}" Visibility="Hidden"/>
|
||||
<DataGridTextColumn Header="参数描述" IsReadOnly="False" Width="350" Binding="{Binding ParamName}" />
|
||||
<!--以下行,没有UpdateSourceTrigger=PropertyChanged就不行-->
|
||||
<DataGridTextColumn Header="参数值" Width="150" Binding="{Binding ParamValue,UpdateSourceTrigger=PropertyChanged}" />
|
||||
<DataGridTextColumn Header="校验规则" Width="150" Binding="{Binding CheckRegular}" Visibility="Hidden"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
32
Cowain.Bake.UI/FactoryMaintenance/Views/SysSetupView.xaml.cs
Normal file
32
Cowain.Bake.UI/FactoryMaintenance/Views/SysSetupView.xaml.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.FactoryMaintenance.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// SysSetup.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SysSetupView : UserControl
|
||||
{
|
||||
//ViewModels.SysSetupViewModel SysSetupViewModel;
|
||||
public SysSetupView()
|
||||
{
|
||||
InitializeComponent();
|
||||
//SysSetupViewModel = new ViewModels.SysSetupViewModel(unityContainer);
|
||||
//this.DataContext = SysSetupViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user