You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1615 lines
50 KiB

<template>
<div class="mod-config">
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;" >
<el-row>
<el-col :span="24" style="">
<el-form-item :label="'物料编码:'">
<el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'物料名称:'">
<el-input v-model="searchData.partDesc" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item :label="'通知单号:'">
<el-input v-model="searchData.notifyNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'检验单号:'">
<el-input v-model="searchData.orderNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'采购单号:'">
<el-input v-model="searchData.poOrderNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'采购单行号:'">
<el-input v-model="searchData.poItemNo" clearable style="width: 100px"></el-input>
</el-form-item>
<el-form-item :label="'单据状态:'">
<el-select v-model="searchData.orderStatus" clearable style="width: 100px">
<el-option label="待入库" value="待入库"></el-option>
<el-option label="已完成" value="已完成"></el-option>
</el-select>
</el-form-item>
<el-form-item label="检验日期">
<el-date-picker
style="width: 130px"
v-model="searchData.startDate"
value-format="yyyy-MM-dd"
clearable
>
</el-date-picker>
-
<el-date-picker
style="width: 130px"
v-model="searchData.endDate "
value-format="yyyy-MM-dd"
clearable
>
</el-date-picker>
</el-form-item>
<el-form-item :label="' '" >
<el-button class="customer-bun-min" type="primary" @click="getMainData" style="">查询</el-button>
<el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:height="height"
:data="mainDataList"
border
ref="mainTable"
highlight-current-row
@row-click="changeData"
v-loading="dataListLoading"
style="margin-top: 0px; width: 100%;">
<el-table-column
header-align="center"
align="center"
width="100"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="addOrUpdateHandle(scope.row)">生成标签</a>
</template>
</el-table-column>
<el-table-column
v-for="(item,index) in columnArray1" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top: 0px"
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;" >
<el-form-item >
<el-button type="primary" @click="printLabels" style="">打印</el-button>
<el-button @click="deleteLabels()" type="primary" style="margin-left: 2px">删除</el-button>
<el-button type="primary" icon="el-icon-upload" @click="openUpload()" style="margin-left: 2px">导入</el-button>
</el-form-item>
</el-form>
<el-table
:height="height"
:data="table2List"
border
ref="table3"
highlight-current-row
@selection-change="handleSelectionChange"
v-loading="dataListLoading"
style="margin-top: 0px; width: 100%;">
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column
v-for="(item,index) in columnArray2" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<el-dialog title="标签发行" :close-on-click-modal="false" v-drag :visible.sync="addModelFlag" width="800px">
<el-form :model="addModelData" label-position="top" style="margin-top: -5px;">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="物料编码" >
<el-input v-model="addModelData.partNo" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="物料名称" >
<el-input v-model="addModelData.partDesc" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="采购订单" >
<el-input v-model="addModelData.poOrderNo" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="采购订单行号">
<el-input v-model="addModelData.poItemNo" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="检验单号">
<el-input v-model="addModelData.orderNo" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="本次到货数量">
<el-input v-model="addModelData.orderQty" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="本次到货卷数">
<el-input v-model="addModelData.orderRollCount" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="检验合格数量">
<el-input v-model="addModelData.batchQualifiedQty" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="超入比例" >
<el-input v-model="addModelData.exceedInRatio" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="有效期管理">
<el-input v-model="addModelData.expirationFlag" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="生产日期" required>
<el-date-picker
v-model="addModelData.productionDate"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 100%">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="批次号">
<el-input v-model="addModelData.batchNo" style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="发行张数" required>
<el-input v-model="addModelData.rollCount" @blur="getNowRollQty()" @input="handleInput" type="number" style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="每张数量" required>
<el-input v-model="addModelData.rollQty" @blur="getNowRollQty()" type="number" style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="尾卷数量">
<el-input v-model="addModelData.tailRollQty" @blur="getNowRollQty()" type="number" style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="本次发行数量" >
<el-input v-model="addModelData.nowRollQty" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="可发行数量">
<el-input v-model="addModelData.remainingIssuableQty" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center;">
<el-button type="success" @click="submitDataNoClose()">应用</el-button>
<el-button type="success" @click="submitData()">确定</el-button>
<el-button type="primary" @click="addModelFlag=false">取消</el-button>
</div>
</el-dialog>
<!-- 导入 -->
<qcUpload ref="qcUpload" @refreshPageTables="getDetailTableList()" v-drag></qcUpload>
<!-- 标签打印对话框 -->
<el-dialog
:close-on-click-modal="false"
v-drag
:visible.sync="printDialogVisible"
width="650px"
class="print-dialog">
<div slot="title" class="dialog-title-wrapper">
<i class="el-icon-printer" style="margin-right: 8px; font-size: 20px;"></i>
<span style="font-size: 18px; font-weight: 600;">标签打印设置</span>
</div>
<div class="print-dialog-content">
<!-- 打印信息提示 -->
<div class="print-info-banner">
<i class="el-icon-info" style="margin-right: 8px; font-size: 16px;"></i>
<span>已选择 <strong style="color: #3a7ba8;">{{ selectionDataList.length }}</strong> 个标签,请配置打印参数</span>
</div>
<el-form :model="printDialogData" label-position="top" style="margin-top: 20px;">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item required>
<span slot="label" class="form-label">
<i class="el-icon-document-copy" style="margin-right: 5px;"></i>
打印次数
</span>
<el-input-number
v-model="printDialogData.printTimes"
:min="1"
:max="100"
controls-position="right"
placeholder="每个标签打印份数"
style="width: 100%">
</el-input-number>
<div class="form-tip">设置每个标签的打印份数</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item required>
<span slot="label" class="form-label">
<i class="el-icon-tickets" style="margin-right: 5px;"></i>
标签模板
</span>
<el-select
v-model="printDialogData.labelNo"
placeholder="请选择标签模板"
style="width: 100%"
:disabled="labelTemplateList.length === 0">
<el-option
v-for="item in labelTemplateList"
:key="item.labelNo"
:label="item.labelName"
:value="item.labelNo">
<span style="float: left">{{ item.labelName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.labelNo }}</span>
</el-option>
</el-select>
<div class="form-tip" v-if="labelTemplateList.length === 0" style="color: #F56C6C;">
暂无可用模板
</div>
<div class="form-tip" v-else>
根据物料自动匹配模板
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item required>
<span slot="label" class="form-label">
<i class="el-icon-printer" style="margin-right: 5px;"></i>
目标打印机
</span>
<el-select
v-model="printDialogData.printerName"
placeholder="请选择打印机"
style="width: 100%"
:disabled="printerList.length === 0">
<el-option
v-for="item in printerList"
:key="item"
:label="item"
:value="item">
<i class="el-icon-printer" style="margin-right: 8px; color: #67C23A;"></i>
{{ item }}
</el-option>
</el-select>
<div class="form-tip" v-if="printerList.length === 0" style="color: #F56C6C;">
未检测到打印机,请确保已安装并启动 CLodop
</div>
<div class="form-tip" v-else>
已检测到 {{ printerList.length }} 台打印机
</div>
</el-form-item>
</el-col>
</el-row>
<!-- 打印预览说明 -->
<div class="print-summary">
<div class="summary-item">
<span class="summary-label">打印总数:</span>
<span class="summary-value">{{ selectionDataList.length * printDialogData.printTimes }} 张</span>
</div>
<div class="summary-item">
<span class="summary-label">标签数量:</span>
<span class="summary-value">{{ selectionDataList.length }} 个</span>
</div>
<div class="summary-item">
<span class="summary-label">每标签份数:</span>
<span class="summary-value">{{ printDialogData.printTimes }} 份</span>
</div>
</div>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button
type="success"
icon="el-icon-printer"
@click="confirmPrint()"
:loading="printLoading"
:disabled="!printDialogData.labelNo || !printDialogData.printerName"
size="medium">
{{ printLoading ? '打印中...' : '开始打印' }}
</el-button>
<el-button
@click="printDialogVisible=false"
size="medium">
取消
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
/*组件*/
import excel from "@/utils/excel-util.js";
import qcUpload from "@/views/modules/qc/qc_upload";
import {
deletePoPartLabelData,
getInboundQcResultData,
getInboundQcResultOtherData,
getPoOrderRollNoOutData, getPoPartLabelData,
submitPoOrderRollNo,
getPartLabelTemplateList,
callUspPartLabelTemplate
} from '../../../api/wms/wms'
import {poPartLabelPrint} from '../clodopLabel/poPartLabel'
import getLodop from '@/utils/LodopFuncs.js'
import labelPrintTemplates from '@/mixins/labelPrintTemplates.js'
export default {
mixins: [labelPrintTemplates],
data() {
return {
functionId: this.$route.meta.menuId,
height: 200,
currentRow: {},
searchData:{
site:this.$store.state.user.site,
orderNo:'',
notifyNo: '',
partNo:'',
partDesc:'',
poOrderNo:'',
poItemNo:'',
orderStatus:'待入库',
startDate:'',
endDate:'',
page: 1,
limit: 10,
},
selectionDataList:[],
pageIndex: 1,
pageSize: 50,
totalPage: 0,
mainDataList:[],
table2List:[],
dataListLoading: false,
addModelFlag:false,
addModelData:{
expirationWarningDay:'',
site:'',
buNo:'',
partNo: '',
partDesc: '',
poOrderNo: '',
poItemNo: '',
orderNo: '',
orderQty: '',
supplierId: '',
supplierName: '',
orderRollCount: '',
batchQualifiedQty: '',
remainingIssuableQty: '',
exceedInRatio: '',
expirationFlag: '',
expirationDay: '',
nowRollQty: '',
productionDate: '',
batchNo: '',
rollCount: '1',
rollQty: '',
tailRollQty: '0'
},
columnArray1: [
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1BuNo',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "buNo",
headerAlign: "center",
align: "center",
columnLabel: "BU",
columnWidth: '70',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1NotifyNo',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "notifyNo",
headerAlign: "center",
align: "left",
columnLabel: "通知单号",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 1,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1OrderNo',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "orderNo",
headerAlign: "center",
align: "left",
columnLabel: "检验单号",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 1,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1OrderStatus',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "orderStatus",
headerAlign: "center",
align: "center",
columnLabel: "单据状态",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 2,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1PartNo',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "partNo",
headerAlign: "center",
align: "left",
columnLabel: "物料编码",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 3,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1PartDesc',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "partDesc",
headerAlign: "center",
align: "left",
columnLabel: "物料名称",
columnWidth: '200',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 4,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1OrderQty',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "orderQty",
headerAlign: "center",
align: "right",
columnLabel: "到货数量",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1RollCount',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "rollCount",
headerAlign: "center",
align: "right",
columnLabel: "到货卷数",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 11,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1BatchQualifiedQty',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "batchQualifiedQty",
headerAlign: "center",
align: "right",
columnLabel: "允许入库数",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 14,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1PoOrderNo',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "poOrderNo",
headerAlign: "center",
align: "left",
columnLabel: "采购订单号",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 5,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1PoItemNo',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "poItemNo",
headerAlign: "center",
align: "center",
columnLabel: "行号",
columnWidth: '80',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 6,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1SupplierName',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "supplierName",
headerAlign: "center",
align: "left",
columnLabel: "供应商",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 7,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1InspectorDate',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "inspectorDate",
headerAlign: "center",
align: "center",
columnLabel: "检验日期",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 8,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1InspectorNo',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "inspectorNo",
headerAlign: "center",
align: "left",
columnLabel: "检验员",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 9,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1InspectionResult',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "inspectionResult",
headerAlign: "center",
align: "center",
columnLabel: "检验结论",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 12,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table1DisposalMeasures',
tableId: "670Table1",
tableName: "采购检验合格单",
columnProp: "disposalMeasures",
headerAlign: "center",
align: "left",
columnLabel: "处置措施",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 13,
status: true,
fixed: false
},
],
columnArray2: [
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2OrderId',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "orderId",
headerAlign: "center",
align: "right",
columnLabel: "No .",
columnWidth: '50',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2RollNo',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "rollNo",
headerAlign: "center",
align: "left",
columnLabel: "标签条码",
columnWidth: '150',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 1,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2RollQty',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "rollQty",
headerAlign: "center",
align: "right",
columnLabel: "标签数量",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 2,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2HardtagInFlag',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "hardtagInFlag",
headerAlign: "center",
align: "center",
columnLabel: "标签状态",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 3,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2PrintFla',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "printFlag",
headerAlign: "center",
align: "right",
columnLabel: "打印次数",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 4,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2BatchNo',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "batchNo",
headerAlign: "center",
align: "center",
columnLabel: "批次号",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 6,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2ProductionDate',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "productionDate",
headerAlign: "center",
align: "center",
columnLabel: "生产日期",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 6,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2ExpirationDate',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "expirationDate",
headerAlign: "center",
align: "center",
columnLabel: "失效日期",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 6,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2ExpirationWarningDate',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "expirationWarningDate",
headerAlign: "center",
align: "center",
columnLabel: "失效预警日期",
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 6,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '670Table2OCreatedBy',
tableId: "670Table2",
tableName: "采购物料标签清单",
columnProp: "createdBy",
headerAlign: "center",
align: "left",
columnLabel: "操作员",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 7,
status: true,
fixed: false
}
],
exportName: '采购检验合格单'+this.dayjs().format('YYYYMMDDHHmmss'),
exportName2: '采购物料标签清单'+this.dayjs().format('YYYYMMDDHHmmss'),
// 标签打印对话框相关
printDialogVisible: false,
printDialogData: {
printTimes: 1,
labelNo: '',
printerName: ''
},
labelTemplateList: [],
printerList: [],
printLoading: false
}
},
/*组件*/
components: {
excel,
qcUpload,
},
mounted() {
this.$nextTick(() => {
this.height = ( window.innerHeight - 220)/2;
})
},
methods: {
getMainData(){
this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex
getInboundQcResultData(this.searchData).then(({data}) => {
if (data.code === 0) {
this.mainDataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
//判断是否全部存在数据
if (this.totalPage > 0) {
//设置选中行
this.$refs.mainTable.setCurrentRow(this.mainDataList[0])
this.changeData(this.mainDataList[0])
}else {
this.changeData(null)
}
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getMainData()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getMainData()
},
async exportExcel() {
this.searchData.limit = -1
this.searchData.page = 1
excel.exportTable({
url: "/wmsPrint/getInboundQcResultData",
columnMapping: this.columnArray1,//可以直接用table,不需要的列就剔除
mergeSetting: [],//需要合并的列
params: this.searchData,
fileName: this.exportName+".xlsx",
rowFetcher: res => res.data,
columnFormatter: [],
dropColumns: [],//需要剔除的列,例如dropColumns: ["netWeight"],即剔除净重列
});
},
changeData(row){
this.currentRow=JSON.parse(JSON.stringify(row))
// let inData={
// site:this.currentRow.site,
// buNo:this.currentRow.buNo,
// inspectionNo:this.currentRow.orderNo,
// }
// getPoOrderRollNoOutData(inData).then(({data}) => {
// //区分请求成功和失败的状况
// if (data && data.code == 0) {
// this.table2List = data.rows
//
// } else {
// this.table2List = [];
// }
// });
this.getDetailTableList();
},
getDetailTableList () {
let inData={
site:this.currentRow.site,
buNo:this.currentRow.buNo,
inspectionNo:this.currentRow.orderNo,
}
getPoOrderRollNoOutData(inData).then(({data}) => {
//区分请求成功和失败的状况
if (data && data.code == 0) {
this.table2List = data.rows
} else {
this.table2List = [];
}
});
},
handleSelectionChange(val){
this.selectionDataList = val
console.log(this.selectionDataList)
},
addOrUpdateHandle(row) {
getInboundQcResultOtherData(row).then(({data}) => {
//区分请求成功和失败的状况
if (data && data.code=== 0) {
let outData = data.row
console.log(data.row);
this.addModelData={
site:row.site,
buNo:row.buNo,
partNo: row.partNo,
partDesc: row.partDesc,
poOrderNo: row.poOrderNo,
poItemNo: row.poItemNo,
orderNo: row.orderNo,
orderQty: row.orderQty,
supplierId: row.supplierId,
supplierName: row.supplierName,
orderRollCount: row.rollCount,
batchQualifiedQty: row.batchQualifiedQty,
remainingIssuableQty: outData.remainingIssuableQty,
exceedInRatio: outData.exceedInRatio,
expirationFlag: outData.expirationFlag,
expirationDay:outData.expirationDay?Number(outData.expirationDay):0,
nowRollQty: row.rollQty,
productionDate: this.dayjs().format("YYYY-MM-DD"),
batchNo: '',
rollCount: '1',
rollQty: row.rollQty,
expirationWarningDay: outData.expirationWarningDay,
tailRollQty: '0'
}
if(this.addModelData.exceedInRatio==""||this.addModelData.exceedInRatio==null){
this.addModelData.exceedInRatio=0
}
}
});
this.addModelFlag = true;
},
submitData() {
// 验证必填字段
if (!this.addModelData.productionDate||this.addModelData.productionDate==='') {
this.$message.error('请选择生产日期');
return;
}
if (!this.addModelData.rollCount||this.addModelData.rollCount==='') {
this.$message.error('请输入发行张数');
return;
}
if (!this.addModelData.rollQty||this.addModelData.rollQty==='') {
this.$message.error('请输入每张数量');
return;
}
if ( this.addModelData.nowRollQty>Number(this.addModelData.remainingIssuableQty)+((Number(this.addModelData.exceedInRatio)*Number(this.addModelData.orderQty))/100)) {
this.$message.error('本次发行数量大于剩余可发行数量和超入数量');
return;
}
// 这里可以添加提交逻辑
submitPoOrderRollNo(this.addModelData).then(({data}) => {
if (data && data.code === 0) {
this.$message.success( '操作成功')
this.changeData(this.currentRow);
this.addModelFlag = false;
}else {
this.$message.error(data.msg);
}
})
},
submitDataNoClose() {
// 验证必填字段
if (!this.addModelData.productionDate||this.addModelData.productionDate==='') {
this.$message.error('请选择生产日期');
return;
}
if (!this.addModelData.rollCount||this.addModelData.rollCount==='') {
this.$message.error('请输入发行张数');
return;
}
if (!this.addModelData.rollQty||this.addModelData.rollQty==='') {
this.$message.error('请输入每张数量');
return;
}
if ( this.addModelData.nowRollQty>Number(this.addModelData.remainingIssuableQty)+((Number(this.addModelData.exceedInRatio)*Number(this.addModelData.orderQty))/100)) {
this.$message.error('本次发行数量大于剩余可发行数量和超入数量');
return;
}
// 这里可以添加提交逻辑
submitPoOrderRollNo(this.addModelData).then(({data}) => {
if (data && data.code === 0) {
this.$message.success( '操作成功')
this.changeData(this.currentRow);
let row=this.currentRow;
getInboundQcResultOtherData(row).then(({data}) => {
//区分请求成功和失败的状况
if (data && data.code=== 0) {
let outData = data.row
console.log(data.row);
this.addModelData.remainingIssuableQty= outData.remainingIssuableQty
}
});
}else {
this.$message.error(data.msg);
}
})
},
getNowRollQty(){
if(this.addModelData.tailRollQty==''||this.addModelData.tailRollQty==null||this.addModelData.tailRollQty<0){
this.addModelData.tailRollQty=0
}
if(this.addModelData.tailRollQty==0){
this.addModelData.nowRollQty=Number(this.addModelData.rollQty)*Number(this.addModelData.rollCount)
}else {
this.addModelData.nowRollQty=Number(this.addModelData.rollQty)*(Number(this.addModelData.rollCount)-1)+Number(this.addModelData.tailRollQty)
}
},
handleInput(value) {
// 1. 只保留数字
value = value.replace(/\D/g, '')
// 2. 去除前导零(0, 00, 0123 → 123)
value = value.replace(/^0+/, '')
// 3. 更新数据(触发 Vue 响应式)
this.addModelData.rollCount = value
},
async printLabels(){
if(this.selectionDataList.length===0){
this.$message.error('未选择标签!');
return false;
}
// 检查主信息是否已选择
if(!this.currentRow || !this.currentRow.site){
this.$message.error('请先选择上方的检验合格单!');
return false;
}
// 获取标签模板列表
await this.getLabelTemplates();
// 获取打印机列表
this.getPrinterList();
// 打开标签打印对话框
this.printDialogData = {
printTimes: 1,
labelNo: '',
printerName: ''
};
this.printDialogVisible = true;
},
// 获取标签模板列表
async getLabelTemplates(){
const params = {
site: this.currentRow.site,
buNo: this.currentRow.buNo,
partNo: this.currentRow.partNo
};
try {
const {data} = await getPartLabelTemplateList(params);
if (data && data.code === 0) {
this.labelTemplateList = data.list || [];
if(this.labelTemplateList.length > 0){
// 默认选中第一个
this.printDialogData.labelNo = this.labelTemplateList[0].labelNo;
}
} else {
this.$message.error(data.msg || '获取标签模板失败!');
}
} catch (error) {
console.error('获取标签模板失败:', error);
this.$message.error('获取标签模板失败!');
}
},
// 获取打印机列表
getPrinterList(){
try {
const LODOP = getLodop();
if (!LODOP) {
this.$message.error('无法连接到打印控件,请确保已安装并启动 CLodop!');
return;
}
const printerCount = LODOP.GET_PRINTER_COUNT();
this.printerList = [];
for (let i = 0; i < printerCount; i++) {
this.printerList.push(LODOP.GET_PRINTER_NAME(i));
}
if(this.printerList.length > 0){
// 默认选中第一个打印机
this.printDialogData.printerName = this.printerList[0];
}
} catch (error) {
console.error('获取打印机列表失败:', error);
this.$message.error('获取打印机列表失败!');
}
},
// 确认打印
async confirmPrint(){
// 验证必填项
if(!this.printDialogData.labelNo){
this.$message.error('请选择标签模板!');
return;
}
if(!this.printDialogData.printerName){
this.$message.error('请选择打印机!');
return;
}
this.printLoading = true;
try {
// 调用存储过程获取打印参数
const printDataList = [];
for(let i = 0; i < this.selectionDataList.length; i++){
const item = this.selectionDataList[i];
const params = {
site: this.currentRow.site,
buNo: this.currentRow.buNo,
menuID: this.$route.meta.menuId,
relatedOrderNo: this.currentRow.poOrderNo,
relatedOrderLineNo: this.currentRow.poItemNo,
documentNo: this.currentRow.notifyNo,
partNo: item.partNo,
labelNo: this.printDialogData.labelNo,
rollNo: item.rollNo
};
const {data} = await callUspPartLabelTemplate(params);
if (data && data.code === 0) {
// 确保 labelNo 字段存在(统一字段名)
const printData = {
...data.row,
labelNo: data.row.labelNo
};
printDataList.push(printData);
} else {
this.$message.error(`获取标签 ${item.rollNo} 的打印参数失败:${data.msg}`);
this.printLoading = false;
return;
}
}
// 根据 labelNo 调用相应的打印方法
await this.executePrint(printDataList);
this.printDialogVisible = false;
this.$message.success('打印任务已发送!');
this.getDetailTableList();
} catch (error) {
console.error('打印失败:', error);
this.$message.error('打印失败:' + error.message);
} finally {
this.printLoading = false;
}
},
// 执行打印
async executePrint(printDataList){
const LODOP = getLodop();
if (!LODOP) {
this.$message.error('无法连接到打印控件!');
return;
}
// 初始化打印任务
LODOP.PRINT_INIT('物料标签打印');
// 设置打印模式,隐藏水印
LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE", true);
// 设置打印机
LODOP.SET_PRINTER_INDEX(this.printDialogData.printerName);
for(let times = 0; times < this.printDialogData.printTimes; times++){
for(let i = 0; i < printDataList.length; i++){
const printData = printDataList[i];
// 根据 labelNo 调用不同的打印方法
if(printData.labelNo === 'A001'){
await this.printLabelA001(LODOP, printData, i > 0 || times > 0);
} else if(printData.labelNo === 'A002'){
await this.printLabelA002(LODOP, printData, i > 0 || times > 0);
} else if(printData.labelNo === 'A003'){
await this.printLabelA003(LODOP, printData, i > 0 || times > 0);
} else {
this.$message.warning(`未知的标签模板:${printData.labelNo}`);
}
}
}
// 预览打印(避免水印)
//LODOP.PREVIEW();
LODOP.PRINT();
},
deleteLabels(){
if(this.selectionDataList.length===0){
this.$message.error('未选择标签!');
return false;
}
for (let i = 0; i <this.selectionDataList.length ; i++) {
if(this.selectionDataList[i].hardtagInFlag!=='未入库'){
this.$message.error('存在不是未入库状态的标签无法删除!');
return false;
}
}
deletePoPartLabelData(this.selectionDataList).then(({data}) => {
if (data && data.code === 0) {
this.getDetailTableList();
this.$message.success('删除成功!');
}else {
this.$message.error(data.msg);
}
})
},
openUpload(){
if(!this.currentRow || !this.currentRow.site){
this.$message.error('请先选择上方的检验合格单!');
return false;
}
let pageData = {
flag: 'poPartPrint',
createBy: this.$store.state.user.name,
site: this.currentRow.site,
buNo: this.currentRow.buNo,
orderNo: this.currentRow.orderNo,
partNo: this.currentRow.partNo,
partDesc: this.currentRow.partDesc,
poOrderNo: this.currentRow.poOrderNo,
poItemNo: this.currentRow.poItemNo,
supplierId: this.currentRow.supplierId,
supplierName: this.currentRow.supplierName,
orderQty: this.currentRow.orderQty,
inspectionNo: this.currentRow.orderNo
}
this.$refs.qcUpload.init(pageData);
},
},
created() {
//查询报表的类型
this.getMainData();
},
}
</script>
<!--当前页面的标签样式-->
<style scoped lang="scss">
/deep/ .customer-tab .el-tabs__content {
padding: 5px !important;
}
/deep/ .el-form-item__label {
font-weight: 500;
}
/deep/ .el-form-item.is-required .el-form-item__label:before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
/deep/ .dialog-footer {
padding: 20px 0 0 0;
text-align: center;
}
/deep/ .el-dialog__body {
padding: 20px;
}
/deep/ .el-input.is-disabled .el-input__inner {
background-color: #f5f7fa;
border-color: #e4e7ed;
color: #c0c4cc;
}
/* 标签打印对话框样式 */
.print-dialog {
/deep/ .el-dialog__header {
background: linear-gradient(135deg, #9ac3d0 20%, #b6c7dd 80%);
padding: 20px 20px 20px 20px;
border-radius: 4px 4px 0 0;
}
/deep/ .el-dialog__title {
color: #ffffff;
}
/deep/ .el-dialog__headerbtn .el-dialog__close {
color: #ffffff;
font-size: 20px;
font-weight: bold;
&:hover {
color: #f0f0f0;
}
}
/deep/ .el-dialog__body {
padding: 0;
}
.dialog-title-wrapper {
color: #ffffff;
display: flex;
align-items: center;
}
.print-dialog-content {
padding: 25px 30px;
}
.print-info-banner {
background: linear-gradient(135deg, #e8f4f8 0%, #f0f5fb 100%);
border-left: 4px solid #60aeff;
padding: 12px 16px;
border-radius: 4px;
color: #606266;
font-size: 14px;
display: flex;
align-items: center;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.form-label {
font-size: 14px;
font-weight: 600;
color: #303133;
display: flex;
align-items: center;
}
.form-tip {
font-size: 12px;
color: #909399;
margin-top: 5px;
line-height: 1.5;
}
.print-summary {
background: linear-gradient(135deg, #e1f0f5 0%, #dae8f3 100%);
border-radius: 8px;
padding: 16px 20px;
margin-top: 20px;
display: flex;
justify-content: space-around;
box-shadow: 0 2px 8px rgba(96, 174, 255, 0.15);
border: 1px solid #c8dff0;
.summary-item {
display: flex;
flex-direction: column;
align-items: center;
.summary-label {
font-size: 12px;
color: #5a7a8f;
margin-bottom: 5px;
font-weight: 500;
}
.summary-value {
font-size: 20px;
font-weight: bold;
color: #3a7ba8;
}
}
}
/deep/ .el-form-item {
margin-bottom: 18px;
}
/deep/ .el-input-number {
width: 100%;
.el-input__inner {
text-align: left;
}
}
/deep/ .el-select {
.el-input__inner {
border: 1px solid #DCDFE6;
transition: all 0.3s;
&:hover {
border-color: #409EFF;
}
&:focus {
border-color: #409EFF;
}
}
}
/deep/ .dialog-footer {
padding: 15px 30px 25px 30px;
text-align: center;
background-color: #fafafa;
border-top: 1px solid #e8e8e8;
.el-button {
min-width: 120px;
height: 40px;
font-weight: 500;
transition: all 0.3s;
font-size: 15px;
}
.el-button--success {
background: linear-gradient(135deg, #67C23A 0%, #85ce61 100%);
border: none;
box-shadow: 0 2px 4px rgba(103, 194, 58, 0.3);
&:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(103, 194, 58, 0.4);
}
&:active {
transform: translateY(0);
}
}
}
}
/* 选项样式优化 */
/deep/ .el-select-dropdown__item {
padding: 10px 20px;
transition: all 0.2s;
&:hover {
background-color: #f5f7fa;
}
}
/* 输入框聚焦效果 */
/deep/ .el-input__inner:focus,
/deep/ .el-textarea__inner:focus {
border-color: #409EFF;
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
}
</style>