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.
 
 
 
 
 

1096 lines
40 KiB

<template>
<div class="mod-config">
<el-form :inline="true" label-position="top">
<el-form-item :label="$t('warehouse.label.inStockStatus')">
<el-select v-model="queryHeaderData.inStockFlag" :placeholder="$t('warehouse.common.select')" style="width: 120px;">
<el-option :label="$t('warehouse.common.all')" value=""></el-option>
<el-option :label="$t('warehouse.label.notInStock')" value="X"></el-option>
<el-option :label="$t('warehouse.label.outbound')" value="N"></el-option>
<el-option :label="$t('warehouse.label.inStock')" value="Y"></el-option>
</el-select>
</el-form-item>
<!-- 本期盘点筛选,空=全部不入 SQL - rqrq -->
<el-form-item :label="$t('warehouse.label.countFlag')">
<el-select v-model="queryHeaderData.countFlag" :placeholder="$t('warehouse.common.select')" style="width: 120px;">
<el-option :label="$t('warehouse.label.countFlagAll')" value=""></el-option>
<el-option label="Y" value="Y"></el-option>
<el-option label="N" value="N"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('warehouse.label.partNoLike')">
<el-input style="width: 120px;" v-model="queryHeaderData.partNo" :placeholder="$t('warehouse.label.partNoLikePlaceholder')" @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="$t('warehouse.label.batchNo')">
<el-input style="width: 120px;" v-model="queryHeaderData.batchNo" :placeholder="$t('warehouse.label.batchNoPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="$t('warehouse.label.location')">
<el-input style="width: 120px;" v-model="queryHeaderData.locationId" :placeholder="$t('warehouse.label.locationPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="$t('warehouse.label.labelNo')">
<el-input style="width: 120px;" v-model="queryHeaderData.unitId" :placeholder="$t('warehouse.label.labelNoPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="$t('warehouse.label.partDesc')">
<el-input style="width: 120px;" v-model="queryHeaderData.partDesc" :placeholder="$t('warehouse.label.partDescPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="$t('warehouse.label.supplierBatchNo')">
<el-input style="width: 120px;" v-model="queryHeaderData.supplierBatchNo" :placeholder="$t('warehouse.label.supplierBatchNoPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
</el-form-item>
<el-form-item :label="$t('warehouse.label.sourceType')">
<el-select v-model="queryHeaderData.sourceType" :placeholder="$t('warehouse.common.select')" style="width: 120px;">
<el-option :label="$t('warehouse.common.all')" value=""></el-option>
<el-option :label="$t('warehouse.label.sourceInit')" value="IFS_INIT"></el-option>
<el-option :label="$t('warehouse.label.sourcePoReceive')" value="PO_RECEIVE"></el-option>
<el-option :label="$t('warehouse.label.sourceShopOrderReceive')" value="SHOP_ORDER_RECEIVEY"></el-option>
<el-option :label="$t('warehouse.label.sourceSalesReturn')" value="SALES_RETURN_RECEIVE"></el-option>
<el-option :label="$t('warehouse.label.sourceProreCreate')" value="PRORE_CREATE"></el-option>
<el-option :label="$t('warehouse.label.sourceOutreCreate')" value="OUTRE_CREATE"></el-option>
<el-option :label="$t('warehouse.label.sourceSplit')" value="SPLIT"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('warehouse.label.createdDate')">
<el-date-picker
v-model="queryHeaderData.startDate"
type="date"
:placeholder="$t('warehouse.label.datePlaceholder')"
style="width: 120px;">
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('warehouse.common.to')">
<el-date-picker
v-model="queryHeaderData.endDate"
type="date"
:placeholder="$t('warehouse.label.datePlaceholder')"
style="width: 120px;">
</el-date-picker>
</el-form-item>
<el-form-item style="margin-top: 20px;">
<el-button @click="getDataList()" type="primary">{{ $t('warehouse.common.search') }}</el-button>
<el-button @click="resetQuery()" type="default">{{ $t('warehouse.common.reset') }}</el-button>
<el-button @click="showOtherInboundDialog()" type="success">{{ $t('warehouse.label.otherInboundPrint') }}</el-button>
<el-button @click="showFailedPrintTasksDialog()" type="warning">{{ $t('warehouse.label.failedPrintRetry') }}</el-button>
<!-- 导出按钮 - rqrq -->
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
:worksheet="$t('warehouse.common.exportWorksheet')"
class="el-button el-button--primary el-button--medium">
{{ $t('warehouse.common.download') }}
</download-excel>
</el-form-item>
</el-form>
<el-table
id="labelQueryTable"
:height="height"
:data="dataList"
border
v-loading="dataListLoading || printLoading"
:element-loading-text="loadingText"
style="width: 100%; margin-bottom: 15px;">
<!-- 动态列配置 - rqrq -->
<el-table-column
v-for="(item,index) in columnList" :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.columnProp === 'inStockFlag'">
<span v-if="scope.row.inStockFlag === 'Y'" type="success">{{ $t('warehouse.label.inStock') }}</span>
<span v-else-if="scope.row.inStockFlag === 'N'" type="info">{{ $t('warehouse.label.outbound') }}</span>
<span v-else-if="scope.row.inStockFlag === 'X'" type="warning">{{ $t('warehouse.label.notInStock') }}</span>
<span v-else>{{ scope.row.inStockFlag }}</span>
</span>
<span v-else-if="item.columnProp === 'lastPrintDate' || item.columnProp === 'createdDate' || item.columnProp === 'lastCountDate'">
{{ formatDate(scope.row[item.columnProp]) }}
</span>
<span v-else-if="item.columnProp === 'countFlag'">
<span v-if="scope.row.countFlag === 'Y'">Y</span>
<span v-else-if="scope.row.countFlag === 'N'">N</span>
<span v-else>{{ scope.row.countFlag }}</span>
</span>
<span v-else-if="item.columnProp === 'reserveFlag'">
{{ scope.row.reserveFlag === 'Y' ? $t('warehouse.common.yes') : $t('warehouse.common.no') }}
</span>
<span v-else>{{ scope.row[item.columnProp] }}</span>
</template>
</el-table-column>
<!-- 操作列 - rqrq -->
<el-table-column :label="$t('warehouse.common.operation')" min-width="150" fixed="right" header-align="center" align="center">
<template slot-scope="scope">
<a
@click="reprintLabel(scope.row)"
type="primary"
:loading="scope.row.printing">
{{ $t('warehouse.label.reprintLabel') }}
</a>
<a
@click="deleteLabel(scope.row)"
type="danger"
style="color: #f56c6c;">
{{ $t('warehouse.common.delete') }}
</a>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 其它入库标签打印弹窗 -->
<el-dialog
:title="$t('warehouse.label.otherInboundDialogTitle')"
:visible.sync="otherInboundVisible"
width="450px"
:close-on-click-modal="false">
<el-form :model="otherInboundForm" ref="otherInboundForm" class="other-inbound-form">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('warehouse.inventory.part')" prop="partNo" class="form-item-vertical">
<el-input v-model="otherInboundForm.partNo" :placeholder="$t('warehouse.label.partNoPlaceholder')"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('warehouse.inventory.description')" prop="partDesc" class="form-item-vertical">
<el-input v-model="otherInboundForm.partDesc" :placeholder="$t('warehouse.label.partDescPlaceholder')"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('warehouse.label.batchNo')" prop="batchNo" class="form-item-vertical">
<el-input v-model="otherInboundForm.batchNo" :placeholder="$t('warehouse.label.batchNoPlaceholder')"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="WDR" prop="wdr" class="form-item-vertical">
<el-input v-model="otherInboundForm.wdr" :placeholder="$t('warehouse.label.wdrPlaceholder')" value="*"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('warehouse.inventory.qty')" prop="qty" class="form-item-vertical">
<el-input
v-model="otherInboundForm.qty"
:min="0.01"
:precision="2"
style="width: 100%"
:placeholder="$t('warehouse.label.qtyPlaceholder')">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('warehouse.label.packageCount')" prop="packageCount" class="form-item-vertical">
<el-input
v-model="otherInboundForm.packageCount"
:min="1"
style="width: 100%"
:placeholder="$t('warehouse.label.packageCountPlaceholder')">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('warehouse.label.height')" prop="height" class="form-item-vertical">
<el-input v-model="otherInboundForm.height"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('warehouse.label.expiredDate')" class="form-item-vertical">
<el-date-picker
v-model="otherInboundForm.expiredDate"
type="date"
:placeholder="$t('warehouse.label.expiredDatePlaceholder')"
style="width: 100%"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="otherInboundVisible = false">{{ $t('warehouse.common.cancel') }}</el-button>
<el-button type="primary" @click="createOtherInboundHU()" :loading="otherInboundLoading">{{ $t('warehouse.label.saveAndPrint') }}</el-button>
</div>
</el-dialog>
<!-- 失败打印任务重试弹窗 -->
<el-dialog
:title="$t('warehouse.label.failedPrintTasksTitle')"
:visible.sync="failedPrintTasksVisible"
width="600px"
:close-on-click-modal="false">
<el-table
:data="failedPrintTasksList"
border
stripe
v-loading="failedPrintTasksLoading"
max-height="400"
style="width: 100%">
<el-table-column
prop="unitId"
:label="$t('warehouse.label.labelNo')"
min-width="150"
align="center"
header-align="center">
</el-table-column>
<el-table-column
prop="printerIp"
:label="$t('warehouse.label.printerIp')"
min-width="120"
align="center"
header-align="center">
</el-table-column>
<el-table-column
prop="retryCount"
:label="$t('warehouse.label.printTimes')"
width="80"
align="center"
header-align="center">
</el-table-column>
<el-table-column
prop="createdDate"
:label="$t('warehouse.label.createdTime')"
min-width="150"
align="center"
header-align="center">
<template slot-scope="scope">
{{ formatDate(scope.row.createdDate) }}
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="failedPrintTasksVisible = false">{{ $t('warehouse.common.cancel') }}</el-button>
<el-button type="primary" @click="retryAllFailedTasks()" :loading="retryLoading">{{ $t('warehouse.label.retryAll') }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getHandlingUnitLabelList, reprintLabel, deleteLabel, getFailedPrintTasks, retryFailedPrintTasks } from '@/api/warehouse/labelQuery'
import { searchSysLanguagePackList, saveUserFavorite, searchUserFavorite } from '@/api/sysLanguage'
import { createOtherInboundHU, printLabel } from '@/api/warehouse/otherInbound'
export default {
data() {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 50,
totalPage: 0,
dataListLoading: false,
printLoading: false,
loadingText: this.$t('warehouse.common.loading'),
dataListSelections: [],
favorite: false,
height: 500,
// 表格列配置 - rqrq
columnList: [
{
columnProp: "unitId",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.labelNo'),
columnWidth: 150,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "partNo",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.inventory.part'),
columnWidth: 120,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "partDesc",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.inventory.description'),
columnWidth: 150,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "batchNo",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.batchNo'),
columnWidth: 120,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "locationId",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.location'),
columnWidth: 100,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "warehouseId",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.warehouse.code'),
columnWidth: 100,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "wdr",
headerAlign: "center",
align: "center",
columnLabel: "WDR",
columnWidth: 100,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "engChgLevel",
headerAlign: "center",
align: "center",
columnLabel: "engChgLevel",
columnWidth: 100,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "expiredDate",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.expiredDate'),
columnWidth: 130,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "qty",
headerAlign: "center",
align: "right",
columnLabel: this.$t('warehouse.inventory.qty'),
columnWidth: 80,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "inStockFlag",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.inStockStatus'),
columnWidth: 80,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "supplierBatchNo",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.supplierBatchNo'),
columnWidth: 100,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "supplierManufactureDate",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.supplierManufactureDate'),
columnWidth: 100,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "countFlag",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.countFlag'),
columnWidth: 90,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "lastCountDate",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.lastCountDate'),
columnWidth: 150,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "printCount",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.printTimes'),
columnWidth: 80,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "lastPrintDate",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.lastPrintTime'),
columnWidth: 150,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "createdDate",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.createdTime'),
columnWidth: 150,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "height",
headerAlign: "center",
align: "right",
columnLabel: this.$t('warehouse.label.height'),
columnWidth: 100,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "sourceType",
headerAlign: "center",
align: "left",
columnLabel: this.$t('warehouse.label.sourceType'),
columnWidth: 100,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "remark",
headerAlign: "center",
align: "left",
columnLabel: this.$t('warehouse.label.remark'),
columnWidth: 100,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "reserveFlag",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.reserveFlag'),
columnWidth: 80,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "reserveOrderRef1",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.reserveOrderRef1'),
columnWidth: 120,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "reserveOrderRef2",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.reserveOrderRef2'),
columnWidth: 120,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
},
{
columnProp: "reserveOrderRef3",
headerAlign: "center",
align: "center",
columnLabel: this.$t('warehouse.label.reserveOrderRef3'),
columnWidth: 120,
columnSortable: false,
showOverflowTooltip: true,
fixed: ""
}
],
queryHeaderData: {
inStockFlag: '',
countFlag: '',
partNo: '',
batchNo: '',
locationId: '',
unitId: '',
partDesc: '',
sourceType: '',
startDate: '',
endDate: '',
},
// 打印相关配置
reportId: 'HU_LABEL', // 默认报表ID,可根据实际情况调整
zplCode: '', // ZPL代码
paperSize: 'A4',
orientation: 'portrait',
dpi: 203,
// 其它入库标签打印相关
otherInboundVisible: false,
otherInboundLoading: false,
otherInboundForm: {
partNo: '',
partDesc: '',
batchNo: '',
locationId: '',
warehouseId: '',
wdr: '*',
qty: 1,
umId: '个',
packageCount: 1,
manufactureDate: '',
expiredDate: '',
remark: ''
},
// 导出相关 - rqrq
exportData: [],
exportName: this.$t('warehouse.label.query') + this.dayjs().format('YYYYMMDDHHmmss'),
exportHeader: [this.$t('warehouse.label.query')],
exportFooter: [],
otherInboundRules: {
partNo: [
{ required: true, message: this.$t('warehouse.label.partNoRequired'), trigger: 'blur' }
],
partDesc: [
{ required: true, message: this.$t('warehouse.label.partDescRequired'), trigger: 'blur' }
],
batchNo: [
{ required: true, message: this.$t('warehouse.label.batchNoRequired'), trigger: 'blur' }
],
locationId: [
{ required: true, message: this.$t('warehouse.label.locationRequired'), trigger: 'blur' }
],
warehouseId: [
{ required: true, message: this.$t('warehouse.label.warehouseRequired'), trigger: 'blur' }
],
qty: [
{ required: true, message: this.$t('warehouse.inventory.qtyRequired'), trigger: 'blur' },
{ type: 'number', min: 0.01, message: this.$t('warehouse.inventory.qtyPositive'), trigger: 'blur' }
],
umId: [
{ required: true, message: this.$t('warehouse.label.umIdRequired'), trigger: 'blur' }
],
packageCount: [
{ required: true, message: this.$t('warehouse.label.packageCountRequired'), trigger: 'blur' },
{ type: 'number', min: 1, message: this.$t('warehouse.label.packageCountMin'), trigger: 'blur' }
]
},
// 失败打印任务相关
failedPrintTasksVisible: false,
failedPrintTasksLoading: false,
failedPrintTasksList: [],
retryLoading: false
}
},
activated() {
this.getDataList()
this.getHeight()
},
mounted() {
this.getDataList()
this.getHeight()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true
const params = {
page: this.pageIndex,
size: this.pageSize,
site: localStorage.getItem('site'),
...this.queryHeaderData
}
getHandlingUnitLabelList(params).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list || []
this.totalPage = data.page.totalCount || 0
} else {
this.dataList = []
this.totalPage = 0
this.$alert(data.msg || this.$t('warehouse.message.queryFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
}
this.dataListLoading = false
}).catch(() => {
this.dataList = []
this.totalPage = 0
this.dataListLoading = false
})
},
// 重置查询条件
resetQuery() {
this.queryHeaderData = {
inStockFlag: '',
countFlag: '',
partNo: '',
batchNo: '',
locationId: '',
unitId: '',
partDesc: '',
sourceType: '',
startDate: '',
endDate: '',
}
this.pageIndex = 1
this.getDataList()
},
// 重打标签
async reprintLabel(row) {
try {
// 设置页面打印状态
this.printLoading = true
this.loadingText = this.$t('warehouse.label.printingByUnit', { unitId: row.unitId })
// 设置行打印状态
this.$set(row, 'printing', true)
let printLabelType;
if (row.partNo && row.partNo.startsWith("80")) {
printLabelType = '库存成品标签';
} else {
printLabelType = 'BIL标签';
}
const printRequest = {
reportId: this.reportId,
zplCode: this.zplCode,
paperSize: this.paperSize,
orientation: this.orientation,
dpi: this.dpi,
userId: localStorage.getItem('userName'),
username: localStorage.getItem('userName'),
site: localStorage.getItem('site'),
unitId: row.unitId,
labelType:printLabelType
}
const { data } = await reprintLabel(printRequest)
if (data && data.code === 0) {
this.$message.success(this.$t('warehouse.label.printSuccess'))
// 刷新当前行数据
this.getDataList()
} else {
this.$alert(data.msg || this.$t('warehouse.label.printFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
}
} catch (error) {
this.$alert(this.$t('warehouse.label.printFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
} finally {
// 清除页面打印状态
this.printLoading = false
this.loadingText = this.$t('warehouse.common.loading')
// 清除行打印状态
this.$set(row, 'printing', false)
}
},
// 删除标签
deleteLabel(row) {
this.$confirm(this.$t('warehouse.label.deleteConfirmContent', { unitId: row.unitId }), this.$t('warehouse.label.deleteConfirmTitle'), {
confirmButtonText: this.$t('warehouse.label.deleteConfirmButton'),
cancelButtonText: this.$t('warehouse.common.cancel'),
type: 'warning'
}).then(async () => {
try {
this.dataListLoading = true
const { data } = await deleteLabel({
site: localStorage.getItem('site'),
unitId: row.unitId
})
if (data && data.code === 0) {
this.$message.success(this.$t('warehouse.message.deleteSuccess'))
// 刷新数据列表
this.getDataList()
} else {
this.$alert(data.msg || this.$t('warehouse.message.deleteFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
}
} catch (error) {
this.$alert(this.$t('warehouse.label.deleteFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
} finally {
this.dataListLoading = false
}
}).catch(() => {
// 用户取消删除
})
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
// 格式化日期
formatDate(date) {
if (!date) return ''
const d = new Date(date)
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
const hours = String(d.getHours()).padStart(2, '0')
const minutes = String(d.getMinutes()).padStart(2, '0')
const seconds = String(d.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
},
// 导出相关方法 - rqrq
async createExportData() {
const queryParams = {
site: localStorage.getItem('site'),
...this.queryHeaderData,
page: 1,
size: 999999 // 设置一个很大的数字来获取全部数据 - rqrq
}
const {data} = await getHandlingUnitLabelList(queryParams)
if (data && data.code === 0) {
return (data.page.list || []).map(item => {
return {
...item,
inStockFlag: item.inStockFlag === 'Y' ? this.$t('warehouse.label.inStock') : item.inStockFlag === 'N' ? this.$t('warehouse.label.outbound') : item.inStockFlag === 'X' ? this.$t('warehouse.label.notInStock') : item.inStockFlag,
reserveFlag: item.reserveFlag === 'Y' ? this.$t('warehouse.common.yes') : this.$t('warehouse.common.no'),
lastPrintDate: this.formatDate(item.lastPrintDate),
createdDate: this.formatDate(item.createdDate),
lastCountDate: this.formatDate(item.lastCountDate)
}
})
}
return []
},
startDownload() {
// 开始导出 - rqrq
},
finishDownload() {
// 导出完成 - rqrq
},
fields() {
let json = "{"
this.columnList.forEach((item, index) => {
if (index == this.columnList.length - 1) {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
} else {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
}
})
json += "}"
let s = eval("(" + json + ")")
return s
},
// 获取表格高度
getHeight() {
this.$nextTick(() => {
this.height = window.innerHeight - 280
})
},
// 显示其它入库标签打印对话框
showOtherInboundDialog() {
this.otherInboundVisible = true
// 重置表单
this.otherInboundForm = {
partNo: '',
partDesc: '',
batchNo: '',
locationId: '',
warehouseId: '',
wdr: '*',
qty: 1,
umId: '个',
packageCount: 1,
manufactureDate: '',
expiredDate: '',
remark: '',
height: '',
}
this.$nextTick(() => {
if (this.$refs['otherInboundForm']) {
this.$refs['otherInboundForm'].clearValidate()
}
})
},
// 创建其它入库HandlingUnit
async createOtherInboundHU() {
try {
// 基本验证
if (!this.otherInboundForm.partNo) {
this.$alert(this.$t('warehouse.label.partNoRequired'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
return
}
if (!this.otherInboundForm.partDesc) {
this.$alert(this.$t('warehouse.label.partDescRequired'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
return
}
if (!this.otherInboundForm.batchNo) {
this.$alert(this.$t('warehouse.label.batchNoRequired'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
return
}
if (!this.otherInboundForm.qty || parseFloat(this.otherInboundForm.qty) <= 0) {
this.$alert(this.$t('warehouse.inventory.qtyPositive'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
return
}
if (!this.otherInboundForm.packageCount || parseInt(this.otherInboundForm.packageCount) <= 0) {
this.$alert(this.$t('warehouse.label.packageCountGreaterThanZero'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
return
}
this.otherInboundLoading = true
// 准备创建HU的数据
const createData = {
site: localStorage.getItem('site'),
warehouseId: this.otherInboundForm.warehouseId,
partNo: this.otherInboundForm.partNo,
partDesc: this.otherInboundForm.partDesc,
batchNo: this.otherInboundForm.batchNo,
wdr: this.otherInboundForm.wdr,
locationId: this.otherInboundForm.locationId,
umid: this.otherInboundForm.umId,
perPackageQty: parseFloat(this.otherInboundForm.qty),
packageCount: parseInt(this.otherInboundForm.packageCount),
manufactureDate: this.otherInboundForm.manufactureDate || null,
expiredDate: this.otherInboundForm.expiredDate || null,
remark: this.otherInboundForm.remark,
height: this.otherInboundForm.height || null,
}
// 创建HandlingUnit
const { data } = await createOtherInboundHU(createData)
if (data && data.code === 0) {
this.$message.success(this.$t('warehouse.ifs.createSuccess'))
// 确定标签类型
let printLabelType
if (this.otherInboundForm.partNo && this.otherInboundForm.partNo.startsWith("80")) {
printLabelType = '库存成品标签'
} else {
printLabelType = 'BIL标签'
}
// 创建成功后进行打印
await this.printHandlingUnits(data.unitIds, printLabelType)
this.otherInboundVisible = false
this.getDataList() // 刷新列表
} else {
this.$alert(data.msg || this.$t('warehouse.ifs.createFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
}
} catch (error) {
this.$alert(this.$t('warehouse.label.createFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
} finally {
this.otherInboundLoading = false
}
},
// 打印HandlingUnit标签
async printHandlingUnits(unitIds, printLabelType) {
if (!unitIds || unitIds.length === 0) {
return
}
try {
// 逐个打印每个HandlingUnit
for (const unitId of unitIds) {
await this.printViaServer(unitId, printLabelType)
}
this.$message.success(this.$t('warehouse.label.printSuccessWithCount', { count: unitIds.length }))
} catch (error) {
this.$alert(this.$t('warehouse.label.printFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
}
},
// 通过服务器打印
async printViaServer(unitId, printLabelType) {
try {
const printRequest = {
reportId: this.reportId,
zplCode: this.zplCode,
paperSize: this.paperSize,
orientation: this.orientation,
dpi: this.dpi,
userId: localStorage.getItem('userName'),
username: localStorage.getItem('userName'),
site: localStorage.getItem('site'),
unitId: unitId,
labelType: printLabelType
}
const { data } = await printLabel(printRequest)
if (data.code === 200) {
return Promise.resolve()
} else {
return Promise.reject(new Error(data.msg || this.$t('warehouse.label.printFailed')))
}
} catch (error) {
return Promise.reject(error)
}
},
/**
* 显示失败打印任务对话框
*/
async showFailedPrintTasksDialog() {
this.failedPrintTasksVisible = true
this.failedPrintTasksLoading = true
try {
const { data } = await getFailedPrintTasks({
site: localStorage.getItem('site')
})
if (data && data.code === 0) {
this.failedPrintTasksList = data.rows || []
if (this.failedPrintTasksList.length === 0) {
this.$message.warning(this.$t('warehouse.label.noFailedTasks'))
}
} else {
this.$alert(data.msg || this.$t('warehouse.message.queryFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
this.failedPrintTasksList = []
}
} catch (error) {
this.$alert(this.$t('warehouse.label.queryFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
this.failedPrintTasksList = []
} finally {
this.failedPrintTasksLoading = false
}
},
/**
* 重试全部失败的打印任务
*/
async retryAllFailedTasks() {
if (this.failedPrintTasksList.length === 0) {
this.$message.warning(this.$t('warehouse.label.noRetry'))
return
}
this.$confirm(this.$t('warehouse.label.retryConfirmContent', { count: this.failedPrintTasksList.length }), this.$t('warehouse.label.retryConfirmTitle'), {
confirmButtonText: this.$t('warehouse.common.confirm'),
cancelButtonText: this.$t('warehouse.common.cancel'),
type: 'warning'
}).then(async () => {
this.retryLoading = true
try {
const { data } = await retryFailedPrintTasks({
site: localStorage.getItem('site')
})
if (data && data.code === 0) {
this.$message.success(this.$t('warehouse.label.retryEnqueueSuccess', { count: data.count || 0 }))
// 关闭对话框
this.failedPrintTasksVisible = false
// 清空列表
this.failedPrintTasksList = []
} else {
this.$alert(data.msg || this.$t('warehouse.label.retryFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
}
} catch (error) {
this.$alert(this.$t('warehouse.label.retryFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
} finally {
this.retryLoading = false
}
}).catch(() => {
// 用户取消重试
})
}
}
}
</script>
<style>
.mod-config .el-form-item {
margin-bottom: 15px;
}
.sl-svg {
font-size: 20px;
cursor: pointer;
color: #409EFF;
}
/* 其它入库标签打印表单样式 */
.other-inbound-form .form-item-vertical {
margin-bottom: 20px;
}
.other-inbound-form .form-item-vertical .el-form-item__label {
display: block;
text-align: left;
padding: 0 0 8px 0;
line-height: 1.5;
font-weight: 500;
}
.other-inbound-form .form-item-vertical .el-form-item__content {
margin-left: 0 !important;
}
.other-inbound-form .el-row {
margin-bottom: 0;
}
</style>