first commit

main
chenjf 2 years ago
parent b554371822
commit e8d6f1c523

@ -11,7 +11,7 @@ window = {
let printListDev = []; let printListDev = [];
let printListOnline = []; let printListOnline = [];
var CLODOP = { var CLODOP = {
strWebPageID: "7BCAAAH", strWebPageID: "827AAAL",
strTaskID: "", strTaskID: "",
strHostURI: "http://localhost:8000", strHostURI: "http://localhost:8000",
wsHostURI: "ws://localhost:8000/c_webskt/", wsHostURI: "ws://localhost:8000/c_webskt/",
@ -215,10 +215,9 @@ window = {
}; };
}, },
wsSend: function(strData) { wsSend: function(strData) {
// console.info(strData); console.log(strData);
console.log(this.webskt); console.log(this.webskt);
console.log(this.wsHostURI); console.log(this.wsHostURI);
console.log(11);
if (this.webskt && this.webskt.readyState == 1) { if (this.webskt && this.webskt.readyState == 1) {
this.Result = null; this.Result = null;
this.iTrySendTimes = 0; this.iTrySendTimes = 0;
@ -1885,10 +1884,12 @@ async function getPrinterList(ip){
let temp = res[1].data.match(/"list":(.+)/); let temp = res[1].data.match(/"list":(.+)/);
const printerListString = temp[1].substr(0,temp[1].length-2); const printerListString = temp[1].substr(0,temp[1].length-2);
let printerListArray = JSON.parse(printerListString); let printerListArray = JSON.parse(printerListString);
let printerList = []; let printerList = [];
printerListArray.forEach(item=>{ printerListArray.forEach(item=>{
printerList.push(item.name) printerList.push(item.name)
}) })
return printerList; return printerList;
}catch(e){ }catch(e){
console.log(e); console.log(e);
@ -1897,4 +1898,4 @@ async function getPrinterList(ip){
export { export {
getCLodop, getCLodop,
getPrinterList getPrinterList
}; //导出getLodop };

@ -4,12 +4,16 @@
<!-- 导航栏 --> <!-- 导航栏 -->
<view v-if="showPop"> <view v-if="showPop">
<view > <view >
<text class="font-sm text-secondary px-3 py-2">ilsApi地址</text> <text class="font-sm text-secondary px-3 py-2">ilsApi地址IP+端口</text>
<input type="text" class="font-md border bg-white px-3" placeholder="请填写ilsApi地址" style="height: 100rpx;" v-model="ilsApi"/> <input type="text" class="font-md border bg-white px-3" placeholder="请填写ilsApi地址IP+端口" style="height: 100rpx;" v-model="ilsApi"/>
</view> </view>
<view > <view >
<text class="font-sm text-secondary px-3 py-2">打印机IP</text> <text class="font-sm text-secondary px-3 py-2">打印机地址IP</text>
<input type="text" class="font-md border bg-white px-3" placeholder="请填写ilsApi地址" style="height: 100rpx;" v-model="printIp"/> <input type="text" class="font-md border bg-white px-3" placeholder="请填写打印机地址IP" style="height: 100rpx;" v-model="printIp"/>
</view>
<view >
<text class="font-sm text-secondary px-3 py-2">打印机名称</text>
<input type="text" class="font-md border bg-white px-3" placeholder="请填写打印机名称" style="height: 100rpx;" v-model="printName"/>
</view> </view>
<view > <view >
<button class="systemSty" @tap="cancelAdd"></button> <button class="systemSty" @tap="cancelAdd"></button>
@ -27,7 +31,8 @@
<script> <script>
import scanCode from "@/components/scan-code/scan-code.vue"; import scanCode from "@/components/scan-code/scan-code.vue";
import { getCLodop } from '@/common/print/CLodopfuncs.js'; // import { getCLodop } from '@/common/print/CLodopfuncs.js';
// import { getPrinterList } from '@/common/print/CLodopfuncs.js';
const printPdf = uni.requireNativePlugin('YanYu-PrintPDF'); const printPdf = uni.requireNativePlugin('YanYu-PrintPDF');
export default { export default {
@ -35,9 +40,12 @@
return { return {
codes: undefined, codes: undefined,
showPop: false, showPop: false,
selectClassEnd:[],
httpRoot: 'http://', httpRoot: 'http://',
ilsApi: '192.168.1.56:9090', ilsApi: '192.168.1.56:9090',
printIp: '192.168.1.26', printIp: '192.168.1.56',
serviceApi: ':8080/ilsApp/print',
printName: 'Xprinter',
onLoad(option) { onLoad(option) {
this.$broadcastScan.init(this.getScancode); this.$broadcastScan.init(this.getScancode);
}, },
@ -55,8 +63,11 @@
methods: { methods: {
pdaSystemInit: function(){ pdaSystemInit: function(){
this.showPop = true; this.showPop = true;
}, },
selectClass(event){
},
confirmAdd() { confirmAdd() {
// //
this.showPop = false; this.showPop = false;
@ -75,30 +86,18 @@
console.log("doPrinter orderCoder: " + orderCoder); console.log("doPrinter orderCoder: " + orderCoder);
console.log("ilsApi:", this.ilsApi); console.log("ilsApi:", this.ilsApi);
console.log("printIp:", this.printIp); console.log("printIp:", this.printIp);
// LODOP.PRINT_INIT(null, "192.168.1.26");
// LODOP.SET_PRINTER_INDEX(-1);
// LODOP.PRINT_INITA(0, 0, "100mm", "150mm", "100X150");
// LODOP.SET_PRINT_PAGESIZE(1, "100mm", "150mm", "");
// LODOP.SET_PRINT_MODE("POS_BASEON_PAPER", true);
// //LODOP.ADD_PRINT_HTM(10, 20, "100mm", "150mm", "<img src="+this.imageData+" style=\"width: 100mm; height: 100mm;\"/>");
// LODOP.ADD_PRINT_PDF(0, 0, "100mm", "150mm", this.imgePdfData);
// LODOP.PRINT();
uni.request({ uni.request({
url: this.httpRoot + this.ilsApi + '/jeecg-boot/front/getOrderPayStateAndPdfBase64?OrderId=' + orderCoder, url: this.httpRoot + this.printIp + this.serviceApi,
method: 'GET', method: 'POST',
data: {
ilsApi: this.ilsApi,
printIp: this.printIp,
orderId: orderCoder,
printName: this.printName
},
success: (res) => { success: (res) => {
console.log( res.data.result); console.log( res);
if(res.data.code==200){ if(res.data.code==200){
let LODOP = getCLodop();
LODOP.PRINT_INIT(null, this.printIp);
LODOP.SET_PRINTER_INDEX(-1);
LODOP.PRINT_INITA(2, 0, "100mm", "150mm", "100X150");
LODOP.SET_PRINT_PAGESIZE(1, "100mm", "150mm", "");
LODOP.SET_PRINT_MODE("POS_BASEON_PAPER", true);
// LODOP.ADD_PRINT_HTM(2, 0, "100mm", "150mm", "<img src="+ this.imgBase64Root + res.data.message+" style=\"width: 100mm; height: 100mm;\"/>");
LODOP.ADD_PRINT_PDF(0, 0, "100mm", "150mm", res.data.result);
LODOP.PRINT();
uni.showToast({ uni.showToast({
title: '面单下发成功.正在打印,请稍候...', title: '面单下发成功.正在打印,请稍候...',
icon: 'none', icon: 'none',
@ -127,49 +126,55 @@
uni.$on('scancodedate', function(data) { uni.$on('scancodedate', function(data) {
console.log('你想要的code', data.code); console.log('你想要的code', data.code);
_this.codes = data.code; _this.codes = data.code;
this.showPop = false; _this.showPop = false;
let orderCoder = data.code; let orderCoder = data.code;
console.log("onShow orderCoder: " + orderCoder); console.log("onShow orderCoder: " + orderCoder);
console.log("ilsApi:", _this.ilsApi); console.log("ilsApi:", _this.ilsApi);
console.log("printIp:", _this.printIp); console.log("printIp:", _this.printIp);
//orderCoder = "SF1642682535344"; console.log("serviceApi:", _this.httpRoot + _this.printIp + _this.serviceApi);
uni.request({ if(orderCoder.length>18){
url: _this.httpRoot + _this.ilsApi + '/jeecg-boot/front/getOrderPayStateAndPdfBase64?OrderId=' + orderCoder, //orderCoder = "SF1642682535344";
method: 'GET', uni.request({
success: (res) => { url: _this.httpRoot + _this.printIp + _this.serviceApi,
console.log( res.data.result); method: 'POST',
if(res.data.code==200){ data: {
let LODOP = getCLodop(); ilsApi: _this.ilsApi,
LODOP.PRINT_INIT(null, _this.printIp); printIp: _this.printIp,
LODOP.SET_PRINTER_INDEX(-1); orderId: orderCoder,
LODOP.PRINT_INITA(2, 0, "100mm", "150mm", "100X150"); printName: _this.printName
LODOP.SET_PRINT_PAGESIZE(1, "100mm", "150mm", ""); },
LODOP.SET_PRINT_MODE("POS_BASEON_PAPER", true); success: (res) => {
// LODOP.ADD_PRINT_HTM(2, 0, "100mm", "150mm", "<img src="+ this.imgBase64Root + res.data.message+" style=\"width: 100mm; height: 100mm;\"/>"); console.log( res);
LODOP.ADD_PRINT_PDF(0, 0, "100mm", "150mm", res.data.result); if(res.data.code==200){
LODOP.PRINT(); uni.showToast({
title: '下发成功.正在打印,请稍候...',
icon: 'none',
duration: 3000
});
}else{
uni.showToast({
title: res.data.message,
icon: 'none',
duration: 3000
})
}
},
fail: (error) => {
console.log("error: ", error);
uni.showToast({ uni.showToast({
title: '下发成功.正在打印,请稍候...', title: '接口访问异常,打印失败',
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
});
}else{
uni.showToast({
title: res.data.message,
icon: 'none',
duration: 3000
}) })
} },
}, });
fail: (error) => { }else{
console.log("error: ", error); uni.showToast({
uni.showToast({ title: '非法单号',
title: '接口访问异常,打印失败', icon: 'none',
icon: 'none', duration: 3000
duration: 3000 })
}) }
},
});
}) })
}, },
getScancode(code) { getScancode(code) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -295,14 +295,14 @@ var render = function () {
_c( _c(
"v-uni-text", "v-uni-text",
{ staticClass: _vm._$g(4, "sc"), attrs: { _i: 4 } }, { staticClass: _vm._$g(4, "sc"), attrs: { _i: 4 } },
[_vm._v("ilsApi地址")] [_vm._v("ilsApi地址IP+端口")]
), ),
_c("v-uni-input", { _c("v-uni-input", {
staticClass: _vm._$g(5, "sc"), staticClass: _vm._$g(5, "sc"),
staticStyle: { height: "100rpx" }, staticStyle: { height: "100rpx" },
attrs: { attrs: {
type: "text", type: "text",
placeholder: "请填写ilsApi地址", placeholder: "请填写ilsApi地址IP+端口",
_i: 5, _i: 5,
}, },
model: { model: {
@ -323,14 +323,14 @@ var render = function () {
_c( _c(
"v-uni-text", "v-uni-text",
{ staticClass: _vm._$g(7, "sc"), attrs: { _i: 7 } }, { staticClass: _vm._$g(7, "sc"), attrs: { _i: 7 } },
[_vm._v("打印机IP")] [_vm._v("打印机地址IP")]
), ),
_c("v-uni-input", { _c("v-uni-input", {
staticClass: _vm._$g(8, "sc"), staticClass: _vm._$g(8, "sc"),
staticStyle: { height: "100rpx" }, staticStyle: { height: "100rpx" },
attrs: { attrs: {
type: "text", type: "text",
placeholder: "请填写ilsApi地址", placeholder: "请填写打印机地址IP",
_i: 8, _i: 8,
}, },
model: { model: {
@ -347,12 +347,40 @@ var render = function () {
_c( _c(
"uni-view", "uni-view",
{ attrs: { _i: 9 } }, { attrs: { _i: 9 } },
[
_c(
"v-uni-text",
{ staticClass: _vm._$g(10, "sc"), attrs: { _i: 10 } },
[_vm._v("打印机名称")]
),
_c("v-uni-input", {
staticClass: _vm._$g(11, "sc"),
staticStyle: { height: "100rpx" },
attrs: {
type: "text",
placeholder: "请填写打印机名称",
_i: 11,
},
model: {
value: _vm._$g(11, "v-model"),
callback: function ($$v) {
_vm.$handleVModelEvent(11, $$v)
},
expression: "printName",
},
}),
],
1
),
_c(
"uni-view",
{ attrs: { _i: 12 } },
[ [
_c( _c(
"v-uni-button", "v-uni-button",
{ {
staticClass: _vm._$g(10, "sc"), staticClass: _vm._$g(13, "sc"),
attrs: { _i: 10 }, attrs: { _i: 13 },
on: { on: {
click: function ($event) { click: function ($event) {
return _vm.$handleViewEvent($event) return _vm.$handleViewEvent($event)
@ -364,8 +392,8 @@ var render = function () {
_c( _c(
"v-uni-button", "v-uni-button",
{ {
staticClass: _vm._$g(11, "sc"), staticClass: _vm._$g(14, "sc"),
attrs: { _i: 11 }, attrs: { _i: 14 },
on: { on: {
click: function ($event) { click: function ($event) {
return _vm.$handleViewEvent($event) return _vm.$handleViewEvent($event)
@ -384,15 +412,15 @@ var render = function () {
_vm._v("当前单号:"), _vm._v("当前单号:"),
_c( _c(
"v-uni-text", "v-uni-text",
{ staticClass: _vm._$g(12, "sc"), attrs: { _i: 12 } }, { staticClass: _vm._$g(15, "sc"), attrs: { _i: 15 } },
[_vm._v(_vm._$g(12, "t0-0"))] [_vm._v(_vm._$g(15, "t0-0"))]
), ),
_vm._$g(13, "i") _vm._$g(16, "i")
? _c( ? _c(
"v-uni-button", "v-uni-button",
{ {
staticClass: _vm._$g(13, "sc"), staticClass: _vm._$g(16, "sc"),
attrs: { _i: 13 }, attrs: { _i: 16 },
on: { on: {
click: function ($event) { click: function ($event) {
return _vm.$handleViewEvent($event) return _vm.$handleViewEvent($event)
@ -402,12 +430,12 @@ var render = function () {
[_vm._v("PDA设置")] [_vm._v("PDA设置")]
) )
: _vm._e(), : _vm._e(),
_vm._$g(14, "i") _vm._$g(17, "i")
? _c( ? _c(
"v-uni-button", "v-uni-button",
{ {
staticClass: _vm._$g(14, "sc"), staticClass: _vm._$g(17, "sc"),
attrs: { _i: 14 }, attrs: { _i: 17 },
on: { on: {
click: function ($event) { click: function ($event) {
return _vm.$handleViewEvent($event) return _vm.$handleViewEvent($event)
@ -420,7 +448,7 @@ var render = function () {
], ],
1 1
), ),
_c("scan-code", { attrs: { _i: 15 } }), _c("scan-code", { attrs: { _i: 18 } }),
], ],
1 1
) )

Loading…
Cancel
Save