208 lines
8.9 KiB
Plaintext
208 lines
8.9 KiB
Plaintext
; ============================================================
|
||
; 入库分拣工作站 · 安装包脚本(Inno Setup 6)
|
||
; 编译:iscc installer.iss → dist\入库分拣工作站_安装程序_v1.0.63.exe
|
||
; 说明:源目录为 build_exe.py 产出的 dist\入库分拣工作站(onedir)
|
||
; ============================================================
|
||
|
||
#define AppName "入库分拣工作站"
|
||
#ifndef AppVersion
|
||
#define AppVersion "1.0.64"
|
||
#endif
|
||
#define AppExe "入库分拣工作站.exe"
|
||
#define SrcDir "dist\入库分拣工作站"
|
||
|
||
[Setup]
|
||
AppId={{9C4F1E23-7B2A-4D8E-9A51-3F6C2B8D0E14}
|
||
AppName={#AppName}
|
||
; 程序启动时创建的同名互斥量:安装/卸载能识别「程序正在运行」并提示关闭,
|
||
; 也避免现场开两个窗口抢同一个摄像头
|
||
AppMutex=InboundSortingStation
|
||
AppVersion={#AppVersion}
|
||
AppVerName={#AppName} {#AppVersion}
|
||
AppPublisher=配送中心
|
||
AppPublisherURL=
|
||
AppSupportURL=
|
||
DefaultDirName={sd}\{#AppName}
|
||
DefaultGroupName={#AppName}
|
||
DisableProgramGroupPage=yes
|
||
OutputDir=dist
|
||
OutputBaseFilename={#AppName}_安装程序_v{#AppVersion}
|
||
SetupIconFile=assets\app.ico
|
||
UninstallDisplayIcon={app}\{#AppExe}
|
||
UninstallDisplayName={#AppName}
|
||
Compression=lzma2/max
|
||
SolidCompression=yes
|
||
WizardStyle=modern
|
||
PrivilegesRequired=lowest
|
||
ArchitecturesInstallIn64BitMode=x64compatible
|
||
ArchitecturesAllowed=x64compatible
|
||
MinVersion=10.0
|
||
CloseApplications=yes
|
||
RestartApplications=no
|
||
AllowNoIcons=yes
|
||
ShowLanguageDialog=no
|
||
VersionInfoVersion=1.0.64.0
|
||
VersionInfoDescription={#AppName} 安装程序
|
||
VersionInfoProductName={#AppName}
|
||
|
||
[Languages]
|
||
Name: "en"; MessagesFile: "compiler:Default.isl"
|
||
|
||
[Messages]
|
||
; —— 界面全部汉化(用覆盖消息的方式,不依赖第三方语言包)——
|
||
SetupAppTitle=安装程序
|
||
SetupWindowTitle=安装 - %1
|
||
UninstallAppTitle=卸载
|
||
UninstallAppFullTitle=卸载 %1
|
||
WelcomeLabel1=欢迎安装 [name]
|
||
WelcomeLabel2=安装程序将把 [name] 装到您的电脑上。%n%n本程序用于配送中心的入库验收与拣货称重打标,安装后无需另装 Python 等运行环境。%n%n继续前请关闭正在运行的旧版本。建议先关闭其它程序。
|
||
WizardSelectDir=选择安装位置
|
||
SelectDirDesc=将 [name] 安装到哪里?
|
||
SelectDirLabel3=安装程序会把 [name] 装到下面的文件夹。
|
||
SelectDirBrowseLabel=如果要装到别的文件夹,点“浏览”。直接点“下一步”就装在默认位置。
|
||
DiskSpaceMBLabel=至少需要 [mb] MB 的磁盘空间。
|
||
WizardSelectTasks=选择附加任务
|
||
SelectTasksDesc=还要做哪些事?
|
||
SelectTasksLabel2=请选择安装 [name] 时要一并完成的附加任务,然后点“下一步”。
|
||
WizardReady=准备安装
|
||
ReadyLabel1=现在可以开始安装 [name] 了。
|
||
ReadyLabel2a=点“安装”开始安装,想改设置就点“上一步”。
|
||
ReadyLabel2b=点“安装”开始安装。
|
||
PreparingDesc=安装程序正在准备安装 [name]。
|
||
InstallingLabel=正在安装 [name],请稍候……
|
||
WizardFinished=安装完成
|
||
FinishedHeadingLabel=正在完成 [name] 安装
|
||
FinishedLabelNoIcons=安装完成。点“完成”退出。
|
||
FinishedLabel=[name] 已安装完成。%n%n桌面上有快捷方式,双击即可启动。
|
||
ClickFinish=点“完成”退出安装程序。
|
||
ButtonNext=下一步(&N) >
|
||
ButtonBack=< 上一步(&B)
|
||
ButtonInstall=安装(&I)
|
||
ButtonFinish=完成(&F)
|
||
ButtonCancel=取消
|
||
ButtonBrowse=浏览(&R)...
|
||
ButtonYes=是(&Y)
|
||
ButtonNo=否(&N)
|
||
ButtonOK=确定
|
||
ButtonCancel2=取消
|
||
ExitSetupTitle=退出安装
|
||
ExitSetupMessage=安装还没完成,现在退出将不会安装 [name]。%n%n确定要退出吗?
|
||
ConfirmUninstall=确定要卸载 %1 及其所有组件吗?
|
||
UninstallAppRunningError=%1 正在运行,请先关闭它再卸载。
|
||
StatusUninstalling=正在卸载 %1……
|
||
CannotInstall=安装程序无法把文件写到“%1”,请换一个文件夹或换一个账户再试。
|
||
CreateDirError=无法创建文件夹:%n%n%1
|
||
ErrorChangingAttr=无法修改文件属性:%n%n%1
|
||
ErrorCopying=复制文件失败:%n%n%1%n%n点“重试”再试一次,或点“忽略”跳过这个文件。
|
||
ErrorCreatingDir=无法创建文件夹:%n%n%1
|
||
UninstallNotFound=文件“%1”不存在,无法卸载。
|
||
UninstallOpenError=无法打开文件“%1”,无法卸载。
|
||
UninstalledAll=%1 卸载完成。%n%n现场台账(data 目录里的 records.csv、journal)和配置备份(data\config_卸载前备份.json)已经保留,确认不再需要时可以直接删除整个安装文件夹。
|
||
UninstalledMost=%1 卸载完成,但有少量文件没能删除,可以手动删除安装文件夹。
|
||
|
||
[Tasks]
|
||
Name: "desktopicon"; Description: "创建桌面快捷方式"; GroupDescription: "附加任务:"; Flags: checkedonce
|
||
Name: "autostart"; Description: "开机自动启动(工位机推荐勾选)"; GroupDescription: "附加任务:"; Flags: unchecked
|
||
|
||
[Files]
|
||
; 程序主体(_internal 是运行库,必须整份装)
|
||
Source: "{#SrcDir}\_internal\*"; DestDir: "{app}\_internal"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||
Source: "{#SrcDir}\{#AppExe}"; DestDir: "{app}"; Flags: ignoreversion
|
||
Source: "{#SrcDir}\使用说明.txt"; DestDir: "{app}"; Flags: ignoreversion
|
||
; 卡片兜底图片(data 下其它内容属于现场台账,升级时不覆盖)
|
||
Source: "{#SrcDir}\data\photos\*"; DestDir: "{app}\data\photos"; Flags: ignoreversion recursesubdirs createallsubdirs skipifsourcedoesntexist
|
||
; 现场配置:已存在就不动(保住 COM 口、账号、打印机设置)
|
||
Source: "{#SrcDir}\config.json"; DestDir: "{app}"; Flags: onlyifdoesntexist
|
||
; VC++ 运行库兜底(仅当目标机缺失时才装)
|
||
Source: "build_assets\vc_redist.x64.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall skipifsourcedoesntexist
|
||
|
||
[Dirs]
|
||
Name: "{app}"; Permissions: users-modify
|
||
Name: "{app}\data"; Permissions: users-modify
|
||
Name: "{app}\data\photos"; Permissions: users-modify
|
||
|
||
[Icons]
|
||
Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExe}"; WorkingDir: "{app}"
|
||
Name: "{group}\卸载 {#AppName}"; Filename: "{uninstallexe}"
|
||
Name: "{autodesktop}\{#AppName}"; Filename: "{app}\{#AppExe}"; WorkingDir: "{app}"; Tasks: desktopicon
|
||
Name: "{userstartup}\{#AppName}"; Filename: "{app}\{#AppExe}"; WorkingDir: "{app}"; Tasks: autostart
|
||
|
||
[Run]
|
||
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/install /quiet /norestart"; StatusMsg: "正在安装 VC++ 运行库(仅缺失时需要)……"; Flags: waituntilterminated; Check: ShouldInstallVCRedist
|
||
Filename: "{app}\{#AppExe}"; Description: "立即启动 {#AppName}"; Flags: nowait postinstall skipifsilent
|
||
|
||
[UninstallDelete]
|
||
; 清运行垃圾;台账(records.csv / journal)与配置备份保留,避免误删历史
|
||
Type: files; Name: "{app}\data\*.log"
|
||
Type: files; Name: "{app}\data\camera_auto.json"
|
||
Type: files; Name: "{app}\data\last_label.prn"
|
||
Type: files; Name: "{app}\data\selftest.txt"
|
||
Type: files; Name: "{app}\config.json.bak"
|
||
Type: filesandordirs; Name: "{app}\data\thumb_cache"
|
||
Type: filesandordirs; Name: "{app}\data\snapshots"
|
||
Type: dirifempty; Name: "{app}\data"
|
||
Type: dirifempty; Name: "{app}"
|
||
|
||
[Code]
|
||
function NeedVCRedist: Boolean;
|
||
var
|
||
Installed: Cardinal;
|
||
begin
|
||
Result := True;
|
||
if RegQueryDWordValue(HKLM64,
|
||
'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64',
|
||
'Installed', Installed) and (Installed = 1) then
|
||
Result := False
|
||
else if RegQueryDWordValue(HKLM32,
|
||
'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64',
|
||
'Installed', Installed) and (Installed = 1) then
|
||
Result := False;
|
||
end;
|
||
|
||
function ShouldInstallVCRedist: Boolean;
|
||
begin
|
||
Result := NeedVCRedist and
|
||
FileExists(ExpandConstant('{tmp}\vc_redist.x64.exe'));
|
||
end;
|
||
|
||
// 更新场景:程序还在跑时先提示关闭(exe 和 _internal 被占用会装不进去)
|
||
function InitializeSetup: Boolean;
|
||
var
|
||
R: Integer;
|
||
Cmd: string;
|
||
begin
|
||
Result := True;
|
||
Cmd := ExpandConstant('{cmd}');
|
||
Exec(Cmd, '/C tasklist /FI "IMAGENAME eq 入库分拣工作站.exe" | find /I "入库分拣工作站" >nul',
|
||
'', SW_HIDE, ewWaitUntilTerminated, R);
|
||
if R = 0 then
|
||
begin
|
||
if MsgBox('检测到 入库分拣工作站 正在运行。%n%n更新需要先关闭它(未提交的称重记录不会丢,未完成的一件请先处理完再更新)。%n%n现在关闭并继续安装吗?',
|
||
mbConfirmation, MB_YESNO) = IDYES then
|
||
begin
|
||
Exec(Cmd, '/C taskkill /F /IM "入库分拣工作站.exe"',
|
||
'', SW_HIDE, ewWaitUntilTerminated, R);
|
||
Sleep(800);
|
||
end
|
||
else
|
||
Result := False; // 用户选“否”:中止安装,让人家先处理完手头的活
|
||
end;
|
||
end;
|
||
|
||
// 卸载前把现场配置备份到 data 里(COM 口、账号、打印机设置都是现场一条条试出来的)
|
||
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
||
var
|
||
Src, Dst: String;
|
||
begin
|
||
if CurUninstallStep = usUninstall then
|
||
begin
|
||
Src := ExpandConstant('{app}\config.json');
|
||
Dst := ExpandConstant('{app}\data\config_卸载前备份.json');
|
||
if FileExists(Src) then
|
||
begin
|
||
ForceDirectories(ExpandConstant('{app}\data'));
|
||
CopyFile(Src, Dst, False);
|
||
end;
|
||
end;
|
||
end;
|