diff --git a/src/views/modules/production-issue/directIssue.vue b/src/views/modules/production-issue/directIssue.vue index 67372c9..b113069 100644 --- a/src/views/modules/production-issue/directIssue.vue +++ b/src/views/modules/production-issue/directIssue.vue @@ -86,7 +86,7 @@
需求数量
{{ material.qtyRequired }}
-
+
已发数量
{{ material.qtyIssued || 0 }}
@@ -533,6 +533,13 @@ export default { margin-left: -12px; } +/* 已发数量高亮样式 */ +.detail-item.issued-qty-highlight .detail-label, +.detail-item.issued-qty-highlight .detail-value { + font-weight: bold; + color: #ff0000; +} + /* 扫描区域 */ .scan-section { margin-top: 16px; diff --git a/src/views/modules/production-issue/directIssueDetail.vue b/src/views/modules/production-issue/directIssueDetail.vue index b6fa7f9..2ce2e33 100644 --- a/src/views/modules/production-issue/directIssueDetail.vue +++ b/src/views/modules/production-issue/directIssueDetail.vue @@ -70,16 +70,18 @@
数量
-
-
{{ index+1 }}
-
{{ label.labelCode }}
-
{{label.warehouseId}}
-
{{ label.batchNo || '-' }}
-
{{ label.quantity }}
-
+
+
+
{{ index+1 }}
+
{{ label.labelCode }}
+
{{label.warehouseId}}
+
{{ label.batchNo || '-' }}
+
{{ label.quantity }}
+
-
-

暂无扫描标签

+
+

暂无扫描标签

+
@@ -516,6 +518,9 @@ export default { margin: 0 16px 12px; border-radius: 8px; overflow: hidden; + display: flex; + flex-direction: column; + max-height: calc(100vh - 320px); } .list-header { display: flex; @@ -525,6 +530,12 @@ export default { font-size: 12px; color: #666; font-weight: 500; + flex-shrink: 0; +} +.list-body { + overflow-y: auto; + flex: 1; + min-height: 0; } .list-item { display: flex; diff --git a/src/views/modules/production-issue/productionPicking.vue b/src/views/modules/production-issue/productionPicking.vue index 213f69d..01ecc4d 100644 --- a/src/views/modules/production-issue/productionPicking.vue +++ b/src/views/modules/production-issue/productionPicking.vue @@ -87,9 +87,9 @@
申请物料行号
{{ material.bomItemNo }}
-
-
单位
-
{{ material.uom || "个" }}
+
+
已发数量
+
{{ material.qtyIssuedHis || 0 }}
@@ -239,10 +239,106 @@ export default { }); }, + // 保存页面状态到sessionStorage(仅用于从详情页返回时恢复) + savePageStateForDetail() { + const state = { + searchCode: this.searchCode, + currentNotifyNo: this.currentNotifyNo, + outboundList: this.outboundList, + // 保存选中工单的唯一标识:notifyNo + itemNo + soorderNo + selectedWorkOrderKey: this.selectedWorkOrder ? { + notifyNo: this.selectedWorkOrder.notifyNo, + itemNo: this.selectedWorkOrder.itemNo, + soorderNo: this.selectedWorkOrder.soorderNo || this.selectedWorkOrder.orderNo + } : null, + materialList: this.materialList, + showOnlySelected: this.showOnlySelected, + }; + sessionStorage.setItem('productionPicking_state_fromDetail', JSON.stringify(state)); + }, + + // 从sessionStorage恢复页面状态(仅当从详情页返回时) + restorePageStateFromDetail() { + try { + const shouldRestore = sessionStorage.getItem('productionPicking_shouldRestore'); + const savedState = sessionStorage.getItem('productionPicking_state_fromDetail'); + + if (shouldRestore === 'true' && savedState) { + const state = JSON.parse(savedState); + this.searchCode = state.searchCode || ''; + this.currentNotifyNo = state.currentNotifyNo || ''; + this.outboundList = state.outboundList || []; + this.materialList = state.materialList || []; + this.showOnlySelected = state.showOnlySelected || false; + + // 恢复选中状态:从outboundList中找到对应的工单对象 + // 使用 notifyNo + itemNo + soorderNo 来精确匹配 + if (state.selectedWorkOrderKey && this.outboundList.length > 0) { + const key = state.selectedWorkOrderKey; + // 兼容旧数据格式(只有工单号的字符串) + if (typeof key === 'string') { + const matchedWorkOrder = this.outboundList.find(wo => + (wo.orderNo || wo.soorderNo) === key + ); + this.selectedWorkOrder = matchedWorkOrder || null; + } else { + // 新格式:使用对象包含 notifyNo、itemNo、soorderNo + const matchedWorkOrder = this.outboundList.find(wo => + wo.notifyNo === key.notifyNo && + wo.itemNo === key.itemNo && + (wo.soorderNo || wo.orderNo) === key.soorderNo + ); + if (matchedWorkOrder) { + this.selectedWorkOrder = matchedWorkOrder; + } else { + this.selectedWorkOrder = null; + } + } + } else { + this.selectedWorkOrder = null; + } + + // 更新已发数量:如果有本次扫描的数量,更新对应物料的已发数量 + const issueInfoStr = sessionStorage.getItem('productionPicking_issueInfo'); + if (issueInfoStr) { + try { + const issueInfo = JSON.parse(issueInfoStr); + // 在materialList中找到对应的物料并更新已发数量 + const material = this.materialList.find(m => + m.partNo === issueInfo.componentPartNo && + m.bomItemNo === issueInfo.lineItemNo + ); + if (material) { + // 更新已发数量 = 原已发数量 + 本次扫描数量 + material.qtyIssuedHis = (material.qtyIssuedHis || 0) + (issueInfo.issueQty || 0); + } + // 清除本次扫描信息 + sessionStorage.removeItem('productionPicking_issueInfo'); + } catch (error) { + console.error('解析本次扫描信息失败:', error); + sessionStorage.removeItem('productionPicking_issueInfo'); + } + } + + // 清除标记 + sessionStorage.removeItem('productionPicking_shouldRestore'); + sessionStorage.removeItem('productionPicking_state_fromDetail'); + } + } catch (error) { + console.error('恢复页面状态失败:', error); + // 清除可能损坏的数据 + sessionStorage.removeItem('productionPicking_shouldRestore'); + sessionStorage.removeItem('productionPicking_state_fromDetail'); + } + }, + // 跳转到领料页面 goToPickingPage(item) { console.log("选中物料:", item, this.selectedWorkOrder); + // 跳转前保存当前页面状态(用于从详情页返回时恢复) + this.savePageStateForDetail(); + this.$router.push({ name: 'productionPickingDetail', query: { @@ -251,6 +347,7 @@ export default { orderNo: this.selectedWorkOrder.soorderNo, componentPartNo: item.partNo, qtyToIssue: item.requestQty, + itemNo: this.selectedWorkOrder.itemNo, lineItemNo: item.bomItemNo, releaseNo: this.selectedWorkOrder.releaseNo, sequenceNo: this.selectedWorkOrder.sequenceNo, @@ -261,6 +358,10 @@ export default { }, mounted() { + // 检查是否从详情页返回,如果是则恢复状态 + const hasRestored = sessionStorage.getItem('productionPicking_shouldRestore') === 'true'; + this.restorePageStateFromDetail(); + // 聚焦搜索框 this.$nextTick(() => { if (this.$refs.searchInput) { @@ -268,8 +369,10 @@ export default { } }); - // 加载数据 - this.loadOutboundList(); + // 如果没有恢复状态,才加载数据(恢复状态时已经包含了数据) + if (!hasRestored) { + this.loadOutboundList(); + } } }; @@ -446,6 +549,13 @@ export default { color: #333; } +/* 已发数量高亮样式 */ +.detail-item.issued-qty-highlight .detail-label, +.detail-item.issued-qty-highlight .detail-value { + font-weight: bold; + color: #ff0000; +} + /* 空状态 */ .empty-state { display: flex; diff --git a/src/views/modules/production-issue/productionPickingDetail.vue b/src/views/modules/production-issue/productionPickingDetail.vue index 5918567..aceac11 100644 --- a/src/views/modules/production-issue/productionPickingDetail.vue +++ b/src/views/modules/production-issue/productionPickingDetail.vue @@ -2,7 +2,7 @@
-
+
生产领料
@@ -86,20 +86,22 @@
标签数量
-
-
{{ labelList.length - index }}
-
{{ label.labelCode }}
-
{{ label.locationId }}
-
{{ label.quantity }}
-
+
+
+
{{ labelList.length - index }}
+
{{ label.labelCode }}
+
{{ label.locationId }}
+
{{ label.quantity }}
+
- -
-

暂无扫描标签

+ +
+

暂无扫描标签

+
@@ -281,10 +283,9 @@ export default { qty += label.quantity; } if (qty > this.outboundInfo.qtyToIssue) { - this.$message.warning('扫描标签总数量超过需求数量'); - this.$confirm('取消后将清空已扫描的标签,确定取消吗?', '提示', { + this.$confirm('扫描标签总数量超过需求数量确定出库吗?', '提示', { confirmButtonText: '确定', - cancelButtonText: '继续操作', + cancelButtonText: '取消', type: 'warning' }).then(() => { this.confirmProductionPicking(); @@ -297,10 +298,12 @@ export default { confirmProductionPicking(){ const params = { site: localStorage.getItem('site'), + notifyNo:this.outboundInfo.outboundNo, workOrderNo: this.outboundInfo.orderNo, componentPartNo: this.outboundInfo.componentPartNo, operatorName: localStorage.getItem('userName'), - itemNo: this.outboundInfo.lineItemNo, + itemNo: this.outboundInfo.itemNo, + lineItemNo:this.outboundInfo.lineItemNo, releaseNo:this.outboundInfo.releaseNo, sequenceNo:this.outboundInfo.sequenceNo, selectedMaterials: this.labelList.map((l, i) => ({ @@ -317,6 +320,15 @@ export default { confirmProductionPicking(params).then(({ data }) => { if (data && data.code === 0) { this.$message.success('操作成功'); + // 设置标记,表示需要恢复productionPicking页面的状态 + sessionStorage.setItem('productionPicking_shouldRestore', 'true'); + // 保存本次扫描的数量和物料信息,用于更新已发数量 + const issueInfo = { + componentPartNo: this.outboundInfo.componentPartNo, + lineItemNo: this.outboundInfo.lineItemNo, + issueQty: this.totalScannedQty + }; + sessionStorage.setItem('productionPicking_issueInfo', JSON.stringify(issueInfo)); this.$router.back(); } else { this.$message.error(data.msg || '操作失败'); @@ -344,17 +356,28 @@ export default { if (this.labelList.length > 0) { this.$confirm('取消后将清空已扫描的标签,确定取消吗?', '提示', { confirmButtonText: '确定', - cancelButtonText: '继续操作', + cancelButtonText: '取消', type: 'warning' }).then(() => { + // 设置标记,表示需要恢复productionPicking页面的状态 + sessionStorage.setItem('productionPicking_shouldRestore', 'true'); this.$router.back(); }).catch(() => { // 用户选择继续操作 }); } else { + // 设置标记,表示需要恢复productionPicking页面的状态 + sessionStorage.setItem('productionPicking_shouldRestore', 'true'); this.$router.back(); } }, + + // 处理返回操作(头部返回按钮) + handleBack() { + // 设置标记,表示需要恢复productionPicking页面的状态 + sessionStorage.setItem('productionPicking_shouldRestore', 'true'); + this.$router.back(); + }, // 显示物料清单弹窗 showMaterialListDialog() { @@ -425,6 +448,7 @@ export default { this.outboundInfo.orderNo = this.$route.query.notifyInfo.orderNo this.outboundInfo.componentPartNo = this.$route.query.notifyInfo.componentPartNo this.outboundInfo.qtyToIssue = this.$route.query.notifyInfo.qtyToIssue + this.outboundInfo.itemNo = this.$route.query.notifyInfo.itemNo this.outboundInfo.lineItemNo = this.$route.query.notifyInfo.lineItemNo this.outboundInfo.releaseNo = this.$route.query.notifyInfo.releaseNo this.outboundInfo.sequenceNo = this.$route.query.notifyInfo.sequenceNo @@ -709,6 +733,9 @@ export default { margin: 0 16px 12px; border-radius: 0 0 8px 8px; overflow: hidden; + display: flex; + flex-direction: column; + max-height: calc(100vh - 320px); } .list-header { @@ -719,6 +746,13 @@ export default { font-size: 12px; color: #666; font-weight: 500; + flex-shrink: 0; +} + +.list-body { + overflow-y: auto; + flex: 1; + min-height: 0; } .list-item {