From 25508db9e43fe793d7a34fa2d8ca1d7244d887a6 Mon Sep 17 00:00:00 2001 From: yyb <995253665@qq.com> Date: 星期四, 17 七月 2025 16:11:56 +0800 Subject: [PATCH] PDA核磅录入除提交外其余地方联调结果 --- pages/wareHouse/nuclearScale/nuclearscalerecord.vue | 1261 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 696 insertions(+), 565 deletions(-) diff --git a/pages/wareHouse/nuclearScale/nuclearscalerecord.vue b/pages/wareHouse/nuclearScale/nuclearscalerecord.vue index 260c131..b4b0834 100644 --- a/pages/wareHouse/nuclearScale/nuclearscalerecord.vue +++ b/pages/wareHouse/nuclearScale/nuclearscalerecord.vue @@ -1,600 +1,731 @@ <template> - <view class="page"> - <view class="finishProductIn-locno-bg" /> - <u-navbar title="鏍哥璁板綍" :background="background" :border-bottom="false" :title-bold="true" title-color="#000" - back-icon-color="#000"> - <view class="navbar-right" slot="right" @click="goPrintAll"> - 鍏ㄩ儴鎵撳嵃 - </view> - </u-navbar> - <view class="wrap"> - <scroll-view class="finishProductIn-locno-scroll-list" scroll-y="true" @scrolltolower="loadMore"> - <u-cell-group class="finishProductIn-locno-scroll-list-group" :border="false"> - <view class="content" v-for="(item, index) in list" :key="item.locNo" :index="index" @click="selectNo(item)"> - <view class="content-header"> - <view class="content-header-title">{{ index + 1 }}</view> - </view> - <view class="content-body"> - <view class="row-list"> - <view class="_label"> - <view class="_label-icon-1"> </view> - <view class="_label-name">鎵规鍙凤細</view> - </view> - <view class="_content"> - {{ item.value0 }} - </view> - </view> - <view class="row-list"> - <view class="_label"> - <view class="_label-icon-2"> </view> - <view class="_label-name">浜у搧鎻忚堪锛�</view> - </view> - <view class="_content"> - {{ item.value1 }} - </view> - </view> - <view class="row-list"> - <view class="_label"> - <view class="_label-icon-3"> </view> - <view class="_label-name">闆朵欢鍙凤細</view> - </view> - <view class="_content"> - {{ item.value2 }} - </view> - </view> - <view class="row-list"> - <view class="_label"> - <view class="_label-icon-1"> </view> - <view class="_label-name">姣涢噸锛�</view> - </view> - <view class="_content"> - {{ item.value3 }} - </view> - </view> - <view class="row-list"> - <view class="_label"> - <view class="_label-icon-2"> </view> - <view class="_label-name">鐩橀噸锛�</view> - </view> - <view class="_content"> - {{ item.value4 }} - </view> - </view> - <view class="row-list"> - <view class="_label"> - <view class="_label-icon-3"> </view> - <view class="_label-name">鍑�閲嶏細</view> - </view> - <view class="_content"> - {{ item.value5 }} - </view> - </view> - <view class="row-list"> - <view class="_label"> - <view class="_label-icon-1"> </view> - <view class="_label-name">鏍哥閲嶉噺锛�</view> - </view> - <view class="_content"> - {{ item.value6 }} - </view> - </view> - <view class="row-list"> - <view class="_label"> - <view class="_label-icon-2"> </view> - <view class="_label-name">鍙夎溅鐩橀噸锛�</view> - </view> - <view class="_content"> - {{ item.value7 }} - </view> - </view> - </view> - </view> - </u-cell-group> - <view class="loadmore" @click="loadMore"> - <u-loadmore :status="loadStatus"></u-loadmore> - </view> - </scroll-view> - </view> - <u-toast ref="uToast" /> - <view v-if="maskShow" class="uni-mask" @touchmove.stop.prevent="moveHandle" @click="maskclose"> - <scroll-view class="uni-scroll_box" scroll-y @touchmove.stop.prevent="moveHandle" @click.stop="moveHandle"> - <view class="uni-list-box" v-for="(item, index) in listDevice" :key="index" @click="tapQuery(item)"> - <view> - <view class="uni-list_name">鍚嶇О锛歿{ item.name }}</view> - <view class="uni-list_item">UUID:{{ item.address }}</view> - </view> - </view> - </scroll-view> - </view> - </view> + <view class="page"> + <view class="finishProductIn-locno-bg" /> + <u-navbar title="鏍哥璁板綍" :background="background" :border-bottom="false" :title-bold="true" title-color="#000" + back-icon-color="#000"> + <view class="navbar-right" slot="right" @click="goPrintAll"> + 鍏ㄩ儴鎵撳嵃 + </view> + </u-navbar> + <view class="wrap"> + <scroll-view class="finishProductIn-locno-scroll-list" scroll-y="true" @scrolltolower="getmoreList()"> + <u-cell-group class="finishProductIn-locno-scroll-list-group" :border="false"> + <view class="content" v-for="(item, index) in list" :key="item.locNo" :index="index" + @click="selectNo(item)"> + <view class="content-header"> + <view class="content-header-title">{{ index + 1 }}</view> + </view> + <view class="content-body"> + <view class="row-list"> + <view class="_label"> + <view class="_label-icon-1"> </view> + <view class="_label-name">鎵规鍙凤細</view> + </view> + <view class="_content"> + {{ item.outBatchNo }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + <view class="_label-icon-2"> </view> + <view class="_label-name">浜у搧鎻忚堪锛�</view> + </view> + <view class="_content"> + {{ item.netWeight }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + <view class="_label-icon-3"> </view> + <view class="_label-name">闆朵欢鍙凤細</view> + </view> + <view class="_content"> + {{ item.partNo }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + <view class="_label-icon-1"> </view> + <view class="_label-name">姣涢噸锛�</view> + </view> + <view class="_content"> + {{ item.grossWeight }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + <view class="_label-icon-2"> </view> + <view class="_label-name">鐩橀噸锛�</view> + </view> + <view class="_content"> + {{ item.trayWeight }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + <view class="_label-icon-3"> </view> + <view class="_label-name">鍑�閲嶏細</view> + </view> + <view class="_content"> + {{ item.value5 }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + <view class="_label-icon-1"> </view> + <view class="_label-name">鏍哥閲嶉噺锛�</view> + </view> + <view class="_content"> + {{ item.netWeight }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + <view class="_label-icon-2"> </view> + <view class="_label-name">鍙夎溅鐩橀噸锛�</view> + </view> + <view class="_content"> + {{ item.value7 }} + </view> + </view> + </view> + </view> + </u-cell-group> + <view class="loadmore" @click="getmoreList()"> + <u-loadmore :status="status" :load-text="loadText" @loadmore="getmoreList()" /> + </view> + </scroll-view> + </view> + <u-toast ref="uToast" /> + <u-modal v-model="maskShow" title="" v-for="(item, index) in listDevice" :key="index" + :show-confirm-button="true" @confirm="tapQuery(item)"> + <view class="packing-registration-param-view" @touchmove.stop.prevent="moveHandle" @click="maskclose"> + <scroll-view class="uni-scroll_box" scroll-y @touchmove.stop.prevent="moveHandle" + @click.stop="moveHandle"> + <view class="packing-registration-param-item param-extra"> + <view class="packing-registration-param-item-left"> + <text class="item-one">鍚嶇О锛�</text> + </view> + <view class="packing-registration-param-item-right"> + <text class="item-one">{{ item.name }}</text> + </view> + </view> + <view class="packing-registration-param-item param-extra"> + <view class="packing-registration-param-item-left"> + <text class="item-one">UUID:</text> + </view> + <view class="packing-registration-param-item-right"> + <text class="item-one">{{ item.address }}</text> + + </view> + </view> + </scroll-view> + </view> + </u-modal> + </view> </template> <script> -import content_bg from '@/static/custom/finishProductIn/locNoBg.png' -const jcapi = uni.requireNativePlugin("JCSDK-JCApiModule"); + import content_bg from '@/static/custom/finishProductIn/locNoBg.png' + const jcapi = uni.requireNativePlugin("JCSDK-JCApiModule"); -// 浜岀淮鐮佺被鍨� -const QrCodeType = { - QrCode: 31, - PDF417: 32, - DataMatrix: 33, - AZTEC: 34 -} -// 绾挎潯绫诲瀷 -const LineType = { - Solid: 1, // 瀹炵嚎 - Dotted: 2, // 铏氱嚎锛堥粯璁よ櫄瀹�1:1鐩搁棿锛� -} -// 鎹㈣鏂瑰紡 -const LineModeType = { - Justified: 1, // 瀹介珮鍥哄畾锛屽唴瀹硅嚜閫傚簲锛堝瓧鍙�/瀛楅棿璺�/琛岄棿璺濇寜姣斾緥缂╂斁锛� - AutoHeight: 2, // 瀹藉害鍥哄畾锛岄珮搴﹁嚜閫傚簲 - Fixed: 4, // 瀹介珮鍥哄畾锛岃秴鍑洪儴鍒嗚鍓� - Adapt: 6, // 瀹介珮鍥哄畾锛屽唴瀹硅秴杩囨椂棰勮瀹介珮鑷姩缂╁皬 -} -export default { - data() { - return { - background: { - backgroundImage: `url(${content_bg})`, - backgroundAttachment: 'fixed', - backgroundSize: '100% auto', - backgroundRepeat: 'no-repeat', - }, - keywords: '', - alllist: [], - originList: [], - query: { - current: 1, - size: 10 - }, - list: [ - { - value0: '123456789', - value1: '123456789', - value2: '123456789', - value3: '123456789', - value4: '123456789', - value5: '123456789', - value6: '123456789', - value7: '123456789' - }, - { - value0: '123456789', - value1: '123456789', - value2: '123456789', - value3: '123456789', - value4: '123456789', - value5: '123456789', - value6: '123456789', - value7: '123456789' - } - ], - count: 0, - loadStatus: 'loading', - maskShow: false, - listDevice: [], //钃濈墮璁惧鏁版嵁 - pritList: [] - }; - }, - onLoad() { - this.$u.api.finishProductIn.fetchList().then(res => { - this.alllist = res.data - this.originList = res.data - this.loadList() - }) - // 鍒濆鍖朣DK - jcapi.initSDK() - // 鐩戝惉椤电爜鍥炶皟 - jcapi.didReadPrintCountInfo(function (r) { - console.log(r) - }) + // 浜岀淮鐮佺被鍨� + const QrCodeType = { + QrCode: 31, + PDF417: 32, + DataMatrix: 33, + AZTEC: 34 + } + // 绾挎潯绫诲瀷 + const LineType = { + Solid: 1, // 瀹炵嚎 + Dotted: 2, // 铏氱嚎锛堥粯璁よ櫄瀹�1:1鐩搁棿锛� + } + // 鎹㈣鏂瑰紡 + const LineModeType = { + Justified: 1, // 瀹介珮鍥哄畾锛屽唴瀹硅嚜閫傚簲锛堝瓧鍙�/瀛楅棿璺�/琛岄棿璺濇寜姣斾緥缂╂斁锛� + AutoHeight: 2, // 瀹藉害鍥哄畾锛岄珮搴﹁嚜閫傚簲 + Fixed: 4, // 瀹介珮鍥哄畾锛岃秴鍑洪儴鍒嗚鍓� + Adapt: 6, // 瀹介珮鍥哄畾锛屽唴瀹硅秴杩囨椂棰勮瀹介珮鑷姩缂╁皬 + } + export default { + data() { + return { + background: { + backgroundImage: `url(${content_bg})`, + backgroundAttachment: 'fixed', + backgroundSize: '100% auto', + backgroundRepeat: 'no-repeat', + }, + keywords: '', + list: [], + total: 0, + pageNum: 1, + pageSize: 10, + status: 'loading', + loadText: { + loadmore: "鍔犺浇鏇村...", + loading: "鍔姏鍔犺浇涓�...", + nomore: "娌℃湁鏇村浜�", + }, + maskShow: false, + listDevice: [], //钃濈墮璁惧鏁版嵁 + pritList: [], + printDensity: 3, // 榛樿鎵撳嵃娴撳害 + labelType: 1, // 榛樿鏍囩绫诲瀷 * + // 1锛氶棿闅欑焊 + // 2锛氶粦鏍囩焊 + // 3锛氳繛缁焊 + // 4锛氬畾瀛旂焊 + // 5锛氶�忔槑绾� + printMode: 2, // 榛樿鎵撳嵃妯″紡 + // 1锛氱儹鏁� + // 2锛氱儹杞嵃 + connectedDevice: null // 宸茶繛鎺ョ殑鎵撳嵃鏈� + }; + }, + onLoad() { + this.getlist() + // 鍒濆鍖朣DK + jcapi.initSDK() + // 鐩戝惉椤电爜鍥炶皟 + jcapi.didReadPrintCountInfo(function(r) { + console.log(r) + }) - // 鐩戝惉閿欒鍥炶皟 - jcapi.didReadPrintErrorInfo(function (r) { - console.log(r) - if (r.code == 23) { - // 鎵撳嵃鏈烘柇寮�杩炴帴 - _this.connectedDevice = null - } - uni.showToast({ - icon: 'none', - title: JSON.stringify(r), - duration: 2 * 1000 - }) - }) - }, - methods: { - loadMore() { - if (this.loadStatus == "nomore" || this.loadStatus == "loading") { - return - } - this.loadStatus = "loading"; - setTimeout(() => { - this.query.current += 1; - this.loadList(); - }, 100); - }, - loadList() { - const data = this.originList.slice((this.query.current - 1) * this.query.size, this.query.current * this.query.size) - this.list = this.list.concat(data); - this.loadStatus = "loadmore"; - if (!data || data.length < this.query.size) { - this.loadStatus = "nomore"; - } - }, - search(value) { - this.list = []; - this.query.current = 1; - if (value) { - this.originList = this.alllist.filter(item => item.locNo.includes(value)) - } else { - this.originList = this.alllist - } - this.loadList() - }, - // 鎵撳嵃鍗曚釜淇℃伅 - selectNo(item) { - let that = this - uni.showModal({ - title: '鎻愮ず', - content: '鏄惁鎵撳嵃瑁呯鍗曪紵', - showCancel: true, - success: function (res) { - if (res.confirm) { - that.searchDevice() - that.pritList = [item] - } - } - }); - }, - // 鎵撳嵃鍏ㄩ儴淇℃伅 - goPrintAll() { - let that = this - uni.showModal({ - title: '鎻愮ず', - content: '鏄惁鎵撳嵃瑁呯鍗曪紵', - showCancel: true, - success: function (res) { - if (res.confirm) { - that.searchDevice() - that.pritList = this.list - } - } - }); - }, - moveHandle() { + // 鐩戝惉閿欒鍥炶皟 + jcapi.didReadPrintErrorInfo((r) => { + console.log(r) + if (r.code == 23) { + // 鎵撳嵃鏈烘柇寮�杩炴帴 + this.connectedDevice = null + uni.showToast({ + icon: 'none', + title: '鎵撳嵃鏈鸿繛鎺ュ凡鏂紑锛岃閲嶆柊杩炴帴', + duration: 2 * 1000 + }) + } else { + uni.showToast({ + icon: 'none', + title: JSON.stringify(r), + duration: 2 * 1000 + }) + } + }) + }, + methods: { + getmoreList() { + if (this.pageSize >= this.total) { + this.status = "nomore"; + return; + } + this.status = "loading"; + setTimeout(() => { + this.pageSize += this.pageSize; + this.getlist(); + }, 1000); + }, + getlist() { + this.$u.api.workReporting + .getWorkshopOrder({ + current: this.pageNum, + size: this.pageSize + }) + .then((res) => { + this.list = res.data.records; + this.total = res.data.total; + if (this.pageSize >= this.total) { + this.status = "nomore"; + } else { + this.status = "loadmore"; + } + }); + }, + search(value) { + if (value) { + this.list = []; + this.pageSize = 10; + this.$u.api.workReporting + .getWorkshopOrder({ + current: this.pageNum, + size: this.pageSize, + moNo: value, + }) + .then((res) => { + this.list = res.data.records; + this.total = res.data.total; + if (this.pageSize >= this.total) { + this.status = "nomore"; + } else { + this.status = "loadmore"; + } + }); + } else { + this.getlist(); + } + }, + // 鎵撳嵃鍗曚釜淇℃伅 + // 妫�鏌ヨ摑鐗欒繛鎺ョ姸鎬� + async checkBluetoothConnection() { + if (!this.connectedDevice) return false; + + // 灏濊瘯鍙戦�佷竴涓畝鍗曞懡浠ゆ鏌ヨ繛鎺ョ姸鎬� + return new Promise(resolve => { + jcapi.checkPrinterStatus(this.connectedDevice.address, r => { + if (r && r.code === 0) { + resolve(true); + } else { + // 杩炴帴宸叉柇寮� + this.connectedDevice = null; + resolve(false); + } + }); + }); + }, - }, - maskclose() { + selectNo(item) { + let that = this + uni.showModal({ + title: '鎻愮ず', + content: '鏄惁鎵撳嵃瑁呯鍗曪紵', + showCancel: true, + success: async function(res) { + if (res.confirm) { + // 妫�鏌ヨ摑鐗欒繛鎺ョ姸鎬� + const isConnected = await that.checkBluetoothConnection(); + if (isConnected) { + // 宸茶繛鎺ワ紝鐩存帴鎵撳嵃 + that.pritList = [item] + that.pritList.forEach(async item => { + await that.printQrCode(item) + }) + } else { + // 鏈繛鎺ユ垨杩炴帴宸叉柇寮�锛屾悳绱㈣澶� + that.searchDevice() + that.pritList = [item] + } + } + } + }); + }, + // 鎵撳嵃鍏ㄩ儴淇℃伅 + goPrintAll() { + let that = this + uni.showModal({ + title: '鎻愮ず', + content: '鏄惁鎵撳嵃瑁呯鍗曪紵', + showCancel: true, + success: async function(res) { + if (res.confirm) { + // 妫�鏌ヨ摑鐗欒繛鎺ョ姸鎬� + const isConnected = await that.checkBluetoothConnection(); + if (isConnected) { + // 宸茶繛鎺ワ紝鐩存帴鎵撳嵃 + that.pritList = that.list + that.pritList.forEach(async item => { + await that.printQrCode(item) + }) + } else { + // 鏈繛鎺ユ垨杩炴帴宸叉柇寮�锛屾悳绱㈣澶� + that.searchDevice() + that.pritList = that.list + } + } + } + }); + }, + moveHandle() { - }, - //鎵撳嵃浜岀淮鐮� - async printQrCode(item) { - const params = { - rwMatlBindId: item.id - } - let res = await this.$u.api.dailyPaper.zongjianLabelInfo(params) - if (!res.data) { - this.$refs.uToast.show({ - title: '鏈煡璇㈠埌璇ユ爣绛句俊鎭紒', - type: 'warning ' - }) - return - } - // 鍒濆鍖栫敾鏉� - jcapi.initDrawingBoard({ - width: 50, - height: 100, - rotate: 0 - }); + }, + maskclose() { - // // 缁樺埗浜岀淮鐮� - jcapi.drawLabelQrCode({ - x: 14.5, - y: 74, - width: 20, - height: 20, - value: jsonString, - rotate: 0, - codeType: QrCodeType.QrCode, - }); - // 缁樺埗妯嚎 瀹炵嚎8鏉� - let sum = 4; - for (let i = 1; i < 13; i++) { - this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎 - sum = (i * 6) + 4 - } - // 浜岀淮鐮佸ぇ妗� - this.getDrawLabelLine(4, 97, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎9 + }, + //鎵撳嵃浜岀淮鐮� + async printQrCode(item) { + console.log('item de shuju ', item) + const params = { + rwMatlBindId: item.id + }; + try { + let res = await this.$u.api.dailyPaper.zongjianLabelInfo(params) + if (!res.data) { + this.$refs.uToast.show({ + title: '鏈煡璇㈠埌璇ユ爣绛句俊鎭紒', + type: 'warning ' + }) + return + } + // const res = { + // ht: 'HT20250717995352665', + // lj: '88.118.1/A0611091', + // ljms: '閾滃崟绾� 瑁搁摐-TY-鍦嗗舰-3.0', + // fh: '1083.6', + // scdt: '2025-07-14 13:46:55.0', + // scph: '2025071273-3', + // fhdw: '姹熶笢鍚堥噾鎶�鏈湁闄愬叕鍙�', + // shdw: '鏄嗗北娉板痉閫氶摐涓氭湁闄愬叕鍙�', + // } + // 浠嶢PI鍝嶅簲涓彁鍙栨墍闇�鏁版嵁 + const { + ht, + lj, + ljms, + fh, + scdt, + scph, + fhdw, + shdw + } = res.data + // const jsonString = JSON.stringify(res.data) - //缁樺埗绔栫嚎 - this.getDrawLabelLine(4, 4, 0.5, 97, 0, LineType.Solid) // 绔栫嚎1 - this.getDrawLabelLine(20, 4, 0.5, 66, 0, LineType.Solid) // 绔栫嚎2 - this.getDrawLabelLine(44.5, 4, 0.5, 97, 0, LineType.Solid) // 绔栫嚎2 + // 鍒濆鍖栫敾鏉� + jcapi.initDrawingBoard({ + width: 70, + height: 49, + rotate: 90 + }); - // 濉啿鏂囧瓧鏍囬 - this.getDrawLabelText(5, 5, 20, 20, '缂� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 11, 20, 20, '宸ュ崟鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 17, 20, 20, '鐗� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 23, 20, 20, '鐗囧锛坢m锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 29, 20, 20, '鍘氬害锛坢m锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 35, 20, 20, '閲嶉噺锛圞G锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 41, 20, 20, '闀垮害锛坢锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 47, 20, 20, '鐢熶骇浜�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 53, 20, 20, '鐢熶骇鏃堕棿:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 59, 20, 20, '鍘傚:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) - this.getDrawLabelText(5, 65, 20, 20, '閾佹崯:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + // 缁樺埗浜岀淮鐮� + const qrContent = + `ht:${ht}\nlj:${lj}\nljms:${ljms}\nfh:${fh}\nscdt:${scdt}\nscph:${scph}\nfhdw:${fhdw}\nshdw:${shdw}`; + jcapi.drawLabelQrCode({ + x: 43.5, + y: 2, + width: 24, + height: 24, + value: qrContent, + rotate: 0, + codeType: QrCodeType.QrCode, + }); + // getDrawLabelLine 锛坸鍧愭爣锛寉鍧愭爣锛岀嚎鏉″搴︼紝绾挎潯楂樺害锛屾棆杞搴︼紝绾挎潯绫诲瀷锛� + // 缁樺埗妯嚎 瀹炵嚎8鏉� + this.getDrawLabelLine(1, 1, 67, 0.5, 0, LineType.Solid) + this.getDrawLabelLine(1, 6, 42, 0.3, 0, LineType.Solid) + this.getDrawLabelLine(1, 11, 42, 0.3, 0, LineType.Solid) + this.getDrawLabelLine(1, 16, 42, 0.3, 0, LineType.Solid) + this.getDrawLabelLine(1, 21, 42, 0.3, 0, LineType.Solid) + this.getDrawLabelLine(1, 27, 67, 0.3, 0, LineType.Solid) + this.getDrawLabelLine(1, 32, 67,0.3, 0, LineType.Solid) + this.getDrawLabelLine(1, 37, 67, 0.3, 0, LineType.Solid) + this.getDrawLabelLine(1, 42, 67, 0.3, 0, LineType.Solid) + this.getDrawLabelLine(1, 47, 67, 0.5, 0, LineType.Solid) + //缁樺埗绔栫嚎 + this.getDrawLabelLine(1, 1, 0.5, 46, 0, LineType.Solid) // 绔栫嚎1 + this.getDrawLabelLine(43, 1, 0.3, 26, 0, LineType.Solid) // 绔栫嚎2 + this.getDrawLabelLine(68, 1, 0.5, 46, 0, LineType.Solid) // 绔栫嚎2 + // getDrawLabelText 锛�1.x鍧愭爣锛�2.y鍧愭爣锛�3.鏂囨湰妗嗗搴︼紝4.鏂囨湰妗嗛珮搴︼紝5.缁樺埗鏂囧瓧鍐呭锛�6.瀛椾綋澶у皬锛堥粯璁ら珮搴�4mm锛�,7.鏃嬭浆瑙掑害,8.鎹㈣鏂瑰紡,9.饩忛棿闅�,10.瀛楅棿闅�,11.鏂囧瓧姘村钩甯冨眬,12鏂囧瓧鍨傜洿甯冨眬) + // 鏍囬 + this.getDrawLabelText(3, 2.5, 40, 8, '涓ぉ绉戞妧瑁呯娓呭崟', 2.5, 0, LineModeType.AutoHeight, 0, 0, 1, 1,1) + // 濉啿鏂囧瓧鏍囬 + this.getDrawLabelText(2, 7, 25, 8, '鍚堝悓鍙�:', 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 1,1) + this.getDrawLabelText(2, 12, 25, 8, '闆朵欢鍙�:', 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 1,1) + this.getDrawLabelText(2, 17, 25, 8, '闆朵欢鎻忚堪:', 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 1,1) + this.getDrawLabelText(2, 22.5, 25, 8, '鍙戣揣/瑁呯鏁�:', 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 1,1) + this.getDrawLabelText(2, 27.5, 25, 8, '鐢熶骇鏃ユ湡:', 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 1,1) + this.getDrawLabelText(2, 32.5, 25, 8, '鐢熶骇鎵瑰彿:', 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 1,1) + this.getDrawLabelText(2, 37.5, 25, 8, '鍙戣揣鍗曚綅:', 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 1,1) + this.getDrawLabelText(2, 42.5, 25, 8, '鏀惰揣鍗曚綅:', 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 1,1) + // 濉啿鍙傛暟鍊� + this.getDrawLabelText(11, 7, 30, 8, ht, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0,1) + this.getDrawLabelText(11, 12, 32, 8, lj, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0,1) + this.getDrawLabelText(14, 17, 30, 8, ljms, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0,1) + this.getDrawLabelText(17, 22.5, 27, 8, fh, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0,1) + this.getDrawLabelText(14, 27.5, 55, 8, scdt, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0,1) + this.getDrawLabelText(14, 32.5, 55, 8, scph, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0,1) + this.getDrawLabelText(14, 37.5,55, 8, fhdw, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0,1) + this.getDrawLabelText(14, 42.5, 55, 8, shdw, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0,1) - // // 濉啿鍙傛暟鍊� - this.getDrawLabelText(22, 5, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 11, 35, 12, optaskNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 17, 35, 12, grade, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 23, 35, 12, sliceWidth, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 29, 35, 12, thickness, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 35, 35, 12, wweight, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 41, 35, 12, llength, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 47, 35, 12, reportName, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 53, 35, 12, reportTime, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 59, 35, 12, supplierVenderName, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) - this.getDrawLabelText(22, 65, 35, 12, ironLoss, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + // 鐢熸垚鎵撳嵃鏁版嵁 + let imageJsonObj = jcapi.generateLabelJson() + let imageJsonObj111 = jcapi.generatePrintPreviewImage(imageJsonObj) + console.log('棰勮', imageJsonObj111) + // // 璁剧疆鎵撳嵃浠诲姟 + jcapi.startJob({ + totalCount: 1, + density: this.printDensity, + labelType: this.labelType, + printMode: this.printMode, + }, function(r) { + console.log('鎵撳嵃', r) + if (r.code == 0) { + // 鎵撳嵃鏁版嵁 + jcapi.printData(imageJsonObj, { + "printQuantity": 1, + }, function(r) { + if (r.code == 0) { + console.log("鎵撳嵃鎴愬姛") + uni.showToast({ + title: '鎵撳嵃鎴愬姛', + icon: 'success' + }) + } else { + console.log("鎵撳嵃澶辫触") + uni.showToast({ + title: '鎵撳嵃澶辫触: ' + (r.msg || '鏈煡閿欒'), + icon: 'none' + }) + } + }) + } else { + console.log("璁剧疆鎵撳嵃浠诲姟澶辫触") + } - // 鐢熸垚鎵撳嵃鏁版嵁 - let imageJsonObj = jcapi.generateLabelJson() - // 璁剧疆鎵撳嵃浠诲姟 - jcapi.startJob({ - totalCount: 1, - density: this.printDensity, - labelType: this.labelType, - printMode: this.printMode, - }, function (r) { - if (r.code == 0) { - // 鎵撳嵃鏁版嵁 - jcapi.printData(imageJsonObj, { - "printQuantity": 1, - }, function (r) { - if (r.code == 0) { - console.log("鎵撳嵃鎴愬姛") - } else { - console.log("鎵撳嵃澶辫触") - } - }) - } else { - console.log("璁剧疆鎵撳嵃浠诲姟澶辫触") - } - }) - }, - tapQuery(item) { - this.maskShow = false - // 杩炴帴鎵撳嵃鏈� - let _this = this; - console.log(item) - jcapi.openPrinterByDevice({ - address: item.address, - name: item.name, - deviceType: item.deviceType // 璁惧绫诲瀷锛�0-钃濈墮锛�1-缃戠粶 - }, function (r) { - uni.showToast({ - title: (r.code == 0) ? "杩炴帴鎴愬姛" : "杩炴帴澶辫触", - duration: 2 * 1000 - }) - if (r.code == 0) { - _this.connectedDevice = item - // 缁樻爣绛捐繘琛屾墦鍗� - _this.pritList.forEac(async item => { - await _this.printQrCode(item) - }) - } - }) - }, - //鎵撳嵃鐩稿叧 - searchDevice() { - let _this = this - uni.openBluetoothAdapter({ // 纭钃濈墮鏄惁鎵撳紑 - success(r) { - uni.showLoading({ - title: "鎼滅储涓�..." - }) - // 鏈巿浜堣摑鐗欑浉鍏虫潈闄愬拰鏈墦寮�鎵嬫満瀹氫綅浼氭悳绱笉鍒拌澶� - jcapi.getBluetoothDevices(function (r) { - console.log("device:" + JSON.stringify(r)) - // 鎼滅储鍒拌澶囧洖璋� - uni.hideLoading() - _this.listDevice = r; - _this.maskShow = true - }) - }, - fail(e) { - uni.showModal({ - confirmText: "鎵撳紑钃濈墮澶辫触" - }) - console.log("寮�鍚摑鐗欒澶囧け璐�" + e) - } - }) - }, - // 缁樺埗妯嚎 瀹炵嚎 - getDrawLabelLine(x, y, width, height, rotate, lineType) { - jcapi.drawLabelLine({ - x: x, - y: y, - width: width, - height: height, - rotate: rotate, - lineType: lineType - }); - }, - // 濉啿鏂囧瓧鏍囬 - getDrawLabelText(x, y, width, height, value, fontSize, rotate, lineMode, lineSpace, letterSpace, textAlignHorizontal, textAlignVertical) { - jcapi.drawLabelText({ - x: x, - y: y, - width: width, - height: height, - value: value, - fontSize: fontSize, - rotate: rotate, - lineMode: lineMode, - lineSpace: lineSpace, - letterSpace: letterSpace, - textAlignHorizontal: textAlignHorizontal, - textAlignVertical: textAlignVertical - }) - }, + }) - //鍒锋柊涓婁竴涓〉闈� - refreshLastPage(no) { - // 鍛婄煡 A.vue 鏇存柊鏁版嵁 - // 鑾峰彇椤甸潰鏍� - let pages = getCurrentPages() + }, + tapQuery(item) { + this.maskShow = false + // 杩炴帴鎵撳嵃鏈� + let _this = this; + console.log(item) + jcapi.openPrinterByDevice({ + address: item.address, + name: item.name, + deviceType: 0 // 璁惧绫诲瀷锛�0-钃濈墮锛�1-缃戠粶 + }, function(r) { + uni.showToast({ + title: (r.code == 0) ? "杩炴帴鎴愬姛" : "杩炴帴澶辫触", + duration: 2 * 1000 + }) + if (r.code == 0) { + _this.connectedDevice = item + // 娣诲姞鎵撳嵃鍒楄〃绌哄�兼鏌� + if (!_this.pritList || _this.pritList.length === 0) { + uni.showToast({ + title: '娌℃湁鍙墦鍗扮殑鏁版嵁', + icon: 'none' + }) + return + } + // 缁樻爣绛捐繘琛屾墦鍗� + _this.pritList.forEach(async item => { + await _this.printQrCode(item) + }) + } + }) + }, + //鎵撳嵃鐩稿叧 + searchDevice() { + let _this = this + uni.openBluetoothAdapter({ // 纭钃濈墮鏄惁鎵撳紑 + success(r) { + uni.showLoading({ + title: "鎼滅储涓�..." + }) + // 鏈巿浜堣摑鐗欑浉鍏虫潈闄愬拰鏈墦寮�鎵嬫満瀹氫綅浼氭悳绱笉鍒拌澶� + jcapi.getBluetoothDevices(function(r) { + console.log("device:" + JSON.stringify(r)) + // 鎼滅储鍒拌澶囧洖璋� + uni.hideLoading() + // 濡傛灉涔嬪墠鏈夎繛鎺ョ殑璁惧浣嗕笉鍦ㄦ悳绱㈢粨鏋滀腑锛岃鏄庤澶囧凡鏇存崲 + if (_this.connectedDevice && !r.some(dev => dev.address === _this.connectedDevice.address)) { + _this.connectedDevice = null; + uni.showToast({ + icon: 'none', + title: '宸茶繛鎺ョ殑钃濈墮璁惧宸叉洿鎹紝璇烽噸鏂伴�夋嫨', + duration: 2000 + }); + } + _this.listDevice = r; + _this.maskShow = true + }) + }, + fail(e) { + uni.showModal({ + title: '鎻愮ず', + content: '鎵撳紑钃濈墮澶辫触锛岃妫�鏌ヨ摑鐗欐槸鍚﹀紑鍚�', + showCancel: false + }) + console.log("寮�鍚摑鐗欒澶囧け璐�" + e) + } + }) + }, + // 缁樺埗妯嚎 瀹炵嚎 + getDrawLabelLine(x, y, width, height, rotate, lineType) { + jcapi.drawLabelLine({ + x: x, + y: y, + width: width, + height: height, + rotate: rotate, + lineType: lineType + }); + }, + // 濉啿鏂囧瓧鏍囬 + getDrawLabelText(x, y, width, height, value, fontSize, rotate, lineMode, lineSpace, letterSpace, + textAlignHorizontal, textAlignVertical,bold) { - // 鑾峰彇涓婁竴椤垫爤 - let prevPage = pages[pages.length - 2] + jcapi.drawLabelText({ + x: x, + y: y, + width: width, + height: height, + value: value, + fontSize: fontSize, + rotate: rotate, + lineMode: lineMode, + lineSpace: lineSpace, + letterSpace: letterSpace, + textAlignHorizontal: textAlignHorizontal, + textAlignVertical: textAlignVertical, + bold:bold + }) + }, - // 瑙﹀彂涓婁竴椤� upData 鍑芥暟(骞舵惡甯﹀弬鏁�) - prevPage.$vm.setNo(no) + //鍒锋柊涓婁竴涓〉闈� + refreshLastPage(no) { + // 鍛婄煡 A.vue 鏇存柊鏁版嵁 + // 鑾峰彇椤甸潰鏍� + let pages = getCurrentPages() - // 杩斿洖涓婁竴椤� - uni.navigateBack({ - delta: 1 - }) - }, - } -}; + // 鑾峰彇涓婁竴椤垫爤 + let prevPage = pages[pages.length - 2] + + // 瑙﹀彂涓婁竴椤� upData 鍑芥暟(骞舵惡甯﹀弬鏁�) + prevPage.$vm.setNo(no) + + // 杩斿洖涓婁竴椤� + uni.navigateBack({ + delta: 1 + }) + }, + } + }; </script> <style lang="scss"> -.finishProductIn-locno-bg { - background-color: #F6F9FF; - background-image: url('~@/static/custom/finishProductIn/locNoBg.png'); - // background: linear-gradient(180deg,rgba(206,227,254,1),rgba(206,227,254,1) 20%,rgba(206,227,254,0.5) 40%,rgba(206,227,254,0.25) 60%,rgba(206,227,254,0.08) 80%,rgba(206,227,254,0)); - padding: 0 20rpx; - background-attachment: fixed; - background-size: 100% auto; - background-repeat: no-repeat; - position: fixed; - top: 0; - bottom: 0; - width: 100%; - z-index: -1; -} + .finishProductIn-locno-bg { + background-color: #F6F9FF; + background-image: url('~@/static/custom/finishProductIn/locNoBg.png'); + // background: linear-gradient(180deg,rgba(206,227,254,1),rgba(206,227,254,1) 20%,rgba(206,227,254,0.5) 40%,rgba(206,227,254,0.25) 60%,rgba(206,227,254,0.08) 80%,rgba(206,227,254,0)); + padding: 0 20rpx; + background-attachment: fixed; + background-size: 100% auto; + background-repeat: no-repeat; + position: fixed; + top: 0; + bottom: 0; + width: 100%; + z-index: -1; + } -.finishProductIn-locno-search { - padding: 40rpx 30rpx 20rpx 30rpx; -} + .finishProductIn-locno-search { + padding: 40rpx 30rpx 20rpx 30rpx; + } -.wrap .finishProductIn-locno-scroll-list { - height: calc(100vh - var(--window-top) - var(--window-bottom) - 242rpx); - width: 100%; -} + .wrap .finishProductIn-locno-scroll-list { + height: calc(100vh - var(--window-top) - var(--window-bottom) - 242rpx); + width: 100%; + } -.finishProductIn-locno-scroll-list-group { - ::v-deep .u-cell-item-box { - background-color: rgba(250, 252, 255, 0.36) !important; - padding: 0rpx 30rpx; - } + .finishProductIn-locno-scroll-list-group { + ::v-deep .u-cell-item-box { + background-color: rgba(250, 252, 255, 0.36) !important; + padding: 0rpx 30rpx; + } - .content { - font-size: 12px; - background-color: #ffffff; - box-sizing: border-box; - border-radius: 10rpx; - margin: 0rpx 0rpx 16rpx; - padding: 20rpx 8rpx; - box-shadow: none; - display: flex; - align-items: center; + .content { + font-size: 12px; + background-color: #ffffff; + box-sizing: border-box; + border-radius: 10rpx; + margin: 0rpx 0rpx 16rpx; + padding: 20rpx 8rpx; + box-shadow: none; + display: flex; + align-items: center; - .content-header { - width: 40rpx; - height: 90rpx; - display: flex; - align-items: center; + .content-header { + width: 40rpx; + height: 90rpx; + display: flex; + align-items: center; - .content-header-icon { - background-image: url("~@/static/custom/moveWareHouse/header_icon.png"); - background-size: 100% auto; - background-repeat: no-repeat; - height: 28rpx; - width: 28rpx; - } + .content-header-icon { + background-image: url("~@/static/custom/moveWareHouse/header_icon.png"); + background-size: 100% auto; + background-repeat: no-repeat; + height: 28rpx; + width: 28rpx; + } - .content-header-title { - margin-left: 11rpx; - font-size: 26rpx; - font-weight: bold; - color: #3d52f5; - } - } + .content-header-title { + margin-left: 11rpx; + font-size: 26rpx; + font-weight: bold; + color: #3d52f5; + } + } - .content-body { - flex: 1; - background: #f5f9ff; - border-radius: 10rpx; - padding: 0rpx 23rpx; + .content-body { + flex: 1; + background: #f5f9ff; + border-radius: 10rpx; + padding: 0rpx 23rpx; - .row-list { - height: 60rpx; - display: flex; - flex-direction: row; - padding: 0px; - align-items: center; - } + .row-list { + height: 60rpx; + display: flex; + flex-direction: row; + padding: 0px; + align-items: center; + } - .row-list ._label { - display: flex; - flex: 0.8; - color: #909399; - align-items: center; + .row-list ._label { + display: flex; + flex: 0.8; + color: #909399; + align-items: center; - ._label-icon-1 { - background-image: url("~@/static/custom/moveWareHouse/label-icon-1.png"); - background-size: 100% auto; - background-repeat: no-repeat; - height: 26rpx; - width: 26rpx; - } + ._label-icon-1 { + background-image: url("~@/static/custom/moveWareHouse/label-icon-1.png"); + background-size: 100% auto; + background-repeat: no-repeat; + height: 26rpx; + width: 26rpx; + } - ._label-icon-2 { - background-image: url("~@/static/custom/moveWareHouse/label-icon-2.png"); - background-size: 100% auto; - background-repeat: no-repeat; - height: 26rpx; - width: 26rpx; - } + ._label-icon-2 { + background-image: url("~@/static/custom/moveWareHouse/label-icon-2.png"); + background-size: 100% auto; + background-repeat: no-repeat; + height: 26rpx; + width: 26rpx; + } - ._label-icon-3 { - background-image: url("~@/static/custom/moveWareHouse/label-icon-3.png"); - background-size: 100% auto; - background-repeat: no-repeat; - height: 26rpx; - width: 26rpx; - } + ._label-icon-3 { + background-image: url("~@/static/custom/moveWareHouse/label-icon-3.png"); + background-size: 100% auto; + background-repeat: no-repeat; + height: 26rpx; + width: 26rpx; + } - ._label-name { - margin-left: 11rpx; - font-size: 26rpx; - font-weight: 500; - color: #666666; - } - } + ._label-name { + margin-left: 11rpx; + font-size: 26rpx; + font-weight: 500; + color: #666666; + } + } - .row-list ._content { - flex: 1.5; - text-align: right; - color: #909399; - font-size: 24rpx; - } + .row-list ._content { + flex: 1.5; + text-align: right; + color: #909399; + font-size: 24rpx; + } - .row-list .s1 { - color: #d35651; - } - } - } -} + .row-list .s1 { + color: #d35651; + } + } + } + } -.navbar-right { - font-weight: 500; - font-size: 13px; - color: #0b0b0b; - line-height: 36rpx; - margin-right: 32rpx; -} -</style> + .navbar-right { + font-weight: 500; + font-size: 13px; + color: #0b0b0b; + line-height: 36rpx; + margin-right: 32rpx; + } +</style> \ No newline at end of file -- Gitblit v1.9.3