仓库管理系统12--物资设置供应商设置

news2024/10/7 10:16:14

1、添加供应商窗体

2、布局控件UI

 

<UserControl x:Class="West.StoreMgr.View.SupplierView"
             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"
             mc:Ignorable="d" 
             DataContext="{Binding Source={StaticResource Locator},Path=Supplier}"
             d:DesignHeight="510" d:DesignWidth="800">
    <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="-4 10 0 10">
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                    <TextBlock Margin="0 0 10 0" Text="供应商名称:" VerticalAlignment="Center"/>
                    <TextBox Margin="0 0 10 0" Text="{Binding Supplier.Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="100" Height="30" />
                    <TextBlock Margin="0 0 10 0" Text="联系人:" VerticalAlignment="Center"/>
                    <TextBox Margin="0 0 10 0" Text="{Binding Supplier.Contact,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="200" Height="30" />
                    <TextBlock Margin="0 0 10 0" Text="电话:" VerticalAlignment="Center"/>
                    <TextBox Margin="0 0 10 0" Text="{Binding Supplier.Telephone,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="200" Height="30" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  Margin="0 10 0 10">
                    <TextBlock Margin="0 0 10 0" Text="电子信箱:" VerticalAlignment="Center"/>
                    <TextBox Margin="0 0 10 0" Text="{Binding Supplier.Email,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="100" Height="30" />
                    <TextBlock Margin="0 0 10 0" Text="地址:" VerticalAlignment="Center"/>
                    <TextBox Margin="0 0 10 0" Text="{Binding Supplier.Address,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="200" Height="30" />
                    <TextBlock Margin="0 0 10 0" Text="备注:" VerticalAlignment="Center"/>
                    <TextBox Margin="0 0 10 0" Text="{Binding Supplier.Tag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="200" Height="30" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="220 10 0 10">
                    <!--button-->
                    <Button Margin="0 0 0 0" Height="36" FontSize="20" Width="199" Grid.Row="3" 
                     Content="增 加" Style="{StaticResource ButtonStyle}" 
                     CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:SupplierView}}"
                     Command="{Binding AddCommand}"/>
                </StackPanel>
            </StackPanel>
        </Grid>

        <!--列表-->
        <Grid Grid.Row="2" Margin="10 -20 10 10">
            <DataGrid ItemsSource="{Binding SupplierList}" CanUserAddRows="False" AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="序号" Binding="{Binding Id}"/>
                    <DataGridTextColumn Header="供应商" Binding="{Binding Name}"/>
                    <DataGridTextColumn Header="联系人" Binding="{Binding Contact}"/>
                    <DataGridTextColumn Header="电话" Binding="{Binding Telephone}"/>
                    <DataGridTextColumn Header="邮箱" Binding="{Binding Email}"/>
                    <DataGridTextColumn Header="地址" Binding="{Binding Address}"/>
                    <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:SupplierView},Path=DataContext.EditCommand}"
                                         CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}}" 
                                         Tag="{Binding}" 
                                         Style="{StaticResource DataGridButtonStyle}" />
                                    <Button Content="删除" 
                                         Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:SupplierView},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 West.StoreMgr.Helper;
using West.StoreMgr.Service;
using CommonServiceLocator;
using West.StoreMgr.Windows;
using static West.StoreMgr.Windows.MsgBoxWindow;

namespace West.StoreMgr.ViewModel
{
    /// <summary>
    /// 供应商viewmodel
    /// </summary>
    public class SupplierViewModel : ViewModelBase
    {
        public SupplierViewModel()
        {
            SupplierList = new SupplierService().Select();
        }

        private Supplier supplier = new Supplier();
        public Supplier Supplier
        {
            get { return supplier; }
            set { supplier = value; RaisePropertyChanged(); }
        }

        private List<Supplier> supplierList = new List<Supplier>();

        public List<Supplier> SupplierList
        {
            get { return supplierList; }
            set { supplierList = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 添加
        /// </summary>
        public RelayCommand AddCommand
        {
            get
            {
                var command = new RelayCommand(() =>
                {
                    if (string.IsNullOrEmpty(Supplier.Name) == true
                    || string.IsNullOrEmpty(Supplier.Contact) == true
                    || string.IsNullOrEmpty(Supplier.Telephone) == true)
                    { 
                        MsgWinHelper.ShowError("不能为空!");
                        return;
                    }

                    Supplier.InsertDate = DateTime.Now;

                    var service = new SupplierService();
                    int count = service.Insert(Supplier);
                    if (count > 0)
                    {
                        SupplierList = service.Select();
                        MsgWinHelper.ShowMessage("添加成功!");
                        Supplier = new Supplier();
                    }
                    else
                    {
                        MsgWinHelper.ShowError("添加失败!");
                    }
                });

                return command;
            }
        }

        /// <summary>
        /// 修改
        /// </summary>
        public RelayCommand<Button> EditCommand
        {
            get
            {
                var command = new RelayCommand<Button>((view) =>
                {
                    var old = view.Tag as Supplier;
                    if (old == null) return;
                    var model = ServiceLocator.Current.GetInstance<EditSupplierViewModel>();
                    model.Supplier = old;
                    var window = new EditSupplierWindow();
                    window.ShowDialog();
                    SupplierList = new SupplierService().Select();
                });

                return command;
            }
        }

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

                        var service = new SupplierService();
                        int count = service.Delete(old);
                        if (count > 0)
                        {
                            SupplierList = service.Select();
                            MsgWinHelper.ShowMessage("删除成功!");
                        }
                        else
                        {
                            MsgWinHelper.ShowError("删除失败!");
                        }
                    }
                });

                return command;
            }
        }
    }
}

4、运行效果

5、修改供应商

1)UI布局

<Window x:Class="West.StoreMgr.Windows.EditSupplierWindow"
        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"
        mc:Ignorable="d"
         ResizeMode="NoResize"
          WindowStartupLocation="CenterScreen"
         DataContext="{Binding Source={StaticResource Locator},Path=EditSupplier}"
         Title="修改供应商" Height="450" Width="800">
    <Grid Background="#E4ECEF">
        <Grid Grid.Column="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.5*"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="0.5*"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Border Grid.Column="0" Height="2" Width="122" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <!--渐变色横条-->
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                            <GradientStop Color="Red" Offset="0"></GradientStop>
                            <GradientStop Color="#6d6d6d"  Offset="1"></GradientStop>
                        </LinearGradientBrush>
                    </Border.Background>
                </Border>
                <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" Text="修改供应商" FontSize="36"/>
                <Border Grid.Column="2"  Height="2" Width="122" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <!--渐变色横条-->
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                            <GradientStop Color="Red" Offset="1"></GradientStop>
                            <GradientStop Color="#6d6d6d"  Offset="0"></GradientStop>
                        </LinearGradientBrush>
                    </Border.Background>
                </Border>
            </Grid>
           

            <TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Text="供应商" FontSize="20"/>
            <TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Text="联系人" FontSize="20"/>
            <TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Text="电话" FontSize="20"/>

            <TextBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Supplier.Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="20" Width="200" Height="30"/>
            <TextBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Supplier.Contact,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="20" Width="200" Height="30"/>
            <TextBox Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Supplier.Telephone,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="20" Width="200" Height="30"/>

            <TextBlock Grid.Row="1" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Text="电子邮箱" FontSize="20"/>
            <TextBlock Grid.Row="2" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Text="地址" FontSize="20"/>
            <TextBlock Grid.Row="3" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Text="备注" FontSize="20"/>

            <TextBox Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Supplier.Email,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="20" Width="200" Height="30"/>
            <TextBox Grid.Row="2" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Supplier.Address,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="20" Width="200" Height="30"/>
            <TextBox Grid.Row="3" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Supplier.Tag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="20" Width="200" Height="30"/>


            <!--button-->
            <StackPanel Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Right" >
                <Button  Height="45" Width="199" Grid.Row="4" FontSize="20"  Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Center" Margin="20 0 20 0"
                     Content="修 改" Style="{StaticResource ButtonStyle}" 
                     CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:EditSupplierWindow}}"
                     Command="{Binding EditCommand}"/>
                <Button  Height="45" Width="199" Grid.Row="4"  FontSize="20"   Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Center" Margin="20 0 65 0"
                     Content="取 消" Style="{StaticResource ButtonStyle}" 
                     CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:EditSupplierWindow}}"
                     Command="{Binding CancelCommand}"/>
            </StackPanel> 
        </Grid> 
    </Grid>
</Window>

 2)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 EditSupplierViewModel : ViewModelBase
    {
        private Supplier supplier = new Supplier();
        public Supplier Supplier
        {
            get { return supplier; }
            set { supplier = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 修改
        /// </summary>
        public RelayCommand<Window> EditCommand
        {
            get
            {
                var command = new RelayCommand<Window>((window) =>
                {
                    if (string.IsNullOrEmpty(Supplier.Name) == true
                    || string.IsNullOrEmpty(Supplier.Contact) == true
                    || string.IsNullOrEmpty(Supplier.Telephone) == true)
                    { 
                        MsgWinHelper.ShowError("不能为空!");
                        return;
                    }

                    var service = new SupplierService();
                    int count = service.Update(Supplier);
                    if (count > 0)
                    {
                        MsgWinHelper.ShowMessage("修改成功!");
                        window.Close();
                    }
                    else
                    { 
                        MsgWinHelper.ShowError("修改失败!");
                    }
                });

                return command;
            }
        }

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

                return command;
            }
        }
    }
}

3)运行效果

 

6、删除供应商

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

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

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

相关文章

业绩尚可但股价不振,浙商银行陆建强闯“3元大关”

&#xff08;题图&#xff09; 文&#xff5c;新熔财经 作者&#xff5c;宏一 本来做着钱生钱的“美梦”&#xff0c;现在倒好&#xff0c;本金都不一定拿得回来。 因为不想把“鸡蛋都放在一个笼子里”&#xff0c;所以前几年在理财的时候一部分放在银行定存&#xff0c;一…

利用 Swifter 加速 Pandas 操作的详细教程

利用 Swifter 加速 Pandas 操作的详细教程 引言 Pandas 是数据分析中常用的库&#xff0c;但在处理大型数据集时效率可能会较低。Swifter 提供了一种简便的方法&#xff0c;通过并行处理来显著加速 Pandas 操作。 Swifter 简介 Swifter 是一个开源库&#xff0c;旨在自动优…

如何使用代理 IP 防止多个 Facebook 帐户关联 - 最佳实践

在社交媒体被广泛应用的今天&#xff0c;Facebook作为全球最大的社交网络平台之一&#xff0c;面临着很多挑战&#xff0c;其中之一就是用户行为的管理和安全。 为了防止多个账户之间的关联和滥用&#xff0c;Facebook需要采取一系列措施&#xff0c;其中包括使用静态住宅代理…

谷歌上搞下来的,无需付费,可以收藏!

在数字化时代&#xff0c;我们越来越依赖于智能设备来获取信息和知识。中国智谋App正是这样一款应用&#xff0c;它将中国古代的智慧与谋略书籍带入了我们的移动设备&#xff0c;让我们能够随时随地学习和领悟。而且提供文言文的原文和译文。 软件下载方式&#xff1a;谷歌上搞…

Firefox 火狐浏览器现在允许您在其 Nightly 版本中选择您喜欢的 AI 聊天机器人

Firefox Nightly版本是Mozilla推出的一个特殊的频道&#xff0c;用户可以在这里试用最新的功能和更改。这个版本每天都会更新&#xff0c;并且持续发布新的功能和修复。例如&#xff0c;在2023年10月8日发布的版本中&#xff0c;引入了一个新的按钮&#xff0c;用于快速重置隐私…

多车自动驾驶编队与协同控制引领智能物流革命

多车自动驾驶编队与协同控制引领智能物流革命 随着科技的不断进步&#xff0c;智能物流正以前所未有的速度和效率改变着我们的生活和工作方式。在这个领域的最前沿&#xff0c;北京渡众机器人科技有限公司的多车自动驾驶编队与协同控制技术正在为物流行业带来革命性的变革。 北…

【Java】Java序列化和反序列化

人不走空 &#x1f308;个人主页&#xff1a;人不走空 &#x1f496;系列专栏&#xff1a;算法专题 ⏰诗词歌赋&#xff1a;斯是陋室&#xff0c;惟吾德馨 # Java中的序列化和反序列化 在Java中&#xff0c;序列化是将对象的状态写入字节流的机制。它主要用于Hibernate…

【教学类-64-05】20240625彩棒鱼骨图(二)AB排列 6.5*1CM 6选2根 30种

背景需求&#xff1a; 【教学类-64-04】20240619彩棒鱼骨图&#xff08;一&#xff09;6.5*1CM 6根棒子720种-CSDN博客文章浏览阅读897次&#xff0c;点赞23次&#xff0c;收藏13次。【教学类-64-04】20240619彩棒鱼骨图&#xff08;一&#xff09;6.5*1CM 6根棒子720种https:…

JAVA每日作业day6.26

ok了家人们&#xff0c;今天我们学习了面向对象-多态&#xff0c;话不多说我们一起来看看吧 一.多态概述 面向对象的第三大特性&#xff1a;封装、继承、多态 我们拿一个生活中的例子来看 生活中&#xff0c;比如跑的动作&#xff0c;小猫、小狗和大象&#xff0c;跑起来是不一…

CAN总线学习之路

闻道有先后&#xff0c;术业有专攻。我们接触新的事物时总会有个学习过程&#xff0c;如今现场总线非常繁多&#xff0c;CAN总线就是其中不可忽视的一种&#xff0c;在此以个人的学习过程与大家共勉&#xff01; 我大学时的专业是电子科学与技术&#xff0c;专业课程是数电、模…

从写下第1个脚本到年薪40W,我的测试开发心路历程!

对于任何职业来说&#xff0c;薪资始终都会是众多追求的重要部分。前几年测试行业还是风口&#xff0c;但是随着不断新鲜血液的加入&#xff0c;再加上就业大环境不好&#xff0c;企业也都在“降本增效”。目前内卷也是越来越激烈。不得不承认当下的现状&#xff0c;已经不仅仅…

视频分享的二维码怎么做?多种视频可用的二维码制作技巧

视频分享的快捷操作技巧可以在二维码生成器上来制作&#xff0c;与传统分享方式相比用二维码的方法能够更快捷&#xff0c;有利于用户能够在不下载视频占用空间的同时&#xff0c;就能够扫描二维码观看视频内容。视频二维码能够应用于很多的场景下&#xff0c;那么制作一个视频…

【Linux】使用ntpdate同步时间

ntpdate 是一个在 Linux 系统中用于同步系统时间的命令行工具&#xff0c;它通过与 NTP 服务器通信来调整本地系统时钟。然而&#xff0c;需要注意的是&#xff0c;ntpdate 已经被许多现代 Linux 发行版弃用。 安装 yum install -y ntpdate 查看时间 date同步时间 ntpdate ntp…

防火墙双机热备

防火墙双机热备 随着移动办公、网上购物、即时通讯、互联网金融、互联网教育等业务蓬勃发展&#xff0c;网络承载的业务越来越多&#xff0c;越来越重要。所以如何保证网络的不间断传输成为网络发展过程中急需解决的一个问题。 防火墙部署在企业网络出口处&#xff0c;内外网之…

想远程控制手机,用哪个软件好?

很多人都想知道安卓系统或iOS系统要如何实现手机远程控制手机、电脑远程控制手机&#xff0c;分别需要用到什么软件&#xff0c;这篇文章一次说清楚。 注意&#xff0c;安卓系统需要是7.0及以上版本&#xff0c;iOS系统需要是11及以上版本。具体使用步骤请点击关注&#xff0c;…

633. 平方数之和(中等)

633. 平方数之和 1. 题目描述2.详细题解3.代码实现3.1 Python3.2 Java内存溢出溢出代码正确代码与截图 1. 题目描述 题目中转&#xff1a;633. 平方数之和 2.详细题解 本题是167. 两数之和 II - 输入有序数组&#xff08;中等&#xff09;题目的变型&#xff0c;由两数之和变…

数字图像分析(第三部分)

文章目录 第11章 基于概率图模型的图像分析概率有向图模型因子分解生成式模型链式图条件独立性有向图模型的马尔科夫毯概率无向图模型模型定义概率无向图模型的因子分解条件随机场条件随机场的定义条件随机场的预测算法第12章 运动分析运动相机建模光流运动表达方法运动估计准则…

二维数组广度优先遍历-腐烂的苹果

一、问题描述 二、解题思路 此问题通过广度优先遍历来解决&#xff0c;模拟苹果发霉变坏的过程 1.初始时遍历网格&#xff0c;借助队列来储存所有发霉的苹果&#xff0c;统计好苹果个数 2.每一分钟队列内发霉苹果都会对周围的苹果起作用&#xff08;向外部扩散&#xff09;&am…

Python 高级编程:文件操作与错误处理

在前几篇文章中&#xff0c;我们介绍了Python的基本语法、函数和模块以及面向对象编程。这些知识对于大部分日常编程问题已经足够&#xff0c;但对于需要分析大数据的人来说&#xff0c;这些还不够。本章将介绍Python的文件操作以及错误处理与调试。 目录 文件操作读文件写文…

鸿蒙开发系统基础能力:【@ohos.systemTime (设置系统时间)】

设置系统时间 本模块用来设置、获取当前系统时间&#xff0c;设置、获取当前系统日期和设置、获取当前系统时区。 说明&#xff1a; 本模块首批接口从API version 7开始支持。后续版本的新增接口&#xff0c;采用上角标单独标记接口的起始版本。 导入模块 import systemTime …