春风项目四线(合箱线、总装线)
yyt
2024-06-03 5030f3d30ccc1bd16db371c6970a48103aff9191
提交 | 用户 | 时间
1c7036 1 <template>
Y 2   <div class="app-container">
3     <div style="width: 100%">
4       <el-card   class="box-card"  style="height: 60px" >
5         <template>
6           <div class="container" type="flex" justify="center" style="text-align:center">
7             <el-divider><span style="font-size:30px;color:black"><strong>活塞连杆扫码上线</strong></span></el-divider>
8           </div>
9         </template>
10       </el-card>
11       <el-row :gutter="3">
12         <el-col :span="6">
13           <el-card shadow="always" class="boxSize">
14             <div class="centerImg">
15               <img style="width: 140px;height: 30px;" src="@/assets/logo/jcdm2.png" alt="dark">
16             </div>
17
18           </el-card>
19         </el-col>
20         <el-col :span="3">
21           <el-card shadow="always" class="boxSize">
22             <span class="centerText" style="height: 60px">{{locationCode}}</span>
23           </el-card>
24         </el-col>
25         <el-col :span="15">
26           <el-card shadow="always" class="boxSize">
27             <span class="centerText" >{{locationName}}</span>
28           </el-card>
29         </el-col>
30       </el-row>
31       <el-card class="box-card" >
32         <el-form :model="from" size="large" :inline="true" label-width="68px" @submit.native.prevent>
33           <el-form-item label-width="200" label="活塞连杆托盘码" :prop="from.scanObject2"  style="align-content: center">
34             <input v-model="from.scanObject2"
35                    ref="inputdata"
36                    style="height: 39px; width: 300px"
37                    placeholder="请输入活塞连杆托盘码"
38             />
39           </el-form-item>
40 <!--          <el-button type="primary" icon="el-icon-refresh" @click="handleQuery">查询</el-button>-->
41         </el-form>
42       </el-card>
43       <el-col :span="24" >
44         <el-card class="bottom-card">
45           <div slot="header" class="clearfix">
46             <i class="el-icon-tickets"></i>
47             <span style="font-weight: bold">当前产品信息</span>
48           </div>
49           <el-descriptions :column="1"  :label-style="{'font-size': '20px'}" border  :content-style="{'min-width': '300px'}">
50             <el-descriptions-item label="机型">
51               <span>{{queryParams.productSeries}}</span>
52             </el-descriptions-item>
53             <el-descriptions-item label="箱体码">
54               <span>{{queryParams.scanObject1}}</span>
55             </el-descriptions-item>
56             <el-descriptions-item label="曲轴码">
57               <span>{{queryParams.scanObject2}}</span>
58             </el-descriptions-item>
59             <el-descriptions-item label="结果">
5030f3 60               <span  style="color: #FFFFFF;"  :style="{ backgroundColor: queryParams.tileColor }">{{queryParams.words}}</span>
1c7036 61             </el-descriptions-item>
Y 62           </el-descriptions>
63           <el-divider></el-divider>
64         </el-card>
65       </el-col>
66     </div>
67   </div>
68 </template>
69 <script>
70 import VueQr from 'vue-qr'
71 import { listTileMatchRules, getTileMatchRules, delTileMatchRules, addTileMatchRules, updateTileMatchRules } from "@/api/main/bs/tileMatchRules/tileMatchRules";
72 import {listStationConf,getIp} from "@/api/main/sc/stationConf";
5030f3 73 import {setBarcodeup} from "@/api/main/da/tileMatchMiddleware/tileMatchMiddleware";
1c7036 74 export default {
Y 75   name: "index",
76   dicts: ['colour_hex','productseries','axisname','neckname','tilename'],
77   components: {
78     VueQr,
79   },
80   data(){
81     return{
82       scannerFlag: false,
83       loading: true,
84       locationCode: "未配置",
85       locationName: "未配置工位",
86       tileMatchKbList: [],
87       qrCode: '',
88       // 查询参数
89       from:{
90         pageNum: 1,
91         pageSize: 10,
92         productSeries: null,
93         scanObject1: null,
94         //scanObject1: 'P0SQ0-01FZ01-1000;T231224116;DBBBBA',
5030f3 95         scanObject2: null,
1c7036 96         axisName: null,
Y 97         neckName: null,
98         tileName: null,
99         axisParameterNoPosition: null,
100         neckParameterPosition: null,
101         axisValue: null,
102         neckValue: null,
103         tileColor: null,
104         createUser: null,
105         updateUser: null,
106         state: null,
107         weight: null,
108       },
109       queryParams: {
110         pageNum: 1,
111         pageSize: 10,
112         productSeries: null,
113         scanObject1: null,
114         // scanObject1: 'P0SQ0-01FZ01-1000;T231224116;DBBBBA',
115         scanObject2: null,
116         axisName: null,
117         neckName: null,
118         tileName: null,
119         axisParameterNoPosition: null,
120         neckParameterPosition: null,
121         axisValue: null,
122         neckValue: null,
5030f3 123         words:"",
1c7036 124         tileColor: null,
Y 125         createUser: null,
126         updateUser: null,
127         state: null,
128         weight: null,
129       },
130     }
131   },
132   mounted() {
133     this.setFocus()
134     this.getStationConf()
135     //this.getNowTime()
136     this.$refs.inputdata.addEventListener('keydown',this.handleScannerInput)
137   },
138   beforeDestroy() {
139     this.$refs.inputdata.removeEventListener('keydown',this.handleScannerInput)
140   },
141   methods:{
142     refresh() {
143       location.reload();
144     },
145     setFocus(){
146       this.$nextTick(()=>{
147         this.$refs.inputdata.focus()
148       })
149     },
150     handleScannerInput(event){
151       if (this.scannerFlag){
152         this.from.scanObject2 = ''
153         this.$refs.inputdata.value = ''
154         this.scannerFlag = false
155       }
156       const input = event.target
157       const inputValue = input.value
158       this.from.scanObject2 = inputValue
159       if (event.key === 'Enter'){
160         this.scannerFlag = true
161         //扫描完成
5030f3 162         if (typeof this.from.scanObject2 !== 'undefined'&& typeof this.locationCode !== 'undefined' ) {
Y 163           setBarcodeup({barcode:this.from.scanObject2,locationCode:this.locationCode}).then(res => {
164             if (res===''){
165               this.$message({
166                 message:res.msg,
167                 type:'warning'
168               })
169             }else {
170               this.$message({
171                 message:'操作成功',
172                 type:'success'
173               })
174               console.log('返回:',res)
175               this.queryParams.productSeries=res.sfcCode;
176               this.queryParams.scanObject1=res.connectingRodNo;
177               this.queryParams.scanObject2=res.PalletNo;
178               this.queryParams.words="扫码成功";
179               this.queryParams.tileColor='#00FF00';
180             }
181           })
182         }
1c7036 183       }
Y 184     },
185
186     /** 查询工位终端配置列表 */
187     getStationConf() {
188       getIp().then(response => {
189         let queryParams = {
190           ipAddress: response.msg,
191         }
192         listStationConf(queryParams).then(response => {
193           this.locationName = response.rows[0].processesName
194           this.locationCode = response.rows[0].processesCode
195         });
196       });
197     },
198     /** 搜索按钮操作 */
199     handleQuery() {
200       this.clear();
201       if(this.from.scanObject1 !== null && this.from.scanObject2 !== null
202         && this.from.axisName !== null && this.from.axisName !== ""
203         && this.from.neckName !== null && this.from.neckName !== ""
204         && this.from.tileName !== null && this.from.tileName !== ""
205         && this.from.productSeries !== null && this.from.productSeries !== "")
206       {
207         this.axisValueextracted();
208         this.neckValueextracted();
209         if(this.queryParams.axisValue !== null && this.queryParams.neckValue !== null){
210           this.insetFromToQueryParams();
211           this.getList();
212         }
213         else{
214           const h = this.$createElement;
215           this.$message({
216             message: h('p',null, [
217               h('span', null, '警告 '),
218               h('i', { style: 'color: black' }, '箱体码或曲轴码输入有误'),
219               h()]),
220             type: 'error',
221             center: true,
222             offset:300
223           });
224         }
225       }
226       else{
227         const h = this.$createElement;
228         this.$message({
229           message: h('p',null, [
230             h('span', null, '警告 '),
231             h('i', { style: 'color: black' }, '请填写所有搜索条件'),
232             h()]),
233           type: 'error',
234           center: true,
235           offset:300
236         });
237       }
238     },
239
240     // 取箱体码第三段为配瓦值
241     axisValueextracted() {
242       const parts1 = this.from.scanObject1.split(";");
243       if (parts1.length >= 3) {
244         //const axisValueextracted = parts1[2].substring(3,4);
245         const axisValueextracted = parts1[2];
246         return this.queryParams.axisValue= axisValueextracted;
247
248       }
249     },
250
251     //取曲轴码第三段为配瓦值
252     neckValueextracted() {
253       const parts2 = this.from.scanObject2.split(";");
254       if (parts2.length >= 3) {
255         //const neckValueextracted = parts2[2].substring(3,4);
256         const neckValueextracted = parts2[2];
257         return this.queryParams.neckValue= neckValueextracted;
258       }
259     },
260     //取配瓦颜色
261     getList() {
262       let queryParams = {
263         productSeries : this.queryParams.productSeries,
264         axisName : this.queryParams.axisName,
265         neckName : this.queryParams.neckName,
266         tileName : this.queryParams.tileName,
267         axisValue: this.queryParams.axisValue,
268         neckValue: this.queryParams.neckValue,
269       }
270       console.log(queryParams)
271       listTileMatchRules(queryParams).then(response => {
272         this.queryParams.tileColor = response.rows[0].tileColor;
273       });
274     },
275     clear(){
276       this.queryParams.axisValue=null;
277       this.queryParams.neckValue=null;
278     },
279     insetFromToQueryParams(){
280       this.queryParams.productSeries=this.from.productSeries;
281       this.queryParams.axisName=this.from.axisName;
282       this.queryParams.neckName=this.from.neckName;
283       this.queryParams.tileName=this.from.tileName;
284       this.queryParams.scanObject1=this.from.scanObject1;
285       this.queryParams.scanObject2=this.from.scanObject2;
286     }
287
288   },
289 }
290 </script>
291
292 <style scoped>
293 ::v-deep .el-form-item__label{
294   font-size: large;
295 }
296 ::v-deep .el-card__body{
297   padding: 15px 20px 0px 20px;
298 }
299 ::v-deep .el-input .el-input--medium .el-input--suffix{
300   width: 200px;
301 }
302 .boxSize{
303   height: 60px;
304 }
305 .centerText{
306   color: black;
307   font-weight: bold;
308   font-size: 20px;
309   display: flex;
310   justify-content: center;
311   margin-top: 5px
312 }
313 </style>