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 destroy-on-close
@closed="$emit('closed')" @closed="$emit('closed')"
> >
<el-container> <div>
<el-header style="height:100px;padding:0"> <!-- 基本信息 -->
<el-card style="width: 100%" header="基本信息" shadow="never"> <el-card style="width: 100%" header="基本信息" shadow="never">
<el-button type="primary" @click="handlePrint" style="position: absolute;right: 20px;">打印</el-button> <el-button type="primary" @click="handlePrint" style="position: absolute;right: 20px;">打印</el-button>
<el-descriptions> <el-descriptions>
<el-descriptions-item label="工艺路线">{{ <el-descriptions-item label="工艺路线">{{
fmlogItem.routepack_name fmlogItem.routepack_name
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="任务编号">{{ <el-descriptions-item label="任务编号">{{
fmlogItem.mtask_number fmlogItem.mtask_number
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="部门/车间">{{ <el-descriptions-item label="部门/车间">{{
fmlogItem.belong_dept_name fmlogItem.belong_dept_name
}}</el-descriptions-item> }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
</el-header> <el-card style="width: 100%; margin: 1vh 0" shadow="never" header="日志列表">
<!-- mlog -->
<el-main style="padding-top: 40px;position: relative;">
<el-button <el-button
type="primary" type="primary"
style="position: absolute;top: 5px;"
v-if="fmlogItem.submit_time == null" v-if="fmlogItem.submit_time == null"
icon="el-icon-plus" icon="el-icon-plus"
@click="table_add" @click="table_add"
@ -83,6 +80,18 @@
<el-descriptions-item label="破损" v-if="props.row.count_n_ps>0"> <el-descriptions-item label="破损" v-if="props.row.count_n_ps>0">
{{props.row.count_n_ps}} {{props.row.count_n_ps}}
</el-descriptions-item> </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> </el-descriptions>
</div> </div>
</template> </template>
@ -126,7 +135,31 @@
</template> </template>
</el-table-column> </el-table-column>
</scTable> </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 <save-dialog
v-if="dialog.save" v-if="dialog.save"
ref="saveDialog" ref="saveDialog"
@ -144,10 +177,10 @@
@closed="dialog.check = false" @closed="dialog.check = false"
> >
</check-dialog> </check-dialog>
</el-container> <el-dialog v-model="printVisible" width="1200px">
<el-dialog v-model="printVisible" width="1200px"> <print :baseData="fmlogItem" :tableData="tableData" type="mlogs12" @closePrint="printVisible=false"/>
<print :baseData="fmlogItem" :tableData="tableData" type="mlogs12" @closePrint="printVisible=false"/> </el-dialog>
</el-dialog> </div>
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
@ -178,6 +211,12 @@ export default {
check: false, check: false,
}, },
apiObj: null, apiObj: null,
apiObjWm:null,
paramsWm: {
page: 0,
search:'',
mgroup:''
},
params: { params: {
page: 0, page: 0,
fmlog: "", fmlog: "",
@ -198,6 +237,7 @@ export default {
}, },
fileList:[], fileList:[],
tableData:[], tableData:[],
batchContains:[],
test_file:'', test_file:'',
deptId: "", deptId: "",
visible: false, visible: false,
@ -221,7 +261,6 @@ export default {
mounted() { mounted() {
this.getfmlogItem(); this.getfmlogItem();
this.params.fmlog = this.fmlogId; this.params.fmlog = this.fmlogId;
console.log('this.params.fmlog',this.params.fmlog);
this.apiObj = this.$API.wpm.mlog.list; this.apiObj = this.$API.wpm.mlog.list;
}, },
methods: { methods: {
@ -235,6 +274,17 @@ export default {
that.fmlogItem = res; that.fmlogItem = res;
that.mgroup = res.mgroup; that.mgroup = res.mgroup;
that.mtask = res.mtask; 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(){ handlePrint(){
let that = this; let that = this;
that.$API.wpm.mlog.list.req(that.params).then((res) => { that.$nextTick(() => {
that.tableData = res; that.printVisible = true;
// console.log('that.tableData',that.tableData); })
// console.log('that.fmlogItem',that.fmlogItem); // that.$API.wpm.mlog.list.req(that.params).then((res) => {
that.$nextTick(() => { // that.tableData = res;
that.printVisible = true; // });
}) },
}); //
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> </el-table-column>
</scTable> </scTable>
</el-card> </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 <save-dialog
v-if="dialog.save" v-if="dialog.save"
ref="saveDialog" ref="saveDialog"
@ -422,6 +446,12 @@ export default {
check: false, check: false,
}, },
apiObj: null, apiObj: null,
apiObjWm:null,
paramsWm: {
page: 0,
search:'',
mgroup:''
},
paramsIn: { paramsIn: {
page: 0, page: 0,
mlog: "", mlog: "",
@ -455,6 +485,7 @@ export default {
5: "已关闭", 5: "已关闭",
}, },
fileList:[], fileList:[],
tableDataWm:[],
test_file:'', test_file:'',
deptId: "", deptId: "",
visible: false, visible: false,
@ -475,11 +506,11 @@ export default {
}, },
], ],
}, },
batchContains:''
}; };
}, },
mounted() { mounted() {
let that = this; let that = this;
this.getMlogItem();
this.paramsIn.mlog = this.mlogId; this.paramsIn.mlog = this.mlogId;
this.paramsOut.mlog = this.mlogId; this.paramsOut.mlog = this.mlogId;
this.apiObj = this.$API.wpm.mlogb.list; this.apiObj = this.$API.wpm.mlogb.list;
@ -487,15 +518,13 @@ export default {
that.$API.wpm.mlogb.list.req(that.paramsIn).then((res) => { that.$API.wpm.mlogb.list.req(that.paramsIn).then((res) => {
that.tableData = res; that.tableData = res;
}) })
that.$API.wpm.mlogb.list.req(that.paramsOut).then((res) => { that.getMlogItem();
that.tableData2 = res;
})
}, },
methods: { methods: {
open() { open() {
this.visible = true; this.visible = true;
}, },
getMlogItem() { getMlogItem() {
let that = this; let that = this;
that.$API.wpm.mlog.item.req(that.mlogId).then((res) => { that.$API.wpm.mlog.item.req(that.mlogId).then((res) => {
@ -505,10 +534,22 @@ export default {
that.form.test_file = res.test_file; that.form.test_file = res.test_file;
} }
that.mgroup = res.mgroup; that.mgroup = res.mgroup;
that.paramsWm.mgroup = res.mgroup;
that.materialIn = res.material_in; that.materialIn = res.material_in;
that.deptId = res.belong_dept; 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) { setData(data) {
Object.assign(this.form, data); Object.assign(this.form, data);
@ -658,6 +699,32 @@ export default {
let that = this; let that = this;
that.printVisible = true; 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> </script>