<template>
|
<div class="app-container">
|
<div style="width: 100%">
|
<el-card class="box-card" style="height: 60px" >
|
<template>
|
<div class="container" type="flex" justify="center" style="text-align:center">
|
<el-divider><span style="font-size:30px;color:black"><strong>活塞连杆扫码上线</strong></span></el-divider>
|
</div>
|
</template>
|
</el-card>
|
<el-row :gutter="3">
|
<el-col :span="6">
|
<el-card shadow="always" class="boxSize">
|
<div class="centerImg">
|
<img style="width: 140px;height: 30px;" src="@/assets/logo/jcdm2.png" alt="dark">
|
</div>
|
|
</el-card>
|
</el-col>
|
<el-col :span="3">
|
<el-card shadow="always" class="boxSize">
|
<span class="centerText" style="height: 60px">{{locationCode}}</span>
|
</el-card>
|
</el-col>
|
<el-col :span="15">
|
<el-card shadow="always" class="boxSize">
|
<span class="centerText" >{{locationName}}</span>
|
</el-card>
|
</el-col>
|
</el-row>
|
<el-card class="box-card" >
|
<el-form :model="from" size="large" :inline="true" label-width="68px" @submit.native.prevent>
|
<el-form-item label-width="200" label="活塞连杆托盘码" :prop="from.scanObject2" style="align-content: center">
|
<input v-model="from.scanObject2"
|
ref="inputdata"
|
style="height: 39px; width: 300px"
|
placeholder="请输入活塞连杆托盘码"
|
/>
|
</el-form-item>
|
<!-- <el-button type="primary" icon="el-icon-refresh" @click="handleQuery">查询</el-button>-->
|
</el-form>
|
</el-card>
|
<el-col :span="24" >
|
<el-card class="bottom-card">
|
<div slot="header" class="clearfix">
|
<i class="el-icon-tickets"></i>
|
<span style="font-weight: bold">当前产品信息</span>
|
</div>
|
<el-descriptions :column="1" :label-style="{'font-size': '20px'}" border :content-style="{'min-width': '300px'}">
|
<el-descriptions-item label="机型">
|
<span>{{queryParams.productSeries}}</span>
|
</el-descriptions-item>
|
<el-descriptions-item label="箱体码">
|
<span>{{queryParams.scanObject1}}</span>
|
</el-descriptions-item>
|
<el-descriptions-item label="曲轴码">
|
<span>{{queryParams.scanObject2}}</span>
|
</el-descriptions-item>
|
<el-descriptions-item label="结果">
|
<span style="color: #FFFFFF;" :style="{ backgroundColor: queryParams.tileColor }">{{queryParams.words}}</span>
|
</el-descriptions-item>
|
</el-descriptions>
|
<el-divider></el-divider>
|
</el-card>
|
</el-col>
|
</div>
|
</div>
|
</template>
|
<script>
|
import VueQr from 'vue-qr'
|
import { listTileMatchRules, getTileMatchRules, delTileMatchRules, addTileMatchRules, updateTileMatchRules } from "@/api/main/bs/tileMatchRules/tileMatchRules";
|
import {listStationConf,getIp} from "@/api/main/sc/stationConf";
|
import {setBarcodeup} from "@/api/main/da/tileMatchMiddleware/tileMatchMiddleware";
|
export default {
|
name: "index",
|
dicts: ['colour_hex','productseries','axisname','neckname','tilename'],
|
components: {
|
VueQr,
|
},
|
data(){
|
return{
|
scannerFlag: false,
|
loading: true,
|
locationCode: "未配置",
|
locationName: "未配置工位",
|
tileMatchKbList: [],
|
qrCode: '',
|
// 查询参数
|
from:{
|
pageNum: 1,
|
pageSize: 10,
|
productSeries: null,
|
scanObject1: null,
|
//scanObject1: 'P0SQ0-01FZ01-1000;T231224116;DBBBBA',
|
scanObject2: null,
|
axisName: null,
|
neckName: null,
|
tileName: null,
|
axisParameterNoPosition: null,
|
neckParameterPosition: null,
|
axisValue: null,
|
neckValue: null,
|
tileColor: null,
|
createUser: null,
|
updateUser: null,
|
state: null,
|
weight: null,
|
},
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
productSeries: null,
|
scanObject1: null,
|
// scanObject1: 'P0SQ0-01FZ01-1000;T231224116;DBBBBA',
|
scanObject2: null,
|
axisName: null,
|
neckName: null,
|
tileName: null,
|
axisParameterNoPosition: null,
|
neckParameterPosition: null,
|
axisValue: null,
|
neckValue: null,
|
words:"",
|
tileColor: null,
|
createUser: null,
|
updateUser: null,
|
state: null,
|
weight: null,
|
},
|
}
|
},
|
mounted() {
|
this.setFocus()
|
this.getStationConf()
|
//this.getNowTime()
|
this.$refs.inputdata.addEventListener('keydown',this.handleScannerInput)
|
},
|
beforeDestroy() {
|
this.$refs.inputdata.removeEventListener('keydown',this.handleScannerInput)
|
},
|
methods:{
|
refresh() {
|
location.reload();
|
},
|
setFocus(){
|
this.$nextTick(()=>{
|
this.$refs.inputdata.focus()
|
})
|
},
|
handleScannerInput(event){
|
if (this.scannerFlag){
|
this.from.scanObject2 = ''
|
this.$refs.inputdata.value = ''
|
this.scannerFlag = false
|
}
|
const input = event.target
|
const inputValue = input.value
|
this.from.scanObject2 = inputValue
|
if (event.key === 'Enter'){
|
this.scannerFlag = true
|
//扫描完成
|
if (typeof this.from.scanObject2 !== 'undefined'&& typeof this.locationCode !== 'undefined' ) {
|
setBarcodeup({barcode:this.from.scanObject2,locationCode:this.locationCode}).then(res => {
|
if (res===''){
|
this.$message({
|
message:res.msg,
|
type:'warning'
|
})
|
}else {
|
this.$message({
|
message:'操作成功',
|
type:'success'
|
})
|
console.log('返回:',res)
|
this.queryParams.productSeries=res.sfcCode;
|
this.queryParams.scanObject1=res.connectingRodNo;
|
this.queryParams.scanObject2=res.PalletNo;
|
this.queryParams.words="扫码成功";
|
this.queryParams.tileColor='#00FF00';
|
}
|
})
|
}
|
}
|
},
|
|
/** 查询工位终端配置列表 */
|
getStationConf() {
|
getIp().then(response => {
|
let queryParams = {
|
ipAddress: response.msg,
|
}
|
listStationConf(queryParams).then(response => {
|
this.locationName = response.rows[0].processesName
|
this.locationCode = response.rows[0].processesCode
|
});
|
});
|
},
|
/** 搜索按钮操作 */
|
handleQuery() {
|
this.clear();
|
if(this.from.scanObject1 !== null && this.from.scanObject2 !== null
|
&& this.from.axisName !== null && this.from.axisName !== ""
|
&& this.from.neckName !== null && this.from.neckName !== ""
|
&& this.from.tileName !== null && this.from.tileName !== ""
|
&& this.from.productSeries !== null && this.from.productSeries !== "")
|
{
|
this.axisValueextracted();
|
this.neckValueextracted();
|
if(this.queryParams.axisValue !== null && this.queryParams.neckValue !== null){
|
this.insetFromToQueryParams();
|
this.getList();
|
}
|
else{
|
const h = this.$createElement;
|
this.$message({
|
message: h('p',null, [
|
h('span', null, '警告 '),
|
h('i', { style: 'color: black' }, '箱体码或曲轴码输入有误'),
|
h()]),
|
type: 'error',
|
center: true,
|
offset:300
|
});
|
}
|
}
|
else{
|
const h = this.$createElement;
|
this.$message({
|
message: h('p',null, [
|
h('span', null, '警告 '),
|
h('i', { style: 'color: black' }, '请填写所有搜索条件'),
|
h()]),
|
type: 'error',
|
center: true,
|
offset:300
|
});
|
}
|
},
|
|
// 取箱体码第三段为配瓦值
|
axisValueextracted() {
|
const parts1 = this.from.scanObject1.split(";");
|
if (parts1.length >= 3) {
|
//const axisValueextracted = parts1[2].substring(3,4);
|
const axisValueextracted = parts1[2];
|
return this.queryParams.axisValue= axisValueextracted;
|
|
}
|
},
|
|
//取曲轴码第三段为配瓦值
|
neckValueextracted() {
|
const parts2 = this.from.scanObject2.split(";");
|
if (parts2.length >= 3) {
|
//const neckValueextracted = parts2[2].substring(3,4);
|
const neckValueextracted = parts2[2];
|
return this.queryParams.neckValue= neckValueextracted;
|
}
|
},
|
//取配瓦颜色
|
getList() {
|
let queryParams = {
|
productSeries : this.queryParams.productSeries,
|
axisName : this.queryParams.axisName,
|
neckName : this.queryParams.neckName,
|
tileName : this.queryParams.tileName,
|
axisValue: this.queryParams.axisValue,
|
neckValue: this.queryParams.neckValue,
|
}
|
console.log(queryParams)
|
listTileMatchRules(queryParams).then(response => {
|
this.queryParams.tileColor = response.rows[0].tileColor;
|
});
|
},
|
clear(){
|
this.queryParams.axisValue=null;
|
this.queryParams.neckValue=null;
|
},
|
insetFromToQueryParams(){
|
this.queryParams.productSeries=this.from.productSeries;
|
this.queryParams.axisName=this.from.axisName;
|
this.queryParams.neckName=this.from.neckName;
|
this.queryParams.tileName=this.from.tileName;
|
this.queryParams.scanObject1=this.from.scanObject1;
|
this.queryParams.scanObject2=this.from.scanObject2;
|
}
|
|
},
|
}
|
</script>
|
|
<style scoped>
|
::v-deep .el-form-item__label{
|
font-size: large;
|
}
|
::v-deep .el-card__body{
|
padding: 15px 20px 0px 20px;
|
}
|
::v-deep .el-input .el-input--medium .el-input--suffix{
|
width: 200px;
|
}
|
.boxSize{
|
height: 60px;
|
}
|
.centerText{
|
color: black;
|
font-weight: bold;
|
font-size: 20px;
|
display: flex;
|
justify-content: center;
|
margin-top: 5px
|
}
|
</style>
|