|
@@ -1,4 +1,3 @@
|
|
-
|
|
|
|
<template>
|
|
<template>
|
|
<div class="content">
|
|
<div class="content">
|
|
<div class="title" v-if="information.indexOf('毛重') > -1">毛重</div>
|
|
<div class="title" v-if="information.indexOf('毛重') > -1">毛重</div>
|
|
@@ -23,7 +22,7 @@ export default {
|
|
return {
|
|
return {
|
|
param: 9600,
|
|
param: 9600,
|
|
grossWeightVal: '',
|
|
grossWeightVal: '',
|
|
- tareVal: '',
|
|
|
|
|
|
+ tareVal: ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
activated() {},
|
|
activated() {},
|
|
@@ -56,16 +55,19 @@ export default {
|
|
// The Web Serial API is supported.
|
|
// The Web Serial API is supported.
|
|
console.log('the Web Serial API is supported.')
|
|
console.log('the Web Serial API is supported.')
|
|
const port = await navigator.serial.requestPort()
|
|
const port = await navigator.serial.requestPort()
|
|
- if (this.deptBudgetList.warehouseName == '白城内陆港'||this.deptBudgetList.warehouseName == '肇东金信库') {
|
|
|
|
|
|
+ if (
|
|
|
|
+ this.deptBudgetList.warehouseName == '白城内陆港' ||
|
|
|
|
+ this.deptBudgetList.warehouseName == '肇东金信库'
|
|
|
|
+ ) {
|
|
this.param = 1200
|
|
this.param = 1200
|
|
- } else if(this.deptBudgetList.warehouseName == '鲅鱼圈祥腾库') {
|
|
|
|
|
|
+ } else if (this.deptBudgetList.warehouseName == '鲅鱼圈祥腾库') {
|
|
this.param = 2400
|
|
this.param = 2400
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
this.param = 9600
|
|
this.param = 9600
|
|
}
|
|
}
|
|
console.log(this.param)
|
|
console.log(this.param)
|
|
await port.open({
|
|
await port.open({
|
|
- baudRate: this.param,
|
|
|
|
|
|
+ baudRate: this.param
|
|
}) // set baud rate
|
|
}) // set baud rate
|
|
this.reader = port.readable.getReader()
|
|
this.reader = port.readable.getReader()
|
|
console.log('port ', port)
|
|
console.log('port ', port)
|
|
@@ -77,7 +79,6 @@ export default {
|
|
}
|
|
}
|
|
// 监听来自串行设备的数据
|
|
// 监听来自串行设备的数据
|
|
while (true) {
|
|
while (true) {
|
|
-
|
|
|
|
const { value, done } = await this.reader.read()
|
|
const { value, done } = await this.reader.read()
|
|
// console.log('value',value);
|
|
// console.log('value',value);
|
|
if (done) {
|
|
if (done) {
|
|
@@ -109,37 +110,39 @@ export default {
|
|
// this.deptBudgetList.tare = parseInt(result)
|
|
// this.deptBudgetList.tare = parseInt(result)
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
-
|
|
|
|
- if(value.length > 3 ){
|
|
|
|
- if(value.length <= 6){
|
|
|
|
|
|
+
|
|
|
|
+ if (value.length > 3) {
|
|
|
|
+ if (value.length <= 6) {
|
|
continue
|
|
continue
|
|
- }
|
|
|
|
- if(this.deptBudgetList.warehouseName == '肇东金信库' && value.length < 10){
|
|
|
|
- var start = (new Date()).getTime();
|
|
|
|
- while((new Date()).getTime() - start < 200) {
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ if (
|
|
|
|
+ this.deptBudgetList.warehouseName == '肇东金信库' &&
|
|
|
|
+ value.length < 10
|
|
|
|
+ ) {
|
|
|
|
+ var start = new Date().getTime()
|
|
|
|
+ while (new Date().getTime() - start < 200) {}
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
console.log('value23:', value)
|
|
console.log('value23:', value)
|
|
- }
|
|
|
|
- else if(this.deptBudgetList.warehouseName == '白城内陆港' ||this.deptBudgetList.warehouseName == '鲅鱼圈祥腾库'){
|
|
|
|
|
|
+ } else if (
|
|
|
|
+ this.deptBudgetList.warehouseName == '白城内陆港' ||
|
|
|
|
+ this.deptBudgetList.warehouseName == '鲅鱼圈祥腾库'
|
|
|
|
+ ) {
|
|
console.log('value:', value)
|
|
console.log('value:', value)
|
|
- var start = (new Date()).getTime();
|
|
|
|
- while((new Date()).getTime() - start < 400) {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- continue;
|
|
|
|
|
|
+ var start = new Date().getTime()
|
|
|
|
+ while (new Date().getTime() - start < 400) {}
|
|
|
|
+ continue
|
|
}
|
|
}
|
|
if (
|
|
if (
|
|
this.deptBudgetList.warehouseName &&
|
|
this.deptBudgetList.warehouseName &&
|
|
(this.deptBudgetList.warehouseName == '山东诸城迈饶库' ||
|
|
(this.deptBudgetList.warehouseName == '山东诸城迈饶库' ||
|
|
- this.deptBudgetList.warehouseName == '山东园丰库' ||
|
|
|
|
|
|
+ this.deptBudgetList.warehouseName == '山东园丰库' ||
|
|
this.deptBudgetList.warehouseName == '克东千红库' ||
|
|
this.deptBudgetList.warehouseName == '克东千红库' ||
|
|
this.deptBudgetList.warehouseName == '鲅鱼圈祥腾库' ||
|
|
this.deptBudgetList.warehouseName == '鲅鱼圈祥腾库' ||
|
|
this.deptBudgetList.warehouseName == '哈尔滨依兰库' ||
|
|
this.deptBudgetList.warehouseName == '哈尔滨依兰库' ||
|
|
this.deptBudgetList.warehouseName == '龙江金信库' ||
|
|
this.deptBudgetList.warehouseName == '龙江金信库' ||
|
|
- this.deptBudgetList.warehouseName == '白城内陆港'||
|
|
|
|
- this.deptBudgetList.warehouseName == '肇东金信库'||
|
|
|
|
|
|
+ this.deptBudgetList.warehouseName == '白城内陆港' ||
|
|
|
|
+ this.deptBudgetList.warehouseName == '肇东金信库' ||
|
|
this.deptBudgetList.warehouseName == '呼兰大金仓')
|
|
this.deptBudgetList.warehouseName == '呼兰大金仓')
|
|
) {
|
|
) {
|
|
for (var i = 0; i < value.length; i++) {
|
|
for (var i = 0; i < value.length; i++) {
|
|
@@ -259,8 +262,8 @@ export default {
|
|
} else {
|
|
} else {
|
|
console.log('the Web Serial API is not supported.', navigator)
|
|
console.log('the Web Serial API is not supported.', navigator)
|
|
}
|
|
}
|
|
- },
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|