pages/tiaomadaying/tiaomadaying.vue
@@ -137,12 +137,13 @@
                    HSubID: '',
                    HOrderBillNo: '',
                    HMaterID: '',
                    barCodeNo: '',
                    // barCodeNo: '',
                    HBillNo: '',
                    HBillLineNo: '',
                    HMaterNumber: '',
                    HMaterName: '',
                    HMaterModel: '',
                    HPcsName: '',
                    HBatchNo: '',
                    HQty: '',
                    HMTONo: '',
@@ -152,6 +153,14 @@
                    HBQty: '',
                    HSupID: '',
                    HUnitID: '',
                    HDate: '',
                    HSourceBillNo: '',
                    HMaker: getUserInfo()["Czymc"],
                    HSupNumber: '',
                    HCoilNO: '',
                    HFurnaceNO: '',
                    HFactory: '',
               HInnerBillNo: '',
                }
            };
        },
@@ -173,206 +182,82 @@
                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()
                    // })
                    // T 24 0 300 280 计划跟踪号: ${this.lailiaoInfo.HMTONo || ''}
                    let HBarCodeNoStr =
                        // `${this.lailiaoInfo.HBillNo}@${this.lailiaoInfo.HBillLineNo}@${this.lailiaoInfo.HMaterNumber || ''}@${this.lailiaoInfo.HMTONo || ''}@${parseFloat(this.lailiaoInfo.HQty||0).toFixed(10)}@${this.lailiaoInfo.HSupNumber || ''}`
                        `${this.lailiaoInfo.HBillNo}@${this.lailiaoInfo.HBillLineNo}@${this.lailiaoInfo.HMaterNumber || ''}@${this.lailiaoInfo.HMTONo || ''}@${this.lailiaoInfo.HQty||0}@${this.lailiaoInfo.HSupNumber || ''}`
                    let pcsInfo = this.lailiaoInfo.HPcsName ? '(' + this.lailiaoInfo.HPcsName + ')' : ''
                    this.printInfo = `! 0 200 200 400 1
PAGE-WIDTH 608
SETQRVER 3
B QR 480 30 M 4 U 4
LA,${this.lailiaoInfo.barCodeNo}
B QR 475 15 Q 0 U 3
LA,${HBarCodeNoStr}
ENDQR
T 24 0 10 30 供应商: ${this.lailiaoInfo.HSupName}
T 55 0 10 55 (Supplier)
T 24 0 10 70 供应商料号:  ${this.lailiaoInfo.HMaterNumber}
T 55 0 10 95 (Supplier Sku No.)
T 24 0 10 110 物料名称: ${this.lailiaoInfo.HMaterName}
T 55 0 10 135 (Material Code)
T 24 0 10 150 款号:
T 55 0 10 175 (eng)
T 24 0 300 150 客户编号:
T 55 0 300 175 (eng)
T 24 0 10 190 分组: ${this.lailiaoInfo.HBatchNo}
T 55 0 10 215 (Group)
T 24 0 300 190 规格: ${this.lailiaoInfo.HMaterModel}
T 55 0 300 215 (SKU NO.)
T 24 0 10 230 数量:  ${this.lailiaoInfo.HQty} (${this.lailiaoInfo.HPcsName})
T 55 0 10 255 (Quantity)
T 24 0 300 230 日期: ${this.lailiaoInfo.HDate}
T 55 0 300 255 (Date)
T 24 0 10 270 检验员:
T 55 0 10 295 (QC)
T 24 0 300 270 采购单号: ${this.lailiaoInfo.HBillNo || ''}
T 55 0 300 295 (Purchase Order No.)
T 24 0 10 310 检验结果:
T 55 0 10 335 (Inspection status)
BOX 240 310 260 330 4
T 24 0 270 310 合格
T 55 0 250 335 (Pass)
BOX 340 310 360 330 4
T 24 0 370 310 不合格
T 55 0 370 335 (Fail)
BOX 460 310 480 330 4
T 24 0 490 310 特采
T 55 0 440 335 (Spec. accepted)
T 24 0 0 30 供应商: ${this.lailiaoInfo.HSupName}
T 55 0 0 55 (Supplier)
T 24 0 0 75 供应商料号:  ${this.lailiaoInfo.HMaterNumber}
T 55 0 0 100 (Supplier Sku No.)
T 24 0 0 120 物料名称: ${this.lailiaoInfo.HMaterName}
T 55 0 0 145 (Material Code)
T 24 0 0 165 款号: ${this.lailiaoInfo.HCoilNO}
T 55 0 0 190 (Style No.)
T 24 0 300 165 客户编号: ${this.lailiaoInfo.HFactory}
T 55 0 300 190 (Consumer No.)
T 24 0 0 210 分组: ${this.lailiaoInfo.HFurnaceNO || ''}
T 55 0 0 235 (Group)
T 24 0 300 210 规格: ${this.lailiaoInfo.HMaterModel}
T 55 0 300 235 (SKU NO.)
T 24 0 0 255 数量:  ${ parseFloat(this.lailiaoInfo.HQty || 0).toFixed(0) } ${pcsInfo}
T 55 0 0 280 (Quantity)
T 24 0 300 255 日期: ${this.lailiaoInfo.HDate || ''}
T 55 0 300 280 (Date)
T 24 0 0 300 检验员:
T 55 0 0 325 (QC)
T 24 0 300 300 采购单号: ${this.lailiaoInfo.HBillNo || ''}
T 55 0 300 325 (Purchase Order No.)
T 24 0 0 345 检验结果:
T 55 0 0 370 (Inspection status)
BOX 240 345 260 365 4
T 24 0 270 345 合格
T 55 0 250 370 (Pass)
BOX 340 345 360 365 4
T 24 0 370 345 不合格
T 55 0 370 370 (Fail)
BOX 460 345 480 365 4
T 24 0 490 345 特采
T 55 0 440 370 (Spec. accepted)
FORM
PRINT`
                    await this.$nextTick(() => {
                        this.$refs.labelPrinter.execPrint()
                    })
                }
            },
            setLailiaoInfo(data, row) {
                if (row > data.length) {
                    CommonUtils.playSound(0)
                    return uni.showToast({
                        icon: 'none',
                        title: '查询的单据号不存在...'
                    })
                }
                let d = data[row - 1]
            setLailiaoInfo(data, row, HQty) {
                let d = data[0]
                // console.log('数量: ', parseFloat(d['数量']).toFixed(10));
                this.lailiaoInfo = Object.assign(this.lailiaoInfo, {
                    HMaterNumber: d['物料编码'],
                    HMaterName: d['物料名称'],
                    HMaterModel: d['规格型号'],
                    HBatchNo: d['批号'],
                    HQty: d['数量'],
                    // HBatchNo: d['批号'],
                    HQty: !CommonUtils.isEmpty(HQty) ? HQty : d['数量'],
                    HMinQty: d['数量'],
                    HBQty: d['数量'],
                    HSupID: d['HSupID'],
                    HSupNumber: d['供应商代码'],
                    HSupName: d['供应商'],
                    HUnitID: d['HUnitID'],
                    HPcsName: d['计量单位'],
                    HSupNameShort: d['供应商'],
                    HMTONo: d['计划跟踪号'],
                    HMainID: d['linterid'],
                    HMainID: d['hmainid'],
                    HSubID: d['HEntryID'],
                    HMaterID: d['HMaterID'],
                    HDate: d['日期'],
                    HCoilNO: d['款号'] || '',
                    HFurnaceNO: d['分组'] || '',
                    HFactory: d['客户编号'] || '',
                })
                CommonUtils.playSound(1)
                this.buttonStatus.btn2 = true
@@ -389,6 +274,7 @@
                    HMaterNumber: '',
                    HMaterName: '',
                    HMaterModel: '',
                    HPcsName: '',
                    HBatchNo: '',
                    HQty: '',
                    HMTONo: '',
@@ -396,12 +282,22 @@
                    HSupNameShort: '',
                    HMinQty: '',
                    HBQty: '',
                    HSupID: '',
                    HUnitID: '',
                    HDate: '',
                    HSourceBillNo: '',
                    HSupNumber: '',
                    HCoilNO: '',
                    HFurnaceNO: '',
                    HFactory: '',
                }
                this.buttonStatus = {
                    btn1: true,
                    btn2: false
                }
                this.refreshBarcodeState()
            },
            barCodeEntryHandler(barCode) {
                if (CommonUtils.isEmpty(barCode) === false) {
@@ -417,16 +313,14 @@
                        })
                    }
                    let barCodeInfo = barCode.split("@")
                    let [PurchaseBillNo, Row] = barCodeInfo
                    this.lailiaoInfo.HBillNo = PurchaseBillNo,
                        this.lailiaoInfo.HBillLineNo = Row
                    console.log({
                        sWhere: ` and 单据号 = '${PurchaseBillNo}'`,
                        user: this.userInfo.Czymc,
                    })
                    let [PurchaseBillNo, Row, MaterNumber, MTO, HQty, HSupNumber] = barCodeInfo
                    this.lailiaoInfo.HBillNo = PurchaseBillNo
               this.lailiaoInfo.HInnerBillNo = PurchaseBillNo
                    this.lailiaoInfo.HSourceBillNo = PurchaseBillNo
                    this.lailiaoInfo.HBillLineNo = Row
                    CommonUtils.doRequest(
                        "/Cg_POOrderBill/list", {
                            sWhere: ` and 单据号 = '${PurchaseBillNo}'`,
                            sWhere: ` and 单据号 = '${PurchaseBillNo}' and 行号 = ${Row}`,
                            user: this.userInfo.Czymc,
                        },
                        (res) => {
@@ -437,8 +331,8 @@
                                Message
                            } = res.data
                            if (count > 0) {
                                this.setLailiaoInfo(data, Row)
                                console.log('data: ', data);
                                this.setLailiaoInfo(data, Row, HQty)
                                // uni.showToast({
                                //     icon: 'none',
                                //     title: Message
@@ -517,7 +411,7 @@
            },
            GenereateBarCode() {
                let HBarCodeNoStr =
                    `${this.lailiaoInfo.HBillNo}@${this.lailiaoInfo.HBillLineNo}@${this.lailiaoInfo.HMaterNumber || ''}@${this.lailiaoInfo.HMTONo || ''}@${this.lailiaoInfo.HQty || ''}@${this.lailiaoInfo.HSupID || ''}`
                    `${this.lailiaoInfo.HBillNo}@${this.lailiaoInfo.HBillLineNo}@${this.lailiaoInfo.HMaterNumber || ''}@${this.lailiaoInfo.HMTONo || ''}@${this.lailiaoInfo.HQty || 0}@${this.lailiaoInfo.HSupNumber  || ''}`
                let sMain = []
                sMain[0] = this.lailiaoInfo
                let sMainStr = JSON.stringify(sMain);
@@ -532,8 +426,11 @@
                //获取当前登录人员
                let UserName = uni.getStorageSync('HUserName');
                let sMainSub = sMainStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' +
                    CampanyName + ';' + UserName + ';' + HBarCodeNoStr;
                    CampanyName + ';' + UserName + ';' + HBarCodeNoStr +
               ';"' + this.lailiaoInfo.HFactory + '";"' + this.lailiaoInfo.HCoilNO +
                '";"' + this.lailiaoInfo.HFurnaceNO + '"';
            console.log(sMainSub.split(';'))
                CommonUtils.doRequest(
                    "/Sc_BarCode/SaveBarCode_NoGenerate", {
                        msg: sMainSub,
@@ -555,9 +452,13 @@
                            })
                            this.buttonStatus = {
                                btn1: true,
                                btn2: true
                                btn2: false
                            }
                        } else {
                            this.buttonStatus = {
                                btn1: false,
                                btn2: false
                            }
                            uni.showToast({
                                icon: 'none',
                                title: Message
@@ -565,6 +466,10 @@
                        }
                    },
                    (err) => {
                        this.buttonStatus = {
                            btn1: false,
                            btn2: false
                        }
                        uni.showToast({
                            icon: 'none',
                            title: err