llj
2026-02-04 a00ddcb072d20e6622081ca8ba87cac20a124b36
app小卫装箱
1个文件已添加
2个文件已修改
592 ■■■■■ 已修改文件
pages.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/zhuangxiang/snZhuangxiang_xiaowei.vue 578 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json
@@ -1764,6 +1764,13 @@
            {
                "navigationBarTitleText" : "拆箱小卫"
            }
        },
        {
            "path" : "pages/zhuangxiang/snZhuangxiang_xiaowei",
            "style" :
            {
                "navigationBarTitleText" : "装箱(小卫)"
            }
        }
        
pages/index/index.vue
@@ -351,6 +351,13 @@
                        "id": 27,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon21.png",
                        "text": "小卫装箱",
                        "url": "/pages/zhuangxiang/snZhuangxiang_xiaowei",
                        "id": 28,
                        "hidden": false
                    },
                ],
            }
        },
pages/zhuangxiang/snZhuangxiang_xiaowei.vue
New file
@@ -0,0 +1,578 @@
<template>
    <view class="form">
        <view class="form-base-info">
            <view class="form-item">
                <view class="title">sn码</view>
                <view class="right">
                    <input type="text" :focus="HBarCodePackFocus" v-model="HBarCode_Pack" @confirm="GetMeesageByBarCode_Pack(HBarCode_Pack)" />
                </view>
                <view class="right-icon">
                    <uni-icons class="right-icon" type="scan"
                        style="background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20"
                        @click="toScanCode"></uni-icons>
                </view>
            </view>
        </view>
        <view class="tabs">
            <view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">装箱信息</view>
            <view :class="tabs == 1 ? 'on':''" @tap="tabs = 1">单据信息</view>
        </view>
        <!-- 拆箱信息 -->
        <view v-if="tabs == 0">
            <zb-table id="list-table" :fit="true" :style="{height: `${listTableHeight}px`}" :columns="columns" :data="listData"
                :show-header="true" :border="true" :row-key="row => row.index" @toggleRowSelection="handleSelect"
                @toggleAllSelection="handleSelectAll" />
        </view>
        <!-- 单据信息 -->
        <view v-if="tabs == 1">
            <view class="bill-info">
                <view class="form-item">
                    <view class="title">单据日期</view>
                    <view class="right">
                        <uni-datetime-picker type="date" v-model="hform.HDate">
                            <input type="text" v-model="hform.HDate" />
                        </uni-datetime-picker>
                    </view>
                </view>
            </view>
            <view class="bill-info">
                <view class="form-item">
                    <view class="title">制单人</view>
                    <view class="right disabled">
                        <input type="text" disabled :value="hform.HMaker" />
                    </view>
                </view>
            </view>
            <!-- <view class="bill-info">
                <view class="form-item">
                    <view class="title">单据号</view>
                    <view class="right disabled">
                        <input type="text" disabled :value="hform.HBillNo" />
                    </view>
                </view>
            </view> -->
            <!-- <view class="bill-info">
                <view class="form-item">
                    <view class="title">单据ID</view>
                    <view class="right disabled">
                        <input type="text" disabled :value="hform.HInterID" />
                    </view>
                </view>
            </view> -->
            <view class="bill-info">
                <view class="form-item">
                    <view class="title">组织</view>
                    <view class="right disabled">
                        <input type="text" disabled :value="hform.HStockOrgName" />
                    </view>
                </view>
            </view>
        </view>
        <view class="bottom-btn" id="bottom-btn">
            <button :class="EnableSubmit?'btn-a':'btn-c'" :disabled="!EnableSubmit" size="mini" @tap="cmdSubmit">拆箱</button>
            <view style="flex: 1;"></view>
            <!-- <button class="btn-d" size="mini" @tap="cmdDelete">删除</button> -->
            <button class="btn-c" size="mini" @tap="cmdExit">退出</button>
        </view>
    </view>
</template>
<script>
    import dayjs from 'dayjs'
    import {
        getUserInfo
    } from "../../utils/auth";
    import {
        CommonUtils
    } from "@/utils/common.js"
    import {
        MpaasScan
    } from "@/utils/mpaasScan.js"
    export default {
        data() {
            return {
                ItemidList:'',
                EnableSubmit: true,
                // 计算列表高度
                bottomBtnTop: 0,
                listTableTop: 0,
                // 公共变量
                HBarCodePackFocus: false,
                HBarCodeFocus: false,
                HBarCode_Pack: '', //箱条码
                HBarCode: '', // 包条码
                tabs: 0,
                HBillType: '3783',
                HBillSubType: '1', //子类型(1拆箱、2拆托)
                OperationType: 1, //操作类型(1新增、2从缓存列表中返回)
                HMaterNumber_Pack: "", //托条码对应物料代码
                listOption: [],
                listData: [],
                columns: [
                    {
                        name: 'index',
                        label: '序号',
                        width: 60,
                        hidden: true,
                    },
                    // {
                    //     name: '中箱码',
                    //     label: '中箱码',
                    //     width: 100,
                    // },
                    {
                        name: 'sn码',
                        label: 'sn码',
                        width: 100,
                    },
                    {
                        name: '物料代码',
                        label: '物料代码',
                        width: 100,
                    },
                    {
                        name: '物料名称',
                        label: '物料名称',
                        width: 100,
                    },
                ],
                selectedRows: [], // 存储选中的数据
                HModName: "Sc_UnPackUnionBill_Packing_PDA",
                ModRightName: "CE_UnPackUnionBill_Packing", //模块权限参数
                titleData: [], //不需要显示的字段
                OperationType: 1, //从缓存列表中返回数据类型(1新增、2从缓存列表中返回)
                HBarCode_Pack_Temp: "", //从缓存列表中返回箱条码
                // 表单提交值
                hform: {
                    HDate: dayjs(new Date()).format('YYYY-MM-DD'),
                    HMaker: getUserInfo()['Czymc'],
                    HBillNo: '',
                    HInterID: '',
                    HStockOrgName: uni.getStorageSync("Organization"),
                    HStockOrgID: uni.getStorageSync("OrganizationID"),
                },
                // 分页模块元数据
                paginationMeta: {
                }
            }
        },
        methods: {
            async HBarCodeFocusRefresh(){
              this.HBarCode = ''
              this.HBarCodeFocus = false
              await this.$nextTick()
              this.HBarCodeFocus = true
            },
            async HBarCodePackFocusRefresh(){
              this.HBarCode_Pack = ''
              this.HBarCodePackFocus = false
              await this.$nextTick()
              this.HBarCodePackFocus = true
            },
            toScanCode() {
                MpaasScan.scanCode((scanCode) => {
                    this.HBarCode_Pack = scanCode
                    this.GetMeesageByBarCode_Pack(HBarCode_Pack)
                })
            },
            GetMeesageByBarCode_Pack(HBarCode) {
                // 获取包条码对应的数据
                let HBarCode_Pack = this.HBarCode_Pack
                let sOldBarCode = this.HBarCode_Pack
                let HDeleteFlag = sOldBarCode.substring(0, 1)
                let sBarCode = sOldBarCode.slice(1)
                if (!HBarCode_Pack) {
                    return uni.showToast({
                        icon: 'none',
                        title: 'sn条码为空,请先扫描sn条码',
                    })
                }
                    let sBarCode_b = this.HBarCode_Pack
                    if (!sBarCode_b) {
                        return uni.showToast({
                            icon: 'none',
                            title: 'sn条码不能为空,请扫描sn条码',
                        })
                    }
                    CommonUtils.doRequest2({
                        url: '/CheckBarcodeController/PackedBoxSn',
                        data: {
                            "HBarCode": sBarCode_b,
                            "HMaker":this.hform.HMaker,
                            "HDate":this.hform.HDate
                            //"HBarCode_Pack": HBarCode_Pack,
                        },
                        resFunction: (res) => {
                            let {
                                data,
                                count,
                                Message
                            } = res.data
                            if (count == 1) {
                                CommonUtils.playSound(1)
                                console.log(data[0])
                                //this.listData = []
                                var codeLength=data.length
                                for (let i = 0; i < codeLength; i++) {
                                    const newItem = data[i]
                                    const isExist = this.listData.some(item =>
                                        item['sn码'] === newItem['sn码']
                                    )
                                    if (!isExist) {
                                            this.listData.push(Object.assign(newItem, {
                                             index: this.listData.length // 使用当前列表长度作为新index
                                       }))
                                  }
                                  this.ItemidList=this.ItemidList+newItem['HItemID']+","
                                  console.log(this.ItemidList)
                                   }
                                    this.HBarCode_Pack = ''
                                    this.HBarCodePackFocusRefresh()
                            } else {
                                CommonUtils.playSound(0)
                                this.HBarCodeFocusRefresh()
                                uni.showToast({
                                    icon: 'none',
                                    title: Message
                                })
                            }
                            console.log(sBarCode_b)
                        }
                    })
            },
            handleSelect(selected, array) {
                this.selectedRows = array
            },
            handleSelectAll(selected, array) {
                this.selectedRows = array
            },
            getMaxNo() {
                CommonUtils.doRequest2({
                    url: "/WEBSController/GetMaxBillNoAndID_Json",
                    data: {
                        "HBillType": this.HBillType
                    },
                    resFunction: (d) => {
                        console.log('d: ', d);
                        let {
                            count,
                            data,
                            Message
                        } = d.data
                        if (count == 1) {
                            this.hform.HInterID = data[0].HInterID;
                            this.hform.HBillNo = data[0].HBillNo
                        } else {
                            uni.showModal({
                                title: "温馨提示",
                                showCancel: false,
                                content: Message
                            })
                        }
                    }
                })
            },
            submitPreCheck() {
                if (CommonUtils.isEmpty(this.hform.HInterID)) {
                    uni.showToast({
                        icon: 'none',
                        title: '单据内码获取失败,错误的单据内码!'
                    })
                    return false
                }
                if (CommonUtils.isEmpty(this.hform.HBillNo)) {
                    uni.showToast({
                        icon: 'none',
                        title: '单据号获取失败,错误的单据号!'
                    })
                    return false
                }
                if (this.listData.length < 1) {
                    uni.showToast({
                        icon: 'none',
                        title: '没有扫码信息,请先扫描条码,确认无误后再提交!'
                    })
                    return false
                }
                return true
            },
            cmdDelete() {
                console.log('this.selectedRows: ', this.selectedRows);
                if (this.selectedRows.length != 1) {
                    return uni.showToast({
                        icon: 'none',
                        title: '请选择一行记录,进行删除!'
                    })
                }
                uni.showModal({
                    title: '删除确认',
                    content: '确认要删除选中行所有扫码记录?删除后将不可恢复!',
                    success: () => {
                        if (confirm) {
                            CommonUtils.doRequest2({
                                url: '/WEBSController/set_DelPackUnionBill_Temp_Pack_Json',
                                data: {
                                    HInterID: this.hform.HInterID,
                                    HBillType: this.HBillType,
                                    HBarCode: this.selectedRows[0].HBarCode
                                },
                                resFunction: (res) => {
                                    let {
                                        data,
                                        count,
                                        Message
                                    } = res.data
                                    if (count == 1) {
                                        CommonUtils.playSound(1)
                                        uni.showToast({
                                            icon: 'none',
                                            title: Message
                                        })
                                        this.DisBillEntryList()
                                    } else {
                                        CommonUtils.playSound(0)
                                        uni.showToast({
                                            icon: 'none',
                                            title: Message
                                        })
                                    }
                                }
                            })
                        }
                    }
                })
            },
            cmdSubmit() {
                // let checkRes = this.submitPreCheck()
                // if (!checkRes) {
                //     return
                // }
                this.EnableSubmit = false
                let HItemIDs=this.ItemidList.slice(0,-1)
                            CommonUtils.doRequest2({
                                url: '/CheckBarcodeController/submitPackedBoxSn',
                                data: {
                                    "HItemIDs": HItemIDs,
                                     "HMaker":this.hform.HMaker,
                                     "HDate":this.hform.HDate
                                },
                                resFunction: (res) => {
                                    let {data, count, Message} = res.data
                                    if(count == 1){
                                        uni.showModal({
                                            title: '生成的条码:',
                                            content: res.data.data[0].HBackRemark,
                                            confirmText: "新增",
                                            cancelText: '关闭',
                                            success: ({confirm,cancel}) => {
                                                if(confirm) {
                                                    uni.redirectTo({
                                                        url: "/pages/zhuangxiang/snZhuangxiang_xiaowei"
                                                    })
                                                }
                                                if(cancel) {
                                                    uni.navigateBack()
                                                }
                                            }
                                        })
                                    }else {
                                        uni.showToast({
                                            icon:'none',
                                            title: Message
                                        })
                                    }
                                }
                            })
            },
            cmdExit() {
                uni.navigateBack()
            }
        },
        computed: {
            listTableHeight: {
                get() {
                    return this.bottomBtnTop - this.listTableTop - 10
                }
            }
        },
        async onReady() {
            // #ifndef MP-WEIXIN
            let query = uni.createSelectorQuery().in(this)
            query.select("#bottom-btn")
                .boundingClientRect((data) => {
                    if (data) {
                        this.bottomBtnTop = data.top
                    } else {
                        console.log("未找到#bottom-btn节点");
                    }
                })
                .exec();
            query.select("#list-table")
                .boundingClientRect((data) => {
                    if (data) {
                        this.listTableTop = data.top
                    } else {
                        console.log("未找到#list-table节点");
                    }
                })
                .exec();
            // #endif
        },
        onLoad(e) {
            this.OperationType = e.OperationType || 1
            this.HBarCode_Pack_Temp = e.CommonUtils || ""
            // if (this.OperationType == 1) {
            //     this.getMaxNo()
            // } else if (this.OperationType == 2) {
            // }
            this.HBarCodePackFocusRefresh()
        }
    }
</script>
<style lang="scss">
    input {
        width: inherit;
        padding: 8rpx 20rpx;
        font-size: 30rpx;
    }
    .form {
        display: flex;
        flex-direction: column;
        gap: 20rpx;
        .form-base-info {
            display: flex;
            flex-direction: column;
            gap: 10rpx;
            box-sizing: border-box;
            padding: 30rpx;
        }
        .bill-info {
            display: flex;
            flex-direction: column;
            gap: 10rpx;
            box-sizing: border-box;
            padding: 16rpx 30rpx;
        }
        .form-item {
            display: flex;
            flex-direction: row;
            gap: 10rpx;
            .title {
                width: 5rem;
                flex-shrink: 0;
            }
            .right {
                flex: 1;
                border-radius: 22rpx;
                border: 1px solid #acacac;
            }
            .disabled {
                border: 1px solid #e4e4e4;
                background-color: #e4e4e4;
            }
            .right-icon {
                flex-shrink: 0;
                display: flex;
                justify-content: center;
                align-items: center;
            }
        }
    }
    .tabs {
        width: 100%;
        display: flex;
        border-bottom: 1px solid #ddd;
        margin: 20rpx 0;
        view {
            width: 25%;
            font-size: 30rpx;
            color: #555;
            text-align: center;
            padding: 16rpx 0;
        }
        .on {
            color: #3a78ff;
            font-weight: bold;
            border-bottom: 3px solid #3a78ff;
        }
    }
    .bottom-btn {
        width: 100%;
        box-sizing: border-box;
        // height: 120rpx;
        position: fixed;
        bottom: 0;
        left: 0;
        background-color: #fff;
        box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
        padding: 30rpx 40rpx 40rpx 40rpx;
        display: flex;
        flex-direction: row;
        gap: 10rpx;
        button {
            border-radius: 50rpx;
            width: 180rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a {
            background-color: #3A78FF;
            color: #fff;
        }
        .btn-b {
            background-color: #41a863;
            color: #fff;
        }
        .btn-c {
            background-color: #acacac;
            color: #fff;
            // position: absolute;
            // right: 120rpx;
        }
        .btn-d {
            background-color: #ff8901;
            color: #fff;
        }
    }
</style>