Commit f3a3e462 authored by jingnan's avatar jingnan 👀

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

parent b85cd758
...@@ -59,6 +59,8 @@ export default { ...@@ -59,6 +59,8 @@ export default {
if (!this.basicData.id) { if (!this.basicData.id) {
if (this.form.subTypeName === 'MatchStockBackRequest' || this.form.subTypeName === 'InternalStockBackRequest') { if (this.form.subTypeName === 'MatchStockBackRequest' || this.form.subTypeName === 'InternalStockBackRequest') {
this.$set(this.form, 'extProcessPlan', null) this.$set(this.form, 'extProcessPlan', null)
} else if (this.form.subTypeName === 'InventoryStockBackRequest') {
this.$set(this.form, 'assembleCode', null)
} else { } else {
this.$set(this.form, 'aoNo', '') this.$set(this.form, 'aoNo', '')
} }
...@@ -115,6 +117,13 @@ export default { ...@@ -115,6 +117,13 @@ export default {
'value': id 'value': id
}) })
} }
if (this.form.subTypeName === 'InventoryStockBackRequest') {
params.searchItems.items.push({
'fieldName': 'subTypeName',
'operator': 'EQ',
'value': 'ExtProcessPlanAssemblyUnit'
})
}
this.loading = true this.loading = true
this.options = [] this.options = []
this.$api.searchApi(requestUrl, params).then(res => { this.$api.searchApi(requestUrl, params).then(res => {
......
...@@ -62,6 +62,16 @@ export default { ...@@ -62,6 +62,16 @@ export default {
} }
}, },
watch: { 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() { created() {
}, },
...@@ -77,33 +87,44 @@ export default { ...@@ -77,33 +87,44 @@ export default {
submitEvent(addContinue) { submitEvent(addContinue) {
this.$refs['applyForm'].validate((valid) => { this.$refs['applyForm'].validate((valid) => {
let scrapCount = 0 let scrapCount = 0
let maxAmount = 0
let inventoryData = null
let aoNo = ''
if (valid && this.selection) { if (valid && this.selection) {
let responseName = '' let responseName = ''
// 历史配套数据 if (this.hasTop) { // 库内退库/配套退库
if (this.selection.subTypeName === 'JobResponseOutStorageMatch') { maxAmount = this.$utils.subNum(this.selection.outsideAmount, -this.selection.backedAmount, -this.selection.backAmount, scrapCount)
responseName = 'oldOutStorage' aoNo = (typeof this.basicData.extProcessPlan === 'string' && this.basicData.extProcessPlan.includes('+') ? this.basicData.extProcessPlan.split('+')[0] : this.basicData.extProcessPlan.serialNumber) || this.basicData.aoPlan
scrapCount = -(this.selection.scrapCount) inventoryData = this.selection.erpInventory
} else { if (this.selection.subTypeName === 'JobResponseOutStorageMatch') { // 历史配套数据(配套退库使用)
responseName = 'jobResponseSorting' 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(`当前选中物料的退库数量不足!`) if (this.applyForm.reqAmount > maxAmount) return this.$utils.showMessageWarning(`当前选中物料的退库数量不足!`)
const inventoryData = this.selection.erpInventory
const data = [{ const data = [{
'subTypeName': `${this.basicData.subTypeName}Item`, 'subTypeName': `${this.basicData.subTypeName}Item`,
'material': inventoryData.extMaterial, 'material': inventoryData.extMaterial,
'materialId': inventoryData.extMaterialId, 'materialId': inventoryData.extMaterialId,
'testNo': inventoryData.testNo, 'testNo': inventoryData.testNo,
'batchNo': inventoryData.batchNumber, 'batchNo': this.selection.batchNumber,
'serialNo': inventoryData.serialNo, 'serialNo': this.selection.serialNo,
'jobResponseId': this.selection.id, 'uniqueId': this.selection.id,
'backAmount': this.selection.backAmount || 0, 'backAmount': this.selection.backAmount || 0,
'scrapCount': this.selection.scrapCount || 0, 'scrapCount': this.selection.scrapCount || 0,
'backedAmount': this.selection.backedAmount || 0, 'backedAmount': this.selection.backedAmount || 0,
'outsideAmount': this.selection.outsideAmount || 0, 'outsideAmount': this.selection.outsideAmount || 0,
'reqAmount': this.applyForm.reqAmount, 'reqAmount': this.applyForm.reqAmount,
'unit': this.selection.unit, 'unit': this.selection.unit,
'reqNo': this.selection.reqNo || '' 'reqNo': this.selection.reqNo || '',
'aoPlan': aoNo,
'mdsItemCode': inventoryData.extMaterial.resCode
}] }]
data[0][responseName] = this.selection data[0][responseName] = this.selection
this.$emit('submitEvent', { formData: data, addContinue }) this.$emit('submitEvent', { formData: data, addContinue })
......
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
item.scrapCount = null item.scrapCount = null
item.unit = item.jobResponseSorting.erpInventory && item.jobResponseSorting.erpInventory.unit item.unit = item.jobResponseSorting.erpInventory && item.jobResponseSorting.erpInventory.unit
item.testNo = item.jobResponseSorting.erpInventory && item.jobResponseSorting.erpInventory.testNo item.testNo = item.jobResponseSorting.erpInventory && item.jobResponseSorting.erpInventory.testNo
item.jobResponseId = item.jobResponseSorting.id item.uniqueId = item.jobResponseSorting.id
} }
} }
if (item.oldOutStorage) { if (item.oldOutStorage) {
...@@ -131,7 +131,7 @@ export default { ...@@ -131,7 +131,7 @@ export default {
item.scrapCount = item.oldOutStorage.scrapCount item.scrapCount = item.oldOutStorage.scrapCount
item.unit = item.oldOutStorage.inventory && item.oldOutStorage.inventory.extUnit && item.oldOutStorage.inventory.extUnit.unitName item.unit = item.oldOutStorage.inventory && item.oldOutStorage.inventory.extUnit && item.oldOutStorage.inventory.extUnit.unitName
item.testNo = item.oldOutStorage.inventory && item.oldOutStorage.inventory.testNo item.testNo = item.oldOutStorage.inventory && item.oldOutStorage.inventory.testNo
item.jobResponseId = item.oldOutStorage.id item.uniqueId = item.oldOutStorage.id
} }
} }
return item return item
...@@ -208,12 +208,12 @@ export default { ...@@ -208,12 +208,12 @@ export default {
}) })
}, },
filterCurData() { 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 }) { 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('只能添加同一单据下的数据,请重新选择!') 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('相同数据不能重复添加,请重新选择!') if (extMaterialIds) return this.$utils.showMessageWarning('相同数据不能重复添加,请重新选择!')
this.tableData.push(...formData) this.tableData.push(...formData)
this.dialogShow = addContinue || false 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