Browse Source

领料申请单优化

master
shenzhouyu 4 months ago
parent
commit
f249029875
  1. 9
      src/views/modules/production-issue/directIssue.vue
  2. 11
      src/views/modules/production-issue/directIssueDetail.vue
  3. 118
      src/views/modules/production-issue/productionPicking.vue
  4. 46
      src/views/modules/production-issue/productionPickingDetail.vue

9
src/views/modules/production-issue/directIssue.vue

@ -86,7 +86,7 @@
<div class="detail-label">需求数量</div>
<div class="detail-value">{{ material.qtyRequired }}</div>
</div>
<div class="detail-item">
<div class="detail-item" :class="{ 'issued-qty-highlight': (material.qtyIssued || 0) > 0 }">
<div class="detail-label">已发数量</div>
<div class="detail-value">{{ material.qtyIssued || 0 }}</div>
</div>
@ -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;

11
src/views/modules/production-issue/directIssueDetail.vue

@ -70,6 +70,7 @@
<div class="col-qty">数量</div>
</div>
<div class="list-body">
<div v-for="(label, index) in scannedLabels" :key="label.id" class="list-item">
<div class="col-no">{{ index+1 }}</div>
<div class="col-label">{{ label.labelCode }}</div>
@ -82,6 +83,7 @@
<p>暂无扫描标签</p>
</div>
</div>
</div>
<!-- 底部操作按钮 -->
<div class="bottom-actions">
@ -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;

118
src/views/modules/production-issue/productionPicking.vue

@ -87,9 +87,9 @@
<div class="detail-label">申请物料行号</div>
<div class="detail-value">{{ material.bomItemNo }}</div>
</div>
<div class="detail-item">
<div class="detail-label">单位</div>
<div class="detail-value">{{ material.uom || "个" }}</div>
<div :class="['detail-item', { 'issued-qty-highlight': (material.qtyIssuedHis || 0) > 0 }]">
<div class="detail-label">已发数量</div>
<div class="detail-value">{{ material.qtyIssuedHis || 0 }}</div>
</div>
</div>
</div>
@ -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 {
// 使 notifyNoitemNosoorderNo
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,9 +369,11 @@ export default {
}
});
//
//
if (!hasRestored) {
this.loadOutboundList();
}
}
};
</script>
@ -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;

46
src/views/modules/production-issue/productionPickingDetail.vue

@ -2,7 +2,7 @@
<div class="pda-container">
<!-- 头部栏 -->
<div class="header-bar">
<div class="header-left" @click="$router.back()">
<div class="header-left" @click="handleBack">
<i class="el-icon-arrow-left"></i>
<span>生产领料</span>
</div>
@ -86,6 +86,7 @@
<div class="col-qty">标签数量</div>
</div>
<div class="list-body">
<div
v-for="(label, index) in labelList"
:key="label.id"
@ -102,6 +103,7 @@
<p>暂无扫描标签</p>
</div>
</div>
</div>
<!-- 底部操作按钮 -->
<div class="bottom-actions">
@ -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,18 +356,29 @@ 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() {
this.showMaterialDialog = true;
@ -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 {

Loading…
Cancel
Save