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