chenhaozhe
2025-08-20 281517a6324a6b3f695ea6229b14867307f415ce
修改 条码生成 源单号 添加 制单人 修改打印功能
2个文件已修改
388 ■■■■■ 已修改文件
manifest.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/shouliaotongzhi/table_son.vue 384 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json
@@ -2,8 +2,8 @@
    "name" : "智云LMES",
    "appid" : "__UNI__B002F49",
    "description" : "",
    "versionName" : "1.0.56",
    "versionCode" : 156,
    "versionName" : "1.0.60",
    "versionCode" : 160,
    "transformPx" : false,
    /* 5+App特有相关 */
    "app-plus" : {
pages/shouliaotongzhi/table_son.vue
@@ -4,59 +4,62 @@
            <view class="form-item">
                <view class="title">收料单号:</view>
                <view class="righton">
                    <input v-model="baseInfo.HBillNo" disabled/>
                    <input v-model="baseInfo.HBillNo" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">采购单号:</view>
                <view class="righton">
                    <input v-model="baseInfo.HOrderBillNo" disabled/>
                    <input v-model="baseInfo.HOrderBillNo" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">物料编码:</view>
                <view class="righton">
                    <input v-model="baseInfo.HMaterNumber" disabled/>
                    <input v-model="baseInfo.HMaterNumber" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">物料名称:</view>
                <view class="righton">
                    <input v-model="baseInfo.HMaterName" disabled/>
                    <input v-model="baseInfo.HMaterName" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">规格型号:</view>
                <view class="righton">
                    <input v-model="baseInfo.HMaterModel" disabled/>
                    <input v-model="baseInfo.HMaterModel" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">收料数量:</view>
                <view class="righton">
                    <input v-model="baseInfo.HQty" disabled/>
                    <input v-model="baseInfo.HQty" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">每箱数量:</view>
                <view class="righton">
                    <input disabled="" v-model="baseInfo.HMinQty" type="number" placeholder="请输入数量"  @confirm="getNum()" @blur="getNum()"/>
                    <input disabled="" v-model="baseInfo.HMinQty" type="number" placeholder="请输入数量" @confirm="getNum()"
                        @blur="getNum()" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">箱数:</view>
                <view class="righton">
                    <input v-model="baseInfo.HBQty"  disabled/>
                    <input v-model="baseInfo.HBQty" disabled />
                </view>
            </view>
            <view class="buttons">
                <button class="btn-b" size="mini" type="default" @tap="getList()">条码生成</button>
                <!-- <button class="btn-c" size="mini" type="default" @tap="searchLabelPrinter()">搜索打印机</button> -->
                <button :class="codeGenComplete == false? 'btn-a': 'btn-c'" :disabled="codeGenComplete == false" size="mini" type="default"
                    @tap="search">打印</button>
            </view>
        </view>
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <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">
@@ -73,19 +76,22 @@
                        <text>条码编号:</text>{{item.条码编号}}
                    </view>
                </view>
                <view class="detail" style="text-align: right;"  @tap.stop="labelPrint(item)"><text style="color: orange;">点击打印条码</text></view>
<!--                 <view class="detail" style="text-align: right;" @tap.stop="labelPrint(item)"><text
                        style="color: orange;">点击打印条码</text></view> -->
            </uni-card>
        </view>
        <view class="over" v-if="listData.length == 0">暂无数据</view>
        <view class="over" v-if="listData.length != 0">已到底</view>
        <labelPrinterComponentVue ref="labelPrinter" :printInfo="printInfo" :printMode="'cpcl'"></labelPrinterComponentVue>
        <labelPrinterComponentVue ref="labelPrinter" :printInfo="printInfo" :printMode="'cpcl'">
        </labelPrinterComponentVue>
        <!-- 打印机选择列表 -->
        <view v-if="maskShow" class="uni-mask" @tap="maskShow = false">
            <scroll-view class="uni-scroll_box" scroll-y>
                <view class="uni-list-box" v-for="(device, index) in discoveredDevices" :key="index" @tap="connectBT(device)">
                <view class="uni-list-box" v-for="(device, index) in discoveredDevices" :key="index"
                    @tap="connectBT(device)">
                    <view class="uni-list_name">名称:{{ device.name }}</view>
                    <view class="uni-list_item">{{ connectedDeviceId === device.address?'已连接':'未连接' }}</view>
                </view>
@@ -95,7 +101,9 @@
</template>
<script>
    import { getUserInfo } from "@/utils/auth.js";
    import {
        getUserInfo
    } from "@/utils/auth.js";
    import labelPrinterComponentVue from "@/components/labelPrinterComponent/labelPrinterComponent.vue"
    // import bluetoothTool from '@/plugins/BluetoothTool.js'
    // import permission from '@/plugins/permission.js'
@@ -133,26 +141,29 @@
    //     EImage
    // } from "@psdk/esc";
    export default {
        components: {labelPrinterComponentVue},
        data() {
            return {
                userInfo:getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
                OperationType:1,//数据类型  1添加 保存  2复制  3 编辑
                linterid:'',
                HEntryID:'',
                baseInfo:{
                    HMainID:'',
                    HSubID:'',
                    HBillNo:'',
                    HMaterID:'',
                    HMaterNumber:'',
                    HMaterName:'',
                    HMaterModel:'',
                    HQty:'',
        components: {
            labelPrinterComponentVue
        },
        data() {
            return {
                codeGenComplete: false,
                userInfo: getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                OperationType: 1, //数据类型  1添加 保存  2复制  3 编辑
                linterid: '',
                HEntryID: '',
                baseInfo: {
                    HMainID: '',
                    HSubID: '',
                    HBillNo: '',
                    HMaterID: '',
                    HMaterNumber: '',
                    HMaterName: '',
                    HMaterModel: '',
                    HQty: '',
                    HMinQty: '',
                    HSupID:'',
                    SHdate:'',
                    HSupID: '',
                    SHdate: '',
                    HMTONo: '',
                    HBatchNo: '',
                    HBQty: '',
@@ -165,23 +176,27 @@
                    HMTONo: '',
                    HDate: '',
                    HSourceBillNo: '',
                    HMaker: getUserInfo()["Czymc"],
                    HCoilNO: '',
                    HFurnaceNO: '',
                    HFactory: '',
                },
                sWhere:'',
                listData:[],
                printItem:'',
                printInfo:"",
                maskShow:false,
                sWhere: '',
                listData: [],
                printItem: '',
                printInfo: "",
                maskShow: false,
                discoveredDevices: [], // 查询到的设备
                connectedDeviceId: ""
            }
        },
            }
        },
        onLoad(e) {
            this.OperationType = e.OperationType
            this.linterid = e.linterid
            this.HEntryID = e.hsubid
            this.getData()
            // //#ifdef APP-PLUS
            // // 蓝牙
            // bluetoothTool.init({
@@ -207,29 +222,32 @@
            // });
            // //#endif
        },
        methods: {
            getData(){
        methods: {
            getData() {
                uni.request({
                    url: this.serverUrl + '/Cg_POInStockBill/loadCg_POInStockBill_Push',
                    data: { HInterID: this.linterid, HSubID: this.HEntryID },
                    success: (res) => {
                        if(res.data.count == 1){
                    url: this.serverUrl + '/Cg_POInStockBill/loadCg_POInStockBill_Push',
                    data: {
                        HInterID: this.linterid,
                        HSubID: this.HEntryID
                    },
                    success: (res) => {
                        if (res.data.count == 1) {
                            var data = res.data.data
                            console.log(data)
                            this.baseInfo = {
                                HMainID:data[0].linterid,
                                HSubID:data[0].hsubid,
                                HBillNo:data[0].单据号,
                                HSourceBillNo: data[0].采购订单号,
                                HMainID: data[0].linterid,
                                HSubID: data[0].hsubid,
                                HBillNo: data[0].单据号,
                                HSourceBillNo: data[0].单据号,
                                HOrderBillNo: data[0].采购订单号,
                                HMaterID:data[0].HMaterID,
                                HMaterNumber:data[0].物料代码,
                                HMaterName:data[0].物料名称,
                                HMaterModel:data[0].规格型号,
                                HQty:data[0].数量,
                                HMaterID: data[0].HMaterID,
                                HMaterNumber: data[0].物料代码,
                                HMaterName: data[0].物料名称,
                                HMaterModel: data[0].规格型号,
                                HQty: data[0].数量,
                                HMinQty: data[0].数量,
                                HSupID:data[0].HSupID,
                                SHdate:data[0].审核日期,
                                HSupID: data[0].HSupID,
                                SHdate: data[0].审核日期,
                                HBatchNo: data[0]['批号'],
                                HSupID: data[0]['HSupID'],
                                HSupNumber: data[0]['供应商代码'],
@@ -240,39 +258,42 @@
                                HMTONo: data[0]['计划跟踪号'].trim(),
                                HDate: data[0]['日期'],
                            }
                            this.baseInfo.HBQty = Math.ceil(this.baseInfo.HQty / this.baseInfo.HMinQty)
                        }else{
                            this.listData = data
                        } else {
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
                });
            },
            getNum(e){
                if(this.baseInfo.HMinQty && this.baseInfo.HMinQty>0){
                    var a = Number(this.baseInfo.HQty)/Number(this.baseInfo.HMinQty)
                    this.baseInfo.HBQty = Math.ceil(Number(this.baseInfo.HQty)/Number(this.baseInfo.HMinQty))
            getNum(e) {
                if (this.baseInfo.HMinQty && this.baseInfo.HMinQty > 0) {
                    var a = Number(this.baseInfo.HQty) / Number(this.baseInfo.HMinQty)
                    this.baseInfo.HBQty = Math.ceil(Number(this.baseInfo.HQty) / Number(this.baseInfo.HMinQty))
                    this.$forceUpdate()
                }else{
                } else {
                    uni.showToast({
                        title:'请输入大于0的合理数量',
                        icon:"none"
                        title: '请输入大于0的合理数量',
                        icon: "none"
                    })
                }
            },
            getList(){
            getList() {
                let HBarCodeNoStr =
                    `${this.baseInfo.HBillNo}@${this.baseInfo.HSubID}@${this.baseInfo.HMaterNumber || ''}@${this.baseInfo.HMTONo || ''}@${this.baseInfo.HQty || 0}`
                var sMain = []
                sMain[0] = this.baseInfo
                var sMainStr = JSON.stringify(sMain);
@@ -285,36 +306,40 @@
                //获取选择的条码类型
                var HSelectBarCodeType = "品种条码";
                //获取当前登录人员
                var UserName = uni.getStorageSync('HUserName');
                var UserName = uni.getStorageSync('HUserName');
                let sMainSub = sMainStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' +
                    CampanyName + ';' + UserName + ';' + HBarCodeNoStr +'; ' + '; ' + '; ';
                    CampanyName + ';' + UserName + ';' + HBarCodeNoStr + '; ' + '; ' + '; ';
                uni.request({
                    url: this.serverUrl + '/Sc_BarCode/SaveBarCode_NoGenerate',
                    method:'POST',
                    data: { msg: sMainSub, CampanyName: CampanyName },
                    success: (res) => {
                        if(res.data.count == 1){
                            this.listData = res.data.data
                    url: this.serverUrl + '/Sc_BarCode/SaveBarCode_NoGenerate',
                    method: 'POST',
                    data: {
                        msg: sMainSub,
                        CampanyName: CampanyName
                    },
                    success: (res) => {
                        if (res.data.count == 1) {
                            this.codeGenComplete = true
                            console.log(this.listData)
                            this.listData[0]['条码编号'] = HBarCodeNoStr
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }else{
                        } else {
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
                });
            },
            async checkPermission() { // 授权
                try {
@@ -334,6 +359,82 @@
                    }
                } catch (err) {
                    console.log("授权失败:", err);
                }
            },
            async search() {
                // #ifndef APP-PLUS
                uni.showModal({
                    content: "不支持蓝牙打印功能,请切换手机...",
                })
                return
                // #endif
                if (this.$printer.isConnected() === false) {
                    this.$refs.labelPrinter.openPopup()
                } else {
                    let printContent = []
                    let printInfoBuffer = []
                    let count = 0
                    for (let listOne of this.listData) {
                        let HBarCodeNoStr =
                            `${this.baseInfo.HBillNo}@${this.baseInfo.HSubID}@${this.baseInfo.HMaterNumber || ''}@${this.baseInfo.HMTONo || ''}@${this.baseInfo.HQty || 0}`
                        let pcsInfo = this.baseInfo.HPcsName ? '(' + this.baseInfo.HPcsName + ')' : ''
                        printContent.push(`! 0 200 200 400 1
PAGE-WIDTH 608
SETQRVER 3
B QR 475 15 Q 0 U 3
LA,${HBarCodeNoStr}
ENDQR
T 24 0 0 30 供应商: ${this.baseInfo.HSupName}
T 55 0 0 55 (Supplier)
T 24 0 0 75 供应商料号:  ${this.baseInfo.HMaterNumber}
T 55 0 0 100 (Supplier Sku No.)
T 24 0 0 120 物料名称: ${this.baseInfo.HMaterName}
T 55 0 0 145 (Material Code)
T 24 0 0 165 款号: ${this.baseInfo.HCoilNO || ''}
T 55 0 0 190 (Style No.)
T 24 0 300 165 客户编号: ${this.baseInfo.HFactory || ''}
T 55 0 300 190 (Consumer No.)
T 24 0 0 210 分组: ${this.baseInfo.HFurnaceNO || ''}
T 55 0 0 235 (Group)
T 24 0 300 210 规格: ${this.baseInfo.HMaterModel}
T 55 0 300 235 (SKU NO.)
T 24 0 0 255 数量:  ${ parseFloat(this.baseInfo.HQty || 0).toFixed(0) } ${pcsInfo}
T 55 0 0 280 (Quantity)
T 24 0 300 255 日期: ${this.baseInfo.HDate || ''}
T 55 0 300 280 (Date)
T 24 0 0 300 检验员:
T 55 0 0 325 (QC)
T 24 0 300 300 采购单号: ${this.baseInfo.HOrderBillNo || ''}
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`)
                        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()
                    })
                }
            },
            async searchLabelPrinter() {
@@ -360,7 +461,7 @@
                        }
                    }
                })
            },
            onDevice(device) {
                console.log("监听寻找到新设备的事件---------------")
@@ -426,35 +527,35 @@
                                        PAGE-WIDTH 608
                                        SETQRVER 3
                                        B QR 450 30 M 2 U 5
                                        LA,`+ this.printItem.条码编号 + `
                                        LA,` + this.printItem.条码编号 + `
                                        ENDQR
                                        T 24 0 24 40 审核日期:`+ this.baseInfo.SHdate +`
                                        T 24 0 24 80 物料编码:`+ this.printItem.物料代码 +`
                                        T 24 0 24 120 物料名称:`+ this.printItem.物料名称 +`
                                        T 24 0 24 160 规格型号:`+ this.printItem.规格型号 +`
                                        T 24 0 24 200 物料数量:`+ this.baseInfo.HQty +`
                                        T 24 0 24 240 条码数量:`+ this.printItem.数量 +`
                                        T 24 0 24 40 审核日期:` + this.baseInfo.SHdate + `
                                        T 24 0 24 80 物料编码:` + this.printItem.物料代码 + `
                                        T 24 0 24 120 物料名称:` + this.printItem.物料名称 + `
                                        T 24 0 24 160 规格型号:` + this.printItem.规格型号 + `
                                        T 24 0 24 200 物料数量:` + this.baseInfo.HQty + `
                                        T 24 0 24 240 条码数量:` + this.printItem.数量 + `
                                        FORM
                                        PRINT`
                    await this.$nextTick(() => {
                        this.$refs.labelPrinter.execPrint()
                    })
                }
                // // 检查蓝牙连接
                // let btStatus = bluetoothTool.getBluetoothStatus()
                // if(btStatus != true) {
                //     this.showToast("蓝牙连接异常!")
                //     return
                // }
                // // 检查是否连接设备
                // let pairedDevices = bluetoothTool.getPairedDevices()
                // if(pairedDevices.length < 1) {
                //     this.showToast("无设备连接!")
                //     return
                // }
                // // 检查表单项是否有空值
                // for (var key in this.hform) {
                //     if (this.hform[key] == "") {
@@ -566,103 +667,119 @@
            //         title: result ? '发送成功!' : '发送失败...'
            //     })
            // },
        }
        }
    }
</script>
<style lang="scss" scoped>
    .form{
    .form {
        width: 640rpx;
        margin: 20rpx auto;
    }
    .form-item{
    .form-item {
        display: flex;
        align-items: center;
        font-size: 28rpx;
        padding: 6rpx 0;
        .title{
        .title {
            width: 180rpx;
            text{
            text {
                color: red;
                font-weight: bold;
            }
        }
        .right{
        .right {
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #acacac;
        }
        .righton{
        .righton {
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
        }
        input{
        input {
            width: 100%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
    }
    .buttons{
    .buttons {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 20rpx;
        button{
        button {
            border-radius: 50rpx;
            width: 220rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a{
        .btn-a {
            background-color: #acacac;
            color: #fff;
        }
        .btn-b{
        .btn-b {
            background-color: #41a863;
            color: #fff;
        }
        .btn-c{
        .btn-c {
            background-color: #3a78ff;
            color: #fff;
        }
    }
    .list{
    .list {
        width: 100%;
        .card-detail{
        .card-detail {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            line-height: 120%;
            .detail{
            .detail {
                // width: 50%;
                font-size: 26rpx;
                margin-bottom: 12rpx;
                color: #555;
                margin-right: 20rpx;
                text{
                text {
                    color: #999;
                    font-size: 26rpx;
                }
            }
        }
        .more{
        .more {
            color: #888;
            font-size: 24rpx;
            display: flex;
            border-top: 1px solid #eee;
            padding-top: 20rpx;
            .part{
            .part {
                width: 50%;
                text-align: center;
            }
        }
    }
    .uni-mask {
        position: fixed;
        top: 0;
@@ -676,46 +793,49 @@
        padding: 0 30rpx;
        box-sizing: border-box;
    }
    .uni-scroll_box {
        height: 60%;
        background: #fff;
        border-radius: 20rpx;
    }
    .uni-list-box {
        margin: 0 20rpx;
        padding: 15rpx 0;
        border-bottom: 1px #f5f5f5 solid;
        box-sizing: border-box;
    }
    .uni-list:last-child {
        border: none;
    }
    .uni-list_name {
        font-size: 30rpx;
        color: #333;
    }
    .uni-list_item {
        font-size: 24rpx;
        color: #555;
        line-height: 1.5;
    }
    .operation-zone {
        display: flex;
        justify-content: space-around;
        margin-top: 10rpx;
        .op1 {
            border: 1px solid #41a863;
            color: #41a863;
        }
        .op4 {
            border: 1px solid #da0000;
            color: #da0000;
        }
    }
</style>
    }
</style>