组盘打印
This commit is contained in:
2
App.vue
2
App.vue
@@ -3,7 +3,7 @@
|
||||
onLaunch: function() {
|
||||
// #ifdef APP-PLUS
|
||||
plus.screen.lockOrientation('portrait-primary');
|
||||
plus.navigator.setFullscreen(true);
|
||||
// plus.navigator.setFullscreen(true);
|
||||
// #endif
|
||||
},
|
||||
onHide: function() {
|
||||
|
||||
@@ -217,7 +217,6 @@ uni-button:after {
|
||||
line-height: 30rpx;
|
||||
font-size: 28rpx;
|
||||
color: #606266;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.filter_input {
|
||||
width: 100%;
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
],
|
||||
"globalStyle": {
|
||||
// "pageOrientation": "landscape",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "uni-app",
|
||||
"navigationBarBackgroundColor": "#d7592f",
|
||||
"backgroundColor": "#ffffff"
|
||||
|
||||
@@ -18,14 +18,12 @@
|
||||
<text class="setup-text" @tap="isUpdate">升级版本</text>
|
||||
</view>
|
||||
<button class="login-btn" :disabled="disabled" @tap="toLogin">确认登录</button>
|
||||
<!-- <button class="login-btn" @tap="test">打印</button> -->
|
||||
<view v-if="version !== ''" class="version-name">v{{version}}</view>
|
||||
<Up-grade v-if="grade === true" @closeUpdate="closeUpdate" :androidUrl="androidUrl"></up-grade>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getCLodop, getPrinterList} from "@/utils/CLodopfuncs.js"
|
||||
import { RSAencrypt } from '@/utils/jsencrypt.js'
|
||||
import {handLogin, pdaUpdate} from '@/utils/getData2.js'
|
||||
import UpGrade from './upgrade.vue'
|
||||
@@ -50,7 +48,7 @@
|
||||
//#ifdef APP-PLUS
|
||||
// 获取本地应用资源版本号
|
||||
plus.runtime.getProperty(plus.runtime.appid, (info) => {
|
||||
console.log(JSON.stringify(info));
|
||||
// console.log(JSON.stringify(info));
|
||||
this.version = info.version;
|
||||
this.versionCode = info.versionCode ;
|
||||
})
|
||||
@@ -60,18 +58,6 @@
|
||||
isUpdate () {
|
||||
this._pdaUpdate()
|
||||
},
|
||||
test() {
|
||||
let LODOP = getCLodop();
|
||||
// 更换为打印服务器ip 不需要加前缀
|
||||
LODOP.PRINT_INIT(null, "192.168.81.198");
|
||||
// 打印机序号 规则为打印服务器打印机列表倒数从0开始 -1为默认打印机
|
||||
LODOP.SET_PRINTER_INDEX(-1);
|
||||
// 设置打印纸大小
|
||||
LODOP.SET_PRINT_PAGESIZE(1, 800, 600, "");
|
||||
// 根据需求插入打印代码
|
||||
LODOP.PRINT(); // 打印
|
||||
// LODOP.PREVIEW()
|
||||
},
|
||||
toSaveUser() {
|
||||
this.saveUser = !this.saveUser
|
||||
},
|
||||
@@ -146,7 +132,7 @@
|
||||
@import '../../common/style/mixin.styl';
|
||||
.p1
|
||||
_font(40rpx,75rpx,#444,666)
|
||||
padding-top: 90rpx
|
||||
padding-top: 190rpx
|
||||
.p2
|
||||
_font(46rpx,1,#444,600)
|
||||
padding: 10rpx 0 55rpx 0
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<view class="filter_input_wraper">
|
||||
<search-box
|
||||
v-model="val1"
|
||||
@handleChange="handleChange"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
@@ -86,6 +85,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getCLodop} from "@/utils/CLodopfuncs.js"
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import SearchBox from '@/components/SearchBox.vue'
|
||||
import {queryPoints, getVehicleType, queryVehicleGroup, groupManual, groupLink, pdaPrintf} from '@/utils/getData2.js'
|
||||
@@ -237,9 +237,49 @@
|
||||
try {
|
||||
let res = await pdaPrintf(this.val1)
|
||||
this.disabled3 = false
|
||||
if (JSON.stringify(res) !== '{}') {
|
||||
setTimeout(this.toPrint(res), 800)
|
||||
}
|
||||
} catch (e) {
|
||||
this.disabled3 = false
|
||||
}
|
||||
},
|
||||
toPrint (data) {
|
||||
let iparr = this.$store.getters.printUrl.split(":")
|
||||
let printUrl = iparr[1].slice(2)
|
||||
let LODOP = getCLodop();
|
||||
if (!(LODOP.webskt && LODOP.webskt.readyState === 1)) {
|
||||
uni.showToast({
|
||||
title: '当前配置ip:' + printUrl + '网络不通,请检查',
|
||||
icon: 'none',
|
||||
duration: 5000
|
||||
})
|
||||
return
|
||||
}
|
||||
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
|
||||
LODOP.SET_LICENSES('浙江省烟草专卖局(公司)', 'C0C4A46A3A0D1F526D426018D9F11921', '', '')
|
||||
// 更换为打印服务器ip 不需要加前缀
|
||||
LODOP.PRINT_INIT(null, printUrl);
|
||||
// 打印机序号 规则为打印服务器打印机列表倒数从0开始 -1为默认打印机
|
||||
LODOP.SET_PRINTER_INDEX(-1);
|
||||
// 设置打印纸大小
|
||||
LODOP.SET_PRINT_PAGESIZE(1, '80mm', '60mm', '');
|
||||
LODOP.ADD_PRINT_RECT('1mm', '3mm', '74mm', '54mm', 0, 1);
|
||||
LODOP.SET_PRINT_STYLE('FontSize', 12);
|
||||
LODOP.SET_PRINT_STYLE('Bold', 1);
|
||||
LODOP.ADD_PRINT_BARCODE('2mm', '4mm', '32mm', '32mm', 'QRCode', data.vehicle_code + '##' + data.material_code + '##' + data.material_qty + '##' + data.pcsn + '##' + data.print_time);
|
||||
LODOP.ADD_PRINT_TEXT('5mm', '35mm', '50mm', '15mm', '载具编码:' + data.vehicle_code);
|
||||
LODOP.ADD_PRINT_TEXT('15mm', '35mm', '50mm', '15mm', '物料编码:' + data.material_code);
|
||||
LODOP.ADD_PRINT_TEXT('25mm', '35mm', '50mm', '15mm', '物料名称:' + data.material_name);
|
||||
LODOP.ADD_PRINT_TEXT('34mm', '5mm', '80mm', '15mm', '物料数量:' + data.material_qty);
|
||||
LODOP.ADD_PRINT_TEXT('41mm', '5mm', '80mm', '15mm', '配盘批次:' + data.pcsn);
|
||||
LODOP.ADD_PRINT_TEXT('48mm', '5mm', '80mm', '15mm', '打印时间:' + data.print_time);
|
||||
LODOP.PRINT(); // 打印
|
||||
// LODOP.PREVIEW()
|
||||
uni.showToast({
|
||||
title: '打印成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable */
|
||||
|
||||
import store from '@/vuex/store'
|
||||
// #ifdef APP-PLUS
|
||||
window = {
|
||||
location: {
|
||||
@@ -13,8 +13,8 @@ window = {
|
||||
var CLODOP = {
|
||||
strWebPageID:"JL68836",
|
||||
strTaskID: "",
|
||||
strHostURI: "http://192.168.81.198:8000",
|
||||
wsHostURI: "ws://192.168.81.198:8000/c_webskt/",
|
||||
strHostURI: store.getters.printUrl,
|
||||
wsHostURI: "ws://" + store.getters.printUrl.slice(7) + "/c_webskt/",
|
||||
VERSION:"6.2.2.0",
|
||||
IVERSION:"6220",
|
||||
CVERSION:"3.0.2.5",
|
||||
@@ -122,8 +122,9 @@ window = {
|
||||
}
|
||||
console.log(this.webskt)
|
||||
console.log(CLODOP.wsHostURI)
|
||||
console.log(rest)
|
||||
let ip = uni.getStorageSync('fl_ip') || '192.168.81.198';
|
||||
console.log(rest)
|
||||
let iparr = store.getters.printUrl.split(":")
|
||||
let ip = iparr[1].slice(2);
|
||||
let wsHostURI = `ws://${ip}:8000/c_webskt/`
|
||||
this.SocketEnable = true;
|
||||
try {
|
||||
|
||||
@@ -253,4 +253,15 @@ export const pdaPrintf = (code) => request({
|
||||
data: {
|
||||
vehicle_code: code
|
||||
}
|
||||
})
|
||||
})
|
||||
// export const pdaPrintf = (code) => {
|
||||
// let res = {
|
||||
// "vehicle_code": "91",
|
||||
// "material_code": "20",
|
||||
// "material_name": "张认义关金",
|
||||
// "material_qty": "100",
|
||||
// "pcsn": "20201112",
|
||||
// "print_time": "20240210"
|
||||
// }
|
||||
// return res
|
||||
// }
|
||||
Reference in New Issue
Block a user