fix:玻纤物料交接

This commit is contained in:
shijing 2025-03-13 15:30:39 +08:00
parent 7b0c2b5368
commit e4184d3849
1 changed files with 67 additions and 34 deletions

View File

@ -16,7 +16,13 @@
<el-row>
<el-form-item label="交接物料">
<el-button type="primary" @click="addMaterial" v-if="mode!=='show'">手动添加</el-button>
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
<el-input ref="codeInput"
placeholder="扫描交接物料"
v-model="wm_in" clearable
@change="formWminChange(wm_in)"
style="width: 300px;margin-left: 10px;"
></el-input>
<!-- <scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog> -->
</el-form-item>
<el-form-item label="总计:">
{{ totalCount }}
@ -31,6 +37,7 @@
filterable
multiple
clearable
@clear="clearSelect"
@change="materialChange"
style="width: 100%"
>
@ -84,11 +91,11 @@
:min="0"
:step="1"
:max="listItem.count_cando"
:disabled="mode==='show'"
:disabled="mode==='show'||listItem.tracking==20"
:step-strictly="true"
style="width: 100%"
placeholder="交接数量"
@change="countChange"
@change="countChanges($index)"
>
</el-input-number>
</el-form-item>
@ -318,6 +325,7 @@ export default {
type:20,
is_hidde:true,
},
wm_in:"",
materials:[],
totalCount: 0,
deptID:'',
@ -378,8 +386,14 @@ export default {
},
methods: {
deletebw(index){
let that = this;
this.form.handoverb[this.bwIndex].handoverbw.splice(index,1);
this.form.handoverb[this.bwIndex].count--;
let totalCount = 0;
that.form.handoverb.forEach((item)=>{
totalCount += item.count;
})
that.totalCount = totalCount;
},
showbw(index){
this.bwIndex = index;
@ -530,29 +544,37 @@ export default {
this.form.handoverb = data;
this.visible = true;
return this;
},
clearSelect(){
let that = this;
that.totalCount = 0;
that.form.handoverb = [];
},
materialChange() {
let that = this;
let totalCount = 0;
let data = that.materialOptions.filter((item) => {
return that.selectItems.indexOf(item.id)>-1;
});
let materialId = data[0].material;
let params = {
material: materialId,
type: that.type,
};
console.log('params',params);
that.$API.wpm.handover.mgroups.req(params).then((res) => {
that.mgroupOptions = res;
})
data.forEach((item,index)=>{
item.wm = item.id;
item.count = item.count_cando;
totalCount += item.count_cando;
item.handoverbw = [];
that.getWprList(item.id,index);
})
let totalCount = 0,data = [];
if(that.selectItems.length>0){
data = that.materialOptions.filter((item) => {
return that.selectItems.indexOf(item.id)>-1;
});
let materialId = data[0].material;
let params = {
material: materialId,
type: that.type,
};
that.$API.wpm.handover.mgroups.req(params).then((res) => {
that.mgroupOptions = res;
})
data.forEach((item,index)=>{
item.wm = item.id;
item.count = item.count_cando;
totalCount += item.count_cando;
item.tracking = item.material_.tracking;
item.handoverbw = [];
that.getWprList(item.id,index);
})
}
that.totalCount = totalCount;
that.form.handoverb = data;
},
@ -580,6 +602,15 @@ export default {
that.totalCount = totalCount;
}
},
countChanges(index){
if(this.form.handoverb[index]){}else{}
if(this.form.handoverb.length>0){
this.form.handoverb.forEach(item=>{
totalCount += item.count;
})
that.totalCount = totalCount;
}
},
//
submit() {
let that = this;
@ -660,8 +691,8 @@ export default {
let that = this;
that.scanVisible = true;
},
scanClose(data){
if(data==''||data==undefined||data==null){
formWminChange(data){
if(data==''){
return;
}
let that = this;
@ -703,13 +734,16 @@ export default {
}
})
}else{//wprnumber
debugger;
that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => {
if(res.length>0){
let indexs = 0;
let arr = that.form.handoverb.filter((item,index) => {
indexs = index;
return item.wm == res[0].wm;
})
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;
})
}
//handoverb
if(arr.length>0){
//wprwpr
@ -720,14 +754,12 @@ export default {
})
if(arr1.length>0){
that.$message.error("该物料已存在");
// console.log('0',that.form);
}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);
// console.log('1',that.form);
}
}else{
that.form.handoverb[indexs].handoverbw = [];
@ -736,11 +768,12 @@ export default {
obj1.number = res[0].number;
that.form.handoverb[indexs].count=1;
that.form.handoverb[indexs].handoverbw.push(obj1);
// console.log('2',that.form);
}
}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;
@ -755,8 +788,8 @@ export default {
obj3.wpr = res[0].id;
obj3.number = res[0].number;
obj2.handoverbw.push(obj3);
that.form.handoverb = [];
that.form.handoverb.push(obj2);
// console.log('3',that.form);
}
})
}