feat:日志添加车间库存并打印物料标签

This commit is contained in:
shijing 2024-10-25 11:13:28 +08:00
parent 9e4ceeec3f
commit f5860c42d5
2 changed files with 179 additions and 39 deletions

View File

@ -6,28 +6,25 @@
destroy-on-close
@closed="$emit('closed')"
>
<el-container>
<el-header style="height:100px;padding:0">
<el-card style="width: 100%" header="基本信息" shadow="never">
<el-button type="primary" @click="handlePrint" style="position: absolute;right: 20px;">打印</el-button>
<el-descriptions>
<el-descriptions-item label="工艺路线">{{
fmlogItem.routepack_name
}}</el-descriptions-item>
<el-descriptions-item label="任务编号">{{
fmlogItem.mtask_number
}}</el-descriptions-item>
<el-descriptions-item label="部门/车间">{{
fmlogItem.belong_dept_name
}}</el-descriptions-item>
</el-descriptions>
</el-card>
</el-header>
<!-- mlog -->
<el-main style="padding-top: 40px;position: relative;">
<div>
<!-- 基本信息 -->
<el-card style="width: 100%" header="基本信息" shadow="never">
<el-button type="primary" @click="handlePrint" style="position: absolute;right: 20px;">打印</el-button>
<el-descriptions>
<el-descriptions-item label="工艺路线">{{
fmlogItem.routepack_name
}}</el-descriptions-item>
<el-descriptions-item label="任务编号">{{
fmlogItem.mtask_number
}}</el-descriptions-item>
<el-descriptions-item label="部门/车间">{{
fmlogItem.belong_dept_name
}}</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card style="width: 100%; margin: 1vh 0" shadow="never" header="日志列表">
<el-button
type="primary"
style="position: absolute;top: 5px;"
v-if="fmlogItem.submit_time == null"
icon="el-icon-plus"
@click="table_add"
@ -83,6 +80,18 @@
<el-descriptions-item label="破损" v-if="props.row.count_n_ps>0">
{{props.row.count_n_ps}}
</el-descriptions-item>
<el-descriptions-item label="产品外径" v-if="props.row.count_n_wj>0">
{{props.row.count_n_wj}}
</el-descriptions-item>
<el-descriptions-item label="产品圆度" v-if="props.row.count_n_xh>0">
{{props.row.count_n_xh}}
</el-descriptions-item>
<el-descriptions-item label="产品同心度" v-if="props.row.count_n_yd>0">
{{props.row.count_n_yd}}
</el-descriptions-item>
<el-descriptions-item label="其它" v-if="props.row.count_n_qt>0">
{{props.row.count_n_ps}}
</el-descriptions-item>
</el-descriptions>
</div>
</template>
@ -126,7 +135,31 @@
</template>
</el-table-column>
</scTable>
</el-main>
</el-card>
<!-- 工段物料库存 -->
<el-card style="width: 100%; margin: 1vh 0" header="工段物料列表" shadow="never">
<scTable
ref="tableWm"
:apiObj="apiObjWm"
:params="paramsWm"
stripe
hidePagination
>
<el-table-column label="物料名称" prop="material_name" show-overflow-tooltip>
</el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
<el-table-column label="不合格标记" prop="notok_sign_name">
</el-table-column>
<el-table-column width="100">
<template #default="scope">
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@ -144,10 +177,10 @@
@closed="dialog.check = false"
>
</check-dialog>
</el-container>
<el-dialog v-model="printVisible" width="1200px">
<print :baseData="fmlogItem" :tableData="tableData" type="mlogs12" @closePrint="printVisible=false"/>
</el-dialog>
<el-dialog v-model="printVisible" width="1200px">
<print :baseData="fmlogItem" :tableData="tableData" type="mlogs12" @closePrint="printVisible=false"/>
</el-dialog>
</div>
</el-drawer>
</template>
<script>
@ -178,6 +211,12 @@ export default {
check: false,
},
apiObj: null,
apiObjWm:null,
paramsWm: {
page: 0,
search:'',
mgroup:''
},
params: {
page: 0,
fmlog: "",
@ -198,6 +237,7 @@ export default {
},
fileList:[],
tableData:[],
batchContains:[],
test_file:'',
deptId: "",
visible: false,
@ -221,7 +261,6 @@ export default {
mounted() {
this.getfmlogItem();
this.params.fmlog = this.fmlogId;
console.log('this.params.fmlog',this.params.fmlog);
this.apiObj = this.$API.wpm.mlog.list;
},
methods: {
@ -235,6 +274,17 @@ export default {
that.fmlogItem = res;
that.mgroup = res.mgroup;
that.mtask = res.mtask;
that.paramsWm.mgroup = res.mgroup;
that.$API.wpm.mlog.list.req(that.params).then((res) => {
that.tableData = res;
if(res.length>0){
res.forEach((item) => {
that.batchContains+= item.batch + " ";
})
that.paramsWm.search = that.batchContains;
that.apiObjWm = that.$API.wpm.wmaterial.list;
}else{}
});
});
},
//
@ -314,14 +364,37 @@ export default {
},
handlePrint(){
let that = this;
that.$API.wpm.mlog.list.req(that.params).then((res) => {
that.tableData = res;
// console.log('that.tableData',that.tableData);
// console.log('that.fmlogItem',that.fmlogItem);
that.$nextTick(() => {
that.printVisible = true;
})
});
that.$nextTick(() => {
that.printVisible = true;
})
// that.$API.wpm.mlog.list.req(that.params).then((res) => {
// that.tableData = res;
// });
},
//
printMaterial(row){
let that = this;
that.$API.cm.labelmat.fromWm.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,
];
if(res.notok_sign!==null){
str.push("WINTEXT 280,550,28,90,0,0,Simhei," +res.notok_sign_name,)
}
str.push("PRINT 1",)
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
this.$API.wpm.prints.req(obj).then((response) => {});
})
},
},
};

View File

@ -276,6 +276,30 @@
</el-table-column>
</scTable>
</el-card>
<!-- 工段物料库存 -->
<el-card style="width: 100%" header="工段物料列表" shadow="never">
<scTable
ref="tableWm"
:apiObj="apiObjWm"
:params="paramsWm"
stripe
hidePagination
>
<el-table-column label="物料名称" prop="material_name" show-overflow-tooltip>
</el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="数量" prop="count">
</el-table-column>
<el-table-column label="不合格标记" prop="notok_sign_name">
</el-table-column>
<el-table-column width="100">
<template #default="scope">
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@ -422,6 +446,12 @@ export default {
check: false,
},
apiObj: null,
apiObjWm:null,
paramsWm: {
page: 0,
search:'',
mgroup:''
},
paramsIn: {
page: 0,
mlog: "",
@ -455,6 +485,7 @@ export default {
5: "已关闭",
},
fileList:[],
tableDataWm:[],
test_file:'',
deptId: "",
visible: false,
@ -475,11 +506,11 @@ export default {
},
],
},
batchContains:''
};
},
mounted() {
let that = this;
this.getMlogItem();
this.paramsIn.mlog = this.mlogId;
this.paramsOut.mlog = this.mlogId;
this.apiObj = this.$API.wpm.mlogb.list;
@ -487,15 +518,13 @@ export default {
that.$API.wpm.mlogb.list.req(that.paramsIn).then((res) => {
that.tableData = res;
})
that.$API.wpm.mlogb.list.req(that.paramsOut).then((res) => {
that.tableData2 = res;
})
that.getMlogItem();
},
methods: {
open() {
this.visible = true;
},
getMlogItem() {
let that = this;
that.$API.wpm.mlog.item.req(that.mlogId).then((res) => {
@ -505,10 +534,22 @@ export default {
that.form.test_file = res.test_file;
}
that.mgroup = res.mgroup;
that.paramsWm.mgroup = res.mgroup;
that.materialIn = res.material_in;
that.deptId = res.belong_dept;
that.$API.wpm.mlogb.list.req(that.paramsOut).then((res) => {
that.tableData2 = res;
if(res.length>0){
res.forEach((item) => {
that.batchContains+= item.batch + " ";
})
that.paramsWm.search = that.batchContains;
that.apiObjWm = that.$API.wpm.wmaterial.list;
}
})
});
},
//
setData(data) {
Object.assign(this.form, data);
@ -658,6 +699,32 @@ export default {
let that = this;
that.printVisible = true;
},
//
printMaterial(row){
let that = this;
that.$API.cm.labelmat.fromWm.req({tid:row.id}).then((res) => {
console.log(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,
];
if(res.notok_sign!==null){
str.push("WINTEXT 280,550,28,90,0,0,Simhei," +res.notok_sign_name,)
}
str.push("PRINT 1",)
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
this.$API.wpm.prints.req(obj).then((response) => {});
})
},
},
};
</script>