fix:coding#786、2

This commit is contained in:
shijing 2025-02-10 16:58:24 +08:00
parent 97d2cb40b5
commit 0c7ce37ed8
1 changed files with 54 additions and 74 deletions

View File

@ -59,7 +59,7 @@
</el-form>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">提交</el-button>
<el-button @click="visibleDrawer = false">取消</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-main>
</el-container>
@ -197,87 +197,67 @@ export default {
},
//
formWminChange(code){
let that = this,codeId='',keys="",arr=[];
let that = this,codeId='',arr=[];
if(code.indexOf("#")>-1){
let arrs = code.split("#");
keys = arrs[0];
codeId = arrs[1];
that.scanKyes = keys;
if(keys=='wpr'){//
console.log('wpr',codeId)
that.form.parent = '';
that.$API.wpm.wpr.item.req(codeId).then((res) => {
if(res){
let bwitem = {};
bwitem.mlogb="";
bwitem.number=res.number;
bwitem.wpr=res.id;
arr = that.materialOptions.filter((item) => {
return item.id == res.wm;
})
if (arr.length > 0) {//
let batch = arr[0].batch;
that.wm_in = arr[0].batch;
that.mlogbInCount = arr[0].count;//
//
let arr0= that.mlogbIns.filter((item)=>{
return item.batch == batch;
})
if (arr0.length > 0) {
that.hasMlogbIn = true;
that.form.count_use = 1;
bwitem.mlogb = arr0[0].id;
}else{
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = 1;
that.wm_in = arr[0].batch;
}
that.bwItemForm = bwitem;
console.log('that.bwItemForm',that.bwItemForm)
}else{
that.wm_in = '';
that.$message.error("批次号不存在");
}
}
}).catch((err) => {})
}else{//
this.$API.cm.labelmat.item.req(codeId).then((res) => {
if(res){
arr = that.materialOptions.filter((item) => {
return item.batch == res.batch&&item.state==res.state;
})
if (arr.length > 0) {
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count;
that.wm_in = arr[0].batch;
}else{
that.wm_in = '';
that.$message.error("批次号不存在");
}
that.scanKyes = arrs[0];
this.$API.cm.labelmat.item.req(codeId).then((res) => {
if(res){
arr = that.materialOptions.filter((item) => {
return item.batch == res.batch&&item.state==res.state;
})
if (arr.length > 0) {
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count;
that.wm_in = arr[0].batch;
}else{
that.wm_in = '';
that.$message.error("批次号不存在");
}
}).catch((err) => {
}else{
that.wm_in = '';
that.$message.error("批次号不存在");
});
}
}else{
arr = that.materialOptions.filter((item) => {
return item.batch == code;
})
if (arr.length > 0) {
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count;
that.wm_in = arr[0].batch;
}else{
}
}).catch((err) => {
that.wm_in = '';
that.$message.error("批次号不存在");
}
});
}else{
that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => {
if(res.length>0){
let bwitem = {};
bwitem.mlogb="";
bwitem.number=res[0].number;
bwitem.wpr=res[0].id;
let arr = that.materialOptions.filter((item) => {
return item.id == res[0].wm;
})
if(arr.length>0){ //
let batch = arr[0].batch;
that.wm_in = arr[0].batch;
that.mlogbInCount = arr[0].count;//
//
let arr0= that.mlogbIns.filter((item)=>{
return item.batch == batch;
})
if (arr0.length > 0) {
that.hasMlogbIn = true;
that.form.count_use = 1;
bwitem.mlogb = arr0[0].id;
}else{
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = 1;
that.wm_in = arr[0].batch;
}
that.bwItemForm = bwitem;
}else{
that.wm_in = '';
that.$message.error("批次号不存在");
}
}
})
}
},
@ -305,7 +285,7 @@ export default {
that.form.batch = '';
that.form.parent = '';
that.form.count_use = 0;
if(that.scanKyes=='wpr'&&that.mlogbInCount>1){
if(that.scanKyes!=='mat'&&that.mlogbInCount>1){
//1
that.bwItemForm.mlogb = res.id;
that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {})