Browse Source

退料修改

master
shenzhouyu 1 month ago
parent
commit
dc3fa8607a
  1. 240
      src/views/modules/production-return/productionReturnPDAIssueList.vue
  2. 150
      src/views/modules/production-return/productionReturnPickingDetail.vue

240
src/views/modules/production-return/productionReturnPDAIssueList.vue

@ -92,26 +92,44 @@
</div> -->
</div>
<!-- 退料标签列表 -->
<div class="label-list">
<div class="list-header">
<div class="col-no">NO.</div>
<div class="col-label">物料标签</div>
<!-- <div class="col-batch">批次号</div> -->
<div class="col-part">库位</div>
<div class="col-qty">高度</div>
<div class="col-qty">退料数量</div>
</div>
<div v-for="(label, index) in labelList" :key="label.id" class="list-item">
<div class="col-no">{{ index+1 }}</div>
<div class="col-label">{{ label.labelCode }}</div>
<!-- <div class="col-batch">{{ label.batchNo }}</div> -->
<div class="col-part">{{ label.locationId }}</div>
<div class="col-qty">{{ label.height }}</div>
<div class="col-qty" @click="openEditDialog(label, index)">
<span class="quantity-display">{{ label.quantity }}</span>
<i class="el-icon-edit edit-icon"></i>
<!-- 退料标签列表 - 卡片样式参考 productionReturnPickingDetail.vue -->
<div class="label-card-container">
<div
v-for="(label, index) in labelList"
:key="label.id || index"
class="label-card"
>
<div class="card-edit-icon" @click.stop="openEditDialog(label, index)">
<i class="el-icon-edit"></i>
</div>
<div class="card-content" @click="openEditDialog(label, index)">
<div class="card-row">
<span class="card-label">标签号</span>
<span class="card-value">{{ label.labelCode }}</span>
</div>
<div class="card-row">
<span class="card-label">批次号</span>
<span class="card-value">{{ label.batchNo }}</span>
</div>
<div class="card-row">
<span class="card-label">库位号</span>
<span class="card-value">{{ label.locationId || '-' }}</span>
</div>
<div class="card-row">
<span class="card-label">高度</span>
<span class="card-value">{{ label.height || '-' }}</span>
</div>
<div class="card-row">
<span class="card-label">退料数量</span>
<span class="card-value highlight">{{ label.quantity || 0 }}</span>
<span class="card-label">是否被占用</span>
<span
class="card-value"
:class="{ 'is-occupied': label.isInWh === 'Y' }"
>
{{ label.isInWh === 'Y' ? '是' : '否' }}
</span>
</div>
</div>
</div>
@ -667,15 +685,11 @@ export default {
this.$message.warning('请先扫描退料标签')
return
}
/* if (!this.returnReason) {
this.$message.warning("请选择退料原因");
return;
} */
if (this.totalScannedQty > this.orderInfo.quantity - this.qtyReversed) {
this.$message.warning('扫描数量不能大于总领料数量和已退数量的差!')
return
}
const hasNewPrint = this.labelList.some(item => {
return typeof item !== null && item.newPrint === 'NEW';
});
@ -684,6 +698,32 @@ export default {
return
}
const hasInvalidLabel = this.labelList.some((label) => {
const isInWh = label.isInWh
const quantity = Number(label.quantity)
return isInWh === 'Y' && !isNaN(quantity) && quantity === 0
})
if (hasInvalidLabel) {
this.$message.warning('立库已有标签不能有数量')
return
}
// labelList isInWh 'Y' quantity 0
let labelLists = this.labelList.filter((label) => {
return !(
label.isInWh === 'Y' ||
(Number(label.quantity) === 0 || !label.quantity)
)
})
//
if (labelLists.length === 0) {
this.$message.warning('没有可退料的标签')
return
}
const returnParams = {
site: localStorage.getItem('site'),
workOrderNo: this.orderNo,
@ -697,8 +737,9 @@ export default {
issueQty: this.quantity,
notifyNo:this.notifyNo,
lineItemNo:this.lineItemNo,
umId: this.umId,
// 退
selectedMaterials: this.labelList.map((label) => ({
selectedMaterials: labelLists.map((label) => ({
labelCode: label.labelCode,
issueQty: label.quantity,
batchNo: label.batchNo,
@ -965,6 +1006,18 @@ export default {
this.$message.error('获取订单详情失败')
})
const paramdetail = {
workOrderNo: this.orderNo,
batchNo: this.batchNo,
site: localStorage.getItem('site'),
partNo: this.partNo,
quantity:this.quantity
}
getMaterialLabelByIssueDetail(paramdetail).then(({data}) =>{
if(data.code == 0){
this.labelList = data.labelInfo
}
})
},
addWmsLabel() {
if (!this.printData.materialCode1.trim()) {
@ -1014,6 +1067,7 @@ export default {
this.sequenceNo = this.$route.query.material.sequenceNo
this.wdrNo = this.$route.query.material.wdrNo
this.engChgLevel = this.$route.query.material.engChgLevel
this.umId = this.$route.query.material.umId
if (!this.orderNo) {
this.$message.error('参数错误')
@ -1365,94 +1419,106 @@ export default {
color: #0d8f7f;
}
/* 标签列表 */
.label-list {
background: white;
margin: 0 10px 12px;
border-radius: 0 0 8px 8px;
overflow: hidden;
/* 标签列表 - 卡片容器(参考 productionReturnPickingDetail.vue) */
.label-card-container {
padding: 0 8px 8px;
background: #f5f5f5;
}
.list-header {
display: flex;
background: #f8f9fa;
padding: 12px 8px;
border-bottom: 1px solid #e0e0e0;
font-size: 12px;
color: #666;
font-weight: 500;
position: sticky;
top: 0;
z-index: 1;
/* 标签卡片 - 更紧凑样式 */
.label-card {
background: white;
border-radius: 4px;
margin-bottom: 6px;
padding: 6px 8px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
border: 1px solid #e0e0e0;
cursor: pointer;
transition: all 0.2s ease;
position: relative;
}
.list-item {
display: flex;
padding: 12px 8px;
border-bottom: 1px solid #f0f0f0;
font-size: 12px;
color: #333;
align-items: flex-start;
min-height: 40px;
.label-card:hover {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
border-color: #17b3a3;
}
.list-item:last-child {
border-bottom: none;
.label-card:active {
transform: scale(0.98);
}
.col-no {
/* 编辑图标 - 右上角 */
.card-edit-icon {
position: absolute;
top: 6px;
right: 6px;
width: 20px;
text-align: center;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
background: #f0f0f0;
border-radius: 3px;
cursor: pointer;
transition: all 0.2s ease;
z-index: 10;
}
.col-label {
flex: 1.5;
text-align: center;
word-break: break-all;
white-space: normal;
line-height: 1.2;
.card-edit-icon:hover {
background: #17b3a3;
color: white;
}
.col-part {
flex: 1.5;
text-align: center;
.card-edit-icon i {
font-size: 12px;
color: #17b3a3;
}
.col-batch {
flex: 1.5;
text-align: center;
.card-edit-icon:hover i {
color: white;
}
.col-qty {
width: 80px;
text-align: center;
cursor: pointer;
position: relative;
/* 卡片内容 */
.card-content {
padding-right: 28px;
}
.card-row {
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
font-size: 11px;
line-height: 1.5;
margin-bottom: 3px;
}
.quantity-display {
font-size: 12px;
color: #333;
.card-row:last-child {
margin-bottom: 0;
}
.edit-icon {
font-size: 12px;
color: #17b3a3;
opacity: 0.7;
transition: opacity 0.2s ease;
.card-label {
color: #666;
min-width: 65px;
flex-shrink: 0;
font-size: 11px;
}
.col-qty:hover .edit-icon {
opacity: 1;
.card-value {
color: #333;
flex: 1;
word-break: break-all;
font-size: 11px;
}
.col-qty:hover {
background-color: #f0fffe;
border-radius: 4px;
.card-value.highlight {
color: #17b3a3;
font-weight: bold;
font-size: 12px;
}
.card-value.is-occupied {
color: #ff4949;
font-weight: bold;
font-size: 12px;
}
.empty-labels {

150
src/views/modules/production-return/productionReturnPickingDetail.vue

@ -11,29 +11,17 @@
<!-- 搜索框 -->
<div class="search-container">
<el-input
clearable
class="compact-input"
v-model="scanCode"
placeholder="请扫描物料标签"
prefix-icon="el-icon-search"
@keyup.enter.native="handleScan"
ref="scanInput"
/>
<el-input clearable class="compact-input" v-model="scanCode" placeholder="请扫描物料标签" prefix-icon="el-icon-search"
@keyup.enter.native="handleScan" ref="scanInput" />
<div class="mode-switch">
<el-switch
class="custom-switch"
v-model="isRemoveMode"
active-color="#ff4949"
inactive-color="#13ce66"
>
<el-switch class="custom-switch" v-model="isRemoveMode" active-color="#ff4949" inactive-color="#13ce66">
</el-switch>
<span v-if="isRemoveMode" class="switch-text">{{ "移除" }}</span>
<span v-else class="switch-text2">{{ "添加" }}</span>
</div>
<div class="print-checkbox">
<el-button class="new-label-btn" @click="openNewLabelDialog">新标签</el-button>
<el-checkbox v-model="enablePrint">打印标签</el-checkbox>
</div>
</div>
@ -84,11 +72,7 @@
<!-- 退料标签列表 - 参考发料标签卡片样式 -->
<div class="label-card-container">
<div
v-for="(label, index) in labelList"
:key="label.id || index"
class="label-card"
>
<div v-for="(label, index) in labelList" :key="label.id || index" class="label-card">
<div class="card-edit-icon" @click.stop="openEditDialog(label, index)">
<i class="el-icon-edit"></i>
</div>
@ -160,15 +144,17 @@
<div class="form-group">
<label class="form-label">库位 <span class="required">*</span></label>
<el-input v-model="editForm.locationId" placeholder="请输入库位" class="form-input" clearable/>
<el-input v-model="editForm.locationId" placeholder="请输入库位" class="form-input" clearable />
</div>
<div class="form-group">
<label class="form-label">高度(单位毫米)</label>
<el-input v-model="editForm.height" type="number" :min="0" placeholder="请输入高度(单位毫米)" class="form-input" clearable/>
<el-input v-model="editForm.height" type="number" :min="0" placeholder="请输入高度(单位毫米)" class="form-input"
clearable />
</div>
<div class="form-group">
<label class="form-label">退料数量 <span class="required">*</span></label>
<el-input v-model="editForm.quantity" type="number" :min="0" placeholder="请输入标签数量" class="form-input" clearable/>
<el-input v-model="editForm.quantity" type="number" :min="0" placeholder="请输入标签数量" class="form-input"
clearable />
</div>
</div>
@ -190,45 +176,33 @@
<div class="modal-body">
<div class="form-group">
<label class="form-label">物料编号</label>
<el-input v-model="newLabelForm.partNo" placeholder="请输入物料编码" class="form-input" clearable disabled/>
<el-input v-model="newLabelForm.partNo" placeholder="请输入物料编码" class="form-input" clearable disabled />
</div>
<div class="form-group">
<label class="form-label">物料名称 </label>
<el-input v-model="newLabelForm.partDesc" placeholder="请输入物料名称" class="form-input" clearable disabled/>
<el-input v-model="newLabelForm.partDesc" placeholder="请输入物料名称" class="form-input" clearable disabled />
</div>
<div class="form-group">
<label class="form-label">WDR<span class="required">*</span></label>
<el-input v-model="newLabelForm.wdrNo" placeholder="请输入WDR" class="form-input" disabled/>
<el-input v-model="newLabelForm.wdrNo" placeholder="请输入WDR" class="form-input" disabled />
</div>
<div class="form-group">
<label class="form-label">库位<span class="required">*</span></label>
<el-input v-model="newLabelForm.locationId" placeholder="请输入库位" class="form-input" clearable/>
<el-input v-model="newLabelForm.locationId" placeholder="请输入库位" class="form-input" clearable />
</div>
<div class="form-group">
<label class="form-label">高度(单位毫米)<span class="required">*</span></label>
<el-input-number
v-model="newLabelForm.height"
:min="0"
:controls="false"
placeholder="请输入高度"
class="form-input"
style="width: 100%;"
/>
<el-input-number v-model="newLabelForm.height" :min="0" :controls="false" placeholder="请输入高度"
class="form-input" style="width: 100%;" />
</div>
<div class="form-group">
<label class="form-label">退料数量 <span class="required">*</span></label>
<el-input-number
v-model="newLabelForm.quantity"
:min="0"
:controls="false"
placeholder="请输入数量"
class="form-input"
style="width: 100%;"
/>
<el-input-number v-model="newLabelForm.quantity" :min="0" :controls="false" placeholder="请输入数量"
class="form-input" style="width: 100%;" />
</div>
</div>
@ -301,7 +275,7 @@ import {
scanMaterialLabel,
productionReturnConfirm,
printLabelCommon,
getMaterialLabelByIssueDetail
getMaterialLabelByIssueDetail,
} from '@/api/production/production-return'
import moment from 'moment'
@ -483,12 +457,8 @@ export default {
} catch (error) {
console.warn('恢复生产退料手动页面状态失败', error)
} finally {
sessionStorage.removeItem(
'productionReturnPickingDetail_shouldRestore'
)
sessionStorage.removeItem(
'productionReturnPickingDetail_state_manual'
)
sessionStorage.removeItem('productionReturnPickingDetail_shouldRestore')
sessionStorage.removeItem('productionReturnPickingDetail_state_manual')
}
},
@ -502,7 +472,7 @@ export default {
batchNo: this.batchNo,
componentPartNo: this.componentPartNo,
}
scanMaterialLabel(params)
scanMaterialLabel(params)
.then(({ data }) => {
if (data.code === 0 && data) {
//
@ -583,7 +553,7 @@ export default {
this.newLabelForm = {
partNo: this.componentPartNo,
partDesc: this.componentPartDesc,
wdrNo: this.wdrNo|| '*',
wdrNo: this.wdrNo || '*',
locationId: '',
height: 0,
quantity: 0,
@ -611,7 +581,10 @@ export default {
this.$message.warning('请输入物料wdr')
return
}
if (!this.newLabelForm.locationId || !this.newLabelForm.locationId.trim()) {
if (
!this.newLabelForm.locationId ||
!this.newLabelForm.locationId.trim()
) {
this.$message.warning('请输入库位')
return
}
@ -681,21 +654,36 @@ export default {
this.$message.warning('扫描数量不能大于总领料数量和已退数量的差!')
return
}
const hasNewPrint = this.labelList.some(item => {
return typeof item !== null && item.newPrint === 'NEW';
});
if(hasNewPrint && !this.enablePrint){
const hasNewPrint = this.labelList.some((item) => {
return typeof item !== null && item.newPrint === 'NEW'
})
if (hasNewPrint && !this.enablePrint) {
this.$message.warning('存在新标签,需勾选打印标签选项!')
return
}
// labelList isInWh 'Y' quantity 0
this.labelList = this.labelList.filter((label) => {
return !(label.isInWh === 'Y' && (Number(label.quantity) === 0 || !label.quantity));
});
const hasInvalidLabel = this.labelList.some((label) => {
const isInWh = label.isInWh
const quantity = Number(label.quantity)
return isInWh === 'Y' && !isNaN(quantity) && quantity === 0
})
if (hasInvalidLabel) {
this.$message.warning('立库已有标签不能有数量')
return
}
// labelList isInWh 'Y' quantity 0
let labelLists = this.labelList.filter((label) => {
return !(
label.isInWh === 'Y' ||
(Number(label.quantity) === 0 || !label.quantity)
)
})
//
if (this.labelList.length === 0) {
if (labelLists.length === 0) {
this.$message.warning('没有可退料的标签')
return
}
@ -711,13 +699,13 @@ export default {
itemNo: this.itemNo,
ifsReversedQty: this.qtyReversed,
issueQty: this.quantity,
notifyNo:this.notifyNo,
lineItemNo:this.lineItemNo,
notifyNo: this.notifyNo,
lineItemNo: this.lineItemNo,
releaseNo: this.releaseNo,
sequenceNo: this.sequenceNo,
umId: this.umId,
// 退
selectedMaterials: this.labelList.map((label) => ({
selectedMaterials: labelLists.map((label) => ({
labelCode: label.labelCode,
issueQty: label.quantity,
batchNo: label.batchNo,
@ -730,18 +718,18 @@ export default {
newPrint: label.newPrint || 'OLD',
})),
}
console.log(returnParams);
console.log(returnParams)
this.loading = true
productionReturnConfirm(returnParams)
.then(({ data }) => {
if (data.code === 0 && data) {
this.$message.success('生产退料成功')
const unitIds = data.unitIds || [];
const unitIds = data.unitIds || []
//
if (this.enablePrint && unitIds.length > 0) {
this.printViaServer(unitIds);
this.printViaServer(unitIds)
}
this.$router.back()
this.loading = false
@ -750,7 +738,7 @@ export default {
}
})
.catch(() => {
this.$message.error(data.msg ||'操作失败')
this.$message.error(data.msg || '操作失败')
})
.finally(() => {
this.loading = false
@ -759,8 +747,8 @@ export default {
async printViaServer(unitIds) {
if (!unitIds || unitIds.length === 0) {
console.warn('没有可打印的标签');
return;
console.warn('没有可打印的标签')
return
}
this.$emit('print-start')
@ -770,9 +758,9 @@ export default {
username: localStorage.getItem('userName'),
site: localStorage.getItem('site'),
unitIds: unitIds,
labelType: "BIL标签"
labelType: 'BIL标签',
}
console.log('打印请求:', printRequest);
console.log('打印请求:', printRequest)
const { data } = await printLabelCommon(printRequest)
if (data.code === 200 || data.code === 0) {
@ -786,7 +774,6 @@ export default {
}
},
//
closePrintDialog() {
this.showPrintDialog = false
@ -860,10 +847,10 @@ export default {
batchNo: this.batchNo,
site: localStorage.getItem('site'),
partNo: this.componentPartNo,
quantity:this.quantity
quantity: this.quantity,
}
getMaterialLabelByIssueDetail(paramdetail).then(({data}) =>{
if(data.code == 0){
getMaterialLabelByIssueDetail(paramdetail).then(({ data }) => {
if (data.code == 0) {
this.labelList = data.labelInfo
}
})
@ -921,7 +908,7 @@ export default {
'物料编码:',
this.partNo,
'关联单号:',
this.engChgLevel,
this.engChgLevel
)
if (!this.orderNo) {
@ -1029,12 +1016,11 @@ export default {
}
.manual-btn {
border: 1px solid #1abc4a;
background: #1abc4a;
color: white;
border-radius: 6px;
width:60px;
width: 60px;
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease;

Loading…
Cancel
Save