diff --git a/src/components/RelabelPalletWork.vue b/src/components/RelabelPalletWork.vue index 268aa6d..b203ad7 100644 --- a/src/components/RelabelPalletWork.vue +++ b/src/components/RelabelPalletWork.vue @@ -9,13 +9,14 @@ 正在改绑:{{ rebindSelection.mark }},当前托盘:{{ rebindSelection.pallet }} + @@ -45,6 +51,11 @@ export default { data() { return { rebindSelection: null, active: 'source', sourceCode: '', targetCode: '', source: null, target: null, marks: [], busy: false, error: '', message: '', newPallet: null, sourceRows: [], selectedSource: null, quantity: '', selectedDestination: '' } }, mounted() { this.loadSources() }, computed: { + allBindingsComplete() { + const required = (this.task.items || []).filter(item => Number(item.expectedPackages || 0) > 0 && (item.returnCartonId || ['CARTON_LABEL', 'CARTON_AND_SKU', 'RETURN_BULK_SKU_LABEL'].includes(item.operationType))) + const bound = new Set(this.currentBindings.map(binding => binding.mark)) + return required.length > 0 && required.every(item => bound.has(item.cartonMark)) + }, requiredSplitPackages() { return (this.task.items || []).filter(item => ['CARTON_LABEL', 'CARTON_AND_SKU'].includes(item.operationType)).reduce((sum, item) => sum + Number(item.expectedPackages || 0), 0) }, splitPackages() { const bound = new Set(this.currentBindings.map(binding => binding.mark)); return (this.task.items || []).filter(item => ['CARTON_LABEL', 'CARTON_AND_SKU'].includes(item.operationType) && bound.has(item.cartonMark)).reduce((sum, item) => sum + Number(item.expectedPackages || 0), 0) }, currentBindings() { @@ -65,6 +76,13 @@ export default { isReturnBulk() { return this.task.operationType === 'RETURN_BULK_SKU_LABEL' }, operableSourceRows() { return this.sourceRows.filter(row => Number(row.movablePackages) > 0) }, plannedPackages() { return this.eligibleItems.reduce((sum, item) => sum + Number(item.expectedPackages || 0), 0) }, + labelBlockReason() { + const pending = this.sourceItems().filter(item => Number(item.relabelledPackages || 0) < Number(item.expectedPackages || 1)) + if (!pending.length) return '' + const missingSku = pending.some(item => item.operationType === 'CARTON_AND_SKU' && Number(item.skuProcessedPackages || 0) < Number(item.expectedPackages || 1)) + if (missingSku) return '本托盘还有未完成的 SKU 贴标登记。混合换标须完成箱唛和 SKU 两项,请返回 SKU 页签处理后再确认绑定。' + return '本托盘还有未完成的换标明细,请先完成贴标登记,再确认目标托盘绑定。' + }, wholeSource() { return this.isReturnBulk && this.selectedSource && (!this.allowDisassemble || this.plannedPackages === Number(this.selectedSource.stockPackages || 0)) }, readyToBind() { return this.source && this.target && this.selectedSource && this.samePallet(this.source, this.selectedSource) && !this.samePallet(this.source, this.target) && Number.isSafeInteger(Number(this.quantity)) && Number(this.quantity) > 0 && Number(this.quantity) <= this.selectedSource.movablePackages && this.bindingSelectionValid() } }, @@ -157,13 +175,14 @@ export default { await this.resolve('source') if (this.error || !this.source) return const source = this.source; this.source = null - if (await this.confirmBindingChoice(`是否绑定来源托盘 ${source.palletCode}?`)) this.source = source + if (await this.confirmBindingChoice(`是否绑定来源托盘 ${source.palletCode}?`)) { this.source = source; this.activate('target') } }, showBindingMessage(title, content) { uni.showModal({ title, content, showCancel: false, confirmText: '知道了' }) }, async confirmTargetAndBind() { if (this.busy) return if (this.rebindSelection) return this.submitRebind() if (!this.isReturnBulk && this.selectedSource && this.samePallet(this.source, this.selectedSource)) { + if (!this.completedItems().length && this.labelBlockReason) { this.error = this.labelBlockReason; this.showBindingMessage('尚未绑定', this.error); return } this.selectedDestination = this.completedItems()[0]?.destinationFbaWarehouseCode || '' this.marks = [] this.fillBatch() diff --git a/src/pages/relabel/relabel.vue b/src/pages/relabel/relabel.vue index d91e125..b9ed6e6 100644 --- a/src/pages/relabel/relabel.vue +++ b/src/pages/relabel/relabel.vue @@ -24,7 +24,7 @@ - + + 完成照片{{ photoFileIds.length }} / 20 张 @@ -58,7 +59,6 @@