浏览代码

柔性味魔方手动控制UI更新

样式分支
taoye 2 年前
父节点
当前提交
390ffbf036
共有 18 个文件被更改,包括 1273 次插入51 次删除
  1. +10
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. +276
    -0
      BPASmartClient.CustomResource/Fonts/new/demo_index.html
  3. 二进制
     
  4. 二进制
     
  5. 二进制
     
  6. 二进制
     
  7. 二进制
     
  8. +1
    -1
      BPASmartClient.CustomResource/Pages/ViewModel/UserManageViewModel.cs
  9. +84
    -0
      BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml
  10. +130
    -0
      BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml.cs
  11. +287
    -0
      BPASmartClient.CustomResource/UserControls/MaterialStock.xaml
  12. +120
    -0
      BPASmartClient.CustomResource/UserControls/MaterialStock.xaml.cs
  13. +7
    -1
      DosingSystem/App.xaml.cs
  14. +40
    -0
      DosingSystem/Model/StockStatusModel.cs
  15. +201
    -0
      DosingSystem/View/StockControlView.xaml
  16. +30
    -0
      DosingSystem/View/StockControlView.xaml.cs
  17. +30
    -0
      DosingSystem/ViewModel/StockControViewModel.cs
  18. +57
    -49
      FryPot_DosingSystem/Control/DosingLogicControl.cs

+ 10
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj 查看文件

@@ -24,6 +24,7 @@
<None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\MT\iconfont.ttf" />
<None Remove="Fonts\naicha.ttf" />
<None Remove="Fonts\new\iconfont.ttf" />
<None Remove="Fonts\Quartz Regular.ttf" />
<None Remove="Image\AGV\agv.png" />
<None Remove="Image\AGV\AGV小车.png" />
@@ -87,6 +88,10 @@
<None Remove="Image\WindowImages.png" />
<None Remove="Image\上箭头.png" />
<None Remove="Image\不规则矩形.png" />
<None Remove="Image\不锈钢纹理.jpg" />
<None Remove="Image\不锈钢纹理1.png" />
<None Remove="Image\不锈钢纹理2.jpeg" />
<None Remove="Image\不锈钢纹理3.jpeg" />
<None Remove="Image\个人信息.png" />
<None Remove="Image\中间.png" />
<None Remove="Image\临时模板.png" />
@@ -276,6 +281,7 @@
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\MT\iconfont.ttf" />
<Resource Include="Fonts\naicha.ttf" />
<Resource Include="Fonts\new\iconfont.ttf" />
<Resource Include="Fonts\Quartz Regular.ttf" />
<Resource Include="Image\AGV\agv.png" />
<Resource Include="Image\AGV\AGV小车.png" />
@@ -301,6 +307,10 @@
<Resource Include="Image\textBox.png" />
<Resource Include="Image\WindowImages.png" />
<Resource Include="Image\上箭头.png" />
<Resource Include="Image\不锈钢纹理.jpg" />
<Resource Include="Image\不锈钢纹理1.png" />
<Resource Include="Image\不锈钢纹理2.jpeg" />
<Resource Include="Image\不锈钢纹理3.jpeg" />
<Resource Include="Image\中间.png" />
<Resource Include="Image\临时模板.png" />
<Resource Include="Image\产品制作.png" />


+ 276
- 0
BPASmartClient.CustomResource/Fonts/new/demo_index.html 查看文件

@@ -0,0 +1,276 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>iconfont Demo</title>
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" type="image/x-icon"/>
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg"/>
<link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
<script src="iconfont.js"></script>
<!-- jQuery -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/7bfddb60-08e8-11e9-9b04-53e73bb6408b.js"></script>
<!-- 代码高亮 -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/a3f714d0-08e6-11e9-8a15-ebf944d7534c.js"></script>
<style>
.main .logo {
margin-top: 0;
height: auto;
}

.main .logo a {
display: flex;
align-items: center;
}

.main .logo .sub-title {
margin-left: 0.5em;
font-size: 22px;
color: #fff;
background: linear-gradient(-45deg, #3967FF, #B500FE);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
</style>
</head>
<body>
<div class="main">
<h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">
<img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
</a></h1>
<div class="nav-tabs">
<ul id="tabs" class="dib-box">
<li class="dib active"><span>Unicode</span></li>
<li class="dib"><span>Font class</span></li>
<li class="dib"><span>Symbol</span></li>
</ul>
</div>
<div class="tab-container">
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe79e;</span>
<div class="name">open-l</div>
<div class="code-name">&amp;#xe79e;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe63f;</span>
<div class="name">进行中</div>
<div class="code-name">&amp;#xe63f;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe746;</span>
<div class="name">启动</div>
<div class="code-name">&amp;#xe746;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe631;</span>
<div class="name">停止刷新</div>
<div class="code-name">&amp;#xe631;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
<hr>

<p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
<ul>
<li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
<li>默认情况下不支持多色,直接添加多色图标会自动去色。</li>
</ul>
<blockquote>
<p>注意:新版 iconfont 支持两种方式引用多色图标:SVG symbol 引用方式和彩色字体图标模式。(使用彩色字体图标需要在「编辑项目」中开启「彩色」选项后并重新生成。)</p>
</blockquote>
<p>Unicode 使用步骤如下:</p>
<h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.ttf?t=1665539385316') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
<pre><code class="language-css"
>.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
<pre>
<code class="language-html"
>&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-openl"></span>
<div class="name">
open-l
</div>
<div class="code-name">.icon-openl
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-shouye"></span>
<div class="name">
进行中
</div>
<div class="code-name">.icon-shouye
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-qidong"></span>
<div class="name">
启动
</div>
<div class="code-name">.icon-qidong
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-tingzhishuaxin"></span>
<div class="name">
停止刷新
</div>
<div class="code-name">.icon-tingzhishuaxin
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
<hr>

<p>font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
<p>与 Unicode 使用方式相比,具有如下特点:</p>
<ul>
<li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
<li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
<pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
</code></pre>
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"
iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-openl"></use>
</svg>
<div class="name">open-l</div>
<div class="code-name">#icon-openl</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-shouye"></use>
</svg>
<div class="name">进行中</div>
<div class="code-name">#icon-shouye</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-qidong"></use>
</svg>
<div class="name">启动</div>
<div class="code-name">#icon-qidong</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-tingzhishuaxin"></use>
</svg>
<div class="name">停止刷新</div>
<div class="code-name">#icon-tingzhishuaxin</div>
</li>
</ul>
<div class="article markdown">
<h2 id="symbol-">Symbol 引用</h2>
<hr>

<p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
<ul>
<li>支持多色图标了,不再受单色限制。</li>
<li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
<li>兼容性较差,支持 IE9+,及现代浏览器。</li>
<li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
<pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
</code></pre>
<h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
<pre><code class="language-html">&lt;style&gt;
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
&lt;/style&gt;
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
&lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
&lt;/svg&gt;
</code></pre>
</div>
</div>

</div>
</div>
<script>
$(document).ready(function () {
$('.tab-container .content:first').show()

$('#tabs li').click(function (e) {
var tabContent = $('.tab-container .content')
var index = $(this).index()

if ($(this).hasClass('active')) {
return
} else {
$('#tabs li').removeClass('active')
$(this).addClass('active')

tabContent.hide().eq(index).fadeIn()
}
})
})
</script>
</body>
</html>

二进制
查看文件


二进制
查看文件


二进制
查看文件


二进制
查看文件


二进制
查看文件


+ 1
- 1
BPASmartClient.CustomResource/Pages/ViewModel/UserManageViewModel.cs 查看文件

@@ -59,7 +59,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
else
{
MessageBox.Show("用户名为空或输入后未回车确认", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
MessageBox.Show("保存失败,用户名为空或输入后未回车确认", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
}
});
DeleteCommand = new RelayCommand<string>((str) =>


+ 84
- 0
BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml 查看文件

@@ -0,0 +1,84 @@
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.ConveyBelt2"
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:BPASmartClient.CustomResource.UserControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Border x:Name="br" >
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="StockGroup">
<VisualState Name="RunState">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="belt"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="-100"
Duration="0:0:20" />
</Storyboard>
</VisualState>
<VisualState Name="Stop">
</VisualState>
</VisualStateGroup>
<VisualStateGroup Name="DirectionGroup">
<VisualState Name="LeftState">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="belt"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="100"
Duration="0:0:20" />
</Storyboard>
</VisualState>
<VisualState Name="RightState">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="belt"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="-100"
Duration="0:0:20" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center">

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

<Rectangle HorizontalAlignment="Center" Width="{Binding ElementName=br, Path=ActualWidth}" Height="5" Canvas.Top="20" RadiusX="1" RadiusY="1">
<Rectangle.Fill>
<LinearGradientBrush >
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle HorizontalAlignment="Center" x:Name="recDown" Width="{Binding ElementName=br, Path=ActualWidth}" Height="5" RadiusX="1" RadiusY="1" Margin="0,80,0,0">
<Rectangle.Fill>
<LinearGradientBrush >
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Path x:Name="belt" Canvas.Top="20" Canvas.Left="10"
StrokeDashArray="2" StrokeThickness="20">
<Path.Stroke>
<LinearGradientBrush>
<GradientStop Color="SlateGray" Offset="0"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="SlateGray" Offset="1"/>
</LinearGradientBrush>
</Path.Stroke>
</Path>
</Canvas>
</Viewbox>
</Border>
</UserControl>

+ 130
- 0
BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml.cs 查看文件

@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
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 BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// ConveyBelt2.xaml 的交互逻辑
/// </summary>
public partial class ConveyBelt2 : UserControl
{
public ConveyBelt2()
{
InitializeComponent();
}
[Category("运行状态")]
public bool IsRun
{
get { return (bool)GetValue(IsRunProperty); }
set { SetValue(IsRunProperty, value); }
}
public static readonly DependencyProperty IsRunProperty =
DependencyProperty.Register("IsRun", typeof(bool), typeof(ConveyBelt2), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnRunningChanged)));

private static void OnRunningChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as ConveyBelt2, (bool)e.NewValue ? "RunState" : "Stop", false);
}

public double BeltWidth
{
get { return (double)GetValue(BeltWidthProperty); }
set { SetValue(BeltWidthProperty, value); }
}
public static readonly DependencyProperty BeltWidthProperty =
DependencyProperty.Register("BeltWidth", typeof(double), typeof(ConveyBelt2), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged)));

private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as ConveyBelt2)?.Refresh();
}
public void Refresh()
{
PathGeometry geometry = new PathGeometry();
PathFigure pathFigure = new PathFigure();
if (BeltHeight > 100)
{
pathFigure.StartPoint = new Point(0, 35 + (BeltHeight - 100) / 2);
pathFigure.Segments.Add(new LineSegment(new Point(BeltWidth - 10, 35 + (BeltHeight - 100)/2), true));
}
else
{
pathFigure.StartPoint = new Point(0, 35);
pathFigure.Segments.Add(new LineSegment(new Point(BeltWidth - 10, 35), true));
}
geometry.Figures.Add(pathFigure);
this.belt.Data = geometry;
this.belt.StrokeDashOffset = BeltDashOffset;
this.br.Width = BeltWidth;
if (BeltHeight > 100)
{
this.recDown.Margin = new Thickness(0, BeltHeight - 20, 0, 0);
}
else
{
this.recDown.Margin = new Thickness(0, 80, 0, 0);
}

this.belt.StrokeThickness = BeltDashThickess;
}

public double BeltHeight
{
get { return (double)GetValue(BeltHeightProperty); }
set { SetValue(BeltHeightProperty, value); }
}
public static readonly DependencyProperty BeltHeightProperty =
DependencyProperty.Register("BeltHeight", typeof(double), typeof(ConveyBelt2), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged)));

public double BeltDashOffset
{
get { return (double)GetValue(BeltDashOffsetProperty); }
set { SetValue(BeltDashOffsetProperty, value); }
}
public static readonly DependencyProperty BeltDashOffsetProperty =
DependencyProperty.Register("BeltDashOffset", typeof(double), typeof(ConveyBelt2), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged)));

public double BeltDashThickess
{
get { return (double)GetValue(BeltDashThickessProperty); }
set { SetValue(BeltDashThickessProperty, value); }
}
public static readonly DependencyProperty BeltDashThickessProperty =
DependencyProperty.Register("BeltDashThickess", typeof(double), typeof(ConveyBelt2), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged)));
public int BeltDirection
{
get { return (int)GetValue(BeltDirectionProperty); }
set { SetValue(BeltDirectionProperty, value); }
}
public static readonly DependencyProperty BeltDirectionProperty =
DependencyProperty.Register("BeltDirection", typeof(int), typeof(ConveyBelt2), new PropertyMetadata(default(int), new PropertyChangedCallback(OnDirectionChanged)));

private static void OnDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{

if ((d as ConveyBelt2)?.BeltDirection == 0)
{
VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false);
}
else
{
VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false);
}

}
}
}

+ 287
- 0
BPASmartClient.CustomResource/UserControls/MaterialStock.xaml 查看文件

@@ -0,0 +1,287 @@
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.MaterialStock"
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:BPASmartClient.CustomResource.UserControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<PathGeometry x:Key="move" Figures="M 0,0 L 0,10"/>
</UserControl.Resources>
<Border HorizontalAlignment="Center">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="StockGroup">
<VisualState Name="OpenState">
<Storyboard>
<DoubleAnimation Duration="00:0:1" From="0" To="200"
Storyboard.TargetProperty="Width"
Storyboard.TargetName="stock"/>
<DoubleAnimation Duration="00:0:1" From="0" To="70"
Storyboard.TargetProperty="Height"
Storyboard.TargetName="stock"/>
</Storyboard>
</VisualState>
<VisualState Name="CloseState">
<Storyboard>
<DoubleAnimation Duration="00:0:1" From="200" To="0"
Storyboard.TargetProperty="Width"
Storyboard.TargetName="stock"/>
<DoubleAnimation Duration="00:0:1" From="70" To="0"
Storyboard.TargetProperty="Height"
Storyboard.TargetName="stock"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup Name="RunStateGroup">
<VisualState Name="RunState">
<Storyboard>
<ColorAnimationUsingKeyFrames
Storyboard.TargetName="gsGreen"
Storyboard.TargetProperty="Color">
<DiscreteColorKeyFrame Value="Green" KeyTime="0"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState Name="Stop"/>
</VisualStateGroup>
<VisualStateGroup x:Name="FaultStateGroup">
<VisualState Name="FaultState">
<Storyboard>
<ColorAnimationUsingKeyFrames RepeatBehavior="Forever"
Storyboard.TargetName="gsRed1"
Storyboard.TargetProperty="Color">
<DiscreteColorKeyFrame Value="Red" KeyTime="0:0:0.5"/>
<DiscreteColorKeyFrame Value="Gray" KeyTime="0:0:1"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState Name="NormalState"/>
</VisualStateGroup>
<VisualStateGroup x:Name="LayOffStateGroup">
<VisualState Name="LayOffState">
<Storyboard>
<DoubleAnimationUsingPath Duration="0:0:1" PathGeometry="{StaticResource move}" RepeatBehavior="Forever"
Storyboard.TargetName="arrow" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(Y)" Source="Y"></DoubleAnimationUsingPath>
</Storyboard>
</VisualState>
<VisualState Name="LayStopState">
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Viewbox VerticalAlignment="Center" HorizontalAlignment="Center">

<Canvas Width="205" Height="245" Margin="5">
<Polygon Points="0,80 20,40 205,40 185,80" Canvas.Left="67">
<Polygon.RenderTransform>
<SkewTransform AngleX="-40" />
</Polygon.RenderTransform>
<Polygon.Fill>
<!--<LinearGradientBrush StartPoint="1,0" EndPoint="1,1">
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="WhiteSmoke" Offset="0.85"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>-->
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg" Stretch="Fill"/>
</Polygon.Fill>
</Polygon>
<Polygon Width="200" Height="70" Points="45,70 60,50 170,50 155,70" Stroke="Gray" StrokeThickness="2" Canvas.Left="67">
<Polygon.RenderTransform>
<SkewTransform AngleX="-40" />
</Polygon.RenderTransform>
</Polygon>
<Polygon x:Name="stock" Width="0" Height="0" Points="45,70 60,50 170,50 155,70" Canvas.Left="67" >
<Polygon.Fill>
<SolidColorBrush Color="DimGray"/>
</Polygon.Fill>
<Polygon.RenderTransform>
<SkewTransform AngleX="-40" />
</Polygon.RenderTransform>
</Polygon>
<Polygon Points="-5,90 0,80 185,80 180,90" Panel.ZIndex="1" >
<Polygon.Fill>
<LinearGradientBrush>
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.66"/>
<GradientStop Color="LightGray" Offset="0.95"/>
</LinearGradientBrush>
</Polygon.Fill>

</Polygon>
<Grid Width="185" Height="160" Canvas.Top="80">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg" Stretch="Fill"/>
</Grid.Background>
<!--<Grid VerticalAlignment="Bottom" Height="20" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Width="60">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="Orange">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock VerticalAlignment="Center" Text="&#xe79e;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="开盖" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="yellow" TargetName="br"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Width="60" Grid.Column="1">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br1" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="yellowgreen">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock VerticalAlignment="Center" Text="&#xe63f;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="出料" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="lawngreen" TargetName="br1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>-->
</Grid>
<Grid Width="185" Height="60" Canvas.Top="90">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg"/>
</Grid.Background>
<Grid.RenderTransform>
<TranslateTransform X="-5"/>
</Grid.RenderTransform>
<TextBox x:Name="stockName" Width="58" Height="50" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Background="Transparent"
BorderThickness="0" VerticalContentAlignment="Center" FontSize="13" Foreground="DarkSlateGray">
</TextBox>


<Border Width="80" Height="50" BorderBrush="DimGray " BorderThickness="2" CornerRadius="5" Margin="15,0,0,0">
<StackPanel >
<TextBlock HorizontalAlignment="Center" FontSize="12" Text="剩余重量" FontFamily="幼圆" Margin="0,2,0,5"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock x:Name="stockWeight" HorizontalAlignment="Center" FontSize="16" />
<TextBlock Text="Kg" FontSize="16"/>
</StackPanel>
</StackPanel>
</Border>
</Grid>
<Grid Width="40" Height="60" Canvas.Top="90" Canvas.Left="180">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理3.jpeg" Stretch="UniformToFill"/>
</Grid.Background>
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.119"/>
<SkewTransform AngleY="-65.5"/>
</TransformGroup>
</Grid.RenderTransform>
<!--<Border VerticalAlignment="Top" Height="140" BorderThickness="10">
<Border.Background>
<SolidColorBrush Color="BlueViolet"/>
</Border.Background>
</Border>-->
<!--<Grid VerticalAlignment="Bottom" Height="40" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Background="#FFAAAAAA" Margin="2"/>
<Border Background="#FFAAAAAA" Margin="2" Grid.Column="1"/>
</Grid>-->
</Grid >
<Path x:Name="arrow" Canvas.Top="175" Canvas.Left="113" Visibility="Collapsed" Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z">
<Path.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90"/>
<TranslateTransform Y="0"/>
</TransformGroup>
</Path.RenderTransform>
<Path.Fill>
<LinearGradientBrush>
<LinearGradientBrush.RelativeTransform>
<RotateTransform Angle="-15"/>
</LinearGradientBrush.RelativeTransform>
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.4"/>
<GradientStop Color="AntiqueWhite" Offset="1"/>
</LinearGradientBrush>
</Path.Fill>
</Path>
<!--<Path Data="M 95,190 L 95,200" Stroke="Red"/>-->

<Grid Width="185" Height="160" Canvas.Top="80" Canvas.Left="185">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg"/>
</Grid.Background>
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.288"/>
<SkewTransform AngleY="-36.8"/>
</TransformGroup>
</Grid.RenderTransform>
<!--<Border VerticalAlignment="Top" Height="140" BorderThickness="10">
<Border.Background>
<DrawingBrush TileMode="Tile" ViewportUnits="Absolute" Viewport="1,0,25,1">
<DrawingBrush.Drawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="#EEE"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<PathGeometry>
<PathFigure>
<LineSegment Point="10,0"/>
<LineSegment Point="10,10"/>
</PathFigure>
</PathGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.Background>
</Border>-->
<!--<Grid VerticalAlignment="Bottom" Height="40" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Background="#FFAAAAAA" Margin="2"/>
<Border Background="#FFAAAAAA" Margin="2" Grid.Column="1"/>
</Grid>-->
</Grid>

<Border Width="18" Height="18" CornerRadius="10" Canvas.Left="150" Canvas.Top="100">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="Gray" Offset="0.6" x:Name="gsGreen"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
</Border>
<Border Width="18" Height="18" CornerRadius="10" Canvas.Left="150" Canvas.Top="125" >
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="Gray" Offset="0.6" x:Name="gsRed1"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
</Border>
</Canvas>
</Viewbox>
</Border>
</UserControl>

+ 120
- 0
BPASmartClient.CustomResource/UserControls/MaterialStock.xaml.cs 查看文件

@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
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 BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// MaterialStock.xaml 的交互逻辑
/// </summary>
public partial class MaterialStock : UserControl
{
public MaterialStock()
{
InitializeComponent();
}
[Category("运行状态")]
public bool IsRunning
{
get { return (bool)GetValue(IsRunningProperty); }
set { SetValue(IsRunningProperty, value); }
}
public static readonly DependencyProperty IsRunningProperty =
DependencyProperty.Register("IsRunning", typeof(bool), typeof(MaterialStock), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnRunningChanged)));

private static void OnRunningChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as MaterialStock, (bool)e.NewValue ? "RunState" : "Stop", false);
}

[Category("报警状态")]
public bool IsFaultState
{
get { return (bool)GetValue(IsFaultStateProperty); }
set { SetValue(IsFaultStateProperty, value); }
}
public static readonly DependencyProperty IsFaultStateProperty =
DependencyProperty.Register("IsFaultState", typeof(bool), typeof(MaterialStock), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnFaultStateChanged)));

private static void OnFaultStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as MaterialStock, (bool)e.NewValue ? "FaultState" : "NormalState", false);
}

[Category("料仓打开状态")]
public bool IsOpenState
{
get { return (bool)GetValue(IsOpenStateProperty); }
set { SetValue(IsOpenStateProperty, value); }
}
public static readonly DependencyProperty IsOpenStateProperty =
DependencyProperty.Register("IsOpenState", typeof(bool), typeof(MaterialStock), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnOpenStateChanged)));

private static void OnOpenStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as MaterialStock, (bool)e.NewValue ? "OpenState" : "CloseState", false);
}


[Category("下料状态")]
public bool IsLayOffState
{
get { return (bool)GetValue(IsLayOffStateProperty); }
set { SetValue(IsLayOffStateProperty, value); }
}
public static readonly DependencyProperty IsLayOffStateProperty =
DependencyProperty.Register("IsLayOffState", typeof(bool), typeof(MaterialStock), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnLayOffStateChanged)));

private static void OnLayOffStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as MaterialStock, (bool)e.NewValue ? "LayOffState" : "LayStopState", false);
if ((d as MaterialStock)?.IsLayOffState == true)
{
(d as MaterialStock).arrow.Visibility = Visibility.Visible;
}
else if ((d as MaterialStock)?.IsLayOffState == false)
{
(d as MaterialStock).arrow.Visibility = Visibility.Collapsed;
}
}

[Category("物料重量")]
public double MaterialWeight
{
get { return (double)GetValue(MaterialWeightProperty); }
set { SetValue(MaterialWeightProperty, value); }
}
public static readonly DependencyProperty MaterialWeightProperty =
DependencyProperty.Register("MaterialWeight", typeof(double), typeof(MaterialStock), new PropertyMetadata(default(double), new PropertyChangedCallback(OnWeightChanged)));
private static void OnWeightChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as MaterialStock).stockWeight.Text = e.NewValue.ToString();

}
[Category("物料名称")]
public string MaterialName
{
get { return (string)GetValue(MaterialNameProperty); }
set { SetValue(MaterialNameProperty, value); }
}
public static readonly DependencyProperty MaterialNameProperty =
DependencyProperty.Register("MaterialName", typeof(string), typeof(MaterialStock), new PropertyMetadata(default(string), new PropertyChangedCallback(OnNameChanged)));
private static void OnNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as MaterialStock).stockName.Text = e.NewValue.ToString();
}

}
}

+ 7
- 1
DosingSystem/App.xaml.cs 查看文件

@@ -112,7 +112,13 @@ namespace BPASmartClient.DosingSystem
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.ManualControlView"
});

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


+ 40
- 0
DosingSystem/Model/StockStatusModel.cs 查看文件

@@ -0,0 +1,40 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem.Model
{
internal class StockStatusModel:ObservableObject
{
/// <summary>
/// 料仓物料重量
/// </summary>
private double _materialWeight;
public double MaterialWeight { get { return _materialWeight; } set { _materialWeight = value;OnPropertyChanged(); } }
/// <summary>
/// 料仓物料名称
/// </summary>
private string _materialName;
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } }
/// <summary>
/// 是否真在运行
/// </summary>
private bool _isRunning;
public bool IsRunning { get { return _isRunning; } set { _isRunning = value; OnPropertyChanged(); } }
/// <summary>
/// 是否正在下料
/// </summary>
private bool _isLayOff;
public bool IsLayOff { get { return _isLayOff; } set { _isLayOff = value; OnPropertyChanged(); } }

/// <summary>
/// 是否故障报警
/// </summary>
private bool _isFault;
public bool IsFault { get { return _isFault; } set { _isFault = value; OnPropertyChanged(); } }

}
}

+ 201
- 0
DosingSystem/View/StockControlView.xaml 查看文件

@@ -0,0 +1,201 @@
<UserControl x:Class="BPASmartClient.DosingSystem.View.StockControlView"
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:BPASmartClient.DosingSystem.View"
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel"
xmlns:define="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:StockControViewModel/>
</UserControl.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid x:Name="TopGrid">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="0.2*"/>
</Grid.RowDefinitions>
<ListView
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding statusTop}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="6" HorizontalAlignment="Left"
VerticalAlignment="Top"
Rows="1" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"/>
<RowDefinition Height="0.2*"/>
</Grid.RowDefinitions>
<define:MaterialStock Margin="0,0,70,0" IsOpenState="False" IsFaultState="False" IsRunning="False" IsLayOffState="False"/>
<Grid VerticalAlignment="Bottom" Margin="5,5,70,0" Grid.Row="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Margin="0,0,10,0">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br3" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="Orange">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock VerticalAlignment="Center" Text="&#xe79e;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="开盖" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="yellow" TargetName="br3"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>

</Button.Template>
</Button>
<Button Grid.Column="1">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br2" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="yellowgreen">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock VerticalAlignment="Center" Text="&#xe63f;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="出料" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="lawngreen" TargetName="br2"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<Grid Grid.Row="1" x:Name="midGrid" Margin="0,0,0,0">
<define:ConveyBelt2 IsRun="True" BeltWidth="{Binding ElementName=midGrid, Path=ActualWidth}" BeltHeight="{Binding ElementName=midGrid, Path=ActualHeight}" Margin="-12,0,10,0" BeltDashThickess="50"/>
</Grid>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,40,0">
<Button HorizontalAlignment="Right" Margin="0,0,10,0">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br5" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="yellowgreen">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock VerticalAlignment="Center" Text="&#xe746;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="启动线体" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="lawngreen" TargetName="br5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button HorizontalAlignment="Right" Margin="0,0,10,0">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br5" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="Red">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock VerticalAlignment="Center" Text="&#xe631;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="停止线体" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="PaleVioletRed" TargetName="br5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
<ListView Grid.Row="1" Background="Transparent" VerticalAlignment="Center"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding statusDown}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="6" HorizontalAlignment="Left"
VerticalAlignment="Top"
Rows="1" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"/>
<RowDefinition Height="0.2*"/>
</Grid.RowDefinitions>
<define:MaterialStock Margin="0,0,70,0" IsOpenState="False" IsFaultState="False" IsRunning="True" />
<Grid VerticalAlignment="Bottom" Margin="5,5,70,0" Grid.Row="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Margin="0,0,10,0">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="Orange">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock VerticalAlignment="Center" Text="&#xe79e;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="开盖" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="yellow" TargetName="br"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>

</Button.Template>
</Button>
<Button Grid.Column="1">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br1" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="yellowgreen">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock VerticalAlignment="Center" Text="&#xe63f;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="出料" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="lawngreen" TargetName="br1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Grid>
</UserControl>

+ 30
- 0
DosingSystem/View/StockControlView.xaml.cs 查看文件

@@ -0,0 +1,30 @@
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 BPASmartClient.DosingSystem.View
{
/// <summary>
/// StockControlView.xaml 的交互逻辑
/// </summary>
public partial class StockControlView : UserControl
{
public StockControlView()
{
InitializeComponent();
}

}
}

+ 30
- 0
DosingSystem/ViewModel/StockControViewModel.cs 查看文件

@@ -0,0 +1,30 @@
using BPASmartClient.DosingSystem.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem.ViewModel
{
internal class StockControViewModel
{
public StockControViewModel()
{
for (int i = 0; i < 6; i++)
{
statusTop.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i+1}号料仓", MaterialWeight = 85+i });
}
for (int i =6; i < 12; i++)
{
statusDown.Add(new StockStatusModel { IsFault = false, IsLayOff = true, IsRunning = true, MaterialName = $"{i+1}号料仓", MaterialWeight = 85 + i });
}
}

public ObservableCollection<StockStatusModel> statusTop { get; set; } = new ObservableCollection<StockStatusModel>();
public ObservableCollection<StockStatusModel> statusDown { get; set; } = new ObservableCollection<StockStatusModel>();
}
}

+ 57
- 49
FryPot_DosingSystem/Control/DosingLogicControl.cs 查看文件

@@ -436,77 +436,85 @@ namespace FryPot_DosingSystem.Control
/// <exception cref="NotImplementedException"></exception>
private void FileRegClean()
{
int days = 5; //清除期限
string[] filesOne = Directory.GetDirectories("AccessFile//DB//炒锅1状态数据");
if (filesOne.Count() > 0)
try
{
foreach (var item in filesOne)
int days = 5; //清除期限
string[] filesOne = Directory.GetDirectories("AccessFile//DB//炒锅1状态数据");
if (filesOne.Count() > 0)
{
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
foreach (var item in filesOne)
{
Directory.Delete(item, true);
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
{
Directory.Delete(item, true);
}
}
}
}
string[] filesTwo = Directory.GetDirectories("AccessFile//DB//炒锅2状态数据");
if (filesTwo.Count() > 0)
{
foreach (var item in filesTwo)
string[] filesTwo = Directory.GetDirectories("AccessFile//DB//炒锅2状态数据");
if (filesTwo.Count() > 0)
{
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
foreach (var item in filesTwo)
{
Directory.Delete(item, true);
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
{
Directory.Delete(item, true);
}
}
}
}
string[] filesThree = Directory.GetDirectories("AccessFile//DB//炒锅3状态数据");
if (filesThree.Count() > 0)
{
foreach (var item in filesThree)
string[] filesThree = Directory.GetDirectories("AccessFile//DB//炒锅3状态数据");
if (filesThree.Count() > 0)
{
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
foreach (var item in filesThree)
{
Directory.Delete(item, true);
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
{
Directory.Delete(item, true);
}
}
}
}
string[] filesFour = Directory.GetDirectories("AccessFile//DB//炒锅4状态数据");
if (filesFour.Count() > 0)
{
foreach (var item in filesFour)
string[] filesFour = Directory.GetDirectories("AccessFile//DB//炒锅4状态数据");
if (filesFour.Count() > 0)
{
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
foreach (var item in filesFour)
{
Directory.Delete(item, true);
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
{
Directory.Delete(item, true);
}
}
}
}
string[] filesFive = Directory.GetDirectories("AccessFile//DB//炒锅5状态数据");
if (filesFive.Count() > 0)
{
foreach (var item in filesFive)
string[] filesFive = Directory.GetDirectories("AccessFile//DB//炒锅5状态数据");
if (filesFive.Count() > 0)
{
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
foreach (var item in filesFive)
{
Directory.Delete(item, true);
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days)
{
Directory.Delete(item, true);
}
}
}
}
catch (Exception)
{

// throw;
}
}
/// <summary>
/// 时间差计算


正在加载...
取消
保存