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