Commit f3a3e462 authored by jingnan's avatar jingnan 👀

ERP相关_退库管理功能开发及配置(台账退库)

parent b85cd758
......@@ -59,6 +59,8 @@ export default {
if (!this.basicData.id) {
if (this.form.subTypeName === 'MatchStockBackRequest' || this.form.subTypeName === 'InternalStockBackRequest') {
this.$set(this.form, 'extProcessPlan', null)
} else if (this.form.subTypeName === 'InventoryStockBackRequest') {
this.$set(this.form, 'assembleCode', null)
} else {
this.$set(this.form, 'aoNo', '')
}
......@@ -115,6 +117,13 @@ export default {
'value': id
})
}
if (this.form.subTypeName === 'InventoryStockBackRequest') {
params.searchItems.items.push({
'fieldName': 'subTypeName',
'operator': 'EQ',
'value': 'ExtProcessPlanAssemblyUnit'
})
}
this.loading = true
this.options = []
this.$api.searchApi(requestUrl, params).then(res => {
......
......@@ -62,6 +62,16 @@ export default {
}
},
watch: {
'basicData.subTypeName': {
immediate: true,
handler(val) {
if (val === 'InventoryStockBackRequest') {
this.cmpOptions = { typeName: 'ErpInventory', layKey: 'InventoryBackAddItemLs' }
} else if (val === 'MatchStockBackRequest' || val === 'InternalStockBackRequest') {
this.cmpOptions = { typeName: 'JobResponseSorting', layKey: 'add_MatchStockBackRequestItem' }
}
}
}
},
created() {
},
......@@ -77,33 +87,44 @@ export default {
submitEvent(addContinue) {
this.$refs['applyForm'].validate((valid) => {
let scrapCount = 0
let maxAmount = 0
let inventoryData = null
let aoNo = ''
if (valid && this.selection) {
let responseName = ''
// 历史配套数据
if (this.selection.subTypeName === 'JobResponseOutStorageMatch') {
responseName = 'oldOutStorage'
scrapCount = -(this.selection.scrapCount)
} else {
responseName = 'jobResponseSorting'
if (this.hasTop) { // 库内退库/配套退库
maxAmount = this.$utils.subNum(this.selection.outsideAmount, -this.selection.backedAmount, -this.selection.backAmount, scrapCount)
aoNo = (typeof this.basicData.extProcessPlan === 'string' && this.basicData.extProcessPlan.includes('+') ? this.basicData.extProcessPlan.split('+')[0] : this.basicData.extProcessPlan.serialNumber) || this.basicData.aoPlan
inventoryData = this.selection.erpInventory
if (this.selection.subTypeName === 'JobResponseOutStorageMatch') { // 历史配套数据(配套退库使用)
responseName = 'oldOutStorage'
scrapCount = -(this.selection.scrapCount)
} else {
responseName = 'jobResponseSorting'
}
} else if (this.basicData.subTypeName === 'InventoryStockBackRequest') { // 台账退库
maxAmount = this.selection.usableAmount
inventoryData = this.selection
responseName = 'erpInventory'
}
const maxAmount = this.$utils.subNum(this.selection.outsideAmount, -this.selection.backedAmount, -this.selection.backAmount, scrapCount)
if (this.applyForm.reqAmount > maxAmount) return this.$utils.showMessageWarning(`当前选中物料的退库数量不足!`)
const inventoryData = this.selection.erpInventory
const data = [{
'subTypeName': `${this.basicData.subTypeName}Item`,
'material': inventoryData.extMaterial,
'materialId': inventoryData.extMaterialId,
'testNo': inventoryData.testNo,
'batchNo': inventoryData.batchNumber,
'serialNo': inventoryData.serialNo,
'jobResponseId': this.selection.id,
'batchNo': this.selection.batchNumber,
'serialNo': this.selection.serialNo,
'uniqueId': this.selection.id,
'backAmount': this.selection.backAmount || 0,
'scrapCount': this.selection.scrapCount || 0,
'backedAmount': this.selection.backedAmount || 0,
'outsideAmount': this.selection.outsideAmount || 0,
'reqAmount': this.applyForm.reqAmount,
'unit': this.selection.unit,
'reqNo': this.selection.reqNo || ''
'reqNo': this.selection.reqNo || '',
'aoPlan': aoNo,
'mdsItemCode': inventoryData.extMaterial.resCode
}]
data[0][responseName] = this.selection
this.$emit('submitEvent', { formData: data, addContinue })
......
......@@ -118,7 +118,7 @@ export default {
item.scrapCount = null
item.unit = item.jobResponseSorting.erpInventory && item.jobResponseSorting.erpInventory.unit
item.testNo = item.jobResponseSorting.erpInventory && item.jobResponseSorting.erpInventory.testNo
item.jobResponseId = item.jobResponseSorting.id
item.uniqueId = item.jobResponseSorting.id
}
}
if (item.oldOutStorage) {
......@@ -131,7 +131,7 @@ export default {
item.scrapCount = item.oldOutStorage.scrapCount
item.unit = item.oldOutStorage.inventory && item.oldOutStorage.inventory.extUnit && item.oldOutStorage.inventory.extUnit.unitName
item.testNo = item.oldOutStorage.inventory && item.oldOutStorage.inventory.testNo
item.jobResponseId = item.oldOutStorage.id
item.uniqueId = item.oldOutStorage.id
}
}
return item
......@@ -208,12 +208,12 @@ export default {
})
},
filterCurData() {
this.tableData = this.tableData.filter(item => !this.selectionRows.map(item => item.jobResponseId).includes(item.jobResponseId))
this.tableData = this.tableData.filter(item => !this.selectionRows.map(item => item.uniqueId).includes(item.uniqueId))
},
submitEvent({ formData, addContinue }) {
const onlyFlag = this.tableData.find(item => !item.reqNo.includes(formData[0].reqNo) && !formData[0].reqNo.includes(item.reqNo))
const onlyFlag = this.tableData.find(item => item.reqNo && !item.reqNo.includes(formData[0].reqNo) && !formData[0].reqNo.includes(item.reqNo))
if (onlyFlag) return this.$utils.showMessageWarning('只能添加同一单据下的数据,请重新选择!')
const extMaterialIds = this.tableData.map(item => item.jobResponseId).includes(formData[0].jobResponseId)
const extMaterialIds = this.tableData.map(item => item.uniqueId).includes(formData[0].uniqueId)
if (extMaterialIds) return this.$utils.showMessageWarning('相同数据不能重复添加,请重新选择!')
this.tableData.push(...formData)
this.dialogShow = addContinue || false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment