Browse Source

修改出货流程显示数据

dev
caoyizhong 2 years ago
parent
commit
ff51de6c43
  1. 440
      src/views/activiti/form/ProcessMaterialsDeliveryForm.vue

440
src/views/activiti/form/ProcessMaterialsDeliveryForm.vue

@ -71,6 +71,7 @@
:rowSelection="true"
:actionButton="true"
@added="addid"
:disabledRows="{id:jiy}"
>
<!-- <template v-slot:qing="props">-->
<!-- <a-input v-decorator="['pleaseSendNumber']" placeholder="请输入" style="width: 100%" @change="shuru" type="number"/>-->
@ -121,6 +122,7 @@
},
data() {
return {
jiy:[],
heid: true,
addId : '',
bigIdMerchandiseNewsList:[],
@ -204,6 +206,14 @@
placeholder: '请输入${title}',
defaultValue:'',
},
// {
// title: '',
// key: 'batch',
// type: FormTypes.input,
// width:"200px",
// placeholder: '${title}',
// defaultValue:'',
// },
{
title: '请发数',
key: 'pleaseSendNumber',
@ -255,14 +265,6 @@
defaultValue:'',
},
// {
// title: '',
// key: 'delFlag',
// type: FormTypes.inputNumber,
// width:"200px",
// placeholder: '${title}',
// defaultValue:'',
// },
// {
// title: '',
// key: 'delTime',
// type: FormTypes.date,
@ -289,7 +291,7 @@
materialType: { rules: [{ required: true, message: '请选择物资类型!' }] },
deliveryTime: { rules: [{ required: true, message: '请选择出库时间!' }] },
processPlan: { rules: [{ required: true, message: '请选择流程计划!' }] }
}
},
}
},
props: {
@ -357,6 +359,9 @@
this.popupCallback(company,userInfo);
},
methods: {
shuliang(){
this.addId
},
//
addid(val){
this.addId = val.row.id;
@ -369,9 +374,7 @@
this.heid = false;
this.fetchData(val);
}
// console.log("l",val);
},
//table
async onSelect(record) {
// console.log(record)
if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment === ''){
@ -388,9 +391,8 @@
unit: item.materialsUnit,
supplierName: item.supplierName,
price: item.price,
// residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber,
residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber,
}
}
})
let values = [
@ -403,122 +405,68 @@
'materialUnit': materialName.unit,
'supplier': materialName.supplierName,
'materialPrice': materialName.price,
// 'actualSendNumber': materialName.residueNumber,
// 'materialAmount': materialName.price * materialName.residueNumber,
'actualSendNumber': materialName.residueNumber,
'materialAmount': materialName.price * materialName.residueNumber,
},
},
]
this.$refs.processMaterialsDeliveryList.setValues(values);
}
let a = false;
let numberStar = 0;
let numberEnd = 0;
//
if(record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined){
// record.row.materialAmount = record.row.materialQuantity * record.row.materialPrice;
let num = 0;
this.bigIdMerchandiseNewsList.forEach( item =>{
console.log("item",item);
numberStar = item.batch.substring(0,item.batch.indexOf("/"));
numberEnd = item.batch.slice(numberStar.length+1);
num = record.row.pleaseSendNumber - item.residueNumber;
if(num > 0){
//
record.row.pleaseSendNumber = item.residueNumber;
record.row.actualSendNumber = record.row.pleaseSendNumber;
this.$refs.processMaterialsDeliveryList.handleClickAdd();
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 = [
})
// console.log("materialName.residueNumber",materialName.residueNumber)
if(parseInt( res.pleaseSendNumber) > parseInt( materialName.residueNumber )){
// console.log("")
res.pleaseSendNumber = materialName.residueNumber;
res.actualSendNumber = materialName.residueNumber;
}else{
// console.log("")
res.actualSendNumber = res.pleaseSendNumber;
}
let value = [
{
rowKey: record.row.id,
rowKey: res.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,
// '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.$refs.processMaterialsDeliveryList.setValues(values);
//
if(a){
let merchandiseNewser = {};
let merchandiseNews = {};
let is = false;
let onIs= false;
do{
// console.log("numberStar",parseInt(numberStar)+1)
merchandiseNewser =await this.fetchMerchandiseNews(drop,parseInt(numberStar)+1);
// console.log(merchandiseNewser);
merchandiseNewser.forEach( item => {
merchandiseNews = item;
});
// console.log(merchandiseNews);
let sum = num - merchandiseNews.residueNumber;
if( sum > 0 ){
// console.log("");
// console.log("numberEnd",numberEnd);
// console.log("merchandiseNews.batch.substring()",merchandiseNews.batch.substring(0,merchandiseNews.batch.indexOf("/")));
//
let isLose = parseInt(numberEnd) - parseInt( merchandiseNews.batch.substring(0,merchandiseNews.batch.indexOf("/")) );
if(isLose === 0 ){
onIs = true;
}else {
is = true;
numberStar = numberStar+1;
this.$refs.processMaterialsDeliveryList.handleClickAdd();
}
}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': record.row.materialPrice,
'actualSendNumber': sum,
'materialAmount': sum * record.row.materialPrice,
'pleaseSendNumber' : sum,
},
},
]
this.$refs.processMaterialsDeliveryList.setValues(values);
if(onIs){
this.$message.warn('没有更多批次了');
is = false;
return;
}
}while (is);
}
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 = [];
@ -575,6 +523,284 @@
});
},
//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,
// // 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,
// // '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);
// }
// });
// 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);
// }
//
// }
//
// }
//
// },
// 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 = {

Loading…
Cancel
Save