Files
PackagingMallShipper/setup.iss
Administrator 399ba617c4 fix: 优化 Windows 7 兼容性,调整 Excel 导出模板
- setup.iss: 改用 classic 向导样式,降低 MinVersion 要求
- setup.iss: 添加 x86/x64 架构支持声明
- Excel 导出: 移除"订单金额"列,新增"数量"列
- Order 模型: 添加 TotalQuantity 属性计算商品总数量

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 15:41:51 +08:00

152 lines
5.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
; Inno Setup Script for 包装商城发货助手
; Requires Inno Setup 6.x
#define MyAppName "包装商城发货助手"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "PackagingMall"
#define MyAppExeName "PackagingMallShipper.exe"
[Setup]
; 应用程序信息
AppId={{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
; 输出设置
OutputDir=installer
OutputBaseFilename=PackagingMallShipper_Setup_v{#MyAppVersion}
; 压缩设置
Compression=lzma2/ultra64
SolidCompression=yes
; 权限设置
PrivilegesRequired=admin
; 系统要求 - Windows 7 或更高版本
; 注意:.NET Framework 4.6.2 需要 Windows 7 SP1但安装程序本身可以在无SP1的Win7上运行并提示
MinVersion=6.1
; 架构支持 - 同时支持32位和64位系统
ArchitecturesAllowed=x86compatible x64compatible
; 安装向导设置 - 使用classic样式以获得最佳Windows 7兼容性
WizardStyle=classic
DisableProgramGroupPage=yes
; 卸载设置
UninstallDisplayName={#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
[Languages]
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
[Tasks]
Name: "desktopicon"; Description: "创建桌面快捷方式"; GroupDescription: "附加选项:"; Flags: checkedonce
[Files]
; 主程序
Source: "publish\PackagingMallShipper.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "publish\PackagingMallShipper.exe.config"; DestDir: "{app}"; Flags: ignoreversion
; SQLite 本地库
Source: "publish\x64\SQLite.Interop.dll"; DestDir: "{app}\x64"; Flags: ignoreversion
Source: "publish\x86\SQLite.Interop.dll"; DestDir: "{app}\x86"; Flags: ignoreversion
; .NET Framework 4.6.2 离线安装包(可选,取消注释以包含)
; Source: "redist\NDP462-KB3151800-x86-x64-AllOS-ENU.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall; Check: not IsDotNetInstalled
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\卸载 {#MyAppName}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
; 安装完成后运行程序
Filename: "{app}\{#MyAppExeName}"; Description: "运行 {#MyAppName}"; Flags: nowait postinstall skipifsilent
[Code]
// 检查 .NET Framework 4.6.2 是否已安装
function IsDotNetInstalled: Boolean;
var
Release: Cardinal;
begin
Result := False;
// .NET Framework 4.6.2 的 Release 值为 394802 或更高
if RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', Release) then
begin
Result := (Release >= 394802);
end;
end;
// 获取 .NET Framework 版本描述
function GetDotNetVersionStr: String;
var
Release: Cardinal;
begin
Result := '未安装';
if RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', Release) then
begin
if Release >= 533320 then
Result := '4.8.1 或更高'
else if Release >= 528040 then
Result := '4.8'
else if Release >= 461808 then
Result := '4.7.2'
else if Release >= 461308 then
Result := '4.7.1'
else if Release >= 460798 then
Result := '4.7'
else if Release >= 394802 then
Result := '4.6.2'
else if Release >= 394254 then
Result := '4.6.1'
else if Release >= 393295 then
Result := '4.6'
else
Result := '4.5.x 或更低';
end;
end;
// 初始化安装向导
function InitializeSetup: Boolean;
var
ErrorCode: Integer;
NetVersion: String;
begin
Result := True;
// 检查 .NET Framework
if not IsDotNetInstalled then
begin
NetVersion := GetDotNetVersionStr;
if MsgBox('此程序需要 .NET Framework 4.6.2 才能运行。' + #13#10 + #13#10 +
'当前检测到的版本: ' + NetVersion + #13#10 + #13#10 +
'是否要打开微软官网下载 .NET Framework 4.6.2' + #13#10 +
'(下载完成后请先安装运行时,再重新运行此安装程序)',
mbConfirmation, MB_YESNO) = IDYES then
begin
// 打开 .NET Framework 4.6.2 下载页面
ShellExec('open', 'https://dotnet.microsoft.com/download/dotnet-framework/net462', '', '', SW_SHOW, ewNoWait, ErrorCode);
end;
Result := MsgBox('是否仍要继续安装?' + #13#10 + #13#10 +
'注意:如果没有安装 .NET Framework 4.6.2,程序将无法运行。',
mbConfirmation, MB_YESNO) = IDYES;
end;
end;
// 卸载时清理数据目录(可选)
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
DataDir: String;
begin
if CurUninstallStep = usPostUninstall then
begin
DataDir := ExpandConstant('{localappdata}\PackagingMallShipper');
if DirExists(DataDir) then
begin
if MsgBox('是否删除程序数据(包括本地缓存的订单数据)?', mbConfirmation, MB_YESNO) = IDYES then
begin
DelTree(DataDir, True, True, True);
end;
end;
end;
end;