From 34736a9d84ba4c65b72185e78c06891bb44dbf17 Mon Sep 17 00:00:00 2001
From: qq_41295110 <qq_41295110@noreply.gitcode.com>
Date: 星期二, 15 七月 2025 15:25:57 +0800
Subject: [PATCH] Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev
---
static/svgs/folder_bg.svg | 2
utils/common.js | 9
pages/caigoudingdan/generate.vue | 201 +++--------
pages.json | 12
pages/tiaomadaying/tiaomadaying.vue | 501 ++++++++++++++++++++----------
components/blueToothConnector/blueToothConnector.vue | 66 ++-
components/labelPrinterComponent/labelPrinterComponent.vue | 143 ++++++--
pages/index/index.vue | 10
8 files changed, 561 insertions(+), 383 deletions(-)
diff --git a/components/blueToothConnector/blueToothConnector.vue b/components/blueToothConnector/blueToothConnector.vue
index 893395c..7805270 100644
--- a/components/blueToothConnector/blueToothConnector.vue
+++ b/components/blueToothConnector/blueToothConnector.vue
@@ -50,13 +50,15 @@
getAddress
} from '../../utils/auth';
import blueToothTool from '@/plugins/BluetoothTool.js';
+import { nextTick } from "vue";
export default {
name: "blueToothPrinterConnector",
data() {
return {
discoveredDevices: [], // 鏌ヨ鍒扮殑璁惧
connectedDeviceId: "",
- readSuccess: false
+ readSuccess: false,
+ clock: null,
};
},
methods: {
@@ -173,22 +175,28 @@
});
},
async checkReadSuccess(count) {
+ // 鎵归噺鎻掑叆鏃讹紝濡傛灉鍓嶄竴娆″彂閫佹垚鍔燂紝鍒欐竻闄ゅ墠涓�娆$殑鏃堕挓
+ if (this.clock != null) {
+ this.clock.stop();
+ this.clock = null;
+ }
let that = this
return new Promise((resolve, reject) => {
let currentCount = 0;
- let clock = new CommonUtils.timeClock(() => {
+ that.clock = new CommonUtils.timeClock(() => {
+ console.log(that.readSuccess)
currentCount++;
- if (this.readSuccess == true) {
- clock.stop();
+ if (that.readSuccess == true) {
+ that.clock.stop();
resolve(true);
} else if (currentCount >= count) {
- clock.stop();
+ that.clock.stop();
reject(new Error('璇诲彇瓒呮椂'));
}
}, 2000);
// 鍚姩鏃堕挓
- clock.start();
+ that.clock.start();
});
},
async sendMessage(cmd) {
@@ -196,7 +204,7 @@
uni.showLoading({
title: "鍙戦�佷腑..."
})
- console.log("msg: " + cmd);
+ // console.log("msg: " + cmd);
let toast = (msg) => {
uni.showToast({
icon: 'none',
@@ -207,23 +215,29 @@
uni.hideLoading()
}, 3000)
}
-
- const result = blueToothTool.sendByteData(cmd);
- if (!result) {
- return toast("鍙戦�佸け璐�,璇烽噸璇�...")
- }
- this.checkReadSuccess(5)
- .then((res) => {
- if(res === true) {
- toast('鍙戦�佹垚鍔�!!!')
+ let that = this
+ return new Promise((resolve, reject) => {
+ const result = blueToothTool.sendByteData(cmd);
+ if (!result) {
+ toast("鍙戦�佸け璐�,璇烽噸璇�...")
+ reject(false)
}
+ that.checkReadSuccess(5)
+ .then((res) => {
+ if (res === true) {
+ toast('鍙戦�佹垚鍔�!!!')
+ resolve(true)
+ }
+ })
+ .catch((err) => {
+ toast('璁惧寮傚父,璇锋鏌ヨ澶囩姸鎬�...')
+ reject(false)
+ })
+ .finally(() => {
+ that.readSuccess = false
+ })
})
- .catch((err) => {
- toast('璁惧寮傚父,璇锋鏌ヨ澶囩姸鎬�...')
- })
- .finally(() => {
- this.readSuccess = false
- })
+
},
uint8ArrayToSignedArray(uint8Array) {
let signedArray = new Array(uint8Array.length);
@@ -256,10 +270,10 @@
console.log("鎼滅储瀹屾垚");
},
readDataCallback: (dataByteArr) => {
- /* if(that.receiveDataArr.length >= 200) {
- that.receiveDataArr = [];
- }
- that.receiveDataArr.push.apply(that.receiveDataArr, dataByteArr); */
+ // if(that.receiveDataArr.length >= 200) {
+ // that.receiveDataArr = [];
+ // }
+ // that.receiveDataArr.push.apply(that.receiveDataArr, dataByteArr);
this.readSuccess = true
console.log("璇诲彇瀹屾垚" + dataByteArr);
},
diff --git a/components/labelPrinterComponent/labelPrinterComponent.vue b/components/labelPrinterComponent/labelPrinterComponent.vue
index f8333ba..265380b 100644
--- a/components/labelPrinterComponent/labelPrinterComponent.vue
+++ b/components/labelPrinterComponent/labelPrinterComponent.vue
@@ -1,10 +1,12 @@
<template>
- <view>
- <uni-popup ref="popup" type="bottom" popupshow @close="popupCloseHandler">
+ <view class="container" :hidden="isPopup === false">
+ <uni-popup ref="popup" type="bottom" popupshow @change="popupChange">
<view style="height: 80vh; background-color: #fff; padding-bottom: 2rem;">
<blueToothConnectorVue ref="bt"></blueToothConnectorVue>
</view>
</uni-popup>
+ <!-- 浣跨敤uni-popup绫荤殑缁勪欢鏃讹紝褰損opup涓嶆樉绀烘椂锛岀粍浠舵爲涓病鏈塸opup鍐呯殑妯$粍锛屾棤娉曚娇鐢╮ef璋冪敤妯$粍鍐呯殑鍑芥暟锛屾晠闇�瑕佸湪澶栭儴鎸傝浇涓�涓�忔槑鐨勭粍浠� -->
+ <blueToothConnectorVue style="display: none;position: absolute; bottom: 0;right: 0;" ref="bt2"></blueToothConnectorVue>
</view>
</template>
@@ -28,12 +30,16 @@
import {
CStatus
} from '@psdk/cpcl';
+ import {
+ CommonUtils
+ } from '../../utils/common';
+import { nextTick } from "vue";
export default {
name: "lablePrinterComponent",
data() {
return {
- blueToothConnector: null,
+ isPopup: false,
};
},
props: {
@@ -50,15 +56,57 @@
blueToothConnectorVue
},
methods: {
- openPopup() {
+ async openPopup() {
this.$refs.popup.open();
+ // 鍦╬opup涓殑鎿嶄綔閽堝ref bt瀵瑰簲鐨勭粍浠讹紝闇�瑕佸皢bt缁勪欢鐨勭姸鎬佷笌bt2杩涜涓�娆″悓姝�
this.$nextTick(() => {
- this.blueToothConnector = this.$refs.bt
+ this.$refs.bt2 = this.$refs.bt
})
-
+
},
- popupCloseHandler() {
-
+ async popupChange(e) {
+ this.isPopup = e['show']
+ await this.$nextTick()
+ },
+ async batchPrint(commandList) {
+ console.log(this.$refs.bt2)
+ let vm = this;
+ let binarys = [];
+ for (let command of commandList) {
+ switch (vm.printMode) {
+ case "tspl":
+ let tspl = await vm.$printer.tspl().clear();
+ tspl.raw(Raw.text(command))
+ console.log("print command锛歕n" + tspl.command().string())
+ binarys.push(tspl.command().binary());
+ break;
+ case "cpcl":
+ let cpcl = await vm.$printer.cpcl().clear();
+ cpcl.raw(Raw.text(command))
+ console.log("print command锛歕n" + cpcl.command().string())
+ binarys.push(cpcl.command().binary());
+ break;
+ case "esc":
+ let esc = await vm.$printer.esc().clear();
+ esc.raw(Raw.text(command))
+ console.log("print command锛歕n" + esc.command().string())
+ binarys.push(esc.command().binary());
+ break;
+ default:
+ return uni.showToast({
+ icon: 'none',
+ title: 'printMode绫诲瀷閿欒!'
+ })
+ }
+ }
+
+ for(let binary of binarys){
+ let sendSuccess = await this.$refs.bt2.sendMessage(binary);
+ console.log("鍙戦�佹槸鍚︽垚鍔燂細 ", sendSuccess)
+ if(sendSuccess === false) {
+ return
+ }
+ }
},
async execPrint() {
// 妫�鏌ヨ摑鐗欒繛鎺�
@@ -74,48 +122,53 @@
this.showToast("鏃犺澶囪繛鎺�!")
return
}
-
try {
if (typeof this.printInfo === 'function') {
// 浼犲叆鐨刾rintInfo鏄嚱鏁帮紝鐩存帴鎵ц
let msg = await this.printInfo()
-
-
- this.blueToothConnector.sendMessage(msg)
+ this.$refs.bt2.sendMessage(msg)
} else if (typeof this.printInfo === 'string') {
// 浼犲叆鐨勫弬鏁版槸瀛楃涓诧紝鍒欐牴鎹墦鍗版ā寮忚皟鐢ㄤ笉鍚岀殑鎵撳嵃API
// 杩欓噷鐨勫瓧绗︿覆闇�瑕佸搴旀墦鍗版ā寮�
-
- let printStr = this.printInfo.replace(/\n/g, "\r\n")
- let vm = this;
- let binary = null;
- switch (vm.printMode) {
- case "tspl":
- const tspl = await vm.$printer.tspl().clear();
- tspl.raw(Raw.text(printStr))
- console.log("print command锛歕n" + tspl.command().string())
- binary = tspl.command().binary();
- await vm.blueToothConnector.sendMessage(binary);
- break;
- case "cpcl":
- const cpcl = await vm.$printer.cpcl().clear();
- cpcl.raw(Raw.text(printStr))
- console.log("print command锛歕n" + cpcl.command().string())
- binary = cpcl.command().binary();
- await vm.blueToothConnector.sendMessage(binary);
- break;
- case "esc":
- const esc = await vm.$printer.esc().clear();
- esc.raw(Raw.text(printStr))
- console.log("print command锛歕n" + esc.command().string())
- binary = esc.command().binary();
- await vm.blueToothConnector.sendMessage(binary);
- break;
- default:
- return uni.showToast({
- icon: 'none',
- title: 'printMode绫诲瀷閿欒!'
- })
+ if (CommonUtils.isJson(this.printInfo) === true) {
+ // 濡傛灉闇�瑕佹壒閲忎紶杈擄紝闇�瑕佷紶JSON
+ let commandList = JSON.parse(this.printInfo)
+ for (let command of commandList) {
+ command.replace(/\n/g, "\r\n")
+ }
+ this.batchPrint(commandList)
+ } else {
+ let printStr = this.printInfo.replace(/\n/g, "\r\n")
+ let vm = this;
+ let binary = null;
+ switch (vm.printMode) {
+ case "tspl":
+ const tspl = await vm.$printer.tspl().clear();
+ tspl.raw(Raw.text(printStr))
+ console.log("print command锛歕n" + tspl.command().string())
+ binary = tspl.command().binary();
+ await this.$refs.bt2.sendMessage(binary);
+ break;
+ case "cpcl":
+ const cpcl = await vm.$printer.cpcl().clear();
+ cpcl.raw(Raw.text(printStr))
+ console.log("print command锛歕n" + cpcl.command().string())
+ binary = cpcl.command().binary();
+ await this.$refs.bt2.sendMessage(binary);
+ break;
+ case "esc":
+ const esc = await vm.$printer.esc().clear();
+ esc.raw(Raw.text(printStr))
+ console.log("print command锛歕n" + esc.command().string())
+ binary = esc.command().binary();
+ await this.$refs.bt2.sendMessage(binary);
+ break;
+ default:
+ return uni.showToast({
+ icon: 'none',
+ title: 'printMode绫诲瀷閿欒!'
+ })
+ }
}
} else {
uni.showToast({
@@ -140,4 +193,8 @@
* {
box-sizing: border-box;
}
+ .container[hidden] {
+ padding: 0 !important;
+ height: 0 !important;
+ }
</style>
\ No newline at end of file
diff --git a/pages.json b/pages.json
index 2166b6f..85305f2 100644
--- a/pages.json
+++ b/pages.json
@@ -506,6 +506,18 @@
}
},
{
+ "path": "pages/caigoudingdan/generate",
+ "style": {
+ "navigationBarTitleText": "鏉$爜鐢熸垚"
+ }
+ },
+ {
+ "path": "pages/caigoudingdan/caigoudingdan",
+ "style": {
+ "navigationBarTitleText": "閲囪喘璁㈠崟"
+ }
+ },
+ {
"path" : "pages/MJGL/shangmudan/table",
"style" :
{
diff --git a/pages/caigoudingdan/generate.vue b/pages/caigoudingdan/generate.vue
index ce4870c..95ab858 100644
--- a/pages/caigoudingdan/generate.vue
+++ b/pages/caigoudingdan/generate.vue
@@ -46,13 +46,16 @@
</view>
<view class="buttons">
<button class="btn-b" size="mini" type="default" @tap="getList()">鏉$爜鐢熸垚</button>
- <button class="btn-c" size="mini" type="default" @tap="search">鎵撳嵃</button>
+ <button class="btn-c" :disabled="codeGenComplete == false" size="mini" type="default"
+ @tap="search">鎵撳嵃</button>
+ <!-- <button class="btn-c" size="mini" type="default"
+ @tap="exit">閫�鍑�</button> -->
</view>
</view>
<view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
- <view class="list" v-for="(item,index) in listData" :key="index" @tap="toSon(item)">
+ <view class="list" v-for="(item,index) in listData" :key="index">
<uni-card :title="item.鐗╂枡浠g爜" :extra="'No. ' + Number(index+1)" style="margin: 10px;">
<view class="card-detail">
<view class="detail">
@@ -70,11 +73,14 @@
</view>
</uni-card>
+
</view>
- <labelPrinterComponentVue ref="labelPrinter" :printInfo="printInfo" :printMode="'cpcl'">
- </labelPrinterComponentVue>
<view class="over" v-if="listData.length == 0">鏆傛棤鏁版嵁</view>
<view class="over" v-if="listData.length != 0">宸插埌搴�</view>
+ <view>
+ <labelPrinterComponentVue ref="labelPrinter" :printInfo="printInfo" :printMode="'cpcl'">
+ </labelPrinterComponentVue>
+ </view>
</view>
</template>
@@ -85,6 +91,10 @@
import {
CommonUtils
} from "../../utils/common";
+ import {
+ nextTick
+ } from "vue";
+ import labelPrinterComponentVue from "@/components/labelPrinterComponent/labelPrinterComponent.vue"
export default {
data() {
return {
@@ -95,6 +105,7 @@
linterid: '',
HEntryID: '',
hmaterid: '',
+ codeGenComplete: false,
baseInfo: {
HBillNo: '',
HMainID: '',
@@ -109,10 +120,15 @@
HQty: '',
HMinQty: '',
HBQty: '',
+ HSupID: '',
},
sWhere: '',
listData: [],
+
}
+ },
+ components: {
+ labelPrinterComponentVue
},
onLoad(e) {
console.log(e)
@@ -125,8 +141,8 @@
getData() {
CommonUtils.doRequest(
"/Cg_POOrderBill/list", {
- sWhere: ` and hmainid = ${this.linterid} and HMaterID = ${this.hmaterid}`
- ,user: this.userInfo.Czymc
+ sWhere: ` and hmainid = ${this.linterid} and HMaterID = ${this.hmaterid}`,
+ user: this.userInfo.Czymc
},
(res) => {
console.log('閲囪喘璁㈠崟: ', res)
@@ -144,7 +160,8 @@
HMaterName: data[0]['鐗╂枡鍚嶇О'],
HMaterModel: data[0]['瑙勬牸鍨嬪彿'],
HQty: data[0]['鏁伴噺'],
- HMTONo: data[0]['璁″垝璺熻釜鍙�']
+ HMTONo: data[0]['璁″垝璺熻釜鍙�'],
+ HSupID: data[0]['HSupID']
}
this.listData = data
} else {
@@ -169,146 +186,34 @@
}
},
async search() {
+ // #ifndef APP-PLUS
+ uni.showModal({
+ content: "涓嶆敮鎸佽摑鐗欐墦鍗板姛鑳斤紝璇峰垏鎹㈡墜鏈�...",
+ })
+ return
+ // #endif
if (this.$printer.isConnected() === false) {
this.$refs.labelPrinter.openPopup()
} else {
- // this.printInfo = async () => {
- // let cpcl = await this.$printer.cpcl().clear()
- // .page(new CPage({
- // width: 608,
- // height: 400
- // }))
- // .qrcode(new CQRCode({
- // x: 500,
- // y: 30,
- // width: 3,
- // content: this.generatedBarCode,
- // codeRotation: CCodeRotation.ROTATION_0,
- // level: CCorrectLevel.L
- // }))
- // .text(new CText({
- // x: 30,
- // y: 30,
- // content: "渚涘簲鍟�: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 80,
- // content: "渚涘簲鍟嗘枡鍙�: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 130,
- // content: "鐗╂枡缂栫爜: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 180,
- // content: "鐗╂枡鍒嗙粍: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 300,
- // y: 180,
- // content: "瑙勬牸鍨嬪彿: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 230,
- // content: "鏁伴噺: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 300,
- // y: 230,
- // content: "鏃ユ湡: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 280,
- // content: "妫�楠屽憳: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 300,
- // y: 280,
- // content: "璁″垝璺熻釜鍙�: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 330,
- // content: "妫�楠岀粨鏋�: ",
- // font: CFont.TSS24
- // }))
- // .box(new CBox({
- // topLeftX: 260,
- // topLeftY: 320,
- // bottomRightX: 280,
- // bottomRightY: 340,
- // lineWidth: 4,
- // }))
- // .text(new CText({
- // x: 290,
- // y: 320,
- // content: "鍚堟牸",
- // font: CFont.TSS24
- // }))
- // .box(new CBox({
- // topLeftX: 360,
- // topLeftY: 320,
- // bottomRightX: 380,
- // bottomRightY: 340,
- // lineWidth: 4,
- // }))
- // .text(new CText({
- // x: 390,
- // y: 320,
- // content: "涓嶅悎鏍�",
- // font: CFont.TSS24
- // }))
- // .box(new CBox({
- // topLeftX: 480,
- // topLeftY: 320,
- // bottomRightX: 500,
- // bottomRightY: 340,
- // lineWidth: 4,
- // }))
- // .text(new CText({
- // x: 510,
- // y: 320,
- // content: "鐗归噰",
- // font: CFont.TSS24
- // }))
- // .form(new CForm())
- // .print();
- // console.log(cpcl.command().string())
- // return cpcl.command().binary()
- // }
- // await this.$nextTick(() => {
- // this.$refs.labelPrinter.execPrint()
- // })
-
- this.printInfo = `! 0 200 200 400 1
+ let printContent = []
+ let printInfoBuffer = []
+ let count = 0
+ for (let listOne of this.listData) {
+ printContent.push(`! 0 200 200 400 1
PAGE-WIDTH 608
SETQRVER 3
B QR 500 30 M 2 U 3
-LA,${this.generatedBarCode}
+LA,${listOne['鏉$爜缂栧彿']}
ENDQR
-T 24 0 30 30 渚涘簲鍟�:
+T 24 0 30 30 渚涘簲鍟�: ${listOne['渚涘簲鍟�']}
T 24 0 30 80 渚涘簲鍟嗘枡鍙�:
-T 24 0 30 130 鐗╂枡缂栫爜:
-T 24 0 30 180 鐗╂枡鍒嗙粍:
-T 24 0 300 180 瑙勬牸鍨嬪彿:
-T 24 0 30 230 鏁伴噺:
-T 24 0 300 230 鏃ユ湡:
+T 24 0 30 130 鐗╂枡缂栫爜: ${listOne['鐗╂枡浠g爜']}
+T 24 0 30 180 鐗╂枡鍒嗙粍: ${listOne['鎵樺彿']}
+T 24 0 300 180 瑙勬牸鍨嬪彿: ${listOne['瑙勬牸鍨嬪彿']}
+T 24 0 30 230 鏁伴噺: ${listOne['鏁伴噺']}
+T 24 0 300 230 鏃ユ湡: ${listOne['鏃ユ湡'].split(" ")[0]}
T 24 0 30 280 妫�楠屽憳:
-T 24 0 300 280 璁″垝璺熻釜鍙�:
+T 24 0 300 280 璁″垝璺熻釜鍙�: ${listOne['璁″垝璺熻釜鍙�']}
T 24 0 30 330 妫�楠岀粨鏋�:
BOX 260 330 280 350 4
T 24 0 290 330 鍚堟牸
@@ -317,9 +222,18 @@
BOX 480 330 500 350 4
T 24 0 510 330 鐗归噰
FORM
-PRINT`
+PRINT`)
+ count++;
+ if (count == 10) {
+ printInfoBuffer.push(printContent.join("\r\n"))
+ count = 0
+ printContent = []
+ }
+ }
+ printInfoBuffer.push(printContent.join("\r\n"))
+ this.printInfo = JSON.stringify(printInfoBuffer)
-
+ printInfoBuffer = []
await this.$nextTick(() => {
this.$refs.labelPrinter.execPrint()
@@ -352,7 +266,9 @@
success: (res) => {
if (res.data.count == 1) {
this.listData = res.data.data
+ this.codeGenComplete = true
} else {
+ this.codeGenComplete = false
uni.showToast({
title: res.data.Message,
icon: 'none'
@@ -427,6 +343,11 @@
font-size: 28rpx;
}
+ button[disabled] {
+ background-color: #acacac;
+ color: #fff;
+ }
+
.btn-a {
background-color: #acacac;
color: #fff;
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 4ef178c..d26af04 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -181,7 +181,7 @@
},
{
img: '../../static/icon/icon16.png',
- text: '鏉$爜鎵撳嵃',
+ text: '鏉ユ枡鏉$爜鎵撳嵃',
url: '/pages/tiaomadaying/tiaomadaying',
id: 28,
},
@@ -190,7 +190,13 @@
text: '涓婃ā鍗�',
url: '/pages/MJGL/shangmudan/table',
id: 29,
- }
+ },
+ {
+ img: '../../static/icon/icon16.png',
+ text: '閲囪喘璁㈠崟',
+ url: '/pages/caigoudingdan/caigoudingdan',
+ id: 30,
+ },
]
}
},
diff --git a/pages/tiaomadaying/tiaomadaying.vue b/pages/tiaomadaying/tiaomadaying.vue
index e7a6b89..5692644 100644
--- a/pages/tiaomadaying/tiaomadaying.vue
+++ b/pages/tiaomadaying/tiaomadaying.vue
@@ -1,12 +1,12 @@
<template>
<view class="container">
<view class="content">
- <view class="header"></view>
+ <view class="header">鍩烘湰淇℃伅</view>
<view class="items">
<view class="item">
<view class="left">鏉$爜缂栧彿锛�</view>
<view class="right">
- <input name="HBarCode" disabled v-model="lailiaoInfo.barCodeNo" placeholder="璇锋壂鎻忔潵鏂欐潯鐮�" />
+ <input name="HBarCode" v-model="lailiaoInfo.barCodeNo" placeholder="璇锋壂鎻忔潵鏂欐潯鐮�" />
</view>
<view>
<uni-icons type="scan"
@@ -17,70 +17,74 @@
<view class="item">
<view class="left">婧愬崟鍙凤細</view>
<view class="right">
- <input name="HSourceBillNo" v-model="lailiaoInfo.HSourceBillNo" />
+ <input name="HBillNo" disabled v-model="lailiaoInfo.HBillNo" />
</view>
</view>
<view class="item">
<view class="left">婧愬崟琛屽彿锛�</view>
<view class="right">
- <input name="HSourceBillLineNo" v-model="lailiaoInfo.HSourceBillLineNo" />
+ <input name="HBillLineNo" disabled v-model="lailiaoInfo.HBillLineNo" />
</view>
</view>
<view class="item">
<view class="left">鐗╂枡缂栫爜锛�</view>
<view class="right">
- <input name="HMaterNo" v-model="lailiaoInfo.HMaterNo" />
+ <input name="HMaterNo" disabled v-model="lailiaoInfo.HMaterNumber" />
</view>
</view>
<view class="item">
<view class="left">鐗╂枡鍚嶇О锛�</view>
<view class="right">
- <input name="HMaterName" v-model="lailiaoInfo.HMaterName" />
+ <input name="HMaterName" disabled v-model="lailiaoInfo.HMaterName" />
</view>
</view>
<view class="item">
<view class="left">瑙勬牸鍨嬪彿锛�</view>
<view class="right">
- <input name="HMaterType" v-model="lailiaoInfo.HMaterType" />
+ <input name="HMaterType" disabled v-model="lailiaoInfo.HMaterModel" />
</view>
</view>
<view class="item">
<view class="left">鎵规锛�</view>
<view class="right">
- <input name="HBatchNo" v-model="lailiaoInfo.HBatchNo" />
+ <input name="HBatchNo" disabled v-model="lailiaoInfo.HBatchNo" />
</view>
</view>
<view class="item">
<view class="left">鏁伴噺锛�</view>
<view class="right">
- <input name="HQty" v-model="lailiaoInfo.HQty" />
+ <input name="HQty" disabled v-model="lailiaoInfo.HQty" />
</view>
</view>
<view class="item">
<view class="left">MTO鍙凤細</view>
<view class="right">
- <input name="HMTONo" v-model="lailiaoInfo.HMTONo" />
+ <input name="HMTONo" disabled v-model="lailiaoInfo.HMTONo" />
</view>
</view>
<view class="item">
<view class="left">渚涘簲鍟嗭細</view>
<view class="right">
- <input name="HSupName" v-model="lailiaoInfo.HSupName" />
+ <input name="HSupName" disabled v-model="lailiaoInfo.HSupName" />
</view>
</view>
<view class="item">
<view class="left">渚涘簲鍟嗙畝绉帮細</view>
<view class="right">
- <input name="HSupNameShort" v-model="lailiaoInfo.HSupNameShort" />
+ <input name="HSupNameShort" disabled v-model="lailiaoInfo.HSupNameShort" />
</view>
</view>
</view>
</view>
<view class="operation-zone">
- <button @click="print">鎵撳嵃</button>
- <labelPrinterComponentVue ref="labelPrinter" :printInfo="printInfo" :printMode="'cpcl'">
- </labelPrinterComponentVue>
+ <button class="btn-c" :disabled="buttonStatus.btn1 == false" @click="GenereateBarCode">鐢熸垚</button>
+ <button class="btn-c" :disabled="buttonStatus.btn2 == false" @click="print">鎵撳嵃</button>
+ <view></view>
+ <button class="btn-c" @click="setClearLailiaoInfo">鏂板</button>
+ <button class="btn-c" @click="exit">閫�鍑�</button>
</view>
+ <labelPrinterComponentVue ref="labelPrinter" :printInfo="printInfo" :printMode="'cpcl'">
+ </labelPrinterComponentVue>
</view>
</template>
@@ -118,18 +122,30 @@
return {
printInfo: "",
userInfo: getUserInfo(),
+ buttonStatus: {
+ btn1: true,
+ btn2: false
+ },
+ generatedBarCode: '',
lailiaoInfo: {
+ HMainID: '',
+ HSubID: '',
+ HOrderBillNo: '',
+ HMaterID: '',
barCodeNo: '',
- HSourceBillNo: '',
- HSourceBillLineNo: '',
- HMaterNo: '',
+ HBillNo: '',
+ HBillLineNo: '',
+ HMaterNumber: '',
HMaterName: '',
- HMaterType: '',
+ HMaterModel: '',
HBatchNo: '',
HQty: '',
HMTONo: '',
HSupName: '',
- HSupNameShort: ''
+ HSupNameShort: '',
+ HMinQty: '',
+ HBQty: '',
+ HSupID: ''
}
};
},
@@ -142,149 +158,149 @@
this.$refs.labelPrinter.openPopup()
} else {
// this.printInfo = async () => {
- // let cpcl = await this.$printer.cpcl().clear()
- // .page(new CPage({
- // width: 608,
- // height: 400
- // }))
- // .qrcode(new CQRCode({
- // x: 500,
- // y: 30,
- // width: 3,
- // content: "PDDZDA00017106",
- // codeRotation: CCodeRotation.ROTATION_0,
- // level: CCorrectLevel.L
- // }))
- // .text(new CText({
- // x: 30,
- // y: 30,
- // content: "渚涘簲鍟�: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 80,
- // content: "渚涘簲鍟嗘枡鍙�: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 130,
- // content: "鐗╂枡缂栫爜: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 180,
- // content: "鐗╂枡鍒嗙粍: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 300,
- // y: 180,
- // content: "瑙勬牸鍨嬪彿: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 230,
- // content: "鏁伴噺: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 300,
- // y: 230,
- // content: "鏃ユ湡: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 280,
- // content: "妫�楠屽憳: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 300,
- // y: 280,
- // content: "璁″垝璺熻釜鍙�: ",
- // font: CFont.TSS24
- // }))
- // .text(new CText({
- // x: 30,
- // y: 330,
- // content: "妫�楠岀粨鏋�: ",
- // font: CFont.TSS24
- // }))
- // .box(new CBox({
- // topLeftX: 260,
- // topLeftY: 320,
- // bottomRightX: 280,
- // bottomRightY: 340,
- // lineWidth: 4,
- // }))
- // .text(new CText({
- // x: 290,
- // y: 320,
- // content: "鍚堟牸",
- // font: CFont.TSS24
- // }))
- // .box(new CBox({
- // topLeftX: 360,
- // topLeftY: 320,
- // bottomRightX: 380,
- // bottomRightY: 340,
- // lineWidth: 4,
- // }))
- // .text(new CText({
- // x: 390,
- // y: 320,
- // content: "涓嶅悎鏍�",
- // font: CFont.TSS24
- // }))
- // .box(new CBox({
- // topLeftX: 480,
- // topLeftY: 320,
- // bottomRightX: 500,
- // bottomRightY: 340,
- // lineWidth: 4,
- // }))
- // .text(new CText({
- // x: 510,
- // y: 320,
- // content: "鐗归噰",
- // font: CFont.TSS24
- // }))
- // .form(new CForm())
- // .print();
- // console.log(cpcl.command().string())
- // return cpcl.command().binary()
+ // let cpcl = await this.$printer.cpcl().clear()
+ // .page(new CPage({
+ // width: 608,
+ // height: 400
+ // }))
+ // .qrcode(new CQRCode({
+ // x: 500,
+ // y: 30,
+ // width: 3,
+ // content: this.generatedBarCode,
+ // codeRotation: CCodeRotation.ROTATION_0,
+ // level: CCorrectLevel.L
+ // }))
+ // .text(new CText({
+ // x: 30,
+ // y: 30,
+ // content: "渚涘簲鍟�: ",
+ // font: CFont.TSS24
+ // }))
+ // .text(new CText({
+ // x: 30,
+ // y: 80,
+ // content: "渚涘簲鍟嗘枡鍙�: ",
+ // font: CFont.TSS24
+ // }))
+ // .text(new CText({
+ // x: 30,
+ // y: 130,
+ // content: "鐗╂枡缂栫爜: ",
+ // font: CFont.TSS24
+ // }))
+ // .text(new CText({
+ // x: 30,
+ // y: 180,
+ // content: "鐗╂枡鍒嗙粍: ",
+ // font: CFont.TSS24
+ // }))
+ // .text(new CText({
+ // x: 300,
+ // y: 180,
+ // content: "瑙勬牸鍨嬪彿: ",
+ // font: CFont.TSS24
+ // }))
+ // .text(new CText({
+ // x: 30,
+ // y: 230,
+ // content: "鏁伴噺: ",
+ // font: CFont.TSS24
+ // }))
+ // .text(new CText({
+ // x: 300,
+ // y: 230,
+ // content: "鏃ユ湡: ",
+ // font: CFont.TSS24
+ // }))
+ // .text(new CText({
+ // x: 30,
+ // y: 280,
+ // content: "妫�楠屽憳: ",
+ // font: CFont.TSS24
+ // }))
+ // .text(new CText({
+ // x: 300,
+ // y: 280,
+ // content: "璁″垝璺熻釜鍙�: ",
+ // font: CFont.TSS24
+ // }))
+ // .text(new CText({
+ // x: 30,
+ // y: 330,
+ // content: "妫�楠岀粨鏋�: ",
+ // font: CFont.TSS24
+ // }))
+ // .box(new CBox({
+ // topLeftX: 260,
+ // topLeftY: 320,
+ // bottomRightX: 280,
+ // bottomRightY: 340,
+ // lineWidth: 4,
+ // }))
+ // .text(new CText({
+ // x: 290,
+ // y: 320,
+ // content: "鍚堟牸",
+ // font: CFont.TSS24
+ // }))
+ // .box(new CBox({
+ // topLeftX: 360,
+ // topLeftY: 320,
+ // bottomRightX: 380,
+ // bottomRightY: 340,
+ // lineWidth: 4,
+ // }))
+ // .text(new CText({
+ // x: 390,
+ // y: 320,
+ // content: "涓嶅悎鏍�",
+ // font: CFont.TSS24
+ // }))
+ // .box(new CBox({
+ // topLeftX: 480,
+ // topLeftY: 320,
+ // bottomRightX: 500,
+ // bottomRightY: 340,
+ // lineWidth: 4,
+ // }))
+ // .text(new CText({
+ // x: 510,
+ // y: 320,
+ // content: "鐗归噰",
+ // font: CFont.TSS24
+ // }))
+ // .form(new CForm())
+ // .print();
+ // console.log(cpcl.command().string())
+ // return cpcl.command().binary()
// }
// await this.$nextTick(() => {
- // this.$refs.labelPrinter.execPrint()
+ // this.$refs.labelPrinter.execPrint()
// })
this.printInfo = `! 0 200 200 400 1
PAGE-WIDTH 608
SETQRVER 3
B QR 500 30 M 2 U 3
-LA,PDDZDA00017106
+LA,${this.generatedBarCode}
ENDQR
-T 24 0 30 30 渚涘簲鍟�:
-T 24 0 30 80 渚涘簲鍟嗘枡鍙�:
-T 24 0 30 130 鐗╂枡缂栫爜:
+T 24 0 30 30 渚涘簲鍟�: ${this.lailiaoInfo.HSupName}
+T 24 0 30 80 渚涘簲鍟嗘枡鍙�:
+T 24 0 30 130 鐗╂枡缂栫爜: ${this.lailiaoInfo.HMaterName}
T 24 0 30 180 鐗╂枡鍒嗙粍:
-T 24 0 300 180 瑙勬牸鍨嬪彿:
-T 24 0 30 230 鏁伴噺:
+T 24 0 300 180 瑙勬牸鍨嬪彿: ${this.lailiaoInfo.HMaterModel}
+T 24 0 30 230 鏁伴噺: ${this.lailiaoInfo.HQty}
T 24 0 300 230 鏃ユ湡:
T 24 0 30 280 妫�楠屽憳:
-T 24 0 300 280 璁″垝璺熻釜鍙�:
+T 24 0 300 280 璁″垝璺熻釜鍙�: ${this.lailiaoInfo.HMTONo || ''}
T 24 0 30 330 妫�楠岀粨鏋�:
-BOX 260 320 280 340 4
-T 24 0 290 320 鍚堟牸
-BOX 360 320 380 340 4
-T 24 0 390 320 涓嶅悎鏍�
-BOX 480 320 500 340 4W
-T 24 0 510 320 鐗归噰
+BOX 260 330 280 350 4
+T 24 0 290 330 鍚堟牸
+BOX 360 330 380 350 4
+T 24 0 390 330 涓嶅悎鏍�
+BOX 480 330 500 350 4
+T 24 0 510 330 鐗归噰
FORM
PRINT`
@@ -296,7 +312,7 @@
}
},
setLailiaoInfo(data, row) {
- if(row > data.length) {
+ if (row > data.length) {
return uni.showToast({
icon: 'none',
title: '鏌ヨ鐨勫崟鎹彿涓嶅瓨鍦�...'
@@ -304,14 +320,47 @@
}
let d = data[row - 1]
this.lailiaoInfo = Object.assign(this.lailiaoInfo, {
- HMaterNo: d['鐗╂枡缂栫爜'],
+ HMaterNumber: d['鐗╂枡缂栫爜'],
HMaterName: d['鐗╂枡鍚嶇О'],
- HMaterType: d['瑙勬牸鍨嬪彿'],
+ HMaterModel: d['瑙勬牸鍨嬪彿'],
HBatchNo: d['鎵瑰彿'],
HQty: d['鏁伴噺'],
+ HMinQty: d['鏁伴噺'],
+ HBQty: d['鏁伴噺'],
+ HSupID: d['HSupID'],
HSupName: d['渚涘簲鍟�'],
- HSupNameShort: d['渚涘簲鍟�']
- })
+ HSupNameShort: d['渚涘簲鍟�'],
+ HMTONo: d['璁㈠崟璺熻釜鍙�'],
+ HMainID: d['linterid'],
+ HSubID: d['HEntryID'],
+ HMaterID: d['HMaterID'],
+ })
+ },
+ setClearLailiaoInfo() {
+ this.lailiaoInfo = {
+ HMainID: '',
+ HSubID: '',
+ HOrderBillNo: '',
+ HMaterID: '',
+ barCodeNo: '',
+ HBillNo: '',
+ HBillLineNo: '',
+ HMaterNumber: '',
+ HMaterName: '',
+ HMaterModel: '',
+ HBatchNo: '',
+ HQty: '',
+ HMTONo: '',
+ HSupName: '',
+ HSupNameShort: '',
+ HMinQty: '',
+ HBQty: '',
+ }
+
+ this.buttonStatus = {
+ btn1: true,
+ btn2: false
+ }
},
toScanCode() {
uni.scanCode({
@@ -328,12 +377,12 @@
}
let barCodeInfo = res.result.split("@")
let [PurchaseBillNo, Row] = barCodeInfo
- this.lailiaoInfo.HSourceBillNo = PurchaseBillNo,
- this.lailiaoInfo.HSourceBillLineNo = Row
- console.log( {
- sWhere: ` and 鍗曟嵁鍙� = '${PurchaseBillNo}'`,
- user: this.userInfo.Czymc,
- })
+ this.lailiaoInfo.HBillNo = PurchaseBillNo,
+ this.lailiaoInfo.HBillLineNo = Row
+ console.log({
+ sWhere: ` and 鍗曟嵁鍙� = '${PurchaseBillNo}'`,
+ user: this.userInfo.Czymc,
+ })
CommonUtils.doRequest(
"/Cg_POOrderBill/list", {
sWhere: ` and 鍗曟嵁鍙� = '${PurchaseBillNo}'`,
@@ -341,8 +390,11 @@
},
(res) => {
console.log('閲囪喘璁㈠崟: ', res)
- let {data, count} = res.data
- if(count > 0){
+ let {
+ data,
+ count
+ } = res.data
+ if (count > 0) {
this.setLailiaoInfo(data, Row)
}
},
@@ -354,49 +406,117 @@
}
}
});
+ },
+ GenereateBarCode() {
+ let sMain = []
+ sMain[0] = this.lailiaoInfo
+ let sMainStr = JSON.stringify(sMain);
+ //鑾峰彇閫夋嫨鐨勭粍缁�
+ let HOrgType = uni.getStorageSync('Organization');
+ //鑾峰彇閫夋嫨鐨勫伐鍘備唬鐮�
+ let CampanyName = "xxx";
+ //鑾峰彇閫夋嫨鐨勬簮鍗曠被鍨�
+ let HSourceBillType = "鏉ユ枡閫氱煡鍗�";
+ //鑾峰彇閫夋嫨鐨勬潯鐮佺被鍨�
+ let HSelectBarCodeType = "鍞竴鏉$爜";
+ //鑾峰彇褰撳墠鐧诲綍浜哄憳
+ let UserName = uni.getStorageSync('HUserName');
+ let sMainSub = sMainStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' +
+ CampanyName + ';' + UserName;
+
+ CommonUtils.doRequest(
+ "/Sc_BarCode/Sub_SaveBill", {
+ msg: sMainSub,
+ CampanyName: CampanyName
+ },
+ (res) => {
+ console.log(res)
+ let {
+ data,
+ count,
+ Message
+ } = res.data
+ if (count > 0) {
+ this.buttonStatus = {
+ btn1: false,
+ btn2: true
+ }
+ this.generatedBarCode = data[0]['鏉$爜缂栧彿']
+ console.log(this.generatedBarCode)
+ uni.showToast({
+ icon: 'none',
+ title: Message
+ })
+ } else {
+ uni.showToast({
+ icon: 'none',
+ title: Message
+ })
+ }
+ },
+ (err) => {
+
+ },
+ "POST"
+ )
+ },
+ exit() {
+ uni.navigateBack()
}
}
}
</script>
-<style lang="scss">
+<style lang="scss" scoped>
* {
box-sizing: border-box;
}
input {
padding: 8rpx 20rpx;
- font-size: 24rpx;
- line-height: 24rpx;
+ font-size: 30rpx;
+ line-height: 30rpx;
+ }
+
+ .uni-input-input[disabled] {
+ background-color: #e4e4e4;
}
.container {
display: flex;
flex-direction: column;
- height: 100%;
+ height: 100vh;
+ padding: 20rpx 0;
.content {
flex: 1;
+ background-image: url('/static/svgs/folder_bg.svg');
+ background-size: cover;
+ padding: 20rpx;
+
+ .header {
+ font-size: 30rpx;
+ }
.items {
display: flex;
flex-direction: column;
gap: 10rpx;
- padding: 20rpx;
+ padding: 40rpx 0rpx;
.item {
display: flex;
flex-direction: row;
padding: 0 10rpx;
gap: 20rpx;
- font-size: 24rpx;
+ font-size: 30rpx;
// height: 1.5rem;
// justify-content: center;
align-items: center;
.left {
text-align: left;
- width: 5rem;
+ width: 6rem;
}
.right {
@@ -410,16 +530,55 @@
>input {
height: auto;
}
+
}
+
+
+
}
}
}
.operation-zone {
- height: 6rem;
+ height: 3rem;
display: flex;
align-items: center;
justify-content: space-between;
+ gap: 30rpx;
+ padding: 20rpx;
+
+ >view {
+ flex: 1;
+ }
+
+ >button {
+ width: 4rem;
+ padding: 0;
+ font-size: 25rpx;
+ border-radius: 50rpx;
+ line-height: 66rpx;
+ font-size: 28rpx;
+ }
+
+ >button[disabled] {
+ background-color: #acacac;
+ color: #fff;
+ }
+
+ .btn-a {
+ background-color: #acacac;
+ color: #fff;
+ }
+
+ .btn-b {
+ background-color: #41a863;
+ color: #fff;
+ }
+
+ .btn-c {
+ background-color: #3a78ff;
+ color: #fff;
+ }
}
}
</style>
\ No newline at end of file
diff --git a/static/svgs/folder_bg.svg b/static/svgs/folder_bg.svg
index 0c09b52..4189db5 100644
--- a/static/svgs/folder_bg.svg
+++ b/static/svgs/folder_bg.svg
@@ -1 +1 @@
-<svg width="100%" height="100%" viewBox="0 0 750 590" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><!-- 鏍囬鍖哄煙 (鍥哄畾楂樺害 64px) --><g id="title" transform="translate(0)"><polyline fill="none" stroke="#000" points="0 64 0 0 300 0 375 64" stroke-width="3"/></g><!-- 鍐呭鍖哄煙 (鑷姩濉厖鍓╀綑楂樺害) --><g id="content" transform="translate(0 64)"><!-- 浣跨敤鐩稿鍧愭爣閲嶇粯鍐呭鍖哄煙 --><polyline fill="none" stroke="#000" points="375 0 750 0 750 526 0 526 0 0" stroke-width="3"/></g></svg>
\ No newline at end of file
+<svg width="100%" height="100%" viewBox="0 0 750 590" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><!-- 鏍囬鍖哄煙 (鍥哄畾楂樺害 64px) --><g id="title" transform="translate(0)"><polyline fill="none" stroke="#000" points="0 32 0 0 150 0 170 32" stroke-width="3"/></g><!-- 鍐呭鍖哄煙 (鑷姩濉厖鍓╀綑楂樺害) --><g id="content" transform="translate(0 32)"><!-- 浣跨敤鐩稿鍧愭爣閲嶇粯鍐呭鍖哄煙 --><polyline fill="none" stroke="#000" points="170 0 750 0 750 526 0 526 0 0" stroke-width="3"/></g></svg>
\ No newline at end of file
diff --git a/utils/common.js b/utils/common.js
index 6e0d02f..8846e12 100644
--- a/utils/common.js
+++ b/utils/common.js
@@ -88,6 +88,15 @@
return /^\d+$/.test(str);
}
+ isJson(str) {
+ try{
+ JSON.parse(str)
+ return true
+ }catch{
+ return false
+ }
+ }
+
timeClock(callback, delay) {
let timeoutId;
let isRunning = false;
--
Gitblit v1.9.1