|
@@ -216,7 +216,8 @@
|
|
monitorUrl1: '',
|
|
monitorUrl1: '',
|
|
monitorUrl2: '',
|
|
monitorUrl2: '',
|
|
cangid:'',
|
|
cangid:'',
|
|
- paramType:'1'
|
|
|
|
|
|
+ paramType:'1',
|
|
|
|
+ warehouseName:''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
activated() {
|
|
activated() {
|
|
@@ -225,6 +226,7 @@
|
|
this.paramType = this.$route.query.paramType
|
|
this.paramType = this.$route.query.paramType
|
|
this.getList()
|
|
this.getList()
|
|
this.tpyeNo = this.$route.query.tpyeNo
|
|
this.tpyeNo = this.$route.query.tpyeNo
|
|
|
|
+ this.warehouseName = this.$route.query.warehouseName
|
|
this.weighingList.number = this.$route.query.number
|
|
this.weighingList.number = this.$route.query.number
|
|
this.weighingList.binNumber = this.$route.query.binNumber
|
|
this.weighingList.binNumber = this.$route.query.binNumber
|
|
this.weighingList.customer = this.$route.query.customer
|
|
this.weighingList.customer = this.$route.query.customer
|
|
@@ -405,6 +407,7 @@
|
|
baudRate: this.param
|
|
baudRate: this.param
|
|
}); // set baud rate
|
|
}); // set baud rate
|
|
this.reader = port.readable.getReader();
|
|
this.reader = port.readable.getReader();
|
|
|
|
+
|
|
// 监听来自串行设备的数据
|
|
// 监听来自串行设备的数据
|
|
while (true) {
|
|
while (true) {
|
|
const {
|
|
const {
|
|
@@ -422,24 +425,56 @@
|
|
// var receData = HexConvert.ByteToString(value);
|
|
// var receData = HexConvert.ByteToString(value);
|
|
// console.log("receData",receData);
|
|
// console.log("receData",receData);
|
|
var flag = false;
|
|
var flag = false;
|
|
- for (var i = 0; i < value.length; i++) {
|
|
|
|
- var tmp = String.fromCharCode(value[i])
|
|
|
|
- if (tmp == '+') {
|
|
|
|
- flag = true
|
|
|
|
|
|
+ if(this.warehouseName&&this.warehouseName == '山东诸城迈饶库'){
|
|
|
|
+ for (var i = 0; i < value.length; i++) {
|
|
|
|
+ var tmp = String.fromCharCode(value[i])
|
|
|
|
+ if (tmp == '+') {
|
|
|
|
+ flag = true
|
|
|
|
+ }
|
|
|
|
+ if (flag && result.length < 6 && tmp != '+') {
|
|
|
|
+ result += tmp
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (flag && result.length < 6 && tmp != '+') {
|
|
|
|
- result += tmp
|
|
|
|
|
|
+ if (this.tpyeNo != 2) {
|
|
|
|
+ if(parseInt(result)|| parseInt(result) == 0){
|
|
|
|
+ this.weighingList.grossWeight = parseInt(result)
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if(parseInt(result)|| parseInt(result) == 0){
|
|
|
|
+ this.weighingList.tare = parseInt(result)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (this.tpyeNo != 2) {
|
|
|
|
- if(parseInt(result)){
|
|
|
|
- this.weighingList.grossWeight = parseInt(result)
|
|
|
|
|
|
+ else{
|
|
|
|
+ for(var i=0;i<value.length;i++){
|
|
|
|
+ var tmp = String.fromCharCode(value[i])
|
|
|
|
+ if(value[0] != 49 && value[0] != 2){
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ if (tmp == String.fromCharCode(32) ) {
|
|
|
|
+ flag = true
|
|
|
|
+ }
|
|
|
|
+ if (flag && result.length < 7 && tmp != String.fromCharCode(32)) {
|
|
|
|
+ // if(i-1 >=0 &&tmp == String.fromCharCode(48) && value[i-1] == 32){
|
|
|
|
+ // continue
|
|
|
|
+ // }
|
|
|
|
+ // if(i-2 >=0 &&tmp == String.fromCharCode(48) && value[i-2] == 32){
|
|
|
|
+ // continue
|
|
|
|
+ // }
|
|
|
|
+ result += tmp
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- if(parseInt(result)){
|
|
|
|
- this.weighingList.tare = parseInt(result)
|
|
|
|
|
|
+ if (this.tpyeNo != 2) {
|
|
|
|
+ if(parseInt(result)|| parseInt(result) == 0){
|
|
|
|
+ this.weighingList.grossWeight = parseInt(result)*100
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if(parseInt(result)|| parseInt(result) == 0){
|
|
|
|
+ this.weighingList.tare = parseInt(result)*100
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
setTimeout(1000)
|
|
setTimeout(1000)
|
|
// value 是一个 Uint8Array
|
|
// value 是一个 Uint8Array
|
|
}
|
|
}
|