chenhaozhe
2025-12-04 77e696ef8693d054ff78154a6a97794aff21d74a
Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev
1个文件已修改
87 ■■■■ 已修改文件
pages/fenbushidiaochudan/form_out.vue 87 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/fenbushidiaochudan/form_out.vue
@@ -401,8 +401,7 @@
                arrayHMainSourceBillType: ['发货通知单', '调拨申请单',
                     '手工录入'
                ],
                arrayHMainSourceBillValue: [1402, 1243, 3720, 1604,
                    1214, 3721, 1242, -1
                arrayHMainSourceBillValue: [1402, 1243, -1
                ],
                linterid: '',
@@ -442,6 +441,9 @@
                Materlist: [],
                FIFOlist: [],
                hform: {
                    inOrgID: '',
                    outOrgID: '',
                    HBillType: 1250,
                    HBillSubType: "",
                    HBillerID: uni.getStorageSync('HBillerID'),
@@ -535,10 +537,28 @@
            this.getRelationStore()
            this.GetSourceBillType()
            uni.$on('BillSelectComplete', (e) => {
            uni.$on('BillSelectComplete', async (e) => {
                console.log("接收到的消息: ", e.HBillNo)
                this.getHBarCodeData(e.HBillNo)
                try {
                    // 等待获取源单数据并回填表头
                    await this.getHBarCodeData(e.HBillNo)
                    // 如果源单类型是 调拨申请单(值可能是 1243),则根据返回的调入组织刷新调入组织名称及仓库
                    const isApplyTransfer = (this.hform.HMainSourceBillType == 1243) || (this.HMainSourceBillType == '调拨申请单')
                    if (isApplyTransfer) {
                        // hform.HStockInOrgID 已在 getHBarCodeData 中回填(若接口返回),这里根据 ID 找到名称并更新仓库列表
                        const inOrgIndex = this.arrayHOrgValue.findIndex(v => v == this.hform.HStockInOrgID)
                        if (inOrgIndex != -1) {
                            this.hform.HStockInOrgName = this.arrayHOrgName[inOrgIndex]
                        }
                        // 刷新调入仓库(传入组织名称或默认 organization)
                        this.getHWarehouseInList(this.hform.HStockInOrgName || uni.getStorageSync('Organization'))
                    }
                } catch (err) {
                    console.warn('获取源单回填失败: ', err)
                } finally {
                this.$refs.billList.exit()
                }
            })
        },
        onUnload() {
@@ -1124,6 +1144,10 @@
                            this.arrayHMainSourceBillType.push('手工录入')
                            this.arrayHMainSourceBillValue.push('-1')
                            this.arrayHMainSourceBillType.push('发货通知单')
                            this.arrayHMainSourceBillValue.push('1402')
                            this.arrayHMainSourceBillType.push('调拨申请单')
                            this.arrayHMainSourceBillValue.push('1243')
                            //如果手工录入不用选择源单
                            if (this.arrayHMainSourceBillType[0] == '手工录入') {
                                this.tabs = 1
@@ -1405,6 +1429,7 @@
            },
            //选中源单
            getHBarCodeData(HBarCode) {
                return new Promise((resolve, reject) => {
                if (!this.hform.HFIFOWHName) {
                    this.hform.HFIFOWHID = 0
                }
@@ -1434,14 +1459,34 @@
                            }
                            this.hform.HSourceBillNo = data.hSourceBillNoField
                            this.showHMainSourceBillType = false
                                this.hform.HStockStyle = data.hStockStyleField
                            if (data.hMulSourceFlagField == 0) {
                                this.showHSourceBillNo = false
                            }
                                // 如果接口返回了组织相关字段,则填充调入/调出组织
                                if (data.hStockInOrgIDField !== undefined || data.hStockOutOrgIDField !== undefined) {
                                    // 有些接口返回字段名可能不同,兼容处理
                                    this.hform.inOrgID = data.hStockInOrgIDField || data.HStockInOrgID || data.HStockInOrgId
                                    this.hform.outOrgID = data.hStockOutOrgIDField || data.HStockOutOrgID || data.HStockOutOrgId
                                    if (this.hform.inOrgID !== undefined && this.hform.inOrgID !== null) {
                                        this.hform.HStockInOrgID = this.hform.inOrgID
                                        const idx = this.arrayHOrgValue.findIndex(e => e == this.hform.inOrgID)
                                        if (idx != -1) this.hform.HStockInOrgName = this.arrayHOrgName[idx]
                                    }
                                    if (this.hform.outOrgID !== undefined && this.hform.outOrgID !== null) {
                                        this.hform.HStockOutOrgID = this.hform.outOrgID
                                        const idx2 = this.arrayHOrgValue.findIndex(e => e == this.hform.outOrgID)
                                        if (idx2 != -1) this.hform.HStockOutOrgName = this.arrayHOrgName[idx2]
                                    }
                                }
                            this.tabs = 2
                            this.showHSupName = false
                            this.barCodeFocus = true
                            this.playSound(1)
                            this.DisBillEntryList()
                                resolve(res.data.data)
                        } else {
                            this.playSound(0)
                            console.log('res: ', res);
@@ -1455,6 +1500,7 @@
                                this.hform.HSourceBillNo = ""
                                this.HSourcebillNoFocus = true
                            })
                                reject(res.data.Message)
                        }
                    },
                    fail: (err) => {
@@ -1469,8 +1515,10 @@
                            this.hform.HSourceBillNo = ""
                            this.HSourcebillNoFocus = true
                        })
                            reject(err)
                    },
                });
                })
            },
            //扫条码处理
            async getCode(HBarCode) {
@@ -1606,14 +1654,14 @@
                                SourceFlag: HSourceFlag,
                                HSourceBillNo: sSourceBillNo,
                                HSourceBillType: sSourceBillType,
                                HStockInOrgID: this.hform.HStockOrgID,
                                HStockOutOrgID: this.hform.HStockOutOrgID,
                                HStockInOrgID: this.hform.inOrgID||this.hform.HStockInOrgID,
                                HStockOutOrgID: this.hform.outOrgID||this.hform.HStockOutOrgID,
                                HScanStyle: "",
                                HCustom1: "",
                                HCustom2: ""
                            },
                        })
                        console.log('fanhuizuzhi ', this.hform.inOrgID,this.hform.outOrgID);
                        if (!res) {
                            return
                        }
@@ -2131,14 +2179,14 @@
                                    this.showHSupName = false
                                }
                            }
                            // if (data.HSourceBillType == 1402) {
                            //     this.hform.HMainSourceBillType = 1402
                            //     this.HMainSourceBillType = '发货通知单'
                            //     this.showHSupName = false
                            // } else if (data.HSourceBillType == 1243) {
                            //     this.hform.HMainSourceBillType = 1243
                            //     this.HMainSourceBillType = '调拨申请单'
                            //     this.showHSupName = false
                            if (data.HSourceBillType == 1402) {
                                this.hform.HMainSourceBillType = 1402
                                this.HMainSourceBillType = '发货通知单'
                                this.showHSupName = false
                            } else if (data.HSourceBillType == 1243) {
                                this.hform.HMainSourceBillType = 1243
                                this.HMainSourceBillType = '调拨申请单'
                                this.showHSupName = false
                            // } else if (data.HSourceBillType == 3720) {
                            //     this.hform.HMainSourceBillType = 3720
                            //     this.HMainSourceBillType = '生产用料清单'
@@ -2159,10 +2207,10 @@
                            //     this.hform.HMainSourceBillType = 1242
                            //     this.HMainSourceBillType = '出库申请单'
                            //     this.showHSupName = false
                            // } else {
                            //     this.hform.HMainSourceBillType = -1
                            //     this.HMainSourceBillType = '手工录入'
                            // }
                            } else {
                                this.hform.HMainSourceBillType = -1
                                this.HMainSourceBillType = '手工录入'
                            }
                            this.showHMainSourceBillType = false
                            //非多源单模式
@@ -2174,7 +2222,6 @@
                            this.hform.HSupID = data.HCusID
                            this.hform.HSupName = data.HCusName
                            this.hform.HStockStyle = data.HStockStyle
                            let HStockInOrgIndex = this.arrayHOrgValue.findIndex(e => e == data
                                .HStockInOrgID)
                            let HStockOutOrgIndex = this.arrayHOrgValue.findIndex(e => e == data