|
|
|
@ -441,44 +441,49 @@
|
|
|
|
|
async onSelect(record) { |
|
|
|
|
// console.log(record) |
|
|
|
|
let isMA = true |
|
|
|
|
if (record.row.materialGroup !== '' && record.row.materialGroup !== undefined) { |
|
|
|
|
if (!!record.row.materialGroup && !!record.row.materialGroup ) { |
|
|
|
|
// console.log("执行materialGroup111") |
|
|
|
|
if (record.row.id !== undefined && record.row.id !== '' && record.row.materialGroup !== this.materialGroupId) { |
|
|
|
|
if (!!record.row.id && record.row.materialGroup !== this.materialGroupId && !record.row.equipment) { |
|
|
|
|
// console.log("执行materialGroup222") |
|
|
|
|
if (this.rolePlay) { |
|
|
|
|
// console.log("执行账外") |
|
|
|
|
//账外 |
|
|
|
|
await this.fetchMerchandiseNewsZW(record.row.materialGroup, 1) |
|
|
|
|
} else { |
|
|
|
|
// console.log("执行总库") |
|
|
|
|
//总库 |
|
|
|
|
await this.fetchMerchandiseNews(record.row.materialGroup, 1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let valu = [ |
|
|
|
|
{ |
|
|
|
|
rowKey: record.row.id, |
|
|
|
|
values: { |
|
|
|
|
'equipment': '', |
|
|
|
|
'materialGroup': record.row.materialGroup, |
|
|
|
|
'materialName': '', |
|
|
|
|
'materialUnit': '', |
|
|
|
|
'supplierId': '', |
|
|
|
|
'materialPrice': '', |
|
|
|
|
'actualSendNumber': '', |
|
|
|
|
'materialAmount': '', |
|
|
|
|
'pleaseSendNumber': '' |
|
|
|
|
|
|
|
|
|
let valu = [ |
|
|
|
|
{ |
|
|
|
|
rowKey: record.row.id, |
|
|
|
|
values: { |
|
|
|
|
'equipment': '', |
|
|
|
|
'materialGroup': record.row.materialGroup, |
|
|
|
|
'materialName': '', |
|
|
|
|
'materialUnit': '', |
|
|
|
|
'supplierId': '', |
|
|
|
|
'materialPrice': '', |
|
|
|
|
'actualSendNumber': '', |
|
|
|
|
'materialAmount': '', |
|
|
|
|
'pleaseSendNumber': '' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
// console.log(valu) |
|
|
|
|
this.$refs.processMaterialsDeliveryList.setValues(valu) |
|
|
|
|
this.materialGroupId = record.row.materialGroup |
|
|
|
|
isMA = false |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
// console.log(valu) |
|
|
|
|
this.$refs.processMaterialsDeliveryList.setValues(valu) |
|
|
|
|
this.materialGroupId = record.row.materialGroup |
|
|
|
|
isMA = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if (record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment !== '' && record.row.equipment !== undefined && isMA) { |
|
|
|
|
let eAll = 0; |
|
|
|
|
if (!!record.row.materialGroup && !! record.row.equipment && isMA) { |
|
|
|
|
// console.log("执行materialNumber") |
|
|
|
|
|
|
|
|
|
let materialName = {} |
|
|
|
|
this.bigIdMerchandiseNewsList.forEach(item => { |
|
|
|
|
if (item.merchandiseNewsId === record.row.equipment) { |
|
|
|
@ -491,7 +496,8 @@
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if (record.row.id !== undefined) { |
|
|
|
|
if (record.row.id !== undefined && Object.keys(materialName).length > 0) { |
|
|
|
|
// console.log("materialName",materialName); |
|
|
|
|
let values = [ |
|
|
|
|
{ |
|
|
|
|
rowKey: record.row.id, |
|
|
|
@ -508,13 +514,26 @@
|
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
this.$refs.processMaterialsDeliveryList.setValues(values) |
|
|
|
|
}else{ |
|
|
|
|
console.log("this.data.materialType",this.data.materialType) |
|
|
|
|
if (parseInt(this.data.materialType) === 1) { |
|
|
|
|
//账外 |
|
|
|
|
await this.getEquipmentInvisible(record.row.equipment); |
|
|
|
|
eAll = 2; |
|
|
|
|
} else { |
|
|
|
|
//总库 |
|
|
|
|
await this.getEquipmentAll(record.row.equipment); |
|
|
|
|
eAll = 1 |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 根据请发数量计算 |
|
|
|
|
if (record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined && isMA) { |
|
|
|
|
// console.log("执行了",record.row) |
|
|
|
|
if (!! record.row.pleaseSendNumber && isMA) { |
|
|
|
|
// console.log("执行了333333333333") |
|
|
|
|
let res = record.row |
|
|
|
|
let materialName = {} |
|
|
|
|
this.bigIdMerchandiseNewsList.forEach(item => { |
|
|
|
@ -524,15 +543,32 @@
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// console.log("materialName.residueNumber",materialName.residueNumber) |
|
|
|
|
if (parseInt(res.pleaseSendNumber) > parseInt(materialName.residueNumber)) { |
|
|
|
|
// console.log("大于") |
|
|
|
|
this.$message.warn('输入请发数不能大于库存数') |
|
|
|
|
res.pleaseSendNumber = materialName.residueNumber |
|
|
|
|
res.actualSendNumber = materialName.residueNumber |
|
|
|
|
} else { |
|
|
|
|
// console.log("小于") |
|
|
|
|
res.actualSendNumber = res.pleaseSendNumber |
|
|
|
|
if(eAll === 0){ |
|
|
|
|
if (parseInt(res.pleaseSendNumber) > parseInt(materialName.residueNumber)) { |
|
|
|
|
this.$message.warn('输入请发数不能大于库存数') |
|
|
|
|
res.pleaseSendNumber = materialName.residueNumber |
|
|
|
|
res.actualSendNumber = materialName.residueNumber |
|
|
|
|
} else { |
|
|
|
|
res.actualSendNumber = res.pleaseSendNumber |
|
|
|
|
} |
|
|
|
|
}else if(eAll === 1){ |
|
|
|
|
// console.log("000000000000000",this.equipmentAll); |
|
|
|
|
if (parseInt(res.pleaseSendNumber) > parseInt(this.equipmentAll[0].materialQuantity)) { |
|
|
|
|
this.$message.warn('输入请发数不能大于库存数') |
|
|
|
|
res.pleaseSendNumber = this.equipmentAll[0].materialQuantity |
|
|
|
|
res.actualSendNumber = this.equipmentAll[0].materialQuantity |
|
|
|
|
} else { |
|
|
|
|
res.actualSendNumber = res.pleaseSendNumber |
|
|
|
|
} |
|
|
|
|
}else if(eAll === 2) { |
|
|
|
|
// console.log("00000000000022222",this.equipmentAll); |
|
|
|
|
if (parseInt(res.pleaseSendNumber) > parseInt(this.equipmentAll[0].residueNumber)) { |
|
|
|
|
this.$message.warn('输入请发数不能大于库存数') |
|
|
|
|
res.pleaseSendNumber = this.equipmentAll[0].residueNumber |
|
|
|
|
res.actualSendNumber = this.equipmentAll[0].residueNumber |
|
|
|
|
} else { |
|
|
|
|
res.actualSendNumber = res.pleaseSendNumber |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (res.id !== undefined) { |
|
|
|
|
let value = [ |
|
|
|
@ -559,6 +595,47 @@
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//查询总出库库存信息 |
|
|
|
|
getEquipmentAll(val,){ |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
let ue = sessionStorage.getItem('USER_INFORMATION') |
|
|
|
|
let res = JSON.parse(ue) |
|
|
|
|
|
|
|
|
|
let pam = { |
|
|
|
|
merchandiseNewsId: val, |
|
|
|
|
departId : res.departIds |
|
|
|
|
} |
|
|
|
|
getAction(this.url.merchandiseNewsList,pam).then(res=>{ |
|
|
|
|
// console.log("dsfgsdfgb",res); |
|
|
|
|
if(res.success){ |
|
|
|
|
this.equipmentAll =res.result ; |
|
|
|
|
} |
|
|
|
|
resolve(this.equipmentAll); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//查询账外出库库存信息 |
|
|
|
|
getEquipmentInvisible(val){ |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
let ue = sessionStorage.getItem('USER_INFORMATION') |
|
|
|
|
let res = JSON.parse(ue) |
|
|
|
|
|
|
|
|
|
let pam = { |
|
|
|
|
merchandiseNewsId: val, |
|
|
|
|
departId : res.departIds |
|
|
|
|
} |
|
|
|
|
getAction(this.url.wasteMaterialsList,pam).then(res=>{ |
|
|
|
|
// console.log("pppppppppppp",res); |
|
|
|
|
if(res.success){ |
|
|
|
|
this.equipmentAll =res.result ; |
|
|
|
|
} |
|
|
|
|
resolve(this.equipmentAll); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
fetchMerchandiseNews(value) { //查询物料清单信息 |
|
|
|
|
//查询大品类数据 |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|