仓库管理系统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.mfbz.cn/a/762906.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

手把手搞定报名亚马逊科技认证

引言 亚马逊云科技认证考试为我们这些技术从业者提供了提升专业技能的机会。无论选择线上还是线下考试&#xff0c;每种方式都有其独特的优势和挑战。选择合适的考试方式将帮助我们更好地展示自己的技术水平。以下是我对不同考试方式的优缺点介绍&#xff0c;以及各科目的考试…

Java案例抢红包

目录 一&#xff1a;题目要求&#xff1a; 二&#xff1a;思路分析&#xff1a;&#xff08;遇见问题先想出完整的思路逻辑再去动手事半功倍&#xff09; 三&#xff1a;具体代码&#xff1a; 一&#xff1a;题目要求&#xff1a; 二&#xff1a;思路分析&#xff1a;&#x…

基于隐马尔可夫模型的股票预测【HMM】

基于机器学习方法的股票预测系列文章目录 一、基于强化学习DQN的股票预测【股票交易】 二、基于CNN的股票预测方法【卷积神经网络】 三、基于隐马尔可夫模型的股票预测【HMM】 文章目录 基于机器学习方法的股票预测系列文章目录一、HMM模型简介&#xff08;1&#xff09;前向后…

Python容器 之 列表--下标和切片

列表的切片 得到是 新的列表字符串的切片 得到是 新的字符串 如果下标 不存在会报错 list1 [1, 3.14, "hello", False] print(list1)# 获取 列表中 第一个数据 print(list1[0]) # 1# 获取列表中的最后一个数据 print(list1[-1]) # [False]# 获取中间两个数 即 3.1…

面经-数据库

1.MySQL 1.1什么是MySQL? MySQL 是⼀种关系型数据库&#xff0c;在 Java 企业级开发中⾮常常⽤&#xff0c;因为 MySQL 是开源免费的&#xff0c;并 且⽅便扩展。阿⾥巴巴数据库系统也⼤量⽤到了 MySQL &#xff0c;因此它的稳定性是有保障的。 MySQL 是开放源代码的&…

VuePress介绍

从本文开始&#xff0c;动手搭建自己的博客&#xff01;希望读者能跟着一起动手&#xff0c;这样才能真正掌握。 ‍ VuePress 是什么 VuePress 是由 Vue 作者带领团队开发的&#xff0c;非常火&#xff0c;使用的人很多&#xff1b;Vue 框架官网也是用了 VuePress 搭建的。即…

一、安全完善度等级SIL(Safety Integrity Level)介绍

目录 一、背景 二、定义 2.1 相关概念介绍如下&#xff1a; 2.2 扩展 2.3 注意事项 一、背景 在轨道交通行业中&#xff0c;安全完善度等级&#xff08;SIL&#xff0c;Safety Integrity Level&#xff09;是一个至关重要的概念&#xff0c;它用于评估安全相关系统&#x…

昇思25天学习打卡营第13天|基于MobileNetV2的垃圾分类

MobileNetv2模型原理介绍 相比于传统的卷积神经网络&#xff0c;MobileNet网络使用深度可分离卷积&#xff08;Depthwise Separable Convolution&#xff09;的思想在准确率小幅度降低的前提下&#xff0c;大大减小了模型参数与运算量。并引入宽度系数α和分辨率系数β使模型满…

头文件没有string.h ----- 怎么统计字符串的长度?

字符串的逆序&#xff08;看收藏里面的题&#xff09; 第一种方式&#xff1a; #include <stdio.h> void f(char *p);int main() {char s[1000];gets(s);f(s);printf("%s",s);return 0; }void f(char *p) {int i0;int q,k0;while(p[i]!\0){i;}while(k<i){…

js修改scss变量

style.scss $color : var(--color,#ccc); // 默认值 #ccc .color{background: $color; } 定义了一个scss变量&#xff08;$color&#xff09;&#xff0c;用普通的css变量&#xff08;--color&#xff09;给他赋值&#xff0c;这里需要一个默认值&#xff0c;此时css变量(--co…

python 中的 下划线_ 是啥意思

在 Python 中&#xff0c;_&#xff08;下划线&#xff09;通常用作占位符&#xff0c;表示一个变量名&#xff0c;但程序中不会实际使用这个变量的值。 目录 忽略循环变量&#xff1a;忽略函数返回值&#xff1a;在解释器中使用&#xff1a;举例子1. 忽略循环变量2. 忽略不需…

001 SpringMVC介绍

文章目录 基础概念介绍BS和CS开发架构应用系统三层架构MVC设计模式 SpringMVC介绍SpringMVC是什么SpringMVC与Spring的联系为什么要学习SpringMVC 六大组件介绍六大组件(MVC组件其他三大组件)说明 基础概念介绍 BS和CS开发架构 一种是C/S架构&#xff0c;也就是客户端/服务器…

依托天拓四方工业智能网关实现CNC数控机床的远程运维

随着工业4.0时代的到来&#xff0c;智能制造和工业互联网成为了推动制造业转型升级的重要力量。CNC数控机床作为制造业的核心设备&#xff0c;其运行效率与稳定性直接关系到企业的生产效益。因此&#xff0c;实现CNC数控机床的远程运维&#xff0c;对于提升企业竞争力、降低运营…

使用systemd管理Linux下的frps服务:安装、配置及自动化操作指南

在 Linux 系统下&#xff0c;使用 systemd 可以方便地控制 frps 服务端的启动、停止、配置后台运行以及开机自启动。以下是具体的操作步骤&#xff1a; 1. 安装 systemd 如果您的 Linux 服务器上尚未安装 systemd&#xff0c;可以使用包管理器如 yum&#xff08;适用于 Cent…

K8S学习教程(一):使用PetaExpress云服务器安装Minikube 集群题

什么是Minikube Minikube是一款工具&#xff0c;主要用于在本地运行 Kubernetes 集群。Kubernetes 开源的平台&#xff0c;用于自动化容器化应用的部署、扩展和管理&#xff0c;而Minikube 使得开发人员能够在本地机器上轻松创建一个单节点的 Kubernetes 集群&#xff0c;从而…

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

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

JMH319【亲测整理】2017剑侠情缘2剑网2汉化版+网游VM单机版+修复纹饰翅膀+内置GM命令无限道具+一键端视频安装教学

资源介绍&#xff1a; 这一套新端早就在手上 一直没分享出来 既然大家放出来了 我也就发出来大家研究吧 目前在改另外一套 是否需要虚拟机&#xff1a;是 文件大小&#xff1a;压缩包约7G 支持系统&#xff1a;win7、win10、win11 硬件需求&#xff1a;运行内存12G …

如何在OpenEuler 上快速部署一套Zabbix7.0监控系统

如何在OpenEuler 上快速部署一套Zabbix监控系统 一、环境信息 用途机器IP操作系统备注zabbix-server172.22.33.180openeuler 22.03 LTS SP37.0 LTS 版本&#xff0c;容器部署zabbix-agent172.16.10.182openeuler 22.03 LTS SP37.0 源码编译部署 二、Docker 部署 2.1 二进制…

七月论文审稿GPT第5版:拿我司七月的早期paper-7方面review数据集微调LLama 3

前言 llama 3出来后&#xff0c;为了通过paper-review的数据集微调3&#xff0c;有以下各种方式 不用任何框架 工具 技术&#xff0c;直接微调原生的llama 3&#xff0c;毕竟也有8k长度了 效果不期望有多高&#xff0c;纯作为baseline通过PI&#xff0c;把llama 3的8K长度扩展…

生产环境部署与协同开发-Docker(原创超全)

关闭防火墙 systemctl stop firewalld.service 关闭SELinux vim /etc/selinux/config 查看yum支持的包并安装docker引擎 yum listyum install -y docker 启动docker设置docker自启动测试docker是否安装成功&#xff1f; systemctl start dockersystemctl enable dockerdoc…