876 lines
27 KiB
Vue
876 lines
27 KiB
Vue
<!--
|
||
功能:新料号标签打印
|
||
-->
|
||
<template>
|
||
<div class="vue-element-page-wrap" ref="tableContainer" v-loading="state.view_loading">
|
||
<el-row class="page-search" justify="space-between" align="middle">
|
||
<el-form
|
||
ref="queryFormRef"
|
||
:model="state.queryParams.params"
|
||
:inline="true"
|
||
@submit.native.prevent
|
||
>
|
||
<el-row :gutter="20">
|
||
<el-col :span="4">
|
||
<el-form-item label="物料编号" prop="MATERIALSPECNAME">
|
||
<el-Input
|
||
v-model="state.queryParams.params.MATERIALSPECNAME"
|
||
placeholder="物料编号"
|
||
clearable
|
||
v-on:keyup.enter="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="批次" prop="queryParams.params">
|
||
<el-Input
|
||
v-model="state.queryParams.params.CHARGE"
|
||
placeholder="批次"
|
||
clearable
|
||
v-on:keyup.enter="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="品名" prop="queryParams.params">
|
||
<el-Input
|
||
v-model="state.queryParams.params.DESC_CN"
|
||
placeholder="品名"
|
||
clearable
|
||
v-on:keyup.enter="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="组织" prop="ERPFACTORY">
|
||
<el-select
|
||
filterable
|
||
v-model="state.queryParams.params.ERPFACTORY"
|
||
placeholder="下拉选择组织"
|
||
clearable
|
||
@change="getERPLocation"
|
||
style="width: 240px"
|
||
>
|
||
<el-option
|
||
v-for="item in state.ERPFactoryList"
|
||
:key="item.ERPFACTORY"
|
||
:label="item.DESCRIPTION"
|
||
:value="item.ERPFACTORY"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="仓库" prop="queryParams.params">
|
||
<el-select
|
||
filterable
|
||
v-model="state.queryParams.params.ERPLOCATION"
|
||
placeholder="选择仓库"
|
||
clearable
|
||
style="width: 170px"
|
||
>
|
||
<el-option
|
||
v-for="item in state.ERPLocationList"
|
||
:key="item.ENUMVALUE"
|
||
:label="item.DESCRIPTION"
|
||
:value="item.ENUMVALUE"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="货位" prop="queryParams.params">
|
||
<el-select
|
||
filterable
|
||
v-model="state.queryParams.params.LOCATIONNAME"
|
||
remote
|
||
:remote-method="handleInput"
|
||
clearable
|
||
placeholder="选择库位"
|
||
style="width: 170px"
|
||
>
|
||
<el-option
|
||
v-for="item in state.LocationList"
|
||
:key="item.storageName"
|
||
:label="item.storageName"
|
||
:value="item.storageName"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<!-- <el-col :span="6">-->
|
||
<!-- <el-form-item label="到货单" prop="MATERIALSPECNAME">-->
|
||
<!-- <el-Input v-model="state.queryParams.params.RECEIVEREQUESTNAME" placeholder="请输入到货单"-->
|
||
<!-- v-on:keyup.enter="handleQuery" />-->
|
||
<!-- </el-form-item>-->
|
||
<!-- </el-col>-->
|
||
</el-row>
|
||
</el-form>
|
||
<div class="page-search-btns">
|
||
<el-button type="primary" @click="handleQueryInfo">搜索</el-button>
|
||
</div>
|
||
</el-row>
|
||
|
||
<div class="vue-element-page-table">
|
||
<div class="page-table-operate">
|
||
<div class="page-table-title">
|
||
<div class="page-table-title-left">
|
||
<span>库内标签打印</span>
|
||
</div>
|
||
</div>
|
||
<div class="page-table-operateBtns">
|
||
<el-popover
|
||
:persistent="false"
|
||
placement="right"
|
||
popper-class="config-table-wrap"
|
||
trigger="click"
|
||
>
|
||
<template #reference>
|
||
<el-button class="operateBtns-setting">
|
||
<svg-icon icon-class="table_title" width="16px" height="16px" />
|
||
</el-button>
|
||
</template>
|
||
<ConfigTable :list="materialTableConfig.column" @updateList="updateList" />
|
||
</el-popover>
|
||
</div>
|
||
</div>
|
||
<el-table
|
||
:height="tableHeight"
|
||
border
|
||
v-loading="materialTableConfig.loading"
|
||
:data="state.MaterialList"
|
||
highlight-current-row
|
||
height="600px"
|
||
row-key="id"
|
||
style="width: 100%"
|
||
@selection-change="handleSelectionChange"
|
||
>
|
||
<el-table-column type="selection" width="55" />
|
||
<template v-for="(col, index) in materialTableConfig.column" :key="index">
|
||
<el-table-column v-if="!col.hide" :label="col.header" show-overflow-tooltip>
|
||
<template #default="scope">
|
||
<span>{{
|
||
col.field === 'MAKEDATE'
|
||
? dayjs(scope.row[col.field]).format('YYYY-MM-DD')
|
||
: scope.row[col.field]
|
||
}}</span>
|
||
</template>
|
||
</el-table-column>
|
||
</template>
|
||
<!--
|
||
<el-table-column fixed="right" label="操作" width="180">
|
||
<template #default="scope">
|
||
<el-button @click="getMaterial(scope.row)" type="text" size="small"
|
||
>修改品名和实际规格</el-button
|
||
>
|
||
</template>
|
||
</el-table-column>
|
||
-->
|
||
</el-table>
|
||
<pagination
|
||
v-if="state.total > 0"
|
||
:total="state.total"
|
||
v-model:pageNumTo="state.queryParams.pageNum"
|
||
v-model:pageSizeTo="state.queryParams.pageSize"
|
||
@pagination="handleQuery"
|
||
/>
|
||
</div>
|
||
|
||
<div style="margin-bottom: auto">
|
||
<div>
|
||
<el-row class="page-search" justify="space-between" align="middle">
|
||
<el-form ref="portFormRef" :inline="true" label-position="left">
|
||
<el-row :gutter="20">
|
||
<el-col :span="6">
|
||
<el-form-item label="选择打印机" v-model="state.PRINTNAME">
|
||
<!-- <el-select clearable filterable v-model="state.PRINTLIST" placeholder="请选择打印机"-->
|
||
<!-- class="product-input">-->
|
||
<!-- <el-option v-for="item in state.PRINTLIST" :key="item.VALUE" :label="item.LABEL"-->
|
||
<!-- :value="item.VALUE" />-->
|
||
<!-- </el-select>-->
|
||
<el-select
|
||
v-model="state.PRINTNAME"
|
||
placeholder="请选择打印机"
|
||
style="width: 200px"
|
||
>
|
||
<el-option
|
||
v-for="item in state.PRINTLIST"
|
||
:key="item.VALUE"
|
||
:label="item.LABEL"
|
||
:value="item.VALUE"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="标签类型">
|
||
<el-select
|
||
v-model="state.LABELCODE"
|
||
placeholder="请选择标签类型"
|
||
>
|
||
<el-option
|
||
v-for="item in state.PRINTLABELLIST"
|
||
:key="item.LABELCODE"
|
||
:label="item.LABEINAME"
|
||
:value="item.LABELCODE"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="2"
|
||
><el-button
|
||
type="primary"
|
||
@click="print"
|
||
:disabled="state.button_print"
|
||
v-loading="state.loadings"
|
||
>打印</el-button
|
||
>
|
||
</el-col>
|
||
|
||
<!-- <el-col :span="12">
|
||
<!– <el-Input v-model="remark" />–>
|
||
<el-Input v-model="state.remark" placeholder="备注" />
|
||
</el-col>
|
||
<el-col :span="2">
|
||
<el-button type="primary" @click="modifiedRemark">更新备注</el-button>
|
||
</el-col>-->
|
||
</el-row>
|
||
<!-- <div class="page-search-btns">
|
||
<el-row :gutter="20">
|
||
<el-col :span="12">
|
||
<!– <el-Input v-model="remark" />–>
|
||
<el-Input v-model="state.remark" placeholder="备注" />
|
||
</el-col>
|
||
<el-col :span="2">
|
||
<el-button type="primary" @click="modifiedRemark">更新备注</el-button>
|
||
</el-col>
|
||
</el-row>
|
||
</div>-->
|
||
</el-form>
|
||
</el-row>
|
||
</div>
|
||
</div>
|
||
|
||
<div style="width: 300px">
|
||
<el-drawer v-model="state.boxDrawer" title="修改" size="300px">
|
||
<el-form :model="state.updateLabelMultiple" :rules="rules" ref="state.updateLabelMultiple">
|
||
<el-form-item label="标签编号" prop="state.createBoxForm.TrueGG">
|
||
<el-Input v-model="state.updateLabelMultiple.MATERIALPACKINGNAME" disabled clearable />
|
||
</el-form-item>
|
||
<el-form-item label="品名" prop="state.createBoxForm.MATERIALQUANTITY">
|
||
<el-Input v-model="state.updateLabelMultiple.DESC_CN" clearable />
|
||
</el-form-item>
|
||
<el-form-item label="实际规格" prop="TRUEGG">
|
||
<el-Input v-model="state.updateLabelMultiple.TRUEGG" clearable />
|
||
</el-form-item>
|
||
<div class="page-search-btns">
|
||
<el-button type="primary" @click="commitDESC_CN">修改</el-button>
|
||
</div>
|
||
</el-form>
|
||
</el-drawer>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
<script lang="ts">
|
||
export default {
|
||
name: 'modifyRemark'
|
||
}
|
||
</script>
|
||
<script lang="ts" setup>
|
||
import { reactive, ref, onMounted } from 'vue'
|
||
import { ElForm, ElMessageBox, ElTable } from 'element-plus'
|
||
import { getQueryPageList, BpelEvent, getQueryList } from '@/api/common'
|
||
import {
|
||
printLabel,
|
||
Getprinter,
|
||
updateTruegg,
|
||
updateRemark,
|
||
labelMaterial,
|
||
printLabelWithRemark, newMaterialSpecLabelPrint
|
||
} from '@/api/label'
|
||
import dayjs from 'dayjs'
|
||
import queryListStore from '@/store/modules/queryList'
|
||
import { localStorage } from '@/utils/storage'
|
||
import { bTableHeight } from '../../../composables/calcTableHeight'
|
||
import { getORG } from '@/api/auth'
|
||
import { cals } from '@/utils/cal'
|
||
import { search } from '@/api/wareHouse'
|
||
|
||
const { tableContainer, tableHeight, updateTableHeight, handleResize } = bTableHeight(280)
|
||
const queryFormRef = ref(ElForm)
|
||
const formDataRef = ref(ElForm)
|
||
const store: any = queryListStore()
|
||
|
||
/***---------------------------------------------------------------------------
|
||
* -------------------------------------页面SQL语句配置------------------------------------------ */
|
||
const state = reactive({
|
||
loadings: false,
|
||
view_loading: false,
|
||
button_print: false,
|
||
ERPLOCATIONdisabled: false,
|
||
LOCATIONdisabled: false,
|
||
updateLabelMultiple: {
|
||
MATERIALPACKINGNAME: '',
|
||
DESC_CN: '',
|
||
TRUEGG: '',
|
||
MATERIALQUANTITY: ''
|
||
},
|
||
query: {
|
||
MATERIALPACKINGNAME: '',
|
||
MATERIALSPECNAME: ''
|
||
},
|
||
boxDrawer: false,
|
||
rsa: '',
|
||
FIRSTORDERLIST: '',
|
||
DBProcessType: 'save',
|
||
remark: '',
|
||
queryParams: {
|
||
queryId: 'GetlabelList',
|
||
version: 'sdk005',
|
||
listCode: '', // 查询类型
|
||
params: {
|
||
MATERIALSPECNAME: '',
|
||
SITENAME: 'SDK',
|
||
RECEIVEACTNO: '',
|
||
RECEIVEREQUESTNAME: '',
|
||
CHARGE: '',
|
||
ERPFACTORY: '',
|
||
ERPLOCATION: '',
|
||
LOCATIONNAME: '',
|
||
DESC_CN: ''
|
||
},
|
||
pageNum: 1,
|
||
pageSize: 10
|
||
},
|
||
ChangeParams: {
|
||
header: {
|
||
MESSAGENAME: '',
|
||
LANGUAGE: 'Chinese'
|
||
},
|
||
body: {
|
||
INRATIO: '',
|
||
OUTRATIO: '',
|
||
IS_CON_TEMP: '',
|
||
DESCRIPTION: '',
|
||
MATERIALSPECNAME: '',
|
||
SITENAME: 'SDK',
|
||
MATERIALSPECDESCRIPTION: '',
|
||
CHECKSTATE: '',
|
||
MATERIALSPECTYPE: '',
|
||
MAKEDATE: '',
|
||
MAKEUSER: '',
|
||
DESC_CN: '',
|
||
DESC_EN: '',
|
||
MATERIALTYPE: '',
|
||
MATERIALGROUP: '',
|
||
MATERIALGROUPDESCRIPTION: '',
|
||
MATERIALUNIT: '',
|
||
MATERIALWEIGHT: '',
|
||
ERPFACTORY: '',
|
||
ERPLOCATION: '',
|
||
MATERIALLIFEMARK: '',
|
||
EXPIRINGDATE: '',
|
||
STOCKDATE: ''
|
||
}
|
||
},
|
||
total: 0,
|
||
loading: false,
|
||
MaterialList: [] as any,
|
||
dialog: {
|
||
title: '新增用户',
|
||
visible: false
|
||
},
|
||
queryParamsERPFactory: {
|
||
queryId: 'GetErpFactoryList',
|
||
version: 'WEB00001',
|
||
params: {
|
||
SITENAME: localStorage.get('siteName') || 'SDK'
|
||
},
|
||
pageNum: 1,
|
||
pageSize: 10
|
||
},
|
||
formData: {
|
||
total: 0,
|
||
SUPPLIERNO: '',
|
||
SUPPLIERNAME: '',
|
||
NATIONALNO: '',
|
||
DESCRIPTION: '',
|
||
ADDRESS: '',
|
||
POSTCODE: '',
|
||
CITY: '',
|
||
TEL: '',
|
||
FAX: '',
|
||
INCHARGE: '',
|
||
EMAIL: '',
|
||
LASTEVENTTIME: ''
|
||
} as any,
|
||
PRINTLIST: [] as any, //打印机
|
||
PRINTLABELLIST: [] as any, //打印标签
|
||
PRINTNAME: '',
|
||
LABELCODE: '',
|
||
column: [] as any,
|
||
selectItem: undefined as any,
|
||
currentTime: '',
|
||
allRole: [] as any,
|
||
ReceiveACTList: [] as any,
|
||
multipleSelection: [] as any,
|
||
ERPFactoryList: [] as any,
|
||
ERPLocationList: [] as any,
|
||
LocationList: [] as any,
|
||
AllLocationList: [] as any
|
||
})
|
||
|
||
const materialTableConfig = ref({
|
||
loading: false,
|
||
column: [] as any,
|
||
data: []
|
||
})
|
||
|
||
/***---------------------------------------------------------------------------
|
||
* -------------------------------------钩子函数区域------------------------------------------ */
|
||
onMounted(() => {
|
||
materialTableConfig.value.column = [
|
||
// { header: "工厂", field: "SITENAME", hide: false },
|
||
{ header: '组织', field: 'ERPFATCORYNAME', hide: false },
|
||
{ header: '仓库', field: 'ERPLOCATIONNAME', hide: false },
|
||
{ header: '货位', field: 'LOCATIONNAMEDESC', hide: false },
|
||
{ header: '标签编号', field: 'MATERIALPACKINGNAME', hide: false },
|
||
{ header: '物料编码', field: 'MATERIALSPECNAME', hide: false },
|
||
{ header: '品名', field: 'DESC_CN', hide: false },
|
||
{ header: '批次', field: 'CHARGE', hide: false },
|
||
{ header: '数量', field: 'MATERIALQUANTITY', hide: false },
|
||
{ header: '单位', field: 'FNAME', hide: false },
|
||
{ header: '实际规格', field: 'TRUEGG', hide: false },
|
||
{ header: 'SDK规格', field: 'SPECNAME', hide: false },
|
||
{ header: '质检结果', field: 'OQARESULT', hide: false },
|
||
{ header: '生产日期', field: 'MAKEDATE', hide: false },
|
||
{ header: '到期日', field: 'EXPIRINGDATE', hide: false },
|
||
{ header: '备注', field: 'REMARK', hide: false },
|
||
{ header: '用户', field: 'UserName', hide: true }
|
||
]
|
||
let pwd: any = localStorage.get('remeberPwd')
|
||
// state.queryParams.params.ERPFACTORY = JSON.parse(pwd).orgNo;
|
||
// 初始化时调用 handleQuery
|
||
handleQuery()
|
||
getPRINTLIST()
|
||
ERPFactoryQuery()
|
||
// getERPLocation();
|
||
getGetPrintLabelType()
|
||
updateTableHeight()
|
||
window.addEventListener('resize', handleResize)
|
||
})
|
||
|
||
function handleInput(val: any) {
|
||
let index = [1, 3, 4, 7, 8]
|
||
if (index.indexOf(val.length) > -1) {
|
||
state.LocationList = []
|
||
search({
|
||
storageName: val,
|
||
orgNo: JSON.parse(localStorage.get('orgNo'))
|
||
}).then((res:any) => {
|
||
if (res.resultObj) {
|
||
state.LocationList = res.resultObj
|
||
} else {
|
||
proxy.$ElMessage.warning(res.message);
|
||
}
|
||
})
|
||
}
|
||
}
|
||
|
||
const exportLabel = () => {
|
||
console.log('state.multipleSelection', state.multipleSelection) // 打印选中行的数据
|
||
printLabel(state.multipleSelection)
|
||
.then((res: any) => {
|
||
console.log(res.data)
|
||
})
|
||
.catch(() => {})
|
||
}
|
||
|
||
const handleSelectionChange = (val: any) => {
|
||
state.multipleSelection = val
|
||
}
|
||
function handleQueryInfo() {
|
||
state.queryParams.pageNum = 1
|
||
/*if (state.LABELCODE == null || state.LABELCODE == '') {
|
||
ElMessageBox.alert('请选择标签类型', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
return
|
||
}*/
|
||
handleQuery()
|
||
}
|
||
const handleQuery = () => {
|
||
console.log(state.queryParams)
|
||
state.view_loading = true
|
||
state.MaterialList = []
|
||
/*
|
||
if (state.LABELCODE == 'PET_A.btw'){
|
||
state.queryParams.queryId = 'GetlabelPrintInfoList'
|
||
state.queryParams.version = '240925'
|
||
}else {
|
||
state.queryParams.queryId = 'GetlabelList'
|
||
state.queryParams.version = 'sdk005'
|
||
}
|
||
*/
|
||
getQueryPageList(state.queryParams)
|
||
.then((res: any) => {
|
||
if (res.data.list.length == 0) {
|
||
state.MaterialList = []
|
||
state.total = 0
|
||
ElMessageBox.alert('查无数据', '提醒框', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
state.loading = false
|
||
state.view_loading = false
|
||
} else {
|
||
for (let i = 0; i < res.data.list.length; i++) {
|
||
state.MaterialList.push({ ...res.data.list[i], User: localStorage.get('userId') })
|
||
// state.MaterialList.push({ ...res.data.list[i], User: localStorage.getItem('userId') })
|
||
}
|
||
state.MaterialList = res.data.list
|
||
state.total = res.data.total
|
||
console.log(state.MaterialList)
|
||
state.view_loading = false
|
||
}
|
||
})
|
||
.catch(() => {})
|
||
}
|
||
|
||
function getStorageSpec() {
|
||
state.queryParams.params.LOCATIONNAME = ''
|
||
state.AllLocationList = []
|
||
if(state.queryParams.params.ERPLOCATION) {
|
||
getQueryList({
|
||
queryId: 'GetLocationList',
|
||
version: 'WEB00001',
|
||
params: {
|
||
SITENAME: 'SDK',
|
||
ERPLOCATION: state.queryParams.params.ERPLOCATION //PO
|
||
} as any
|
||
}).then((res: any) => {
|
||
state.AllLocationList = res.data
|
||
locatioNFilter('')
|
||
})
|
||
}
|
||
}
|
||
function getGetPrintLabelType() {
|
||
state.queryParams.params.LOCATIONNAME = ''
|
||
state.AllLocationList = []
|
||
state.PRINTLABELLIST = [
|
||
{"LABEINAME":"PET","LABELCODE":"PET标签-电晕.btw","LABELURL":"C:\\inetpub\\wwwroot\\BarTender\\wwwroot\\Templates\\WMS\\WHRePrint\\","SITENAME":"SDK"},
|
||
{"LABEINAME":"SKD2","LABELCODE":"Sdk2.btw","LABELURL":"C:\\inetpub\\wwwroot\\BarTender\\wwwroot\\Templates\\","SITENAME":"SDK"},
|
||
{"LABEINAME":"胶水原料","LABELCODE":"胶水原材.btw","LABELURL":"C:\\inetpub\\wwwroot\\BarTender\\wwwroot\\Templates\\","SITENAME":"SDK"},
|
||
]
|
||
}
|
||
|
||
function locatioNFilter(query: any) {
|
||
console.log(state.AllLocationList)
|
||
let arr = state.AllLocationList.filter((item: any) => {
|
||
return item.DESCRIPTION.includes(query) || item.ENUMVALUE.includes(query)
|
||
})
|
||
if (arr.length > 50) {
|
||
state.LocationList = arr.slice(0, 50)
|
||
} else {
|
||
state.LocationList = arr
|
||
}
|
||
}
|
||
|
||
function getERPLocation() {
|
||
state.queryParams.params.LOCATIONNAME = ''
|
||
state.queryParams.params.ERPLOCATION = ''
|
||
if (state.queryParams.params.ERPFACTORY) {
|
||
getQueryList({
|
||
// queryId: "GetERPLocationForCreatePO",
|
||
queryId: 'GetErpLocationList',
|
||
version: 'WEB00001',
|
||
params: {
|
||
SITENAME: 'SDK',
|
||
ERPFACTORYNAME: state.queryParams.params.ERPFACTORY
|
||
} as any
|
||
}).then((res: any) => {
|
||
console.log(res.data)
|
||
state.ERPLocationList = res.data
|
||
state.ERPLocationList.unshift({
|
||
VALUE: '全部'
|
||
})
|
||
})
|
||
}
|
||
}
|
||
|
||
function ERPFactoryQuery() {
|
||
getORG({ orgNo: null })
|
||
.then((res: any) => {
|
||
state.ERPFactoryList = res.resultObj
|
||
state.ERPFactoryList.unshift({
|
||
ERPFACTORY: '全部'
|
||
})
|
||
})
|
||
.catch(() => {})
|
||
}
|
||
|
||
function commitDESC_CN() {
|
||
let splTtrue = state.updateLabelMultiple.TRUEGG
|
||
if (splTtrue) {
|
||
let arrS = splTtrue.split('*') || []
|
||
console.log(arrS)
|
||
const regex = /\d+/g
|
||
|
||
if (arrS[0]) {
|
||
let arr_prv = arrS[0].match(regex).map(Number)
|
||
let arr_font = arrS[1].match(regex).map(Number)
|
||
console.log(arr_prv, arr_font)
|
||
let numberC = cals.mul(arr_prv[0], arr_font[0]).toNumber() / 1000
|
||
console.log(numberC, state.updateLabelMultiple.MATERIALQUANTITY)
|
||
if (numberC != state.updateLabelMultiple.MATERIALQUANTITY) {
|
||
ElMessageBox.alert('修改的实际规格计算的数量与条码数量不一致!', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
return;
|
||
}else {
|
||
let boxLists = []
|
||
for (var z = 0; z < state.multipleSelection.length; ++z) {
|
||
state.multipleSelection[z].key = {
|
||
SITENAME: 'SDK',
|
||
MATERIALPACKINGNAME: state.multipleSelection[z]['MATERIALPACKINGNAME']
|
||
}
|
||
boxLists.push(state.multipleSelection[z])
|
||
}
|
||
let params = {
|
||
boxList: boxLists,
|
||
USER: localStorage.get('userId'),
|
||
truegg: splTtrue
|
||
}
|
||
updateTruegg(params)
|
||
.then((res: any) => {
|
||
console.log(res.success)
|
||
if (res.success) {
|
||
ElMessageBox.alert('修改实际规格成功', '提醒框', {
|
||
confirmButtonText: 'OK',
|
||
})
|
||
} else {
|
||
ElMessageBox.alert(res.message, '提醒框', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
}
|
||
})
|
||
.catch(() => {
|
||
ElMessageBox.alert('修改实际规格失败', '提醒框', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
})
|
||
}
|
||
}
|
||
}
|
||
|
||
for (var i = 0; i < state.multipleSelection.length; i++) {
|
||
if (
|
||
state.multipleSelection[i].MATERIALPACKINGNAME ==
|
||
state.updateLabelMultiple.MATERIALPACKINGNAME
|
||
) {
|
||
state.multipleSelection[i].DESC_CN = state.updateLabelMultiple.DESC_CN
|
||
if(state.updateLabelMultiple.TRUEGG) {
|
||
state.multipleSelection[i].TRUEGG = state.updateLabelMultiple.TRUEGG
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
state.boxDrawer = false
|
||
}
|
||
|
||
function getMaterial(value: any) {
|
||
if (state.multipleSelection.length == 0) {
|
||
ElMessageBox.alert('选择条数', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
return
|
||
} else {
|
||
var y = 0
|
||
for (var i = 0; i < state.multipleSelection.length; i++) {
|
||
if (state.multipleSelection[i].MATERIALPACKINGNAME == value.MATERIALPACKINGNAME) {
|
||
state.query.MATERIALPACKINGNAME = value.MATERIALPACKINGNAME
|
||
state.query.MATERIALSPECNAME = value.MATERIALSPECNAME
|
||
labelMaterial(state.query).then((res: any) => {
|
||
state.updateLabelMultiple.MATERIALPACKINGNAME = res.resultObj[0].MATERIALPACKINGNAME
|
||
state.updateLabelMultiple.DESC_CN = res.resultObj[0].DESC_CN
|
||
state.updateLabelMultiple.TRUEGG = res.resultObj[0].TRUEGG
|
||
state.updateLabelMultiple.MATERIALQUANTITY = res.resultObj[0].MATERIALQUANTITY
|
||
})
|
||
state.boxDrawer = true
|
||
y++
|
||
}
|
||
}
|
||
if (y == 0) {
|
||
ElMessageBox.alert('选择条数与修改条不一致', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
}
|
||
}
|
||
}
|
||
|
||
function updateMaterial(vlue: any) {
|
||
state.boxDrawer = true
|
||
console.log('123')
|
||
}
|
||
function getPRINTLIST() {
|
||
getQueryList({
|
||
queryId: 'getPRINTLIST',
|
||
version: '00001',
|
||
params: {}
|
||
}).then((res: any) => {
|
||
state.PRINTLIST = res.data
|
||
})
|
||
}
|
||
|
||
function print() {
|
||
if (state.PRINTNAME == null || state.PRINTNAME == '') {
|
||
ElMessageBox.alert('请选择打印机', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
return
|
||
}
|
||
if (state.LABELCODE == null || state.LABELCODE == '') {
|
||
ElMessageBox.alert('请选择标签类型', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
return
|
||
}
|
||
|
||
if (state.multipleSelection.length == 0) {
|
||
ElMessageBox.alert('打印清单为空', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
return
|
||
}
|
||
for (var i = 0; i < state.multipleSelection.length; i++) {
|
||
if (
|
||
undefined != state.multipleSelection[i].DESC_CN &&
|
||
'' != state.multipleSelection[i].DESC_CN
|
||
) {
|
||
continue
|
||
} else {
|
||
state.multipleSelection[i].DESC_CN = ''
|
||
}
|
||
}
|
||
let PRINT = {
|
||
LIST: state.multipleSelection,
|
||
PRINTNAME: state.PRINTNAME,
|
||
USER: localStorage.get('userId'),
|
||
LABELCODE: state.LABELCODE
|
||
}
|
||
|
||
state.button_print = true
|
||
state.loadings = true
|
||
newMaterialSpecLabelPrint(PRINT)
|
||
.then((res: any) => {
|
||
if (res.success) {
|
||
state.button_print = false;
|
||
state.loadings = false;
|
||
ElMessageBox.alert('标签打印成功', {
|
||
confirmButtonText: 'OK',
|
||
})
|
||
}else {
|
||
state.button_print = false;
|
||
state.loadings = false;
|
||
ElMessageBox.alert('标签打印失败:' + res.message, '提醒框', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
}
|
||
/*console.log('PRINTNAME', state.PRINTNAME)
|
||
if (state.PRINTNAME == 'PDF') {
|
||
console.log(res.resultObj)
|
||
let arrList = res.resultObj
|
||
arrList.map((item: any) => {
|
||
let fileName = JSON.parse(item)?.filePath
|
||
downloadPDF(fileName)
|
||
})
|
||
}*/
|
||
})
|
||
.catch((err: any) => {
|
||
state.button_print = false
|
||
state.loadings = false
|
||
ElMessageBox.alert('标签打印失败' + err, '提醒框', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
})
|
||
/* state.button_print = false
|
||
state.loadings = false
|
||
ElMessageBox.alert('标签打印成功', {
|
||
confirmButtonText: 'OK'
|
||
})*/
|
||
}
|
||
function downloadPDF(fileName: any) {
|
||
// 要下载的文件路径
|
||
var fileUrl = fileName
|
||
// 创建一个隐藏的<a>元素,用于下载文件
|
||
var a = document.createElement('a')
|
||
a.href = fileUrl
|
||
a.download = fileName // 可以自定义下载文件的名称
|
||
a.style.display = 'none'
|
||
a.target = '_blank'
|
||
// 将<a>元素添加到页面上
|
||
document.body.appendChild(a)
|
||
// 触发点击事件,开始下载
|
||
a.click()
|
||
// 下载完成后,移除<a>元素
|
||
document.body.removeChild(a)
|
||
}
|
||
/**
|
||
* 修改备注
|
||
*/
|
||
function modifiedRemark() {
|
||
if (state.multipleSelection.length == 0) {
|
||
ElMessageBox.alert('列表为空', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
return
|
||
}
|
||
let boxLists = []
|
||
for (var i = 0; i < state.multipleSelection.length; ++i) {
|
||
state.multipleSelection[i].key = {
|
||
SITENAME: 'SDK',
|
||
MATERIALPACKINGNAME: state.multipleSelection[i]['MATERIALPACKINGNAME']
|
||
}
|
||
boxLists.push(state.multipleSelection[i])
|
||
}
|
||
let PRINT = {
|
||
boxList: boxLists,
|
||
USER: localStorage.get('userId'),
|
||
remark: state.remark
|
||
}
|
||
if(state.remark) {
|
||
updateRemark(PRINT)
|
||
.then((res: any) => {
|
||
console.log(res.success)
|
||
if (res.success) {
|
||
// proxy.$ElMessage.success('备注更新成功');
|
||
ElMessageBox.alert('备注更新成功', '提醒框', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
handleQuery()
|
||
} else {
|
||
proxy.$ElMessage.error(res.message)
|
||
}
|
||
})
|
||
.catch(() => {})
|
||
}else {
|
||
ElMessageBox.alert('为空默认为原备注信息', '提醒框', {
|
||
confirmButtonText: 'OK'
|
||
})
|
||
}
|
||
|
||
}
|
||
|
||
function Queryprinter() {
|
||
Getprinter({}).then((res: any) => {
|
||
state.FIRSTORDERLIST = res.data
|
||
})
|
||
}
|
||
|
||
const updateList = (col: any) => {
|
||
materialTableConfig.value.column = col
|
||
}
|
||
</script>
|
||
|
||
<style scoped></style>
|