首次提交:添加src文件夹代码
This commit is contained in:
20
Cowain.Bake.UI/CommonView/Views/ProgressBarView.xaml
Normal file
20
Cowain.Bake.UI/CommonView/Views/ProgressBarView.xaml
Normal file
@@ -0,0 +1,20 @@
|
||||
<Window x:Class="Cowain.Bake.UI.CommonView.Views.ProgressBarView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
mc:Ignorable="d"
|
||||
Height="200" Width="380" WindowStartupLocation="CenterScreen" Title="加载中..."
|
||||
>
|
||||
<hc:TransitioningContentControl>
|
||||
<hc:LoadingLine Margin="0,30" Foreground="BlueViolet" Style="{StaticResource LoadingLineLarge}"/>
|
||||
<!--<StackPanel Margin="132" >
|
||||
<Slider Value="50" Name="SliderDemo" Maximum="16"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,32,0,0">
|
||||
<hc:CircleProgressBar IsIndeterminate="True" Height="200" Width="200" Margin="160,0,0,0"/>
|
||||
</StackPanel>
|
||||
</StackPanel>-->
|
||||
</hc:TransitioningContentControl>
|
||||
</Window>
|
||||
15
Cowain.Bake.UI/CommonView/Views/ProgressBarView.xaml.cs
Normal file
15
Cowain.Bake.UI/CommonView/Views/ProgressBarView.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Cowain.Bake.UI.CommonView.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ProgressBarView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ProgressBarView : Window
|
||||
{
|
||||
public ProgressBarView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
425
Cowain.Bake.UI/Cowain.Bake.UI.csproj
Normal file
425
Cowain.Bake.UI/Cowain.Bake.UI.csproj
Normal file
@@ -0,0 +1,425 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{09EF460A-9D14-4090-B0D5-CA43E4B72A66}</ProjectGuid>
|
||||
<OutputType>library</OutputType>
|
||||
<RootNamespace>Cowain.Bake.UI</RootNamespace>
|
||||
<AssemblyName>Cowain.Bake.UI</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cowain.Bake.BLL">
|
||||
<HintPath>..\Cowain.Bake.BLL\bin\Debug\Cowain.Bake.BLL.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cowain.Bake.Common">
|
||||
<HintPath>..\Cowain.Bake.Common\bin\Debug\Cowain.Bake.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cowain.Bake.Communication">
|
||||
<HintPath>..\Cowain.Bake.Communication\bin\Debug\Cowain.Bake.Communication.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cowain.Bake.Model">
|
||||
<HintPath>..\Cowain.Bake.Model\bin\Debug\Cowain.Bake.Model.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CsvHelper, Version=31.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Libs\CsvHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HandyControl, Version=3.5.1.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\HandyControl.3.5.1\lib\net472\HandyControl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HslCommunication, Version=11.6.4.0, Culture=neutral, PublicKeyToken=3d72ad3b6b5ec0e3" />
|
||||
<Reference Include="LiveCharts">
|
||||
<HintPath>..\Libs\LiveCharts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="LiveCharts.Wpf">
|
||||
<HintPath>..\Libs\LiveCharts.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Libs\Microsoft.Bcl.HashCode.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.31\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism">
|
||||
<HintPath>..\Libs\Prism.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Unity.Wpf">
|
||||
<HintPath>..\Libs\Prism.Unity.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Prism.Wpf">
|
||||
<HintPath>..\Libs\Prism.Wpf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Spire.Doc, Version=13.8.1.0, Culture=neutral, PublicKeyToken=663f351905198cb3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Spire.Doc.13.8.1\lib\net40\Spire.Doc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.7.0.2\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity">
|
||||
<HintPath>..\Libs\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="Unity.Abstractions, Version=5.11.7.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Unity.Abstractions.5.11.7\lib\net47\Unity.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.Container, Version=5.11.11.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Unity.Container.5.11.11\lib\net47\Unity.Container.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CommonView\Views\ProgressBarView.xaml.cs">
|
||||
<DependentUpon>ProgressBarView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CsvMap\BatteryInfoDetailMap.cs" />
|
||||
<Compile Include="CsvMap\BatteryInfoMap.cs" />
|
||||
<Compile Include="CsvMap\FailBatteryMap.cs" />
|
||||
<Compile Include="CsvMap\MesDataMap.cs" />
|
||||
<Compile Include="CsvMap\PalletInfoMap.cs" />
|
||||
<Compile Include="CsvMap\TypeConverter.cs" />
|
||||
<Compile Include="DataQuery\ViewModels\BatteryInfoViewModel.cs" />
|
||||
<Compile Include="DataQuery\ViewModels\CurveViewModel.cs" />
|
||||
<Compile Include="DataQuery\ViewModels\DummyInfoViewModel.cs" />
|
||||
<Compile Include="DataQuery\ViewModels\GetMesLogViewModel.cs" />
|
||||
<Compile Include="DataQuery\ViewModels\IncomingCellInfoViewModel.cs" />
|
||||
<Compile Include="DataQuery\ViewModels\NGCellInfoViewModel.cs" />
|
||||
<Compile Include="DataQuery\ViewModels\PalletInfoViewModel.cs" />
|
||||
<Compile Include="DataQuery\ViewModels\ProductionsInfoViewModel.cs" />
|
||||
<Compile Include="DataQuery\Views\BatteryInfoView.xaml.cs">
|
||||
<DependentUpon>BatteryInfoView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataQuery\Views\CurveView.xaml.cs">
|
||||
<DependentUpon>CurveView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataQuery\Views\DummyInfoView.xaml.cs">
|
||||
<DependentUpon>DummyInfoView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataQuery\Views\GetMesLogView.xaml.cs">
|
||||
<DependentUpon>GetMesLogView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataQuery\Views\IncomingCellInfoView.xaml.cs">
|
||||
<DependentUpon>IncomingCellInfoView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataQuery\Views\NGCellInfoView.xaml.cs">
|
||||
<DependentUpon>NGCellInfoView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataQuery\Views\PalletInfoView.xaml.cs">
|
||||
<DependentUpon>PalletInfoView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataQuery\Views\ProductionsInfoView.xaml.cs">
|
||||
<DependentUpon>ProductionsInfoView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FactoryMaintenance\ViewModels\DeviceManagementViewModel.cs" />
|
||||
<Compile Include="FactoryMaintenance\ViewModels\MomOutboundViewModel.cs" />
|
||||
<Compile Include="FactoryMaintenance\ViewModels\PLCVarMonitorViewModel.cs" />
|
||||
<Compile Include="FactoryMaintenance\ViewModels\SysSetupViewModel.cs" />
|
||||
<Compile Include="FactoryMaintenance\Views\DeviceManagementView.xaml.cs">
|
||||
<DependentUpon>DeviceManagementView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FactoryMaintenance\Views\MomOutboundView.xaml.cs">
|
||||
<DependentUpon>MomOutboundView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FactoryMaintenance\Views\PLCVarMonitorView.xaml.cs">
|
||||
<DependentUpon>PLCVarMonitorView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FactoryMaintenance\Views\SysSetupView.xaml.cs">
|
||||
<DependentUpon>SysSetupView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helper\ViewModels\AboutWindowViewModel.cs" />
|
||||
<Compile Include="Helper\ViewModels\HelpWindowViewModel.cs" />
|
||||
<Compile Include="Helper\Views\AboutWindowView.xaml.cs">
|
||||
<DependentUpon>AboutWindowView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helper\Views\HelpWindowView.xaml.cs">
|
||||
<DependentUpon>HelpWindowView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Home\ViewModels\LoginViewModel.cs" />
|
||||
<Compile Include="Home\ViewModels\ModifyPassWordViewModel.cs" />
|
||||
<Compile Include="Home\ViewModels\ProcessParametersViewModel.cs" />
|
||||
<Compile Include="Home\ViewModels\SetScannerViewModel.cs" />
|
||||
<Compile Include="Home\Views\LoginView.xaml.cs">
|
||||
<DependentUpon>LoginView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Home\Views\ModifyPassWordView.xaml.cs">
|
||||
<DependentUpon>ModifyPassWordView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Home\ViewModels\WorkOrderViewModel.cs" />
|
||||
<Compile Include="Home\Views\ProcessParametersView.xaml.cs">
|
||||
<DependentUpon>ProcessParametersView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Home\Views\SetScannerView.xaml.cs">
|
||||
<DependentUpon>SetScannerView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Home\Views\WorkOrderView.xaml.cs">
|
||||
<DependentUpon>WorkOrderView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Home\ViewModels\DataInfo.cs" />
|
||||
<Compile Include="ProductManagement\ViewModels\DBLogViewModel.cs" />
|
||||
<Compile Include="ProductManagement\ViewModels\DisableStoveViewModel.cs" />
|
||||
<Compile Include="ProductManagement\ViewModels\EleTableViewModel.cs" />
|
||||
<Compile Include="ProductManagement\ViewModels\TaskMaintainViewModel.cs" />
|
||||
<Compile Include="ProductManagement\ViewModels\TaskViewModel.cs" />
|
||||
<Compile Include="ProductManagement\Views\DBLogView.xaml.cs">
|
||||
<DependentUpon>DBLogView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProductManagement\Views\DisableStove.xaml.cs">
|
||||
<DependentUpon>DisableStove.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProductManagement\Views\EleTableView.xaml.cs">
|
||||
<DependentUpon>EleTableView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProductManagement\Views\TaskMaintainView.xaml.cs">
|
||||
<DependentUpon>TaskMaintainView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProductManagement\Views\TaskView.xaml.cs">
|
||||
<DependentUpon>TaskView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TaskModule.cs" />
|
||||
<Compile Include="UserManagerment\ViewModels\AuthorityManagementViewModel.cs" />
|
||||
<Compile Include="UserManagerment\ViewModels\DeviceModeViewModel.cs" />
|
||||
<Compile Include="UserManagerment\ViewModels\UserManagermentViewModel.cs" />
|
||||
<Compile Include="UserManagerment\Views\AuthorityManagementView.xaml.cs">
|
||||
<DependentUpon>AuthorityManagementView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserManagerment\Views\DeviceModeView.xaml.cs">
|
||||
<DependentUpon>DeviceModeView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserManagerment\Views\UserManagermentView.xaml.cs">
|
||||
<DependentUpon>UserManagermentView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="CommonView\Views\ProgressBarView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="DataQuery\Views\BatteryInfoView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="DataQuery\Views\CurveView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="DataQuery\Views\DummyInfoView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="DataQuery\Views\GetMesLogView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="DataQuery\Views\IncomingCellInfoView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="DataQuery\Views\NGCellInfoView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="DataQuery\Views\PalletInfoView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="DataQuery\Views\ProductionsInfoView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="FactoryMaintenance\Views\DeviceManagementView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="FactoryMaintenance\Views\MomOutboundView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="FactoryMaintenance\Views\PLCVarMonitorView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="FactoryMaintenance\Views\SysSetupView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Helper\Views\AboutWindowView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Helper\Views\HelpWindowView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Home\Views\LoginView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Home\Views\ModifyPassWordView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Home\Views\ProcessParametersView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Home\Views\SetScannerView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Home\Views\WorkOrderView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="ProductManagement\Views\DBLogView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="ProductManagement\Views\DisableStove.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="ProductManagement\Views\EleTableView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="ProductManagement\Views\TaskMaintainView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="ProductManagement\Views\TaskView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="UserManagerment\Views\AuthorityManagementView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="UserManagerment\Views\DeviceModeView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="UserManagerment\Views\UserManagermentView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="Office">
|
||||
<Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
|
||||
<VersionMajor>99</VersionMajor>
|
||||
<VersionMinor>1</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="stdole">
|
||||
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="CommonView\ViewModels\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
6
Cowain.Bake.UI/Cowain.Bake.UI.csproj.user
Normal file
6
Cowain.Bake.UI/Cowain.Bake.UI.csproj.user
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
66
Cowain.Bake.UI/CsvMap/BatteryInfoDetailMap.cs
Normal file
66
Cowain.Bake.UI/CsvMap/BatteryInfoDetailMap.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using CsvHelper.Configuration;
|
||||
|
||||
namespace Cowain.Bake.UI.CsvMap
|
||||
{
|
||||
// 5. 创建自定义ClassMap
|
||||
//public sealed class BatteryInfoMap : ClassMap<TBatteryInfo>
|
||||
public sealed class BatteryInfoDetailMap : ClassMap<BatteryInfoEntity>
|
||||
{
|
||||
public BatteryInfoDetailMap()
|
||||
{
|
||||
Map(m => m.Id).Name("电池序号");
|
||||
Map(m => m.PalletCode).Name("夹具条码");
|
||||
|
||||
// 应用枚举描述转换器
|
||||
Map(m => m.BatteryStatus)
|
||||
.Name("状态")
|
||||
.TypeConverter<BatteryStatusMapConverter>();
|
||||
|
||||
Map(m => m.ScanTime)
|
||||
.Name("扫码时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BatteryCode).Name("电池条码");
|
||||
Map(m => m.PositionX).Name("行号");
|
||||
Map(m => m.PositionY).Name("列号");
|
||||
|
||||
Map(m => m.BindingTime)
|
||||
.Name("绑定时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BindingTime)
|
||||
.Name("解绑时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingPosition).Name("所属烤箱")
|
||||
.TypeConverter<CavityInfoIdMapConverter>();
|
||||
|
||||
Map(m => m.LoadingBegingTime)
|
||||
.Name("上料开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.LoadingOverTime)
|
||||
.Name("上料结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingBeginTime)
|
||||
.Name("烘烤开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingOverTime)
|
||||
.Name("烘烤结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.UnLoadingBegingTime)
|
||||
.Name("下料开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.UnLoadingOverTime)
|
||||
.Name("下料结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.WaterValue).Name("水含量结果");
|
||||
}
|
||||
}
|
||||
}
|
||||
44
Cowain.Bake.UI/CsvMap/BatteryInfoMap.cs
Normal file
44
Cowain.Bake.UI/CsvMap/BatteryInfoMap.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using Cowain.Bake.Model;
|
||||
using CsvHelper.Configuration;
|
||||
|
||||
|
||||
namespace Cowain.Bake.UI.CsvMap
|
||||
{
|
||||
// 4. 创建CsvHelper自定义转换器
|
||||
|
||||
|
||||
// 5. 创建自定义ClassMap
|
||||
//public sealed class BatteryInfoMap : ClassMap<TBatteryInfo>
|
||||
public sealed class BatteryInfoMap : ClassMap<TBatteryInfo>
|
||||
{
|
||||
public BatteryInfoMap()
|
||||
{
|
||||
Map(m => m.Id).Name("电池序号");
|
||||
Map(m => m.PalletVirtualId).Name("夹具条码")
|
||||
.TypeConverter<PalletVirtualIdMapConverter>();
|
||||
// 应用枚举描述转换器
|
||||
Map(m => m.BatteryStatus)
|
||||
.Name("状态")
|
||||
.TypeConverter<BatteryStatusMapConverter>();
|
||||
|
||||
Map(m => m.ScanTime)
|
||||
.Name("扫码时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BatteryCode).Name("条码");
|
||||
Map(m => m.PositionX).Name("行号");
|
||||
Map(m => m.PositionY).Name("列号");
|
||||
|
||||
Map(m => m.BindingTime)
|
||||
.Name("绑定时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BindingTime)
|
||||
.Name("解绑时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
Map(m => m.DummyFlag).Name("假电芯");
|
||||
Map(m => m.Remarks).Name("备注");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Cowain.Bake.UI/CsvMap/FailBatteryMap.cs
Normal file
26
Cowain.Bake.UI/CsvMap/FailBatteryMap.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Cowain.Bake.Model;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using CsvHelper.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.Common.CsvMap
|
||||
{
|
||||
public sealed class FailBatteryMap : ClassMap<TBatteryNG>
|
||||
{
|
||||
public FailBatteryMap()
|
||||
{
|
||||
Map(m => m.Id).Name("序号");
|
||||
Map(m => m.PalletCode).Name("夹具条码");
|
||||
Map(m => m.BatteryCode).Name("电芯条码");
|
||||
Map(m => m.CreateTime)
|
||||
.Name("创建时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
Map(m => m.Desc).Name("描述");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
32
Cowain.Bake.UI/CsvMap/MesDataMap.cs
Normal file
32
Cowain.Bake.UI/CsvMap/MesDataMap.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Cowain.Bake.Common.Converter;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Cowain.Bake.UI.CsvMap;
|
||||
using CsvHelper;
|
||||
using CsvHelper.Configuration;
|
||||
using CsvHelper.TypeConversion;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.Common.CsvMap
|
||||
{
|
||||
|
||||
public sealed class MesDataMap : ClassMap<MesDataEntity>
|
||||
{
|
||||
public MesDataMap()
|
||||
{
|
||||
Map(m => m.CreateTime).Name("创建时间").TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss"); ;
|
||||
Map(m => m.SendTime).Name("发送时间").TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss"); ;
|
||||
Map(m => m.RecvTime).Name("接收时间").TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss"); ;
|
||||
Map(m => m.Content).Name("发送信息");
|
||||
Map(m => m.RecvContent).Name("接收信息");
|
||||
Map(m => m.BatteryCode).Name("电芯条码");
|
||||
Map(m => m.SendFlag)
|
||||
.Name("发送状态")
|
||||
.TypeConverter<MesDataMapConverter>();
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Cowain.Bake.UI/CsvMap/PalletInfoMap.cs
Normal file
65
Cowain.Bake.UI/CsvMap/PalletInfoMap.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Cowain.Bake.Model;
|
||||
using CsvHelper;
|
||||
using CsvHelper.Configuration;
|
||||
using CsvHelper.TypeConversion;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Cowain.Bake.UI.CsvMap
|
||||
{
|
||||
public sealed class PalletInfoMap : ClassMap<TPalletInfo>
|
||||
{
|
||||
public PalletInfoMap()
|
||||
{
|
||||
Map(m => m.Id).Name("序号");
|
||||
Map(m => m.PalletCode).Name("夹具条码");
|
||||
|
||||
// 应用枚举描述转换器
|
||||
Map(m => m.PalletStatus)
|
||||
.Name("状态")
|
||||
.TypeConverter<PalletStatusMapConverter>();
|
||||
|
||||
Map(m => m.BatteryQty).Name("电芯数量");
|
||||
Map(m => m.BakingCount).Name("烘烤次数");
|
||||
Map(m => m.JobNum).Name("工单号");;
|
||||
|
||||
Map(m => m.BakingPosition).Name("烘烤位置")
|
||||
.TypeConverter<CavityInfoIdMapConverter>();
|
||||
|
||||
Map(m => m.ScanTime)
|
||||
.Name("扫码时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.LoadingPosition).Name("上料位置")
|
||||
.TypeConverter<CavityInfoIdMapConverter>();
|
||||
|
||||
//Map(m => m.UnLoadingPosition).Name("下料位置")
|
||||
// .TypeConverter<CavityInfoIdMapConverter>();
|
||||
|
||||
Map(m => m.LoadingBegingTime)
|
||||
.Name("上料开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.LoadingOverTime)
|
||||
.Name("上料结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingBeginTime)
|
||||
.Name("烘烤开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.BakingOverTime)
|
||||
.Name("烘烤结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.UnLoadingBegingTime)
|
||||
.Name("下料开始时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.UnLoadingOverTime)
|
||||
.Name("下料结束时间")
|
||||
.TypeConverterOption.Format("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Map(m => m.WaterValue).Name("水含量结果");
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Cowain.Bake.UI/CsvMap/TypeConverter.cs
Normal file
63
Cowain.Bake.UI/CsvMap/TypeConverter.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using Cowain.Bake.Common.Converter;
|
||||
using Cowain.Bake.BLL.Converter;
|
||||
using Cowain.Bake.Model;
|
||||
using CsvHelper;
|
||||
using CsvHelper.Configuration;
|
||||
using CsvHelper.TypeConversion;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Cowain.Bake.UI.CsvMap
|
||||
{
|
||||
public class PalletStatusMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly PalletStatusConvertor _converter = new PalletStatusConvertor();
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
|
||||
public class MesDataMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly SendFlagConvertor _converter = new SendFlagConvertor();
|
||||
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
|
||||
public class BatteryStatusMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly BatteryStatusConvertor _converter = new BatteryStatusConvertor();
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
|
||||
public class PalletVirtualIdMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly PalletVirtualIdConverter _converter = new PalletVirtualIdConverter();
|
||||
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
|
||||
public class CavityInfoIdMapConverter : DefaultTypeConverter
|
||||
{
|
||||
private static readonly CavityInfoIdConverter _converter = new CavityInfoIdConverter();
|
||||
|
||||
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
|
||||
{
|
||||
// 使用IValueConverter转换逻辑
|
||||
return _converter.Convert(value, typeof(string), null, CultureInfo.InvariantCulture) as string;
|
||||
}
|
||||
}
|
||||
}
|
||||
95
Cowain.Bake.UI/DataQuery/ViewModels/BatteryInfoViewModel.cs
Normal file
95
Cowain.Bake.UI/DataQuery/ViewModels/BatteryInfoViewModel.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
using Prism.Commands;
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Cowain.Bake.UI.CsvMap;
|
||||
|
||||
namespace Cowain.Bake.UI.DataQuery.ViewModels
|
||||
{
|
||||
public class BatteryInfoViewModel : ViewModelBase
|
||||
{
|
||||
private DateTime _startTime = DateTime.Now.AddDays(-1);
|
||||
public DateTime StartDatetime
|
||||
{
|
||||
get { return _startTime; }
|
||||
set { SetProperty(ref _startTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
private DateTime _endTime = DateTime.Now.AddHours(1);
|
||||
public DateTime EndDatetime
|
||||
{
|
||||
get { return _endTime; }
|
||||
set { SetProperty(ref _endTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
|
||||
public BatteryInfoViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "电池追踪";
|
||||
}
|
||||
|
||||
public List<BatteryInfoEntity> batteryList = new List<BatteryInfoEntity>();
|
||||
|
||||
private ObservableCollection<TBatteryInfo> cellList;
|
||||
public ObservableCollection<TBatteryInfo> CellList
|
||||
{
|
||||
get => cellList ?? (cellList = new ObservableCollection<TBatteryInfo>());
|
||||
set { SetProperty(ref cellList, value); }
|
||||
}
|
||||
|
||||
public DelegateCommand<object> ExportCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (batteryList.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Common.Core.CSVHelper.WriteMap<BatteryInfoEntity, BatteryInfoDetailMap>(batteryList);
|
||||
//Common.Core.CSVHelper.WriteDataTableToCsv(batteryList, new List<string> { "Id","BatteryCode", "PalletCode", "BatteryStatus",
|
||||
// "PositionX", "PositionY", "LoadingBegingTime","ScanTime","LoadingOverTime", "BakingPosition", "BakingBeginTime", "BakingOverTime","UnLoadingBegingTime", "UnLoadingOverTime", "WaterValue"}, new List<string> { "序号", "电芯条码", "托盘条码", "电芯状态", "行号", "列号", "上料开始时间","扫码时间", "上料结束时间", "所属烤箱", "烘烤开始时间",
|
||||
// "烘烤结束时间", "下料开始时间", "下料结束时间", "不含量结果"});
|
||||
});
|
||||
public DelegateCommand<object> QueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
CellList.Clear();
|
||||
|
||||
if ((EndDatetime - StartDatetime).TotalDays > 5)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("查询时间差在 5 天以内!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Code))
|
||||
{
|
||||
batteryList = _unityContainer.Resolve<BatteryInfoService>().Query(StartDatetime, EndDatetime);
|
||||
}
|
||||
else
|
||||
{
|
||||
batteryList = _unityContainer.Resolve<BatteryInfoService>().Query(Code);
|
||||
}
|
||||
|
||||
if (0 != batteryList.Count)
|
||||
{
|
||||
batteryList.ForEach(item => CellList.Add(item));
|
||||
Growl.Success("查询完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("没有数据!");
|
||||
}
|
||||
});
|
||||
public DelegateCommand<object> DeleteCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
365
Cowain.Bake.UI/DataQuery/ViewModels/CurveViewModel.cs
Normal file
365
Cowain.Bake.UI/DataQuery/ViewModels/CurveViewModel.cs
Normal file
@@ -0,0 +1,365 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.UI.CommonView.Views;
|
||||
using LiveCharts;
|
||||
using LiveCharts.Wpf;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.DataQuery.ViewModels
|
||||
{
|
||||
public enum EChartType
|
||||
{
|
||||
Temp = 1,
|
||||
Vacuum = 2,
|
||||
PID = 3
|
||||
}
|
||||
public class DemoDataModel
|
||||
{
|
||||
public int Index { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
public class CurveViewModel : ViewModelBase
|
||||
{
|
||||
//private DataTable _dtChartTemp;
|
||||
private DataTable _dtTemp;
|
||||
|
||||
private ObservableCollection<DemoDataModel> _dataList;
|
||||
public ObservableCollection<DemoDataModel> DataList
|
||||
{
|
||||
get => _dataList;
|
||||
set => SetProperty(ref _dataList, value);
|
||||
}
|
||||
|
||||
public DataTable DtTemp
|
||||
{
|
||||
get => _dtTemp;
|
||||
set => SetProperty(ref _dtTemp, value);
|
||||
}
|
||||
|
||||
private DataTable _dtPID;
|
||||
public DataTable DtPID
|
||||
{
|
||||
get => _dtPID;
|
||||
set => SetProperty(ref _dtPID, value);
|
||||
}
|
||||
public ChartValues<string> TimeLine { get; set; }
|
||||
public string XName { get; set; }
|
||||
public string YName { get; set; }
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
private int _stepId = 1;
|
||||
public int StepId
|
||||
{
|
||||
get => _stepId;
|
||||
set => SetProperty(ref _stepId, value);
|
||||
}
|
||||
|
||||
private string _selectOneItem;
|
||||
public string SelectOneItem
|
||||
{
|
||||
get => _selectOneItem;
|
||||
set => SetProperty(ref _selectOneItem, value);
|
||||
}
|
||||
|
||||
private DateTime _curveStartDateTime = DateTime.Now.AddHours(-23);
|
||||
public DateTime CurveStartDateTime
|
||||
{
|
||||
get { return _curveStartDateTime; }
|
||||
set { SetProperty(ref _curveStartDateTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
private DateTime _curveEndDateTime = DateTime.Now;
|
||||
public DateTime CurveEndDateTime
|
||||
{
|
||||
get { return _curveEndDateTime; }
|
||||
set { SetProperty(ref _curveEndDateTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
|
||||
|
||||
public CurveViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
DtTemp = null;
|
||||
DtPID = null;;
|
||||
DataList = new ObservableCollection<DemoDataModel>();
|
||||
|
||||
SetCheckCombox();
|
||||
TimeLine = new ChartValues<string>();
|
||||
SeriesCollection = new SeriesCollection();
|
||||
this.PageTitle = "曲线图表";
|
||||
}
|
||||
|
||||
private void SetCheckCombox()
|
||||
{
|
||||
for (int i = 1; i <= 8; i++)
|
||||
{
|
||||
DataList.Add(new DemoDataModel()
|
||||
{
|
||||
Index = i,
|
||||
Name = "温度" + i.ToString(),
|
||||
IsSelected = true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void GetTempChartData(DataTable table)
|
||||
{
|
||||
for (int i = 2; i < table.Columns.Count; i++)
|
||||
{
|
||||
var columnName = table.Columns[i].ColumnName;
|
||||
|
||||
var model = DataList.Where(x => x.IsSelected && x.Name == columnName).FirstOrDefault();
|
||||
if (null == model)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ChartValues<double> chartValues = new ChartValues<double>();
|
||||
table.AsEnumerable().Select(item => item.Field<double>(columnName)).ToList().ForEach(item => chartValues.Add(item));
|
||||
|
||||
var lineSeries = new LineSeries
|
||||
{
|
||||
Title = columnName,
|
||||
Values = chartValues,
|
||||
StrokeThickness = 1,
|
||||
LineSmoothness = 0,
|
||||
Fill = Brushes.Transparent,
|
||||
PointGeometry = null // 不画圆点
|
||||
};
|
||||
|
||||
SeriesCollection.Add(lineSeries);
|
||||
}
|
||||
}
|
||||
|
||||
void GetVacuumChartData(DataTable table)
|
||||
{
|
||||
var columnName = table.Columns[2].ColumnName;
|
||||
ChartValues<double> chartValues = new ChartValues<double>();
|
||||
table.AsEnumerable().Select(item => item.Field<float>(columnName)).ToList().ForEach(item => chartValues.Add(Math.Round(item,2)));
|
||||
|
||||
var lineSeries = new LineSeries
|
||||
{
|
||||
Title = columnName,
|
||||
Values = chartValues,
|
||||
StrokeThickness = 1,
|
||||
LineSmoothness = 0,
|
||||
Fill = Brushes.Transparent,
|
||||
PointGeometry = null // 不画圆点
|
||||
};
|
||||
SeriesCollection.Add(lineSeries);
|
||||
}
|
||||
|
||||
void GetPIDChartData(DataTable table)
|
||||
{
|
||||
for (int i = 2; i < table.Columns.Count; i++)
|
||||
{
|
||||
var columnName = table.Columns[i].ColumnName;
|
||||
ChartValues<double> chartValues = new ChartValues<double>();
|
||||
table.AsEnumerable().Select(item => item.Field<double>(columnName)).ToList().ForEach(item => chartValues.Add(item));
|
||||
|
||||
var lineSeries = new LineSeries
|
||||
{
|
||||
Title = columnName,
|
||||
Values = chartValues,
|
||||
StrokeThickness = 1,
|
||||
LineSmoothness = 0,
|
||||
Fill = Brushes.Transparent,
|
||||
PointGeometry = null // 不画圆点
|
||||
};
|
||||
|
||||
SeriesCollection.Add(lineSeries);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSeries(DataTable table, EChartType chartType)
|
||||
{
|
||||
if (null == table
|
||||
|| 0 == table.Rows.Count)
|
||||
{
|
||||
HandyControl.Controls.Growl.Warning("请点【查询】数据,或查询数据为空!");
|
||||
return;
|
||||
}
|
||||
StepId = table.Rows.Count / 10;
|
||||
System.Threading.SynchronizationContext.SetSynchronizationContext(new
|
||||
System.Windows.Threading.DispatcherSynchronizationContext(System.Windows.Application.Current.Dispatcher));
|
||||
System.Threading.SynchronizationContext.Current.Post(p1 =>
|
||||
{
|
||||
TimeLine.Clear();
|
||||
SeriesCollection.Clear();
|
||||
|
||||
if (chartType == EChartType.Vacuum)
|
||||
{
|
||||
GetVacuumChartData(table);
|
||||
}
|
||||
else if (chartType == EChartType.Temp)
|
||||
{
|
||||
GetTempChartData(table);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetPIDChartData(table);
|
||||
}
|
||||
|
||||
SetXAxis(table);
|
||||
}, null);
|
||||
}
|
||||
|
||||
private void SetXAxis(DataTable table)
|
||||
{
|
||||
XName = table.Columns[0].ColumnName;
|
||||
table.AsEnumerable().Select(item => item.Field<string>(XName)).ToList().ForEach(item => TimeLine.Add(item));
|
||||
}
|
||||
|
||||
public DelegateCommand QueryTempCommand { get => new DelegateCommand(async () => await QueryTemp()); }
|
||||
|
||||
public async Task QueryTemp()
|
||||
{
|
||||
DtTemp = null;
|
||||
if (!IsAccord("温度曲线(℃)"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ProgressBarView dlg = new ProgressBarView();
|
||||
dlg.Show();
|
||||
string sql = $@"CALL ProcGetTemperatureAndPressureData('{CurveStartDateTime.ToString("yyyy-MM-dd HH:mm:ss")}'
|
||||
,'{CurveEndDateTime.ToString("yyyy-MM-dd HH:mm:ss")}','{Code}')";
|
||||
await Task.Run(new Action(() =>
|
||||
{
|
||||
DtTemp = _unityContainer.Resolve<StoveSctualPatrolService>().GetDataTable(sql);
|
||||
}));
|
||||
dlg.Close();
|
||||
Tip(DtTemp);
|
||||
}
|
||||
|
||||
void Tip(DataTable dt)
|
||||
{
|
||||
if (0 == dt.Rows.Count)
|
||||
{
|
||||
HandyControl.Controls.Growl.Warning("查询数据为空!");
|
||||
}
|
||||
else
|
||||
{
|
||||
HandyControl.Controls.Growl.Success("查询数据成功!");
|
||||
}
|
||||
}
|
||||
public DelegateCommand ChartTempCommand => new DelegateCommand(async() =>
|
||||
{
|
||||
await WaitChartTemp(DtTemp, EChartType.Temp);
|
||||
});
|
||||
|
||||
|
||||
public async Task AsyncChart(DataTable table, EChartType chartType)
|
||||
{
|
||||
Task queryTask = Task.Run(() => UpdateSeries(table, chartType));
|
||||
var timeouttask = Task.Delay(30 * 1000);
|
||||
|
||||
var completedTask = await Task.WhenAny(queryTask, timeouttask);
|
||||
if (completedTask == timeouttask)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("查询超时!");
|
||||
}
|
||||
}
|
||||
|
||||
public DelegateCommand ChartVacuumCommand => new DelegateCommand(async() =>
|
||||
{
|
||||
if (!IsAccord("真空压力"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await WaitChartTemp(DtTemp, EChartType.Vacuum);
|
||||
});
|
||||
|
||||
//public DelegateCommand QueryPIDCommand { get => new DelegateCommand(QueryPID); }
|
||||
public DelegateCommand QueryPIDCommand { get => new DelegateCommand(async() => await QueryPID()); }
|
||||
public async Task QueryPID()
|
||||
{
|
||||
if (!IsAccord("PID"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ProgressBarView dlg = new ProgressBarView();
|
||||
dlg.Show();
|
||||
string sql = $@"CALL ProcGetPidData ('{CurveStartDateTime.ToString("yyyy-MM-dd HH:mm:ss")}'
|
||||
,'{CurveEndDateTime.ToString("yyyy-MM-dd HH:mm:ss")}','{Code}')";
|
||||
|
||||
await Task.Run(new Action(() =>
|
||||
{
|
||||
DtPID = _unityContainer.Resolve<StoveSctualPatrolService>().GetDataTable(sql);
|
||||
}));
|
||||
dlg.Close();
|
||||
Tip(DtPID);
|
||||
}
|
||||
|
||||
public DelegateCommand ChartPIDCommand => new DelegateCommand(async() =>
|
||||
{
|
||||
await WaitChartTemp(DtPID, EChartType.PID);
|
||||
});
|
||||
|
||||
public async Task WaitChartTemp(DataTable table, EChartType eChart)
|
||||
{
|
||||
ProgressBarView dlg = new ProgressBarView();
|
||||
dlg.Show();
|
||||
await AsyncChart(table, eChart);
|
||||
dlg.Close();
|
||||
}
|
||||
|
||||
public DelegateCommand<object> ExportTempCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (null == DtTemp)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error("温度数据为空!", "操作提示");
|
||||
return;
|
||||
}
|
||||
|
||||
CSVHelper.WriteDataTableToCsv(DtTemp);
|
||||
});
|
||||
|
||||
public DelegateCommand<object> ExportPIDCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (null == DtPID)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error("温度数据为空!", "操作提示");
|
||||
return;
|
||||
}
|
||||
|
||||
CSVHelper.WriteDataTableToCsv(DtPID);
|
||||
});
|
||||
|
||||
bool IsAccord(string headName)
|
||||
{
|
||||
YName = headName;
|
||||
if (string.IsNullOrWhiteSpace(Code))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error("请输入条码", "操作提示");
|
||||
return false;
|
||||
}
|
||||
|
||||
var p = _unityContainer.Resolve<PalletInfoService>().GetPalletInfo(Code);
|
||||
if (p == null)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error("没有该托盘码", "操作提示");
|
||||
return false;
|
||||
}
|
||||
|
||||
TimeSpan timeSpan = CurveEndDateTime - CurveStartDateTime;
|
||||
if (timeSpan.TotalHours > 24)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error("请选择时间区间小于24小时的数据", "操作提示");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Cowain.Bake.UI/DataQuery/ViewModels/DummyInfoViewModel.cs
Normal file
65
Cowain.Bake.UI/DataQuery/ViewModels/DummyInfoViewModel.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Unity;
|
||||
using Prism.Commands;
|
||||
using HandyControl.Controls;
|
||||
using Newtonsoft.Json;
|
||||
using Cowain.Bake.Model.Models;
|
||||
using System.Linq;
|
||||
|
||||
namespace Cowain.Bake.UI.DataQuery.ViewModels
|
||||
{
|
||||
public class DummyInfoViewModel:ViewModelBase
|
||||
{
|
||||
public DummyInfoViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "电池追踪";
|
||||
|
||||
}
|
||||
|
||||
private ObservableCollection<BatteryInfoEntity> cellList;
|
||||
public ObservableCollection<BatteryInfoEntity> CellList
|
||||
{
|
||||
get => cellList ?? (cellList = new ObservableCollection<BatteryInfoEntity>());
|
||||
set { SetProperty(ref cellList, value); }
|
||||
}
|
||||
|
||||
public DelegateCommand<object> DummyQueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
CellList.Clear();
|
||||
if (string.IsNullOrWhiteSpace(Code))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error($@"没有数据!请输入正确的条码", "操作提示");
|
||||
return;
|
||||
}
|
||||
|
||||
BatteryInfoEntity batteryInfo = _unityContainer.Resolve<BatteryInfoService>().QueryBatteryWaterValue(Code);
|
||||
if(null == batteryInfo)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error($@"没有数据到所属托盘或没有此电芯!", "警告");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(batteryInfo.WaterValue))
|
||||
{
|
||||
List<WaterModel> waterModelList = JsonConvert.DeserializeObject<List<WaterModel>>(batteryInfo.WaterValue);
|
||||
WaterModel waterModel = waterModelList.OrderByDescending(w=>w.Id).FirstOrDefault();
|
||||
batteryInfo.SeptumValue = waterModel.SeptumWaterValue;
|
||||
batteryInfo.AnodeValue = waterModel.AnodeWaterValue;
|
||||
batteryInfo.CathodeValue = waterModel.CathodeWaterValue;
|
||||
}
|
||||
|
||||
CellList.Add(batteryInfo);
|
||||
Growl.Success("查询完成!");
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
192
Cowain.Bake.UI/DataQuery/ViewModels/GetMesLogViewModel.cs
Normal file
192
Cowain.Bake.UI/DataQuery/ViewModels/GetMesLogViewModel.cs
Normal file
@@ -0,0 +1,192 @@
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Common.Interface;
|
||||
using Cowain.Bake.Model;
|
||||
using HandyControl.Controls;
|
||||
using Microsoft.Win32;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Unity;
|
||||
using Cowain.Bake.Common.CsvMap;
|
||||
|
||||
namespace Cowain.Bake.UI.DataQuery.ViewModels
|
||||
{
|
||||
|
||||
public class GetMesLogViewModel : ViewModelBase, INavigationAware
|
||||
{
|
||||
TimeSpan intervalDateTime;
|
||||
private bool isChecked;
|
||||
public bool IsChecked
|
||||
{
|
||||
get => isChecked;
|
||||
set => SetProperty(ref isChecked, value);
|
||||
}
|
||||
|
||||
private string batteryCode;
|
||||
public string BatteryCode
|
||||
{
|
||||
get => batteryCode;
|
||||
set => SetProperty(ref batteryCode, value);
|
||||
}
|
||||
|
||||
private string mesClass;
|
||||
public string MesClass
|
||||
{
|
||||
get => mesClass;
|
||||
set => SetProperty(ref mesClass, value);
|
||||
}
|
||||
private ObservableCollection<MesDataEntity> mesDataList;
|
||||
public ObservableCollection<MesDataEntity> MesDataList
|
||||
{
|
||||
get => mesDataList;
|
||||
set => SetProperty(ref mesDataList, value);
|
||||
}
|
||||
private List<string> mesClassList;
|
||||
public List<string> MesClassList
|
||||
{
|
||||
get => mesClassList;
|
||||
set => SetProperty(ref mesClassList, value);
|
||||
}
|
||||
|
||||
private DateTime _startTime = DateTime.Now.AddDays(-2);
|
||||
public DateTime StartDatetime
|
||||
{
|
||||
get { return _startTime; }
|
||||
set { SetProperty(ref _startTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
private DateTime _endTime = DateTime.Now;
|
||||
public DateTime EndDatetime
|
||||
{
|
||||
get { return _endTime; }
|
||||
set { SetProperty(ref _endTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
public GetMesLogViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
BatteryCode = "";
|
||||
_unityContainer = unityContainer;
|
||||
SetPalletStatusCombox();
|
||||
MesDataList = new ObservableCollection<MesDataEntity>();
|
||||
}
|
||||
|
||||
private void SetPalletStatusCombox()
|
||||
{
|
||||
mesClassList = new List<string>();
|
||||
foreach (EMesLogClass eMesLogClass in System.Enum.GetValues(typeof(EMesLogClass)))
|
||||
{
|
||||
mesClassList.Add(eMesLogClass.GetDescription());
|
||||
}
|
||||
|
||||
MesClass = EMesLogClass.EnterStation.GetDescription();
|
||||
}
|
||||
|
||||
public DelegateCommand AutoUploadCommand => new DelegateCommand(() =>
|
||||
{
|
||||
foreach (var item in MesDataList)
|
||||
{
|
||||
if (item.IsCheck)
|
||||
{
|
||||
_unityContainer.Resolve<MesDataService>().ModifySendFlag(item.Id, (sbyte)EMesUpLoadStatus.Wait);
|
||||
}
|
||||
}
|
||||
QueryMesStation();
|
||||
});
|
||||
|
||||
bool QueryMesStation()
|
||||
{
|
||||
MesDataList.Clear();
|
||||
List<MesDataEntity> dataList = null;
|
||||
if (!ExecuttableOrNot())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsChecked)
|
||||
{
|
||||
if (string.IsNullOrEmpty(BatteryCode))
|
||||
{
|
||||
Growl.Warning("电芯条码为空!");
|
||||
return false;
|
||||
}
|
||||
dataList = _unityContainer.Resolve<MesDataService>().GetMesDataCellState(BatteryCode, StartDatetime, EndDatetime);
|
||||
dataList.AddRange(_unityContainer.Resolve<MesDataService>().GetMesDataBakingOutput(BatteryCode, StartDatetime, EndDatetime));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(MesClass))
|
||||
{
|
||||
Growl.Warning("Mes信息类别为空!");
|
||||
return false;
|
||||
}
|
||||
|
||||
var Cmd = EnumHelper.GetValueByDescription<EMesLogClass>(MesClass);
|
||||
dataList = _unityContainer.Resolve<MesDataService>().GetMesDataList(Cmd, StartDatetime, EndDatetime);
|
||||
}
|
||||
|
||||
dataList.ForEach(item => MesDataList.Add(item));
|
||||
return true;
|
||||
}
|
||||
|
||||
public DelegateCommand<object> QueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (!QueryMesStation())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MesDataList.Count == 0)
|
||||
{
|
||||
Growl.Warning("没有数据!");
|
||||
return;
|
||||
}
|
||||
});
|
||||
public DelegateCommand<object> GetMesCvsCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (MesDataList == null
|
||||
|| MesDataList.Count == 0)
|
||||
{
|
||||
Growl.Warning("没有数据!");
|
||||
return;
|
||||
}
|
||||
|
||||
Common.Core.CSVHelper.WriteMap<MesDataEntity, MesDataMap>(MesDataList);
|
||||
//Common.Core.CSVHelper.WriteDataTableToCsv(MesDataList, new List<string>() {"CreateTime", "SendTime", "RecvTime", "Content", "RecvContent", "BatteryCode" },
|
||||
// new List<string>() {"创建时间", "发送时间", "接收时间", "发送信息", "接收信息" , "电芯条码"});
|
||||
});
|
||||
|
||||
void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
// 导航到当前页面时的处理逻辑,先执行构造方法,再执行本方法
|
||||
}
|
||||
|
||||
bool INavigationAware.IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return false; //false:表示每次导航都创建新实例,不重用旧实例; true:用旧实例,不会执行构造方法
|
||||
}
|
||||
|
||||
void INavigationAware.OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
//相当于析构方法,退出时(切换时)再执行。
|
||||
// 在这里添加释放旧视图实例资源的代码
|
||||
}
|
||||
|
||||
private bool ExecuttableOrNot()
|
||||
{
|
||||
intervalDateTime = EndDatetime - StartDatetime;
|
||||
if (intervalDateTime.TotalDays > 10)
|
||||
{
|
||||
Growl.Warning("请选择时间区间小于10天的数据!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
146
Cowain.Bake.UI/DataQuery/ViewModels/IncomingCellInfoViewModel.cs
Normal file
146
Cowain.Bake.UI/DataQuery/ViewModels/IncomingCellInfoViewModel.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
using Prism.Commands;
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using Cowain.Bake.UI.CsvMap;
|
||||
|
||||
namespace Cowain.Bake.UI.DataQuery.ViewModels
|
||||
{
|
||||
public class IncomingCellInfoViewModel : ViewModelBase
|
||||
{
|
||||
private DateTime _startTime = DateTime.Now.AddDays(-1);
|
||||
public DateTime StartDatetime
|
||||
{
|
||||
get { return _startTime; }
|
||||
set { SetProperty(ref _startTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
private DateTime _endTime = DateTime.Now.AddHours(1);
|
||||
public DateTime EndDatetime
|
||||
{
|
||||
get { return _endTime; }
|
||||
set { SetProperty(ref _endTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
|
||||
List<TBatteryInfo> batteryList = new List<TBatteryInfo>();
|
||||
|
||||
public IncomingCellInfoViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "来料查询";
|
||||
|
||||
}
|
||||
|
||||
private ObservableCollection<TBatteryInfo> cellList;
|
||||
public ObservableCollection<TBatteryInfo> CellList
|
||||
{
|
||||
get => cellList ?? (cellList = new ObservableCollection<TBatteryInfo>());
|
||||
set { SetProperty(ref cellList, value); }
|
||||
}
|
||||
|
||||
public void AsyncRefreshTask()
|
||||
{
|
||||
Application.Current?.Dispatcher?.Invoke(new Action(() =>
|
||||
{
|
||||
Refresh();
|
||||
}));
|
||||
}
|
||||
|
||||
public async override void Refresh()
|
||||
{
|
||||
CellList.Clear();
|
||||
batteryList.Clear();
|
||||
|
||||
batteryList = await System.Threading.Tasks.Task.Run(() =>
|
||||
{
|
||||
var cellInfoService = _unityContainer.Resolve<BatteryInfoService>();
|
||||
//从数据库查询任务
|
||||
return cellInfoService.GetIncomingCell();
|
||||
});
|
||||
|
||||
batteryList.ForEach(x => CellList.Add(x));
|
||||
}
|
||||
|
||||
public DelegateCommand<object> DeleteCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Ask($@"确定删除?", "操作提示");
|
||||
if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var t = x as TBatteryInfo;
|
||||
if (t != null)
|
||||
{
|
||||
int delCount = _unityContainer.Resolve<BatteryInfoService>().Delete(t);
|
||||
cellList.Remove(t);
|
||||
if (delCount > 0)
|
||||
{
|
||||
Growl.Success("删除成功!");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("删除失败!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("删除失败!");
|
||||
}
|
||||
});
|
||||
|
||||
public DelegateCommand<object> ExportCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (batteryList.Count == 0)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("没有数据!");
|
||||
return;
|
||||
}
|
||||
|
||||
Common.Core.CSVHelper.WriteMap<TBatteryInfo, BatteryInfoMap>(batteryList);
|
||||
});
|
||||
|
||||
public DelegateCommand<object> QueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
CellList.Clear();
|
||||
batteryList.Clear();
|
||||
if ((EndDatetime - StartDatetime).TotalDays > 5)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("查询时间差在 5 天以内!");
|
||||
return;
|
||||
}
|
||||
|
||||
var cellService = _unityContainer.Resolve<BatteryInfoService>();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Code))
|
||||
{
|
||||
batteryList = cellService.QueryIncomingCell(StartDatetime, EndDatetime);
|
||||
}
|
||||
else
|
||||
{
|
||||
batteryList = cellService.QueryIncomingCellByCode(Code);
|
||||
|
||||
}
|
||||
if (0 != batteryList.Count)
|
||||
{
|
||||
batteryList.ForEach(item => CellList.Add(item));
|
||||
Growl.Success("查询完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("没有数据!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
179
Cowain.Bake.UI/DataQuery/ViewModels/NGCellInfoViewModel.cs
Normal file
179
Cowain.Bake.UI/DataQuery/ViewModels/NGCellInfoViewModel.cs
Normal file
@@ -0,0 +1,179 @@
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
using Prism.Commands;
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Cowain.Bake.Common.CsvMap;
|
||||
|
||||
namespace Cowain.Bake.UI.DataQuery.ViewModels
|
||||
{
|
||||
public class NGCellInfoViewModel:ViewModelBase
|
||||
{
|
||||
private DateTime _startTime = DateTime.Now.AddDays(-1);
|
||||
public DateTime StartDatetime
|
||||
{
|
||||
get { return _startTime; }
|
||||
set { SetProperty(ref _startTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
private DateTime _endTime = DateTime.Now.AddHours(1);
|
||||
public DateTime EndDatetime
|
||||
{
|
||||
get { return _endTime; }
|
||||
set { SetProperty(ref _endTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
public NGCellInfoViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "烘烤NG电芯查询";
|
||||
|
||||
}
|
||||
|
||||
private ObservableCollection<TBatteryNG> cellList;
|
||||
public ObservableCollection<TBatteryNG> CellList
|
||||
{
|
||||
get => cellList ?? (cellList = new ObservableCollection<TBatteryNG>());
|
||||
set { SetProperty(ref cellList, value); }
|
||||
}
|
||||
|
||||
public void AsyncRefreshTask()
|
||||
{
|
||||
Application.Current?.Dispatcher?.Invoke(new Action(() =>
|
||||
{
|
||||
Refresh();
|
||||
}));
|
||||
}
|
||||
|
||||
public async override void Refresh()
|
||||
{
|
||||
CellList.Clear();
|
||||
|
||||
var listCell = await System.Threading.Tasks.Task.Run(() =>
|
||||
{
|
||||
//从数据库查询任务
|
||||
return _unityContainer.Resolve<BatteryNGService>().GetAllNGCell();
|
||||
});
|
||||
|
||||
listCell = ExtractJson(listCell);
|
||||
listCell.ForEach(x => CellList.Add(x));
|
||||
}
|
||||
|
||||
public DelegateCommand<object> ExportCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (0 == CellList.Count)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("没有数据,导出失败!");
|
||||
return;
|
||||
}
|
||||
|
||||
Common.Core.CSVHelper.WriteMap<TBatteryNG, FailBatteryMap>(CellList);
|
||||
//Common.Core.CSVHelper.WriteDataTableToCsv(CellList, new List<string> { "Id","BatteryCode", "PalletCode", "ChannelNo",
|
||||
// "Desc", "CreateTime"}, new List<string> { "序号", "电芯条码", "托盘条码", "报警通道", "报警描述","报警时间"});
|
||||
});
|
||||
|
||||
public DelegateCommand<object> QueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
CellList.Clear();
|
||||
|
||||
if ((EndDatetime - StartDatetime).TotalDays > 5)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("查询时间差在 5 天以内!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
List<TBatteryNG> queryCell = _unityContainer.Resolve<BatteryNGService>().QueryNGCell(StartDatetime, EndDatetime, Code); //出可以直接在数据库中查询得到 SELECT `Desc`->>'$.Info.MOMMessage' cmd FROM TBatteryNG;
|
||||
queryCell = ExtractJson(queryCell);
|
||||
if (0 != queryCell.Count)
|
||||
{
|
||||
queryCell.ForEach(item => CellList.Add(item));
|
||||
Growl.Success("查询完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("没有数据!");
|
||||
}
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// JSON 字符串截取
|
||||
/// </summary>
|
||||
/// <param name="failBatterys"></param>
|
||||
/// <returns></returns>
|
||||
List<TBatteryNG> ExtractJson(List<TBatteryNG> failBatterys)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var item in failBatterys)
|
||||
{
|
||||
if (!IsValidJson(item.Desc))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JObject jsonObject = JObject.Parse(item.Desc);
|
||||
string keyValue = (string)jsonObject["Info"]["MOMMessage"]; //为什么加try,怕没有MOMMessage
|
||||
item.Desc = keyValue; // 更新为Key的值
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
LogHelper.Instance.Info($"NG电芯,解析JSON失败:{ex.Message}");
|
||||
}
|
||||
|
||||
return failBatterys;
|
||||
}
|
||||
|
||||
bool IsValidJson(string input)
|
||||
{
|
||||
try
|
||||
{
|
||||
JsonConvert.DeserializeObject(input);
|
||||
//JsonDocument.Parse(input);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public DelegateCommand<object> DeleteCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Ask($@"确定删除?", "操作提示");
|
||||
if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var t = x as TBatteryNG;
|
||||
if (t != null)
|
||||
{
|
||||
int delCount = _unityContainer.Resolve<BatteryNGService>().Delete(t);
|
||||
cellList.Remove(t);
|
||||
if (delCount > 0)
|
||||
{
|
||||
Growl.Success("删除成功!");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("删除失败!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("删除失败!");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
133
Cowain.Bake.UI/DataQuery/ViewModels/PalletInfoViewModel.cs
Normal file
133
Cowain.Bake.UI/DataQuery/ViewModels/PalletInfoViewModel.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Unity;
|
||||
using Prism.Commands;
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using Cowain.Bake.UI.CsvMap;
|
||||
|
||||
namespace Cowain.Bake.UI.DataQuery.ViewModels
|
||||
{
|
||||
public class PalletInfoViewModel:ViewModelBase
|
||||
{
|
||||
private DateTime _startTime = DateTime.Now.AddDays(-1);
|
||||
public DateTime StartDatetime
|
||||
{
|
||||
get { return _startTime; }
|
||||
set { SetProperty(ref _startTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
private DateTime _endTime = DateTime.Now.AddHours(1);
|
||||
public DateTime EndDatetime
|
||||
{
|
||||
get { return _endTime; }
|
||||
set { SetProperty(ref _endTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
|
||||
public PalletInfoViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "托盘追踪";
|
||||
}
|
||||
|
||||
private ObservableCollection<TPalletInfo> palletList;
|
||||
public ObservableCollection<TPalletInfo> PalletList
|
||||
{
|
||||
get => palletList ?? (palletList = new ObservableCollection<TPalletInfo>());
|
||||
set { SetProperty(ref palletList, value); }
|
||||
}
|
||||
|
||||
List<TPalletInfo> SaveList = new List<TPalletInfo>();
|
||||
public void AsyncRefreshTask()
|
||||
{
|
||||
Application.Current?.Dispatcher?.Invoke(new Action(() =>
|
||||
{
|
||||
Refresh();
|
||||
}));
|
||||
}
|
||||
|
||||
public async override void Refresh()
|
||||
{
|
||||
PalletList.Clear();
|
||||
SaveList.Clear();
|
||||
SaveList = await System.Threading.Tasks.Task.Run(() =>
|
||||
{
|
||||
//从数据库查询任务
|
||||
return _unityContainer.Resolve<PalletInfoService>().GetAll();
|
||||
});
|
||||
|
||||
SaveList.ForEach(x => PalletList.Add(x));
|
||||
}
|
||||
|
||||
public DelegateCommand<object> ExportCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (SaveList.Count == 0)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("没有数据!");
|
||||
return;
|
||||
}
|
||||
|
||||
Common.Core.CSVHelper.WriteMap<TPalletInfo, PalletInfoMap>(SaveList);
|
||||
//Common.Core.CSVHelper.WriteDataTableToCsv(SaveList, new List<string> { "Id","PalletCode", "PalletStatus",
|
||||
// "BatteryQty", "BakingCount","BakingPosition", "ScanTime", "LoadingOverTime","InStoveTime","BakingBeginTime","BakingOverTime","OutStoveTime","JobNum"},
|
||||
// new List<string> { "序号", "托盘条码", "托盘状态", "电芯数量", "烘烤次数", "烘烤位置", "扫码时间", "上料完成时间", "入炉时间", "开始烘烤时间", "烘烤完成时间", "出炉时间", "工单号"});
|
||||
});
|
||||
|
||||
public DelegateCommand<object> QueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
PalletList.Clear();
|
||||
SaveList.Clear();
|
||||
if ((EndDatetime - StartDatetime).TotalDays > 30)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("查询时间差在 30 天以内!");
|
||||
return;
|
||||
}
|
||||
|
||||
var palletInfoService = _unityContainer.Resolve<PalletInfoService>();
|
||||
SaveList = palletInfoService.Query(StartDatetime, EndDatetime, Code);
|
||||
|
||||
if (0 != SaveList.Count)
|
||||
{
|
||||
SaveList.ForEach(item => PalletList.Add(item));
|
||||
Growl.Success("查询完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("没有数据!");
|
||||
}
|
||||
});
|
||||
public DelegateCommand<object> DeleteCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Ask($@"确定删除?", "操作提示");
|
||||
if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var t = x as TPalletInfo;
|
||||
if (t != null)
|
||||
{
|
||||
int delCount = _unityContainer.Resolve<PalletInfoService>().Delete(t);
|
||||
palletList.Remove(t);
|
||||
if (delCount > 0)
|
||||
{
|
||||
Growl.Success("删除成功!");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("删除失败!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("删除失败!");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
using Prism.Commands;
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using Cowain.Bake.Common.Core;
|
||||
|
||||
namespace Cowain.Bake.UI.DataQuery.ViewModels
|
||||
{
|
||||
public class ProductionsInfoViewModel:ViewModelBase
|
||||
{
|
||||
public ProductionsInfoViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "产量查询";
|
||||
|
||||
}
|
||||
private ObservableCollection<OutputEntity> productionList;
|
||||
public ObservableCollection<OutputEntity> ProductionList
|
||||
{
|
||||
get => productionList ?? (productionList = new ObservableCollection<OutputEntity>());
|
||||
set { SetProperty(ref productionList, value); }
|
||||
}
|
||||
|
||||
void ExecuteQuery()
|
||||
{
|
||||
List<OutputEntity> query = null;
|
||||
var cellService = _unityContainer.Resolve<BatteryInfoService>();
|
||||
|
||||
if (5 < (EndDateTime - StartDateTime).Days)
|
||||
{
|
||||
Growl.Fatal("查询日期间隔不能大于5天!");
|
||||
return;
|
||||
}
|
||||
|
||||
var task = System.Threading.Tasks.Task.Factory.StartNew(() =>
|
||||
{
|
||||
query = cellService.GetProductionOutPut(StartDateTime, EndDateTime);
|
||||
});
|
||||
|
||||
task.Wait();
|
||||
|
||||
if (null == query)
|
||||
{
|
||||
Growl.Fatal("查询失败,请重新查询!");
|
||||
return;
|
||||
}
|
||||
|
||||
productionList.Clear();
|
||||
|
||||
if (0 != query.Count)
|
||||
{
|
||||
query.ForEach(item => ProductionList.Add(item));
|
||||
Growl.Success("查询完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("没有数据!");
|
||||
}
|
||||
}
|
||||
|
||||
public DelegateCommand<object> QueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
ExecuteQuery();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
76
Cowain.Bake.UI/DataQuery/Views/BatteryInfoView.xaml
Normal file
76
Cowain.Bake.UI/DataQuery/Views/BatteryInfoView.xaml
Normal file
@@ -0,0 +1,76 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.DataQuery.Views.BatteryInfoView"
|
||||
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.DataQuery.Views"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:convertorBll="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="900">
|
||||
<UserControl.Resources>
|
||||
<convertor:BatteryStatusConvertor x:Key="cellStatusConvertor"></convertor:BatteryStatusConvertor>
|
||||
<convertorBll:CavityInfoIdConverter x:Key="CavityInfoIdConverter">
|
||||
</convertorBll:CavityInfoIdConverter>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,10" HorizontalAlignment="Center" Width="880" >
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Margin="4">日期时间:</TextBlock>
|
||||
<hc:DateTimePicker x:Name="StartTime" Text="{Binding StartDatetime,Mode=TwoWay}" Margin="5,5,0,0" Width="163"/>
|
||||
<TextBlock VerticalAlignment="Center">-</TextBlock>
|
||||
<hc:DateTimePicker x:Name="EndTime" Text="{Binding EndDatetime,Mode=TwoWay}" Width="163"></hc:DateTimePicker>
|
||||
<TextBlock Text="电芯条码:" VerticalAlignment="Center" Margin="60,4,4,4"/>
|
||||
<hc:TextBox Width="201" Height="30" Margin="0,0,10,0" Text="{Binding Code,Mode=TwoWay}"></hc:TextBox>
|
||||
<!--<TextBlock Text="托盘条码:" VerticalAlignment="Center" Margin="4"/>
|
||||
<hc:TextBox Width="93" Height="30" Margin="0,0,10,0" Text="{Binding PalletCode,Mode=TwoWay}"></hc:TextBox>-->
|
||||
<Button Content="查询" Click="Button_Click_1" Style="{StaticResource ButtonSuccess}" Margin="4" Width="58" Command="{Binding QueryCommand}"/>
|
||||
<Button Content="导出" Style="{StaticResource ButtonPrimary}" Margin="4" Width="58" Command="{Binding ExportCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvStation" Grid.Row="1"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="True"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding CellList,UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding BatteryCode}" Header="电芯条码"/>
|
||||
<DataGridTextColumn Width="90" CanUserResize="False" Binding="{Binding PalletVirtualId}" Header="托盘虚拟码"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding PalletCode}" Header="托盘条码"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding BatteryStatus, Converter={StaticResource cellStatusConvertor}}" Header="电芯状态"/>
|
||||
<DataGridTextColumn Width="55" CanUserResize="False" Binding="{Binding PositionX}" Header="行号"/>
|
||||
<DataGridTextColumn Width="55" CanUserResize="False" Binding="{Binding PositionY}" Header="列号"/>
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding LoadingBegingTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="上料开始时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding ScanTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="扫码时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding LoadingOverTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="上料结束时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding BakingPosition,Converter={StaticResource CavityInfoIdConverter}}" Header="所属烤箱" />
|
||||
<DataGridTextColumn Width="55" CanUserResize="False" Binding="{Binding BakingCount}" Header="烘烤次数"/>
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding BakingBeginTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="烘烤开始时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding BakingOverTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="烘烤结束时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding UnLoadingBegingTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="下料开始时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding UnLoadingOverTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="下料结束时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding CoolTemp}" Header="下料温度" />
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding WaterValue}" Header="水含量结果"/>
|
||||
<!--<DataGridTemplateColumn Header="操作" Width="80">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBlock Margin="3,0" >
|
||||
<Hyperlink Foreground="Red" Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding}">删除</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>-->
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
33
Cowain.Bake.UI/DataQuery/Views/BatteryInfoView.xaml.cs
Normal file
33
Cowain.Bake.UI/DataQuery/Views/BatteryInfoView.xaml.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using HandyControl.Tools.Extension;
|
||||
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.DataQuery.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// CellInfoView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class BatteryInfoView : UserControl
|
||||
{
|
||||
public BatteryInfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
140
Cowain.Bake.UI/DataQuery/Views/CurveView.xaml
Normal file
140
Cowain.Bake.UI/DataQuery/Views/CurveView.xaml
Normal file
@@ -0,0 +1,140 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.DataQuery.Views.CurveView"
|
||||
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:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="530" d:DesignWidth="950">
|
||||
<UserControl.Resources>
|
||||
<convertor:CavityInfoIdConverter x:Key="CavityInfoIdConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<TabControl VerticalAlignment="Stretch">
|
||||
<TabItem Header="曲线图" >
|
||||
<hc:SimplePanel>
|
||||
<hc:DrawerContainer>
|
||||
<Grid Background="#FFE5E5E5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="时间:" Foreground="Black" Style="{StaticResource BaseStyle}" Margin="10,10,0,0" />
|
||||
<hc:DateTimePicker Text="{Binding CurveStartDateTime,Mode=TwoWay}" Width="169" Height="30"/>
|
||||
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0">-</TextBlock>
|
||||
<hc:DateTimePicker Text="{Binding CurveEndDateTime,Mode=TwoWay}" Margin="5,0,0,0" Width="169" Height="30"/>
|
||||
<Label Height="30" Content="托盘条码:" Foreground="Black" Style="{StaticResource BaseStyle}" Margin="20,10,0,0" VerticalAlignment="Top" Width="60" />
|
||||
<hc:TextBox Width="100" Height="30" Text="{Binding Code,Mode=TwoWay}" Margin="0,0,20,0"></hc:TextBox>
|
||||
|
||||
<Button Content="查询温度" Style="{StaticResource ButtonSuccess}" Margin="4" Width="80" Command="{Binding QueryTempCommand}"/>
|
||||
<Button Content="查询PID" Style="{StaticResource ButtonSuccess}" Margin="4,4,60,4" Width="80" Command="{Binding QueryPIDCommand}"/>
|
||||
<Button Content="压力曲线" Style="{StaticResource ButtonSuccess}" Margin="4" Width="80" Command="{Binding ChartVacuumCommand}"/>
|
||||
<Button Content="温度曲线" Style="{StaticResource ButtonSuccess}" Margin="4" Width="80" Command="{Binding ChartTempCommand}"/>
|
||||
<Button Content="PID曲线" Style="{StaticResource ButtonSuccess}" Margin="4" Width="80" Command="{Binding ChartPIDCommand}"/>
|
||||
<ToggleButton Content="选择" IsChecked="{Binding IsOpen,ElementName=DrawerTopInContainer}" Margin="30,0,0,0"/>
|
||||
</StackPanel>
|
||||
|
||||
<hc:Drawer Name="DrawerTopInContainer" Dock="Top" ShowMode="Press">
|
||||
<Border Background="{DynamicResource RegionBrush}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<DataGrid Grid.Row="1" Grid.Column="0" hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="Column" RowHeaderWidth="60" AutoGenerateColumns="False" ItemsSource="{Binding DataList}" Margin="8">
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}" Header="温度类型"/>
|
||||
<DataGridCheckBoxColumn Width="100" CanUserResize="False" Binding="{Binding IsSelected,Mode=TwoWay}" Header="查询"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Command="hc:ControlCommands.Close" Grid.Row="0" HorizontalAlignment="Right" Foreground="{DynamicResource PrimaryTextBrush}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</hc:Drawer>
|
||||
|
||||
<lvc:CartesianChart Series="{Binding SeriesCollection}" Grid.Row="1" LegendLocation="Right"
|
||||
DisableAnimations="True"
|
||||
Hoverable="False"
|
||||
DataTooltip="{x:Null}">
|
||||
<lvc:CartesianChart.AxisX>
|
||||
<lvc:Axis Title="{Binding XName}" FontSize="12" Labels="{Binding TimeLine}">
|
||||
<lvc:Axis.Separator>
|
||||
<lvc:Separator Step="{Binding StepId}" />
|
||||
</lvc:Axis.Separator>
|
||||
</lvc:Axis>
|
||||
</lvc:CartesianChart.AxisX>
|
||||
|
||||
<lvc:CartesianChart.AxisY>
|
||||
<lvc:Axis Title="{Binding YName}" FontSize="12"/>
|
||||
</lvc:CartesianChart.AxisY>
|
||||
</lvc:CartesianChart>
|
||||
</Grid>
|
||||
</hc:DrawerContainer>
|
||||
</hc:SimplePanel>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="温度数据" >
|
||||
<Grid Background="#FFE5E5E5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
|
||||
<Button Content="导出" Style="{StaticResource ButtonInfo}" Command="{Binding ExportTempCommand}" Margin="20,0,0,0" Width="80" />
|
||||
</StackPanel>
|
||||
<DataGrid Style="{StaticResource DataGrid.Small}" AutoGenerateColumns="False" ItemsSource="{Binding DtTemp,UpdateSourceTrigger=PropertyChanged}"
|
||||
Height="Auto" Width="Auto" Grid.Row="1">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="时间" Width="170" Binding="{Binding CreateTime}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="烘烤位置" Width="120" Binding="{Binding CavityId,Converter={StaticResource CavityInfoIdConverter}}"/>
|
||||
<DataGridTextColumn Header="压力" Width="80" Binding="{Binding Vacuum}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="温度1" Width="80" Binding="{Binding 温度1}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="温度2" Width="80" Binding="{Binding 温度2}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="温度3" Width="80" Binding="{Binding 温度3}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="温度4" Width="80" Binding="{Binding 温度4}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="温度5" Width="80" Binding="{Binding 温度5}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="温度6" Width="80" Binding="{Binding 温度6}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="温度7" Width="80" Binding="{Binding 温度7}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="温度8" Width="80" Binding="{Binding 温度8}"></DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="PID数据" >
|
||||
<Grid Background="#FFE5E5E5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
|
||||
<Button Content="导出" Style="{StaticResource ButtonInfo}" Command="{Binding ExportPIDCommand}" Margin="20,0,0,0" Width="80" />
|
||||
</StackPanel>
|
||||
<DataGrid Style="{StaticResource DataGrid.Small}" AutoGenerateColumns="False" ItemsSource="{Binding DtPID,UpdateSourceTrigger=PropertyChanged}"
|
||||
Height="Auto" Width="Auto" Grid.Row="1" >
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="时间" Width="170" Binding="{Binding CreateTime}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="烘烤位置" Width="120" Binding="{Binding CavityId,Converter={StaticResource CavityInfoIdConverter}}"/>
|
||||
<DataGridTextColumn Header="PID1" Width="80" Binding="{Binding PID1}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="PID2" Width="80" Binding="{Binding PID2}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="PID3" Width="80" Binding="{Binding PID3}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="PID4" Width="80" Binding="{Binding PID4}"></DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
29
Cowain.Bake.UI/DataQuery/Views/CurveView.xaml.cs
Normal file
29
Cowain.Bake.UI/DataQuery/Views/CurveView.xaml.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.DataQuery.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Curve.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CurveView : UserControl
|
||||
{
|
||||
private IUnityContainer _unityContainer;
|
||||
public CurveView(IUnityContainer unityContainer)
|
||||
{
|
||||
InitializeComponent();
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
private void CheckComboBox_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Cowain.Bake.UI/DataQuery/Views/DummyInfoView.xaml
Normal file
47
Cowain.Bake.UI/DataQuery/Views/DummyInfoView.xaml
Normal file
@@ -0,0 +1,47 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.DataQuery.Views.DummyInfoView"
|
||||
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.DataQuery.Views"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
d:DesignHeight="450" d:DesignWidth="950">
|
||||
<UserControl.Resources>
|
||||
<convertor:BatteryStatusConvertor x:Key="cellStatusConvertor"></convertor:BatteryStatusConvertor>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="2,10,10,10" HorizontalAlignment="Right" >
|
||||
<TextBlock Text="电芯条码:" VerticalAlignment="Center" Margin="4"/>
|
||||
<hc:TextBox Width="150" Height="30" Margin="0,0,10,0" Text="{Binding Code,Mode=TwoWay}"></hc:TextBox>
|
||||
<Button Content="查询" Style="{StaticResource ButtonSuccess}" Margin="4" Width="100" Command="{Binding DummyQueryCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvStation" Grid.Row="1"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="True"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding CellList,UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="150" CanUserResize="False" Binding="{Binding ScanTime, StringFormat=yyyy-MM-dd HH:mm:ss}" Header="扫码时间"/>
|
||||
<DataGridTextColumn Width="210" CanUserResize="False" Binding="{Binding BatteryCode}" Header="电芯条码"/>
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding PalletCode}" Header="托盘条码"/>
|
||||
<DataGridTextColumn Width="150" Binding="{Binding BakingLocation}" Header="烘烤位置" />
|
||||
<DataGridTextColumn Width="150" Binding="{Binding BakingBeginTime, StringFormat=yyyy-MM-dd HH:mm:ss}" Header="烘烤开始时间" Visibility="Visible"/>
|
||||
<DataGridTextColumn Width="150" Binding="{Binding BakingOverTime, StringFormat=yyyy-MM-dd HH:mm:ss}" Header="烘烤结束时间" Visibility="Visible"/>
|
||||
<DataGridTextColumn Width="80" CanUserResize="False" Binding="{Binding AnodeValue}" Header="正极水分"/>
|
||||
<DataGridTextColumn Width="80" CanUserResize="False" Binding="{Binding SeptumValue}" Header="隔膜水分"/>
|
||||
<DataGridTextColumn Width="80" CanUserResize="False" Binding="{Binding CathodeValue}" Header="负极水分"/>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/DataQuery/Views/DummyInfoView.xaml.cs
Normal file
28
Cowain.Bake.UI/DataQuery/Views/DummyInfoView.xaml.cs
Normal file
@@ -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.DataQuery.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DummyInfoView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DummyInfoView : UserControl
|
||||
{
|
||||
public DummyInfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
56
Cowain.Bake.UI/DataQuery/Views/GetMesLogView.xaml
Normal file
56
Cowain.Bake.UI/DataQuery/Views/GetMesLogView.xaml
Normal file
@@ -0,0 +1,56 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.DataQuery.Views.GetMesLogView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.DataQuery.Views"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Height="auto" Width="auto">
|
||||
<UserControl.Resources>
|
||||
<convertor:SendFlagConvertor x:Key="sendFlagConvertor"></convertor:SendFlagConvertor>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="55"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<WrapPanel >
|
||||
<TextBlock VerticalAlignment="Center" Margin="5,10,0,0">日期时间:</TextBlock>
|
||||
<hc:DateTimePicker x:Name="StartTime" Text="{Binding StartDatetime,Mode=TwoWay}" Margin="5,10,0,0" Width="160"/>
|
||||
<TextBlock VerticalAlignment="Center" Margin="0,10,0,0">-</TextBlock>
|
||||
<hc:DateTimePicker x:Name="EndTime" Text="{Binding EndDatetime,Mode=TwoWay}" Margin="0,10,0,0" Width="160"></hc:DateTimePicker>
|
||||
<TextBlock Text="MOM信息类别:" VerticalAlignment="Center" Margin="4,10,0,0"/>
|
||||
<ComboBox x:Name="palletCode" SelectedValue="{Binding MesClass,Mode=TwoWay}" ItemsSource="{Binding MesClassList}" Margin="5,10,0,0" FontWeight="Bold" IsReadOnly="True" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="120"/>
|
||||
<CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" FontWeight="Bold" Margin="10,10,0,0" Content="条码(时间组合)"/>
|
||||
<TextBlock Text="电芯条码:" VerticalAlignment="Center" Margin="0,10,0,0"/>
|
||||
<TextBox Text="{Binding BatteryCode,Mode=TwoWay}" Margin="5,10,0,0" Width="190"/>
|
||||
<Button Content="查询" Style="{StaticResource ButtonSuccess}" Margin="4,10,0,0" Width="45" Command="{Binding QueryCommand}"/>
|
||||
<Button Content="导出" Style="{StaticResource ButtonPrimary}" Margin="4,10,0,0" Width="45" Command="{Binding GetMesCvsCommand}"/>
|
||||
<Button Content="自动上传" Visibility="Collapsed" Command="{Binding AutoUploadCommand}" Style="{StaticResource ButtonSuccess}" VerticalAlignment="Top" Width="68" Margin="4,10,0,0"/>
|
||||
</WrapPanel>
|
||||
|
||||
|
||||
<DataGrid HorizontalAlignment="Left" Grid.Row="1" AutoGenerateColumns="False" IsReadOnly="True"
|
||||
ItemsSource="{Binding MesDataList,Mode=TwoWay}" Height="auto" VerticalAlignment="Top" Width="auto">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding CreateTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="创建时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding SendTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="发送时间" />
|
||||
<DataGridTextColumn Width="160" Binding="{Binding BatteryCode}" Header="电芯条码" />
|
||||
<DataGridTextColumn Binding="{Binding Content}" Width="*" Header="发送信息" />
|
||||
<DataGridTextColumn Binding="{Binding RecvContent}" Width="350" Header="接收信息"/>
|
||||
<DataGridTextColumn Header="上传状态" Width="auto" Binding="{Binding SendFlag, Converter={StaticResource sendFlagConvertor}}"></DataGridTextColumn>
|
||||
<DataGridTemplateColumn Header="上传勾选">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding Path=IsCheck, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/DataQuery/Views/GetMesLogView.xaml.cs
Normal file
28
Cowain.Bake.UI/DataQuery/Views/GetMesLogView.xaml.cs
Normal file
@@ -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.DataQuery.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// GetMesLog.xaml µÄ½»»¥Âß¼
|
||||
/// </summary>
|
||||
public partial class GetMesLogView : UserControl
|
||||
{
|
||||
public GetMesLogView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
67
Cowain.Bake.UI/DataQuery/Views/IncomingCellInfoView.xaml
Normal file
67
Cowain.Bake.UI/DataQuery/Views/IncomingCellInfoView.xaml
Normal file
@@ -0,0 +1,67 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.DataQuery.Views.IncomingCellInfoView"
|
||||
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:bllConverter="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
xmlns:CommonConverter="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.DataQuery.Views"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
<UserControl.Resources>
|
||||
<bllConverter:PalletVirtualIdConverter x:Key="CPalletCode"/>
|
||||
<CommonConverter:BatteryStatusConvertor x:Key="CBatteryStatus"/>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="2,10,10,10" HorizontalAlignment="Right" >
|
||||
<TextBlock VerticalAlignment="Center" Margin="4">日期时间:</TextBlock>
|
||||
<hc:DateTimePicker x:Name="StartTime" Text="{Binding StartDatetime,Mode=TwoWay}" Margin="10,5,0,0" Width="163"/>
|
||||
<TextBlock VerticalAlignment="Center">-</TextBlock>
|
||||
<hc:DateTimePicker x:Name="EndTime" Text="{Binding EndDatetime,Mode=TwoWay}" Width="163"></hc:DateTimePicker>
|
||||
<TextBlock Text="电芯条码:" VerticalAlignment="Center" Margin="60,4,4,4"/>
|
||||
<hc:TextBox Width="150" Height="30" Margin="0,0,10,0" Text="{Binding Code,Mode=TwoWay}"></hc:TextBox>
|
||||
|
||||
<Button Content="查询" Style="{StaticResource ButtonSuccess}" Margin="4" Width="100" Command="{Binding QueryCommand}"/>
|
||||
<Button Content="导出" Style="{StaticResource ButtonPrimary}" Margin="4" Width="100" Command="{Binding ExportCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvStation" Grid.Row="1"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="True"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding CellList,UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding Id}" Header="序号"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding BatteryCode}" Header="电芯条码"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding BatteryStatus,Converter={StaticResource CBatteryStatus}}" Header="电芯状态"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding PalletVirtualId ,Converter={StaticResource CPalletCode}}" Header="夹具条码"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding PositionX}" Header="夹具行号"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding PositionY}" Header="夹具列号"/>
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding ScanTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="扫码时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding BindingTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="绑定时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding UnbindingTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="解绑时间" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding DummyFlag}" Header="假电芯" />
|
||||
<DataGridTemplateColumn Header="操作" Width="80">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBlock Margin="3,0" >
|
||||
<Hyperlink Foreground="Red" Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding}">删除</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/DataQuery/Views/IncomingCellInfoView.xaml.cs
Normal file
28
Cowain.Bake.UI/DataQuery/Views/IncomingCellInfoView.xaml.cs
Normal file
@@ -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.DataQuery.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// IncomingCellInfoView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class IncomingCellInfoView : UserControl
|
||||
{
|
||||
public IncomingCellInfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Cowain.Bake.UI/DataQuery/Views/NGCellInfoView.xaml
Normal file
60
Cowain.Bake.UI/DataQuery/Views/NGCellInfoView.xaml
Normal file
@@ -0,0 +1,60 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.DataQuery.Views.NGCellInfoView"
|
||||
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.DataQuery.Views"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="2,10,10,10" HorizontalAlignment="Right" >
|
||||
<TextBlock VerticalAlignment="Center" Margin="4">日期时间:</TextBlock>
|
||||
<hc:DateTimePicker Height="30" x:Name="StartTime" Text="{Binding StartDatetime,Mode=TwoWay}" Width="163"></hc:DateTimePicker>
|
||||
<TextBlock VerticalAlignment="Center">-</TextBlock>
|
||||
<hc:DateTimePicker Height="30" x:Name="EndTime" Text="{Binding EndDatetime,Mode=TwoWay}" Width="163"></hc:DateTimePicker>
|
||||
<TextBlock Text="电芯条码:" VerticalAlignment="Center" Margin="30,4,4,4"/>
|
||||
<hc:TextBox Width="150" Height="30" Margin="0,0,10,0" Text="{Binding Code,Mode=TwoWay}"></hc:TextBox>
|
||||
<TextBlock Text="托盘条码:" VerticalAlignment="Center" Margin="30,4,4,4"/>
|
||||
<hc:TextBox Width="150" Height="30" Margin="0,0,10,0" Text="{Binding PalletCode,Mode=TwoWay}"></hc:TextBox>
|
||||
<Button Content="查询" Style="{StaticResource ButtonSuccess}" Margin="4" Width="100" Command="{Binding QueryCommand}"/>
|
||||
<Button Content="导出" Style="{StaticResource ButtonSuccess}" Margin="4" Width="100" Command="{Binding ExportCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvStation" Grid.Row="1"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="True"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding CellList,UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="50" CanUserResize="False" Binding="{Binding Id}" Header="序号"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding BatteryCode}" Header="电芯条码"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding PalletCode}" Header="托盘条码"/>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Desc}" Width="auto" Header="描述"/>
|
||||
<DataGridTextColumn Width="*" Binding="{Binding CreateTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="报警时间" />
|
||||
<DataGridTemplateColumn Header="操作" Width="80">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBlock Margin="3,0" >
|
||||
<Hyperlink Foreground="Red" Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding}">删除</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/DataQuery/Views/NGCellInfoView.xaml.cs
Normal file
28
Cowain.Bake.UI/DataQuery/Views/NGCellInfoView.xaml.cs
Normal file
@@ -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.DataQuery.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// NGCellInfoView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class NGCellInfoView : UserControl
|
||||
{
|
||||
public NGCellInfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
72
Cowain.Bake.UI/DataQuery/Views/PalletInfoView.xaml
Normal file
72
Cowain.Bake.UI/DataQuery/Views/PalletInfoView.xaml
Normal file
@@ -0,0 +1,72 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.DataQuery.Views.PalletInfoView"
|
||||
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.DataQuery.Views"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
xmlns:commonConvertor="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontSize" Value="15"/>
|
||||
</Style>
|
||||
<commonConvertor:DummyStatusConvertor x:Key="DummyStatusConvertor"/>
|
||||
<commonConvertor:PalletStatusConvertor x:Key="PalletStatusConvertor"/>
|
||||
<convertor:CavityInfoIdConverter x:Key="CavityInfoIdConverter"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="2,10,10,10" HorizontalAlignment="Right" >
|
||||
<TextBlock VerticalAlignment="Center" Margin="4">日期时间:</TextBlock>
|
||||
<hc:DateTimePicker Height="30" x:Name="StartTime" Text="{Binding StartDatetime,Mode=TwoWay}" Width="163"></hc:DateTimePicker>
|
||||
<TextBlock VerticalAlignment="Center">-</TextBlock>
|
||||
<hc:DateTimePicker Height="30" x:Name="EndTime" Text="{Binding EndDatetime,Mode=TwoWay}" Width="163"></hc:DateTimePicker>
|
||||
<TextBlock Text="托盘条码:" VerticalAlignment="Center" Margin="4"/>
|
||||
<hc:TextBox Width="150" Height="30" Margin="0,0,10,0" Text="{Binding Code,Mode=TwoWay}"></hc:TextBox>
|
||||
|
||||
<Button Content="查询" Style="{StaticResource ButtonSuccess}" Margin="4" Width="100" Command="{Binding QueryCommand}"/>
|
||||
<Button Content="导出" Style="{StaticResource ButtonPrimary}" Margin="4" Width="100" Command="{Binding ExportCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvStation" Grid.Row="1"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="True"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding PalletList,UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding Id}" Header="序号"/>
|
||||
<DataGridTextColumn Header="托盘条码" Width="auto" Binding="{Binding PalletCode}"/>
|
||||
<DataGridTextColumn Header="托盘状态" Width="100" Binding="{Binding PalletStatus,Converter={StaticResource PalletStatusConvertor}}" />
|
||||
<!--<DataGridTextColumn Header="带水状态" Width="100" Binding="{Binding DummyStatus,Converter={StaticResource DummyStatusConvertor}}"/>-->
|
||||
<DataGridTextColumn Header="电芯数量" Width="80" Binding="{Binding BatteryQty}"/>
|
||||
<DataGridTextColumn Header="烘烤次数" Width="80" Binding="{Binding BakingCount}"/>
|
||||
<DataGridTextColumn Header="烘烤位置" Width="150" Binding="{Binding BakingPosition,Converter={StaticResource CavityInfoIdConverter}}"/>
|
||||
<DataGridTextColumn Header="扫码时间" Width="auto" Binding="{Binding ScanTime,StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"/>
|
||||
<DataGridTextColumn Header="上料完成时间" Width="auto" Binding="{Binding LoadingOverTime,StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"/>
|
||||
<DataGridTextColumn Header="入炉时间" Width="auto" Binding="{Binding InStoveTime,StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"/>
|
||||
<DataGridTextColumn Header="开始烘烤时间" Width="auto" Binding="{Binding BakingBeginTime,StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"/>
|
||||
<DataGridTextColumn Header="烘烤完成时间" Width="auto" Binding="{Binding BakingOverTime,StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"/>
|
||||
<DataGridTextColumn Header="出炉时间" Width="150" Binding="{Binding OutStoveTime,StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"/>
|
||||
<DataGridTextColumn Header="工单号" Width="auto" Binding="{Binding JobNum}"/>
|
||||
|
||||
<DataGridTemplateColumn Header="操作" Width="80">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBlock Margin="3,0" >
|
||||
<Hyperlink Foreground="Red" Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding}">删除</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/DataQuery/Views/PalletInfoView.xaml.cs
Normal file
28
Cowain.Bake.UI/DataQuery/Views/PalletInfoView.xaml.cs
Normal file
@@ -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.DataQuery.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// PalletInfoView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PalletInfoView : UserControl
|
||||
{
|
||||
public PalletInfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Cowain.Bake.UI/DataQuery/Views/ProductionsInfoView.xaml
Normal file
42
Cowain.Bake.UI/DataQuery/Views/ProductionsInfoView.xaml
Normal file
@@ -0,0 +1,42 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.DataQuery.Views.ProductionsInfoView"
|
||||
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.DataQuery.Views"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="2,10,10,10" HorizontalAlignment="Right" >
|
||||
<TextBlock VerticalAlignment="Center" Margin="4">时间:</TextBlock>
|
||||
<hc:DateTimePicker Height="30" Width="170" Text="{Binding StartDateTime,Mode=OneWayToSource}" DateTimeFormat="yyyy-MM-dd"></hc:DateTimePicker>
|
||||
<TextBlock VerticalAlignment="Center">-</TextBlock>
|
||||
<hc:DateTimePicker Height="30" Width="170" Text="{Binding EndDateTime,Mode=OneWayToSource}" DateTimeFormat="yyyy-MM-dd"></hc:DateTimePicker>
|
||||
<Button Content="查询" Style="{StaticResource ButtonSuccess}" Margin="4" Width="100" Command="{Binding QueryCommand}"/>
|
||||
</StackPanel>
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvStation" Grid.Row="1"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="True"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding ProductionList,UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="日期" Width="100" Binding="{Binding ProductionDate}"/>
|
||||
<DataGridTextColumn Header="白班产量" Width="120" Binding="{Binding DayOutput}"/>
|
||||
<DataGridTextColumn Header="白班投入" Width="120" Binding="{Binding DayInput}"/>
|
||||
<DataGridTextColumn Header="白班NG" Width="120" Binding="{Binding DayNG}"/>
|
||||
<DataGridTextColumn Header="白班合格率(%)" Width="120" Binding="{Binding DayNGRate}"/>
|
||||
<DataGridTextColumn Header="晚班产量" Width="120" Binding="{Binding NightOutput}"/>
|
||||
<DataGridTextColumn Header="晚班投入" Width="120" Binding="{Binding NightInput}"/>
|
||||
<DataGridTextColumn Header="晚班NG" Width="120" Binding="{Binding NightNG}"/>
|
||||
<DataGridTextColumn Header="晚班合格率(%)" Width="120" Binding="{Binding NightNGRate}"/>
|
||||
<DataGridTextColumn Header="白班时间段" Width="300" Binding="{Binding DayWorkTime}"/>
|
||||
<DataGridTextColumn Header="晚班时间段" Width="300" Binding="{Binding NightWorkTime}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/DataQuery/Views/ProductionsInfoView.xaml.cs
Normal file
28
Cowain.Bake.UI/DataQuery/Views/ProductionsInfoView.xaml.cs
Normal file
@@ -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.DataQuery.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ProductionsInfoView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ProductionsInfoView : UserControl
|
||||
{
|
||||
public ProductionsInfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
56
Cowain.Bake.UI/Helper/ViewModels/AboutWindowViewModel.cs
Normal file
56
Cowain.Bake.UI/Helper/ViewModels/AboutWindowViewModel.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.Helper.ViewModels
|
||||
{
|
||||
public class AboutWindowViewModel : ViewModelBase
|
||||
{
|
||||
private string windowTitle = $"About - {Global.VS}";
|
||||
public string WindowTitle
|
||||
{
|
||||
get => windowTitle;
|
||||
set => SetProperty(ref windowTitle, value);
|
||||
}
|
||||
|
||||
private string heading = $"{SettingProvider.Instance.ProductionLineName}";
|
||||
public string Heading
|
||||
{
|
||||
get => heading;
|
||||
set => SetProperty(ref heading, value);
|
||||
}
|
||||
private string notes ;
|
||||
public string Notes
|
||||
{
|
||||
get => notes;
|
||||
set => SetProperty(ref notes, value);
|
||||
}
|
||||
|
||||
public AboutWindowViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "文件版本";
|
||||
LoadData();
|
||||
}
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
string content = File.ReadAllText("Notes.txt");
|
||||
if (content != null)
|
||||
{
|
||||
Notes = content;
|
||||
}
|
||||
else
|
||||
{
|
||||
Notes = "No release notes available.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Cowain.Bake.UI/Helper/ViewModels/HelpWindowViewModel.cs
Normal file
21
Cowain.Bake.UI/Helper/ViewModels/HelpWindowViewModel.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Cowain.Bake.Common;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.Helper.ViewModels
|
||||
{
|
||||
public class HelpWindowViewModel : ViewModelBase
|
||||
{
|
||||
public HelpWindowViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "帮助手册";
|
||||
_unityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Cowain.Bake.UI/Helper/Views/AboutWindowView.xaml
Normal file
26
Cowain.Bake.UI/Helper/Views/AboutWindowView.xaml
Normal file
@@ -0,0 +1,26 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.Helper.Views.AboutWindowView"
|
||||
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.Helper.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<DockPanel Margin="0">
|
||||
<!-- 标题 & 版本 -->
|
||||
<TextBlock DockPanel.Dock="Top" FontSize="18" FontWeight="SemiBold"
|
||||
Text="{Binding Heading}" Margin="0 0 0 10"/>
|
||||
|
||||
<TextBlock DockPanel.Dock="Top" FontSize="18" FontWeight="SemiBold"
|
||||
Text="{Binding WindowTitle}" Margin="0 0 0 10"/>
|
||||
<!-- Release Notes -->
|
||||
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto">
|
||||
|
||||
<TextBlock Text="{Binding Notes}"
|
||||
TextWrapping="Wrap"
|
||||
FontFamily="Consolas" FontSize="16"/>
|
||||
</ScrollViewer>
|
||||
|
||||
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/Helper/Views/AboutWindowView.xaml.cs
Normal file
28
Cowain.Bake.UI/Helper/Views/AboutWindowView.xaml.cs
Normal file
@@ -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.Helper.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// AboutWindowView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AboutWindowView : UserControl
|
||||
{
|
||||
public AboutWindowView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml
Normal file
14
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.Helper.Views.HelpWindowView"
|
||||
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.Helper.Views"
|
||||
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
<Grid>
|
||||
<WebBrowser x:Name="webBrowser"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
31
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml.cs
Normal file
31
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Spire.Doc;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace Cowain.Bake.UI.Helper.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// HelpWindowView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class HelpWindowView : System.Windows.Controls.UserControl
|
||||
{
|
||||
public HelpWindowView()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadWordAsHtml(".\\doc.docx");
|
||||
}
|
||||
|
||||
private void LoadWordAsHtml(string filePath)
|
||||
{
|
||||
Document doc = new Document();
|
||||
doc.LoadFromFile(filePath);
|
||||
|
||||
// 转换为HTML
|
||||
string tempHtml = Path.Combine(Path.GetTempPath(), "temp.html");
|
||||
doc.SaveToFile(tempHtml, FileFormat.Html);
|
||||
|
||||
// 显示在WebBrowser
|
||||
webBrowser.Navigate(tempHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Cowain.Bake.UI/Home/ViewModels/DataInfo.cs
Normal file
21
Cowain.Bake.UI/Home/ViewModels/DataInfo.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.UI.Home
|
||||
{
|
||||
public class DataInfo
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private static string checkvalue;
|
||||
public static string Checkvalue
|
||||
{
|
||||
get { return checkvalue; }
|
||||
set { checkvalue = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
126
Cowain.Bake.UI/Home/ViewModels/LoginViewModel.cs
Normal file
126
Cowain.Bake.UI/Home/ViewModels/LoginViewModel.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
//using Cowain.Bake.Common.Service;
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Common.Interface;
|
||||
using Prism.Commands;
|
||||
using Prism.Ioc;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.Home.ViewModels
|
||||
{
|
||||
public class LoginViewModel : BindableBase
|
||||
{
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
//private readonly IRegionManager _regionManager;
|
||||
|
||||
public LoginViewModel(IUnityContainer unityContainer/*, IRegionManager regionManager*/)
|
||||
{
|
||||
//初始化数据库连接池
|
||||
_unityContainer = unityContainer;
|
||||
//_regionManager = regionManager;
|
||||
//ConfigInfo.InitConfigParm(_unityContainer);
|
||||
Global.STOVE_LAYERS = _unityContainer.Resolve<MemoryDataProvider>().AllStation.Find(x => x.Type == (int)EStationType.Stove).Layers;
|
||||
}
|
||||
|
||||
private string _userName = "TEST12132";
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get { return _userName; }
|
||||
set { SetProperty<string>(ref _userName, value); }
|
||||
}
|
||||
|
||||
|
||||
private string _password = "123456";
|
||||
|
||||
public string Password
|
||||
{
|
||||
get { return _password; }
|
||||
set { SetProperty<string>(ref _password, value); }
|
||||
}
|
||||
|
||||
private string _errorMsg;
|
||||
|
||||
public string ErrorMsg
|
||||
{
|
||||
get { return _errorMsg; }
|
||||
set { SetProperty<string>(ref _errorMsg, value); }
|
||||
}
|
||||
|
||||
|
||||
// 登录命令
|
||||
public ICommand LoginCommand
|
||||
{
|
||||
get => new DelegateCommand<object>(OnLogin);
|
||||
}
|
||||
public static bool loginFlag = false;
|
||||
private async void OnLogin(object obj)
|
||||
{
|
||||
string msg = "";
|
||||
try
|
||||
{
|
||||
this.ErrorMsg = "" ;
|
||||
if (string.IsNullOrEmpty(this.UserName))
|
||||
{
|
||||
this.ErrorMsg = "请输入用户名!";
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.Password))
|
||||
{
|
||||
this.ErrorMsg = "请输入密码!";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var loginTask = Task.Run(() => _unityContainer.Resolve<UserService>().Login(this.UserName, this.Password, out msg));
|
||||
var timeouttask = Task.Delay(8000);
|
||||
var completedTask = await Task.WhenAny(loginTask, timeouttask);
|
||||
if (completedTask == timeouttask)
|
||||
{
|
||||
this.ErrorMsg = "连接数据库超时,请联系管理员!";
|
||||
}
|
||||
else
|
||||
{
|
||||
var task = await loginTask;
|
||||
if (task == true && !loginFlag)
|
||||
{
|
||||
loginFlag = true;
|
||||
this.ErrorMsg = "登录成功 . . .";
|
||||
(obj as Window).DialogResult = true;
|
||||
}
|
||||
else if (task == true && loginFlag)//切换用户
|
||||
{
|
||||
_unityContainer.Resolve<ICommonFun>().InitWindows();
|
||||
(obj as Window).DialogResult = true;
|
||||
(obj as Window).Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(msg))
|
||||
{
|
||||
this.ErrorMsg = msg;
|
||||
}
|
||||
else if (!loginFlag)
|
||||
{
|
||||
this.ErrorMsg = "登录失败,用户名或密码错误. . .";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ErrorMsg = "切换用户失败,用户名或密码错误. . .";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.ErrorMsg = "登录失败!" + ex.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
68
Cowain.Bake.UI/Home/ViewModels/ModifyPassWordViewModel.cs
Normal file
68
Cowain.Bake.UI/Home/ViewModels/ModifyPassWordViewModel.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.Home.ViewModels
|
||||
{
|
||||
public class ModifyPassWordViewModel : BindableBase
|
||||
{
|
||||
|
||||
private string newPassWord;
|
||||
public string NewPassWord
|
||||
{
|
||||
get => newPassWord;
|
||||
set => SetProperty(ref newPassWord, value);
|
||||
}
|
||||
|
||||
private string checkPassWord;
|
||||
public string CheckPassWord
|
||||
{
|
||||
get => checkPassWord;
|
||||
set => SetProperty(ref checkPassWord, value);
|
||||
}
|
||||
|
||||
private string oldPassWord;
|
||||
public string OldPassWord
|
||||
{
|
||||
get => oldPassWord;
|
||||
set => SetProperty(ref oldPassWord, value);
|
||||
}
|
||||
|
||||
IUnityContainer _unityContainer;
|
||||
public ModifyPassWordViewModel(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public DelegateCommand<object> ModifyCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
var memory = _unityContainer.Resolve<MemoryDataProvider>();
|
||||
if (!_unityContainer.Resolve<UserService>().ValidPassword(memory.CurrentUser.UserId, OldPassWord))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning($"旧密码不正确,请重新输入!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (NewPassWord != CheckPassWord)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("新密码和验证密码不匹配,请重新输入!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 == _unityContainer.Resolve<UserService>().ModifyPassword(NewPassWord))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("修改密码失败!");
|
||||
return;
|
||||
}
|
||||
|
||||
LogHelper.Instance.Info($"用户:{memory.CurrentUser.UserId}, 修改密码成功!", true);
|
||||
});
|
||||
}
|
||||
}
|
||||
328
Cowain.Bake.UI/Home/ViewModels/ProcessParametersViewModel.cs
Normal file
328
Cowain.Bake.UI/Home/ViewModels/ProcessParametersViewModel.cs
Normal file
@@ -0,0 +1,328 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Model;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using HandyControl.Controls;
|
||||
using Newtonsoft.Json;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using Unity;
|
||||
using static Cowain.Bake.Common.Models.MESModel;
|
||||
|
||||
namespace Cowain.Bake.UI.Home.ViewModels
|
||||
{
|
||||
public class ProcessParametersViewModel : ViewModelBase, INavigationAware
|
||||
{
|
||||
private List<string> processParamNames;
|
||||
public List<string> ProcessParamNames
|
||||
{
|
||||
get => processParamNames;
|
||||
set => SetProperty(ref processParamNames, value);
|
||||
}
|
||||
|
||||
private string selectedProcessParamName;
|
||||
public string SelectedProcessParamName
|
||||
{
|
||||
get => selectedProcessParamName;
|
||||
//set => SetProperty(ref selectedProcessParam, value);
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedProcessParamName, value);
|
||||
SelectionProcessParamChanged(value); //选择了配方,参数也要跟着变
|
||||
}
|
||||
}
|
||||
|
||||
private string newProcessParamName;
|
||||
public string NewProcessParamName
|
||||
{
|
||||
get => newProcessParamName;
|
||||
set => SetProperty(ref newProcessParamName, value);
|
||||
}
|
||||
|
||||
private bool isAllowed;
|
||||
public bool IsAllowed
|
||||
{
|
||||
get => isAllowed;
|
||||
set => SetProperty(ref isAllowed, value);
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler NotifyPropertyChanged;
|
||||
public void OnPropertyChanged(string propName)
|
||||
{
|
||||
if (NotifyPropertyChanged != null)
|
||||
{
|
||||
NotifyPropertyChanged.Invoke(this, new PropertyChangedEventArgs(propName));
|
||||
}
|
||||
}
|
||||
|
||||
//参数列表
|
||||
private ObservableCollection<EqptParameterModel> paramList;
|
||||
public ObservableCollection<EqptParameterModel> ParamList
|
||||
{
|
||||
get => paramList ?? (paramList = new ObservableCollection<EqptParameterModel>());
|
||||
set
|
||||
{
|
||||
if (value != paramList)
|
||||
{
|
||||
paramList = value;
|
||||
OnPropertyChanged(nameof(ParamList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<WorkStepEntity> workStepList;
|
||||
public ObservableCollection<WorkStepEntity> WorkStepList
|
||||
{
|
||||
get => workStepList ?? (workStepList = new ObservableCollection<WorkStepEntity>());
|
||||
set
|
||||
{
|
||||
if (value != workStepList)
|
||||
{
|
||||
workStepList = value;
|
||||
OnPropertyChanged(nameof(WorkStepList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TProcessParameter SelectProcessParam = null;
|
||||
List<EqptParameterModel> OperNodes = null;
|
||||
|
||||
public ProcessParametersViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "配方参数";
|
||||
Refresh();
|
||||
isAllowed = unityContainer.Resolve<UserService>().CheckPermission(ERole.Mantainer);
|
||||
}
|
||||
|
||||
private void SelectionProcessParamChanged(string processParamName)
|
||||
{
|
||||
SelectProcessParam = _unityContainer.Resolve<ProcessParamService>().QueryFormula(processParamName).FirstOrDefault();
|
||||
if (null != SelectProcessParam)
|
||||
{
|
||||
ParamList.Clear();
|
||||
WorkStepList.Clear();
|
||||
OperNodes = JsonConvert.DeserializeObject<List<EqptParameterModel>>(SelectProcessParam.Parameters);
|
||||
// Application.Current.Dispatcher.Invoke(() =>
|
||||
//{
|
||||
ParamList.AddRange(OperNodes); //现场耗时0.3S,本机耗时2S
|
||||
//});
|
||||
|
||||
List<WorkStepEntity> workSteps = GetWorkStepData(OperNodes);
|
||||
WorkStepList.AddRange(workSteps);
|
||||
}
|
||||
}
|
||||
|
||||
List<WorkStepEntity> GetWorkStepData(List<EqptParameterModel> ops)
|
||||
{
|
||||
List<WorkStepEntity> workSteps = new List<WorkStepEntity>();
|
||||
workSteps.Add(SetSingleData(EStovePLC.HeatingEnabled.ToString(), EStovePLC.HeatingEnabled.GetDescription(), ops) );
|
||||
workSteps.Add(SetSingleData(EStovePLC.VacuumEnabled.ToString().ToString(), EStovePLC.VacuumEnabled.GetDescription(), ops));
|
||||
workSteps.Add(SetSingleData(EStovePLC.NitrogenEnabled.ToString(), EStovePLC.NitrogenEnabled.GetDescription(), ops));
|
||||
workSteps.Add(SetSingleData(EStovePLC.StepWorkTime.ToString(), EStovePLC.StepWorkTime.GetDescription(), ops));
|
||||
return workSteps;
|
||||
}
|
||||
|
||||
WorkStepEntity SetSingleData(string key, string desc, List<EqptParameterModel> ops)
|
||||
{
|
||||
WorkStepEntity wse = new WorkStepEntity();
|
||||
wse.WorkStepName = desc.Substring(3, desc.Length - 3);
|
||||
|
||||
foreach (var item in ops)
|
||||
{
|
||||
if (item.ParameterCode.ToLower().StartsWith(key.ToLower())) //在JOSN里面,数组一定要按顺序排,或者顺序乱了
|
||||
{
|
||||
string pattern = @"\d+";
|
||||
Match match = Regex.Match(item.ParameterCode, pattern);
|
||||
int value = System.Convert.ToInt32(item.TargetValue);
|
||||
PropertyInfo propertyInfo = typeof(WorkStepEntity).GetProperty("WorkStep" + match.Value);
|
||||
propertyInfo.SetValue(wse, value);
|
||||
}
|
||||
}
|
||||
|
||||
return wse;
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
List<TProcessParameter> ProcessParams = _unityContainer.Resolve<ProcessParamService>().GetAllFormula().ToList();
|
||||
ProcessParamNames = ProcessParams.Select(x => x.ProcessParamName).ToList();
|
||||
|
||||
if (0 != ProcessParamNames.Count)
|
||||
{
|
||||
var currentJobNum = _unityContainer.Resolve<ProductionInformationService>().GetCurrentProductInfo();
|
||||
var processParams = _unityContainer.Resolve<ProcessParamService>().Get(currentJobNum.ProcessParamId);
|
||||
SelectedProcessParamName = processParams.ProcessParamName; //赋值给当前配方
|
||||
}
|
||||
}
|
||||
|
||||
public DelegateCommand<object> AddCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(NewProcessParamName))
|
||||
{
|
||||
Growl.Error("配方名称不能为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_unityContainer.Resolve<ProcessParamService>().CreateNewProcessParam(newProcessParamName))
|
||||
{
|
||||
Growl.Error("配方名称重复!");
|
||||
return;
|
||||
}
|
||||
Refresh();
|
||||
NewProcessParamName = "";
|
||||
Growl.Info("新增配方成功!");
|
||||
});
|
||||
|
||||
public DelegateCommand<object> DeleteCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (0 == WorkStepList.Count)
|
||||
{
|
||||
LogHelper.Instance.Error("没有工步数据,修改失败");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(SelectedProcessParamName))
|
||||
{
|
||||
var currentProductInfo = _unityContainer.Resolve<ProductionInformationService>().GetCurrentProductInfo();
|
||||
|
||||
if (SelectProcessParam.Id == currentProductInfo.ProcessParamId)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Fatal($@"此配方有工单正在使用,请修改当前使用工单后重试", "操作提示");
|
||||
return;
|
||||
}
|
||||
|
||||
var result1 = HandyControl.Controls.MessageBox.Ask($@"确定删除此配方?该操作会删除所有绑定此配方的工单", "操作提示");
|
||||
if (result1 == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_unityContainer.Resolve<ProcessParamService>().Delete(SelectProcessParam); //删除配方
|
||||
_unityContainer.Resolve<ProductionInformationService>().Delete(SelectProcessParam.Id); //删除TProductionInformation里的对应配方
|
||||
_unityContainer.Resolve<LogService>().AddLog($"删除配方:{SelectProcessParam.ProcessParamName}" , E_LogType.Operate.ToString());
|
||||
Refresh();
|
||||
}
|
||||
});
|
||||
|
||||
bool IsTypeMatching(string type, string value, string desc) //数据类型不匹配
|
||||
{
|
||||
string regular = "";
|
||||
if (BasicFramework.Instance.RegularDic.ContainsKey(type))
|
||||
{
|
||||
regular = BasicFramework.Instance.RegularDic[type];
|
||||
}
|
||||
else
|
||||
{
|
||||
regular = BasicFramework.Instance.RegularDic["Int32"];
|
||||
}
|
||||
Regex regex = new Regex(regular);
|
||||
if (!regex.IsMatch(value))
|
||||
{
|
||||
LogHelper.Instance.Error($"数据类型:{type},值:{value},节点:{desc},数据类型与值不匹配!", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//ParamList
|
||||
bool IsMatchingBaseData()
|
||||
{
|
||||
if (ParamList.Count != OperNodes.Count
|
||||
|| OperNodes.Count < 28) //正常是107个参数
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i <= 28; i++)
|
||||
{
|
||||
if (!IsTypeMatching(ParamList[i].ParameterType, ParamList[i].TargetValue, ParamList[i].Description))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public DelegateCommand<object> ModifyCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (!IsMatchingBaseData())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 == WorkStepList.Count)
|
||||
{
|
||||
LogHelper.Instance.Error("没有工步数据,修改失败", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SetWorkStep(WorkStepList[0], EStovePLC.HeatingEnabled.ToString())
|
||||
&& SetWorkStep(WorkStepList[1], EStovePLC.VacuumEnabled.ToString())
|
||||
&& SetWorkStep(WorkStepList[2], EStovePLC.NitrogenEnabled.ToString())
|
||||
&& SetWorkStep(WorkStepList[3], EStovePLC.StepWorkTime.ToString()))
|
||||
{
|
||||
SelectProcessParam.Parameters = JsonConvert.SerializeObject(ParamList); //JsonConvert.SerializeObject(OperNodes);
|
||||
if (0 == _unityContainer.Resolve<ProcessParamService>().Update<TProcessParameter>(SelectProcessParam))
|
||||
{
|
||||
LogHelper.Instance.Error("修改配方参数失败!", true);
|
||||
return;
|
||||
}
|
||||
|
||||
HandyControl.Controls.MessageBox.Success("修改配方参数成功!");
|
||||
}
|
||||
});
|
||||
|
||||
bool SetWorkStep(WorkStepEntity wse, string key) //WorkStepList->OperNodes赋值
|
||||
{
|
||||
foreach (var item in ParamList)
|
||||
{
|
||||
if (item.ParameterCode.ToLower().StartsWith(key.ToLower()))
|
||||
{
|
||||
string pattern = @"\d+";
|
||||
Match match = Regex.Match(item.ParameterCode, pattern);
|
||||
string value = GetValue(wse, match.Value);
|
||||
|
||||
if (!IsTypeMatching(item.ParameterType, value, item.Description))
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
PropertyInfo propertyInfo = typeof(EqptParameterModel).GetProperty("TargetValue");
|
||||
propertyInfo.SetValue(item, value);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
string GetValue(WorkStepEntity wse, string number)
|
||||
{
|
||||
PropertyInfo propertyInfo = typeof(WorkStepEntity).GetProperty("WorkStep" + number);
|
||||
return propertyInfo.GetValue(wse).ToString();
|
||||
}
|
||||
|
||||
void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
// 导航到当前页面时的处理逻辑,先执行构造方法,再执行本方法
|
||||
}
|
||||
|
||||
bool INavigationAware.IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return false; //false:表示每次导航都创建新实例,不重用旧实例; true:用旧实例,不会执行构造方法
|
||||
}
|
||||
|
||||
void INavigationAware.OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
//相当于析构方法,退出时(切换时)再执行。
|
||||
// 在这里添加释放旧视图实例资源的代码
|
||||
}
|
||||
}
|
||||
}
|
||||
66
Cowain.Bake.UI/Home/ViewModels/SetScannerViewModel.cs
Normal file
66
Cowain.Bake.UI/Home/ViewModels/SetScannerViewModel.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Model;
|
||||
using HandyControl.Controls;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Unity;
|
||||
|
||||
|
||||
namespace Cowain.Bake.UI.Home.ViewModels
|
||||
{
|
||||
public class SetScannerViewModel : BindableBase
|
||||
{
|
||||
List<TDeviceConfig> _scanCodeConfigs;
|
||||
IUnityContainer _unityContainer;
|
||||
|
||||
private List<string> scannersName;
|
||||
public List<string> ScannersName
|
||||
{
|
||||
get => scannersName;
|
||||
set => SetProperty(ref scannersName, value);
|
||||
}
|
||||
|
||||
private List<bool> isCheckScnner;
|
||||
public List<bool> IsCheckScnner
|
||||
{
|
||||
get => isCheckScnner;
|
||||
set => SetProperty(ref isCheckScnner, value);
|
||||
}
|
||||
public SetScannerViewModel(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
_scanCodeConfigs = _unityContainer.Resolve<DeviceConfigService>().GetConfig(EDeviceType.SCANNER).OrderBy(x=>x.Id).ToList();
|
||||
scannersName = _scanCodeConfigs.Select(x => x.Desc).ToList();
|
||||
IsCheckScnner = _scanCodeConfigs.Select(x => x.Enable).ToList();
|
||||
}
|
||||
|
||||
public DelegateCommand<object> SubmitCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
bool status = false;
|
||||
if (MessageBoxResult.OK != HandyControl.Controls.MessageBox.Ask("确认是否重新选择扫码枪!", "操作提示"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
foreach (var item in _scanCodeConfigs)
|
||||
{
|
||||
status = IsCheckScnner[index++];
|
||||
_unityContainer.Resolve<DeviceConfigService>().UpdateEnable(item.Id, status);
|
||||
|
||||
item.Enable = status;
|
||||
CommonCoreHelper.Instance.BlockStatusColor.Add(item);
|
||||
}
|
||||
|
||||
HandyControl.Controls.MessageBox.Show("选择成功,请重启上位机!");
|
||||
});
|
||||
}
|
||||
}
|
||||
673
Cowain.Bake.UI/Home/ViewModels/WorkOrderViewModel.cs
Normal file
673
Cowain.Bake.UI/Home/ViewModels/WorkOrderViewModel.cs
Normal file
@@ -0,0 +1,673 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Unity;
|
||||
using Prism.Commands;
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
using System.Data;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using static Cowain.Bake.Common.Models.MESModel;
|
||||
using JSON = Newtonsoft.Json.JsonConvert;
|
||||
using Cowain.Bake.Common.Interface;
|
||||
using System.Text.RegularExpressions;
|
||||
using Cowain.Bake.Communication.MOM;
|
||||
|
||||
namespace Cowain.Bake.UI.Home.ViewModels
|
||||
{
|
||||
public class WorkOrderViewModel : ViewModelBase, INavigationAware
|
||||
{
|
||||
public WorkOrderViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "创建工单";
|
||||
SetDummyRuleList();
|
||||
isAllowed = unityContainer.Resolve<UserService>().CheckPermission(ERole.Mantainer);
|
||||
}
|
||||
|
||||
private bool isAllowed;
|
||||
public bool IsAllowed
|
||||
{
|
||||
get => isAllowed;
|
||||
set => SetProperty(ref isAllowed, value);
|
||||
}
|
||||
|
||||
//工单列表
|
||||
private ObservableCollection<WorkOrderFormulaEntity> workOrderList;
|
||||
public ObservableCollection<WorkOrderFormulaEntity> WorkOrderList
|
||||
{
|
||||
get => workOrderList ?? (workOrderList = new ObservableCollection<WorkOrderFormulaEntity>());
|
||||
set { SetProperty(ref workOrderList, value); }
|
||||
}
|
||||
//配方列表
|
||||
private ObservableCollection<TProcessParameter> formulaList = new ObservableCollection<TProcessParameter>();
|
||||
public ObservableCollection<TProcessParameter> FormulaList
|
||||
{
|
||||
get => formulaList;
|
||||
set { SetProperty(ref formulaList, value); }
|
||||
}
|
||||
//参数列表
|
||||
private ObservableCollection<EqptParameterModel> paramList;
|
||||
public ObservableCollection<EqptParameterModel> ParamList
|
||||
{
|
||||
get => paramList ?? (paramList = new ObservableCollection<EqptParameterModel>());
|
||||
set
|
||||
{
|
||||
if (value != paramList)
|
||||
{
|
||||
paramList = value;
|
||||
OnPropertyChanged("ParamList");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private WorkOrderFormulaEntity workOrderSelectedItem;
|
||||
public WorkOrderFormulaEntity WorkOrderSelectedItem
|
||||
{
|
||||
get { return workOrderSelectedItem; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
workOrderSelectedItem = value;
|
||||
OnPropertyChanged("WorkOrderSelectedItem");
|
||||
}
|
||||
if (workOrderSelectedItem != null)
|
||||
{
|
||||
FormulaSelectedItem = FormulaList.FirstOrDefault(x => x.Id == workOrderSelectedItem.ProcessParamId);
|
||||
}
|
||||
else
|
||||
{
|
||||
FormulaSelectedItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TProcessParameter formulaSelectedItem;
|
||||
public TProcessParameter FormulaSelectedItem
|
||||
{
|
||||
get { return formulaSelectedItem; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
formulaSelectedItem = value;
|
||||
OnPropertyChanged("FormulaSelectedItem");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TProcessParameter formulaComboSelectedItem;
|
||||
public TProcessParameter FormulaComboSelectedItem
|
||||
{
|
||||
get { return formulaComboSelectedItem; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
|
||||
formulaComboSelectedItem = value;
|
||||
OnPropertyChanged("FormulaComboSelectedItem");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TProcessParameter reFormulaComboSelectedItem;
|
||||
public TProcessParameter ReFormulaComboSelectedItem
|
||||
{
|
||||
get { return reFormulaComboSelectedItem; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
|
||||
reFormulaComboSelectedItem = value;
|
||||
OnPropertyChanged("ReFormulaComboSelectedItem");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string dummyComboSelectedItem;
|
||||
public string DummyComboSelectedItem
|
||||
{
|
||||
get { return dummyComboSelectedItem; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
dummyComboSelectedItem = value;
|
||||
OnPropertyChanged("DummyComboSelectedItem");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//实现INotifyPropertyChanged接口
|
||||
public event PropertyChangedEventHandler NotifyPropertyChanged;
|
||||
public void OnPropertyChanged(string propName)
|
||||
{
|
||||
if (NotifyPropertyChanged != null)
|
||||
{
|
||||
NotifyPropertyChanged.Invoke(this, new PropertyChangedEventArgs(propName));
|
||||
}
|
||||
}
|
||||
//工单textbox双绑定
|
||||
private string workOrder = string.Empty;
|
||||
public string WorkOrder
|
||||
{
|
||||
get { return workOrder; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
workOrder = value;
|
||||
OnPropertyChanged("WorkOrder");
|
||||
}
|
||||
}
|
||||
}
|
||||
//配方textbox双绑定
|
||||
private string formula;
|
||||
public string Formula
|
||||
{
|
||||
get => formula;
|
||||
set => SetProperty(ref formula, value);
|
||||
}
|
||||
|
||||
private Visibility buttonVisibility = Visibility.Hidden;
|
||||
public Visibility ButtonVisibility
|
||||
{
|
||||
get { return buttonVisibility; }
|
||||
set
|
||||
{
|
||||
|
||||
buttonVisibility = value;
|
||||
OnPropertyChanged("ButtonVisibility");
|
||||
|
||||
}
|
||||
}
|
||||
public List<WorkOrderFormulaEntity> CurrentOrderList { get; set; }
|
||||
//设置水含量电芯下拉框数据源
|
||||
public List<string> DummyRuleList { get; set; }
|
||||
private void SetDummyRuleList()
|
||||
{
|
||||
DummyRuleList = new List<string>();
|
||||
foreach (DummyPlaceRule dummyPlaceRule in Enum.GetValues(typeof(DummyPlaceRule)))
|
||||
{
|
||||
DummyRuleList.Add(dummyPlaceRule.GetDescription());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void AsyncRefreshTask()
|
||||
{
|
||||
Application.Current?.Dispatcher?.Invoke(new Action(() =>
|
||||
{
|
||||
Refresh();
|
||||
}));
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
WorkOrderList.Clear();
|
||||
FormulaList.Clear();
|
||||
var listWorkOrderFormula = _unityContainer.Resolve<ProductionInformationService>().GetAllCellWorkOrderFormula();
|
||||
var listFormula = _unityContainer.Resolve<ProcessParamService>().GetAllFormula();
|
||||
|
||||
listWorkOrderFormula.ForEach(x => WorkOrderList.Add(x));
|
||||
listFormula.ForEach(x => FormulaList.Add(x));
|
||||
CurrentOrderList = listWorkOrderFormula;
|
||||
|
||||
if (!string.IsNullOrEmpty(Formula))
|
||||
{
|
||||
if (-1 != paraID)
|
||||
{
|
||||
GetSelectJSON();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void GetSelectJSON()
|
||||
{
|
||||
foreach (var item in WorkOrderList)
|
||||
{
|
||||
if (true == item.CurrentProduct)
|
||||
{
|
||||
var memory = _unityContainer.Resolve<MemoryDataProvider>();
|
||||
memory.CurrentUser.JobNum = item.JobNum;
|
||||
memory.CurrentUser.ProcessParamName = item.ProcessParamName;
|
||||
_unityContainer.Resolve<ICommonFun>().ModifyOrderNum();
|
||||
}
|
||||
}
|
||||
|
||||
var paramData = _unityContainer.Resolve<ProcessParamService>().GetProcessParam(paraID);
|
||||
ParamList.Clear();
|
||||
var operationList = JsonConvert.DeserializeObject<List<EqptParameterModel>>(paramData);
|
||||
operationList.ForEach(a => ParamList.Add(a));
|
||||
Formula = FormulaSelectedItem.ProcessParamName;
|
||||
paraID = FormulaSelectedItem.Id;
|
||||
}
|
||||
private int paraID = -1;
|
||||
//配方datagrid的SelectionChanged命令
|
||||
public DelegateCommand<object> SelectionChangedCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (FormulaSelectedItem != null)
|
||||
{
|
||||
ParamList.Clear();
|
||||
var operationList = JsonConvert.DeserializeObject<List<EqptParameterModel>>(FormulaSelectedItem.Parameters);
|
||||
operationList.ForEach(a => ParamList.Add(a));
|
||||
Formula = FormulaSelectedItem.ProcessParamName;
|
||||
paraID = FormulaSelectedItem.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParamList = null;
|
||||
}
|
||||
});
|
||||
|
||||
public DelegateCommand<string> DeleteCommand => new DelegateCommand<string>((x) =>
|
||||
{
|
||||
int delCount = 0;
|
||||
if (x == "deleteWorkOrder")
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Ask($@"确定删除?", "操作提示");
|
||||
if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (workOrderSelectedItem != null)
|
||||
{
|
||||
var deleteItem = workOrderSelectedItem as TProductionInformation;
|
||||
if (_unityContainer.Resolve<ProductionInformationService>().GetIsInUse(deleteItem.Id))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Fatal($@"工单正在使用,请修改当前使用工单后重试", "操作提示");
|
||||
return;
|
||||
}
|
||||
delCount = _unityContainer.Resolve<ProductionInformationService>().Delete<TProductionInformation>(deleteItem.Id);
|
||||
WorkOrderList.Remove(WorkOrderSelectedItem);
|
||||
CurrentOrderList.Remove(WorkOrderSelectedItem);
|
||||
_unityContainer.Resolve<LogService>().AddLog("WorkOrderViewModel.DeleteCommand:deleteWorkOrder," +
|
||||
JsonConvert.SerializeObject(WorkOrderSelectedItem), E_LogType.Operate.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (x == "deleteFormula")
|
||||
{
|
||||
if (formulaSelectedItem != null)
|
||||
{
|
||||
if (null != CurrentOrderList.Find(item => item.ProcessParamId == FormulaSelectedItem.Id && item.CurrentProduct.Value == true))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Fatal($@"此配方有工单正在使用,请修改当前使用工单后重试", "操作提示");
|
||||
return;
|
||||
}
|
||||
|
||||
if (null != CurrentOrderList.Find(item => item.ProcessParamId == FormulaSelectedItem.Id || item.ReProcessParamId == FormulaSelectedItem.Id))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Fatal($@"此配方有工单在使用,请先删除工单!", "操作提示");
|
||||
return;
|
||||
}
|
||||
|
||||
var result1 = HandyControl.Controls.MessageBox.Ask($@"确定删除此配方?该操作会删除所有绑定此配方的工单", "操作提示");
|
||||
if (result1 == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
delCount = _unityContainer.Resolve<ProcessParamService>().Delete(FormulaSelectedItem);
|
||||
_unityContainer.Resolve<ProductionInformationService>().Delete(FormulaSelectedItem.Id);
|
||||
FormulaList.Remove(FormulaSelectedItem);
|
||||
_unityContainer.Resolve<LogService>().AddLog("WorkOrderViewModel.DeleteCommand:deleteFormula," +
|
||||
JsonConvert.SerializeObject(FormulaSelectedItem), E_LogType.Operate.ToString());
|
||||
paraID = -1;
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (delCount > 0)
|
||||
{
|
||||
Growl.Success("删除成功!");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("删除失败!");
|
||||
}
|
||||
|
||||
});
|
||||
public DelegateCommand<string> QueryCommand => new DelegateCommand<string>((x) =>
|
||||
{
|
||||
List<WorkOrderFormulaEntity> queryWorkOrderList;
|
||||
List<TProcessParameter> queryFormulaList;
|
||||
if (x == "queryWorkOrder")
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(WorkOrder))
|
||||
{
|
||||
WorkOrderList.Clear();
|
||||
queryWorkOrderList = _unityContainer.Resolve<ProductionInformationService>().QueryWorkOrder(WorkOrder);
|
||||
if (0 != queryWorkOrderList.Count)
|
||||
{
|
||||
queryWorkOrderList.ForEach(i => WorkOrderList.Add(i));
|
||||
Growl.Success("查询完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("没有数据!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (x == "queryFormula")
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(Formula))
|
||||
{
|
||||
FormulaList.Clear();
|
||||
queryFormulaList = _unityContainer.Resolve<ProcessParamService>().QueryFormula(Formula);
|
||||
if (0 != queryFormulaList.Count)
|
||||
{
|
||||
queryFormulaList.ForEach(i => FormulaList.Add(i));
|
||||
Growl.Success("查询完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("没有数据!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
private EqptParameterModel selectedItem;
|
||||
public EqptParameterModel SelectedItem
|
||||
{
|
||||
get => selectedItem;
|
||||
set => SetProperty(ref selectedItem, value);
|
||||
}
|
||||
public DelegateCommand<object> CellEditEndingCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (null == selectedItem)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string regular = "";
|
||||
if (BasicFramework.Instance.RegularDic.ContainsKey(selectedItem.ParameterType))
|
||||
{
|
||||
regular = BasicFramework.Instance.RegularDic[selectedItem.ParameterType];
|
||||
}
|
||||
else
|
||||
{
|
||||
regular = BasicFramework.Instance.RegularDic["Int32"];
|
||||
}
|
||||
Regex regex = new Regex(regular);
|
||||
if (!regex.IsMatch(selectedItem.TargetValue))
|
||||
{
|
||||
Refresh();
|
||||
Growl.Error("参数格式不正确!");
|
||||
}
|
||||
});
|
||||
|
||||
//工艺参数是否超出范围
|
||||
bool IsParamOutRange()
|
||||
{
|
||||
float min , max, value;
|
||||
foreach (var item in ParamList)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.LowerLimit)
|
||||
|| string.IsNullOrEmpty(item.TargetValue)
|
||||
|| string.IsNullOrEmpty(item.UpperLimit))
|
||||
{
|
||||
LogHelper.Instance.Error($"工艺参数相关项不能为空,内容为:{JSON.SerializeObject(item)}", true);
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
max = float.Parse(item.UpperLimit);
|
||||
min = float.Parse(item.LowerLimit);
|
||||
value = float.Parse(item.TargetValue);
|
||||
if (max < value || min > value)
|
||||
{
|
||||
LogHelper.Instance.Error($"工艺参数值超出上限或下限值,内容为:{JSON.SerializeObject(item)}", true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.Error($"上限值、下限值、设置值异常,异常内容:{ex.Message},内容为:{JSON.SerializeObject(item)}", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public DelegateCommand RefreshFormulaCommand => new DelegateCommand(() =>
|
||||
{
|
||||
Refresh();
|
||||
});
|
||||
/*
|
||||
设备调机完成后,如需要保存调整的工艺参数,需要将所有的参数上传给MOM,MOM检查参数是否允许修改,如果允许修改设备才可以保存参数的修改,如果保存失败需要报错提醒操作人员参数保存失败以及失败的原因,操作人员根据报错提示的内容决定是继续调整参数还是复位到调整前的参数数据
|
||||
*/
|
||||
public DelegateCommand<string> SaveFormulaCommand => new DelegateCommand<string>((x) =>
|
||||
{
|
||||
//参数变更, 先判断是否超出范围
|
||||
if (!IsParamOutRange())
|
||||
{
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
int mesEnable = int.Parse(_unityContainer.Resolve<SysSetupService>().GetValueByParaID(ESysSetup.MOMEnable.ToString()));
|
||||
//MOM验证结果 add by lsm 20250926 test
|
||||
if (mesEnable == (int)EMOMEnable.Enable)
|
||||
{
|
||||
var memory = _unityContainer.Resolve<MemoryDataProvider>();
|
||||
MESReturnCmdModel mesResult = _unityContainer.Resolve<MESProcess>().ChangeParam(memory.CurrentUser.UserId, new List<EqptParameterModel>(ParamList));
|
||||
if (null == mesResult
|
||||
|| mesResult.Info.ResultFlag != EResultFlag.OK.ToString())
|
||||
{
|
||||
if (null == mesResult)
|
||||
{
|
||||
LogHelper.Instance.Warn($"MOM验证参数变更失败,返回信息:{JSON.SerializeObject(mesResult)}", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Instance.Warn($"MOM验证参数变更失败,返回信息:{mesResult.Info.MOMMessage}", true);
|
||||
}
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//参数保存
|
||||
if (_unityContainer.Resolve<ProcessParamService>().UpdateProcessParam(paraID, JsonConvert.SerializeObject(ParamList)))
|
||||
{
|
||||
Refresh();
|
||||
Growl.Success("更新成功!");
|
||||
}
|
||||
});
|
||||
//AddProcessParaCommand
|
||||
public DelegateCommand<string> AddProcessParaCommand => new DelegateCommand<string>((x) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(formula))
|
||||
{
|
||||
Growl.Error("配方名称不能为空!");
|
||||
return;
|
||||
}
|
||||
if (!_unityContainer.Resolve<ProcessParamService>().CreateNewProcessParam(formula))
|
||||
{
|
||||
Growl.Error("配方名称重复!");
|
||||
return;
|
||||
}
|
||||
Refresh();
|
||||
Growl.Info("新增配方成功!");
|
||||
});
|
||||
public DelegateCommand<string> AddCommand => new DelegateCommand<string>((x) =>
|
||||
{
|
||||
if (x == "addWorkOrder")
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(WorkOrder))
|
||||
{
|
||||
Growl.Info("请输入工单号!");
|
||||
return;
|
||||
}
|
||||
if (FormulaComboSelectedItem == null)
|
||||
{
|
||||
Growl.Info("请选择配方!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ReFormulaComboSelectedItem == null)
|
||||
{
|
||||
Growl.Info("请选择复烘配方!");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(DummyComboSelectedItem))
|
||||
{
|
||||
Growl.Info("请选择水含量电芯放盘规则!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (CurrentOrderList.Count > 0)
|
||||
{
|
||||
if (CurrentOrderList.Where(b => b.JobNum == workOrder).ToList().Count > 0)
|
||||
{
|
||||
Growl.Info("工单已存在!");
|
||||
return;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//从当前工单列表中找到当前生产的工单
|
||||
//var u = CurrentOrderList.Where(c => c.CurrentProduct == true).ToList()[0];
|
||||
//TProductionInformation updateItem = new TProductionInformation()
|
||||
//{
|
||||
// Id = u.Id,
|
||||
// JobNum = u.JobNum,
|
||||
// CurrentProduct = false,
|
||||
// DummyRule = u.DummyRule,
|
||||
// ProcessParamId = u.ProcessParamId
|
||||
//};
|
||||
//workOrderService.Update(updateItem);
|
||||
|
||||
DummyPlaceRule d = EnumHelper.GetValueByDescription<DummyPlaceRule>(DummyComboSelectedItem);
|
||||
int selectedDummyRule = (int)Enum.Parse(typeof(DummyPlaceRule), d.ToString());
|
||||
int proccessParamId = FormulaComboSelectedItem.Id;
|
||||
|
||||
TProductionInformation newWorkOrder = new TProductionInformation()
|
||||
{
|
||||
JobNum = WorkOrder,
|
||||
CurrentProduct = false,
|
||||
DummyRule = Convert.ToSByte(selectedDummyRule),
|
||||
ProcessParamId = proccessParamId,
|
||||
ReProcessParamId = ReFormulaComboSelectedItem.Id,
|
||||
};
|
||||
_unityContainer.Resolve<ProductionInformationService>().Insert(newWorkOrder);
|
||||
_unityContainer.Resolve<LogService>().AddLog("WorkOrderViewModel.AddCommand:"
|
||||
+ JsonConvert.SerializeObject(newWorkOrder), E_LogType.Operate.ToString());
|
||||
|
||||
Refresh();
|
||||
var UpdateProduceModel = workOrderList.Where(a => a.CurrentProduct == true && a.JobNum != WorkOrder).ToList();
|
||||
Growl.Success("新增成功!");
|
||||
}
|
||||
else if (x == "addFormula")
|
||||
{
|
||||
TProcessParameter newFormula = new TProcessParameter();
|
||||
|
||||
}
|
||||
});
|
||||
public DelegateCommand<object> CurrentProduceCheckBoxChangeCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Ask($@"确定更改?", "操作提示");
|
||||
if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
var clickItem = WorkOrderSelectedItem;
|
||||
//if (clickItem.IsRebake == true)
|
||||
//{
|
||||
// HandyControl.Controls.MessageBox.Error("无法将复烘配方选择为生产配方");
|
||||
// Refresh();
|
||||
// return;
|
||||
//}
|
||||
if (_unityContainer.Resolve<ProcessParamService>().UpdateCurrentJobNum(clickItem.Id))
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Info("必须有一个正在的生产工单");
|
||||
Refresh();
|
||||
}
|
||||
});
|
||||
|
||||
//public DelegateCommand<object> RebakeBoxChangeCommand => new DelegateCommand<object>((x) =>
|
||||
//{
|
||||
// var result = HandyControl.Controls.MessageBox.Ask($@"选择此工单为复烘配方?", "操作提示");
|
||||
// if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
// {
|
||||
// Refresh();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// var clickItem = WorkOrderSelectedItem;
|
||||
// if (clickItem.CurrentProduct == true)
|
||||
// {
|
||||
// HandyControl.Controls.MessageBox.Error("无法将正在生产的工单选择为复烘配方");
|
||||
// Refresh();
|
||||
// return;
|
||||
// }
|
||||
// if (_unityContainer.Resolve<ProcessParamService>().UpdateRebake(clickItem.Id))
|
||||
// {
|
||||
// Refresh();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Growl.Info("必须有一个复烘配方");
|
||||
// Refresh();
|
||||
// }
|
||||
//});
|
||||
|
||||
void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
// 导航到当前页面时的处理逻辑,先执行构造方法,再执行本方法
|
||||
}
|
||||
|
||||
bool INavigationAware.IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return false; //false:表示每次导航都创建新实例,不重用旧实例; true:用旧实例,不会执行构造方法
|
||||
}
|
||||
|
||||
void INavigationAware.OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
//相当于析构方法,退出时(切换时)再执行。
|
||||
// 在这里添加释放旧视图实例资源的代码
|
||||
}
|
||||
}
|
||||
}
|
||||
171
Cowain.Bake.UI/Home/Views/LoginView.xaml
Normal file
171
Cowain.Bake.UI/Home/Views/LoginView.xaml
Normal file
@@ -0,0 +1,171 @@
|
||||
<Window x:Class="Cowain.Bake.UI.Home.Views.LoginView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.Home.Views"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
xmlns:pwdHelper="clr-namespace:Cowain.Bake.Common;assembly=Cowain.Bake.Common"
|
||||
mc:Ignorable="d" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
|
||||
Title="登录" Height="500" Width="830">
|
||||
<Window.Background>
|
||||
<ImageBrush ImageSource="pack://application:,,,/Cowain.Bake.Common;component/Images/Cowain.jpg" Stretch="UniformToFill"/>
|
||||
</Window.Background>
|
||||
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Cowain.Bake.Common;component/Styles/BaseResources.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Cowain.Bake.Common;component/Styles/ButtonStyles.xaml"/>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ControlTemplate TargetType="TextBox" x:Key="UserNameTextBoxTemplate">
|
||||
<Border CornerRadius="5" BorderBrush="#DDD" BorderThickness="1">
|
||||
<Grid>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="30"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="" FontFamily="{StaticResource Iconfont}" Margin="0,2,0,0"
|
||||
FontSize="18" Foreground="#BBB" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<ScrollViewer x:Name="PART_ContentHost" Grid.Column="1" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate TargetType="TextBox" x:Key="Machine2TextBoxTemplate">
|
||||
<Border CornerRadius="5" BorderBrush="#DDD" BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="14.974"/>
|
||||
<ColumnDefinition Width="15.026"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="" FontFamily="{StaticResource Iconfont}" Margin="0,8,0,0"
|
||||
FontSize="18" Foreground="#BBB" HorizontalAlignment="Center" Grid.ColumnSpan="2"/>
|
||||
<ScrollViewer x:Name="PART_ContentHost" Grid.Column="2" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"
|
||||
/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate TargetType="TextBox" x:Key="Machine1TextBoxTemplate">
|
||||
<Border CornerRadius="5" BorderBrush="#DDD" BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="30"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="" FontFamily="{StaticResource Iconfont}" Margin="0,2,0,0"
|
||||
FontSize="18" Foreground="#BBB" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<ScrollViewer x:Name="PART_ContentHost" Grid.Column="1" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"
|
||||
/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
<!--Style 包含 ControlTemplate:Template-->
|
||||
<ControlTemplate TargetType="PasswordBox" x:Key="PasswordBoxTemplate">
|
||||
<Border CornerRadius="5" BorderBrush="#DDD" BorderThickness="1">
|
||||
<Grid>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="" FontFamily="{StaticResource Iconfont}" Margin="0,2,0,0"
|
||||
FontSize="26" Foreground="#BBB" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
|
||||
<ScrollViewer x:Name="PART_ContentHost" Grid.Column="1" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"
|
||||
/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style TargetType="Hyperlink">
|
||||
<Setter Property="Foreground" Value="#AAA"/>
|
||||
<Setter Property="TextBlock.TextDecorations" Value="{x:Null}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="#999"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate TargetType="Button" x:Key="LoginButtonTemplate">
|
||||
<Grid>
|
||||
<Border CornerRadius="5">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="#FF0ABEFF" Offset="0"/>
|
||||
<GradientStop Color="#FF00B4FA" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
/>
|
||||
</Border>
|
||||
<Border CornerRadius="3" Name="mask"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#22FFFFFF" TargetName="mask"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="#11000000" TargetName="mask"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
</Window.Resources>
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome NonClientFrameEdges="None" GlassFrameThickness="-1" ResizeBorderThickness="1"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
<Grid>
|
||||
<Viewbox Stretch="Uniform">
|
||||
<Canvas Width="830" Height="500">
|
||||
|
||||
<TextBlock Text="得壹二期自动真空烘烤系统" Width="830" Height="500" Margin="0,39,0,0" TextAlignment="Center"
|
||||
HorizontalAlignment="Center" Foreground="White" FontSize="32">
|
||||
<TextBlock.Effect>
|
||||
<DropShadowEffect BlurRadius="15" ShadowDepth="10" Direction="265" Opacity="0.5" Color="Gray"/>
|
||||
</TextBlock.Effect>
|
||||
</TextBlock>
|
||||
|
||||
<Image Source="pack://application:,,,/Cowain.Bake.Common;component/Images/CowainLogo.png" Width="194" Height="28"
|
||||
Canvas.Left="320" Canvas.Top="0" />
|
||||
|
||||
|
||||
<Button Content="" Style="{StaticResource IconButtonStyle}"
|
||||
Height="28" Background="Transparent" Click="Min_Button_Click" Margin="770,0,0.2,0"/>
|
||||
<Button Content="" Style="{StaticResource IconButtonStyle}"
|
||||
Height="28" Background="Transparent" Click="Button_Click" Margin="800,0,0.2,0"/>
|
||||
|
||||
<TextBox Text="{Binding UserName,UpdateSourceTrigger=PropertyChanged}"
|
||||
Height="25" FontSize="14" Background="Transparent" Foreground="White"
|
||||
Template="{StaticResource UserNameTextBoxTemplate}" Canvas.Left="600" Canvas.Top="201" Width="171"/>
|
||||
<PasswordBox pwdHelper:PasswordHelper.Password="{Binding Password,Mode=TwoWay}"
|
||||
pwdHelper:PasswordHelper.Attach="True" Foreground="White"
|
||||
Height="25" FontSize="14"
|
||||
Template="{StaticResource PasswordBoxTemplate}" Canvas.Left="600" Canvas.Top="264" Width="171"/>
|
||||
<Button Content="" Height="30" Width="176" Foreground="White" FontSize="14"
|
||||
Background="Transparent"
|
||||
Command="{Binding LoginCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}" Canvas.Left="600" Canvas.Top="331"
|
||||
/>
|
||||
|
||||
<TextBlock Text="{Binding ErrorMsg}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16" Width="245" Foreground="Red" Canvas.Left="575" Canvas.Top="455"
|
||||
/>
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</Window>
|
||||
37
Cowain.Bake.UI/Home/Views/LoginView.xaml.cs
Normal file
37
Cowain.Bake.UI/Home/Views/LoginView.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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.Shapes;
|
||||
|
||||
namespace Cowain.Bake.UI.Home.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// LoginView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class LoginView : Window
|
||||
{
|
||||
public LoginView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
}
|
||||
|
||||
private void Min_Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Cowain.Bake.UI/Home/Views/ModifyPassWordView.xaml
Normal file
33
Cowain.Bake.UI/Home/Views/ModifyPassWordView.xaml
Normal file
@@ -0,0 +1,33 @@
|
||||
<Window x:Class="Cowain.Bake.UI.Home.Views.ModifyPassWordView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:pwdHelper="clr-namespace:Cowain.Bake.Common;assembly=Cowain.Bake.Common"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.Home.Views"
|
||||
xmlns:prism ="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d"
|
||||
Title="修改用户密码" Height="250" Width="400"
|
||||
ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<WrapPanel Margin="0,10,0,0">
|
||||
<TextBlock Text="旧密码:" TextAlignment="Right" Foreground="Black" FontWeight="Bold" Margin="40,10,0,0" Width="90" Height="26" />
|
||||
<PasswordBox pwdHelper:PasswordHelper.Password="{Binding OldPassWord,Mode=TwoWay}" pwdHelper:PasswordHelper.Attach="True" FontWeight="Bold" Margin="10,0,0,0" Height="30" Width="200" />
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0">
|
||||
<TextBlock Text="新密码:" TextAlignment="Right" Foreground="Black" FontWeight="Bold" Margin="40,10,0,0" Width="90" Height="26" />
|
||||
<PasswordBox pwdHelper:PasswordHelper.Password="{Binding NewPassWord,Mode=TwoWay}" pwdHelper:PasswordHelper.Attach="True" FontWeight="Bold" Margin="10,0,0,0" Height="30" Width="200" />
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0">
|
||||
<TextBlock Text="验证密码:" TextAlignment="Right" Foreground="Black" FontWeight="Bold" Margin="40,10,0,0" Width="90" Height="26" />
|
||||
<PasswordBox pwdHelper:PasswordHelper.Password="{Binding CheckPassWord,Mode=TwoWay}" pwdHelper:PasswordHelper.Attach="True" FontWeight="Bold" Margin="10,0,0,0" Height="30" Width="200" />
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0">
|
||||
<Button Content="修改" x:Name="judge" Background="DeepSkyBlue" Command="{Binding ModifyCommand}" Margin="150,20,0,30" Width="90" />
|
||||
</WrapPanel>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
27
Cowain.Bake.UI/Home/Views/ModifyPassWordView.xaml.cs
Normal file
27
Cowain.Bake.UI/Home/Views/ModifyPassWordView.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
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.Shapes;
|
||||
|
||||
namespace Cowain.Bake.UI.Home.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ModifyPassWordView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ModifyPassWordView : Window
|
||||
{
|
||||
public ModifyPassWordView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
233
Cowain.Bake.UI/Home/Views/ProcessParametersView.xaml
Normal file
233
Cowain.Bake.UI/Home/Views/ProcessParametersView.xaml
Normal file
@@ -0,0 +1,233 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.Home.Views.ProcessParametersView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="55"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.65*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="1" CornerRadius="6" BorderThickness="1"/>
|
||||
<Border Background="#EEE" Grid.Row="1" Margin="1" CornerRadius="6" BorderThickness="1"/>
|
||||
<Border Background="#EEE" Grid.Row="2" Margin="1" CornerRadius="6" BorderThickness="1"/>
|
||||
<WrapPanel>
|
||||
<TextBlock Text="配方名:" Margin="10,20,0,20" ></TextBlock>
|
||||
<ComboBox Margin="10" ItemsSource="{Binding ProcessParamNames}" SelectedValue="{Binding SelectedProcessParamName,Mode=TwoWay}" FontWeight="Bold" Width="200"></ComboBox>
|
||||
<Button Content="修改" Style="{StaticResource ButtonSuccess}" Command="{Binding ModifyCommand}" IsEnabled="{Binding IsAllowed}" Margin="10,0,0,0"/>
|
||||
<Button Content="删除" Style="{StaticResource ButtonDanger}" Command="{Binding DeleteCommand}" Margin="20,0,0,0" IsEnabled="{Binding IsAllowed}" CommandParameter="deleteFormula" />
|
||||
<TextBlock Text="新配方名:" Margin="60,20,10,0" ></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="180" Margin="0,0,0,0" Text="{Binding NewProcessParamName,Mode=TwoWay}"></TextBox>
|
||||
<Button Content="新增" Style="{StaticResource ButtonInfo}" Command="{Binding AddCommand}" Margin="10,0,0,0" IsEnabled="{Binding IsAllowed}" CommandParameter="addFormula"/>
|
||||
</WrapPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.4*"/>
|
||||
<ColumnDefinition Width="0.6*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel >
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="设定温度:" Margin="0,10,0,0" ></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="15,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[0].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[0].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="温度公差:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="15,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[1].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[1].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="温度上限(+):" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="0,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[2].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[2].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="真空到达值:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="5,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[3].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[3].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="真空上限(+):" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="0,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[4].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[4].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="真空下限(-):" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="5,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[5].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[5].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1">
|
||||
<WrapPanel Margin="5,10,0,0" >
|
||||
<TextBlock Text="氮气到达值:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="10,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[6].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[6].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="5,10,0,0" >
|
||||
<TextBlock Text="氮气上限(+):" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="5,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[7].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[7].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="5,10,0,0" >
|
||||
<TextBlock Text="氮气下限(-):" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="10,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[8].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[8].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="5,10,0,0" >
|
||||
<TextBlock Text="常压到达值:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="10,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[9].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[9].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="5,10,0,0" >
|
||||
<TextBlock Text="常压上限(+):" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="5,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[10].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[10].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="5,10,0,0" >
|
||||
<TextBlock Text="常压下限(-):" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" Margin="10,0,0,0" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[11].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[11].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.11*"/>
|
||||
<ColumnDefinition Width="0.1*"/>
|
||||
<ColumnDefinition Width="0.09*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="10,0,0,0">
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环启动工步1:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[12].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[12].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环启动工步2:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[13].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[13].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环启动工步3:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[14].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[14].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环启动工步4:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[15].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[15].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环启动工步5:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[16].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[16].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0">
|
||||
<TextBlock Text="温度上限预警值:" Margin="-5,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[27].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[27].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Margin="5,0,0,0">
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环结束工步1:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[17].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[17].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环结束工步2:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[18].TargetValue}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[18].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环结束工步3:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[19].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[19].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环结束工步4:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[20].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[20].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环结束工步5:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[21].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[21].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0">
|
||||
<TextBlock Text="真空上限预警值:" Margin="-5,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[28].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[28].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Margin="5,0,0,0">
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环次数1:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[22].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[22].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环次数2:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[23].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[23].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环次数3:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[24].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[24].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环次数4:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[25].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[25].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="0,10,0,0" >
|
||||
<TextBlock Text="循环次数5:" Margin="0,10,0,0"></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="70" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" Text="{Binding ParamList[26].TargetValue,Mode=TwoWay}"></TextBox>
|
||||
<TextBlock Text="{Binding ParamList[26].UOM,Mode=TwoWay}" Margin="10,10,0,0" Width="30"></TextBlock>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<DataGrid Grid.Row="3" hc:DataGridAttach.CanUnselectAllWithBlankArea="False" HeadersVisibility="All"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" SelectedItem="{Binding WorkOrderSelectedItem, Mode=TwoWay}"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding WorkStepList,UpdateSourceTrigger=PropertyChanged}" >
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="工步参数" Binding="{Binding WorkStepName}" />
|
||||
<DataGridTextColumn Header="工步1" Binding="{Binding WorkStep1}" />
|
||||
<DataGridTextColumn Header="工步2" Binding="{Binding WorkStep2}" />
|
||||
<DataGridTextColumn Header="工步3" Binding="{Binding WorkStep3}" />
|
||||
<DataGridTextColumn Header="工步4" Binding="{Binding WorkStep4}" />
|
||||
<DataGridTextColumn Header="工步5" Binding="{Binding WorkStep5}" />
|
||||
<DataGridTextColumn Header="工步6" Binding="{Binding WorkStep6}" />
|
||||
<DataGridTextColumn Header="工步7" Binding="{Binding WorkStep7}" />
|
||||
<DataGridTextColumn Header="工步8" Binding="{Binding WorkStep8}" />
|
||||
<DataGridTextColumn Header="工步9" Binding="{Binding WorkStep9}" />
|
||||
<DataGridTextColumn Header="工步10" Binding="{Binding WorkStep10}" />
|
||||
<DataGridTextColumn Header="工步11" Binding="{Binding WorkStep11}" />
|
||||
<DataGridTextColumn Header="工步12" Binding="{Binding WorkStep12}" />
|
||||
<DataGridTextColumn Header="工步13" Binding="{Binding WorkStep13}" />
|
||||
<DataGridTextColumn Header="工步14" Binding="{Binding WorkStep14}" />
|
||||
<DataGridTextColumn Header="工步15" Binding="{Binding WorkStep15}" />
|
||||
<DataGridTextColumn Header="工步16" Binding="{Binding WorkStep16}" />
|
||||
<DataGridTextColumn Header="工步17" Binding="{Binding WorkStep17}" />
|
||||
<DataGridTextColumn Header="工步18" Binding="{Binding WorkStep18}" />
|
||||
<DataGridTextColumn Header="工步19" Binding="{Binding WorkStep19}" />
|
||||
<DataGridTextColumn Header="工步20" Binding="{Binding WorkStep20}" />
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
15
Cowain.Bake.UI/Home/Views/ProcessParametersView.xaml.cs
Normal file
15
Cowain.Bake.UI/Home/Views/ProcessParametersView.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Cowain.Bake.UI.Home.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// ProcessParametersView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ProcessParametersView : UserControl
|
||||
{
|
||||
public ProcessParametersView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Cowain.Bake.UI/Home/Views/SetScannerView.xaml
Normal file
34
Cowain.Bake.UI/Home/Views/SetScannerView.xaml
Normal file
@@ -0,0 +1,34 @@
|
||||
<Window x:Class="Cowain.Bake.UI.Home.Views.SetScannerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.Home.Views"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:prism ="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d"
|
||||
Title="选择使用扫码枪" Height="300" Width="400"
|
||||
ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid Margin="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="请选择所使用的扫码枪:" FontSize="16" Margin="0,0,0,10"/>
|
||||
|
||||
<!-- 复选框数组容器 -->
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical" Margin="100,0,0,20">
|
||||
<CheckBox Content="{Binding ScannersName[0]}" IsChecked="{Binding IsCheckScnner[0]}" Margin="10"/>
|
||||
<CheckBox Content="{Binding ScannersName[1]}" IsChecked="{Binding IsCheckScnner[1]}" Margin="10"/>
|
||||
<CheckBox Content="{Binding ScannersName[2]}" IsChecked="{Binding IsCheckScnner[2]}" Margin="10"/>
|
||||
<CheckBox Content="{Binding ScannersName[3]}" IsChecked="{Binding IsCheckScnner[3]}" Margin="10"/>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="2" Content="提交选择"
|
||||
Style="{StaticResource ButtonSuccess}" Command="{Binding SubmitCommand}" CommandParameter="queryFormula"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
20
Cowain.Bake.UI/Home/Views/SetScannerView.xaml.cs
Normal file
20
Cowain.Bake.UI/Home/Views/SetScannerView.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace Cowain.Bake.UI.Home.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// SetScannerView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SetScannerView : Window
|
||||
{
|
||||
public SetScannerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
140
Cowain.Bake.UI/Home/Views/WorkOrderView.xaml
Normal file
140
Cowain.Bake.UI/Home/Views/WorkOrderView.xaml
Normal file
@@ -0,0 +1,140 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.Home.Views.WorkOrderView"
|
||||
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.Home.Views"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:ConvertorBLL="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
mc:Ignorable="d"
|
||||
Background="Transparent"
|
||||
d:DesignHeight="450" d:DesignWidth="800" >
|
||||
<UserControl.Resources>
|
||||
<convertor:DummyRuleConvertor x:Key="dummyRuleConvertor"/>
|
||||
<ConvertorBLL:ProcessParamIdConvertor x:Key="ProcessParamIdConvertor"/>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="65*"/>
|
||||
<ColumnDefinition Width="45*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="35"/>
|
||||
<RowDefinition Height="35"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="工单管理" />
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<Button Content="查询工单" Style="{StaticResource ButtonSuccess}" Command="{Binding QueryCommand}" CommandParameter="queryWorkOrder"/>
|
||||
<Button Content="新增工单" Style="{StaticResource ButtonInfo}" Command="{Binding AddCommand}" CommandParameter="addWorkOrder"/>
|
||||
<Button Content="删除工单" Style="{StaticResource ButtonDanger}" Command="{Binding DeleteCommand}" CommandParameter="deleteWorkOrder" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<TextBlock Text="工单号:"/>
|
||||
<TextBox x:Name="workOrder" Width="100" Text="{Binding WorkOrder,Mode=TwoWay}"/>
|
||||
<TextBlock Text="配方:" Margin="10,0,0,0"/>
|
||||
<ComboBox x:Name="formulaCombo" Width="100" ItemsSource="{Binding FormulaList}" DisplayMemberPath="ProcessParamName" SelectedItem="{Binding FormulaComboSelectedItem,Mode=OneWayToSource}"/>
|
||||
<TextBlock Text="复烘配方:" Margin="10,0,0,0"/>
|
||||
<ComboBox x:Name="reFormulaCombo" Width="100" ItemsSource="{Binding FormulaList}" DisplayMemberPath="ProcessParamName" SelectedItem="{Binding ReFormulaComboSelectedItem,Mode=OneWayToSource}"/>
|
||||
<TextBlock Text="水含量电芯放盘规则:" Margin="10,0,0,0"/>
|
||||
<ComboBox x:Name="dummyRuleBox" ItemsSource="{Binding DummyRuleList}" SelectedItem="{Binding DummyComboSelectedItem ,Mode=OneWayToSource}" MinWidth="100"/>
|
||||
</StackPanel>
|
||||
<DataGrid Grid.Row="3" hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="True" SelectedItem="{Binding WorkOrderSelectedItem, Mode=TwoWay}"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding WorkOrderList,UpdateSourceTrigger=PropertyChanged}"
|
||||
>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding SelectionChangedCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Self}}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Header="序号" Width="120" Binding="{Binding Id}" Visibility="Hidden" />-->
|
||||
<DataGridTextColumn Header="工单号" Width="auto" Binding="{Binding JobNum}" />
|
||||
<DataGridTextColumn Header="配方" Width="auto" Binding="{Binding ProcessParamName}" />
|
||||
<DataGridTextColumn Header="复烘配方" Width="auto" Binding="{Binding ReProcessParamId,Converter={StaticResource ProcessParamIdConvertor}}" />
|
||||
<DataGridTextColumn Header="假电芯放盘规则" Width="auto" Binding="{Binding DummyRule,Converter={StaticResource dummyRuleConvertor}}" />
|
||||
|
||||
<DataGridTextColumn Header="创建时间" Width="auto" Binding="{Binding ProductionDatetime, StringFormat=yyyy-MM-dd HH:mm:ss}"/>
|
||||
<DataGridTemplateColumn Header="正在生产" Width="auto" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox HorizontalAlignment="Center" Tag="{Binding Id}" IsChecked="{Binding CurrentProduct,Mode=TwoWay}" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding DataContext.CurrentProduceCheckBoxChangeCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</CheckBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="35"/>
|
||||
<RowDefinition Height="35"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="配方管理" />
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<Button Content="查询配方" Style="{StaticResource ButtonSuccess}" Command="{Binding QueryCommand}" CommandParameter="queryFormula"/>
|
||||
<Button Content="新增配方" Style="{StaticResource ButtonInfo}" Command="{Binding AddProcessParaCommand}" IsEnabled="{Binding IsAllowed}" CommandParameter="addFormula"/>
|
||||
<Button Content="删除配方" Style="{StaticResource ButtonDanger}" Command="{Binding DeleteCommand}" IsEnabled="{Binding IsAllowed}" CommandParameter="deleteFormula" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<TextBlock Text="配方"/>
|
||||
<TextBox x:Name="formulaBox" Width="100" Text="{Binding Formula,Mode=TwoWay}"/>
|
||||
<Button Width="80" Content="参数变更" Style="{StaticResource ButtonDanger}" Margin="120,0,10,0" Command="{Binding SaveFormulaCommand}" IsEnabled="{Binding IsAllowed}"/>
|
||||
<Button Width="60" Content="刷新" Style="{StaticResource ButtonSuccess}" Margin="0,0,10,0" Command="{Binding RefreshFormulaCommand}"/>
|
||||
</StackPanel>
|
||||
<DockPanel Grid.Row="3" LastChildFill="True">
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" DockPanel.Dock="Left"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="True" Width="200" SelectedItem="{Binding FormulaSelectedItem,Mode=TwoWay}"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding FormulaList,UpdateSourceTrigger=PropertyChanged}" FocusManager.FocusedElement="{Binding FormulaSelectedItem,Mode=TwoWay}" >
|
||||
<i:Interaction.Triggers >
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding SelectionChangedCommand}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="序号" Binding="{Binding Id}" Visibility="Hidden" />
|
||||
<DataGridTextColumn Header="配方" Binding="{Binding ProcessParamName}" />
|
||||
<!--cancel by wz-->
|
||||
<!--<DataGridTextColumn Header="{DynamicResource DateTime}" Width="180" Binding="{Binding CreateDatetime,StringFormat='yyyy-MM-dd HH:mm:ss'}" ElementStyle="{StaticResource DataGridCellStyle}"/>-->
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" DockPanel.Dock="Right"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="False" IsEnabled="{Binding IsAllowed}"
|
||||
SelectedItem="{Binding SelectedItem,Mode=TwoWay}"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding ParamList,UpdateSourceTrigger=PropertyChanged}">
|
||||
<i:Interaction.Triggers >
|
||||
<i:EventTrigger EventName="CellEditEnding">
|
||||
<i:InvokeCommandAction Command="{Binding CellEditEndingCommand}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="工艺参数名" Binding="{Binding Description}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="工艺参数值" Binding="{Binding TargetValue,UpdateSourceTrigger=PropertyChanged}" IsReadOnly="False"/>
|
||||
<DataGridTextColumn Header="单位" Binding="{Binding UOMCode}" IsReadOnly="False"/>
|
||||
<DataGridTextColumn Header="Regular" Binding="{Binding ParameterType}" IsReadOnly="False" Visibility="Hidden"/>
|
||||
<!--cancel by wz-->
|
||||
<!--<DataGridTextColumn Header="{DynamicResource DateTime}" Width="180" Binding="{Binding CreateDatetime,StringFormat='yyyy-MM-dd HH:mm:ss'}" ElementStyle="{StaticResource DataGridCellStyle}"/>-->
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
29
Cowain.Bake.UI/Home/Views/WorkOrderView.xaml.cs
Normal file
29
Cowain.Bake.UI/Home/Views/WorkOrderView.xaml.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
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.Home.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// WorkOrderView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class WorkOrderView : UserControl
|
||||
{
|
||||
public WorkOrderView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
108
Cowain.Bake.UI/ProductManagement/ViewModels/DBLogViewModel.cs
Normal file
108
Cowain.Bake.UI/ProductManagement/ViewModels/DBLogViewModel.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Model;
|
||||
using HandyControl.Controls;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.ProductManagement.ViewModels
|
||||
{
|
||||
public class DBLogViewModel: ViewModelBase
|
||||
{
|
||||
public DBLogViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "日志查询";
|
||||
SetCombox();
|
||||
}
|
||||
private ObservableCollection<TLog> logList;
|
||||
public ObservableCollection<TLog> LogList
|
||||
{
|
||||
get => logList ?? (logList = new ObservableCollection<TLog>());
|
||||
set { SetProperty(ref logList, value); }
|
||||
}
|
||||
private DateTime _startTime = DateTime.Now.AddHours(-4);
|
||||
public DateTime StartDatetime
|
||||
{
|
||||
get { return _startTime; }
|
||||
set { SetProperty(ref _startTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
|
||||
private DateTime _endTime = DateTime.Now.AddHours(4);
|
||||
public DateTime EndDatetime
|
||||
{
|
||||
get { return _endTime; }
|
||||
set { SetProperty(ref _endTime, DateTime.Parse(value.ToString("yyyy-MM-dd HH:mm:ss"))); }
|
||||
}
|
||||
private string _logText=string.Empty;
|
||||
public string LogText
|
||||
{
|
||||
get { return _logText; }
|
||||
set { SetProperty(ref _logText, value); }
|
||||
}
|
||||
|
||||
public string selectLogLevel;
|
||||
public string SelectLogLevel
|
||||
{
|
||||
get => selectLogLevel;
|
||||
set => SetProperty(ref selectLogLevel, value);
|
||||
}
|
||||
|
||||
private List<string> listLogLevel;
|
||||
public List<string> ListLogLevel
|
||||
{
|
||||
get => listLogLevel;
|
||||
set => SetProperty(ref listLogLevel, value);
|
||||
}
|
||||
|
||||
private void SetCombox()
|
||||
{
|
||||
ListLogLevel = new List<string>();
|
||||
|
||||
foreach (E_LogType level in System.Enum.GetValues(typeof(E_LogType)))
|
||||
{
|
||||
ListLogLevel.Add(level.GetDescription());
|
||||
}
|
||||
|
||||
SelectLogLevel = E_LogType.Operate.GetDescription();
|
||||
}
|
||||
|
||||
public DelegateCommand<object> QueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
logList.Clear();
|
||||
E_LogType logType = EnumHelper.GetValueByDescription<E_LogType>(SelectLogLevel);
|
||||
//var list = EnumHelper.GetEnumList<E_LogType>().Where(item => item.EnumDesc == SelectLogLevel);
|
||||
//string level = list.FirstOrDefault().EnumString;
|
||||
var logService = _unityContainer.Resolve<LogService>();
|
||||
List<Model.TLog> logListTemporary;
|
||||
//if (string.IsNullOrEmpty(level))
|
||||
//{
|
||||
// //logListTemporary = logService.QueryByTime(StartDatetime, EndDatetime);
|
||||
// LogHelper.Instance.Warn("日志级别不能为空",null, true);
|
||||
// return;
|
||||
//}
|
||||
//else
|
||||
{
|
||||
logListTemporary = logService.QueryByTimeAndText(StartDatetime, EndDatetime, logType);
|
||||
}
|
||||
if (logListTemporary.Count != 0)
|
||||
{
|
||||
logListTemporary.ForEach(item => logList.Add(item));
|
||||
Growl.Success("查询完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("没有数据!");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
//using GalaSoft.MvvmLight.Command;
|
||||
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 Prism.Commands;
|
||||
|
||||
namespace Cowain.Bake.UI.ProductManagement.ViewModels
|
||||
{
|
||||
public class DisableStoveViewModel
|
||||
{
|
||||
private IUnityContainer _unityContainer;
|
||||
//public RelayCommand SaveCommand { get; set; }
|
||||
public DisableStoveViewModel(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
DisplayInfo();
|
||||
}
|
||||
public ObservableCollection<TStation> MachineList { get; set; } = new ObservableCollection<TStation>();
|
||||
public DelegateCommand<object> SaveCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
foreach (var item in MachineList)
|
||||
{
|
||||
_unityContainer.Resolve<StationService>().UpdateEnableStatus(item);
|
||||
}
|
||||
Common.Core.CommonCoreHelper.Instance.MainViewAutoEvent.Set();
|
||||
HandyControl.Controls.Growl.Success("保存成功!");
|
||||
});
|
||||
private void DisplayInfo()
|
||||
{
|
||||
_unityContainer.Resolve<StationService>().GetAll().ForEach(item => MachineList.Add(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.ProductManagement.ViewModels
|
||||
{
|
||||
public class EleTableViewModel : ViewModelBase
|
||||
{
|
||||
public string selectStationId;
|
||||
public string SelectStationId
|
||||
{
|
||||
get => selectStationId;
|
||||
set => SetProperty(ref selectStationId, value);
|
||||
}
|
||||
|
||||
private List<string> listStationId;
|
||||
public List<string> ListStationId
|
||||
{
|
||||
get => listStationId;
|
||||
set => SetProperty(ref listStationId, value);
|
||||
}
|
||||
|
||||
private ObservableCollection<TElectricEnergy> eleList;
|
||||
public ObservableCollection<TElectricEnergy> EellList
|
||||
{
|
||||
get => eleList ?? (eleList = new ObservableCollection<TElectricEnergy>());
|
||||
set { SetProperty(ref eleList, value); }
|
||||
}
|
||||
//IUnityContainer _unityContainer ;
|
||||
List<TElectricEnergy> queryData = null;
|
||||
List<TStation> _stations = null;
|
||||
public EleTableViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
_stations = _unityContainer.Resolve<StationService>().GetStationsByType((int)EStationType.Stove);
|
||||
this.PageTitle = "电表查询";
|
||||
SetCombox();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void SetCombox()
|
||||
{
|
||||
ListStationId = new List<string>();
|
||||
|
||||
foreach (var station in _stations)
|
||||
{
|
||||
ListStationId.Add(station.Desc);
|
||||
}
|
||||
|
||||
selectStationId = ListStationId[0];
|
||||
}
|
||||
|
||||
public DelegateCommand<object> QueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
EellList.Clear();
|
||||
var station = _stations.Where(s=>s.Desc == selectStationId).FirstOrDefault();
|
||||
queryData = _unityContainer.Resolve<ElectricEnergyService>().Query(station.Id, StartTime, EndTime);
|
||||
if (0 == queryData.Count)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("查询数据为空!");
|
||||
return;
|
||||
}
|
||||
queryData.ForEach(item => EellList.Add(item));
|
||||
});
|
||||
|
||||
public DelegateCommand<object> ExportCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
if (0 == queryData.Count)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("数据为空,请先查询数据!");
|
||||
return;
|
||||
}
|
||||
|
||||
CSVHelper.WriteDataTableToCsv(queryData, new List<string>() { "序号", "烤箱编号", "A相电流" , "B相电流", "C相电流","A相电压", "B相电压", "C相电压", "电能","创建时间" });
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Model;
|
||||
using HandyControl.Controls;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.ProductManagement.ViewModels
|
||||
{
|
||||
public class TaskMaintainViewModel : ViewModelBase //BindableBase
|
||||
{
|
||||
private string _title;
|
||||
public string Title
|
||||
{
|
||||
get { return _title; }
|
||||
set { SetProperty(ref _title, value); }
|
||||
}
|
||||
|
||||
private TTaskType selectTask;
|
||||
public TTaskType SelectTask
|
||||
{
|
||||
get => selectTask ?? (selectTask = new TTaskType());
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectTask, value);
|
||||
}
|
||||
}
|
||||
|
||||
private TTaskType _editTask;
|
||||
public TTaskType EditTask
|
||||
{
|
||||
get => _editTask ?? (_editTask = new TTaskType());
|
||||
set
|
||||
{
|
||||
SetProperty(ref _editTask, value);
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<TTaskType> _taskList;
|
||||
public ObservableCollection<TTaskType> TaskList
|
||||
{
|
||||
//get { return _taskList; }
|
||||
get => _taskList ?? (_taskList = new ObservableCollection<TTaskType>());
|
||||
set { SetProperty(ref _taskList, value); }
|
||||
}
|
||||
|
||||
private List<string> machineList;
|
||||
public List<string> MachineList
|
||||
{
|
||||
get => machineList ?? (machineList = new List<string>());
|
||||
set { SetProperty(ref machineList, value); }
|
||||
}
|
||||
|
||||
private List<string> _palletStatusList;
|
||||
public List<string> PalletStatusList
|
||||
{
|
||||
get => _palletStatusList ?? (_palletStatusList = new List<string>());
|
||||
set { SetProperty(ref _palletStatusList, value); }
|
||||
}
|
||||
|
||||
|
||||
public TaskMaintainViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
_taskList = new ObservableCollection<TTaskType>();
|
||||
_unityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
PalletStatusList = EPalletStatus.Loading.GetListDesc();
|
||||
MachineList = EnumHelper.GetDescriptions<EStationType>();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public DelegateCommand EnableCommand => new DelegateCommand(() =>
|
||||
{
|
||||
if (SelectTask != null && SelectTask.Id > 0)
|
||||
{
|
||||
var tServices = _unityContainer.Resolve<TaskTypeService>();
|
||||
|
||||
var res = tServices.UpdateEnableTask(SelectTask.Id, !SelectTask.Enable);
|
||||
if (res > 0)
|
||||
{
|
||||
Growl.Success("是否启用任务修改完成!");
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("是否启用任务失败!");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
public DelegateCommand SelectCommand => new DelegateCommand(() =>
|
||||
{
|
||||
if (SelectTask != null && SelectTask.Id > 0)
|
||||
{
|
||||
//深拷贝
|
||||
EditTask = BasicFramework.DeepCopy<TTaskType>(SelectTask);
|
||||
}
|
||||
});
|
||||
|
||||
public DelegateCommand AddCommand => new DelegateCommand(() =>
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Ask($@"是否确定要添加任务?", "操作提示");
|
||||
if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var res = _unityContainer.Resolve<TaskTypeService>().AddTaskConfig(EditTask);
|
||||
if (res > 0)
|
||||
{
|
||||
Growl.Success("任务添加完成!");
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("任务添加失败!");
|
||||
}
|
||||
});
|
||||
|
||||
public DelegateCommand EditCommand => new DelegateCommand(() =>
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Ask($@"是否确定要修改任务?", "操作提示");
|
||||
if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var res = _unityContainer.Resolve<TaskTypeService>().EditTaskConfig(EditTask);
|
||||
if (res > 0)
|
||||
{
|
||||
Growl.Success("任务修改完成!");
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Fatal("任务修改失败,优先级不存在!");
|
||||
}
|
||||
});
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
TaskList.Clear();
|
||||
List<TTaskType> list = _unityContainer.Resolve<TaskTypeService>().GetAll();
|
||||
list.ForEach(p => TaskList.Add(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
215
Cowain.Bake.UI/ProductManagement/ViewModels/TaskViewModel.cs
Normal file
215
Cowain.Bake.UI/ProductManagement/ViewModels/TaskViewModel.cs
Normal file
@@ -0,0 +1,215 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Common.Interface;
|
||||
using Cowain.Bake.Model;
|
||||
using HandyControl.Controls;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.ProductManagement.ViewModels
|
||||
{
|
||||
public class TaskViewModel: ViewModelBase, INavigationAware
|
||||
{
|
||||
//
|
||||
private DateTime _startTime = DateTime.Now.AddHours(-4);
|
||||
public new DateTime StartTime
|
||||
{
|
||||
get { return _startTime; }
|
||||
set { SetProperty(ref _startTime, value); }
|
||||
}
|
||||
|
||||
private DateTime _endTime = DateTime.Now.AddHours(10);
|
||||
public new DateTime EndTime
|
||||
{
|
||||
get { return _endTime; }
|
||||
set { SetProperty(ref _endTime, value); }
|
||||
}
|
||||
|
||||
private ObservableCollection<TTaskRecord> _taskList;
|
||||
public ObservableCollection<TTaskRecord> TaskList
|
||||
{
|
||||
get => _taskList ?? (_taskList = new ObservableCollection<TTaskRecord>());
|
||||
set { SetProperty(ref _taskList, value); }
|
||||
}
|
||||
|
||||
private ObservableCollection<TTaskStep> _taskStepList;
|
||||
public ObservableCollection<TTaskStep> TaskStepList
|
||||
{
|
||||
get => _taskStepList ?? (_taskStepList = new ObservableCollection<TTaskStep>());
|
||||
set { SetProperty(ref _taskStepList, value); }
|
||||
}
|
||||
private TTaskStep _selectTaskStep;
|
||||
public TTaskStep SelectTaskStep
|
||||
{
|
||||
get => _selectTaskStep ?? (_selectTaskStep = new TTaskStep());
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectTaskStep, value);
|
||||
}
|
||||
}
|
||||
|
||||
private TTaskRecord _selectTaskRecord;
|
||||
public TTaskRecord SelectTaskRecord
|
||||
{
|
||||
get => _selectTaskRecord ?? (_selectTaskRecord = new TTaskRecord());
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectTaskRecord, value);
|
||||
}
|
||||
}
|
||||
//public Dictionary<int, string> SexDict { get; } = new Dictionary<int, string>();
|
||||
public TaskViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "调度记录";
|
||||
|
||||
//var models =_unityContainer.Resolve<RgvActionService>().GetAll();
|
||||
//foreach(var item in models)
|
||||
//{
|
||||
// SexDict.Add(item.Cmd, item.Desc);
|
||||
//}
|
||||
}
|
||||
public DelegateCommand SelectCommand => new DelegateCommand(() =>
|
||||
{
|
||||
if (SelectTaskRecord != null && SelectTaskRecord.Id > 0)
|
||||
{
|
||||
TaskStepList.Clear();
|
||||
var models = _unityContainer.Resolve<TaskStepService>().GetTaskAllStep(SelectTaskRecord.Id);
|
||||
models.ForEach(item => TaskStepList.Add(item));
|
||||
}
|
||||
});
|
||||
|
||||
public DelegateCommand SendCommand => new DelegateCommand(() =>
|
||||
{
|
||||
if (null == SelectTaskRecord
|
||||
|| 0 == SelectTaskRecord.Id
|
||||
|| 0 == SelectTaskRecord.Target)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Info("请选择任务!", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((int)ETaskStatus.ExecutionCompleted == SelectTaskRecord.Status)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("已经完成的任务不能再发送!", "警告");
|
||||
return;
|
||||
}
|
||||
|
||||
if (SelectTaskStep != null)
|
||||
{
|
||||
if ((ETaskStep)SelectTaskStep.StepId == ETaskStep.None
|
||||
|| (ETaskStep)SelectTaskStep.StepId == ETaskStep.Unexecuted
|
||||
|| (ETaskStep)SelectTaskStep.StepId == ETaskStep.Finish)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("请选择任务步骤!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (System.Windows.MessageBoxResult.OK ==
|
||||
HandyControl.Controls.MessageBox.Ask($"你确定重新发送【{((ETaskStep)SelectTaskStep.StepId).GetDescription()}】指令到PLC?", "发送指令"))
|
||||
{
|
||||
if(_unityContainer.Resolve<ICommonFun>().ManualTaskCmd(SelectTaskRecord, (short)SelectTaskStep.StepId))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Info("发送成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Fatal("发送失败,请重新发送!","警示");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
public async override void Refresh()
|
||||
{
|
||||
TaskList.Clear();
|
||||
|
||||
var listTask = await System.Threading.Tasks.Task.Run(() =>
|
||||
{
|
||||
//从数据库查询任务
|
||||
return _unityContainer.Resolve<TaskRecordService>().GetAllTaskRun();
|
||||
});
|
||||
listTask = UpdetaListStatus(listTask);
|
||||
listTask.ForEach(x => TaskList.Add(x));
|
||||
}
|
||||
|
||||
public DelegateCommand<object> QueryCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
TaskList.Clear();
|
||||
var queryTask = _unityContainer.Resolve<TaskRecordService>().Query(StartTime, EndTime);
|
||||
|
||||
if (0 != queryTask.Count)
|
||||
{
|
||||
queryTask = UpdetaListStatus(queryTask);
|
||||
queryTask.ForEach(item => TaskList.Add(item));
|
||||
Growl.Success("查询完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("没有数据!");
|
||||
}
|
||||
});
|
||||
public List<TTaskRecord> UpdetaListStatus(List<TTaskRecord> taskRunList)
|
||||
{
|
||||
foreach (var item in taskRunList)
|
||||
{
|
||||
if (item.Status != (int)ETaskStatus.ExecutionCompleted)
|
||||
{
|
||||
item.Status = (int)ETaskStatus.None;
|
||||
}
|
||||
}
|
||||
return taskRunList;
|
||||
}
|
||||
public DelegateCommand<object> DeleteCommand => new DelegateCommand<object>((x) =>
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Ask($@"是否确定要删除任务?", "操作提示");
|
||||
if (result == System.Windows.MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var taskService = _unityContainer.Resolve<TaskRecordService>();
|
||||
var task = x as TTaskRecord;
|
||||
if (task != null)
|
||||
{
|
||||
int delCount = taskService.DeleteTask(task.Id);
|
||||
if (delCount > 0)
|
||||
{
|
||||
//如果是未执行完成的任务,要清除主界面
|
||||
if (task.Status != (int)ETaskStatus.ExecutionCompleted)
|
||||
{
|
||||
task.StepId = (int)ETaskStep.None;
|
||||
CommonCoreHelper.Instance.BlockTask.Add(task);
|
||||
}
|
||||
|
||||
LogHelper.Instance.Debug($"删除了一条任务,取盘位置{task.Source},放盘位置{task.Target},托盘ID{task.PalletId}");
|
||||
Growl.Success("任务删除完成!");
|
||||
this.Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Success("任务删除失败!");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
// 导航到当前页面时的处理逻辑,先执行构造方法,再执行本方法
|
||||
}
|
||||
|
||||
bool INavigationAware.IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return false; //false:表示每次导航都创建新实例,不重用旧实例; true:用旧实例,不会执行构造方法
|
||||
}
|
||||
|
||||
void INavigationAware.OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
//相当于析构方法,退出时(切换时)再执行。
|
||||
// 在这里添加释放旧视图实例资源的代码
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Cowain.Bake.UI/ProductManagement/Views/DBLogView.xaml
Normal file
33
Cowain.Bake.UI/ProductManagement/Views/DBLogView.xaml
Normal file
@@ -0,0 +1,33 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.ProductManagement.Views.DBLogView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.ProductManagement.Views"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="900">
|
||||
<UserControl.Resources>
|
||||
<convertor:LogTypeConverter x:Key="logTypeConvertor"></convertor:LogTypeConverter>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<DataGrid ItemsSource="{Binding LogList}" Margin="0,40,0,0" AutoGenerateColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="50" CanUserResize="False" Binding="{Binding Id}" Header="序号" Visibility="Hidden"/>
|
||||
<DataGridTextColumn Width="150" Binding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm:ss}" Header="时间" Visibility="Visible"/>
|
||||
<DataGridTextColumn Width="100" CanUserResize="True" Binding="{Binding Level, Converter={StaticResource logTypeConvertor}}" Header="日志级别" Visibility="Visible"/>
|
||||
<DataGridTextColumn Width="800" CanUserResize="True" Binding="{Binding Content}" Header="内容" Visibility="Visible"/>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<hc:DateTimePicker x:Name="startTime" Text="{Binding StartDatetime,Mode=TwoWay}" HorizontalAlignment="Left" Margin="62,5,0,0" VerticalAlignment="Top" Width="163"/>
|
||||
<Label Content="时间:" HorizontalAlignment="Left" Margin="5,5,0,0" VerticalAlignment="Top"/>
|
||||
<hc:DateTimePicker x:Name="endTime" Text="{Binding EndDatetime,Mode=TwoWay}" HorizontalAlignment="Left" Margin="235,5,0,0" VerticalAlignment="Top" Width="185"/>
|
||||
<Label Content="内容:" HorizontalAlignment="Left" Margin="438,5,0,0" VerticalAlignment="Top"/>
|
||||
<ComboBox ItemsSource="{Binding ListLogLevel}" FontWeight="Bold" SelectedValue="{Binding SelectLogLevel,Mode=TwoWay}" Margin="492,5,0,0" IsReadOnly="True" HorizontalAlignment="Left" VerticalAlignment="Top" Width="135"/>
|
||||
<!--<TextBox HorizontalAlignment="Left" Margin="492,5,0,0" TextWrapping="NoWrap" Text="{Binding LogText}" VerticalAlignment="Top" Width="178"/>-->
|
||||
<Button x:Name="report" Content="查询" Style="{StaticResource ButtonSuccess}" HorizontalAlignment="Left" Margin="679,5,0,0"
|
||||
VerticalAlignment="Top" Width="61" Command="{Binding QueryCommand}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
27
Cowain.Bake.UI/ProductManagement/Views/DBLogView.xaml.cs
Normal file
27
Cowain.Bake.UI/ProductManagement/Views/DBLogView.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
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.Shapes;
|
||||
|
||||
namespace Cowain.Bake.UI.ProductManagement.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DBLog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DBLogView : UserControl
|
||||
{
|
||||
public DBLogView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Cowain.Bake.UI/ProductManagement/Views/DisableStove.xaml
Normal file
21
Cowain.Bake.UI/ProductManagement/Views/DisableStove.xaml
Normal file
@@ -0,0 +1,21 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.ProductManagement.Views.DisableStove"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
Loaded="DisableStove_Loaded"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<DataGrid ItemsSource="{Binding MachineList}" AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="10,65,0,0" VerticalAlignment="Top">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="序号" Binding="{Binding Id}" Width="100"/>
|
||||
<DataGridTextColumn Header="名称" Binding="{Binding Desc}" Width="150"/>
|
||||
<DataGridTextColumn Header="编号" Binding="{Binding Number}" Width="100"/>
|
||||
<DataGridCheckBoxColumn Header="可用" Binding="{Binding Enable}" Width="100"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Content="保存" Style="{StaticResource ButtonSuccess}" Command="{Binding SaveCommand}" HorizontalAlignment="Left" Margin="10,13,0,0" VerticalAlignment="Top" Width="115" Height="40"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
34
Cowain.Bake.UI/ProductManagement/Views/DisableStove.xaml.cs
Normal file
34
Cowain.Bake.UI/ProductManagement/Views/DisableStove.xaml.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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.ProductManagement.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DisableStove.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DisableStove : UserControl
|
||||
{
|
||||
public DisableStove()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void DisableStove_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Cowain.Bake.UI/ProductManagement/Views/EleTableView.xaml
Normal file
50
Cowain.Bake.UI/ProductManagement/Views/EleTableView.xaml
Normal file
@@ -0,0 +1,50 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.ProductManagement.Views.EleTableView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.ProductManagement.Views"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="900"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True" >
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,10" HorizontalAlignment="Center" Width="880" >
|
||||
<TextBlock VerticalAlignment="Center" Margin="4">日期:</TextBlock>
|
||||
<hc:DatePicker Width="110" Height="30" Margin="4" Text="{Binding Date,Mode=TwoWay}"></hc:DatePicker>
|
||||
<TextBlock VerticalAlignment="Center" Margin="4">时间:</TextBlock>
|
||||
<hc:TimePicker Height="30" Text="{Binding StartTime,Mode=OneWayToSource,FallbackValue='{x:Static sys:DateTime.Now}'}"></hc:TimePicker>
|
||||
<TextBlock VerticalAlignment="Center">-</TextBlock>
|
||||
<hc:TimePicker Height="30" Text="{Binding EndTime,Mode=OneWayToSource,FallbackValue='{x:Static sys:DateTime.Now}'}"></hc:TimePicker>
|
||||
<Label Content="炉号:" VerticalAlignment="Center" Margin="100,0,0,0"/>
|
||||
<ComboBox ItemsSource="{Binding ListStationId}" FontWeight="Bold" SelectedValue="{Binding SelectStationId,Mode=TwoWay}" IsReadOnly="True" Width="135"/>
|
||||
<Button Content="查询" Style="{StaticResource ButtonSuccess}" HorizontalAlignment="Left" Margin="20,0,0,0" Width="80" Command="{Binding QueryCommand}"/>
|
||||
<Button Content="导出" Style="{StaticResource ButtonPrimary}" HorizontalAlignment="Left" Margin="20,0,0,0" Width="80" Command="{Binding ExportCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvStation" Grid.Row="1"
|
||||
SelectionMode="Single" Margin="4" IsReadOnly="True" CanUserSortColumns="False"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding EellList,UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Width="90" Binding="{Binding Id}" Header="序号" />-->
|
||||
<DataGridTextColumn Width="150" Binding="{Binding CreateTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="创建时间" />
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding ElectricityA}" Header="A相电流"/>
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding ElectricityB}" Header="B相电流"/>
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding ElectricityC}" Header="C相电流"/>
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding VoltageA}" Header="A相电压A"/>
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding VoltageB}" Header="B相电压"/>
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding VoltageC}" Header="C相电压"/>
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding VoltageB}" Header="B相电压"/>
|
||||
<DataGridTextColumn Width="100" CanUserResize="False" Binding="{Binding ElectricEnergy}" Header="电能"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/ProductManagement/Views/EleTableView.xaml.cs
Normal file
28
Cowain.Bake.UI/ProductManagement/Views/EleTableView.xaml.cs
Normal file
@@ -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.ProductManagement.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// EleTableView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class EleTableView : UserControl
|
||||
{
|
||||
public EleTableView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
124
Cowain.Bake.UI/ProductManagement/Views/TaskMaintainView.xaml
Normal file
124
Cowain.Bake.UI/ProductManagement/Views/TaskMaintainView.xaml
Normal file
@@ -0,0 +1,124 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.ProductManagement.Views.TaskMaintainView"
|
||||
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:converter="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="900" d:DesignWidth="1400">
|
||||
<UserControl.Resources>
|
||||
<converter:EnumDescriptionConverter x:Key="DescriptionConverter"/>
|
||||
<converter:PalletStatusConvertor x:Key="CPalletStatus"/>
|
||||
<converter:StationTypeConverter x:Key="CMachineType"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="280"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvStation"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" SelectedItem="{Binding SelectTask}"
|
||||
IsReadOnly="True" HorizontalScrollBarVisibility="Auto"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding TaskList}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding SelectCommand}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<!--<DataGrid.RowHeaderTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=DataGridRow}}"/>
|
||||
</DataTemplate>
|
||||
</DataGrid.RowHeaderTemplate>-->
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="删除选择" Command="{Binding DeleteSelectCommand}"/>
|
||||
<MenuItem Header="启用/禁用" Command="{Binding EnableCommand}"/>
|
||||
<MenuItem Header="导入"/>
|
||||
<MenuItem Header="导出"/>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="66" Binding="{Binding Id}" Header="序号"/>
|
||||
<DataGridTextColumn MinWidth="120" Binding="{Binding Name}" Header="任务名称"/>
|
||||
<DataGridTextColumn Width="66" Binding="{Binding Priority}" Header="优先级"/>
|
||||
<DataGridTextColumn Width="100" Binding="{Binding SourceDeviceType,Converter={StaticResource CMachineType}}" Header="源设备类型"/>
|
||||
<DataGridTextColumn Width="100" Binding="{Binding TargetDeviceType,Converter={StaticResource CMachineType}}" Header="目标设备类型"/>
|
||||
<DataGridTextColumn MinWidth="120" Binding="{Binding PalletStatus,Converter={StaticResource CPalletStatus}}" Header="夹具状态"/>
|
||||
<DataGridCheckBoxColumn Width="60" Binding="{Binding Enable}" Header="启用" IsReadOnly="True"/>
|
||||
<DataGridTextColumn MinWidth="120" Binding="{Binding Json}" Header="备注"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Border Background="#EEE" Grid.Column="1" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<Grid Grid.Column="1">
|
||||
<ScrollViewer>
|
||||
<StackPanel HorizontalAlignment="Left" Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<Label Content="优先级数字越小,优先级越高,越先执行!" FontSize="14" Margin="2" HorizontalContentAlignment="Left" Width="auto" Foreground="red" Height="30" Background="Transparent"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<Label Content="优先级" FontSize="14" Margin="2" HorizontalContentAlignment="Left" Width="120" Height="30" Background="Transparent"/>
|
||||
<hc:NumericUpDown Maximum="50" Minimum="0" Increment="1" HorizontalContentAlignment="Center" Value="{Binding EditTask.Priority}" Width="130"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<Label Content="源设备类型" FontSize="14" HorizontalContentAlignment="Left" Margin="2" Width="120" Height="30" Background="Transparent"/>
|
||||
<hc:ComboBox Margin="2" FontSize="14" Width="130" Height="30"
|
||||
ItemsSource="{Binding MachineList}" SelectedValue="{Binding EditTask.SourceDeviceType,Converter={StaticResource CMachineType}}"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center">
|
||||
</hc:ComboBox>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<Label Content="目标设备类型" FontSize="14" HorizontalContentAlignment="Left" Margin="2" Width="120" Height="30" Background="Transparent"/>
|
||||
<hc:ComboBox Margin="2" FontSize="14" Width="130" Height="30"
|
||||
ItemsSource="{Binding MachineList}" SelectedValue="{Binding EditTask.TargetDeviceType,Converter={StaticResource CMachineType}}"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center">
|
||||
</hc:ComboBox>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<Label Content="夹具状态" FontSize="14" HorizontalContentAlignment="Left" Margin="2" Width="120" Height="30" Background="Transparent"/>
|
||||
<hc:ComboBox Margin="2" FontSize="14" Width="130" Height="30"
|
||||
ItemsSource="{Binding PalletStatusList}" SelectedValue="{Binding EditTask.PalletStatus,Converter={StaticResource CPalletStatus}}"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center">
|
||||
</hc:ComboBox>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<Label Content="是否启用" FontSize="14" Margin="2" HorizontalContentAlignment="Left" Width="120" Height="30" Background="Transparent"/>
|
||||
<CheckBox HorizontalContentAlignment="Center" Margin="2" FontSize="14" Width="130" Height="30" IsChecked ="{Binding EditTask.Enable}"/>
|
||||
</StackPanel>
|
||||
<!--<StackPanel Orientation="Horizontal" Margin="2">
|
||||
<Label Content="目标夹具状态" HorizontalContentAlignment="Left" FontSize="14" Margin="2" Width="120" Height="30" Background="Transparent"/>
|
||||
<ComboBox Margin="2" FontSize="14" Width="130" Height="30"
|
||||
ItemsSource="{Binding Source={StaticResource PStatus},Path=PalletStatusList}" SelectedValue="{Binding EditTask.TargetPStatus}"
|
||||
DisplayMemberPath="Name" SelectedValuePath="State"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center">
|
||||
</ComboBox>
|
||||
</StackPanel>-->
|
||||
|
||||
<Label Content="名称:" HorizontalAlignment="Left" FontSize="14" Margin="4" Height="30" FontWeight="Bold" BorderThickness="0" Background="Transparent"/>
|
||||
<hc:TextBox Margin="4" Text="{Binding EditTask.Name}" Width="254"
|
||||
VerticalScrollBarVisibility="Visible" AcceptsReturn="True"
|
||||
HorizontalAlignment="Left" TextWrapping="Wrap"/>
|
||||
<Label Content="Json:" HorizontalAlignment="Left" FontSize="14" Margin="4" Height="30" FontWeight="Bold" BorderThickness="0" Background="Transparent"/>
|
||||
<TextBox Margin="4" Text="{Binding EditTask.Json}" Height="100" Width="254"
|
||||
VerticalScrollBarVisibility="Visible" AcceptsReturn="True"
|
||||
HorizontalAlignment="Left" TextWrapping="Wrap"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="2" HorizontalAlignment="Center">
|
||||
<Button Content="添加" Style="{StaticResource ButtonSuccess}" Margin="4" Width="100" Command="{Binding AddCommand}"/>
|
||||
<Button Content="修改" Style="{StaticResource ButtonWarning}" Margin="4" Width="100" Command="{Binding EditCommand}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,40 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Common;
|
||||
using Prism.Regions;
|
||||
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.ProductManagement.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// TaskMaintainView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TaskMaintainView : UserControl
|
||||
{
|
||||
public TaskMaintainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
//RegionContext.GetObservableContext(this).PropertyChanged += PersonDetail_PropertyChanged;
|
||||
}
|
||||
|
||||
//private void PersonDetail_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
//{
|
||||
// var context = (ObservableObject<object>)sender;
|
||||
// var selectedPerson = (TTaskType)context.Value;
|
||||
// //(DataContext as PersonDetailViewModel).SelectedPerson = selectedPerson;
|
||||
//}
|
||||
}
|
||||
}
|
||||
87
Cowain.Bake.UI/ProductManagement/Views/TaskView.xaml
Normal file
87
Cowain.Bake.UI/ProductManagement/Views/TaskView.xaml
Normal file
@@ -0,0 +1,87 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.ProductManagement.Views.TaskView"
|
||||
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:bllConverter="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
xmlns:Converter="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="1200">
|
||||
<UserControl.Resources>
|
||||
<bllConverter:CavityInfoIdConverter x:Key="CavityInfoIdConverter"/>
|
||||
<bllConverter:PalletIdConverter x:Key="CPalletId"/>
|
||||
<bllConverter:TaskTypeConverter x:Key="TaskTypeConverter"/>
|
||||
<Converter:TaskCmdConvertor x:Key="TaskCmdConvertor"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#EEE" Margin="4" CornerRadius="6" BorderThickness="1"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="2,10,10,10" HorizontalAlignment="Right">
|
||||
<TextBlock VerticalAlignment="Center" Margin="4" FontSize="20" >生成时间范围:</TextBlock>
|
||||
<hc:DateTimePicker x:Name="startTime" Width="160" Height="30" Margin="4" Text="{Binding StartTime,Mode=TwoWay}" DateTimeFormat="yyyy-MM-dd HH:mm"></hc:DateTimePicker>
|
||||
<TextBlock VerticalAlignment="Center">—</TextBlock>
|
||||
<hc:DateTimePicker x:Name="endTime" Width="160" Height="30" Margin="4" Text="{Binding EndTime,Mode=TwoWay}" DateTimeFormat="yyyy-MM-dd HH:mm"></hc:DateTimePicker>
|
||||
<Button Content="查询" Style="{StaticResource ButtonSuccess}" Margin="4" Width="100" Command="{Binding QueryCommand}"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2.4*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvStation"
|
||||
CanUserSortColumns="True" SelectionMode="Single" Margin="4" IsReadOnly="True" SelectedItem="{Binding SelectTaskRecord}"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding TaskList}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding SelectCommand}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<DataGrid.Columns>
|
||||
|
||||
<DataGridTextColumn Width="80" CanUserResize="False" Binding="{Binding StepId,Converter={StaticResource TaskCmdConvertor}}" Header="任务步骤"/>
|
||||
<DataGridTextColumn Width="auto" CanUserResize="False" Binding="{Binding PalletId,Converter={StaticResource CPalletId}}" Header="夹具条码"/>
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding Source,Converter={StaticResource CavityInfoIdConverter}}" Header="取盘位置"/>
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding Target,Converter={StaticResource CavityInfoIdConverter}}" Header="放盘位置"/>
|
||||
<DataGridCheckBoxColumn Width="auto" Binding="{Binding Status}" IsReadOnly="True" Header="完成"/>
|
||||
<!--<DataGridTextColumn Width="150" Binding="{Binding BuildTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="生成时间" />-->
|
||||
<DataGridTextColumn Width="150" Binding="{Binding StartTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="开始时间"/>
|
||||
<DataGridTextColumn Width="150" Binding="{Binding EndTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="结束时间"/>
|
||||
<DataGridTextColumn Width="150" Binding="{Binding TaskTypeId,Converter={StaticResource TaskTypeConverter}}" Header="任务名称"/>
|
||||
<DataGridTemplateColumn Header="操作" Width="80">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBlock Margin="3,0" >
|
||||
<Hyperlink Foreground="Red" Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding}">删除</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<DataGrid hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" x:Name="dgvTaskSetp"
|
||||
CanUserSortColumns="True" SelectionMode="Single" Margin="4" IsReadOnly="True" Grid.Column="1"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding TaskStepList}" SelectedItem="{Binding SelectTaskStep}">
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="发送指令" Command="{Binding SendCommand}"/>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="60" CanUserResize="False" Binding="{Binding Count}" Header="计数"/>
|
||||
<DataGridTextColumn Width="80" CanUserResize="False" Binding="{Binding StepId,Converter={StaticResource TaskCmdConvertor}}" Header="指令"/>
|
||||
<DataGridTextColumn Width="150" Binding="{Binding StartTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="开始时间"/>
|
||||
<DataGridTextColumn Width="150" Binding="{Binding EndTime,StringFormat=yyyy-MM-dd HH:mm:ss}" Header="结束时间"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/ProductManagement/Views/TaskView.xaml.cs
Normal file
28
Cowain.Bake.UI/ProductManagement/Views/TaskView.xaml.cs
Normal file
@@ -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.ProductManagement.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// TaskView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TaskView : UserControl
|
||||
{
|
||||
public TaskView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
55
Cowain.Bake.UI/Properties/AssemblyInfo.cs
Normal file
55
Cowain.Bake.UI/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Cowain.Bake.UI")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Cowain.Bake.UI")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//若要开始生成可本地化的应用程序,请设置
|
||||
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
|
||||
//例如,如果您在源文件中使用的是美国英语,
|
||||
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
|
||||
//对以下 NeutralResourceLanguage 特性的注释。 更新
|
||||
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly:ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
|
||||
//(未在页面中找到资源时使用,
|
||||
//或应用程序资源字典中找到时使用)
|
||||
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
|
||||
//(未在页面中找到资源时使用,
|
||||
//、应用程序或任何主题专用资源字典中找到时使用)
|
||||
)]
|
||||
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
63
Cowain.Bake.UI/Properties/Resources.Designer.cs
generated
Normal file
63
Cowain.Bake.UI/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Cowain.Bake.UI.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Cowain.Bake.UI.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
Cowain.Bake.UI/Properties/Resources.resx
Normal file
117
Cowain.Bake.UI/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
Cowain.Bake.UI/Properties/Settings.Designer.cs
generated
Normal file
26
Cowain.Bake.UI/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Cowain.Bake.UI.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Cowain.Bake.UI/Properties/Settings.settings
Normal file
7
Cowain.Bake.UI/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
76
Cowain.Bake.UI/TaskModule.cs
Normal file
76
Cowain.Bake.UI/TaskModule.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using Cowain.Bake.Common.Interface;
|
||||
using Cowain.Bake.Common.Models;
|
||||
using Cowain.Bake.UI.UserManagerment.ViewModels;
|
||||
using Prism.Ioc;
|
||||
using Prism.Modularity;
|
||||
using Prism.Regions;
|
||||
using System.ComponentModel;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI
|
||||
{
|
||||
public class UI : IModule
|
||||
{
|
||||
private readonly IRegionManager _regionManager;
|
||||
public UI(IRegionManager regionManager)
|
||||
{
|
||||
_regionManager = regionManager;
|
||||
}
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
//containerProvider.Resolve<GlobalListData>();
|
||||
//var plist = containerProvider.Resolve<IPalletService>().GetPalletStatusList();
|
||||
//PalletStatus.PalletStatusList.AddRange(plist);
|
||||
|
||||
//_regionManager.RegisterViewWithRegion("InsulaTestBeforeInjectRegion", typeof(InsulaTestBeforeInjectView));
|
||||
//_regionManager.RegisterViewWithRegion("ShortCircuitTesterRegion", typeof(ShortCircuitTesterView));
|
||||
//_regionManager.RegisterViewWithRegion("WeightBeforeInjectRegion", typeof(WeightBeforeInjectView));
|
||||
//_regionManager.RegisterViewWithRegion("VacuumInjectionRegion", typeof(VacuumInjectionView));
|
||||
//_regionManager.RegisterViewWithRegion("WeightAfterInjectRegion", typeof(WeightAfterInjectView));
|
||||
//_regionManager.RegisterViewWithRegion("VacuumPackageRegion", typeof(VacuumPackageView));
|
||||
//_regionManager.RegisterViewWithRegion("WeightAfterPackageRegion", typeof(WeightAfterPackageView));
|
||||
//_regionManager.RegisterViewWithRegion("InsulaTestAfterPackageRegion", typeof(InsulaTestAfterPackageView));
|
||||
//_regionManager.RegisterViewWithRegion("UnLoadingScanCodeRegion", typeof(UnLoadingScanCodeView));
|
||||
//_regionManager.RegisterViewWithRegion("MarkingRegion", typeof(MarkingView));
|
||||
//_regionManager.RegisterViewWithRegion("OutboundMaterialBoxRegion", typeof(OutboundMaterialBoxView));
|
||||
|
||||
//_regionManager.RegisterViewWithRegion("ParasBasicRegion", typeof(SetParams.Views.SysSetupView));
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
//可以注册其他规则(比如干涉判断需要修改,继承TaskManage1,重写FilterTask方法)
|
||||
containerRegistry.RegisterForNavigation<Home.Views.WorkOrderView>();
|
||||
containerRegistry.RegisterForNavigation<Home.Views.ProcessParametersView>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<DataQuery.Views.ProductionsInfoView>();
|
||||
containerRegistry.RegisterForNavigation<DataQuery.Views.IncomingCellInfoView>();
|
||||
containerRegistry.RegisterForNavigation<DataQuery.Views.NGCellInfoView>();
|
||||
containerRegistry.RegisterForNavigation<DataQuery.Views.DummyInfoView>();
|
||||
containerRegistry.RegisterForNavigation<DataQuery.Views.BatteryInfoView>();
|
||||
containerRegistry.RegisterForNavigation<DataQuery.Views.PalletInfoView>();
|
||||
containerRegistry.RegisterForNavigation<DataQuery.Views.CurveView>();
|
||||
containerRegistry.RegisterForNavigation<DataQuery.Views.GetMesLogView>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<UserManagerment.Views.UserManagermentView>();
|
||||
containerRegistry.RegisterForNavigation<UserManagerment.Views.AuthorityManagementView>();
|
||||
containerRegistry.RegisterForNavigation<UserManagerment.Views.DeviceModeView>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<FactoryMaintenance.Views.DeviceManagementView>();
|
||||
containerRegistry.RegisterForNavigation<FactoryMaintenance.Views.SysSetupView>();
|
||||
containerRegistry.RegisterForNavigation<FactoryMaintenance.Views.PLCVarMonitorView>();
|
||||
containerRegistry.RegisterForNavigation<FactoryMaintenance.Views.MomOutboundView>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<ProductManagement.Views.TaskView>();
|
||||
containerRegistry.RegisterForNavigation<ProductManagement.Views.DisableStove>();
|
||||
containerRegistry.RegisterForNavigation<ProductManagement.Views.TaskMaintainView>();
|
||||
containerRegistry.RegisterForNavigation<ProductManagement.Views.DBLogView>();
|
||||
containerRegistry.RegisterForNavigation<ProductManagement.Views.EleTableView>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<Helper.Views.AboutWindowView>();
|
||||
containerRegistry.RegisterForNavigation<Helper.Views.HelpWindowView>();
|
||||
|
||||
containerRegistry.RegisterSingleton<DeviceModeViewModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Ioc;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using Prism.Commands;
|
||||
using HandyControl.Controls;
|
||||
|
||||
namespace Cowain.Bake.UI.UserManagerment.ViewModels
|
||||
{
|
||||
public class AuthorityManagementViewModel : ViewModelBase, INotifyPropertyChanged
|
||||
{
|
||||
public AuthorityManagementViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "权限管理";
|
||||
_unityContainer = unityContainer;
|
||||
RoleList = userService.GetAllRole();
|
||||
InitTreeView();
|
||||
SelectedRole= RoleList.FirstOrDefault();
|
||||
RefreshAuthority();
|
||||
}
|
||||
#region 绑定属性
|
||||
UserService userService = MyAppContainer.Current.Resolve<UserService>();
|
||||
|
||||
public new event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChange(string propName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
|
||||
}
|
||||
|
||||
//用于展示角色的listbox
|
||||
private List<TRoleInfo> roleList;
|
||||
|
||||
public List<TRoleInfo> RoleList
|
||||
{
|
||||
get { return roleList; }
|
||||
set { roleList = value; }
|
||||
}
|
||||
|
||||
//用于权限展示的treeview
|
||||
private ObservableCollection<AuthorityEntity> authorityList;
|
||||
|
||||
public ObservableCollection<AuthorityEntity> AuthorityList
|
||||
{
|
||||
get { return authorityList; }
|
||||
set { authorityList = value; }
|
||||
}
|
||||
|
||||
//选中的角色
|
||||
private TRoleInfo selectedRole;
|
||||
|
||||
public TRoleInfo SelectedRole
|
||||
{
|
||||
get { return selectedRole; }
|
||||
set
|
||||
{
|
||||
if (selectedRole != value)
|
||||
{
|
||||
selectedRole = value;
|
||||
OnPropertyChange(nameof(SelectedRole));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void InitTreeView()
|
||||
{
|
||||
AuthorityList = new ObservableCollection<AuthorityEntity>();
|
||||
var menuList = userService.GetAllMenuInfo();
|
||||
//第一个循环,循环父节点
|
||||
for (int i = 1; i <= menuList.Where(x=>x.ParentId==0).ToList().Count; i++)
|
||||
{
|
||||
var a = menuList.Where(p => p.Id == i).FirstOrDefault();
|
||||
AuthorityEntity parentItem = new AuthorityEntity
|
||||
{
|
||||
Header = a.Header,
|
||||
HeaderName = a.HeaderName,
|
||||
TargetView = a.TargetView,
|
||||
MenuId = a.Id,
|
||||
ParentId = a.ParentId,
|
||||
CheckboxVisibility = System.Windows.Visibility.Collapsed
|
||||
};
|
||||
|
||||
//第二个循环,循环子节点
|
||||
foreach(var item in menuList.Where(c => c.ParentId == i).ToList())
|
||||
{
|
||||
|
||||
|
||||
AuthorityEntity childItem = new AuthorityEntity
|
||||
{
|
||||
Header = item.Header,
|
||||
HeaderName = item.HeaderName,
|
||||
TargetView = item.TargetView,
|
||||
MenuId = item.Id,
|
||||
ParentId = item.ParentId,
|
||||
|
||||
CheckboxVisibility = System.Windows.Visibility.Visible
|
||||
|
||||
};
|
||||
parentItem.Children.Add(childItem);
|
||||
}
|
||||
|
||||
AuthorityList.Add(parentItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public DelegateCommand SaveCommand => new DelegateCommand(() =>
|
||||
{
|
||||
StringBuilder authorityString = new StringBuilder();
|
||||
foreach (var parentItem in AuthorityList)
|
||||
{
|
||||
foreach(var childitem in parentItem.Children)
|
||||
{
|
||||
if (childitem.IsHasAuthority)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(childitem.HeaderName))
|
||||
{
|
||||
authorityString.Append(childitem.HeaderName);
|
||||
authorityString.Append(";");
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SelectedRole.AccessNode= authorityString.ToString();
|
||||
_unityContainer.Resolve<RoleInfoService>().Update(SelectedRole);
|
||||
Growl.Success("保存成功!");
|
||||
});
|
||||
|
||||
public DelegateCommand ListBoxSelectionChangedCommand => new DelegateCommand(() =>
|
||||
{
|
||||
RefreshAuthority();
|
||||
});
|
||||
|
||||
public void RefreshAuthority()
|
||||
{
|
||||
string authority = userService.GetAuthority(selectedRole.RoleName);
|
||||
foreach (var parent in AuthorityList)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (string.IsNullOrEmpty(child.HeaderName))
|
||||
{
|
||||
child.IsHasAuthority = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
child.IsHasAuthority = authority.Contains(child.HeaderName) ? true : false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
147
Cowain.Bake.UI/UserManagerment/ViewModels/DeviceModeViewModel.cs
Normal file
147
Cowain.Bake.UI/UserManagerment/ViewModels/DeviceModeViewModel.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Communication.MOM;
|
||||
using Cowain.Bake.Model;
|
||||
using Newtonsoft.Json;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using System.Windows.Input;
|
||||
using Unity;
|
||||
using static Cowain.Bake.Common.Models.MESModel;
|
||||
|
||||
namespace Cowain.Bake.UI.UserManagerment.ViewModels
|
||||
{
|
||||
public class DeviceModeViewModel : BindableBase
|
||||
{
|
||||
TDeviceConfig dev;
|
||||
private string _userName;
|
||||
public string UserName
|
||||
{
|
||||
get { return _userName; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _userName, value);
|
||||
}
|
||||
}
|
||||
private string _userPwa;
|
||||
public string UserPwa
|
||||
{
|
||||
get { return _userPwa; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _userPwa, value);
|
||||
}
|
||||
}
|
||||
private string _url;
|
||||
public string Url
|
||||
{
|
||||
get { return _url; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _url, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int _selectedRadioButtonIndex;
|
||||
public int SelectedRadioButtonIndex
|
||||
{
|
||||
get { return _selectedRadioButtonIndex; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectedRadioButtonIndex, value);
|
||||
}
|
||||
}
|
||||
public class CloseWindowEvent : PubSubEvent
|
||||
{
|
||||
public CloseWindowEvent()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
private IEventAggregator _eventAggregator;
|
||||
private IUnityContainer _unityContainer;
|
||||
public DeviceModeViewModel(IUnityContainer unityContainer, IEventAggregator eventAggregator)
|
||||
{
|
||||
//初始化数据库连接池
|
||||
_unityContainer = unityContainer;
|
||||
_eventAggregator = eventAggregator;
|
||||
string v = _unityContainer.Resolve<BLL.SysSetupService>().GetValueByParaID(ESysSetup.MOMMode.ToString());
|
||||
SelectedRadioButtonIndex = int.Parse(v);
|
||||
dev = _unityContainer.Resolve<DeviceConfigService>().GetConfig(EDeviceType.MOM)[0];
|
||||
dynamic d = JsonConvert.DeserializeObject<dynamic>(dev.Json);
|
||||
_url = d.URL;
|
||||
|
||||
}
|
||||
|
||||
public ICommand ExitCommand
|
||||
{
|
||||
get => new DelegateCommand<object>(OnExit);
|
||||
}
|
||||
|
||||
public ICommand SwitchCommand
|
||||
{
|
||||
get => new DelegateCommand<object>(OnSwitch);
|
||||
}
|
||||
|
||||
//public ICommand MesIpUpdateCommand
|
||||
//{
|
||||
// get => new DelegateCommand<object>(OnMesUpdate);
|
||||
//}
|
||||
|
||||
private void OnExit(object obj )
|
||||
{
|
||||
_eventAggregator.GetEvent<CloseWindowEvent>().Publish();
|
||||
}
|
||||
// _unityContainer.Resolve<SysSetupService>().GetValueByParaID(ESysSetup.MOMMode.ToString())
|
||||
public void OnSwitch(object obj)
|
||||
{
|
||||
if (string.IsNullOrEmpty(UserName)|| string.IsNullOrEmpty(this.UserPwa))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Info("工号与密码不能为空!请输入后切换");
|
||||
return;
|
||||
}
|
||||
|
||||
int deviceMode = int.Parse(_unityContainer.Resolve<SysSetupService>().GetValueByParaID(ESysSetup.MOMMode.ToString()));
|
||||
_unityContainer.Resolve<SysSetupService>().UpdateValue(ESysSetup.MOMMode.ToString(), SelectedRadioButtonIndex.ToString());
|
||||
MESReturnCmdModel mesModel = _unityContainer.Resolve<MESProcess>().EqptRun(UserName, this.UserPwa,
|
||||
SelectedRadioButtonIndex.ToString());
|
||||
string MOMMessage = "";
|
||||
|
||||
if (null != mesModel)
|
||||
{
|
||||
MOMMessage = mesModel.Info.MOMMessage;
|
||||
}
|
||||
if (null == mesModel || mesModel.Info.ResultFlag == EResultFlag.NG.ToString())
|
||||
{
|
||||
_unityContainer.Resolve<SysSetupService>().UpdateValue(ESysSetup.MOMMode.ToString(), deviceMode.ToString());
|
||||
HandyControl.Controls.MessageBox.Error($@"切换【{((EMOMMode)SelectedRadioButtonIndex).GetDescription()}】失败 {MOMMessage}!", "切换提示");
|
||||
return;
|
||||
}
|
||||
|
||||
HandyControl.Controls.MessageBox.Show($@"切换【{((EMOMMode)SelectedRadioButtonIndex).GetDescription()}】成功!", "切换提示");
|
||||
_unityContainer.Resolve<LogService>().AddLog($@"切换【{((EMOMMode)SelectedRadioButtonIndex).GetDescription()}】!", E_LogType.Operate.ToString());
|
||||
}
|
||||
//public void OnMesUpdate(object obj)
|
||||
//{
|
||||
// dynamic dc = JsonConvert.DeserializeObject<dynamic>(dev.Json);
|
||||
|
||||
// if (MessageBoxResult.OK == HandyControl.Controls.MessageBox.Ask("是否修改Mes地址?该操作可能会导致Mes(MOM)无法使用,请仔细确认无误", "操作提示"))
|
||||
// {
|
||||
// dc.URL = _url;
|
||||
// _unityContainer.Resolve<DeviceConfigService>().UpdateMesJosn(JsonConvert.SerializeObject(dc));
|
||||
// //_unityContainer.Resolve<MESProcess>().GetJsonParam(JsonConvert.SerializeObject(dc));
|
||||
// return;
|
||||
// }
|
||||
// Url = dc.URL;
|
||||
//}
|
||||
public void Refresh()
|
||||
{
|
||||
string v = _unityContainer.Resolve<BLL.SysSetupService>().GetValueByParaID(ESysSetup.MOMMode.ToString());
|
||||
SelectedRadioButtonIndex = int.Parse(v);
|
||||
dev = _unityContainer.Resolve<DeviceConfigService>().GetConfig(EDeviceType.MOM)[0];
|
||||
dynamic d = JsonConvert.DeserializeObject<dynamic>(dev.Json);
|
||||
Url = d.URL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,374 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Model;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
using Prism.Commands;
|
||||
using System.Windows;
|
||||
using HandyControl.Controls;
|
||||
using Cowain.Bake.Model.Entity;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
using System.Text.Json;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
namespace Cowain.Bake.UI.UserManagerment.ViewModels
|
||||
{
|
||||
class UserManagermentViewModel : ViewModelBase, INotifyPropertyChanged
|
||||
{
|
||||
public UserManagermentViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "用户管理";
|
||||
userManagermentService = _unityContainer.Resolve<UserService>();
|
||||
SetRoleList();
|
||||
}
|
||||
|
||||
//记忆当前所有的用户
|
||||
public List<TUserManage> CurrentUserList { get; set; }
|
||||
|
||||
//公共服务字段
|
||||
private UserService userManagermentService { get; set; }
|
||||
|
||||
public new event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string proName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(proName));
|
||||
}
|
||||
//datagrid数据源
|
||||
private ObservableCollection<TUserManage> userList;
|
||||
public ObservableCollection<TUserManage> UserList
|
||||
{
|
||||
get => userList ?? (userList = new ObservableCollection<TUserManage>());
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
userList = value;
|
||||
OnPropertyChanged("UserList");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//隐藏增加用户的布局
|
||||
private Visibility addUserVisibility = Visibility.Collapsed;
|
||||
|
||||
public Visibility AddUserVisibility
|
||||
{
|
||||
get { return addUserVisibility; }
|
||||
set
|
||||
{
|
||||
if (addUserVisibility != value)
|
||||
{
|
||||
addUserVisibility = value;
|
||||
OnPropertyChanged("AddUserVisibility");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//用户搜索框
|
||||
private string textBoxContent;
|
||||
public string TextBoxContent
|
||||
{
|
||||
get { return textBoxContent; }
|
||||
set
|
||||
{
|
||||
if (textBoxContent != value)
|
||||
{
|
||||
textBoxContent = value;
|
||||
OnPropertyChanged("TextBoxContent");
|
||||
}
|
||||
}
|
||||
}
|
||||
//用户框
|
||||
private string userNameBoxContent;
|
||||
public string UserNameBoxContent
|
||||
{
|
||||
get { return userNameBoxContent; }
|
||||
set
|
||||
{
|
||||
if (userNameBoxContent != value)
|
||||
{
|
||||
userNameBoxContent = value;
|
||||
OnPropertyChanged("UserNameBoxContent");
|
||||
}
|
||||
}
|
||||
}
|
||||
//账号框
|
||||
private string userIdBoxContent;
|
||||
public string UserIdBoxContent
|
||||
{
|
||||
get { return userIdBoxContent; }
|
||||
set
|
||||
{
|
||||
if (userIdBoxContent != value)
|
||||
{
|
||||
userIdBoxContent = value;
|
||||
OnPropertyChanged("UserIdBoxContent");
|
||||
}
|
||||
}
|
||||
}
|
||||
//密码框
|
||||
private string pwdBoxContent;
|
||||
public string PwdBoxContent
|
||||
{
|
||||
get { return pwdBoxContent; }
|
||||
set
|
||||
{
|
||||
if (pwdBoxContent != value)
|
||||
{
|
||||
pwdBoxContent = value;
|
||||
OnPropertyChanged("PwdBoxContent");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//确认密码框
|
||||
//private string confirmPwdBoxContent;
|
||||
//public string ConfirmPwdBoxContent
|
||||
//{
|
||||
// get { return confirmPwdBoxContent; }
|
||||
// set
|
||||
// {
|
||||
// if (confirmPwdBoxContent != value)
|
||||
// {
|
||||
// confirmPwdBoxContent = value;
|
||||
// OnPropertyChanged("ConfirmPwdBoxContent");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//角色下拉框
|
||||
private string roleComboboxSelected;
|
||||
public string RoleComboboxSelected
|
||||
{
|
||||
get { return roleComboboxSelected; }
|
||||
set
|
||||
{
|
||||
if (roleComboboxSelected != value)
|
||||
{
|
||||
roleComboboxSelected = value;
|
||||
OnPropertyChanged("RoleComboboxSelected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TUserManage selectedUser;
|
||||
public TUserManage SelectedUser
|
||||
{
|
||||
get { return selectedUser; }
|
||||
set
|
||||
{
|
||||
if (selectedUser != value)
|
||||
{
|
||||
selectedUser = value;
|
||||
OnPropertyChanged("SelectedUser");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AsyncRefreshTask()
|
||||
{
|
||||
Application.Current?.Dispatcher?.Invoke(new Action(() =>
|
||||
{
|
||||
Refresh();
|
||||
}));
|
||||
}
|
||||
|
||||
public async override void Refresh()
|
||||
{
|
||||
UserList.Clear();
|
||||
if (CurrentUserList!=null)
|
||||
{
|
||||
CurrentUserList.Clear();
|
||||
|
||||
}
|
||||
var listUser = await System.Threading.Tasks.Task.Run(() =>
|
||||
{
|
||||
var userService = _unityContainer.Resolve<UserService>();
|
||||
//从数据库查询任务
|
||||
return userService.GetAllUsers();
|
||||
});
|
||||
|
||||
listUser.ForEach(x => UserList.Add(x));
|
||||
CurrentUserList = listUser;
|
||||
}
|
||||
|
||||
public List<string> RoleList { get; set; }
|
||||
public void SetRoleList()
|
||||
{
|
||||
RoleList = new List<string>();
|
||||
foreach(ERole role in Enum.GetValues(typeof(ERole)))
|
||||
{
|
||||
RoleList.Add(role.GetDescription());
|
||||
}
|
||||
}
|
||||
//用户查询
|
||||
public DelegateCommand QueryUserCommand => new DelegateCommand(() =>
|
||||
{
|
||||
|
||||
if (string.IsNullOrWhiteSpace(TextBoxContent))
|
||||
{
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
var queryList = userManagermentService.QueryUser(TextBoxContent);
|
||||
if (queryList.Count > 0)
|
||||
{
|
||||
UserList.Clear();
|
||||
UserList.Add(queryList[0]);
|
||||
Growl.Info("查询成功!");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Info("没有数据!");
|
||||
}
|
||||
});
|
||||
|
||||
//更改用户是否有效
|
||||
public DelegateCommand<string> UserValidCommand => new DelegateCommand<string>((y) =>
|
||||
{
|
||||
if (SelectedUser == null)
|
||||
{
|
||||
Growl.Info("请选择用户!");
|
||||
return;
|
||||
}
|
||||
var result = HandyControl.Controls.MessageBox.Ask("确认更改?", "操作提示");
|
||||
if (result == MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (y == EValidStatus.Invalid.ToString())
|
||||
{
|
||||
if (SelectedUser.Valid!=false)
|
||||
{
|
||||
SelectedUser.Valid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else if (y == EValidStatus.Valid.ToString())
|
||||
{
|
||||
if (SelectedUser.Valid!=true)
|
||||
{
|
||||
SelectedUser.Valid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
userManagermentService.Update(SelectedUser);
|
||||
Refresh();
|
||||
Growl.Success("更改成功!");
|
||||
|
||||
});
|
||||
|
||||
|
||||
public DelegateCommand ShowAddUserCommand => new DelegateCommand(() =>
|
||||
{
|
||||
AddUserVisibility = Visibility.Visible;
|
||||
|
||||
});
|
||||
|
||||
public DelegateCommand AddUserCommand => new DelegateCommand(() =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(UserIdBoxContent))
|
||||
{
|
||||
Growl.Info("请输入账号!");
|
||||
return;
|
||||
}
|
||||
if (CurrentUserList.Where(a => a.UserId == UserIdBoxContent).ToList().Count > 0)
|
||||
{
|
||||
Growl.Info("账号已经存在!");
|
||||
return;
|
||||
}
|
||||
//if (PwdBoxContent != ConfirmPwdBoxContent)
|
||||
//{
|
||||
// Growl.Info("密码不一致!");
|
||||
// return;
|
||||
//}
|
||||
if (string.IsNullOrWhiteSpace(RoleComboboxSelected))
|
||||
{
|
||||
Growl.Info("请选择用户角色!");
|
||||
return;
|
||||
}
|
||||
TUserManage addUserItem = new TUserManage()
|
||||
{
|
||||
UserId = UserIdBoxContent,
|
||||
UserName = UserNameBoxContent,
|
||||
Password = PwdBoxContent,
|
||||
//将枚举描述转换成对应int
|
||||
RoleId = (int)EnumHelper.GetValueByDescription<ERole>(roleComboboxSelected),
|
||||
Valid = true,
|
||||
};
|
||||
if (userManagermentService.Insert(addUserItem)>0)
|
||||
{
|
||||
UserList.Add(addUserItem);
|
||||
AddUserVisibility = Visibility.Collapsed;
|
||||
Growl.Success("新增成功!");
|
||||
};
|
||||
});
|
||||
public DelegateCommand DeleteUserCommand => new DelegateCommand(() =>
|
||||
{
|
||||
if (SelectedUser == null)
|
||||
{
|
||||
Growl.Info("请选择用户!");
|
||||
return;
|
||||
}
|
||||
|
||||
var result = HandyControl.Controls.MessageBox.Ask($"用户名:{selectedUser.UserName},是否删除?", "操作提示");
|
||||
if (result == MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 == userManagermentService.Delete(selectedUser))
|
||||
{
|
||||
Growl.Warning("删除失败!");
|
||||
return;
|
||||
}
|
||||
|
||||
Growl.Success($"删除用户【{selectedUser.UserName}】成功!");
|
||||
_unityContainer.Resolve<LogService>().AddLog($"删除用户:{selectedUser.UserName}", E_LogType.Operate.ToString());
|
||||
Refresh();
|
||||
|
||||
});
|
||||
public DelegateCommand InitPwdCommand => new DelegateCommand(()=>
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Ask("是否初始化?","操作提示");
|
||||
if (result == MessageBoxResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (selectedUser != null)
|
||||
{
|
||||
selectedUser.Password = "123456";
|
||||
userManagermentService.Update(selectedUser);
|
||||
Growl.Success("初始化成功");
|
||||
}
|
||||
});
|
||||
|
||||
public DelegateCommand CancelSaveCommand => new DelegateCommand(() =>
|
||||
{
|
||||
AddUserVisibility = Visibility.Collapsed;
|
||||
UserIdBoxContent = string.Empty;
|
||||
UserNameBoxContent = string.Empty;
|
||||
PwdBoxContent = string.Empty;
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.UserManagerment.Views.AuthorityManagementView"
|
||||
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.UserManagerment.Views"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="180"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Grid.Column="0" ItemsSource="{Binding RoleList}" DisplayMemberPath="RoleName" SelectedItem="{Binding SelectedRole,Mode=TwoWay}" SelectedIndex="0">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding ListBoxSelectionChangedCommand}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Column="1" Orientation="Vertical" Background="#f1f2f6">
|
||||
<TreeView ItemsSource="{Binding AuthorityList}" Height="342">
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
||||
<StackPanel x:Name="stackPanel" Orientation="Horizontal">
|
||||
<CheckBox FontSize="14" x:Name="checkBox1"
|
||||
IsChecked="{Binding IsHasAuthority,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding TargetView}" Visibility="{Binding CheckboxVisibility}"/>
|
||||
<TextBlock Text="{Binding Header}" FontSize="14" Margin="8,0,0,0"/>
|
||||
</StackPanel>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
<Button Content="保存" HorizontalAlignment="Left" Style="{StaticResource ButtonInfo}" Width="60" Margin="5" Command="{Binding SaveCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
</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.UserManagerment.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// AuthorityManagementView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AuthorityManagementView : UserControl
|
||||
{
|
||||
public AuthorityManagementView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
66
Cowain.Bake.UI/UserManagerment/Views/DeviceModeView.xaml
Normal file
66
Cowain.Bake.UI/UserManagerment/Views/DeviceModeView.xaml
Normal file
@@ -0,0 +1,66 @@
|
||||
<Window x:Class="Cowain.Bake.UI.UserManagerment.Views.DeviceModeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.UserManagerment.Views"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:pwdHelper="clr-namespace:Cowain.Bake.Common;assembly=Cowain.Bake.Common"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
xmlns:cm="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
mc:Ignorable="d"
|
||||
Title="设备模式" Height="230" Width="500" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<cm:RadioButtonToIndexConverter x:Key="RadioButtonToIndexConverter" />
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.01*"/>
|
||||
<RowDefinition Height="0.1*"/>
|
||||
<RowDefinition Height="0.3*"/>
|
||||
<RowDefinition Height="0.2*"/>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.1*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="0.1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.4*"/>
|
||||
<ColumnDefinition Width="0.6*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
<Label Content="工号:" Grid.Row="0" Grid.Column="0" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="UserName" FontWeight="Bold" HorizontalAlignment="Left" Width="100" Height="23" TextWrapping="Wrap" Text="{Binding UserName}"/>
|
||||
<Label Content="密码:" Grid.Row="0" Grid.Column="2" Margin="15,0,0,0" />
|
||||
<PasswordBox pwdHelper:PasswordHelper.Password="{Binding UserPwa,Mode=TwoWay}" Width="160" Height="23" pwdHelper:PasswordHelper.Attach="True" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="1" >
|
||||
<RadioButton Content="联机模式" IsChecked="{Binding SelectedRadioButtonIndex, Mode=TwoWay, Converter={StaticResource RadioButtonToIndexConverter}, ConverterParameter=0}" FontSize="12" Foreground="DarkBlue"/>
|
||||
<RadioButton Content="离线模式" IsChecked="{Binding SelectedRadioButtonIndex, Mode=TwoWay, Converter={StaticResource RadioButtonToIndexConverter}, ConverterParameter=1}" FontSize="12" Margin="30" Foreground="DarkBlue"/>
|
||||
<RadioButton Content="调机模式" IsChecked="{Binding SelectedRadioButtonIndex, Mode=TwoWay, Converter={StaticResource RadioButtonToIndexConverter}, ConverterParameter=2}" FontSize="12" Foreground="DarkBlue"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1">
|
||||
<Button Content="切换" Command="{Binding SwitchCommand}" Style="{StaticResource ButtonInfo}" Margin="120,0,0,0"/>
|
||||
<Button Content="退出" Command="{Binding ExitCommand}" Style="{StaticResource ButtonInfo}" Margin="80,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
23
Cowain.Bake.UI/UserManagerment/Views/DeviceModeView.xaml.cs
Normal file
23
Cowain.Bake.UI/UserManagerment/Views/DeviceModeView.xaml.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Cowain.Bake.UI.UserManagerment.ViewModels;
|
||||
using Prism.Events;
|
||||
using System.Windows;
|
||||
using Unity;
|
||||
using static Cowain.Bake.UI.UserManagerment.ViewModels.DeviceModeViewModel;
|
||||
|
||||
namespace Cowain.Bake.UI.UserManagerment.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DeviceModeView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DeviceModeView : Window
|
||||
{
|
||||
private IEventAggregator _eventAggregator;
|
||||
public DeviceModeView(IUnityContainer unityContainer, IEventAggregator eventAggregator)
|
||||
{
|
||||
InitializeComponent();
|
||||
_eventAggregator = eventAggregator;
|
||||
_eventAggregator.GetEvent<CloseWindowEvent>().Subscribe(() => Close());
|
||||
unityContainer.Resolve<DeviceModeViewModel>().Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.UserManagerment.Views.UserManagermentView"
|
||||
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.UserManagerment.Views"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
|
||||
d:DesignHeight="450" d:DesignWidth="800" Background="Transparent">
|
||||
<UserControl.Resources>
|
||||
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<convertor:InvalidConvertor x:Key="invalidConvertor"/>
|
||||
<convertor:RoleConvertor x:Key="roleConvertor"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="账号:" />
|
||||
<TextBox Width="120" Text="{Binding TextBoxContent,Mode=OneWayToSource}"/>
|
||||
<Button Content="查询" Style="{StaticResource ButtonSuccess}" Command="{Binding QueryUserCommand}" Margin="20,0,0,0" Width="80"/>
|
||||
<Button Content="新增" Style="{StaticResource ButtonInfo}" Command="{Binding ShowAddUserCommand}" Margin="10,0,0,0" Width="80"/>
|
||||
<Button Content="有效化" Style="{StaticResource ButtonInfo}" Command="{Binding UserValidCommand}" CommandParameter="Valid" Margin="10,0,0,0" Width="80"/>
|
||||
<Button Content="无效化" Style="{StaticResource ButtonDanger}" Command="{Binding UserValidCommand}" CommandParameter="Invalid" Margin="10,0,0,0" Width="80"/>
|
||||
<Button Content="初始化密码" Style="{StaticResource ButtonDanger}" Command="{Binding InitPwdCommand}" Margin="10,0,0,0" Width="80"/>
|
||||
<Button Content="删除用户" Style="{StaticResource ButtonDanger}" Command="{Binding DeleteUserCommand}" Margin="10,0,0,0" Width="80"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,5" Visibility="{Binding AddUserVisibility ,Mode=TwoWay}">
|
||||
<TextBlock Text="账号:"/>
|
||||
<TextBox Width="120" Text="{Binding UserIdBoxContent,Mode=TwoWay}"/>
|
||||
<TextBlock Text="用户名:"/>
|
||||
<TextBox Width="120" Text="{Binding UserNameBoxContent,Mode=TwoWay}"/>
|
||||
<TextBlock Text="密码:"/>
|
||||
<TextBox Width="120" Text="{Binding PwdBoxContent,Mode=TwoWay}" />
|
||||
<!--<TextBlock Text="确认密码:"/>
|
||||
<TextBox Width="120" Text="{Binding ConfirmPwdBoxContent,Mode=OneWayToSource}"/>-->
|
||||
<TextBlock Text="角色:"/>
|
||||
<ComboBox Width="100" SelectedItem="{Binding RoleComboboxSelected,Mode=TwoWay}" ItemsSource="{Binding RoleList}"/>
|
||||
<Button Content="保存" Width="80" Style="{StaticResource ButtonSuccess}" Margin="10,0,0,0" Command="{Binding AddUserCommand}" />
|
||||
<Button Content="取消" Style="{StaticResource ButtonDanger}" Command="{Binding CancelSaveCommand}" Margin="10,0,0,0" Width="80"/>
|
||||
|
||||
</StackPanel>
|
||||
<DataGrid Grid.Row="2" hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All"
|
||||
CanUserSortColumns="False" SelectionMode="Single" Margin="4" IsReadOnly="True"
|
||||
RowHeaderWidth="0" AutoGenerateColumns="False" ItemsSource="{Binding UserList}" SelectedItem="{Binding SelectedUser}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="账号" Binding="{Binding UserId}"/>
|
||||
<DataGridTextColumn Header="用户名" Binding="{Binding UserName}"/>
|
||||
<DataGridTextColumn Header="是否有效" Binding="{Binding Valid,Converter={StaticResource invalidConvertor}}"/>
|
||||
<DataGridTextColumn Header="角色" Binding="{Binding RoleId,Converter={StaticResource roleConvertor}}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</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.UserManagerment.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// UserManagermentView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class UserManagermentView : UserControl
|
||||
{
|
||||
public UserManagermentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Cowain.Bake.UI/app.config
Normal file
39
Cowain.Bake.UI/app.config
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
|
||||
BIN
Cowain.Bake.UI/bin/Debug/Cowain.Preheat.BLL.dll
Normal file
BIN
Cowain.Bake.UI/bin/Debug/Cowain.Preheat.BLL.dll
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user