fix:防止网络慢时扫码乱批处理
This commit is contained in:
parent
4b27653e18
commit
5d4b61e893
|
@ -17,8 +17,10 @@
|
||||||
<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>
|
||||||
<el-input ref="codeInput"
|
<el-input ref="codeInput"
|
||||||
|
id="wm_in"
|
||||||
placeholder="扫描交接物料"
|
placeholder="扫描交接物料"
|
||||||
v-model="wm_in" clearable
|
v-model="wm_in" clearable
|
||||||
|
:disabled="imputDisable"
|
||||||
@change="formWminChange(wm_in)"
|
@change="formWminChange(wm_in)"
|
||||||
style="width: 300px;margin-left: 10px;"
|
style="width: 300px;margin-left: 10px;"
|
||||||
></el-input>
|
></el-input>
|
||||||
|
@ -344,6 +346,7 @@ export default {
|
||||||
bwVisible:false,
|
bwVisible:false,
|
||||||
scanVisible:false,
|
scanVisible:false,
|
||||||
isSaveing: false,
|
isSaveing: false,
|
||||||
|
imputDisable:false,
|
||||||
change_batch:false,
|
change_batch:false,
|
||||||
setFiltersVisible: false,
|
setFiltersVisible: false,
|
||||||
};
|
};
|
||||||
|
@ -733,69 +736,73 @@ export default {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.scanVisible = true;
|
that.scanVisible = true;
|
||||||
},
|
},
|
||||||
formWminChange(data){
|
async formWminChange(data){
|
||||||
|
this.imputDisable = true;
|
||||||
|
await this.getInputText(data);
|
||||||
|
this.imputDisable = false;
|
||||||
|
this.$refs.codeInput.focus();
|
||||||
|
},
|
||||||
|
async getInputText(data){
|
||||||
if(data==''){
|
if(data==''){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.wm_in = '';
|
||||||
if(data.indexOf('#')>-1){
|
if(data.indexOf('#')>-1){
|
||||||
let id = data.split('#')[1];
|
let id = data.split('#')[1];
|
||||||
this.$API.cm.labelmat.item.req(id).then((res) => {
|
let res = await this.$API.cm.labelmat.item.req(id);
|
||||||
let arr = [];
|
let arr = [];
|
||||||
if(that.form.handoverb&&that.form.handoverb.length>0){
|
if(that.form.handoverb&&that.form.handoverb.length>0){
|
||||||
that.form.handoverb.forEach((item) => {
|
that.form.handoverb.forEach((item) => {
|
||||||
if(item.batch == res.batch&&item.state==res.state&&item.defect==res.defect){
|
if(item.batch == res.batch&&item.state==res.state&&item.defect==res.defect){
|
||||||
arr.push(item);
|
arr.push(item);
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if(arr.length>0){
|
|
||||||
that.wm_in = "";
|
|
||||||
that.$message.error("该批次已存在")
|
|
||||||
}else{
|
|
||||||
let hasArr = [];
|
|
||||||
that.materialOptions.forEach((item) => {
|
|
||||||
if(item.batch == res.batch){
|
|
||||||
hasArr.push(item);
|
|
||||||
let params = {material: item.material,type: that.type};
|
|
||||||
that.$API.wpm.handover.mgroups.req(params).then((res0) => {
|
|
||||||
that.mgroupOptions = res0;
|
|
||||||
if(res0.length==1){
|
|
||||||
that.form.recive_mgroup = res0[0].id;
|
|
||||||
that.getUserList2();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
let obj = {};
|
|
||||||
obj.wm = item.id;
|
|
||||||
obj.batch = item.batch;
|
|
||||||
if(item.material_.process_name){
|
|
||||||
obj.process = item.material_.process_name;
|
|
||||||
}
|
|
||||||
obj.count_cando = item.count_canhandover;
|
|
||||||
obj.count = item.count_canhandover;
|
|
||||||
obj.state = res.state;
|
|
||||||
obj.defect = res.defect;
|
|
||||||
obj.handoverbw = [];
|
|
||||||
that.$API.wpm.wpr.list.req({wm:item.id,page:0}).then((res) => {
|
|
||||||
let handoverbw = [];
|
|
||||||
let list = res;
|
|
||||||
list.forEach(item1=>{
|
|
||||||
let obj1 = {};
|
|
||||||
obj1.wpr = item1.id;
|
|
||||||
obj1.number = item1.number;
|
|
||||||
handoverbw.push(obj1);
|
|
||||||
})
|
|
||||||
obj.handoverbw = handoverbw;
|
|
||||||
that.form.handoverb.push(obj);
|
|
||||||
that.wm_in = "";
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if(hasArr.length>0){}else{
|
|
||||||
that.$message.error("该批次不存在")
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(arr.length>0){
|
||||||
|
that.$message.error("该批次已存在")
|
||||||
|
}else{
|
||||||
|
let hasArr = [];
|
||||||
|
that.materialOptions.forEach((item) => {
|
||||||
|
if(item.batch == res.batch){
|
||||||
|
hasArr.push(item);
|
||||||
|
let params = {material: item.material,type: that.type};
|
||||||
|
that.$API.wpm.handover.mgroups.req(params).then((res0) => {
|
||||||
|
that.mgroupOptions = res0;
|
||||||
|
if(res0.length==1){
|
||||||
|
that.form.recive_mgroup = res0[0].id;
|
||||||
|
that.getUserList2();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let obj = {};
|
||||||
|
obj.wm = item.id;
|
||||||
|
obj.batch = item.batch;
|
||||||
|
if(item.material_.process_name){
|
||||||
|
obj.process = item.material_.process_name;
|
||||||
|
}
|
||||||
|
obj.count_cando = item.count_canhandover;
|
||||||
|
obj.count = item.count_canhandover;
|
||||||
|
obj.state = res.state;
|
||||||
|
obj.defect = res.defect;
|
||||||
|
obj.handoverbw = [];
|
||||||
|
that.$API.wpm.wpr.list.req({wm:item.id,page:0}).then((res) => {
|
||||||
|
let handoverbw = [];
|
||||||
|
let list = res;
|
||||||
|
list.forEach(item1=>{
|
||||||
|
let obj1 = {};
|
||||||
|
obj1.wpr = item1.id;
|
||||||
|
obj1.number = item1.number;
|
||||||
|
handoverbw.push(obj1);
|
||||||
|
})
|
||||||
|
obj.handoverbw = handoverbw;
|
||||||
|
that.form.handoverb.push(obj);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(hasArr.length>0){}else{
|
||||||
|
that.$message.error("该批次不存在")
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}else{//wpr的number
|
}else{//wpr的number
|
||||||
let arr = [];
|
let arr = [];
|
||||||
arr = that.materialOptions.filter((item) => {
|
arr = that.materialOptions.filter((item) => {
|
||||||
|
@ -809,7 +816,6 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(arr2.length>0){
|
if(arr2.length>0){
|
||||||
that.wm_in = "";
|
|
||||||
that.$message.error("该批次已存在")
|
that.$message.error("该批次已存在")
|
||||||
}else{
|
}else{
|
||||||
let params = {material: arr[0].material,type: that.type};
|
let params = {material: arr[0].material,type: that.type};
|
||||||
|
@ -825,79 +831,71 @@ export default {
|
||||||
obj2.count_cando = arr[0].count_canhandover;
|
obj2.count_cando = arr[0].count_canhandover;
|
||||||
obj2.count = arr[0].count_canhandover;
|
obj2.count = arr[0].count_canhandover;
|
||||||
that.form.handoverb.push(obj2);
|
that.form.handoverb.push(obj2);
|
||||||
that.wm_in = "";
|
|
||||||
}
|
}
|
||||||
}else{//单件
|
}else{//单件
|
||||||
that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => {
|
let res = await that.$API.wpm.wpr.list.req({number:data,page:0});
|
||||||
if(res.length>0){
|
if(res.length>0){
|
||||||
let indexs = 0,arr =[];
|
let indexs = 0,arr =[];
|
||||||
if( that.form.handoverb&&that.form.handoverb.length>0){
|
if( that.form.handoverb&&that.form.handoverb.length>0){
|
||||||
arr = that.form.handoverb.filter((item,index) => {
|
that.form.handoverb.forEach((item,index) => {
|
||||||
if(item.wm == res[0].wm){
|
if(item.wm == res[0].wm){
|
||||||
indexs = index;
|
indexs = index;
|
||||||
}
|
arr.push(item);
|
||||||
return item.wm == res[0].wm;
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//handoverb里有这个物料批次
|
||||||
|
if(arr.length>0){
|
||||||
|
//判断是否有wpr,若无将wpr放进去
|
||||||
|
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){
|
||||||
//handoverb里有这个物料批次
|
that.$message.error("该物料已存在");
|
||||||
if(arr.length>0){
|
|
||||||
//判断是否有wpr,若无将wpr放进去
|
|
||||||
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{
|
}else{
|
||||||
that.form.handoverb[indexs].handoverbw = [];
|
|
||||||
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);
|
||||||
that.wm_in = "";
|
|
||||||
}
|
}
|
||||||
}else{//handoverb里没有有这个物料批次
|
}else{
|
||||||
that.materialOptions.forEach((item) => {
|
that.form.handoverb[indexs].handoverbw = [];
|
||||||
if(item.id == res[0].wm){
|
let obj1 = {};
|
||||||
let params = {material: item.material,type: that.type};
|
obj1.wpr = res[0].id;
|
||||||
that.$API.wpm.handover.mgroups.req(params).then((res1) => {
|
obj1.number = res[0].number;
|
||||||
that.mgroupOptions = res1;
|
that.form.handoverb[indexs].count=1;
|
||||||
})
|
that.form.handoverb[indexs].handoverbw.push(obj1);
|
||||||
let obj2 = {};
|
|
||||||
obj2.wm = item.id;
|
|
||||||
obj2.batch = item.batch;
|
|
||||||
if(item.material_.process_name){
|
|
||||||
obj2.process = item.material_.process_name;
|
|
||||||
}
|
|
||||||
obj2.count_cando = item.count_canhandover;
|
|
||||||
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{
|
}else{//handoverb里没有有这个物料批次
|
||||||
that.wm_in = "";
|
that.materialOptions.forEach((item) => {
|
||||||
that.$message.error("该批次不存在")
|
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;
|
||||||
|
if(item.material_.process_name){
|
||||||
|
obj2.process = item.material_.process_name;
|
||||||
|
}
|
||||||
|
obj2.count_cando = item.count_canhandover;
|
||||||
|
obj2.handoverbw = [];
|
||||||
|
obj2.count = 1;
|
||||||
|
let obj3 = {};
|
||||||
|
obj3.wpr = res[0].id;
|
||||||
|
obj3.number = res[0].number;
|
||||||
|
obj2.handoverbw.push(obj3);
|
||||||
|
that.form.handoverb.push(obj2);
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
}else{
|
||||||
|
that.$message.error("该批次不存在")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
Loading…
Reference in New Issue