feat: 拆包列表增加强制录制(returnUnpack.forceRecord)

This commit is contained in:
liufumingren 2026-08-25 01:35:35 +08:00
parent 5eecfda9fa
commit b57d08af5c
3 changed files with 115 additions and 2 deletions

View File

@ -570,6 +570,53 @@ export function returnUnpackDelete(data: ReturnUnpackDeleteParams): Promise<any>
} as any)
}
// ============ returnUnpack.forceRecord ============
/** returnUnpack.forceRecord 请求参数 */
export type ReturnUnpackForceRecordParams = {
/** 拆包单ID(必填) */
id: number
}
/** returnUnpack.forceRecord 响应 */
export type ReturnUnpackForceRecordResponse = {
/** 拆包单ID */
unpack_id: number
/** 录制电脑ID(wms_print_computer.id,is_recording=true) */
computer_id: number
/** 打印服务强制录制接口地址(POST {printService.url}/record/force) */
print_service_url: string
/** 推送给打印服务的请求体({ unpack_id }) */
print_service_request: { unpack_id: number }
/** 打印服务响应(status/headers/data) */
print_service_response?: {
status: number
headers: Record<string, unknown>
data: unknown
} | null
/** 打印服务通知异常信息(推送失败时返回) */
print_service_error?: string | null
}
/**
* returnUnpack.forceRecord:强制重新录制拆包视频。
* 校验仓库录制电脑在线后,将视频记录(wms_return_unpack_video)重置为 created 并清空 video_url,
* 再向打印服务 /record/force 推送 { unpack_id } 触发重新录制(仓库隔离,仅本仓库拆包单)。
*/
export function returnUnpackForceRecord(data: ReturnUnpackForceRecordParams): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'returnUnpack.forceRecord',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}
// ============ 模块导出 ============
export const returnUnpackModule = {
@ -582,5 +629,6 @@ export const returnUnpackModule = {
list: returnUnpackList,
detailList: returnUnpackDetailList,
detail: returnUnpackDetail,
delete: returnUnpackDelete
delete: returnUnpackDelete,
forceRecord: returnUnpackForceRecord
}

View File

@ -88,6 +88,19 @@
<span v-else>-</span>
</template>
<template #column-operation="{ row }">
<div class="unpack-operation-actions">
<el-button
type="warning"
size="small"
link
@click.stop="openForceRecordDialog(row)"
>
强制录制
</el-button>
</div>
</template>
<template #empty>
<div class="empty-tip">暂无退回拆包单数据</div>
</template>
@ -268,12 +281,13 @@
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
returnUnpackList,
returnUnpackDetail,
returnUnpackDetailList,
returnUnpackVideoList,
returnUnpackForceRecord,
} from '@/api/returnunpack'
import { loadStores } from '@/api/index/index'
import { extractStoreListFromResponse, fillStoreScanFieldOptions } from '@/views/order/orderManagement/config/order-common-config'
@ -344,6 +358,7 @@ function cameraIdsLabel(ids: any): string {
function videoStatusLabel(val: any): string {
const map: Record<string, string> = {
created: '待录制',
recording: '录制中',
completed: '录制完成',
failed: '录制失败',
@ -353,6 +368,7 @@ function videoStatusLabel(val: any): string {
function videoStatusTagType(val: any): 'success' | 'warning' | 'info' | 'danger' {
const map: Record<string, 'success' | 'warning' | 'info' | 'danger'> = {
created: 'info',
recording: 'warning',
completed: 'success',
failed: 'danger',
@ -753,6 +769,54 @@ function handlePlayVideo(video: VideoItem) {
playerVisible.value = true
}
// ==================== 强制录制 ====================
const forceRecordLoading = ref(false)
const forceRecordOperatingRow = ref<any>(null)
async function openForceRecordDialog(row: any) {
forceRecordOperatingRow.value = row
try {
await ElMessageBox.confirm(
`确定要强制重新录制拆包单 #${row.id}${row.unpack_no ? `(${row.unpack_no})` : ''} 的视频吗?将清空现有视频并推送到录制电脑重新录制。`,
'强制录制确认',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
await doForceRecord()
} catch {
// 用户取消
}
}
async function doForceRecord() {
const row = forceRecordOperatingRow.value
if (!row?.id) return
forceRecordLoading.value = true
try {
const res: any = await returnUnpackForceRecord({ id: Number(row.id) })
if (isOk(res)) {
const data = res.data ?? res
ElMessage.success(`录制请求已提交,录制电脑ID:${data?.computer_id ?? '—'}`)
// 当前详情选中的是该单时刷新详情,否则刷新列表
if (selectedRecord.value?.id === row.id) {
handleViewDetail(selectedRecord.value)
} else {
fetchData()
}
} else {
ElMessage.error(res?.message || '强制录制请求失败')
}
} catch {
// 请求层已提示错误
} finally {
forceRecordLoading.value = false
}
}
// ==================== 货主选项加载 ====================
async function loadStoreOptions() {

View File

@ -76,6 +76,7 @@ export const returnUnpackColumns = [
{ prop: 'has_video', label: '视频', width: '90' },
{ prop: 'video_enable', label: '视频可用', width: '100' },
{ prop: 'videos', label: '视频状态', minWidth: '150' },
{ prop: 'operation', label: '操作', width: '110', fixed: 'right' },
{ prop: 'created_at', label: '创建时间', width: '170', sortable: 'custom' },
]