|
|
@ -84,14 +84,11 @@ |
|
|
|
|
|
|
|
|
<!-- 底部操作按钮 --> |
|
|
<!-- 底部操作按钮 --> |
|
|
<div class="bottom-actions"> |
|
|
<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 class="action-btn secondary" style="margin-left: 10px;" @click="clearScannedLabels"> |
|
|
清空 |
|
|
|
|
|
|
|
|
取消 |
|
|
</button> |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
@ -100,6 +97,10 @@ |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import moment from 'moment' |
|
|
import moment from 'moment' |
|
|
|
|
|
import { |
|
|
|
|
|
scanOutsourcingMaterialLabel, |
|
|
|
|
|
confirmOutsourcingDirectIssue, |
|
|
|
|
|
} from '@/api/outsourcing/outsourcing-issue' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
@ -112,6 +113,8 @@ export default { |
|
|
componentPartDesc: '', |
|
|
componentPartDesc: '', |
|
|
requiredQty: 0, |
|
|
requiredQty: 0, |
|
|
issuedQty: 0, |
|
|
issuedQty: 0, |
|
|
|
|
|
itemNo: '', |
|
|
|
|
|
loading: false, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
@ -132,23 +135,40 @@ export default { |
|
|
} |
|
|
} |
|
|
this.scanCode = '' |
|
|
this.scanCode = '' |
|
|
}, |
|
|
}, |
|
|
// TODO: 接入委外标签校验API |
|
|
|
|
|
validateAndAddLabel(labelCode) { |
|
|
validateAndAddLabel(labelCode) { |
|
|
// 先允许录入,后续替换为接口校验 |
|
|
|
|
|
const exists = this.scannedLabels.find((item) => item.labelCode === labelCode) |
|
|
|
|
|
if (exists) { |
|
|
|
|
|
this.$message.warning('该标签已扫描,请勿重复扫描') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.scannedLabels.push({ |
|
|
|
|
|
id: Date.now(), |
|
|
|
|
|
labelCode, |
|
|
|
|
|
|
|
|
const params = { |
|
|
|
|
|
scannedLabel: labelCode, |
|
|
|
|
|
outsourcingNo: this.outsourcingNo, |
|
|
componentPartNo: this.componentPartNo, |
|
|
componentPartNo: this.componentPartNo, |
|
|
quantity: 1, |
|
|
|
|
|
batchNo: '-', |
|
|
|
|
|
warehouseId: '-', |
|
|
|
|
|
}) |
|
|
|
|
|
this.$message.success('扫描成功') |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
} |
|
|
|
|
|
this.scannedLabels.push({ |
|
|
|
|
|
id: Date.now(), |
|
|
|
|
|
labelCode, |
|
|
|
|
|
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) { |
|
|
removeLabelByCode(labelCode) { |
|
|
const index = this.scannedLabels.findIndex((item) => item.labelCode === labelCode) |
|
|
const index = this.scannedLabels.findIndex((item) => item.labelCode === labelCode) |
|
|
@ -160,26 +180,58 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
clearScannedLabels() { |
|
|
clearScannedLabels() { |
|
|
if (this.scannedLabels.length === 0) return |
|
|
|
|
|
this.$confirm('确定清空所有已扫描的标签吗?', '提示', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
}) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
this.scannedLabels = [] |
|
|
|
|
|
this.$message.success('已清空') |
|
|
|
|
|
|
|
|
if (this.scannedLabels.length > 0) { |
|
|
|
|
|
this.$confirm('确定清空所有已扫描的标签吗?', '提示', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
type: 'warning', |
|
|
}) |
|
|
}) |
|
|
.catch(() => {}) |
|
|
|
|
|
|
|
|
.then(() => { |
|
|
|
|
|
this.scannedLabels = [] |
|
|
|
|
|
this.$router.back() |
|
|
|
|
|
this.$message.success('已清空') |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => {}) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$router.back() |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
confirmIssue() { |
|
|
confirmIssue() { |
|
|
if (this.scannedLabels.length === 0) { |
|
|
if (this.scannedLabels.length === 0) { |
|
|
this.$message.warning('请先扫描材料标签') |
|
|
this.$message.warning('请先扫描材料标签') |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
// TODO: 调用委外直接发料确认API |
|
|
|
|
|
this.$message.success('发料成功(示例)') |
|
|
|
|
|
this.$router.back() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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() { |
|
|
initFromRoute() { |
|
|
this.outsourcingNo = this.$route.params.outsourcingNo |
|
|
this.outsourcingNo = this.$route.params.outsourcingNo |
|
|
@ -187,6 +239,7 @@ export default { |
|
|
this.componentPartDesc = this.$route.params.partDesc || '' |
|
|
this.componentPartDesc = this.$route.params.partDesc || '' |
|
|
this.requiredQty = Number(this.$route.params.requiredQty || 0) |
|
|
this.requiredQty = Number(this.$route.params.requiredQty || 0) |
|
|
this.issuedQty = Number(this.$route.params.issuedQty || 0) |
|
|
this.issuedQty = Number(this.$route.params.issuedQty || 0) |
|
|
|
|
|
this.itemNo = this.$route.params.itemNo || '' |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
|