diff --git a/src/views/inm/mainso.vue b/src/views/inm/mainso.vue
index 03070918..6aefc73a 100644
--- a/src/views/inm/mainso.vue
+++ b/src/views/inm/mainso.vue
@@ -63,7 +63,7 @@
- 物料标签
+ 物料标签
@@ -80,7 +80,7 @@
关联产品
-
+
@@ -139,10 +139,12 @@ export default {
wprParams:{
page:0
},
+ project_code:''
};
},
mounted() {
this.getWarehouse();
+ this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
},
methods: {
getType(type){
@@ -174,14 +176,60 @@ export default {
})
},
//打印物料标签
- printMaterial(row){
+ printMaterial(row,type){
let that = this;
- that.wmId = row.id;
- that.wmtype = row.material_.type;
- that.print_m = true;
- this.$nextTick(() => {
- this.$refs.printmaterial.open();
- })
+ let printer_name=localStorage.getItem("printer_name");
+ if(printer_name!==''&&printer_name!==null&&printer_name!==undefined){
+ if(that.project_code!=='gz'){
+ if(type=='mb'){
+ that.$API.cm.labelmat.fromMb.req({tid:row.id}).then((res) => {
+ let code = res.code_label;
+ let str = [
+ "SIZE 40 mm,70 mm",
+ "GAP 7 mm,7 mm",
+ "CLS",
+ "REFERENCE 0,0",
+ 'QRCODE 30,400,H,5,A,0,"' +code +'"',
+ "WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name,
+ "WINTEXT 240,550,28,90,0,0,Simhei," + res.batch,
+ "PRINT 1",
+ ];
+ let obj = {};
+ obj.printer_commands = str;
+ obj.printer_name = printer_name;
+ that.$API.wpm.prints.req(obj).then((response) => {
+ that.$message.success("打印成功");
+ });
+ })
+ }else{
+ let code = row.number;
+ let str = [
+ "SIZE 70 mm,100 mm",
+ "GAP 7 mm,7 mm",
+ "CLS",
+ "REFERENCE 0,0",
+ 'QRCODE 30,400,H,5,A,0,"' +code +'"',
+ "WINTEXT 240,550,28,90,0,0,Simhei," + row.number,
+ "PRINT 1",
+ ];
+ let obj = {};
+ obj.printer_commands = str;
+ obj.printer_name = printer_name;
+ that.$API.wpm.prints.req(obj).then((response) => {
+ that.$message.success("打印成功");
+ });
+ }
+ }else{
+ that.wmId = row.id;
+ that.wmtype = row.material_.type;
+ that.print_m = true;
+ this.$nextTick(() => {
+ this.$refs.printmaterial.open();
+ })
+ }
+ }else{
+ that.$message.console.error("请先设置打印机");
+ }
},
},
};
diff --git a/src/views/inm/mioitem.vue b/src/views/inm/mioitem.vue
index 32e17e3b..b562e1a5 100644
--- a/src/views/inm/mioitem.vue
+++ b/src/views/inm/mioitem.vue
@@ -199,7 +199,7 @@
物料标签
@@ -479,8 +479,8 @@ export default {
printMaterial(row,type){
let that = this;
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
- if(type=='wm'){
- that.$API.cm.labelmat.fromWm.req({tid:row.id}).then((res) => {
+ if(type=='mioitem'){
+ that.$API.cm.labelmat.fromMioitem.req({tid:row.id}).then((res) => {
let code = res.code_label;
let str = [
"SIZE 40 mm,70 mm",
@@ -507,7 +507,6 @@ export default {
"CLS",
"REFERENCE 0,0",
'QRCODE 30,400,H,5,A,0,"' +code +'"',
- "WINTEXT 200,550,28,90,0,0,Simhei," + row.material_name,
"WINTEXT 240,550,28,90,0,0,Simhei," + row.number,
"PRINT 1",
];
diff --git a/src/views/wpm_bx/mlogb_form.vue b/src/views/wpm_bx/mlogb_form.vue
index 0093ce4c..8d1f6aac 100644
--- a/src/views/wpm_bx/mlogb_form.vue
+++ b/src/views/wpm_bx/mlogb_form.vue
@@ -215,6 +215,7 @@ export default {
]
},
wm_in:'',
+ mlogbId:'',
route_code:"",
mlogbIns:[],
options: [],
@@ -392,16 +393,25 @@ export default {
let arr0= that.mlogbIns.filter((item)=>{
return item.batch == batch;
})
+ let arr1 = that.bwItemForms.filter((item)=>{
+ return item.number == bwitem.number;
+ })
if (arr0.length > 0) {
that.hasMlogbIn = true;
that.form.count_use = 1;
+ that.mlogbId = arr0[0].id;
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 = '';
- that.batchs = arr[0].id;
+ if(arr1.length>0){
+ that.wm_in = '';
+ that.$message.error("已存在");
+ }else{
+ that.form.batch = arr[0].batch;
+ that.form.wm_in = arr[0].id;
+ that.form.count_use += 1;
+ that.wm_in = '';
+ that.batchs = arr[0].id;
+ }
}
that.bwItemForms.push(bwitem);
// that.bwItemForm = bwitem;
@@ -418,28 +428,15 @@ export default {
submit() {
let that = this;
if(that.hasMlogbIn){
- that.bwItemForms.forEach(item=>{
- item.mlogb = res.id;
- that.$API.wpm.mlogbw.create.req(item).then((res1) => {
- that.wm_in = '';
- that.form.mtask = '';
- that.form.batch = '';
- that.form.parent = '';
- that.form.count_use = 0;
- that.$emit("closed");
- that.visible = false;
- })
+ that.$API.wpm.mlogbw.create.req(that.bwItemForms).then((res1) => {
+ that.wm_in = '';
+ that.form.mtask = '';
+ that.form.batch = '';
+ that.form.parent = '';
+ that.form.count_use = 0;
+ that.$emit("closed");
+ that.visible = false;
})
- // that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {
- // that.$message.success("添加成功");
- // that.wm_in = '';
- // that.form.mtask = '';
- // that.form.batch = '';
- // that.form.parent = '';
- // that.form.count_use = 0;
- // that.$emit("closed");
- // that.visible = false;
- // })
}else{
that.form.mlog = that.mlog;
that.$API.wpm.mlogb.in.req(that.form).then((res) => {
@@ -450,16 +447,37 @@ export default {
that.form.parent = '';
that.form.count_use = 0;
if(that.scanKyes!=='mat'&&that.bwItemForms.length>1){
+ //2
+ // async function callApis() {
+ // for (const item of that.bwItemForms) {
+ // item.mlogb = res.id;
+ // try {
+ // await that.$API.wpm.mlogbw.create.req(item).then((res) => {});
+ // } catch (error) {
+ // console.error('Error calling API:', error);
+ // }
+ // }
+ // }
+ // callApis();
+ //1
+ // const promises = that.bwItemForms.map(item => {
+ // item.mlogb = res.id;
+ // return that.$API.wpm.mlogbw.create.req(item).then((res) => {});
+ // });
+ // console.log('promises.length',promises.length);
+ // Promise.all(promises).then(results => {
+ // console.log('results',results);
+ // that.$emit("closed");
+ // }).catch(error => {
+ // console.error(error);
+ // });
+ //0
that.bwItemForms.forEach(item=>{
item.mlogb = res.id;
- that.$API.wpm.mlogbw.create.req(item).then((res1) => {
- that.$emit("closed");
- })
})
- // that.bwItemForm.mlogb = res.id;
- // that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {
- // that.$emit("closed");
- // })
+ that.$API.wpm.mlogbw.create.req(that.bwItemForms).then((res1) => {
+ that.$emit("closed");
+ })
}else{
that.$emit("closed");
}