|
@@ -74,7 +74,7 @@
|
|
|
onLoad(value) {
|
|
|
const arr = this.$cache.getCache('commodity')
|
|
|
this.waybillList = JSON.parse(arr)
|
|
|
- console.log(this.waybillList, 14)
|
|
|
+ // console.log(this.waybillList, 14)
|
|
|
var userInfo = this.$cache.getCache('userInfo')
|
|
|
this.userInfo = userInfo
|
|
|
if (value.printType == 'barCode') {
|
|
@@ -308,9 +308,10 @@
|
|
|
.printBarcode(code128)
|
|
|
.setSize(1, 1)
|
|
|
.setAlign('LT')
|
|
|
- .text(' ')
|
|
|
- .text(codeValue + ' \n')
|
|
|
+ // .text(' ')
|
|
|
+ // .text(codeValue + ' \n')
|
|
|
// .print(printerUtil.fillLine())
|
|
|
+
|
|
|
.setAlign('LT')
|
|
|
.setSize(1, 2)
|
|
|
.setSize(2, 1)
|
|
@@ -323,7 +324,6 @@
|
|
|
.waybillList
|
|
|
.senderAddressPhone.substr(7) + ' \n')
|
|
|
.print(shippingAddress(this.waybillList.senderAddressDetails))
|
|
|
- // .print(printerUtil.fillLine())
|
|
|
.setSize(1, 2)
|
|
|
.setSize(2, 1)
|
|
|
.setBold()
|
|
@@ -336,6 +336,8 @@
|
|
|
.consigneeAddressPhone.substr(7) + ' \n')
|
|
|
.print(shippingAddress(this.waybillList.consigneeAddressDetails))
|
|
|
.print(printerUtil.fillLine())
|
|
|
+ .print('下单时间:' + this.waybillList.orderTime)
|
|
|
+ // .print(printerUtil.fillLine())
|
|
|
.text('备注:')
|
|
|
.text('货物类型:' + this.waybillList.cargoType + ' \n')
|
|
|
.print(' 温度需求:' + this.waybillList.temperatureInterval)
|
|
@@ -371,61 +373,96 @@
|
|
|
// .print('结束时间:' + item.endTime)
|
|
|
// .print(printerUtil.fillLine())
|
|
|
item.arr.forEach((item1, index1) => {
|
|
|
- printerJobs
|
|
|
- .print('日期:' + item1.time + '单位℃ ')
|
|
|
- .text('时间 ')
|
|
|
- .text('|')
|
|
|
- .text(' ')
|
|
|
- .text('T1 ')
|
|
|
- .text(' ')
|
|
|
- .text('|')
|
|
|
- .text(' ')
|
|
|
- .text('T2 ')
|
|
|
- .text(' ')
|
|
|
- .text('|')
|
|
|
- .text(' ')
|
|
|
- .text('T3 ')
|
|
|
- .text(' ')
|
|
|
- .text('|')
|
|
|
- .text(' ')
|
|
|
- .text('T4 \n')
|
|
|
- item1.arr.forEach((item2, index2) => {
|
|
|
+ if (item1.arrNum < 2) {
|
|
|
printerJobs
|
|
|
- .text(`${item2[0].time}`)
|
|
|
+ .print('日期:' + item1.time + '单位℃ ')
|
|
|
+ .text('时间 ')
|
|
|
.text('|')
|
|
|
.text(' ')
|
|
|
- .text(
|
|
|
- `${item2[0] == '---' ? '----' : character(item2[0].T_t) }`
|
|
|
- )
|
|
|
+ .text('T1 ')
|
|
|
.text(' ')
|
|
|
.text('|')
|
|
|
.text(' ')
|
|
|
- .text(
|
|
|
- `${item2[1] == '---' ? '----' : character(item2[1].T_t) }`
|
|
|
- )
|
|
|
+ .text('T2 ')
|
|
|
.text(' ')
|
|
|
.text('|')
|
|
|
.text(' ')
|
|
|
- .text(
|
|
|
- `${item2[2] == '---' ? '----' : character(item2[2].T_t) }`
|
|
|
- )
|
|
|
+ .text('T3 ')
|
|
|
.text(' ')
|
|
|
.text('|')
|
|
|
.text(' ')
|
|
|
- .text(
|
|
|
- `${item2[3] == '---' ? '----' : character(item2[3].T_t) }`
|
|
|
- )
|
|
|
+ .text('T4 \n')
|
|
|
+ item1.arr.forEach((item2, index2) => {
|
|
|
+ printerJobs
|
|
|
+ .text(`${item2[0].time}`)
|
|
|
+ .text('|')
|
|
|
+ .text(' ')
|
|
|
+ .text(
|
|
|
+ `${item2[0] == '---' ? '----' : character(item2[0].T_t) }`
|
|
|
+ )
|
|
|
+ .text(' ')
|
|
|
+ .text('|')
|
|
|
+ .text(' ')
|
|
|
+ .text(
|
|
|
+ `${item2[1] == '---' ? '----' : character(item2[1].T_t) }`
|
|
|
+ )
|
|
|
+ .text(' ')
|
|
|
+ .text('|')
|
|
|
+ .text(' ')
|
|
|
+ .text(
|
|
|
+ `${item2[2] == '---' ? '----' : character(item2[2].T_t) }`
|
|
|
+ )
|
|
|
+ .text(' ')
|
|
|
+ .text('|')
|
|
|
+ .text(' ')
|
|
|
+ .text(
|
|
|
+ `${item2[3] == '---' ? '----' : character(item2[3].T_t) }`
|
|
|
+ )
|
|
|
|
|
|
- function character(value) {
|
|
|
- var arr = value.toFixed(1)
|
|
|
- if (arr.length == 3) {
|
|
|
- var arr1 = arr + ' '
|
|
|
- return arr1
|
|
|
- } else {
|
|
|
- return arr
|
|
|
+ function character(value) {
|
|
|
+ var arr = value.toFixed(1)
|
|
|
+ if (arr.length == 3) {
|
|
|
+ var arr1 = arr + ' '
|
|
|
+ return arr1
|
|
|
+ } else {
|
|
|
+ return arr
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ printerJobs
|
|
|
+ .print('日期:' + item1.time + '单位℃ ')
|
|
|
+ .text('时间')
|
|
|
+ .text('|')
|
|
|
+ .text('温度(℃)')
|
|
|
+ .text(' ')
|
|
|
+ .text('时间')
|
|
|
+ .text('|')
|
|
|
+ .text('温度(℃) \n')
|
|
|
+ item1.arr.forEach((item2, index2) => {
|
|
|
+ printerJobs
|
|
|
+ .text(`${item2[0].time}`)
|
|
|
+ .text('|')
|
|
|
+ .text(
|
|
|
+ `${item2[0] == '---' ? '----' : character(item2[0].T_t) }`
|
|
|
+ )
|
|
|
+ .text('|')
|
|
|
+ .text(
|
|
|
+ `${item2[1] == '---' ? '----' : character(item2[1].T_t) }`
|
|
|
+ )
|
|
|
+ .text(' ')
|
|
|
+
|
|
|
+ function character(value) {
|
|
|
+ var arr = value.toFixed(1)
|
|
|
+ if (arr.length == 3) {
|
|
|
+ var arr1 = arr + ' '
|
|
|
+ return arr1
|
|
|
+ } else {
|
|
|
+ return arr
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
// printerJobs.println()
|
|
|
}
|
|
@@ -488,6 +525,8 @@
|
|
|
dataList.title = item.car.carNo
|
|
|
} else if (item.warehouse.id) {
|
|
|
dataList.title = item.warehouse.name
|
|
|
+ } else if (item.coolerBox.id) {
|
|
|
+ dataList.title = item.coolerBox.name
|
|
|
}
|
|
|
arrList.push(dataList)
|
|
|
})
|
|
@@ -587,12 +626,35 @@
|
|
|
const flag = areAllUndefined(result1, result2, result3,
|
|
|
result4)
|
|
|
if (!flag) {
|
|
|
- let list2 = [
|
|
|
- result1 == undefined ? '---' : result1,
|
|
|
- result2 == undefined ? '---' : result2,
|
|
|
- result3 == undefined ? '---' : result3,
|
|
|
- result4 == undefined ? '---' : result4,
|
|
|
- ]
|
|
|
+ function countFalseObjects(objects) {
|
|
|
+ let count = 0;
|
|
|
+ for (let i = 0; i < objects.length; i++) {
|
|
|
+ if (objects[i] === undefined) {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+ const arrNum = countFalseObjects([result1, result2,
|
|
|
+ result3, result4
|
|
|
+ ])
|
|
|
+ let list2 = []
|
|
|
+ if (arrNum < 2) {
|
|
|
+ list2.push(result1 == undefined ? '---' : result1)
|
|
|
+ list2.push(result2 == undefined ? '---' : result2)
|
|
|
+ list2.push(result3 == undefined ? '---' : result3)
|
|
|
+ list2.push(result4 == undefined ? '---' : result4)
|
|
|
+ } else {
|
|
|
+ list2.push(result1 == undefined ? '---' : result1)
|
|
|
+ list2.push(result2 == undefined ? '---' : result2)
|
|
|
+ }
|
|
|
+ // let list2 = [
|
|
|
+ // result1 == undefined ? '---' : result1,
|
|
|
+ // result2 == undefined ? '---' : result2,
|
|
|
+ // result3 == undefined ? '---' : result3,
|
|
|
+ // result4 == undefined ? '---' : result4,
|
|
|
+ // ]
|
|
|
+ item3.arrNum = arrNum
|
|
|
item3.arr.push(list2)
|
|
|
}
|
|
|
|