Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev
| | |
| | | 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: { |
| | |
| | | }); |
| | | }, |
| | | 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) { |
| | |
| | | uni.showLoading({ |
| | | title: "发送中..." |
| | | }) |
| | | console.log("msg: " + cmd); |
| | | // console.log("msg: " + cmd); |
| | | let toast = (msg) => { |
| | | uni.showToast({ |
| | | icon: 'none', |
| | |
| | | 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); |
| | |
| | | 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); |
| | | }, |
| | |
| | | <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类的组件时,当popup不显示时,组件树中没有popup内的模组,无法使用ref调用模组内的函数,故需要在外部挂载一个透明的组件 --> |
| | | <blueToothConnectorVue style="display: none;position: absolute; bottom: 0;right: 0;" ref="bt2"></blueToothConnectorVue> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | 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: { |
| | |
| | | blueToothConnectorVue |
| | | }, |
| | | methods: { |
| | | openPopup() { |
| | | async openPopup() { |
| | | this.$refs.popup.open(); |
| | | // 在popup中的操作针对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() { |
| | | // 检查蓝牙连接 |
| | |
| | | this.showToast("无设备连接!") |
| | | return |
| | | } |
| | | |
| | | try { |
| | | if (typeof this.printInfo === 'function') { |
| | | // 传入的printInfo是函数,直接执行 |
| | | 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({ |
| | |
| | | * { |
| | | box-sizing: border-box; |
| | | } |
| | | .container[hidden] { |
| | | padding: 0 !important; |
| | | height: 0 !important; |
| | | } |
| | | </style> |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/caigoudingdan/generate", |
| | | "style": { |
| | | "navigationBarTitleText": "条码生成" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/caigoudingdan/caigoudingdan", |
| | | "style": { |
| | | "navigationBarTitleText": "采购订单" |
| | | } |
| | | }, |
| | | { |
| | | "path" : "pages/MJGL/shangmudan/table", |
| | | "style" : |
| | | { |
| | |
| | | </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.物料代码" :extra="'No. ' + Number(index+1)" style="margin: 10px;"> |
| | | <view class="card-detail"> |
| | | <view class="detail"> |
| | |
| | | </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> |
| | | |
| | |
| | | import { |
| | | CommonUtils |
| | | } from "../../utils/common"; |
| | | import { |
| | | nextTick |
| | | } from "vue"; |
| | | import labelPrinterComponentVue from "@/components/labelPrinterComponent/labelPrinterComponent.vue" |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | linterid: '', |
| | | HEntryID: '', |
| | | hmaterid: '', |
| | | codeGenComplete: false, |
| | | baseInfo: { |
| | | HBillNo: '', |
| | | HMainID: '', |
| | |
| | | HQty: '', |
| | | HMinQty: '', |
| | | HBQty: '', |
| | | HSupID: '', |
| | | }, |
| | | sWhere: '', |
| | | listData: [], |
| | | |
| | | } |
| | | }, |
| | | components: { |
| | | labelPrinterComponentVue |
| | | }, |
| | | onLoad(e) { |
| | | console.log(e) |
| | |
| | | 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) |
| | |
| | | HMaterName: data[0]['物料名称'], |
| | | HMaterModel: data[0]['规格型号'], |
| | | HQty: data[0]['数量'], |
| | | HMTONo: data[0]['计划跟踪号'] |
| | | HMTONo: data[0]['计划跟踪号'], |
| | | HSupID: data[0]['HSupID'] |
| | | } |
| | | this.listData = data |
| | | } else { |
| | |
| | | } |
| | | }, |
| | | 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['物料代码']} |
| | | 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 合格 |
| | |
| | | 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() |
| | |
| | | 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' |
| | |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | button[disabled] { |
| | | background-color: #acacac; |
| | | color: #fff; |
| | | } |
| | | |
| | | .btn-a { |
| | | background-color: #acacac; |
| | | color: #fff; |
| | |
| | | }, |
| | | { |
| | | img: '../../static/icon/icon16.png', |
| | | text: '条码打印', |
| | | text: '来料条码打印', |
| | | url: '/pages/tiaomadaying/tiaomadaying', |
| | | id: 28, |
| | | }, |
| | |
| | | text: '上模单', |
| | | url: '/pages/MJGL/shangmudan/table', |
| | | id: 29, |
| | | } |
| | | }, |
| | | { |
| | | img: '../../static/icon/icon16.png', |
| | | text: '采购订单', |
| | | url: '/pages/caigoudingdan/caigoudingdan', |
| | | id: 30, |
| | | }, |
| | | ] |
| | | } |
| | | }, |
| | |
| | | <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" |
| | |
| | | <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> |
| | | |
| | |
| | | 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: '' |
| | | } |
| | | }; |
| | | }, |
| | |
| | | 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` |
| | | |
| | |
| | | } |
| | | }, |
| | | setLailiaoInfo(data, row) { |
| | | if(row > data.length) { |
| | | if (row > data.length) { |
| | | return uni.showToast({ |
| | | icon: 'none', |
| | | title: '查询的单据号不存在...' |
| | |
| | | } |
| | | 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({ |
| | |
| | | } |
| | | 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}'`, |
| | |
| | | }, |
| | | (res) => { |
| | | console.log('采购订单: ', res) |
| | | let {data, count} = res.data |
| | | if(count > 0){ |
| | | let { |
| | | data, |
| | | count |
| | | } = res.data |
| | | if (count > 0) { |
| | | this.setLailiaoInfo(data, Row) |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | 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 { |
| | |
| | | >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> |
| | |
| | | <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> |
| | | <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> |
| | |
| | | return /^\d+$/.test(str); |
| | | } |
| | | |
| | | isJson(str) { |
| | | try{ |
| | | JSON.parse(str) |
| | | return true |
| | | }catch{ |
| | | return false |
| | | } |
| | | } |
| | | |
| | | timeClock(callback, delay) { |
| | | let timeoutId; |
| | | let isRunning = false; |