优化
This commit is contained in:
+46
-11
@@ -117,7 +117,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="currentBox.inboundId && pickingCompleted" class="loading-evidence-section">
|
<view v-if="loadingStageReady" class="loading-evidence-section">
|
||||||
<view class="section-heading-row">
|
<view class="section-heading-row">
|
||||||
<view><text class="section-title">装柜证据</text><text class="section-subtitle">空仓、半仓、满仓、锁仓及带锁码照</text></view>
|
<view><text class="section-title">装柜证据</text><text class="section-subtitle">空仓、半仓、满仓、锁仓及带锁码照</text></view>
|
||||||
<text class="sync-state" :class="remoteSyncState.tone">{{ remoteSyncState.label }}</text>
|
<text class="sync-state" :class="remoteSyncState.tone">{{ remoteSyncState.label }}</text>
|
||||||
@@ -147,6 +147,10 @@
|
|||||||
<button class="evidence-retry-btn" :disabled="remoteLoading" @tap="refreshTask">刷新任务</button>
|
<button class="evidence-retry-btn" :disabled="remoteLoading" @tap="refreshTask">刷新任务</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-if="pickingCompleted && !loadingStageReady" class="remote-error-row submit-error-row">
|
||||||
|
<text class="version-hint" role="status">拣货已完成,装柜状态尚未同步,请刷新重试</text>
|
||||||
|
<button class="evidence-retry-btn" :disabled="remoteLoading" @tap="refreshTask">刷新任务</button>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="submit-section">
|
<view class="submit-section">
|
||||||
<view class="submit-info">
|
<view class="submit-info">
|
||||||
@@ -371,7 +375,7 @@
|
|||||||
selectedIncompleteReason: '',
|
selectedIncompleteReason: '',
|
||||||
completionSummary: { picked: 0, partial: 0, skipped: 0, autoSkipped: 0 },
|
completionSummary: { picked: 0, partial: 0, skipped: 0, autoSkipped: 0 },
|
||||||
evidenceSlots: EVIDENCE_SLOTS,
|
evidenceSlots: EVIDENCE_SLOTS,
|
||||||
evidenceFiles: {}, evidenceQueueItems: [], evidenceQueue: null, evidenceContextId: 0, sealNo: '', loadingVersion: null, pickingVersion: null, remotePick: null,
|
evidenceFiles: {}, evidenceQueueItems: [], evidenceQueue: null, evidenceContextId: 0, evidenceIdentity: null, sealNo: '', loadingVersion: null, pickingVersion: null, remotePick: null,
|
||||||
remoteTaskId: null, assignmentVersion: null, submitId: '',
|
remoteTaskId: null, assignmentVersion: null, submitId: '',
|
||||||
taskRequestId: 0,
|
taskRequestId: 0,
|
||||||
remoteError: '', remoteLoading: false, submitting: false,
|
remoteError: '', remoteLoading: false, submitting: false,
|
||||||
@@ -410,6 +414,12 @@
|
|||||||
return Boolean(this.completedBoxes[this.currentBoxIndex])
|
return Boolean(this.completedBoxes[this.currentBoxIndex])
|
||||||
|| isPickingCompleteTask(this.remotePick)
|
|| isPickingCompleteTask(this.remotePick)
|
||||||
},
|
},
|
||||||
|
loadingStageReady() {
|
||||||
|
return this.pickingCompleted
|
||||||
|
&& this.evidenceIdentity
|
||||||
|
&& this.evidenceIdentity.inboundId
|
||||||
|
&& Number.isFinite(Number(this.loadingVersion))
|
||||||
|
},
|
||||||
partialTargetItem() {
|
partialTargetItem() {
|
||||||
return this.currentBox.items.find((item) => item.id === this.partialTargetId) || null
|
return this.currentBox.items.find((item) => item.id === this.partialTargetId) || null
|
||||||
},
|
},
|
||||||
@@ -514,18 +524,36 @@
|
|||||||
})
|
})
|
||||||
} catch (_) { /* console may be unavailable on a device */ }
|
} catch (_) { /* console may be unavailable on a device */ }
|
||||||
},
|
},
|
||||||
isEvidenceContextActive(contextId, inboundId) {
|
captureEvidenceIdentity() {
|
||||||
|
return {
|
||||||
|
taskId: this.remoteTaskId || this.currentBox.taskId || null,
|
||||||
|
inboundId: this.currentBox.inboundId || null,
|
||||||
|
loadingPlanId: this.currentBox.loadingPlanId || null,
|
||||||
|
containerBookingId: this.currentBox.containerBookingId || null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isSameEvidenceIdentity(left, right) {
|
||||||
|
return ['taskId', 'inboundId', 'loadingPlanId', 'containerBookingId'].every((key) => String(left?.[key] ?? '') === String(right?.[key] ?? ''))
|
||||||
|
},
|
||||||
|
isEvidenceContextActive(contextId, identity) {
|
||||||
return contextId === this.evidenceContextId
|
return contextId === this.evidenceContextId
|
||||||
&& String(this.currentBox.inboundId ?? '') === String(inboundId ?? '')
|
&& this.isSameEvidenceIdentity(this.evidenceIdentity, identity)
|
||||||
},
|
},
|
||||||
requireEvidenceStage() {
|
requireEvidenceStage() {
|
||||||
if (this.pickingCompleted) return true
|
if (!this.pickingCompleted) {
|
||||||
this.showToast('请先提交拣货完成', 'warning')
|
this.showToast('请先提交拣货完成', 'warning')
|
||||||
return false
|
return false
|
||||||
|
}
|
||||||
|
if (!this.loadingStageReady) {
|
||||||
|
this.showToast(VERSION_SYNC_MESSAGE, 'warning')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
},
|
},
|
||||||
resetEvidenceState() {
|
resetEvidenceState() {
|
||||||
const contextId = this.evidenceContextId + 1
|
const contextId = this.evidenceContextId + 1
|
||||||
this.evidenceContextId = contextId
|
this.evidenceContextId = contextId
|
||||||
|
this.evidenceIdentity = null
|
||||||
this.evidenceFiles = {}
|
this.evidenceFiles = {}
|
||||||
this.evidenceQueueItems = []
|
this.evidenceQueueItems = []
|
||||||
this.sealNo = ''
|
this.sealNo = ''
|
||||||
@@ -728,12 +756,18 @@
|
|||||||
async syncRemoteTask() {
|
async syncRemoteTask() {
|
||||||
if (!isRemoteReady(this.currentBox.inboundId || this.currentBox.boxNo)) return
|
if (!isRemoteReady(this.currentBox.inboundId || this.currentBox.boxNo)) return
|
||||||
const requestId = ++this.taskRequestId
|
const requestId = ++this.taskRequestId
|
||||||
this.debugSubmit('refresh.start', { requestId, inboundId: this.currentBox.inboundId || null, cabinetNo: this.currentBox.cabinetNo || null })
|
const selector = { taskId: this.remoteTaskId || this.currentBox.taskId, cabinetNo: this.currentBox.cabinetNo, loadingPlanId: this.currentBox.loadingPlanId }
|
||||||
|
this.currentBox.inboundId = null
|
||||||
|
this.currentBox.loadingPlanId = null
|
||||||
|
this.currentBox.containerBookingId = null
|
||||||
|
this.loadingVersion = null
|
||||||
|
this.resetEvidenceState()
|
||||||
|
this.debugSubmit('refresh.start', { requestId, cabinetNo: this.currentBox.cabinetNo || null, selector })
|
||||||
this.remoteLoading = true
|
this.remoteLoading = true
|
||||||
this.remoteError = ''
|
this.remoteError = ''
|
||||||
try {
|
try {
|
||||||
const warehouseId = this.currentBox.warehouseId || session.currentUser?.warehouseId || session.currentUser?.warehouse
|
const warehouseId = this.currentBox.warehouseId || session.currentUser?.warehouseId || session.currentUser?.warehouse
|
||||||
const task = await getContainerPickingTask({ taskId: this.remoteTaskId || this.currentBox.taskId, cabinetNo: this.currentBox.cabinetNo, loadingPlanId: this.currentBox.loadingPlanId }, warehouseId)
|
const task = await getContainerPickingTask(selector, warehouseId)
|
||||||
if (requestId !== this.taskRequestId) return
|
if (requestId !== this.taskRequestId) return
|
||||||
if (!task) throw new Error('未找到当前柜次的拣货任务')
|
if (!task) throw new Error('未找到当前柜次的拣货任务')
|
||||||
const remoteItems = task.items || task.pickItems || task.details || task.lines
|
const remoteItems = task.items || task.pickItems || task.details || task.lines
|
||||||
@@ -758,8 +792,9 @@
|
|||||||
}))
|
}))
|
||||||
const firstItem = this.currentBox.items[0]
|
const firstItem = this.currentBox.items[0]
|
||||||
this.currentBox.orderNo = firstItem.orderNo || firstItem.inboundCode || this.currentBox.orderNo
|
this.currentBox.orderNo = firstItem.orderNo || firstItem.inboundCode || this.currentBox.orderNo
|
||||||
this.currentBox.inboundId = firstItem.inboundId || this.currentBox.inboundId
|
if (!firstItem.inboundId) throw new Error('服务端任务明细缺少 inboundId,无法进入装柜取证')
|
||||||
this.currentBox.tenantId = firstItem.tenantId || this.currentBox.tenantId
|
this.currentBox.inboundId = firstItem.inboundId
|
||||||
|
this.currentBox.tenantId = firstItem.tenantId || null
|
||||||
const serverStates = createItemStates(this.currentBox.items)
|
const serverStates = createItemStates(this.currentBox.items)
|
||||||
const serverPartialQuantities = {}
|
const serverPartialQuantities = {}
|
||||||
this.currentBox.items.forEach((item) => {
|
this.currentBox.items.forEach((item) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user