物料管理导入模板下载
This commit is contained in:
@ -33,6 +33,8 @@ namespace 智慧物流软件系统
|
||||
/// 资源目录
|
||||
/// </summary>
|
||||
public static readonly string ResourcesDir = Path.Combine(AppDir, "Resources");
|
||||
|
||||
public static readonly string ExcelDir = Path.Combine(AppDir, "Excel");
|
||||
/// <summary>
|
||||
/// 运行主程序
|
||||
/// </summary>
|
||||
|
@ -26,6 +26,8 @@ using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using System.Collections.ObjectModel;
|
||||
using HandyControl.Tools.Extension;
|
||||
using 智慧物流软件系统.Tool;
|
||||
using Microsoft.Win32;
|
||||
using System.IO;
|
||||
|
||||
namespace 智慧物流软件系统.ViewModel
|
||||
{
|
||||
@ -164,6 +166,48 @@ namespace 智慧物流软件系统.ViewModel
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 下载导入模板
|
||||
/// </summary>
|
||||
public ICommand DownloadImportTemplateCommand { get => new DelegateCommand(DownloadImportTemplate); }
|
||||
public void DownloadImportTemplate()
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Title = "选择保存导入模板路径";//窗口标题
|
||||
|
||||
saveFileDialog.Filter = "Excel 文件 (*.xlsx)|*.xlsx|All files (*.*)|*.*"; // 设置文件过滤器
|
||||
saveFileDialog.ValidateNames = true;
|
||||
saveFileDialog.FileName = "物料管理导入模板.xlsx";// 设置默认文件名
|
||||
|
||||
if (saveFileDialog.ShowDialog() == true)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 文件保存路径
|
||||
var destinationPath = saveFileDialog.FileName;
|
||||
// 文件源路径
|
||||
var sourcePath = Path.Combine(LocalFile.ExcelDir, "物料管理导入模板.xlsx");
|
||||
|
||||
Folder.CopyFile(sourcePath, destinationPath);
|
||||
|
||||
// 更新文件的最后修改时间(通常设置为当前时间)
|
||||
File.SetLastWriteTime(destinationPath, DateTime.Now);
|
||||
|
||||
if (File.Exists(destinationPath) && LocalFile.Config.IsLoadingDownloadPath)
|
||||
{
|
||||
LocalFile.Config.BatchBindImportTemplatePath = destinationPath;
|
||||
LocalFile.SaveConfig();
|
||||
}
|
||||
Growl.Success("下载成功!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Warning($"操作失败:{ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出数据为Excel文件
|
||||
/// </summary>
|
||||
|
@ -105,7 +105,15 @@
|
||||
Command="{Binding BtnDeleteCommand}"
|
||||
Style="{StaticResource ButtonDanger}">
|
||||
</Button>
|
||||
|
||||
<TextBlock VerticalAlignment="Bottom"
|
||||
Margin="25 5 5 5"
|
||||
Foreground="Blue"
|
||||
TextDecorations="Underline"
|
||||
Text="下载导入模板">
|
||||
<TextBlock.InputBindings>
|
||||
<MouseBinding Gesture="LeftClick" Command="{Binding DownloadImportTemplateCommand}" />
|
||||
</TextBlock.InputBindings>
|
||||
</TextBlock>
|
||||
<Button MinHeight="40" FontSize="18" Margin="5"
|
||||
Content="导 入" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnImportCommand}"
|
||||
|
@ -8,8 +8,8 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Company>重庆盟讯电子科技有限公司</Company>
|
||||
<Copyright>Copyright © 2025</Copyright>
|
||||
<AssemblyVersion>1.0.0</AssemblyVersion>
|
||||
<FileVersion>1.0.0</FileVersion>
|
||||
<AssemblyVersion>1.0.1</AssemblyVersion>
|
||||
<FileVersion>1.0.1</FileVersion>
|
||||
<ApplicationIcon>Resources\Logo.ico</ApplicationIcon>
|
||||
<Authors>重庆盟讯电子科技有限公司</Authors>
|
||||
<Product>智慧物流软件系统</Product>
|
||||
|
Reference in New Issue
Block a user