Commit d0dc7ade authored by 沈翠玲's avatar 沈翠玲

包装标签打印

parent 417e4ab0
<template> <template>
<div class="app-container"> <div class="app-container">
<el-row style="display: flex;" :gutter="16"> <el-row style="display: flex" :gutter="16">
<el-col :span="8" > <el-col :span="8">
<el-card style="min-height: 700px;"> <el-card style="min-height: 700px">
<el-form <el-form
:model="queryParams" :model="queryParams"
ref="queryForm" ref="queryForm"
...@@ -52,30 +52,44 @@ ...@@ -52,30 +52,44 @@
<el-table-column width="50" align="center"> <el-table-column width="50" align="center">
<template v-slot="scope"> <template v-slot="scope">
<!-- 可以手动的修改label的值,从而控制选择哪一项 --> <!-- 可以手动的修改label的值,从而控制选择哪一项 -->
<el-radio class="radio" v-model="selectedItemId" :label="scope.row.workorderCode" <el-radio
>{{ "" }}</el-radio class="radio"
v-model="selectedItemId"
:label="scope.row.workorderCode"
>{{ '' }}</el-radio
> >
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="生产单号" align="center" prop="workorderCode" /> <el-table-column
<el-table-column label="销售单号" align="center" prop="sourceCode" /> label="生产单号"
<el-table-column label="数量" width="80" align="center" prop="quantity" /> align="center"
prop="workorderCode"
/>
<el-table-column
label="销售单号"
align="center"
prop="sourceCode"
/>
<el-table-column
label="数量"
width="80"
align="center"
prop="quantity"
/>
</el-table> </el-table>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="16"> <el-col :span="16">
<el-card style="height: 240px;margin-bottom:10px;"> <el-card style="height: 240px; margin-bottom: 10px">
<el-button <el-button type="primary" plain size="mini" @click="handleProduce"
type="primary" >生成</el-button
plain >
size="mini"
@click="handleProduce"
>生成</el-button>
<el-form <el-form
:model="produceForm" :model="produceForm"
ref="produceForm" ref="produceForm"
size="small" size="small"
label-width="130px" label-width="130px"
:rules="rules"
> >
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
...@@ -103,6 +117,26 @@ ...@@ -103,6 +117,26 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="包装类型:" prop="packType">
<el-select v-model.number="produceForm.packType">
<el-option
v-for="dict in dict.type.mes_package_type"
:key="dict.value"
:label="dict.label"
:value="Number(dict.value)"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="合并包装:" prop="mergePack">
<el-radio-group v-model="produceForm.mergePack">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="检验员:" prop="checkBy"> <el-form-item label="检验员:" prop="checkBy">
<el-input <el-input
...@@ -128,7 +162,7 @@ ...@@ -128,7 +162,7 @@
<el-date-picker <el-date-picker
v-model="produceForm.inputTime" v-model="produceForm.inputTime"
type="datetime" type="datetime"
style="width:100%;" style="width: 100%"
value-format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm"
format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm"
placeholder="请选择录入时间" placeholder="请选择录入时间"
...@@ -136,7 +170,6 @@ ...@@ -136,7 +170,6 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
...@@ -147,15 +180,12 @@ ...@@ -147,15 +180,12 @@
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
<el-card style="min-height: 450px;"> <el-card style="min-height: 450px">
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="primary" plain size="mini" @click="handleSave"
type="primary" >保存</el-button
plain >
size="mini"
@click="handleSave"
>保存</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
...@@ -163,7 +193,8 @@ ...@@ -163,7 +193,8 @@
plain plain
size="mini" size="mini"
@click="handleChooseTemplate" @click="handleChooseTemplate"
>打印</el-button> >打印</el-button
>
</el-col> </el-col>
<right-toolbar <right-toolbar
:showSearch.sync="showSearch" :showSearch.sync="showSearch"
...@@ -176,7 +207,12 @@ ...@@ -176,7 +207,12 @@
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="备注" width="150" align="center" prop="remark" > <el-table-column
label="备注"
width="150"
align="center"
prop="remark"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model="scope.row.remark" v-model="scope.row.remark"
...@@ -185,26 +221,77 @@ ...@@ -185,26 +221,77 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="净重" width="150" align="center" prop="netWeight" > <el-table-column
label="净重"
width="150"
align="center"
prop="netWeight"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model="scope.row.netWeight" v-model="scope.row.netWeight"
placeholder="请输入净重" placeholder="请输入净重"
clearable clearable
style="width: 100%;" style="width: 100%"
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="指令" width="80" align="center" prop="directive" /> <el-table-column
<el-table-column label="SIZE" width="80" align="center" prop="standardSize" /> label="指令"
<el-table-column label="条码" width="150" align="center" prop="barcode" /> width="80"
<el-table-column label="序号" width="80" align="center" prop="sheetCount" /> align="center"
<el-table-column label="数量" width="80" align="center" prop="packageNum" /> prop="directive"
<el-table-column label="LOSS数量" width="100" align="center" prop="lossNum" /> />
<el-table-column label="打印次数" width="100" align="center" prop="printTime" /> <el-table-column
<el-table-column label="超报工" width="150" align="center" prop="isSurplus" > label="SIZE"
width="80"
align="center"
prop="standardSize"
/>
<el-table-column
label="条码"
width="150"
align="center"
prop="barcode"
/>
<el-table-column
label="序号"
width="80"
align="center"
prop="sheetCount"
/>
<el-table-column
label="数量"
width="80"
align="center"
prop="packageNum"
/>
<el-table-column
label="LOSS数量"
width="100"
align="center"
prop="lossNum"
/>
<el-table-column
label="样品数"
width="100"
align="center"
prop="sampleNum"
/>
<el-table-column
label="打印次数"
width="100"
align="center"
prop="printTime"
/>
<el-table-column
label="超报工"
width="150"
align="center"
prop="isSurplus"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.isSurplus ? '是' : '否'}} {{ scope.row.isSurplus ? '是' : '否' }}
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -221,8 +308,19 @@ ...@@ -221,8 +308,19 @@
</el-row> </el-row>
<!-- 选择打印模版对话框 --> <!-- 选择打印模版对话框 -->
<el-dialog title="选择打印模版" :visible.sync="visible" width="960px" append-to-body> <el-dialog
<templatePrint ref="templatePrintRef" v-if="visible" type="single" reportType='package_label' :operation="false"></templatePrint> title="选择打印模版"
:visible.sync="visible"
width="960px"
append-to-body
>
<templatePrint
ref="templatePrintRef"
v-if="visible"
type="single"
reportType="package_label"
:operation="false"
></templatePrint>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSubmitPrint">确 定</el-button> <el-button type="primary" @click="handleSubmitPrint">确 定</el-button>
<el-button @click="visible = false">取 消</el-button> <el-button @click="visible = false">取 消</el-button>
...@@ -232,12 +330,20 @@ ...@@ -232,12 +330,20 @@
</template> </template>
<script> <script>
import { workorderList, workorderLinkInfo, buildPackagePrint, workorderPackageList, updatePackagePrintRecord, packagePrintRecordInfo } from "@/api/mes/pro/packageLablePrint"; import {
workorderList,
workorderLinkInfo,
buildPackagePrint,
workorderPackageList,
updatePackagePrintRecord,
packagePrintRecordInfo,
} from '@/api/mes/pro/packageLablePrint'
import templatePrint from '@/views/mes/report/index' import templatePrint from '@/views/mes/report/index'
import { postBatchPrintPdf } from '@/utils/ruoyi' import { postBatchPrintPdf } from '@/utils/ruoyi'
export default { export default {
name: 'packageLablePrint', name: 'packageLablePrint',
components: { templatePrint }, components: { templatePrint },
dicts: ['mes_package_type'],
data() { data() {
return { return {
// 查询参数 // 查询参数
...@@ -245,6 +351,11 @@ export default { ...@@ -245,6 +351,11 @@ export default {
arrangeCode: null, arrangeCode: null,
workorderCode: null, workorderCode: null,
}, },
rules: {
packType: [
{ required: true, trigger: 'blur', message: '包装类型必选' },
],
},
// 显示搜索条件 // 显示搜索条件
showSearch: true, showSearch: true,
loading: false, loading: false,
...@@ -252,21 +363,23 @@ export default { ...@@ -252,21 +363,23 @@ export default {
produceForm: { produceForm: {
packNum: '', packNum: '',
checkBy: '', checkBy: '',
mergePack: false,
packType: '',
inputBy: '', inputBy: '',
inputTime: '', inputTime: '',
encasementNum: '' encasementNum: '',
}, },
loadingPackage: false, loadingPackage: false,
queryPackageParams: { queryPackageParams: {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10,
}, },
tablePackageList: [], tablePackageList: [],
packageTotal: 0, packageTotal: 0,
currentData: {}, currentData: {},
selectedItemId: null, selectedItemId: null,
selectPackageTable: [], selectPackageTable: [],
visible: false visible: false,
} }
}, },
created() { created() {
...@@ -275,81 +388,87 @@ export default { ...@@ -275,81 +388,87 @@ export default {
methods: { methods: {
/** 查询工单列表 */ /** 查询工单列表 */
getList() { getList() {
if (!this.queryParams.arrangeCode&&!this.queryParams.workorderCode) { if (!this.queryParams.arrangeCode && !this.queryParams.workorderCode) {
this.$message.error('请输入查询条件') this.$message.error('请输入查询条件')
return return
} }
this.loading = true; this.loading = true
workorderList(this.queryParams).then((response) => { workorderList(this.queryParams).then((response) => {
console.log(response, 'response') console.log(response, 'response')
this.tableList = response.rows; this.tableList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
this.produceForm = {} this.produceForm = {}
this.selectedItemId = null this.selectedItemId = null
}); })
}, },
/** 查询标签列表 */ /** 查询标签列表 */
getPackageList() { getPackageList() {
this.loadingPackage = true; this.loadingPackage = true
this.queryPackageParams.workorderId = this.produceForm.workorderId this.queryPackageParams.workorderId = this.produceForm.workorderId
workorderPackageList(this.queryPackageParams).then((response) => { workorderPackageList(this.queryPackageParams).then((response) => {
console.log(response, 'response') console.log(response, 'response')
this.tablePackageList = response.rows; this.tablePackageList = response.rows
this.packageTotal = response.total; this.packageTotal = response.total
this.loadingPackage = false; this.loadingPackage = false
}); })
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
handleSave() { handleSave() {
if(!this.validSelect()) { if (!this.validSelect()) {
return return
} }
updatePackagePrintRecord(this.tablePackageList).then((response) => { updatePackagePrintRecord(this.tablePackageList).then((response) => {
console.log(response, 'response') console.log(response, 'response')
if (response.code === 200) { if (response.code === 200) {
this.getPackageList() this.getPackageList()
} }
}); })
}, },
handleProduce() { handleProduce() {
if(!this.validSelect()) { if (!this.validSelect()) {
return return
}
const params = {
"encasementNum": this.produceForm.encasementNum,
"checkBy": this.produceForm.checkBy,
"inputBy": this.produceForm.inputBy,
"inputTime": this.produceForm.inputTime,
"packNum": Number(this.produceForm.packNum),
"workorderId": this.produceForm.workorderId
} }
buildPackagePrint(params).then((response) => { this.$refs['produceForm'].validate((valid) => {
console.log(response, 'response') if (valid) {
if (response.code === 200) { const params = {
this.$message.success('生成成功!') encasementNum: this.produceForm.encasementNum,
this.getPackageList() checkBy: this.produceForm.checkBy,
mergePack: this.produceForm.mergePack,
packType: this.produceForm.packType,
inputBy: this.produceForm.inputBy,
inputTime: this.produceForm.inputTime,
packNum: Number(this.produceForm.packNum),
workorderId: this.produceForm.workorderId,
}
buildPackagePrint(params).then((response) => {
console.log(response, 'response')
if (response.code === 200) {
this.$message.success('生成成功!')
this.getPackageList()
}
})
} }
}); })
}, },
handleChooseTemplate() { handleChooseTemplate() {
if (!this.validSelect()) { if (!this.validSelect()) {
return return
} }
if (this.selectPackageTable.length === 0) { if (this.selectPackageTable.length === 0) {
this.$message.warning('请至少选择一条数据') this.$message.warning('请至少选择一条数据')
return return
} }
this.visible = true this.visible = true
}, },
handleSubmitPrint() { handleSubmitPrint() {
if (!this.$refs.templatePrintRef.selectedItemId) { if (!this.$refs.templatePrintRef.selectedItemId) {
...@@ -358,26 +477,26 @@ export default { ...@@ -358,26 +477,26 @@ export default {
} }
const forms = new FormData() const forms = new FormData()
forms.append('workorderId', this.produceForm.workorderId) forms.append('workorderId', this.produceForm.workorderId)
this.selectPackageTable.forEach(item => { this.selectPackageTable.forEach((item) => {
forms.append('recordIds', item.recordId) forms.append('recordIds', item.recordId)
}) })
packagePrintRecordInfo(forms).then((response) => { packagePrintRecordInfo(forms).then((response) => {
console.log(response, 'response') console.log(response, 'response')
if (response.code === 200) { if (response.code === 200) {
const valueList = response.data.map(item => { const valueList = response.data.map((item) => {
return { return {
packagePrint: item packagePrint: item,
} }
}) })
postBatchPrintPdf( postBatchPrintPdf(
this.$refs.templatePrintRef.currentData.name, this.$refs.templatePrintRef.currentData.name,
valueList valueList
).then(()=> { ).then(() => {
this.visible = false this.visible = false
this.getPackageList() this.getPackageList()
}) })
} }
}); })
}, },
validSelect() { validSelect() {
if (this.selectedItemId) { if (this.selectedItemId) {
...@@ -388,31 +507,38 @@ export default { ...@@ -388,31 +507,38 @@ export default {
}, },
handleCurrentChange(row) { handleCurrentChange(row) {
console.log(row, 'row88') console.log(row, 'row88')
workorderLinkInfo({workorderId: row.workorderId}).then((response) => { workorderLinkInfo({ workorderId: row.workorderId }).then((response) => {
console.log(response, 'response') console.log(response, 'response')
if (response.code === 200) { if (response.code === 200) {
this.produceForm = Object.assign({},row) this.produceForm = Object.assign({}, row)
// this.produceForm.packNum = response.data.packNum // this.produceForm.packNum = response.data.packNum
// this.produceForm.encasementNum = response.data.encasementNum || '' // this.produceForm.encasementNum = response.data.encasementNum || ''
this.$set(this.produceForm, 'packNum', response.data.usagePackNum || '') this.$set(
this.$set(this.produceForm, 'encasementNum', response.data.usageEncasementNum || '') this.produceForm,
'packNum',
response.data.usagePackNum || ''
)
this.$set(
this.produceForm,
'encasementNum',
response.data.usageEncasementNum || ''
)
this.selectedItemId = row.workorderCode this.selectedItemId = row.workorderCode
this.queryPackageParams = { this.queryPackageParams = {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10,
} }
this.getPackageList() this.getPackageList()
} }
}); })
}, },
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectPackageTable = selection this.selectPackageTable = selection
} },
} },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment