pang.jiabao
9 小时以前 796e7c646e4d40ab55e62f7454893dfd0dc28ffb
订单组托,领料出库功能完善
2个文件已修改
231 ■■■■ 已修改文件
pages/order/callReqOutbound.vue 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/order/orderSelect.vue 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/order/callReqOutbound.vue
@@ -72,6 +72,12 @@
                                </view>
                            </view>
                            <view class="info-row">
                                <view class="info-label">工单号:</view>
                                <view class="info-value">
                                    <text class="tag tag-info">{{orderDetl.standby1 || '-'}}</text>
                                </view>
                            </view>
                            <view class="info-row">
                                <view class="info-label">料号:</view>
                                <view class="info-value">
                                    <text class="tag tag-primary">{{orderDetl.matnr || '-'}}</text>
@@ -195,12 +201,28 @@
        methods: {
            // 重置选中状态
            reset() {
                for (let k of this.dataList) {
                    this.$set(k, 'checked', false)
                }
                this.orderNo = ''
                this.updateSelectAllTitle()
                this.filterMatnr = ''
                this.dataList = []
                this.filteredList = []
                this.idList = []
                this.total = 0
                this.seltitle = '全选'
            },
            // reset() {
            //     for (let k of this.dataList) {
            //         this.$set(k, 'checked', false)
            //     }
            //     this.orderNo = ''
            //     this.updateSelectAllTitle()
            // },
            onFilterInput() {
                this.applyFilter()
            },
@@ -258,19 +280,14 @@
                    const missingStaNo = pickList.filter(item => {
                        return item.staNos && item.staNos.length > 0 && !item.selectedStaNo
                    })
                    if (missingStaNo.length > 0) {
                        uni.showModal({
                            title: '提示',
                            content: `有 ${missingStaNo.length} 个物料未选择出库口,是否继续?`,
                            confirmText: '继续',
                            cancelText: '取消',
                            success: (res) => {
                                if (res.confirm) {
                                    this.submitPickList(pickList)
                                }
                            }
                        uni.showToast({
                            title: '存在未选择出库口的物料',
                            icon: 'none',
                            position: 'center'
                        })
                        return
                    }
                    
@@ -290,7 +307,9 @@
                        anfme: item.anfme,              // 可用数量
                        orderNo: item.orderNo,          // 订单号
                        staNo: item.selectedStaNo, // 选中的出库口
                        standby1: item.standby1,
                        // 添加其他需要的字段
                    }
                })
                
@@ -299,7 +318,8 @@
            },
            // 直接调用出库接口的方法
            outboundRequest(submitData) {
                console.info(submitData)
                // console.info(submitData)
                let that = this
                uni.showLoading({ title: '出库中...', mask: true })
                
                uni.request({
@@ -322,18 +342,21 @@
                        }
                        
                        if (result.code === 200) {
                            uni.showToast({
                                title: `成功出库 ${submitData.length} 个物料`,
                                icon: "success"
                            })
                                uni.showToast({
                                    title: `成功出库 ${submitData.length} 个物料`,
                                    icon: "success"
                                })
                            
                            // 出库成功后,刷新列表或返回上一页
                            setTimeout(() => {
                                // 刷新当前列表
                                this.getOrderDet()
                                // 或者返回上一页
                                // uni.navigateBack({})
                            }, 1500)
                                // 清空旧数据
                                that.dataList = []
                                that.filteredList = []
                                // 刷新列表
                                setTimeout(() => {
                                    that.getOrderDet()
                                }, 800)
                        } else if (result.code === 403) {
                            uni.showToast({ title: result.msg || '登录已过期', icon: "error" })
                            setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1500);
pages/order/orderSelect.vue
@@ -13,7 +13,26 @@
                    <uni-combox :candidates="orderNoList" placeholder="请选择订单" v-model="orderNo" @input="getOrderDet"></uni-combox>
                </view>
            </view>
            <!-- 物料码扫描 -->
            <view class="filter-item">
                <view class="filter-label">
                    <uni-icons type="scan" size="18" color="#67C23A"></uni-icons>
                    <text>物料码</text>
                </view>
            
                <view class="filter-input">
                    <input
                        type="text"
                        v-model="scanCode"
                        placeholder="扫描物料二维码"
                        confirm-type="done"
                        class="filter-input-field"
                        placeholder-class="placeholder-style"
                        :focus="true"
                        @input="onScanInput"
                    />
                </view>
            </view>
            <!-- 物料编号过滤 -->
            <view class="filter-item">
                <view class="filter-label">
@@ -148,7 +167,8 @@
                orderNo: '',
                orderNoList: [],
                seltitle: '全选',
                filterMatnr: ''
                filterMatnr: '',
                scanCode: ''
            }
        },
        onShow() {
@@ -170,17 +190,125 @@
            this.getOrderNoList()
        },
        methods: {
            onFilterInput() {
                    let that = this
                    // 方法1:分割成数组
                    let arr = that.filterMatnr.split('|')
                    // 方法2:遍历每一段
                    arr.forEach((item, index) => {
                      switch(index){
                            case 2: that.filterMatnr = item
                                break;
                      }
            onScanInput(e) {
                let value = e.detail.value
                // 有些扫码枪最后会带回车
                value = value.replace(/\r|\n/g, '')
                this.scanCode = value
                // 判断扫码格式是否完整
                // 例如:
                // 001|PPP6|YJ2026050514464499|205050506|fsd
                let arr = value.split('|')
                // 满5段认为扫码完成
                if (arr.length >= 5) {
                    // 延迟一点,避免输入未完成
                    setTimeout(() => {
                        this.handleScanCode()
                    }, 50)
                }
            },
            handleScanCode() {
                let code = this.scanCode
                if (!code || code.trim() === '') {
                    return
                }
                code = code.trim()
                // 分割二维码
                let arr = code.split('|')
                if (arr.length < 5) {
                    uni.showToast({
                        title: '二维码格式错误',
                        icon: 'none'
                    })
                    this.scanCode = ''
                    return
                }
                // 提取字段
                let standby1 = (arr[1] || '').trim()
                let matnr = (arr[2] || '').trim()
                let batch = (arr[3] || '').trim()
                console.log('工单号:', standby1)
                console.log('料号:', matnr)
                console.log('批号:', batch)
                // 查找匹配
                let target = this.dataList.find(item => {
                    let itemStandby1 = (item.standby1 || '').trim()
                    let itemMatnr = (item.matnr || '').trim()
                    let itemBatch = (item.batch || '').trim()
                    return itemStandby1 === standby1
                        && itemMatnr === matnr
                        && itemBatch === batch
                })
                // 匹配成功
                if (target) {
                    // 已扫描
                    if (target.checked) {
                        uni.showToast({
                            title: '该物料已扫描',
                            icon: 'none'
                        })
                    } else {
                        this.$set(target, 'checked', true)
                        uni.showToast({
                            title: '匹配成功',
                            icon: 'success'
                        })
                    }
                    this.updateSelectAllTitle()
                } else {
                    // 未匹配提示详细内容
                    uni.showModal({
                        title: '未匹配到物料',
                        content:
                            '工单号:' + (standby1 || '空') +
                            '\n料号:' + (matnr || '空') +
                            '\n批号:' + (batch || '空'),
                        showCancel: false
                    })
                }
                // 清空输入框
                this.scanCode = ''
            },
            onFilterInput() {
                    // let that = this
                    // // 方法1:分割成数组
                    // let arr = that.filterMatnr.split('|')
                    // // 方法2:遍历每一段
                    // arr.forEach((item, index) => {
                    //   switch(index){
                    //         case 2: that.filterMatnr = item
                    //             break;
                    //   }
                    // })
                this.applyFilter()
            },
            
@@ -392,7 +520,7 @@
.filter-item {
    display: flex;
    align-items: center;
    padding: 24rpx 32rpx;
    padding: 15rpx 15rpx;
    border-bottom: 1px solid #f0f0f0;
}
@@ -401,7 +529,7 @@
}
.filter-label {
    width: 140rpx;
    width: 160rpx;
    display: flex;
    align-items: center;
    gap: 12rpx;