|
|
|
@ -205,14 +205,14 @@
|
|
|
|
|
placeholder: '请输入${title}', |
|
|
|
|
defaultValue:'', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '批次', |
|
|
|
|
key: 'batch', |
|
|
|
|
type: FormTypes.input, |
|
|
|
|
width:"200px", |
|
|
|
|
placeholder: '请输入${title}', |
|
|
|
|
defaultValue:'', |
|
|
|
|
}, |
|
|
|
|
// { |
|
|
|
|
// title: '批次', |
|
|
|
|
// key: 'batch', |
|
|
|
|
// type: FormTypes.input, |
|
|
|
|
// width:"200px", |
|
|
|
|
// placeholder: '请输入${title}', |
|
|
|
|
// defaultValue:'', |
|
|
|
|
// }, |
|
|
|
|
{ |
|
|
|
|
title: '请发数', |
|
|
|
|
key: 'pleaseSendNumber', |
|
|
|
@ -264,12 +264,13 @@
|
|
|
|
|
defaultValue:'', |
|
|
|
|
}, |
|
|
|
|
// { |
|
|
|
|
// title: '删除时间', |
|
|
|
|
// key: 'delTime', |
|
|
|
|
// type: FormTypes.date, |
|
|
|
|
// width:"200px", |
|
|
|
|
// placeholder: '请输入${title}', |
|
|
|
|
// title: '', |
|
|
|
|
// key: 'MaterialsDeliveryId', |
|
|
|
|
// type: FormTypes.input, |
|
|
|
|
// width:"0px", |
|
|
|
|
// defaultValue:'', |
|
|
|
|
// disabled:true, |
|
|
|
|
// |
|
|
|
|
// }, |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
@ -374,156 +375,6 @@
|
|
|
|
|
this.fetchData(val); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// async onSelect(record) { |
|
|
|
|
// // console.log(record) |
|
|
|
|
// if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment === ''){ |
|
|
|
|
// // console.log("执行materialGroup") |
|
|
|
|
// this.fetchMerchandiseNews(record.row.materialGroup,1); |
|
|
|
|
// } |
|
|
|
|
// if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment !== '' && record.row.actualSendNumber === '' ){ |
|
|
|
|
// // console.log("执行materialNumber") |
|
|
|
|
// let materialName = {} |
|
|
|
|
// this.bigIdMerchandiseNewsList.forEach(item => { |
|
|
|
|
// if (item.merchandiseNewsId === record.row.equipment) { |
|
|
|
|
// materialName = { |
|
|
|
|
// name: item.merchandiseName, |
|
|
|
|
// unit: item.materialsUnit, |
|
|
|
|
// supplierName: item.supplierName, |
|
|
|
|
// price: item.price, |
|
|
|
|
// residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// let values = [ |
|
|
|
|
// { |
|
|
|
|
// rowKey: record.row.id, |
|
|
|
|
// values: { |
|
|
|
|
// 'equipment': record.row.equipment, |
|
|
|
|
// 'materialGroup': record.row.materialGroup, |
|
|
|
|
// 'materialName': materialName.name, |
|
|
|
|
// 'materialUnit': materialName.unit, |
|
|
|
|
// 'supplier': materialName.supplierName, |
|
|
|
|
// 'materialPrice': materialName.price, |
|
|
|
|
// 'actualSendNumber': materialName.residueNumber, |
|
|
|
|
// 'materialAmount': materialName.price * materialName.residueNumber, |
|
|
|
|
// }, |
|
|
|
|
// }, |
|
|
|
|
// ] |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.setValues(values); |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// // 根据请发数量计算 |
|
|
|
|
// if(record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined){ |
|
|
|
|
// // console.log("执行了",record.row) |
|
|
|
|
// let res = record.row; |
|
|
|
|
// let materialName = {} |
|
|
|
|
// this.bigIdMerchandiseNewsList.forEach(item => { |
|
|
|
|
// if (item.merchandiseNewsId === record.row.equipment) { |
|
|
|
|
// materialName = { |
|
|
|
|
// residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// // 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; |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// let value = [ |
|
|
|
|
// { |
|
|
|
|
// rowKey: res.id, |
|
|
|
|
// values: { |
|
|
|
|
// // 'equipment': res.equipment, |
|
|
|
|
// // 'materialGroup': res.materialGroup, |
|
|
|
|
// // 'materialName': res.materialName, |
|
|
|
|
// // 'materialUnit': res.materialUnit, |
|
|
|
|
// // 'supplier': res.supplier, |
|
|
|
|
// // 'materialPrice': res.materialPrice, |
|
|
|
|
// 'actualSendNumber': res.actualSendNumber, |
|
|
|
|
// 'pleaseSendNumber': res.pleaseSendNumber, |
|
|
|
|
// 'materialAmount': res.materialPrice * res.actualSendNumber, |
|
|
|
|
// }, |
|
|
|
|
// }, |
|
|
|
|
// ] |
|
|
|
|
// this.$nextTick(()=>{ |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.setValues(value); |
|
|
|
|
// }) |
|
|
|
|
// // console.log('****>',value) |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// }, |
|
|
|
|
// fetchMerchandiseNews(value){ //查询物料清单信息 |
|
|
|
|
// //查询大品类数据 |
|
|
|
|
// return new Promise((resolve, reject) => { |
|
|
|
|
// //你的逻辑代码 |
|
|
|
|
// let par = { |
|
|
|
|
// delFlag: 0, |
|
|
|
|
// descriptionId:value, |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// this.bigIdMerchandiseNews = []; |
|
|
|
|
// this.bigIdMerchandiseNewsList = []; |
|
|
|
|
// let qc = []; |
|
|
|
|
// let numberList = []; |
|
|
|
|
// if(this.processMaterialsDeliveryListTable.columns[1].options.length > 0){ |
|
|
|
|
// this.processMaterialsDeliveryListTable.columns[1].options = []; |
|
|
|
|
// } |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.getValues((a,b,c)=>{ |
|
|
|
|
// // console.log(a,b,c) |
|
|
|
|
// b.forEach(item =>{ |
|
|
|
|
// if(item.equipment !== '' && item.equipment !== undefined && item.equipment !== null){ |
|
|
|
|
// numberList.push(item.materialNumber); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// }); |
|
|
|
|
// getAction(this.url.merchandiseNewsList,par).then((res)=>{ |
|
|
|
|
// if(res.success){ |
|
|
|
|
// console.log(res.result); |
|
|
|
|
// let newList = res.result; |
|
|
|
|
// // console.log("12312312:"+numberList.length); |
|
|
|
|
// if(numberList.length > 0){ |
|
|
|
|
// newList.forEach( item => { |
|
|
|
|
// qc.push({ |
|
|
|
|
// title : item.materialsNumber, |
|
|
|
|
// value : item.merchandiseNewsId, |
|
|
|
|
// disabled : false |
|
|
|
|
// }) |
|
|
|
|
// }) |
|
|
|
|
// numberList.forEach( num => { |
|
|
|
|
// qc.forEach( i => { |
|
|
|
|
// if(num === i.value){ |
|
|
|
|
// // console.log(num,i.value); |
|
|
|
|
// i.disabled = true; |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// }) |
|
|
|
|
// this.processMaterialsDeliveryListTable.columns[1].options = qc; |
|
|
|
|
// }else{ |
|
|
|
|
// newList.forEach( item => { |
|
|
|
|
// this.processMaterialsDeliveryListTable.columns[1].options.push({ |
|
|
|
|
// title : item.materialsNumber, |
|
|
|
|
// value : item.merchandiseNewsId, |
|
|
|
|
// disabled : false |
|
|
|
|
// }) |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// // console.log(this.processUdgetPlanMaterialTable.columns[1].options); |
|
|
|
|
// resolve(this.bigIdMerchandiseNewsList = res.result ); |
|
|
|
|
// // return |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// |
|
|
|
|
// }); |
|
|
|
|
// |
|
|
|
|
// }, |
|
|
|
|
//table 值改变触发 |
|
|
|
|
async onSelect(record) { |
|
|
|
|
// console.log(record) |
|
|
|
|
if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment === ''){ |
|
|
|
@ -540,8 +391,7 @@
|
|
|
|
|
unit: item.materialsUnit, |
|
|
|
|
supplierName: item.supplierName, |
|
|
|
|
price: item.price, |
|
|
|
|
batch: item.batch, |
|
|
|
|
// residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, |
|
|
|
|
residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -555,196 +405,69 @@
|
|
|
|
|
'materialUnit': materialName.unit, |
|
|
|
|
'supplier': materialName.supplierName, |
|
|
|
|
'materialPrice': materialName.price, |
|
|
|
|
'batch' : materialName.batch, |
|
|
|
|
// 'actualSendNumber': materialName.residueNumber, |
|
|
|
|
// 'materialAmount': materialName.price * materialName.residueNumber, |
|
|
|
|
'actualSendNumber': materialName.residueNumber, |
|
|
|
|
'materialAmount': materialName.price * materialName.residueNumber, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
this.$refs.processMaterialsDeliveryList.setValues(values); |
|
|
|
|
} |
|
|
|
|
let a = false; |
|
|
|
|
|
|
|
|
|
// 根据请发数量计算 |
|
|
|
|
if(record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined){ |
|
|
|
|
let numberStar = 0; |
|
|
|
|
let numberEnd = 0; |
|
|
|
|
// record.row.materialAmount = record.row.materialQuantity * record.row.materialPrice; |
|
|
|
|
// 获取被逻辑删除的字段id |
|
|
|
|
// let deleteIds = this.$refs.processMaterialsDeliveryList.getDeleteIds(); |
|
|
|
|
// 获取所有表单的值,并进行验证 |
|
|
|
|
let batcher = false; |
|
|
|
|
let rest = false; |
|
|
|
|
let { error, values } = this.$refs.processMaterialsDeliveryList.getValuesSync({ }) |
|
|
|
|
// console.log( values); |
|
|
|
|
values.forEach( item => { |
|
|
|
|
//判断是不是操作第一个 |
|
|
|
|
if(item.id === record.row.id){ |
|
|
|
|
let bat = record.row.batch.substring(0,record.row.batch.indexOf('/')); |
|
|
|
|
if(parseInt(bat) === 1){ |
|
|
|
|
// console.log("第一批"); |
|
|
|
|
batcher = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//判断下面是不是有一样的物资 |
|
|
|
|
if(item.id !== record.row.id && item.equipment === record.row.equipment ){ |
|
|
|
|
//有 |
|
|
|
|
let cf = record.row.pleaseSendNumber - record.row.actualSendNumber; |
|
|
|
|
if(cf < 0 ){ |
|
|
|
|
let ba = record.row.batch.substring(0,record.row.batch.indexOf('/')); |
|
|
|
|
if(parseInt(ba) === 1 ){ |
|
|
|
|
record.row.actualSendNumber = record.row.pleaseSendNumber; |
|
|
|
|
//请减小 |
|
|
|
|
let values = [ |
|
|
|
|
{ |
|
|
|
|
rowKey: record.row.id, |
|
|
|
|
values: { |
|
|
|
|
'equipment': record.row.equipment, |
|
|
|
|
'materialGroup': record.row.materialGroup, |
|
|
|
|
'materialName': record.row.materialName, |
|
|
|
|
'materialUnit': record.row.materialUnit, |
|
|
|
|
'supplier': record.row.supplier, |
|
|
|
|
'materialPrice': record.row.price , |
|
|
|
|
'actualSendNumber': record.row.actualSendNumber, |
|
|
|
|
'materialAmount': record.row.price * record.row.actualSendNumber, |
|
|
|
|
'pleaseSendNumber' : record.row.pleaseSendNumber, |
|
|
|
|
'batch' : record.row.batch, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
this.$refs.processMaterialsDeliveryList.setValues(values); |
|
|
|
|
this.$refs.processMaterialsDeliveryList.removeRows(item.id); |
|
|
|
|
}else { |
|
|
|
|
|
|
|
|
|
batcher =true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
//请变大 |
|
|
|
|
this.$refs.processMaterialsDeliveryList.removeRows(item.id); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
//第二行操作 |
|
|
|
|
if(batcher){ |
|
|
|
|
// console.log("执行了123") |
|
|
|
|
let num = 0; |
|
|
|
|
this.bigIdMerchandiseNewsList.forEach( item =>{ |
|
|
|
|
// console.log("item",item); |
|
|
|
|
num = record.row.pleaseSendNumber - item.residueNumber; //第二行显示的数量 |
|
|
|
|
if(num > 0){ |
|
|
|
|
// 限制最大数量 |
|
|
|
|
record.row.pleaseSendNumber = item.residueNumber; |
|
|
|
|
record.row.actualSendNumber = record.row.pleaseSendNumber; |
|
|
|
|
//添加一行 |
|
|
|
|
this.$refs.processMaterialsDeliveryList.handleClickAdd(); |
|
|
|
|
this.jiy.push(this.addId); |
|
|
|
|
a =true; |
|
|
|
|
}else{ |
|
|
|
|
record.row.actualSendNumber = record.row.pleaseSendNumber; |
|
|
|
|
// console.log("执行了222" ,record.row.actualSendNumber); |
|
|
|
|
// console.log("执行了",record.row) |
|
|
|
|
let res = record.row; |
|
|
|
|
let materialName = {} |
|
|
|
|
this.bigIdMerchandiseNewsList.forEach(item => { |
|
|
|
|
if (item.merchandiseNewsId === record.row.equipment) { |
|
|
|
|
materialName = { |
|
|
|
|
residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
let drop = record.row.materialGroup; |
|
|
|
|
let values = [ |
|
|
|
|
{ |
|
|
|
|
rowKey: record.row.id, |
|
|
|
|
values: { |
|
|
|
|
'equipment': record.row.equipment, |
|
|
|
|
'materialGroup': record.row.materialGroup, |
|
|
|
|
'materialName': record.row.materialName, |
|
|
|
|
'materialUnit': record.row.materialUnit, |
|
|
|
|
'supplier': record.row.supplier, |
|
|
|
|
'materialPrice': record.row.materialPrice, |
|
|
|
|
'actualSendNumber': record.row.actualSendNumber, |
|
|
|
|
'materialAmount': record.row.actualSendNumber * record.row.materialPrice, |
|
|
|
|
'pleaseSendNumber' : record.row.pleaseSendNumber, |
|
|
|
|
'batch' : record.row.batch, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
this.$refs.processMaterialsDeliveryList.setValues(values); |
|
|
|
|
//重新赋值 |
|
|
|
|
if(a){ |
|
|
|
|
let merchandiseNewser = {}; |
|
|
|
|
let merchandiseNews = {}; |
|
|
|
|
let is = false; |
|
|
|
|
let onIs= false; |
|
|
|
|
do{ |
|
|
|
|
if(is){ |
|
|
|
|
this.$refs.processMaterialsDeliveryList.handleClickAdd(); |
|
|
|
|
merchandiseNewser =await this.fetchMerchandiseNews(drop,parseInt(numberStar)); |
|
|
|
|
}else{ |
|
|
|
|
merchandiseNewser =await this.fetchMerchandiseNews(drop,2); |
|
|
|
|
} |
|
|
|
|
merchandiseNewser.forEach( item => { |
|
|
|
|
merchandiseNews = item; |
|
|
|
|
}); |
|
|
|
|
console.log("numberStar",numberStar) |
|
|
|
|
numberStar = merchandiseNews.batch.substring(0,merchandiseNews.batch.indexOf("/")); |
|
|
|
|
numberEnd = merchandiseNews.batch.slice(numberStar.length+1); |
|
|
|
|
// console.log(merchandiseNews); |
|
|
|
|
let sum = num - merchandiseNews.residueNumber; |
|
|
|
|
let isLose = parseInt(numberEnd) - parseInt(numberStar); |
|
|
|
|
console.log("isLose",isLose); |
|
|
|
|
if(isLose === 0 ){ |
|
|
|
|
onIs = true; |
|
|
|
|
} |
|
|
|
|
if( sum > 0 ){ |
|
|
|
|
//第三批 |
|
|
|
|
is = true; |
|
|
|
|
numberStar = parseInt(numberStar)+1; |
|
|
|
|
sum = merchandiseNews.residueNumber; |
|
|
|
|
}else{ |
|
|
|
|
sum = num; |
|
|
|
|
// console.log("小于"); |
|
|
|
|
is = false; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
let values = [ |
|
|
|
|
{ |
|
|
|
|
rowKey: this.addId, |
|
|
|
|
values: { |
|
|
|
|
'equipment': record.row.equipment, |
|
|
|
|
'materialGroup': record.row.materialGroup, |
|
|
|
|
'materialName': record.row.materialName, |
|
|
|
|
'materialUnit': record.row.materialUnit, |
|
|
|
|
'supplier': record.row.supplier, |
|
|
|
|
'materialPrice': merchandiseNews.price ? merchandiseNews.price : 0 , |
|
|
|
|
'actualSendNumber': sum , |
|
|
|
|
'materialAmount': sum * merchandiseNews.price ? sum * merchandiseNews.price : 0, |
|
|
|
|
'pleaseSendNumber' : sum, |
|
|
|
|
'batch' : merchandiseNews.batch, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
this.$refs.processMaterialsDeliveryList.setValues(values); |
|
|
|
|
//减小num 数量 |
|
|
|
|
num = sum; |
|
|
|
|
if(onIs){ |
|
|
|
|
//还要继续查询 |
|
|
|
|
|
|
|
|
|
this.$message.warn('没有更多批次了'); |
|
|
|
|
is = false; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
}while (is); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
// 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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let value = [ |
|
|
|
|
{ |
|
|
|
|
rowKey: res.id, |
|
|
|
|
values: { |
|
|
|
|
// 'equipment': res.equipment, |
|
|
|
|
// 'materialGroup': res.materialGroup, |
|
|
|
|
// 'materialName': res.materialName, |
|
|
|
|
// 'materialUnit': res.materialUnit, |
|
|
|
|
// 'supplier': res.supplier, |
|
|
|
|
// 'materialPrice': res.materialPrice, |
|
|
|
|
'actualSendNumber': res.actualSendNumber, |
|
|
|
|
'pleaseSendNumber': res.pleaseSendNumber, |
|
|
|
|
'materialAmount': res.materialPrice * res.actualSendNumber, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
this.$nextTick(()=>{ |
|
|
|
|
this.$refs.processMaterialsDeliveryList.setValues(value); |
|
|
|
|
}) |
|
|
|
|
// console.log('****>',value) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
fetchMerchandiseNews(value,batch){ //查询物料清单信息 |
|
|
|
|
fetchMerchandiseNews(value){ //查询物料清单信息 |
|
|
|
|
//查询大品类数据 |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
//你的逻辑代码 |
|
|
|
|
let par = { |
|
|
|
|
delFlag: 0, |
|
|
|
|
descriptionId:value, |
|
|
|
|
batchNum: batch, |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
this.bigIdMerchandiseNews = []; |
|
|
|
|
this.bigIdMerchandiseNewsList = []; |
|
|
|
@ -801,6 +524,291 @@
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//table 值改变触发 |
|
|
|
|
// async onSelect(record) { |
|
|
|
|
// // console.log(record) |
|
|
|
|
// if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment === ''){ |
|
|
|
|
// // console.log("执行materialGroup") |
|
|
|
|
// this.fetchMerchandiseNews(record.row.materialGroup,1); |
|
|
|
|
// } |
|
|
|
|
// if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment !== '' && record.row.actualSendNumber === '' ){ |
|
|
|
|
// // console.log("执行materialNumber") |
|
|
|
|
// let materialName = {} |
|
|
|
|
// this.bigIdMerchandiseNewsList.forEach(item => { |
|
|
|
|
// if (item.merchandiseNewsId === record.row.equipment) { |
|
|
|
|
// materialName = { |
|
|
|
|
// name: item.merchandiseName, |
|
|
|
|
// unit: item.materialsUnit, |
|
|
|
|
// supplierName: item.supplierName, |
|
|
|
|
// price: item.price, |
|
|
|
|
// batch: item.batch, |
|
|
|
|
// MaterialsDeliveryId : item.id |
|
|
|
|
// // residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// let values = [ |
|
|
|
|
// { |
|
|
|
|
// rowKey: record.row.id, |
|
|
|
|
// values: { |
|
|
|
|
// 'equipment': record.row.equipment, |
|
|
|
|
// 'materialGroup': record.row.materialGroup, |
|
|
|
|
// 'materialName': materialName.name, |
|
|
|
|
// 'materialUnit': materialName.unit, |
|
|
|
|
// 'supplier': materialName.supplierName, |
|
|
|
|
// 'materialPrice': materialName.price, |
|
|
|
|
// 'batch' : materialName.batch, |
|
|
|
|
// 'MaterialsDeliveryId': materialName.MaterialsDeliveryId |
|
|
|
|
// // 'actualSendNumber': materialName.residueNumber, |
|
|
|
|
// // 'materialAmount': materialName.price * materialName.residueNumber, |
|
|
|
|
// }, |
|
|
|
|
// }, |
|
|
|
|
// ] |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.setValues(values); |
|
|
|
|
// } |
|
|
|
|
// let a = false; |
|
|
|
|
// // 根据请发数量计算 |
|
|
|
|
// if(record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined){ |
|
|
|
|
// console.log("record.row",record.row); |
|
|
|
|
// let numberStar = 0; |
|
|
|
|
// let numberEnd = 0; |
|
|
|
|
// // record.row.materialAmount = record.row.materialQuantity * record.row.materialPrice; |
|
|
|
|
// // 获取被逻辑删除的字段id |
|
|
|
|
// // let deleteIds = this.$refs.processMaterialsDeliveryList.getDeleteIds(); |
|
|
|
|
// // 获取所有表单的值,并进行验证 |
|
|
|
|
// let batcher = false; |
|
|
|
|
// let { error, values } = this.$refs.processMaterialsDeliveryList.getValuesSync({ }) |
|
|
|
|
// // console.log( values); |
|
|
|
|
// values.forEach( item => { |
|
|
|
|
// //判断是不是操作第一个 |
|
|
|
|
// if(item.id === record.row.id){ |
|
|
|
|
// let bat = record.row.batch.substring(0,record.row.batch.indexOf('/')); |
|
|
|
|
// if(parseInt(bat) === 1){ |
|
|
|
|
// // console.log("第一批"); |
|
|
|
|
// batcher = true; |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// //判断下面是不是有一样的物资 |
|
|
|
|
// if(item.id !== record.row.id && item.equipment === record.row.equipment ){ |
|
|
|
|
// //有 |
|
|
|
|
// let cf = record.row.pleaseSendNumber - record.row.actualSendNumber; |
|
|
|
|
// if(cf < 0 ){ |
|
|
|
|
// let ba = record.row.batch.substring(0,record.row.batch.indexOf('/')); |
|
|
|
|
// if(parseInt(ba) === 1 ){ |
|
|
|
|
// record.row.actualSendNumber = record.row.pleaseSendNumber; |
|
|
|
|
// //请减小 |
|
|
|
|
// let values = [ |
|
|
|
|
// { |
|
|
|
|
// rowKey: record.row.id, |
|
|
|
|
// values: { |
|
|
|
|
// 'equipment': record.row.equipment, |
|
|
|
|
// 'materialGroup': record.row.materialGroup, |
|
|
|
|
// 'materialName': record.row.materialName, |
|
|
|
|
// 'materialUnit': record.row.materialUnit, |
|
|
|
|
// 'supplier': record.row.supplier, |
|
|
|
|
// 'materialPrice': record.row.price , |
|
|
|
|
// 'actualSendNumber': record.row.actualSendNumber, |
|
|
|
|
// 'materialAmount': record.row.price * record.row.actualSendNumber, |
|
|
|
|
// 'pleaseSendNumber' : record.row.pleaseSendNumber, |
|
|
|
|
// 'batch' : record.row.batch, |
|
|
|
|
// }, |
|
|
|
|
// }, |
|
|
|
|
// ] |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.setValues(values); |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.removeRows(item.id); |
|
|
|
|
// }else { |
|
|
|
|
// |
|
|
|
|
// batcher =true; |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// }else{ |
|
|
|
|
// //请变大 |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.removeRows(item.id); |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// }) |
|
|
|
|
// //第二行操作 |
|
|
|
|
// if(batcher){ |
|
|
|
|
// // console.log("执行了123") |
|
|
|
|
// let num = 0; |
|
|
|
|
// this.bigIdMerchandiseNewsList.forEach( item =>{ |
|
|
|
|
// // console.log("item",item); |
|
|
|
|
// num = record.row.pleaseSendNumber - item.residueNumber; //第二行显示的数量 |
|
|
|
|
// if(num > 0){ |
|
|
|
|
// // 限制最大数量 |
|
|
|
|
// record.row.pleaseSendNumber = item.residueNumber; |
|
|
|
|
// record.row.actualSendNumber = record.row.pleaseSendNumber; |
|
|
|
|
// record.row.MaterialsDeliveryId = item.id; |
|
|
|
|
// //添加一行 |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.handleClickAdd(); |
|
|
|
|
// this.jiy.push(this.addId); |
|
|
|
|
// a =true; |
|
|
|
|
// }else{ |
|
|
|
|
// record.row.actualSendNumber = record.row.pleaseSendNumber; |
|
|
|
|
// record.row.MaterialsDeliveryId = item.id; |
|
|
|
|
// // console.log("执行了222" ,record.row.actualSendNumber); |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// }); |
|
|
|
|
// let drop = record.row.materialGroup; |
|
|
|
|
// let values = [ |
|
|
|
|
// { |
|
|
|
|
// rowKey: record.row.id, |
|
|
|
|
// values: { |
|
|
|
|
// 'equipment': record.row.equipment, |
|
|
|
|
// 'materialGroup': record.row.materialGroup, |
|
|
|
|
// 'materialName': record.row.materialName, |
|
|
|
|
// 'materialUnit': record.row.materialUnit, |
|
|
|
|
// 'supplier': record.row.supplier, |
|
|
|
|
// 'materialPrice': record.row.materialPrice, |
|
|
|
|
// 'actualSendNumber': record.row.actualSendNumber, |
|
|
|
|
// 'materialAmount': record.row.actualSendNumber * record.row.materialPrice, |
|
|
|
|
// 'pleaseSendNumber' : record.row.pleaseSendNumber, |
|
|
|
|
// 'batch' : record.row.batch, |
|
|
|
|
// 'MaterialsDeliveryId': record.row.MaterialsDeliveryId, |
|
|
|
|
// }, |
|
|
|
|
// }, |
|
|
|
|
// ] |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.setValues(values); |
|
|
|
|
// //重新赋值 |
|
|
|
|
// if(a){ |
|
|
|
|
// let merchandiseNewser = {}; |
|
|
|
|
// let merchandiseNews = {}; |
|
|
|
|
// let is = false; |
|
|
|
|
// let onIs= false; |
|
|
|
|
// do{ |
|
|
|
|
// if(is){ |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.handleClickAdd(); |
|
|
|
|
// merchandiseNewser =await this.fetchMerchandiseNews(drop,parseInt(numberStar)); |
|
|
|
|
// }else{ |
|
|
|
|
// merchandiseNewser =await this.fetchMerchandiseNews(drop,2); |
|
|
|
|
// } |
|
|
|
|
// merchandiseNewser.forEach( item => { |
|
|
|
|
// merchandiseNews = item; |
|
|
|
|
// }); |
|
|
|
|
// // console.log("numberStar",numberStar) |
|
|
|
|
// numberStar = merchandiseNews.batch.substring(0,merchandiseNews.batch.indexOf("/")); |
|
|
|
|
// numberEnd = merchandiseNews.batch.slice(numberStar.length+1); |
|
|
|
|
// // console.log(merchandiseNews); |
|
|
|
|
// let sum = num - merchandiseNews.residueNumber; //剩余数量 |
|
|
|
|
// let isLose = parseInt(numberEnd) - parseInt(numberStar); |
|
|
|
|
// // console.log("isLose",isLose); |
|
|
|
|
// if(isLose === 0 ){ |
|
|
|
|
// onIs = true; |
|
|
|
|
// } |
|
|
|
|
// if( sum > 0 ){ |
|
|
|
|
// //第三批 |
|
|
|
|
// is = true; |
|
|
|
|
// numberStar = parseInt(numberStar)+1; |
|
|
|
|
// sum = merchandiseNews.residueNumber; |
|
|
|
|
// }else{ |
|
|
|
|
// sum = num; |
|
|
|
|
// // console.log("sum=================>",sum); |
|
|
|
|
// is = false; |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// let values = [ |
|
|
|
|
// { |
|
|
|
|
// rowKey: this.addId, |
|
|
|
|
// values: { |
|
|
|
|
// 'equipment': record.row.equipment, |
|
|
|
|
// 'materialGroup': record.row.materialGroup, |
|
|
|
|
// 'materialName': record.row.materialName, |
|
|
|
|
// 'materialUnit': record.row.materialUnit, |
|
|
|
|
// 'supplier': record.row.supplier, |
|
|
|
|
// 'materialPrice': merchandiseNews.price ? merchandiseNews.price : 0 , |
|
|
|
|
// 'actualSendNumber': sum , |
|
|
|
|
// 'materialAmount': sum * merchandiseNews.price ? sum * merchandiseNews.price : 0, |
|
|
|
|
// 'pleaseSendNumber' : sum, |
|
|
|
|
// 'batch' : merchandiseNews.batch, |
|
|
|
|
// 'MaterialsDeliveryId': merchandiseNews.id, |
|
|
|
|
// }, |
|
|
|
|
// }, |
|
|
|
|
// ] |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.setValues(values); |
|
|
|
|
// //减小num 数量 |
|
|
|
|
// num = num - merchandiseNews.residueNumber; |
|
|
|
|
// if(onIs){ |
|
|
|
|
// //还要继续查询 |
|
|
|
|
// |
|
|
|
|
// this.$message.warn('暂无更多库存!'); |
|
|
|
|
// is = false; |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
// }while (is); |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// }, |
|
|
|
|
// fetchMerchandiseNews(value,batch){ //查询物料清单信息 |
|
|
|
|
// //查询大品类数据 |
|
|
|
|
// return new Promise((resolve, reject) => { |
|
|
|
|
// //你的逻辑代码 |
|
|
|
|
// let par = { |
|
|
|
|
// delFlag: 0, |
|
|
|
|
// descriptionId:value, |
|
|
|
|
// batchNum: batch, |
|
|
|
|
// } |
|
|
|
|
// this.bigIdMerchandiseNews = []; |
|
|
|
|
// this.bigIdMerchandiseNewsList = []; |
|
|
|
|
// let qc = []; |
|
|
|
|
// let numberList = []; |
|
|
|
|
// if(this.processMaterialsDeliveryListTable.columns[1].options.length > 0){ |
|
|
|
|
// this.processMaterialsDeliveryListTable.columns[1].options = []; |
|
|
|
|
// } |
|
|
|
|
// this.$refs.processMaterialsDeliveryList.getValues((a,b,c)=>{ |
|
|
|
|
// // console.log(a,b,c) |
|
|
|
|
// b.forEach(item =>{ |
|
|
|
|
// if(item.equipment !== '' && item.equipment !== undefined && item.equipment !== null){ |
|
|
|
|
// numberList.push(item.materialNumber); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// }); |
|
|
|
|
// getAction(this.url.merchandiseNewsList,par).then((res)=>{ |
|
|
|
|
// if(res.success){ |
|
|
|
|
// console.log(res.result); |
|
|
|
|
// let newList = res.result; |
|
|
|
|
// // console.log("12312312:"+numberList.length); |
|
|
|
|
// if(numberList.length > 0){ |
|
|
|
|
// newList.forEach( item => { |
|
|
|
|
// qc.push({ |
|
|
|
|
// title : item.materialsNumber, |
|
|
|
|
// value : item.merchandiseNewsId, |
|
|
|
|
// disabled : false |
|
|
|
|
// }) |
|
|
|
|
// }) |
|
|
|
|
// numberList.forEach( num => { |
|
|
|
|
// qc.forEach( i => { |
|
|
|
|
// if(num === i.value){ |
|
|
|
|
// // console.log(num,i.value); |
|
|
|
|
// i.disabled = true; |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// }) |
|
|
|
|
// this.processMaterialsDeliveryListTable.columns[1].options = qc; |
|
|
|
|
// }else{ |
|
|
|
|
// newList.forEach( item => { |
|
|
|
|
// this.processMaterialsDeliveryListTable.columns[1].options.push({ |
|
|
|
|
// title : item.materialsNumber, |
|
|
|
|
// value : item.merchandiseNewsId, |
|
|
|
|
// disabled : false |
|
|
|
|
// }) |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// // console.log(this.processUdgetPlanMaterialTable.columns[1].options); |
|
|
|
|
// resolve(this.bigIdMerchandiseNewsList = res.result ); |
|
|
|
|
// // return |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// |
|
|
|
|
// }); |
|
|
|
|
// |
|
|
|
|
// }, |
|
|
|
|
fetchData(value){ //查询物料组 |
|
|
|
|
//查询大品类数据 |
|
|
|
|
let par = { |
|
|
|
|