89 lines
3.3 KiB
Markdown
89 lines
3.3 KiB
Markdown
# 资产管理模块
|
||
|
||
## 原 n2tpm 盘点接口兼容
|
||
|
||
当前服务保留自身 `/apis` 上下文,并提供原盘点协议的以下 POST 接口:
|
||
|
||
- `/apis/n2tpm/webmvc/Inventory/Login`
|
||
- `/apis/n2tpm/webmvc/Inventory/GetInventory`
|
||
- `/apis/n2tpm/webmvc/Inventory/GetInventoryDetail`
|
||
- `/apis/n2tpm/webmvc/Inventory/SaveDeviceInventoryInfo`
|
||
- `/apis/n2tpm/webmvc/Inventory/AccepteOrHandoverDocForInventory`
|
||
- `/apis/n2tpm/webmvc/Inventory/UploadPicture`
|
||
- `/apis/n2tpm/webmvc/Inventory/GetDevice`
|
||
|
||
接口请求字段、响应中的业务字段及 `code/msg/data` 包装与原项目一致。若外部设备必须继续访问
|
||
`/n2tpm/webmvc/Inventory/**`,请在网关将该路径转发到本服务的
|
||
`/apis/n2tpm/webmvc/Inventory/**`,无需修改前端和现有 `/apis` 接口。
|
||
|
||
## 部署
|
||
|
||
1. 执行 `src/main/resources/db/migration/V20260918__asset_management.sql`。
|
||
2. 重启后端并重新登录前端,使动态菜单和角色权限重新加载。
|
||
3. 管理员菜单中会出现“资产管理”,包含“资产台账”“设备台账”“资产盘点”。
|
||
|
||
## 盘点流程
|
||
|
||
盘点状态依次为:草稿(DRAFT)→ 盘点中(IN_PROGRESS)→ 待审核(PENDING_AUDIT)→ 已完成(COMPLETED)→ 已关结(CLOSED)。
|
||
|
||
创建盘点单时会把当前资产/设备台账固化为盘点快照。盘点支持按明细操作,也支持输入或扫描资产、设备编号定位明细。实盘数量和账面数量不一致时会自动判断盘盈或盘亏;部门、地点变化时会判断为异常,也可人工指定结果。
|
||
|
||
## 协同服务接口
|
||
|
||
推荐接口:
|
||
|
||
```http
|
||
POST /apis/assetInventory/collaboration/create
|
||
Content-Type: application/json
|
||
```
|
||
|
||
```json
|
||
{
|
||
"externalRequestId": "外部系统唯一请求号",
|
||
"planName": "月度设备盘点",
|
||
"scopeType": "DEVICE",
|
||
"deadline": "2026-09-30 18:00:00",
|
||
"remark": "由协同服务创建"
|
||
}
|
||
```
|
||
|
||
`externalRequestId` 是租户内幂等键,外部服务重试时会返回原盘点单,不会重复建单。接口沿用系统登录会话和租户隔离机制。
|
||
|
||
为兼容参考工程中的调用路径,同时保留:
|
||
|
||
```http
|
||
POST /apis/tpmDouble/cteatePdTasks
|
||
```
|
||
|
||
该兼容接口固定以全部设备台账创建盘点任务,可选传入 `externalRequestId`、`planName`、`deadline` 和 `remark`。
|
||
|
||
### 外部服务回传单项盘点结果
|
||
|
||
推荐使用:
|
||
|
||
```http
|
||
POST /apis/assetInventory/collaboration/record
|
||
Content-Type: application/json
|
||
```
|
||
|
||
为兼容原设备项目的调用路径,同时支持:
|
||
|
||
```http
|
||
POST /apis/deviceInventory/doDevicePlan
|
||
Content-Type: application/json
|
||
```
|
||
|
||
按盘点单号和设备编码回传示例:
|
||
|
||
```json
|
||
{
|
||
"inventoryNo": "PD20260918131230171",
|
||
"deviceSn": "QC-SPI-01",
|
||
"remark": "外部采集服务确认设备在位"
|
||
}
|
||
```
|
||
|
||
也可以传 `inventoryId` 与 `detailId`,或者使用 `targetCode`、`deviceCode`、`assetCode` 作为对象编码。回传成功后,明细由“未盘点”更新为“已盘点”,主单自动进入“盘点中”并刷新已盘数量。重复回传同一明细按幂等成功处理,不会重复计数。若外部系统能够判断差异,可将 `inventoryStatus` 传为 `NORMAL`、`SURPLUS`、`SHORTAGE` 或 `ABNORMAL`。
|
||
|
||
接口沿用本系统认证与租户隔离,外部服务调用时需携带有效登录令牌或会话。
|