仓库管理系统13--物资设置

1、添加窗体

2、设计UI界面

注意这个下拉框的绑定,你看到的选项是由displaymember决定,当你选择了哪个选项时,后台绑定这个选项的ID 

<UserControl x:Class="West.StoreMgr.View.GoodsView"
             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"
             mc:Ignorable="d" 
             DataContext="{Binding Source={StaticResource Locator},Path=Goods}">
    <!--加载页面时获取物资列表数据-->
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <i:InvokeCommandAction Command="{Binding LoadCommand}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition/>
            <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="20">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Border Background="#72BBE5">
                <TextBlock Text="添加物资" FontSize="18" VerticalAlignment="Center" Foreground="#1F3C4C" Margin="0 0 10 0"/>
            </Border>
            <StackPanel Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center"  Margin="0 10 0 10">
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                    <TextBlock Margin="0 0 10 0" Text="物资类别:" VerticalAlignment="Center" Width="80"/>
                    <!--下拉框绑定后台类别列表-->
                    <ComboBox x:Name="comboboxGoodsType" Margin="0 0 10 0" ItemsSource="{Binding GoodsTypeList}" DisplayMemberPath="Name" SelectedValuePath="Id" Width="150" Height="30" />
                    <TextBlock Margin="0 0 10 0" Text="规格型号:" VerticalAlignment="Center" Width="80"/>
                    <!--下拉框绑定后台规格列表-->
                    <ComboBox x:Name="comboboxSpec" Margin="0 0 10 0" ItemsSource="{Binding SpecList}" DisplayMemberPath="Name" SelectedValuePath="Id" Width="150" Height="30" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  Margin="0 10 0 10">
                    <TextBlock Margin="0 0 10 0" Text=" 序号:" VerticalAlignment="Center" Width="80"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Center" TextAlignment="Left" VerticalContentAlignment="Center"  Margin="0 0 10 0" Text="{Binding Goods.Serial,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
                    <TextBlock Margin="0 0 10 0" Text="物资名称:" VerticalAlignment="Center" Width="80"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Center" TextAlignment="Left" VerticalContentAlignment="Center"  Margin="0 0 10 0" Text="{Binding Goods.Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
                    <TextBlock Margin="0 0 10 0" Text="单位:" VerticalAlignment="Center" Width="80"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Center" TextAlignment="Left" VerticalContentAlignment="Center"  Margin="0 0 10 0" Text="{Binding Goods.Unit,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  Margin="0 10 0 10">
                    <TextBlock Margin="0 0 10 0" Text="库存最小值:" VerticalAlignment="Center" Width="80"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Center" TextAlignment="Left" VerticalContentAlignment="Center"  Margin="0 0 10 0" Text="{Binding Goods.Min,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
                    <TextBlock Margin="0 0 10 0" Text="库存最大值:" VerticalAlignment="Center" Width="80"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Center" TextAlignment="Left" VerticalContentAlignment="Center"  Margin="0 0 10 0" Text="{Binding Goods.Max,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
                    <TextBlock Margin="0 0 10 0" Text="备注:" VerticalAlignment="Center" Width="80"/>
                    <TextBox HorizontalAlignment="Left" VerticalAlignment="Center" TextAlignment="Left" VerticalContentAlignment="Center"  Margin="0 0 10 0" Text="{Binding Goods.Tag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 10 0 10">                  
                    <Button Margin="542 0 0 0" Height="36" Width="199" Grid.Row="3" 
                     Content="增加" Style="{StaticResource ButtonStyle}" 
                     CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:GoodsView}}"
                     Command="{Binding AddCommand}"/>
                </StackPanel>
            </StackPanel> 
        </Grid>

        <!--浏览-->
        <Grid Grid.Row="2" Margin="10 0 10 10">
            <DataGrid ItemsSource="{Binding GoodsList}" CanUserDeleteRows="False" CanUserAddRows="False" AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="序号" Binding="{Binding Serial}"/>
                    <DataGridTextColumn Header="名称" Binding="{Binding Name}"/>
                    <DataGridTextColumn Header="单位" Binding="{Binding Unit}"/>
                    <DataGridTextColumn Header="最小库存" Binding="{Binding Min}"/>
                    <DataGridTextColumn Header="最大库存" Binding="{Binding Max}"/>
                    <DataGridTextColumn Header="当前库存" Binding="{Binding Quant}"/>
                    <DataGridTextColumn Header="物资类别" Binding="{Binding GoodsTypeName}" IsReadOnly="True"/>
                    <DataGridTextColumn Header="规格型号" Binding="{Binding SpecName}" IsReadOnly="True"/>
                    <DataGridTextColumn Header="备注" Binding="{Binding Tag}"/>
                    <DataGridTextColumn Header="日期" Binding="{Binding InsertDate}"/>
                    <DataGridTemplateColumn  Header="操作">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <Button Content="编辑" 
                                         Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:GoodsView},Path=DataContext.EditCommand}"
                                         CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}}" 
                                         Tag="{Binding}" 
                                         Style="{StaticResource DataGridButtonStyle}" />
                                    <Button Content="删除" 
                                         Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:GoodsView},Path=DataContext.DeleteCommand}"
                                         CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}}"
                                         Tag="{Binding}" 
                                         Style="{StaticResource DataGridButtonStyle}" />
                                </StackPanel>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
    </Grid>
</UserControl>

3、添加viewmodel

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using CommonServiceLocator;
using West.StoreMgr.Service;
using West.StoreMgr.Helper;
using West.StoreMgr.View;
using West.StoreMgr.Windows;
using static West.StoreMgr.Windows.MsgBoxWindow;

namespace West.StoreMgr.ViewModel
{
    /// <summary>
    /// 物资viewmodel
    /// </summary>
    public class GoodsViewModel : ViewModelBase
    {
        public GoodsViewModel()
        {

        }

        private Goods goods = new Goods();
        public Goods Goods
        {
            get { return goods; }
            set { goods = value; RaisePropertyChanged(); }
        }

        private List<Goods> goodsList = new List<Goods>();
        /// <summary>
        /// 物资列表
        /// </summary>
        public List<Goods> GoodsList
        {
            get { return goodsList; }
            set { goodsList = value; RaisePropertyChanged(); }
        }

        private List<GoodsType> goodsTypeList = new List<GoodsType>();
        /// <summary>
        /// 物资类别集合
        /// </summary>
        public List<GoodsType> GoodsTypeList
        {
            get { return goodsTypeList; }
            set { goodsTypeList = value; RaisePropertyChanged(); }
        }

        private List<Spec> specList = new List<Spec>();
        /// <summary>
        /// 物资规格集合
        /// </summary>
        public List<Spec> SpecList
        {
            get { return specList; }
            set { specList = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 加载页面时获取数据
        /// </summary>
        public RelayCommand LoadCommand
        {
            get
            {
                return new RelayCommand(() =>
                {
                    GoodsList = new GoodsService().Select();//物资列表
                    GoodsTypeList = new GoodsTypeService().Select();//物资类别列表
                    SpecList = new SpecService().Select();//规格列表
                });
            }
        }


        //添加
        public RelayCommand<UserControl> AddCommand
        {
            get
            {
                var command = new RelayCommand<UserControl>((obj) =>
                {
                    if (!(obj is GoodsView view)) return;
                    if (string.IsNullOrEmpty(Goods.Name) == true
                    || string.IsNullOrEmpty(Goods.Serial) == true)
                    {
                        MsgWinHelper.ShowError("序号和名字不能为空");
                        return;
                    }

                    Goods.InsertDate = DateTime.Now;
                    Goods.UserInfoId = AppData.Instance.User.Id;
                    var goodsType = view.comboboxGoodsType.SelectedItem as GoodsType;//将选择的下拉框类别转换成物资类别对象
                    var spec = view.comboboxSpec.SelectedItem as Spec;//将选择的下拉框规格转换成物资规格对象
                    if (goodsType != null) Goods.GoodsTypeId = goodsType.Id;
                    if (spec != null) Goods.SpecId = spec.Id;

                    var service = new GoodsService();
                    int count = service.Insert(Goods);
                    if (count > 0)
                    {
                        GoodsList = service.Select(); 
                        MsgWinHelper.ShowMessage("物资添加成功!");
                        Goods = new Goods();
                    }
                    else
                    {
                        MsgWinHelper.ShowError("物资添加失败!");
                    }
                });

                return command;
            }
        }

        //修改
        public RelayCommand<Button> EditCommand
        {
            get
            {
                var command = new RelayCommand<Button>((view) =>
                {
                    var old = view.Tag as Goods;
                    if (old == null) return;
                    var vm = ServiceLocator.Current.GetInstance<EditGoodsViewModel>();
                    vm.Goods = old;
                    vm.GoodsType = vm.GoodsTypeList.FirstOrDefault(t => t.Id == old.GoodsTypeId);
                    vm.Spec = vm.SpecList.FirstOrDefault(t => t.Id == old.SpecId);
                    var window = new EditGoodsWindow();
                    window.ShowDialog();
                    GoodsList = new GoodsService().Select();
                });

                return command;
            }
        }

        //删除
        public RelayCommand<Button> DeleteCommand
        {
            get
            {
                var command = new RelayCommand<Button>((view) =>
                {
                    if (MsgWinHelper.ShowQuestion("您确定要删除该物资吗?") == CustomMessageBoxResult.OK)
                    {
                        var old = view.Tag as Goods;
                        if (old == null) return;

                        var service = new GoodsService();
                        int count = service.Delete(old);
                        if (count > 0)
                        {
                            GoodsList = service.Select();
                            MsgWinHelper.ShowMessage("操作成功");
                        }
                        else
                        {
                            MsgWinHelper.ShowError("操作失败");
                        }
                    }
                });

                return command;
            }
        }
    }
}

 4、运行程序

 5、修改物资

1)添加窗体

 2)UI布局

<Window x:Class="West.StoreMgr.Windows.EditGoodsWindow"
        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:West.StoreMgr.Windows"
          ResizeMode="NoResize"
          WindowStartupLocation="CenterScreen"
        mc:Ignorable="d" DataContext="{Binding Source={StaticResource Locator},Path=EditGoods}"
        Title="修改物资" Height="410" Width="800">
    <Grid Grid.Row="1" Margin="17" Background="#E4ECEF">
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Border Background="#72BBE5">
            <TextBlock Text="修改物资数据" FontSize="18" VerticalAlignment="Center" Foreground="#1F3C4C" Margin="0 0 10 0"/>
        </Border>
        <StackPanel Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center"  Margin="0 10 0 10">
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                <TextBlock Margin="0 0 10 0" Text="物资类别:" VerticalAlignment="Center" Width="80"/>
                <ComboBox x:Name="comboboxGoodsType" Margin="0 0 10 0" ItemsSource="{Binding GoodsTypeList}" SelectedItem="{Binding GoodsType}" DisplayMemberPath="Name" SelectedValuePath="Id" Width="150" Height="30" />
                <TextBlock Margin="0 0 10 0" Text="规格型号:" VerticalAlignment="Center" Width="80"/>
                <ComboBox x:Name="comboboxSpec" Margin="0 0 10 0" ItemsSource="{Binding SpecList}" SelectedItem="{Binding Spec}" DisplayMemberPath="Name" SelectedValuePath="Id" Width="150" Height="30" />
            </StackPanel>
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  Margin="0 10 0 10">
                <TextBlock Margin="0 0 10 0" Text=" 序号:" VerticalAlignment="Center" Width="80"/>
                <TextBox Margin="0 0 10 0" Text="{Binding Goods.Serial,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" IsReadOnly="True" />
                <TextBlock Margin="0 0 10 0" Text="物资名称:" VerticalAlignment="Center" Width="80"/>
                <TextBox Margin="0 0 10 0" Text="{Binding Goods.Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
                <TextBlock Margin="0 0 10 0" Text="单位:" VerticalAlignment="Center" Width="80"/>
                <TextBox Margin="0 0 10 0" Text="{Binding Goods.Unit,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
            </StackPanel>
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  Margin="0 10 0 10">
                <TextBlock Margin="0 0 10 0" Text="库存最小值:" VerticalAlignment="Center" Width="80"/>
                <TextBox Margin="0 0 10 0" Text="{Binding Goods.Min,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
                <TextBlock Margin="0 0 10 0" Text="库存最大值:" VerticalAlignment="Center" Width="80"/>
                <TextBox Margin="0 0 10 0" Text="{Binding Goods.Max,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
                <TextBlock Margin="0 0 10 0" Text="备注:" VerticalAlignment="Center" Width="80"/>
                <TextBox Margin="0 0 10 0" Text="{Binding Goods.Tag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150" Height="30" />
            </StackPanel>
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 10 0 10">
                <!--button-->
                <Button Margin="542 0 0 0" Height="36" Width="199" Grid.Row="3" FontSize="21"
                        Content="确 定" Style="{StaticResource ButtonStyle}" 
                        CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:EditGoodsWindow}}"
                        Command="{Binding EditCommand}"/>
            </StackPanel>
        </StackPanel>
    </Grid>
</Window>

3)添加viewmodel

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using West.StoreMgr.Helper;
using West.StoreMgr.Service;

namespace West.StoreMgr.ViewModel
{
    /// <summary>
    /// 修改物资viewmodel
    /// </summary>
    public class EditGoodsViewModel : ViewModelBase
    {
        public EditGoodsViewModel()
        {
            GoodsTypeList = new GoodsTypeService().Select();
            SpecList = new SpecService().Select(); 
        }


        private GoodsType goodsType = new GoodsType();
        /// <summary>
        /// 物资类别
        /// </summary>
        public GoodsType GoodsType
        {
            get { return goodsType; }
            set { goodsType = value; RaisePropertyChanged(); }
        }

        private Spec spec = new Spec();
        /// <summary>
        /// 物资规格
        /// </summary>
        public Spec Spec
        {
            get { return spec; }
            set { spec = value; RaisePropertyChanged(); }
        }
         

        private List<GoodsType> goodsTypeList = new List<GoodsType>();
        /// <summary>
        /// 物资类别集合
        /// </summary>
        public List<GoodsType> GoodsTypeList
        {
            get { return goodsTypeList; }
            set { goodsTypeList = value; RaisePropertyChanged(); }
        }

        private List<Spec> specList = new List<Spec>();
        /// <summary>
        /// 物资规格集合
        /// </summary>
        public List<Spec> SpecList
        {
            get { return specList; }
            set { specList = value; RaisePropertyChanged(); }
        }


        private Goods goods = new Goods(); 
        public Goods Goods
        {
            get { return goods; }
            set { goods = value; RaisePropertyChanged(); }
        }

        //修改
        public RelayCommand<Window> EditCommand
        {
            get
            {
                var command = new RelayCommand<Window>((window) =>
                {
                    if (string.IsNullOrEmpty(Goods.Name) == true
                    || string.IsNullOrEmpty(Goods.Serial) == true)
                    { 
                        MsgWinHelper.ShowError("序号和名字不能为空!");
                        return;
                    }
                    Goods.GoodsTypeId = GoodsType.Id;
                    Goods.SpecId = Spec.Id;
                    var service = new GoodsService();
                    int count = service.Update(Goods);
                    if (count > 0)
                    {
                        MsgWinHelper.ShowMessage("修改成功!");
                        window.Close();
                    }
                    else
                    {
                        MsgWinHelper.ShowError("修改失败!");
                    }
                });

                return command;
            }
        }


        //取消
        public RelayCommand<Window> CancelCommand
        {
            get
            {
                var command = new RelayCommand<Window>((window) =>
                {
                    window.Close();
                });

                return command;
            }
        }
    }
}

4)运行程序

 

6、删除物资

 

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

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

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

相关文章

Discourse OpenAI 生成图片

正如一些讨论的&#xff0c;生成图片是比较贵的。 差不多到了 1 元 一张图了。 就 OpenAI 生成了上面 4 张图&#xff0c;费用 0.4 美元。 Discourse OpenAI 生成图片 - Discourse - iSharkFly

SSZipArchive 解压后 中文文件名乱码问题

不知道什么情况&#xff0c;做为一个三方广泛使用的框架库&#xff0c;会出现这种比较低级的问题&#xff01; 还有中文的文件名解压后显示乱码&#xff01; 经过深入研究排查&#xff0c;发现目录或文件名编码错误&#xff01;但是POD库&#xff0c;不可能直接在里面改&#…

上市公司银行专利申请数据集(2003-2022年)

数据简介&#xff1a;上市商业银行的专利申请数据是可作为金融科技创新水平的关键指标&#xff0c;这些数据反映了银行在金融技术领域的创新能力。发明专利因其创新性、技术深度和行业代表性&#xff0c;被赋予了特别的重视。遵循郭晔等人(2022)的研究方法&#xff0c;使用国家…

算法力扣刷题记录五【59.螺旋矩阵II】

前言 第五篇&#xff0c;继续。 力扣【59】&#xff1a;螺旋矩阵II &#xff08;Hint: 我认为blog记录得到最终代码的过程&#xff0c;所以有些代码片是逻辑错误&#xff08;会标明“有错”&#xff09;&#xff0c;体现改进&#xff0c;所以阅读时请不要错位&#xff0c;或复…

python FastAPI操作数据库实现注册登录

代码如下 from fastapi import FastAPI, APIRouter, HTTPException, status from pydantic import BaseModel from fastapi.responses import JSONResponse from typing import Optional from fastapi.middleware.cors import CORSMiddleware from utils.time import DateTime…

搭建抖音微短剧系统:源码部署与巨量广告回传全解析

在数字化浪潮中&#xff0c;抖音微短剧已成为内容创作的新宠。想要搭建一个高效的抖音微短剧系统&#xff0c;并实现与巨量广告的有效回传吗&#xff1f;本文将为您详细解析源码部署与广告回传的关键步骤。 一、源码部署&#xff1a;构建短剧系统的基石 源码是软件开发的起点…

ubuntu 挂载新硬盘 记录

Ref 安全自动挂载硬盘&#xff0c; https://berylbot.com/archives/mount-disks-ubuntu 挂载新硬盘, https://berylbot.com/archives/mount-disks-ubuntu 1. 检查新硬盘是否被系统识别 lsblk -f 查看所有硬盘的UUID, 其中 mount point 为空则表示尚未挂载的硬盘。 列出所有可用…

鸿蒙开发设备管理:【@ohos.batteryInfo (电量信息)】

电量信息 该模块主要提供电池状态和充放电状态的查询接口。 说明&#xff1a; 本模块首批接口从API version 6开始支持。后续版本的新增接口&#xff0c;采用上角标单独标记接口的起始版本。 导入模块 import batteryInfo from ohos.batteryInfo;属性 描述电池信息。 系统能…

三元和磷酸铁锂电池有什么区别?

现在的电动车大多都会使用到锂电池&#xff0c;在常见的锂电池分为两种&#xff0c;一种是三元锂电池另外一种是磷酸铁锂电池&#xff0c;面对这两种锂电池时&#xff0c;它们到底有什么不同&#xff1f; 1、材料不同 这两种锂电池的不同之处便是材料不同&#xff0c;磷酸铁锂…

C#和python端通信之使用共享内存

一、前言 本篇主要实验通过使用共享内存实现C#端代码和python端代码之间的通信&#xff0c;主要目的是相较于直接传输较大的数据&#xff08;例如图像数据&#xff09;&#xff0c;该方式更节省时间。 二、代码 C#端&#xff1a; 创建了一个大小为1的共享内存&#xff0c;名为…

搜维尔科技:SenseGlove Nova2国内首款支持手掌心力回馈手套开售

《SenseGlove Nova 2》现正全球发行中! 搜维尔科技独家代理最新上市的 SenseGlove Nova 2 是世上首款&#xff0c;也是目前市面上唯一一款提供手掌力回馈的无缐VR力回馈手套&#xff0c;它结合了三种最先进的反馈技术&#xff0c;包括主动反馈、强力反馈及震动反馈&#xff0c…

【Flink metric(1)】Flink指标系统的系统性知识:获取metric以及注册自己的metric

文章目录 一. Registering metrics&#xff1a;向flink注册新自己的metrics1. 注册metrics2. Metric types:指标类型2.1. Counter2.2. Gauge2.3. Histogram(ing)2.4. Meter 二. Scope:指标作用域1. User Scope2. System Scope ing3. User Variables 三. Reporter ing四. System…

Linux线程互斥锁

目录 &#x1f6a9;看现象&#xff0c;说原因 &#x1f6a9;解决方案 &#x1f6a9;互斥锁 &#x1f680;关于互斥锁的理解 &#x1f680;关于原子性的理解 &#x1f680;如何理解加锁和解锁是原子的 &#x1f6a9;对互斥锁的简单封装 引言 大家有任何疑问&#xff0c;可…

昇思25天学习打卡营第4天|onereal

今天学习的内容是&#xff1a;ResNet50迁移学习 以下内容拷贝至教程&#xff0c;实话实话看不懂&#xff0c;迷迷糊糊都运行jupyter里的代码。走完程序&#xff0c;训练生成了一些图片。 ResNet50迁移学习 在实际应用场景中&#xff0c;由于训练数据集不足&#xff0c;所以很少…

python OpenCV 库中的 cv2.Canny() 函数来对图像进行边缘检测,并显示检测到的边缘特征

import cv2# 加载图像 image cv2.imread(4.png)# 使用 Canny 边缘检测算法提取边缘特征 edges cv2.Canny(image, 100, 200)# 显示边缘特征 cv2.imshow(Edges, edges) cv2.waitKey(0) cv2.destroyAllWindows() 代码解析&#xff1a; 导入 OpenCV 库&#xff1a; import cv2加…

【十】【QT开发应用】QT中文乱码解决方案

QT中文乱码解决方案 粘贴代码导致的乱码 粘贴别人的代码时,在记事本里面"过一遍",然后再粘贴到QTCreator 使用u8 配置QT 不使用QT使用VS QT自选编码格式 结尾 最后&#xff0c;感谢您阅读我的文章&#xff0c;希望这些内容能够对您有所启发和帮助。如果您有任何问…

新能源汽车CAN总线故障定位与干扰排除的几个方法

CAN总线是目前最受欢迎的现场总线之一,在新能源车中有广泛应用。新能源车的CAN总线故障和隐患将影响驾驶体验甚至行车安全,如何进行CAN总线故障定位及干扰排除呢? 目前,国内机动车保有量已经突破三亿大关。由于大量的燃油车带来严峻的环境问题,因此全面禁售燃油车的日程在…

C语言笔记26 •顺序表应用•

基于动态顺序表实现通讯录项目 1.通讯录其实也就是顺序表&#xff0c;就是把里面存的数据类型变了一下 &#xff0c;所以有一些方法对于顺序表适用&#xff0c;对于通讯录也是适用的&#xff08;初始化&#xff0c;销毁&#xff0c;内存空间扩容&#xff09;。 2.要用到顺序表…

Ngnix内存池——高并发实现高效内存管理

目录 一、高并发下传统方式的弊端 1、常用的内存操作函数 2、弊端一 3、弊端二 4、弊端三 5、弊端四 二、弊端解决之道 1、内存管理维度分析 2、内存管理组件选型 三、高并发内存管理最佳实践 1、内存池技术 2、内存池如何解决弊端 3、高并发内存池如何实现 四、…

springboot+vue+mysql+mybatis 二手交易平台

springbootvuemysqlmybatis 二手交易平台 相关技术 javaspringbootmybatismysqlvueelementui