Browse Source

mr修改

master
shenzhouyu 4 months ago
parent
commit
f726859958
  1. 4
      src/views/modules/mr-issue/mrReturnIssueList.vue
  2. 85
      src/views/modules/outsourcing-issue/outsourcingDirectIssueDetail.vue

4
src/views/modules/mr-issue/mrReturnIssueList.vue

@ -77,8 +77,8 @@ export default {
}
this.loading = true;
const params = {
//orderNo: this.orderNo.trim(),
orderNo: '10520',
orderNo: this.orderNo.trim(),
//orderNo: '10520',
site: this.$store.state.user.site,
partNo: this.partNo,
};

85
src/views/modules/outsourcing-issue/outsourcingDirectIssueDetail.vue

@ -84,14 +84,11 @@
<!-- 底部操作按钮 -->
<div class="bottom-actions">
<button class="action-btn secondary" @click="confirmIssue" :disabled="scannedLabels.length === 0">
<el-button class="action-btn secondary" :loading="loading" @click="confirmIssue" :disabled="scannedLabels.length === 0">
确定
</button>
<button class="action-btn secondary" style="margin-left: 10px;">
打印
</button>
</el-button>
<button class="action-btn secondary" style="margin-left: 10px;" @click="clearScannedLabels">
清空
取消
</button>
</div>
</div>
@ -100,6 +97,10 @@
<script>
import moment from 'moment'
import {
scanOutsourcingMaterialLabel,
confirmOutsourcingDirectIssue,
} from '@/api/outsourcing/outsourcing-issue'
export default {
data() {
@ -112,6 +113,8 @@ export default {
componentPartDesc: '',
requiredQty: 0,
issuedQty: 0,
itemNo: '',
loading: false,
}
},
computed: {
@ -132,10 +135,19 @@ export default {
}
this.scanCode = ''
},
// TODO: API
validateAndAddLabel(labelCode) {
//
const exists = this.scannedLabels.find((item) => item.labelCode === labelCode)
const params = {
scannedLabel: labelCode,
outsourcingNo: this.outsourcingNo,
componentPartNo: this.componentPartNo,
site: this.$store.state.user.site,
}
scanOutsourcingMaterialLabel(params)
.then(({ data }) => {
if (data && data.code === 0) {
const exists = this.scannedLabels.find(
(item) => item.labelCode === labelCode
)
if (exists) {
this.$message.warning('该标签已扫描,请勿重复扫描')
return
@ -143,12 +155,20 @@ export default {
this.scannedLabels.push({
id: Date.now(),
labelCode,
componentPartNo: this.componentPartNo,
quantity: 1,
batchNo: '-',
warehouseId: '-',
componentPartNo: data.labelInfo.partNo,
quantity: data.labelInfo.availableQty,
batchNo: data.labelInfo.batchNo,
warehouseId: data.labelInfo.warehouseId,
locationId: data.labelInfo.locationId,
})
this.$message.success('扫描成功')
} else {
this.$message.error(data.msg || '标签验证失败')
}
})
.catch(() => {
this.$message.error('扫描失败')
})
},
removeLabelByCode(labelCode) {
const index = this.scannedLabels.findIndex((item) => item.labelCode === labelCode)
@ -160,7 +180,7 @@ export default {
}
},
clearScannedLabels() {
if (this.scannedLabels.length === 0) return
if (this.scannedLabels.length > 0) {
this.$confirm('确定清空所有已扫描的标签吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -168,18 +188,50 @@ export default {
})
.then(() => {
this.scannedLabels = []
this.$router.back()
this.$message.success('已清空')
})
.catch(() => {})
} else {
this.$router.back()
}
},
confirmIssue() {
if (this.scannedLabels.length === 0) {
this.$message.warning('请先扫描材料标签')
return
}
// TODO: API
this.$message.success('发料成功(示例)')
const params = {
site: this.$store.state.user.site,
outsourcingNo: this.outsourcingNo,
componentPartNo: this.componentPartNo,
operatorName: localStorage.getItem('userName'),
itemNo: this.itemNo,
selectedMaterials: this.scannedLabels.map((l, i) => ({
labelCode: l.labelCode,
issueQty: l.quantity,
batchNo: l.batchNo,
warehouseId: l.warehouseId,
locationId: l.locationId,
materialCode: l.componentPartNo,
})),
}
this.loading = true
confirmOutsourcingDirectIssue(params)
.then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('委外发料成功')
this.$router.back()
} else {
this.$message.error(data.msg || '委外发料失败')
}
})
.catch(() => {
this.$message.error('委外发料失败')
}).finally(()=>{
this.loading = false
})
},
initFromRoute() {
this.outsourcingNo = this.$route.params.outsourcingNo
@ -187,6 +239,7 @@ export default {
this.componentPartDesc = this.$route.params.partDesc || ''
this.requiredQty = Number(this.$route.params.requiredQty || 0)
this.issuedQty = Number(this.$route.params.issuedQty || 0)
this.itemNo = this.$route.params.itemNo || ''
},
},
mounted() {

Loading…
Cancel
Save