| | |
| | | <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" |
| | | > |
| | | <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"> |
| | | <!-- 连接和打印状态指示器 --> |
| | | <view |
| | | class="status-indicator" |
| | | :class="{ |
| | | <view class="status-indicator" :class="{ |
| | | connected: connectionStatus === 'connected', |
| | | connecting: connectionStatus === 'connecting', |
| | | disconnected: connectionStatus === 'disconnected', |
| | | }" |
| | | > |
| | | }"> |
| | | <text class="status-text">{{ getConnectionStatusText() }}</text> |
| | | <text class="print-status" v-if="printStatus !== 'idle'" |
| | | >- {{ getPrintStatusText() }}</text |
| | | > |
| | | <text class="print-status" v-if="printStatus !== 'idle'">- {{ getPrintStatusText() }}</text> |
| | | </view> |
| | | <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)" |
| | | > |
| | | <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="_label-name">批次号:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.outBatchNo }} |
| | | {{ item.batchNo }} |
| | | </view> |
| | | </view> |
| | | <view class="row-list"> |
| | |
| | | <view class="_label-name">产品描述:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.netWeight }} |
| | | {{ item.partDescription }} |
| | | </view> |
| | | </view> |
| | | <view class="row-list"> |
| | |
| | | <view class="_label-name">毛重:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.grossWeight }} |
| | | {{ item.newGrossWeight }} |
| | | </view> |
| | | </view> |
| | | <view class="row-list"> |
| | |
| | | <view class="_label-name">盘重:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.trayWeight }} |
| | | {{ item.newWeight }} |
| | | </view> |
| | | </view> |
| | | <view class="row-list"> |
| | |
| | | <view class="_label-name">净重:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.value5 }} |
| | | {{ item.newNetWeight }} |
| | | </view> |
| | | </view> |
| | | <view class="row-list"> |
| | |
| | | <view class="_label-name">核磅重量:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.netWeight }} |
| | | {{ item.verificationWeight }} |
| | | </view> |
| | | </view> |
| | | <view class="row-list"> |
| | |
| | | <view class="_label-name">叉车盘重:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.value7 }} |
| | | {{ item.forkliftWeight }} |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </u-cell-group> |
| | | <view class="loadmore" @click="getmoreList()"> |
| | | <u-loadmore |
| | | :status="status" |
| | | :load-text="loadText" |
| | | @loadmore="getmoreList()" |
| | | /> |
| | | <u-loadmore :status="status" :load-text="loadText" @loadmore="getmoreList()" /> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | <u-toast ref="uToast" /> |
| | | <u-modal v-model="maskShow" title="" :show-confirm-button="false"> |
| | | <view @touchmove.stop.prevent="moveHandle" @click="maskclose"> |
| | | <scroll-view |
| | | class="uni-scroll_box" |
| | | scroll-y |
| | | @touchmove.stop.prevent="moveHandle" |
| | | @click.stop="moveHandle" |
| | | > |
| | | <scroll-view class="uni-scroll_box" scroll-y @touchmove.stop.prevent="moveHandle" |
| | | @click.stop="moveHandle"> |
| | | <view class="modal-title">选择蓝牙设备</view> |
| | | <view v-if="listDevice.length === 0" class="empty-tip">暂无设备</view> |
| | | <view |
| | | v-for="(item, index) in listDevice" |
| | | :key="index" |
| | | @click="tapQuery(item)" |
| | | class="device-item" |
| | | > |
| | | <view v-for="(item, index) in listDevice" :key="index" @click="tapQuery(item)" class="device-item"> |
| | | <view class="device-name"> |
| | | <text>名称:</text> |
| | | <text>{{ item.name || "未知设备" }}</text> |
| | |
| | | connectionStatus: "disconnected", // 连接状态: disconnected, connecting, connected |
| | | printStatus: "idle", // 打印状态: idle, printing, error |
| | | errorMessage: "", // 错误信息 |
| | | verificationNo:'' |
| | | }; |
| | | }, |
| | | onLoad() { |
| | | onLoad(options) { |
| | | this.verificationNo = JSON.parse(decodeURIComponent(options.verificationNo)) |
| | | this.getlist(); |
| | | // 初始化SDK |
| | | jcapi.initSDK(); |
| | | // 监听页码回调 |
| | | jcapi.didReadPrintCountInfo(function (r) { |
| | | console.log(r); |
| | | console.log('页码',r); |
| | | }); |
| | | |
| | | // 监听错误回调 |
| | | jcapi.didReadPrintErrorInfo((r) => { |
| | | console.log(r); |
| | | console.log('错误',r); |
| | | if (r.code == 23) { |
| | | // 打印机断开连接 |
| | | this.connectedDevice = null; |
| | |
| | | }, 1000); |
| | | }, |
| | | getlist() { |
| | | this.$u.api.workReporting |
| | | .getWorkshopOrder({ |
| | | this.$u.api.NuclearScaleEntry |
| | | .queryPacking({ |
| | | current: this.pageNum, |
| | | size: this.pageSize, |
| | | verificationNo: this.verificationNo, |
| | | }) |
| | | .then((res) => { |
| | | this.list = res.data.records; |
| | | this.total = res.data.total; |
| | | this.list = res.data; |
| | | this.total = res.data.length; |
| | | if (this.pageSize >= this.total) { |
| | | this.status = "nomore"; |
| | | } else { |
| | |
| | | if (value) { |
| | | this.list = []; |
| | | this.pageSize = 10; |
| | | this.$u.api.workReporting |
| | | .getWorkshopOrder({ |
| | | this.$u.api.NuclearScaleEntry |
| | | .queryPacking({ |
| | | current: this.pageNum, |
| | | size: this.pageSize, |
| | | moNo: value, |
| | |
| | | moveHandle() {}, |
| | | maskclose() {}, |
| | | //打印二维码 |
| | | async printQrCode(item) { |
| | | return new Promise(async (resolve, reject) => { |
| | | const params = { |
| | | rwMatlBindId: item.id |
| | | }; |
| | | printQrCode(item) { |
| | | // return new Promise(async (resolve, reject) => { |
| | | // const params = { |
| | | // rwMatlBindId: item.id |
| | | // }; |
| | | try { |
| | | let res = await this.$u.api.dailyPaper.zongjianLabelInfo(params) |
| | | if (!res.data) { |
| | | // let res = await this.$u.api.dailyPaper.zongjianLabelInfo(params) |
| | | if (!item) { |
| | | this.$refs.uToast.show({ |
| | | title: "未查询到该标签信息!", |
| | | type: "warning ", |
| | |
| | | return; |
| | | } |
| | | |
| | | // 从API响应中提取所需数据 |
| | | const { ht, lj, ljms, fh, scdt, scph, fhdw, shdw } = res.data; |
| | | const ht = item.contractNo |
| | | const lj = item.partNo |
| | | const ljms = item.ccontrProModel |
| | | const fh = item.newNetWeight |
| | | const scdt = item.outboundDate |
| | | const scph = item.batchNo |
| | | const shdw = item.customerName |
| | | const fhdw = '江东合金技术有限公司' |
| | | |
| | | // 初始化画板 |
| | | jcapi.initDrawingBoard({ |
| | |
| | | }); |
| | | |
| | | // 绘制二维码 |
| | | const qrContent = `ht:${ht}\nlj:${lj}\nljms:${ljms}\nfh:${fh}\nscdt:${scdt}\nscph:${scph}\nfhdw:${fhdw}\nshdw:${shdw}`; |
| | | const qrContent = { |
| | | company : item.customerNo, |
| | | line_no : item.lineNo, |
| | | lot_batch_no : item.batchNo, |
| | | order_no : item.contractNo, |
| | | part_no : item.partNo, |
| | | total_qty : item.newNetWeight, |
| | | qty_arrived : item.newNetWeight, |
| | | release_no : item.relNo, |
| | | } |
| | | |
| | | jcapi.drawLabelQrCode({ |
| | | x: 43.5, |
| | | y: 2, |
| | |
| | | this.getDrawLabelLine(68, 1, 0.5, 46, 0, LineType.Solid); // 竖线3 |
| | | |
| | | // 绘制文本 |
| | | 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(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.7,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(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.7, 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); |
| | | // 生成打印数据 |
| | | let imageJsonObj = jcapi.generateLabelJson(); |
| | | |
| | | // 设置打印任务 |
| | | jcapi.startJob( |
| | | { |
| | | jcapi.startJob({ |
| | | totalCount: 1, |
| | | density: this.printDensity, |
| | | labelType: this.labelType, |
| | |
| | | |
| | | // 添加打印超时处理 |
| | | const printTimeout = setTimeout(() => { |
| | | jcapi.didReadPrintCountInfo(originalPrintCountCallback); |
| | | jcapi.didReadPrintCountInfo( |
| | | originalPrintCountCallback); |
| | | reject(new Error("打印超时未响应")); |
| | | }, 20000); |
| | | |
| | | jcapi.printData( |
| | | imageJsonObj, |
| | | { |
| | | imageJsonObj, { |
| | | printQuantity: 1, |
| | | }, |
| | | function (r) { |
| | | if (r.code != 0) { |
| | | // 恢复原始回调 |
| | | jcapi.didReadPrintCountInfo(originalPrintCountCallback); |
| | | jcapi.didReadPrintCountInfo( |
| | | originalPrintCountCallback); |
| | | // 结束当前打印任务 |
| | | reject(new Error(r.msg || "打印失败")); |
| | | } |
| | |
| | | } catch (error) { |
| | | reject(error); |
| | | } |
| | | }); |
| | | // }); |
| | | }, |
| | | tapQuery(item) { |
| | | this.maskShow = false; |
| | |
| | | // 设置为连接中状态 |
| | | this.connectionStatus = "connecting"; |
| | | |
| | | jcapi.openPrinterByDevice( |
| | | { |
| | | jcapi.openPrinterByDevice({ |
| | | address: item.address, |
| | | name: item.name, |
| | | deviceType: 0, // 设备类型:0-蓝牙,1-网络 |