refactor(rpa): 重构货代RPA上传成功判定与按需库存trigger构造
This commit is contained in:
1 parent
420f1a4abb
commit
fee28bd1e9
8 files changed
+1019
-348
No files matched your search
@@ -1393,6 +1393,46 @@ cd C:\HxopsRpaTest
|
||||
.\scripts\rpa\inventory\register_inventory_worker_tasks.ps1 -Scope test -Unregister # 只注销 test
|
||||
```
|
||||
|
||||
#### PowerShell 执行策略阻止脚本时
|
||||
|
||||
如果直接执行 `.ps1` 时出现“在此系统上禁止运行脚本”(`PSSecurityException` / `UnauthorizedAccess`),优先使用一次性的 `ExecutionPolicy Bypass`,不要修改计算机或用户的全局执行策略:
|
||||
|
||||
```powershell
|
||||
cd C:\HxopsRpaTest
|
||||
|
||||
# 注册 TEST 计划任务
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File `
|
||||
"C:\HxopsRpaTest\scripts\rpa\inventory\register_inventory_worker_tasks.ps1" `
|
||||
-Scope test `
|
||||
-TestApiBase "http://192.168.100.192:8890" `
|
||||
-TestRoot "C:\HxopsRpaTest" `
|
||||
-SecretFile "C:\HxopsRpaSecrets"
|
||||
|
||||
# 启动或查看 TEST 任务
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File `
|
||||
"C:\HxopsRpaTest\scripts\rpa\inventory\register_inventory_worker_tasks.ps1" `
|
||||
-Scope test -Start
|
||||
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File `
|
||||
"C:\HxopsRpaTest\scripts\rpa\inventory\register_inventory_worker_tasks.ps1" `
|
||||
-Scope test -Status
|
||||
```
|
||||
|
||||
如果脚本是从浏览器、邮件或压缩包复制而来,可能带有 Internet 下载标记;确认路径无误后可解除该文件的阻止状态,再按普通方式执行:
|
||||
|
||||
```powershell
|
||||
Unblock-File -LiteralPath `
|
||||
"C:\HxopsRpaTest\scripts\rpa\inventory\register_inventory_worker_tasks.ps1"
|
||||
```
|
||||
|
||||
可用以下命令查看当前执行策略:
|
||||
|
||||
```powershell
|
||||
Get-ExecutionPolicy -List
|
||||
```
|
||||
|
||||
不建议直接设置 `Unrestricted`。如果 `MachinePolicy` 或 `UserPolicy` 已由公司组策略设置,`Bypass` 仍可能被拦截,此时需要管理员调整组策略或按公司运维流程批准执行该脚本。
|
||||
|
||||
- **`-Scope test|prod|all`**:`Start/Stop/Status/Unregister`(以及默认注册)都可只作用于单个环境;不带 `-Scope` 时默认操作 test 和 prod 两个任务。两个任务是独立命名的(`HXOPS Inventory RPA Worker TEST` / `...PROD`),也可用原生 `Get-ScheduledTask -TaskName <任务名>` 单独查询。
|
||||
|
||||
- 与 2.3 可见模式仅两处差异:计划任务给 `powershell.exe` 加 `-WindowStyle Hidden`(无控制台),并给 `start_rpa_worker.ps1` 加 `-Headless`(Playwright headless,无可见 Edge)。其余 `AtLogOn`、`Interactive`、`RestartCount/RestartInterval`、`ExecutionTimeLimit=0`、`MultipleInstances=IgnoreNew` 均与 2.3 一致。
|
||||
|
||||
Reference in new issue
Block a user