仓库管理系统24--统计报表

原创不易,打字不易,截图不易,多多点赞,送人玫瑰,留有余香,财务自由明日实现 

1、引用LiveCharts

2、创建LiveChartViewModel

using GalaSoft.MvvmLight;
using LiveCharts.Wpf;
using LiveCharts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GalaSoft.MvvmLight.Command;
using West.StoreMgr.Service;namespace West.StoreMgr.ViewModel
{/// <summary>/// 柱状图viewmodel/// </summary>public class LiveChartViewModel : ViewModelBase{//物资库存柱状private IChartValues goodsChartValues = new ChartValues<double>();public IChartValues GoodsChartValues{get { return goodsChartValues; }set { goodsChartValues = value; RaisePropertyChanged(); }}private List<string> goodsLabes = new List<string>();/// <summary>/// 物资标签/// </summary>public List<string> GoodsLabes{get { return goodsLabes; }set { goodsLabes = value; RaisePropertyChanged(); }}//物资入库流水折线public SeriesCollection GoodsInStoreSeries { get; set; } = new SeriesCollection();public AxesCollection GoodsInStoreAxis { get; set; } = new AxesCollection();//物资出库流水折线public SeriesCollection GoodsOutStoreSeries { get; set; } = new SeriesCollection();public AxesCollection GoodsOutStoreAxis { get; set; } = new AxesCollection();//客户出库饼图public SeriesCollection CustomerPieSeries { get; set; } = new SeriesCollection();/// <summary>/// 加载命令/// </summary>public RelayCommand LoadCommand{get{return new RelayCommand(() =>{ GoodsChartValues.Clear();GoodsLabes.Clear();var goodsList = new GoodsService().Select();var instoreList = new InStoreService().Select();var outstoreList = new OutStoreService().Select();var customers = new CustomerService().Select();goodsList.ForEach(goods =>{//物资库存柱状GoodsChartValues.Add(goods.Quant);GoodsLabes.Add(goods.Name);//物资入库流水折线var instores = instoreList.FindAll(item => item.GoodsSerial == goods.Serial);var inserise = new LineSeries() { Title = goods.Name, Values = new ChartValues<double>() };instores.ForEach(item =>{inserise.Values.Add(item.Number);});GoodsInStoreSeries.Add(inserise);//物资出库流水折线var outstores = outstoreList.FindAll(item => item.GoodsSerial == goods.Serial);var outserise = new LineSeries() { Title = goods.Name, Values = new ChartValues<double>() };outstores.ForEach(item =>{outserise.Values.Add(item.Number);});GoodsOutStoreSeries.Add(outserise);});CustomerPieSeries.Clear();customers.ForEach(item =>{var list = outstoreList.FindAll(outstore => outstore.CustomerId == item.Id);var sum = list.Sum(t => t.Number);var pieSeries = new PieSeries{Title = item.Name,Values = new ChartValues<double>() { sum }};CustomerPieSeries.Add(pieSeries);}); });}}}
}

3、创建LiveChartView用户控件

<UserControl x:Class="West.StoreMgr.View.LiveChartView"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:West.StoreMgr.View"xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:wpf="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"mc:Ignorable="d" DataContext="{Binding Source={StaticResource Locator},Path=LiveChart}"d:DesignHeight="450" d:DesignWidth="800"><i:Interaction.Triggers><i:EventTrigger EventName="Loaded"><i:InvokeCommandAction Command="{Binding LoadCommand}"/></i:EventTrigger></i:Interaction.Triggers><Grid><Grid.RowDefinitions><RowDefinition Height="50"/><RowDefinition Height="auto"/><RowDefinition/></Grid.RowDefinitions><!--标题--><StackPanel Background="#EDF0F6" Orientation="Horizontal"><TextBlock Margin="10 0 0 0" Text="&#xf015;" FontSize="20" FontFamily="/Fonts/#FontAwesome" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#797672"/><TextBlock Margin="10 0 0 0" Text="首页 > 报表统计" FontSize="20" FontFamily="/Fonts/#FontAwesome" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#797672"/></StackPanel><!--增加--><Grid Grid.Row="1" Margin="10"></Grid><!--报表--><Grid Grid.Row="2" Margin="10 0 10 10" ><Grid.ColumnDefinitions><ColumnDefinition/><ColumnDefinition/></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition/><RowDefinition/></Grid.RowDefinitions><!--物资库存柱状图--><TextBlock Text="物资库存柱状图" Grid.Row="0" Grid.Column="0" Margin="150 -20 0 0" FontSize="15" FontFamily="微软雅黑" ></TextBlock><Border Grid.Row="0" Grid.Column="0" BorderBrush="BurlyWood"  BorderThickness="0.5"><wpf:CartesianChart  Margin="10"><wpf:CartesianChart.Series><wpf:ColumnSeries Values="{Binding GoodsChartValues}"/></wpf:CartesianChart.Series><wpf:CartesianChart.AxisX><wpf:Axis ShowLabels="True" Labels="{Binding GoodsLabes}"><wpf:Axis.Separator><wpf:Separator Step="1" IsEnabled="False"/></wpf:Axis.Separator></wpf:Axis></wpf:CartesianChart.AxisX></wpf:CartesianChart></Border><!--客户出库统计饼图--><TextBlock Text="客户出库统计饼图" Grid.Row="0" Grid.Column="1" Margin="150 -20 0 0" FontSize="15" FontFamily="微软雅黑"></TextBlock><Border Grid.Row="0" Grid.Column="1"  BorderBrush="BurlyWood"  BorderThickness="0.5"><wpf:PieChart LegendLocation="Right" Hoverable="True" InnerRadius="30" Series="{Binding CustomerPieSeries}"><wpf:PieChart.ChartLegend><wpf:DefaultLegend Foreground="Green"/></wpf:PieChart.ChartLegend></wpf:PieChart> </Border> <!--物资入库流水记录--><TextBlock  Text="物资入库流水记录" Grid.Row="1" Grid.Column="0"  Margin="150 0 0 0" FontSize="15" FontFamily="微软雅黑"></TextBlock><Border Grid.Row="1" Grid.Column="0" BorderBrush="BurlyWood"  BorderThickness="0.5"> <wpf:CartesianChart  Series="{Binding GoodsInStoreSeries}" AxisX="{Binding GoodsInStoreAxis}"/></Border><!--物资出库流水记录--><TextBlock Text="物资出库流水记录" Grid.Row="1" Grid.Column="1" Margin="150 0 0 0" FontSize="15" FontFamily="微软雅黑" ></TextBlock><Border Grid.Row="1" Grid.Column="1"  BorderBrush="BurlyWood"  BorderThickness="0.5"> <wpf:CartesianChart Margin="10" Series="{Binding GoodsOutStoreSeries}" AxisX="{Binding GoodsOutStoreAxis}"/></Border></Grid></Grid>
</UserControl>

4、运行效果

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/38901.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【SQL注入】 数据库基础

MySQL中的库名 information_schema&#xff08;信息库&#xff09;—— 保存其他数据库里所有信息&#xff08;数据库名、表、字段的数据类型/访问权限&#xff09; mysql—— 存储用户名 密码 host performance_schema——内存数据库 数据放在内存中直接操作的数据库 sys—…

代码随想录训练营Day52

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、回文子串二、最长回文子序列 前言 提示&#xff1a;这里可以添加本文要记录的大概内容&#xff1a; 今天是跟着代码随想录刷题的第52天&#xff0c;主要学…

从新手到高手:Scala函数式编程完全指南,Scala 数据类型(4)

1、Scala 数据类型 Scala 与 Java有着相同的数据类型&#xff0c;下表列出了 Scala 支持的数据类型&#xff1a;

智能扫地机器人编译过程中的定位导航技术

智能扫地机器人的定位导航技术主要包括以下几种&#xff0c;下面将分点表示并归纳这些技术及其特点&#xff1a; 1.随机碰撞导航&#xff1a;这是最早期的导航方式&#xff0c;扫地机器人通过随机移动来覆盖地面。 特点&#xff1a;效率较低&#xff0c;容易重复清洁或遗漏区域…

CentOS 7报错Erro:NetworkManager is not running怎么处理?

CentOS 7系统报错Error: NetworkManager is not running&#xff0c;意思是NetworkManager未在运行&#xff0c;NetworkManager是Linux系统上管理网络设置的守护进程&#xff0c;负责自动处理和配置网络连接&#xff0c;未运行可能会导致网络连接问题。遇到报错Error: NetworkM…

运用大数据分析提升返利App的市场营销效果

运用大数据分析提升返利App的市场营销效果 大家好&#xff0c;我是免费搭建查券返利机器人省钱赚佣金就用微赚淘客系统3.0的小编&#xff0c;也是冬天不穿秋裤&#xff0c;天冷也要风度的程序猿&#xff01; 引言 随着信息技术的快速发展&#xff0c;大数据分析在各行各业的…

ros1仿真导航机器人 navigation

仅为学习记录和一些自己的思考&#xff0c;不具有参考意义。 1navigation导航框架 2导航设置过程 &#xff08;1&#xff09;启动仿真环境 roslaunch why_simulation why_robocup.launch &#xff08;2&#xff09;启动move_base导航、amcl定位 roslaunch why_simulation nav…

系统运行缓慢CPU飙高等问题的排查思路

系统运行缓慢和CPU飙高问题的排查思路 当系统运行缓慢或CPU使用率飙高时&#xff0c;可能有多种原因导致这一现象。以下是一些排查思路和方法&#xff1a; 1. 检查系统资源使用情况 - 任务管理器&#xff08;Windows&#xff09;或活动监视器&#xff08;Mac&#xff09;或top…

postgresql搭建

搭建postgresql-11.3&#xff0c;和客户端工具 1&#xff0c;准备对应的包&#xff0c;右键直接下一步安装完即可&#xff0c; 将postgresql设置为本地服务&#xff0c;方便启动&#xff0c; 2&#xff0c;用对应客户端软件连接&#xff0c;新建一个数据库controlDB 新建用户…

无偏归一化自适应心电ECG信号降噪方法(MATLAB)

心电信号作为一种生物信号&#xff0c;含有大量的临床应用价值的信息&#xff0c;在现代生命医学研究中占有重要的地位。但心电信号低频、低幅值的特点&#xff0c;使其在采集和传输的过程中经常受到噪声的干扰&#xff0c;使心电波形严重失真&#xff0c;从而影响后续的病情分…

你还不会买智能猫砂盆吗?跟你们详细讲解今年最火的智能猫砂盆!

智能猫砂盆的坑&#xff0c;想必有很多养猫家庭都踩过吧。自己买回来的机器&#xff0c;不是空间不够大&#xff0c;导致猫咪拉到外面去&#xff0c;就是铲不干净&#xff0c;还得自己进行二次清理&#xff0c;搞得这个智能猫砂盆白买了。那如果我们想要购买合适自己家猫咪的智…

数据链路层分析

文章目录 前言一、数据链路层概述二、终端之间的通信三、帧格式1.Ethernet_II型2.IEEE 802.3 四、MTU分析五、数据帧的传输1.MAC地址2.单播3.广播4.组播5.数据帧的收发 前言 网络中传输数据需要定义并遵循一些标准&#xff0c;以太网是根据IEEE802.3标准来管理和控制数据帧的&…

sqlserver开启CDC

1、背景 由于需要学习flink cdc&#xff0c;并且数据选择sqlserver&#xff0c;所以这里记录sqlserver的cdc开启操作步骤。 2、基础前提 官方介绍地址&#xff1a;https://learn.microsoft.com/zh-cn/sql/relational-databases/track-changes/enable-and-disable-change-dat…

隐式转换的魔法:Scala中隐式转换的深度解析

隐式转换的魔法&#xff1a;Scala中隐式转换的深度解析 在Scala编程语言的丰富特性中&#xff0c;隐式转换是一个强大而微妙的工具。它允许开发者在不改变现有代码的情况下&#xff0c;扩展或修改类的行为。本文将深入探讨Scala中隐式转换的工作原理&#xff0c;并通过详细的代…

如何优化前端性能:提高网页加载速度的实用技巧

我们在前端开发中&#xff0c;性能优化是提高用户体验的关键因素。网页加载速度直接影响用户的满意度和留存率。本文将介绍几种优化前端性能的实用方法&#xff0c;帮助你提高网页加载速度。 问题描述 &#xff1a; 首先前端性能优化涉及多个方面&#xff0c;包括减少HTTP请…

Java命名规范:

Java命名规范&#xff1a; 大驼峰命名法/帕斯卡命名法&#xff1a; ​ 作用&#xff1a;类名、接口名 ​ 规则&#xff1a;每个单词首字母大写 ​ ps&#xff1a; ​ public class HelloWorld{} ​ 小驼峰命名法&#xff1a; ​ 作用&#xff1a;方法名、变量名 ​ 规则&am…

专为运维工程师设计!阿里藏经阁出品的Python实战手册被我搞来了

Python 可能是极少数既简单又强大的编程语言中的一种。更重要的是&#xff0c;用它来编程是非常快乐的事。 今天给小伙伴们分享的是阿里“藏经阁”出品的专门给运维工程师设计的Python实战手册 废话不多说&#xff0c;下面把内容展示给大家 01 Python快速回顾 02 Python脚本…

【大模型】基于ChatGLM进行微调及应用 [更新中......]

文章目录 一、前言二、说明2.1 代码结构2.2 依赖包版本 三、启动对话演示3.1 命令行交互 cli_demo.py3.2 网页交互 web_demo.py 四、微调模型4.1 基于 P-Tuning v2 微调模型4.1.1 软件依赖4.1.2 下载数据集4.1.3 下载模型文件4.1.4 操作步骤 4.2 基于 Full Parameter 微调模型4…

洛谷P10677题解

题目描述 给一个 n m n\times m nm 的字符矩阵&#xff0c;有些位置有障碍&#xff08;记为字符 #&#xff09;&#xff0c;需要在矩阵上找出一条起始点任意的路径&#xff08;可以重复经过某个格子&#xff09;&#xff0c;使得字典序最大。 可以证明答案一定是有限的或者…

从进程到协程,浅谈Java提高CPU利用率的发展

综合CPU利用率来讲,计算机远古时期,为提高CPU利用率,有以下概念 串行进程->并行进程->线程->线程池>->虚拟线程(协程) 一,串行进程, 早期的操作系统对任务调度,往往从最简单的实现开端,串型进程意思是对分配的一个任务,其任务能百分百占用CPU,哪怕…