fix:车间库存领料和入库

This commit is contained in:
shijing 2025-02-27 17:50:35 +08:00
parent 36987f5b2a
commit 93f8474f76
2 changed files with 110 additions and 40 deletions

View File

@ -2,12 +2,9 @@
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" @click="tomio('do_out')" v-auth="'mio.do'"
v-if="mgroupName=='清洗'"
>领料</el-button
>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">
报废</el-button>
<el-button type="primary" @click="tomio('do_out')" v-auth="'mio.do'" v-if="mgroupName=='清洗'">领料</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">报废</el-button>
<el-button type="primary" @click="tomio('do_in')" v-auth="'mio.do'" v-if="mgroupName=='检测'">入库</el-button>
</div>
<div class="right-panel">
<el-select

View File

@ -192,11 +192,9 @@ export default {
getList(){
let that = this;
that.$API.inm.mioitem.list.req({mio:that.mioId,page:0}).then(res=>{
console.log('mioitemlist',res);
that.mioitemlist = res;
})
},
//
getMaterialOptions() {
let that = this;
@ -223,7 +221,6 @@ export default {
obj.page= 0;
obj.mgroupx= that.mgroupId;
obj.material__process= that.process;
if (that.mgroupId != null &&that.mgroupId != undefined &&that.mgroupId != "") {
that.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.wbatchOptions = res;
@ -236,45 +233,102 @@ export default {
let obj = {};
obj.page = 0;
obj.state = 10;
obj.material__type__in= '30';
obj.material = that.form.material;
that.$API.inm.warehouse.batch.req(obj).then((res) => {
that.batchOptions = res.filter((item) => {
return item.state == 10;
});
that.batchOptions = res
});
},
scanClose(data){
let that = this;
let id = data.split('#')[1];
console.log('id',id);
// that.form.batch = id;
that.$API.cm.labelmat.item.req(id).then((res) => {
that.form.mb = res.id;
that.form.batch = res.batch;
that.form.warehouse = res.warehouse;
let arr = that.mioitemlist.filter((mioitem) => {
return mioitem.batch == res.batch;
});
if(arr.length > 0){
that.$message.error('该批次已存在');
that.selectBatchClear();
}else{
let arr2 = that.batchOptions.filter((batchitem) => {
return batchitem.batch == res.batch;
})
if(arr2.length > 0){
that.selectBatch = arr2[0].batch;
that.form.batch = arr2[0].batch;
that.form.count = arr2[0].count;
that.form.mb = arr2[0].id;
that.form.warehouse = arr2[0].warehouse;
that.$refs.scanDialog.visible = false;
that.form.mb = '';
that.form.wm = '';
//
if(data.indexOf('#')>-1){
let id = data.split('#')[1];
console.log('id',id);
that.$API.cm.labelmat.item.req(id).then((res) => {
that.form.batch = res.batch;
that.form.warehouse = res.warehouse;
let arr = that.mioitemlist.filter((mioitem) => {
return mioitem.batch == res.batch;
});
if(arr.length > 0){
that.$message.error('该批次已存在');
that.selectBatchClear();
}else{
that.$message.error('该批次不存在');
let arr2 = [];
if(that.cate == "do_out"){
arr2 = that.batchOptions.filter((batchitem) => {
return batchitem.batch == res.batch;
})
}else{
arr2 = that.wbatchOptions.filter((batchitem) => {
return batchitem.batch == res.batch;
})
}
if(arr2.length > 0){
that.selectBatch = arr2[0].batch;
that.form.batch = arr2[0].batch;
that.form.count = arr2[0].count;
if(that.cate == "do_out"){
that.form.mb = arr2[0].id;
}else{
that.form.wm = arr2[0].id;
}
that.form.warehouse = arr2[0].warehouse;
that.$refs.scanDialog.visible = false;
}else{
that.$message.error('该批次不存在');
}
}
}
})
})
}else{
that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => {
if(res.length>0){
let arr = [];
if(that.cate == "do_out"){
arr = that.mioitemlist.filter((item) => {
return item.mb == res[0].mb;
})
}else{
arr = that.mioitemlist.filter((item) => {
return item.wm == res[0].wm;
})
}
//
if(arr.length>0){
that.$message.error("该物料已存在");
}else{//
let arr2 = [];
if(that.cate == "do_out"){
arr2 = that.batchOptions.filter((batchitem) => {
console.log('batchitem.id',batchitem.id);
console.log('res[0].mb.id',res[0].mb);
return batchitem.id == res[0].mb;
})
}else{
arr2 = that.wbatchOptions.filter((batchitem) => {
return batchitem.id == res[0].wm;
})
}
console.log('arr2',arr2);
that.selectBatch = arr2[0].batch;
that.form.batch = arr2[0].batch;
that.form.count = arr2[0].count;
debugger;
if(that.cate == "do_out"){
that.form.mb = arr2[0].id;
}else{
that.form.wm = arr2[0].id;
}
that.form.warehouse = arr2[0].warehouse;
that.$refs.scanDialog.visible = false;
}
}
})
}
},
selectMaterialChange() {
this.getBatchOptions();
@ -301,6 +355,16 @@ export default {
this.form.mb = item.id;
this.form.count = item.count;
this.form.warehouse = item.warehouse;
this.form.mioitemw = [];
this.isSaveing = true;
that.$API.wpm.wpr.list.req({mb: item.id,page:0}).then((res) => {
res.forEach((itemwpr) => {
let obj={};
obj.number = itemwpr.number;
this.form.mioitemw.push(obj)
})
this.isSaveing = false;;
})
}
}
},
@ -311,6 +375,15 @@ export default {
if (item.batch == val) {
that.form.material = item.material;
that.form.count = item.count;
this.isSaveing = true;
that.$API.wpm.wpr.list.req({wm: item.id,page:0}).then((res) => {
res.forEach((itemwpr) => {
let obj={};
obj.number = itemwpr.number;
this.form.mioitemw.push(obj)
})
this.isSaveing = false;;
})
}
})
},