fix:玻纤交接记录扫描批次,显示物料工序

This commit is contained in:
shijing 2025-03-18 10:39:38 +08:00
parent 135b950432
commit 3b20f98e2c
1 changed files with 98 additions and 57 deletions

View File

@ -64,7 +64,8 @@
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="10">
<el-form-item label="交接物料">
<el-input v-model="listItem.batch" disabled></el-input>
<!-- <sapn>{{ listItem.batch }}({{ listItem.process }})</sapn> -->
<el-input :placeholder="listItem.batch+'('+listItem.process+')'" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
@ -532,6 +533,7 @@ export default {
this.addShow = true;
},
delMaterial(index){
this.selectItems.splice(index,1);
this.form.handoverb.splice(index,1);
this.countChange();
},
@ -569,8 +571,9 @@ export default {
data.forEach((item,index)=>{
item.wm = item.id;
item.count = item.count_cando;
totalCount += item.count_cando;
totalCount += Number(item.count_cando);
item.tracking = item.material_.tracking;
item.process = item.material_.process_name;
item.handoverbw = [];
that.getWprList(item.id,index);
})
@ -598,9 +601,11 @@ export default {
let totalCount = 0;
if(this.form.handoverb.length>0){
this.form.handoverb.forEach(item=>{
totalCount += item.count;
totalCount += Number(item.count);
})
that.totalCount = totalCount;
}else{
that.totalCount = 0;
}
},
countChanges(index){
@ -723,6 +728,7 @@ export default {
let obj = {};
obj.wm = item.id;
obj.batch = item.batch;
obj.batch = item.batch.material_.process_name;
obj.count_cando = item.count;
obj.count = item.count;
obj.handoverbw = [];
@ -752,74 +758,109 @@ export default {
}
})
}else{//wprnumber
that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => {
if(res.length>0){
let indexs = 0,arr =[];
if( that.form.handoverb&&that.form.handoverb.length>0){
arr = that.form.handoverb.filter((item,index) => {
indexs = index;
return item.wm == res[0].wm;
})
let arr = [];
arr = that.materialOptions.filter((item) => {
return item.batch == data;
})
if(arr.length>0){//
let arr2 = [];
if(that.form.handoverb&&that.form.handoverb.length>0){
arr2 = that.form.handoverb.filter((item) => {
return item.batch == data;
})
}
if(arr2.length>0){
that.wm_in = "";
that.$message.error("该批次已存在")
}else{
let params = {material: arr[0].material,type: that.type};
that.$API.wpm.handover.mgroups.req(params).then((res0) => {
that.mgroupOptions = res0;
})
let obj2 = {};
obj2.wm = arr[0].id;
obj2.batch = arr[0].batch;
obj2.process = arr[0].material_.process_name;
obj2.count_cando = arr[0].count;
obj2.count = arr[0].count;
if(that.form.handoverb&&that.form.handoverb.length>0){
that.form.handoverb.push(obj2);
}else{
that.form.handoverb = [];
that.form.handoverb.push(obj2);
}
//handoverb
if(arr.length>0){
//wprwpr
if(that.form.handoverb[0].handoverbw&&that.form.handoverb[0].handoverbw.length>0){
let arr1 = [];
arr1 = that.form.handoverb[0].handoverbw.filter((item1) => {
return item1.wpr == res[0].id;
that.wm_in = "";
}
}else{//
that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => {
if(res.length>0){
let indexs = 0,arr =[];
if( that.form.handoverb&&that.form.handoverb.length>0){
arr = that.form.handoverb.filter((item,index) => {
indexs = index;
return item.wm == res[0].wm;
})
if(arr1.length>0){
that.wm_in = "";
that.$message.error("该物料已存在");
}
//handoverb
if(arr.length>0){
//wprwpr
if(that.form.handoverb[indexs].handoverbw&&that.form.handoverb[indexs].handoverbw.length>0){
let arr1 = [];
arr1 = that.form.handoverb[indexs].handoverbw.filter((item1) => {
return item1.wpr == res[0].id;
})
if(arr1.length>0){
that.wm_in = "";
that.$message.error("该物料已存在");
}else{
let obj1 = {};
obj1.wpr = res[0].id;
obj1.number = res[0].number;
that.form.handoverb[indexs].count+=1;
that.form.handoverb[indexs].handoverbw.push(obj1);
that.wm_in = "";
}
}else{
that.form.handoverb[indexs].handoverbw = [];
let obj1 = {};
obj1.wpr = res[0].id;
obj1.number = res[0].number;
that.form.handoverb[indexs].count+=1;
that.form.handoverb[indexs].count=1;
that.form.handoverb[indexs].handoverbw.push(obj1);
that.wm_in = "";
}
}else{
that.form.handoverb[indexs].handoverbw = [];
let obj1 = {};
obj1.wpr = res[0].id;
obj1.number = res[0].number;
that.form.handoverb[indexs].count=1;
that.form.handoverb[indexs].handoverbw.push(obj1);
}else{//handoverb
that.materialOptions.forEach((item) => {
if(item.id == res[0].wm){
let params = {material: item.material,type: that.type};
that.$API.wpm.handover.mgroups.req(params).then((res1) => {
that.mgroupOptions = res1;
})
let obj2 = {};
obj2.wm = item.id;
obj2.batch = item.batch;
obj2.process = item.material_.process_name;
obj2.count_cando = item.count;
obj2.handoverbw = [];
obj2.count = 1;
let obj3 = {};
obj3.wpr = res[0].id;
obj3.number = res[0].number;
obj2.handoverbw.push(obj3);
that.form.handoverb = [];
that.form.handoverb.push(obj2);
}
})
that.wm_in = "";
}
}else{//handoverb
console.log('handoverb里没有有这个物料批次');
that.materialOptions.forEach((item) => {
if(item.id == res[0].wm){
console.log('item',item);
let params = {material: item.material,type: that.type};
that.$API.wpm.handover.mgroups.req(params).then((res1) => {
that.mgroupOptions = res1;
})
let obj2 = {};
obj2.wm = item.id;
obj2.batch = item.batch;
obj2.count_cando = item.count;
obj2.handoverbw = [];
obj2.count = 1;
let obj3 = {};
obj3.wpr = res[0].id;
obj3.number = res[0].number;
obj2.handoverbw.push(obj3);
that.form.handoverb = [];
that.form.handoverb.push(obj2);
}
})
}else{
that.wm_in = "";
that.$message.error("该批次不存在")
}
}else{
that.wm_in = "";
that.$message.error("该批次不存在")
}
})
})
}
}
this.countChange();
},
},
};